if ($may_cache) {
$items[] = array(
- 'path' => 'planetlab/logout',
+ 'path' => 'planetlab/common/logout',
'title' => t('Log out of %s', array('%s' => variable_get('site_name', 'local'))),
'callback' => 'planetlab_logout',
'access' => TRUE,
}
// formatting helpers
-function ul_start () { return '<ul class=menu>'; }
+function ul_start () { return '<ul class="menu">'; }
function ul_end () { return '</ul>'; }
-function leaf($text) { return '<li class=leaf>' . $text . '</li>'; }
-function expanded($text) { return '<li class=expanded>' . $text . '</li>'; }
+function leaf($text) { return '<li class="leaf">' . $text . '</li>'; }
+function expanded($text) { return '<li class="expanded">' . $text . '</li>'; }
function p($text) { return '<p>' . $text . '</p>'; }
// fake theme to look like menu
function menu_theme ($menu) {
$block['content'] .= p( href(l_person_register(),"Create an account") );
$block['content'] .= p( href(l_site_register(),"File a site registration") );
} else {
- $block['subject'] = $plc->person['email'];
+ $block['subject'] = truncate($plc->person['email'],30);
$is_admin = in_array(10,$plc->person['role_ids']);
$is_pi = in_array(20,$plc->person['role_ids']);
$is_user = in_array(30,$plc->person['role_ids']);
$is_tech = in_array(40,$plc->person['role_ids']);
+ //////////////////// Log out
+ if ($user->uid) {
+ // Drupal logout (destroys the session and cleans up $user)
+ // Thierry unclear when this triggers, I suspect this is obsolete
+ $items[] = leaf (l(t('Log out of %s',
+ array('%s' => variable_get('site_name', 'local'))), 'logout'));
+ } else {
+ // PlanetLab logout (just destroy the session)
+ $items[] = leaf ( href (l_logout(),'Log out'));
+ }
+
+ //////////////////// Sites
$site_item = '';
$site_item .= href(l_sites(),"Sites");
$site_item .= ul_start();
$site_item .= leaf( href(l_site(plc_my_site_id()),"My site"));
if ( $is_admin )
- $site_item .= leaf( href(l_site_pending(),"Pending Requests"));
+ $site_item .= leaf( href(l_sites_pending(),"Pending Requests"));
$site_item .= ul_end();
$items[] = expanded($site_item);
+ //////////////////// Users
$user_item = '';
$user_item .= href(l_persons(),'Users');
$user_item .= ul_start();
if (is_pi)
$user_item .= leaf( href( l_persons_site(plc_my_site_id()), "My users"));
if ( $plc->alt_person && $plc->alt_auth) {
- $email = $plc->person['email'];
+ $email = truncate($plc->person['email'],20);
$user_item .= leaf( href( l_sulogout(),"Log out of $email"));
}
$user_item .= ul_end();
$items [] = expanded($user_item);
+ //////////////////// Nodes
$node_item = '';
$node_item .= href(l_nodes(),"Nodes");
$node_item .= ul_start();
$node_item .= leaf( href (l_nodes_site (plc_my_site_id()),"My Site Nodes"));
$node_item .= leaf( href (l_node_add(),"Add Node"));
- if ( $is_admin)
- $node_item .= leaf (href(l_peers(),'Peers'));
$node_item .= ul_end();
$items [] = expanded($node_item);
+ //////////////////// Slices
$slice_item = '';
//if( !( $is_tech && ! $is_user && ! $is_pi && ! $is_admin ) )
$slice_item .= href(l_slices(),"Slices");
$slice_item .= ul_end();
$items [] = expanded($slice_item);
+ //////////////////// Admin
if( $is_admin || $is_pi ) {
- $tag_item = '';
- $tag_item .= href(l_tags(),"All Tag Types");
- $tag_item .= ul_start();
- $tag_item .= leaf( href( l_tags_slice(),"Slice Tags"));
- $tag_item .= leaf( href( l_tags_interface(),"Interface Tags"));
- $tag_item .= leaf( href (l_tags_interface(),"Setting Types (dup xxx)"));
- $tag_item .= leaf( href( l_tags_node(),"Node Tags"));
- $tag_item .= leaf( href( l_nodegroups(),"Node groups (xxx)"));
- $tag_item .= ul_end();
- $items [] = expanded($tag_item);
+ $admin_item = '';
+ $admin_item .= href(l_admin(),"Admin");
+ $admin_item .= ul_start();
+ $admin_item .= leaf( href( l_tags(),"Tags"));
+ $admin_item .= leaf( href( l_nodegroups(),"Node groups"));
+ $admin_item .= leaf (href(l_peers(),'Peers'));
+ if ( $is_admin )
+ $admin_item .= leaf (href(l_events(),'Events'));
+ $admin_item .= ul_end();
+ $items [] = expanded($admin_item);
}
$doc_item = '';
$doc_item .= ul_end();
$items[] = expanded($doc_item);
- if ( $is_admin )
- $items[] = leaf (href(l_events(),'Events'));
-
- if ($user->uid) {
- // Drupal logout (destroys the session and cleans up $user)
- // Thierry unclear when this triggers, I suspect this is obsolete
- $items[] = leaf (l(t('Log out of %s',
- array('%s' => variable_get('site_name', 'local'))), 'logout'));
- } else {
- // PlanetLab logout (just destroy the session)
- $items[] = leaf ( href (l_logout(),'Log out'));
- }
-
//$block['content'] = theme('list_item', $items);
$block['content'] = menu_theme($items);
- // plc_debug("content",$block['content']);
}
/*
if ($url[0] != "/") {
$url = "/$url";
}
- Header("Location: $url");
+ header("Location: $url");
exit();
}
}