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);
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<String> 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("<html>" + lineSeparator );
msgBuf.append("<head>" + 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>From: "+webusername +" (" + webuseremail + ")"+" at IP address "+request.getRemoteAddr()+"</h4>"+lineSeparator);
if (!(originalReferer == null || originalReferer.equals("none"))){
//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 );
}
//Don't need any 'likely viewing page' portion to be emailed out to the others
msgBuf.append(lineSeparator + "</i></p><h3>Comments:</h3>" + lineSeparator );
if (comments==null || comments.equals("")) {

View file

@ -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<FileItem> itemList = new ArrayList<FileItem>();
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

View file

@ -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;
}
}

View file

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

View file

@ -173,20 +173,24 @@ 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);
//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 {
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.
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
// 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 =
@ -211,7 +215,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
}else {
form = DEFAULT_ADD_INDIVIDUAL;
}
}
}
if( ! isForwardToCreateNew ){
@ -221,6 +225,8 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
form = DEFAULT_OBJ_FORM ;
}
}
}
} else {
//case where a form was passed as a http parameter
form = formParam;

View file

@ -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<String,String> defaultsForXSDtypes ;
static {
defaultsForXSDtypes = new HashMap<String,String>();

View file

@ -25,10 +25,8 @@
<p class="normal">My full name is:</p>
<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.)
that you would like to see represented.</i></p>
<h3>Enter your comments, questions, or suggestions in the box below.</h3>
<h3>Enter your message below. This message will be emailed to all email addresses associated with user accounts. </h3>
<textarea name="s34gfd88p9x1" rows="10" cols="90"></textarea>
<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="customReports.jsp" %>
<%--
<%@ include file="sessionPreferences.jsp" %>
--%>

View file

@ -13,7 +13,9 @@ Portal portalBean=vreq.getPortal();
<div id="content">
<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/>
<p>Thank you for contacting our curation and development team. We will respond to your inquiry as soon as possible.</p>