[Koha-patches] [PATCH] IE bugs 3124 and 3115: z3950 search and guided_reports

Joe Atzberger joe.atzberger at liblime.com
Wed Apr 22 20:24:34 CEST 2009


Clip trailing comma in js list argument.

Column selection improved with jquery and submit time check.
---
 .../prog/en/modules/cataloguing/z3950_search.tmpl  |   22 ++++++------
 .../en/modules/reports/guided_reports_start.tmpl   |   34 +++++++-------------
 2 files changed, 23 insertions(+), 33 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tmpl
index 4c5c5c4..21d5fda 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tmpl
@@ -6,11 +6,11 @@
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
 <script type="text/javascript">
 //<![CDATA[
-    function Import(GetThisOne,biblionumber) {
-        opener.document.location="../cataloguing/addbiblio.pl?biblionumber="+biblionumber+"&z3950=1&frameworkcode=<!-- TMPL_VAR name="frameworkcode" -->&breedingid="+GetThisOne;
-        window.close();
-        return false;
-    }
+function Import(GetThisOne,biblionumber) {
+    opener.document.location="../cataloguing/addbiblio.pl?biblionumber="+biblionumber+"&z3950=1&frameworkcode=<!-- TMPL_VAR name="frameworkcode" -->&breedingid="+GetThisOne;
+    window.close();
+    return false;
+}
 $.tablesorter.addParser({
     id: 'articles', 
     is: function(s) {return false;  }, 
@@ -18,7 +18,7 @@ $.tablesorter.addParser({
     type: 'text' 
 });
 
-	$(document).ready(function(){
+$(document).ready(function(){
     $("#CheckAll").click(function(){
         $(".checkboxed").checkCheckboxes();
         return false;
@@ -27,11 +27,11 @@ $.tablesorter.addParser({
         $(".checkboxed").unCheckCheckboxes();
         return false;
     });
-	$("#resultst").tablesorter({
-		sortList: [[1,0]],
-		headers: { 0: {sorter:false}, 1: { sorter: 'articles' },5: { sorter: false },6: { sorter: false } },
-        widgets: ['zebra'],
-	}); 
+    $("#resultst").tablesorter({
+        sortList: [[1,0]],
+        headers: { 0: {sorter:false}, 1: { sorter: 'articles' },5: { sorter: false },6: { sorter: false } },
+        widgets: ['zebra']
+    }); 
 });
 //]]>
 </script>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl
index 3714867..67dc404 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tmpl
@@ -174,7 +174,7 @@ canned reports and writing custom SQL reports.</p>
 <h3>Step 3 of 6: Select Columns for Display</h3>
 <p>Note: Be careful selecting when selecting columns. If your choice is too broad it could result in a very large report that will either not complete, or slow your system down.</p>
 
-<form action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
+<form id="column_submit" action="/cgi-bin/koha/reports/guided_reports.pl" method="post">
 	<input type="hidden" name="area" value="<!-- TMPL_VAR NAME="area" -->" />
 	<input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
 	<fieldset>
@@ -205,7 +205,7 @@ canned reports and writing custom SQL reports.</p>
 </div>
 
 <div class="yui-u">
-<select id="selectedColumns" name="columns" multiple="multiple" size="25" style="min-width:200px;height:300px;"></select>
+<select id="selectedColumns" name="columns" multiple="multiple" size="25" style="width:200px; height:300px;"></select>
 </div>
 </div>
 </fieldset>
@@ -513,30 +513,20 @@ Sub report:<select name="subreport">
 </div>
 <script type="text/javascript">
 //<![CDATA[
-function setObjects() {
-	selectedColumnsObj=document.getElementById('selectedColumns');
-	availableColumnsObj=document.getElementById('availableColumns');
-}
-setObjects();
-
 function addColumn() {
-	for (i=0;i<availableColumnsObj.length;i++) {
-		if (availableColumnsObj.options[i].selected==true) {
-			var newColumnObj=document.createElement("OPTION");
-			newColumnObj.value=availableColumnsObj.options[i].value;
-			newColumnObj.text=availableColumnsObj.options[i].text;
-			selectedColumnsObj.appendChild(newColumnObj);
-			newColumnObj.selected=true;
-		}
-	}
+    $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected");
 }
-
 function delColumn() {
-	for (i=0;i<=selectedColumnsObj.options.length;i++) {
-		if (selectedColumnsObj.options.selectedIndex>=0)
-		selectedColumnsObj.remove(selectedColumnsObj.options.selectedIndex)
-	}
+    $("#selectedColumns option:selected").remove();
 }
+$("#column_submit").submit(function() {
+    if ($("#selectedColumns option").size() < 1) {
+        alert(_("No columns selected!"));
+        return false;
+    }
+    $("#selectedColumns option").attr("selected", "selected");  // Select everything still in #selectedColumns
+    return true;
+});
 //]]>
 </script>
 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
-- 
1.5.6.5




More information about the Koha-patches mailing list