added pub date sorting to rresult page and made a way to get there from the advanced...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Mar 2006 15:42:33 +0000 (15:42 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Mar 2006 15:42:33 +0000 (15:42 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3245 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/locale/en-US/opac_advanced.dtd
Open-ILS/web/opac/skin/default/js/advanced.js
Open-ILS/web/opac/skin/default/js/mresult.js
Open-ILS/web/opac/skin/default/js/rresult.js
Open-ILS/web/opac/skin/default/xml/advanced/advanced_refined.xml
Open-ILS/web/opac/skin/default/xml/advanced/advanced_wizard.xml

index ae10506..51d7ab8 100644 (file)
@@ -217,8 +217,9 @@ config.ids.altcanvas = {};
        before the method is called when in XUL mode */
 
 var FETCH_MRIDS_                                       = "open-ils.search:open-ils.search.biblio.metabib.class.search:1";
-var FETCH_MRIDS                                        = "open-ils.search:open-ils.search.biblio.class:1";
-var FETCH_MRIDS_FULL                           = "open-ils.search:open-ils.search.biblio.class.full:1";
+var FETCH_SEARCH_RIDS                  = "open-ils.search:open-ils.search.biblio.record.class.search:1";
+/*var FETCH_MRIDS                                      = "open-ils.search:open-ils.search.biblio.class:1";*/
+/*var FETCH_MRIDS_FULL                         = "open-ils.search:open-ils.search.biblio.class.full:1";*/
 var FETCH_MRMODS                                       = "open-ils.search:open-ils.search.biblio.metarecord.mods_slim.retrieve";
 var FETCH_MODS_FROM_COPY               = "open-ils.search:open-ils.search.biblio.mods_from_copy";
 var FETCH_MR_COPY_COUNTS               = "open-ils.search:open-ils.search.biblio.metarecord.copy_count:1";
index 854af0e..e33384d 100644 (file)
@@ -1,4 +1,4 @@
-<!ENTITY opac.advanced.wizard.title "Advanced Search Wizard">
+<!ENTITY opac.advanced.wizard.title "Advanced Search">
 <!ENTITY opac.advanced.wizard.contains "Selected field contains the following words">
 <!ENTITY opac.advanced.wizard.nocontains "Selected field does <u>not</u> contain the following words">
 <!ENTITY opac.advanced.wizard.exact "Selected field contains the <u>exact</u> phrase">
index 2b05b10..359f1d4 100644 (file)
@@ -2,6 +2,23 @@
 
 attachEvt("common", "run", advInit);
 
+/* tests the cookie rresult stuff 
+
+function advTestCookie() {
+       var ids = [ 
+               40791, 40792, 40793, 40794, 40795, 40797, 40798, 40799, 362178, 362179, 
+               362180, 362170, 338215, 333398, 329010, 17, 362182, 362183, 362184, 362185 ];
+
+       cookieManager.write(COOKIE_RIDS, js2JSON(ids), '+1h');
+       var a = {};
+       a.page = RRESULT;
+       a[PARAM_RTYPE] = RTYPE_COOKIE;
+       goTo(buildOPACLink(a));
+}
+*/
+
+
+
 function advInit() { 
        $('advanced.wizard.contains').focus();
        depthSelInit(); 
@@ -31,13 +48,6 @@ function advInit() {
        setEnterFunc($('opac.advanced.quick.isbn'), advISBNRun );
        setEnterFunc($('opac.advanced.quick.issn'), advISSNRun );
        setEnterFunc( $n( $('advanced.marc.tbody'), 'advanced.marc.value'), advMARCRun );
-
-       /*
-       setSelector($('advanced.wizard.sort_by'), getSort());
-       setSelector($('advanced.wizard.sort_dir'), getSortDir());
-       if(getSort() && getSort() != SORT_TYPE_REL) 
-               $('advanced.wizard.sort_dir').disabled = false;
-               */
 }
 
 
@@ -61,6 +71,11 @@ function advWizardRun() {
        arg[PARAM_SORT]         = sort;
        arg[PARAM_SORT_DIR]     = sortdir;
 
+       if( sort == SORT_TYPE_PUBDATE ) {
+               arg.page = RRESULT;
+               arg[PARAM_RTYPE]        = type;
+       }
+
        goTo(buildOPACLink(arg));
 }
 
index f18d789..cac31b5 100644 (file)
@@ -64,7 +64,7 @@ function _mresultCollectIds() {
 
                var form                = (!getForm() || getForm() == "all") ? null : getForm();
                var sort                = (getSort() == SORT_TYPE_REL) ? null : getSort(); 
-               var sortdir = (sort) ? getSortDir() : null;
+               var sortdir = (sort) ? ((getSortDir()) ? getSortDir() : SORT_DIR_ASC) : null;
 
                var req = new Request(FETCH_MRIDS_, getStype(), 
                        {       term            : getTerm(), 
@@ -88,7 +88,7 @@ function mresultCollectAdvIds() {
 
                var form                = (getForm() == "all") ? null : getForm();
                var sort                = (getSort() == SORT_TYPE_REL) ? null : getSort(); 
-               var sortdir = (sort) ? getSortDir() : null;
+               var sortdir = (sort) ? ((getSortDir()) ? getSortDir() : SORT_DIR_ASC) : null;
 
                var req = new Request(FETCH_ADV_MRIDS, 
                        {       sort            : sort,
index 5856c27..af6187a 100644 (file)
@@ -1,6 +1,7 @@
 var records = new Array();
 var table;
 var rowtemplate;
+var rresultLimit = 200;
 
 function rresultUnload() { removeChildren(table); table = null;}
 
@@ -20,11 +21,20 @@ function rresultDoSearch() {
 function rresultCollectIds() {
        var ids;
        switch(getRtype()) {
+
                case RTYPE_COOKIE:
                        ids = JSON2js(cookieManager.read(COOKIE_RIDS));
                        _rresultHandleIds( ids, ids.length );
                        break;
 
+               case RTYPE_TITLE:
+               case RTYPE_AUTHOR:
+               case RTYPE_SUBJECT:
+               case RTYPE_SERIES:
+               case RTYPE_KEYWORD:
+                       rresultDoRecordSearch();
+                       break;
+
                case RTYPE_MRID :
                defaut:
                        var form = (getForm() == "all") ? null : getForm();
@@ -67,3 +77,34 @@ function rresultHandleMods(r) {
 function rresultLaunchDrawn(id, node) {
        runEvt("rresult", "recordDrawn", id, node);
 }
+
+
+function rresultDoRecordSearch() {
+
+       var form                = (!getForm() || getForm() == "all") ? null : getForm();
+       var sort                = (getSort() == SORT_TYPE_REL) ? null : getSort(); 
+       var sortdir = (sort) ? ((getSortDir()) ? getSortDir() : SORT_DIR_ASC) : null;
+
+       var req = new Request(FETCH_SEARCH_RIDS, getRtype(), 
+               {       term            : getTerm(), 
+                       sort            : sort,
+                       sort_dir        : sortdir,
+                       org_unit : getLocation(),
+                       depth           : getDepth(),
+                       limit           : rresultLimit,
+                       offset  : getOffset(),
+                       format  : form } );
+
+       req.callback(rresultFilterSearchResults);
+       req.send();
+}
+
+function rresultFilterSearchResults(r) {
+       var result = r.getResultObject();
+       var ids = [];
+       for( var i = 0; i != result.ids.length; i++ ) 
+               ids.push(result.ids[i][0]);
+       _rresultHandleIds( ids, result.count );
+}
+
+
index 454eee0..a7d2d71 100644 (file)
@@ -65,7 +65,9 @@
                                        <option value='rel'>Relevance</option>
                                        <option value='title'>Title</option>
                                        <option value='author'>Author</option>
-                                       <option value='pubdate' disabled='disabled'>Publication Date</option>
+                                       <!--
+                                       <option value='pubdate'>Publication Date</option>
+                                       -->
                                </select>
                        </td>
                        <td>
@@ -73,8 +75,8 @@
                        </td>
                        <td>
                                <select id='advanced.refined.sort_dir' disabled='disabled'>
-                                       <option value='asc'>Normal</option>
-                                       <option value='desc'>Reverse</option>
+                                       <option value='asc'>Ascending / A to Z</option>
+                                       <option value='desc'>Descending / Z to A</option>
                                </select>
                        </td>
                </tr>
index 4263081..0967c09 100644 (file)
                                        <option value='rel'>Relevance</option>
                                        <option value='title'>Title</option>
                                        <option value='author'>Author</option>
-                                       <option value='pubdate' disabled='disabled'>Publication Date</option>
-                                       <!--
                                        <option value='pubdate'>Publication Date</option>
-                                       -->
                                </select>
                        </td>
                        <td>
                                <span>Sort Direction </span>
                                <select id='advanced.wizard.sort_dir' disabled='disabled'>
-                                       <option value='asc'>Normal</option>
-                                       <option value='desc'>Reverse</option>
+                                       <option value='asc'>Ascending / A to Z</option>
+                                       <option value='desc'>Descending / Z to A</option>
                                </select>
                        </td>
                </tr>