fi
popd
# append our own database creation hacks to the drupal database schema
-drupal_database_dir=/var/www/html/database
-pushd $drupal_database_dir
+pushd /var/www/html/database
if [ ! -f database.pgsql.distrib ] ; then
cp database.pgsql database.pgsql.distrib
cat database.pgsql.distrib ../drupal-hacks/database.pgsql > database.pgsql
fi
popd
+# hack the welcome page for MyPLC
+pushd /var/www/html/modules
+if [ ! -f node.module.distrib ] ; then
+ cp node.module node.module.distrib
+ [ -f /var/www/html/drupal-hacks/node.module ] && cp -f /var/www/html/drupal-hacks/node.module /var/www/html/module/node.module
+fi
+popd
%clean
rm -rf $RPM_BUILD_ROOT
*.plc-warning a:link { text-decoration: none; color:white }
*.plc-warning a:visited { text-decoration: none; color:white }
*.plc-warning a:hover { text-decoration: none; color:black }
+
+.plc-error {
+ background: red;
+}
/* $Id$ */
-table.plc_table
- {
- width: auto;
- padding: 0;
- margin: 0 auto 1.5em auto;
- border-left: 1px solid #C1DAD7;
- border-collapse:collapse;
- }
-th.plc_table
- {
- font: bold 10px/22px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
- color: #4f6b72;
- border-right: 1px solid #C1DAD7;
- border-bottom: 1px solid #C1DAD7;
- border-top: 1px solid #C1DAD7;
- letter-spacing: 1px;
- text-transform: uppercase;
- text-align: left;
- padding: 8px 12px 4px 12px;
- background: #CAE8EA url(/planetlab/icons/tablesort_header.jpg) no-repeat;
- vertical-align:middle;
- }
-td.plc_table
- {
- font: normal 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
- border-right: 1px solid #C1DAD7;
- border-bottom: 1px solid #C1DAD7;
- padding: 6px 12px 6px 12px;
- color: #4f6b72;
- }
+table.plc_table {
+ width: auto;
+ padding: 0;
+ margin: 0 auto 1.5em auto;
+ border-left: 1px solid #C1DAD7;
+ border-collapse:collapse;
+}
+th.plc_table {
+ font: bold 10px/22px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+ color: #4f6b72;
+ border-right: 1px solid #C1DAD7;
+ border-bottom: 1px solid #C1DAD7;
+ border-top: 1px solid #C1DAD7;
+ letter-spacing: 1px;
+ text-transform: uppercase;
+ text-align: left;
+ padding: 8px 12px 4px 12px;
+ background: #CAE8EA url(/planetlab/icons/tablesort_header.jpg) no-repeat;
+ vertical-align:middle;
+}
+td.plc_table {
+ font: normal 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
+ border-right: 1px solid #C1DAD7;
+ border-bottom: 1px solid #C1DAD7;
+ padding: 6px 12px 6px 12px;
+ color: #4f6b72;
+}
th.sortable,
th.sortable-text,
th.sortable-date,
th.sortable-sortImage,
th.sortable-sortFileSize,
th.sortable-sortAlphaNumeric,
-th.sortable-sortEnglishDateTime
-
- {
- cursor:pointer;
- background: #CAE8EA url(/planetlab/icons/tablesort_header_sortable.jpg) no-repeat;
- padding: 8px 12px 4px 16px;
- }
-th.forwardSort
- {
- background:#CAE8EA url(/planetlab/icons/tablesort_header_down.jpg) no-repeat 0 0;
- }
-th.reverseSort
- {
- background:#CAE8EA url(/planetlab/icons/tablesort_header_up.jpg) no-repeat 0 0;
- }
+th.sortable-sortEnglishDateTime {
+ cursor:pointer;
+ background: #CAE8EA url(/planetlab/icons/tablesort_header_sortable.jpg) no-repeat;
+ padding: 8px 12px 4px 16px;
+}
+th.forwardSort {
+ background:#CAE8EA url(/planetlab/icons/tablesort_header_down.jpg) no-repeat 0 0;
+}
+th.reverseSort {
+ background:#CAE8EA url(/planetlab/icons/tablesort_header_up.jpg) no-repeat 0 0;
+}
table thead th.forwardSort a,
-table thead th.reverseSort a
- {
- color:#000;
- text-decoration:none;
- }
+table thead th.reverseSort a {
+ color:#000;
+ text-decoration:none;
+}
/* rows with odd index */
-tr.alt
- {
- background: #F5FAFA;
- color: #797268;
- }
+tr.alt {
+ background: #F5FAFA;
+ color: #797268;
+}
/* sort columns */
/* Poor old Internet Explorer 6 has a bug that means we can't use background images for the table rows
as it trys to download the image each and every time that it is used (which means a 1000 row table
will produce 1000 http requests for the image in question) */
-tr[class="alt"] td
- {
- background: #F5FAFA url(/planetlab/icons/tablesort_td_alt.jpg) no-repeat;
- }
-td.plc_table [class~="alt"]
- {
- background: #edf3f3 url(/planetlab/icons/tablesort_col_alt.jpg) no-repeat !important;
- }
+tr[class="alt"] td {
+ background: #F5FAFA url(/planetlab/icons/tablesort_td_alt.jpg) no-repeat;
+}
+td.plc_table [class~="alt"] {
+ background: #edf3f3 url(/planetlab/icons/tablesort_col_alt.jpg) no-repeat !important;
+}
/* Poor old Internet Explorer won't see the next two rules either as it doesn't get :first-child */
-table.plc_table tbody tr.alt td:first-child
- {
- background: #F5FAFA url(/planetlab/icons/tablesort_bullet2.gif) no-repeat;
- font-weight:bold;
- }
-table.plc_table tbody tr td:first-child
- {
- background: #fff url(/planetlab/icons/tablesort_bullet1.gif) no-repeat;
- font-weight:bold;
- }
+table.plc_table tbody tr.alt td:first-child {
+ background: #F5FAFA url(/planetlab/icons/tablesort_bullet2.gif) no-repeat;
+ font-weight:bold;
+}
+table.plc_table tbody tr td:first-child {
+ background: #fff url(/planetlab/icons/tablesort_bullet1.gif) no-repeat;
+ font-weight:bold;
+}
td.table_flushleft {
text-align:left;
}
/* Pagination list styles */
-ul.fdtablePaginater
- {
- display:table;
- list-style:none;
- padding:0;
- margin:0 auto;
- text-align:center;
- height:1.5em;
- width:auto;
- margin-bottom:1em;
- }
-ul.fdtablePaginater li
- {
- display:table-cell;
- padding-right:4px;
- color:#666;
- list-style:none;
-
- -moz-user-select:none;
- -khtml-user-select:none;
- }
-ul.fdtablePaginater li a.currentPage
- {
- border-color:#a84444 !important;
- color:#000;
- }
-ul.fdtablePaginater li a:active
- {
- border-color:#222 !important;
- color:#222;
- }
+ul.fdtablePaginater {
+ display:table;
+ list-style:none;
+ padding:0;
+ margin:0 auto;
+ text-align:center;
+ height:1.5em;
+ width:auto;
+ margin-bottom:1em;
+}
+ul.fdtablePaginater li {
+ display:table-cell;
+ padding-right:4px;
+ color:#666;
+ list-style:none;
+
+ -moz-user-select:none;
+ -khtml-user-select:none;
+}
+ul.fdtablePaginater li a.currentPage {
+ border-color:#a84444 !important;
+ color:#000;
+}
+ul.fdtablePaginater li a:active {
+ border-color:#222 !important;
+ color:#222;
+}
ul.fdtablePaginater li a,
-ul.fdtablePaginater li div
- {
- display:block;
- width:2em;
- font-size:1em;
- color:#666;
- padding:0;
- margin:0;
- text-decoration:none;
- outline:none;
- border:1px solid #ccc;
- font-family:georgia, serif;
- }
-ul.fdtablePaginater li div
- {
- cursor:normal;
- opacity:.5;
- filter:alpha(opacity=50);
- }
+ul.fdtablePaginater li div {
+ display:block;
+ width:2em;
+ font-size:1em;
+ color:#666;
+ padding:0;
+ margin:0;
+ text-decoration:none;
+ outline:none;
+ border:1px solid #ccc;
+ font-family:georgia, serif;
+}
+ul.fdtablePaginater li div {
+ cursor:normal;
+ opacity:.5;
+ filter:alpha(opacity=50);
+}
ul.fdtablePaginater li a span,
-ul.fdtablePaginater li div span
- {
- display:block;
- line-height:2em;
- border:1px solid #fff;
- background:#fff url(/planetlab/icons/tablesort_gradient.gif) repeat-x 0 -20px;
- }
-ul.fdtablePaginater li a
- {
- cursor:pointer;
- }
-ul.fdtablePaginater li a:focus
- {
- color:#333;
- text-decoration:none;
- border-color:#aaa;
- }
-.fdtablePaginaterWrap
- {
- text-align:center;
- clear:both;
- text-decoration:none;
- }
+ul.fdtablePaginater li div span {
+ display:block;
+ line-height:2em;
+ border:1px solid #fff;
+ background:#fff url(/planetlab/icons/tablesort_gradient.gif) repeat-x 0 -20px;
+}
+ul.fdtablePaginater li a {
+ cursor:pointer;
+}
+ul.fdtablePaginater li a:focus {
+ color:#333;
+ text-decoration:none;
+ border-color:#aaa;
+}
+.fdtablePaginaterWrap {
+ text-align:center;
+ clear:both;
+ text-decoration:none;
+}
ul.fdtablePaginater li .next-page span,
ul.fdtablePaginater li .previous-page span,
ul.fdtablePaginater li .first-page span,
-ul.fdtablePaginater li .last-page span
- {
- font-weight:bold !important;
- }
+ul.fdtablePaginater li .last-page span {
+ font-weight:bold !important;
+}
/* Keep the table columns an equal size during pagination */
-td.sized1
- {
- width:16em;
- text-align:left;
- }
-td.sized2
- {
- width:10em;
- text-align:left;
- }
-td.sized3
- {
- width:7em;
+td.sized1 {
+ width:16em;
+ text-align:left;
+}
+td.sized2 {
+ width:10em;
+ text-align:left;
+}
+td.sized3 {
+ width:7em;
text-align:left;
- }
+}
/*
tfoot td
{
letter-spacing:1px;
}
*/
-#visibleTotal
- {
- text-align:center;
- letter-spacing:auto;
- }
+#visibleTotal {
+ text-align:center;
+ letter-spacing:auto;
+}
* html ul.fdtablePaginater li div span,
-* html ul.fdtablePaginater li div span
- {
- background:#eee;
- }
-tr.invisibleRow
- {
- display:none;
- visibility:hidden;
- }
-p.paginationText
- {
- font-style:oblique;
- }
-p.plc_filter_note
- {
+* html ul.fdtablePaginater li div span {
+ background:#eee;
+}
+tr.invisibleRow {
+ display:none;
+ visibility:hidden;
+}
+p.paginationText {
+ font-style:oblique;
+}
+p.plc_filter_note {
font-style:oblique;
font-size:0.6em;
font-family: georgia;
text-align: center
- }
+}
<!--[if IE]>
<style type="text/css">
--- /dev/null
+<?php
+
+// $Id$
+
+require_once 'plc_functions.php';
+
+// rough implem, no class for now
+
+// start the details area, with an optional caption
+function plc_details_start ($title="") {
+ print "<table><thead>";
+ if ($caption) {
+ printf ("<caption>%s</caption>\n",$caption);
+ }
+ echo "</thead><tbody>";
+}
+
+// end the area
+function plc_details_end() {
+ print "</tbody></table>\n";
+}
+
+// display a line with caption and value
+function plc_details_line ($title,$value) {
+ printf("<tr><th>%s</th><td>%s</td></tr>\n",$title,$value);
+}
+
+// same but the values are multiple and displayed in an embedded vertical table
+function plc_details_line_list($title,$list) {
+ plc_details_line($title,plc_vertical_table($list,"foo"));
+}
+
+// a dummy line for getting some air
+function plc_details_space_line () {
+ echo "<tr><td colspan=2> </td></tr>\n";
+}
+
+?>
return in_array( $site_id, $plc->person['site_ids']);
}
+function plc_my_site_id () {
+ global $plc;
+ return $plc->person['site_ids'][0];
+}
+
//////////////////////////////////////////////////////////// peer & peerscopes
// when shortnames are needed on peers
function plc_peer_get_hash ($api) {
print "</div>\n";
}
-//// standard peerscope syntax
+// interpret standard syntax for peerscope
function plc_peer_info ($api,$peerscope) {
- switch ($_GET['peerscope']) {
+ switch ($peerscope) {
case '':
$peer_filter=array();
$peer_label="all peers";
$peer_label="foreign peers";
break;
default:
- $peer_id=intval($_GET['peerscope']);
- $peer_filter=array("peer_id"=>$peer_id);
- $peer=$api->GetPeers(array("peer_id"=>$peer_id));
- $peer_label='peer "' . $peer[0]['peername'] . '"';
+ if (is_int ($peerscope)) {
+ $peer_id=intval($peerscope);
+ $peers=$api->GetPeers(array("peer_id"=>$peer_id));
+ } else {
+ $peers=$api->GetPeers(array("shortname"=>$peerscope));
+ }
+ if ($peers) {
+ $peer=$peers[0];
+ $peer_id=$peer['peer_id'];
+ $peer_filter=array("peer_id"=>$peer_id);
+ $peer_label='peer "' . $peer['shortname'] . '"';
+ } else {
+ $peer_filter=array();
+ $peer_label="[no such peer " . $peerscope . "]";
+ }
break;
}
return array ($peer_filter,$peer_label);
//////////////////////////////////////////////////////////// links
function href ($url,$text) { return "<a href='" . $url . "'>" . $text . "</a>"; }
-function l_nodes () { return "/db/nodes/newindex.php"; }
+function l_nodes () { return "/db/nodes/index.php"; }
+function l_nodes_site ($site_id) { return "/db/nodes/index.php?site_id=" . $site_id; }
function l_node_u ($node_id) { return "/db/nodes/node.php?id=" . $node_id; }
function l_node ($node_id) { return href (l_node_u($node_id),$node_id); }
function l_node2 ($node_id,$text) { return href (l_node_u($node_id),$text); }
return $result;
}
-function plc_make_table ($class, $messages) {
+function plc_vertical_table ($messages, $class="") {
// pretty print the cell
+ if ( empty( $messages) ) return "";
$formatted = "";
- if (! empty ($messages)) {
- $formatted="<table class='" . $class . "'>";
- foreach ($messages as $message) {
- $formatted .= "<tr><td>" . $message . "</td></tr>";
- }
- $formatted .= "</table>";
+ $formatted .= "<table ";
+ if ($class) $formatted .= "class='" . $class . "'";
+ $formatted .= ">";
+ foreach ($messages as $message) {
+ $formatted .= "<tr><td>" . $message . "</td></tr>";
}
+ $formatted .= "</table>";
return $formatted;
}
////////////////////////////////////////////////////////////
function plc_error ($text) {
// should use the same channel as the php errors..
- print "<div class='plc-warning'> Error " . $text . "</div>";
+ print "<div class='plc-error'> Error " . $text . "</div>";
+}
+
+function plc_errors ($list) {
+ print( "<div class='plc-error'>" );
+ print( "<p style='font-weight:bold'>The following errors occured:</p>" );
+ print("<ul>");
+ foreach( $errors as $err ) {
+ print( "<li>$err</li>\n" );
+ }
+ print( "</ul></div>\n" );
}
function plc_warning ($text) {
<?php
-// $Id: plc_sorts.php 11578 2009-01-16 09:38:48Z thierry $
+// $Id$
// person sort on last name, first name, email
function __cmp_persons($a, $b) {
require_once 'plc_functions.php';
require_once 'plc_sorts.php';
-// find person roles
-$_person= $plc->person;
-$_roles= $_person['role_ids'];
-
// if not a admin, pi, or tech then redirect to node index
-if( !(in_array( 10, $plc->person['role_ids'] ) || in_array( 20, $plc->person['role_ids'] ) || in_array( 40, $plc->person['role_ids'] )) ) {
+// xxx does not take site into account
+$has_privileges=plc_is_admin() || plc_is_pi() || plc_is_tech();
+if( ! $has_privileges) {
header( "index.php" );
- }
-
+}
// this sets up which box is to be checked the first time the page is loaded
$method= $_POST['method'];
-if( $method == "" )
- $method= "static";
+if( $method == "" ) $method= "static";
$model= $_POST['model'];
-if( $model == "" )
- $model= "Custom";
+if( $model == "" ) $model= "Custom";
$submitted = false;
// if submitted validate and add
-if( $_POST['submitted'] )
-{
+if ( $_POST['submitted'] ) {
$submitted = true;
$errors= array();
$static_fields['broadcast']= "Broadcast address";
$static_fields['dns1']= "Primary DNS address";
- if( $method == 'static' )
- {
- foreach( $static_fields as $field => $desc )
- {
- if( trim($_POST[$field]) == "" )
- {
+ if( $method == 'static' ) {
+ foreach( $static_fields as $field => $desc ) {
+ if( trim($_POST[$field]) == "" ) {
$errors[] = "$desc is required";
- }
- elseif( !is_valid_ip(trim($_POST[$field])) )
- {
+ } elseif( !is_valid_ip(trim($_POST[$field])) ) {
$errors[] = "$desc is not a valid address";
}
}
-
- if( !is_valid_network_addr($network,$netmask) )
- {
+
+ if( !is_valid_network_addr($network,$netmask) ) {
$errors[] = "The network address does not coorespond to the netmask";
}
}
-
- if( $hostname == "" )
- {
+
+ if( $hostname == "" ) {
$errors[] = "Hostname is required";
}
-
- if( $ip == "" )
- {
+ if( $ip == "" ) {
$errors[] = "IP is required";
}
-
- if( count($errors) == 0 )
- {
+ if( count($errors) == 0 ) {
$success= 1;
// add new node and its interface
$optional_vals= array( "hostname"=>$hostname, "model"=>$model );
-
- $site_id= $_person['site_ids'][0];
-
+ $site_id= plc_my_site_id();
$node_id= $api->AddNode( intval( $site_id ), $optional_vals );
if ( $api->error() ) {
$errors[] = "Hostname already present or not valid";
$success= 0;
- }
- else
- {
+ } else {
// now, try to add the network.
$optional_vals= array();
$optional_vals['is_primary']= true;
$optional_vals['type']= 'ipv4';
$optional_vals['method']= $method;
- if( $method == 'static' )
- {
-
+ if( $method == 'static' ) {
$optional_vals['gateway']= $gateway;
$optional_vals['network']= $network;
$optional_vals['broadcast']= $broadcast;
// an error on download of the configuration file
}
}
-
}
-
// Print header
require_once 'plc_drupal.php';
drupal_set_title('Nodes');
include 'plc_header.php';
-
?>
<script language="javascript">
-function updateStaticFields()
-{
+function updateStaticFields() {
var is_dhcp= document.fm.method[0].checked;
document.fm.netmask.disabled= is_dhcp;
<?php
-if( $success )
-{
-?>
+if ( $success ) {
+ $link=l_node2($node_id,"here");
+ print <<< EOF
<h2>Node Created</h2>
<p>The node has been successfully added.
<p>View node details and download a configuration
-file <a href="/db/nodes/index.php?id=<?php echo $node_id ?>">here</a>.
-
-<?
-}
-else
-{
-?>
-
+ file $link.
+EOF;
+ } else {
+ print <<< EOF
<h2>Add A New Node</h2>
<p>This page will allow you to add a new machine to your site. This must
a configuration file when complete for this node.
<p>Even for DHCP, you must enter the IP address of the node.
+EOF;
-<?php
-if( count($errors) > 0 )
-{
- print( "<p><strong>The following errors occured:</strong>" );
- print( "<font color='red' size='-1'><ul>\n" );
- foreach( $errors as $err )
- {
- print( "<li>$err\n" );
- }
- print( "</ul></font>\n" );
+if( count($errors) > 0 ) {
+ plc_errors ($errors);
}
$self = $_SERVER['PHP_SELF'];
</table>
-<h3>Network Settings</h3>
+<h3>Interface Settings</h3>
<table width="100%" cellspacing="0" cellpadding="4" border="0">
<?php
-// $Id: index.php 11577 2009-01-16 06:29:51Z thierry $
+// $Id$
// Require login
require_once 'plc_login.php';
require_once 'plc_functions.php';
require_once 'plc_minitabs.php';
require_once 'plc_tables.php';
-
-// tmp
-//require_once 'plc_sorts.php';
-// find person roles
-$_person= $plc->person;
-$_roles= $_person['role_ids'];
+require_once 'plc_details.php';
// --------------------
// recognized URL arguments
$site_name= $site['name'];
$site_node_ids= $site['node_ids'];
+ // hash node_id=>hostname for this site's nodes
$site_node_hash=array();
if( !empty( $site_node_ids ) ) {
// get site node info basics
if( !empty( $slice_ids ) )
$slices= $api->GetSlices( $slice_ids, array( "slice_id", "name" , "peer_id" ) );
- // gets conf file info
- if( !empty( $conf_file_ids ) )
- $conf_files= $api->GetConfFiles( $conf_file_ids );
-
// get interface info
if( !empty( $interface_ids ) )
$interfaces= $api->GetInterfaces( $interface_ids );
if( !empty( $nodegroup_ids ) )
$nodegroups= $api->GetNodeGroups( $nodegroup_ids, array("groupname","tag_type_id","value"));
- // xxx Thierry : disabling call to GetEvents, that gets the session deleted in the DB
- // needs being reworked
-
+ // xxx Thierry : remaining stuff
+ // (*) events: should display the latest events relating to that node.
+ // disabling call to GetEvents, that gets the session deleted in the DB
+ // (*) conf_files: is fetched but not displayed
+ if( !empty( $conf_file_ids ) )
+ $conf_files= $api->GetConfFiles( $conf_file_ids );
+ // (*) idem for PCUs
// gets pcu and port info key to both is $pcu_id
if( !empty( $pcu_ids ) )
$PCUs= $api->GetPCUs( $pcu_ids );
+ //////////////////// display node info
- // display node info
+ // fetches peers and initialize hash peer_id->peer
+ $peer_hash = plc_peer_get_hash ($api);
+ // show gray background on foreign objects : start a <div> with proper class
plc_peer_block_start ($peer_hash,$peer_id);
drupal_set_title("Details for node " . $hostname);
$tabs["Add Interface"]=l_interface_add_u($node_id);
$tabs["Comon"]=l_comon("node_id",$node_id);
$tabs["Events"]=l_event("Node","node",$node_id);
+ }
- $tabs["All nodes"]=l_nodes();
+ $tabs["All nodes"]=l_nodes();
- plc_tabs($tabs);
+ plc_tabs($tabs);
- }
-
echo "<hr />";
- echo "<table><tbody>\n";
- echo "<tr><th>Hostname: </th><td> $hostname </td></tr>\n";
- echo "<tr><th>Type: </th><td> $node_type</td></tr>\n";
- echo "<tr><th>Model: </th><td> $model</td></tr>\n";
- echo "<tr><th>Version: </th><td> $version</td></tr>\n";
-
+ plc_details_start ();
+ plc_details_line("Hostname",$hostname);
+ plc_details_line("Type",$node_type);
+ plc_details_line("Model",$model);
+ plc_details_line("Version",$version);
+
+ // no tool to implement this multiple-choice setting yet
+ // xxx would need at least to use the proper class, like plc_details_class() or something
echo "<tr><th>Boot State: </th><td>";
if ($peer_id) {
echo $boot_state;
echo ">$val</option>\n";
}
-
echo "</select></input></form>";
}
echo "</td></tr>\n";
+ // same here for the download area
if ( ! $peer_id && $extra_privileges) {
echo "<tr><th>Download </th><td>";
}
// site info and all site nodes
- echo "<tr><td colspan=2> </td></tr>\n";
- echo "<tr><th>Site: </th><td> <a href='/db/sites/index.php?id=$site_id'>$site_name</a></td></tr>\n";
- echo "<tr><th>All site nodes: </th><td>";
- if (empty($site_node_hash)) {
- echo "<span class='plc-warning'>Site has no node</span>";
- } else {
- foreach( $site_node_hash as $key => $val ) {
- echo "<a href=index.php?id=$key>$val</a><br />";
- }
+ plc_details_space_line ();
+ plc_details_line("Site",l_site2($site_id,$site_name));
+
+ // build list of node links
+ $nodes_area=array();
+ foreach ($site_node_hash as $hash_node_id => $hash_hostname) {
+ $nodes_area []= l_node2($hash_node_id,$hash_hostname);
}
- echo "</td></tr>\n";
+ plc_details_line_list ("All site nodes",$nodes_area);
+
+ plc_details_end ();
- echo "</tbody></table><br />\n";
-
//////////////////////////////////////////////////////////// interfaces
if ( ! $peer_id ) {
//////////////////////////////////////////////////////////// slices
// display slices
- $peer_hash = plc_peer_get_hash ($api);
print "<hr/>\n";
plc_table_title ("Slices");
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) {
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) {
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
$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.";
}
// --- decoration
$title="Nodes";
-$tabs["Logout"]=array('url'=>l_logout(),
- 'bubble'=>'Logout ' . $plc->person['email']);
-
+$tabs=array();
+$mysite_id=plc_my_site_id();
+$tabs['My nodes'] = array('url'=>l_nodes(),
+ 'values'=>array('site_id'=>plc_my_site_id()),
+ 'bubble'=>'Lists nodes on site ' . $mysite_id);
// --------------------
$peer_filter=array();
$node_filter=array();
$messages [] = "No interface";
}
}
- return plc_make_table('plc-warning',$messages);
+ return plc_vertical_table($messages,'plc-warning');
}
-// fetch nodes - set pattern in the url for server-side filtering
+// fetch nodes
$node_columns=array('hostname','node_type','site_id','node_id','boot_state','interface_ids','peer_id');
+// server-side filtering - set pattern in $_GET for filtering on hostname
if ($pattern) {
$node_filter['hostname']=$pattern;
$title .= " matching " . $pattern;
plc_table_end();
plc_table_notes();
-?>
+// Print footer
+include 'plc_footer.php';
+
+?>
// cleanup $person columns
unset ($person['slice_ids']);
//display the extra status column
- $person['status'] = plc_make_table($class,$messages);
+ $person['status'] = plc_vertical_table($messages,$class);
return $person;
}
unset ($site['max_slices']);
unset ($site['slice_ids']);
unset ($site['node_ids']);
- $site['sanity check'] = plc_make_table($class,$messages);
+ $site['sanity check'] = plc_vertical_table($messages,$class);
return $site;
}
<?php
- // Require login
+// Require login
require_once 'plc_login.php';
// Get session and API handles
$sitemembers_nodes= array();
$nodes_ids=array();
$site_up=array();
-function layout(&$param){
+function layout(&$param) {
$class='plc-foreign';
$messages=array();
$messages[]=$temp;
echo $new_site;
//unset ($param['time']);
- $param[$j]['abbreviated_name']=plc_make_table($class,$messages);
+ $param[$j]['abbreviated_name']=plc_vertical_table($messages,$class);
$j++;
}