summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2011-10-12 17:02:48 +0200
committerPhilip Häusler <msquare@notrademark.de>2011-10-12 17:02:48 +0200
commitd4c17f48f53dd1f123c06b2277dda55a291d6d97 (patch)
tree08365b4137e6b452c146de128876d190b91c1d5b
parentca0ff251315c6c774cf59b22173b5c041be9ffaa (diff)
#35 admin_shifts: escape from preview
-rw-r--r--includes/pages/admin_shifts.php26
-rw-r--r--public/css/base.css4
-rw-r--r--templates/admin_shift_preview.html11
-rw-r--r--templates/admin_shifts.html35
4 files changed, 61 insertions, 15 deletions
diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php
index 5dacb3ff..94c6f38a 100644
--- a/includes/pages/admin_shifts.php
+++ b/includes/pages/admin_shifts.php
@@ -11,6 +11,8 @@ function admin_shifts() {
$end = $start +24 * 60 * 60;
$mode = '';
$angelmode = '';
+ $length = '';
+ $change_hours = '';
// Locations laden
$rooms = sql_select("SELECT * FROM `Room` WHERE `show`='Y' ORDER BY `Name`");
@@ -24,7 +26,7 @@ function admin_shifts() {
foreach ($types as $type)
$needed_angel_types[$type['TID']] = 0;
- if (isset ($_REQUEST['preview'])) {
+ if (isset ($_REQUEST['preview']) || isset ($_REQUEST['back'])) {
// Name/Bezeichnung der Schicht, darf leer sein
$name = strip_request_item('name');
@@ -110,6 +112,10 @@ function admin_shifts() {
$msg .= error("Bitte wähle benötigte Engel.");
}
+ // Beim Zurück-Knopf das Formular zeigen
+ if (isset ($_REQUEST['back']))
+ $ok = false;
+
// Alle Eingaben in Ordnung
if ($ok) {
if ($angelmode == 'location') {
@@ -200,8 +206,20 @@ function admin_shifts() {
$_SESSION['admin_shifts_shifts'] = $shifts;
$_SESSION['admin_shifts_types'] = $needed_angel_types;
+ $hidden_types = "";
+ foreach ($needed_angel_types as $type_id => $count)
+ $hidden_types .= '<input type="hidden" name="type_' . $type_id . '" value="' . $count . '" />';
return template_render('../templates/admin_shift_preview.html', array (
- 'shifts_table' => $shifts_table
+ 'shifts_table' => $shifts_table,
+ 'name' => $name,
+ 'rid' => $rid,
+ 'start' => date("Y-m-d H:i", $start),
+ 'end' => date("Y-m-d H:i", $end),
+ 'mode' => $mode,
+ 'length' => $length,
+ 'change_hours' => $change_hours,
+ 'angelmode' => $angelmode,
+ 'needed_angel_types' => $hidden_types
));
}
@@ -244,9 +262,9 @@ function admin_shifts() {
'end' => date("Y-m-d H:i", $end),
'mode_single_selected' => $_REQUEST['mode'] == 'single' ? 'checked="checked"' : '',
'mode_multi_selected' => $_REQUEST['mode'] == 'multi' ? 'checked="checked"' : '',
- 'mode_multi_length' => !empty($_REQUEST['length'])? $_REQUEST['length'] : '120',
+ 'mode_multi_length' => !empty ($_REQUEST['length']) ? $_REQUEST['length'] : '120',
'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',
+ '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_manually_selected' => $_REQUEST['angelmode'] == 'manually' ? 'checked="checked"' : ''
));
diff --git a/public/css/base.css b/public/css/base.css
index e93d2a9b..55af610f 100644
--- a/public/css/base.css
+++ b/public/css/base.css
@@ -133,6 +133,10 @@ fieldset p label {
width: 200px;
}
+fieldset p label[for] {
+ width: auto;
+}
+
fieldset p label input {
float: right;
margin: 2px 10px 0 0;
diff --git a/templates/admin_shift_preview.html b/templates/admin_shift_preview.html
index 30905618..e04313f6 100644
--- a/templates/admin_shift_preview.html
+++ b/templates/admin_shift_preview.html
@@ -17,7 +17,16 @@
</tbody>
</table>
<p>
- <input type="submit" name="submit" value="Erstellen" />
+ <input type="submit" name="back" value="Zurück" /><input type="submit" name="submit" value="Erstellen" />
</p>
+ <input type="hidden" name="name" value="%name%" />
+ <input type="hidden" name="rid" value="%rid%" />
+ <input type="hidden" name="start" value="%start%" />
+ <input type="hidden" name="end" value="%end%" />
+ <input type="hidden" name="mode" value="%mode%" />
+ <input type="hidden" name="length" value="%length%" />
+ <input type="hidden" name="change_hours" value="%change_hours%" />
+ <input type="hidden" name="angelmode" value="%angelmode%" />
+ %needed_angel_types%
</fieldset>
</form> \ No newline at end of file
diff --git a/templates/admin_shifts.html b/templates/admin_shifts.html
index bfcc4623..3840b76e 100644
--- a/templates/admin_shifts.html
+++ b/templates/admin_shifts.html
@@ -29,43 +29,58 @@
</p><h2>Modus:</h2>
<p>
<label>
- <input type="radio" name="mode" value="single" %mode_single_selected%/>
- </label>Eine Schicht erstellen.
+ <input id="mode_single" type="radio" name="mode" value="single" %mode_single_selected%/>
+ </label>
+ <label for="mode_single">
+ Eine Schicht erstellen.
+ </label>
</p>
<p>
<label>
<input type="radio" name="mode" id="multi_shifts" value="multi" %mode_multi_selected%/>
- </label>Mehrere Schichten erstellen:
+ </label>
+ <label for="multi_shifts">
+ Mehrere Schichten erstellen:
+ </label>
</p>
<p>
<label>
Schichtlänge in Minuten:
</label>
- <input type="text" name="length" value="%mode_multi_length%" onchange="document.getElementById('multi_shifts').checked = true;" />
+ <input type="text" name="length" value="%mode_multi_length%" onchange="document.getElementById('multi_shifts').checked = true;"/>
</p>
<p>
<label>
<input type="radio" name="mode" id="var_multi_shifts" value="variable" %mode_variable_selected%/>
- </label>Mehrere Schichten mit variabler Länge erstellen:
+ </label>
+ <label for="var_multi_shifts">
+ Mehrere Schichten mit variabler Länge erstellen:
+ </label>
</p>
<p>
<label>
Schichtwechsel-Stunden:
</label>
- <input type="text" name="change_hours" style="width: 300px;" value="%mode_variable_hours%" onchange="document.getElementById('var_multi_shifts').checked = true;" />
+ <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>
<label>
- <input type="radio" name="angelmode" value="location" %angelmode_location_selected%/>
- </label>Benötigte Engel vom Ort übernehmen.
+ <input id="angelmode_location" type="radio" name="angelmode" value="location" %angelmode_location_selected%/>
+ </label>
+ <label for="angelmode_location">
+ Benötigte Engel vom Ort übernehmen.
+ </label>
</p>
<p>
<label>
<input type="radio" name="angelmode" id="manual_angelmode" value="manually" %angelmode_manually_selected%/>
- </label>Es werden folgende Engel benötigt:
+ </label>
+ <label for="manual_angelmode">
+ Es werden folgende Engel benötigt:
+ </label>
</p>%angel_types%
<p>
<input type="submit" name="preview" value="Vorschau" />
</p>
</fieldset>
-</form>
+</form> \ No newline at end of file