// Print header
require_once 'plc_drupal.php';
-// set default
+// set default
drupal_set_title('DB Search');
-include 'plc_header.php';
+include 'plc_header.php';
// Common functions
require_once 'plc_functions.php';
////////////////////
-// from a single search form, extract all tokens entered
+// from a single search form, extract all tokens entered
// and then show all entities that match one of that tokens among
// persons - sites - slices - nodes
////////////////////
$toggle->start();
print <<< EOF
<p id='admin-search-message'>
-This form searches for <span class="bold">any entry</span> in the database
-(among <span class="bold">persons</span>, <span class="bold">slices</span>,
-<span class="bold">sites</span> and <span class="bold">nodes</span>)
+This form searches for <span class="bold">any entry</span> in the database
+(among <span class="bold">persons</span>, <span class="bold">slices</span>,
+<span class="bold">sites</span> and <span class="bold">nodes</span>)
matching a name fragment, or token. <br/>
-You can specify a space-separated list of tokens, all entries matching
+You can specify a space-separated list of tokens, all entries matching
<span class="bold">any token</span> would then get listed.
</p>
EOF;
// then, e.g. on slice, $key='site_id' & $plural=false
// or, e.g. on person, $key='site_ids' & $plural=true
function generic_gather_related ($objects, $key, $plural) {
- if ( empty ($objects))
+ if ( empty ($objects))
return array();
// else, look for either 'site_id' or 'site_ids' in the first object
$sample=$objects[0];
}
}
-//////////
+//////////
// create link from an id, using the various global hashes
function plc_person_link ($person_id) {global $persons_hash; return l_person_obj($persons_hash[$person_id]);}
function plc_slice_link ($slice_id) {global $slices_hash; return l_slice_obj($slices_hash[$slice_id]);}
function display_persons ($persons,$visible) {
if ( ! $persons) return;
-
+
$toggle=new PlekitToggle('persons-area',"Persons",array('visible'=>$visible));
$toggle->start();
$table=new PlekitTable('persons',$headers,1,$table_options);
$table->start();
foreach ($persons as $person) {
- $table->row_start();
+ $table->row_start();
$table->cell($person['person_id']);
$peers->cell($table,$person['peer_id']);
$table->cell(l_person_obj($person));
function display_slices ($slices,$visible) {
if ( ! $slices) return;
-
+
$toggle=new PlekitToggle('slices-area',"Slices",array('visible'=>$visible));
$toggle->start();
$table=new PlekitTable('slices',$headers,1,$table_options);
$table->start();
foreach ($slices as $slice) {
- $table->row_start();
+ $table->row_start();
$table->cell($slice['slice_id']);
$peers->cell($table,$slice['peer_id']);
$table->cell(l_slice_obj($slice));
function display_sites ($sites,$visible) {
if ( ! $sites) return;
-
+
$toggle=new PlekitToggle('sites-area',"Sites",array('visible'=>$visible));
$toggle->start();
$table=new PlekitTable('sites',$headers,1,$table_options);
$table->start();
foreach ($sites as $site) {
- $table->row_start();
+ $table->row_start();
$table->cell($site['site_id']);
$peers->cell($table,$site['peer_id']);
$table->cell(l_site_obj($site));
function display_nodes ($nodes,$visible) {
if ( ! $nodes) return;
-
+
$toggle=new PlekitToggle('nodes-area',"Nodes",array('visible'=>$visible));
$toggle->start();
$table=new PlekitTable('nodes',$headers,1,$table_options);
$table->start();
foreach ($nodes as $node) {
- $table->row_start();
+ $table->row_start();
$table->cell($node['node_id']);
$peers->cell($table,$node['peer_id']);
$table->cell(l_node_obj($node));
} else {
$visible=false;
}
-
- ////////// collect all related objects
+
+ ////////// collect all related objects
$rel_person_ids = array();
$rel_person_ids = array_merge($rel_person_ids, generic_gather_related ($sites,'person_ids',true));
$rel_person_ids = array_merge($rel_person_ids, generic_gather_related ($slices,'person_ids',true));
require_once 'table.php';
require_once 'linetabs.php';
require_once 'datepicker.php';
-
+
// needs much memory
ini_set("memory_limit","256M");
drupal_set_title('Events');
// as per index.php, we get here if _GET['type'] is set
-$type=$_GET['type'];
-$from_date=$_GET['from_date'];
-$until_date=$_GET['until_date'];
+$type = $_GET['type'];
+$from_date = $_GET['from_date'];
+$until_date = $_GET['until_date'];
$messages=array();
} else {
$date="now"; $time=strtotime($date);
}
-
+
} else {
// user-provided string
list ($year,$month,$day) = preg_split ('/[\/\.\-]/',$user_date);
}
function e_auth ($event) {
- if (array_key_exists('auth_type',$event))
+ if (array_key_exists('auth_type',$event))
return $event['auth_type'];
else
return "";
//////////////////////////////////////// Events
if ($type == 'Event') {
-
+
// and the filter applied for fetching events using GetEvent
$user_desc=$_GET['event'];
if ( ! empty($user_desc)) {
// should parse stuff like 45-90,230-3000 - some other day
$filter['event_id']=intval($user_desc);
}
-
- $events = $api->GetEvents($filter);
+
+ $events = $api->GetEvents($filter);
$title="Events [ $from_string - $until_string] matching " . ($user_desc ? $user_desc : "everything");
-
+
// see actual display of $title and $events below
-
+
} else {
-
+
switch ($type) {
- case 'Person':
+ case 'Person':
$primary_key='person_id';
$string_key='email';
$user_input=$_GET['person'];
$object_type='Person';
break;
- case 'Node':
+ case 'Node':
$primary_key='node_id';
$string_key='hostname';
$user_input=$_GET['node'];
$method="GetNodes";
$object_type='Node';
break;
-
- case 'Site':
+
+ case 'Site':
$primary_key='site_id';
$string_key='login_base';
$user_input=$_GET['site'];
$object_type='Site';
break;
- case 'Slice':
+ case 'Slice':
$primary_key='slice_id';
$string_key='name';
$user_input=$_GET['slice'];
$title .= " type=$object_type";
$title .= " id(s)=";
foreach ( explode(",",$user_input) as $user_desc) {
-# numeric
+# numeric
if (my_is_int($user_desc)) {
$obj_check = call_user_func(array($api,$method),array(intval($user_desc)),array($primary_key));
if (empty ($obj_check)) {
drupal_set_title ($title);
// Show messages
-if (!empty($messages))
- foreach ($messages as $line)
+if (!empty($messages))
+ foreach ($messages as $line)
drupal_set_message($line);
$headers=array("Id"=>"int",
$table->set_options (array ('max_pages'=>20));
$table->start ();
foreach ($events as $event) {
-
+
// the call button
$message = htmlentities($event['message'], ENT_QUOTES);
$call = htmlentities($event['call'], ENT_QUOTES);
$text = sprintf("message=<<%s>>\\n\\ncall=<<%s>>\\n\\nruntime=<<%f>>\\n",$message,$call,$event['runtime']);
$method = "<input type=button name='call' value='" . $event['call_name'] ."' onclick='alert(\"" . $text . "\")'";
// $method = sprintf('<span title="%s">%s</span>',$call,$method);
-
+
// the message button
$trunc_mess=htmlentities(truncate($event['message'],40),ENT_QUOTES);
$message="<input type=button name='message' value='" . $trunc_mess ."' onclick='alert(\"" . $text . "\")'";
$details="<input type=button name='message' value='+' onclick='alert(\"" . $text . "\")'";
// $message=sprintf('<span title="%s">%s</span>',$message,$message);
-
+
$message=truncate($event['message'],40);
$table->row_start();
$table->cell(e_event($event['event_id']));
$table->set_options(array('notes'=>array("The R column shows the call result value, a.k.a. fault_code",
"Click the button in the D(etails) column to get more details")));
$table->end();
-
+
//plekit_linetabs ($tabs,"bottom");
// Print footer
return $plc->person['person_id'];
}
-//////////////////////////////////////////////////////////// links
+//////////////////////////////////////////////////////////// links
function href ($url,$text) { return "<a href='" . $url . "'>" . $text . "</a>"; }
// naming scheme is
function l_interface ($interface_id) { return "/db/nodes/interface.php?id=$interface_id"; }
function l_interface_tags($interface_id){ return "/db/nodes/interface.php?id=$interface_id&show_tags=1"; }
-function l_interface_t ($interface_id,$text) {
+function l_interface_t ($interface_id,$text) {
return href (l_interface($interface_id),$text); }
function l_interface_add($node_id) { return "/db/nodes/interface.php?node_id=$node_id"; }
function l_slice_obj ($slice) { return l_slice_t ($slice['slice_id'],$slice['name']); }
function l_sliver ($node_id,$slice_id) { return "/db/nodes/slivers.php?node_id=$node_id&slice_id=$slice_id"; }
-function l_sliver_t ($node_id,$slice_id,$text) {
+function l_sliver_t ($node_id,$slice_id,$text) {
return href (l_sliver($node_id,$slice_id),$text) ; }
function l_persons () { return "/db/persons/index.php&active_line_tab=All Accounts"; }
function l_nodegroups () { return "/db/tags/nodegroups.php"; }
function l_nodegroup ($nodegroup_id) { return "/db/tags/nodegroup.php?id=$nodegroup_id"; }
-function l_nodegroup_t ($nodegroup_id,$text) {
+function l_nodegroup_t ($nodegroup_id,$text) {
return href(l_nodegroup($nodegroup_id),$text); }
-function l_nodegroup_obj ($nodegroup) {
+function l_nodegroup_obj ($nodegroup) {
return href(l_nodegroup($nodegroup['nodegroup_id']),$nodegroup['groupname']); }
function l_events () { return "/db/events/index.php"; }
//////////////////////////////////////////////////////////// nav tabs
-function tab_nodes () { return array ('label'=>'All nodes','url'=>l_nodes(),
+function tab_nodes () { return array ('label'=>'All nodes','url'=>l_nodes(),
'bubble'=>'Display nodes from all peers'); }
-function tab_nodes_local () { return array ('label'=>'Local nodes', 'url'=>l_nodes_peer('local'),
+function tab_nodes_local () { return array ('label'=>'Local nodes', 'url'=>l_nodes_peer('local'),
'bubble'=>'Display all nodes local to this peer'); }
-function tab_nodes_site($site_id){ return array ('label'=>'Site nodes', 'url'=>l_nodes_site($site_id),
+function tab_nodes_site($site_id){ return array ('label'=>'Site nodes', 'url'=>l_nodes_site($site_id),
'bubble'=>'Display nodes on that site'); }
-function tab_nodes_slice($slice_id){ return array ('label'=>'Slice nodes', 'url'=>l_nodes_slice($slice_id),
+function tab_nodes_slice($slice_id){ return array ('label'=>'Slice nodes', 'url'=>l_nodes_slice($slice_id),
'bubble'=>'Display nodes for that slice'); }
-function tab_nodes_mysite () { return array ('label'=>'My site nodes', 'url'=>l_nodes_my_site(),
+function tab_nodes_mysite () { return array ('label'=>'My site nodes', 'url'=>l_nodes_my_site(),
'bubble'=>'Display nodes on my site'); }
function tab_nodes_all_mysite (){ return array ('label'=>'All My site nodes', 'url'=>l_nodes_all_my_site(),
'bubble'=>'Display nodes on all my sites'); }
function tab_mysite() { return array ('label'=>'My site', 'url'=>l_site(plc_my_site_id()),
'bubble'=>'Details for site ' . plc_my_site_id()); }
function tab_sites () { return array ('label'=>'All sites' , 'url'=>l_sites(), 'bubble'=> 'Display all sites'); }
-function tab_sites_local () { return array ('label'=>'Local sites' , 'url'=>l_sites_peer('local'),
+function tab_sites_local () { return array ('label'=>'Local sites' , 'url'=>l_sites_peer('local'),
'bubble'=> 'Display all siteslocal to this peer'); }
//////////
function tab_slices() { return array ('label'=>'All slices', 'url'=>l_slices(),
'bubble' => 'Display all slices'); }
function tab_slices_person() { return array ('label'=>'My slices', 'url'=>l_slices_person(plc_my_person_id()),
'bubble' => 'Display my all slices'); }
-function tab_slices_mysite () { return array ('label'=>'My site slices', 'url'=>l_slices_my_site(),
+function tab_slices_mysite () { return array ('label'=>'My site slices', 'url'=>l_slices_my_site(),
'bubble'=>'Display all slices on my site'); }
-function tab_slices_local () { return array ('label'=>'Local slices', 'url'=>l_slices_local(),
+function tab_slices_local () { return array ('label'=>'Local slices', 'url'=>l_slices_local(),
'bubble'=>'Display all slices local to this peer'); }
function tab_slice($slice) { return array ('label'=>'Slice '.$slice['name'], 'url'=>l_slice($slice['slice_id']),
'bubble' => 'Details for ' . $slice['name']); }
foreach ($reserved_ips as $r) {
$min = ip2long($r[0]);
$max = ip2long($r[1]);
-
+
if (($lNetwork >= $min) && ($lNetwork <= $max))
return true;
}
if ($roles)
foreach ($roles as $role) {
if ( ! in_array ($role['role_id'],$exception_ids) ) {
- $result[]=$role;
+ $result[]=$role;
}
}
}
return $hash;
}
-
+
//////////////////////////////////////////////////////////// titles
function t_site($site) { return " on site " . $site['name'] . " (" . $site['login_base'] .")"; }
function t_slice ($slice) { return " running slice " . $slice['name'] . " (" . $slice['slice_id'] . ")"; }
$display=substr($text, 0, $numb).$etc;
return sprintf("<span title='%s'>%s</span>",$text,$display);
}
-
+
// generates <(atom) class=(class)> (text) </(atom)>
function html_atom ($atom,$text,$class="") {
$html="<$atom";
print( "<div class='plc-error'>" );
print( "<p>The following errors occured:</p>" );
print("<ul>");
- foreach( $errors as $error )
+ foreach( $errors as $error )
print( "<li>$error</li>\n" );
print( "</ul></div>\n" );
}
"dhcp"=>"DHCP");
} else {
$builtin_methods=array("static"=>"Static",
- "dhcp"=>"DHCP",
- "proxy"=>"Proxy",
+ "dhcp"=>"DHCP",
+ "proxy"=>"Proxy",
"tap"=>"TUN/TAP",
"ipmi"=>"IPMI");
}
else return strval($bw/1000000000) . " Gbps";
}
-////////////////////
+////////////////////
function instantiation_label ($slice) {
$instantiation_labels = array ('not-instantiated'=>'NOT',
'plc-instantiated'=>'PLC',
if (!$result) $result = '??';
return $result;
}
-
+
//////////////////// toggle areas
// get_arg ('show_persons',false) returns $_GET['show_persons'] if set and false otherwise
function get_arg ($name,$default=NULL,$method='get') {
$time = ""; # The string we will hold our times in
while($i > $n) {
# if the difference is greater than the length we are checking... continue
- if ($diff > $lengths[$i-1]) {
+ if ($diff > $lengths[$i-1]) {
# 65 / 60 = 1. That means one minute. 130 / 60 = 2. Two minutes.. etc
- $val = floor($diff / $lengths[$i-1]);
+ $val = floor($diff / $lengths[$i-1]);
# The value, then the name associated, then add 's' if plural
- $time .= $val ." ". $periods[$i-1].($val > 1 ? 's ' : ' ');
-# subtract the values we just used from the overall diff so we can
+ $time .= $val ." ". $periods[$i-1].($val > 1 ? 's ' : ' ');
+# subtract the values we just used from the overall diff so we can
# find the rest of the information
- $diff -= ($val * $lengths[$i-1]);
-# if detailed is turn off (default) only show the first set found,
+ $diff -= ($val * $lengths[$i-1]);
+# if detailed is turn off (default) only show the first set found,
# else show all information
- if(!$detailed) { $i = 0; }
+ if(!$detailed) { $i = 0; }
}
$i--;
}
-
+
# Basic error checking.
if ($time == "") {
return "error: bad time";
class Person {
var $roles;
var $person_id;
- var $first_name;
+ var $first_name;
var $last_name;
var $email;
var $enabled;
}
function deletePCUlink($node) {
- return "<a href='/db/sites/index.php?id=" . $node->site_id .
- "&delete_node_from_pcu=" . $node->node_id .
+ return "<a href='/db/sites/index.php?id=" . $node->site_id .
+ "&delete_node_from_pcu=" . $node->node_id .
"&pcu_id=" . $this->data['pcu_id'] . "'> Remove from PCU</a>";
}
function pcu_name() {
if ( $this->data['hostname'] != NULL and $this->data['hostname'] != "" ):
return $this->data['hostname'];
- else:
+ else:
if ( $this->data['ip'] != NULL and $this->data['ip'] != "" ):
return $this->data['ip'];
else:
function link($str) {
return "<a href='/db/addresses/index.php?id=" . $this->data['address_id'] . "'>" . $str . "</a>";
}
-
+
function label() {
$label = "";
$comma= sizeof( $this->data['address_types'] );
$this->nn = $api->GetInterfaces($node['interface_ids']);
foreach ($this->nn as $nnet)
{
- if ( $nnet['is_primary'] == true )
- {
- $this->ip = $nnet['ip'];
- $this->netmask = $nnet['netmask'];
- $this->network = $nnet['network'];
- $this->gateway= $nnet['gateway'];
- $this->broadcast = $nnet['broadcast'];
- $this->dns1 = $nnet['dns1'];
- $this->dns2 = $nnet['dns2'];
- $this->method = $nnet['method'];
- $this->interface_id = $nnet['interface_id'];
- }
+ if ( $nnet['is_primary'] == true )
+ {
+ $this->ip = $nnet['ip'];
+ $this->netmask = $nnet['netmask'];
+ $this->network = $nnet['network'];
+ $this->gateway= $nnet['gateway'];
+ $this->broadcast = $nnet['broadcast'];
+ $this->dns1 = $nnet['dns1'];
+ $this->dns2 = $nnet['dns2'];
+ $this->method = $nnet['method'];
+ $this->interface_id = $nnet['interface_id'];
+ }
}
}
return $ret;
}
- // code needs to be accessible from outside an object too
+ // code needs to be accessible from outside an object too
// b/c of the performance overhead of creating as many objects as nodes
static function status_label_class__ ($boot_state, $run_level, $last_contact, $peer_id) {
$label= $run_level ? $run_level : ( $boot_state . '*' ) ;
static function status_footnote () {
return "state; * if node doesn't have an observed state; ... if status is stale (" . Node::stale_text() . ")";
}
-
+
// ditto
static function stale_ ($last_contact, $peer_id) {
// remote nodes don't have a last_contact
$adm->GetPCUs( $this->pcu_ids );
$adm->GetNodes( $this->node_ids, array( "node_id", "hostname", "boot_state",
"date_created", "last_updated", "last_contact", "site_id", "pcu_ids" ) );
- $adm->GetPersons( $this->person_ids, array( "role_ids", "person_id", "first_name",
+ $adm->GetPersons( $this->person_ids, array( "role_ids", "person_id", "first_name",
"last_name", "email", "enabled" ) );
$adm->GetSlices( $this->slice_ids, array( "name", "slice_id", "instantiation", "created", "expires" ) );
return $adm->commit();
require_once 'form.php';
require_once 'toggle.php';
-// --------------------
+// --------------------
// recognized URL arguments
-$site_id=intval($_GET['id']);
+$site_id = intval($_GET['id']);
if ( ! $site_id ) { plc_error('Malformed URL - id not set'); return; }
////////////////////
$enabled = $site['enabled'];
$ext_consortium_id = $site ['ext_consortium_id'];
-// get peer
+// get peer
$peer_id= $site['peer_id'];
$peers = new Peers ($api);
$local_peer = ! $peer_id;
$is_site_pi = ( $local_peer && plc_is_pi() && plc_in_site($site_id) );
$is_site_tech = ( $local_peer && plc_is_pi() && plc_in_site($site_id) );
$is_site_admin = ($local_peer && plc_is_admin());
-
+
$address_ids= $site['address_ids'];
$pcu_ids= $site['pcu_ids'];
$node_ids= $site['node_ids'];
if ( in_array( '20', $role_ids )) $pis[] = $person;
if ( in_array( '40', $role_ids )) $techs[] = $person;
if ( ! $person['enabled'] ) $disabled_persons[] = $person;
-
+
}
$has_disabled_persons = count ($disabled_persons) !=0;
////////////////////////////////////////
drupal_set_title("Details for site " . $sitename);
-
+
$tabs=array();
$tabs []= tab_mysite();
'bubble'=>"Delete site $sitename",
'confirm'=>"Are you sure you want to delete site $login_base");
-if ( $is_site_pi )
+if ( $is_site_pi )
$tabs ['Add slice'] = array ('url'=>l_slice_add(),
'method'=>'post',
'bubble'=>'Create new slice in site');
// pending site
global $PENDING_CONSORTIUM_ID;
if ( $ext_consortium_id === $PENDING_CONSORTIUM_ID) {
- if ( ! $enabled )
- plc_warning ("This site is under pending registration - Please visit " .
- href (l_sites_pending(),"this page") .
+ if ( ! $enabled )
+ plc_warning ("This site is under pending registration - Please visit " .
+ href (l_sites_pending(),"this page") .
" to review pending applications.");
- else
+ else
plc_warning ("This site is pending but is also enabled - something is wrong. You should fix the issue with plcsh");
} else {
- if ( ! $enabled)
+ if ( ! $enabled)
plc_warning ("This site is disabled.");
}
}
$details->start();
-if ( ! $site['is_public'])
+if ( ! $site['is_public'])
$details->tr(plc_warning_html("This site is not public!"));
$details->th_td("Full name",$sitename,'name',array('width'=>50));
$details->th_td("Longitude",$site_long,'longitude');
// modifiable by admins only
-if (plc_is_admin())
+if (plc_is_admin())
$details->th_td("Login base",$login_base,'login_base',array('width'=>12));
else
$details->th_td("Login base",$login_base);
$details->th_td("Max slices",$max_slices);
if (plc_is_admin())
{
- $selectors=array(array('display'=>"False",'value'=>'0'),
+ $selectors=array(array('display'=>"False",'value'=>'0'),
array('display'=>"True",'value'=>'1'));
$selectors[intval($enabled)]['selected'] = 'selected';
$nodes_title = "Nodes : ";
$nodes_title .= count($nodes) . " total";
$nodes_title .= " / " . $nb_boot . " boot";
- if ($nb_boot < 2 )
+ if ($nb_boot < 2 )
$nodes_title = plc_warning_html ($nodes_title);
$nodes_title .= href(l_nodes_site($site_id)," (See as nodes)");
$headers=array();
$sort_column = '0';
if ($display_pcus) { $headers['PCU']='string'; $sort_column = '1' ; }
- $headers['hostname']='string';
+ $headers['hostname']='string';
$headers['state']='string';
$table = new PlekitTable ('nodes',$headers,$sort_column,array('search_area'=>false,
$table->row_end();
}
// show undisplayed PCU's if any
- if ($display_pcus)
+ if ($display_pcus)
if ($pcu_hash) foreach ($pcu_hash as $id=>$pcu) {
if (!$pcu['displayed']) {
$table->row_start();
$table->row_end();
}
}
-
+
$table->tfoot_start();
$table->row_start();
$button=new PlekitFormButton (l_node_add(),"node_add","Add node","POST");
$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)
+ 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 )
+ 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)");
$slices_title .= $max_slices . " max";
$slices_title .= " / " . count($slice_ids) . " running";
$slices_title .= " / $slivers_count slivers";
- if (count($slice_ids) >= $max_slices)
+ 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();
$table->row_start();
$table->cell($button->html(),array('hfill'=>true,'align'=>'right'));
}
-
+
$table->end();
$toggle->end();
//////////////////////////////////////////////////////////// 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,
+ // 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')));
"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 (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
+ // remove tag
$table->row_start();
$table->cell($form->submit_html("delete-site-tags","Remove Tags"),
// use the whole columns and right adjust
// set tag area
$table->row_start();
- // get list of tag names in the site/* category
+ // 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
+ // 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->submit_html("set-tag-on-site","Set Tag"),array('columns'=>2,'align'=>'left'));
$table->row_end();
}
-
+
$table->end();
$toggle->end();
$form->end();
fwrite($fh, $stringData);
fclose($fh);
-?>
+?>
function __construct ($id, $class, $size='medium') {
$this->id = $id;
- $this->class=$class;
- $this->size=$size;
+ $this->class = $class;
+ $this->size = $size;
}
function start () { print $this->start_html(); }
return $html;
}
- function end () { print $this->end_html();}
+ function end () { print $this->end_html();}
function end_html () {
return "</div>";
}