+ $table->start();
+ foreach ($nodes as $node) {
+ $table->row_start();
+ if ($display_pcus) {
+ // $table->cell(display_and_mark($pcu_hash,$node['pcu_ids'],$node['ports']));
+ $table->cell(display_and_mark($node['pcu_ids'],$node['ports']));
+ }
+ $table->cell (l_node_obj($node));
+ $table->cell ($node['boot_state']);
+ $table->row_end();
+ }
+ // show undisplayed PCU's if any
+ if ($display_pcus)
+ if ($pcu_hash) foreach ($pcu_hash as $id=>$pcu) {
+ if (!$pcu['displayed']) {
+ $table->row_start();
+ $table->cell($pcu['hostname']); $table->cell(''); $table->cell('');
+ $table->row_end();
+ }
+ }
+
+ $table->tfoot_start();
+ $table->row_start();
+ $button=new PlekitFormButton (l_node_add(),"node_add","Add node","POST");
+ $table->cell($button->html(),array('hfill'=>true,'align'=>'right'));
+ $table->row_end();
+ $table->end();
+ $toggle->end();
+
+ //////////////////// Users
+ $persons_title = "Users : ";
+ $persons_title .= count($person_ids) . " total";
+ $persons_title .= " / " . count ($pis) . " PIs";
+ $persons_title .= " / " . count ($techs) . " Techs";
+ if ($has_disabled_persons)
+ $persons_title .= " / " . count($disabled_persons) . " Disabled";
+ if ( (count ($pis) == 0) || (count ($techs) == 0) || (count($person_ids) >= 30) || count($disabled_persons) != 0 )
+ $persons_title = plc_warning_html ($persons_title);
+ $persons_title .= href(l_persons_site($site_id)," (See as users)");
+
+ $toggle=new PlekitToggle ('persons',$persons_title,
+ array('visible'=>get_arg('show_persons')));
+ $toggle->start();
+
+ $headers = array ();
+ $headers["email"]='string';
+ $headers["S"]='int';
+ $headers["PI"]='string';
+ $headers['User']='string';
+ $headers["Tech"]='string';
+ if ($has_disabled_persons) $headers["Disabled"]='string';
+ $notes=array('S = slices');
+ $table=new PlekitTable('persons',$headers,'1r-3r-0',array('search_area'=>false,
+ 'notes'=>$notes,
+ 'pagesize_area'=>false));
+ $table->start();
+ if ($persons) foreach ($persons as $person) {
+ $table->row_start();
+ $table->cell(l_person_obj($person));
+ $table->cell(count($person['slice_ids']));
+ $table->cell( in_array ('20',$person['role_ids']) ? "yes" : "no");
+ $table->cell( in_array ('30',$person['role_ids']) ? "yes" : "no");
+ $table->cell( in_array ('40',$person['role_ids']) ? "yes" : "no");
+ if ($has_disabled_persons) $table->cell( $person['enabled'] ? "no" : plc_warning_html("yes"));
+ $table->row_end();
+ }
+ $table->end();
+ $toggle->end();
+
+ //////////////////// Slices
+ $slices_title="Slices : ";
+ $slices_title .= $max_slices . " max";
+ $slices_title .= " / " . count($slice_ids) . " running";
+ $slices_title .= " / $slivers_count slivers";
+ if (count($slice_ids) >= $max_slices)
+ $slices_title = plc_warning_html($slices_title);
+ $slices_title .= href(l_slices_site($site_id)," (See as slices)");
+
+ $toggle=new PlekitToggle ('slices',$slices_title,
+ array('visible'=>get_arg('show_slices')));
+ $toggle->start();
+
+ $headers = array ();
+ $headers ['name']='string';
+ $headers ['I'] = 'string';
+ $headers ['N']='int';
+ $headers ['U']='int';
+ $notes=array('I = instantiation type',
+ 'N = number of nodes',
+ 'U = number of users');
+ $table=new PlekitTable ('slices',$headers,0,array('search_area'=>false,
+ 'pagesize_area'=>false,
+ 'notes'=>$notes));
+
+ $table->start();
+ if ($slices) foreach ($slices as $slice) {
+ $table->row_start();
+ $table->cell(l_slice_obj($slice));
+ $table->cell(instantiation_label($slice));
+ $table->cell (href(l_nodes_slice($slice['slice_id']),count($slice['node_ids'])));
+ $table->cell (count($slice['person_ids']));
+ $table->row_end();
+ }
+ if ($is_site_pi) {
+ $button=new PlekitFormButton (l_slice_add(),"slice_add","Add slice","post");
+ $table->tfoot_start();
+ $table->row_start();
+ $table->cell($button->html(),array('hfill'=>true,'align'=>'right'));
+ }
+
+ $table->end();
+ $toggle->end();
+
+ $form=new PlekitForm (l_actions(), array('site_id'=>$site_id));
+ $form->start();
+ //////////////////////////////////////////////////////////// Tags
+ // tags section
+ // already inside a if ( $local_peer )...
+
+ $tags=$api->GetSiteTags (array('site_id'=>$site_id));
+ function get_tagname ($tag) { return $tag['tagname'];}
+ // xxx looks like tech-only see an error here,
+ // might be that GetSiteTags is not accessible or something
+ $tagnames = array_map ("get_tagname",$tags);
+
+ $toggle = new PlekitToggle ('tags',count_english($tags,'tag'),
+ array('bubble'=>'Inspect and set tags on that site',
+ 'visible'=>get_arg('show_tags')));
+ $toggle->start();
+
+ $headers=array("Name"=>"string",
+ "Value"=>"string",
+ );
+ if (plc_is_admin()) $headers[plc_delete_icon()]="none";
+
+ $table_options=array("notes_area"=>false,"pagesize_area"=>false,"search_width"=>10);
+ $table=new PlekitTable("site_tags",$headers,0,$table_options);
+ $table->start();
+ if ($tags) foreach ($tags as $tag) {
+ $table->row_start();
+ $table->cell(l_tag_obj($tag));
+ $table->cell($tag['value']);
+ // the remove checkbox
+ if (plc_is_admin()) $table->cell ($form->checkbox_html('site_tag_ids[]',$tag['site_tag_id']));
+ $table->row_end();
+ }
+
+ if ($is_site_pi || $is_site_admin) {
+ $table->tfoot_start();
+
+ // remove tag
+ $table->row_start();
+ $table->cell($form->submit_html("delete-site-tags","Remove Tags"),
+ // use the whole columns and right adjust
+ array('hfill'=>true,'align'=>'right'));
+ $table->row_end();
+
+ // set tag area
+ $table->row_start();
+ // get list of tag names in the site/* category
+ $all_tags= $api->GetTagTypes( array ("category"=>"site*","-SORT"=>"tagname"), array("tagname","tag_type_id"));
+ // xxx cannot use onchange=submit() - would need to somehow pass action name
+ function tag_selector ($tag) { return array("display"=>$tag['tagname'],"value"=>$tag['tag_type_id']); }
+ $selector=array_map("tag_selector",$all_tags);
+ $table->cell($form->select_html("tag_type_id",$selector,array('label'=>"Choose")));
+ $table->cell($form->text_html("value","",array('width'=>8)));
+ $table->cell($form->submit_html("set-tag-on-site","Set Tag"),array('columns'=>2,'align'=>'left'));
+ $table->row_end();
+ }
+
+ $table->end();
+ $toggle->end();
+ $form->end();
+
+ //////////////////// Addresses
+ $toggle=new PlekitToggle ('addresses',"Addresses",
+ array('visible'=>get_arg('show_addresses')));
+ $toggle->start();
+ if ( ! $addresses) {
+ print "<p class='addresses'>No known address for this site</p>";
+ } else {
+ $details=new PlekitDetails (false);
+ $details->start();
+ $details->th_td("Addresses","");
+ foreach ($addresses as $address) {
+ $details->th_td(plc_vertical_table($address['address_types']),
+ plc_vertical_table(array($address['line1'],
+ $address['line2'],
+ $address['line3'],
+ $address['city'],
+ $address['state'],
+ $address['postalcode'],
+ $address['country'])));
+ }
+ $details->end();
+ }
+ $toggle->end();