make shift creation more comfortable by automatically selecting mode on changes to the according fields and remembering entries if error occurs

main
Jan-Philipp Litza 13 years ago
parent 4309131a7d
commit 01463f0ac0

@ -226,7 +226,7 @@ function admin_shifts() {
unset ($_SESSION['admin_shifts_types']); unset ($_SESSION['admin_shifts_types']);
} }
$room_select = html_select_key('rid', $room_array, ''); $room_select = html_select_key('rid', $room_array, $_REQUEST['rid']);
$angel_types = ""; $angel_types = "";
foreach ($types as $type) { foreach ($types as $type) {
$angel_types .= template_render('../templates/admin_shifts_angel_types.html', array ( $angel_types .= template_render('../templates/admin_shifts_angel_types.html', array (
@ -244,9 +244,11 @@ function admin_shifts() {
'end' => date("Y-m-d H:i", $end), 'end' => date("Y-m-d H:i", $end),
'mode_single_selected' => $_REQUEST['mode'] == 'single' ? 'checked="checked"' : '', 'mode_single_selected' => $_REQUEST['mode'] == 'single' ? 'checked="checked"' : '',
'mode_multi_selected' => $_REQUEST['mode'] == 'multi' ? 'checked="checked"' : '', 'mode_multi_selected' => $_REQUEST['mode'] == 'multi' ? 'checked="checked"' : '',
'mode_multi_length' => !empty($_REQUEST['length'])? $_REQUEST['length'] : '120',
'mode_variable_selected' => $_REQUEST['mode'] == 'variable' ? 'checked="checked"' : '', 'mode_variable_selected' => $_REQUEST['mode'] == 'variable' ? 'checked="checked"' : '',
'mode_variable_hours' => !empty($_REQUEST['change_hours'])? $_REQUEST['change_hours'] : '00, 04, 08, 10, 12, 14, 16, 18, 20, 22',
'angelmode_location_selected' => $_REQUEST['angelmode'] == 'location' ? 'checked="checked"' : '', 'angelmode_location_selected' => $_REQUEST['angelmode'] == 'location' ? 'checked="checked"' : '',
'angelmode_manually_selected' => $_REQUEST['angelmode'] == 'manually' ? 'checked="checked"' : '' 'angelmode_manually_selected' => $_REQUEST['angelmode'] == 'manually' ? 'checked="checked"' : ''
)); ));
} }
?> ?>

@ -34,25 +34,25 @@
</p> </p>
<p> <p>
<label> <label>
<input type="radio" name="mode" value="multi" %mode_multi_selected%/> <input type="radio" name="mode" id="multi_shifts" value="multi" %mode_multi_selected%/>
</label>Mehrere Schichten erstellen: </label>Mehrere Schichten erstellen:
</p> </p>
<p> <p>
<label> <label>
Schichtlänge in Minuten: Schichtlänge in Minuten:
</label> </label>
<input type="text" name="length" value="120" /> <input type="text" name="length" value="%mode_multi_length%" onchange="document.getElementById('multi_shifts').checked = true;" />
</p> </p>
<p> <p>
<label> <label>
<input type="radio" name="mode" value="variable" %mode_variable_selected%/> <input type="radio" name="mode" id="var_multi_shifts" value="variable" %mode_variable_selected%/>
</label>Mehrere Schichten mit variabler Länge erstellen: </label>Mehrere Schichten mit variabler Länge erstellen:
</p> </p>
<p> <p>
<label> <label>
Schichtwechsel-Stunden: Schichtwechsel-Stunden:
</label> </label>
<input type="text" name="change_hours" style="width: 300px;" value="00, 04, 08, 10, 12, 14, 16, 18, 20, 22" /> <input type="text" name="change_hours" style="width: 300px;" value="%mode_variable_hours%" onchange="document.getElementById('var_multi_shifts').checked = true;" />
</p><h2>Benötigte Engel:</h2> </p><h2>Benötigte Engel:</h2>
<p> <p>
<label> <label>
@ -61,11 +61,11 @@
</p> </p>
<p> <p>
<label> <label>
<input type="radio" name="angelmode" value="manually" %angelmode_manually_selected%/> <input type="radio" name="angelmode" id="manual_angelmode" value="manually" %angelmode_manually_selected%/>
</label>Es werden folgende Engel benötigt: </label>Es werden folgende Engel benötigt:
</p>%angel_types% </p>%angel_types%
<p> <p>
<input type="submit" name="preview" value="Vorschau" /> <input type="submit" name="preview" value="Vorschau" />
</p> </p>
</fieldset> </fieldset>
</form> </form>

@ -6,11 +6,17 @@
<script type="text/javascript"> <script type="text/javascript">
document.getElementById("type_%id%_up").onclick = function(e){ document.getElementById("type_%id%_up").onclick = function(e){
document.getElementById("type_%id%").value = (parseInt(document.getElementById("type_%id%").value) + 101) % 100; document.getElementById("type_%id%").value = (parseInt(document.getElementById("type_%id%").value) + 101) % 100;
return false; document.getElementById("manual_angelmode").checked = true;
return false;
}; };
document.getElementById("type_%id%_down").onclick = function(e){ document.getElementById("type_%id%_down").onclick = function(e){
document.getElementById("type_%id%").value = (parseInt(document.getElementById("type_%id%").value) +99) % 100; document.getElementById("type_%id%").value = (parseInt(document.getElementById("type_%id%").value) +99) % 100;
return false; document.getElementById("manual_angelmode").checked = true;
return false;
};
document.getElementById("type_%id%").onchange = function(e){
document.getElementById("manual_angelmode").checked = true;
return false;
}; };
</script> </script>
</p> </p>

Loading…
Cancel
Save