Minor code tweaks

This commit is contained in:
rjy7 2010-07-04 19:43:39 +00:00
parent 51b4fb24c2
commit 8a4c457654
3 changed files with 30 additions and 29 deletions

View file

@ -21,6 +21,7 @@ core:authorInAuthorship (Person : Authorship) - inverse of linkedAuthor
--%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Arrays" %>
<%@ page import="java.util.Collections" %>
@ -38,6 +39,7 @@ core:authorInAuthorship (Person : Authorship) - inverse of linkedAuthor
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.web.MiscWebUtils" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.utils.StringUtils" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.JavaScript" %>
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder.Css" %>
@ -234,7 +236,7 @@ SPARQL queries for existing values. --%>
}
</c:set>
<%
<%
log.debug(request.getAttribute("editjson"));
EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request);
@ -274,6 +276,19 @@ SPARQL queries for existing values. --%>
"/edit/forms/css/addAuthorsToInformationResource.css"
));
request.setAttribute("customCss", customCss);
String ulClass = "";
List<String> ulClasses = new ArrayList<String>();
if (authorships.size() > 1) {
// This class triggers application of dd styles. Don't wait for js to add
// the ui-sortable class, because then the page flashes as the styles are updated.
ulClasses.add("dd");
}
if (ulClasses.size() > 0) {
ulClass="class=\"" + StringUtils.join(ulClasses, " ") + "\"";
}
%>
<c:set var="title" value="<em>${infoResourceName}</em>: Authors" />
@ -284,20 +299,6 @@ SPARQL queries for existing values. --%>
<h2>${title}</h2>
<%
String ulClass = "";
if (authorships.size() > 1) {
// This class triggers application of dd styles. Don't wait for js to add
// the ui-sortable class, because then the page flashes as the styles are updated.
ulClass = "dd";
}
if (! "".equals(ulClass)) {
ulClass = "class='" + ulClass + "'";
}
%>
<ul id="authorships" <%= ulClass %>>
<%

View file

@ -161,11 +161,11 @@ var addAuthorForm = {
minLength: 2,
source: function(request, response) {
if (request.term in addAuthorForm.acCache) {
// console.log("found term in cache");
// console.log('found term in cache');
response(addAuthorForm.acCache[request.term]);
return;
}
// console.log("not getting term from cache");
// console.log('not getting term from cache');
// If the url query params are too long, we could do a post
// here instead of a get. Add the exclude uris to the data
@ -195,8 +195,8 @@ var addAuthorForm = {
var url = this.baseAcUrl,
existingAuthors = $('#authorships .authorLink');
//console.log("in setAcUrl()");
//console.log("number of existing authors: " + existingAuthors.length);
//console.log('in setAcUrl()');
//console.log('number of existing authors: ' + existingAuthors.length);
existingAuthors.each(function() {
url += '&excludeUri=' + $(this).attr('id');
@ -286,8 +286,8 @@ var addAuthorForm = {
});
// console.log(authorships)
// console.log("additions: " + additions);
// console.log("retractions: " + retractions);
// console.log('additions: ' + additions);
// console.log('retractions: ' + retractions);
$.ajax({
url: $('.reorderUrl').attr('id'),
@ -469,7 +469,7 @@ var addAuthorForm = {
removeAuthorship: function(link) {
// RY Upgrade this to a modal window
var message = "Are you sure you want to remove this author?";
var message = 'Are you sure you want to remove this author?';
if (!confirm(message)) {
return false;
}
@ -525,7 +525,7 @@ var addAuthorForm = {
// $(this).siblings('.undo').show();
// author.html(authorName + ' has been removed');
// author.css('width', 'auto');
// author.effect("highlight", {}, 3000);
// author.effect('highlight', {}, 3000);
} else {
alert('Error processing request: author not removed');
}
@ -544,8 +544,8 @@ var addAuthorForm = {
// RY To be implemented later.
toggleRemoveLink: function() {
// when clicking remove: remove the author, and change link text to "undo"
// when clicking undo: add the author back, and change link text to "remove"
// when clicking remove: remove the author, and change link text to 'undo'
// when clicking undo: add the author back, and change link text to 'remove'
}
};

View file

@ -12,13 +12,13 @@
<c:choose>
<c:when test="${predicateUri == 'http://vivoweb.org/ontology/core#authorInAuthorship'}"><%-- SUBJECT is a Person, so get info from Authorship about related Publication --%>
<c:choose>
<c:when test="${!empty individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedInformationResource']}"><%-- this Position is linked to an Organization --%>
<c:when test="${!empty individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedInformationResource']}"><%-- this Authorship is linked to an InformationResource --%>
<c:set var="infoResource" value="${individual.objectPropertyMap['http://vivoweb.org/ontology/core#linkedInformationResource'].objectPropertyStatements[0].object}" />
<c:set var="name" value="${infoResource.name}"/>
<c:set var="name" value="${infoResource.name}"/>
<c:set var="moniker" value="${infoResource.moniker}"/>
<c:set var="year" value="${infoResource.dataPropertyMap['http://vivoweb.org/ontology/core#year'].dataPropertyStatements[0].data}"/>
<c:set var="year" value="${infoResource.dataPropertyMap['http://vivoweb.org/ontology/core#year'].dataPropertyStatements[0].data}"/>
<c:set var="label" value="${moniker} ${year}"/>
<c:set var="uri" value="${infoResource.URI}"/>
<c:set var="uri" value="${infoResource.URI}"/>
</c:when>
<c:otherwise><%-- this Position is not linked to a Publication yet; use Authorship name as a placeholder and add link to the Authorship so user can add more information --%>
<c:choose>