GetSites(array('site_id'=>$site_id)); if ( ! $sites) { drupal_set_error("Cannot find site_id $site_id"); $check=false; } $site=$sites[0]; $base=$site['login_base'] . '_'; // validate input if( $name == $base ) { drupal_set_error("You must enter a name for your slice"); $check=false; } else if (strpos($name,$base) != 0) { drupal_set_error("Slice name $name should begin with $base"); $check=false; } else { // make sure slice name doesnt exist $slices = $api->GetSlices( array( $name ), array( "slice_id" ) ); if ( count($slices) != 0) { drupal_set_error("Slice name $name already in use, please choose another"); $check=false; } } if ( ($url == "http://") || ( $url=="" ) ) { drupal_set_error("You must enter a URL for your slice's info"); $check=false; } if( $description == "" ) { drupal_set_error("Your must enter a description for you slice."); $check=false; } // if no errors then add if ( $check ) { $fields= array( "url" => $url, "instantiation" => $instantiation, "name" => $name, "description" => $description ); // add it! $slice_id= $api->AddSlice( $fields ); if ($slice_id > 0) { drupal_set_message ("Slice $slice_id created"); if ($person_ids) { // Add people $success=true; $counter=0; foreach ($person_ids as $person_id) { $person_id=intval($person_id); if ($api->AddPersonToSlice($person_id,$slice_id) != 1) { drupal_set_error("Could not add person $person_id in slice :" . $api->error()); $success=false; } else { $counter++; } } if ($success) drupal_set_message ("Added $counter person(s)"); else drupal_set_error ("Could not add all selected persons, only $counter were added"); } plc_redirect(l_slice($slice_id) ); } else { drupal_set_error("Could not create slice $name " . $api->error() ); $check=false; } } } //////////////////// still here : either it's a blank form or something was wrong // Print header require_once 'plc_drupal.php'; include 'plc_header.php'; $sites=$api->GetSites(array($site_id)); $site=$sites[0]; $sitename=$site['name']; if ( ! $_POST['name']) $base= $site['login_base'] ."_"; // propose to add all 'reachable' persons $site_person_ids=$site['person_ids']; $persons_filter=array("person_id"=>$site_person_ids, "enabled"=>true); $persons=$api->GetPersons($persons_filter,array('email','enabled','first_name','last_name','person_id')); drupal_set_title('Create slice in site "' . $sitename . '"'); // defaults $url = $_POST['url']; 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'"; // is there a need to consider several sites ? $multiple_sites=false; $site_columns=array('name','login_base','site_id'); if (plc_is_admin ()) { $multiple_sites=true; $filter=NULL; } else if (count (plc_my_site_ids()) > 1) { $multiple_sites=true; $filter=plc_my_site_ids(); } if ($multiple_sites) { print "
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 your PlanetLab Operations Center
is unable to determine what the normal behavior of your slice is,
your slice may be deleted to resolve the complaint.
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.
There are four possible "instantiation" states for a slice.