person; $_roles= $_person['role_ids']; // Constants $week= 7 * 24 * 60 * 60; // seconds $max_renewal_length= 8; // weeks from today $max_expiration= mktime() + ($max_renewal_length * $week); // seconds since epoch $max_expiration_date= gmstrftime("%A %b-%d-%y %T %Z", $max_expiration); // if submitted validate input if( $_POST['submitted'] ) { // get post vars $expire_len= $_POST['expire_len']; $expires= $_POST['expires']; $slice_id= intval( $_POST['id'] ); // create empty error array $error= array( ); // check input $url= $_POST['url']; if( $url == '' || empty( $url ) ) $error['url']= "Provide a link to a project website."; $description= htmlspecialchars( $_POST['description'] ); if ( $description == '' || empty( $description ) ) $error['description']= "Provide a short description of the slice."; // if no errors update slice info if( empty( $error ) ) { // set new expiration $expires+= ( $expire_len * $week ); // make slice field array $slice_fields= array( "url" => $url, "description" => $description, "expires" => $expires ); // Update it! $api->UpdateSlice( $slice_id, $slice_fields ); header( "location: index.php?id=$slice_id" ); exit(); } } // if no id is set redirect back to slice index if( !$_POST['id'] && !$_GET['id'] ) { header( "location: index.php" ); exit(); } // Print header require_once 'plc_drupal.php'; drupal_set_title('Slice Renewal'); include 'plc_header.php'; // get id if( $_GET['id'] ) $slice_id= intval( $_GET['id'] ); if( $_POST['id'] ) $slice_id= intval( $_POST['id'] ); // get slice info $slice_info= $api->GetSlices( array( $slice_id ), array( "expires", "name", "site_id", "description", "url" ) ); echo "

Slice ". $slice_info[0]['name'] ." Renewal

\n"; // get site info if( !empty( $slice_info[0]['site_id'] ) ) { // get sliver/slice site info $site_info= $api->GetSites( array( $slice_info[0]['site_id'] ), array( "max_slivers", "max_slices" ) ); // do not allow renew if max_slices are 0 if( $site_info[0]['max_slices'] <= 0 ) { $support= ''; $site_id= $slice_info[0]['site_id']; echo "

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. If you believe that your site's nodes are up and reachable. Visit your site's 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).

"; } // else start renewal form else { // 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_info[0]['expires'] + ( $weeks * $week ) ) < $max_expiration ) { $renewal_lengths[$weeks]= "$text (". gmstrftime( "%A %b-%d-%y %T %Z", $slice_info[0]['expires'] + ( $weeks * $week ) ) .")"; } } if ( empty( $renewal_lengths ) ) { echo "Slice cannot be renewed any further into the future, try again closer to expiration date. Go back to ". $slice_info[0]['name'] .".\n"; } else { // clean vars $expiration_date = gmstrftime( "%A %b-%d-%y %T %Z", $slice_info[0]['expires'] ); // display form echo "
\n"; echo "\n"; echo "

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.

\n"; 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_info[0]['name'] ."
Expiration Date: $expiration_date
Renewal Length:
\n"; } } } else echo "No data for this slice ID. Go back to slices.\n"; // Print footer include 'plc_footer.php'; ?>