edit_room.php (mrbs-1.9.4) | : | edit_room.php (mrbs-1.10.0) | ||
---|---|---|---|---|
skipping to change at line 55 | skipping to change at line 55 | |||
// tinyint returns an int). In order to have a boolean field in the room | // tinyint returns an int). In order to have a boolean field in the room | |||
// table you should use a smallint in PostgreSQL or a smallint or a tinyint | // table you should use a smallint in PostgreSQL or a smallint or a tinyint | |||
// in MySQL. | // in MySQL. | |||
// | // | |||
// You can put a description of the column that will be used as the label in | // You can put a description of the column that will be used as the label in | |||
// the form in the $vocab_override variable in the config file using the tag | // the form in the $vocab_override variable in the config file using the tag | |||
// 'room.[columnname]'. | // 'room.[columnname]'. | |||
// | // | |||
// For example if you want to add a column specifying whether or not a room | // For example if you want to add a column specifying whether or not a room | |||
// has a coffee machine you could add a column to the room table called | // has a coffee machine you could add a column to the room table called | |||
// 'coffee_machine' of type tinyint(1), in MySQL, or smallint in PostgreSQL. | // 'coffee_machine' of type tinyint, in MySQL, or smallint in PostgreSQL. | |||
// Then in the config file you would add the line | // Then in the config file you would add the line | |||
// | // | |||
// $vocab_override['en']['room.coffee_machine'] = "Coffee machine"; // or appro priate translation | // $vocab_override['en']['room.coffee_machine'] = "Coffee machine"; // or appro priate translation | |||
// | // | |||
// If MRBS can't find an entry for the field in the lang file or vocab overrides , then | // If MRBS can't find an entry for the field in the lang file or vocab overrides , then | |||
// it will use the fieldname, eg 'coffee_machine'. | // it will use the fieldname, eg 'coffee_machine'. | |||
function get_custom_fields($data) | function get_custom_fields($data) | |||
{ | { | |||
global $standard_fields, $text_input_max; | global $standard_fields, $text_input_max; | |||
skipping to change at line 252 | skipping to change at line 252 | |||
} | } | |||
// Then the custom fields | // Then the custom fields | |||
$fields = get_custom_fields($data); | $fields = get_custom_fields($data); | |||
$fieldset->addElements($fields); | $fieldset->addElements($fields); | |||
// The Submit and Back buttons | // The Submit and Back buttons | |||
$field = new FieldInputSubmit(); | $field = new FieldInputSubmit(); | |||
$back = new ElementInputSubmit(); | $back = new ElementInputSubmit(); | |||
$back->setAttributes(array('value' => get_vocab('backadmin'), | $back->setAttributes(array('value' => get_vocab('back'), | |||
'formaction' => multisite('admin.php'))); | 'formaction' => multisite('admin.php'))); | |||
$field->setAttribute('class', 'buttons') | $field->setAttribute('class', 'buttons') | |||
->addLabelClass('no_suffix') | ->addLabelClass('no_suffix') | |||
->addLabelElement($back) | ->addLabelElement($back) | |||
->setControlAttribute('value', get_vocab('change')); | ->setControlAttribute('value', get_vocab('save')); | |||
if (!is_admin()) | if (!is_admin()) | |||
{ | { | |||
$field->removeControl(); | $field->removeControl(); | |||
} | } | |||
$fieldset->addElement($field); | $fieldset->addElement($field); | |||
return $fieldset; | return $fieldset; | |||
} | } | |||
// Check the user is authorised for this page | // Check the user is authorised for this page | |||
skipping to change at line 302 | skipping to change at line 302 | |||
$attributes = array('id' => 'edit_room', | $attributes = array('id' => 'edit_room', | |||
'class' => 'standard', | 'class' => 'standard', | |||
'action' => multisite('edit_room_handler.php'), | 'action' => multisite('edit_room_handler.php'), | |||
'method' => 'post'); | 'method' => 'post'); | |||
// Non-admins will only be allowed to view room details, not change them | // Non-admins will only be allowed to view room details, not change them | |||
$legend = (is_admin()) ? get_vocab('editroom') : get_vocab('viewroom'); | $legend = (is_admin()) ? get_vocab('editroom') : get_vocab('viewroom'); | |||
$form->setAttributes($attributes) | $form->setAttributes($attributes) | |||
->addHiddenInput('room', $data['id']) | ->addHiddenInputs(array( | |||
->addHiddenInput('old_area', $data['area_id']) | 'room' => $data['id'], | |||
->addHiddenInput('old_room_name', $data['room_name']); | 'area' => $data['area_id'], | |||
'old_area' => $data['area_id'], | ||||
'old_room_name' => $data['room_name'] | ||||
)); | ||||
$outer_fieldset = new ElementFieldset(); | $outer_fieldset = new ElementFieldset(); | |||
$outer_fieldset->addLegend($legend) | $outer_fieldset->addLegend($legend) | |||
->addElement(get_fieldset_errors($errors)) | ->addElement(get_fieldset_errors($errors)) | |||
->addElement(get_fieldset_general($data)); | ->addElement(get_fieldset_general($data)); | |||
$form->addElement($outer_fieldset); | $form->addElement($outer_fieldset); | |||
$form->render(); | $form->render(); | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 9 lines changed or added |