edit_entry.php (mrbs-1.9.4) | : | edit_entry.php (mrbs-1.10.0) | ||
---|---|---|---|---|
skipping to change at line 489 | skipping to change at line 489 | |||
)); | )); | |||
$field->addElement($select); | $field->addElement($select); | |||
} // foreach | } // foreach | |||
return $field; | return $field; | |||
} | } | |||
function get_field_type($value, $disabled=false) | function get_field_type($value, $disabled=false) | |||
{ | { | |||
global $booking_types, $is_mandatory_field; | global $is_mandatory_field; | |||
// Get the options | ||||
$options = get_type_options(is_book_admin()); | ||||
// Don't bother with types if there's only one of them (or even none) | // Don't bother with types if there's only one of them (or even none) | |||
if (!isset($booking_types) || (count($booking_types) < 2)) | // for the current user. | |||
if (count($options) < 2) | ||||
{ | { | |||
return null; | return null; | |||
} | } | |||
// Get the options | ||||
$options = get_type_options(is_book_admin()); | ||||
// If it's a mandatory field add a blank option to force a selection | // If it's a mandatory field add a blank option to force a selection | |||
if (!empty($is_mandatory_field['entry.type'])) | if (!empty($is_mandatory_field['entry.type'])) | |||
{ | { | |||
$options = array('' => get_type_vocab('')) + $options; | $options = array('' => get_type_vocab('')) + $options; | |||
} | } | |||
$field = new FieldSelect(); | $field = new FieldSelect(); | |||
$field->setLabel(get_vocab('type')) | $field->setLabel(get_vocab('type')) | |||
->setControlAttributes(array('name' => 'type', | ->setControlAttributes(array('name' => 'type', | |||
skipping to change at line 940 | skipping to change at line 942 | |||
) | ) | |||
); | ); | |||
$fieldset->addElement($field); | $fieldset->addElement($field); | |||
// Registration opens and closes | // Registration opens and closes | |||
// The suffix text for registration opens and closes depends on whether | // The suffix text for registration opens and closes depends on whether | |||
// periods are being used. | // periods are being used. | |||
if ($enable_periods) | if ($enable_periods) | |||
{ | { | |||
$time = strtotime($periods_booking_opens); | $time = strtotime($periods_booking_opens); | |||
$time = strftime(hour_min_format(), $time); | $time = utf8_strftime(hour_min_format(), $time); | |||
$in_advance_vocab = get_vocab('in_advance_periods', $time); | $in_advance_vocab = get_vocab('in_advance_periods', $time); | |||
} | } | |||
else | else | |||
{ | { | |||
$in_advance_vocab = get_vocab('in_advance'); | $in_advance_vocab = get_vocab('in_advance'); | |||
} | } | |||
// Registration opens | // Registration opens | |||
$param_names = array( | $param_names = array( | |||
'enabler' => 'registration_opens_enabled', | 'enabler' => 'registration_opens_enabled', | |||
skipping to change at line 1108 | skipping to change at line 1110 | |||
$copy = get_form_var('copy', 'int'); | $copy = get_form_var('copy', 'int'); | |||
$edit_type = get_form_var('edit_type', 'string', ''); | $edit_type = get_form_var('edit_type', 'string', ''); | |||
$returl = get_form_var('returl', 'string'); | $returl = get_form_var('returl', 'string'); | |||
// The following variables are used when coming via a JavaScript drag select | // The following variables are used when coming via a JavaScript drag select | |||
$drag = get_form_var('drag', 'int'); | $drag = get_form_var('drag', 'int'); | |||
$start_seconds = get_form_var('start_seconds', 'int'); | $start_seconds = get_form_var('start_seconds', 'int'); | |||
$end_seconds = get_form_var('end_seconds', 'int'); | $end_seconds = get_form_var('end_seconds', 'int'); | |||
$selected_rooms = get_form_var('rooms', 'array'); | $selected_rooms = get_form_var('rooms', 'array'); | |||
$start_date = get_form_var('start_date', 'string'); | $start_date = get_form_var('start_date', 'string'); | |||
$end_date = get_form_var('end_date', 'string'); | $end_date = get_form_var('end_date', 'string'); | |||
// And this comes from edit_entry_handler.php | ||||
$back_button = get_form_var('back_button', 'string'); | ||||
// Check the CSRF token. | // Check the CSRF token. | |||
// Only check the token if the page is accessed via a POST request. Therefore | // Only check the token if the page is accessed via a POST request. Therefore | |||
// this page should not take any action, but only display data. | // this page should not take any action, but only display data. | |||
Form::checkToken($post_only=true); | Form::checkToken($post_only=true); | |||
// Get the return URL. Need to do this before checkAuthorised(). | // Get the return URL. Need to do this before checkAuthorised(). | |||
// We might be going through edit_entry more than once, for example if we have t o log on on the way. We | // We might be going through edit_entry more than once, for example if we have t o log on on the way. We | |||
// still need to preserve the original calling page so that once we've completed edit_entry_handler we can | // still need to preserve the original calling page so that once we've completed edit_entry_handler we can | |||
// go back to the page we started at (rather than going to the default view). I f this is the first time | // go back to the page we started at (rather than going to the default view). I f this is the first time | |||
skipping to change at line 1335 | skipping to change at line 1339 | |||
$rep_interval = $row['rep_interval']; | $rep_interval = $row['rep_interval']; | |||
// If we're editing the series we want the start_time and end_time to be t he | // If we're editing the series we want the start_time and end_time to be t he | |||
// start and of the first entry of the series, not the start of this entry | // start and of the first entry of the series, not the start of this entry | |||
if ($edit_type == "series") | if ($edit_type == "series") | |||
{ | { | |||
$start_time = $row['start_time']; | $start_time = $row['start_time']; | |||
$end_time = $row['end_time']; | $end_time = $row['end_time']; | |||
} | } | |||
$rep_end_day = (int)strftime('%d', $row['end_date']); | $rep_end_day = (int)utf8_strftime('%d', $row['end_date']); | |||
$rep_end_month = (int)strftime('%m', $row['end_date']); | $rep_end_month = (int)utf8_strftime('%m', $row['end_date']); | |||
$rep_end_year = (int)strftime('%Y', $row['end_date']); | $rep_end_year = (int)utf8_strftime('%Y', $row['end_date']); | |||
// Get the end date in string format as well, for use when | // Get the end date in string format as well, for use when | |||
// the input is disabled | // the input is disabled | |||
$rep_end_date = utf8_strftime('%A %d %B %Y',$row['end_date']); | $rep_end_date = utf8_strftime('%A %d %B %Y',$row['end_date']); | |||
switch ($rep_type) | switch ($rep_type) | |||
{ | { | |||
case REP_WEEKLY: | case REP_WEEKLY: | |||
for ($i=0; $i<DAYS_PER_WEEK; $i++) | for ($i=0; $i<DAYS_PER_WEEK; $i++) | |||
{ | { | |||
if ($row['rep_opt'][$i]) | if ($row['rep_opt'][$i]) | |||
skipping to change at line 1510 | skipping to change at line 1514 | |||
if (!isset($month_relative)) | if (!isset($month_relative)) | |||
{ | { | |||
$month_relative = date_byday($start_time); | $month_relative = date_byday($start_time); | |||
} | } | |||
if (!isset($month_absolute)) | if (!isset($month_absolute)) | |||
{ | { | |||
$month_absolute = date('j', $start_time); | $month_absolute = date('j', $start_time); | |||
} | } | |||
list($month_relative_ord, $month_relative_day) = byday_split($month_relative); | list($month_relative_ord, $month_relative_day) = byday_split($month_relative); | |||
$start_hour = strftime('%H', $start_time); | $start_hour = utf8_strftime('%H', $start_time); | |||
$start_min = strftime('%M', $start_time); | $start_min = utf8_strftime('%M', $start_time); | |||
// Determine the area id of the room in question first | // Determine the area id of the room in question first | |||
$area_id = mrbsGetRoomArea($room_id); | $area_id = mrbsGetRoomArea($room_id); | |||
$enable_periods ? toPeriodString($start_min, $duration, $dur_units) : toTimeStri ng($duration, $dur_units); | $enable_periods ? toPeriodString($start_min, $duration, $dur_units) : toTimeStri ng($duration, $dur_units); | |||
//now that we know all the data to fill the form with we start drawing it | //now that we know all the data to fill the form with we start drawing it | |||
if (!getWritable($create_by, $room_id)) | if (!getWritable($create_by, $room_id)) | |||
{ | { | |||
skipping to change at line 1671 | skipping to change at line 1675 | |||
} | } | |||
} | } | |||
$form = new Form(); | $form = new Form(); | |||
$form->setAttributes(array('class' => 'standard js_hidden', | $form->setAttributes(array('class' => 'standard js_hidden', | |||
'id' => 'main', | 'id' => 'main', | |||
'action' => multisite('edit_entry_handler.php'), | 'action' => multisite('edit_entry_handler.php'), | |||
'method' => 'post')); | 'method' => 'post')); | |||
if (!empty($back_button)) | ||||
{ | ||||
// Add a data attribute so that the JavaScript can tell where we've come from | ||||
$form->setAttribute('data-back', 1); | ||||
} | ||||
$hidden_inputs = array('returl' => $returl, | $hidden_inputs = array('returl' => $returl, | |||
'rep_id' => $rep_id, | 'rep_id' => $rep_id, | |||
'edit_type' => $edit_type); | 'edit_type' => $edit_type); | |||
$form->addHiddenInputs($hidden_inputs); | $form->addHiddenInputs($hidden_inputs); | |||
// The original_room_id will only be set if this was an existing booking. | // The original_room_id will only be set if this was an existing booking. | |||
// If it is an existing booking then edit_entry_handler needs to know the | // If it is an existing booking then edit_entry_handler needs to know the | |||
// original room id and the ical_uid and the ical_sequence, because it will | // original room id and the ical_uid and the ical_sequence, because it will | |||
// have to keep the ical_uid and increment the ical_sequence for the room that | // have to keep the ical_uid and increment the ical_sequence for the room that | |||
End of changes. 8 change blocks. | ||||
10 lines changed or deleted | 20 lines changed or added |