diff --git a/doc/install.html b/doc/install.html index c409b190c..cd048e367 100644 --- a/doc/install.html +++ b/doc/install.html @@ -67,7 +67,7 @@

Vitro inside Tomcat

When you run the build script to compile and deploy Vitro - (see installation step VI, below), + (see installation step V, below), the files will be deployed to a directory inside Tomcat. This is the actual executing code for Vitro, but you won’t need to look at it or change it. If you need to change @@ -86,7 +86,7 @@ build.properties file (see installation step IV, below). You must create this directory before starting Vitro, you must create the runtime.properties file in this directory - (see Step V, below), and you + (see Step VI, below), and you must ensure that Tomcat has permission to read and write to this directory when it runs.

@@ -186,10 +186,10 @@ Specify build properties
  • - Specify runtime properties + Compile and deploy
  • - Compile and deploy + Specify runtime properties
  • Configure Tomcat @@ -226,20 +226,19 @@

    @@ -320,8 +319,8 @@

    These properties are used in compilation and deployment. They will be incorporated into Vitro when it is compiled in - Step VI. If you want to change these properties at - a later date, you will need to stop Tomcat, repeat Step VI, + Step V. If you want to change these properties at + a later date, you will need to stop Tomcat, repeat Step V, and restart Tomcat.

    @@ -394,22 +393,64 @@ -

    V. Specify runtime properties

    +

    V. Compile and deploy

    - In Step IV, you defined the location of the Vitro home directory, + In Step IV, you defined the location of the VIVO home directory, by specifying vitro.home in the build.properties file. Create that directory now.

    - In the webapp/config subdirectory of the Vitro distribution, you will find a file called - example.runtime.properties. Copy this to the Vitro home directory you have created, - renaming the copy to runtime.properties. - Edit the file to suit your installation, as described in the following table. + At the command line, change to the webapp directory inside the Vitro distribution + directory. Then type: +

    +
        ant all
    +

    + to build Vitro and deploy to Tomcat's webapps directory. +

    +

    + The build script may run for as much as five minutes, + and creates more than 100 lines of output. + The process comprises several steps: +

    +

    +

    + The output of the build may include a variety of warning messages. + The Java compiler may warn of code that is outdated. + Unit tests may produce warning messages, + and some tests may be ignored if they do not produce consistent results. +

    +
    + BUILD SUCCESSFUL
    Total time: 1 minute 49 seconds +
    +

    + If the output ends with a success message, the build was successful. + Proceed to the next step. +

    +
    + BUILD FAILED
    Total time: 35 seconds +
    +

    + If the output ends with a failure message, the build has failed. + Find the cause of the failure, fix the problem, and run the script again. +

    + +

    VI. Specify runtime properties

    +

    + The build process in Step V created a file called example.runtime.properties + in your Vitro home directory (vitro.home in the build.properties file). + Rename this file to runtime.properties, and + edit the file to suit your installation, as described in the following table.

    These properties are loaded when Vitro starts up. If you want to change these properties at a later date, you will need to restart Tomcat for them to take - effect. You will not need to repeat Step VI. + effect. You will not need to repeat Step V.

    Windows: @@ -800,47 +841,6 @@ -

    VI. Compile and deploy

    -

    - At the command line, change to the webapp directory inside the Vitro distribution - directory. Then type: -

    -
        ant all
    -

    - to build Vitro and deploy to Tomcat's webapps directory. -

    -

    - The build script may run for as much as five minutes, - and creates more than 100 lines of output. - The process comprises several steps: -

    -

    -

    - The output of the build may include a variety of warning messages. - The Java compiler may warn of code that is outdated. - Unit tests may produce warning messages, - and some tests may be ignored if they do not produce consistent results. -

    -
    - BUILD SUCCESSFUL
    Total time: 1 minute 49 seconds -
    -

    - If the output ends with a success message, the build was successful. - Proceed to the next step. -

    -
    - BUILD FAILED
    Total time: 35 seconds -
    -

    - If the output ends with a failure message, the build has failed. - Find the cause of the failure, fix the problem, and run the script again. -

    VII. Configure Tomcat

    Set JVM parameters

    @@ -921,8 +921,8 @@ problem is detected, the normal Vitro pages will redirect to a startup status page describing the problem. You can stop tomcat, attempt to fix the problem and - proceeded from Step VI. The - startup status page may offer a continue link which + proceed from Step V. If the problem is not serious, the + startup status page may offer a continue link which will allow you to use VIVO in spite of the problems.

    diff --git a/utilities/testrunner/selenium/how-to-create-firefox-profile.txt b/utilities/testrunner/selenium/how-to-create-firefox-profile.txt index 0c5af1d1d..03007d63f 100644 --- a/utilities/testrunner/selenium/how-to-create-firefox-profile.txt +++ b/utilities/testrunner/selenium/how-to-create-firefox-profile.txt @@ -1,3 +1,3 @@ -Here is an excellent description of how to create a Firefox profile for use when running Selenium tests. - +Here is an excellent description of how to create a Firefox profile for use when running Selenium tests. + http://girliemangalo.wordpress.com/2009/02/05/creating-firefox-profile-for-your-selenium-rc-tests/ \ No newline at end of file diff --git a/webapp/build.xml b/webapp/build.xml index 6b60d1fe4..00f61f423 100644 --- a/webapp/build.xml +++ b/webapp/build.xml @@ -102,6 +102,24 @@ + + + + + + + Tomcat home directory '${tomcat.home}' does not exist. + Check the value of 'tomcat.home' in your build.properties file. + + + + + + + + '${tomcat.home}' does not refer to a valid Tomcat instance: it has no 'webapps' sub-directory. + Check the value of 'tomcat.home' in your build.properties file." + diff --git a/webapp/languages/example/i18n/all_es.properties b/webapp/languages/example/i18n/all_es.properties index e556063d6..49e8eb110 100644 --- a/webapp/languages/example/i18n/all_es.properties +++ b/webapp/languages/example/i18n/all_es.properties @@ -126,10 +126,6 @@ submit_add_new_account = Añadir nueva cuenta account_created = Su {0} cuenta ha sido creada. account_created_subject = Su {0} cuenta ha sido creada. -account_created_email_html = @@file files/accountCreatedEmail.html -account_created_email_text = @@file files/accountCreatedEmail.txt -account_created_external_email_html = @@file files/accountCreatedExternalOnlyEmail.html -account_created_external_email_text = @@file files/accountCreatedExternalOnlyEmail.txt confirm_delete_account_singular = ¿Está seguro de que desea eliminar esta cuenta? confirm_delete_account_plural = ¿Está seguro de que desea eliminar estas cuentas? @@ -148,21 +144,11 @@ select_associated_profile = Seleccione el perfil asociado create_associated_profile = Cree el perfil asociado email_changed_subject = Su {0} cuenta de correo electrónico ha cambiado. -email_changed_html = @@file files/accountEmailChanged.html -email_changed_text = @@file files/accountEmailChanged.txt create_your_password = Crea tu Contraseña password_created_subject = Su {0} contraseña ha sido creado con éxito. -password_created_email_html = @@file files/passwordCreatedEmail.html -password_created_email_text = @@file files/passwordCreatedEmail.txt - password_reset_pending_subject = {0} restablecer solicitud de contraseña -password_reset_pending_email_html = @@file files/passwordResetPending.html -password_reset_pending_email_text = @@file files/passwordResetPending.txt - password_reset_complete_subject = Su {0} ha cambiado la contraseña. -password_reset_complete_email_html = @@file files/passwordResetComplete.html -password_reset_complete_email_text = @@file files/passwordResetComplete.txt reset_your_password = Renovar su contraseña first_time_login = Log Por primera vez en @@ -181,8 +167,6 @@ password_saved_please_login = Su contraseña ha sido guardada. Por favor, ingres please_provide_contact_information = Por favor proporcione su información de contacto para terminar de crear la cuenta. first_time_login_note = Nota: Un correo electrónico será enviado a la dirección indicada anteriormente notificar que una cuenta ha sido creada. -first_time_external_email_html = @@file files/accountFirstTimeExternal.html -first_time_external_email_text = @@file files/accountFirstTimeExternal.txt myAccount_heading = Mi cuenta myAccount_confirm_changes = Los cambios se han guardado. diff --git a/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedEmail.ftl new file mode 100644 index 000000000..e5ab4bc0b --- /dev/null +++ b/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedEmail.ftl @@ -0,0 +1,68 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Confirmation that an account has been created. --> + +<#assign subject = "Su cuenta ${siteName} ha sido creado." /> + +<#assign html> + + + ${subject} + + +

    + ${userAccount.firstName} ${userAccount.lastName} +

    + +

    + Enhorabuena! +

    + +

    + Hemos creado la nueva cuenta en ${siteName}, asociada con ${userAccount.emailAddress}. +

    + +

    + Si no has solicitado esta nueva cuenta puede ignorar este mensaje. + Esta solicitud caducará si no se hubiere pronunciado sobre durante 30 días. +

    + +

    + Haga clic en el enlace de abajo para crear la contraseña de su cuenta usando nuestro servidor seguro. +

    + +

    + ${passwordLink} +

    + +

    + Si el enlace no funciona, puedes copiar y pegar el enlace directamente en la barra de direcciones de su navegador. +

    + +

    + ¡Gracias! +

    + + + + +<#assign text> +${userAccount.firstName} ${userAccount.lastName} + +Enhorabuena! + +Hemos creado la nueva cuenta en ${siteName}, +asociada con ${userAccount.emailAddress}. + +Si no has solicitado esta nueva cuenta puede ignorar este mensaje. +Esta solicitud caducará si no se hubiere pronunciado sobre durante 30 días. + +Pega el siguiente enlace en la barra de direcciones de su navegador para +crear su contraseña para su nueva cuenta usando nuestro servidor seguro. + +${passwordLink} + +¡Gracias! + + +<@email subject=subject html=html text=text /> diff --git a/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedExternalOnlyEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedExternalOnlyEmail.ftl new file mode 100644 index 000000000..0b91545fe --- /dev/null +++ b/webapp/languages/example/templates/freemarker/userAccounts-acctCreatedExternalOnlyEmail.ftl @@ -0,0 +1,43 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Confirmation that an account has been created. --> + +<#assign subject = "Su cuenta ${siteName} ha sido creada." /> + +<#assign html> + + + ${subject} + + +

    + ${userAccount.firstName} ${userAccount.lastName} +

    + +

    + ¡Enhorabuena! +

    + +

    + Hemos creado la nueva cuenta VIVO asociado con ${userAccount.emailAddress}. +

    + +

    + ¡Gracias! +

    + + + + +<#assign text> +${userAccount.firstName} ${userAccount.lastName} + +¡Enhorabuena! + +Hemos creado la nueva cuenta VIVO asociado con +${userAccount.emailAddress}. + +¡Gracias! + + +<@email subject=subject html=html text=text /> diff --git a/webapp/languages/example/templates/freemarker/userAccounts-confirmEmailChangedEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-confirmEmailChangedEmail.ftl new file mode 100644 index 000000000..a3674c8cf --- /dev/null +++ b/webapp/languages/example/templates/freemarker/userAccounts-confirmEmailChangedEmail.ftl @@ -0,0 +1,38 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Confirmation that the user has changed his email account. --> + +<#assign subject = "Su cuenta de correo electrónico ${siteName} ha cambiado." /> + +<#assign html> + + + ${subject} + + +

    + Hola, ${userAccount.firstName} ${userAccount.lastName} +

    + +

    + Ha cambiado recientemente la dirección de correo electrónico asociada a + ${userAccount.firstName} ${userAccount.lastName} +

    + +

    + Gracias. +

    + + + + +<#assign text> +Hola, ${userAccount.firstName} ${userAccount.lastName} + +Ha cambiado recientemente la dirección de correo electrónico asociada a +${userAccount.firstName} ${userAccount.lastName} + +Gracias. + + +<@email subject=subject html=html text=text /> diff --git a/webapp/languages/example/templates/freemarker/userAccounts-firstTimeExternalEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-firstTimeExternalEmail.ftl new file mode 100644 index 000000000..5c6558a52 --- /dev/null +++ b/webapp/languages/example/templates/freemarker/userAccounts-firstTimeExternalEmail.ftl @@ -0,0 +1,43 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Confirmation that an account has been created for an externally-authenticated user. --> + +<#assign subject = "Su cuenta ${siteName} ha sido creada." /> + +<#assign html> + + + ${subject} + + +

    + ${userAccount.firstName} ${userAccount.lastName} +

    + +

    + ¡Enhorabuena! +

    + +

    + Hemos creado la nueva cuenta VIVO asociado con ${userAccount.emailAddress}. +

    + +

    + ¡Gracias! +

    + + + + +<#assign text> +${userAccount.firstName} ${userAccount.lastName} + +¡Enhorabuena! + +Hemos creado la nueva cuenta VIVO asociado con +${userAccount.emailAddress}. + +¡Gracias! + + +<@email subject=subject html=html text=text /> diff --git a/webapp/languages/example/templates/freemarker/userAccounts-passwordCreatedEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-passwordCreatedEmail.ftl new file mode 100644 index 000000000..f3e272055 --- /dev/null +++ b/webapp/languages/example/templates/freemarker/userAccounts-passwordCreatedEmail.ftl @@ -0,0 +1,43 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Confirmation that an password has been created. --> + +<#assign subject = "El ${siteName} contraseña ha sido creado con éxito." /> + +<#assign html> + + + ${subject} + + +

    + ${userAccount.firstName} ${userAccount.lastName} +

    + +

    + Contraseña creado con éxito. +

    + +

    + Su nueva contraseña asociada con ${userAccount.emailAddress} se ha creado. +

    + +

    + Gracias. +

    + + + + +<#assign text> +${userAccount.firstName} ${userAccount.lastName} + +Contraseña creado con éxito. + +Su nueva contraseña asociada con ${userAccount.emailAddress} +se ha creado. + +Gracias. + + +<@email subject=subject html=html text=text /> diff --git a/webapp/languages/example/templates/freemarker/userAccounts-passwordResetCompleteEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-passwordResetCompleteEmail.ftl new file mode 100644 index 000000000..64ca61dae --- /dev/null +++ b/webapp/languages/example/templates/freemarker/userAccounts-passwordResetCompleteEmail.ftl @@ -0,0 +1,44 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Confirmation that a password has been reset. --> + +<#assign subject = "El ${siteName} contraseña cambiada." /> + +<#assign html> + + + ${subject} + + + +

    + ${userAccount.firstName} ${userAccount.lastName} +

    + +

    + Contraseña cambiada con éxito. +

    + +

    + Su nueva contraseña asociada con ${userAccount.emailAddress} ha sido cambiado. +

    + +

    + Gracias. +

    + + + + +<#assign text> +${userAccount.firstName} ${userAccount.lastName} + +Contraseña cambiada con éxito. + +Su nueva contraseña asociada con ${userAccount.emailAddress} +ha sido cambiado. + +Gracias. + + +<@email subject=subject html=html text=text /> diff --git a/webapp/languages/example/templates/freemarker/userAccounts-passwordResetPendingEmail.ftl b/webapp/languages/example/templates/freemarker/userAccounts-passwordResetPendingEmail.ftl new file mode 100644 index 000000000..2f0bccc98 --- /dev/null +++ b/webapp/languages/example/templates/freemarker/userAccounts-passwordResetPendingEmail.ftl @@ -0,0 +1,62 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- Confirmation email for user account password reset --> + +<#assign subject = "${siteName} restablecer solicitud de contraseña" /> + +<#assign html> + + + ${subject} + + +

    + Estimado ${userAccount.firstName} ${userAccount.lastName}: +

    + +

    + Hemos recibido una solicitud para restablecer la contraseña de su cuenta ${siteName} + (${userAccount.emailAddress}). +

    + +

    + Por favor, siga las siguientes instrucciones para proceder con su restablecimiento de contraseña. +

    + +

    + Si no has solicitado esta nueva cuenta puede ignorar este mensaje. + Esta solicitud caducará si no se hubiere pronunciado en un plazo de 30 días. +

    + +

    + Haga clic en el enlace de abajo o pegarlo en la barra de direcciones de su navegador para + restablecer su contraseña usando nuestro servidor seguro. +

    + +

    ${passwordLink}

    + +

    ¡Gracias!

    + + + + +<#assign text> +Estimado ${userAccount.firstName} ${userAccount.lastName}: + +Hemos recibido una solicitud para restablecer la contraseña de su cuenta ${siteName} +(${userAccount.emailAddress}). + +Por favor, siga las siguientes instrucciones para proceder con su restablecimiento de contraseña. + +Si no has solicitado esta nueva cuenta puede ignorar este mensaje. +Esta solicitud caducará si no se hubiere pronunciado en un plazo de 30 días. + +Pega el siguiente enlace en la barra de direcciones de su navegador para +restablecer su contraseña usando nuestro servidor seguro. + +${passwordLink} + +¡Gracias! + + +<@email subject=subject html=html text=text /> diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/PolicyHelper.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/PolicyHelper.java index 11c351044..d8a606efb 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/PolicyHelper.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/policy/PolicyHelper.java @@ -11,7 +11,6 @@ import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.ontology.OntModelSpec; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.rdf.model.Property; import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.Statement; @@ -20,7 +19,6 @@ import com.hp.hpl.jena.rdf.model.StmtIterator; import edu.cornell.mannlib.vitro.webapp.auth.identifier.ActiveIdentifierBundleFactories; import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers; -import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission; import edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.PolicyIface; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction; @@ -136,7 +134,8 @@ public class PolicyHelper { .asResource().getURI()); } else { action = new AddDataPropertyStatement(modelToBeModified, - subject.getURI(), predicate.getURI()); + subject.getURI(), predicate.getURI(), objectNode + .asLiteral().getString()); } return isAuthorizedForActions(req, action); } @@ -169,7 +168,8 @@ public class PolicyHelper { .asResource().getURI()); } else { action = new DropDataPropertyStatement(modelToBeModified, - subject.getURI(), predicate.getURI()); + subject.getURI(), predicate.getURI(), objectNode + .asLiteral().getString()); } return isAuthorizedForActions(req, action); } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AbstractDataPropertyStatementAction.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AbstractDataPropertyStatementAction.java index bfcf98c2a..8e49ec193 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AbstractDataPropertyStatementAction.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AbstractDataPropertyStatementAction.java @@ -16,15 +16,17 @@ public abstract class AbstractDataPropertyStatementAction extends private final String subjectUri; private final String predicateUri; private final Property predicate; + private final String dataValue; public AbstractDataPropertyStatementAction(OntModel ontModel, - String subjectUri, String predicateUri) { + String subjectUri, String predicateUri, String dataValue) { super(ontModel); this.subjectUri = subjectUri; this.predicateUri = predicateUri; Property dataProperty = new Property(); dataProperty.setURI(predicateUri); this.predicate = dataProperty; + this.dataValue = dataValue; } public AbstractDataPropertyStatementAction(OntModel ontModel, @@ -36,12 +38,14 @@ public abstract class AbstractDataPropertyStatementAction extends Property dataProperty = new Property(); dataProperty.setURI(predicateUri); this.predicate = dataProperty; + this.dataValue = dps.getData(); } public String getSubjectUri() { return subjectUri; } + @Override public Property getPredicate() { return predicate; } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AddDataPropertyStatement.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AddDataPropertyStatement.java index 5f550d058..39c1e20ab 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AddDataPropertyStatement.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/AddDataPropertyStatement.java @@ -13,8 +13,8 @@ public class AddDataPropertyStatement extends AbstractDataPropertyStatementAction { public AddDataPropertyStatement(OntModel ontModel, String subjectUri, - String predicateUri) { - super(ontModel, subjectUri, predicateUri); + String predicateUri, String dataValue) { + super(ontModel, subjectUri, predicateUri, dataValue); } public AddDataPropertyStatement(OntModel ontModel, DataPropertyStatement dps) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/DropDataPropertyStatement.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/DropDataPropertyStatement.java index 07138aa8f..b1f84cb2a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/DropDataPropertyStatement.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/DropDataPropertyStatement.java @@ -14,8 +14,8 @@ public class DropDataPropertyStatement extends AbstractDataPropertyStatementAction { public DropDataPropertyStatement(OntModel ontModel, String subjectUri, - String predicateUri) { - super(ontModel, subjectUri, predicateUri); + String predicateUri, String dataValue) { + super(ontModel, subjectUri, predicateUri, dataValue); } public DropDataPropertyStatement(OntModel ontModel, diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/EditDataPropertyStatement.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/EditDataPropertyStatement.java index 5ef3b918f..8243a2031 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/EditDataPropertyStatement.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/auth/requestedAction/propstmt/EditDataPropertyStatement.java @@ -12,8 +12,8 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement; public class EditDataPropertyStatement extends AbstractDataPropertyStatementAction { public EditDataPropertyStatement(OntModel ontModel, String subjectUri, - String predicateUri) { - super(ontModel, subjectUri, predicateUri); + String predicateUri, String dataValue) { + super(ontModel, subjectUri, predicateUri, dataValue); } public EditDataPropertyStatement(OntModel ontModel, diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualListController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualListController.java index 54b295e6d..184bda547 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualListController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/IndividualListController.java @@ -13,10 +13,7 @@ import javax.servlet.ServletContext; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.solr.client.solrj.SolrQuery; -import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServerException; -import org.apache.solr.client.solrj.response.QueryResponse; import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.VClass; @@ -25,9 +22,8 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; +import edu.cornell.mannlib.vitro.webapp.controller.individuallist.IndividualListResults; import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; -import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames; -import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup; import edu.cornell.mannlib.vitro.webapp.utils.solr.SolrQueryUtils; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual; @@ -94,16 +90,15 @@ public class IndividualListController extends FreemarkerHttpServlet { String alpha = getAlphaParameter(vreq); int page = getPageParameter(vreq); - Map map = getResultsForVClass( + IndividualListResults vcResults = getResultsForVClass( vclass.getURI(), page, alpha, vreq.getWebappDaoFactory().getIndividualDao(), getServletContext()); - body.putAll(map); + body.putAll(vcResults.asFreemarkerMap()); - @SuppressWarnings("unchecked") - List inds = (List)map.get("entities"); + List inds = vcResults.getEntities(); List indsTm = new ArrayList(); if (inds != null) { for ( Individual ind : inds ) { @@ -154,13 +149,12 @@ public class IndividualListController extends FreemarkerHttpServlet { return SolrQueryUtils.getPageParameter(request); } - public static Map getResultsForVClass(String vclassURI, int page, String alpha, IndividualDao indDao, ServletContext context) + public static IndividualListResults getResultsForVClass(String vclassURI, int page, String alpha, IndividualDao indDao, ServletContext context) throws SearchException{ - Map rvMap = new HashMap(); try{ List classUris = Collections.singletonList(vclassURI); IndividualListQueryResults results = SolrQueryUtils.buildAndExecuteVClassQuery(classUris, alpha, page, INDIVIDUALS_PER_PAGE, context, indDao); - rvMap = getResultsForVClassQuery(results, page, INDIVIDUALS_PER_PAGE, alpha); + return getResultsForVClassQuery(results, page, INDIVIDUALS_PER_PAGE, alpha); } catch (SolrServerException e) { String msg = "An error occurred retrieving results for vclass query"; log.error(msg, e); @@ -168,31 +162,29 @@ public class IndividualListController extends FreemarkerHttpServlet { throw new SearchException(msg); } catch(Throwable th) { log.error("An error occurred retrieving results for vclass query", th); + return IndividualListResults.EMPTY; } - return rvMap; } - public static Map getResultsForVClassIntersections(List vclassURIs, int page, int pageSize, String alpha, IndividualDao indDao, ServletContext context) { - Map rvMap = new HashMap(); + public static IndividualListResults getResultsForVClassIntersections(List vclassURIs, int page, int pageSize, String alpha, IndividualDao indDao, ServletContext context) { try{ IndividualListQueryResults results = SolrQueryUtils.buildAndExecuteVClassQuery(vclassURIs, alpha, page, pageSize, context, indDao); - rvMap = getResultsForVClassQuery(results, page, pageSize, alpha); + return getResultsForVClassQuery(results, page, pageSize, alpha); } catch(Throwable th) { log.error("Error retrieving individuals corresponding to intersection multiple classes." + vclassURIs.toString(), th); + return IndividualListResults.EMPTY; } - return rvMap; } - public static Map getRandomResultsForVClass(String vclassURI, int page, int pageSize, IndividualDao indDao, ServletContext context) { - Map rvMap = new HashMap(); + public static IndividualListResults getRandomResultsForVClass(String vclassURI, int page, int pageSize, IndividualDao indDao, ServletContext context) { try{ List classUris = Collections.singletonList(vclassURI); IndividualListQueryResults results = SolrQueryUtils.buildAndExecuteRandomVClassQuery(classUris, page, pageSize, context, indDao); - rvMap = getResultsForVClassQuery(results, page, pageSize, ""); + return getResultsForVClassQuery(results, page, pageSize, ""); } catch(Throwable th) { log.error("An error occurred retrieving random results for vclass query", th); + return IndividualListResults.EMPTY; } - return rvMap; } //TODO: Get rid of this method and utilize SolrQueryUtils - currently appears to be referenced @@ -201,24 +193,13 @@ public class IndividualListController extends FreemarkerHttpServlet { return SolrQueryUtils.getIndividualCount(vclassUris, indDao, context); } - private static Map getResultsForVClassQuery(IndividualListQueryResults results, int page, int pageSize, String alpha) { - Map rvMap = new HashMap(); - + private static IndividualListResults getResultsForVClassQuery(IndividualListQueryResults results, int page, int pageSize, String alpha) { long hitCount = results.getHitCount(); if ( hitCount > pageSize ){ - rvMap.put("showPages", Boolean.TRUE); - List pageRecords = makePagesList(hitCount, pageSize, page); - rvMap.put("pages", pageRecords); + return new IndividualListResults(hitCount, results.getIndividuals(), alpha, true, makePagesList(hitCount, pageSize, page)); }else{ - rvMap.put("showPages", Boolean.FALSE); - rvMap.put("pages", Collections.emptyList()); + return new IndividualListResults(hitCount, results.getIndividuals(), alpha, false, Collections.emptyList()); } - - rvMap.put("alpha",alpha); - rvMap.put("totalCount", hitCount); - rvMap.put("entities", results.getIndividuals()); - - return rvMap; } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individual/IndividualRequestAnalysisContextImpl.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individual/IndividualRequestAnalysisContextImpl.java index 5f3ebc7e4..a6ad31af7 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individual/IndividualRequestAnalysisContextImpl.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individual/IndividualRequestAnalysisContextImpl.java @@ -4,11 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.controller.individual; import java.util.List; -import javax.servlet.ServletContext; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; @@ -22,18 +17,13 @@ import edu.cornell.mannlib.vitro.webapp.filestorage.model.FileInfo; */ public class IndividualRequestAnalysisContextImpl implements IndividualRequestAnalysisContext { - private static final Log log = LogFactory - .getLog(IndividualRequestAnalysisContextImpl.class); - - - private final VitroRequest vreq; - private final ServletContext ctx; + + private final VitroRequest vreq; private final WebappDaoFactory wadf; private final IndividualDao iDao; public IndividualRequestAnalysisContextImpl(VitroRequest vreq) { - this.vreq = vreq; - this.ctx = vreq.getSession().getServletContext(); + this.vreq = vreq; this.wadf = vreq.getWebappDaoFactory(); this.iDao = wadf.getIndividualDao(); } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java new file mode 100644 index 000000000..1fda3985a --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java @@ -0,0 +1,48 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.controller.individuallist; + +import java.util.Collection; +import java.util.Map; + +import org.json.JSONException; +import org.json.JSONObject; + +import edu.cornell.mannlib.vitro.webapp.beans.Individual; +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; +import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao; +import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; + +/** + * Wrap an Individual in a JSON object for display by the script. + * + * This will be overridden in VIVO so we can have more info in the display. + */ +public class IndividualJsonWrapper { + static JSONObject packageIndividualAsJson(VitroRequest vreq, Individual ind) + throws JSONException { + // need an unfiltered dao to get firstnames and lastnames + WebappDaoFactory fullWdf = vreq.getUnfilteredWebappDaoFactory(); + + JSONObject jo = new JSONObject(); + jo.put("URI", ind.getURI()); + jo.put("label", ind.getRdfsLabel()); + jo.put("name", ind.getName()); + jo.put("thumbUrl", ind.getThumbUrl()); + jo.put("imageUrl", ind.getImageUrl()); + jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq)); + jo.put("mostSpecificTypes", getMostSpecificTypes(ind, fullWdf)); + return jo; + } + + public static Collection getMostSpecificTypes( + Individual individual, WebappDaoFactory wdf) { + ObjectPropertyStatementDao opsDao = wdf.getObjectPropertyStatementDao(); + Map mostSpecificTypes = opsDao + .getMostSpecificTypesInClassgroupsForIndividual(individual + .getURI()); + return mostSpecificTypes.values(); + } + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResults.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResults.java new file mode 100644 index 000000000..68cbc1d09 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResults.java @@ -0,0 +1,87 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.controller.individuallist; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import edu.cornell.mannlib.vitro.webapp.beans.Individual; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord; + +/** + * These are the paged results of a query for Individuals. + * + * The criteria for the search are the index of the desired page, the number of + * results displayed on each page, and an optional initial letter to search + * against. + * + * By the time this is built, the results have already been partially processed. + * A list of PageRecord object is included, with values that the GUI can use to + * create Alphabetical links. Maybe this processing should have been done later. + * Maybe it should have been left to the GUI. + */ +public class IndividualListResults { + private static final Log log = LogFactory + .getLog(IndividualListResults.class); + + public static final IndividualListResults EMPTY = new IndividualListResults(); + + private final long totalCount; + private final List entities; + private final String alpha; + private final boolean showPages; + private final List pages; + + public IndividualListResults(long totalCount, List entities, + String alpha, boolean showPages, List pages) { + this.totalCount = totalCount; + this.entities = entities; + this.alpha = alpha; + this.showPages = showPages; + this.pages = pages; + } + + private IndividualListResults() { + this(0L, Collections. emptyList(), "", false, Collections + . emptyList()); + } + + public long getTotalCount() { + return totalCount; + } + + public String getAlpha() { + return alpha; + } + + public List getEntities() { + return entities; + } + + public List getPages() { + return pages; + } + + public boolean isShowPages() { + return showPages; + } + + /** + * Some controllers put this data directly into the Freemarker body map. + * Others wrap it in JSON. + */ + public Map asFreemarkerMap() { + Map m = new HashMap<>(); + m.put("showPages", showPages); + m.put("pages", pages); + m.put("alpha", alpha); + m.put("totalCount", totalCount); + m.put("entities", entities); + return m; + } +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResultsUtils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResultsUtils.java new file mode 100644 index 000000000..e06f35af9 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualListResultsUtils.java @@ -0,0 +1,148 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.controller.individuallist; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.ArrayUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import edu.cornell.mannlib.vitro.webapp.beans.Individual; +import edu.cornell.mannlib.vitro.webapp.beans.VClass; +import edu.cornell.mannlib.vitro.webapp.controller.Controllers; +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord; + +/** + * Utility methods for procesing the paged results of a query for a list of Individuals. + * + * Right now, there is only a method to wrap the results in Json. + */ +public class IndividualListResultsUtils { + private static final Log log = LogFactory + .getLog(IndividualListResultsUtils.class); + + /** + * Process results related to VClass or vclasses. Handles both single and + * multiple vclasses being sent. + */ + public static JSONObject wrapIndividualListResultsInJson(IndividualListResults results, VitroRequest vreq, + boolean multipleVclasses) { + JSONObject rObj = new JSONObject(); + + if (log.isDebugEnabled()) { + dumpParametersFromRequest(vreq); + } + + try { + List vclasses = buildListOfRequestedVClasses(vreq); + + VClass vclass = null; + // if single vclass expected, then include vclass. + // This relates to what the expected behavior is, not size of list + if (!multipleVclasses) { + vclass = vclasses.get(0); + // currently used for ClassGroupPage + } else { + // For now, utilize very last VClass (assume that that is the one to be employed) + // TODO: Find more general way of dealing with this: put multiple ones in? + vclass = vclasses.get(vclasses.size() - 1); + // rObj.put("vclasses", new JSONObject().put("URIs",vitroClassIdStr).put("name",vclass.getName())); + } + + rObj.put("vclass", packageVClassAsJson(vclass)); + rObj.put("totalCount", results.getTotalCount()); + rObj.put("alpha", results.getAlpha()); + rObj.put("individuals", packageIndividualsAsJson(vreq, results.getEntities())); + rObj.put("pages", packagePageRecordsAsJson(results.getPages())); + rObj.put("letters", packageLettersAsJson()); + } catch (Exception ex) { + log.error("Error occurred in processing JSON object", ex); + } + return rObj; + } + + private static List buildListOfRequestedVClasses(VitroRequest vreq) + throws Exception { + String[] vitroClassIdStr = vreq.getParameterValues("vclassId"); + if (ArrayUtils.isEmpty(vitroClassIdStr)) { + log.error("parameter vclassId URI parameter expected "); + throw new Exception("parameter vclassId URI parameter expected "); + } + + List list = new ArrayList<>(); + for (String vclassId : vitroClassIdStr) { + VClass vclass = vreq.getWebappDaoFactory().getVClassDao() + .getVClassByURI(vclassId); + if (vclass == null) { + log.error("Couldn't retrieve vclass "); + throw new Exception("Class " + vclassId + " not found"); + } + list.add(vclass); + } + return list; + } + + private static JSONObject packageVClassAsJson(VClass vclass) + throws JSONException { + JSONObject jvclass = new JSONObject(); + jvclass.put("URI", vclass.getURI()); + jvclass.put("name", vclass.getName()); + return jvclass; + } + + private static JSONArray packageLettersAsJson() throws JSONException, + UnsupportedEncodingException { + List letters = Controllers.getLetters(); + JSONArray jletters = new JSONArray(); + for (String s : letters) { + JSONObject jo = new JSONObject(); + jo.put("text", s); + jo.put("param", "alpha=" + URLEncoder.encode(s, "UTF-8")); + jletters.put(jo); + } + return jletters; + } + + private static JSONArray packagePageRecordsAsJson(List pages) + throws JSONException { + JSONArray wpages = new JSONArray(); + for (PageRecord pr : pages) { + JSONObject p = new JSONObject(); + p.put("text", pr.text); + p.put("param", pr.param); + p.put("index", pr.index); + wpages.put(p); + } + return wpages; + } + + private static JSONArray packageIndividualsAsJson(VitroRequest vreq, + List inds) throws JSONException { + log.debug("Number of individuals returned from request: " + inds.size()); + + JSONArray jInds = new JSONArray(); + for (Individual ind : inds) { + jInds.put(IndividualJsonWrapper.packageIndividualAsJson(vreq, ind)); + } + return jInds; + } + + private static void dumpParametersFromRequest(VitroRequest vreq) { + Map pMap = vreq.getParameterMap(); + for (String name : pMap.keySet()) { + for (String value : pMap.get(name)) { + log.debug("value for " + name + ": '" + value + "'"); + } + } + } + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/json/JsonServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/json/JsonServlet.java index baf72ec82..6ed8a362e 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/json/JsonServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/json/JsonServlet.java @@ -3,11 +3,8 @@ package edu.cornell.mannlib.vitro.webapp.controller.json; import java.io.IOException; -import java.net.URLEncoder; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.Enumeration; import java.util.List; import java.util.Map; @@ -18,18 +15,15 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; import org.json.JSONObject; import edu.cornell.mannlib.vitro.webapp.beans.DataProperty; import edu.cornell.mannlib.vitro.webapp.beans.Individual; -import edu.cornell.mannlib.vitro.webapp.beans.VClass; -import edu.cornell.mannlib.vitro.webapp.controller.Controllers; import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; +import edu.cornell.mannlib.vitro.webapp.controller.individuallist.IndividualListResultsUtils; +import edu.cornell.mannlib.vitro.webapp.controller.individuallist.IndividualListResults; import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.utils.log.LogUtils; @@ -94,29 +88,28 @@ public class JsonServlet extends VitroHttpServlet { List vclassURIs = Collections.singletonList(vclassURI); VitroRequest vreq = new VitroRequest(req); - Map map = getSolrVClassIntersectionResults(vclassURIs, vreq, context); + IndividualListResults vcResults = getSolrVClassIntersectionResults(vclassURIs, vreq, context); //last parameter indicates single vclass instead of multiple vclasses - return processVclassResultsJSON(map, vreq, false); + return IndividualListResultsUtils.wrapIndividualListResultsInJson(vcResults, vreq, false); } public static JSONObject getSolrIndividualsByVClasses(List vclassURIs, HttpServletRequest req, ServletContext context) throws Exception { VitroRequest vreq = new VitroRequest(req); log.debug("Retrieve solr results for vclasses" + vclassURIs.toString()); - Map map = getSolrVClassIntersectionResults(vclassURIs, vreq, context); - log.debug("Results returned from Solr for " + vclassURIs.toString() + " are of size " + map.size()); + IndividualListResults vcResults = getSolrVClassIntersectionResults(vclassURIs, vreq, context); + log.debug("Results returned from Solr for " + vclassURIs.toString() + " are of size " + vcResults.getTotalCount()); - return processVclassResultsJSON(map, vreq, true); + return IndividualListResultsUtils.wrapIndividualListResultsInJson(vcResults, vreq, true); } //Including version for Solr query for Vclass Intersections - private static Map getSolrVClassIntersectionResults(List vclassURIs, VitroRequest vreq, ServletContext context){ + private static IndividualListResults getSolrVClassIntersectionResults(List vclassURIs, VitroRequest vreq, ServletContext context){ log.debug("Retrieving Solr intersection results for " + vclassURIs.toString()); String alpha = IndividualListController.getAlphaParameter(vreq); int page = IndividualListController.getPageParameter(vreq); log.debug("Alpha and page parameters are " + alpha + " and " + page); - Map map = null; try { - map = IndividualListController.getResultsForVClassIntersections( + return IndividualListController.getResultsForVClassIntersections( vclassURIs, page, INDIVIDUALS_PER_PAGE, alpha, @@ -124,23 +117,10 @@ public class JsonServlet extends VitroHttpServlet { context); } catch(Exception ex) { log.error("Error in retrieval of search results for VClass " + vclassURIs.toString(), ex); + return IndividualListResults.EMPTY; } - - return map; } - // Map given to process method includes the actual individuals returned from the search -// public static JSONObject processVClassResults(Map map, VitroRequest vreq, ServletContext context, boolean multipleVclasses) throws Exception{ -// JSONObject rObj = processVclassResultsJSON(map, vreq, multipleVclasses); -// return rObj; -// } - - public static Collection getMostSpecificTypes(Individual individual, WebappDaoFactory wdf) { - ObjectPropertyStatementDao opsDao = wdf.getObjectPropertyStatementDao(); - Map mostSpecificTypes = opsDao.getMostSpecificTypesInClassgroupsForIndividual(individual.getURI()); - return mostSpecificTypes.values(); - } - public static String getDataPropertyValue(Individual ind, DataProperty dp, WebappDaoFactory wdf){ String value = ind.getDataValue(dp.getURI()); if( value == null || value.isEmpty() ) @@ -152,21 +132,20 @@ public class JsonServlet extends VitroHttpServlet { public static JSONObject getRandomSolrIndividualsByVClass(String vclassURI, HttpServletRequest req, ServletContext context) throws Exception { VitroRequest vreq = new VitroRequest(req); - Map map = getRandomSolrVClassResults(vclassURI, vreq, context); + IndividualListResults vcResults = getRandomSolrVClassResults(vclassURI, vreq, context); //last parameter indicates single vclass instead of multiple vclasses - return processVclassResultsJSON(map, vreq, false); + return IndividualListResultsUtils.wrapIndividualListResultsInJson(vcResults, vreq, false); } //Including version for Random Solr query for Vclass Intersections - private static Map getRandomSolrVClassResults(String vclassURI, VitroRequest vreq, ServletContext context){ + private static IndividualListResults getRandomSolrVClassResults(String vclassURI, VitroRequest vreq, ServletContext context){ log.debug("Retrieving random Solr intersection results for " + vclassURI); int page = IndividualListController.getPageParameter(vreq); int pageSize = Integer.parseInt(vreq.getParameter("pageSize")); log.debug("page and pageSize parameters = " + page + " and " + pageSize); - Map map = null; try { - map = IndividualListController.getRandomResultsForVClass( + return IndividualListController.getRandomResultsForVClass( vclassURI, page, pageSize, @@ -174,126 +153,8 @@ public class JsonServlet extends VitroHttpServlet { context); } catch(Exception ex) { log.error("Error in retrieval of search results for VClass " + vclassURI, ex); + return IndividualListResults.EMPTY; } - - return map; } - - /** - * Process results related to VClass or vclasses. Handles both single and multiple vclasses being sent. - */ - public static JSONObject processVclassResultsJSON(Map map, VitroRequest vreq, boolean multipleVclasses) { - JSONObject rObj = new JSONObject(); - VClass vclass=null; - - try { - - // Properties from ontologies used by VIVO - should not be in vitro - DataProperty fNameDp = (new DataProperty()); - fNameDp.setURI("http://xmlns.com/foaf/0.1/firstName"); - DataProperty lNameDp = (new DataProperty()); - lNameDp.setURI("http://xmlns.com/foaf/0.1/lastName"); - DataProperty preferredTitleDp = (new DataProperty()); - preferredTitleDp.setURI("http://vivoweb.org/ontology/core#preferredTitle"); - - if( log.isDebugEnabled() ){ - @SuppressWarnings("unchecked") - Enumeration e = vreq.getParameterNames(); - while(e.hasMoreElements()){ - String name = e.nextElement(); - log.debug("parameter: " + name); - for( String value : vreq.getParameterValues(name) ){ - log.debug("value for " + name + ": '" + value + "'"); - } - } - } - - //need an unfiltered dao to get firstnames and lastnames - WebappDaoFactory fullWdf = vreq.getUnfilteredWebappDaoFactory(); - - String[] vitroClassIdStr = vreq.getParameterValues("vclassId"); - if ( vitroClassIdStr != null && vitroClassIdStr.length > 0){ - for(String vclassId: vitroClassIdStr) { - vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vclassId); - if (vclass == null) { - log.error("Couldn't retrieve vclass "); - throw new Exception ("Class " + vclassId + " not found"); - } - } - }else{ - log.error("parameter vclassId URI parameter expected "); - throw new Exception("parameter vclassId URI parameter expected "); - } - List vclassIds = Arrays.asList(vitroClassIdStr); - //if single vclass expected, then include vclass. This relates to what the expected behavior is, not size of list - if(!multipleVclasses) { - //currently used for ClassGroupPage - rObj.put("vclass", - new JSONObject().put("URI",vclass.getURI()) - .put("name",vclass.getName())); - } else { - //For now, utilize very last VClass (assume that that is the one to be employed) - //TODO: Find more general way of dealing with this - //put multiple ones in? - if(vclassIds.size() > 0) { - int numberVClasses = vclassIds.size(); - vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vclassIds.get(numberVClasses - 1)); - rObj.put("vclass", new JSONObject().put("URI",vclass.getURI()) - .put("name",vclass.getName())); - } - // rObj.put("vclasses", new JSONObject().put("URIs",vitroClassIdStr) - // .put("name",vclass.getName())); - } - if (vclass != null) { - - rObj.put("totalCount", map.get("totalCount")); - rObj.put("alpha", map.get("alpha")); - - List inds = (List)map.get("entities"); - log.debug("Number of individuals returned from request: " + inds.size()); - JSONArray jInds = new JSONArray(); - for(Individual ind : inds ){ - JSONObject jo = new JSONObject(); - jo.put("URI", ind.getURI()); - jo.put("label",ind.getRdfsLabel()); - jo.put("name",ind.getName()); - jo.put("thumbUrl", ind.getThumbUrl()); - jo.put("imageUrl", ind.getImageUrl()); - jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq)); - - jo.put("mostSpecificTypes", JsonServlet.getMostSpecificTypes(ind,fullWdf)); - jo.put("preferredTitle", JsonServlet.getDataPropertyValue(ind, preferredTitleDp, fullWdf)); - - jInds.put(jo); - } - rObj.put("individuals", jInds); - - JSONArray wpages = new JSONArray(); - //Made sure that PageRecord here is SolrIndividualListController not IndividualListController - List pages = (List)map.get("pages"); - for( PageRecord pr: pages ){ - JSONObject p = new JSONObject(); - p.put("text", pr.text); - p.put("param", pr.param); - p.put("index", pr.index); - wpages.put( p ); - } - rObj.put("pages",wpages); - - JSONArray jletters = new JSONArray(); - List letters = Controllers.getLetters(); - for( String s : letters){ - JSONObject jo = new JSONObject(); - jo.put("text", s); - jo.put("param", "alpha=" + URLEncoder.encode(s, "UTF-8")); - jletters.put( jo ); - } - rObj.put("letters", jletters); - } - } catch(Exception ex) { - log.error("Error occurred in processing JSON object", ex); - } - return rObj; - } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DateTimeValueFormGenerator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DateTimeValueFormGenerator.java index ebb7b298e..7ecf1695e 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DateTimeValueFormGenerator.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/DateTimeValueFormGenerator.java @@ -39,7 +39,7 @@ public class DateTimeValueFormGenerator extends BaseEditConfigurationGenerator initBasics(conf, vreq); initPropertyParameters(vreq, session, conf); - initObjectPropForm(conf, vreq); + initObjectPropForm(conf, vreq); conf.setTemplate(this.getTemplate()); @@ -126,6 +126,7 @@ public class DateTimeValueFormGenerator extends BaseEditConfigurationGenerator public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { HashMap formSpecificData = new HashMap(); formSpecificData.put("editMode", getEditMode(vreq).name().toLowerCase()); + formSpecificData.put("domainUri", getDomainUri(vreq)); editConfiguration.setFormSpecificData(formSpecificData); } @@ -140,4 +141,10 @@ public class DateTimeValueFormGenerator extends BaseEditConfigurationGenerator } return editMode; } + + private String getDomainUri(VitroRequest vreq) { + String domainUri = vreq.getParameter("domainUri"); + + return domainUri; + } } \ No newline at end of file diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForIndividualGenerator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForIndividualGenerator.java index 855a2d8ed..39e268a48 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForIndividualGenerator.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForIndividualGenerator.java @@ -1,6 +1,10 @@ /* $This file is distributed under the terms of the license in /doc/license.txt$ */ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; +import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_LITERAL; +import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_PREDICATE; +import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_URI; + import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Arrays; @@ -24,14 +28,12 @@ import com.hp.hpl.jena.vocabulary.RDFS; import edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyHelper; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddDataPropertyStatement; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddObjectPropertyStatement; import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Property; import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo; @@ -271,11 +273,10 @@ public class ManageLabelsForIndividualGenerator extends BaseEditConfigurationGen Individual individual = EditConfigurationUtils.getIndividual(vreq, config.getSubjectUri()); AddDataPropertyStatement adps = new AddDataPropertyStatement( vreq.getJenaOntModel(), individual.getURI(), - RequestActionConstants.SOME_URI); + SOME_URI, SOME_LITERAL); AddObjectPropertyStatement aops = new AddObjectPropertyStatement( vreq.getJenaOntModel(), individual.getURI(), - RequestActionConstants.SOME_PREDICATE, - RequestActionConstants.SOME_URI); + SOME_PREDICATE, SOME_URI); return PolicyHelper.isAuthorizedForActions(vreq, new Actions(adps).or(aops)); } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/PostEditCleanupController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/PostEditCleanupController.java index 9c7d6b9a0..b62254878 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/PostEditCleanupController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/PostEditCleanupController.java @@ -55,6 +55,15 @@ public class PostEditCleanupController extends FreemarkerHttpServlet{ return new RedirectResponseValues( UrlBuilder.getHomeUrl() ); } + //In some cases, a generator/form may have a regular URL to return to but the same generator + //may be used from different pages, so a parameter allowing the form to return to a specific page + //would be useful + + String returnURLParameter = vreq.getParameter("returnURL"); + if(returnURLParameter != null) { + return new DirectRedirectResponseValues( returnURLParameter ); + } + // If there is a urlToReturnTo that takes precedence if( editConfig.getUrlToReturnTo() != null && ! editConfig.getUrlToReturnTo().trim().isEmpty()){ //this does not get value substitution or the predicate anchor diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/services/shortview/FakeApplicationOntologyService.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/services/shortview/FakeApplicationOntologyService.java index c3a0b6be4..794837d24 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/services/shortview/FakeApplicationOntologyService.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/services/shortview/FakeApplicationOntologyService.java @@ -439,9 +439,13 @@ public class FakeApplicationOntologyService { * "display model". The query finds a preferred title for the individual. */ private static class FakeVivoPeopleDataGetter extends SparqlQueryDataGetter { - private static final String QUERY_STRING = "SELECT ?uri ?pt WHERE {\n" - + " ?uri ?pt\n" - + "} LIMIT 1"; + private static String QUERY_STRING = "" + + "PREFIX obo: \n" + + "PREFIX vcard: \n" + + "SELECT ?uri ?pt \n" + "WHERE { \n" + + " ?uri obo:ARG_2000028 ?vIndividual . \n" + + " ?vIndividual vcard:hasTitle ?vTitle . \n" + + " ?vTitle vcard:title ?pt . \n" + "} LIMIT 1"; private static final String FAKE_VIVO_PEOPLE_DATA_GETTER_URI = "http://FakeVivoPeopleDataGetter"; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/FileGraphSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/FileGraphSetup.java index 6cdcea7a6..aef019ae8 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/FileGraphSetup.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/FileGraphSetup.java @@ -188,6 +188,7 @@ public class FileGraphSetup implements ServletContextListener { baseModel.add(model); } log.info("Attached file graph as " + type + " submodel " + p.getFileName()); + } modelChanged = modelChanged | updateGraphInDB(dataset, model, type, p); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/RDFFilesLoader.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/RDFFilesLoader.java index f01b5b244..89b6dbfe6 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/RDFFilesLoader.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/servlet/setup/RDFFilesLoader.java @@ -87,14 +87,23 @@ public class RDFFilesLoader { OntModel model) { OntModel everytimeModel = ModelFactory .createOntologyModel(OntModelSpec.OWL_MEM); - Set paths = getPaths(locateHomeDirectory(ctx), RDF, modelPath, - EVERY_TIME); + String home = locateHomeDirectory(ctx); + Set paths = getPaths(home, RDF, modelPath, EVERY_TIME); for (Path p : paths) { + log.info("Loading " + relativePath(p, home)); readOntologyFileIntoModel(p, everytimeModel); } model.addSubModel(everytimeModel); } + private static Path relativePath(Path p, String home) { + try { + return Paths.get(home).relativize(p); + } catch (Exception e) { + return p; + } + } + /** * Create a model from all the RDF files in the specified directory. */ @@ -148,7 +157,7 @@ public class RDFFilesLoader { private static void readOntologyFileIntoModel(Path p, Model model) { String format = getRdfFormat(p); - log.info("Loading "+ p); + log.debug("Loading "+ p); try (InputStream stream = new FileInputStream(p.toFile())) { model.read(stream, null, format); log.debug("...successful"); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/DataGetterUtils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/DataGetterUtils.java index 008a3870f..f8aa99ce1 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/DataGetterUtils.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/DataGetterUtils.java @@ -3,10 +3,7 @@ package edu.cornell.mannlib.vitro.webapp.utils.dataGetter; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -import java.net.URLEncoder; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -17,7 +14,6 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; import org.json.JSONObject; import com.hp.hpl.jena.query.Query; @@ -35,20 +31,13 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory; import com.hp.hpl.jena.shared.Lock; import com.hp.hpl.jena.vocabulary.OWL; -import edu.cornell.mannlib.vitro.webapp.beans.DataProperty; -import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup; -import edu.cornell.mannlib.vitro.webapp.controller.Controllers; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; -import edu.cornell.mannlib.vitro.webapp.controller.json.JsonServlet; import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupsForRequest; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; -import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache; @@ -324,123 +313,6 @@ public class DataGetterUtils { return classGroupUri; } - /** - * Process results related to VClass or vclasses. Handles both single and multiple vclasses being sent. - */ - public static JSONObject processVclassResultsJSON(Map map, VitroRequest vreq, boolean multipleVclasses) { - JSONObject rObj = new JSONObject(); - VClass vclass=null; - - try { - - // Properties from ontologies used by VIVO - should not be in vitro - DataProperty fNameDp = (new DataProperty()); - fNameDp.setURI("http://xmlns.com/foaf/0.1/firstName"); - DataProperty lNameDp = (new DataProperty()); - lNameDp.setURI("http://xmlns.com/foaf/0.1/lastName"); - DataProperty preferredTitleDp = (new DataProperty()); - preferredTitleDp.setURI("http://vivoweb.org/ontology/core#preferredTitle"); - - if( log.isDebugEnabled() ){ - @SuppressWarnings("unchecked") - Enumeration e = vreq.getParameterNames(); - while(e.hasMoreElements()){ - String name = e.nextElement(); - log.debug("parameter: " + name); - for( String value : vreq.getParameterValues(name) ){ - log.debug("value for " + name + ": '" + value + "'"); - } - } - } - - //need an unfiltered dao to get firstnames and lastnames - WebappDaoFactory fullWdf = vreq.getUnfilteredWebappDaoFactory(); - - String[] vitroClassIdStr = vreq.getParameterValues("vclassId"); - if ( vitroClassIdStr != null && vitroClassIdStr.length > 0){ - for(String vclassId: vitroClassIdStr) { - vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vclassId); - if (vclass == null) { - log.error("Couldn't retrieve vclass "); - throw new Exception ("Class " + vclassId + " not found"); - } - } - }else{ - log.error("parameter vclassId URI parameter expected "); - throw new Exception("parameter vclassId URI parameter expected "); - } - List vclassIds = Arrays.asList(vitroClassIdStr); - //if single vclass expected, then include vclass. This relates to what the expected behavior is, not size of list - if(!multipleVclasses) { - //currently used for ClassGroupPage - rObj.put("vclass", - new JSONObject().put("URI",vclass.getURI()) - .put("name",vclass.getName())); - } else { - //For now, utilize very last VClass (assume that that is the one to be employed) - //TODO: Find more general way of dealing with this - //put multiple ones in? - if(vclassIds.size() > 0) { - int numberVClasses = vclassIds.size(); - vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(vclassIds.get(numberVClasses - 1)); - rObj.put("vclass", new JSONObject().put("URI",vclass.getURI()) - .put("name",vclass.getName())); - } - // rObj.put("vclasses", new JSONObject().put("URIs",vitroClassIdStr) - // .put("name",vclass.getName())); - } - if (vclass != null) { - - rObj.put("totalCount", map.get("totalCount")); - rObj.put("alpha", map.get("alpha")); - - List inds = (List)map.get("entities"); - log.debug("Number of individuals returned from request: " + inds.size()); - JSONArray jInds = new JSONArray(); - for(Individual ind : inds ){ - JSONObject jo = new JSONObject(); - jo.put("URI", ind.getURI()); - jo.put("label",ind.getRdfsLabel()); - jo.put("name",ind.getName()); - jo.put("thumbUrl", ind.getThumbUrl()); - jo.put("imageUrl", ind.getImageUrl()); - jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq)); - - jo.put("mostSpecificTypes", JsonServlet.getMostSpecificTypes(ind,fullWdf)); - jo.put("preferredTitle", JsonServlet.getDataPropertyValue(ind, preferredTitleDp, fullWdf)); - - jInds.put(jo); - } - rObj.put("individuals", jInds); - - JSONArray wpages = new JSONArray(); - //Made sure that PageRecord here is SolrIndividualListController not IndividualListController - List pages = (List)map.get("pages"); - for( PageRecord pr: pages ){ - JSONObject p = new JSONObject(); - p.put("text", pr.text); - p.put("param", pr.param); - p.put("index", pr.index); - wpages.put( p ); - } - rObj.put("pages",wpages); - - JSONArray jletters = new JSONArray(); - List letters = Controllers.getLetters(); - for( String s : letters){ - JSONObject jo = new JSONObject(); - jo.put("text", s); - jo.put("param", "alpha=" + URLEncoder.encode(s, "UTF-8")); - jletters.put( jo ); - } - rObj.put("letters", jletters); - } - } catch(Exception ex) { - log.error("Error occurred in processing JSON object", ex); - } - return rObj; - } - private static final String forClassGroupURI = "<" + DisplayVocabulary.FOR_CLASSGROUP + ">"; private static final String classGroupForDataGetterQuery = diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/IndividualsForClassesDataGetter.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/IndividualsForClassesDataGetter.java index 1788e3fa4..45c4a3eba 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/IndividualsForClassesDataGetter.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/IndividualsForClassesDataGetter.java @@ -353,14 +353,15 @@ public class IndividualsForClassesDataGetter extends DataGetterBase implements D public String getDataServiceUrl() { return UrlBuilder.getUrl("/dataservice?getRenderedSolrIndividualsByVClass=1&vclassId="); } + /** * For processig of JSONObject */ - public JSONObject convertToJSON(Map map, VitroRequest vreq) { - JSONObject rObj = DataGetterUtils.processVclassResultsJSON(map, vreq, true); + public JSONObject convertToJSON(Map dataMap, VitroRequest vreq) { + JSONObject rObj = null; return rObj; } - + protected static void setAllClassCountsToZero(VClassGroup vcg){ for(VClass vc : vcg){ vc.setEntityCount(0); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/SolrIndividualsDataGetter.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/SolrIndividualsDataGetter.java index 278b8c645..cb5e89c67 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/SolrIndividualsDataGetter.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/dataGetter/SolrIndividualsDataGetter.java @@ -3,9 +3,7 @@ package edu.cornell.mannlib.vitro.webapp.utils.dataGetter; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -23,7 +21,6 @@ import com.hp.hpl.jena.query.QuerySolutionMap; import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.ResourceFactory; import com.hp.hpl.jena.shared.Lock; @@ -33,8 +30,9 @@ import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.SearchException; +import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; +import edu.cornell.mannlib.vitro.webapp.controller.individuallist.IndividualListResults; import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary; import edu.cornell.mannlib.vitro.webapp.utils.solr.SolrQueryUtils; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual; @@ -174,16 +172,15 @@ public class SolrIndividualsDataGetter extends DataGetterBase implements DataGet try { String alpha = SolrQueryUtils.getAlphaParameter(vreq); int page = SolrQueryUtils.getPageParameter(vreq); - Map map = IndividualListController.getResultsForVClass( + IndividualListResults vcResults = IndividualListController.getResultsForVClass( vclass.getURI(), page, alpha, vreq.getWebappDaoFactory().getIndividualDao(), vreq.getSession().getServletContext()); - body.putAll(map); + body.putAll(vcResults.asFreemarkerMap()); - @SuppressWarnings("unchecked") - List inds = (List)map.get("entities"); + List inds = vcResults.getEntities(); List indsTm = new ArrayList(); if (inds != null) { for ( Individual ind : inds ) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/solr/SolrQueryUtils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/solr/SolrQueryUtils.java index 608ae0efc..924a5cd58 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/solr/SolrQueryUtils.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/solr/SolrQueryUtils.java @@ -4,8 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.utils.solr; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -20,9 +18,7 @@ import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.response.QueryResponse; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListQueryResults; -import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.SearchException; import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames; import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/edit/EditConfigurationTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/edit/EditConfigurationTemplateModel.java index fec05b51e..49b17fbe4 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/edit/EditConfigurationTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/edit/EditConfigurationTemplateModel.java @@ -666,7 +666,13 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel { //this url is for canceling public String getCancelUrl() { String editKey = editConfig.getEditKey(); - return EditConfigurationUtils.getCancelUrlBase(vreq) + "?editKey=" + editKey + "&cancel=true"; + String cancelURL = EditConfigurationUtils.getCancelUrlBase(vreq) + "?editKey=" + editKey + "&cancel=true"; + //Check for special return url parameter + String returnURLParameter = vreq.getParameter("returnURL"); + if(returnURLParameter != null && !returnURLParameter.isEmpty() ) { + cancelURL += "&returnURL=" + returnURLParameter; + } + return cancelURL; } //Get confirm deletion url diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseIndividualTemplateModel.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseIndividualTemplateModel.java index bed1d0daf..0d8901251 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseIndividualTemplateModel.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individual/BaseIndividualTemplateModel.java @@ -2,6 +2,10 @@ package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual; +import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_LITERAL; +import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_PREDICATE; +import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_URI; + import java.util.Collection; import java.util.List; import java.util.Map; @@ -16,7 +20,6 @@ import edu.cornell.mannlib.vedit.beans.LoginStatusBean; import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission; import edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyHelper; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions; -import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddDataPropertyStatement; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.propstmt.AddObjectPropertyStatement; import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement; @@ -116,11 +119,10 @@ public abstract class BaseIndividualTemplateModel extends BaseTemplateModel { public boolean isEditable() { AddDataPropertyStatement adps = new AddDataPropertyStatement( vreq.getJenaOntModel(), individual.getURI(), - RequestActionConstants.SOME_URI); + SOME_URI, SOME_LITERAL); AddObjectPropertyStatement aops = new AddObjectPropertyStatement( vreq.getJenaOntModel(), individual.getURI(), - RequestActionConstants.SOME_PREDICATE, - RequestActionConstants.SOME_URI); + SOME_PREDICATE, SOME_URI); return PolicyHelper.isAuthorizedForActions(vreq, new Actions(adps).or(aops)); } 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 621c35998..0011726e4 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 @@ -2,6 +2,8 @@ package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual; +import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_LITERAL; + import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -118,7 +120,7 @@ public class DataPropertyTemplateModel extends PropertyTemplateModel { // Determine whether a new statement can be added RequestedAction action = new AddDataPropertyStatement( - vreq.getJenaOntModel(), subjectUri, propertyUri); + vreq.getJenaOntModel(), subjectUri, propertyUri, SOME_LITERAL); if ( ! PolicyHelper.isAuthorizedForActions(vreq, action) ) { return; } diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicyTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicyTest.java index 9459e6ca5..365983216 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicyTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicyTest.java @@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.auth.policy; import static edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization.AUTHORIZED; import static edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization.INCONCLUSIVE; +import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_LITERAL; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNull; @@ -31,6 +32,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin.RebuildTextIn import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin.RemoveUser; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin.ServerStatus; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.admin.UpdateTextIndex; +import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ontology.CreateOwlClass; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ontology.DefineDataProperty; @@ -125,19 +127,19 @@ public class SelfEditingPolicyTest extends AbstractTestClass { // now with dataprop statements whatToAuth = new AddDataPropertyStatement(ontModel, SELFEDITOR_URI, - "http://mannlib.cornell.edu/bad#prp234"); + "http://mannlib.cornell.edu/bad#prp234", SOME_LITERAL); assertDecision(INCONCLUSIVE, policy.isAuthorized(ids, whatToAuth)); whatToAuth = new AddDataPropertyStatement(ontModel, SELFEDITOR_URI, - "http://mannlib.cornell.edu/bad#prp999"); + "http://mannlib.cornell.edu/bad#prp999", SOME_LITERAL); assertDecision(INCONCLUSIVE, policy.isAuthorized(ids, whatToAuth)); whatToAuth = new AddDataPropertyStatement(ontModel, SELFEDITOR_URI, - SAFE_PREDICATE.getURI()); + SAFE_PREDICATE.getURI(), SOME_LITERAL); assertDecision(AUTHORIZED, policy.isAuthorized(ids, whatToAuth)); whatToAuth = new AddDataPropertyStatement(ontModel, SELFEDITOR_URI, - UNSAFE_PREDICATE.getURI()); + UNSAFE_PREDICATE.getURI(), SOME_LITERAL); assertDecision(INCONCLUSIVE, policy.isAuthorized(ids, whatToAuth)); } @@ -219,16 +221,16 @@ public class SelfEditingPolicyTest extends AbstractTestClass { // @Test public void testVisitIdentifierBundleEditDataPropStmt() { - whatToAuth = new EditDataPropertyStatement(ontModel, SELFEDITOR_URI,SAFE_PREDICATE.getURI()); + whatToAuth = new EditDataPropertyStatement(ontModel, SELFEDITOR_URI,SAFE_PREDICATE.getURI(), SOME_LITERAL); assertDecision(AUTHORIZED, policy.isAuthorized(ids, whatToAuth)); - whatToAuth = new EditDataPropertyStatement(ontModel, SELFEDITOR_URI, UNSAFE_PREDICATE.getURI()); + whatToAuth = new EditDataPropertyStatement(ontModel, SELFEDITOR_URI, UNSAFE_PREDICATE.getURI(), SOME_LITERAL); assertDecision(INCONCLUSIVE, policy.isAuthorized(ids, whatToAuth)); - whatToAuth = new EditDataPropertyStatement(ontModel, UNSAFE_RESOURCE, SAFE_PREDICATE.getURI()); + whatToAuth = new EditDataPropertyStatement(ontModel, UNSAFE_RESOURCE, SAFE_PREDICATE.getURI(), SOME_LITERAL); assertDecision(INCONCLUSIVE, policy.isAuthorized(ids, whatToAuth)); - whatToAuth = new EditDataPropertyStatement(ontModel, SAFE_RESOURCE, SAFE_PREDICATE.getURI()); + whatToAuth = new EditDataPropertyStatement(ontModel, SAFE_RESOURCE, SAFE_PREDICATE.getURI(), SOME_LITERAL); assertDecision(INCONCLUSIVE, policy.isAuthorized(ids, whatToAuth)); } @@ -288,7 +290,7 @@ public class SelfEditingPolicyTest extends AbstractTestClass { public void twoSEIsFindDataPropertySubject() { setUpTwoSEIs(); - whatToAuth = new EditDataPropertyStatement(ontModel, SELFEDITOR_URI, SAFE_PREDICATE.getURI()); + whatToAuth = new EditDataPropertyStatement(ontModel, SELFEDITOR_URI, SAFE_PREDICATE.getURI(), SOME_LITERAL); assertDecision(AUTHORIZED, policy.isAuthorized(ids, whatToAuth)); } @@ -296,7 +298,7 @@ public class SelfEditingPolicyTest extends AbstractTestClass { public void twoSEIsDontFindInDataProperty() { setUpTwoSEIs(); - whatToAuth = new EditDataPropertyStatement(ontModel, SAFE_RESOURCE, SAFE_PREDICATE.getURI()); + whatToAuth = new EditDataPropertyStatement(ontModel, SAFE_RESOURCE, SAFE_PREDICATE.getURI(), SOME_LITERAL); assertDecision(INCONCLUSIVE, policy.isAuthorized(ids, whatToAuth)); } diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicy_2_Test.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicy_2_Test.java index aa5aa6ac0..f1448b0e4 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicy_2_Test.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/auth/policy/SelfEditingPolicy_2_Test.java @@ -2,6 +2,8 @@ package edu.cornell.mannlib.vitro.webapp.auth.policy; +import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_LITERAL; + import java.io.InputStream; import org.apache.commons.logging.Log; @@ -306,7 +308,7 @@ public class SelfEditingPolicy_2_Test extends AbstractTestClass { private void assertEditDataPropStmt(String individualURI, String datapropURI, String data, Authorization expectedAuthorization) { EditDataPropertyStatement whatToAuth = new EditDataPropertyStatement( - ontModel, individualURI, datapropURI); + ontModel, individualURI, datapropURI, SOME_LITERAL); PolicyDecision dec = policy.isAuthorized(ids, whatToAuth); log.debug(dec); Assert.assertNotNull(dec); diff --git a/webapp/web/i18n/all.properties b/webapp/web/i18n/all.properties index 193c8a2e7..38912ca5f 100644 --- a/webapp/web/i18n/all.properties +++ b/webapp/web/i18n/all.properties @@ -134,10 +134,6 @@ submit_add_new_account = Add new account account_created = Your {0} account has been created. account_created_subject = Your {0} account has been created. -account_created_email_html = @@file files/accountCreatedEmail.html -account_created_email_text = @@file files/accountCreatedEmail.txt -account_created_external_email_html = @@file files/accountCreatedExternalOnlyEmail.html -account_created_external_email_text = @@file files/accountCreatedExternalOnlyEmail.txt confirm_delete_account_singular = Are you sure you want to delete this account? confirm_delete_account_plural = Are you sure you want to delete these accounts? @@ -156,21 +152,11 @@ select_associated_profile = Select the associated profile create_associated_profile = Create the associated profile email_changed_subject = Your {0} email account has been changed. -email_changed_html = @@file files/accountEmailChanged.html -email_changed_text = @@file files/accountEmailChanged.txt create_your_password = Create your Password password_created_subject = Your {0} password has successfully been created. -password_created_email_html = @@file files/passwordCreatedEmail.html -password_created_email_text = @@file files/passwordCreatedEmail.txt - password_reset_pending_subject = {0} reset password request -password_reset_pending_email_html = @@file files/passwordResetPending.html -password_reset_pending_email_text = @@file files/passwordResetPending.txt - password_reset_complete_subject = Your {0} password changed. -password_reset_complete_email_html = @@file files/passwordResetComplete.html -password_reset_complete_email_text = @@file files/passwordResetComplete.txt reset_your_password = Reset your Password first_time_login = First time log in @@ -193,8 +179,6 @@ password_saved_please_login = Your password has been saved. Please log in. please_provide_contact_information = Please provide your contact information to finish creating your account. first_time_login_note = Note: An email will be sent to the address entered above notifying \ that an account has been created. -first_time_external_email_html = @@file files/accountFirstTimeExternal.html -first_time_external_email_text = @@file files/accountFirstTimeExternal.txt myAccount_heading = My account myAccount_confirm_changes = Your changes have been saved. diff --git a/webapp/web/i18n/files/accountCreatedEmail.html b/webapp/web/i18n/files/accountCreatedEmail.html deleted file mode 100644 index 96b84d727..000000000 --- a/webapp/web/i18n/files/accountCreatedEmail.html +++ /dev/null @@ -1,39 +0,0 @@ - - - {1} - - -

    - {2} {3} -

    - -

    - Congratulations! -

    - -

    - We have created your new account on {0}, associated with {4}. -

    - -

    - If you did not request this new account you can safely ignore this email. - This request will expire if not acted upon for 30 days. -

    - -

    - Click the link below to create your password for your new account using our secure server. -

    - -

    - {5} -

    - -

    - If the link above doesn't work, you can copy and paste the link directly into your browser's address bar. -

    - -

    - Thanks! -

    - - diff --git a/webapp/web/i18n/files/accountCreatedEmail.txt b/webapp/web/i18n/files/accountCreatedEmail.txt deleted file mode 100644 index 4dcd900c8..000000000 --- a/webapp/web/i18n/files/accountCreatedEmail.txt +++ /dev/null @@ -1,17 +0,0 @@ -{2} {3} - -Congratulations! - -We have created your new account on {0}, -associated with {4}. - -If you did not request this new account you can safely ignore this email. -This request will expire if not acted upon for 30 days. - -Paste the link below into your browser's address bar to create your password -for your new account using our secure server. - -{5} - -Thanks! - diff --git a/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.html b/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.html deleted file mode 100644 index 164bf87ae..000000000 --- a/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.html +++ /dev/null @@ -1,22 +0,0 @@ - - - ${1} - - -

    - ${2} ${3} -

    - -

    - Congratulations! -

    - -

    - We have created your new VIVO account associated with ${4}. -

    - -

    - Thanks! -

    - - diff --git a/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.txt b/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.txt deleted file mode 100644 index c55cb3f9a..000000000 --- a/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.txt +++ /dev/null @@ -1,9 +0,0 @@ -${2} ${3} - -Congratulations! - -We have created your new VIVO account associated with -${4}. - -Thanks! - diff --git a/webapp/web/i18n/files/accountEmailChanged.html b/webapp/web/i18n/files/accountEmailChanged.html deleted file mode 100644 index 5a2e51e50..000000000 --- a/webapp/web/i18n/files/accountEmailChanged.html +++ /dev/null @@ -1,19 +0,0 @@ - - - {1} - - -

    - Hi, {2} ${3} -

    - -

    - You recently changed the email address associated with - ${2} ${3} -

    - -

    - Thank you. -

    - - diff --git a/webapp/web/i18n/files/accountEmailChanged.txt b/webapp/web/i18n/files/accountEmailChanged.txt deleted file mode 100644 index 5f560dca1..000000000 --- a/webapp/web/i18n/files/accountEmailChanged.txt +++ /dev/null @@ -1,6 +0,0 @@ -Hi, {2} {3} - -You recently changed the email address associated with -{2} {3} - -Thank you. diff --git a/webapp/web/i18n/files/accountFirstTimeExternal.html b/webapp/web/i18n/files/accountFirstTimeExternal.html deleted file mode 100644 index 61dca7f3c..000000000 --- a/webapp/web/i18n/files/accountFirstTimeExternal.html +++ /dev/null @@ -1,22 +0,0 @@ - - - {1} - - -

    - {2} {3} -

    - -

    - Congratulations! -

    - -

    - We have created your new {0} account associated with {4}. -

    - -

    - Thanks! -

    - - diff --git a/webapp/web/i18n/files/accountFirstTimeExternal.txt b/webapp/web/i18n/files/accountFirstTimeExternal.txt deleted file mode 100644 index 1cb60552b..000000000 --- a/webapp/web/i18n/files/accountFirstTimeExternal.txt +++ /dev/null @@ -1,8 +0,0 @@ -{2} {3} - -Congratulations! - -We have created your new {0} account associated with -{4} - -Thanks! diff --git a/webapp/web/i18n/files/passwordCreatedEmail.html b/webapp/web/i18n/files/passwordCreatedEmail.html deleted file mode 100644 index 15cf8bb0d..000000000 --- a/webapp/web/i18n/files/passwordCreatedEmail.html +++ /dev/null @@ -1,22 +0,0 @@ - - - {1} - - -

    - {2} {3} -

    - -

    - Password successfully created. -

    - -

    - Your new password associated with {4} has been created. -

    - -

    - Thank you. -

    - - diff --git a/webapp/web/i18n/files/passwordCreatedEmail.txt b/webapp/web/i18n/files/passwordCreatedEmail.txt deleted file mode 100644 index dbd9e9da0..000000000 --- a/webapp/web/i18n/files/passwordCreatedEmail.txt +++ /dev/null @@ -1,8 +0,0 @@ -{2} {3} - -Password successfully created. - -Your new password associated with {4} -has been created. - -Thank you. diff --git a/webapp/web/i18n/files/passwordRequestPending.html b/webapp/web/i18n/files/passwordRequestPending.html deleted file mode 100644 index bd20cb392..000000000 --- a/webapp/web/i18n/files/passwordRequestPending.html +++ /dev/null @@ -1,34 +0,0 @@ - - - {1} - - -

    - Dear {2} {3}: -

    - -

    - We have received a request to reset the password for your {0} account ({4}). -

    - -

    - Please follow the instructions below to proceed with your password reset. -

    - -

    - If you did not request this new account you can safely ignore this email. - This request will expire if not acted upon within 30 days. -

    - -

    - Click on the link below or paste it into your browser's address bar to reset your password - using our secure server. -

    - -

    - {5} -

    - -

    Thank you!

    - - diff --git a/webapp/web/i18n/files/passwordRequestPending.txt b/webapp/web/i18n/files/passwordRequestPending.txt deleted file mode 100644 index e8c92b5f2..000000000 --- a/webapp/web/i18n/files/passwordRequestPending.txt +++ /dev/null @@ -1,16 +0,0 @@ -Dear {2} {3}: - -We have received a request to reset the password for your {0} account -({4}). - -Please follow the instructions below to proceed with your password reset. - -If you did not request this new account you can safely ignore this email. -This request will expire if not acted upon within 30 days. - -Paste the link below into your browser's address bar to reset your password -using our secure server. - -{5} - -Thank you! diff --git a/webapp/web/i18n/files/passwordResetComplete.html b/webapp/web/i18n/files/passwordResetComplete.html deleted file mode 100644 index bfa756f15..000000000 --- a/webapp/web/i18n/files/passwordResetComplete.html +++ /dev/null @@ -1,22 +0,0 @@ - - - {1} - - -

    - {2} {3} -

    - -

    - Password successfully changed. -

    - -

    - Your new password associated with {4} has been changed. -

    - -

    - Thank you. -

    - - diff --git a/webapp/web/i18n/files/passwordResetComplete.txt b/webapp/web/i18n/files/passwordResetComplete.txt deleted file mode 100644 index 99503085c..000000000 --- a/webapp/web/i18n/files/passwordResetComplete.txt +++ /dev/null @@ -1,8 +0,0 @@ -{2} {3} - -Password successfully changed. - -Your new password associated with {4} -has been changed. - -Thank you. diff --git a/webapp/web/i18n/files/passwordResetPending.html b/webapp/web/i18n/files/passwordResetPending.html deleted file mode 100644 index bd20cb392..000000000 --- a/webapp/web/i18n/files/passwordResetPending.html +++ /dev/null @@ -1,34 +0,0 @@ - - - {1} - - -

    - Dear {2} {3}: -

    - -

    - We have received a request to reset the password for your {0} account ({4}). -

    - -

    - Please follow the instructions below to proceed with your password reset. -

    - -

    - If you did not request this new account you can safely ignore this email. - This request will expire if not acted upon within 30 days. -

    - -

    - Click on the link below or paste it into your browser's address bar to reset your password - using our secure server. -

    - -

    - {5} -

    - -

    Thank you!

    - - diff --git a/webapp/web/i18n/files/passwordResetPending.txt b/webapp/web/i18n/files/passwordResetPending.txt deleted file mode 100644 index 5d34952f3..000000000 --- a/webapp/web/i18n/files/passwordResetPending.txt +++ /dev/null @@ -1,16 +0,0 @@ -Dear {2} {3}: - -We have received a request to reset the password for your {0} account -({4}). - -Please follow the instructions below to proceed with your password reset. - -If you did not request this new account you can safely ignore this email. -This request will expire if not acted upon within 30 days. - -Paste the link below into your browser's address bar to reset your password -using our secure server. - -{5} - -Thank you! \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedEmail.ftl index b02c2e415..ce80a5481 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedEmail.ftl @@ -2,22 +2,67 @@ <#-- Confirmation that an account has been created. --> -<#assign strings = i18n() /> +<#assign subject = "Your ${siteName} account has been created." /> -<#assign subject = strings.account_created(siteName) /> +<#assign html> + + + ${subject} + + +

    + ${userAccount.firstName} ${userAccount.lastName} +

    -<#assign html = strings.account_created_email_html(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress, - passwordLink) /> +

    + Congratulations! +

    -<#assign text = strings.account_created_email_text(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress, - passwordLink) /> +

    + We have created your new account on ${siteName}, associated with ${userAccount.emailAddress}. +

    -<@email subject=subject html=html text=text /> \ No newline at end of file +

    + If you did not request this new account you can safely ignore this email. + This request will expire if not acted upon for 30 days. +

    + +

    + Click the link below to create your password for your new account using our secure server. +

    + +

    + ${passwordLink} +

    + +

    + If the link above doesn't work, you can copy and paste the link directly into your browser's address bar. +

    + +

    + Thanks! +

    + + + + +<#assign text> +${userAccount.firstName} ${userAccount.lastName} + +Congratulations! + +We have created your new account on ${siteName}, +associated with ${userAccount.emailAddress}. + +If you did not request this new account you can safely ignore this email. +This request will expire if not acted upon for 30 days. + +Paste the link below into your browser's address bar to create your password +for your new account using our secure server. + +${passwordLink} + +Thanks! + + +<@email subject=subject html=html text=text /> diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedExternalOnlyEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedExternalOnlyEmail.ftl index 9b787983c..844df023c 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedExternalOnlyEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedExternalOnlyEmail.ftl @@ -2,18 +2,42 @@ <#-- Confirmation that an account has been created. --> -<#assign subject = strings.account_created(siteName) /> +<#assign subject = "Your ${siteName} account has been created." /> -<#assign html = strings.account_created_external_email_html(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress) /> +<#assign html> + + + ${subject} + + +

    + ${userAccount.firstName} ${userAccount.lastName} +

    -<#assign text = string.account_created_external_email_text(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress) /> +

    + Congratulations! +

    -<@email subject=subject html=html text=text /> \ No newline at end of file +

    + We have created your new VIVO account associated with ${userAccount.emailAddress}. +

    + +

    + Thanks! +

    + + + + +<#assign text> +${userAccount.firstName} ${userAccount.lastName} + +Congratulations! + +We have created your new VIVO account associated with +${userAccount.emailAddress}. + +Thanks! + + +<@email subject=subject html=html text=text /> diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-confirmEmailChangedEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-confirmEmailChangedEmail.ftl index d091af468..2f55508f7 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-confirmEmailChangedEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-confirmEmailChangedEmail.ftl @@ -2,20 +2,37 @@ <#-- Confirmation that the user has changed his email account. --> -<#assign strings = i18n() /> +<#assign subject = "Your ${siteName} email account has been changed." /> -<#assign subject = strings.email_changed_subject(siteName) /> +<#assign html> + + + ${subject} + + +

    + Hi, ${userAccount.firstName} ${userAccount.lastName} +

    -<#assign html = strings.email_changed_html(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress) /> +

    + You recently changed the email address associated with + ${userAccount.firstName} ${userAccount.lastName} +

    -<#assign text = strings.email_changed_text(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress) /> +

    + Thank you. +

    + + + + +<#assign text> +Hi, ${userAccount.firstName} ${userAccount.lastName} + +You recently changed the email address associated with +${userAccount.firstName} ${userAccount.lastName} + +Thank you. + <@email subject=subject html=html text=text /> diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternalEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternalEmail.ftl index 27cb200d7..04a8e6e2b 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternalEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternalEmail.ftl @@ -2,20 +2,42 @@ <#-- Confirmation that an account has been created for an externally-authenticated user. --> -<#assign strings = i18n() /> +<#assign subject = "Your ${siteName} account has been created." /> -<#assign subject = strings.account_created(siteName) /> +<#assign html> + + + ${subject} + + +

    + ${userAccount.firstName} ${userAccount.lastName} +

    -<#assign html = strings.first_time_external_email_html(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress) /> +

    + Congratulations! +

    -<#assign text = strings.first_time_external_email_text(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress) /> +

    + We have created your new VIVO account associated with ${userAccount.emailAddress}. +

    -<@email subject=subject html=html text=text /> \ No newline at end of file +

    + Thanks! +

    + + + + +<#assign text> +${userAccount.firstName} ${userAccount.lastName} + +Congratulations! + +We have created your new VIVO account associated with +${userAccount.emailAddress}. + +Thanks! + + +<@email subject=subject html=html text=text /> diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordCreatedEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordCreatedEmail.ftl index 60cc436d7..2f80d500d 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordCreatedEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordCreatedEmail.ftl @@ -2,20 +2,42 @@ <#-- Confirmation that an password has been created. --> -<#assign strings = i18n() /> +<#assign subject = "Your ${siteName} password has successfully been created." /> -<#assign subject = strings.password_created_subject(siteName) /> +<#assign html> + + + ${subject} + + +

    + ${userAccount.firstName} ${userAccount.lastName} +

    -<#assign html = strings.password_created_email_html(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress) /> +

    + Password successfully created. +

    -<#assign text = strings.password_created_email_text(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress) /> +

    + Your new password associated with ${userAccount.emailAddress} has been created. +

    -<@email subject=subject html=html text=text /> \ No newline at end of file +

    + Thank you. +

    + + + + +<#assign text> +${userAccount.firstName} ${userAccount.lastName} + +Password successfully created. + +Your new password associated with ${userAccount.emailAddress} +has been created. + +Thank you. + + +<@email subject=subject html=html text=text /> diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetCompleteEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetCompleteEmail.ftl index 55af25bfa..c4e64c1cc 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetCompleteEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetCompleteEmail.ftl @@ -2,20 +2,43 @@ <#-- Confirmation that a password has been reset. --> -<#assign strings = i18n() /> +<#assign subject = "Your ${siteName} password changed." /> -<#assign subject = strings.password_reset_complete_subject(siteName) /> +<#assign html> + + + ${subject} + -<#assign html = strings.password_reset_complete_email_html(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress) /> + +

    + ${userAccount.firstName} ${userAccount.lastName} +

    -<#assign text = strings.password_reset_complete_email_text(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress) /> +

    + Password successfully changed. +

    -<@email subject=subject html=html text=text /> \ No newline at end of file +

    + Your new password associated with ${userAccount.emailAddress} has been changed. +

    + +

    + Thank you. +

    + + + + +<#assign text> +${userAccount.firstName} ${userAccount.lastName} + +Password successfully changed. + +Your new password associated with ${userAccount.emailAddress} +has been changed. + +Thank you. + + +<@email subject=subject html=html text=text /> diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetPendingEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetPendingEmail.ftl index e02bdfd9a..9ac0438ee 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetPendingEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetPendingEmail.ftl @@ -2,22 +2,60 @@ <#-- Confirmation email for user account password reset --> -<#assign strings = i18n() /> +<#assign subject = "${siteName} reset password request" /> -<#assign subject = strings.password_reset_pending_subject(siteName) /> +<#assign html> + + + ${subject} + + +

    + Dear ${userAccount.firstName} ${userAccount.lastName}: +

    + +

    + We have received a request to reset the password for your ${siteName} account (${userAccount.emailAddress}). +

    + +

    + Please follow the instructions below to proceed with your password reset. +

    + +

    + If you did not request this new account you can safely ignore this email. + This request will expire if not acted upon within 30 days. +

    + +

    + Click on the link below or paste it into your browser's address bar to reset your password + using our secure server. +

    + +

    ${passwordLink}

    + +

    Thank you!

    + + + -<#assign html = strings.password_reset_pending_email_html(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress, - passwordLink) /> +<#assign text> +Dear ${userAccount.firstName} ${userAccount.lastName}: + +We have received a request to reset the password for your ${siteName} account +(${userAccount.emailAddress}). -<#assign text = strings.password_reset_pending_email_text(siteName, - subject, - userAccount.firstName, - userAccount.lastName, - userAccount.emailAddress, - passwordLink) /> +Please follow the instructions below to proceed with your password reset. -<@email subject=subject html=html text=text /> \ No newline at end of file +If you did not request this new account you can safely ignore this email. +This request will expire if not acted upon within 30 days. + +Paste the link below into your browser's address bar to reset your password +using our secure server. + +${passwordLink} + +Thank you! + + +<@email subject=subject html=html text=text /> diff --git a/webapp/web/templates/freemarker/body/individual/individual-menu.ftl b/webapp/web/templates/freemarker/body/individual/individual-menu.ftl index 2099c0c96..40a901d1b 100644 --- a/webapp/web/templates/freemarker/body/individual/individual-menu.ftl +++ b/webapp/web/templates/freemarker/body/individual/individual-menu.ftl @@ -5,8 +5,7 @@ <#include "individual-setup.ftl"> <#assign hasElement = propertyGroups.pullProperty("${namespaces.display}hasElement")!> - -<#assign addNewMenuItemUrl = "${urls.base}/menuManagementController?cmd=add" > +<#assign returnURL = "/vivo/individual?uri=http%3A%2F%2Fvitro.mannlib.cornell.edu%2Fontologies%2Fdisplay%2F1.1%23DefaultMenu&switchToDisplayModel=true" /> <#if hasElement?has_content>