From: erickson Date: Thu, 8 Nov 2007 15:37:27 +0000 (+0000) Subject: Committing initial limit-to-available and sort options on record result page X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=343c60070d21cbefa65ca1afecc393bd6802f01c;p=Evergreen.git Committing initial limit-to-available and sort options on record result page Also, cleaned up some old code and did some tab cleanup TODO: Automatically re-fire search when limit or sort options are changed Add relevance as a sort option Add limit to advanced search Make limit and sort sticky on advanced search Evaluate dropdown labels - i.e. What is clearest to the user in the smallest amount of space? git-svn-id: svn://svn.open-ils.org/ILS/trunk@8044 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/opac/common/js/config.js b/Open-ILS/web/opac/common/js/config.js index 224399706b..58a63a6c30 100644 --- a/Open-ILS/web/opac/common/js/config.js +++ b/Open-ILS/web/opac/common/js/config.js @@ -35,6 +35,7 @@ var PARAM_LANGUAGE = 'la'; var PARAM_TFORM = 'tf'; /* temporary format for title result pages */ var PARAM_RDEPTH = 'rd'; var PARAM_REDIR = 're'; /* true if we have been redirected by IP (we're at a real lib) */ +var PARAM_AVAIL = 'av'; /* limit search results to available items */ /* URL param values (see comments above) */ var TERM; @@ -67,6 +68,7 @@ var SEARCHES; var LANGUAGE; var TFORM; var RDEPTH; +var AVAIL; /* cookie values */ var SBEXTRAS; diff --git a/Open-ILS/web/opac/common/js/opac_utils.js b/Open-ILS/web/opac/common/js/opac_utils.js index 57babc144e..a9835bab6e 100644 --- a/Open-ILS/web/opac/common/js/opac_utils.js +++ b/Open-ILS/web/opac/common/js/opac_utils.js @@ -153,42 +153,45 @@ function initParams() { LANGUAGE = cgi.param(PARAM_LANGUAGE); TFORM = cgi.param(PARAM_TFORM); RDEPTH = cgi.param(PARAM_RDEPTH); + AVAIL = cgi.param(PARAM_AVAIL); /* set up some sane defaults */ - //if(isNaN(DEPTH)) DEPTH = 0; - if(isNaN(RDEPTH)) RDEPTH = 0; - if(isNaN(OFFSET)) OFFSET = 0; - if(isNaN(COUNT)) COUNT = 10; + //if(isNaN(DEPTH)) DEPTH = 0; + if(isNaN(RDEPTH)) RDEPTH = 0; + if(isNaN(OFFSET)) OFFSET = 0; + if(isNaN(COUNT)) COUNT = 10; if(isNaN(HITCOUNT)) HITCOUNT = 0; if(isNaN(MRID)) MRID = 0; - if(isNaN(RID)) RID = 0; + if(isNaN(RID)) RID = 0; if(isNaN(ORIGLOC)) ORIGLOC = 0; /* so we know it hasn't been set */ if(isNaN(AUTHTIME)) AUTHTIME = 0; - if(ADVTERM==null) ADVTERM = ""; + if(ADVTERM==null) ADVTERM = ""; + if(isNaN(AVAIL)) AVAIL = 0; } function clearSearchParams() { - TERM = null; - STYPE = null; - FORM = null; - OFFSET = 0; - HITCOUNT = 0; - ADVTERM = null; - ADVTYPE = null; - MRID = null; - RID = null; - RTYPE = null; - SORT = null; - SORT_DIR = null; - RLIST = null; - CALLNUM = null; - LITFORM = null; - ITEMFORM = null; - ITEMTYPE = null; - AUDIENCE = null; - SEARCHES = null; - LANGUAGE = null; - RDEPTH = null; + TERM = null; + STYPE = null; + FORM = null; + OFFSET = 0; + HITCOUNT = 0; + ADVTERM = null; + ADVTYPE = null; + MRID = null; + RID = null; + RTYPE = null; + SORT = null; + SORT_DIR = null; + RLIST = null; + CALLNUM = null; + LITFORM = null; + ITEMFORM = null; + ITEMTYPE = null; + AUDIENCE = null; + SEARCHES = null; + LANGUAGE = null; + RDEPTH = null; + AVAIL = null; } @@ -231,6 +234,7 @@ function getAudience() { return AUDIENCE; } function getSearches() { return SEARCHES; } function getLanguage() { return LANGUAGE; } function getRdepth() { return RDEPTH; } +function getAvail() { return AVAIL; } function findBasePath() { @@ -377,6 +381,8 @@ function buildOPACLink(args, slim, ssl) { string += _appendParam(SORT, PARAM_SORT, args, getSort, string); if(getSortDir() != null) string += _appendParam(SORT_DIR, PARAM_SORT_DIR, args, getSortDir, string); + if(getAvail()) + string += _appendParam(AVAIL, PARAM_AVAIL, args, getAvail, string); return string.replace(/\&$/,'').replace(/\?\&/,"?"); } diff --git a/Open-ILS/web/opac/locale/en-US/opac.dtd b/Open-ILS/web/opac/locale/en-US/opac.dtd index a8b7f84548..5802878d57 100644 --- a/Open-ILS/web/opac/locale/en-US/opac.dtd +++ b/Open-ILS/web/opac/locale/en-US/opac.dtd @@ -59,6 +59,10 @@ "The password must be at least 7 characters in length, contain at least one letter (a-z/A-Z), and contain at least one number."> + + + + @@ -523,6 +527,8 @@ We recommend that you remove this title from any bookbags it may have been added + + diff --git a/Open-ILS/web/opac/skin/default/css/layout.css b/Open-ILS/web/opac/skin/default/css/layout.css index 5a0d463c7d..9f5704bd59 100644 --- a/Open-ILS/web/opac/skin/default/css/layout.css +++ b/Open-ILS/web/opac/skin/default/css/layout.css @@ -241,4 +241,6 @@ table { border-collapse: collapse; } margin: auto; } +#opac.result.sort { margin-left: 5px; } + diff --git a/Open-ILS/web/opac/skin/default/js/result_common.js b/Open-ILS/web/opac/skin/default/js/result_common.js index 35ba9110b0..6602165d30 100644 --- a/Open-ILS/web/opac/skin/default/js/result_common.js +++ b/Open-ILS/web/opac/skin/default/js/result_common.js @@ -78,6 +78,7 @@ function resultCollectSearchIds( type, method, handler ) { if(sortdir) args.sort_dir = sortdir; if(item_type) args.item_type = item_type; if(item_form) args.item_form = item_form; + if(getAvail()) args.available = 1; if(getAudience()) args.audience = getAudience().split(/,/); diff --git a/Open-ILS/web/opac/skin/default/js/rresult.js b/Open-ILS/web/opac/skin/default/js/rresult.js index c314dfd33b..c0e150bfa4 100644 --- a/Open-ILS/web/opac/skin/default/js/rresult.js +++ b/Open-ILS/web/opac/skin/default/js/rresult.js @@ -27,35 +27,9 @@ function rresultDoSearch() { rresultCollectIds(); } -function rresultCachedSearch() { - - /* XXX */ - return false; - - /* - if(!getOffset()) { - cookieManager.remove(COOKIE_SRIDS); - return false; - } - - var data = JSON2js(cookieManager.read(COOKIE_SRIDS)); - //alert('cached count = ' + data.count); - - if( data && data.ids[getOffset()] != null && - data.ids[resultFinalPageIndex()] != null ) { - _rresultHandleIds( data.ids, data.count ); - return true; - } - - return false; - */ -} - function rresultCollectIds() { var ids; - if(rresultCachedSearch()) return; - switch(getRtype()) { case RTYPE_COOKIE: diff --git a/Open-ILS/web/opac/skin/default/js/search_bar.js b/Open-ILS/web/opac/skin/default/js/search_bar.js index 335720dfc4..1679fcf14c 100644 --- a/Open-ILS/web/opac/skin/default/js/search_bar.js +++ b/Open-ILS/web/opac/skin/default/js/search_bar.js @@ -41,6 +41,12 @@ function searchBarInit() { attachEvt('common','depthChanged', searchBarSubmit); } + if( (limit = $('opac.result.limit2avail')) ) { + if(getAvail()) limit.checked = true; + s = getSort()+'.'+getSortDir(); + if(s.length > 1) + setSelector($('opac.result.filters'), s); + } } function searchBarSubmit() { @@ -53,8 +59,6 @@ function searchBarSubmit() { var d = (newSearchDepth != null) ? newSearchDepth : depthSelGetDepth(); if(isNaN(d)) d = 0; - //text = text.replace(/'/,''); - var args = {}; if(SHOW_MR_DEFAULT) { @@ -70,6 +74,14 @@ function searchBarSubmit() { args[PARAM_DEPTH] = d; args[PARAM_FORM] = _fs.options[_fs.selectedIndex].value; + if($('opac.result.limit2avail')) { + args[PARAM_AVAIL] = ($('opac.result.limit2avail').checked) ? 1 : ''; + if( (val = getSelectorVal($('opac.result.filters'))) ) { + args[PARAM_SORT] = val.split('.')[0] + args[PARAM_SORT_DIR] = val.split('.')[1] + } + } + goTo(buildOPACLink(args)); } diff --git a/Open-ILS/web/opac/skin/default/xml/common/statusbar.xml b/Open-ILS/web/opac/skin/default/xml/common/statusbar.xml index d67b8749e0..a6462c0e03 100644 --- a/Open-ILS/web/opac/skin/default/xml/common/statusbar.xml +++ b/Open-ILS/web/opac/skin/default/xml/common/statusbar.xml @@ -12,6 +12,11 @@ &status.results; + + + + + diff --git a/Open-ILS/web/opac/skin/default/xml/result/filtersort.xml b/Open-ILS/web/opac/skin/default/xml/result/filtersort.xml new file mode 100644 index 0000000000..d88ddffc24 --- /dev/null +++ b/Open-ILS/web/opac/skin/default/xml/result/filtersort.xml @@ -0,0 +1,20 @@ + + &result.limit2avail; + +