function l_actions_download () { return "/db/nodes/node_downloads.php"; }
function l_register_node () { return "/registerwizard/index.php"; }
function l_pcu_add () { return "/registerwizard/index.php/register/stage1_addpcu"; }
+function l_pcu ($pcu_id) { return "/db/sites/pcu.php?id=$pcu_id"; }
function l_nodes () { return "/db/nodes/index.php"; }
function l_nodes_peer ($peer_id) { return "/db/nodes/index.php?peerscope=$peer_id"; }
}
//////////
+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;
+}
+
// should use the same channel as the php errors..
-function plc_error_html ($text) { return "<div class='plc-error'> " . $text . "</div>"; }
+function plc_error_html ($text) { return html_div ($text,'plc-error'); }
function plc_error ($text) { print plc_error_html ("Error " . $text); }
-function plc_errors ($errors) {
+function errors_init() { return array();}
+function errors_record ($adm, $errors) {
+ if ($adm->error()) {
+ $tmp=$adm->error();
+ $errors []= $tmp;
+ }
+ return $errors;
+}
+
+function errors_display ($errors) {
if ($errors) {
print( "<div class='plc-error'>" );
print( "<p>The following errors occured:</p>" );
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>");
return $selectors;
}
+// displays bandwidth with kbps Mbps Gbps as needed
+function pretty_bandwidth ($bw) {
+ if ($bw < 1000) return $bw;
+ if ($bw < 1000000) return strval($bw/1000) . " kbps";
+ if ($bw < 1000000000) return strval($bw/1000000) . " Mbps";
+ else return strval($bw/1000000000) . " Gbps";
+}
+
////////////////////
function instantiation_label ($slice) {
$instantiation_labels = array ('not-instantiated'=>'NOT',