UI component for selecting copy locations to filter on. todo: plugging in cgi params...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 19 Jun 2008 03:03:52 +0000 (03:03 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 19 Jun 2008 03:03:52 +0000 (03:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@9863 dcc99617-32d9-48b4-a31d-7c20da2025e4

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/xml/advanced/advanced_global.xml

index 3100a85..5993c9e 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 "Filter by Shelving Location">
 
 <!-- ==========================================================
      MARC expert search
index c112356..c68914c 100644 (file)
@@ -248,3 +248,5 @@ table { border-collapse: collapse; }
 #myopac_holds_thaw_date_form {padding: 10px; text-align: center;}
 #myopac_holds_freeze_select_thaw {margin-right: 100px; margin-left: 100px; }
 
+#adv_copy_location_filter_td { text-align:center; }
+#adv_copy_location_filter_div { padding:5px; margin:5px; }
index f844450..78f1746 100644 (file)
@@ -1,7 +1,9 @@
 
 attachEvt("common", "run", advgInit);
+attachEvt("common", "locationChanged", advSyncCopyLocLink );
 
 var COOKIE_NOGROUP_RECORDS = 'grpt';
+var advSelectedOrg = null;
 
 function advgInit() {
 
@@ -48,6 +50,24 @@ 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'));
+        if(!$('adv_copy_location_filter_div').className.match(/hide_me/))
+            advLoadCopyLocations(org); 
+    } else {
+        hideMe($('adv_copy_location_filter_row'));
+    }
+
 }
 
 function initSearchBoxes() {
@@ -234,5 +254,34 @@ function advBuildSearchBlob() {
 }
 
 
+// retrieves the shelving locations
+var advLocationsLoaded = false;
+function advLoadCopyLocations(org) {
+    if(advLocationsLoaded) {
+        removeChildren($('adv_copy_location_filter_select'));
+        hideMe($('adv_copy_location_filter_div'));
+        advLocationsLoaded = false;
+        return;
+    }
+    if(org == null) {
+        if(advSelectedOrg == null)
+            org = getLocation();
+        else
+            org = advSelectedOrg;
+    }
+    unHideMe($('adv_copy_location_filter_div'));
+    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 021c6bf..95daf0b 100644 (file)
                                                </table>
                                        </td>
                                </tr>
+                <tr id='adv_copy_location_filter_row' class='hide_me'>
+                    <td id='adv_copy_location_filter_td' colspan='2'>
+                        <a class='classic_link' href='javascript:advLoadCopyLocations();'>&opac.advanced.copy_loc_filter;</a>
+                        <div id='adv_copy_location_filter_div' class='hide_me'>
+                            <select id='adv_copy_location_filter_select' multiple='multiple'>
+                            </select>
+                        </div>
+                    </td>
+                </tr>
                        </table>
                </td>