brute-force changed access to $_GET['key'] to use get_array instead
[plewww.git] / planetlab / tags / nodegroup.php
index 892cfc8..fddba94 100644 (file)
@@ -15,15 +15,14 @@ include 'plc_header.php';
 
 // Common functions
 require_once 'plc_functions.php';
-require_once 'plc_minitabs.php';
-require_once 'plc_tables.php';
-require_once 'plc_details.php';
-//require_once 'plc_forms.php';
-//require_once 'plc_peers.php';
+require_once 'linetabs.php';
+require_once 'table.php';
+require_once 'details.php';
+require_once 'toggle.php';
 
 // -------------------- 
 // recognized URL arguments
-$nodegroup_id=intval($_GET['id']);
+$nodegroup_id=intval(get_array($_GET, 'id'));
 if ( ! $nodegroup_id ) { plc_error('Malformed URL - id not set'); return; }
 
 ////////////////////
@@ -44,29 +43,38 @@ $node_columns = array("hostname","node_id");
 
 $nodes = $api->GetNodes( $node_ids, $node_columns);
 
-$tabs ["All nodegroups"] = array ('url'=>l_nodegroups(),
-                                 'bubble'=>'All nodegroups');
-$tabs ["All tags"] = array ('url'=>l_tags(),
-                           'bubble'=>'All tags');
-$tabs ["Local nodes"] = array ('url'=>l_nodes_peer('local'),
-                            'bubble'=>'All local nodes');
+$tabs = array();
 
-drupal_set_title("Details for node group " . $nodegroup['groupname']);
-plc_tabs($tabs);
+$tabs []= tab_tags();
+$tabs []= tab_nodegroups();
+$tabs []= tab_nodes_local();
 
-plc_details_start();
-plc_details_line ("Node group name",$nodegroup['groupname']);
-plc_details_line ("Based on tag",href(l_tag($nodegroup['tag_type_id']),$tagname));
-plc_details_line("Matching value",$nodegroup['value']);
-plc_details_line("# nodes",count($nodegroup['node_ids']));
-plc_details_end();
+drupal_set_title("Details for node group " . $nodegroup['groupname']);
+plekit_linetabs($tabs);
+
+$toggle=new PlekitToggle('details','Details');
+$toggle->start();
+$details=new PlekitDetails(plc_is_admin());
+$details->start();
+$details->form_start(l_actions(),array("action"=>"update-nodegroup", "nodegroup_id"=>$nodegroup_id));
+$details->th_td ("Node group name",$nodegroup['groupname'],'groupname');
+// can't change the target tag
+$details->th_td ("Based on tag",href(l_tag($nodegroup['tag_type_id']),$tagname));
+$details->th_td("Matching value",$nodegroup['value'],'value');
+$details->th_td("# nodes",count($nodegroup['node_ids']));
+$details->tr_submit("submit","Update Nodegroup");
+$details->form_end();
+$details->end();
+
+$toggle->end();
 
 // xxx : add & delete buttons would make sense here too
-plc_section("Nodes");
+$toggle=new PlekitToggle('nodes',"Nodes");
+$toggle->start();
 
 $headers["Hostname"]="string";
 
-$table = new PlcTable("nodegroup_nodes",$headers,0,array('search_width'=>15));
+$table = new PlekitTable("nodegroup_nodes",$headers,0,array('search_width'=>15));
 $table->start();
 if ($nodes) foreach ($nodes as $node) {
   $table->row_start ();
@@ -75,6 +83,10 @@ if ($nodes) foreach ($nodes as $node) {
 }
 
 $table->end ();
+$toggle->end();
+
+//plekit_linetabs ($tabs,"bottom");
+
 // Print footer
 include 'plc_footer.php';