[Koha-patches] [PATCH] Fix for Bug 4024, Search history template problems, and other fixes.

Owen Leonard oleonard at myacpl.org
Thu Jan 7 15:51:18 CET 2010


- Markup corrections
- Removing TMPL EXPR
- Converting delete link to FORM ("destructive" actions shouldn't be links)
- Adding "search history" link to logged-in user's sidebar menu
---
 koha-tmpl/opac-tmpl/prog/en/css/opac.css           |    5 +--
 koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc  |   12 +++++-
 koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc  |    3 +
 .../prog/en/modules/opac-search-history.tmpl       |   47 +++++++++++++------
 opac/opac-search-history.pl                        |    3 +
 5 files changed, 50 insertions(+), 20 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
index 9e30270..17093e7 100644
--- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css
+++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
@@ -611,15 +611,12 @@ body#advsearch #listsmenulink {
 	text-decoration : none;
 }
 
-#members li:first-child {
-	border-right : 1px solid black;
-}
-
 #members li:last-child {
 	border-right : 0;
 }
 
 #members li {
+	border-right : 1px solid black;
 	display : inline;
 	list-style : none;
 	margin : 0;
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
index 0112166..f3916e6 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
@@ -1,6 +1,16 @@
 <div id="header-wrapper"><div id="members">
   <!-- TMPL_IF NAME="opacuserlogin" -->
-	<ul><!-- TMPL_IF NAME="loggedinusername" --><li><span class="members">Welcome, <a href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername"><!-- TMPL_LOOP NAME="USER_INFO" --><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --><!-- /TMPL_LOOP --></span></a></span></li><!-- TMPL_IF NAME="ShowOpacRecentSearchLink" --><li><a href="/cgi-bin/koha/opac-search-history.pl" title="View your search history">Search history</a> [<a href="/cgi-bin/koha/opac-search-history.pl?action=delete" title="Delete your search history" onclick="javascript:return confirm(_('Are you sure you want to delete your search history?'));">x</a>]</li> <!-- /TMPL_IF --><li><a class="logout" id="logout" href="/cgi-bin/koha/opac-main.pl?logout.x=1">Log Out</a></li><!-- TMPL_ELSE --><li><a href="/cgi-bin/koha/opac-user.pl">Log in to Your Account</a></li><!-- /TMPL_IF -->
+	<ul>
+<!-- TMPL_UNLESS NAME="loggedinusername" -->
+               <li><a href="/cgi-bin/koha/opac-user.pl">Log in to Your Account</a></li><!-- /TMPL_UNLESS -->
+            <!-- TMPL_IF NAME="loggedinusername" -->
+                <li><span class="members">Welcome, <a href="/cgi-bin/koha/opac-user.pl"><span class="loggedinusername"><!-- TMPL_LOOP NAME="USER_INFO" --><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --><!-- /TMPL_LOOP --></span></a></span></li>
+
+            <!-- /TMPL_IF -->
+            <!-- TMPL_IF NAME="ShowOpacRecentSearchLink" -->
+                <li><a href="/cgi-bin/koha/opac-search-history.pl" title="View your search history">Search history</a> [<a class="logout" href="/cgi-bin/koha/opac-search-history.pl?action=delete" title="Delete your search history" onclick="return confirm(_('Are you sure you want to delete your search history?'));">x</a>]</li>
+            <!-- /TMPL_IF -->
+			<!-- TMPL_IF NAME="loggedinusername" --><li><a class="logout" id="logout" href="/cgi-bin/koha/opac-main.pl?logout.x=1">Log Out</a></li><!-- /TMPL_IF -->
    	</ul>	
   <!-- /TMPL_IF -->
 </div>
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc
index 5d1c50f..26bf502 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc
@@ -12,6 +12,9 @@
   <!-- TMPL_IF NAME="OpacPasswordChange" -->
     <!-- TMPL_IF NAME="passwdview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/opac-passwd.pl">change my password</a></li>
   <!-- /TMPL_IF -->
+  <!-- TMPL_IF NAME="ShowOpacRecentSearchLink" -->
+  <!-- TMPL_IF NAME="searchhistoryview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/opac-search-history.pl">my search history</a></li>
+  <!-- /TMPL_IF -->
   <!-- TMPL_IF NAME="opacreadinghistory" -->
   <!-- TMPL_IF NAME="readingrecview" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/opac-readingrecord.pl">my reading history</a></li>
   <!-- /TMPL_IF -->
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tmpl
index 2823501..90fc569 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tmpl
@@ -8,7 +8,8 @@
 		// We show table ordered by descending dates by default
 		// (so that the more recent query is shown first)
 		$.tablesorter.defaults.sortList = [[0,1]]; 
-                $("#historyt").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
+                $(".historyt").tablesorter({
+						widgets : ['zebra'],<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
                         dateFormat: 'uk'<!-- /TMPL_IF -->
                 });
             });
@@ -17,20 +18,27 @@
 </script>
 </head>
 <body>
-<!-- TMPL_IF NAME="OpacNav" --><div id="doc3" class="yui-t1"><!-- TMPL_ELSE --><div id="doc3" class="yui-t7"><!-- /TMPL_IF -->
+<!-- TMPL_IF NAME="OpacNav" -->
+<div id="doc3" class="yui-t1">
+<!-- TMPL_ELSIF NAME="loggedinusername" -->
+<div id="doc3" class="yui-t1">
+<!-- TMPL_ELSE -->
+<div id="doc3" class="yui-t7">
+<!-- /TMPL_IF -->
    <div id="bd">
 <!--TMPL_INCLUDE NAME="masthead.inc" -->
 
 	<div id="yui-main">
 <div class="yui-b"><div class="yui-g">
-        <div class="container">
+        <div id="searchhistory" class="container">
 	<h1>Search history</h1>
-	<!-- TMPL_IF EXPR="recentSearches || previousSearches" -->
+	<!-- TMPL_IF NAME="recentSearches" --><form action="/cgi-bin/koha/opac-search-history.pl" method="get"><input type="hidden" name="action" value="delete" /><input type="submit" class="deleteshelf" value="Delete your search history" onclick="return confirm(_('Are you sure you want to delete your search history?'));" /></form><!-- TMPL_ELSE --><!-- TMPL_IF NAME="previousSearches" --><form action="/cgi-bin/koha/opac-search-history.pl" method="get"><input type="hidden" name="action" value="delete" /><input type="submit" class="deleteshelf" value="Delete your search history" onclick="return confirm(_('Are you sure you want to delete your search history?'));" /></form><!-- /TMPL_IF --><!-- /TMPL_IF -->
+
 	    <!-- TMPL_IF NAME="recentSearches" -->
+	    <table class="historyt">
 	    <!-- TMPL_IF NAME="previousSearches" -->
-	    <h2>Current session</h2>
+	    <caption>Current session</caption>
 	    <!-- /TMPL_IF -->
-	    <table id="historyt">
 		<thead>
 		    <tr><th>Date</th><th>Search</th><th>Results</th></tr>
 		</thead>
@@ -38,7 +46,7 @@
 		    <!-- TMPL_LOOP NAME="recentSearches" -->
 		    <tr>
 			<td><!-- TMPL_VAR NAME="time" --></td>
-			<td><a href="/cgi-bin/koha/opac-search.pl?<!-- TMPL_VAR NAME="query_cgi" -->"><!-- TMPL_VAR NAME="query_desc" --></a></td>
+			<td><a href="/cgi-bin/koha/opac-search.pl?<!-- TMPL_VAR NAME="query_cgi"  -->"><!-- TMPL_VAR NAME="query_desc" --></a></td>
 			<td><!-- TMPL_VAR NAME="total" --></td>
 		    </tr>
 		    <!-- /TMPL_LOOP -->
@@ -47,8 +55,8 @@
 	    <!-- /TMPL_IF -->
 
 	    <!-- TMPL_IF NAME="previousSearches" -->
-	    <h2>Previous sessions</h2>
-	    <table id="historyt">
+	    <table class="historyt">
+	    <caption>Previous sessions</caption>
 		<thead>
 		    <tr><th>Date</th><th>Search</th><th>Results</th></tr>
 		</thead>
@@ -56,25 +64,34 @@
 		    <!-- TMPL_LOOP NAME="previousSearches" -->
 		    <tr>
 			<td><!-- TMPL_VAR NAME="time" --></td>
-			<td><a href="/cgi-bin/koha/opac-search.pl?<!-- TMPL_VAR NAME="query_cgi" -->"><!-- TMPL_VAR NAME="query_desc" --></a></td>
+			<td><a href="/cgi-bin/koha/opac-search.pl?<!-- TMPL_VAR NAME="query_cgi"  -->"><!-- TMPL_VAR NAME="query_desc" --></a></td>
 			<td><!-- TMPL_VAR NAME="total" --></td>
 		    </tr>
 		    <!-- /TMPL_LOOP -->
 		</tbody>
 	    </table>
 	    <!-- /TMPL_IF -->
-	<!-- TMPL_ELSE -->
-	<p>Your search history is now empty.</p> 
-	<!-- /TMPL_IF -->
+
+<!-- TMPL_IF NAME="recentSearches" --><!-- TMPL_ELSE --><!-- TMPL_IF NAME="previousSearches" --><!-- TMPL_ELSE --><p>Your search history is empty.</p><!-- /TMPL_IF --><!-- /TMPL_IF -->
+
      </div>
      </div>
      </div>
      </div>
-<!-- TMPL_IF EXPR="OpacNav||loggedinusername" -->
+
+<!-- TMPL_IF NAME="OpacNav" -->
 <div class="yui-b"><div class="container">
 <!--TMPL_INCLUDE NAME="navigation.inc" -->
 <!--TMPL_INCLUDE NAME="usermenu.inc" -->
-</div></div></div>
+</div></div>
+<!-- TMPL_ELSIF NAME="loggedinusername" -->
+<div class="yui-b"><div class="container">
+<!--TMPL_INCLUDE NAME="navigation.inc" -->
+<!--TMPL_INCLUDE NAME="usermenu.inc" -->
+</div></div>
+<!-- TMPL_ELSE -->
 <!-- /TMPL_IF -->
 
+
+</div>
 <!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
diff --git a/opac/opac-search-history.pl b/opac/opac-search-history.pl
index fdf0701..97db2d5 100755
--- a/opac/opac-search-history.pl
+++ b/opac/opac-search-history.pl
@@ -142,6 +142,9 @@ if ($loggedinuser == '') {
     }
 
 }
+
+$template->param(searchhistoryview => 1);
+
 output_html_with_http_headers $cgi, $cookie, $template->output;
 
 
-- 
1.6.3.3




More information about the Koha-patches mailing list