Reimplementation of 2840bb619 (signup requires arrival), closes #330

This commit is contained in:
Igor Scheller 2017-08-31 12:25:06 +02:00
parent 2bd127c011
commit 0a20883aa8
7 changed files with 52 additions and 24 deletions

View File

@ -4,7 +4,7 @@
return [
// MySQL-Connection Settings
'database' => [
'database' => [
'host' => 'localhost',
'user' => 'root',
'pw' => '',
@ -12,28 +12,28 @@ return [
],
// For accessing stats
'api_key' => '',
'api_key' => '',
// Enable maintenance mode (show a static page)
'maintenance' => false,
'maintenance' => false,
// Set to development to enable debugging messages
'environment' => 'production',
'environment' => 'production',
// URL to the angel faq and job description
'faq_url' => 'https://events.ccc.de/congress/2013/wiki/Static:Volunteers',
'faq_url' => 'https://events.ccc.de/congress/2013/wiki/Static:Volunteers',
// Contact email address, linked on every page
'contact_email' => 'mailto:ticket@c3heaven.de',
'contact_email' => 'mailto:ticket@c3heaven.de',
// From address of all emails
'no_reply_email' => 'noreply@engelsystem.de',
'no_reply_email' => 'noreply@engelsystem.de',
// Default theme, 1=style1.css
'theme' => 1,
'theme' => 1,
// Available themes
'available_themes' => [
'available_themes' => [
'4' => 'Engelsystem 33c3 (2016)',
'3' => 'Engelsystem 32c3 (2015)',
'2' => 'Engelsystem cccamp15',
@ -42,10 +42,13 @@ return [
],
// Number of News shown on one site
'display_news' => 6,
'display_news' => 6,
// Only arrived angels can sign up for shifts
'signup_requires_arrival' => false,
// Anzahl Stunden bis zum Austragen eigener Schichten
'last_unsubscribe' => 3,
'last_unsubscribe' => 3,
// Setzt den zu verwendenden Crypto-Algorithmus (entsprechend der Dokumentation von crypt()).
// Falls ein Benutzerpasswort in einem anderen Format gespeichert ist,
@ -55,7 +58,7 @@ return [
// Blowfish '$2y$13'
// SHA-256 '$5$rounds=5000'
// SHA-512 '$6$rounds=5000'
'crypt_alg' => '$6$rounds=5000',
'crypt_alg' => '$6$rounds=5000',
'min_password_length' => 8,

View File

@ -57,16 +57,17 @@ function success($msg, $immediately = false)
* @param string $class
* @param string $msg
* @param bool $immediately
* @return string|null
* @return string
*/
function alert($class, $msg, $immediately = false)
{
$session = session();
if (empty($msg)) {
return '';
}
if ($immediately) {
if ($msg == '') {
return '';
}
return '<div class="alert alert-' . $class . '">' . $msg . '</div>';
}
@ -74,5 +75,5 @@ function alert($class, $msg, $immediately = false)
$message .= alert($class, $msg, true);
$session->set('msg', $message);
return null;
return '';
}

View File

@ -245,6 +245,10 @@ function Shift_signup_allowed_angel(
) {
$free_entries = Shift_free_entries($needed_angeltype, $shift_entries);
if (config('signup_requires_arrival') && !$user['Gekommen']) {
return new ShiftSignupState(ShiftSignupState::SHIFT_ENDED, $free_entries);
}
if ($user_shifts == null) {
$user_shifts = Shifts_by_user($user);
}

View File

@ -206,6 +206,11 @@ function view_user_shifts()
$end_day = date('Y-m-d', $shiftsFilter->getEndTime());
$end_time = date('H:i', $shiftsFilter->getEndTime());
$assignNotice = '';
if (config('signup_requires_arrival') && !$user['Gekommen']) {
$assignNotice = info(render_user_arrived_hint(), true);
}
return page([
div('col-md-12', [
msg(),
@ -229,6 +234,7 @@ function view_user_shifts()
. ' <a href="' . page_link_to('angeltypes', ['action' => 'about']) . '">'
. _('Description of the jobs.')
. '</a>',
'assign_notice' => $assignNotice,
'shifts_table' => msg() . $shiftCalendarRenderer->render(),
'ical_text' => '<h2>' . _('iCal export') . '</h2><p>' . sprintf(
_('Export of shown shifts. <a href="%s">iCal format</a> or <a href="%s">JSON format</a> available (please keep secret, otherwise <a href="%s">reset the api key</a>).'),

View File

@ -11,8 +11,16 @@ use Engelsystem\ShiftsFilterRenderer;
*/
function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalendarRenderer $shiftCalendarRenderer)
{
global $user;
$assignNotice = '';
if (config('signup_requires_arrival') && !$user['Gekommen']) {
$assignNotice = info(render_user_arrived_hint(), true);
}
return page_with_title(glyph('map-marker') . $room['Name'], [
$shiftsFilterRenderer->render($room),
$assignNotice,
$shiftCalendarRenderer->render()
]);
}

View File

@ -19,7 +19,7 @@ $free_pages = [
'stats',
'users',
'user_driver_licenses',
'user_password_recovery'
'user_password_recovery',
];
// Gewünschte Seite/Funktion
@ -218,6 +218,7 @@ $parameters = [
if ($page == 'user_meetings') {
$parameters['meetings'] = 1;
}
echo view(__DIR__ . '/../templates/layout.html', [
'theme' => isset($user) ? $user['color'] : config('theme'),
'title' => $title,

View File

@ -4,12 +4,14 @@
var days = document.getElementById(id + '_day').getElementsByTagName(
'option');
for (var i = 0; i < days.length; i++) {
if (days[i].value == moment().format('YYYY-MM-DD'))
if (days[i].value === moment().format('YYYY-MM-DD')) {
days[i].selected = true;
}
}
}
</script>
<form class="form-inline" action="" method="get">
<form class="form-inline" action="">
<input type="hidden" name="p" value="user_shifts">
<div class="row">
<div class="col-md-6">
@ -17,7 +19,7 @@
<div class="form-group">%start_select%</div>
<div class="form-group">
<div class="input-group">
<input class="form-control" type="text" id="start_time" name="start_time" size="5"
<input class="form-control" id="start_time" name="start_time" size="5"
pattern="^\d{1,2}:\d{2}$" placeholder="HH:MM" maxlength="5" value="%start_time%">
<div class="input-group-btn">
<button class="btn btn-default" title="Now" type="button" onclick="set_to_now('start');">
@ -30,7 +32,7 @@
<div class="form-group">%end_select%</div>
<div class="form-group">
<div class="input-group">
<input class="form-control" type="text" id="end_time" name="end_time" size="5"
<input class="form-control" id="end_time" name="end_time" size="5"
pattern="^\d{1,2}:\d{2}$" placeholder="HH:MM" maxlength="5" value="%end_time%">
<div class="input-group-btn">
<button class="btn btn-default" title="Now" type="button" onclick="set_to_now('end');">
@ -46,8 +48,11 @@
</div>
<div class="row">
<div class="col-md-6">
<div>%task_notice%</div>
<input class="btn btn-primary" type="submit" style="width: 75%; margin-bottom: 20px" value="%filter%">
<div>%assign_notice%</div>
</div>
<div class="col-md-6">
<div><p>%task_notice%</p></div>
<input class="btn btn-primary" type="submit" style="width:75%; margin-bottom: 20px" value="%filter%">
</div>
</div>
</form>