for 5.0
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 27 May 2008 07:46:40 +0000 (07:46 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 27 May 2008 07:46:40 +0000 (07:46 +0000)
planetlab/nodes/index.php
planetlab/nodes/interfaces.php [moved from planetlab/nodes/node_networks.php with 99% similarity]
planetlab/nodes/node_actions.php
planetlab/nodes/setting_action.php

index 91aeaa1..355ade4 100644 (file)
@@ -248,7 +248,7 @@ if ( $_GET['id'] ) {
 
     // get node network info
     if( !empty( $interface_ids ) )
-      $node_networks= $api->GetInterfaces( $interface_ids );
+      $interfaces= $api->GetInterfaces( $interface_ids );
 
     // gets nodegroup info
     if( !empty( $nodegroup_ids ) )
@@ -381,7 +381,7 @@ if ( $_GET['id'] ) {
       echo "<hr />\n";
 
       // display node networks
-      if( $node_networks ) {
+      if( $interfaces ) {
        echo "<p><table class='list_set' border=0 cellpadding=2>\n";
        echo "<caption class='list_set'>Node Networks</caption>\n";
        echo "<thead><tr class='list_set'>";
@@ -391,27 +391,27 @@ if ( $_GET['id'] ) {
        }
        echo "<th class='list_set'>IP Address</th><th class='list_set'>Method</th><th class='list_set'>Type</th><th class='list_set'>MAC</th><th class='list_set'>Bandwidth Limit</th></tr></thead><tbody>\n";
 
-       foreach( $node_networks as $node_network ) {
-         $nn_id= $node_network['interface_id'];
-         $nn_ip= $node_network['ip'];
-         $nn_broad= $node_network['broadcast'];
-         $nn_primary= $node_network['is_primary'];
-         $nn_network= $node_network['network'];
-         $nn_dns1= $node_network['dns1'];
-         $nn_dns2= $node_network['dns2'];
-         $nn_hostname= $node_network['hostname'];
-         $nn_netmaks= $node_network['netmask'];
-         $nn_gatewary= $node_network['gateway'];
-         $nn_mac= $node_network['mac'];
-         $nn_bwlimit= $node_network['bwlimit'];
-         $nn_type= $node_network['type'];
-         $nn_method= $node_network['method'];
+       foreach( $interfaces as $interface ) {
+         $nn_id= $interface['interface_id'];
+         $nn_ip= $interface['ip'];
+         $nn_broad= $interface['broadcast'];
+         $nn_primary= $interface['is_primary'];
+         $nn_network= $interface['network'];
+         $nn_dns1= $interface['dns1'];
+         $nn_dns2= $interface['dns2'];
+         $nn_hostname= $interface['hostname'];
+         $nn_netmaks= $interface['netmask'];
+         $nn_gatewary= $interface['gateway'];
+         $nn_mac= $interface['mac'];
+         $nn_bwlimit= $interface['bwlimit'];
+         $nn_type= $interface['type'];
+         $nn_method= $interface['method'];
 
          echo "<tr class='list_set'>";
          if ( $is_admin || ($is_pi && $in_site)) {
            echo "<td class='list_set'>";
            if (!$nn_primary) {
-             echo plc_delete_link_button('node_networks.php?id=' . $nn_id . '&delete=1&submitted=1', '\\nNode Network ' . $nn_ip);
+             echo plc_delete_link_button('interfaces.php?id=' . $nn_id . '&delete=1&submitted=1', '\\nNode Network ' . $nn_ip);
            } else {
              echo '<span title="This node network is primary"> P </span>';
            }
@@ -419,7 +419,7 @@ if ( $_GET['id'] ) {
          }
          echo "<td class='list_set'>";
          if( $is_admin || $is_pi || $is_tech ) {
-           echo "<a href='node_networks.php?id=$nn_id'>$nn_ip</a>";
+           echo "<a href='interfaces.php?id=$nn_id'>$nn_ip</a>";
          } else {
            echo "</td><td class='list_set'>$nn_ip</td>";
          }
@@ -432,7 +432,7 @@ if ( $_GET['id'] ) {
        echo "<p><span class='plc-warning'>No Node Network</span>.  Please add a node network to make this a usable PLC node</p>.\n";
       }
 
-      echo "<br /><a href='node_networks.php?node_id=$node_id'>Add a node network</a>.\n";
+      echo "<br /><a href='interfaces.php?node_id=$node_id'>Add a node network</a>.\n";
       echo "<br /><hr />\n";
     }
 
similarity index 99%
rename from planetlab/nodes/node_networks.php
rename to planetlab/nodes/interfaces.php
index 50e38b2..f8b7f58 100644 (file)
@@ -100,7 +100,7 @@ drupal_set_title($node['hostname']);
 include 'plc_header.php';
 
 // Start form
-$action= "node_networks.php";
+$action= "interfaces.php";
 if( isset( $id ) ) {
   $action.= "?id=" . $interface['interface_id'];
 } 
index 3844031..0878874 100644 (file)
@@ -278,8 +278,8 @@ switch ($action) {
    $has_primary= 0;
    
    if( count($return) > 0 ) {
-     foreach( $return as $node_network_detail ) {
-       if( $node_network_detail['is_primary'] == true ) {
+     foreach( $return as $interface_detail ) {
+       if( $interface_detail['is_primary'] == true ) {
         $has_primary= 1;
         break;
        }
@@ -296,26 +296,26 @@ switch ($action) {
      
      $fields= array("method","ip");
      foreach( $fields as $field ) {
-       if( $node_network_detail[$field] == "" ) {
+       if( $interface_detail[$field] == "" ) {
         $can_gen_config= 0;
-        $node_network_detail[$field]= "<i>Missing</i>";
+        $interface_detail[$field]= "<i>Missing</i>";
        }
      }
 
-     if( $node_network_detail['method'] == "static" ) {
+     if( $interface_detail['method'] == "static" ) {
        $fields= array("gateway","netmask","network","broadcast","dns1");
        foreach( $fields as $field ) {
-        if( $node_network_detail[$field] == "" ) {
+        if( $interface_detail[$field] == "" ) {
           $can_gen_config= 0;
-          $node_network_detail[$field]= "<i>Missing</i>";
+          $interface_detail[$field]= "<i>Missing</i>";
         }
        }
      }
 
-     if(    $node_network_detail['method'] != "static" 
-        && $node_network_detail['method'] != "dhcp" ) {
+     if(    $interface_detail['method'] != "static" 
+        && $interface_detail['method'] != "dhcp" ) {
        $can_gen_config= 0;
-       $node_network_detail['method']= "<i>Unknown method</i>";
+       $interface_detail['method']= "<i>Unknown method</i>";
      }
    }
 
@@ -395,36 +395,36 @@ if( $has_primary ) {
   print( "<tr><th>Hostname:</th>" );
   print( "<td>" . $node_detail['hostname'] . "</td></tr>\n" );
 
-  $nn_id = $node_network_detail['interface_id'];
-  print( "<tr><th colspan=2><a href='node_networks.php?id=$nn_id'>Node Network Details</a></th></tr>" );
+  $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>Method:</th>" );
-  print( "<td>" . $node_network_detail['method'] . "</td></tr>\n" );
+  print( "<td>" . $interface_detail['method'] . "</td></tr>\n" );
   print( "<tr><th>IP:</th>" );
-  print( "<td>" . $node_network_detail['ip'] . "</td></tr>\n" );
+  print( "<td>" . $interface_detail['ip'] . "</td></tr>\n" );
 
-  if( $node_network_detail['method'] == "static" ) {
+  if( $interface_detail['method'] == "static" ) {
       print( "<tr><th>Gateway:</th>" );
-      print( "<td>" . $node_network_detail['gateway'] . "</td></tr>\n" );
+      print( "<td>" . $interface_detail['gateway'] . "</td></tr>\n" );
       print( "<tr><th>Network mask:</th>" );
-      print( "<td>" . $node_network_detail['netmask'] . "</td></tr>\n" );
+      print( "<td>" . $interface_detail['netmask'] . "</td></tr>\n" );
       print( "<tr><th>Network address:</th>" );
-      print( "<td>" . $node_network_detail['network'] . "</td></tr>\n" );
+      print( "<td>" . $interface_detail['network'] . "</td></tr>\n" );
       print( "<tr><th>Broadcast address:</th>" );
-      print( "<td>" . $node_network_detail['broadcast'] . "</td></tr>\n" );
+      print( "<td>" . $interface_detail['broadcast'] . "</td></tr>\n" );
       print( "<tr><th>DNS 1:</th>" );
-      print( "<td>" . $node_network_detail['dns1'] . "</td></tr>\n" );
+      print( "<td>" . $interface_detail['dns1'] . "</td></tr>\n" );
       print( "<tr><th>DNS 2:</th>" );
-      if( $node_network_detail['dns2'] == "" ) {
+      if( $interface_detail['dns2'] == "" ) {
        print( "<td><i>Optional, missing</i></td></tr>\n" );
       } else {
-       print( "<td>" . $node_network_detail['dns2'] . "</td></tr>\n" );
+       print( "<td>" . $interface_detail['dns2'] . "</td></tr>\n" );
       }
     }
 
   if (method_exists ($api,'GetInterfaceSettings')) {
-    print ("<tr><th colspan=2><a href='node_networks.php?id=$nn_id'>Additional Settings</a></th></tr>\n");
-    $nn_id = $node_network_detail['interface_id'];
+    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)));
     foreach ($settings as $setting) {
       $category=$setting['category'];
index 8dbe20c..41e852d 100644 (file)
@@ -72,7 +72,7 @@ if( $_GET['rem_id'] ) {
   // delete the attribute
   $api->DeleteInterfaceSetting( $setting_id );
 
-  header( "location: node_networks.php?id=$interface_id" );
+  header( "location: interfaces.php?id=$interface_id" );
   exit();
 }
 
@@ -86,7 +86,7 @@ if( $_POST['add_setting'] ) {
   // add it!
   $api->AddInterfaceSetting( $interface_id, $interface_setting_type_id, $value );
 
-  header( "location: node_networks.php?id=$interface_id" );
+  header( "location: interfaces.php?id=$interface_id" );
   exit();
 }
 
@@ -100,7 +100,7 @@ if( $_POST['edit_setting'] ) {
   // update it!
   $api->UpdateInterfaceSetting($setting_id, $value );
 
-  header( "location: node_networks.php?id=$interface_id" );
+  header( "location: interfaces.php?id=$interface_id" );
   exit();
 }