person; $_roles= $_person['role_ids']; //print_r( $_person ); // if not a PI or admin then redirect to slice index if( !in_array( '10', $_roles ) && !in_array( '20', $_roles ) ) header( "index.php" ); if( !$_POST['name'] ) { // get default site base $site_info= $api->GetSites( array( $_person['site_ids'][0] ), array( "login_base" ) ); $base= $site_info[0]['login_base'] ."_"; } // add it if( $_POST['add'] ) { // get post vars $url= $_POST['url']; $instantiation= $_POST['instantiation']; $name= $_POST['name']; $description= $_POST['description']; // validate input if( $name == $base ) $error['name']= "You must enter a name for your slice."; else { $slice_name= $name; // make sure slice name doesnt exist $slice_info= $api->GetSlices( array( $slice_name ), array( "slice_id" ) ); if( !empty( $slice_info ) ) { $error['name']= "Slice name already in use. Please choose another."; $name= ""; } } if( $url == "http://" || "" ) $error['url']= "You must enter a URL for your slice's info."; if( $description == "" ) $error['description']= "Your must enter a description for you slice."; // if no errors then add if( !$error ) { $fields= array( "url" => $url, "instantiation" => $instantiation, "name" => $slice_name, "description" => $description ); echo "added:
"; print_r( $fields ); echo "
\n"; // add it! $slice_new_id= $api->AddSlice( $fields ); if( $slice_new_id ) { plc_redirect( "index.php?id=$slice_new_id" ); exit(); } else { $error['api']= $api->error(); } } } // Print header require_once 'plc_drupal.php'; drupal_set_title('Slices'); include 'plc_header.php'; if( !$url ) $url= "http://"; // check for errors and set error styles if( $error['name'] ) $name_error= " class='plc-warning'"; if( $error['url'] ) $url_error= " class='plc-warning'"; if( $error['description'] ) $desc_error= " class='plc-warning'"; // add javaScript code echo "\n"; // start form echo "
\n"; if( $error['api'] ) echo "". $error['api'] ."\n"; echo "

Create Slice

\n"; echo "

You must provide a short description of the new slice as well as a link to a project website before creating 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.\n"; echo "

There are three possible \"instantiation\" states for a slice. PLC creates a slice with default settings. Delegated creates a ticket to use on each node. None allows you to reserve a slice name; you may instantiate the slice later.\n"; echo "

NOTE: All PlanetLab users are strongly encouraged to join the PlanetLab Users mailing list. Most questions about running software on PlanetLab can be answered by posting to this list. Site administrators often use this list to post announcements about service outages. New software releases and available services are announced here as well.\n"; echo "

\n"; // displays a site select list for admins and multi-site users if( count( $_person['site_ids'] ) > 1 || in_array( 10, $_roles ) ) { // get sites depending on role and sites associated. if( in_array( 10, $_roles ) ) $site_info= $api->GetSites( NULL, array( "name", "site_id", "login_base" ) ); elseif( count( $_person['site_ids'] ) > 1 ) $site_info= $api->GetSites( $_person['site_ids'], array( "name", "site_id", "login_base" ) ); echo "\n"; } echo "Name: \n"; echo "URL: \n"; echo "Description: \n"; echo "\n"; echo "
Site:
". $error['name'] ."
". $error['url'] ."
". $error['description'] ."
Instantiation:
\n"; echo "

\n"; echo "

\n"; // Print footer include 'plc_footer.php'; ?>