+
<%-- RY maybe make this a label and input field. See what looks best. --%>
-
+
diff --git a/productMods/edit/forms/addInformationResourceToAuthor.jsp b/productMods/edit/forms/addInformationResourceToAuthor.jsp
deleted file mode 100644
index cb9f6be7..00000000
--- a/productMods/edit/forms/addInformationResourceToAuthor.jsp
+++ /dev/null
@@ -1,18 +0,0 @@
-<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
-
-<%-- Custom form for adding an information resource to an author
-
-Classes:
-foaf:Person - the individual being edited
-core:Authorship - primary new individual being created
-core:InformationResource - new or existing individual being linked to
-
-Object properties (domain : range)
-
-core:informationResourceInAuthorship (InformationResource : Authorship)
-core:linkedInformationResource (Authorship : InformationResource) - inverse of informationResourceInAuthorship
-
-core:linkedAuthor (Authorship : Person)
-core:authorInAuthorship (Person : Authorship) - inverse of linkedAuthor
-
---%>
diff --git a/productMods/edit/forms/addPublicationToAuthor.jsp b/productMods/edit/forms/addPublicationToAuthor.jsp
new file mode 100644
index 00000000..4bb03745
--- /dev/null
+++ b/productMods/edit/forms/addPublicationToAuthor.jsp
@@ -0,0 +1,236 @@
+<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
+
+<%-- Custom form for adding a publication to an author
+
+Classes:
+foaf:Person - the individual being edited
+core:Authorship - primary new individual being created
+
+Object properties (domain : range):
+
+core:authorInAuthorship (Person : Authorship)
+core:linkedAuthor (Authorship : Person) - inverse of authorInAuthorship
+
+core:linkedInformationResource (Authorship : InformationResource)
+core:informationResourceInAuthorship (InformationResource : Authorship) - inverse of linkedInformationResource
+
+--%>
+
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.ArrayList" %>
+<%@ page import="java.util.Arrays" %>
+<%@ page import="java.util.Collections" %>
+<%@ page import="java.net.URLEncoder" %>
+
+<%@ page import="com.hp.hpl.jena.rdf.model.Model" %>
+<%@ page import="com.hp.hpl.jena.vocabulary.XSD" %>
+
+<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
+<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyComparator" %>
+<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %>
+<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary" %>
+<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %>
+<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.PublicationHasAuthorValidator" %>
+<%@ 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="edu.cornell.mannlib.vitro.webapp.utils.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.logging.Log" %>
+<%@ page import="org.apache.commons.logging.LogFactory" %>
+
+<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
+<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
+
+<%!
+ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.edit.forms.addAuthorsToInformationResource.jsp");
+%>
+<%
+ VitroRequest vreq = new VitroRequest(request);
+ WebappDaoFactory wdf = vreq.getWebappDaoFactory();
+ vreq.setAttribute("defaultNamespace", ""); //empty string triggers default new URI behavior
+
+ String flagUri = null;
+ if (wdf.getApplicationDao().isFlag1Active()) {
+ flagUri = VitroVocabulary.vitroURI+"Flag1Value"+vreq.getPortal().getPortalId()+"Thing";
+ } else {
+ flagUri = wdf.getVClassDao().getTopConcept().getURI(); // fall back to owl:Thing if not portal filtering
+ }
+ vreq.setAttribute("flagUri",flagUri);
+
+ vreq.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString()));
+
+ String intDatatypeUri = XSD.xint.toString();
+ vreq.setAttribute("intDatatypeUri", intDatatypeUri);
+ vreq.setAttribute("intDatatypeUriJson", MiscWebUtils.escape(intDatatypeUri));
+%>
+
+
+
+
+
+
+<%-- Unlike other custom forms, this form does not allow edits of existing authors, so there are no
+SPARQL queries for existing values. --%>
+
+
+ ?newPub a ?pubType .
+
+
+
+ ?newPub <${label}> ?title .
+
+
+<%-- This applies to both a new and an existing publication --%>
+
+ @prefix core: <${vivoCore}> .
+
+ ?authorshipUri a core:Authorship ,
+ <${flagUri}> ;
+ core:linkedAuthor ?person .
+
+ ?person core:authorInAuthorship ?authorshipUri .
+
+
+
+ @prefix core: <${vivoCore}> .
+
+ ?authorshipUri core:linkedInformationResource ?pubUri .
+ ?pubUri core:informationResourceInAuthorship ?authorshipUri .
+
+
+
+ @prefix core: <${vivoCore}> .
+
+ ?newPub a ?pubType ,
+ <${flagUri}> ;
+ <${label}> ?title .
+
+ ?authorshipUri core:linkedInformationResource ?newPub .
+ ?newPub core:informationResourceInAuthorship ?authorshipUri .
+
+
+
${infoResourceClassUri}
+
+
+
+{
+ "formUrl" : "${formUrl}",
+ "editKey" : "${editKey}",
+ "urlPatternToReturnTo" : "", // this will be a problem in the case of a new infoResource - we don't have the uri yet
+
+ "subject" : ["person", "${subjectUriJson}" ],
+ "predicate" : ["predicate", "${predicateUriJson}" ],
+ "object" : ["authorshipUri", "${objectUriJson}", "URI" ],
+
+ "n3required" : [ "${n3ForNewAuthorship}" ],
+
+ "n3optional" : [ "${n3ForExistingPub}", "${n3ForNewPub}",
+ "${newPubNameAssertion}", "${newPubTypeAssertion}" ],
+
+ "newResources" : { "authorshipUri" : "${defaultNamespace}",
+ "newPub" : "${defaultNamespace}" },
+
+ "urisInScope" : { },
+ "literalsInScope": { },
+ "urisOnForm" : [ "pubUri", "pubType" ],
+ "literalsOnForm" : [ "title" ],
+ "filesOnForm" : [ ],
+ "sparqlForLiterals" : { },
+ "sparqlForUris" : { },
+ "sparqlForExistingLiterals" : { },
+ "sparqlForExistingUris" : { },
+ "fields" : {
+ "title" : {
+ "newResource" : "false",
+ "validators" : [ "datatype:${stringDatatypeUriJson}" ],
+ "optionsType" : "UNDEFINED",
+ "literalOptions" : [ ],
+ "predicateUri" : "",
+ "objectClassUri" : "",
+ "rangeDatatypeUri" : "${stringDatatypeUriJson}",
+ "rangeLang" : "",
+ "assertions" : [ "${n3ForNewPub}" ]
+ },
+ "pubType" : {
+ "newResource" : "false",
+ "validators" : [ ],
+ "optionsType" : "CHILD_VCLASSES",
+ "literalOptions" : [ "Select one" ],
+ "predicateUri" : "",
+ "objectClassUri" : "${infoResourceClassUriJson}",
+ "rangeDatatypeUri" : "",
+ "rangeLang" : "",
+ "assertions" : [ "${newPubTypeAssertion}" ]
+ },
+ "pubUri" : {
+ "newResource" : "false",
+ "validators" : [ ],
+ "optionsType" : "UNDEFINED",
+ "literalOptions" : [ ],
+ "predicateUri" : "",
+ "objectClassUri" : "${personClassUriJson}",
+ "rangeDatatypeUri" : "",
+ "rangeLang" : "",
+ "assertions" : ["${n3ForExistingPub}"]
+ }
+ }
+}
+
+
+<%
+ log.debug(request.getAttribute("editjson"));
+
+ EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request);
+ if (editConfig == null) {
+ editConfig = new EditConfiguration((String) request.getAttribute("editjson"));
+ EditConfiguration.putConfigInSession(editConfig,session);
+ }
+
+ Model model = (Model) application.getAttribute("jenaOntModel");
+ String objectUri = (String) request.getAttribute("objectUri");
+ editConfig.prepareForNonUpdate(model); // we're only adding new, not editing existing
+
+ String subjectUri = vreq.getParameter("subjectUri");
+ String predicateUri = vreq.getParameter("predicateUri");
+ String subjectName = ((Individual) request.getAttribute("subject")).getName();
+
+ List
customJs = new ArrayList(Arrays.asList(JavaScript.JQUERY_UI.path(),
+ JavaScript.UTILS.path(),
+ JavaScript.CUSTOM_FORM_UTILS.path(),
+ "/edit/forms/js/customFormWithAdvanceTypeSelection.js"
+ ));
+ request.setAttribute("customJs", customJs);
+
+ List customCss = new ArrayList(Arrays.asList(Css.JQUERY_UI.path(),
+ Css.CUSTOM_FORM.path(),
+ "/edit/forms/css/autocomplete.css",
+ "/edit/forms/css/customFormWithAdvanceTypeSelection.css"
+ ));
+ request.setAttribute("customCss", customCss);
+%>
+
+
+
+Create a new publication entry for <%= subjectName %>
+
+" >
+
+
+
+
+
+
+ <%-- RY maybe make this a label and input field. See what looks best. --%>
+
+
+
+
+
+
+ * required fields
+
+
+
\ No newline at end of file
diff --git a/productMods/edit/forms/css/addAuthorsToInformationResource.css b/productMods/edit/forms/css/addAuthorsToInformationResource.css
index 5053ddfc..11230af3 100644
--- a/productMods/edit/forms/css/addAuthorsToInformationResource.css
+++ b/productMods/edit/forms/css/addAuthorsToInformationResource.css
@@ -94,19 +94,13 @@ form a:hover.cancel,
width: 10em;
}
-#selectedAuthorName {
- background-color: #d9d9d9;
- padding: .5em 1em;
-}
-
#content form p.submit {
margin-top: 3em;
}
/* Disabling undo links for the present. Add back later. */
/*
-a.undo,
-#selectedAuthor {
+a.undo {
display: none;
}
*/
@@ -116,8 +110,7 @@ a.undo,
/*
#showAddForm,
a.remove,
-a.undo,
-#selectedAuthor {
+a.undo {
display: none;
}
*/
diff --git a/productMods/edit/forms/css/autocomplete.css b/productMods/edit/forms/css/autocomplete.css
new file mode 100644
index 00000000..5e74780d
--- /dev/null
+++ b/productMods/edit/forms/css/autocomplete.css
@@ -0,0 +1,10 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+
+.acSelection {
+ display: none;
+}
+
+.acSelectionName {
+ background-color: #d9d9d9;
+ padding: .5em 1em;
+}
\ No newline at end of file
diff --git a/productMods/edit/forms/css/customFormWithAdvanceTypeSelection.css b/productMods/edit/forms/css/customFormWithAdvanceTypeSelection.css
new file mode 100644
index 00000000..33d84828
--- /dev/null
+++ b/productMods/edit/forms/css/customFormWithAdvanceTypeSelection.css
@@ -0,0 +1,5 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+
+#selectedResource {
+ display:none;
+}
diff --git a/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js
new file mode 100644
index 00000000..5da6b4c2
--- /dev/null
+++ b/productMods/edit/forms/js/customFormWithAdvanceTypeSelection.js
@@ -0,0 +1,3 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+
+$('#pubUri').attr('disabled', 'disabled');
diff --git a/productMods/edit/forms/personHasEducationalBackground.jsp b/productMods/edit/forms/personHasEducationalBackground.jsp
index 3fb8cbf7..bf676348 100644
--- a/productMods/edit/forms/personHasEducationalBackground.jsp
+++ b/productMods/edit/forms/personHasEducationalBackground.jsp
@@ -7,8 +7,6 @@ core:EducationalTraining - primary new individual being created
foaf:Person - existing individual
foaf:Organization - new or existing individual
core:AcademicDegree - existing individual
-core:DateTimeValue
-core:DateTimeValuePrecision
Data properties of EducationalTraining:
core:majorField
@@ -25,6 +23,12 @@ core:degreeOutcomeOf (AcademicDegree : EducationalTraining) - inverse of degreeE
core:organizationGrantingDegree (EducationalTraining : Organization) - no inverse
+Future version
+--------------
+Classes:
+core:DateTimeValue
+core:DateTimeValuePrecision
+Object properties:
core:dateTimeValue (EducationalTraining : DateTimeValue)
core:dateTimePrecision (DateTimeValue : DateTimeValuePrecision)
--%>