From: dbs Date: Thu, 19 Aug 2010 16:51:00 +0000 (+0000) Subject: Further enhancements to the authority list interface X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0299987c2c4040b729fd843283e0ae7d848793e9;p=evergreen%2Fpines.git Further enhancements to the authority list interface * Offer Next / Previous buttons instead of forcing the number spinner * Submit searches onBlur of the search box instead of having to click Submit * Accept CGI params so we can kick off a search from other interfaces * Factor out the displayRecords() code so we can attach other events to it git-svn-id: svn://svn.open-ils.org/ILS/trunk@17267 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/templates/default/cat/authority/list.tt2 b/Open-ILS/web/templates/default/cat/authority/list.tt2 index f340a48ade..a85c799aac 100644 --- a/Open-ILS/web/templates/default/cat/authority/list.tt2 +++ b/Open-ILS/web/templates/default/cat/authority/list.tt2 @@ -11,10 +11,13 @@ dojo.require('dijit.form.TextBox'); dojo.require("dijit.Menu"); dojo.require("dijit.MenuItem"); dojo.require('dojox.xml.parser'); +dojo.require('openils.CGI'); dojo.require('openils.PermaCrud'); dojo.require('openils.XUL'); dojo.require('openils.widget.OrgUnitFilteringSelect'); +var cgi = new openils.CGI(); + /* // OrgUnits do not currently affect the retrieval of authority records, // but this is how to display them if they become OrgUnit-aware @@ -97,11 +100,70 @@ function loadMarcEditor(pcrud, rec) { } }; } + +function authListInit() { + /* Parse CGI params so we can display records on load */ + term = cgi.param('authTerm') || ''; + page = cgi.param('authPage') || 0; + axis = cgi.param('authAxis') || 'authority.author'; + if (axis) { + dijit.byId('authAxis').attr('value', axis); + } + if (page) { + dijit.byId('authPage').attr('value', page); + } + + /* If we receive a term, go ahead and display the records */ + if (term) { + dijit.byId('authTerm').attr('value', term); + displayRecords(); + } + + /* Make searching possible without having to click Submit */ + dojo.connect(dijit.byId('authTerm'), 'onBlur', 'displayRecords'); +} + +function displayRecords(parms) { + + if (parms && parms.page) { + if (parms.page == 'next') { + page = dijit.byId('authPage').attr('value'); + dijit.byId('authPage').attr('value', page + 1); + } else if (parms.page == 'prev') { + page = dijit.byId('authPage').attr('value'); + dijit.byId('authPage').attr('value', page - 1); + } else { + dijit.byId('authPage').attr('value', parms.page); + } + } + + /* Protect against null input */ + if (!dijit.byId('authTerm').attr('value')) { + return; + } + + /* Clear out the current contents of the page */ + widgets = dijit.findWidgets(dojo.byId('authlist-div')); + dojo.forEach(widgets, function(w) { w.destroyRecursive(true); }); + + dojo.query("#authlist-div div").orphan(); + + url = '/opac/extras/startwith/marcxml/' + + dijit.byId('authAxis').attr('value') + // + '/' + dijit.byId('authOU').attr('value') + + '/1' // replace with preceding line if OUs gain some meaning + + '/' + dijit.byId('authTerm').attr('value') + + '/' + dijit.byId('authPage').attr('value') + ; + dojo.xhrGet({"url":url, "handleAs":"xml", "content":{"format":"marcxml"}, "preventCache": true, "load":displayAuthorities }); +} + +dojo.addOnLoad(authListInit);
- @@ -109,28 +171,24 @@ function loadMarcEditor(pcrud, rec) { - -
Submit + +
Previous +
- /* Clear out the current contents of the page */ - widgets = dijit.findWidgets(dojo.byId('authlist-div')); - dojo.forEach(widgets, function(w) { w.destroyRecursive(true); }); + - dojo.query("#authlist-div div").orphan(); +
Next + +
- url = '/opac/extras/startwith/marcxml/' - + dijit.byId('authAxis').attr('value') - // + '/' + dijit.byId('authOU').attr('value') - + '/1' // replace with preceding line if OUs gain some meaning - + '/' + dijit.byId('authTerm').attr('value') - + '/' + dijit.byId('authPage').attr('value') - ; - dojo.xhrGet({"url":url, "handleAs":"xml", "content":{"format":"marcxml"}, "preventCache": true, "load":displayAuthorities }); +
Submit +