From e48271b1a41b231cd29a61f69e7f4677cb620faf Mon Sep 17 00:00:00 2001 From: ryounes Date: Mon, 11 Jul 2011 21:13:05 +0000 Subject: [PATCH] NIHVIVO-707 First draft of Manage Web Pages screen. JS not yet functional. --- .../forms/addAuthorsToInformationResource.jsp | 4 +- productMods/edit/forms/addEditWebpageForm.jsp | 23 ++-- .../forms/css/manageWebpagesForIndividual.css | 55 +++++++++ .../forms/manageWebpagesForIndividual.jsp | 109 +++++++++++++++++- themes/wilma/css/wilma.css | 3 + 5 files changed, 177 insertions(+), 17 deletions(-) create mode 100644 productMods/edit/forms/css/manageWebpagesForIndividual.css diff --git a/productMods/edit/forms/addAuthorsToInformationResource.jsp b/productMods/edit/forms/addAuthorsToInformationResource.jsp index 5ec56713..1c3734f2 100644 --- a/productMods/edit/forms/addAuthorsToInformationResource.jsp +++ b/productMods/edit/forms/addAuthorsToInformationResource.jsp @@ -37,10 +37,10 @@ core:authorInAuthorship (Person : Authorship) - inverse of linkedAuthor <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %> -<%@ page import="org.apache.commons.lang.StringUtils" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %> +<%@ page import="org.apache.commons.lang.StringUtils" %> <%@ page import="org.json.JSONObject" %> <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.LogFactory" %> @@ -308,8 +308,6 @@ SPARQL queries for existing values. --%> int maxRank = 0; int authorshipCount = authorships.size(); - // for ( ObjectPropertyStatement stmt : authorshipStmts) { - // Individual authorship = stmt.getObject(); %> + + + +
+ +
+ +<%! + +private static String WEBPAGE_QUERY = "" + + "PREFIX core: \n" + + "SELECT DISTINCT ?link ?url ?anchor ?rank WHERE { \n" + + " ?subject core:webpage ?link . \n" + + " OPTIONAL { ?link core:linkURI ?url } \n" + + " OPTIONAL { ?link core:linkAnchorText ?anchor } \n" + + " OPTIONAL { ?link core:rank ?rank } \n" + + "} ORDER BY ?rank"; + + +private List> getWebpages(String subjectUri, VitroRequest vreq) { + + String queryStr = QueryUtils.subUriForQueryVar(WEBPAGE_QUERY, "subject", subjectUri); + log.debug("Query string is: " + queryStr); + List> webpages = new ArrayList>(); + try { + ResultSet results = QueryUtils.getQueryResults(queryStr, vreq); + while (results.hasNext()) { + QuerySolution soln = results.nextSolution(); + RDFNode node = soln.get("link"); + if (node.isURIResource()) { + webpages.add(QueryUtils.querySolutionToStringValueMap(soln)); + } + } + } catch (Exception e) { + log.error(e, e); + } + + return webpages; +} + +%> diff --git a/themes/wilma/css/wilma.css b/themes/wilma/css/wilma.css index cad60e42..353c4ce0 100644 --- a/themes/wilma/css/wilma.css +++ b/themes/wilma/css/wilma.css @@ -201,6 +201,7 @@ form textarea { width: 100%; } #authorships a.remove:link, +#manageWebpages a.remove:link, #showAddForm a.cancel:link, form a:link.cancel, form a:visited.cancel { @@ -211,6 +212,8 @@ form a:visited.cancel { } #authorships a.remove:hover, #authorships a.remove:active, +#manageWebpages a.remove:hover, +#manageWebpages a.remove:active, #showAddForm a.cancel:hover, #showAddForm a.cancel:active, form a:hover.cancel,