X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetlab%2Fslices%2Fslice.php;h=e0868b7361e61aa48bf5519205121ee208b31ea5;hb=e417acbe5b45f14f5f7b0f297a327d2aa18c7038;hp=4e23205797fd4600c956f2faf028c3a2879a2855;hpb=d7cc4e048eea83c6bb75bef519723a918a9c44d0;p=plewww.git diff --git a/planetlab/slices/slice.php b/planetlab/slices/slice.php index 4e23205..e0868b7 100644 --- a/planetlab/slices/slice.php +++ b/planetlab/slices/slice.php @@ -1,7 +1,5 @@ +'); + +$profiling = false; +if (get_array($_GET, 'profiling')) { + $profiling = true; +} -// -------------------- -// recognized URL arguments -$slice_id=intval($_GET['id']); -if ( ! $slice_id ) { plc_error('Malformed URL - id not set'); return; } - -function renew_area ($slice,$site) { - - // 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); - - // the renew area - // xxx some extra code needed to enable this area only if the slice description is OK: - // description and url must be non void - $toggle=new PlekitToggle('renew',"Renew this slice", - array("trigger-bubble"=>"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 ($profiling) { + plc_debug_prof_start(); +} - 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 "