From e12608ee73cdc43a01482e777ed3fec59043e6d8 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Thu, 27 Dec 2012 16:11:07 +0100 Subject: [PATCH 1/4] made the user list a bit nicer --- includes/pages/admin_user.php | 30 +++++++++++++++--------------- public/css/base.css | 27 +++++++++++++++++++++++++++ public/css/style11.css | 4 ++-- templates/guest_credits.html | 3 +++ 4 files changed, 47 insertions(+), 17 deletions(-) diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index f4902e1c..9c13cbd7 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -293,16 +293,15 @@ function admin_user() { Nick Vorname Name + DECT Alter - - E-Mail - - Größe - Gekommen - Aktiv - T-Shirt + E-Mail +
Gekommen
+
Aktiv
+
T-Shirt
+
Größe
Last login - Änd. + Edit '; $Gekommen = 0; $Active = 0; @@ -340,6 +339,7 @@ function admin_user() { else $html .= "\t" . mysql_result($Erg, $n, "Nick") . "\n"; $html .= "\t" . mysql_result($Erg, $n, "Vorname") . " " . mysql_result($Erg, $n, "Name") . "\n"; + $html .= "\t" . mysql_result($Erg, $n, "DECT") . "\n"; $html .= "\t" . mysql_result($Erg, $n, "Alter") . "\n"; $html .= "\t"; if (strlen(mysql_result($Erg, $n, "email")) > 0) @@ -347,25 +347,25 @@ function admin_user() { mysql_result($Erg, $n, "email") . ""; $html .= ''; $html .= "\n"; - $html .= "\t" . mysql_result($Erg, $n, "Size") . "\n"; $Gekommen += mysql_result($Erg, $n, "Gekommen"); - $html .= "\t" . mysql_result($Erg, $n, "Gekommen") . "\n"; + $html .= "\t" . mysql_result($Erg, $n, "Gekommen") . "\n"; $Active += mysql_result($Erg, $n, "Aktiv"); - $html .= "\t" . mysql_result($Erg, $n, "Aktiv") . "\n"; + $html .= "\t" . mysql_result($Erg, $n, "Aktiv") . "\n"; $Tshirt += mysql_result($Erg, $n, "Tshirt"); - $html .= "\t" . mysql_result($Erg, $n, "Tshirt") . "\n"; + $html .= "\t" . mysql_result($Erg, $n, "Tshirt") . "\n"; + $html .= "\t" . mysql_result($Erg, $n, "Size") . "\n"; $last_login = mysql_result($Erg, $n, "lastLogIn"); if($last_login == 0) $html .= "never"; else - $html .= "" . date("Y-m-d H:i", $last_login) . ""; + $html .= "" . date('d.m.&\n\b\s\p;H:i', $last_login) . ""; $html .= "\t" . 'Edit' . "\n"; $html .= "\n"; } $html .= "" . - "" . - "$Gekommen$Active$Tshirt\n"; + "Summe" . + "$Gekommen$Active$Tshirt\n"; $html .= "\t\n"; // Ende Userliste } diff --git a/public/css/base.css b/public/css/base.css index c42225e6..759e9157 100644 --- a/public/css/base.css +++ b/public/css/base.css @@ -145,12 +145,39 @@ fieldset p label input { th { background: #f0f0f0; + vertical-align: bottom; } td, th { border: 1px solid #888; } +td.true, td.false { + color: transparent; +} + +td.true { + background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGrSURBVDjLvZPZLkNhFIV75zjvYm7VGFNCqoZUJ+roKUUpjRuqp61Wq0NKDMelGGqOxBSUIBKXWtWGZxAvobr8lWjChRgSF//dv9be+9trCwAI/vIE/26gXmviW5bqnb8yUK028qZjPfoPWEj4Ku5HBspgAz941IXZeze8N1bottSo8BTZviVWrEh546EO03EXpuJOdG63otJbjBKHkEp/Ml6yNYYzpuezWL4s5VMtT8acCMQcb5XL3eJE8VgBlR7BeMGW9Z4yT9y1CeyucuhdTGDxfftaBO7G4L+zg91UocxVmCiy51NpiP3n2treUPujL8xhOjYOzZYsQWANyRYlU4Y9Br6oHd5bDh0bCpSOixJiWx71YY09J5pM/WEbzFcDmHvwwBu2wnikg+lEj4mwBe5bC5h1OUqcwpdC60dxegRmR06TyjCF9G9z+qM2uCJmuMJmaNZaUrCSIi6X+jJIBBYtW5Cge7cd7sgoHDfDaAvKQGAlRZYc6ltJlMxX03UzlaRlBdQrzSCwksLRbOpHUSb7pcsnxCCwngvM2Rm/ugUCi84fycr4l2t8Bb6iqTxSCgNIAAAAAElFTkSuQmCC') no-repeat center center; +} + +td.false { + background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIhSURBVDjLlZPrThNRFIWJicmJz6BWiYbIkYDEG0JbBiitDQgm0PuFXqSAtKXtpE2hNuoPTXwSnwtExd6w0pl2OtPlrphKLSXhx07OZM769qy19wwAGLhM1ddC184+d18QMzoq3lfsD3LZ7Y3XbE5DL6Atzuyilc5Ciyd7IHVfgNcDYTQ2tvDr5crn6uLSvX+Av2Lk36FFpSVENDe3OxDZu8apO5rROJDLo30+Nlvj5RnTlVNAKs1aCVFr7b4BPn6Cls21AWgEQlz2+Dl1h7IdA+i97A/geP65WhbmrnZZ0GIJpr6OqZqYAd5/gJpKox4Mg7pD2YoC2b0/54rJQuJZdm6Izcgma4TW1WZ0h+y8BfbyJMwBmSxkjw+VObNanp5h/adwGhaTXF4NWbLj9gEONyCmUZmd10pGgf1/vwcgOT3tUQE0DdicwIod2EmSbwsKE1P8QoDkcHPJ5YESjgBJkYQpIEZ2KEB51Y6y3ojvY+P8XEDN7uKS0w0ltA7QGCWHCxSWWpwyaCeLy0BkA7UXyyg8fIzDoWHeBaDN4tQdSvAVdU1Aok+nsNTipIEVnkywo/FHatVkBoIhnFisOBoZxcGtQd4B0GYJNZsDSiAEadUBCkstPtN3Avs2Msa+Dt9XfxoFSNYF/Bh9gP0bOqHLAm2WUF1YQskwrVFYPWkf3h1iXwbvqGfFPSGW9Eah8HSS9fuZDnS32f71m8KFY7xs/QZyu6TH2+2+FAAAAABJRU5ErkJggg==') no-repeat center center; +} + +.rotate { + /* this is a hack because the height of the row isn't adjusted automatically */ + height: 6em; +} + +.rotate div { + transform: rotate(270deg); + width: 1ex; + margin: 0 auto -2px; + -webkit-transform: rotate(270deg); + padding: 0 3px; + white-space: nowrap; +} + textarea { font-family: inherit; font-size: inherit; diff --git a/public/css/style11.css b/public/css/style11.css index cefc761e..934034d0 100644 --- a/public/css/style11.css +++ b/public/css/style11.css @@ -27,7 +27,7 @@ footer, footer a { } tr:hover > td { - background: #f0f0f0; + background-color: #f0f0f0; } .selection ul li.heading { @@ -51,4 +51,4 @@ tr:hover > td { border-color: rgb(0, 178, 107); color: rgb(0, 178, 107); font-weight: bold; -} \ No newline at end of file +} diff --git a/templates/guest_credits.html b/templates/guest_credits.html index 034a61dd..61446801 100644 --- a/templates/guest_credits.html +++ b/templates/guest_credits.html @@ -13,3 +13,6 @@ jplitza + +

Icons

+

Some icons from the famfamfam.com silk iconset have been used. They are licensed under the Creative Commons Attribution 2.5 License.

From 43970df0f3edf7ccef2652cda4c5688e4e78f5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20H=C3=A4usler?= Date: Thu, 27 Dec 2012 16:34:41 +0100 Subject: [PATCH 2/4] simplified shift view --- includes/pages/user_settings.php | 2 +- includes/pages/user_shifts.php | 66 +++++++++++++++++++++++++------ public/css/base.css | 4 ++ public/css/forms.js | 2 +- public/pic/lock.png | Bin 0 -> 749 bytes 5 files changed, 59 insertions(+), 15 deletions(-) create mode 100644 public/pic/lock.png diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php index 999b890d..7aaad79a 100644 --- a/includes/pages/user_settings.php +++ b/includes/pages/user_settings.php @@ -182,7 +182,7 @@ function user_settings() { form_text('jabber', "Jabber", $jabber), form_text('hometown', Get_Text("makeuser_Hometown"), $hometown), $enable_tshirt_size ? form_select('tshirt_size', Get_Text("makeuser_T-Shirt"), $tshirt_sizes, $tshirt_size) : '', - form_checkboxes('angel_types', "What do you want to do?
(Description of job types)", $angel_types, $selected_angel_types), + form_checkboxes('angel_types', "What do you want to do?
(Description of job types)", $angel_types, $selected_angel_types), form_submit('submit', Get_Text("save")) )), form(array ( diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index 07db1d57..f76157d4 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -282,10 +282,11 @@ function view_user_shifts() { $ical_shifts = array (); $days = sql_select("SELECT DISTINCT DATE(FROM_UNIXTIME(`start`)) AS `id`, DATE(FROM_UNIXTIME(`start`)) AS `name` FROM `Shifts` ORDER BY `start`"); $rooms = sql_select("SELECT `RID` AS `id`, `Name` AS `name` FROM `Room` WHERE `show`='Y' ORDER BY `Name`"); - if (in_array('admin_shifts', $privileges)) + + if(in_array('user_shifts_admin', $privileges)) $types = sql_select("SELECT `id`, `name` FROM `AngelTypes` ORDER BY `AngelTypes`.`name`"); else - $types = sql_select("SELECT `AngelTypes`.`id`, `AngelTypes`.`name` FROM `UserAngelTypes` JOIN `AngelTypes` ON (`UserAngelTypes`.`angeltype_id` = `AngelTypes`.`id`) WHERE `UserAngelTypes`.`user_id` = " . sql_escape($user['UID']) . " AND (`AngelTypes`.`restricted` = 0 OR NOT `UserAngelTypes`.`confirm_user_id` IS NULL) ORDER BY `AngelTypes`.`name`"); + $types = sql_select("SELECT `AngelTypes`.`id`, `AngelTypes`.`name`, (`AngelTypes`.`restricted`=0 OR NOT `UserAngelTypes`.`confirm_user_id` IS NULL) as `enabled` FROM `AngelTypes` LEFT JOIN `UserAngelTypes` ON (`UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id` AND `UserAngelTypes`.`user_id`=" . sql_escape($user['UID']) . ") ORDER BY `AngelTypes`.`name`"); if (empty($types)) $types = sql_select("SELECT `id`, `name` FROM `AngelTypes` WHERE `restricted` = 0"); $filled = array ( @@ -420,9 +421,9 @@ function view_user_shifts() { $query .= "`shift_id` = " . sql_escape($shift['SID']); else $query .= "`room_id` = " . sql_escape($shift['RID']); - $query .= " AND `count` > 0 - AND `angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ") - ORDER BY `AngelTypes`.`name`"; + $query .= " AND `count` > 0 "; + $query .= " AND `angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ")"; + $query .= "ORDER BY `AngelTypes`.`name`"; $angeltypes = sql_select($query); if (count($angeltypes) > 0) { @@ -441,10 +442,29 @@ function view_user_shifts() { $entry_list[] = "" . $entry['Nick'].""; } if ($angeltype['count'] - count($entries) > 0) { - if ((time() < $shift['end'] && !$my_shift) || in_array('user_shifts_admin', $privileges)) { + // is the shift still running or alternatively is the user shift admin? + $user_may_join_shift = true; + + /* you cannot join if user already joined this shift */ + $user_may_join_shift &= !$my_shift; + + // you cannot join if user is not of this angel type + $user_may_join_shift &= in_array($angeltype['id'], $_SESSION['user_shifts']['types']); + + // you can only join if the shift is in future or running + $user_may_join_shift &= time() < $shift['end']; + + // User shift admins may join anybody in every shift + $user_may_join_shift |= in_array('user_shifts_admin', $privileges); + + if ($user_may_join_shift) { $entry_list[] = '' . ($angeltype['count'] - count($entries)) . ' Helfer' . ($angeltype['count'] - count($entries) != 1 ? '' : '') . ' gebraucht »'; } else { - $entry_list[] = ($angeltype['count'] - count($entries)) . ' Helfer gebraucht'; + if(!in_array('user_shifts_admin', $privileges) && $angeltype['restricted'] == 1 && !isset($angeltype['confirm_user_id'])) { + $entry_list[] = ($angeltype['count'] - count($entries)) . ' Helfer gebraucht' . ' unconfirmed'; + } else { + $entry_list[] = ($angeltype['count'] - count($entries)) . ' Helfer gebraucht' . ' (Werde ' . $angeltype['name'] .')'; + } } $is_free = true; } @@ -505,8 +525,8 @@ function view_user_shifts() { $shift_has_special_needs = 0 < sql_num_query("SELECT `id` FROM `NeededAngelTypes` WHERE `shift_id` = " . $shift['SID']); $query = "SELECT * FROM `NeededAngelTypes` - JOIN `AngelTypes` - ON (`NeededAngelTypes`.`angel_type_id` = `AngelTypes`.`id`) + JOIN `AngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `AngelTypes`.`id`) + LEFT JOIN `UserAngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `UserAngelTypes`.`angeltype_id` AND `UserAngelTypes`.`user_id`=" . sql_escape($user['UID']) . ") WHERE "; if ($shift_has_special_needs) $query .= "`shift_id` = " . sql_escape($shift['SID']); @@ -533,10 +553,30 @@ function view_user_shifts() { if ($angeltype['count'] - count($entries) > 0) { $inner_text = ($angeltype['count'] - count($entries)) . ' ' . Get_Text($angeltype['count'] - count($entries) == 1 ? 'helper' : 'helpers') . ' ' . Get_Text('needed'); // is the shift still running or alternatively is the user shift admin? - if ((time() < $shift['end'] && !$my_shift) || in_array('user_shifts_admin', $privileges)) + $user_may_join_shift = true; + + /* you cannot join if user already joined this shift */ + $user_may_join_shift &= !$my_shift; + + // you cannot join if user is not of this angel type + $user_may_join_shift &= in_array($angeltype['id'], $_SESSION['user_shifts']['types']); + + // you can only join if the shift is in future or running + $user_may_join_shift &= time() < $shift['end']; + + // User shift admins may join anybody in every shift + $user_may_join_shift |= in_array('user_shifts_admin', $privileges); + + if ($user_may_join_shift) $entry_list[] = '' . $inner_text . ' »'; - else - $entry_list[] = $inner_text; + else { + if(!in_array('user_shifts_admin', $privileges) && $angeltype['restricted'] == 1 && !isset($angeltype['confirm_user_id'])) { + $entry_list[] = $inner_text . ' unconfirmed'; + } else { + $entry_list[] = $inner_text . ' (Werde ' . $angeltype['name'] .')'; + } + } + unset($inner_text); $is_free = true; } @@ -599,7 +639,7 @@ function make_select($items, $selected, $name, $title = null) { $html_items[] = '
  • ' . $title . '
  • ' . "\n"; foreach ($items as $i) - $html_items[] = '
  • '; + $html_items[] = '
  • ' . (!isset($i['enabled']) || $i['enabled'] ? '' : ' unconfirmed') . '
  • '; $html = '
    ' . "\n"; $html .= '
      ' . "\n"; $html .= implode("\n", $html_items); diff --git a/public/css/base.css b/public/css/base.css index c42225e6..bd488df3 100644 --- a/public/css/base.css +++ b/public/css/base.css @@ -362,3 +362,7 @@ tr:hover .hidden { #filter { padding: 10px; } + +td .entries img { + vertical-align: bottom; +} diff --git a/public/css/forms.js b/public/css/forms.js index 8a6e2c69..630d8c25 100644 --- a/public/css/forms.js +++ b/public/css/forms.js @@ -2,7 +2,7 @@ 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") + if(boxes[i].type == "checkbox" && !boxes[i].disabled) boxes[i].checked = true; } } diff --git a/public/pic/lock.png b/public/pic/lock.png new file mode 100644 index 0000000000000000000000000000000000000000..2ebc4f6f9663e32cad77d67ef93ab8843dfea3c0 GIT binary patch literal 749 zcmVe|tv9>?g+k#9o0pTxd@;_sq{kwlU;^VvV*?BV8P@}BoaZTQUROpWV6|-M`|^n&)=+8tHo3*<<$NU zU`%V~ZF;?hBSYsjJ6%JzV}E(D{pOLqQklliUf9um_tGl-wty`y*p?eYNW56P>X@1s zZs7KrRZKtmV7Lqj^5Fgr7_`LjhdJK@ltF&O`j7?*NUM$KvmNGz)3WjM?V$vHlPT0AFyF?kLE<#HZabCSW3-oa*6;Z zrXD`Ulwd<^2glP%1Y1Kc1Ij%DU^=ME(jKf6APNlA$Uu;J4bVilQHSWX5uJ$9Zsp4M z0%!@LvyTxz=Z6stxlichODIY+yNGt%RM;m`>H4LOKLFs9Y%b5aUN|2|{0Zw|<_~i} fmXz*V19AKYa Date: Thu, 27 Dec 2012 16:57:03 +0100 Subject: [PATCH 3/4] Revert "simplified shift view" This reverts commit 43970df0f3edf7ccef2652cda4c5688e4e78f5dd. --- includes/pages/user_settings.php | 2 +- includes/pages/user_shifts.php | 66 ++++++------------------------- public/css/base.css | 4 -- public/css/forms.js | 2 +- public/pic/lock.png | Bin 749 -> 0 bytes 5 files changed, 15 insertions(+), 59 deletions(-) delete mode 100644 public/pic/lock.png diff --git a/includes/pages/user_settings.php b/includes/pages/user_settings.php index 7aaad79a..999b890d 100644 --- a/includes/pages/user_settings.php +++ b/includes/pages/user_settings.php @@ -182,7 +182,7 @@ function user_settings() { form_text('jabber', "Jabber", $jabber), form_text('hometown', Get_Text("makeuser_Hometown"), $hometown), $enable_tshirt_size ? form_select('tshirt_size', Get_Text("makeuser_T-Shirt"), $tshirt_sizes, $tshirt_size) : '', - form_checkboxes('angel_types', "What do you want to do?
      (Description of job types)", $angel_types, $selected_angel_types), + form_checkboxes('angel_types', "What do you want to do?
      (Description of job types)", $angel_types, $selected_angel_types), form_submit('submit', Get_Text("save")) )), form(array ( diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index f76157d4..07db1d57 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -282,11 +282,10 @@ function view_user_shifts() { $ical_shifts = array (); $days = sql_select("SELECT DISTINCT DATE(FROM_UNIXTIME(`start`)) AS `id`, DATE(FROM_UNIXTIME(`start`)) AS `name` FROM `Shifts` ORDER BY `start`"); $rooms = sql_select("SELECT `RID` AS `id`, `Name` AS `name` FROM `Room` WHERE `show`='Y' ORDER BY `Name`"); - - if(in_array('user_shifts_admin', $privileges)) + if (in_array('admin_shifts', $privileges)) $types = sql_select("SELECT `id`, `name` FROM `AngelTypes` ORDER BY `AngelTypes`.`name`"); else - $types = sql_select("SELECT `AngelTypes`.`id`, `AngelTypes`.`name`, (`AngelTypes`.`restricted`=0 OR NOT `UserAngelTypes`.`confirm_user_id` IS NULL) as `enabled` FROM `AngelTypes` LEFT JOIN `UserAngelTypes` ON (`UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id` AND `UserAngelTypes`.`user_id`=" . sql_escape($user['UID']) . ") ORDER BY `AngelTypes`.`name`"); + $types = sql_select("SELECT `AngelTypes`.`id`, `AngelTypes`.`name` FROM `UserAngelTypes` JOIN `AngelTypes` ON (`UserAngelTypes`.`angeltype_id` = `AngelTypes`.`id`) WHERE `UserAngelTypes`.`user_id` = " . sql_escape($user['UID']) . " AND (`AngelTypes`.`restricted` = 0 OR NOT `UserAngelTypes`.`confirm_user_id` IS NULL) ORDER BY `AngelTypes`.`name`"); if (empty($types)) $types = sql_select("SELECT `id`, `name` FROM `AngelTypes` WHERE `restricted` = 0"); $filled = array ( @@ -421,9 +420,9 @@ function view_user_shifts() { $query .= "`shift_id` = " . sql_escape($shift['SID']); else $query .= "`room_id` = " . sql_escape($shift['RID']); - $query .= " AND `count` > 0 "; - $query .= " AND `angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ")"; - $query .= "ORDER BY `AngelTypes`.`name`"; + $query .= " AND `count` > 0 + AND `angel_type_id` IN (" . implode(',', $_SESSION['user_shifts']['types']) . ") + ORDER BY `AngelTypes`.`name`"; $angeltypes = sql_select($query); if (count($angeltypes) > 0) { @@ -442,29 +441,10 @@ function view_user_shifts() { $entry_list[] = "" . $entry['Nick'].""; } if ($angeltype['count'] - count($entries) > 0) { - // is the shift still running or alternatively is the user shift admin? - $user_may_join_shift = true; - - /* you cannot join if user already joined this shift */ - $user_may_join_shift &= !$my_shift; - - // you cannot join if user is not of this angel type - $user_may_join_shift &= in_array($angeltype['id'], $_SESSION['user_shifts']['types']); - - // you can only join if the shift is in future or running - $user_may_join_shift &= time() < $shift['end']; - - // User shift admins may join anybody in every shift - $user_may_join_shift |= in_array('user_shifts_admin', $privileges); - - if ($user_may_join_shift) { + if ((time() < $shift['end'] && !$my_shift) || in_array('user_shifts_admin', $privileges)) { $entry_list[] = '' . ($angeltype['count'] - count($entries)) . ' Helfer' . ($angeltype['count'] - count($entries) != 1 ? '' : '') . ' gebraucht »'; } else { - if(!in_array('user_shifts_admin', $privileges) && $angeltype['restricted'] == 1 && !isset($angeltype['confirm_user_id'])) { - $entry_list[] = ($angeltype['count'] - count($entries)) . ' Helfer gebraucht' . ' unconfirmed'; - } else { - $entry_list[] = ($angeltype['count'] - count($entries)) . ' Helfer gebraucht' . ' (Werde ' . $angeltype['name'] .')'; - } + $entry_list[] = ($angeltype['count'] - count($entries)) . ' Helfer gebraucht'; } $is_free = true; } @@ -525,8 +505,8 @@ function view_user_shifts() { $shift_has_special_needs = 0 < sql_num_query("SELECT `id` FROM `NeededAngelTypes` WHERE `shift_id` = " . $shift['SID']); $query = "SELECT * FROM `NeededAngelTypes` - JOIN `AngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `AngelTypes`.`id`) - LEFT JOIN `UserAngelTypes` ON (`NeededAngelTypes`.`angel_type_id` = `UserAngelTypes`.`angeltype_id` AND `UserAngelTypes`.`user_id`=" . sql_escape($user['UID']) . ") + JOIN `AngelTypes` + ON (`NeededAngelTypes`.`angel_type_id` = `AngelTypes`.`id`) WHERE "; if ($shift_has_special_needs) $query .= "`shift_id` = " . sql_escape($shift['SID']); @@ -553,30 +533,10 @@ function view_user_shifts() { if ($angeltype['count'] - count($entries) > 0) { $inner_text = ($angeltype['count'] - count($entries)) . ' ' . Get_Text($angeltype['count'] - count($entries) == 1 ? 'helper' : 'helpers') . ' ' . Get_Text('needed'); // is the shift still running or alternatively is the user shift admin? - $user_may_join_shift = true; - - /* you cannot join if user already joined this shift */ - $user_may_join_shift &= !$my_shift; - - // you cannot join if user is not of this angel type - $user_may_join_shift &= in_array($angeltype['id'], $_SESSION['user_shifts']['types']); - - // you can only join if the shift is in future or running - $user_may_join_shift &= time() < $shift['end']; - - // User shift admins may join anybody in every shift - $user_may_join_shift |= in_array('user_shifts_admin', $privileges); - - if ($user_may_join_shift) + if ((time() < $shift['end'] && !$my_shift) || in_array('user_shifts_admin', $privileges)) $entry_list[] = '' . $inner_text . ' »'; - else { - if(!in_array('user_shifts_admin', $privileges) && $angeltype['restricted'] == 1 && !isset($angeltype['confirm_user_id'])) { - $entry_list[] = $inner_text . ' unconfirmed'; - } else { - $entry_list[] = $inner_text . ' (Werde ' . $angeltype['name'] .')'; - } - } - + else + $entry_list[] = $inner_text; unset($inner_text); $is_free = true; } @@ -639,7 +599,7 @@ function make_select($items, $selected, $name, $title = null) { $html_items[] = '
    • ' . $title . '
    • ' . "\n"; foreach ($items as $i) - $html_items[] = '
    • ' . (!isset($i['enabled']) || $i['enabled'] ? '' : ' unconfirmed') . '
    • '; + $html_items[] = '
    • '; $html = '
      ' . "\n"; $html .= '
        ' . "\n"; $html .= implode("\n", $html_items); diff --git a/public/css/base.css b/public/css/base.css index bb59014e..759e9157 100644 --- a/public/css/base.css +++ b/public/css/base.css @@ -389,7 +389,3 @@ tr:hover .hidden { #filter { padding: 10px; } - -td .entries img { - vertical-align: bottom; -} diff --git a/public/css/forms.js b/public/css/forms.js index 630d8c25..8a6e2c69 100644 --- a/public/css/forms.js +++ b/public/css/forms.js @@ -2,7 +2,7 @@ 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) + if(boxes[i].type == "checkbox") boxes[i].checked = true; } } diff --git a/public/pic/lock.png b/public/pic/lock.png deleted file mode 100644 index 2ebc4f6f9663e32cad77d67ef93ab8843dfea3c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 749 zcmVe|tv9>?g+k#9o0pTxd@;_sq{kwlU;^VvV*?BV8P@}BoaZTQUROpWV6|-M`|^n&)=+8tHo3*<<$NU zU`%V~ZF;?hBSYsjJ6%JzV}E(D{pOLqQklliUf9um_tGl-wty`y*p?eYNW56P>X@1s zZs7KrRZKtmV7Lqj^5Fgr7_`LjhdJK@ltF&O`j7?*NUM$KvmNGz)3WjM?V$vHlPT0AFyF?kLE<#HZabCSW3-oa*6;Z zrXD`Ulwd<^2glP%1Y1Kc1Ij%DU^=ME(jKf6APNlA$Uu;J4bVilQHSWX5uJ$9Zsp4M z0%!@LvyTxz=Z6stxlichODIY+yNGt%RM;m`>H4LOKLFs9Y%b5aUN|2|{0Zw|<_~i} fmXz*V19AKYa Date: Thu, 27 Dec 2012 17:32:14 +0100 Subject: [PATCH 4/4] reworked admin_user again --- includes/pages/admin_user.php | 136 ++++++++++++++-------------------- includes/sys_mysql.php | 5 +- includes/sys_template.php | 2 +- public/css/base.css | 16 +--- public/pic/icons/cross.png | Bin 0 -> 655 bytes public/pic/icons/pencil.png | Bin 0 -> 450 bytes public/pic/icons/tick.png | Bin 0 -> 537 bytes 7 files changed, 61 insertions(+), 98 deletions(-) create mode 100644 public/pic/icons/cross.png create mode 100644 public/pic/icons/pencil.png create mode 100644 public/pic/icons/tick.png diff --git a/includes/pages/admin_user.php b/includes/pages/admin_user.php index 9c13cbd7..5f2bdbe6 100644 --- a/includes/pages/admin_user.php +++ b/includes/pages/admin_user.php @@ -281,93 +281,65 @@ function admin_user() { if (!isset ($_GET["OrderBy"])) $_GET["OrderBy"] = "Nick"; $SQL = "SELECT * FROM `User` ORDER BY `" . sql_escape($_GET["OrderBy"]) . "` ASC"; - $Erg = sql_query($SQL); + $angels = sql_select($SQL); // anzahl zeilen - $Zeilen = mysql_num_rows($Erg); + $Zeilen = count($angels); $html .= "Anzahl Engel: $Zeilen

        \n"; - $html .= ' - - - - - - - - - - - - - '; - $Gekommen = 0; - $Active = 0; - $Tshirt = 0; - - for ($n = 0; $n < $Zeilen; $n++) { - $title = ""; - $user_groups = sql_select("SELECT * FROM `UserGroups` JOIN `Groups` ON (`Groups`.`UID` = `UserGroups`.`group_id`) WHERE `UserGroups`.`uid`=" . sql_escape(mysql_result($Erg, $n, "UID")) . " ORDER BY `Groups`.`Name`"); - $groups = array (); - foreach ($user_groups as $user_group) { - $groups[] = $user_group['Name']; - } - $title .= 'Groups: ' . join(", ", $groups) . "
        "; - if (strlen(mysql_result($Erg, $n, "Telefon")) > 0) - $title .= "Tel: " . mysql_result($Erg, $n, "Telefon") . "
        "; - if (strlen(mysql_result($Erg, $n, "Handy")) > 0) - $title .= "Handy: " . mysql_result($Erg, $n, "Handy") . "
        "; - if (strlen(mysql_result($Erg, $n, "DECT")) > 0) - $title .= "DECT: " . - mysql_result($Erg, $n, "DECT") . "
        "; - if (strlen(mysql_result($Erg, $n, "Hometown")) > 0) - $title .= "Hometown: " . mysql_result($Erg, $n, "Hometown") . "
        "; - if (strlen(mysql_result($Erg, $n, "CreateDate")) > 0) - $title .= "Registered: " . mysql_result($Erg, $n, "CreateDate") . "
        "; - if (strlen(mysql_result($Erg, $n, "Art")) > 0) - $title .= "Type: " . mysql_result($Erg, $n, "Art") . "
        "; - if (strlen(mysql_result($Erg, $n, "ICQ")) > 0) - $title .= "ICQ: " . mysql_result($Erg, $n, "ICQ") . "
        "; - if (strlen(mysql_result($Erg, $n, "jabber")) > 0) - $title .= "jabber: " . mysql_result($Erg, $n, "jabber") . "
        "; - - $html .= "\n"; - if (in_array("user_shifts_admin", $privileges)) - $html .= "\t\n"; - else - $html .= "\t\n"; - $html .= "\t\n"; - $html .= "\t\n"; - $html .= "\t\n"; - $html .= "\t\n"; - $Gekommen += mysql_result($Erg, $n, "Gekommen"); - $html .= "\t\n"; - $Active += mysql_result($Erg, $n, "Aktiv"); - $html .= "\t\n"; - $Tshirt += mysql_result($Erg, $n, "Tshirt"); - $html .= "\t\n"; - $html .= "\t\n"; - $last_login = mysql_result($Erg, $n, "lastLogIn"); - if($last_login == 0) - $html .= ""; - else - $html .= ""; - $html .= "\t\n"; - $html .= "\n"; + + function prepare_angel_table($angel) { + global $privileges; + $groups = sql_select_single_col("SELECT `Name` FROM `UserGroups` JOIN `Groups` ON (`Groups`.`UID` = `UserGroups`.`group_id`) WHERE `UserGroups`.`uid`=" . sql_escape($angel["UID"]) . " ORDER BY `Groups`.`Name`"); + $popup = '" . - "" . - "\n"; - $html .= "\t
        - Nick - Vorname NameDECTAlterE-MailLast loginEdit
        " . mysql_result($Erg, $n, "Nick") . "" . mysql_result($Erg, $n, "Nick") . "" . mysql_result($Erg, $n, "Vorname") . " " . mysql_result($Erg, $n, "Name") . "" . mysql_result($Erg, $n, "DECT") . "" . mysql_result($Erg, $n, "Alter") . ""; - if (strlen(mysql_result($Erg, $n, "email")) > 0) - $html .= "" . - mysql_result($Erg, $n, "email") . ""; - $html .= ''; - $html .= "" . mysql_result($Erg, $n, "Gekommen") . "" . mysql_result($Erg, $n, "Aktiv") . "" . mysql_result($Erg, $n, "Tshirt") . "" . mysql_result($Erg, $n, "Size") . "never" . date('d.m.&\n\b\s\p;H:i', $last_login) . "" . 'Edit' . - "
        Summe$Gekommen$Active$Tshirt
        \n"; - // Ende Userliste + $angels = array_map('prepare_angel_table', $angels); + $Gekommen = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Gekommen` = 1"); + $Active = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Aktiv` = 1"); + $Tshirt = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Tshirt` = 1"); + $angels[] = array('Nick' => 'Summe', 'Gekommen' => $Gekommen, 'Aktiv' => $Active, 'Tshirt' => $Tshirt); + $html .= table(array( + 'Nick' => 'Nick', + 'Name' => 'Vorname Name', + 'DECT' => 'DECT', + 'Alter' => 'Alter', + 'email' => 'E-Mail', + 'Gekommen' => '', + 'Aktiv' => '', + 'Tshirt' => '', + 'Size' => '', + 'lastLogIn' => 'Last login', + 'edit' => ''), + $angels); } return $html; } diff --git a/includes/sys_mysql.php b/includes/sys_mysql.php index 81747ec2..1315a4f6 100644 --- a/includes/sys_mysql.php +++ b/includes/sys_mysql.php @@ -33,8 +33,11 @@ function sql_select($query) { function sql_select_single_col($query) { $result = sql_select($query); - return array_map('array_pop', $result); + return array_map('array_shift', $result); +} +function sql_select_single_cell($query) { + return array_shift(array_shift(sql_select($query))); } // Execute a query diff --git a/includes/sys_template.php b/includes/sys_template.php index a988ff23..0f030e86 100644 --- a/includes/sys_template.php +++ b/includes/sys_template.php @@ -147,7 +147,7 @@ function table($columns, $rows, $data = true) { $html .= ''; $html .= ''; foreach ($columns as $key => $column) - $html .= '' . $column . ''; + $html .= '' . $column . ''; $html .= ''; $html .= ''; foreach ($rows as $row) { diff --git a/public/css/base.css b/public/css/base.css index 759e9157..6c5ecc57 100644 --- a/public/css/base.css +++ b/public/css/base.css @@ -152,24 +152,12 @@ td, th { border: 1px solid #888; } -td.true, td.false { - color: transparent; -} - -td.true { - background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGrSURBVDjLvZPZLkNhFIV75zjvYm7VGFNCqoZUJ+roKUUpjRuqp61Wq0NKDMelGGqOxBSUIBKXWtWGZxAvobr8lWjChRgSF//dv9be+9trCwAI/vIE/26gXmviW5bqnb8yUK028qZjPfoPWEj4Ku5HBspgAz941IXZeze8N1bottSo8BTZviVWrEh546EO03EXpuJOdG63otJbjBKHkEp/Ml6yNYYzpuezWL4s5VMtT8acCMQcb5XL3eJE8VgBlR7BeMGW9Z4yT9y1CeyucuhdTGDxfftaBO7G4L+zg91UocxVmCiy51NpiP3n2treUPujL8xhOjYOzZYsQWANyRYlU4Y9Br6oHd5bDh0bCpSOixJiWx71YY09J5pM/WEbzFcDmHvwwBu2wnikg+lEj4mwBe5bC5h1OUqcwpdC60dxegRmR06TyjCF9G9z+qM2uCJmuMJmaNZaUrCSIi6X+jJIBBYtW5Cge7cd7sgoHDfDaAvKQGAlRZYc6ltJlMxX03UzlaRlBdQrzSCwksLRbOpHUSb7pcsnxCCwngvM2Rm/ugUCi84fycr4l2t8Bb6iqTxSCgNIAAAAAElFTkSuQmCC') no-repeat center center; -} - -td.false { - background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAIhSURBVDjLlZPrThNRFIWJicmJz6BWiYbIkYDEG0JbBiitDQgm0PuFXqSAtKXtpE2hNuoPTXwSnwtExd6w0pl2OtPlrphKLSXhx07OZM769qy19wwAGLhM1ddC184+d18QMzoq3lfsD3LZ7Y3XbE5DL6Atzuyilc5Ciyd7IHVfgNcDYTQ2tvDr5crn6uLSvX+Av2Lk36FFpSVENDe3OxDZu8apO5rROJDLo30+Nlvj5RnTlVNAKs1aCVFr7b4BPn6Cls21AWgEQlz2+Dl1h7IdA+i97A/geP65WhbmrnZZ0GIJpr6OqZqYAd5/gJpKox4Mg7pD2YoC2b0/54rJQuJZdm6Izcgma4TW1WZ0h+y8BfbyJMwBmSxkjw+VObNanp5h/adwGhaTXF4NWbLj9gEONyCmUZmd10pGgf1/vwcgOT3tUQE0DdicwIod2EmSbwsKE1P8QoDkcHPJ5YESjgBJkYQpIEZ2KEB51Y6y3ojvY+P8XEDN7uKS0w0ltA7QGCWHCxSWWpwyaCeLy0BkA7UXyyg8fIzDoWHeBaDN4tQdSvAVdU1Aok+nsNTipIEVnkywo/FHatVkBoIhnFisOBoZxcGtQd4B0GYJNZsDSiAEadUBCkstPtN3Avs2Msa+Dt9XfxoFSNYF/Bh9gP0bOqHLAm2WUF1YQskwrVFYPWkf3h1iXwbvqGfFPSGW9Eah8HSS9fuZDnS32f71m8KFY7xs/QZyu6TH2+2+FAAAAABJRU5ErkJggg==') no-repeat center center; -} - -.rotate { +th.Gekommen { /* this is a hack because the height of the row isn't adjusted automatically */ height: 6em; } -.rotate div { +div.rotate { transform: rotate(270deg); width: 1ex; margin: 0 auto -2px; diff --git a/public/pic/icons/cross.png b/public/pic/icons/cross.png new file mode 100644 index 0000000000000000000000000000000000000000..1514d51a3cf1b67e1c5b9ada36f1fd474e2d214a GIT binary patch literal 655 zcmV;A0&x9_P)uEoyT++I zn$b9r%cFfhHe2K68PkBu*@^<$y+7xQ$wJ~;c5aBx$R=xq*41Wo zhwQus_VOgm0hughj}MhOvs#{>Vg09Y8WxjWUJY5YW zJ?&8eG!59Cz=|E%Ns@013KLWOLV)CObIIj_5{>{#k%TEAMs_GbdDV`x-iYsGH z#=Z{USAQA>NY(}X7=3{K8#Rq1}l<=psl5*5Xz9i;M}s*NP=ugs7Q#8Z;Dyx|}!`#}xw_C3!B-yaPC&0j)XcpuX@rNfq|q}N(wJOjA& z>u+z?dfJEuLePrqzy!)73pvLjxk4d6XNZt?hm_iYES{i}J5y3l?}PPNYDBR7oPc~6 zL^d)Bi4Q2L3pnp!nFxN9c2E+=@XAl&+;2m6a~kZj1r3Mz3C=hmUG<{+vWR@t4q?fJ zhFc(ozZD#Mx`^Q~g1v=K6!QnfuqyD4>U4EjF0eamL}Jx| z%&`kR-H+3GBYr*Qx}frLU4`%n9(`uSomzw)t%%NagXkA*R5Mbv9VLDp1wMo$cOMa~ s3Wm%r7^bwK$2$}-<~D8p`#1iScU4^XCLAA~0ssI207*qoM6N<$g3sK(Qvd(} literal 0 HcmV?d00001 diff --git a/public/pic/icons/tick.png b/public/pic/icons/tick.png new file mode 100644 index 0000000000000000000000000000000000000000..a9925a06ab02db30c1e7ead9c701c15bc63145cb GIT binary patch literal 537 zcmV+!0_OdRP)Hs{AQG2a)rMyf zFQK~pm1x3+7!nu%-M`k}``c>^00{o_1pjWJUTfl8mg=3qGEl8H@}^@w`VUx0_$uy4 z2FhRqKX}xI*?Tv1DJd8z#F#0c%*~rM30HE1@2o5m~}ZyoWhqv>ql{V z1ZGE0lgcoK^lx+eqc*rAX1Ky;Xx3U%u#zG!m-;eD1Qsn@kf3|F9qz~|95=&g3(7!X zB}JAT>RU;a%vaNOGnJ%e1=K6eAh43c(QN8RQ6~GP%O}Jju$~Ld*%`mO1p