"Enter this zone if you wish to renew your slice", 'start-visible'=>true)); $toggle->start(); // xxx message could take roles into account if ($site['max_slices']<=0) { $message= <<< EOF

Slice creation and renewal have been temporarily disabled for your site. This may have occurred because your site's nodes have been down or unreachable for several weeks, and multiple attempts to contact your site's PI(s) and Technical Contact(s) have all failed. If so, contact your site's PI(s) and Technical Contact(s) and ask them to bring up your site's nodes. Please visit your site details page to find out more about your site's nodes, and how to contact your site's PI(s) and Technical Contact(s).

EOF; echo $message; } else { // xxx this is a rough cut and paste from the former UI // Showing a datepicker view could be considered as well with some extra work // Calculate possible extension lengths $renewal_lengths = array(); foreach ( array ( 1 => "One more week", 2 => "Two more weeks", 4 => "One more month" ) as $weeks => $text ) { if (($slice [ 'expires' ] + ($weeks * $week)) < $max_expiration) { $renewal_lengths [ $weeks ] = "$text (" . gmstrftime( "%A %b-%d-%y %T %Z", $slice [ 'expires' ] + ( $weeks * $week ) ) . ")"; } } if ( empty( $renewal_lengths ) ) { plc_warning("Slice cannot be renewed any further into the future, try again closer to expiration date."); } else { // clean vars $expiration_date = gmstrftime( "%A %b-%d-%y %T %Z", $slice [ 'expires' ] ); echo '

area under construction '; // // display form // echo "

\n"; // echo "\n"; // $message = <<< EOF //

You must provide a short description as well as a link to a project website before renewing it. // Do not provide bogus information; if a complaint is lodged against your slice // and PlanetLab Operations is unable to determine what the normal behavior of your slice is, // your slice may be deleted to resolve the complaint.

// EOF; // echo $message; // // echo "

NOTE: // Slices cannot be renewed beyond $max_renewal_length weeks of today ($max_expiration_date).

\n"; // // echo "\n"; // // echo "\n"; // // if( $error['url'] ) // $url_style= " style='border: 1px solid red;'"; // echo "URL: ". $error['url'] ."\n"; // // if( $error['description'] ) // $desc_style= " style='border: 1px solid red;'"; // echo "Description: ". $error['description'] ."\n"; // // echo "\n"; // // echo "\n\n
Name:". $slice['name'] ."
Expiration Date: $expiration_date
Renewal Length:
\n"; // // } // } $toggle->end(); } //////////////////// // Get all columns as we focus on only one entry $slices= $api->GetSlices( array($slice_id)); if (empty($slices)) { drupal_set_message ("Slice " . $slice_id . " not found"); return; } $slice=$slices[0]; // pull all node info to vars $name= $slice['name']; $expires = date( "d/m/Y", $slice['expires'] ); $site_id= $slice['site_id']; //$node_ids=$slice['node_ids']; $person_ids=$slice['person_ids']; //$slice_tag_ids= $slice['slice_tag_ids']; // get peers $peer_id= $slice['peer_id']; $peers=new Peers ($api); // gets site info $sites= $api->GetSites( array( $site_id ) ); $site=$sites[0]; $site_name= $site['name']; $max_slices = $site['max_slices']; // get all persons info if (!empty($person_ids)) $persons=$api->GetPersons($person_ids,array('email','enabled')); ////////// drupal_set_title("Details for slice " . $name); $local_peer= ! $peer_id; $am_in_slice = in_array(plc_my_person_id(),$person_ids); $privileges = (plc_is_admin() || $am_in_slice); $tabs=array(); $tabs [] = tab_nodes_slice($slice_id); $tabs [] = tab_site($site_id); // are these the right privileges for deletion ? if ($privileges) { $tabs ['Delete']= array('url'=>l_actions(), 'method'=>'post', 'values'=>array('action'=>'delete-slice','slice_id'=>$slice_id), 'bubble'=>"Delete slice $name", 'confirm'=>'Are you sure to delete $name'); $tabs["Events"]=array_merge(tablook_event(), array('url'=>l_event("Slice","slice",$slice_id), 'bubble'=>"Events for slice $name")); $tabs["Comon"]=array_merge(tablook_comon(), array('url'=>l_comon("slice_id",$slice_id), 'bubble'=>"Comon page about slice $name")); } plekit_linetabs($tabs); //////////////////////////////////////// $peers->block_start($peer_id); $toggle = new PlekitToggle ('slice',"Details", array('trigger-bubble'=>'Display and modify details for that slice')); $toggle->start(); $details=new PlekitDetails($privileges); $details->form_start(l_actions(),array('action'=>'update-slice','slice_id'=>$slice_id)); $details->start(); if (! $local_peer) { $details->th_td("Peer",$peers->peer_link($peer_id)); $details->space(); } $details->th_td('Name',$slice['name']); $details->th_td('Description',$slice['description'],'description', array('input_type'=>'textarea', 'width'=>50,'height'=>5)); $details->th_td('URL',$slice['url'],'url',array('width'=>50)); $details->th_td('Expires',$expires); $details->th_td('Instantiation',$slice['instantiation']); $details->th_td('Site',l_site_obj($site)); $details->end(); $details->form_end(); $toggle->end(); renew_area ($slice,$site); $peers->block_end($peer_id); //////////////////// users //////////////////// nodes //////////////////// tags // Print footer include 'plc_footer.php'; return; ?> // gets all persons from site_id // person info if( !empty( $person_ids ) ) $persons= $api->GetPersons( $site_info[0]['person_ids'] , array( "person_id", "role_ids", "first_name", "last_name", "email" ) ); if( $persons ) { // gets site contacts pis stores in dict foreach( $persons as $person ) if( in_array( "20", $person['role_ids'] ) ) { $pis[]= array( "email" => $person['email'], "first_name" => $person['first_name'], "last_name" => $person['last_name'], "person_id" => $person['person_id'] ); } if ($pis) { sort_persons( $pis ); } } // slice tag info if( !empty( $slice_tag_ids ) ) $slice_attibs= $api->GetSliceTags( $slice_tag_ids, array( "slice_tag_id", "tag_type_id", "value", "description", "min_role_id", "node_id" ) ); // gets tag type info and combines it to form all tag info array if( $slice_attibs ) { foreach( $slice_attibs as $slice_attib ) { $tag_type= $api->GetTagTypes( array( $slice_attib['tag_type_id'] ), array( "tag_type_id", "tagname", "description" ) ); $tags[]= array( "slice_tag_id" => $slice_attib['slice_tag_id'], "tag_type_id" => $slice_attib['tag_type_id'], "tagname" => $tag_type[0]['tagname'], "value" => $slice_attib['value'], "description" => $slice_attib['description'], "min_role_id" => $slice_attib['min_role_id'], "node_id" => $slice_attib['node_id'] ); } } drupal_set_title("Slice details for " . $name); // start form if( $peer_id ) { echo "
\n"; } // basic slice menu if( ! $peer_id ) { $actions= array( ''=>'Choose Action' ); if( in_array( 10, $_roles ) || ( in_array( 20, $_roles ) && in_array( $site_id, $_person['site_ids'] ) ) || in_array( $slice_id, $_person['slice_ids'] ) ) { $actions['renew']= "Renew $name"; $actions['nodes']= "Manage Nodes"; } if ( in_array( 10, $_roles ) || ( in_array( 20, $_roles ) && in_array( $site_id, $_person['site_ids'] ) ) ) { $actions['users']= "Manage Users"; $actions['delete']= "Delete $name"; } echo "
\n"; if (in_array( 10, $_roles )) { echo plc_event_button("slices","slice",$slice_id); echo ""; } echo plc_comon_button("slice_id",$slice_id); echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "\n"; echo "
\n"; } echo "\n \n \n \n"; if( gmmktime() > $slice['expires'] ) { $class1= ' style="color:red;"'; $msg1= '(slice is expired)'; } echo "Expiration: $expires   $msg1\n"; echo "\n"; echo "\n"; $href="'/db/nodes/index.php?slice_id=" . $slice_id . "'"; printf ("\n",$href,$href,count($node_ids)); $href="'/db/persons/index.php?slice_id=" . $slice_id . "'"; printf ("\n",$href,$href,count($person_ids)); echo "
Slice Name: $name
Description: $description
URL: $url
Instantiation: "; echo "
Site: ". $site_info[0]['name'] ."
# NodesTotal %d nodes
# UsersTotal %d users
\n"; if ( (!$class1) && in_array( $slice_id, $_person['slice_ids'] ) && (! $peer_id) ) echo "

Update Information\n"; echo "


\n"; // slice tags if( $tags ) { // builds 2 arrays, one for tags, one for slivers foreach( $tags as $tag ) { if( empty( $tag['node_id'] ) ) { $slice_tag[]= $tag; } else { $sliver_tag[]= $tag; $sliver_nodes[]= $tag['node_id']; } } } // Get node info for those slivers $sliver_node_info= $api->GetNodes( $sliver_nodes, array( "node_id", "hostname" ) ); if( $sliver_node_info ) { foreach( $sliver_node_info as $sliv_node ) { $new_sliver_node_info[$sliv_node['node_id']]= $sliv_node; } } if( $peer_id ) { echo "
\n"; } // slice tags $is_admin=in_array( 10, $_roles ); $is_in_slice=in_array( $slice_id, $_person['slice_ids'] ); $is_pi=in_array( 20, $_roles ); if( $slice_tag ) { echo ""; echo ""; if( $is_admin ) echo ""; echo ""; echo "\n"; foreach( $tags as $tag ) { // ignore sliver tags at this stage if( empty( $tag['node_id'] ) ) { echo(""); if( $is_admin ) { printf(""; } if( $is_admin || ($is_pi && $is_in_slice) ) { printf ("", $tag['slice_tag_id'],$tag['tagname']); } else { printf("",$tag['tagname']); } printf("", $tag['value'],$tag['description']); echo ""; } } echo "
Slice Tags
TagValueDescription
"); sprintf($label,"\\n [ %s = %s] \\n from %s",$tag['tagname'],$tag['value'],$name); // xxx this is deprecated echo plc_delete_link_button ('tag_action.php?rem_id=' . $tag['slice_tag_id'], $label); echo "%s%s%s%s
\n"; } if( $is_admin || ($is_pi && $is_in_slice) ) echo "Add a Slice Tag\n"; // sliver tags if( $sliver_tag ) { echo ""; echo ""; if( $is_admin ) echo ""; echo ""; echo "\n"; foreach( $tags as $tag ) { $nodename=$new_sliver_node_info[$tag['node_id']]['hostname']; // consider only sliver tags at this stage if( !empty( $tag['node_id'] ) ) { echo(""); if( $is_admin ) { echo(""; } if( $is_admin ) { printf("",$tag['slice_tag_id'],$tag['tagname']); } else { printf("",$tag['tagname']); } printf("", $tag['value'],$tag['description'],$tag['node_id'],$nodename); echo ""; } } echo "
Sliver Tags
TagValueDescriptionNode
"); $label=sprintf("\\n [ %s = %s ] \\n from %s \\n on node %s", $tag['tagname'],$tag['value'],$name,$nodename); echo plc_delete_link_label('/db/nodes/sliver_action.php?rem_id=' . $tag['slice_tag_id'], $label); echo "%s%s%s%s%s
\n"; } echo "

\n"; if( $pis && !$peer_id ) { // site contacts echo "
Contacts
\n"; $pi_rows= count( $pis ); $tech_rows= count( $techs ); $table_row= 0; echo ""; if( $pis ) { echo "\n"; foreach( $pis as $pi ) { if( $table_row != 0 ) echo ""; printf("\n", $pi['person_id'],$pi['first_name'],$pi['last_name'],$pi['email'],$pi['email']); $table_row++; } } echo "
PI's:  
%s %s%s
\n

\n"; } echo "

Back to slice list\n"; }