KMAIN-1619 Advanced Sort Relevance Bug
authorDan Reuther <dreuther@catalystitservices.com>
Fri, 6 Mar 2015 00:12:18 +0000 (19:12 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Added a storage string to window.name, which allows the sort result
filter to persist across multiple advanced queries in the same tab

cross port of 2482783

Signed-off-by: Dan Reuther <dreuther@catalystitservices.com>
modified:   KCLS/openils/var/templates_kcls/opac/parts/advanced/search.tt2
modified:   KCLS/openils/var/templates_kcls/opac/parts/filtersort.tt2
modified:   Open-ILS/web/js/ui/default/opac/simple.js

KCLS/openils/var/templates_kcls/opac/parts/advanced/search.tt2
KCLS/openils/var/templates_kcls/opac/parts/filtersort.tt2
Open-ILS/web/js/ui/default/opac/simple.js

index 374a509..fd93a5e 100644 (file)
     var pubdateSel = $("adv_global_pub_date_type");
     var orgSel = document.getElementById("org_selector");
     var sortBySel = document.getElementById("opac.result.sort");
+    
+       /*Part of a hack to keep the Sort Results order selector persistent across multiple searches in single tab 
+                see filtersort.tt2 and simple.js*/
+    if (window.name != "browser_browser") {
+               (document.getElementById("opac.result.sort")).selectedIndex = window.name;
+       }
+       
     var resultViewSel = document.getElementById("resultViewSel");
     var modCheck = document.getElementById("opac.result.limit2avail");
     var templateSel = document.getElementById("templateList");
index e87dbd2..72072ca 100644 (file)
@@ -1,4 +1,6 @@
-<select class="results_header_sel" id='opac.result.sort' name="sort"
+       <!-- Onchange below is part of a hack to keep the Sort Results order selector persistent across multiple searches in single tab 
+                see templates_kcls/opac/parts/search.tt2 and simple.js-->
+<select class="results_header_sel" id='opac.result.sort' name="sort" onchange="setPersistentSort();"
     [% IF submit_on_change %]onchange='this.form.submit()'[% END %]>
     <option value=''>[% l("Sort by Relevance") %]</option>
     <optgroup label='[% l("Sort by Title") %]'>
index c113814..aa72263 100644 (file)
@@ -119,3 +119,11 @@ function exclude_onchange(checkbox) {
 
     checkbox.form.submit();
 }
+
+// Dirty hack to keep the Sort Results order selector persistent in 
+// multiple searches in same tab (see 
+// openils/var/templates_kcls/opac/parts/advanced.tt2)
+function setPersistentSort() {
+           window.name = (document.getElementById("opac.result.sort")).selectedIndex;
+}
+