update
[plewww.git] / plekit / php / linetabs.php
index b26dffc..f83241a 100644 (file)
@@ -38,18 +38,18 @@ drupal_set_html_head('
 // $tabs['Simple Tab']="http://planet-lab.org";
 // $tabs['Complex Tab']=array('url'=>'http://planet-lab.org/',
 //                           'bubble'=>'This text gets displayed when the mouse remains over for a while');
-// plc_tabs($tabs);
+// plekit_linetabs($tabs);
 
 ////////// Notes: limited support for images
 // (*) for some reason, confirmation does not work with image tabs 
 //     (the form gets submitted whatever the confirmation....)
 // (*) you need to tune the image size, which is wrong, as the image should rather be bottom-aligned 
 
-function plc_tabs ($array, $id=NULL) {
+function plekit_linetabs ($array, $id=NULL) {
   // need id to pass to the onclick function attached to the input buttons
-  $id="minitabs";
+  $id="linetabs";
   if (! $id) $id .= '-' + $id;
-  print "<div id='$id' class='minitabs'>";
+  print "<div id='$id' class='linetabs'>";
   print "<ul>";
   foreach ($array as $label=>$todo) {
     // in case we have a simple string, rewrite it as an array
@@ -68,34 +68,38 @@ function plc_tabs ($array, $id=NULL) {
     $url_values=$split['values'];
 
     // create form
-    $method=$todo['method'];
-    print "<form name='$label' action='$url' method='$method'>";
+    $method=strtolower($todo['method']);
+    print "<form action='$url' method='$method'><fieldset>";
     // set values
     $values=$todo['values'];
     if ( ! $values) $values = array();
     if ($url_values) $values = array_merge($values,$url_values);
     if ( $values ) foreach ($values as $key=>$value) {
-       print "<input type=hidden name='$key' value='$value' />";
+       print "<input type='hidden' name='$key' value='$value' />";
       }
-    $tracer="class=minitabs-submit";
+    $tracer="class='linetabs-submit'";
     // image and its companions 'height' 
     if ($todo['image']) {
-      $type='type=image src="' . $todo['image'] . '"';
-      if ($todo['height']) $type.= ' height=' . $todo['height'];
+      $what=$todo['image'];
+      $type="type='image' src='$what'";
+      if ($todo['height']) {
+       $what=$todo['height'];
+       $type .= " height='$what'";
+      }
     } else {
-      $type='type=button value="' . $label . '"';
+      $type="type='button' value='$label'";
     }
     $bubble=$todo['bubble'];
     print "<span title='$bubble'>";
     $message="";
     if ($todo['confirm']) $message=$todo['confirm'] . " ?";
-    print "<input $tracer $type onclick='minitabs_namespace.submit(\"$id\",\"$message\")' />";
+    print "<input $tracer $type onclick='linetabs_namespace.submit(\"$id\",\"$message\")' />";
     print "</span>";
-    print "</form></li>\n";
+    print "</fieldset></form></li>\n";
   }
   print '</ul>';
   print '</div>';
-  print "<p class='plc-minittabs'></p>\n";
+  print "<p class='linetabs'></p>\n";
 }
 
 ?>