From f1b794697579d63a49345e50861b14874419bab5 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Tue, 26 Dec 2017 13:09:44 +0100 Subject: Removed some short ifs from Shifts_view.php --- includes/view/Shifts_view.php | 70 ++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php index 44c879d2..755fab74 100644 --- a/includes/view/Shifts_view.php +++ b/includes/view/Shifts_view.php @@ -122,39 +122,47 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt $needed_angels .= Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin); } + $content = [msg()]; + + if ($shift_signup_state->getState() == ShiftSignupState::COLLIDES) { + $content[] = info(_('This shift collides with one of your shifts.'), true); + } + + if ($shift_signup_state->getState() == ShiftSignupState::SIGNED_UP) { + $content[] = info(_('You are signed up for this shift.'), true); + } + + $buttons = []; + if ($shift_admin || $admin_shifttypes || $admin_rooms) { + $buttons = [ + $shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '', + $shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '', + $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '', + $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '', + ]; + } + $buttons[] = button(user_link($user), ' ' . _('My shifts')); + $content[] = buttons($buttons); + + $content[] = Shift_view_header($shift, $room); + $content[] = div('row', [ + div('col-sm-6', [ + '

' . _('Needed angels') . '

', + '
' . $needed_angels . '
' + ]), + div('col-sm-6', [ + '

' . _('Description') . '

', + $parsedown->parse($shifttype['description']) + ]) + ]); + + if ($shift_admin) { + $content[] = Shift_editor_info_render($shift); + } + return page_with_title( $shift['name'] . ' %c', - [ - msg(), - $shift_signup_state->getState() == ShiftSignupState::COLLIDES - ? info(_('This shift collides with one of your shifts.'), true) - : '', - $shift_signup_state->getState() == ShiftSignupState::SIGNED_UP - ? info(_('You are signed up for this shift.'), true) - : '', - buttons( - ($shift_admin || $admin_shifttypes || $admin_rooms) ? [ - $shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '', - $shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '', - $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '', - $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '', - button(user_link($user), ' ' . _('My shifts')) - ] : [ - button(user_link($user), ' ' . _('My shifts')) - ]), - Shift_view_header($shift, $room), - div('row', [ - div('col-sm-6', [ - '

' . _('Needed angels') . '

', - '
' . $needed_angels . '
' - ]), - div('col-sm-6', [ - '

' . _('Description') . '

', - $parsedown->parse($shifttype['description']) - ]) - ]), - $shift_admin ? Shift_editor_info_render($shift) : '' - ] + $content ); } -- cgit v1.2.3-54-g00ecf From 6953090e7d789f52761a8f4b505cfbcf0c347018 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Tue, 26 Dec 2017 14:35:01 +0100 Subject: 392: Show warning message when editing html news without proper permissions to save them, Closes #392 --- includes/helper/message_helper.php | 22 +++++++++++++++++----- includes/pages/admin_news.php | 9 +++++++++ locale/de_DE.UTF-8/LC_MESSAGES/default.mo | Bin 43418 -> 43607 bytes locale/de_DE.UTF-8/LC_MESSAGES/default.po | 4 ++++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/includes/helper/message_helper.php b/includes/helper/message_helper.php index 4fa0efe3..3d2b663a 100644 --- a/includes/helper/message_helper.php +++ b/includes/helper/message_helper.php @@ -1,7 +1,7 @@ input('action')) { case 'edit': $user_source = User($news['UID']); + if ( + !in_array('admin_news_html', $privileges) + && strip_tags($news['Text']) != $news['Text'] + ) { + $html .= warning( + _('This message contains HTML. After saving the post some formatting will be lost!'), + true + ); + } $html .= form( [ diff --git a/locale/de_DE.UTF-8/LC_MESSAGES/default.mo b/locale/de_DE.UTF-8/LC_MESSAGES/default.mo index d601751b..6cb4b885 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 19247210..5779141d 100644 --- a/locale/de_DE.UTF-8/LC_MESSAGES/default.po +++ b/locale/de_DE.UTF-8/LC_MESSAGES/default.po @@ -1203,6 +1203,10 @@ msgstr "Log" msgid "Edit news entry" msgstr "News-Eintrag bearbeiten" +#: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_news.php:37 +msgid "This message contains HTML. After saving the post some formatting will be lost!" +msgstr "Diese Nachricht beinhaltet HTML. Wenn du sie speicherst gehen diese Formatierungen verloren!" + #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_news.php:36 msgid "Author" msgstr "Autor" -- cgit v1.2.3-54-g00ecf