corrected behavior of Add Interface button. PlekitForm strips url of arguments,
authorStephen Soltesz <soltesz@cs.princeton.edu>
Mon, 15 Jun 2009 23:27:07 +0000 (23:27 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Mon, 15 Jun 2009 23:27:07 +0000 (23:27 +0000)
preventing correct behavior in old usage at this patch.  to resolve, I used existing
'actions.php' template to redirect to 'interface?node_id=xxx'

planetlab/common/actions.php
planetlab/nodes/node.php

index eff610a..f7d77df 100644 (file)
@@ -57,6 +57,8 @@ $known_actions []= "delete-interfaces";
 //     expects:        interface_ids
 $known_actions []="add-interface";
 //     expects:        node_id & interface details
+$known_actions []="new-interface";
+//     expects:        node_id 
 $known_actions []="update-interface";
 //     expects:        interface_id & interface details
 
@@ -383,7 +385,9 @@ switch ($action) {
      drupal_set_error ("Could not delete all selected interfaces, only $counter were removed");
    plc_redirect(l_node($_POST['node_id']));
  }
-
+ case 'new-interface': {
+   plc_redirect(l_interface_add($_POST['node_id']));
+ }
  case 'add-interface': {
    $node_id=$_POST['node_id'];
    foreach ($interface_details as $field) {
index 9b10bf8..1441223 100644 (file)
@@ -464,9 +464,11 @@ if ( $local_peer ) {
     if ($privileges) {
       $table->tfoot_start();
       $table->row_start();
-      $add_button=new PlekitFormButton (l_interface_add($node_id),"add","Add Interface","GET");
       // we should have 6 cols, use 3 for the left (new) and the rest for the right (remove)
-      $table->cell($add_button->html(),array('columns'=> 3,'align'=>'left'));
+      //$add_button=new PlekitFormButton (l_interface_add($node_id),"add","Add Interface","GET");
+      //$table->cell($add_button->html(),array('columns'=> 3,'align'=>'left'));
+      $table->cell($form->submit_html("new-interface","Add Interface"), 
+               array('columns'=> 3,'align'=>'left'));
       $table->cell($form->submit_html("delete-interfaces","Remove Interfaces"), 
                   array('columns'=>$table->columns()-3,'align'=>'right'));
       $table->row_end();