replace 'Add Node' with 'Register Node' as link to registerwizard.
[plewww.git] / planetlab / includes / plc_functions.php
index b23e86a..83a764b 100644 (file)
@@ -3,7 +3,12 @@
 // $Id$
 
 // will trash this eventually
-require_once 'plc_functions_trash.php';
+  //require_once 'plc_functions_trash.php';
+
+// utility
+function my_is_int ($x) {
+    return (is_numeric($x) ? intval($x) == $x : false);
+}
 
 //////////////////////////////////////////////////////////// roles & other checks on global $plc
 function plc_is_admin () {
@@ -23,6 +28,11 @@ function plc_in_site ($site_id) {
   return in_array( $site_id, $plc->person['site_ids']);
 }
 
+function plc_my_site_ids () {
+  global $plc;
+  return $plc->person['site_ids'];
+}
+
 function plc_my_site_id () {
   global $plc;
   return $plc->person['site_ids'][0];
@@ -42,50 +52,60 @@ function href ($url,$text) { return "<a href='" . $url . "'>" . $text . "</a>";
 // l_object_t($object_id,text) -> an <a> tag that shows text and links to the above
 // l_object_add ()             -> the url to that object-afding page
 
-function l_actions ()                  { return "/db/actions.php"; }
+function l_actions ()                  { return "/db/common/actions.php"; }
+// some complex node actions are kept separate, e.g. the ones related to getbootmedium
+function l_actions_download ()         { return "/db/nodes/node_downloads.php"; }
+function l_register_node ()            { return "/registerwizard/index.php"; }
 
 function l_nodes ()                    { return "/db/nodes/index.php"; }
-function l_nodes_local ()              { return "/db/nodes/index.php?peerscope=local"; }
+function l_nodes_peer ($peer_id)       { return "/db/nodes/index.php?peerscope=$peer_id"; }
 function l_node ($node_id)             { return "/db/nodes/node.php?id=$node_id"; }
 function l_node_t ($node_id,$text)     { return href (l_node($node_id),$text); }
+function l_node_obj($node)             { return href(l_node($node['node_id']),$node['hostname']); }
 function l_node_add ()                 { return "/db/nodes/node_add.php"; }
 function l_nodes_site ($site_id)       { return "/db/nodes/index.php?site_id=$site_id"; }
+function l_nodes_slice ($slice_id)     { return "/db/nodes/index.php?slice_id=$slice_id"; }
 
-function l_interface ($interface_id)   { return "/db/nodes/interfaces.php?id=$interface_id"; }
+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_details=0&show_tags=1"; }
 function l_interface_t ($interface_id,$text) { 
                                          return href (l_interface($interface_id),$text); }
-function l_interface_add($node_id)     { return "/db/nodes/interfaces.php?node_id=$node_id"; }
+function l_interface_add($node_id)     { return "/db/nodes/interface.php?node_id=$node_id"; }
 
 function l_sites ()                    { return "/db/sites/index.php"; }
-function l_sites_local ()              { return "/db/sites/index.php?peerscope=local"; }
+function l_sites_peer ($peer_id)       { return "/db/sites/index.php?peerscope=$peer_id"; }
 function l_site ($site_id)             { return "/db/sites/index.php?id=$site_id"; }
 function l_site_t ($site_id,$text)     { return href (l_site($site_id),$text); }
-function l_site_update($site_id)       { return "/xxx-undefined"; }
+function l_site_obj($site)             { return href (l_site($site['site_id']),$site['name']); }
 
 function l_slices ()                   { return "/db/slices/index.php"; }
+function l_slices_peer ($peer_id)      { return "/db/slices/index.php?peerscope=$peer_id"; }
 function l_slice ($slice_id)           { return "/db/slices/index.php?id=$slice_id"; }
 function l_slice_t ($slice_id,$text)   { return href (l_slice($slice_id),$text); }
-function l_slice_add ()                        { return "/db/slices/add_slice.php"; }
+function l_slice_add ()                        { return "/db/slices/slice_add.php"; }
 function l_slices_site($site_id)       { return "/db/slices/index.php?site_id=$site_id"; }
+function l_slices_local()              { return "/db/slices/index.php?peerscope=local"; }
 // from an object
-function l_slice_text ($slice)         { return l_slice_t ($slice['slice_id'],$slice['name']); }
+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) { 
                                          return href (l_sliver($node_id,$slice_id),$text) ; }
 
 function l_persons ()                  { return "/db/persons/index.php"; }
+function l_persons_peer ($peer_id)     { return "/db/persons/index.php?peerscope=$peer_id"; }
 function l_person ($person_id)         { return "/db/persons/index.php?id=$person_id"; }
 function l_person_t ($person_id,$text) { return href (l_person($person_id),$text); }
 function l_persons_site ($site_id)     { return "/db/persons/index.php?site_id=$site_id"; }
+function l_persons_slice ($slice_id)   { return "/db/persons/index.php?slice_id=$slice_id"; }
+function l_person_obj ($person)                { return l_person_t($person['person_id'],$person['email']); }
 
 function l_tags ()                     { return "/db/tags/index.php"; }
-function l_tag ($tag_type_id)          { return "/db/tags/index.php"; }
-function l_tag_add()                   { return "/db/tags/tag_form.php"; }
-function l_tag_update($id)             { return "/db/tags/tag_form.php&action=update-tag-type&id=$id"; }
+function l_tag ($tag_type_id)          { return "/db/tags/index.php?id=$tag_type_id"; }
+function l_tag_obj ($tag)              { return href(l_tag($tag['tag_type_id']),$tag['tagname']); }
 
 function l_nodegroups ()               { return "/db/tags/nodegroups.php"; }
-function l_nodegroup ($nodegroup_id)   { return "/db/tags/nodegroups.php?id=$nodegroup_id"; }
+function l_nodegroup ($nodegroup_id)   { return "/db/tags/nodegroup.php?id=$nodegroup_id"; }
 function l_nodegroup_t ($nodegroup_id,$text) { 
                                          return href(l_nodegroup($nodegroup_id),$text); }
 
@@ -94,37 +114,76 @@ function l_event ($type,$param,$id)        { return "/db/events/index.php?type=$type&$p
 
 function l_peers()                     { return "/db/peers/index.php"; }
 function l_peer($peer_id)              { return "/db/peers/index.php?id=$peer_id"; }
+function l_peer_t($peer_id,$text)      { return href(l_peer($peer_id),$text); }
 
 function l_comon($id_name,$id_value)   { return "/db/nodes/comon.php?$id_name=$id_value"; }
 function l_sirius()                    { return "/db/sirius/index.php"; }
-function l_about()                     { return "/db/about.php"; }
+function l_about()                     { return "/db/common/about.php"; }
 function l_doc_plcapi()                        { return "/db/doc/PLCAPI.php"; }
 function l_doc_nmapi()                 { return "/db/doc/NMAPI.php"; }
-function l_admin()                     { return "/db/adminsearch.php"; }
+function l_admin()                     { return "/db/common/adminsearch.php"; }
 
-function l_logout()                    { return "/planetlab/logout.php"; }
-function l_sulogout()                  { return "/planetlab/sulogout.php"; }
+function l_login()                     { return "/db/common/login.php"; }
+function l_logout()                    { return "/planetlab/common/logout.php"; }
+function l_sulogout()                  { return "/planetlab/common/sulogout.php"; }
 function l_reset_password()            { return "/db/persons/reset_password.php"; }
 function l_person_register()           { return "/db/persons/register.php"; }
 function l_site_register()             { return "/db/sites/register.php"; }
 function l_sites_pending()             { return "/db/sites/join_request.php"; }
 
-function tabs_events()                 { return array('image'=>'/planetlab/icons/event.png','height'=>18);}
-function tabs_comon()                  { return array('image'=>'/planetlab/icons/comon.png','height'=>18);}
-
-// returns array ['url' => path, 'values' => hash (key=>value)* ]
-function split_url ($full_url) {
-  list($url,$args) = explode("?",$full_url);
-  $values=array();
-  if ($args) {
-    $pairs=explode("&",$args);
-    foreach ($pairs as $pair) {
-      list ($name,$value) = explode("=",$pair);
-      $values[$name]=$value;
-    }
-  }
-  return array("url"=>$url,"values"=>$values);
-}
+
+//////////////////////////////////////////////////////////// nav tabs
+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'), 
+                                               '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), 
+                                                'bubble'=>'Display nodes on that site'); }
+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 nodes', 'url'=>l_nodes_site(plc_my_site_id()), 
+                                               'bubble'=>'Display nodes on my site'); }
+function tab_node($node)       { return array ('label'=>'Node '.$node['hostname'], 'url'=>l_node($node['node_id']),
+                                               'bubble'=>'Details for ' . $node['hostname']); }
+//////////
+function tab_site($site)       { return array ('label'=>'Site '.$site['login_base'], 'url'=>l_site($site['site_id']),
+                                               'bubble'=>'Details for ' . $site['name']); }
+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'), 
+                                               '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_mysite ()  { return array ('label'=>'My site slices', 'url'=>l_slices_site(plc_my_site_id()), 
+                                               'bubble'=>'Display all slices on my site'); }
+function tab_slices_mine ()    { return array ('label'=>'My site slices', 'url'=>l_slices_site(plc_my_site_id()), 
+                                               'bubble'=>'Display all slices on my site'); }
+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']); }
+//////////
+function tab_persons()         { return array ('label'=>'All accounts', 'url'=>l_persons(),
+                                               'bubble'=>'Display users from all peers'); }
+function tab_persons_local()   { return array ('label'=>'Local accounts', 'url'=>l_persons_peer('local'),
+                                               'bubble'=>'Display all users local to this peer'); }
+function tab_persons_mysite()  { return array ('label'=>'My accounts' , 'url'=>l_persons_site(plc_my_site_id()),
+                                               'bubble'=>'Display accounts on site ' . plc_my_site_id()); }
+function tab_person($person)   { return array ('label'=>'Account '.$person['email'], 'url'=>l_person($person['person_id']),
+                                               'bubble'=>'Details for ' . $person['email']); }
+//////////
+function tab_tags()            { return array ('label'=>'Tag Types', 'url'=>l_tags(),
+                                               'bubble' => 'Display and create tag types'); }
+function tab_nodegroups()      { return array ('label'=>'Nodegroups', 'url'=>l_nodegroups(),
+                                               'bubble' => 'Display and create nodegroups'); }
+
+// only partial tab
+function tablook_event()       { return array('image'=>'/planetlab/icons/event.png','height'=>18);}
+function tablook_comon()       { return array('image'=>'/planetlab/icons/comon.png','height'=>18);}
+
+////////////////////
 
 //////////////////////////////////////////////////////////// validation functions
 function topdomain ($hostname) {
@@ -207,7 +266,7 @@ function is_reserved_network_addr($network_addr) {
   return false;
 }
 
-////////////////////////////////////////////////////////////  peer & peerscopes
+////////////////////////////////////////////////////////////  roles
 function plc_role_global_hash ($api) {
   $hash=array();
   $roles=$api->GetRoles();
@@ -216,89 +275,6 @@ function plc_role_global_hash ($api) {
   }
   return $hash;
 }
-  
-////////////////////////////////////////////////////////////  peer & peerscopes
-// when shortnames are needed on peers
-function plc_peer_global_hash ($api) {
-  $peer_columns=array('peer_id','shortname');
-  $peer_filter=array();
-  $peers = $api->GetPeers($peer_filter,$peer_columns);
-  
-  $peer_hash=array();
-  if ($peers) foreach ($peers as $peer) {
-    $peer_hash[$peer['peer_id']]=$peer;
-  }
-}
-
-function plc_peer_shortname ($peer_hash,$peer_id) {
-  if ( ! $peer_id ) {
-    return PLC_SHORTNAME;
-  } else {
-     return $peer_hash[$node['peer_id']]['shortname'];
-  }
-}
-
-function plc_peer_label ($peer) { 
-  if (! $peer) {
-    return "Local object on " . PLC_NAME . " (" . PLC_SHORTNAME . ")";
-  }
-  $result= $peer['peername'] . " (" . $peer['shortname'] . ")";
-  $result= href(l_peer($peer['peer_id']),$result);
-  return plc_foreign_text($result);
-}
-
-// to set the background to grey on foreign objects
-// return true if the peer is local 
-function plc_peer_block_start ($peer_hash,$peer_id) {
-  if ( ! $peer_id ) {
-    print "<div>";
-    return true;
-  } else {
-    // set two classes, one eneraic to all foreign, and one based on the peer's shortname for finer grain tuning
-    printf ('<div class="plc-foreign plc-%s>"',strtolower(plc_peer_shortname($peer_hash,$peer_id)));
-    return false;
-  }
-}
-
-function plc_peer_block_end () {
-  print "</div>\n";
-}
-
-// interpret standard syntax for peerscope
-function plc_peer_info ($api,$peerscope) {
-  switch ($peerscope) {
-  case '':
-    $peer_filter=array();
-    $peer_label="all peers";
-    break;
-  case 'local':
-    $peer_filter=array("peer_id"=>NULL);
-    $peer_label=PLC_SHORTNAME;
-    break;
-  case 'foreign':
-    $peer_filter=array("~peer_id"=>NULL);
-    $peer_label="foreign peers";
-    break;
-  default:
-    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);
-}
 
 //////////////////////////////////////////////////////////// nodegroups
 // hash by 'tagname=value'
@@ -319,47 +295,10 @@ function plc_nodegroup_global_hash ($api,$tagnames=NULL) {
 //////////////////////////////////////////////////////////// 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'] . ")"; }
+function t_person ($person) { return " belonging to " . $person['email'] . " (" . $person['person_id'] . ")"; }
 
-//////////////////////////////////////////////////////////// nav tabs
-function tabs_node($node) { return array('Node ' . $node['hostname']=>l_node($node_id)); }
-function tabs_site($site) { return array('Site ' . $site['name']=>l_site($site_id)); }
-function tabs_slice($slice) { return array('Slice ' . $slice['name']=>l_slice($slice_id)); }
-
-//////////////////////////////////////////////////////////// presentation
-// builds a table from an array of strings, with the given class
-// attempt to normalize the delete buttons and confirmations
-function plc_delete_button($width=15) {
-  return '<span title="Delete this entry"><img width=' . $width . ' alt="Delete this entry" src="/planetlab/icons/delete.png"></span>';
-}
-
-function plc_js_confirm($message) {
-  return "onclick=\"javascript:return confirm('Are you sure you want to delete " . $message . " ?')\"";
-}
-
-function plc_delete_link($url,$delete_message,$visible) {
-  return "<a href='" . $url . "' " . plc_js_confirm($delete_message) . ">" . $visible . "</a>";
-}
-
-function plc_delete_link_button($url,$delete_message,$width=15) {
-  return "<a href='" . $url . "' " . plc_js_confirm($delete_message) . ">" . plc_delete_button($width) . "</a>";
-}
-
-function plc_event_button($type,$param,$id) {
-  return '<a href="' . l_event($type,$param,$id) . '"> <span title="Related events"> <img src="/planetlab/icons/event.png" width=18></span></a>';
-}
-
-function plc_comon_button ($id_name, $id_value,$target="") {
-  $result='<a ';
-  if (!empty($target)) {
-    $result.='target="' . $target . '" ';
-  }
-  $result.='href="' . l_comon($id_name,$id_value) . '">';
-  $result.='<span title="Link to Comon"> <img src="/planetlab/icons/comon.png" width="18"></span></a>';
-  return $result;
-}
-
+//////////////////////////////////////////////////////////// html fragments
 function plc_vertical_table ($messages, $class="") {
-  // pretty print the cell
   if ( empty( $messages) ) return "";
   $formatted = "";
   $formatted .= "<table";
@@ -371,16 +310,17 @@ function plc_vertical_table ($messages, $class="") {
   $formatted .= "</table>";
   return $formatted;
 }
-
-//////////////////////////////////////////////////////////// various mappers
-// could not figure how to use anonymous lambdas..
-function get_site_id ($site) { return $site['site_id'];}
-function get_tagname ($tag) { return $tag['tagname'];}
-
-////////////////////////////////////////////////////////////
-function plc_section ($text,$line=true) {
-  if ($line) { print "<hr/>";}
-  print "<h2 class=plc> $text </h2>\n";
+function plc_itemize ($messages, $class="") {
+  if ( empty( $messages) ) return "";
+  $formatted = "";
+  $formatted .= "<ul";
+  if ($class) $formatted .= " class='" . $class . "'";
+  $formatted .= ">";
+  foreach ($messages as $message) {
+    $formatted .= "<li>" . $message . "</li>";
+  }
+  $formatted .= "</ul>";
+  return $formatted;
 }
 
 function plc_error ($text) {
@@ -388,19 +328,20 @@ function plc_error ($text) {
   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" );
+function plc_errors ($errors) {
+  if ($errors) {
+    print( "<div class='plc-error'>" );
+    print( "<p>The following errors occured:</p>" );
+    print("<ul>");
+    foreach( $errors as $error ) 
+      print( "<li>$error</li>\n" );
+    print( "</ul></div>\n" );
   }
-  print( "</ul></div>\n" );
 }
 
-function plc_warning_text ($text)      { return "<span class='plc-warning'>" . $text . "</span>";}
-function plc_warning ($text)           { print plc_warning_text("Warning " . $text); }
-function plc_foreign_text($text)       { return "<span class=plc-foreign>$text</span>"; }
+function plc_warning_html ($text)      { return "<span class='plc-warning'>" . $text . "</span>";}
+function plc_warning ($text)           { print plc_warning_html("Warning " . $text); }
+function plc_foreign_html($text)       { return "<span class=plc-foreign>$text</span>"; }
 
 // shows a php variable verbatim with a heading message
 function plc_debug ($message,$object) {
@@ -409,5 +350,113 @@ function plc_debug ($message,$object) {
   print "</pre>";
 }
 
+function truncate ($text,$numb,$etc = "...") {
+  if (strlen($text) > $numb) {
+    $text = substr($text, 0, $numb);
+    $text = $text.$etc;
+  }
+  return $text;
+}
+function html_div ($text,$class="") {
+  $html="<div";
+  if ($class) $html .= " class='$class'";
+  $html .= ">$text</div>";
+  return $html;
+}
 
+if (! function_exists ("drupal_set_error")) {
+  function drupal_set_error ($text) {
+    drupal_set_message ("<span class=error>$text</span>");
+  }
+ }
+
+//////////////////////////////////////////////////////////// sort out for obsolete / trash
+// builds a table from an array of strings, with the given class
+// attempt to normalize the delete buttons and confirmations
+function plc_delete_icon($width=15) {
+  return "<img width='$width' src='/planetlab/icons/delete.png'>";
+}
+
+function plc_bubble($text,$bubble) {
+  return "<span title='$bubble'>$text</span>";
+}
+function plc_delete_icon_bubble ($bubble,$width=15) {
+  return plc_bubble(plc_delete_icon($width),$bubble);
+}
+
+function plc_event_button($type,$param,$id) {
+  return '<a href="' . l_event($type,$param,$id) . '"> <span title="Related events"> <img src="/planetlab/icons/event.png" width=18></span></a>';
+}
+
+function plc_comon_button ($id_name, $id_value,$target="") {
+  $result='<a ';
+  if (!empty($target)) {
+    $result.='target="' . $target . '" ';
+  }
+  $result.='href="' . l_comon($id_name,$id_value) . '">';
+  $result.='<span title="Link to Comon"> <img src="/planetlab/icons/comon.png" width="18"></span></a>';
+  return $result;
+}
+
+////////////////////
+function plc_redirect ($url) {
+  header ("Location: " . $url);
+  exit ();
+}
+
+//////////////////// the options for an interface - suitable for plekit/form
+//>>> GetNetworkMethods()
+//[u'static', u'dhcp', u'proxy', u'tap', u'ipmi', u'unknown']
+function interface_method_selectors ($api, $method, $primary) {
+  if ($primary) {
+    $builtin_methods=array("static"=>"Static",
+                          "dhcp"=>"DHCP");
+  } else {
+    $builtin_methods=array("static"=>"Static",
+                          "dhcp"=>"DHCP", 
+                          "proxy"=>"Proxy",  
+                          "tap"=>"TUN/TAP",
+                          "ipmi"=>"IPMI");
+  }
+  $selectors=array();
+  foreach ($builtin_methods as $value=>$display) {
+    $selector=array('display'=>$display, 'value'=>$value);
+    if ($value == $method) $selector['selected']=true;
+    $selectors []= $selector;
+  }
+  return $selectors;
+}
+
+//////////////////// 
+function instantiation_label ($slice) {
+  $instantiation_labels = array ('not-instantiated'=>'NOT',
+                                'plc-instantiated'=>'PLC',
+                                'delegated' => 'DEL',
+                                'nm-controller' => 'NM');
+  $result=$instantiation_labels[$slice['instantiation']];
+  if (!$result) $result = $slice['instantiation'];
+  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,$method='get') {
+  if ($method == 'get') $var=$_GET; else $var=$_POST;
+  if (isset ($var[$name])) return $var[$name];
+  else return $default;
+}
+
+//////////////////// number of ...
+function count_english ($objs,$name) {
+  $count=count($objs);
+  if ($count == 0) return 'No ' . $name;
+  else if ($count == 1) return 'One ' . $name;
+  else return $count . ' ' . $name . 's';
+}
+function count_english_warning ($objs, $name) {
+  $x=count_english ($objs,$name);
+  if (count ($objs) == 0) $x=plc_warning_html($x . ' !!');
+  return $x;
+}
 ?>