diff --git a/db/update.sql b/db/update.sql index 594969f9..3dbd613a 100644 --- a/db/update.sql +++ b/db/update.sql @@ -1,3 +1,16 @@ +/* more shift infos */ +ALTER TABLE `Shifts` ADD `created_by_user_id` INT NOT NULL , +ADD `created_at_timestamp` INT NOT NULL , +ADD `edited_by_user_id` INT NOT NULL , +ADD `edited_at_timestamp` INT NOT NULL; +ALTER TABLE `Shifts` ADD INDEX ( `created_by_user_id` ); +ALTER TABLE `Shifts` ADD INDEX ( `edited_by_user_id` ); +ALTER TABLE `Shifts` CHANGE `created_by_user_id` `created_by_user_id` INT( 11 ) NULL ; +ALTER TABLE `Shifts` CHANGE `edited_by_user_id` `edited_by_user_id` INT( 11 ) NULL ; +update Shifts set created_by_user_id=null, edited_by_user_id=null; +ALTER TABLE `Shifts` ADD FOREIGN KEY ( `created_by_user_id` ) REFERENCES `engelsystem`.`User` (`UID`) ON DELETE SET NULL ON UPDATE CASCADE ; +ALTER TABLE `Shifts` ADD FOREIGN KEY ( `edited_by_user_id` ) REFERENCES `engelsystem`.`User` (`UID`) ON DELETE SET NULL ON UPDATE CASCADE ; + /* Introduce planned departure date */ ALTER TABLE `User` ADD `planned_departure_date` INT NULL, ADD INDEX ( `planned_departure_date` ); diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index c12d3e01..d32de0cb 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -101,6 +101,7 @@ function Shift_delete($shift_id) { * Update a shift. */ function Shift_update($shift) { + global $user; $shift['name'] = ShiftType($shift['shifttype_id'])['name']; mail_shift_change(Shift($shift['SID']), $shift); @@ -111,7 +112,9 @@ function Shift_update($shift) { `RID`='" . sql_escape($shift['RID']) . "', `title`=" . sql_null($shift['title']) . ", `URL`=" . sql_null($shift['URL']) . ", - `PSID`=" . sql_null($shift['PSID']) . " + `PSID`=" . sql_null($shift['PSID']) . ", + `edited_by_user_id`='" . sql_escape($user['UID']) . "', + `edited_at_timestamp`=" . time() . " WHERE `SID`='" . sql_escape($shift['SID']) . "'"); } @@ -134,6 +137,7 @@ function Shift_update_by_psid($shift) { * @return new shift id or false */ function Shift_create($shift) { + global $user; $result = sql_query("INSERT INTO `Shifts` SET `shifttype_id`='" . sql_escape($shift['shifttype_id']) . "', `start`='" . sql_escape($shift['start']) . "', @@ -141,7 +145,9 @@ function Shift_create($shift) { `RID`='" . sql_escape($shift['RID']) . "', `title`=" . sql_null($shift['title']) . ", `URL`=" . sql_null($shift['URL']) . ", - `PSID`=" . sql_null($shift['PSID'])); + `PSID`=" . sql_null($shift['PSID']) . ", + `created_by_user_id`='" . sql_escape($user['UID']) . "', + `created_at_timestamp`=" . time()); if ($result === false) return false; return sql_id(); diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php index 9586cf90..b0628a3b 100644 --- a/includes/view/Shifts_view.php +++ b/includes/view/Shifts_view.php @@ -1,5 +1,14 @@ ', $info); +} + function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null, $user_shifts = null) { global $user; @@ -60,6 +69,7 @@ function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, } return page_with_title($shift['name'] . ' %c', [ + msg(), Shift_collides($shift, $user_shifts) ? info(_('This shift collides with one of your shifts.'), true) : '', $signed_up ? info(_('You are signed up for this shift.'), true) : '', @@ -104,7 +114,8 @@ function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source, '

' . _('Description') . '

', $parsedown->parse($shifttype['description']) ]) - ]) + ]), + $shift_admin ? Shift_editor_info_render($shift) : '' ]); } diff --git a/locale/de_DE.UTF-8/LC_MESSAGES/default.mo b/locale/de_DE.UTF-8/LC_MESSAGES/default.mo index a1f9cab6..3e58bc2a 100644 Binary files a/locale/de_DE.UTF-8/LC_MESSAGES/default.mo and b/locale/de_DE.UTF-8/LC_MESSAGES/default.mo differ diff --git a/locale/de_DE.UTF-8/LC_MESSAGES/default.po b/locale/de_DE.UTF-8/LC_MESSAGES/default.po index 8f724435..d2241761 100644 --- a/locale/de_DE.UTF-8/LC_MESSAGES/default.po +++ b/locale/de_DE.UTF-8/LC_MESSAGES/default.po @@ -1,8 +1,8 @@ msgid "" msgstr "" "Project-Id-Version: Engelsystem 2.0\n" -"POT-Creation-Date: 2015-08-15 14:53+0100\n" -"PO-Revision-Date: 2015-08-15 14:54+0100\n" +"POT-Creation-Date: 2015-08-15 23:36+0100\n" +"PO-Revision-Date: 2015-08-15 23:36+0100\n" "Last-Translator: msquare \n" "Language-Team: \n" "Language: de_DE\n" @@ -114,7 +114,7 @@ msgstr "ansehen" #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_groups.php:23 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_rooms.php:18 #: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:84 -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:67 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:77 #: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:52 #: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:63 #: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:156 @@ -131,7 +131,7 @@ msgstr "bearbeiten" #: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:86 #: /Users/msquare/workspace/projects/engelsystem/includes/view/Questions_view.php:5 #: /Users/msquare/workspace/projects/engelsystem/includes/view/Questions_view.php:12 -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:68 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:78 #: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:15 #: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:53 #: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:64 @@ -680,7 +680,6 @@ msgid "arrived" msgstr "angekommen" #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_arrive.php:109 -#, fuzzy msgid "Planned arrival" msgstr "Geplanter Ankunftstag" @@ -907,7 +906,7 @@ msgstr "Tag" #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:128 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:137 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:306 -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:78 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:88 msgid "Start" msgstr "Beginn" @@ -915,7 +914,7 @@ msgstr "Beginn" #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:129 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:138 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:307 -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:86 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:96 msgid "End" msgstr "Ende" @@ -930,7 +929,7 @@ msgstr "Schichttyp" #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_import.php:140 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:302 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:185 -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:74 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:84 msgid "Title" msgstr "Titel" @@ -1137,7 +1136,7 @@ msgstr "Typ und Titel" #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:255 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_shifts.php:316 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:189 -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:100 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:110 msgid "Needed angels" msgstr "Benötigte Engel" @@ -1715,7 +1714,7 @@ msgstr[0] "%d Helfer benötigt" msgstr[1] "%d Helfer benötigt" #: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:638 -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:13 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:22 msgid "Sign up" msgstr "Eintragen" @@ -1725,7 +1724,7 @@ msgstr "vorbei" #: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:649 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/user_shifts.php:782 -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:15 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:24 #, php-format msgid "Become %s" msgstr "Werde ein %s" @@ -1846,7 +1845,7 @@ msgstr "" #: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:63 #: /Users/msquare/workspace/projects/engelsystem/includes/view/AngelTypes_view.php:93 -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:104 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:114 #: /Users/msquare/workspace/projects/engelsystem/includes/view/ShiftTypes_view.php:35 msgid "Description" msgstr "Beschreibung" @@ -1972,15 +1971,25 @@ msgstr "Typ:" msgid "Comment (for your eyes only):" msgstr "Kommentar (nur für Dich):" -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:64 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:6 +#, php-format +msgid "created at %s by %s" +msgstr "erstellt am %s von %s" + +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:8 +#, php-format +msgid "edited at %s by %s" +msgstr "bearbeitet am %s von %s" + +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:74 msgid "This shift collides with one of your shifts." msgstr "Diese Schicht kollidiert mit deinen Schichten." -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:65 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:75 msgid "You are signed up for this shift." msgstr "Du bist für diese Schicht eingetragen." -#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:94 +#: /Users/msquare/workspace/projects/engelsystem/includes/view/Shifts_view.php:104 #: /Users/msquare/workspace/projects/engelsystem/includes/view/User_view.php:221 msgid "Location" msgstr "Ort"