Bugfixes & improvements

This commit is contained in:
Igor Scheller 2017-01-03 15:32:12 +01:00
parent 1c27bf1375
commit 8254a79c58
7 changed files with 41 additions and 27 deletions

View File

@ -123,7 +123,7 @@ function user_driver_license_edit_controller()
if (UserDriverLicense_valid($user_driver_license)) {
if ($user_driver_license['user_id'] == null) {
$user_driver_license = UserDriverLicenses_create($user_driver_license, $user);
$user_driver_license = UserDriverLicenses_create($user_driver_license, $user_source['UID']);
} else {
UserDriverLicenses_update($user_driver_license);
}

View File

@ -53,12 +53,18 @@ function Room_create($name, $from_frab, $public, $number = null)
/**
* Returns room by id.
*
* @param int $room_id RID
* @param int $room_id RID
* @param bool $show_only
* @return array|false
*/
function Room($room_id)
function Room($room_id, $show_only = true)
{
$room_source = sql_select("SELECT * FROM `Room` WHERE `RID`='" . sql_escape($room_id) . "' AND `show` = 'Y'");
$room_source = sql_select("
SELECT *
FROM `Room`
WHERE `RID`='" . sql_escape($room_id) . "'
" . ($show_only ? "AND `show` = 'Y'" : '')
);
if ($room_source === false) {
return false;

View File

@ -45,7 +45,7 @@ function admin_rooms()
}
if (test_request_int('id')) {
$room = Room($_REQUEST['id']);
$room = Room($_REQUEST['id'], false);
if ($room === false) {
engelsystem_error('Unable to load room.');
}
@ -209,7 +209,11 @@ function admin_rooms()
]),
sprintf(_('Do you want to delete room %s?'), $name),
buttons([
button(page_link_to('admin_rooms') . '&show=delete&id=' . $room_id . '&ack', _('Delete'), 'delete')
button(
page_link_to('admin_rooms') . '&show=delete&id=' . $room_id . '&ack',
_('Delete'),
'delete btn-danger'
)
])
]);
}

View File

@ -41,18 +41,20 @@ function admin_user()
$html .= '<input type="hidden" name="Type" value="Normal">' . "\n";
$html .= '<tr><td>' . "\n";
$html .= '<table>' . "\n";
$html .= ' <tr><td>Nick</td><td>' . '<input type="text" size="40" name="eNick" value="' . $user_source['Nick'] . '"></td></tr>' . "\n";
$html .= ' <tr><td>lastLogIn</td><td>' . date('Y-m-d H:i', $user_source['lastLogIn']) . '</td></tr>' . "\n";
$html .= ' <tr><td>Name</td><td>' . '<input type="text" size="40" name="eName" value="' . $user_source['Name'] . '"></td></tr>' . "\n";
$html .= ' <tr><td>Vorname</td><td>' . '<input type="text" size="40" name="eVorname" value="' . $user_source['Vorname'] . '"></td></tr>' . "\n";
$html .= ' <tr><td>Alter</td><td>' . '<input type="text" size="5" name="eAlter" value="' . $user_source['Alter'] . '"></td></tr>' . "\n";
$html .= ' <tr><td>Telefon</td><td>' . '<input type="text" size="40" name="eTelefon" value="' . $user_source['Telefon'] . '"></td></tr>' . "\n";
$html .= ' <tr><td>Handy</td><td>' . '<input type="text" size="40" name="eHandy" value="' . $user_source['Handy'] . '"></td></tr>' . "\n";
$html .= ' <tr><td>DECT</td><td>' . '<input type="text" size="4" name="eDECT" value="' . $user_source['DECT'] . '"></td></tr>' . "\n";
$html .= ' <tr><td>Nick</td><td>' . '<input type="text" size="40" name="eNick" value="' . $user_source['Nick'] . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Last login</td><td><p class="help-block">'
. date('Y-m-d H:i', $user_source['lastLogIn'])
. '</p></td></tr>' . "\n";
$html .= ' <tr><td>Name</td><td>' . '<input type="text" size="40" name="eName" value="' . $user_source['Name'] . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Vorname</td><td>' . '<input type="text" size="40" name="eVorname" value="' . $user_source['Vorname'] . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Alter</td><td>' . '<input type="text" size="5" name="eAlter" value="' . $user_source['Alter'] . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Telefon</td><td>' . '<input type="text" size="40" name="eTelefon" value="' . $user_source['Telefon'] . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Handy</td><td>' . '<input type="text" size="40" name="eHandy" value="' . $user_source['Handy'] . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>DECT</td><td>' . '<input type="text" size="4" name="eDECT" value="' . $user_source['DECT'] . '" class="form-control"></td></tr>' . "\n";
if ($user_source['email_by_human_allowed']) {
$html .= " <tr><td>email</td><td>" . '<input type="text" size="40" name="eemail" value="' . $user_source['email'] . '"></td></tr>' . "\n";
$html .= " <tr><td>email</td><td>" . '<input type="text" size="40" name="eemail" value="' . $user_source['email'] . '" class="form-control"></td></tr>' . "\n";
}
$html .= " <tr><td>jabber</td><td>" . '<input type="text" size="40" name="ejabber" value="' . $user_source['jabber'] . '"></td></tr>' . "\n";
$html .= " <tr><td>jabber</td><td>" . '<input type="text" size="40" name="ejabber" value="' . $user_source['jabber'] . '" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Size</td><td>'
. html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size']) . '</td></tr>' . "\n";
@ -79,13 +81,13 @@ function admin_user()
$html .= ' <tr><td>T-Shirt</td><td>' . "\n";
$html .= html_options('eTshirt', $options, $user_source['Tshirt']) . '</td></tr>' . "\n";
$html .= ' <tr><td>Hometown</td><td>' . '<input type="text" size="40" name="Hometown" value="' . $user_source['Hometown'] . '"></td></tr>' . "\n";
$html .= ' <tr><td>Hometown</td><td>' . '<input type="text" size="40" name="Hometown" value="' . $user_source['Hometown'] . '" class="form-control"></td></tr>' . "\n";
$html .= '</table>' . "\n" . '</td><td valign="top"></td></tr>';
$html .= '</td></tr>' . "\n";
$html .= '</table>' . "\n" . '<br />' . "\n";
$html .= '<input type="submit" value="Speichern">';
$html .= '<input type="submit" value="Speichern" class="btn btn-primary">';
$html .= '</form>';
$html .= '<hr />';
@ -95,11 +97,11 @@ function admin_user()
$html .= 'Hier kannst Du das Passwort dieses Engels neu setzen:<form action="'
. page_link_to('admin_user') . '&action=change_pw&id=' . $user_id . '" method="post">' . "\n";
$html .= '<table>' . "\n";
$html .= ' <tr><td>Passwort</td><td>' . '<input type="password" size="40" name="new_pw" value=""></td></tr>' . "\n";
$html .= ' <tr><td>Wiederholung</td><td>' . '<input type="password" size="40" name="new_pw2" value=""></td></tr>' . "\n";
$html .= ' <tr><td>Passwort</td><td>' . '<input type="password" size="40" name="new_pw" value="" class="form-control"></td></tr>' . "\n";
$html .= ' <tr><td>Wiederholung</td><td>' . '<input type="password" size="40" name="new_pw2" value="" class="form-control"></td></tr>' . "\n";
$html .= '</table>';
$html .= '<input type="submit" value="Speichern">' . "\n";
$html .= '</table>' . "\n" . '<br />' . "\n";
$html .= '<input type="submit" value="Speichern" class="btn btn-primary">' . "\n";
$html .= '</form>';
$html .= '<hr />';
@ -135,9 +137,9 @@ function admin_user()
. ' /></td><td>' . $group['Name'] . '</td></tr>';
}
$html .= '</table>';
$html .= '</table><br>';
$html .= '<input type="submit" value="Speichern">' . "\n";
$html .= '<input type="submit" value="Speichern" class="btn btn-primary">' . "\n";
$html .= '</form>';
$html .= '<hr />';
@ -229,7 +231,7 @@ function admin_user()
. ', active: ' . $_POST['eAktiv']
. ', tshirt: ' . $_POST['eTshirt']
);
$html .= success('Änderung wurde gespeichert...' . '\n', true);
$html .= success('Änderung wurde gespeichert...' . "\n", true);
break;
case 'change_pw':

View File

@ -34,6 +34,7 @@ function user_ical()
function send_ical_from_shifts($shifts)
{
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename=shifts.ics');
$output = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//-//Engelsystem//DE\r\nCALSCALE:GREGORIAN\r\n";
foreach ($shifts as $shift) {
$output .= make_ical_entry_from_shift($shift);

View File

@ -36,11 +36,12 @@ function form_spinner($name, $label, $value)
</div>
</div>
<script type="text/javascript">
var spinner = $("#spinner-' . $name . '");
$("#spinner-' . $name . '-down").click(function() {
var spinner = $("#spinner-' . $name . '");
spinner.val(parseInt(spinner.val()) - 1);
});
$("#spinner-' . $name . '-up").click(function() {
var spinner = $("#spinner-' . $name . '");
spinner.val(parseInt(spinner.val()) + 1);
});
</script>

View File

@ -26,7 +26,7 @@ function ShiftType_delete_view($shifttype)
button(
page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'] . '&confirmed',
_('delete'),
'ok'
'ok btn-danger'
)
])
]);