Improve output: distinguish between failed assertions (failures) and unexpected exceptions (errors), and print a filtered stack trace for any exception.

This commit is contained in:
jeb228 2010-01-29 22:13:57 +00:00
commit 4f2e303079
1839 changed files with 235630 additions and 0 deletions

View file

@ -0,0 +1,16 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<% if (securityLevel >= loginHandler.DBA) { %>
<div class="pageBodyGroup">
<h3>Advanced Data Tools</h3>
<ul>
<li><a href="ingest">Ingest tools</a></li>
<li><a href="uploadRDFForm?home=<%=portal.getPortalId()%>">Add/Remove RDF data</a></li>
<li><a href="export?home=<%=portal.getPortalId()%>">RDF export</a></li>
<%-- <li><a href="refactorOp?home=<%=portal.getPortalId()%>&amp;modeStr=fixDataTypes">Datatype literal realignment</a></li> --%>
<li><a href="admin/sparqlquery">SPARQL query</a></li>
</ul>
</div>
<% } %>

View file

@ -0,0 +1,18 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<% if (securityLevel >= loginHandler.EDITOR) { %>
<div class="pageBodyGroup">
<h3>Data Input</h3>
<form action="editForm" method="get">
<select id="VClassURI" name="VClassURI" class="form-item">
<form:option name="VClassId"/>
</select>
<input type="submit" class="add-action-button" value="Add individual of this class"/>
<input type="hidden" name="home" value="<%=portal.getPortalId()%>" />
<input type="hidden" name="controller" value="Entity"/>
</form>
</div>
<% } %>

View file

@ -0,0 +1,121 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%-- Included in siteAdmin/main.jsp to handle login/logout form and processing --%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<c:url var="loginJSP" value="<%= Controllers.LOGIN_JSP %>" />
<c:set var="loginFormTitle" value="<h3>Please log in</h3>" />
<%
int securityLevel = loginHandler.ANYBODY;
String loginStatus = loginHandler.getLoginStatus();
if ( loginStatus.equals("authenticated")) {
%>
<div id="logoutPanel">
<%
} else {
%>
<div id="loginPanel" class="pageBodyGroup">
<%
}
if ( loginStatus.equals("authenticated")) {
// test whether session is still valid
String currentSessionId = session.getId();
String storedSessionId = loginHandler.getSessionId();
if ( currentSessionId.equals( storedSessionId ) ) {
String currentRemoteAddrStr = request.getRemoteAddr();
String storedRemoteAddr = loginHandler.getLoginRemoteAddr();
securityLevel = Integer.parseInt( loginHandler.getLoginRole() );
if ( currentRemoteAddrStr.equals( storedRemoteAddr ) ) {
%>
<form class="logout" name="logout" action="${loginJSP}" method="post">
<input type="hidden" name="home" value="<%=portal.getPortalId()%>"/>
<em>Logged in as</em> <strong><jsp:getProperty name="loginHandler" property="loginName" /></strong>
<input type="submit" name="loginSubmitMode" value="Log out" class="logout-button button" />
</form>
<%
} else {
%>
${loginFormTitle}
<em>(IP address has changed)</em><br />
<%
loginHandler.setLoginStatus("logged out");
}
} else {
loginHandler.setLoginStatus("logged out");
%>
${loginFormTitle}
<em>(session has expired)</em><br/>
<form class="login" name="login" action="${loginJSP}" method="post" onsubmit="return isValidLogin(this) ">
<input type="hidden" name="home" value="<%=portal.getPortalId()%>" />
Username: <input type="text" name="loginName" size="10" class="form-item" /><br />
Password: <input type="password" name="loginPassword" size="10" class="form-item" /><br />
<input type="submit" name="loginSubmitMode" value="Log in" class="form-item button" />
</form>
<%
}
} else { /* not thrown out by coming from different IP address or expired session; check login status returned by authenticate.java */
%>
<h3>Please log in</strong></h3>
<%
if ( loginStatus.equals("logged out")) { %>
<em class="noticeText">(currently logged out)</em>
<% } else if ( loginStatus.equals("bad_password")) { %>
<em class="errorText">(password incorrect)</em><br/>
<% } else if ( loginStatus.equals("unknown_username")) { %>
<em class="errorText">(unknown username)</em><br/>
<% } else if ( loginStatus.equals("first_login_no_password")) { %>
<em class="noticeText">(1st login; need to request initial password below)</em>
<% } else if ( loginStatus.equals("first_login_mistyped")) { %>
<em class="noticeText">(1st login; initial password entered incorrectly)</em>
<% } else if ( loginStatus.equals("first_login_changing_password")) { %>
<em class="noticeText">(1st login; changing to new private password)</em>
<% } else if ( loginStatus.equals("changing_password_repeated_old")) { %>
<em class="noticeText">(changing to a different password)</em>
<% } else if ( loginStatus.equals("changing_password")) { %>
<em class="noticeText">(changing to new password)</em>
<% } else if ( loginStatus.equals("none")) { %>
<em class="noticeText">(new session)</em><br/>
<% } else { %>
<em class="errorText">Status unrecognized: <%=loginStatus.replace("_", " ")%></em><br/>
<% } %>
<form class="old-global-form" name="login" action="${loginJSP}" method="post" onsubmit="return isValidLogin(this) ">
<input type="hidden" name="home" value="<%=portal.getPortalId()%>" />
<label for="loginName">Username:</label>
<%
if ( loginStatus.equals("bad_password") || loginStatus.equals("first_login_no_password")
|| loginStatus.equals("first_login_mistyped") || loginStatus.equals("first_login_changing_password")
|| loginStatus.equals("changing_password_repeated_old") || loginStatus.equals("changing_password") ) { %>
<input id="username" type="text" name="loginName" value='<%=loginHandler.getLoginName()%>' size="10" class="form-item" /><br />
<% } else { %>
<input id="username" type="text" name="loginName" size="10" class="form-item" /><br />
<% if ( loginStatus.equals("unknown_username") ) { %>
<em class="errorText usernameError">Unknown username</em>
<% }
}
%>
<label for="loginPassword">Password:</label>
<input id="password" type="password" name="loginPassword" size="10" class="form-item" /><br />
<% String passwordError=loginHandler.getErrorMsg("loginPassword");
if (passwordError!=null && !passwordError.equals("")) {%>
<em class="errorText passwordError"><%=passwordError%></em>
<% } %>
<input type="submit" name="loginSubmitMode" value="Log in" class="form-item button" />
</form>
<% } %>
</div> <!-- end loginPanel -->

View file

@ -0,0 +1,47 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Portal" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.Controllers" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.auth.policy.RoleBasedPolicy" %>
<%@ page errorPage="/error.jsp"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%/* this odd thing points to something in web.xml */ %>
<%@ taglib prefix="form" uri="http://vitro.mannlib.cornell.edu/edit/tags" %>
<jsp:useBean id="loginHandler" class="edu.cornell.mannlib.vedit.beans.LoginFormBean" scope="session" />
<%
Portal portal = (Portal) request.getAttribute("portalBean");
final String DEFAULT_SEARCH_METHOD = "fulltext"; /* options are fulltext/termlike */
%>
<div id="content">
<div class="tab">
<h2>Site Administration</h2>
</div>
<div id="adminDashboard">
<%@ include file="loginForm.jsp" %>
<%@ include file="dataInput.jsp" %>
<%@ include file="siteConfiguration.jsp" %>
<%@ include file="ontologyEditor.jsp" %>
<%@ include file="advancedDataTools.jsp" %>
<%--
<%@ include file="sessionPreferences.jsp" %>
--%>
</div> <!-- end adminDashboard -->
</div> <!-- end content -->

View file

@ -0,0 +1,58 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener"%>
<% if (securityLevel >= loginHandler.CURATOR) { %>
<div class="pageBodyGroup">
<h3>Ontology Editor</h3>
<%
Object plObj = getServletContext().getAttribute("pelletListener");
if ( (plObj != null) && (plObj instanceof PelletListener) ) {
PelletListener pelletListener = (PelletListener) plObj;
if (!pelletListener.isConsistent()) {
%>
<p class="notice">
INCONSISTENT ONTOLOGY: reasoning halted.
</p>
<p class="notice">
Cause: <%=pelletListener.getExplanation()%>
</p>
<% } else if (pelletListener.isInErrorState()) { %>
<p class="notice">
An error occurred during reasoning;
reasoning has been halted.
See error log for details.
</p>
<% }
}
%>
<ul>
<li><a href="listOntologies?home=<%=portal.getPortalId()%>">Ontology list</a></li>
</ul>
<h4>Class Management</h4>
<ul>
<li><a href="showClassHierarchy?home=<%=portal.getPortalId()%>">Class hierarchy</a></li>
<li><a href="listGroups?home=<%=portal.getPortalId()%>">Class groups</a></li>
</ul>
<h4>Property Management</h4>
<ul>
<li><a href="showObjectPropertyHierarchy?home=${portalBean.portalId}&amp;iffRoot=true">Object property hierarchy</a></li>
<li><a href="showDataPropertyHierarchy?home=<%=portal.getPortalId()%>">Data property hierarchy</a></li>
<li><a href="listPropertyGroups?home=<%=portal.getPortalId()%>">Property groups</a></li>
</ul>
<c:set var="verbosePropertyListing" value="${verbosePropertyListing == true ? true : false}" />
<form id="verbosePropertyForm" action="${Controllers.SITE_ADMIN}#verbosePropertyForm" method="get">
<input type="hidden" name="verbose" value="${!verbosePropertyListing}" />
<span>Verbose property display for this session is <b>${verbosePropertyListing == true ? 'on' : 'off'}</b>.</span>
<input type="submit" value="Turn ${verbosePropertyListing == true ? 'off' : 'on'}" />
</form>
</div>
<% } %>

View file

@ -0,0 +1,60 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.User" %>
<script type="text/javascript" src="js/jquery.js"></script>
<script language="JavaScript" type="text/javascript" src="js/toggle.js"></script>
<script language="JavaScript" type="text/javascript" src="js/md5.js"></script>
<script language="JavaScript" type="text/javascript">
<!-- Hide from browsers without JavaScript support
function isValidLogin( theForm ) {
if ( isEmpty( theForm.loginName.value)) {
theForm.loginName.focus();
return false;
}
if ( isEmptyOrWrongLength( theForm.loginPassword.value)) {
theForm.loginPassword.focus();
return false;
}
//alert("theForm.loginPassword.value=" + theForm.loginPassword.value );
theForm.loginPassword.value = calcMD5( theForm.loginPassword.value );
//alert("theForm.loginPassword.value=" + theForm.loginPassword.value );
return true;
}
function isEmpty( aStr ) {
if ( aStr.length == 0 ) {
alert("Please enter a username to log in");
return true;
}
return false;
}
function isEmptyOrWrongLength( aStr ) {
if ( aStr.length == 0 ) {
alert("Please enter a password to log in");
return true;
} else if ( aStr.length < <%=User.MIN_PASSWORD_LENGTH%> || aStr.length > <%=User.MAX_PASSWORD_LENGTH%>) {
alert("Please enter a password between 6 and 12 characters long");
return true;
}
return false;
}
//Give initial focus to the password or username field
$(document).ready(function(){
if ($("em.passwordError").length > 0 && $("em.usernameError").length == 0) {
$("input#password").focus();
} else {
$("input#username").focus();
}
});
-->
</script>
<script language="JavaScript" type="text/javascript">
initDHTMLAPI();
</script>

View file

@ -0,0 +1,27 @@
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<% if (securityLevel >= loginHandler.CURATOR) { %>
<div class="pageBodyGroup">
<h3>Site Configuration</h3>
<ul>
<c:if test="${requestScope.singlePortal == true }">
<li><a href="editForm?home=<%=portal.getPortalId()%>&amp;controller=Portal&amp;id=<%=portal.getPortalId()%>">Site information</a></li>
</c:if>
<c:if test="${requestScope.singlePortal == false }">
<li><a href="editForm?home=<%=portal.getPortalId()%>&amp;controller=Portal&amp;id=<%=portal.getPortalId()%>">Current portal information</a></li>
<li><a href="listPortals?home=<%=portal.getPortalId()%>">List all portals</a></li>
</c:if>
<li><a href="listTabs?home=<%=portal.getPortalId()%>">Tab management</a></li>
<% if (securityLevel >= loginHandler.DBA) { %>
<li><a href="listUsers?home=<%=portal.getPortalId()%>">User accounts</a></li>
<% } %>
</ul>
</div>
<% } %>