added params for filtering pubdate before/after/between/during. added functional...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 26 Sep 2008 18:54:19 +0000 (18:54 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 26 Sep 2008 18:54:19 +0000 (18:54 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10711 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/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 11016a9..279d3bd 100644 (file)
@@ -39,6 +39,10 @@ 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
 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
+var PARAM_PUBD_BEFORE = 'pdb';
+var PARAM_PUBD_AFTER = 'pda';
+var PARAM_PUBD_BETWEEN = 'pdt';
+var PARAM_PUBD_DURING = 'pdd';
 
 /* URL param values (see comments above) */
 var TERM;  
 
 /* URL param values (see comments above) */
 var TERM;  
@@ -75,6 +79,10 @@ var TFORM;
 var RDEPTH;
 var AVAIL;
 var COPYLOCS;
 var RDEPTH;
 var AVAIL;
 var COPYLOCS;
+var PUBD_BEFORE;
+var PUBD_AFTER;
+var PUBD_BETWEEN;
+var PUBD_DURING;
 
 /* cookie values */
 var SBEXTRAS; 
 
 /* cookie values */
 var SBEXTRAS; 
index 3527596..165a5bf 100644 (file)
@@ -167,8 +167,12 @@ function initParams() {
        RDEPTH  = cgi.param(PARAM_RDEPTH);
     AVAIL   = cgi.param(PARAM_AVAIL);
     COPYLOCS   = cgi.param(PARAM_COPYLOCS);
        RDEPTH  = cgi.param(PARAM_RDEPTH);
     AVAIL   = cgi.param(PARAM_AVAIL);
     COPYLOCS   = cgi.param(PARAM_COPYLOCS);
-    
+    PUBD_BEFORE = cgi.param(PARAM_PUBD_BEFORE);
+    PUBD_AFTER = cgi.param(PARAM_PUBD_AFTER);
+    PUBD_BETWEEN = cgi.param(PARAM_PUBD_BETWEEN);
+    PUBD_DURING = cgi.param(PARAM_PUBD_DURING);
 
 
+    
        /* set up some sane defaults */
        //if(isNaN(DEPTH))      DEPTH           = 0;
        if(isNaN(RDEPTH))       RDEPTH  = 0;
        /* set up some sane defaults */
        //if(isNaN(DEPTH))      DEPTH           = 0;
        if(isNaN(RDEPTH))       RDEPTH  = 0;
@@ -208,6 +212,10 @@ function clearSearchParams() {
        RDEPTH      = null;
     AVAIL       = null;
     COPYLOCS    = null;
        RDEPTH      = null;
     AVAIL       = null;
     COPYLOCS    = null;
+    PUBD_BEFORE = null;
+    PUBD_AFTER  = null;
+    PUBD_BETWEEN = null;
+    PUBD_DURING = null;
 }
 
 
 }
 
 
@@ -219,8 +227,6 @@ function initCookies() {
        SKIN = cookieManager.read(COOKIE_SKIN);
     if(findCurrentPage() == HOME)
         cookieManager.remove(COOKIE_SEARCH);
        SKIN = cookieManager.read(COOKIE_SKIN);
     if(findCurrentPage() == HOME)
         cookieManager.remove(COOKIE_SEARCH);
-        
-
 }
 
 /* URL param accessors */
 }
 
 /* URL param accessors */
@@ -258,6 +264,10 @@ function getLanguage() { return LANGUAGE; }
 function getRdepth() { return RDEPTH; }
 function getAvail() { return AVAIL; }
 function getCopyLocs() { return COPYLOCS; }
 function getRdepth() { return RDEPTH; }
 function getAvail() { return AVAIL; }
 function getCopyLocs() { return COPYLOCS; }
+function getPubdBefore() { return PUBD_BEFORE; }
+function getPubdAfter() { return PUBD_AFTER; }
+function getPubdBetween() { return PUBD_BETWEEN; }
+function getPubdDuring() { return PUBD_DURING; }
 
 
 function findBasePath() {
 
 
 function findBasePath() {
@@ -412,6 +422,15 @@ function  buildOPACLink(args, slim, ssl) {
                string += _appendParam(AVAIL, PARAM_AVAIL, args, getAvail, string);
        if(getCopyLocs())
                string += _appendParam(COPYLOCS, PARAM_COPYLOCS, args, getCopyLocs, string);
                string += _appendParam(AVAIL, PARAM_AVAIL, args, getAvail, string);
        if(getCopyLocs())
                string += _appendParam(COPYLOCS, PARAM_COPYLOCS, args, getCopyLocs, string);
+    if(getPubdBefore())
+               string += _appendParam(PUBD_BEFORE, PARAM_PUBD_BEFORE, args, getPubdBefore, string);
+    if(getPubdAfter())
+               string += _appendParam(PUBD_AFTER, PARAM_PUBD_AFTER, args, getPubdAfter, string);
+    if(getPubdBetween())
+               string += _appendParam(PUBD_BETWEEN, PARAM_PUBD_BETWEEN, args, getPubdBetween, string);
+    if(getPubdDuring())
+               string += _appendParam(PUBD_DURING, PARAM_PUBD_DURING, args, getPubdDuring, string);
+
 
        return string.replace(/\&$/,'').replace(/\?\&/,"?");    
 }
 
        return string.replace(/\&$/,'').replace(/\?\&/,"?");    
 }
index 5c38007..40f486a 100644 (file)
@@ -464,6 +464,12 @@ Please see a librarian to renew your account.">
 <!ENTITY advanced.sort.desc "Descending / Z to A">
 <!ENTITY advanced.frbrize "Group Formats and Editions">
 <!ENTITY advanced.go "Go">
 <!ENTITY advanced.sort.desc "Descending / Z to A">
 <!ENTITY advanced.frbrize "Group Formats and Editions">
 <!ENTITY advanced.go "Go">
+<!ENTITY advanced.biblevel "Bib Level">
+<!ENTITY advanced.filter.pubyear "Publication Year">
+<!ENTITY advanced.filter.pubyear.equals "Is">
+<!ENTITY advanced.filter.pubyear.before "Before">
+<!ENTITY advanced.filter.pubyear.after "After">
+<!ENTITY advanced.filter.pubyear.between "Between">
 
 <!--   ================================================================= 
        Rdetail
 
 <!--   ================================================================= 
        Rdetail
index b28ebc0..e28a33a 100644 (file)
@@ -49,11 +49,36 @@ function advgInit() {
     if(getAvail())
         $('opac.result.limit2avail').checked = true;
 
     if(getAvail())
         $('opac.result.limit2avail').checked = true;
 
-    initSearchBoxes();
+    // not sure we want to propogate the pubdate filter, 
+    // since other filters are not propogated
+    //advInitPubFilter();
 
 
+    initSearchBoxes();
     advSyncCopyLocLink(getLocation());
 }
 
     advSyncCopyLocLink(getLocation());
 }
 
+function advInitPubFilter() {
+    var i1 = $('adv_global_pub_date_1');
+    var i2 = $('adv_global_pub_date_2');
+    var sel = $('adv_global_pub_date_type');
+    if(getPubdBefore()) {
+        i1.value = getPubdBefore();
+        setSelector(sel, 'before');
+    } else if(getPubdAfter()) {
+        i1.value = getPubdAfter();
+        setSelector(sel, 'after');
+    } else if(getPubdBetween()) {
+        var values = getPubdBetween().split(','); 
+        i1.value = values[0]
+        if(values[0] == values[1]) {
+            setSelector(sel, 'equals');
+        } else {
+            setSelector(sel, 'between');
+            i2.value = values[1];
+        }
+    }
+}
+
 function advSyncCopyLocLink(org) {
     // display the option to filter by copy location
     advLocationsLoaded = false;
 function advSyncCopyLocLink(org) {
     // display the option to filter by copy location
     advLocationsLoaded = false;
@@ -202,6 +227,27 @@ function advSubmitGlobal() {
        args[PARAM_TERM]                = searches;
        args[PARAM_AVAIL]               = limit2avail;
 
        args[PARAM_TERM]                = searches;
        args[PARAM_AVAIL]               = limit2avail;
 
+    // publicate year filtering
+    var pub1;
+    if( (pub1 = $('adv_global_pub_date_1').value) && (''+pub1).match(/\d{4}/)) {
+        switch(getSelectorVal($('adv_global_pub_date_type'))) {
+            case 'equals':
+                   args[PARAM_PUBD_BETWEEN] = pub1+','+pub1;
+                break;
+            case 'before':
+                   args[PARAM_PUBD_BEFORE] = pub1;
+                break;
+            case 'after':
+                   args[PARAM_PUBD_AFTER] = pub1;
+                break;
+            case 'between':
+                var pub2 = $('adv_global_pub_date_2').value;
+                if((''+pub2).match(/\d{4}/))
+                       args[PARAM_PUBD_BETWEEN] = pub1+','+pub2;
+                break;
+        }
+    }
+
        /* pubdate sorting causes a record (not metarecord) search */
        if( sortby == SORT_TYPE_PUBDATE || !$('adv_group_titles').checked ) {
                args.page = RRESULT;
        /* pubdate sorting causes a record (not metarecord) search */
        if( sortby == SORT_TYPE_PUBDATE || !$('adv_group_titles').checked ) {
                args.page = RRESULT;
index e2c57b8..636f18c 100644 (file)
@@ -86,6 +86,9 @@ function resultCollectSearchIds( type, method, handler ) {
        if(getLanguage()) args.language = getLanguage().split(/,/);
        if(getBibLevel()) args.bib_level        = getBibLevel().split(/,/);
        if(getCopyLocs()) args.locations        = getCopyLocs().split(/,/);
        if(getLanguage()) args.language = getLanguage().split(/,/);
        if(getBibLevel()) args.bib_level        = getBibLevel().split(/,/);
        if(getCopyLocs()) args.locations        = getCopyLocs().split(/,/);
+    if(getPubdBefore()) args.before = getPubdBefore();
+    else if(getPubdAfter()) args.after = getPubdAfter();
+    else if(getPubdBetween()) args.between = getPubdBetween().split(/,/);
 
        _debug('Search args: ' + js2JSON(args));
        _debug('Raw query: ' + getTerm());
 
        _debug('Search args: ' + js2JSON(args));
        _debug('Raw query: ' + getTerm());
index 437f321..daf6048 100644 (file)
 
                                        <tr>
                                                <td align='right'>
 
                                        <tr>
                                                <td align='right'>
-                                                       <span>Bib Level</span>
+                                                       <span>&advanced.biblevel;</span>
                                                </td>
                                                <td align='left'>
                                                        <select multiple='multiple' size='3' id='adv_global_bib_level'>
                                                </td>
                                                <td align='left'>
                                                        <select multiple='multiple' size='3' id='adv_global_bib_level'>
                                                </td>
                                        </tr>
 
                                                </td>
                                        </tr>
 
+                                       <tr>
+                                               <td align='right'>
+                                                       <span>&advanced.filter.pubyear;</span>
+                                               </td>
+                                               <td align='left'>
+                                                       <select id='adv_global_pub_date_type' onchange='
+                                if($("adv_global_pub_date_type").selectedIndex == 3)
+                                    unHideMe($("adv_global_pub_date_2_span"));
+                                else
+                                    hideMe($("adv_global_pub_date_2_span"));'>
+                                <option value='equals' selected='selected'>&advanced.filter.pubyear.equals;</option>
+                                <option value='before'>&advanced.filter.pubyear.before;</option>
+                                <option value='after'>&advanced.filter.pubyear.after;</option>
+                                <option value='between'>&advanced.filter.pubyear.between;</option>
+                                                       </select>       
+                            <div style='margin-top:5px;'>
+                                <input id='adv_global_pub_date_1' type='text' size='4' maxlength='4'/>
+                                <span id='adv_global_pub_date_2_span' class='hide_me'>
+                                   &common.and; <input id='adv_global_pub_date_2' type='text' size='4' maxlength='4'/>
+                                </span>
+                            </div>
+                                               </td>
+                                       </tr>
+
+
                     <!-- copy location selector -->
                     <tr id='adv_copy_location_filter_row' class='hide_me'>
                         <td align='right'>&opac.advanced.copy_loc_filter;</td>
                     <!-- copy location selector -->
                     <tr id='adv_copy_location_filter_row' class='hide_me'>
                         <td align='right'>&opac.advanced.copy_loc_filter;</td>
        </tr>
 
        <tr style='border-top: none;'>
        </tr>
 
        <tr style='border-top: none;'>
-               <td align='center' valign='bottom' style='border-top: none;'>
+               <td align='center' valign='top' style='border-top: none;'>
 
                        <table style='border: none; width: 100%;'>
                                <tr>
 
                        <table style='border: none; width: 100%;'>
                                <tr>