X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fincludes%2Fplc_functions.php;h=ad41d991a6ec4b843d0080f270479733cb14b059;hb=8dfeb8aa13ccfe89e04ca7e290f0dfbd10e1b5ab;hp=ff4afd7faab2e5548cc5fa8018b8f7784dc96066;hpb=305c3ccb1a65dc994558ec83e5fc3b877686e07f;p=plewww.git diff --git a/planetlab/includes/plc_functions.php b/planetlab/includes/plc_functions.php index ff4afd7..ad41d99 100644 --- a/planetlab/includes/plc_functions.php +++ b/planetlab/includes/plc_functions.php @@ -3,7 +3,7 @@ // $Id$ // will trash this eventually -require_once 'plc_functions_trash.php'; + //require_once 'plc_functions_trash.php'; // utility function my_is_int ($x) { @@ -47,33 +47,35 @@ function href ($url,$text) { return "" . $text . ""; // l_object_add () -> the url to that object-afding page function l_actions () { return "/db/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_nodes () { return "/db/nodes/index.php"; } 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_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_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_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_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"; } // 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) { @@ -86,9 +88,8 @@ 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_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/nodegroup.php?id=$nodegroup_id"; } @@ -117,8 +118,48 @@ 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);} + +//////////////////////////////////////////////////////////// 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 local nodes only'); } +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_mysite () { return array ('label'=>'My nodes', 'url'=>l_nodes_site(plc_my_site_id()), + 'bubble'=>'Display nodes on that site'); } +function tab_node($node) { return array ('label'=>'Node '.$node['hostname'], 'url'=>l_node($node_id), + 'bubble'=>'Details for ' . $node['hostname']); } +////////// +function tab_site($site) { return array ('label'=>'Site '.$site['login_base'], 'url'=>l_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 local sites'); } +////////// +function tab_slices() { return array ('label'=>'All slices', 'url'=>l_slices(), + 'bubble' => 'Display all slices'); } +function tab_slice($slice) { return array ('label'=>'Slice '.$slice['name'], 'url'=>l_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 local users'); } +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_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);} + +//////////////////// // returns array ['url' => path, 'values' => hash (key=>value)* ] function split_url ($full_url) { @@ -246,11 +287,6 @@ function plc_nodegroup_global_hash ($api,$tagnames=NULL) { function t_site($site) { return " on site " . $site['name'] . " (" . $site['login_base'] .")"; } function t_slice ($slice) { return " running slice " . $slice['name'] . " (" . $slice['slice_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)); } - //////////////////////////////////////////////////////////// html fragments function plc_vertical_table ($messages, $class="") { // pretty print the cell @@ -287,9 +323,9 @@ function plc_errors ($errors) { } } -function plc_warning_text ($text) { return "" . $text . "";} -function plc_warning ($text) { print plc_warning_text("Warning " . $text); } -function plc_foreign_text($text) { return "$text"; } +function plc_warning_html ($text) { return "" . $text . "";} +function plc_warning ($text) { print plc_warning_html("Warning " . $text); } +function plc_foreign_html($text) { return "$text"; } // shows a php variable verbatim with a heading message function plc_debug ($message,$object) { @@ -305,6 +341,12 @@ function truncate ($text,$numb,$etc = "...") { } return $text; } +function html_div ($text,$class="") { + $html="Delete this entry'; +function plc_delete_icon($width=15) { + return ""; } -function plc_js_confirm($message) { - return "onclick=\"javascript:return confirm('Are you sure you want to delete " . $message . " ?')\""; +function plc_bubble($text,$bubble) { + return "$text"; } - -function plc_delete_link($url,$delete_message,$visible) { - return "" . $visible . ""; -} - -function plc_delete_link_button($url,$delete_message,$width=15) { - return "" . plc_delete_button($width) . ""; +function plc_delete_icon_bubble ($bubble,$width=15) { + return plc_bubble(plc_delete_icon($width),$bubble); } function plc_event_button($type,$param,$id) {