backporting shelving location filter
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Jul 2008 19:11:31 +0000 (19:11 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Jul 2008 19:11:31 +0000 (19:11 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@10056 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/common/js/opac_utils.js
Open-ILS/web/opac/locale/en-US/opac.dtd
Open-ILS/web/opac/skin/default/css/layout.css
Open-ILS/web/opac/skin/default/js/adv_global.js
Open-ILS/web/opac/skin/default/js/result_common.js
Open-ILS/web/opac/skin/default/xml/advanced/advanced_global.xml

index 1249948..d073f24 100644 (file)
@@ -36,6 +36,7 @@ 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 */
+var PARAM_COPYLOCS  = 'cl'; // copy (shelving) locations
 
 /* URL param values (see comments above) */
 var TERM;  
@@ -69,6 +70,7 @@ var LANGUAGE;
 var TFORM;
 var RDEPTH;
 var AVAIL;
+var COPYLOCS;
 
 /* cookie values */
 var SBEXTRAS; 
index 247300c..d1e6100 100644 (file)
@@ -154,6 +154,8 @@ function initParams() {
        TFORM           = cgi.param(PARAM_TFORM);
        RDEPTH  = cgi.param(PARAM_RDEPTH);
     AVAIL   = cgi.param(PARAM_AVAIL);
+    COPYLOCS   = cgi.param(PARAM_COPYLOCS);
+    
 
        /* set up some sane defaults */
        //if(isNaN(DEPTH))      DEPTH           = 0;
@@ -192,6 +194,7 @@ function clearSearchParams() {
        LANGUAGE    = null;
        RDEPTH      = null;
     AVAIL       = null;
+    COPYLOCS    = null;
 }
 
 
@@ -239,6 +242,7 @@ function getSearches() { return SEARCHES; }
 function getLanguage() { return LANGUAGE; }
 function getRdepth() { return RDEPTH; }
 function getAvail() { return AVAIL; }
+function getCopyLocs() { return COPYLOCS; }
 
 
 function findBasePath() {
@@ -387,6 +391,8 @@ function  buildOPACLink(args, slim, ssl) {
                string += _appendParam(SORT_DIR,        PARAM_SORT_DIR, args, getSortDir, string);
        if(getAvail())
                string += _appendParam(AVAIL, PARAM_AVAIL, args, getAvail, string);
+       if(getCopyLocs())
+               string += _appendParam(COPYLOCS, PARAM_COPYLOCS, args, getCopyLocs, string);
 
        return string.replace(/\&$/,'').replace(/\?\&/,"?");    
 }
index e985dc9..afd9872 100644 (file)
@@ -319,6 +319,7 @@ Please see a librarian to renew your account.">
 <!ENTITY opac.advanced.quick.tcn "TCN"> <!-- title control number -->
 <!ENTITY opac.advanced.quick.barcode "Item Barcode"> 
 <!ENTITY opac.advanced.quick.cn "Call Number"> 
+<!ENTITY opac.advanced.copy_loc_filter "Shelving Location">
 
 <!-- ==========================================================
      MARC expert search
index c112356..0eae7a7 100644 (file)
@@ -247,4 +247,3 @@ table { border-collapse: collapse; }
 #xul_recipient_me { margin-left: 25px; }
 #myopac_holds_thaw_date_form {padding: 10px; text-align: center;}
 #myopac_holds_freeze_select_thaw {margin-right: 100px; margin-left: 100px; }
-
index 1dd7dd9..6277971 100644 (file)
@@ -1,7 +1,9 @@
 
 attachEvt("common", "run", advgInit);
+attachEvt("common", "locationChanged", advSyncCopyLocLink );
 
 var COOKIE_NOGROUP_RECORDS = 'grpt';
+var advSelectedOrg = null;
 
 function advgInit() {
 
@@ -45,6 +47,23 @@ function advgInit() {
         $('opac.result.limit2avail').checked = true;
 
     initSearchBoxes();
+
+    advSyncCopyLocLink(getLocation());
+}
+
+function advSyncCopyLocLink(org) {
+    // display the option to filter by copy location
+    advLocationsLoaded = false;
+    advSelectedOrg = org;
+    removeChildren($('adv_copy_location_filter_select'));
+
+    if(isTrue(findOrgType(findOrgUnit(org).ou_type()).can_have_vols())) {
+        unHideMe($('adv_copy_location_filter_row'));
+        advLoadCopyLocations(org); 
+    } else {
+        hideMe($('adv_copy_location_filter_row'));
+    }
+
 }
 
 function initSearchBoxes() {
@@ -137,6 +156,7 @@ function advSubmitGlobal() {
        var itemforms = advGetVisSelectorVals('adv_global_item_form');
        var itemtypes = advGetVisSelectorVals('adv_global_item_type');
        var audiences = advGetVisSelectorVals('adv_global_audience');
+    var locations = advGetVisSelectorVals('adv_copy_location_filter_select');
        var languages = getSelectedList($('adv_global_lang')) + '';     
     var limit2avail = $('opac.result.limit2avail').checked ? 1 : ''
 
@@ -152,6 +172,7 @@ function advSubmitGlobal() {
        args[PARAM_LITFORM]     = litforms;
        args[PARAM_AUDIENCE]    = audiences;
        args[PARAM_LANGUAGE] = languages;
+       args[PARAM_COPYLOCS] = locations;
        //args[PARAM_SEARCHES]  = js2JSON(searches); /* break these out */
        args[PARAM_DEPTH]               = depthSelGetDepth();
        args[PARAM_LOCATION]    = depthSelGetNewLoc();
@@ -229,5 +250,23 @@ function advBuildSearchBlob() {
 }
 
 
+// retrieves the shelving locations
+var advLocationsLoaded = false;
+function advLoadCopyLocations(org) {
+    if(org == null) 
+        org = advSelectedOrg;
+    var req = new Request(FETCH_COPY_LOCATIONS, org);
+    req.callback(advShowCopyLocations);
+    req.send();
+    advLocationsLoaded = true;
+}
+
+// inserts the shelving locations into the multi-select
+function advShowCopyLocations(r) {
+    var locations = r.getResultObject();
+    var sel = $('adv_copy_location_filter_select');
+    for(var i = 0; i < locations.length; i++) 
+        insertSelectorVal(sel, -1, locations[i].name(), locations[i].id());
+}
 
 
index 98fb725..d6e94ee 100644 (file)
@@ -76,6 +76,7 @@ function resultCollectSearchIds( type, method, handler ) {
        if(getAudience()) args.audience  = getAudience().split(/,/);
        if(getLitForm()) args.lit_form  = getLitForm().split(/,/);
        if(getLanguage()) args.language = getLanguage().split(/,/);
+       if(getCopyLocs()) args.locations        = getCopyLocs().split(/,/);
 
     TERM = (TERM+'').replace(/\\/g,'');
 
index f09d760..8f7c150 100644 (file)
                                                        </select>
                                                </td>
                                        </tr>
+                    <!-- copy location selector -->
+                    <tr id='adv_copy_location_filter_row' class='hide_me'>
+                        <td align='right'>&opac.advanced.copy_loc_filter;</td>
+                        <td align='left' id='adv_copy_location_filter_td'>
+                            <select size='3' id='adv_copy_location_filter_select' multiple='multiple'>
+                            </select>
+                        </td>
+                    </tr>
                                </tbody>
                        </table>
                </td>