Changes related to datastar issues: Adding link in site admin for custom report, fixing upload issues.

This commit is contained in:
hjk54 2010-02-28 21:14:48 +00:00
parent 95cffe41b0
commit f884489278
10 changed files with 128 additions and 78 deletions

View file

@ -68,7 +68,7 @@ public class MailUsersServlet extends VitroHttpServlet {
VitroRequest vreq = new VitroRequest(request); VitroRequest vreq = new VitroRequest(request);
Portal portal = vreq.getPortal(); Portal portal = vreq.getPortal();
String confirmpage = "/thankyou.jsp"; String confirmpage = "/confirmUserMail.jsp";
String errpage = "/contact_err.jsp"; String errpage = "/contact_err.jsp";
String status = null; // holds the error status String status = null; // holds the error status
@ -106,14 +106,6 @@ public class MailUsersServlet extends VitroHttpServlet {
List<String> deliverToArray = null; List<String> deliverToArray = null;
int recipientCount = 0; int recipientCount = 0;
String deliveryfrom = null; 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(); 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 webusername = vreq.getParameter("webusername");// Null.trim(); will give you an exception
String webuseremail = vreq.getParameter("webuseremail");//.trim(); String webuseremail = vreq.getParameter("webuseremail");//.trim();
String comments = vreq.getParameter("s34gfd88p9x1"); //what does this string signify? String comments = vreq.getParameter("s34gfd88p9x1"); //what does this string signify?
webusername = "hjk54"; //webusername = "hjk54";
webuseremail = "hjk54@cornell.edu"; //webuseremail = "hjk54@cornell.edu";
//comments = "following are comments"; //comments = "following are comments";
webusername=webusername.trim(); webusername=webusername.trim();
deliveryfrom = webuseremail;
comments=comments.trim(); 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 String lineSeparator = System.getProperty("line.separator"); // \r\n on windows, \n on unix
// from MyLibrary // from MyLibrary
msgBuf.setLength(0); 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("<html>" + lineSeparator ); msgBuf.append("<html>" + lineSeparator );
msgBuf.append("<head>" + lineSeparator ); msgBuf.append("<head>" + lineSeparator );
msgBuf.append("<style>a {text-decoration: none}</style>" + lineSeparator ); msgBuf.append("<style>a {text-decoration: none}</style>" + lineSeparator );
@ -160,13 +153,7 @@ public class MailUsersServlet extends VitroHttpServlet {
msgBuf.append("<h4>" + deliveryfrom + "</h4>" + lineSeparator ); msgBuf.append("<h4>" + deliveryfrom + "</h4>" + lineSeparator );
msgBuf.append("<h4>From: "+webusername +" (" + webuseremail + ")"+" at IP address "+request.getRemoteAddr()+"</h4>"+lineSeparator); msgBuf.append("<h4>From: "+webusername +" (" + webuseremail + ")"+" at IP address "+request.getRemoteAddr()+"</h4>"+lineSeparator);
if (!(originalReferer == null || originalReferer.equals("none"))){ //Don't need any 'likely viewing page' portion to be emailed out to the others
//The spam filter that is being used by the listsrv is rejecting <a href="...
//so try with out the markup, if that sill doesn't work,
//uncomment the following line to strip the http://
//msgBuf.append("<p><i>likely viewing page " + stripProtocol(originalReferer) );
msgBuf.append("<p><i>likely viewing page " + originalReferer );
}
msgBuf.append(lineSeparator + "</i></p><h3>Comments:</h3>" + lineSeparator ); msgBuf.append(lineSeparator + "</i></p><h3>Comments:</h3>" + lineSeparator );
if (comments==null || comments.equals("")) { if (comments==null || comments.equals("")) {

View file

@ -107,6 +107,8 @@ public class N3MultiPartUpload extends VitroHttpServlet {
String maxSize = ConfigurationProperties.getProperty("n3.maxSize", Long String maxSize = ConfigurationProperties.getProperty("n3.maxSize", Long
.toString(DEFAULT_MAX_SIZE)); .toString(DEFAULT_MAX_SIZE));
//DEBUG ADDED
System.out.println("Max size is " + maxSize);
try { try {
maxFileSize = Integer.parseInt(maxSize); maxFileSize = Integer.parseInt(maxSize);
} catch (NumberFormatException nfe) { } catch (NumberFormatException nfe) {
@ -176,6 +178,10 @@ public class N3MultiPartUpload extends VitroHttpServlet {
log.debug("File in multipart content request: field " log.debug("File in multipart content request: field "
+ name + " with file name " + item.getName() + name + " with file name " + item.getName()
+ " detected."); + " detected.");
//Debug line
System.out.println("File in multipart content request: field "
+ name + " with file name " + item.getName()
+ " detected.");
} else { } else {
List<FileItem> itemList = new ArrayList<FileItem>(); List<FileItem> itemList = new ArrayList<FileItem>();
itemList.add(item); itemList.add(item);
@ -216,9 +222,9 @@ public class N3MultiPartUpload extends VitroHttpServlet {
&& editConfig.getObject().trim().length() > 0; && editConfig.getObject().trim().length() > 0;
log.debug(requestIsAnUpdate ? "request is an update for a file object" log.debug(requestIsAnUpdate ? "request is an update for a file object"
: "request is for a new 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 "); log.error("Editing an existing file resource is not supported by N3MultiPartUpload.java ");
request.setAttribute("errors", "Editing an existing file resource is not supported."); request.setAttribute("errors", "Editing an existing file resource is not supported.");
RequestDispatcher rd = request RequestDispatcher rd = request

View file

@ -241,7 +241,6 @@ public class UserDaoJena extends JenaBaseDao implements UserDao {
String swrcOntology = "http://swrc.ontoware.org/ontology#"; String swrcOntology = "http://swrc.ontoware.org/ontology#";
String emailProperty = swrcOntology + "email"; String emailProperty = swrcOntology + "email";
String emailValue, uri; String emailValue, uri;
System.out.println("To clarify here is may edit as " + VitroVocabulary.MAY_EDIT_AS);
try{ try{
Property emailProp = ontModel.getProperty(emailProperty); Property emailProp = ontModel.getProperty(emailProperty);
StmtIterator it = ontModel.listStatements( StmtIterator it = ontModel.listStatements(
@ -257,15 +256,12 @@ public class UserDaoJena extends JenaBaseDao implements UserDao {
{ {
uri = stmt.getObject().asNode().getURI(); uri = stmt.getObject().asNode().getURI();
System.out.println("Returned URI is " + uri);
StmtIterator emailIt = baseModel.listStatements(baseModel.createResource(uri), baseModel.createProperty(emailProperty), (RDFNode) null); StmtIterator emailIt = baseModel.listStatements(baseModel.createResource(uri), baseModel.createProperty(emailProperty), (RDFNode) null);
System.out.println("Email iterator successfull ? " + emailIt.hasNext());
while(emailIt.hasNext()) { while(emailIt.hasNext()) {
Statement emailSt = (Statement) emailIt.next(); Statement emailSt = (Statement) emailIt.next();
if(emailSt != null && emailSt.getObject().isLiteral() && emailSt.getObject() != null) { if(emailSt != null && emailSt.getObject().isLiteral() && emailSt.getObject() != null) {
email.add(emailSt.getLiteral().getString()); email.add(emailSt.getLiteral().getString());
//Issue: this prints out the email in a tags //Issue: this prints out the email in a tags
System.out.println("Email Iterator Object Value" + emailSt.getLiteral().getString());
} else { } else {
//System.out.println("Unfortunately email statement is null"); //System.out.println("Unfortunately email statement is null");
} }
@ -285,5 +281,49 @@ public class UserDaoJena extends JenaBaseDao implements UserDao {
return email; 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;
}
} }

View file

@ -145,7 +145,6 @@
} else { } else {
vreq.setAttribute("form", formParam); vreq.setAttribute("form", formParam);
} }
if( session.getAttribute("requestedFromEntity") == null ) if( session.getAttribute("requestedFromEntity") == null )
session.setAttribute("requestedFromEntity", subjectUri ); session.setAttribute("requestedFromEntity", subjectUri );
%> %>

View file

@ -51,7 +51,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
? EditConfiguration.newEditKey(session) ? EditConfiguration.newEditKey(session)
: EditConfiguration.getEditKey(request); : EditConfiguration.getEditKey(request);
request.setAttribute("editKey", editKey); request.setAttribute("editKey", editKey);
// set the referrer URL, if available // set the referrer URL, if available
setEditReferer(editKey, request.getHeader("Referer"), request.getSession()); 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 formParam = request.getParameter("editform");
String command = request.getParameter("cmd"); String command = request.getParameter("cmd");
String typeOfNew = request.getParameter("typeOfNew"); String typeOfNew = request.getParameter("typeOfNew");
//If there is no specified editForm then the subjectURI and the predicate //If there is no specified editForm then the subjectURI and the predicate
//are needed to determin which form to use for this edit. //are needed to determin which form to use for this edit.
if (formParam == null || "".equals(formParam)) { if (formParam == null || "".equals(formParam)) {
@ -173,54 +173,60 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
if( predicateUri != null ){ if( predicateUri != null ){
objectProp = wdf.getObjectPropertyDao().getObjectPropertyByURI(predicateUri); objectProp = wdf.getObjectPropertyDao().getObjectPropertyByURI(predicateUri);
customForm = objectProp.getCustomEntryForm();
request.setAttribute("predicate", objectProp); request.setAttribute("predicate", objectProp);
//Offer create new and select from existing are ignored if there is a custom form
boolean isForwardToCreateNew = if (customForm != null && customForm.length() > 0) {
( objectProp != null && objectProp.getOfferCreateNewOption() && objectProp.getSelectFromExisting() == false) //bdc34: maybe this should be the custom form on the class, not the property.
|| ( 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.
form = objectProp.getCustomEntryForm(); form = objectProp.getCustomEntryForm();
} else { }
//If a objectProperty is both provideSelect and offerCreateNewOption else {
// and a user gos to a defaultObjectProperty.jsp form then the user is boolean isForwardToCreateNew =
// offered the option to create a new Individual and replace the ( objectProp != null && objectProp.getOfferCreateNewOption() && objectProp.getSelectFromExisting() == false)
// object in the existing objectPropertyStatement with this new individual. || ( objectProp != null && objectProp.getOfferCreateNewOption() && "create".equals(command));
boolean isReplaceWithNew =
isEditOfExistingStmt && "create".equals(command) if (isForwardToCreateNew) {
&& objectProp != null && objectProp.getOfferCreateNewOption() == true;
request.setAttribute("isForwardToCreateNew", new Boolean(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 //If a objectProperty is both provideSelect and offerCreateNewOption
// of the objPropStmt. // and a user goes to a defaultObjectProperty.jsp form then the user is
boolean isForwardToCreateButEdit = // offered the option to create a new Individual and replace the
isEditOfExistingStmt && objectProp != null // object in the existing objectPropertyStatement with this new individual.
&& objectProp.getOfferCreateNewOption() == true boolean isReplaceWithNew =
&& objectProp.getSelectFromExisting() == false isEditOfExistingStmt && "create".equals(command)
&& ! "create".equals(command); && objectProp != null && objectProp.getOfferCreateNewOption() == true;
if( isReplaceWithNew ){ // If an objectProperty is selectFromExisitng==false and offerCreateNewOption == true
request.setAttribute("isReplaceWithNew", new Boolean(true)); // the we want to forward to the create new form but edit the existing object
form = DEFAULT_ADD_INDIVIDUAL; // of the objPropStmt.
}else if( isForwardToCreateButEdit ){ boolean isForwardToCreateButEdit =
request.setAttribute("isForwardToCreateButEdit", new Boolean(true)); isEditOfExistingStmt && objectProp != null
form = DEFAULT_ADD_INDIVIDUAL; && objectProp.getOfferCreateNewOption() == true
}else { && objectProp.getSelectFromExisting() == false
form = DEFAULT_ADD_INDIVIDUAL; && ! "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 { } else {
//case where a form was passed as a http parameter //case where a form was passed as a http parameter
form = formParam; form = formParam;

View file

@ -10,7 +10,6 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration" %>
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %> <%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
<%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%> <%@page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils"%>
<%! private static HashMap<String,String> defaultsForXSDtypes ; <%! private static HashMap<String,String> defaultsForXSDtypes ;
static { static {
defaultsForXSDtypes = new HashMap<String,String>(); defaultsForXSDtypes = new HashMap<String,String>();

View file

@ -25,10 +25,8 @@
<p class="normal">My full name is:</p> <p class="normal">My full name is:</p>
<input style="width:33%;" type="text" name="webusername" maxlength="255"/><br/><br/> <input style="width:33%;" type="text" name="webusername" maxlength="255"/><br/><br/>
<p class="normal"><i>${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.) <h3>Enter your message below. This message will be emailed to all email addresses associated with user accounts. </h3>
that you would like to see represented.</i></p>
<h3>Enter your comments, questions, or suggestions in the box below.</h3>
<textarea name="s34gfd88p9x1" rows="10" cols="90"></textarea> <textarea name="s34gfd88p9x1" rows="10" cols="90"></textarea>
<div> <div>

View file

@ -0,0 +1,12 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<% if (securityLevel >= loginHandler.DBA) { %>
<div class="pageBodyGroup">
<h3>Reports</h3>
<ul>
<li><a href="customsparql">Custom Report: File Publication Date < 1 YEAR AGO</a></li>
</ul>
</div>
<% } %>

View file

@ -37,6 +37,7 @@
<%@ include file="advancedDataTools.jsp" %> <%@ include file="advancedDataTools.jsp" %>
<%@ include file="customReports.jsp" %>
<%-- <%--
<%@ include file="sessionPreferences.jsp" %> <%@ include file="sessionPreferences.jsp" %>
--%> --%>

View file

@ -13,7 +13,9 @@ Portal portalBean=vreq.getPortal();
<div id="content"> <div id="content">
<h2>Feedback</h2> <h2>Feedback</h2>
<c:set var='themeDir'>
<c:if test="${!empty context && context != ''}">/${context}</c:if>/<%=portalBean.getThemeDir()%>
</c:set>
<img src="${themeDir}site_icons/mail.gif" alt="mailbox"/><br/> <img src="${themeDir}site_icons/mail.gif" alt="mailbox"/><br/>
<p>Thank you for contacting our curation and development team. We will respond to your inquiry as soon as possible.</p> <p>Thank you for contacting our curation and development team. We will respond to your inquiry as soon as possible.</p>