handling toggle parts visible tag: now rely on local storage, so avoid
[plewww.git] / planetlab / nodes / interface.php
index 338b9b8..744ce3f 100644 (file)
@@ -15,6 +15,7 @@ require_once 'linetabs.php';
 require_once 'details.php';
 require_once 'table.php';
 require_once 'toggle.php';
+require_once 'prototype.php';
 
 require_once 'plc_drupal.php';
 include 'plc_header.php';
@@ -49,7 +50,7 @@ if ( ! $node_id) {
 
 $tabs=array();
 $tabs[] = array('label'=>'Back to node', 'url'=>l_node($node_id), 
-               'values' => array('show_details'=>False,'show_interfaces'=>True),
+               'values' => array('show_interfaces'=>True),
                'bubble'=>'Cancel pending changes');
 plekit_linetabs($tabs);
 
@@ -75,7 +76,7 @@ drupal_set_html_head ('
 $nifty_id = ($mode == 'add' ) ? 'add-interface' : 'interface';
 $toggle = new PlekitToggle ($nifty_id,"Details",
                            array('bubble'=>'Display and modify details for that interface',
-                                 'visible'=>get_arg('show_details',true)));
+                                 'visible'=>get_arg('show_details')));
 $toggle->start();
 
 $details=new PlekitDetails($can_update);
@@ -89,8 +90,7 @@ $form=$details->form_start(l_actions(),$form_variables,
 $details->start();
 
 if ($mode == 'add') 
-  // would have preferred 'dhcp' as a default but could not figure how to trigger updateMethodFields on startup
-  $method_default = 'static';
+  $method_default = 'dhcp';
 else
   $method_default = $interface['method'];
 $method_select = $form->select_html ("method",
@@ -131,8 +131,10 @@ switch ($mode) {
    $is_primary = (count($node['interface_ids']) == 0);
    if ( ! $is_primary) {
      // default is to create virtual interfaces
-     $details->th_th($form->checkbox_html('is-virtual','yes',array('checked'=>'checked')),
-                    "Virtual Interface");
+     $details->th_th("Virtual Interface",
+                    $form->checkbox_html('is-virtual','yes',array('id'=>'virtual', 
+                                                                  'checked'=>'checked',
+                                                                  'onChange'=>'updateVirtualArea()')));
      $details->th_td("Interface name","eth0",'ifname');
      $details->th_td("alias (leave empty if unsure)","",'alias');
    }
@@ -154,7 +156,7 @@ if ($mode == 'add') return;
 //////////////////////////////////////// tags
 $tags=$api->GetInterfaceTags (array('interface_id'=>$interface_id));
 $toggle=new PlekitToggle ('tags',count_english($tags,'tag'),
-                         array('visible'=>get_arg('show_tags',true)));
+                         array('visible'=>get_arg('show_tags')));
 $toggle->start();
 
 $form = new PlekitForm (l_actions(),array('interface_id'=>$interface_id));