X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fnodes%2Fnode_add.php;h=8a17774d936d6b820ade66e0838afae9c50e991d;hb=c0e69680677e153e96e0302633e97e31b1e2c7a6;hp=63b9fd56e085e021ea4b1cf41212f2c11d37c9f5;hpb=25d98634e8ff1509901a8f1b44882e452b9131b7;p=plewww.git diff --git a/planetlab/nodes/node_add.php b/planetlab/nodes/node_add.php index 63b9fd5..8a17774 100644 --- a/planetlab/nodes/node_add.php +++ b/planetlab/nodes/node_add.php @@ -1,7 +1,5 @@ $hostname, "model"=>$model ); - $site_id= plc_my_site_id(); + $node_fields= array( "hostname"=>$hostname, "model"=>$model , "node_type" => $node_type); $node_id= $api->AddNode( intval( $site_id ), $node_fields ); if ( empty($node_id) || ($node_id < 0) ) { @@ -137,27 +141,26 @@ drupal_set_html_head (' '); -$sites=$api->GetSites(array(plc_my_site_id())); -$site=$sites[0]; -$sitename=$site['name']; - -drupal_set_title('Add a new node in site "' . $sitename . '"'); +drupal_set_title('Add a new node to site'); // defaults -$method = $_POST['method']; -if( ! $method ) $method= "static"; - $model = $_POST['model']; if( ! $model ) $model= "Custom"; +$node_type = $_POST['node_type']; +if ( ! $node_type ) $node_type= "regular"; + +$method = $_POST['method']; +if( ! $method ) $method= "static"; + print <<< EOF

-This page lets you declare a new machine in your site. +This page lets you declare a new machine to a site.
This must be done before the machine is turned on, as it will allow you to download a boot image when complete for this node.
- It is now reserved to admins, as regular users are supposed to use the register wizard, that among other things enforces PCU deployment. +It is now reserved to admins, as regular users are supposed to use the register wizard, that among other things enforces PCU deployment.
An IP address is required even if you use DHCP.

@@ -178,8 +181,23 @@ $form=$details->form_start('/db/nodes/node_add.php',$form_variables, $details->start(); +$site_columns=array( "site_id", "name", "login_base" ); +$local_sites= $api->GetSites( array("peer_id"=>NULL, '-SORT'=>'name'), $site_columns ); +function site_selector($site) { return array('display'=>$site['name'],"value"=>$site['site_id']); } +$site_selector = array_map ("site_selector",$local_sites); +$site_select = $form->select_html("site_id", $site_selector, array('id'=>'site_id')); +$details->th_td("Site", + $site_select, + "site_id", + array('input_type'=>'select','value'=>$interface['site_id'])); + $details->th_td("Hostname",$hostname,"hostname"); $details->th_td("Model",$model,"model"); +$node_type_select = $form->select_html ("node_type", + node_type_selectors($api,$node_type), + array('id'=>'node_type')); +$details->th_td("Reservation",$node_type_select,"node_type", + array('input_type'=>'select','value'=>$node_type)); $method_select = $form->select_html ("method", interface_method_selectors($api,$method,true), array('id'=>'method',