From f7979ef91415c281f7ff66123361f400bf601e57 Mon Sep 17 00:00:00 2001 From: manolobevia Date: Mon, 20 Jun 2011 16:35:00 +0000 Subject: [PATCH 01/13] NIHVIVO-2311: Removed About, Contact, and Support from header nav. Added Support link to footer. --- webapp/web/themes/vitro/templates/footer.ftl | 1 + webapp/web/themes/vitro/templates/identity.ftl | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/webapp/web/themes/vitro/templates/footer.ftl b/webapp/web/themes/vitro/templates/footer.ftl index ada24d0df..fc258004a 100644 --- a/webapp/web/themes/vitro/templates/footer.ftl +++ b/webapp/web/themes/vitro/templates/footer.ftl @@ -25,6 +25,7 @@ <#if urls.contact??>
  • Contact Us
  • +
  • Support
  • diff --git a/webapp/web/themes/vitro/templates/identity.ftl b/webapp/web/themes/vitro/templates/identity.ftl index 41b24a35e..9dc27d3ba 100644 --- a/webapp/web/themes/vitro/templates/identity.ftl +++ b/webapp/web/themes/vitro/templates/identity.ftl @@ -18,12 +18,6 @@ <#else>
  • Log in
  • - <#-- List of links that appear in submenus, like the header and footer. --> -
  • About
  • - <#if urls.contact??> -
  • Contact Us
  • - -
  • Support
  • Index
  • From f49d3af301b278a9c0162956be798db756fa007a Mon Sep 17 00:00:00 2001 From: manolobevia Date: Mon, 20 Jun 2011 17:36:01 +0000 Subject: [PATCH 02/13] NIHVIVO-2280: Removed word OPTIONAL in External AUTH ID label. --- .../templates/freemarker/body/accounts/userAccounts-edit.ftl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl index e6e2e0374..2117e3b5e 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl @@ -65,7 +65,7 @@ - + <#if roles?has_content> From 1edae6b6519e24b0d87b8a3cc1bb063deb05c329 Mon Sep 17 00:00:00 2001 From: brianjlowe Date: Mon, 20 Jun 2011 18:25:50 +0000 Subject: [PATCH 03/13] NIHVIVO-2617 restored assertions-only filtering for individual lists --- .../webapp/dao/jena/IndividualDaoSDB.java | 201 ++++++++++++------ 1 file changed, 136 insertions(+), 65 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualDaoSDB.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualDaoSDB.java index 7e12cf122..eaaf641d2 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualDaoSDB.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/IndividualDaoSDB.java @@ -10,6 +10,7 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.joda.time.DateTime; @@ -26,18 +27,14 @@ import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.rdf.model.AnonId; import com.hp.hpl.jena.rdf.model.Literal; -import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.RDFNode; -import com.hp.hpl.jena.rdf.model.ResIterator; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.ResourceFactory; import com.hp.hpl.jena.rdf.model.Statement; import com.hp.hpl.jena.rdf.model.StmtIterator; import com.hp.hpl.jena.shared.Lock; import com.hp.hpl.jena.util.iterator.ClosableIterator; -import com.hp.hpl.jena.vocabulary.OWL; -import com.hp.hpl.jena.vocabulary.RDF; import com.hp.hpl.jena.vocabulary.RDFS; import edu.cornell.mannlib.vitro.webapp.beans.Individual; @@ -105,67 +102,42 @@ public class IndividualDaoSDB extends IndividualDaoJena { ents.addAll(getIndividualsByVClass(vc)); } } else { - DatasetWrapper w = getDatasetWrapper(); - Dataset dataset = w.getDataset(); - dataset.getLock().enterCriticalSection(Lock.READ); - try { - String[] graphVars = {"?g", "?h", "?i"}; - String query = - "SELECT DISTINCT ?ind ?label ?moniker " + - "WHERE " + - "{ \n" + - "{ ?ind a <" + theClass.getURI() + "> } \n" + - "UNION { \n" + - " ?ind a <" + theClass.getURI() + "> . \n" + - " ?ind <" + RDFS.label.getURI() + "> ?label \n" + - "} \n" + - "UNION { \n" + - " ?ind a <" + theClass.getURI() + "> . \n" + - " ?ind <" + VitroVocabulary.MONIKER + "> ?moniker \n" + - "} \n" + - "} ORDER BY ?ind ?label"; - ResultSet rs =QueryExecutionFactory.create( - QueryFactory.create(query), dataset) - .execSelect(); - String uri = null; - String label = null; - String moniker = null; - while (rs.hasNext()) { - QuerySolution sol = rs.nextSolution(); - Resource currRes = sol.getResource("ind"); - if (currRes.isAnon()) { - continue; - } - if (uri != null && !uri.equals(currRes.getURI())) { - Individual ent = makeIndividual(uri, label, moniker); - if (ent != null) { - ents.add(ent); - } - uri = currRes.getURI(); - label = null; - moniker = null; - } else if (uri == null) { - uri = currRes.getURI(); - } - Literal labelLit = sol.getLiteral("label"); - if (labelLit != null) { - label = labelLit.getLexicalForm(); - } - Literal monikerLit = sol.getLiteral("moniker"); - if (monikerLit != null) { - moniker = monikerLit.getLexicalForm(); - } - if (!rs.hasNext()) { - Individual ent = makeIndividual(uri, label, moniker); - if (ent != null) { - ents.add(ent); - } - } - } - } finally { - dataset.getLock().leaveCriticalSection(); - w.close(); - } + + List individualList; + + // Check if there is a graph filter. + // If so, we will use it in a slightly strange way. Unfortunately, + // performance is quite bad if we add several graph variables in + // order to account for the fact that an individual's type + // declaration may be in a different graph from its label or + // moniker. Thus, we will run two queries: one with a single + // graph variable to get the list of URIs, and a second against + // the union graph to get individuals with their labels and + // monikers. We will then toss out any individual in the second + // list that is not also in the first list. + // Annoying, yes, but better than the alternative. + // Note that both queries need to sort identically or + // the results may be very strange. + String[] graphVars = {"?g"}; + String filterStr = WebappDaoFactorySDB.getFilterBlock( + graphVars, datasetMode); + if (!StringUtils.isEmpty(filterStr)) { + List graphFilteredIndividualList = + getGraphFilteredIndividualList(theClass, filterStr); + List unfilteredIndividualList = getIndividualList( + theClass); + Iterator unfilteredIt = unfilteredIndividualList + .iterator(); + for (Individual filt : graphFilteredIndividualList) { + Individual unfilt = unfilteredIt.next(); + while (!unfilt.getURI().equals(filt.getURI())) { + unfilt = unfilteredIt.next(); + } + ents.add(unfilt); + } + } else { + ents = getIndividualList(theClass); + } } java.util.Collections.sort(ents); @@ -181,6 +153,105 @@ public class IndividualDaoSDB extends IndividualDaoJena { return ents; } + + private List getIndividualList(Resource theClass) { + List ents = new ArrayList(); + DatasetWrapper w = getDatasetWrapper(); + Dataset dataset = w.getDataset(); + dataset.getLock().enterCriticalSection(Lock.READ); + try { + + String query = + "SELECT DISTINCT ?ind ?label ?moniker " + + "WHERE " + + "{ \n" + + "{ ?ind a <" + theClass.getURI() + "> } \n" + + "UNION { \n" + + " ?ind a <" + theClass.getURI() + "> . \n" + + " ?ind <" + RDFS.label.getURI() + "> ?label \n" + + "} \n" + + "UNION { \n" + + " ?ind a <" + theClass.getURI() + "> . \n" + + " ?ind <" + VitroVocabulary.MONIKER + "> ?moniker \n" + + "} \n" + + "} ORDER BY ?ind ?label"; + ResultSet rs =QueryExecutionFactory.create( + QueryFactory.create(query), dataset) + .execSelect(); + String uri = null; + String label = null; + String moniker = null; + while (rs.hasNext()) { + QuerySolution sol = rs.nextSolution(); + Resource currRes = sol.getResource("ind"); + if (currRes.isAnon()) { + continue; + } + if (uri != null && !uri.equals(currRes.getURI())) { + Individual ent = makeIndividual(uri, label, moniker); + if (ent != null) { + ents.add(ent); + } + uri = currRes.getURI(); + label = null; + moniker = null; + } else if (uri == null) { + uri = currRes.getURI(); + } + Literal labelLit = sol.getLiteral("label"); + if (labelLit != null) { + label = labelLit.getLexicalForm(); + } + Literal monikerLit = sol.getLiteral("moniker"); + if (monikerLit != null) { + moniker = monikerLit.getLexicalForm(); + } + if (!rs.hasNext()) { + Individual ent = makeIndividual(uri, label, moniker); + if (ent != null) { + ents.add(ent); + } + } + } + } finally { + dataset.getLock().leaveCriticalSection(); + w.close(); + } + return ents; + } + + private List getGraphFilteredIndividualList(Resource theClass, + String filterStr) { + List filteredIndividualList = new ArrayList(); + DatasetWrapper w = getDatasetWrapper(); + Dataset dataset = w.getDataset(); + dataset.getLock().enterCriticalSection(Lock.READ); + try { + String query = + "SELECT DISTINCT ?ind ?label ?moniker " + + "WHERE " + + "{ GRAPH ?g { \n" + + "{ ?ind a <" + theClass.getURI() + "> } \n" + + " } \n" + filterStr + + "} ORDER BY ?ind"; + ResultSet rs =QueryExecutionFactory.create( + QueryFactory.create(query), dataset) + .execSelect(); + while (rs.hasNext()) { + QuerySolution sol = rs.nextSolution(); + Resource currRes = sol.getResource("ind"); + if (currRes.isAnon()) { + continue; + } + filteredIndividualList.add( + makeIndividual(currRes.getURI(), null, null)); + } + } finally { + dataset.getLock().leaveCriticalSection(); + w.close(); + } + return filteredIndividualList; + } private Individual makeIndividual(String uri, String label, String moniker) { Individual ent = new IndividualSDB(uri, From a5488317d0b0845d9266ea0a666d26ae4e151f20 Mon Sep 17 00:00:00 2001 From: manolobevia Date: Mon, 20 Jun 2011 18:55:48 +0000 Subject: [PATCH 04/13] NIHVIVO-2588: Move styles and images for user menu dropdown to vitro.css --- webapp/web/css/vitro.css | 89 +++++++++++++++++++++ webapp/web/images/arrowDownAccount.gif | Bin 0 -> 175 bytes webapp/web/images/arrowDownOverAccount.gif | Bin 0 -> 56 bytes webapp/web/images/arrowMenuAccount.gif | Bin 0 -> 170 bytes 4 files changed, 89 insertions(+) create mode 100644 webapp/web/images/arrowDownAccount.gif create mode 100644 webapp/web/images/arrowDownOverAccount.gif create mode 100644 webapp/web/images/arrowMenuAccount.gif diff --git a/webapp/web/css/vitro.css b/webapp/web/css/vitro.css index 1b8b1d2c6..24c265cc0 100644 --- a/webapp/web/css/vitro.css +++ b/webapp/web/css/vitro.css @@ -113,4 +113,93 @@ .searchTOC ul a { display: block; padding-left: 15px; +} + +/* -------------------------------------------------> */ +/* DROP DOWN USER MENU ----------------------------> */ +/* -------------------------------------------------> */ + +/* LEVEL ONE */ +ul.dropdown { + position: relative; +} +ul.dropdown li { + float: left; + zoom: 1; + padding: 0 !important; +} +ul.dropdown li a { + display: block; + font-size: 1.4em; +} +ul.dropdown li#user-menu { + background: url(../images/arrowDownOverAccount.gif) right 9px no-repeat; + min-width:110px; +} +ul.dropdown li#user-menu a { + margin-right: 28px; + margin-left:10px; +} +ul.dropdown li#user-menu.hover, +ul.dropdown li#user-menu:hover { + color: #000 !important; + position: relative; + background: #fff url(../images/arrowDownAccount.gif) right 9px no-repeat; + border-bottom: 1px solid #cdcfcf; +} +ul.dropdown li.hover a, +ul.dropdown li:hover a { + color: #000 !important; + margin-left:10px; +} +/* LEVEL TWO */ +ul.dropdown ul.sub_menu { + background-color: #fff; + font-size: 1.4em; + visibility: hidden; + position: absolute; + top: 100%; + right: 0; + z-index: 999; + color: #000; +} +ul.dropdown ul.sub_menu li { + float: none; + clear: both; + padding-left: 14px !important; + width: 96px; + border-right: none !important; + border-bottom: 1px solid #cdcfcf; + background: #fff url(../images/arrowMenuAccount.gif) 7px 8px no-repeat; +} +ul.dropdown ul.sub_menu li:last-child { + width: 96px; +} +/* IE 6 & 7 Needs Inline Block */ +/* ADD IN IE6.css and IE7.css*/ +ul.dropdown ul.sub_menu li a { + width: 90%; + display: inline-block; + color: #000 !important; + background-color: #fff; + padding: 0; + padding-left: 0px; + height: 24px; +} +ul.dropdown ul.sub_menu li.inactive { + color: #aab0ae !important; + font-size: 1em !important; + padding-left: 22px !important; + width: 88px; +} +ul.dropdown ul.sub_menu li a:hover, +ul.dropdown ul.sub_menu li a.hover { + color: #999 !important; +} +/* LEVEL THREE */ +ul.dropdown ul ul { + left: 100%; top: 0; +} +ul.dropdown li:hover > ul { + visibility: visible; } \ No newline at end of file diff --git a/webapp/web/images/arrowDownAccount.gif b/webapp/web/images/arrowDownAccount.gif new file mode 100644 index 0000000000000000000000000000000000000000..0f5463ebaa8ae4b7964f0e3a94a809cac6de77c7 GIT binary patch literal 175 zcmZ?wbhEHb6lY*(IKsg2`Rg~!*!;#BORn5`U>uPxWE*_*!IMv4zCC~Q?$WLMN6ue; z|LKcSc-F@+U-_&8xy<}bBXh6cf5c?q@&EsS1|opsPZmZ724MyrkXn$P46Hf}6naxM wHG@~J^Guw^v+3N*k9&klF4R1k(ZZH5v9njg#EC^^Wht4NfByVA zcmDj5qenAxbMM{1|Ni~^sWWEe6cl{<`gO+a*-xH6t*Wc5uCKpw>(;-2{|+BL`t#?{ zxa8#j|Nk?9f#OdVMg|611|1L&WG4fwdP2BhENA42uq+wzmEH>qj$KI&sV+Hu)UwB^ TiCLf|Vv@V& Date: Mon, 20 Jun 2011 19:02:52 +0000 Subject: [PATCH 05/13] NIHVIVO-2311: Added dropdown user menu to header nav. --- .../web/themes/vitro/templates/identity.ftl | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/webapp/web/themes/vitro/templates/identity.ftl b/webapp/web/themes/vitro/templates/identity.ftl index 9dc27d3ba..645f67354 100644 --- a/webapp/web/themes/vitro/templates/identity.ftl +++ b/webapp/web/themes/vitro/templates/identity.ftl @@ -9,17 +9,29 @@ - - - -<#assign nameForOtherGroup = "other"> <#-- used by both individual-propertyGroupMenu.ftl and individual-properties.ftl --> -

    Menu management

    -<#-- Menu Ontology properties --> -<#include "individual-menu-properties.ftl"> +<#assign hasElement = propertyGroups.pullProperty("${namespaces.display}hasElement")> +<#-- List the menu items --> +<#list hasElement.statements as statement> + <#-- can we just provide the name of the template? --> + Position | <#include "${hasElement.template}"> | <@p.editingLinks "hasElement" statement editable />
    + + +
    <#-- remove this once styles are applied --> + +<#-- Link to add a new menu item --> +<#if editable> + <#assign addUrl = hasElement.addUrl> + <#if addUrl?has_content> + Add menu item + + + +<#-- Remove unneeded scripts and stylesheets --> ${stylesheets.add('', '')} diff --git a/webapp/web/templates/freemarker/body/partials/individual/individual-menu-properties.ftl b/webapp/web/templates/freemarker/body/partials/individual/individual-menu-properties.ftl deleted file mode 100644 index 06870cc31..000000000 --- a/webapp/web/templates/freemarker/body/partials/individual/individual-menu-properties.ftl +++ /dev/null @@ -1,24 +0,0 @@ -<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> - -<#-- Template for menu management page --> - -<#import "lib-properties.ftl" as p> - -<#list propertyGroups.all as group> - <#assign groupName = group.getName(nameForOtherGroup)> - - <#-- Display the group heading --> - <#if groupName?has_content> -

    ${groupName?capitalize}

    - - - <#-- List the menu items(properties) in the group --> - <#list group.properties as property> - <#if property.localName == "hasElement"> - <#-- List menu Items --> - <@p.objectProperty property editable property.template /> -
    <#--remove break--> - <@p.addLink property editable /> - - - \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl b/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl index 89d82af59..47f27fff0 100644 --- a/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl +++ b/webapp/web/templates/freemarker/body/partials/individual/lib-properties.ftl @@ -75,11 +75,7 @@ Assumes property is non-null. --> <#macro objectPropertyList property editable statements=property.statements template=property.template> <#list statements as statement> - <#if property.localName == "hasElement"> - <@menuItem property statement editable><#include "${template}"> - <#else> <@propertyListItem property statement editable><#include "${template}"> - @@ -96,14 +92,9 @@ name will be used as the label. --> <#macro addLink property editable label="${property.name}" extraParams=""> <#if editable> - <#--@dump var="property"/--> <#local url = property.addUrl> <#if url?has_content> - <#if property.localName == "hasElement"> - <@showAddMenuItemLink property.localName label addParamsToEditUrl(url, extraParams) /> - <#else> - <@showAddLink property.localName label addParamsToEditUrl(url, extraParams) /> - + <@showAddLink property.localName label addParamsToEditUrl(url, extraParams) /> @@ -249,12 +240,3 @@ name will be used as the label. --> <@editingLinks "label" label editable /> -<#-- Add menu item button --> -<#macro showAddMenuItemLink propertyLocalName label url> - Add menu item - - -<#-- List menu items --> -<#macro menuItem property statement editable > - Position | <#nested> | <@editingLinks "${property.localName}" statement editable/>
    - From 8e3764b7b748eb7ea280d6b77d13bb96af4a29b3 Mon Sep 17 00:00:00 2001 From: ryounes Date: Tue, 21 Jun 2011 20:03:57 +0000 Subject: [PATCH 13/13] Minor changes to menu template --- .../templates/freemarker/body/individual/individual-menu.ftl | 3 --- 1 file changed, 3 deletions(-) diff --git a/webapp/web/templates/freemarker/body/individual/individual-menu.ftl b/webapp/web/templates/freemarker/body/individual/individual-menu.ftl index d3c3860ee..98aa83d7c 100644 --- a/webapp/web/templates/freemarker/body/individual/individual-menu.ftl +++ b/webapp/web/templates/freemarker/body/individual/individual-menu.ftl @@ -2,8 +2,6 @@ <#-- Menu management page (uses individual display mechanism) --> -<#import "lib-properties.ftl" as p> - <#include "individual-setup.ftl">

    Menu management

    @@ -12,7 +10,6 @@ <#-- List the menu items --> <#list hasElement.statements as statement> - <#-- can we just provide the name of the template? --> Position | <#include "${hasElement.template}"> | <@p.editingLinks "hasElement" statement editable />