diff --git a/db/connection/ConnectionSQLite.php b/db/connection/ConnectionSQLite.php
index 0f307ab..1cca3a3 100644
--- a/db/connection/ConnectionSQLite.php
+++ b/db/connection/ConnectionSQLite.php
@@ -26,7 +26,7 @@ class ConnectionSQLite extends ConnectionAbstr {
if(!($result = $prepStmt->execute())){
throw new \SYSTEM\LOG\ERROR("Could not execute prepare statement: ". $error);}
- return new ResultSQLite($result,$this);
+ return new ResultSQLite($result,$prepStmt);
}
public function close(){
@@ -39,7 +39,7 @@ class ConnectionSQLite extends ConnectionAbstr {
if($result === TRUE){
return TRUE;}
- return new ResultSQLite($result);
+ return new ResultSQLite($result,null);
}
public function exec($query){
diff --git a/db/qq/QQ.php b/db/qq/QQ.php
index 775623c..ab86314 100644
--- a/db/qq/QQ.php
+++ b/db/qq/QQ.php
@@ -26,7 +26,7 @@ class QQ {
return self::QQ()->next();}
public static function QI(){
$qq = self::QQ();
- return $qq->affectedRows() != (0||null);}
+ return $qq;}
//override this
protected static function query(){
throw new \SYSTEM\LOG\ERROR('query function of your QQ Class not overwritten!');}
diff --git a/db/result/ResultSQLite.php b/db/result/ResultSQLite.php
index 5f514d5..7a7996f 100644
--- a/db/result/ResultSQLite.php
+++ b/db/result/ResultSQLite.php
@@ -17,7 +17,9 @@ class ResultSQLite extends \SYSTEM\DB\Result{
$this->close();}
public function close(){
- $this->stmt->close();}
+ if($this->stmt){
+ $this->stmt->close();}
+ }
public function count(){
throw new Exception("Problem SQLite");
diff --git a/dbd/sql/mysql/data/sai_api.sql b/dbd/sql/mysql/data/sai_api.sql
index 86088dc..7a47202 100644
--- a/dbd/sql/mysql/data/sai_api.sql
+++ b/dbd/sql/mysql/data/sai_api.sql
@@ -131,6 +131,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 (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');
-- 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/sai/modules/saimod_sys_todo/js/saimod_sys_todo.js b/sai/modules/saimod_sys_todo/js/saimod_sys_todo.js
index 099660f..a332198 100644
--- a/sai/modules/saimod_sys_todo/js/saimod_sys_todo.js
+++ b/sai/modules/saimod_sys_todo/js/saimod_sys_todo.js
@@ -21,6 +21,19 @@ function register_new(){
});
}
+function register_edit(){
+ $('#btn_edit').click(function(){
+ $.ajax({ type : 'GET',
+ url : SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=edit&todo='+$(this).attr('todo')+'&message='+$('#ta_message').val(),
+ success : function(data) {
+ if(data.status){
+ load_todo_tab('todolist');
+ }
+ }
+ });
+ });
+}
+
function register_newform(){
$('#btn_add').click(function(){
$.ajax({ type : 'GET',
@@ -45,7 +58,7 @@ function load_todo_tab(action){
return;
case 'dotolist':
$('#tab_todo').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_todo&action='+action, function(){
- register_doto(false);
+ register_doto();
register_listclick();
$('#img_loader').hide();});
return;
@@ -63,6 +76,7 @@ function register_listclick(todo){
$('.sai_todo_element').click(function(){
$('#img_loader').show();
$('#tab_todo').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=todo&todo='+$(this).attr('todo'), function(){
+ register_edit();
$('#btn_back').click(function(){
if(todo){load_todo_tab('todolist');}else{load_todo_tab('dotolist');}});
if(todo){register_close();}else{register_open();}
@@ -100,14 +114,37 @@ function register_close(){
}
function register_todolist(){
+ $('#btn_refresh').unbind('click');
$('#btn_refresh').click(function(){
load_todo_tab('todolist');});
+ $('#btn_close_all').unbind('click');
+ $('#btn_close_all').click(function(){
+ if (confirm('Are you sure you want to delete all open entries in the todolist?')) {
+ $.ajax({ type :'GET',
+ url : SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=close_all',
+ success : function(data) {
+ if(data.status){
+ load_todo_tab('todolist');
+ }else{
+ alert('Problem: '+data);}
+ }
+ });
+ }
+ })
}
function register_doto(){
+ $('#btn_refresh').unbind('click');
$('#btn_refresh').click(function(){
load_todo_tab('dotolist');});
+ $('#btn_close_all').unbind('click');
+ $('#btn_close_all').click(function(){
+ alert('operation not possible on this list');});
}
function register_stats(){
+ $('#btn_refresh').unbind('click');
$('#btn_refresh').click(function(){
load_todo_tab('stats');});
+ $('#btn_close_all').unbind('click');
+ $('#btn_close_all').click(function(){
+ alert('operation not possible on this list');});
}
\ No newline at end of file
diff --git a/sai/modules/saimod_sys_todo/qq/SYS_SAIMOD_TODO_CLOSE_ALL.php b/sai/modules/saimod_sys_todo/qq/SYS_SAIMOD_TODO_CLOSE_ALL.php
new file mode 100644
index 0000000..d827b67
--- /dev/null
+++ b/sai/modules/saimod_sys_todo/qq/SYS_SAIMOD_TODO_CLOSE_ALL.php
@@ -0,0 +1,14 @@
+next()){
- $row['class_by_type'] = self::trclassbytype($row['type']);
+ $row['class_row'] = self::trclass($row['type'],$row['class']);
$row['time_elapsed'] = self::time_elapsed_string(strtotime($row['time']));
- $row['report_type'] = self::reporttype($row['type']);
+ //$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));
+ 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);
+ }}
+ return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_list.tpl'), array('todo_user_list_elements' => $result_user,'todo_list_elements' => $result, 'count' => $count));
}
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_dotolist(){
- $result = '';
+ $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_by_type'] = self::trclassbytype($row['type']);
+ $row['class_row'] = self::trclass($row['type'],$row['class']);
$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);
+ 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);
+ }
}
- 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));
+ return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/todo_list.tpl'), array('todo_user_list_elements' => $result_user,'todo_list_elements' => $result, 'count' => $count));
}
public static function statistics(){
@@ -121,29 +129,38 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
return '';}
return '';}
- private static function reporttype($type){
- switch($type){
- case 0: return 'Feature Request';
- case 1: return 'Error Report';
- case 2: return 'Unasigned Category';
- default: return 'Note';
+ private static function trclass($type,$class){
+ if($type == \SYSTEM\DBD\system_todo::FIELD_TYPE_USER){
+ return 'success';}
+ switch($class){
+ case 'SYSTEM\LOG\INFO': case 'INFO': case 'SYSTEM\LOG\COUNTER':
+ return 'success';
+ case 'SYSTEM\LOG\DEPRECATED': case 'DEPRECATED':
+ return 'info';
+ case 'SYSTEM\LOG\ERROR': case 'ERROR': case 'Exception': case 'SYSTEM\LOG\ERROR_EXCEPTION':
+ case 'ErrorException': case 'SYSTEM\LOG\SHUTDOWN_EXCEPTION':
+ return 'error';
+ case 'SYSTEM\LOG\WARNING': case 'WARNING':
+ return 'warning';
+ default:
+ return '';
}
}
- private static function trclassbytype($type){
- switch($type){
- case 0: return 'info';
- case 1: return 'error';
- case 2: return 'warning';
- case 3: return 'success';
- default: return '';
- }
- }
+ public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_close_all(){
+ \SYSTEM\DBD\SYS_SAIMOD_TODO_CLOSE_ALL::QI();
+ return \SYSTEM\LOG\JsonResult::ok();}
+ public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_edit($todo, $message){
+ \SYSTEM\DBD\SYS_SAIMOD_TODO_EDIT::QI(array($message,$message,$todo));
+ 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::QQ(array($todo))->next();
+ $vars = \SYSTEM\DBD\SYS_SAIMOD_TODO_TODO::Q1(array($todo));
$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);}
+ 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 '
ToDo';}
public static function right_public(){return false;}
diff --git a/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo.tpl b/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo.tpl
index 4c91d2a..f2d4bae 100644
--- a/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo.tpl
+++ b/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo.tpl
@@ -7,6 +7,7 @@
Statistics
+
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
new file mode 100644
index 0000000..44d4286
--- /dev/null
+++ b/sai/modules/saimod_sys_todo/tpl/saimod_sys_todo_todo_user.tpl
@@ -0,0 +1,16 @@
+
ToDo ${ID}
+
+ | Property | Value |
+ | ID | ${ID} |
+ | ip | ${ip} |
+ | querytime | ${querytime} |
+ | time | ${time} |
+ | http_referer | ${http_referer} |
+ | http_user_agent | ${http_user_agent} |
+ | user | ${username} |
+ | 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 99b9453..e2c195d 100644
--- a/sai/modules/saimod_sys_todo/tpl/todo_list.tpl
+++ b/sai/modules/saimod_sys_todo/tpl/todo_list.tpl
@@ -1,5 +1,16 @@
Rows: ${count}
+
User ToDo's
+
+
+ | time ago |
+ message |
+ user |
+
+ ${todo_user_list_elements}
+
+
+
Generated ToDo's
| time ago |
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
new file mode 100644
index 0000000..e37d0b7
--- /dev/null
+++ b/sai/modules/saimod_sys_todo/tpl/todo_user_list_element.tpl
@@ -0,0 +1,5 @@
+
+ | ${time_elapsed} |
+ ${message} |
+ ${username} |
+
\ No newline at end of file