3 ////////////////////////////////////////
4 // table_id: <table>'s id tag
5 // pagesize_init: the initial pagination size
6 // pagesize_def: the page size when one clisks the pagesize reset button
7 function plc_table_search_area ($table_id,$pagesize_init,$pagesize_def) {
8 $pagesize_text_id = $table_id . "_pagesize";
9 $search_text_id = $table_id . "_search";
10 $search_reset_id = $table_id . "_search_reset";
11 $search_and_id = $table_id . "_search_and";
13 <table class='table_dialogs'> <tr>
14 <td class='table_flushleft'>
15 <form class='pagesize'>
16 <input class='pagesize_input' type='text' id="$pagesize_text_id" value=$pagesize_init
17 onkeyup='plc_pagesize_set("$table_id","$pagesize_text_id", $pagesize_init);'
19 <label class='pagesize_label'> items/page </label>
20 <img class='table_reset' src="/planetlab/icons/clear.png"
21 onmousedown='plc_pagesize_reset("$table_id","$pagesize_text_id",$pagesize_def);'>
25 <td class='table_flushright'>
26 <form class='table_search'>
27 <label class='table_search_label'> Search </label>
28 <input class='table_search_input' type='text' id='$search_text_id'
29 onkeyup='plc_table_filter("$table_id","$search_text_id","$search_and_id");'
30 size=40 maxlength=256 />
32 <input id='$search_and_id' class='table_search_and'
33 type='checkbox' checked='checked'
34 onchange='plc_table_filter("$table_id","$search_text_id","$search_and_id");' />
35 <img class='table_reset' src="/planetlab/icons/clear.png"
36 onmousedown='plc_table_filter_reset("$table_id","$search_text_id","$search_and_id");'>
43 ////////////////////////////////////////
44 // table_id: <table>'s id tag
45 // headers: an associative array "label"=>"type"
46 // pagesize: the initial page
47 // column_init_sort: the column to sort on at load-time
48 // max_pages: the max number of pages to display in the paginator
49 function plc_table_head ($table_id,$headers,$pagesize,$column_init_sort,$max_pages) {
50 $paginator=$table_id."_paginator";
51 $classname="paginationcallback-".$paginator;
52 $classname.=" max-pages-" . $max_pages;
53 $classname.=" paginate-" . $pagesize;
55 <!-- instantiate paginator callback -->
56 <script type"text/javascript">
57 function $paginator (opts) { plc_table_paginator (opts,"$table_id"); }
60 <table id="$table_id" cellpadding="0" cellspacing="0" border="0"
61 class="plc_table sortable-onload-$column_init_sort rowstyle-alt colstyle-alt no-arrow $classname">
66 foreach ($headers as $label => $type) {
67 if ($type == "string") $type="";
68 if ($type == "int") $type="";
69 if ($type == "float") $type="";
71 if ( ! empty($type)) $class .= "-" . $type;
72 print '<th class="' . $class . ' plc_table">' . $label . "</th>\n";
82 ////////////////////////////////////////
83 function plc_table_foot () {
92 ////////////////////////////////////////
93 function plc_table_notes () {
95 <p class='plc_filter_note'>
96 Notes: Enter & or | in the search area to alternate between <bold>AND</bold> and <bold>OR</bold> search modes
98 Hold down the shift key to select multiple columns to sort