diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/MailUsersServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/MailUsersServlet.java index 2b4d8dbab..f8b0f188d 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/MailUsersServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/MailUsersServlet.java @@ -68,7 +68,7 @@ public class MailUsersServlet extends VitroHttpServlet { VitroRequest vreq = new VitroRequest(request); Portal portal = vreq.getPortal(); - String confirmpage = "/thankyou.jsp"; + String confirmpage = "/confirmUserMail.jsp"; String errpage = "/contact_err.jsp"; String status = null; // holds the error status @@ -106,14 +106,6 @@ public class MailUsersServlet extends VitroHttpServlet { List deliverToArray = null; int recipientCount = 0; String deliveryfrom = null; - deliveryfrom = "hjk54@cornell.edu"; //Who would this message be delivered from? - //Place-holder delivery To Array - /*deliverToArray = new String[] { - "huda.khan@gmail.com", - "huda.khan@colorado.edu", - "hjk54@cornell.edu", - "huda_jalil_khan@hotmail.com" - };*/ UserDao uDao = getWebappDaoFactory().getUserDao(); @@ -135,11 +127,12 @@ public class MailUsersServlet extends VitroHttpServlet { String webusername = vreq.getParameter("webusername");// Null.trim(); will give you an exception String webuseremail = vreq.getParameter("webuseremail");//.trim(); String comments = vreq.getParameter("s34gfd88p9x1"); //what does this string signify? - webusername = "hjk54"; - webuseremail = "hjk54@cornell.edu"; + //webusername = "hjk54"; + //webuseremail = "hjk54@cornell.edu"; //comments = "following are comments"; webusername=webusername.trim(); + deliveryfrom = webuseremail; comments=comments.trim(); @@ -150,7 +143,7 @@ public class MailUsersServlet extends VitroHttpServlet { String lineSeparator = System.getProperty("line.separator"); // \r\n on windows, \n on unix // from MyLibrary msgBuf.setLength(0); - msgBuf.append("Content-Type: text/html; charset='us-ascii'" + lineSeparator); + //msgBuf.append("Content-Type: text/html; charset='us-ascii'" + lineSeparator); msgBuf.append("" + lineSeparator ); msgBuf.append("" + lineSeparator ); msgBuf.append("" + lineSeparator ); @@ -160,13 +153,7 @@ public class MailUsersServlet extends VitroHttpServlet { msgBuf.append("

" + deliveryfrom + "

" + lineSeparator ); msgBuf.append("

From: "+webusername +" (" + webuseremail + ")"+" at IP address "+request.getRemoteAddr()+"

"+lineSeparator); - if (!(originalReferer == null || originalReferer.equals("none"))){ - //The spam filter that is being used by the listsrv is rejecting likely viewing page " + stripProtocol(originalReferer) ); - msgBuf.append("

likely viewing page " + originalReferer ); - } + //Don't need any 'likely viewing page' portion to be emailed out to the others msgBuf.append(lineSeparator + "

Comments:

" + lineSeparator ); if (comments==null || comments.equals("")) { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/N3MultiPartUpload.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/N3MultiPartUpload.java index fa3a455bd..7d1d7b4dc 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/N3MultiPartUpload.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/N3MultiPartUpload.java @@ -107,6 +107,8 @@ public class N3MultiPartUpload extends VitroHttpServlet { String maxSize = ConfigurationProperties.getProperty("n3.maxSize", Long .toString(DEFAULT_MAX_SIZE)); + //DEBUG ADDED + System.out.println("Max size is " + maxSize); try { maxFileSize = Integer.parseInt(maxSize); } catch (NumberFormatException nfe) { @@ -176,6 +178,10 @@ public class N3MultiPartUpload extends VitroHttpServlet { log.debug("File in multipart content request: field " + name + " with file name " + item.getName() + " detected."); + //Debug line + System.out.println("File in multipart content request: field " + + name + " with file name " + item.getName() + + " detected."); } else { List itemList = new ArrayList(); itemList.add(item); @@ -216,9 +222,9 @@ public class N3MultiPartUpload extends VitroHttpServlet { && editConfig.getObject().trim().length() > 0; log.debug(requestIsAnUpdate ? "request is an update for a file object" : "request is for a new file object"); - + System.out.println("Request type, update or new: " + requestIsAnUpdate); /** *************************************************** */ - if (requestIsAnUpdate) { + if (requestIsAnUpdate) {System.out.println("Currently existing file reosurce edit not supported"); log.error("Editing an existing file resource is not supported by N3MultiPartUpload.java "); request.setAttribute("errors", "Editing an existing file resource is not supported."); RequestDispatcher rd = request diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserDaoJena.java index bd9d49ab4..22318f239 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserDaoJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/UserDaoJena.java @@ -241,7 +241,6 @@ public class UserDaoJena extends JenaBaseDao implements UserDao { String swrcOntology = "http://swrc.ontoware.org/ontology#"; String emailProperty = swrcOntology + "email"; String emailValue, uri; - System.out.println("To clarify here is may edit as " + VitroVocabulary.MAY_EDIT_AS); try{ Property emailProp = ontModel.getProperty(emailProperty); StmtIterator it = ontModel.listStatements( @@ -257,15 +256,12 @@ public class UserDaoJena extends JenaBaseDao implements UserDao { { uri = stmt.getObject().asNode().getURI(); - System.out.println("Returned URI is " + uri); StmtIterator emailIt = baseModel.listStatements(baseModel.createResource(uri), baseModel.createProperty(emailProperty), (RDFNode) null); - System.out.println("Email iterator successfull ? " + emailIt.hasNext()); while(emailIt.hasNext()) { Statement emailSt = (Statement) emailIt.next(); if(emailSt != null && emailSt.getObject().isLiteral() && emailSt.getObject() != null) { email.add(emailSt.getLiteral().getString()); //Issue: this prints out the email in a tags - System.out.println("Email Iterator Object Value" + emailSt.getLiteral().getString()); } else { //System.out.println("Unfortunately email statement is null"); } @@ -285,5 +281,49 @@ public class UserDaoJena extends JenaBaseDao implements UserDao { return email; } + //for a specific user account, get the email address + public String getUserEmailAddress (String userURI) { + OntModel ontModel = getOntModel(); + OntModel baseModel = getOntModelSelector().getFullModel(); + ontModel.enterCriticalSection(Lock.READ); + String swrcOntology = "http://swrc.ontoware.org/ontology#"; + String emailProperty = swrcOntology + "email"; + String personUri, emailValue = null; + + try { + //Get person account associated with this email address + StmtIterator it = ontModel.listStatements( + ontModel.createResource(userURI), + ontModel.getProperty(VitroVocabulary.MAY_EDIT_AS), + (RDFNode)null); + try{ + while(it.hasNext()) { + Statement personStmt = (Statement) it.next(); + if(personStmt != null + && personStmt.getObject() != null + && personStmt.getObject().asNode() != null + && personStmt.getObject().asNode().getURI() != null) { + personUri = personStmt.getObject().asNode().getURI(); + + StmtIterator emailIt = baseModel.listStatements(baseModel.createResource(personUri), + baseModel.createProperty(emailProperty), + (RDFNode)null); + while(emailIt.hasNext()) { + Statement emailStmt = (Statement) emailIt.next(); + if(emailStmt != null && emailStmt.getObject().isLiteral() && emailStmt.getObject() != null) { + emailValue = emailStmt.getLiteral().getString(); + } + } + } + } + } catch(Exception ex) { + System.out.println("Error occurred in retrieving email and/or user uri"); + } + }finally{ + ontModel.leaveCriticalSection(); + } + return emailValue; + } + } diff --git a/webapp/web/edit/editDatapropStmtRequestDispatch.jsp b/webapp/web/edit/editDatapropStmtRequestDispatch.jsp index 2fef8be0d..e4047a2e6 100644 --- a/webapp/web/edit/editDatapropStmtRequestDispatch.jsp +++ b/webapp/web/edit/editDatapropStmtRequestDispatch.jsp @@ -145,7 +145,6 @@ } else { vreq.setAttribute("form", formParam); } - if( session.getAttribute("requestedFromEntity") == null ) session.setAttribute("requestedFromEntity", subjectUri ); %> diff --git a/webapp/web/edit/editRequestDispatch.jsp b/webapp/web/edit/editRequestDispatch.jsp index f64d8b001..a160a4ff3 100644 --- a/webapp/web/edit/editRequestDispatch.jsp +++ b/webapp/web/edit/editRequestDispatch.jsp @@ -51,7 +51,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp. ? EditConfiguration.newEditKey(session) : EditConfiguration.getEditKey(request); request.setAttribute("editKey", editKey); - + // set the referrer URL, if available setEditReferer(editKey, request.getHeader("Referer"), request.getSession()); @@ -64,7 +64,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp. String formParam = request.getParameter("editform"); String command = request.getParameter("cmd"); String typeOfNew = request.getParameter("typeOfNew"); - + //If there is no specified editForm then the subjectURI and the predicate //are needed to determin which form to use for this edit. if (formParam == null || "".equals(formParam)) { @@ -173,54 +173,60 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp. if( predicateUri != null ){ objectProp = wdf.getObjectPropertyDao().getObjectPropertyByURI(predicateUri); + customForm = objectProp.getCustomEntryForm(); request.setAttribute("predicate", objectProp); - - boolean isForwardToCreateNew = - ( objectProp != null && objectProp.getOfferCreateNewOption() && objectProp.getSelectFromExisting() == false) - || ( objectProp != null && objectProp.getOfferCreateNewOption() && "create".equals(command)); - - if (isForwardToCreateNew) { - request.setAttribute("isForwardToCreateNew", new Boolean(true)); - if (customForm != null && customForm.length() > 0) { - //bdc34: maybe this should be the custom form on the class, not the property. + //Offer create new and select from existing are ignored if there is a custom form + if (customForm != null && customForm.length() > 0) { + //bdc34: maybe this should be the custom form on the class, not the property. form = objectProp.getCustomEntryForm(); - } else { - //If a objectProperty is both provideSelect and offerCreateNewOption - // and a user gos to a defaultObjectProperty.jsp form then the user is - // offered the option to create a new Individual and replace the - // object in the existing objectPropertyStatement with this new individual. - boolean isReplaceWithNew = - isEditOfExistingStmt && "create".equals(command) - && objectProp != null && objectProp.getOfferCreateNewOption() == true; - - // If an objectProperty is selectFromExisitng==false and offerCreateNewOption == true - // the we want to forward to the create new form but edit the existing object - // of the objPropStmt. - boolean isForwardToCreateButEdit = - isEditOfExistingStmt && objectProp != null - && objectProp.getOfferCreateNewOption() == true - && objectProp.getSelectFromExisting() == false - && ! "create".equals(command); - - if( isReplaceWithNew ){ - request.setAttribute("isReplaceWithNew", new Boolean(true)); - form = DEFAULT_ADD_INDIVIDUAL; - }else if( isForwardToCreateButEdit ){ - request.setAttribute("isForwardToCreateButEdit", new Boolean(true)); - form = DEFAULT_ADD_INDIVIDUAL; - }else { - form = DEFAULT_ADD_INDIVIDUAL; - } - } + } + else { + boolean isForwardToCreateNew = + ( objectProp != null && objectProp.getOfferCreateNewOption() && objectProp.getSelectFromExisting() == false) + || ( objectProp != null && objectProp.getOfferCreateNewOption() && "create".equals(command)); + + if (isForwardToCreateNew) { + + request.setAttribute("isForwardToCreateNew", new Boolean(true)); + + //If a objectProperty is both provideSelect and offerCreateNewOption + // and a user goes to a defaultObjectProperty.jsp form then the user is + // offered the option to create a new Individual and replace the + // object in the existing objectPropertyStatement with this new individual. + boolean isReplaceWithNew = + isEditOfExistingStmt && "create".equals(command) + && objectProp != null && objectProp.getOfferCreateNewOption() == true; + + // If an objectProperty is selectFromExisitng==false and offerCreateNewOption == true + // the we want to forward to the create new form but edit the existing object + // of the objPropStmt. + boolean isForwardToCreateButEdit = + isEditOfExistingStmt && objectProp != null + && objectProp.getOfferCreateNewOption() == true + && objectProp.getSelectFromExisting() == false + && ! "create".equals(command); + + if( isReplaceWithNew ){ + request.setAttribute("isReplaceWithNew", new Boolean(true)); + form = DEFAULT_ADD_INDIVIDUAL; + }else if( isForwardToCreateButEdit ){ + request.setAttribute("isForwardToCreateButEdit", new Boolean(true)); + form = DEFAULT_ADD_INDIVIDUAL; + }else { + form = DEFAULT_ADD_INDIVIDUAL; + } + + } + + if( ! isForwardToCreateNew ){ + if( objectProp != null && objectProp.getCustomEntryForm() != null && objectProp.getCustomEntryForm().length() > 0){ + form = objectProp.getCustomEntryForm(); + }else{ + form = DEFAULT_OBJ_FORM ; + } + } } - if( ! isForwardToCreateNew ){ - if( objectProp != null && objectProp.getCustomEntryForm() != null && objectProp.getCustomEntryForm().length() > 0){ - form = objectProp.getCustomEntryForm(); - }else{ - form = DEFAULT_OBJ_FORM ; - } - } } else { //case where a form was passed as a http parameter form = formParam; diff --git a/webapp/web/edit/forms/defaultDatapropForm.jsp b/webapp/web/edit/forms/defaultDatapropForm.jsp index b6a93cff9..aa7d81453 100644 --- a/webapp/web/edit/forms/defaultDatapropForm.jsp +++ b/webapp/web/edit/forms/defaultDatapropForm.jsp @@ -10,7 +10,6 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> <%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> - <%! private static HashMap defaultsForXSDtypes ; static { defaultsForXSDtypes = new HashMap(); diff --git a/webapp/web/emailUsers.jsp b/webapp/web/emailUsers.jsp index 19daeef72..489348f5a 100644 --- a/webapp/web/emailUsers.jsp +++ b/webapp/web/emailUsers.jsp @@ -25,10 +25,8 @@

My full name is:



-

${siteName} is a service that depends on regular updates and feedback. - Please help us out by providing any necessary corrections and suggestions for additional content (people, departments, courses, research services, etc.) - that you would like to see represented.

-

Enter your comments, questions, or suggestions in the box below.

+ +

Enter your message below. This message will be emailed to all email addresses associated with user accounts.

diff --git a/webapp/web/siteAdmin/customReports.jsp b/webapp/web/siteAdmin/customReports.jsp new file mode 100644 index 000000000..e2a7842ad --- /dev/null +++ b/webapp/web/siteAdmin/customReports.jsp @@ -0,0 +1,12 @@ +<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%> + +<% if (securityLevel >= loginHandler.DBA) { %> + +<% } %> diff --git a/webapp/web/siteAdmin/main.jsp b/webapp/web/siteAdmin/main.jsp index f4339cb90..7d2370baa 100644 --- a/webapp/web/siteAdmin/main.jsp +++ b/webapp/web/siteAdmin/main.jsp @@ -37,6 +37,7 @@ <%@ include file="advancedDataTools.jsp" %> + <%@ include file="customReports.jsp" %> <%-- <%@ include file="sessionPreferences.jsp" %> --%> diff --git a/webapp/web/thankyou.jsp b/webapp/web/thankyou.jsp index 9edb77985..037411527 100644 --- a/webapp/web/thankyou.jsp +++ b/webapp/web/thankyou.jsp @@ -13,7 +13,9 @@ Portal portalBean=vreq.getPortal();

Feedback

- + + /${context}/<%=portalBean.getThemeDir()%> + mailbox

Thank you for contacting our curation and development team. We will respond to your inquiry as soon as possible.