Merge branch 'develop' of git://github.com/vivo-project/Vitro into develop

# By Graham Triggs
# Via grahamtriggs (2) and Graham Triggs (1)
* 'develop' of git://github.com/vivo-project/Vitro:
  [VIVO-1224] Suppress default "synthetic" model from the lists on the ingest pages
  [VIVO-1230] Make contact form compatible with SMTP relays
  [VIVO-1233] Wrap large buttons on ontology edit page
  Fix error message (change erroneous UPDATE to SELECT)
This commit is contained in:
Jim Blake 2016-06-21 10:09:02 -04:00
commit 0709ca504e
4 changed files with 99 additions and 72 deletions

View file

@ -12,6 +12,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.mail.Address;
import javax.mail.Message; import javax.mail.Message;
import javax.mail.MessagingException; import javax.mail.MessagingException;
import javax.mail.SendFailedException; import javax.mail.SendFailedException;
@ -256,13 +257,13 @@ public class ContactMailController extends FreemarkerHttpServlet {
MimeMessage msg = new MimeMessage( s ); MimeMessage msg = new MimeMessage( s );
//System.out.println("trying to send message from servlet"); //System.out.println("trying to send message from servlet");
// Set the from address // Set the reply address
try { try {
msg.setFrom( new InternetAddress( webuseremail, webusername )); msg.setReplyTo( new Address[] { new InternetAddress( webuseremail, webusername ) } );
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
log.error("Can't set message sender with personal name " + webusername + log.error("Can't set message reply with personal name " + webusername +
" due to UnsupportedEncodingException"); " due to UnsupportedEncodingException");
msg.setFrom( new InternetAddress( webuseremail ) ); // msg.setFrom( new InternetAddress( webuseremail ) );
} }
// Set the recipient address // Set the recipient address
@ -272,6 +273,13 @@ public class ContactMailController extends FreemarkerHttpServlet {
} }
msg.setRecipients( Message.RecipientType.TO, address ); msg.setRecipients( Message.RecipientType.TO, address );
// Set the from address
if (address != null && address.length > 0) {
msg.setFrom(address[0]);
} else {
msg.setFrom( new InternetAddress( webuseremail ) );
}
// Set the subject and text // Set the subject and text
msg.setSubject( deliveryfrom ); msg.setSubject( deliveryfrom );

View file

@ -189,7 +189,14 @@ public class JenaIngestController extends BaseEditController {
} }
maker = getModelMaker(vreq); maker = getModelMaker(vreq);
request.setAttribute("modelNames", maker.listModels().toList()); List<String> modelNames = maker.listModels().toList();
for (int mnIdx = modelNames.size() - 1; mnIdx > -1; mnIdx--) {
if (!modelNames.get(mnIdx).startsWith("http")) {
modelNames.remove(mnIdx);
}
}
request.setAttribute("modelNames", modelNames);
RequestDispatcher rd = request.getRequestDispatcher( RequestDispatcher rd = request.getRequestDispatcher(
Controllers.BASIC_JSP); Controllers.BASIC_JSP);

View file

@ -304,7 +304,7 @@ public class RDFServiceSparql extends RDFServiceImpl implements RDFService {
if (statusCode > 399) { if (statusCode > 399) {
log.error("response " + statusCode + " to query. \n"); log.error("response " + statusCode + " to query. \n");
log.debug("update string: \n" + queryStr); log.debug("update string: \n" + queryStr);
throw new RDFServiceException("Unable to perform SPARQL UPDATE"); throw new RDFServiceException("Unable to perform SPARQL SELECT");
} }
try (InputStream in = response.getEntity().getContent()) { try (InputStream in = response.getEntity().getContent()) {

View file

@ -3,76 +3,88 @@
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ --> <!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:form="http://vitro.mannlib.cornell.edu/edit/tags" xmlns:form="http://vitro.mannlib.cornell.edu/edit/tags"
version="2.0"> version="2.0">
<jsp:directive.page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers"/> <jsp:directive.page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers"/>
<div class="editingForm"> <div class="editingForm">
<style>
.editingForm .form-button {
white-space: normal;
}
</style>
<jsp:include page="/templates/edit/fetch/vertical.jsp"/> <jsp:include page="/templates/edit/fetch/vertical.jsp"/>
<div align="center"> <div align="center">
<table class="form-background" border="0" cellpadding="2" cellspacing="2"> <table class="form-background" border="0" cellpadding="2" cellspacing="2">
<tr valign="bottom" align="center"> <tr valign="bottom" align="center">
<td> <td width="46%">
<form action="listOntologies" method="get"> <form action="listOntologies" method="get">
<input type="submit" class="form-button" value="All Ontologies"/> <input type="submit" class="form-button" value="All Ontologies"/>
</form> </form>
<form action="showClassHierarchy" method="get"> <form action="showClassHierarchy" method="get">
<input type="submit" class="form-button" value="Hierarchy of Classes Defined in This Namespace" /> <input type="submit" class="form-button" value="Hierarchy of Classes Defined in This Namespace" />
<input type="hidden" name="ontologyUri" value="${Ontology.URI}" /> <input type="hidden" name="ontologyUri" value="${Ontology.URI}" />
</form> </form>
<form action="listPropertyWebapps" method="get"> <form action="listPropertyWebapps" method="get">
<input type="submit" class="form-button" value="Object Properties Defined in This Namespace" /> <input type="submit" class="form-button" value="Object Properties Defined in This Namespace" />
<input type="hidden" name="ontologyUri" value="${Ontology.URI}" /> <input type="hidden" name="ontologyUri" value="${Ontology.URI}" />
</form> </form>
<form action="listDatatypeProperties" method="get"> <form action="listDatatypeProperties" method="get">
<input type="submit" class="form-button" value="Datatype Properties Defined in This Namespace" /> <input type="submit" class="form-button" value="Datatype Properties Defined in This Namespace" />
<input type="hidden" name="ontologyUri" value="${Ontology.URI}" /> <input type="hidden" name="ontologyUri" value="${Ontology.URI}" />
</form> </form>
</td> </td>
<td valign="bottom" align="center"> <td valign="bottom" align="center" width="27%">
<form action="editForm" method="get"> <form action="editForm" method="get">
<input type="submit" class="form-button" value="Edit ${Ontology.name}"/> <input type="submit" class="form-button" value="Edit ${Ontology.name}"/>
<input name="uri" type = "hidden" value="${Ontology.URI}" /> <input name="uri" type = "hidden" value="${Ontology.URI}" />
<input type="hidden" name="controller" value="Ontology"/> <input type="hidden" name="controller" value="Ontology"/>
</form> </form>
</td> </td>
<td valign="bottom"> <td valign="bottom" width="27%">
<form action="editForm" method="get"> <form action="editForm" method="get">
<input type="submit" class="form-button" value="Add New Ontology"/> <input type="submit" class="form-button" value="Add New Ontology"/>
<input type="hidden" name="controller" value="Ontology"/> <input type="hidden" name="controller" value="Ontology"/>
</form> </form>
<form action="editForm" method="get"> <form action="editForm" method="get">
<input type="submit" class="form-button" value="Change URI"/> <input type="submit" class="form-button" value="Change URI"/>
<input type="hidden" name="oldURI" value="${realURI}"/> <input type="hidden" name="oldURI" value="${realURI}"/>
<input type="hidden" name="mode" value="renameResource"/> <input type="hidden" name="mode" value="renameResource"/>
<input type="hidden" name="controller" value="Refactor"/> <input type="hidden" name="controller" value="Refactor"/>
</form> </form>
<div style="margin-left:-0.5em;margin-top:0.5em;padding:0.5em;border-style:solid;border-width:1px;"> </td>
<form action="${exportURL}" method="get"> </tr>
<input type="hidden" name="subgraph" value="tbox"/> <tr><td colspan="3"><hr></hr></td></tr>
<input type="hidden" name="assertedOrInferred" value="asserted"/> </table>
<input type="hidden" name="ontologyURI" value="${Ontology.URI}"/> <table class="form-background" border="0" cellpadding="2" cellspacing="2">
<input type="submit" class="form-button" name="submit" value="Export Ontology Entities Defined in This Namespace to RDF"/> <tr valign="bottom" align="center">
<div style="padding:0;margin-top:0.3em;white-space:nowrap;"> <td>
<input type="radio" name="format" value="RDF/XML-ABBREV" checked="checked" selected="selected"/> RDF/XML abbreviated <div style="margin-left:-0.5em;margin-top:0.5em;padding:0.5em;border-style:solid;border-width:1px;float:right">
<input type="radio" name="format" value="RDF/XML"/> RDF/XML <form action="${exportURL}" method="get">
<input type="radio" name="format" value="N3"/> N3 <input type="hidden" name="subgraph" value="tbox"/>
<input type="radio" name="format" value="N-TRIPLE"/> N-Triples <input type="hidden" name="assertedOrInferred" value="asserted"/>
<input type="radio" name="format" value="TURTLE"/> Turtle <input type="hidden" name="ontologyURI" value="${Ontology.URI}"/>
</div> <input type="submit" class="form-button" name="submit" value="Export Ontology Entities Defined in This Namespace to RDF"/>
</form> <div style="padding:0;margin-top:0.3em;white-space:nowrap;">
</div> <input type="radio" name="format" value="RDF/XML-ABBREV" checked="checked" selected="selected"/> RDF/XML abbreviated
<input type="radio" name="format" value="RDF/XML"/> RDF/XML
<input type="radio" name="format" value="N3"/> N3
<input type="radio" name="format" value="N-TRIPLE"/> N-Triples
<input type="radio" name="format" value="TURTLE"/> Turtle
</div>
</form>
</div>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>
</jsp:root> </jsp:root>