Merge pull request #393 from MyIgel/master

Removed some short ifs from Shifts_view.php, add warning when editing HTML
main
msquare 7 years ago committed by GitHub
commit a3905dc8e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,7 +1,7 @@
<?php <?php
/** /**
* Gibt zwischengespeicherte Fehlermeldungen zurück und löscht den Zwischenspeicher * Returns messages from session and removes them from the stack
* *
* @return string * @return string
*/ */
@ -16,7 +16,7 @@ function msg()
} }
/** /**
* Rendert eine Information * Renders an information message
* *
* @param string $msg * @param string $msg
* @param bool $immediately * @param bool $immediately
@ -28,7 +28,19 @@ function info($msg, $immediately = false)
} }
/** /**
* Rendert eine Fehlermeldung * Renders a warning message
*
* @param string $msg
* @param bool $immediately
* @return string
*/
function warning($msg, $immediately = false)
{
return alert('warning', $msg, $immediately);
}
/**
* Renders an error message
* *
* @param string $msg * @param string $msg
* @param bool $immediately * @param bool $immediately
@ -40,7 +52,7 @@ function error($msg, $immediately = false)
} }
/** /**
* Rendert eine Erfolgsmeldung * Renders a success message
* *
* @param string $msg * @param string $msg
* @param bool $immediately * @param bool $immediately
@ -52,7 +64,7 @@ function success($msg, $immediately = false)
} }
/** /**
* Renders an alert with given alert-* class. * Renders an alert message with the given alert-* class.
* *
* @param string $class * @param string $class
* @param string $msg * @param string $msg

@ -29,6 +29,15 @@ function admin_news()
switch ($request->input('action')) { switch ($request->input('action')) {
case 'edit': case 'edit':
$user_source = User($news['UID']); $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( $html .= form(
[ [

@ -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); $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), '<span class="icon-icon_angel"></span> ' . _('My shifts'));
$content[] = buttons($buttons);
$content[] = Shift_view_header($shift, $room);
$content[] = div('row', [
div('col-sm-6', [
'<h2>' . _('Needed angels') . '</h2>',
'<div class="list-group">' . $needed_angels . '</div>'
]),
div('col-sm-6', [
'<h2>' . _('Description') . '</h2>',
$parsedown->parse($shifttype['description'])
])
]);
if ($shift_admin) {
$content[] = Shift_editor_info_render($shift);
}
return page_with_title( return page_with_title(
$shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', $shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
[ $content
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), '<span class="icon-icon_angel"></span> ' . _('My shifts'))
] : [
button(user_link($user), '<span class="icon-icon_angel"></span> ' . _('My shifts'))
]),
Shift_view_header($shift, $room),
div('row', [
div('col-sm-6', [
'<h2>' . _('Needed angels') . '</h2>',
'<div class="list-group">' . $needed_angels . '</div>'
]),
div('col-sm-6', [
'<h2>' . _('Description') . '</h2>',
$parsedown->parse($shifttype['description'])
])
]),
$shift_admin ? Shift_editor_info_render($shift) : ''
]
); );
} }

@ -1203,6 +1203,10 @@ msgstr "Log"
msgid "Edit news entry" msgid "Edit news entry"
msgstr "News-Eintrag bearbeiten" 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 #: /Users/msquare/workspace/projects/engelsystem/includes/pages/admin_news.php:36
msgid "Author" msgid "Author"
msgstr "Autor" msgstr "Autor"

Loading…
Cancel
Save