- Timestamp:
- 06/22/05 10:20:07 (18 years ago)
- Location:
- trunk/web/addons/toga
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/toga/search.php
r156 r157 5 5 function validateFormInput() { 6 6 global $clustername, $tpl, $id, $user, $name, $start_from_time, $start_to_time, $queue; 7 global $end_from_time, $end_to_time ;7 global $end_from_time, $end_to_time, $period_start, $period_stop; 8 8 9 9 $error = 0; 10 $error_msg = "<FONT COLOR=\"red\"><B>"; 11 $show_msg = 0; 10 12 11 13 $none_set = 0; … … 13 15 if( $id == '' and $user == '' and $name == '' and $start_from_time == '' and $start_to_time == '' and $queue == '' and $end_from_time == '' and $end_to_time == '') { 14 16 $error = 1; 15 $error_msg = "<FONT COLOR=\"red\"><B>No search criteria set!</B></FONT>"; 17 $show_msg = 1; 18 $error_msg .= "No search criteria set!"; 16 19 } 17 20 … … 19 22 20 23 $error = 1; 21 $error_msg = "<FONT COLOR=\"red\"><B>Id must be a number</B></FONT>"; 24 $show_msg = 1; 25 $error_msg .= "Id must be a number"; 22 26 } 23 27 28 //printf( "period_start = %s period_stop = %s\n", $period_start, $period_stop ); 29 30 if( !$error and $period_start != '' ) { 31 //printf( "period_start = %s period_stop = %s\n", $period_start, $period_stop ); 32 $pstart_epoch = datetimeToEpoch( $period_start ); 33 //printf( "period_start = %s period_stop = %s\n", $period_start, $period_stop ); 34 if( $period_stop != '' ) { 35 36 $pstop_epoch = datetimeToEpoch( $period_stop ); 37 printf( "pstop_epoch = %s pstart_epoch = %s\n", $pstop_epoch, $pstart_epoch ); 38 39 if( $pstart_epoch > $pstop_epoch ) { 40 41 $show_msg = 1; 42 $error_msg .= "Graph timeperiod reset: start date/time can't be later than end"; 43 $period_stop = ''; 44 $period_start = ''; 45 } else if( $pstop_epoch == $pstart_epoch ) { 46 47 $show_msg = 1; 48 $error_msg .= "Graph timeperiod reset: start and end date/time can't be the same"; 49 $period_stop = ''; 50 $period_start = ''; 51 } 52 } 53 } 54 55 $error_msg .= "</B></FONT>"; 24 56 // doe checks en set error en error_msg in case shit 25 57 26 if( $ error) {58 if( $show_msg ) 27 59 $tpl->assign( "form_error_msg", $error_msg ); 28 return 0; 29 } else { 30 return 1; 31 } 60 61 return ($error ? 0 : 1 ); 32 62 } 33 63 … … 108 138 function datetimeToEpoch( $datetime ) { 109 139 140 //printf("datetime = %s\n", $datetime ); 110 141 $datetime_fields = explode( ' ', $datetime ); 111 142 … … 119 150 $years = $date_fields[2]; 120 151 152 //printf( "days = %s months = %s years = %s\n", $days, $months, $years ); 153 121 154 $time_fields = explode( ':', $time ); 122 155 … … 125 158 $seconds = $time_fields[2]; 126 159 160 //printf( "hours = %s minutes = %s seconds = %s\n", $hours, $minutes, $seconds ); 161 127 162 $timestamp = mktime( $hours, $minutes, $seconds, $months, $days, $years ); 163 164 //printf( "timestamp = %s\n", $timestamp ); 128 165 129 166 return $timestamp; … … 271 308 //printf("start = %s stop = %s\n", $start, $stop ); 272 309 273 if( !$period_start ) // Add an additional 5 minutes before310 if( !$period_start ) // Add an extra 10% to graphstart 274 311 $period_start = intval( $job_start - (intval( $runningtime * 0.10 ) ) ); 275 312 else 276 313 $period_start = datetimeToEpoch( $period_start ); 277 314 278 if( !$period_stop ) // Add an additional 5 minutes after315 if( !$period_stop ) // Add an extra 10% to graphend 279 316 $period_stop = intval( $job_stop + (intval( $runningtime * 0.10 ) ) ); 280 317 else -
trunk/web/addons/toga/templates/search.tpl
r149 r157 194 194 <TD></TD> 195 195 <TD></TD> 196 <TD> {form_error_msg}</TD>196 <TD></TD> 197 197 <TD> 198 198 <INPUT TYPE="submit" VALUE="Search archive" onClick="setSearchTimestamps();"> … … 202 202 203 203 </TABLE> 204 <BR><BR>204 {form_error_msg}<BR><BR> 205 205 <!-- START BLOCK : search_results --> 206 206
Note: See TracChangeset
for help on using the changeset viewer.