keep the explicit setting of memory_limit only in 3 pages
[plewww.git] / planetlab / nodes / nodes.php
index 872b5ee..8a858b7 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 
-// $Id$
-
 // Require login
 require_once 'plc_login.php';
 
@@ -30,7 +28,6 @@ drupal_set_html_head('
 ');
 
 
-ini_set("memory_limit","64M");
 //error_reporting(0);
 
 // -------------------- 
@@ -73,8 +70,6 @@ function node_status ($node) {
 }
 
 
-$first_time_configuration = false;
-
 if (plc_is_admin()) 
        $default_configuration = "ID:f|hostname:f|ST:f|AU:f|RES:f";
 else
@@ -84,7 +79,6 @@ else
 $column_configuration = "";
 $slice_column_configuration = "";
 $show_configuration = "";
-$show_columns_message = '1';
 
 
 $PersonTags=$api->GetPersonTags (array('person_id'=>$plc->person['person_id']));
@@ -107,7 +101,6 @@ foreach ($PersonTags as $ptag) {
 $nodesconf_exists = false;
 if ($column_configuration == "")
 {
-        $first_time_configuration = true;
         $column_configuration = "nodes;default";
         $nodesconf_exists = true;
 }
@@ -175,22 +168,27 @@ $extra_columns[]=array('tagname'=>'deployment', 'header'=>'DL', 'source'=>'myplc
 //CoMon Live data
 //NOTE: Uncomment these lines if CoMon provides information for your nodes
 
-//$extra_columns[]=array('tagname'=>'bwlimit', 'header'=>'BW', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Bandwidth limit', 'fetched'=>false);
-//$extra_columns[]=array('tagname'=>'numcores', 'header'=>'CC', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Number of CPU Cores', 'fetched'=>false);
-//$extra_columns[]=array('tagname'=>'cpuspeed', 'header'=>'CR', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'CPU clock rate', 'fetched'=>false);
-//$extra_columns[]=array('tagname'=>'disksize', 'header'=>'DS', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Disk size', 'fetched'=>false);
-//$extra_columns[]=array('tagname'=>'gbfree', 'header'=>'DF', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Currently available disk space', 'fetched'=>false);
-//$extra_columns[]=array('tagname'=>'memsize', 'header'=>'MS', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Memory size', 'fetched'=>false);
-//$extra_columns[]=array('tagname'=>'numslices', 'header'=>'SM', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Number of slices in memory', 'fetched'=>false);
-//$extra_columns[]=array('tagname'=>'uptime', 'header'=>'UT', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Continuous uptime until now', 'fetched'=>false);
+if (MYSLICE_COMON_AVAILABLE)
+{
+$extra_columns[]=array('tagname'=>'bwlimit', 'header'=>'BW', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Bandwidth limit', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'numcores', 'header'=>'CC', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Number of CPU Cores', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'cpuspeed', 'header'=>'CR', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'CPU clock rate', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'disksize', 'header'=>'DS', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Disk size', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'gbfree', 'header'=>'DF', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Currently available disk space', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'memsize', 'header'=>'MS', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Memory size', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'numslices', 'header'=>'SM', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Number of slices in memory', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'uptime', 'header'=>'UT', 'source'=>'comon', 'type'=>'sortAlphaNumericTop', 'title'=>'Continuous uptime until now', 'fetched'=>false);
+}
 
 //TopHat Live data
-//NOTE: Uncomment these lines if TopHat provides information for your nodes
-//$extra_columns[]=array('tagname'=>'asn', 'header'=>'AS', 'source'=>'tophat', 'type'=>'string', 'title'=>'AS Number', 'fetched'=>false);
-//$extra_columns[]=array('tagname'=>'city', 'header'=>'LCY', 'source'=>'tophat', 'type'=>'string', 'title'=>'City', 'fetched'=>false);
-//$extra_columns[]=array('tagname'=>'region', 'header'=>'LRN', 'source'=>'tophat', 'type'=>'string', 'title'=>'Region', 'fetched'=>false);
-//$extra_columns[]=array('tagname'=>'country', 'header'=>'LCN', 'source'=>'tophat', 'type'=>'string', 'title'=>'Country', 'fetched'=>false);
-//$extra_columns[]=array('tagname'=>'continent', 'header'=>'LCT', 'source'=>'tophat', 'type'=>'string', 'title'=>'Continent', 'fetched'=>false);
+
+if (MYSLICE_TOPHAT_AVAILABLE)
+{
+$extra_columns[]=array('tagname'=>'asn', 'header'=>'AS', 'source'=>'tophat', 'type'=>'string', 'title'=>'AS Number', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'city', 'header'=>'LCY', 'source'=>'tophat', 'type'=>'string', 'title'=>'City', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'region', 'header'=>'LRN', 'source'=>'tophat', 'type'=>'string', 'title'=>'Region', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'country', 'header'=>'LCN', 'source'=>'tophat', 'type'=>'string', 'title'=>'Country', 'fetched'=>false);
+$extra_columns[]=array('tagname'=>'continent', 'header'=>'LCT', 'source'=>'tophat', 'type'=>'string', 'title'=>'Continent', 'fetched'=>false);
 //$extra_columns[]=array('tagname'=>'hopcount', 'header'=>'HC', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Hop count from reference node', 'fetched'=>false);
 ////$extra_columns[]=array('tagname'=>'rtt', 'header'=>'RTT', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Round trip time from reference node', 'fetched'=>false);
 ////$extra_columns[]=array('tagname'=>'agents', 'header'=>'MA', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Co-located measurement agents', 'fetched'=>true);
@@ -198,6 +196,7 @@ $extra_columns[]=array('tagname'=>'deployment', 'header'=>'DL', 'source'=>'myplc
 ////$extra_columns[]=array('tagname'=>'agents_etomic', 'header'=>'MAE', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Co-located ETOMIC agents', 'fetched'=>true);
 ////$extra_columns[]=array('tagname'=>'agents_tdmi', 'header'=>'MAT', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Co-located TDMI agents', 'fetched'=>true);
 ////$extra_columns[]=array('tagname'=>'agents_dimes', 'header'=>'MAD', 'source'=>'tophat', 'type'=>'sortAlphaNumericTop', 'title'=>'Co-located DIMES agents', 'fetched'=>true);
+}
 
 
 $ConfigureColumns =new PlekitColumns($full_configuration, $fix_columns, $tag_columns, $extra_columns);
@@ -271,10 +270,11 @@ $nodes=$api->GetNodes($node_filter,$node_columns);
 
 $ConfigureColumns->fetch_live_data($nodes);
 
+$show_columns_message = TRUE;
 $show_conf = explode(";",$show_configuration);
 foreach ($show_conf as $ss) {
-        if ($ss =="columns")
-                $show_columns_message = '0';
+  if ($ss =="columns")
+    $show_columns_message = FALSE;
 }
 
 
@@ -315,37 +315,10 @@ if ( ! $nodes ) {
   
 $nifty=new PlekitNifty ('','objects-list','big');
 $nifty->start();
-$headers = array (); $offset=0;
+$headers = array (); 
 $notes=array();
 $notes [] = "For information about the different columns please see the <b>node table layout</b> tab above or <b>mouse over</b> the column headers";
 
-
-/*
-// fixed columns
-if (plc_is_admin()) { 
-  $short="I"; $long="node_id"; $type='int'; 
-       $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long";
-  $offset=1; 
- }
-$short="P"; $long="Peer"; $type='string'; 
-       $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long";
-$short="D"; $long="toplevel domain name"; $type='string'; 
-       $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long";
-$headers["Site"]="string";
-$headers["Hostname"]="string";
-$short="IP"; $long="IP Address"; $type='sortIPAddress'; 
-       $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long";
-$short="ST"; $long=Node::status_footnote(); $type='string'; 
-       $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long";
-$short="SL"; $long="Number of slivers"; $type='int'; 
-       $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long";
-
-$headers=array_merge($headers,$visibletags->headers());
-$notes=array_merge($notes,$visibletags->notes());
-$short="?"; $long="extra status info"; $type='string'; 
-       $headers[$short]=array('type'=>$type,'title'=>$long); $notes []= "$short = $long";
-*/
-
 $info_header = array();
 $short="?"; $long="extra status info"; $type='string'; 
 $info_header[$short]=array('type'=>$type,'title'=>$long, 'label'=>'?', 'header'=>'?', 'visible'=>true); 
@@ -353,14 +326,21 @@ $info_header[$short]=array('type'=>$type,'title'=>$long, 'label'=>'?', 'header'=
 //$info_header["?"] = "none";
 $headers = array_merge($ConfigureColumns->get_headers(),$info_header);
 
-if ($first_time_configuration)
-$column_conf_visible = '1';
-else
-$column_conf_visible = '0';
-
-$toggle_nodes=new PlekitToggle('nodes-column-configuration',
+$layout_help='
+This tab allows you to customize the columns in the node tables,
+below. Information on the nodes comes from a variety of monitoring
+sources. If you, as either a user or a provider of monitoring data,
+would like to see additional columns made available, please send us
+your request in mail to <a
+href="mailto:support@myslice.info">support@myslice.info</a>.  You can
+find more information about the MySlice project at <a
+href="http://trac.myslice.info">http://trac.myslice.info</a>.
+';
+$toggle_nodes=new PlekitToggle('nodes-layout',
                                "Node table layout",
-                               array('visible'=>$column_conf_visible, 'info_div'=>'note_columns_div'));
+                               array('visible'=>NULL, 
+                                    'info-text'=>$layout_help,
+                                    'info-visible'=>$show_columns_message));
 $toggle_nodes->start();
 print("<div id='debug'></div>");
 print("<input type='hidden' id='slice_id' value='nodes' />");
@@ -372,20 +352,7 @@ print("<input type='hidden' id='column_configuration' value='".$slice_column_con
 print("<br><input type='hidden' size=80 id='full_column_configuration' value='".$column_configuration."' />");
 print("<input type='hidden' id='defaultConf' value='".$default_configuration."'></input>");
 
-if ($show_columns_message == '0')
-$note_display = "display:none;";
-else
-$note_display = "";
-
-
-print <<<EOF
-<div class="note-div" id='note_columns_div' style='$note_display'>
-<table class='center'><tr><td class='top'>
-This tab allows you to customize the columns in the node tables, below. Information on the nodes comes from a variety of monitoring sources. If you, as either a user or a provider of monitoring data, would like to see additional columns made available, please send us your request in mail to <a href="mailto:support@myslice.info">support@myslice.info</a>. You can find more information about the MySlice project at <a href="http://trac.myslice.info">http://trac.myslice.info</a>.
-</td><td class='top'><span onClick=closeMessage('columns')><img class='reset' src="/planetlab/icons/clear.png" alt="hide message permanently"></span>
-</td></tr></table>
-</div>
-EOF;
+////////// end
 
 $ConfigureColumns->configuration_panel_html(true);
 $ConfigureColumns->javascript_init();
@@ -397,7 +364,7 @@ $table_options = array('notes'=>$notes,
                         'configurable'=>true);
 
 # initial sort on hostnames
-$table=new PlekitTable ("nodes",$headers,3+$offset, $table_options);
+$table=new PlekitTable ("nodes",$headers,2, $table_options);
 $table->start();
 
 $peers = new Peers ($api);