[Koha-patches] [PATCH] Adding checks for dateformat preference so that tablesorter script can be passed an extra parameter for proper sorting of metric dates (Bug 2089, dates & table ordering with jquery)

Owen Leonard oleonard at myacpl.org
Mon May 12 14:58:00 CEST 2008


---
 circ/circulation.pl                                |    3 ++-
 circ/pendingreserves.pl                            |    1 +
 circ/transferstodo.pl                              |    1 +
 circ/transferstoreceive.pl                         |    1 +
 circ/waitingreserves.pl                            |    1 +
 .../prog/en/modules/circ/circulation.tmpl          |    7 ++++---
 .../prog/en/modules/circ/pendingreserves.tmpl      |    3 ++-
 .../prog/en/modules/circ/transferstodo.tmpl        |    9 ++++++---
 .../prog/en/modules/circ/transferstoreceive.tmpl   |    7 +++++--
 .../prog/en/modules/circ/waitingreserves.tmpl      |    3 ++-
 .../prog/en/modules/members/moremember.tmpl        |    6 ++++--
 .../prog/en/modules/suggestion/acceptorreject.tmpl |    9 ++++++---
 .../prog/en/modules/tools/koha-news.tmpl           |    3 ++-
 koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl |    6 ++++--
 members/moremember.pl                              |    1 +
 opac/opac-topissues.pl                             |    1 +
 opac/opac-user.pl                                  |    1 +
 suggestion/acceptorreject.pl                       |    1 +
 tools/koha-news.pl                                 |    1 +
 19 files changed, 46 insertions(+), 19 deletions(-)

diff --git a/circ/circulation.pl b/circ/circulation.pl
index add047d..5fcdd66 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -704,7 +704,8 @@ $template->param( picture => 1 ) if $picture;
 
 $template->param(
     SpecifyDueDate           => C4::Context->preference("SpecifyDueDate"),
-    CircAutocompl            => C4::Context->preference("CircAutocompl") ,
+    CircAutocompl            => C4::Context->preference("CircAutocompl"),
+	dateformat            => C4::Context->preference("dateformat"),
     DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
 );
 output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl
index 0a6fa2f..0423052 100755
--- a/circ/pendingreserves.pl
+++ b/circ/pendingreserves.pl
@@ -259,6 +259,7 @@ $template->param(
     reserveloop     	=> \@reservedata,
     "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
     DHTMLcalendar_dateformat =>  C4::Dates->DHTMLcalendar(),
+	dateformat    => C4::Context->preference("dateformat"),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/circ/transferstodo.pl b/circ/transferstodo.pl
index 340dc34..1837e33 100755
--- a/circ/transferstodo.pl
+++ b/circ/transferstodo.pl
@@ -129,6 +129,7 @@ foreach my $br ( keys %$branches ) {
 $template->param(
     branchesloop => \@branchesloop,
     show_date    => format_date(C4::Dates->today('iso')),
+	dateformat    => C4::Context->preference("dateformat"),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl
index 0917292..f148dd5 100755
--- a/circ/transferstoreceive.pl
+++ b/circ/transferstoreceive.pl
@@ -125,6 +125,7 @@ foreach my $br ( keys %$branches ) {
 $template->param(
     branchesloop => \@branchesloop,
     show_date    => format_date(C4::Dates->today('iso')),
+	dateformat    => C4::Context->preference("dateformat"),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl
index 574edca..01b4df0 100755
--- a/circ/waitingreserves.pl
+++ b/circ/waitingreserves.pl
@@ -159,6 +159,7 @@ foreach my $num (@getreserves) {
 $template->param(
     reserveloop => \@reservloop,
     show_date   => format_date(C4::Dates->today('iso')),
+	dateformat   => C4::Context->preference("dateformat"),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
index 219166b..0f3dee9 100755
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
@@ -17,14 +17,15 @@ $.tablesorter.addParser({
 	 $(document).ready(function() {
  		$('#patronlists > ul').tabs();
 		$.tablesorter.defaults.widgets = ['zebra']; 
-		$("#issuest").tablesorter({
-//		sortList: [[0,0]], don't sort by default to preserve 'previous checkouts' header
+		$("#issuest").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 		headers: { 1: { sorter: 'articles' },4:{sorter:false},5: { sorter: false },6:{sorter:false}}
 		});
 		$("#issuest").bind("sortEnd",function() {
         	$("#previous").parents("tr").remove();  // 'previous checkouts' header chokes table sorter
 	    }); 
-		$("#holdst").tablesorter({
+		$("#holdst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 			sortList: [[0,0]],
 			headers: { 1: { sorter: 'articles' }}
 		}); 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tmpl
index 74cba1c..7fd76b2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tmpl
@@ -20,7 +20,8 @@ $.tablesorter.addParser({
 	 $(document).ready(function() {
 	 	$("th a").hide();
 		$.tablesorter.defaults.widgets = ['zebra'];
-		$("#holdst").tablesorter({
+		$("#holdst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 			sortList: [[3,0]],
 			headers: { 0:{sorter:false},1:{sorter:false},3: { sorter: 'articles' },7:{sorter:false}}
 		}); 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstodo.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstodo.tmpl
index 3b25d5a..64333b1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstodo.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstodo.tmpl
@@ -11,11 +11,14 @@ $.tablesorter.addParser({
     type: 'text' 
 });
 	 $(document).ready(function() {
+	 <!-- TMPL_LOOP NAME="branchesloop" -->
 		$.tablesorter.defaults.widgets = ['zebra']; 
-		$("#transferst").tablesorter({
+		$("#transferst<!-- TMPL_VAR NAME="branchcode" -->").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 			sortList: [[1,0]],
 			headers: { 1: { sorter: 'articles' },4:{sorter:false}}
 		}); 
+	<!-- /TMPL_LOOP -->
 	 });
 //]]>
 </script>
@@ -39,7 +42,7 @@ $.tablesorter.addParser({
         <!-- TMPL_LOOP NAME="branchesloop" -->
             <!-- TMPL_IF NAME="branchcode" -->
 			<h4>Holds waiting for: <!-- TMPL_VAR NAME="branchname" --></h4>
-            <table id="transferst">
+            <table id="transferst<!-- TMPL_VAR NAME="branchcode" -->" style="width:100%;">
             <thead><tr>
                 <th>Date of hold</th>
                 <th>Title</th>
@@ -56,7 +59,7 @@ $.tablesorter.addParser({
 <a href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --></a>
 <!-- TMPL_ELSE -->
 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" -->  <!-- TMPL_VAR NAME="subtitle" --></a><!-- /TMPL_IF -->&nbsp; (<b><!-- TMPL_VAR NAME="itemtype" --> </b>) <br />Barcode : <!-- TMPL_VAR NAME="barcode" --></td>
-                    <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!--TMPL_VAR Name="borrowernum"-->"><!-- TMPL_VAR NAME="borrowername" --> &nbsp; <!-- TMPL_VAR NAME="borrowerfirstname" --></a><br />
+                    <td><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!--TMPL_VAR Name="borrowernum"-->"><!-- TMPL_VAR NAME="borrowername" -->, <!-- TMPL_VAR NAME="borrowerfirstname" --></a><br />
                             <!-- TMPL_VAR NAME="borrowerphone" --><br />
                             <!-- TMPL_IF NAME="borrowermail" -->
                                 <a href="mailto:<!-- TMPL_VAR NAME="email" -->?subject=Reservation: <!-- TMPL_VAR NAME="title" -->">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tmpl
index 063e365..0a19f99 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/transferstoreceive.tmpl
@@ -11,11 +11,14 @@ $.tablesorter.addParser({
     type: 'text' 
 });
 	 $(document).ready(function() {
+            <!-- TMPL_LOOP NAME="branchesloop" -->
 		$.tablesorter.defaults.widgets = ['zebra']; 
-		$("#transferst").tablesorter({
+		$("#transferst<!-- TMPL_VAR NAME="branchcode" -->").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 			sortList: [[1,0]],
 			headers: { 1: { sorter: 'articles' },4:{sorter:false}}
 		}); 
+		<!-- /TMPL_LOOP -->
 	 });
 //]]>
 </script>
@@ -39,7 +42,7 @@ $.tablesorter.addParser({
             <div id="resultlist">
             <!-- TMPL_LOOP NAME="branchesloop" -->
                 <!-- TMPL_IF NAME="branchcode" -->
-                <table style="width: 100%" id="transferst">
+                <table style="width: 100%" id="transferst<!-- TMPL_VAR NAME="branchcode" -->">
 				<caption>Coming from <!-- TMPL_VAR NAME="branchname" --></caption>
                 <thead><tr>
                     <th>Date of transfer</th>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tmpl
index 2b91306..ee7194c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tmpl
@@ -13,7 +13,8 @@ $.tablesorter.addParser({
 	 $(document).ready(function() {
 	 	$("th a").hide();
 		$.tablesorter.defaults.widgets = ['zebra'];
-		$("#holdst").tablesorter({
+		$("#holdst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 			sortList: [[3,0]],
 			headers: { 1:{sorter:'articles'},3: { sorter: 'articles' },4:{sorter:false}}
 		}); 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
index e284f65..bb7ae27 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
@@ -14,11 +14,13 @@ $.tablesorter.addParser({
 });
 $(document).ready(function() {
 	$('#finesholdsissues > ul').tabs();
-	$("#issuest").tablesorter({
+	$("#issuest").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 		sortList: [[1,0]],
 		headers: { 1: { sorter: 'articles' },4:{sorter:false},5: { sorter: false },6:{sorter:false},7:{sorter:false}}
 	}); 
-	$("#holdst").tablesorter({
+	$("#holdst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 		sortList: [[0,0]],
 		headers: { 1: { sorter: 'articles' },6: { sorter: false }}
 	}); 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl
index f749034..df9ab5f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/acceptorreject.tmpl
@@ -25,7 +25,8 @@
 		    }
 		});
 		$.tablesorter.defaults.widgets = ['zebra'];
-		$("#acceptedt").tablesorter({
+		$("#acceptedt").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 			headers: { 0: { sorter: 'articles' },3:{sorter: false},4:{sorter: false},5:{sorter: false},6:{sorter: false},7:{sorter: false}}
 		});
 		$("#acceptedt").bind("sortStart",function() {
@@ -33,7 +34,8 @@
 		}).bind("sortEnd",function() {
 			$("#sorting").hide();
 		});
-		$("#pendingt").tablesorter({
+		$("#pendingt").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 	    headers: { 0: { sorter: 'articles' },3:{sorter: false},4:{sorter: false},5:{sorter: false},6:{sorter: false},7:{sorter: false}}
 		});
 		$("#pendingt").bind("sortStart",function() {
@@ -41,7 +43,8 @@
 		}).bind("sortEnd",function() {
 			$("#sorting").hide();
 		});
-		$("#rejectedt").tablesorter({
+		$("#rejectedt").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 	    headers: { 0: { sorter: 'articles' },3:{sorter: false},4:{sorter: false},5:{sorter: false},6:{sorter: false},7:{sorter: false}}
 		});
 		$("#rejectedt").bind("sortStart",function() {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tmpl
index 7560f5c..3d9af53 100755
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/koha-news.tmpl
@@ -5,7 +5,8 @@
 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.pack.js"></script>
 <script type="text/javascript">//<![CDATA[
 $(document).ready(function() {
-	$("#newst").tablesorter({
+	$("#newst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 		sortList: [[2,0]],
 		headers: { 0: {sorter:false},6: { sorter: false },7: { sorter: false }}
 	}); 
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
index 114b768..506f948 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
@@ -15,13 +15,15 @@ $.tablesorter.addParser({
 });
             $(function() {
             $('#opac-user-views > ul').tabs();
-			$("#holdst").tablesorter({
+			$("#holdst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 				widgets : ['zebra'],
 				sortList: [[0,0]],
 		        headers: { 0: { sorter: 'articles' },4: { sorter: false }
 				}
 			}); 
-			$("#checkoutst").tablesorter({
+			$("#checkoutst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+		dateFormat: 'uk',<!-- /TMPL_IF -->
 				widgets : ['zebra'],
 				<!-- TMPL_IF NAME="AmazonContent" -->
 				sortList: [[3,0]],
diff --git a/members/moremember.pl b/members/moremember.pl
index 22a56ef..244a5ce 100755
--- a/members/moremember.pl
+++ b/members/moremember.pl
@@ -352,6 +352,7 @@ $template->param(
     StaffMember		=> ($category_type eq 'S'),
 	is_child        => ($category_type eq 'C'),
 	# 		 reserveloop     => \@reservedata,
+	dateformat    => C4::Context->preference("dateformat"),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/opac/opac-topissues.pl b/opac/opac-topissues.pl
index f47c138..3371d1d 100755
--- a/opac/opac-topissues.pl
+++ b/opac/opac-topissues.pl
@@ -120,6 +120,7 @@ foreach my $thisitemtype (keys %$itemtypes) {
 
 $template->param(
                  itemtypeloop =>\@itemtypeloop,
+                 dateformat    => C4::Context->preference("dateformat"),
                 );
 output_html_with_http_headers $input, $cookie, $template->output;
 
diff --git a/opac/opac-user.pl b/opac/opac-user.pl
index 1e1bb93..f9aeb0c 100755
--- a/opac/opac-user.pl
+++ b/opac/opac-user.pl
@@ -225,6 +225,7 @@ $template->param(
 	patronupdate => $patronupdate,
 	OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"),
 	userview => 1,
+	dateformat    => C4::Context->preference("dateformat"),
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/suggestion/acceptorreject.pl b/suggestion/acceptorreject.pl
index c1c7dd5..3fed003 100755
--- a/suggestion/acceptorreject.pl
+++ b/suggestion/acceptorreject.pl
@@ -174,6 +174,7 @@ push @allsuggestions,{"suggestiontype"=>"rejected",
 $template->param(
     suggestions       => \@allsuggestions,
     "op_$op"                => 1,
+    dateformat    => C4::Context->preference("dateformat"),
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/tools/koha-news.pl b/tools/koha-news.pl
index 5da0926..3730c10 100755
--- a/tools/koha-news.pl
+++ b/tools/koha-news.pl
@@ -117,5 +117,6 @@ else {
 }
 $template->param(
 				DHTMLcalendar_dateformat =>  C4::Dates->DHTMLcalendar(),
+				dateformat    => C4::Context->preference("dateformat"),
 		);
 output_html_with_http_headers $cgi, $cookie, $template->output;
-- 
1.5.2.1




More information about the Koha-patches mailing list