added angeltype description

This commit is contained in:
Philip Häusler 2014-03-09 13:12:46 +01:00
parent 893bb5a9cf
commit 98f355cd86
7 changed files with 105 additions and 39 deletions

View File

@ -3,7 +3,7 @@
-- http://www.phpmyadmin.net -- http://www.phpmyadmin.net
-- --
-- Host: localhost -- Host: localhost
-- Erstellungszeit: 05. Jan 2014 um 20:01 -- Erstellungszeit: 09. Mrz 2014 um 13:11
-- Server Version: 5.6.12 -- Server Version: 5.6.12
-- PHP-Version: 5.5.3 -- PHP-Version: 5.5.3
@ -11,6 +11,12 @@ SET FOREIGN_KEY_CHECKS=0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00"; SET time_zone = "+00:00";
--
-- Datenbank: `engelsystem`
--
CREATE DATABASE IF NOT EXISTS `engelsystem` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `engelsystem`;
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
@ -22,9 +28,17 @@ CREATE TABLE IF NOT EXISTS `AngelTypes` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(25) NOT NULL DEFAULT '', `name` varchar(25) NOT NULL DEFAULT '',
`restricted` int(1) NOT NULL, `restricted` int(1) NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `Name` (`name`) UNIQUE KEY `Name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
--
-- Daten für Tabelle `AngelTypes`
--
INSERT INTO `AngelTypes` (`id`, `name`, `restricted`, `description`) VALUES
(1, 'testengel', 0, '# Überschrift in Ebene 1\n\n#### Überschrift in Ebene 4\n\n[Beschriftung des Hyperlinks](http://de.wikipedia.org/ "Titel, der beim Überfahren mit der Maus angezeigt wird")');
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -39,6 +53,21 @@ CREATE TABLE IF NOT EXISTS `Counter` (
PRIMARY KEY (`URL`) PRIMARY KEY (`URL`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Counter der Seiten'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Counter der Seiten';
--
-- Daten für Tabelle `Counter`
--
INSERT INTO `Counter` (`URL`, `Anz`) VALUES
('admin_user', 2),
('angeltypes', 33),
('login', 11),
('news', 6),
('register', 1),
('user_angeltypes', 2),
('user_meetings', 1),
('user_myshifts', 2),
('user_settings', 7);
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
@ -142,7 +171,19 @@ CREATE TABLE IF NOT EXISTS `LogEntries` (
`message` text NOT NULL, `message` text NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `timestamp` (`timestamp`) KEY `timestamp` (`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;
--
-- Daten für Tabelle `LogEntries`
--
INSERT INTO `LogEntries` (`id`, `timestamp`, `nick`, `message`) VALUES
(1, 1390991375, 'admin', 'Created angeltype: testengel, restricted: 0'),
(2, 1390991407, 'admin', 'User <a href="?p=user_myshifts&amp;id=1">admin</a> joined testengel.'),
(3, 1390991407, 'admin', 'User <a href="?p=user_myshifts&amp;id=1">admin</a> confirmed as testengel.'),
(4, 1394366820, 'admin', 'Updated angeltype: testengel, restricted: 0'),
(5, 1394366908, 'admin', 'Updated angeltype: testengel, restricted: 0'),
(6, 1394367023, 'admin', 'Own angel types set to: testengel');
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -181,7 +222,7 @@ CREATE TABLE IF NOT EXISTS `NeededAngelTypes` (
KEY `room_id` (`room_id`,`angel_type_id`), KEY `room_id` (`room_id`,`angel_type_id`),
KEY `shift_id` (`shift_id`), KEY `shift_id` (`shift_id`),
KEY `angel_type_id` (`angel_type_id`) KEY `angel_type_id` (`angel_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -199,7 +240,7 @@ CREATE TABLE IF NOT EXISTS `News` (
`Treffen` tinyint(4) NOT NULL DEFAULT '0', `Treffen` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
KEY `UID` (`UID`) KEY `UID` (`UID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -217,7 +258,7 @@ CREATE TABLE IF NOT EXISTS `NewsComments` (
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
KEY `Refid` (`Refid`), KEY `Refid` (`Refid`),
KEY `UID` (`UID`) KEY `UID` (`UID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -292,7 +333,7 @@ CREATE TABLE IF NOT EXISTS `Questions` (
PRIMARY KEY (`QID`), PRIMARY KEY (`QID`),
KEY `UID` (`UID`), KEY `UID` (`UID`),
KEY `AID` (`AID`) KEY `AID` (`AID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Fragen und Antworten' AUTO_INCREMENT=1 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Fragen und Antworten' AUTO_INCREMENT=1 ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -310,7 +351,7 @@ CREATE TABLE IF NOT EXISTS `Room` (
`Number` int(11) DEFAULT NULL, `Number` int(11) DEFAULT NULL,
PRIMARY KEY (`RID`), PRIMARY KEY (`RID`),
UNIQUE KEY `Name` (`Name`) UNIQUE KEY `Name` (`Name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -332,7 +373,7 @@ CREATE TABLE IF NOT EXISTS `ShiftEntry` (
KEY `UID` (`UID`), KEY `UID` (`UID`),
KEY `SID` (`SID`,`TID`), KEY `SID` (`SID`,`TID`),
KEY `freeloaded` (`freeloaded`) KEY `freeloaded` (`freeloaded`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -352,7 +393,7 @@ CREATE TABLE IF NOT EXISTS `Shifts` (
PRIMARY KEY (`SID`), PRIMARY KEY (`SID`),
UNIQUE KEY `PSID` (`PSID`), UNIQUE KEY `PSID` (`PSID`),
KEY `RID` (`RID`) KEY `RID` (`RID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -402,7 +443,7 @@ CREATE TABLE IF NOT EXISTS `User` (
-- --
INSERT INTO `User` (`UID`, `Nick`, `Name`, `Vorname`, `Alter`, `Telefon`, `DECT`, `Handy`, `email`, `ICQ`, `jabber`, `Size`, `Passwort`, `password_recovery_token`, `Gekommen`, `Aktiv`, `force_active`, `Tshirt`, `color`, `Sprache`, `Avatar`, `Menu`, `lastLogIn`, `CreateDate`, `Art`, `kommentar`, `Hometown`, `api_key`) VALUES INSERT INTO `User` (`UID`, `Nick`, `Name`, `Vorname`, `Alter`, `Telefon`, `DECT`, `Handy`, `email`, `ICQ`, `jabber`, `Size`, `Passwort`, `password_recovery_token`, `Gekommen`, `Aktiv`, `force_active`, `Tshirt`, `color`, `Sprache`, `Avatar`, `Menu`, `lastLogIn`, `CreateDate`, `Art`, `kommentar`, `Hometown`, `api_key`) VALUES
(1, 'admin', 'Gates', 'Bill', 42, '', '-', '', '', '', '', 'XL', '21232f297a57a5a743894a0e4a801fc3', NULL, 1, 0, 1, 0, 1, 'de_DE.UTF-8', 115, 'L', 1388948427, '0000-00-00 00:00:00', '', '', '', '038850abdd1feb264406be3ffa746235'); (1, 'admin', 'Gates', 'Bill', 42, '', '-', '', 'admin@example.com', '', '', 'XL', '$6$rounds=5000$hjXbIhoRTH3vKiRa$Wl2P2iI5T9iRR.HHu/YFHswBW0WVn0yxCfCiX0Keco9OdIoDK6bIAADswP6KvMCJSwTGdV8PgA8g8Xfw5l8BD1', NULL, 1, 0, 1, 0, 1, 'de_DE.UTF-8', 115, 'L', 1394367023, '0000-00-00 00:00:00', '', '', '', '038850abdd1feb264406be3ffa746235');
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -420,7 +461,14 @@ CREATE TABLE IF NOT EXISTS `UserAngelTypes` (
KEY `user_id` (`user_id`,`angeltype_id`,`confirm_user_id`), KEY `user_id` (`user_id`,`angeltype_id`,`confirm_user_id`),
KEY `angeltype_id` (`angeltype_id`), KEY `angeltype_id` (`angeltype_id`),
KEY `confirm_user_id` (`confirm_user_id`) KEY `confirm_user_id` (`confirm_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
--
-- Daten für Tabelle `UserAngelTypes`
--
INSERT INTO `UserAngelTypes` (`id`, `user_id`, `angeltype_id`, `confirm_user_id`) VALUES
(1, 1, 1, 1);
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -436,7 +484,7 @@ CREATE TABLE IF NOT EXISTS `UserGroups` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `uid` (`uid`,`group_id`), KEY `uid` (`uid`,`group_id`),
KEY `group_id` (`group_id`) KEY `group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=27 ; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ;
-- --
-- Daten für Tabelle `UserGroups` -- Daten für Tabelle `UserGroups`
@ -457,23 +505,23 @@ INSERT INTO `UserGroups` (`id`, `uid`, `group_id`) VALUES
-- Constraints der Tabelle `GroupPrivileges` -- Constraints der Tabelle `GroupPrivileges`
-- --
ALTER TABLE `GroupPrivileges` ALTER TABLE `GroupPrivileges`
ADD CONSTRAINT `groupprivileges_ibfk_2` FOREIGN KEY (`privilege_id`) REFERENCES `Privileges` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `groupprivileges_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `Groups` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `groupprivileges_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `Groups` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE; ADD CONSTRAINT `groupprivileges_ibfk_2` FOREIGN KEY (`privilege_id`) REFERENCES `Privileges` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- --
-- Constraints der Tabelle `Messages` -- Constraints der Tabelle `Messages`
-- --
ALTER TABLE `Messages` ALTER TABLE `Messages`
ADD CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`RUID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`SUID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`SUID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE; ADD CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`RUID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE;
-- --
-- Constraints der Tabelle `NeededAngelTypes` -- Constraints der Tabelle `NeededAngelTypes`
-- --
ALTER TABLE `NeededAngelTypes` ALTER TABLE `NeededAngelTypes`
ADD CONSTRAINT `neededangeltypes_ibfk_3` FOREIGN KEY (`angel_type_id`) REFERENCES `AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `neededangeltypes_ibfk_1` FOREIGN KEY (`room_id`) REFERENCES `Room` (`RID`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `neededangeltypes_ibfk_1` FOREIGN KEY (`room_id`) REFERENCES `Room` (`RID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `neededangeltypes_ibfk_2` FOREIGN KEY (`shift_id`) REFERENCES `Shifts` (`SID`) ON DELETE CASCADE ON UPDATE CASCADE; ADD CONSTRAINT `neededangeltypes_ibfk_2` FOREIGN KEY (`shift_id`) REFERENCES `Shifts` (`SID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `neededangeltypes_ibfk_3` FOREIGN KEY (`angel_type_id`) REFERENCES `AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- --
-- Constraints der Tabelle `News` -- Constraints der Tabelle `News`
@ -485,23 +533,23 @@ ALTER TABLE `News`
-- Constraints der Tabelle `NewsComments` -- Constraints der Tabelle `NewsComments`
-- --
ALTER TABLE `NewsComments` ALTER TABLE `NewsComments`
ADD CONSTRAINT `newscomments_ibfk_2` FOREIGN KEY (`UID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `newscomments_ibfk_1` FOREIGN KEY (`Refid`) REFERENCES `News` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `newscomments_ibfk_1` FOREIGN KEY (`Refid`) REFERENCES `News` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE; ADD CONSTRAINT `newscomments_ibfk_2` FOREIGN KEY (`UID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE;
-- --
-- Constraints der Tabelle `Questions` -- Constraints der Tabelle `Questions`
-- --
ALTER TABLE `Questions` ALTER TABLE `Questions`
ADD CONSTRAINT `questions_ibfk_2` FOREIGN KEY (`AID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `questions_ibfk_1` FOREIGN KEY (`UID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `questions_ibfk_1` FOREIGN KEY (`UID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE; ADD CONSTRAINT `questions_ibfk_2` FOREIGN KEY (`AID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE;
-- --
-- Constraints der Tabelle `ShiftEntry` -- Constraints der Tabelle `ShiftEntry`
-- --
ALTER TABLE `ShiftEntry` ALTER TABLE `ShiftEntry`
ADD CONSTRAINT `shiftentry_ibfk_3` FOREIGN KEY (`TID`) REFERENCES `AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `shiftentry_ibfk_1` FOREIGN KEY (`SID`) REFERENCES `Shifts` (`SID`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `shiftentry_ibfk_1` FOREIGN KEY (`SID`) REFERENCES `Shifts` (`SID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `shiftentry_ibfk_2` FOREIGN KEY (`UID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE; ADD CONSTRAINT `shiftentry_ibfk_2` FOREIGN KEY (`UID`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `shiftentry_ibfk_3` FOREIGN KEY (`TID`) REFERENCES `AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- --
-- Constraints der Tabelle `Shifts` -- Constraints der Tabelle `Shifts`
@ -513,9 +561,9 @@ ALTER TABLE `Shifts`
-- Constraints der Tabelle `UserAngelTypes` -- Constraints der Tabelle `UserAngelTypes`
-- --
ALTER TABLE `UserAngelTypes` ALTER TABLE `UserAngelTypes`
ADD CONSTRAINT `userangeltypes_ibfk_3` FOREIGN KEY (`confirm_user_id`) REFERENCES `User` (`UID`) ON DELETE SET NULL ON UPDATE CASCADE,
ADD CONSTRAINT `userangeltypes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `userangeltypes_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `User` (`UID`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `userangeltypes_ibfk_2` FOREIGN KEY (`angeltype_id`) REFERENCES `AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; ADD CONSTRAINT `userangeltypes_ibfk_2` FOREIGN KEY (`angeltype_id`) REFERENCES `AngelTypes` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `userangeltypes_ibfk_3` FOREIGN KEY (`confirm_user_id`) REFERENCES `User` (`UID`) ON DELETE SET NULL ON UPDATE CASCADE;
-- --
-- Constraints der Tabelle `UserGroups` -- Constraints der Tabelle `UserGroups`

View File

@ -33,3 +33,4 @@ ALTER TABLE `AngelTypes` DROP `Man`;
ALTER TABLE `AngelTypes` CHANGE `TID` `id` INT( 11 ) NOT NULL AUTO_INCREMENT; ALTER TABLE `AngelTypes` CHANGE `TID` `id` INT( 11 ) NOT NULL AUTO_INCREMENT;
ALTER TABLE `AngelTypes` CHANGE `Name` `name` VARCHAR( 25 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''; ALTER TABLE `AngelTypes` CHANGE `Name` `name` VARCHAR( 25 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
ALTER TABLE `AngelTypes` ADD `restricted` INT( 1 ) NOT NULL; ALTER TABLE `AngelTypes` ADD `restricted` INT( 1 ) NOT NULL;
ALTER TABLE `AngelTypes` ADD `description` TEXT NOT NULL;

View File

@ -77,6 +77,8 @@ function angeltype_edit_controller() {
$name = ""; $name = "";
$restricted = false; $restricted = false;
$description = "";
if (isset($_REQUEST['angeltype_id'])) { if (isset($_REQUEST['angeltype_id'])) {
$angeltype = AngelType($_REQUEST['angeltype_id']); $angeltype = AngelType($_REQUEST['angeltype_id']);
if ($angeltype === false) if ($angeltype === false)
@ -86,6 +88,7 @@ function angeltype_edit_controller() {
$name = $angeltype['name']; $name = $angeltype['name'];
$restricted = $angeltype['restricted']; $restricted = $angeltype['restricted'];
$description = $angeltype['description'];
} }
if (isset($_REQUEST['submit'])) { if (isset($_REQUEST['submit'])) {
@ -101,16 +104,19 @@ function angeltype_edit_controller() {
$restricted = isset($_REQUEST['restricted']); $restricted = isset($_REQUEST['restricted']);
if (isset($_REQUEST['description']))
$description = strip_request_item_nl('description');
if ($ok) { if ($ok) {
$restricted = $restricted ? 1 : 0; $restricted = $restricted ? 1 : 0;
if (isset($angeltype)) { if (isset($angeltype)) {
$result = AngelType_update($angeltype['id'], $name, $restricted); $result = AngelType_update($angeltype['id'], $name, $restricted, $description);
if ($result === false) if ($result === false)
engelsystem_error("Unable to update angeltype."); engelsystem_error("Unable to update angeltype.");
engelsystem_log("Updated angeltype: " . $name . ", restricted: " . $restricted); engelsystem_log("Updated angeltype: " . $name . ", restricted: " . $restricted);
$angeltype_id = $angeltype['id']; $angeltype_id = $angeltype['id'];
} else { } else {
$angeltype_id = AngelType_create($name, $restricted); $angeltype_id = AngelType_create($name, $restricted, $description);
if ($angeltype_id === false) if ($angeltype_id === false)
engelsystem_error("Unable to create angeltype."); engelsystem_error("Unable to create angeltype.");
engelsystem_log("Created angeltype: " . $name . ", restricted: " . $restricted); engelsystem_log("Created angeltype: " . $name . ", restricted: " . $restricted);
@ -123,7 +129,7 @@ function angeltype_edit_controller() {
return array( return array(
isset($angeltype) ? sprintf(_("Edit %s"), $name) : _("Add new angeltype"), isset($angeltype) ? sprintf(_("Edit %s"), $name) : _("Add new angeltype"),
AngelType_edit_view($name, $restricted) AngelType_edit_view($name, $restricted, $description)
); );
} }

View File

@ -17,12 +17,14 @@ function AngelType_delete($angeltype) {
* @param int $angeltype_id * @param int $angeltype_id
* @param string $name * @param string $name
* @param boolean $restricted * @param boolean $restricted
* @param string $description
*/ */
function AngelType_update($angeltype_id, $name, $restricted) { function AngelType_update($angeltype_id, $name, $restricted, $description) {
return sql_query(" return sql_query("
UPDATE `AngelTypes` SET UPDATE `AngelTypes` SET
`name`='" . sql_escape($name) . "', `name`='" . sql_escape($name) . "',
`restricted`=" . sql_escape($restricted ? 1 : 0) . " `restricted`=" . sql_escape($restricted ? 1 : 0) . ",
`description`='" . sql_escape($description) . "'
WHERE `id`=" . sql_escape($angeltype_id) . " WHERE `id`=" . sql_escape($angeltype_id) . "
LIMIT 1"); LIMIT 1");
} }
@ -32,13 +34,15 @@ function AngelType_update($angeltype_id, $name, $restricted) {
* *
* @param string $name * @param string $name
* @param boolean $restricted * @param boolean $restricted
* @param string $description
* @return New Angeltype id * @return New Angeltype id
*/ */
function AngelType_create($name, $restricted) { function AngelType_create($name, $restricted, $description) {
$result = sql_query(" $result = sql_query("
INSERT INTO `AngelTypes` SET INSERT INTO `AngelTypes` SET
`name`='" . sql_escape($name) . "', `name`='" . sql_escape($name) . "',
`restricted`=" . sql_escape($restricted ? 1 : 0)); `restricted`=" . sql_escape($restricted ? 1 : 0) . "
`description`='" . sql_escape($description) . "'");
if ($result === false) if ($result === false)
return false; return false;
return sql_id(); return sql_id();

View File

@ -10,7 +10,7 @@ function AngelType_delete_view($angeltype) {
)); ));
} }
function AngelType_edit_view($name, $restricted) { function AngelType_edit_view($name, $restricted, $description) {
return page(array( return page(array(
buttons(array( buttons(array(
button(page_link_to('angeltypes'), _("Angeltypes"), 'back') button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
@ -20,6 +20,8 @@ function AngelType_edit_view($name, $restricted) {
form_text('name', _("Name"), $name), form_text('name', _("Name"), $name),
form_checkbox('restricted', _("Restricted"), $restricted), 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_info("", _("Restricted angel types can only be used by an angel if enabled by an archangel (double opt-in).")),
form_textarea('description', _("Description"), $description),
form_info("", _("Please use markdown for the description.")),
form_submit('submit', _("Save")) form_submit('submit', _("Save"))
)) ))
)); ));
@ -48,8 +50,11 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel
buttons($buttons) buttons($buttons)
); );
// $page[] = '<h3>' . _("Info") . '</h3>'; $page[] = '<h3>' . _("Description") . '</h3>';
// Description + Team-Coordinators $parsedown = new Parsedown();
$page[] = $parsedown->parse($angeltype['description']);
// Team-Coordinators list missing
$page[] = '<h3>' . _("Members") . '</h3>'; $page[] = '<h3>' . _("Members") . '</h3>';
$members_confirmed = array(); $members_confirmed = array();

View File

@ -1,10 +1,10 @@
<?php <?php
// path and include settings // path and include settings
$rootpath = str_replace(DIRECTORY_SEPARATOR . 'bootstrap.php', '', __FILE__); $rootpath = __DIR__ . DIRECTORY_SEPARATOR . '..';
define('ROOTPATH', $rootpath); define('ROOTPATH', $rootpath);
$includePath = ini_get('include_path'); $includePath = ini_get('include_path');
$includePath .= PATH_SEPARATOR . ROOTPATH . DIRECTORY_SEPARATOR . '..'; $includePath .= PATH_SEPARATOR . ROOTPATH;
ini_set('include_path', $includePath); ini_set('include_path', $includePath);
?> ?>

View File

@ -58,6 +58,8 @@ require_once ('includes/pages/user_settings.php');
require_once ('includes/pages/user_shifts.php'); require_once ('includes/pages/user_shifts.php');
require_once ('includes/pages/user_wakeup.php'); require_once ('includes/pages/user_wakeup.php');
require_once ('vendor/parsedown-0.9.0/Parsedown.php');
session_start(); session_start();
gettext_init(); gettext_init();