From e51da9ac4e4a6c078923eceb3ab2aa0f60f61c51 Mon Sep 17 00:00:00 2001 From: Ted Lawless Date: Thu, 8 Jan 2015 08:11:41 -0500 Subject: [PATCH 1/8] SPARQL update API comments in permission_config.n3 Change security update comment from SSH to HTTPs. Adjust formatting to match rest of file. --- webapp/rdf/auth/everytime/permission_config.n3 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/webapp/rdf/auth/everytime/permission_config.n3 b/webapp/rdf/auth/everytime/permission_config.n3 index f4d4b0665..172c55ca8 100644 --- a/webapp/rdf/auth/everytime/permission_config.n3 +++ b/webapp/rdf/auth/everytime/permission_config.n3 @@ -25,12 +25,12 @@ auth:ADMIN auth:hasPermission simplePermission:UseAdvancedDataToolsPages ; auth:hasPermission simplePermission:UseMiscellaneousAdminPages ; auth:hasPermission simplePermission:UseSparqlQueryPage ; - auth:hasPermission simplePermission:PageViewableAdmin ; + auth:hasPermission simplePermission:PageViewableAdmin ; - # Uncomment the following permission line to enable the SPARQL update API. - # Before enabling, be sure that the URL api/sparqlUpdate is secured by SSH, - # so passwords will not be sent in clear text. -# auth:hasPermission simplePermission:UseSparqlUpdateApi ; + # Uncomment the following permission line to enable the SPARQL update API. + # Before enabling, be sure that the URL api/sparqlUpdate is secured by HTTPS, + # so passwords will not be sent in clear text. + #auth:hasPermission simplePermission:UseSparqlUpdateApi ; # permissions for CURATOR and above. auth:hasPermission simplePermission:EditOntology ; From b21cd24489c651bf91ce19b5054e49c1340db21e Mon Sep 17 00:00:00 2001 From: Tim Worrall Date: Mon, 9 Feb 2015 15:54:11 -0500 Subject: [PATCH 2/8] VIVO-904: the display limit annotation on data and faux properties now determines when the more... link is employed for one of these properties. Regular object properties will have a default limit of 5. Also, the add statement link is no longer suppressed when the display limit is reached. --- .../individual/DataPropertyTemplateModel.java | 25 +++++++++++++++---- .../individual/PropertyTemplateModel.java | 7 ++++++ .../individual/individual-property-groups.css | 3 +++ .../individual/individual-properties.ftl | 6 ++++- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyTemplateModel.java index 9cba71164..dbe99ce60 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/DataPropertyTemplateModel.java @@ -65,6 +65,7 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel { private String objectKey; private String queryString; private Set constructQueries; + private int displayLimit; DataPropertyTemplateModel(DataProperty dp, Individual subject, VitroRequest vreq, boolean editing, List populatedDataPropertyList) { @@ -82,7 +83,7 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel { constructQueries = getConstructQueries(); statements = new ArrayList(); - + displayLimit = dp.getDisplayLimit(); // If the property is populated, get the data property statements via a sparql query if (populatedDataPropertyList.contains(dp)) { log.debug("Getting data for populated data property " + getUri()); @@ -108,14 +109,22 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel { return; } - // If the display limit has already been reached, we can't add a new statement. - // NB This appears to be a misuse of a value called "display limit". Note that it's - // not used to limit display, either, so should be renamed. +/* If the display limit has already been reached, we can't add a new statement. + NB This appears to be a misuse of a value called "display limit". Note that it's + not used to limit display, either, so should be renamed. int displayLimit = dp.getDisplayLimit(); - // Display limit of -1 (default value for new property) means no display limit + Display limit of -1 (default value for new property) means no display limit if ( displayLimit >= 0 && statements.size() >= displayLimit ) { return; } +*/ + // Rewriting the above per jc55. If the data property is functional, there should only + // be 1 statement. The Display Limit is for determining how many statements to display + // before a "more..." link is used to hide statements exceeding the display limit. tlw72 + boolean functional = dp.getFunctional(); + if ( functional && statements.size() >= 1 ) { + return; + } // Determine whether a new statement can be added RequestedAction action = new AddDataPropertyStatement( @@ -146,6 +155,11 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel { protected Route getPropertyEditRoute() { return Route.DATA_PROPERTY_EDIT; } + + @Override + public int getDisplayLimit() { + return displayLimit; + } public ConfigError checkQuery(String queryString) { if (StringUtils.isBlank(queryString)) { @@ -191,6 +205,7 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel { public String getTemplate() { return getTemplateName(); } + /* Template methods */ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyTemplateModel.java index d8a0186fd..4c1c7a99b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/PropertyTemplateModel.java @@ -41,6 +41,7 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel { private String name; private FauxProperty fauxProperty; + private int displayLimit; PropertyTemplateModel(Property property, Individual subject, VitroRequest vreq, String name) { this.vreq = vreq; @@ -49,11 +50,13 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel { propertyUri = property.getURI(); localName = property.getLocalName(); this.name = name; + this.displayLimit = displayLimit; addUrl = ""; fauxProperty = isFauxProperty(property); if (fauxProperty != null) { this.name = fauxProperty.getDisplayName(); + this.displayLimit = fauxProperty.getDisplayLimit(); } setVerboseDisplayValues(property); @@ -142,6 +145,10 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel { return name; } + public int getDisplayLimit() { + return displayLimit; + } + public String getLocalName() { return localName; } diff --git a/webapp/web/css/individual/individual-property-groups.css b/webapp/web/css/individual/individual-property-groups.css index b7cc8fa2f..7b97e5d4b 100644 --- a/webapp/web/css/individual/individual-property-groups.css +++ b/webapp/web/css/individual/individual-property-groups.css @@ -67,4 +67,7 @@ li.selectedGroupTab { } li.groupTabSpacer { float:left;border-bottom: 1px solid #DFE6E5;background-color:#fff;width:3px;height:37px +} +div.additionalItems { + margin-top: 0 !important; } \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/partials/individual/individual-properties.ftl b/webapp/web/templates/freemarker/body/partials/individual/individual-properties.ftl index 9c6ba070f..2c44bd9ab 100644 --- a/webapp/web/templates/freemarker/body/partials/individual/individual-properties.ftl +++ b/webapp/web/templates/freemarker/body/partials/individual/individual-properties.ftl @@ -42,7 +42,11 @@

${property.name} <@p.addLink property editable /> <@p.verboseDisplay property />

<#-- List the statements for each property --> -
    + <#assign limit = property.getDisplayLimit()!5 /> + <#if limit == -1 || limit == 0 > + <#assign limit = 5 /> + +
      <#-- data property --> <#if property.type == "data"> <@p.dataPropertyList property editable /> From 76668990c435da83d2ae92085a362f52c250a06e Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Tue, 10 Feb 2015 12:10:28 -0700 Subject: [PATCH 3/8] removed extra } from title attributes in vitro templates --- .../templates/freemarker/body/accounts/userAccounts-list.ftl | 4 ++-- .../body/partials/shortview/view-browse-default.ftl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl index f76707992..ee9a542c9 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl @@ -25,7 +25,7 @@