X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fincludes%2Fplc_functions.php;h=2de30852a2cd83bd7bca91040326e5e08ec07a5f;hb=5f334a97c63ea036cdb37f5455e1135120681a95;hp=f007cda3cfdf5da3700f4b4398af6cb72b7dbc2d;hpb=fa425f537d2e4aced1a2362672791aed274dd903;p=plewww.git
diff --git a/planetlab/includes/plc_functions.php b/planetlab/includes/plc_functions.php
index f007cda..2de3085 100644
--- a/planetlab/includes/plc_functions.php
+++ b/planetlab/includes/plc_functions.php
@@ -1,6 +1,7 @@
";
}
+function plc_debug_txt ($message,$txt) {
+ print "
" . $message . "
";
+ $txt=str_replace(" ","<SPC>",$txt);
+ $txt=str_replace("\t","<TAB>",$txt);
+ $txt=str_replace("\n","<LF>",$txt);
+ $txt=str_replace("\r","<CR>",$txt);
+ print $txt . "<EOF>";
+ print "";
+}
+
$plc_prof_start=0.;
$plc_prof_time=0.;
$plc_prof_counter=0;
@@ -498,6 +512,27 @@ function plc_redirect ($url) {
exit ();
}
+//////////////////// the options for an nodetype - suitable for plekit/form
+global $builtin_node_types;
+$builtin_node_types = array ( "regular" => "Regular/Shared",
+ "reservable" => "Reservable (requires to get leases)");
+function node_type_display ($api, $node_type) {
+ global $builtin_node_types;
+ $val=$builtin_node_types[$node_type];
+ if ( ! $val) $val="??undefined??";
+ return $val;
+}
+
+function node_type_selectors ($api,$node_type) {
+ global $builtin_node_types;
+ foreach ($builtin_node_types as $value=>$display) {
+ $selector=array('display'=>$display, 'value'=>$value);
+ if ($value == $node_type) $selector['selected']=true;
+ $selectors []= $selector;
+ }
+ return $selectors;
+}
+
//////////////////// the options for an interface - suitable for plekit/form
//>>> GetNetworkMethods()
//[u'static', u'dhcp', u'proxy', u'tap', u'ipmi', u'unknown']
@@ -543,7 +578,7 @@ function instantiation_label ($slice) {
//////////////////// toggle areas
// get_arg ('show_persons',false) returns $_GET['show_persons'] if set and false otherwise
-function get_arg ($name,$default,$method='get') {
+function get_arg ($name,$default=NULL,$method='get') {
if ($method == 'get') $var=$_GET; else $var=$_POST;
if (isset ($var[$name])) return $var[$name];
else return $default;
@@ -566,5 +601,35 @@ function count_english_warning ($objs, $name) {
function reservable_mark () { return "-R-";}
function reservable_legend () { return "reservable nodes are marked with " . reservable_mark (); }
+//////////////////// Vicci simplified portal support
+function plc_advanced() {
+ global $plc, $api;
+
+ if ((!$plc) || (!$api)) {
+ return FALSE;
+ }
+
+ $person_id = $plc->person['person_id'];
+ $tags = $api->GetPersonTags(array("person_id" => $person_id, "tagname" => "advanced"));
+ if (!$tags) {
+ return FALSE;
+ }
+ return (bool) $tags[0]['value'];
+}
+
+function plc_set_advanced($value) {
+ global $plc, $api;
+
+ $person_id = $plc->person['person_id'];
+ $tags = $api->GetPersonTags(array("person_id" => $person_id, "tagname" => "advanced"));
+ if ($tags) {
+ $result = $api->UpdatePersonTag($tags[0]["person_tag_id"], $value);
+ //print "update " . $tags[0]["person_tag_id"] . " " . $value . " " . $result . "