diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/controller/users_controller.php | 3 | ||||
-rw-r--r-- | includes/pages/user_myshifts.php | 2 | ||||
-rw-r--r-- | includes/pages/user_shifts.php | 21 | ||||
-rw-r--r-- | includes/sys_template.php | 4 | ||||
-rw-r--r-- | includes/view/User_view.php | 12 |
5 files changed, 27 insertions, 15 deletions
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php index b24a7fdf..f54cf066 100644 --- a/includes/controller/users_controller.php +++ b/includes/controller/users_controller.php @@ -48,6 +48,9 @@ function user_controller() { } } + if ($user_source['api_key'] == "") + User_reset_api_key($user_source); + return array( $user_source['Nick'], User_view($user_source, $admin_user_privilege, User_is_freeloader($user_source), User_angeltypes($user_source), User_groups($user_source), $shifts, $user['UID'] == $user_source['UID']) diff --git a/includes/pages/user_myshifts.php b/includes/pages/user_myshifts.php index 35aa8f54..d1c60dd6 100644 --- a/includes/pages/user_myshifts.php +++ b/includes/pages/user_myshifts.php @@ -26,7 +26,7 @@ function user_myshifts() { } return page_with_title(_("Reset API key"), array( error(_("If you reset the key, the url to your iCal- and JSON-export and your atom feed changes! You have to update it in every application using one of these exports."), true), - button(page_link_to('myshifts') . '&reset=ack', _("Continue"), 'btn-danger') + button(page_link_to('user_myshifts') . '&reset=ack', _("Continue"), 'btn-danger') )); } elseif (isset($_REQUEST['edit']) && preg_match("/^[0-9]*$/", $_REQUEST['edit'])) { $id = $_REQUEST['edit']; diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 370544a1..04a94c3f 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -1,4 +1,5 @@ <?php + function shifts_title() { return _("Shifts"); } @@ -501,7 +502,10 @@ function view_user_shifts() { $is_free = false; $shifts_row = $shift['name']; if (in_array('admin_shifts', $privileges)) - $shifts_row .= ' ' . img_button('?p=user_shifts&edit_shift=' . $shift['SID'], 'pencil', _("edit")) . img_button('?p=user_shifts&delete_shift=' . $shift['SID'], 'bin', _("delete")); + $shifts_row .= ' ' . table_buttons(array( + button(page_link_to('user_shift') . '&edit_shift=' . $shift['SID'], glyph('edit'), 'btn-xs'), + button(page_link_to('user_shift') . '&delete_shift=' . $shift['SID'], glyph('trash'), 'btn-xs') + )); $shifts_row .= '<br />'; $query = "SELECT `NeededAngelTypes`.`count`, `AngelTypes`.`id`, `AngelTypes`.`restricted`, `UserAngelTypes`.`confirm_user_id`, `AngelTypes`.`name`, `UserAngelTypes`.`user_id` FROM `NeededAngelTypes` @@ -534,7 +538,9 @@ function view_user_shifts() { $style .= " text-decoration: line-through;"; } if (in_array('user_shifts_admin', $privileges)) - $entry_list[] = "<span style=\"$style\">" . User_Nick_render($entry) . ' ' . img_button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], 'bin', _("delete")) . '</span>'; + $entry_list[] = "<span style=\"$style\">" . User_Nick_render($entry) . ' ' . table_buttons(array( + button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], glyph('trash'), 'btn-xs') + )) . '</span>'; else $entry_list[] = "<span style=\"$style\">" . User_Nick_render($entry) . "</span>"; } @@ -632,7 +638,10 @@ function view_user_shifts() { ); if (in_array('admin_shifts', $privileges)) - $shift_row['info'] .= ' ' . img_button('?p=user_shifts&edit_shift=' . $shift['SID'], 'pencil', 'edit') . img_button('?p=user_shifts&delete_shift=' . $shift['SID'], 'bin', _("delete")); + $shift_row['info'] .= ' ' . table_buttons(array( + button(page_link_to('user_shifts') . '&edit_shift=' . $shift['SID'], glyph('edit'), 'btn-xs'), + button(page_link_to('user_shifts') . '&delete_shift=' . $shift['SID'], glyph('trash'), 'btn-xs') + )); $shift_row['entries'] .= '<br />'; $is_free = false; $shift_has_special_needs = 0 < sql_num_query("SELECT `id` FROM `NeededAngelTypes` WHERE `shift_id` = " . $shift['SID']); @@ -659,7 +668,9 @@ function view_user_shifts() { $freeloader = 0; foreach ($entries as $entry) { if (in_array('user_shifts_admin', $privileges)) - $member = User_Nick_render($entry) . ' ' . img_button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], 'bin', _("delete")); + $member = User_Nick_render($entry) . ' ' . table_buttons(array( + button(page_link_to('user_shifts') . '&entry_id=' . $entry['id'], glyph('trash'), 'btn-xs') + )); else $member = User_Nick_render($entry); if ($entry['freeloaded']) { @@ -743,7 +754,7 @@ function view_user_shifts() { 'filled_select' => make_select($filled, $_SESSION['user_shifts']['filled'], "filled", _("Occupancy")), 'task_notice' => '<sup>1</sup>' . _("The tasks shown here are influenced by the preferences you defined in your settings!") . " <a href=\"" . page_link_to('angeltypes') . '&action=about' . "\">" . _("Description of the jobs.") . "</a>", 'new_style_checkbox' => '<label><input type="checkbox" name="new_style" value="1" ' . ($_SESSION['user_shifts']['new_style'] ? ' checked' : '') . '> ' . _("Use new style if possible") . '</label>', - 'shifts_table' =>msg(). $shifts_table, + 'shifts_table' => msg() . $shifts_table, '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>)."), page_link_to_absolute('ical') . '&key=' . $user['api_key'], page_link_to_absolute('shifts_json_export') . '&key=' . $user['api_key'], page_link_to('user_myshifts') . '&reset') . '</p>', 'filter' => _("Filter") )), diff --git a/includes/sys_template.php b/includes/sys_template.php index bf0e81fc..e707ab71 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -373,10 +373,6 @@ function html_select_key($id, $name, $rows, $selected) { return $html; } -function img_button($link, $icon, $text, $extra_text = '') { - return '<a href="' . htmlspecialchars($link) . '"><img src="pic/icons/' . htmlspecialchars($icon) . '.png" alt="' . $text . '" ' . (empty($text) ? '' : 'title="' . $text . '"') . '>' . (empty($extra_text) ? '' : ' ' . $extra_text) . '</a>'; -} - function ReplaceSmilies($neueckig) { $neueckig = str_replace(";o))", "<img src=\"pic/smiles/icon_redface.gif\">", $neueckig); $neueckig = str_replace(":-))", "<img src=\"pic/smiles/icon_redface.gif\">", $neueckig); diff --git a/includes/view/User_view.php b/includes/view/User_view.php index 912579e7..0bea946c 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -131,11 +131,12 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel $myshift['comment'] .= '<br /><p class="error">' . _("Freeloaded") . '</p>'; } - $myshift['actions'] = ""; + $myshift['actions'] = array(); if ($its_me || in_array('user_shifts_admin', $privileges)) - $myshift['actions'] .= img_button(page_link_to('user_myshifts') . '&edit=' . $shift['id'] . '&id=' . $user_source['UID'], 'pencil', _("edit")); + $myshift['actions'][] = button(page_link_to('user_myshifts') . '&edit=' . $shift['id'] . '&id=' . $user_source['UID'], glyph('edit') . _('edit'), 'btn-xs'); if (($shift['start'] > time() + $LETZTES_AUSTRAGEN * 3600) || in_array('user_shifts_admin', $privileges)) - $myshift['actions'] .= img_button(page_link_to('user_myshifts') . ((! $its_me) ? '&id=' . $user_source['UID'] : '') . '&cancel=' . $shift['id'], 'cross', _("sign off")); + $myshift['actions'][] = button(page_link_to('user_myshifts') . ((! $its_me) ? '&id=' . $user_source['UID'] : '') . '&cancel=' . $shift['id'], glyph('trash') . _('sign off'), 'btn-xs'); + $myshift['actions'] = table_buttons($myshift['actions']); if ($shift['freeloaded']) $timesum += - 2 * ($shift['end'] - $shift['start']); @@ -182,8 +183,9 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel buttons(array( $admin_user_privilege ? button(page_link_to('admin_user') . '&id=' . $user_source['UID'], '<span class="glyphicon glyphicon-edit"></span> ' . _("edit")) : '', ! $user_source['Gekommen'] ? button(page_link_to('admin_arrive') . '&arrived=' . $user_source['UID'], _("arrived")) : '', - $its_me ? button(page_link_to_absolute('ical') . '&key=' . $user_source['api_key'], '<span class="glyphicon glyphicon-calendar"></span> ' . _("iCal Export")) : '', - $its_me ? button(page_link_to_absolute('shifts_json_export') . '&key=' . $user_source['api_key'], '<span class="glyphicon glyphicon-export"></span> ' . _("JSON Export")) : '' + $its_me ? button(page_link_to_absolute('ical') . '&key=' . $user_source['api_key'], glyph('calendar') . _("iCal Export")) : '', + $its_me ? button(page_link_to_absolute('shifts_json_export') . '&key=' . $user_source['api_key'], glyph('export') . _("JSON Export")) : '', + $its_me ? button(page_link_to_absolute('user_myshifts') . '&reset', glyph('repeat') . _('Reset API key')) : '' )), ($its_me || $admin_user_privilege) ? '<h2>' . _("Shifts") . '</h2>' : '', ($its_me || $admin_user_privilege) ? table(array( |