More js-based table sorting

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Owen Leonard 2008-03-17 15:07:14 -05:00 committed by Joshua Ferraro
parent 2d3b85e4fe
commit 90ccab18a4
5 changed files with 103 additions and 59 deletions

View file

@ -237,7 +237,8 @@ td,th {
th {
background-color:#EFF1DC;
font-weight : bold;
padding : 2px 4px;
padding : 2px 23px;
text-align : center;
}
th.sum {
@ -253,12 +254,16 @@ th[scope=row] {
text-align : right;
}
tr.highlight td, tr.highlight th {
tr.highlight td, tr.highlight th, tr.odd td {
background-color : #F3F3F3;
border : 1px solid #DDDDDD;
border-right : 1px solid #DDDDDD;
}
tr.even td, tr.even.highlight td {
background-color: #FFF;
}
tr.grouplabel td {
background-color : #E8E8E8;
border : 1px solid #DDDDDD;
@ -267,6 +272,18 @@ tr.grouplabel td {
font-weight : bold;
padding: 10px;
}
.header {
background-image:url("../../images/ascdesc.gif");
background-position:right center;
background-repeat:no-repeat;
cursor:pointer;
}
.headerSortUp {
background-image:url("../../images/asc.gif");
}
.headerSortDown {
background-image:url("../../images/desc.gif");
}
ul {
list-style : disc;

View file

@ -184,6 +184,8 @@
<ul>
<li><a href="http://worldcat.org/search?q=<!-- TMPL_VAR NAME="title" ESCAPE="url" -->">Other Libraries (WorldCat)</a></li>
<li><a href="http://www.scholar.google.com/scholar?q=<!-- TMPL_VAR NAME="title" ESCAPE="url" -->">Other Databases (Google Scholar)</a></li>
<li><a href="http://www.bookfinder.com/search/?author=<!-- TMPL_VAR NAME="author" -->&title=<!-- TMPL_VAR NAME="title" -->&st=xl&ac=qr">Online Stores (Bookfinder.com)</a></li>
<li><a href="http://search.ebscohost.com/Login.aspx?authtype=ip,uid&amp;site=novelist-live&amp;direct=true&amp;bquery=TI+<!-- TMPL_VAR NAME="title" -->+and+AU+<!-- TMPL_VAR NAME="author" -->&amp;scope=site">Novelist</a></li>
</ul>
</div>

View file

@ -1,4 +1,35 @@
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha Online<!-- /TMPL_IF --> Catalog &rsaquo; <!-- TMPL_IF NAME="viewshelf" -->Contents of <!-- TMPL_VAR NAME="shelfname" --><!-- TMPL_ELSE -->My Lists<!-- /TMPL_IF --><!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.checkboxes.pack.js"></script>
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.pack.js"></script>
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
$.tablesorter.addParser({
id: 'articles',
is: function(s) {return false; },
format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
type: 'text'
});
$(function() {
$("span.clearall").html("<a id=\"CheckNone\" href=\"#\">Clear All</a>");
$("span.checkall").html("<a id=\"CheckAll\" href=\"#\">Select All</a>");
$("#listcontents").tablesorter({
widgets : ['zebra'],
<!-- TMPL_IF NAME="manageshelf" -->sortList: [[2,0]],<!-- TMPL_ELSE -->sortList: [[1,0]],<!-- /TMPL_IF -->
headers: { 0: { sorter: false },<!-- TMPL_IF NAME="manageshelf" -->1: { sorter: false },2: { sorter: 'articles' }<!-- TMPL_ELSE -->1:{sorter: 'articles' }<!-- /TMPL_IF -->
}
});
$("#CheckAll").click(function(){
$(".checkboxed").checkCheckboxes();
return false;
});
$("#CheckNone").click(function(){
$(".checkboxed").unCheckCheckboxes();
return false;
});
});
//]]>
</script>
</head>
<body>
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
@ -49,18 +80,19 @@
<!-- TMPL_IF NAME="viewshelf" -->
<h3><a href="/cgi-bin/koha/opac-shelves.pl">Lists</a> <img src="<!-- TMPL_VAR NAME="themelang" -->/../images/caret.gif" width="16" height="16" alt="&gt;" border="0" /> <em><!-- TMPL_VAR NAME="shelfname" --></em></h3>
<!-- TMPL_IF NAME="itemsloop" -->
<form action="/cgi-bin/koha/opac-shelves.pl" method="post" name="myform">
<form action="/cgi-bin/koha/opac-shelves.pl" method="post" name="myform" class="checkboxed">
<input type="hidden" name="viewshelf" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
<input type="hidden" name="modifyshelfcontents" value="1" />
<table>
<tr>
<!-- TMPL_IF NAME="manageshelf" --><th><a href="/cgi-bin/koha/opac-shelves.pl" onclick="CheckAll(); return false;"><img src="<!-- TMPL_VAR NAME="themelang" -->/../images/checkall.gif" alt="Check All" border="0" /></a></th><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="manageshelf" --><span class="checkall"></span>
<span class="clearall"></span><!-- /TMPL_IF --><table id="listcontents">
<thead><tr>
<!-- TMPL_IF NAME="manageshelf" --><th>&nbsp;</th><!-- /TMPL_IF -->
<th>&nbsp;</th>
<th>Title</th>
<th>Author</th>
<th>Copyright</th>
</tr>
<!-- TMPL_LOOP NAME="itemsloop" -->
</tr></thead>
<tbody><!-- TMPL_LOOP NAME="itemsloop" -->
<!-- TMPL_IF NAME="toggle" -->
<tr class="highlight">
<!-- TMPL_ELSE -->
@ -74,21 +106,11 @@
<td>
<img src="<!-- TMPL_VAR NAME="themelang" -->/../itemtypeimg/<!-- TMPL_VAR NAME="itemtype" -->.gif" alt="<!-- TMPL_VAR NAME="itemtype" -->" title="<!-- TMPL_VAR NAME="itemtype" -->" />
</td>
<td>
<!-- TMPL_IF NAME="BiblioDefaultViewmarc" -->
<a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" --></a>
<!-- TMPL_ELSE -->
<!-- TMPL_IF NAME="BiblioDefaultViewisbd" -->
<a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" --></a>
<!-- TMPL_ELSE -->
<a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" --></a>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
</td>
<td><!-- TMPL_IF NAME="BiblioDefaultViewmarc" --><a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" --></a><!-- TMPL_ELSE --><!-- TMPL_IF NAME="BiblioDefaultViewisbd" --><a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" --></a><!-- TMPL_ELSE --><a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" ESCAPE="URL" -->"><!-- TMPL_VAR NAME="title" --> <!-- TMPL_VAR NAME="subtitle" --></a><!-- /TMPL_IF --><!-- /TMPL_IF --></td>
<td><!-- TMPL_VAR NAME="author" --></td>
<td><!-- TMPL_VAR NAME="copyrightdate" --></td>
</tr>
<!-- /TMPL_LOOP --><!-- /itemsloop -->
<!-- /TMPL_LOOP --></tbody><!-- /itemsloop -->
</table>
<!-- TMPL_ELSE -->
<div class="dialog message">This List is empty. You can add to your lists from the results of any <a href="opac-main.pl">search</a>!</div>

View file

@ -2,6 +2,29 @@
<!-- TMPL_IF name="op_add" -->Enter a new purchase suggestion<!-- /TMPL_IF -->
<!-- TMPL_IF name="op_else" -->Purchase Suggestions<!-- /TMPL_IF -->
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.pack.js"></script>
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
$.tablesorter.addParser({
id: 'articles',
is: function(s) {return false; },
format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
type: 'text'
});
$(function() {
$("#suggestt").tablesorter({
widgets : ['zebra'],
<!-- TMPL_IF NAME="loggedinusername" -->sortList: [[1,0]],<!-- TMPL_ELSE -->sortList: [[0,0]],<!-- /TMPL_IF -->
headers: {
<!-- TMPL_IF NAME="loggedinusername" -->0: { sorter: false },2: { sorter: 'articles' },2: {sorter: false },4: {sorter: false},5:{sorter:false}
<!-- TMPL_ELSE -->0: { sorter: 'articles' },1: {sorter: false },3: {sorter: false},4:{sorter:false}
<!-- /TMPL_IF -->
}
});
});
//]]>
</script>
</head>
<body>
<!-- TMPL_INCLUDE name="masthead.inc" -->
@ -58,16 +81,16 @@
</form>
<form action="/cgi-bin/koha/opac-suggestions.pl" method="post">
<input type="hidden" name="op" value="delete_confirm" />
<table>
<tr>
<table id="suggestt">
<thead><tr>
<!-- TMPL_IF NAME="loggedinusername" --><th>&nbsp;</th><!-- /TMPL_IF -->
<th>Summary</th>
<th>Note</th>
<th>Suggested by</th>
<th>Managed by</th>
<th>Status</th>
</tr>
<!-- TMPL_LOOP NAME="suggestions_loop" -->
</tr></thead>
<tbody><!-- TMPL_LOOP NAME="suggestions_loop" -->
<!-- TMPL_IF name="even" --><tr><!-- TMPL_ELSE --><tr class="highlight"><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="loggedinusername" --><td>
<input type="checkbox" name="delete_field" value="<!--TMPL_VAR name="suggestionid" -->" />
@ -98,12 +121,11 @@
</td>
</tr>
<!-- /TMPL_LOOP -->
<!-- TMPL_IF NAME="loggedinusername" --><tr>
<td colspan="9">
</tbody>
</table> <!-- TMPL_IF NAME="loggedinusername" --><fieldset class="action">
<input type="submit" value="Delete Checked Items" />
</td>
</fieldset>
</tr><!-- /TMPL_IF -->
</table>
</form>
<!-- TMPL_ELSE --><p>There are no pending purchase suggestions.</p><!-- /TMPL_IF -->

View file

@ -7,23 +7,19 @@
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.pack.js"></script>
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
$.tablesorter.addParser({
// set a unique id
$.tablesorter.addParser({
id: 'articles',
is: function(s) {
// return false so this parser is not auto detected
return false;
},
format: function(s) {
// format your data for normalization
return s.toLowerCase().replace(/^(the|an|a) /,'');
},
// set type, either numeric or text
is: function(s) {return false; },
format: function(s) { return s.toLowerCase().replace(/^(the|an|a) /,''); },
type: 'text'
});
$(function() {
$('#opac-user-views > ul').tabs();
$("#holdst").tablesorter({
sortList: [[0,0]],
headers: { 0: { sorter: 'articles' },3: { sorter: false },4: { sorter: false }
}
});
$("#checkoutst").tablesorter({
sortList: [[4,0]],
headers: { 0: { sorter: false }, 1: { sorter: 'articles' },2: { sorter: false },3: { sorter: false },5: { sorter: false },6: { sorter: false }
@ -32,23 +28,6 @@ $.tablesorter.addParser({
});
//]]>
</script>
<style type="text/css">
.header {
background-image:url("/opac-tmpl/prog/images/ascdesc.gif");
background-position:right center;
background-repeat:no-repeat;
cursor:pointer;
}
.headerSortUp {
background-image:url("/opac-tmpl/prog/images/asc.gif");
}
.headerSortDown {
background-image:url("/opac-tmpl/prog/images/desc.gif");
}
tr th, tr th:last-child {
text-align : center;
}
</style>
</head>
<body>
<!-- TMPL_INCLUDE NAME="masthead.inc" -->
@ -285,13 +264,14 @@ No renewals left
<table id="holdst">
<caption>Holds <span class="count">(<!-- TMPL_VAR NAME="reserves_count" --> total)</span></caption>
<!-- RESERVES TABLE ROWS -->
<tr>
<thead><tr>
<th>Title</th>
<th>Placed On</th>
<th>Pick Up Location</th>
<th>Status</th>
<th>Modify</th>
</tr>
</tr></thead>
<tbody>
<!-- TMPL_LOOP NAME="RESERVES" -->
<tr>
<td>
@ -324,6 +304,7 @@ No renewals left
</tr>
<!-- /TMPL_LOOP -->
</tbody>
</table>
</div>
<!-- /TMPL_IF -->