5 <script type="text/javascript" src="/planetlab/minitabs/minitabs.js"></script>
6 <link href="/planetlab/minitabs/minitabs.css" rel="stylesheet" type="text/css" />
10 // the expected argument is an (ordered) associative array
11 // ( label => todo , ...)
12 // label is expected to be the string to display in the menu
14 // (*) a string : it is then taken to be a URL to move to
15 // (*) or an associative array with the following keys
16 // (*) 'method': 'POST' or 'GET' -- default is 'GET'
17 // (*) 'url': where to go
18 // (*) 'values': an associative array of (key,value) pairs to send to the URL; values are strings
19 // (*) 'confirm': a question to display before actually triggering
20 // (*) 'bubble': a longer message displayed when the mouse stays quite for a while on the label
21 // (*) 'image' : the url of an image used instead of the full title
22 // (*) 'height' : used for the image
24 ////////// Notes: limited support for images
25 // (*) for some reason, confirmation does not work with image tabs
26 // (the form gets submitted whatever the confirmation....)
27 // (*) you need to tune the image size, which is wrong, as the image should rather be bottom-aligned
30 function plc_tabs($array) {
31 print '<div id="minitabs_container">';
32 print '<ul id="miniflex">';
34 foreach ($array as $label=>$todo) {
35 print '<li class="minitabs">';
36 // in case we have a string, rewrite it as an array
37 if (is_string ($todo)) $todo=array('method'=>'GET','url'=>$todo);
39 if ( ! $todo['method'] ) $todo['method']='GET';
41 printf ('<form name="%s" action="%s" method="%s">',$label,$todo['url'],$todo['method']);
43 if ( $todo['values'] ) {
44 foreach ($todo['values'] as $key=>$value) {
45 printf('<input class="minitabs-hidden" type=hidden name="%s" value="%s" />',$key,$value);
48 $class_value="minitabs-submit";
49 // image and its companions 'height'
51 $type='type=image src="' . $todo['image'] . '"';
52 if ($todo['height']) $type.= ' height=' . $todo['height'];
54 $type='type=button value="' . $label . '"';
56 printf('<span title="%s">',$todo['bubble']);
57 printf('<input class="%s" %s onclick=\'miniTab.submit("%s");\' />',$class_value,$type,$todo['confirm']);
58 printf('</span>',$todo['bubble']);
59 printf("</form></li>\n");