checkpoint
[plewww.git] / planetlab / nodes / node_actions.php
index 8fc8165..a5db54a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-  // $Id: node_actions.php 1184 2008-02-12 20:33:35Z thierry $
+  // $Id$
   // This file was created when we decided to make the node page consistent with the other pages
   // That is to say, we wanted the 'Update' and 'Delete' functions to appear in a drop-down
   // menu like for the other objects
@@ -71,10 +71,6 @@ global $plc, $api;
 require_once 'plc_functions.php';
 require_once 'plc_sorts.php';
 
-// find person roles
-$_person= $plc->person;
-$_roles= $_person['role_ids'];
-
 // NOTE: this function exits() after it completes its job, 
 // simply returning leads to html decorations being added around the contents
 function deliver_and_unlink ($filename) {
@@ -105,7 +101,7 @@ function deliver_and_unlink ($filename) {
   exit();
 }
 
-function show_download_confirm_button($api, $node_id, $action, $can_gen_config, $show_details) {
+function show_download_confirm_button ($api, $node_id, $action, $can_gen_config, $show_details) {
 
   if( $can_gen_config ) {
     if ($show_details) {
@@ -156,7 +152,7 @@ switch ($action) {
    echo "<form method=post action='node_actions.php'>\n";
    echo "<input type=hidden name='node_id' value='$node_id'></input>\n";
    echo "<input type=hidden name='action' value='update'></input>\n";
-   if( $_POST['error'] ) echo "<font color=red>". unserialize( $_POST['error'] ."</font>\n" );
+   if( $_POST['error'] ) plc_error(unserialize( $_POST['error']));
    echo "<p><table cellpadding=2><tbody>\n
        <tr><th>Hostname: </th><td> <input type=text size=35 name='hostname' value='". $node_info[0]['hostname'] ."'></td></tr>\n
        <tr><th>Model: </th><td> <input type=text size=35 name='model' value='". $node_info[0]['model'] ."'></td></tr>\n
@@ -258,9 +254,9 @@ switch ($action) {
    $node_detail= $return[0];
 
    // non-admin people need to be affiliated with the right site
-   if( !in_array( 10, $_roles ) ) {
+   if( ! plc_is_admin() ) {
      $node_site_id = $node_detail['site_id'];
-     $in_site = in_array ($node_site_id,$_person['site_ids']);
+     $in_site = plc_in_site($node_site_id);
      if( ! $in_site) {
        $error= "Insufficient permission. You cannot create configuration files for this node.";
      }
@@ -357,7 +353,7 @@ a new node key, and any existing configuration file will be unusable and
 go into debug mode.
 
 <p>In order to create a configuration file for this node using this page,
-all the node network settings must be up to date. Below is summary of these
+all the interface settings must be up to date. Below is summary of these
 values. Any missing values must be entered before this can be used.
 
 EOF;
@@ -366,7 +362,7 @@ EOF;
 
    show_download_confirm_button($api, $node_id, $action, $can_gen_config, false);
    print ("<p>");
-   print ("<h3>Current node network settings</h3>\n");
+   print ("<h3>Current interface settings</h3>\n");
    
 if( $has_primary ) {
   print( "<table border=\"0\" cellspacing=\"4\">\n" );
@@ -378,7 +374,7 @@ if( $has_primary ) {
   print( "<td>" . $node_detail['hostname'] . "</td></tr>\n" );
 
   $nn_id = $interface_detail['interface_id'];
-  print( "<tr><th colspan=2><a href='interfaces.php?id=$nn_id'>Node Network Details</a></th></tr>" );
+  print( "<tr><th colspan=2><a href='interfaces.php?id=$nn_id'>Interface Details</a></th></tr>" );
 
   print( "<tr><th>Method:</th>" );
   print( "<td>" . $interface_detail['method'] . "</td></tr>\n" );
@@ -406,17 +402,17 @@ if( $has_primary ) {
 
   print ("<tr><th colspan=2><a href='interfaces.php?id=$nn_id'>Additional Settings</a></th></tr>\n");
   $nn_id = $interface_detail['interface_id'];
-  $settings=$api->GetInterfaceSettings(array("interface_id" => array($nn_id)));
+  $settings=$api->GetInterfaceTags(array("interface_id" => array($nn_id)));
   foreach ($settings as $setting) {
     $category=$setting['category'];
-    $name=$setting['name'];
+    $name=$setting['tagname'];
     $value=$setting['value'];
     print (" <tr><th> $category $name </th><td> $value </td></tr>\n");
   }
 
   print( "</table>\n" );
 } else {
-  print( "<p class='plc-warning'>This node has no configured primary network.</p>\n" );
+  print( "<p class='plc-warning'>This node has no configured primary interface.</p>\n" );
 }
 
  show_download_confirm_button($api, $node_id, $action, $can_gen_config, true);