From: Stephen Soltesz Date: Mon, 15 Jun 2009 23:27:07 +0000 (+0000) Subject: corrected behavior of Add Interface button. PlekitForm strips url of arguments, X-Git-Tag: PLEWWW-4.3-20~2 X-Git-Url: http://git.onelab.eu/?p=plewww.git;a=commitdiff_plain;h=f9a23a0eb7f2c6eed5a0f0362ba3d1a627ef066a corrected behavior of Add Interface button. PlekitForm strips url of arguments, preventing correct behavior in old usage at this patch. to resolve, I used existing 'actions.php' template to redirect to 'interface?node_id=xxx' --- diff --git a/planetlab/common/actions.php b/planetlab/common/actions.php index eff610a..f7d77df 100644 --- a/planetlab/common/actions.php +++ b/planetlab/common/actions.php @@ -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) { diff --git a/planetlab/nodes/node.php b/planetlab/nodes/node.php index 9b10bf8..1441223 100644 --- a/planetlab/nodes/node.php +++ b/planetlab/nodes/node.php @@ -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();