From 5e8453992810181facf168d6aaede9d2dcd61dba Mon Sep 17 00:00:00 2001
From: Philip Häusler The original system was written by cookie. It was then completely rewritten and greatly enhanced by msquare and helios of planet cyborg and jplitza. The original system was written by cookie. It was then completely rewritten and greatly enhanced by msquare and mortzu of planet cyborg and jplitza. Webspace, development platform and domain is currently provided by would you buy this? (ichdasich)
' . _("Unconfirmed");
+ else
+ $angeltype['membership'] = '
' . _("Member");
+ } else
+ $angeltype['membership'] = '
' . _("Member");
+ $actions[] = '' . _("leave") . '';
+ } else {
+ $angeltype['membership'] = '
';
+ $actions[] = '' . _("join") . '';
+ }
+
+ $angeltype['restricted'] = $angeltype['restricted'] ? '
' : '';
+ $angeltype['name'] = '' . $angeltype['name'] . '';
+
+ $angeltype['actions'] = join(" ", $actions);
+ }
+
+ return array(
+ angeltypes_title(),
+ AngelTypes_list_view($angeltypes, in_array('admin_angel_types', $privileges))
+ );
+}
+?>
\ No newline at end of file
diff --git a/includes/controller/user_angeltypes_controller.php b/includes/controller/user_angeltypes_controller.php
new file mode 100644
index 00000000..d110f7a7
--- /dev/null
+++ b/includes/controller/user_angeltypes_controller.php
@@ -0,0 +1,272 @@
+
\ No newline at end of file
diff --git a/includes/model/AngelType_model.php b/includes/model/AngelType_model.php
index 49d1c702..22baa4a4 100644
--- a/includes/model/AngelType_model.php
+++ b/includes/model/AngelType_model.php
@@ -1,29 +1,107 @@
- 0)
- return $angelType_source;
- return null;
-}
-
-/**
- * Returns angelType by id.
- *
- * @param $id angelType ID
- */
-function mAngelType($id) {
- $angelType_source = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($id) . " LIMIT 1");
- if ($angelType_source === false)
- return false;
- if (count($angelType_source) > 0)
- return $angelType_source[0];
- return null;
-}
-
+ 0)
+ return $angelType_source;
+ return null;
+}
+
+/**
+ * Returns angelType by id.
+ *
+ * @param $id angelType
+ * ID
+ */
+function mAngelType($id) {
+ $angelType_source = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($id) . " LIMIT 1");
+ if ($angelType_source === false)
+ return false;
+ if (count($angelType_source) > 0)
+ return $angelType_source[0];
+ return null;
+}
+
?>
\ No newline at end of file
diff --git a/includes/model/UserAngelTypes_model.php b/includes/model/UserAngelTypes_model.php
new file mode 100644
index 00000000..e931e04b
--- /dev/null
+++ b/includes/model/UserAngelTypes_model.php
@@ -0,0 +1,69 @@
+
\ No newline at end of file
diff --git a/includes/model/User_model.php b/includes/model/User_model.php
index 6b23f74b..84097333 100644
--- a/includes/model/User_model.php
+++ b/includes/model/User_model.php
@@ -1,5 +1,18 @@
$angel_type['id'],
- 'name' => $angel_type['name'],
- 'restricted' => $angel_type['restricted'] == 1 ? '✓' : '',
- 'actions' => 'edit delete'
- );
- }
-
- if (isset ($_REQUEST['show'])) {
- $msg = "";
- $name = "";
- $restricted = 0;
-
- if (test_request_int('id')) {
- $angel_type = sql_select("SELECT * FROM `AngelTypes` WHERE `id`=" . sql_escape($_REQUEST['id']));
- if (count($angel_type) > 0) {
- $id = $_REQUEST['id'];
- $name = $angel_type[0]['name'];
- $restricted = $angel_type[0]['restricted'];
- } else
- redirect(page_link_to('admin_angel_types'));
- }
-
- if ($_REQUEST['show'] == 'edit') {
- if (isset ($_REQUEST['submit'])) {
- $ok = true;
-
- if (isset ($_REQUEST['name']) && strlen(strip_request_item('name')) > 0) {
- $name = strip_request_item('name');
- if (sql_num_query("SELECT * FROM `AngelTypes` WHERE NOT `id`=" . sql_escape(isset ($id) ? $id : 0) . " AND `name`='" . sql_escape(strip_request_item('name')) . "' LIMIT 1") > 0) {
- $ok = false;
- $msg .= error("This angel type name is already given.", true);
- }
- } else {
- $ok = false;
- $msg .= error("Please enter a name.", true);
- }
-
- if (isset ($_REQUEST['restricted']))
- $restricted = 1;
- else
- $restricted = 0;
-
- if ($ok) {
- if (isset ($id)) {
- sql_query("UPDATE `AngelTypes` SET `name`='" . sql_escape($name) . "', `restricted`=" . sql_escape($restricted) . " WHERE `id`=" . sql_escape($id) . " LIMIT 1");
- engelsystem_log("Updated angeltype: " . $name . ", restricted: " . $restricted);
- } else {
- sql_query("INSERT INTO `AngelTypes` SET `name`='" . sql_escape($name) . "', `restricted`=" . sql_escape($restricted));
- engelsystem_log("Created angeltype: " . $name . ", restricted: " . $restricted);
- }
-
- success("Angel type saved.");
- redirect(page_link_to('admin_angel_types'));
- }
- }
-
- return page(array (
- buttons(array (
- button(page_link_to('admin_angel_types'), "Back", 'back')
- )),
- $msg,
- form(array (
- form_text('name', 'Name', $name),
- form_checkbox('restricted', 'Restricted', $restricted),
- form_info("", "Restricted angel types can only be used by an angel if enabled by an archangel (double opt-in)."),
- form_submit('submit', 'Save')
- ))
- ));
- }
- elseif ($_REQUEST['show'] == 'delete') {
- if (isset ($_REQUEST['ack'])) {
- sql_query("DELETE FROM `NeededAngelTypes` WHERE `angel_type_id`=" . sql_escape($id) . " LIMIT 1");
- sql_query("DELETE FROM `ShiftEntry` WHERE `TID`=" . sql_escape($id) . " LIMIT 1");
- sql_query("DELETE FROM `AngelTypes` WHERE `id`=" . sql_escape($id) . " LIMIT 1");
- sql_query("DELETE FROM `UserAngelTypes` WHERE `angeltype_id`=" . sql_escape($id) . " LIMIT 1");
- engelsystem_log("Deleted angel type: " . $name);
- success(sprintf("Angel type %s deleted.", $name));
- redirect(page_link_to('admin_angel_types'));
- }
-
- return page(array (
- buttons(array (
- button(page_link_to('admin_angel_types'), "Back", 'cancel')
- )),
- sprintf("Do you want to delete angel type %s?", $name),
- buttons(array (
- button(page_link_to('admin_angel_types') . '&show=delete&id=' . $id . '&ack', "Delete", 'ok')
- ))
- ));
- } else
- redirect(page_link_to('admin_angel_types'));
- }
-
- return page(array (
- buttons(array (
- button(page_link_to('admin_angel_types') . '&show=edit', "Add", 'add')
- )),
- msg(),
- table(array (
- 'name' => "Name",
- 'restricted' => "Restricted",
- 'actions' => ""
- ), $angel_types)
- ));
-}
-?>
diff --git a/includes/pages/admin_user_angeltypes.php b/includes/pages/admin_user_angeltypes.php
index 9377dc20..2b623d72 100644
--- a/includes/pages/admin_user_angeltypes.php
+++ b/includes/pages/admin_user_angeltypes.php
@@ -97,18 +97,4 @@ function admin_user_angeltypes() {
));
}
-/**
- * Anzeige, ob noch Engeltypen bestätigt werden müssen. Damit werden Erzengel auf jeder Seite im Kopfbereich "genervt", wenn zu ihren Aufgaben noch Engel bestätigt werden müssen.
- */
-function admin_new_user_angeltypes() {
- global $user, $privileges;
-
- if (in_array("admin_user_angeltypes", $privileges)) {
- $unconfirmed_angeltypes = sql_num_query("SELECT * FROM `UserAngelTypes` JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id` WHERE `UserAngelTypes`.`angeltype_id` IN (SELECT `angeltype_id` FROM `UserAngelTypes` WHERE `user_id`=" . sql_escape($user['UID']) . ") AND `AngelTypes`.`restricted`=1 AND `UserAngelTypes`.`confirm_user_id` IS NULL LIMIT 1") > 0;
-
- if ($unconfirmed_angeltypes)
- return info('' . _("There are unconfirmed angeltypes!") . '', true);
- }
- return "";
-}
?>
diff --git a/includes/sys_menu.php b/includes/sys_menu.php
index d4620753..ae39afeb 100644
--- a/includes/sys_menu.php
+++ b/includes/sys_menu.php
@@ -44,6 +44,7 @@ function make_navigation() {
"user_meetings" => meetings_title(),
"user_myshifts" => myshifts_title(),
"user_shifts" => shifts_title(),
+ "angeltypes" => angeltypes_title(),
"user_messages" => messages_title(),
"user_questions" => questions_title(),
"user_wakeup" => wakeup_title(),
@@ -52,7 +53,6 @@ function make_navigation() {
"admin_user" => admin_user_title(),
"admin_free" => admin_free_title(),
"admin_questions" => admin_questions_title(),
- "admin_angel_types" => admin_angel_types_title(),
"admin_user_angeltypes" => admin_user_angeltypes_title(),
"admin_shifts" => admin_shifts_title(),
"admin_rooms" => admin_rooms_title(),
diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php
new file mode 100644
index 00000000..f0ab0e42
--- /dev/null
+++ b/includes/view/AngelTypes_view.php
@@ -0,0 +1,115 @@
+' . _("Info") . '';
+ // Description + Team-Coordinators
+
+ $page[] = '' . _("Members") . '
';
+ $members_confirmed = array();
+ $members_unconfirmed = array();
+ foreach ($members as $member) {
+ $member['Nick'] = User_Nick_render($member);
+ if ($angeltype['restricted'] && $member['confirm_user_id'] == null) {
+ $member['actions'] = join(" ", array(
+ '' . ("confirm") . '',
+ '' . ("deny") . ''
+ ));
+ $members_unconfirmed[] = $member;
+ } else {
+ if ($admin_user_angeltypes)
+ $member['actions'] = join(" ", array(
+ '' . ("remove") . ''
+ ));
+ $members_confirmed[] = $member;
+ }
+ }
+ $page[] = table(array(
+ 'Nick' => _("Nick"),
+ 'DECT' => _("DECT"),
+ 'actions' => ""
+ ), $members_confirmed);
+
+ if ($admin_user_angeltypes && $angeltype['restricted'] && count($members_unconfirmed) > 0) {
+ $page[] = '' . _("Unconfirmed") . '
';
+ $page[] = buttons(array(
+ button(page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'], _("confirm all"), 'ok'),
+ button(page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'], _("deny all"), 'cancel')
+ ));
+ $page[] = table(array(
+ 'Nick' => _("Nick"),
+ 'DECT' => _("DECT"),
+ 'actions' => ""
+ ), $members_unconfirmed);
+ }
+
+ return page($page);
+}
+
+/**
+ * Display the list of angeltypes.
+ *
+ * @param array $angeltypes
+ */
+function AngelTypes_list_view($angeltypes, $admin_angeltypes) {
+ return page(array(
+ msg(),
+ $admin_angeltypes ? buttons(array(
+ button(page_link_to('angeltypes') . '&action=edit', _("New angeltype"), 'add')
+ )) : '',
+ table(array(
+ 'name' => _("Name"),
+ 'restricted' => '
',
+ 'membership' => _("Membership"),
+ 'actions' => ""
+ ), $angeltypes)
+ ));
+}
+
+?>
\ No newline at end of file
diff --git a/includes/view/UserAngelTypes_view.php b/includes/view/UserAngelTypes_view.php
new file mode 100644
index 00000000..ed825c04
--- /dev/null
+++ b/includes/view/UserAngelTypes_view.php
@@ -0,0 +1,58 @@
+
\ No newline at end of file
diff --git a/public/css/base.css b/public/css/base.css
index 2f5aa18c..89fa62a5 100644
--- a/public/css/base.css
+++ b/public/css/base.css
@@ -357,8 +357,13 @@ tr:hover .hidden {
margin: 0 0 10px 0;
}
+.actions a {
+ background: 2px 1px no-repeat;
+ padding-right: 5px;
+}
+
a.button {
- background: #f0f0f0;
+ background: #f0f0f0 2px 2px no-repeat;
border: 1px solid #888;
border-radius: 4px;
line-height: 25px;
@@ -374,26 +379,36 @@ a.button {
.button:hover, .toolbar .button:hover {
color: #000;
- background: #fff;
+ background-color: #fff;
}
-.button.add {
- background: url('../pic/icons/add.png') 2px 2px no-repeat;
+.button.add, .actions .add {
+ background-image: url('../pic/icons/add.png');
padding-left: 20px;
}
-.button.edit {
- background: url('../pic/icons/pencil.png') 2px 2px no-repeat;
+.button.edit, .actions .edit {
+ background-image: url('../pic/icons/pencil.png');
padding-left: 20px;
}
-.button.ok {
- background: url('../pic/icons/tick.png') 2px 2px no-repeat;
+.button.ok, .actions .ok {
+ background-image: url('../pic/icons/tick.png');
+ padding-left: 20px;
+}
+
+.button.cancel, .actions .cancel {
+ background-image: url('../pic/icons/cross.png');
+ padding-left: 20px;
+}
+
+.button.delete, .actions .delete {
+ background-image: url('../pic/icons/bin.png');
padding-left: 20px;
}
-.button.cancel {
- background: url('../pic/icons/cross.png') 2px 2px no-repeat;
+.button.back, .actions .back {
+ background-image: url('../pic/icons/arrow_left.png');
padding-left: 20px;
}
diff --git a/public/index.php b/public/index.php
index 24d92b9d..9cd01e40 100644
--- a/public/index.php
+++ b/public/index.php
@@ -10,20 +10,26 @@ require_once ('includes/sys_menu.php');
require_once ('includes/sys_page.php');
require_once ('includes/sys_template.php');
+require_once ('includes/model/AngelType_model.php');
require_once ('includes/model/LogEntries_model.php');
+require_once ('includes/model/Message_model.php');
require_once ('includes/model/NeededAngelTypes_model.php');
+require_once ('includes/model/Room_model.php');
require_once ('includes/model/ShiftEntry_model.php');
require_once ('includes/model/Shifts_model.php');
+require_once ('includes/model/UserAngelTypes_model.php');
require_once ('includes/model/User_model.php');
-require_once ('includes/model/Room_model.php');
-require_once ('includes/model/Message_model.php');
-require_once ('includes/model/AngelType_model.php');
+require_once ('includes/view/AngelTypes_view.php');
require_once ('includes/view/Questions_view.php');
require_once ('includes/view/Shifts_view.php');
require_once ('includes/view/ShiftEntry_view.php');
+require_once ('includes/view/UserAngelTypes_view.php');
require_once ('includes/view/User_view.php');
+require_once ('includes/controller/angeltypes_controller.php');
+require_once ('includes/controller/user_angeltypes_controller.php');
+
require_once ('includes/helper/internationalization_helper.php');
require_once ('includes/helper/message_helper.php');
require_once ('includes/helper/error_helper.php');
@@ -34,7 +40,6 @@ if (file_exists('../config/config.php'))
require_once ('config/config.php');
require_once ('includes/pages/admin_active.php');
-require_once ('includes/pages/admin_angel_types.php');
require_once ('includes/pages/admin_arrive.php');
require_once ('includes/pages/admin_free.php');
require_once ('includes/pages/admin_groups.php');
@@ -70,7 +75,8 @@ $free_pages = array(
'stats',
'shifts_json_export_all',
'user_password_recovery',
- 'api'
+ 'api',
+ 'credits'
);
// Gewünschte Seite/Funktion
@@ -86,7 +92,7 @@ if (isset($_REQUEST['p']) && preg_match("/^[a-z0-9_]*$/i", $_REQUEST['p']) && (i
require_once ('includes/controller/api.php');
error("Api disabled temporily.");
redirect(page_link_to('login'));
- //api_controller();
+ // api_controller();
} elseif ($p == "ical") {
require_once ('includes/pages/user_ical.php');
user_ical();
@@ -106,6 +112,10 @@ if (isset($_REQUEST['p']) && preg_match("/^[a-z0-9_]*$/i", $_REQUEST['p']) && (i
require_once ('includes/controller/users_controller.php');
$title = user_password_recovery_title();
$content = user_password_recovery_controller();
+ } elseif ($p == "angeltypes") {
+ list($title, $content) = angeltypes_controller();
+ } elseif ($p == "user_angeltypes") {
+ list($title, $content) = user_angeltypes_controller();
} elseif ($p == "news") {
$title = news_title();
$content = user_news();
@@ -164,9 +174,6 @@ if (isset($_REQUEST['p']) && preg_match("/^[a-z0-9_]*$/i", $_REQUEST['p']) && (i
} elseif ($p == "admin_news") {
require_once ('includes/pages/admin_news.php');
$content = admin_news();
- } elseif ($p == "admin_angel_types") {
- $title = admin_angel_types_title();
- $content = admin_angel_types();
} elseif ($p == "admin_rooms") {
$title = admin_rooms_title();
$content = admin_rooms();
@@ -206,10 +213,10 @@ if (isset($_REQUEST['p']) && preg_match("/^[a-z0-9_]*$/i", $_REQUEST['p']) && (i
if (isset($user)) {
$freeloaded_shifts_count = count(ShiftEntries_freeloaded_by_user($user));
- if($freeloaded_shifts_count >= $max_freeloadable_shifts)
+ if ($freeloaded_shifts_count >= $max_freeloadable_shifts)
$content = error(sprintf(_("You freeloaded %s shifts. Shift signup is locked. Please go to heavens desk to be unlocked again."), $freeloaded_shifts_count), true) . $content;
-
- // Hinweis für ungelesene Nachrichten
+
+ // Hinweis für ungelesene Nachrichten
if ($p != "user_messages")
$content = user_unread_messages() . $content;
@@ -226,10 +233,6 @@ if (isset($user)) {
// Erzengel Hinweis für unbeantwortete Fragen
if ($p != "admin_questions")
$content = admin_new_questions() . $content;
-
- // Erzengel Hinweis für freizuschaltende Engeltypen
- if ($p != "admin_user_angeltypes")
- $content = admin_new_user_angeltypes() . $content;
}
echo template_render('../templates/layout.html', array(
diff --git a/public/pic/icons/arrow_left.png b/public/pic/icons/arrow_left.png
new file mode 100755
index 00000000..5dc69678
Binary files /dev/null and b/public/pic/icons/arrow_left.png differ
diff --git a/templates/guest_credits.html b/templates/guest_credits.html
index b586c722..2b48c081 100644
--- a/templates/guest_credits.html
+++ b/templates/guest_credits.html
@@ -1,9 +1,9 @@
Source code
-Hosting
-and adminstrated by helios, derf and ichdasich.
Some icons from the famfamfam.com silk iconset have been used. They are licensed under the Creative Commons Attribution 2.5 License.
-- cgit v1.3.1