Merge branch 'master' of github.com:engelsystem/engelsystem

This commit is contained in:
Felix Favre 2014-12-06 22:46:40 +01:00
commit 45ac884474
11 changed files with 95 additions and 56 deletions

View File

@ -16,7 +16,7 @@ function user_angeltypes_unconfirmed_hint() {
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>';
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);
}
/**

View File

@ -5,7 +5,7 @@ function admin_news() {
if (! isset($_GET["action"])) {
redirect(page_link_to("news"));
} else {
$html = '<div class="col-md-12"><h1>' . _("Edit news entry") . '</h1>';
$html = '<div class="col-md-12"><h1>' . _("Edit news entry") . '</h1>' . msg();
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id']))
$id = $_REQUEST['id'];
else

View File

@ -10,7 +10,7 @@ function admin_new_questions() {
$new_messages = sql_num_query("SELECT * FROM `Questions` WHERE `AID` IS NULL");
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 "";

View File

@ -264,6 +264,7 @@ function admin_user() {
}
}
} else {
msg();
redirect(page_link_to('users'));
}

View File

@ -14,7 +14,7 @@ function page_link_to_absolute($page) {
* Renders the header toolbar containing search, login/logout, user and settings links.
*/
function header_toolbar() {
global $p, $privileges, $user;
global $p, $privileges, $user, $enable_tshirt_size;
$toolbar_items = array();
@ -27,9 +27,47 @@ function header_toolbar() {
if (in_array('login', $privileges))
$toolbar_items[] = toolbar_item_link(page_link_to('login'), 'log-in', login_title(), $p == 'login');
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());
$hints = [];
if (isset($user)) {
$hint_class = 'info';
// 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 (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);
$hint_class = 'danger';
}
// 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);
$hint_class = 'danger';
}
if ($enable_tshirt_size && $user['Size'] == "") {
$hints[] = error(_("You need to specify a tshirt size in your settings!"), true);
$hint_class = 'danger';
}
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);
$hint_class = 'danger';
}
}
if (count($hints) > 0)
$toolbar_items[] = toolbar_popover('warning-sign text-' . $hint_class, '', $hints, 'bg-' . $hint_class);
$user_submenu = make_langselect();
$user_submenu[] = toolbar_item_divider();
if (in_array('user_myshifts', $privileges))

View File

@ -5,13 +5,13 @@
*/
$themes = array(
"0" => "Engelsystem light",
"1" => "Engelsystem dark"
"1" => "Engelsystem dark"
);
/**
* Render glyphicon
*
* @param string $glyph_name
* @param string $glyph_name
*/
function glyph($glyph_name) {
return ' <span class="glyphicon glyphicon-' . $glyph_name . '"></span> ';
@ -20,7 +20,7 @@ function glyph($glyph_name) {
/**
* Renders a tick or a cross by given boolean
*
* @param boolean $boolean
* @param boolean $boolean
*/
function glyph_bool($boolean) {
return '<span class="text-' . ($boolean ? 'success' : 'danger') . '">' . glyph($boolean ? 'ok' : 'remove') . '</span>';
@ -34,7 +34,7 @@ function div($class, $content = array(), $id = "") {
/**
* Render a toolbar.
*
* @param array $items
* @param array $items
* @return string
*/
function toolbar($items = array(), $right = false) {
@ -44,10 +44,10 @@ function toolbar($items = array(), $right = false) {
/**
* Render a link for a toolbar.
*
* @param string $href
* @param string $glyphicon
* @param string $label
* @param bool $selected
* @param string $href
* @param string $glyphicon
* @param string $label
* @param bool $selected
* @return string
*/
function toolbar_item_link($href, $glyphicon, $label, $selected = false) {
@ -58,12 +58,21 @@ function toolbar_item_divider() {
return '<li class="divider"></li>';
}
function toolbar_dropdown($glyphicon, $label, $submenu) {
return '<li class="dropdown">
function toolbar_dropdown($glyphicon, $label, $submenu, $class = '') {
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>
<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) {
return '<input type="hidden" name="' . $name . '" value="' . $value . '" />';
}
@ -111,9 +120,9 @@ function form_checkboxes($name, $label, $items, $selected) {
$html = form_element($label, '');
foreach ($items as $key => $item)
$html .= form_checkbox($name . '_' . $key, $item, array_search($key, $selected) !== false);
return $html;
$html = "<ul>";
foreach ($items as $key => $item) {
$id = $name . '_' . $key;
@ -234,7 +243,7 @@ function form_select($name, $label, $values, $selected) {
function form_element($label, $input, $for = "") {
if ($label == '') {
return '<div class="form-group">' . $input . '</div>';
}else {
} else {
return '<div class="form-group">' . '<label for="' . $for . '">' . $label . '</label>' . $input . '</div>';
}
}
@ -269,17 +278,17 @@ function table($columns, $rows_raw, $data = true) {
// If only one column is given
if (! is_array($columns)) {
$columns = array(
'col' => $columns
'col' => $columns
);
$rows = array();
foreach ($rows_raw as $row)
$rows[] = array(
'col' => $row
'col' => $row
);
} else
$rows = $rows_raw;
if (count($rows) == 0)
return info(_("No data found."), true);
$html = "";
@ -313,9 +322,9 @@ function button($href, $label, $class = "") {
/**
* Rendert einen Knopf mit Glyph
*/
function button_glyph($href, $glyph, $class= "") {
return button($href, glyph($glyph), $class);
}
function button_glyph($href, $glyph, $class = "") {
return button($href, glyph($glyph), $class);
}
/**
* Rendert eine Toolbar mit Knöpfen
@ -367,7 +376,7 @@ function html_options($name, $options, $selected = "") {
$html = "";
foreach ($options as $value => $label)
$html .= '<input type="radio"' . ($value == $selected ? ' checked="checked"' : '') . ' name="' . $name . '" value="' . $value . '"> ' . $label;
return $html;
}
@ -405,7 +414,7 @@ function ReplaceSmilies($neueckig) {
$neueckig = str_replace(";P", "<img src=\"pic/smiles/icon_mad.gif\">", $neueckig);
$neueckig = str_replace(";oP", "<img src=\"pic/smiles/icon_mad.gif\">", $neueckig);
$neueckig = str_replace("?)", "<img src=\"pic/smiles/icon_question.gif\">", $neueckig);
return $neueckig;
}
?>

View File

@ -90,29 +90,6 @@ if (! isset($_REQUEST['p']))
if (isset($_REQUEST['p']) && preg_match("/^[a-z0-9_]*$/i", $_REQUEST['p']) && (in_array($_REQUEST['p'], $free_pages) || in_array($_REQUEST['p'], $privileges))) {
$p = $_REQUEST['p'];
if (isset($user)) {
$hints = "";
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();
}
$title = $p;
$content = "";
@ -240,7 +217,7 @@ echo template_render('../templates/layout.html', array(
'title' => $title,
'atom_link' => ($p == 'news' || $p == 'user_meetings') ? '<link href="' . page_link_to('atom') . (($p == 'user_meetings') ? '&amp;meetings=1' : '') . '&amp;key=' . $user['api_key'] . '" type="application/atom+xml" rel="alternate" title="Atom Feed">' : '',
'menu' => make_menu(),
'content' => $content,
'content' => msg() . $content,
'header_toolbar' => header_toolbar(),
'faq_url' => $faq_url,
'locale' => $_SESSION['locale']

View File

@ -1,8 +1,8 @@
function check_all(id) {
var obj = document.getElementById(id);
var boxes = obj.getElementsByTagName("input");
for(var i = 0; i < boxes.length; i++) {
if(boxes[i].type == "checkbox" && !boxes[i].disabled)
for ( var i = 0; i < boxes.length; i++) {
if (boxes[i].type == "checkbox" && !boxes[i].disabled)
boxes[i].checked = true;
}
}
@ -10,8 +10,15 @@ function check_all(id) {
function uncheck_all(id) {
var obj = document.getElementById(id);
var boxes = obj.getElementsByTagName("input");
for(var i = 0; i < boxes.length; i++) {
if(boxes[i].type == "checkbox")
for ( var i = 0; i < boxes.length; i++) {
if (boxes[i].type == "checkbox")
boxes[i].checked = false;
}
}
$(function() {
$('form').submit(function(ev) {
$('input[type="submit"]').prop("readonly", true).addClass("disabled");
return true;
});
});

6
public/vendor/jquery-ui.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,7 @@
<link rel="stylesheet" type="text/css" href="css/theme%theme%.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-ui.min.js"></script>
%atom_link%
</head>
<body>

View File

@ -12,7 +12,7 @@
}
}
</script>
<form class="form-inline" action="#shifts" method="get">
<form class="form-inline" action="" method="get">
<input type="hidden" name="p" value="user_shifts">
<div class="row">
<div class="col-md-6">