Files
Mozilla/mozilla/webtools/testopia/template/en/default/testopia/blocks.html.tmpl
ghendricks%novell.com aa5d8576ef numerous fixes
git-svn-id: svn://10.0.0.236/trunk@227552 18797224-902f-48f8-a5cc-f745e15eee43
2007-06-05 21:11:53 +00:00

162 lines
6.1 KiB
Cheetah

[%# 1.0@bugzilla.org %]
[%# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Testopia System
#
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2001
# Greg Hendricks. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
# Karla Hendricks <palegreensocks@gmail.com>
#%]
[%############################################################################%]
[%# Block for SELECT fields #%]
[%############################################################################%]
[% BLOCK select %]
<label for="[% sel.name %]" accesskey="[% sel.accesskey %]"></label>
<select name="[% sel.name %]" id="[% sel.name %]"
[%- "multiple=\"multiple\"" IF sel.mult %]
[%- "size=\"$sel.elements\"" IF sel.elements %]
[%- sel.events IF sel.events %]
[%- sel.style IF sel.style %]>
[% FOREACH item = sel.list %]
<option value="[% sel.byname ? item.name : item.id FILTER html %]" [% 'selected="selected"' IF (sel.default == item.name && item.name != '') || (sel.default == item.id || sel.default == 'all') %][% 'selected="selected"' IF (sel.deflist == 1 AND lsearch(sel.default, item.id)> -1) %]>
[% item.name FILTER html %]</option>
[% END %]
</select>
[% END %]
[%############################################################################%]
[%# Block for Navigation Links #%]
[%############################################################################%]
[% BLOCK navigation %]
[% SET MAX_LIMIT = 10000 %]
[% IF ajax %]
[% url = "javascript:page(" %]
[% pc = ")" %]
[% ELSE %]
[% url = "$table.get_page_url&pagesize=$table.page_size&page="%]
[%# url = "$table.url_loc?direction=$direction&getlist=1&page="%]
[% END %]
[% IF NOT table.viewall %]
[% pagesizelist = [{name => 25, id => 25},
{name => 50, id => 50},
{name => 100, id => 100},
{name => 500, id => 500}]%]
<script type='text/javascript'>
var [% table.type %]Table = {
jumpToPage: function (page){
var digit = /^\d+$/;
page = page - 1;
if ((page >= [% table.page_count %]) || (page < 0) || !digit.test(page)){
alert('Invalid page number. Please enter a value between 1 and [% table.page_count %] ');
return;
}
var url = '[% url %]' + page;
document.location = url;
}
};
function adjustPageSize(psize) {
document.location = "[% table.get_page_url %]&pagesize=" + psize;
}
</script>
<table align="center">
<tr style="background-color: #eeeeee; ">
[% IF table.page != 0 %]
<td><a href="[% url %]0[% pc %]">&lt;&lt;&nbsp;First</a></td>
<td><a href="[% url %][% table.page - 1 %][% pc %]">&lt;&nbsp;Previous</a></td>
[% ELSE %]
<td>&lt;&lt;&nbsp;First</td>
<td>&lt;&nbsp;Previous</td>
[% END %]
<td align="center" style="font-size: medium">
[% SET framewidth = 10 %]
[% IF (table.page_count - 1) < framewidth %]
[% SET p = 0 %]
[% SET frame_end = table.page_count - 1 %]
[% ELSIF (table.page_count - table.page) < (framewidth / 2) %]
[% SET p = table.page_count - framewidth %]
[% SET frame_end = table.page_count - 1 %]
[% SET start_mark = '...' %]
[% ELSIF table.page < (framewidth / 2) %]
[% SET p = 0 %]
[% SET frame_end = framewidth %]
[% SET end_mark = '...' %]
[% ELSE %]
[% SET p = table.page - (framewidth / 2) %]
[% SET frame_end = table.page + (framewidth / 2) %]
[% SET start_mark = '...' %]
[% SET end_mark = '...' %]
[% END %]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[% start_mark %]
[% WHILE p <= frame_end %]
[% IF p != table.page %]
<a href="[% url %][% p %][% pc %]">[% p + 1 %]</a>&nbsp;
[% ELSE %]
[% p + 1 %]
[% END %]
[% p = p + 1 %]
[% END %]
[% end_mark %]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
[% IF table.page < table.page_count - 1 %]
<td><a href="[% url %][% table.page + 1 %][% pc %]">Next&nbsp;&gt;</a></td>
<td><a href="[% url %][% table.page_count - 1 %][% pc %]" title="Jump to Page [% table.page_count %]">Last&nbsp;&gt;&gt;</a></td>
[% ELSE %]
<td>Next&nbsp;&gt;</td>
<td>Last&nbsp;&gt;&gt;</td>
[% END %]
</tr>
<td colspan="5">
<input type="button" onclick="[% table.type %]Table.jumpToPage(document.getElementById('jump_[% table.type %]').value)" value="Jump To Page">
<input id="jump_[% table.type %]" size="4">
&nbsp;Out of [% table.page_count %] pages
&nbsp;&nbsp;&nbsp;
View [% PROCESS select sel = {list => pagesizelist,
default => table.page_size,
events => 'onchange="adjustPageSize(this.value)"' }%]
records&nbsp;at&nbsp;a&nbsp;time
&nbsp;&nbsp;&nbsp;
[% IF ajax %]
<a href="[% url %]null,1[% pc %]">View&nbsp;All</a>&nbsp;
[% ELSE %]
[% IF table.list_count < MAX_LIMIT AND table.list_count > table.page_size %]
<a href="[% url %]&viewall=1">View&nbsp;All</a>&nbsp;
[% ELSE %]
<span style="color:gray">View&nbsp;All</span>
[% END %]
[% END %]
</td>
</tr>
<tr><th colspan="5" style="font-size: 12pt;">[% table.list_count %] records found [% '(filtered)' IF filtered %]</th></tr>
</table>
[% ELSE %]
<table align="center">
<tr style="background-color: #eeeeee; ">
<td align="center"><a href="[% url %]0">Paged View</a></td>
</tr>
<tr><th colspan="5" style="font-size: 12pt;">[% table.list_count %] records found [% '(filtered)' IF filtered %]</th></tr>
</table>
[% END %]
[% END %]