[open-ils-commits] r8044 - in trunk/Open-ILS/web/opac: common/js locale/en-US skin/default/css skin/default/js skin/default/xml/common skin/default/xml/result

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Nov 8 10:53:18 EST 2007


Author: erickson
Date: 2007-11-08 10:37:27 -0500 (Thu, 08 Nov 2007)
New Revision: 8044

Added:
   trunk/Open-ILS/web/opac/skin/default/xml/result/filtersort.xml
Modified:
   trunk/Open-ILS/web/opac/common/js/config.js
   trunk/Open-ILS/web/opac/common/js/opac_utils.js
   trunk/Open-ILS/web/opac/locale/en-US/opac.dtd
   trunk/Open-ILS/web/opac/skin/default/css/layout.css
   trunk/Open-ILS/web/opac/skin/default/js/result_common.js
   trunk/Open-ILS/web/opac/skin/default/js/rresult.js
   trunk/Open-ILS/web/opac/skin/default/js/search_bar.js
   trunk/Open-ILS/web/opac/skin/default/xml/common/statusbar.xml
Log:


Committing initial limit-to-available and sort options on record result page
Also, cleaned up some old code and did some tab cleanup

TODO:
    Automatically re-fire search when limit or sort options are changed
    Add relevance as a sort option
    Add limit to advanced search
    Make limit and sort sticky on advanced search
    Evaluate dropdown labels - i.e. What is clearest to the user in the smallest amount of space?



Modified: trunk/Open-ILS/web/opac/common/js/config.js
===================================================================
--- trunk/Open-ILS/web/opac/common/js/config.js	2007-11-08 15:35:41 UTC (rev 8043)
+++ trunk/Open-ILS/web/opac/common/js/config.js	2007-11-08 15:37:27 UTC (rev 8044)
@@ -35,6 +35,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 */
 
 /* URL param values (see comments above) */
 var TERM;  
@@ -67,6 +68,7 @@
 var LANGUAGE;
 var TFORM;
 var RDEPTH;
+var AVAIL;
 
 /* cookie values */
 var SBEXTRAS; 

Modified: trunk/Open-ILS/web/opac/common/js/opac_utils.js
===================================================================
--- trunk/Open-ILS/web/opac/common/js/opac_utils.js	2007-11-08 15:35:41 UTC (rev 8043)
+++ trunk/Open-ILS/web/opac/common/js/opac_utils.js	2007-11-08 15:37:27 UTC (rev 8044)
@@ -153,42 +153,45 @@
 	LANGUAGE	= cgi.param(PARAM_LANGUAGE);
 	TFORM		= cgi.param(PARAM_TFORM);
 	RDEPTH	= cgi.param(PARAM_RDEPTH);
+    AVAIL   = cgi.param(PARAM_AVAIL);
 
 	/* set up some sane defaults */
-	//if(isNaN(DEPTH))		DEPTH		= 0;
-	if(isNaN(RDEPTH))		RDEPTH	= 0;
-	if(isNaN(OFFSET))		OFFSET	= 0;
-	if(isNaN(COUNT))		COUNT		= 10;
+	//if(isNaN(DEPTH))	DEPTH		= 0;
+	if(isNaN(RDEPTH))	RDEPTH	= 0;
+	if(isNaN(OFFSET))	OFFSET	= 0;
+	if(isNaN(COUNT))	COUNT		= 10;
 	if(isNaN(HITCOUNT))	HITCOUNT	= 0;
 	if(isNaN(MRID))		MRID		= 0;
-	if(isNaN(RID))			RID		= 0;
+	if(isNaN(RID))		RID		= 0;
 	if(isNaN(ORIGLOC))	ORIGLOC	= 0; /* so we know it hasn't been set */
 	if(isNaN(AUTHTIME))	AUTHTIME	= 0;
-	if(ADVTERM==null)		ADVTERM	= "";
+	if(ADVTERM==null)	ADVTERM	= "";
+    if(isNaN(AVAIL))    AVAIL = 0;
 }
 
 function clearSearchParams() {
-	TERM		= null;
-	STYPE		= null;
-	FORM		= null;
-	OFFSET	= 0;
-	HITCOUNT = 0;  
-	ADVTERM  = null;
-	ADVTYPE  = null;
-	MRID		= null;
-	RID		= null;
-	RTYPE		= null;
-	SORT		= null;
-	SORT_DIR = null;
-	RLIST		= null;
-	CALLNUM	= null;
-	LITFORM	= null;
-	ITEMFORM = null;
-	ITEMTYPE = null;
-	AUDIENCE = null;
-	SEARCHES = null;
-	LANGUAGE = null;
-	RDEPTH	= null;
+	TERM        = null;
+	STYPE       = null;
+	FORM        = null;
+	OFFSET      = 0;
+	HITCOUNT    = 0;  
+	ADVTERM     = null;
+	ADVTYPE     = null;
+	MRID        = null;
+	RID         = null;
+	RTYPE       = null;
+	SORT        = null;
+	SORT_DIR    = null;
+	RLIST       = null;
+	CALLNUM	    = null;
+	LITFORM	    = null;
+	ITEMFORM    = null;
+	ITEMTYPE    = null;
+	AUDIENCE    = null;
+	SEARCHES    = null;
+	LANGUAGE    = null;
+	RDEPTH      = null;
+    AVAIL       = null;
 }
 
 
@@ -231,6 +234,7 @@
 function getSearches() { return SEARCHES; }
 function getLanguage() { return LANGUAGE; }
 function getRdepth() { return RDEPTH; }
+function getAvail() { return AVAIL; }
 
 
 function findBasePath() {
@@ -377,6 +381,8 @@
 		string += _appendParam(SORT,	PARAM_SORT, args, getSort, string);
 	if(getSortDir() != null)
 		string += _appendParam(SORT_DIR,	PARAM_SORT_DIR, args, getSortDir, string);
+	if(getAvail())
+		string += _appendParam(AVAIL, PARAM_AVAIL, args, getAvail, string);
 
 	return string.replace(/\&$/,'').replace(/\?\&/,"?");	
 }

Modified: trunk/Open-ILS/web/opac/locale/en-US/opac.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/opac.dtd	2007-11-08 15:35:41 UTC (rev 8043)
+++ trunk/Open-ILS/web/opac/locale/en-US/opac.dtd	2007-11-08 15:37:27 UTC (rev 8044)
@@ -59,6 +59,10 @@
 	"The password must be at least 7 characters in length, 
 	contain at least one letter (a-z/A-Z), 
 	and contain at least one number.">
+<!ENTITY common.a2z "A to Z">
+<!ENTITY common.z2a "Z to A">
+<!ENTITY common.new2old "Newest to Oldest">
+<!ENTITY common.old2new "Oldest to Newest">
 
 <!ENTITY opac.style.reddish "Reddish">
 
@@ -523,6 +527,8 @@
 <!ENTITY rdetail.noneAvailable " * There are no copies in this location">
 <!ENTITY rdetail.summary.online "Online Resources">
 
+<!ENTITY result.sort_by "Sort Results by ...">
+<!ENTITY result.limit2avail "Limit to Available">
 <!ENTITY result.info.copies "Available copies / Total copies">
 <!ENTITY result.info.no.items "No items with the selected format were found in this location.">
 <!ENTITY result.info.format.items "Listed below are all items in the catalog with the chosen format.">

Modified: trunk/Open-ILS/web/opac/skin/default/css/layout.css
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/css/layout.css	2007-11-08 15:35:41 UTC (rev 8043)
+++ trunk/Open-ILS/web/opac/skin/default/css/layout.css	2007-11-08 15:37:27 UTC (rev 8044)
@@ -241,4 +241,6 @@
     margin: auto;
 }
 
+#opac.result.sort { margin-left: 5px; }
 
+

Modified: trunk/Open-ILS/web/opac/skin/default/js/result_common.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/result_common.js	2007-11-08 15:35:41 UTC (rev 8043)
+++ trunk/Open-ILS/web/opac/skin/default/js/result_common.js	2007-11-08 15:37:27 UTC (rev 8044)
@@ -78,6 +78,7 @@
 	if(sortdir) args.sort_dir = sortdir;
 	if(item_type) args.item_type	= item_type;
 	if(item_form) args.item_form	= item_form;
+    if(getAvail()) args.available = 1;
 
 
 	if(getAudience()) args.audience  = getAudience().split(/,/);

Modified: trunk/Open-ILS/web/opac/skin/default/js/rresult.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/rresult.js	2007-11-08 15:35:41 UTC (rev 8043)
+++ trunk/Open-ILS/web/opac/skin/default/js/rresult.js	2007-11-08 15:37:27 UTC (rev 8044)
@@ -27,35 +27,9 @@
 	rresultCollectIds();
 }
 
-function rresultCachedSearch() {
-
-	/* XXX */
-	return false;
-
-	/*
-	if(!getOffset()) {
-		cookieManager.remove(COOKIE_SRIDS);
-		return false;
-	}
-
-	var data = JSON2js(cookieManager.read(COOKIE_SRIDS));
-	//alert('cached count = ' + data.count);
-
-	if( data && data.ids[getOffset()] != null && 
-		data.ids[resultFinalPageIndex()] != null ) {
-		_rresultHandleIds( data.ids, data.count );
-		return true;
-	}
-
-	return false;
-	*/
-}
-
 function rresultCollectIds() {
 	var ids;
 
-	if(rresultCachedSearch()) return;
-
 	switch(getRtype()) {
 
 		case RTYPE_COOKIE:

Modified: trunk/Open-ILS/web/opac/skin/default/js/search_bar.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/search_bar.js	2007-11-08 15:35:41 UTC (rev 8043)
+++ trunk/Open-ILS/web/opac/skin/default/js/search_bar.js	2007-11-08 15:37:27 UTC (rev 8044)
@@ -41,6 +41,12 @@
 		attachEvt('common','depthChanged', searchBarSubmit);
 	}
 
+    if( (limit = $('opac.result.limit2avail')) ) {
+        if(getAvail()) limit.checked = true;
+        s = getSort()+'.'+getSortDir();
+        if(s.length > 1)
+            setSelector($('opac.result.filters'), s);
+    }
 }
 
 function searchBarSubmit() {
@@ -53,8 +59,6 @@
 	var d	= (newSearchDepth != null) ?  newSearchDepth : depthSelGetDepth();
 	if(isNaN(d)) d = 0;
 
-	//text = text.replace(/'/,'');
-
 	var args = {};
 
 	if(SHOW_MR_DEFAULT) {
@@ -70,6 +74,14 @@
 	args[PARAM_DEPTH]		= d;
 	args[PARAM_FORM]		= _fs.options[_fs.selectedIndex].value;
 
+    if($('opac.result.limit2avail')) {
+        args[PARAM_AVAIL] = ($('opac.result.limit2avail').checked) ? 1 : '';
+        if( (val = getSelectorVal($('opac.result.filters'))) ) {
+            args[PARAM_SORT] = val.split('.')[0]
+            args[PARAM_SORT_DIR] = val.split('.')[1]
+        }
+    }
+
 	goTo(buildOPACLink(args));
 }
 

Modified: trunk/Open-ILS/web/opac/skin/default/xml/common/statusbar.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/common/statusbar.xml	2007-11-08 15:35:41 UTC (rev 8043)
+++ trunk/Open-ILS/web/opac/skin/default/xml/common/statusbar.xml	2007-11-08 15:37:27 UTC (rev 8044)
@@ -12,6 +12,11 @@
 						<span>&status.results;</span> <b id='including_results_location'> </b>
 					</i>
 				</td>
+                <td align='right'>
+                    <!--#if expr="$OILS_PAGE='rresult.xml'"-->
+                    <!--#include virtual="../result/filtersort.xml" -->
+                    <!--#endif -->
+                </td>
 			</tr>
 		</tbody>
 	</table>

Added: trunk/Open-ILS/web/opac/skin/default/xml/result/filtersort.xml
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/xml/result/filtersort.xml	                        (rev 0)
+++ trunk/Open-ILS/web/opac/skin/default/xml/result/filtersort.xml	2007-11-08 15:37:27 UTC (rev 8044)
@@ -0,0 +1,20 @@
+<span>
+    &result.limit2avail;<input type='checkbox' id='opac.result.limit2avail'/>
+    <select id='opac.result.sort'>
+        <option selelted='selected' value=''>&result.sort_by;</option>
+        <optgroup label='&common.title;'>
+            <option id='opac.result.title.a2z' label='&common.a2z;' value='title.asc'>&common.a2z;</option>
+            <option id='opac.result.title.z2a' label='&common.z2a;' value='title.desc'>&common.z2a;</option>
+        </optgroup>
+        <optgroup label='&common.author;'>
+            <option id='opac.result.author.a2z' label='&common.a2z;' value='author.asc'>&common.a2z;</option>
+            <option id='opac.result.author.z2a' label='&common.z2a;' value='author.desc'>&common.z2a;</option>
+        </optgroup>
+        <optgroup label='&common.pubdate;'>
+            <option id='opac.result.pubdate.new2old' label='&common.new2old;' 
+                value='pubdate.desc'>&common.new2old;</option>
+            <option id='opac.result.pubdate.old2new' label='&common.old2new;' 
+                value='pubdate.asc'>&common.old2new;</option>
+        </optgroup>
+    </select>
+</span>



More information about the open-ils-commits mailing list