diff --git a/dbd/sql/mysql/data/system_sai_api.sql b/dbd/sql/mysql/data/system_sai_api.sql index 5c5999e..b6f5096 100644 --- a/dbd/sql/mysql/data/system_sai_api.sql +++ b/dbd/sql/mysql/data/system_sai_api.sql @@ -137,6 +137,8 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1002, 42, 2, 1000, 'open', 'todo', 'INT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1003, 42, 2, 1000, 'close', 'todo', 'INT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1004, 42, 2, 1000, 'add', 'todo', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1005, 42, 2, 1000, 'assign', 'todo', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1006, 42, 2, 1000, 'deassign', 'todo', 'INT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1010, 42, 2, 1000, 'edit', 'todo', 'INT'); INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1011, 42, 2, 1000, 'edit', 'message', 'STRING'); diff --git a/dbd/sql/mysql/data/system_text.sql b/dbd/sql/mysql/data/system_text.sql index 01317bc..f3b21b1 100644 --- a/dbd/sql/mysql/data/system_text.sql +++ b/dbd/sql/mysql/data/system_text.sql @@ -520,6 +520,20 @@ INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('basic_open', 'enUS', 'Open', 2, 1, '2015-04-16 23:11:18', '2015-04-16 23:11:18'); INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_open', 'basic'); INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_open', 'sai_todo'); + + DELETE FROM `system_text` WHERE id = 'basic_assign'; + DELETE FROM `system_text_tag` WHERE id = 'basic_assign'; + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('basic_assign', 'deDE', 'Mach ich', 1, 1, '2015-04-16 23:11:18', '2015-04-16 16:48:36'); + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('basic_assign', 'enUS', 'I Do it', 2, 1, '2015-04-16 23:11:18', '2015-04-16 23:11:18'); + INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_assign', 'basic'); + INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_assign', 'sai_todo'); + + DELETE FROM `system_text` WHERE id = 'basic_deassign'; + DELETE FROM `system_text_tag` WHERE id = 'basic_deassign'; + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('basic_deassign', 'deDE', 'Mach ich nicht', 1, 1, '2015-04-16 23:11:18', '2015-04-16 16:48:36'); + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('basic_deassign', 'enUS', 'I don\'t Do that', 2, 1, '2015-04-16 23:11:18', '2015-04-16 23:11:18'); + INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_deassign', 'basic'); + INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('basic_deassign', 'sai_todo'); -- SAI DELETE FROM `system_text` WHERE id = 'sai_api_title'; @@ -545,8 +559,8 @@ DELETE FROM `system_text` WHERE id = 'sai_copyright'; DELETE FROM `system_text_tag` WHERE id = 'sai_copyright'; - INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_copyright', 'deDE', 'MYPROJECTNAME © WebCraft Media 2015', 2, 2, '2015-04-17 19:15:03', '2015-04-17 19:15:03'); - INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_copyright', 'enUS', 'MYPROJECTNAME © WebCraft Media 2015', 2, 2, '2015-04-17 19:15:03', '2015-04-17 19:15:03'); + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_copyright', 'deDE', '${project} © WebCraft Media 2015', 2, 2, '2015-04-17 19:15:03', '2015-04-17 19:15:03'); + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_copyright', 'enUS', '${project} © WebCraft Media 2015', 2, 2, '2015-04-17 19:15:03', '2015-04-17 19:15:03'); INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('sai_copyright', 'sai'); INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('sai_copyright', 'sai_default'); @@ -792,10 +806,10 @@ DELETE FROM `system_text` WHERE id = 'sai_title'; DELETE FROM `system_text_tag` WHERE id = 'sai_title'; - INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_title', 'deDE', 'Admin Bereich', 1, 1, '2015-04-19 21:10:58', '2015-04-19 21:10:58'); - INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_title', 'enUS', 'Admin area', 2, 1, '2015-04-19 21:09:54', '2015-04-19 21:09:54'); - INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_title', 'frFR', 'Domaine d\'administration', 3, 3, '2015-04-20 19:12:40', '2015-04-20 19:12:40'); - INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_title', 'jaJA', 'アドミンーエリア', 1, 1, '2015-04-19 21:09:28', '2015-04-19 21:09:28'); + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_title', 'deDE', '${project} - Admin Bereich', 1, 1, '2015-04-19 21:10:58', '2015-04-19 21:10:58'); + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_title', 'enUS', '${project} - Admin area', 2, 1, '2015-04-19 21:09:54', '2015-04-19 21:09:54'); + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_title', 'frFR', '${project} - Domaine d\'administration', 3, 3, '2015-04-20 19:12:40', '2015-04-20 19:12:40'); + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('sai_title', 'jaJA', '${project} - アドミンーエリア', 1, 1, '2015-04-19 21:09:28', '2015-04-19 21:09:28'); INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('sai_title', 'sai'); INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('sai_title', 'sai_default'); @@ -814,6 +828,7 @@ INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_author', 'enUS', 'Author', 2, 2, '2015-04-18 13:36:35', '2015-04-18 13:36:35'); INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_author', 'frFR', 'Auteur', 3, 3, '2015-04-20 18:59:40', '2015-04-20 18:59:40'); INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_author', 'sai_text'); + INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_author', 'sai_todo'); INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_author', 'table'); DELETE FROM `system_text` WHERE id = 'table_author_edit'; @@ -1031,6 +1046,13 @@ INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_value', 'enUS', 'Value', 2, 2, '2015-04-18 13:56:53', '2015-04-18 13:56:53'); INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_value', 'sai_log'); INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_value', 'table'); + + DELETE FROM `system_text` WHERE id = 'table_assignee'; + DELETE FROM `system_text_tag` WHERE id = 'table_assignee'; + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_assignee', 'deDE', 'Beauftragter', 2, 2, '2015-04-23 01:58:25', '2015-04-23 01:58:25'); + INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_assignee', 'enUS', 'Assignee', 2, 2, '2015-04-18 13:56:53', '2015-04-18 13:56:53'); + INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_assignee', 'sai_todo'); + INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_assignee', 'table'); -- Time diff --git a/dbd/sql/mysql/schema/system_todo_asign.sql b/dbd/sql/mysql/schema/system_todo_assign.sql similarity index 78% rename from dbd/sql/mysql/schema/system_todo_asign.sql rename to dbd/sql/mysql/schema/system_todo_assign.sql index 2e8d047..da87016 100644 --- a/dbd/sql/mysql/schema/system_todo_asign.sql +++ b/dbd/sql/mysql/schema/system_todo_assign.sql @@ -1,4 +1,4 @@ -CREATE TABLE `system_todo_asign` ( +CREATE TABLE `system_todo_assign` ( `todo` INT(10) NOT NULL, `user` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`todo`, `user`) diff --git a/dbd/tbl/system_todo_asign.php b/dbd/tbl/system_todo_asign.php deleted file mode 100644 index 0b1c747..0000000 --- a/dbd/tbl/system_todo_asign.php +++ /dev/null @@ -1,10 +0,0 @@ -id)); + return \SYSTEM\LOG\JsonResult::ok();} + public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_deassign($todo){ + \SYSTEM\DBD\SYS_SAIMOD_TODO_DEASSIGN::QI(array($todo,\SYSTEM\SECURITY\Security::getUser()->id)); + return \SYSTEM\LOG\JsonResult::ok();} public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_close($todo){ \SYSTEM\DBD\SYS_SAIMOD_TODO_CLOSE::QI(array($todo)); return \SYSTEM\LOG\JsonResult::ok();} @@ -38,19 +44,23 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule { } public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_todolist(){ + return self::generate_list(\SYSTEM\DBD\system_todo::FIELD_STATE_OPEN);} + + public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_dotolist(){ + return self::generate_list(\SYSTEM\DBD\system_todo::FIELD_STATE_CLOSED);} + + private static function generate_list($state){ $result = $result_user = ''; $userid = \SYSTEM\SECURITY\Security::getUser()->id; - $res = \SYSTEM\DBD\SYS_SAIMOD_TODO_LIST::QQ(array(\SYSTEM\DBD\system_todo::FIELD_STATE_OPEN,$userid)); - $count = \SYSTEM\DBD\SYS_SAIMOD_TODO_TODO_COUNT::Q1()['count']; + $res = \SYSTEM\DBD\SYS_SAIMOD_TODO_LIST::QQ(array($state,$userid)); while($row = $res->next()){ - $row['class_row'] = self::trclass($row['type'],$row['class'],$row['asignee_id'],$userid); + $row['class_row'] = self::trclass($row['type'],$row['class'],$row['assignee_id'],$userid); $row['time_elapsed'] = \SYSTEM\time::time_ago_string(strtotime($row['time'])); - //$row['report_type'] = self::reporttype($row['type']); $row['state_string'] = self::state($row['count']); $row['state_btn'] = self::statebtn($row['count']); $row['message'] = htmlspecialchars($row['message']); $row['request_uri'] = htmlspecialchars($row['request_uri']); - $row['openclose'] = 'close'; + $row['openclose'] = $state == \SYSTEM\DBD\system_todo::FIELD_STATE_OPEN ? 'close' : 'open'; if($row['type'] == \SYSTEM\DBD\system_todo::FIELD_TYPE_USER){ $row['message'] = str_replace("\n", '
', $row['message']); $result_user .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_user_list_element.tpl'), $row); @@ -58,33 +68,7 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule { $result .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_list_element.tpl'), $row); } } - $vars = array(); - $vars['todo_user_list_elements'] = $result_user; - $vars['todo_list_elements'] = $result; - $vars['count'] = $count; - $vars = array_merge($vars, \SYSTEM\PAGE\text::tag(\SYSTEM\DBD\system_text::TAG_SAI_TODO)); - return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_list.tpl'), $vars); - } - - public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_dotolist(){ - $result = $result_user = ''; - $res = \SYSTEM\DBD\SYS_SAIMOD_TODO_DOTO_LIST::QQ(); - $count = \SYSTEM\DBD\SYS_SAIMOD_TODO_DOTO_COUNT::Q1()['count']; - while($row = $res->next()){ - $row['class_row'] = self::trclass($row['type'],$row['class']); - $row['time_elapsed'] = \SYSTEM\time::time_ago_string(strtotime($row['time'])); - $row['state_string'] = self::state($row['count']); - $row['state_btn'] = self::statebtn($row['count']); - $row['message'] = htmlspecialchars($row['message']); - $row['request_uri'] = htmlspecialchars($row['request_uri']); - $row['openclose'] = 'open'; - if($row['type'] == \SYSTEM\DBD\system_todo::FIELD_TYPE_USER){ - $row['message'] = str_replace("\r", '
', $row['message']); - $result_user .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_user_list_element.tpl'), $row); - } else { - $result .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_list_element.tpl'), $row); - } - } + $count = \SYSTEM\DBD\SYS_SAIMOD_TODO_COUNT::Q1(array($state))['count']; $vars = array(); $vars['todo_user_list_elements'] = $result_user; $vars['todo_list_elements'] = $result; @@ -130,10 +114,10 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule { return '';} return '';} - private static function trclass($type,$class,$asignee,$userid){ + private static function trclass($type,$class,$assignee,$userid){ if($type == \SYSTEM\DBD\system_todo::FIELD_TYPE_USER){ - if($asignee == $userid){ return 'danger';} - if($asignee){ return 'warning';} + if($assignee == $userid){ return 'danger';} + if($assignee){ return 'warning';} return 'success'; } switch($class){ @@ -143,7 +127,7 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule { return 'info'; case 'SYSTEM\LOG\ERROR': case 'ERROR': case 'Exception': case 'SYSTEM\LOG\ERROR_EXCEPTION': case 'ErrorException': case 'SYSTEM\LOG\SHUTDOWN_EXCEPTION': - return 'error'; + return 'danger'; case 'SYSTEM\LOG\WARNING': case 'WARNING': return 'warning'; default: @@ -160,14 +144,16 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule { return \SYSTEM\LOG\JsonResult::ok();} public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_todo($todo){ - $vars = \SYSTEM\DBD\SYS_SAIMOD_TODO_TODO::Q1(array($todo)); + $userid = \SYSTEM\SECURITY\Security::getUser()->id; + $vars = \SYSTEM\DBD\SYS_SAIMOD_TODO_TODO::Q1(array($todo,$userid)); $vars = array_merge($vars,\SYSTEM\PAGE\text::tag(\SYSTEM\DBD\system_text::TAG_SAI_TODO)); $vars['trace'] = implode('
', array_slice(explode('#', $vars['trace']), 1, -1)); + $vars['display_assign'] = $vars['assignee_id'] != $userid ? '' : 'display: none;'; + $vars['display_deassign'] = $vars['assignee_id'] == $userid ? '' : 'display: none;'; return $vars[\SYSTEM\DBD\system_todo::FIELD_TYPE] == \SYSTEM\DBD\system_todo::FIELD_TYPE_USER ? \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/saimod_sys_todo_todo_user.tpl'), $vars) : \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/saimod_sys_todo_todo.tpl'), $vars);} - //public static function html_li_menu(){return '
  • ${sai_menu_todo}
  • ';} public static function html_li_menu(){return '
  • ';} public static function right_public(){return false;} public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} diff --git a/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo_todo_user.tpl b/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo_todo_user.tpl index b9389e3..ae65005 100644 --- a/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo_todo_user.tpl +++ b/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo_todo_user.tpl @@ -13,4 +13,6 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/sai/modules/saimod_sys_todo/tpl/todo_list.tpl b/sai/modules/saimod_sys_todo/tpl/todo_list.tpl index f9c2e2d..c368fbd 100644 --- a/sai/modules/saimod_sys_todo/tpl/todo_list.tpl +++ b/sai/modules/saimod_sys_todo/tpl/todo_list.tpl @@ -6,7 +6,7 @@ ${time_ago} ${table_message} ${table_author} - ${table_asignee} + ${table_assignee} ${todo_user_list_elements} diff --git a/sai/modules/saimod_sys_todo/tpl/todo_user_list_element.tpl b/sai/modules/saimod_sys_todo/tpl/todo_user_list_element.tpl index 7c31181..f7b59fd 100644 --- a/sai/modules/saimod_sys_todo/tpl/todo_user_list_element.tpl +++ b/sai/modules/saimod_sys_todo/tpl/todo_user_list_element.tpl @@ -2,5 +2,5 @@ ${time_elapsed} ${message} ${username} - ${asignee} + ${assignee} \ No newline at end of file diff --git a/sai/page/default_page.php b/sai/page/default_page.php index e924801..86bd1f6 100644 --- a/sai/page/default_page.php +++ b/sai/page/default_page.php @@ -59,7 +59,9 @@ class default_page extends \SYSTEM\PAGE\Page { $vars['menu_start'] = self::menu_start(); $vars['menu_sys'] = self::menu_sys(); $vars['menu_proj'] = self::menu_proj(); - $vars = array_merge($vars,\SYSTEM\PAGE\text::tag(\SYSTEM\DBD\system_text::TAG_SAI_DEFAULT)); + $vars = array_merge($vars,\SYSTEM\PAGE\text::tag(\SYSTEM\DBD\system_text::TAG_SAI_DEFAULT), + array( 'project' => \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_PROJECT), + 'project_url' => \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEURL))); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'page/tpl/sai.tpl'), $vars); } } \ No newline at end of file