From 8568c806b4a135e5d77cfe2b5ed8fdaea38d99c9 Mon Sep 17 00:00:00 2001 From: rjy7 Date: Thu, 1 Jul 2010 14:50:02 +0000 Subject: [PATCH] NIHVIVO-646 Modifications to element structure of existing author listings, and associated changes to js and css --- .../forms/addAuthorsToInformationResource.jsp | 45 ++++++++---- .../css/addAuthorsToInformationResource.css | 14 ++-- .../edit/forms/images/sortable_icon.png | Bin 0 -> 234 bytes .../js/addAuthorsToInformationResource.js | 68 ++++++++++++++++-- 4 files changed, 99 insertions(+), 28 deletions(-) create mode 100644 productMods/edit/forms/images/sortable_icon.png diff --git a/productMods/edit/forms/addAuthorsToInformationResource.jsp b/productMods/edit/forms/addAuthorsToInformationResource.jsp index 078aebc9..64d0e4b2 100644 --- a/productMods/edit/forms/addAuthorsToInformationResource.jsp +++ b/productMods/edit/forms/addAuthorsToInformationResource.jsp @@ -63,7 +63,10 @@ core:authorInAuthorship (Person : Authorship) - inverse of linkedAuthor vreq.setAttribute("flagUri",flagUri); vreq.setAttribute("stringDatatypeUriJson", MiscWebUtils.escape(XSD.xstring.toString())); - vreq.setAttribute("intDatatypeUriJson", MiscWebUtils.escape(XSD.xint.toString())); + + String intDatatypeUri = XSD.xint.toString(); + vreq.setAttribute("intDatatypeUri", intDatatypeUri); + vreq.setAttribute("intDatatypeUriJson", MiscWebUtils.escape(intDatatypeUri)); %> @@ -293,12 +296,17 @@ SPARQL queries for existing values. --%> @@ -356,8 +368,11 @@ SPARQL queries for existing values. --%> - + + + " /> + " />

diff --git a/productMods/edit/forms/css/addAuthorsToInformationResource.css b/productMods/edit/forms/css/addAuthorsToInformationResource.css index 92ed2b03..ddeba3c2 100644 --- a/productMods/edit/forms/css/addAuthorsToInformationResource.css +++ b/productMods/edit/forms/css/addAuthorsToInformationResource.css @@ -7,18 +7,15 @@ #authors li { list-style: none; margin-bottom: .75em; + padding-left: 1em; + background: url("../images/sortable_icon.png") no-repeat left center; } -#authors a.existingAuthor { +#authors a.authorLink { display: inline-block; width: 15em; } -/* These are only here for JavaScript to pick up. Don't display!! */ -#authors span.existingAuthorUri { - display: none; -} - #showAddForm span.or { display: none; } @@ -85,10 +82,15 @@ form a:hover.cancel, margin-top: 3em; } + + +/* Disabling undo links for the present. Add back later. */ +/* a.undo, #selectedAuthor { display: none; } +*/ /* Hide elements not used in non-JS version of form */ /* rjy7 Currently not supporting non-JS version of this form. */ diff --git a/productMods/edit/forms/images/sortable_icon.png b/productMods/edit/forms/images/sortable_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8cae70f7c166b3b40dbe1980d5e53486fbb69d5e GIT binary patch literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^Y(UJz!3-qJI&EZtlw^r(L`iUdT1k0gQ7VIDN`6wR zf@f}GdTLN=VoGJ<$y6JlBCPGL(%Czz7PJf8P*^m@;iHU`^~Al~bu-?^tuQq`c5$}H|4q+gwtwZD&%n%3vW4kj T;NeC`pg9blu6{1-oD!M', + additions = '', + retractions = '', + rankTypeSuffix = '^^<' + $('#rankType').val() + '>', + uri, + newRank, + oldRank; + $('li.authorship').each(function(index) { + // This value does double duty, for removal and reordering + uri = $(this).children('.remove').attr('id'); + oldRank = $(this).children('.rank').attr('id'); // already contains the rankSuffix, if present + newRank = index + 1; + additions += uri + ' ' + rankPred + ' ' + '"' + newRank + '"' + rankTypeSuffix + ' .'; + retractions += uri + ' ' + rankPred + ' ' + '"' + oldRank + ' .'; + }); + console.log(additions); + console.log(retractions); + $.ajax({ + url: $('#reorderUrl').val(), + data: { + additions: additions, + retractions: retractions + }, + dataType: 'json', + type: 'POST', + success: function(xhr, status, error) { + // reset rank in the span + // can just do from values we computed, if easier than getting data back from server + // + }, + error: function(data, status, request) { + addAuthorForm.restorePreviousRankings(); + alert('Reordering of author ranks failed.'); + } + }); + }, + + restorePreviousRankings: function() { + // restore existing rankings after reordering failure + // use span.rank id attr value to determine + }, + + initAutocomplete: function() { var cache = {}; var url = $('#acUrl').val();