diff --git a/dbd/sql/mysql/data/sai_api.sql b/dbd/sql/mysql/data/sai_api.sql index 17f99fe..7827bed 100644 --- a/dbd/sql/mysql/data/sai_api.sql +++ b/dbd/sql/mysql/data/sai_api.sql @@ -125,7 +125,10 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam -- INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (900, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_cache', 'action', NULL); --- INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1000, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_todo', 'action', NULL); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1000, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_todo', 'action', NULL); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1001, 42, 2, 1000, 'todo', 'todo', 'INT'); +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 (1100, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_docu', 'action', NULL); diff --git a/dbd/sql/mysql/schema/system_todo.sql b/dbd/sql/mysql/schema/system_todo.sql index 8c0a1b9..c4de6db 100644 --- a/dbd/sql/mysql/schema/system_todo.sql +++ b/dbd/sql/mysql/schema/system_todo.sql @@ -18,7 +18,8 @@ CREATE TABLE `system_todo` ( `user` INT(10) UNSIGNED NOT NULL, `thrown` BIT(1) NOT NULL, `type` INT(11) NOT NULL DEFAULT '0', - `count` INT(11) NOT NULL DEFAULT '0', + `count` INT(11) NOT NULL DEFAULT '1', + `state` INT(11) NOT NULL DEFAULT '0', PRIMARY KEY (`ID`) ) COLLATE='utf8_general_ci' diff --git a/dbd/sql/pg/data/sai_api.sql b/dbd/sql/pg/data/sai_api.sql index 4725e70..7eb682e 100644 --- a/dbd/sql/pg/data/sai_api.sql +++ b/dbd/sql/pg/data/sai_api.sql @@ -109,7 +109,17 @@ INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, ve -- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (900, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_cache', 'action', NULL); --- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (1000, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_todo', 'action', NULL); +INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (1000, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_todo', 'action', NULL); --- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (1100, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_docu', 'action', NULL); \ No newline at end of file +-- INSERT INTO system.api ("ID", "group", type, "parentID", "parentValue", name, verify) VALUES (1100, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_docu', 'action', NULL); + +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1200, 42, 0, 0, '_SYSTEM_SAI_saimod_sys_cron', 'action', NULL); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1201, 42, 2, 1200, 'add', 'cls', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1202, 42, 2, 1200, 'add', 'min', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1203, 42, 2, 1200, 'add', 'hour', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1204, 42, 2, 1200, 'add', 'day', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1205, 42, 2, 1200, 'add', 'day_week', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1206, 42, 2, 1200, 'add', 'month', 'INT'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1208, 42, 2, 1200, 'del', 'cls', 'STRING'); +INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1209, 42, 2, 1200, 'deldialog', 'cls', 'STRING'); \ No newline at end of file diff --git a/dbd/sql/pg/schema/system_todo.sql b/dbd/sql/pg/schema/system_todo.sql index fc385af..0bf9c37 100644 --- a/dbd/sql/pg/schema/system_todo.sql +++ b/dbd/sql/pg/schema/system_todo.sql @@ -19,7 +19,8 @@ CREATE TABLE system.todo "user" integer, thrown integer, "type" integer NOT NULL DEFAULT 0, - "count" integer NOT NULL DEFAULT 0, + "count" integer NOT NULL DEFAULT 1, + "state" integer NOT NULL DEFAULT 0, CONSTRAINT system_todo_pk_id PRIMARY KEY ("ID"), CONSTRAINT system_todo_fk_user FOREIGN KEY ("user") REFERENCES system."user" (id) MATCH SIMPLE diff --git a/dbd/tbl/system_todo.php b/dbd/tbl/system_todo.php new file mode 100644 index 0000000..2fea657 --- /dev/null +++ b/dbd/tbl/system_todo.php @@ -0,0 +1,34 @@ +next()){ $row['class_by_type'] = self::trclassbytype($row['type']); $row['time_elapsed'] = self::time_elapsed_string(strtotime($row['time'])); $row['report_type'] = self::reporttype($row['type']); - $row['state_string'] = self::state($row['state']); - $row['state_btn'] = self::statebtn($row['state']); + $row['state_string'] = self::state($row['count']); + $row['state_btn'] = self::statebtn($row['count']); $result .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_list_element.tpl'), $row); } - return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_list.tpl'), array('todo_list_elements' => $result)); - } + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_list.tpl'), array('todo_list_elements' => $result, 'count' => $count)); + } + + public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_dotolist(){ + $result = ''; + $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_by_type'] = self::trclassbytype($row['type']); + $row['time_elapsed'] = self::time_elapsed_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']); + $result .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_list_element.tpl'), $row); + } + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_list.tpl'), array('todo_list_elements' => $result, 'count' => $count)); + } + + public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_stats(){ + $todo = new \SYSTEM\LOG\TODO('Do ToDo Stats'); + return 'Todo: Do ToDo Stats'; + } private static function time_elapsed_string($ptime) { @@ -73,10 +108,40 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule { } } + public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_todo($todo){ + $vars = \SYSTEM\DBD\SYS_SAIMOD_TODO_TODO::QQ(array($todo))->next(); + $vars['trace'] = implode('
', array_slice(explode('#', $vars['trace']), 1, -1)); + return \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 '
  • ToDo
  • ';} public static function right_public(){return false;} public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_flag_css(){} - public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_flag_js(){} + public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_flag_js(){return \SYSTEM\LOG\JsonResult::toString( + array(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/saimod_sys_todo.js')));} + + public static function exception(\Exception $E, $thrown){ + try{ + if(\property_exists(get_class($E), 'todo_logged') && $E->todo_logged){ + return false;} //alrdy logged(this prevents proper thrown value for every system exception) + + \SYSTEM\DBD\SYS_SAIMOD_TODO_EXCEPTION_INSERT::Q1( array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(), + getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5), + $_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST), + array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null, + array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null, + ($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null, $thrown ? 1 : 0), + array( get_class($E), $E->getMessage(), $E->getCode(), $E->getFile(), $E->getLine(), $E->getTraceAsString(), + getenv('REMOTE_ADDR'),round(microtime(true) - \SYSTEM\time::getStartTime(),5),date('Y-m-d H:i:s', microtime(true)), + $_SERVER["SERVER_NAME"],$_SERVER["SERVER_PORT"],$_SERVER['REQUEST_URI'], serialize($_POST), + array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : null, + array_key_exists('HTTP_USER_AGENT',$_SERVER) ? $_SERVER['HTTP_USER_AGENT'] : null, + ($user = \SYSTEM\SECURITY\Security::getUser()) ? $user->id : null,$thrown)); + if(\property_exists(get_class($E), 'logged')){ + $E->todo_logged = true;} //we just did log + } catch (\Exception $E){return false;} //Error -> Ignore + + return false; //We just log and do not handle the error! + } } \ No newline at end of file diff --git a/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo.tpl b/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo.tpl new file mode 100644 index 0000000..64c3c40 --- /dev/null +++ b/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo.tpl @@ -0,0 +1,15 @@ +

    System ToDo

    +
    +
    + +
    +
    +
    +
    \ No newline at end of file diff --git a/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo_todo.tpl b/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo_todo.tpl new file mode 100644 index 0000000..9e842c9 --- /dev/null +++ b/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo_todo.tpl @@ -0,0 +1,26 @@ +

    ToDo ${ID}

    + + + + + + + + + + + + + + + + + + + + + +
    PropertyValue
    ID${ID}
    class${class}
    code${code}
    file${file}
    line${line}
    trace${trace}
    ip${ip}
    querytime${querytime}
    time${time}
    server_name${server_name}
    server_port${server_port}
    request_uri${request_uri}
    url${server_name}:${server_port}${request_uri}
    post${post}
    http_referer${http_referer}
    http_user_agent${http_user_agent}
    user${username}
    thrown${thrown}
    message${message}
    + + + \ 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 b2ff895..99b9453 100644 --- a/sai/modules/saimod_sys_todo/tpl/todo_list.tpl +++ b/sai/modules/saimod_sys_todo/tpl/todo_list.tpl @@ -1,16 +1,17 @@ -

    ToDo

    -
    - + Rows: ${count} +
    - - - - - - - - + + + + + + + + + + ${todo_list_elements}
    Time agoTimeReporttypeMessageAuthorVolunteersStateActiontime agoclassmessagefilelineipurluserquerytimecount
    diff --git a/sai/modules/saimod_sys_todo/tpl/todo_list_element.tpl b/sai/modules/saimod_sys_todo/tpl/todo_list_element.tpl index f02e039..ee9c842 100644 --- a/sai/modules/saimod_sys_todo/tpl/todo_list_element.tpl +++ b/sai/modules/saimod_sys_todo/tpl/todo_list_element.tpl @@ -1,15 +1,12 @@ - - ${time_elapsed} - ${time} - ${report_type} - ${message} - ${username}'. - Assigned pplz'. - ${state_string}'. - - ${state_btn} - '. - '. - - + + ${time_elapsed} + ${class} + ${message} + ${file} + ${line} + ${ip} + ${server_name}:${server_port}${request_uri} + ${username} + ${querytime} + ${count} \ No newline at end of file