oops, textareas were rendered like passwords
[plewww.git] / planetlab / tags / tags.php
index 4403f72..0f57723 100644 (file)
@@ -15,9 +15,9 @@ include 'plc_header.php';
 
 // Common functions
 require_once 'plc_functions.php';
-require_once 'plc_minitabs.php';
-require_once 'plc_tables.php';
-require_once 'plc_forms.php';
+require_once 'linetabs.php';
+require_once 'table.php';
+require_once 'form.php';
 
 // -------------------- 
 // recognized URL arguments
@@ -26,15 +26,13 @@ $pattern=$_GET['pattern'];
 // --- decoration
 $title="Tag Types";
 $tabs=array();
-$tabs['Tag Types']=array('url'=>l_tags(),'bubble'=>"Create a new tag type");
-$tabs['All Nodes']=array('url'=>l_nodes(),'bubble'=>"Nodes from all peers");
-$tabs['Local Nodes']=array('url'=>l_nodes(),'values'=>array('peerscope'=>'local'),'bubble'=>"All local nodes");
-//$tabs['Interfaces']=l_interfaces();
-$tabs['All Slices']=array('url'=>l_slices(),'bubble'=>"Slices from all peers");
+$tabs []= tab_tags();
+$tabs []= tab_nodes_local();
+$tabs []= tab_slices();
 
 // -------------------- 
 drupal_set_title($title);
-plc_tabs($tabs);
+plekit_linetabs($tabs);
 
 $tag_type_columns = array( "tag_type_id", "tagname", "category", "description", "min_role_id" );
 
@@ -46,18 +44,24 @@ if ($pattern)
 $tag_types= $api->GetTagTypes($tag_type_filter, $tag_type_columns);
   
 $headers=array();
+$notes=array();
 // delete button
 $headers['Name']="string";
 $headers['Description']="string";
 $headers['Category']="string";
-$headers['Min role']="string";
+$headers['MR']="string";
+$notes []= "MR: Min Role, needed to manage this tag";
+
+// xxx ref count would be helpful but seem too expensive to compute at this stage 
+// the individual tag page show those ref counts per type
+
 $headers["Id"]="int";
 if (plc_is_admin()) $headers[plc_delete_icon()]="none";
 
-$form=new PlcForm(l_actions(),NULL);
+$form=new PlekitForm(l_actions(),NULL);
 $form->start();
 
-$table = new PlcTable("tags",$headers,0);
+$table = new PlekitTable("tags",$headers,0,array('notes'=>$notes));
 $table->start();
 
 $roles_hash=plc_role_global_hash($api);
@@ -73,6 +77,8 @@ foreach( $tag_types as $tag_type ) {
   $table->cell(wordwrap($tag_type['description'],$description_width,"<br/>"));
   $table->cell($tag_type['category']);
   $table->cell($role_name);
+  // ref count
+  //  if (plc_is_admin())     $table->cell('xxx');
   $table->cell($tag_type_id);
   if (plc_is_admin()) 
     $table->cell ($form->checkbox_html('tag_type_ids[]',$tag_type_id));
@@ -84,7 +90,7 @@ if (plc_is_admin()) {
 
   $table->row_start();
   $table->cell($form->submit_html ("delete-tag-types","Remove tags"),
-              $table->columns(),"right");
+              array('hfill'=>true,'align'=>'right'));
   $table->row_end();
 
   // an inline area to add a tag type
@@ -94,19 +100,21 @@ if (plc_is_admin()) {
   $relevant_roles = $api->GetRoles( array("~role_id"=>$role_ids));
   function selector_argument ($role) { return array('display'=>$role['name'],"value"=>$role['role_id']); }
   $selectors=array_map("selector_argument",$relevant_roles);
-  $role_input=$form->select_html("min_role_id",$selectors,"Role");
+  $role_input=$form->select_html("min_role_id",$selectors,array('label'=>"Role"));
 
   $table->cell($form->text_html('tagname',''));
   $table->cell($form->textarea_html('description','',$description_width,2));
   $table->cell($form->text_html('category',''));
   $table->cell($role_input);
-  $table->cell($form->submit_html("add-tag-type","Add Type"),2);
+  $table->cell($form->submit_html("add-tag-type","Add"),2);
   $table->row_end();
  }
 
 $table->end();
 $form->end();
 
+//plekit_linetabs ($tabs,"bottom");
+
 // Print footer
 include 'plc_footer.php';