move hints to toolbar

main
Philip Häusler 10 years ago
parent 8261933bec
commit d34fae3c40

@ -16,7 +16,7 @@ function user_angeltypes_unconfirmed_hint() {
foreach ($unconfirmed_user_angeltypes as $user_angeltype) foreach ($unconfirmed_user_angeltypes as $user_angeltype)
$unconfirmed_links[] = '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $user_angeltype['angeltype_id'] . '">' . $user_angeltype['name'] . '</a>'; $unconfirmed_links[] = '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $user_angeltype['angeltype_id'] . '">' . $user_angeltype['name'] . '</a>';
return error(sprintf(ngettext("There is %d unconfirmed angeltype.", "There are %d unconfirmed angeltypes.", count($unconfirmed_user_angeltypes)), count($unconfirmed_user_angeltypes)) . " " . _('Angel types which need approvals:') . ' ' . join(', ', $unconfirmed_links)); return info(sprintf(ngettext("There is %d unconfirmed angeltype.", "There are %d unconfirmed angeltypes.", count($unconfirmed_user_angeltypes)), count($unconfirmed_user_angeltypes)) . " " . _('Angel types which need approvals:') . ' ' . join(', ', $unconfirmed_links), true);
} }
/** /**

@ -10,7 +10,7 @@ function admin_new_questions() {
$new_messages = sql_num_query("SELECT * FROM `Questions` WHERE `AID` IS NULL"); $new_messages = sql_num_query("SELECT * FROM `Questions` WHERE `AID` IS NULL");
if ($new_messages > 0) if ($new_messages > 0)
info('<a href="' . page_link_to("admin_questions") . '">Es gibt unbeantwortete Fragen!</a>'); return info('<a href="' . page_link_to("admin_questions") . '">' . _('There are unanswered questions!') . '</a>', true);
} }
return ""; return "";

@ -14,7 +14,7 @@ function page_link_to_absolute($page) {
* Renders the header toolbar containing search, login/logout, user and settings links. * Renders the header toolbar containing search, login/logout, user and settings links.
*/ */
function header_toolbar() { function header_toolbar() {
global $p, $privileges, $user; global $p, $privileges, $user, $enable_tshirt_size;
$toolbar_items = array(); $toolbar_items = array();
@ -30,6 +30,35 @@ function header_toolbar() {
if(isset($user) && in_array('user_messages', $privileges)) if(isset($user) && in_array('user_messages', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('user_messages'), 'envelope', user_unread_messages()); $toolbar_items[] = toolbar_item_link(page_link_to('user_messages'), 'envelope', user_unread_messages());
$hints = [];
if (isset($user)) {
if (User_is_freeloader($user))
$hints[] = error(sprintf(_("You freeloaded at least %s shifts. Shift signup is locked. Please go to heavens desk to be unlocked again."), $max_freeloadable_shifts), true);
// Hinweis für Engel, die noch nicht angekommen sind
if ($user['Gekommen'] == 0)
$hints[] = error(_("You are not marked as arrived. Please go to heaven's desk, get your angel badge and/or tell them that you arrived already."), true);
if ($enable_tshirt_size && $user['Size'] == "")
$hints[] = error(_("You need to specify a tshirt size in your settings!"), true);
if ($user['DECT'] == "")
$hints[] = error(_("You need to specify a DECT phone number in your settings! If you don't have a DECT phone, just enter \"-\"."), true);
// Erzengel Hinweis für unbeantwortete Fragen
if ($p != "admin_questions") {
$new_questions = admin_new_questions();
if($new_questions != "")
$hints[] = $new_questions;
}
$unconfirmed_hint = user_angeltypes_unconfirmed_hint();
if($unconfirmed_hint != '')
$hints[] = $unconfirmed_hint;
}
if(count($hints) > 0)
$toolbar_items[] = toolbar_popover('warning-sign text-danger', '', $hints, 'bg-danger');
$user_submenu = make_langselect(); $user_submenu = make_langselect();
$user_submenu[] = toolbar_item_divider(); $user_submenu[] = toolbar_item_divider();
if (in_array('user_myshifts', $privileges)) if (in_array('user_myshifts', $privileges))

@ -58,12 +58,21 @@ function toolbar_item_divider() {
return '<li class="divider"></li>'; return '<li class="divider"></li>';
} }
function toolbar_dropdown($glyphicon, $label, $submenu) { function toolbar_dropdown($glyphicon, $label, $submenu, $class = '') {
return '<li class="dropdown"> return '<li class="dropdown ' . $class . '">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '') . $label . ' <span class="caret"></span></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown">' . ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '') . $label . ' <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">' . join("\n", $submenu) . '</ul></li>'; <ul class="dropdown-menu" role="menu">' . join("\n", $submenu) . '</ul></li>';
} }
function toolbar_popover($glyphicon, $label, $content, $class = '') {
$id = md5(microtime() . $glyphicon . $label);
return '<li class="dropdown ' . $class . '">
<a id="' . $id . '" href="#">' . ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '') . $label . ' <span class="caret"></span></a>
<script type="text/javascript">
$(function(){$("#' . $id . '").effect("highlight", {color: "#A94442"}, 500); $("#' . $id . '").popover({trigger: "focus", html: true, content: "' . addslashes(join('', $content)) . '", placement: "bottom", container: "body"})});
</script></li>';
}
function form_hidden($name, $value) { function form_hidden($name, $value) {
return '<input type="hidden" name="' . $name . '" value="' . $value . '" />'; return '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
} }

@ -93,27 +93,6 @@ if (isset($_REQUEST['p']) && preg_match("/^[a-z0-9_]*$/i", $_REQUEST['p']) && (i
$title = $p; $title = $p;
$content = ""; $content = "";
if (isset($user)) {
if (User_is_freeloader($user))
error(sprintf(_("You freeloaded at least %s shifts. Shift signup is locked. Please go to heavens desk to be unlocked again."), $max_freeloadable_shifts));
// Hinweis für Engel, die noch nicht angekommen sind
if ($user['Gekommen'] == 0)
error(_("You are not marked as arrived. Please go to heaven's desk, get your angel badge and/or tell them that you arrived already."));
if ($enable_tshirt_size && $user['Size'] == "")
error(_("You need to specify a tshirt size in your settings!"));
if ($user['DECT'] == "")
error(_("You need to specify a DECT phone number in your settings! If you don't have a DECT phone, just enter \"-\"."));
// Erzengel Hinweis für unbeantwortete Fragen
if ($p != "admin_questions")
admin_new_questions();
user_angeltypes_unconfirmed_hint();
}
if ($p == "api") { if ($p == "api") {
require_once realpath(__DIR__ . '/../includes/controller/api.php'); require_once realpath(__DIR__ . '/../includes/controller/api.php');
error("Api disabled temporily."); error("Api disabled temporily.");

File diff suppressed because one or more lines are too long

@ -13,6 +13,7 @@
<link rel="stylesheet" type="text/css" href="css/theme%theme%.css" /> <link rel="stylesheet" type="text/css" href="css/theme%theme%.css" />
<link rel="stylesheet" type="text/css" href="vendor/icomoon/style.css" /> <link rel="stylesheet" type="text/css" href="vendor/icomoon/style.css" />
<script type="text/javascript" src="vendor/jquery-2.1.1.min.js"></script> <script type="text/javascript" src="vendor/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="vendor/jquery-ui.min.js"></script>
%atom_link% %atom_link%
</head> </head>
<body> <body>

Loading…
Cancel
Save