+function truncate ($text,$numb,$etc = "...") {
+ if (strlen($text) > $numb) {
+ $text = substr($text, 0, $numb);
+ $text = $text.$etc;
+ }
+ return $text;
+}
+
+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 ();
+}
+