From: erickson Date: Fri, 16 Nov 2007 16:44:59 +0000 (+0000) Subject: Storing the compiled search blob in a cookie. That cookie is used to populate X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f55a82a89cddb1b5f8d7ff62f197ffe511527a29;p=Evergreen.git Storing the compiled search blob in a cookie. That cookie is used to populate the advanced search widgets. (This means we don't have to re-parse the query syntax in the OPAC). Removed the hold cancel option from the edit column since Cancel is an option in the new hold actions dropdown. git-svn-id: svn://svn.open-ils.org/ILS/trunk@8075 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 aca1d7d90f..e77b3e9370 100644 --- a/Open-ILS/web/opac/common/js/config.js +++ b/Open-ILS/web/opac/common/js/config.js @@ -82,6 +82,7 @@ var COOKIE_SES = "ses"; var COOKIE_FONT = "fnt"; var COOKIE_SKIN = "skin"; var COOKIE_RIDS = "rids"; /* list of record ids */ +var COOKIE_SEARCH = 'sr'; /* pages */ var MRESULT = "mresult"; diff --git a/Open-ILS/web/opac/common/js/opac_utils.js b/Open-ILS/web/opac/common/js/opac_utils.js index a9835bab6e..cd0f2a198b 100644 --- a/Open-ILS/web/opac/common/js/opac_utils.js +++ b/Open-ILS/web/opac/common/js/opac_utils.js @@ -201,6 +201,10 @@ function initCookies() { scaleFonts(font); if(font) FONTSIZE = font; SKIN = cookieManager.read(COOKIE_SKIN); + if(findCurrentPage() == HOME) + cookieManager.remove(COOKIE_SEARCH); + + } /* URL param accessors */ @@ -708,6 +712,7 @@ function doLogout(noredirect) { cookieManager.remove(COOKIE_RIDS); cookieManager.remove(COOKIE_SES); cookieManager.remove(COOKIE_SKIN); + cookieManager.remove(COOKIE_SEARCH); checkUserSkin("default"); COUNT = 10; diff --git a/Open-ILS/web/opac/locale/en-US/opac.dtd b/Open-ILS/web/opac/locale/en-US/opac.dtd index 63159260cd..653299be9b 100644 --- a/Open-ILS/web/opac/locale/en-US/opac.dtd +++ b/Open-ILS/web/opac/locale/en-US/opac.dtd @@ -201,7 +201,7 @@ avoid using bookbags all together. Thank you."> ================================================================= --> - + diff --git a/Open-ILS/web/opac/skin/default/js/adv_global.js b/Open-ILS/web/opac/skin/default/js/adv_global.js index c5da253b77..1dd7dd9e85 100644 --- a/Open-ILS/web/opac/skin/default/js/adv_global.js +++ b/Open-ILS/web/opac/skin/default/js/adv_global.js @@ -43,6 +43,40 @@ function advgInit() { if(getAvail()) $('opac.result.limit2avail').checked = true; + + initSearchBoxes(); +} + +function initSearchBoxes() { + /* loads the compiled search from the search cookie + and sets the widgets accordingly */ + + search = cookieManager.read(COOKIE_SEARCH); + if(!search) return; + _debug("loaded compiled search cookie: " + search); + + search = JSON2js(search); + if(!search) return; + + var types = getObjectKeys(search.searches); + + /* pre-add the needed rows */ + while($('adv_global_tbody').getElementsByTagName('tr').length - 1 < types.length) + advAddGblRow(); + + var rows = $('adv_global_tbody').getElementsByTagName('tr'); + for(var t = 0; t < types.length; t++) { + var row = rows[t]; + setSelector($n(row, 'type'), types[t]); + var term = search.searches[types[t]].term; + + /* if this is a single - search, set the selector to nocontains */ + if(match = term.match(/^-(\w+)$/)) { + term = match[1]; + setSelector($n(row, 'contains'), 'nocontains'); + } + $n(row, 'term').value = term; + } } function advAddGblRow() { diff --git a/Open-ILS/web/opac/skin/default/js/mresult.js b/Open-ILS/web/opac/skin/default/js/mresult.js index 97fcd6bb21..aaad90d93d 100644 --- a/Open-ILS/web/opac/skin/default/js/mresult.js +++ b/Open-ILS/web/opac/skin/default/js/mresult.js @@ -51,6 +51,7 @@ function mresultHandleMRIds(r) { if( getOffset() == 0 ) HITCOUNT = res.count; runEvt('result', 'hitCountReceived'); } + cookieManager.write(COOKIE_SEARCH, js2JSON(res.compiled_search), -1); runEvt('result', 'idsReceived', res.ids); } diff --git a/Open-ILS/web/opac/skin/default/js/myopac.js b/Open-ILS/web/opac/skin/default/js/myopac.js index 11ff6f3e22..fc8d7cf776 100644 --- a/Open-ILS/web/opac/skin/default/js/myopac.js +++ b/Open-ILS/web/opac/skin/default/js/myopac.js @@ -336,9 +336,6 @@ function myOPACDrawHolds(r) { tbody.appendChild(row); - $n(row,'myopac_holds_cancel_link').setAttribute( - 'href','javascript:myOPACCancelHold("'+ h.id()+'");'); - $n(row,'myopac_holds_edit_link').setAttribute( 'href','javascript:myOPACEditHold("'+ h.id()+'");'); @@ -378,15 +375,6 @@ function myOPACEditHold(holdid) { } -function myOPACCancelHold(holdid) { - if( confirm($('myopac_holds_cancel_verify').innerHTML) ) { - holdsCancel(holdid); - holdsTemplateRow = null - myOPACShowHolds(); - } -} - - function myOPACDrawHoldStatus(hold) { var req = new Request(FETCH_HOLD_STATUS, G.user.session, hold.id() ); req.callback(myOShowHoldStatus); @@ -464,7 +452,6 @@ function _myOPACFleshHoldTitle(hold, holdObjects) { if(copy) $n(row, 'copy').appendChild(text(copy.barcode())); } - /*var form = $("myopac_holds_form_" + hold.id() + '_' + record.doc_id());*/ var form = $("myopac_holds_form_" + hold.id()); if(form) { diff --git a/Open-ILS/web/opac/skin/default/js/rresult.js b/Open-ILS/web/opac/skin/default/js/rresult.js index 79ece56094..0b11da9de5 100644 --- a/Open-ILS/web/opac/skin/default/js/rresult.js +++ b/Open-ILS/web/opac/skin/default/js/rresult.js @@ -299,6 +299,8 @@ function rresultFilterSearchResults(r) { for( var i = 0; i != result.ids.length; i++ ) ids.push(result.ids[i][0]); } + + cookieManager.write(COOKIE_SEARCH, js2JSON(result.compiled_search), -1); _rresultHandleIds( ids, result.count ); } diff --git a/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml b/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml index 2d2210687c..678b2dc1b4 100644 --- a/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml +++ b/Open-ILS/web/opac/skin/default/xml/myopac/myopac_holds.xml @@ -43,7 +43,7 @@ onclick='myopacSelectNoneHolds();' class='classic_link' href='javascript:void(0);'>&common.none;) - &myopac.holds.edit.cancel; + &myopac.holds.edit; @@ -88,10 +88,7 @@ &myopac.holds.edit; - &myopac.holds.cancel; -