saimod todo priority, close time, assigne time

Conflicts:

	sai/modules/saimod_sys_todo/tpl/saimod_sys_todo_todo_user.tpl
This commit is contained in:
Ulf Gebhardt 2015-06-09 03:09:45 +02:00
parent 93c8eb92b4
commit c8a9ffcbf3
14 changed files with 68 additions and 7 deletions

View File

@ -142,6 +142,8 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1007, 42, 3, 1000, 'deassign', 'user', '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');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1015, 42, 2, 1000, 'priority_up', 'todo', 'INT');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1016, 42, 2, 1000, 'priority_down', '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);

View File

@ -21,9 +21,12 @@ CREATE TABLE `system_todo` (
`type` INT(11) NOT NULL DEFAULT '0',
`count` INT(11) NOT NULL DEFAULT '1',
`state` INT(11) NOT NULL DEFAULT '0',
`priority` INT(11) NOT NULL DEFAULT '0',
`time_closed` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE INDEX `file_line_message` (`file`, `line`, `message_hash`)
)
COLLATE='utf8_general_ci'
ENGINE=MyISAM
AUTO_INCREMENT=92;
AUTO_INCREMENT=0
;

View File

@ -1,6 +1,7 @@
CREATE TABLE `system_todo_assign` (
`todo` INT(10) NOT NULL,
`user` INT(10) UNSIGNED NOT NULL,
`time` DATETIME NOT NULL,
PRIMARY KEY (`todo`, `user`)
)
COLLATE='utf8_unicode_ci'

View File

@ -32,4 +32,6 @@ class system_todo {
const FIELD_STATE = 'state';
const FIELD_STATE_OPEN = 0;
const FIELD_STATE_CLOSED = 1;
const FIELD_PRIORITY = 'priority';
const FIELD_TIME_CLOSED = 'time_closed';
}

View File

@ -7,4 +7,5 @@ class system_todo_assign {
const FIELD_TODO = 'todo';
const FIELD_USER = 'user';
const FIELD_TIME = 'time';
}

View File

@ -54,6 +54,7 @@ function init_saimod_sys_todo_todoopen(){
register_assign();
register_deassign();
register_deassign_user();
register_priority();
init_tinymce();
}
function init_saimod_sys_todo_todoclose(){
@ -71,6 +72,7 @@ function init_saimod_sys_todo_todoclose(){
register_assign();
register_deassign();
register_deassign_user();
register_priority();
init_tinymce();
}
@ -89,6 +91,30 @@ function init_saimod_sys_todo_new(){
init_tinymce();
}
function register_priority(){
$('#btn_prio_up').click(function(){
$.ajax({ type : 'GET',
url : './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=priority_up&todo='+$(this).attr('todo'),
success : function(data) {
if(data.status){
alert('success');
}
}
});
});
$('#btn_prio_down').click(function(){
$.ajax({ type : 'GET',
url : './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=priority_down&todo='+$(this).attr('todo'),
success : function(data) {
if(data.status){
alert('success');
}
}
});
});
}
function register_open(){
$('#btn_open').show();
$('#btn_open').click(function(){

View File

@ -7,6 +7,8 @@ class SYS_SAIMOD_TODO_ASSIGN extends \SYSTEM\DB\QP {
//pg
'TODO',
//mys
'INSERT INTO '.\SYSTEM\DBD\system_todo_assign::NAME_MYS.' ('.\SYSTEM\DBD\system_todo_assign::FIELD_TODO.','.\SYSTEM\DBD\system_todo_assign::FIELD_USER.') VALUES(?,?);'
'INSERT INTO '.\SYSTEM\DBD\system_todo_assign::NAME_MYS.
' ('.\SYSTEM\DBD\system_todo_assign::FIELD_TODO.','.\SYSTEM\DBD\system_todo_assign::FIELD_USER.','.\SYSTEM\DBD\system_todo_assign::FIELD_TIME.')'.
' VALUES(?,?, NOW());'
);}}

View File

@ -8,7 +8,7 @@ class SYS_SAIMOD_TODO_CLOSE extends \SYSTEM\DB\QP {
'UPDATE '.\SYSTEM\DBD\system_todo::NAME_PG.' SET '.\SYSTEM\DBD\system_todo::FIELD_STATE.'='.\SYSTEM\DBD\system_todo::FIELD_STATE_CLOSED.
' WHERE "'.\SYSTEM\DBD\system_todo::FIELD_ID.'"= $1;',
//mys
'UPDATE '.\SYSTEM\DBD\system_todo::NAME_MYS.' SET '.\SYSTEM\DBD\system_todo::FIELD_STATE.'='.\SYSTEM\DBD\system_todo::FIELD_STATE_CLOSED.
'UPDATE '.\SYSTEM\DBD\system_todo::NAME_MYS.' SET '.\SYSTEM\DBD\system_todo::FIELD_STATE.'='.\SYSTEM\DBD\system_todo::FIELD_STATE_CLOSED.', '.\SYSTEM\DBD\system_todo::FIELD_TIME_CLOSED.'=NOW()'.
' WHERE '.\SYSTEM\DBD\system_todo::FIELD_ID.'= ?;'
);}}

View File

@ -8,7 +8,7 @@ class SYS_SAIMOD_TODO_CLOSE_ALL extends \SYSTEM\DB\QQ {
'UPDATE '.\SYSTEM\DBD\system_todo::NAME_PG.' SET '.\SYSTEM\DBD\system_todo::FIELD_STATE.'='.\SYSTEM\DBD\system_todo::FIELD_STATE_CLOSED.
' WHERE "'.\SYSTEM\DBD\system_todo::FIELD_TYPE.'"='.\SYSTEM\DBD\system_todo::FIELD_TYPE_EXCEPTION.';',
//mys
'UPDATE '.\SYSTEM\DBD\system_todo::NAME_MYS.' SET '.\SYSTEM\DBD\system_todo::FIELD_STATE.'='.\SYSTEM\DBD\system_todo::FIELD_STATE_CLOSED.
'UPDATE '.\SYSTEM\DBD\system_todo::NAME_MYS.' SET '.\SYSTEM\DBD\system_todo::FIELD_STATE.'='.\SYSTEM\DBD\system_todo::FIELD_STATE_CLOSED.', '.\SYSTEM\DBD\system_todo::FIELD_TIME_CLOSED.'=NOW()'.
' WHERE `'.\SYSTEM\DBD\system_todo::FIELD_TYPE.'`='.\SYSTEM\DBD\system_todo::FIELD_TYPE_EXCEPTION.';'
);}}

View File

@ -9,7 +9,7 @@ class SYS_SAIMOD_TODO_LIST extends \SYSTEM\DB\QP {
//mys
'SELECT * FROM('.
' SELECT todo.'.\SYSTEM\DBD\system_todo::FIELD_ID.' as todo_id,'.
' todo.'.\SYSTEM\DBD\system_todo::FIELD_TYPE.', todo.'.\SYSTEM\DBD\system_todo::FIELD_CLASS.', todo.'.\SYSTEM\DBD\system_todo::FIELD_TIME.', todo.'.\SYSTEM\DBD\system_todo::FIELD_COUNT.', todo.'.\SYSTEM\DBD\system_todo::FIELD_MESSAGE.', todo.'.\SYSTEM\DBD\system_todo::FIELD_REQUEST_URI.', todo.'.\SYSTEM\DBD\system_todo::FIELD_FILE.', todo.'.\SYSTEM\DBD\system_todo::FIELD_LINE.', todo.'.\SYSTEM\DBD\system_todo::FIELD_SERVER_NAME.', todo.'.\SYSTEM\DBD\system_todo::FIELD_SERVER_PORT.', todo.'.\SYSTEM\DBD\system_todo::FIELD_QUERYTIME.', todo.'.\SYSTEM\DBD\system_todo::FIELD_IP.','.
' todo.'.\SYSTEM\DBD\system_todo::FIELD_TYPE.', todo.'.\SYSTEM\DBD\system_todo::FIELD_CLASS.', todo.'.\SYSTEM\DBD\system_todo::FIELD_TIME.', todo.'.\SYSTEM\DBD\system_todo::FIELD_COUNT.', todo.'.\SYSTEM\DBD\system_todo::FIELD_MESSAGE.', todo.'.\SYSTEM\DBD\system_todo::FIELD_REQUEST_URI.', todo.'.\SYSTEM\DBD\system_todo::FIELD_FILE.', todo.'.\SYSTEM\DBD\system_todo::FIELD_LINE.', todo.'.\SYSTEM\DBD\system_todo::FIELD_SERVER_NAME.', todo.'.\SYSTEM\DBD\system_todo::FIELD_SERVER_PORT.', todo.'.\SYSTEM\DBD\system_todo::FIELD_QUERYTIME.', todo.'.\SYSTEM\DBD\system_todo::FIELD_IP.', todo.'.\SYSTEM\DBD\system_todo::FIELD_PRIORITY.','.
' creator.'.\SYSTEM\DBD\system_user::FIELD_ID.' as creator_id,'.
' creator.'.\SYSTEM\DBD\system_user::FIELD_USERNAME.','.
' assignee.'.\SYSTEM\DBD\system_user::FIELD_USERNAME.' as assignee,'.
@ -23,5 +23,5 @@ class SYS_SAIMOD_TODO_LIST extends \SYSTEM\DB\QP {
' LIMIT 100'.
') as a'.
' GROUP BY a.todo_id'.
' ORDER BY a.'.\SYSTEM\DBD\system_todo::FIELD_TYPE.' DESC, a.'.\SYSTEM\DBD\system_todo::FIELD_COUNT.' DESC, a.'.\SYSTEM\DBD\system_todo::FIELD_TIME.' DESC'
' ORDER BY a.'.\SYSTEM\DBD\system_todo::FIELD_PRIORITY.' DESC, a.'.\SYSTEM\DBD\system_todo::FIELD_TYPE.' DESC, a.'.\SYSTEM\DBD\system_todo::FIELD_COUNT.' DESC, a.'.\SYSTEM\DBD\system_todo::FIELD_TIME.' DESC'
);}}

View File

@ -0,0 +1,13 @@
<?php
namespace SYSTEM\DBD;
class SYS_SAIMOD_TODO_PRIORITY extends \SYSTEM\DB\QP {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'todo',
//mys
'UPDATE '.\SYSTEM\DBD\system_todo::NAME_MYS.' SET '.\SYSTEM\DBD\system_todo::FIELD_PRIORITY.' = '.\SYSTEM\DBD\system_todo::FIELD_PRIORITY.' + ?'.
' WHERE '.\SYSTEM\DBD\system_todo::FIELD_ID.'= ?;'
);}}

View File

@ -31,6 +31,12 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_add($todo){
self::exception(new \Exception($todo), false, true);
return \SYSTEM\LOG\JsonResult::ok();}
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_priority_up($todo){
\SYSTEM\DBD\SYS_SAIMOD_TODO_PRIORITY::QI(array(+1,$todo));
return \SYSTEM\LOG\JsonResult::ok();}
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_priority_down($todo){
\SYSTEM\DBD\SYS_SAIMOD_TODO_PRIORITY::QI(array(-1,$todo));
return \SYSTEM\LOG\JsonResult::ok();}
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo(){
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\DBD\system_text::TAG_SAI_TODO);

View File

@ -22,5 +22,7 @@
<tr><td>message</td><td>${message}</td></tr>
</table>
<button id="btn_back" onClick="system.load('todo');" class="btn btn-sm btn-success" style="margin-right: 15px; height: 32px; font-size: 13px; float: left;"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> ${basic_back}</button>
<button id="btn_prio_up" class="btn btn-sm btn-success" style="margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${ID}"><span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span></button>
<button id="btn_prio_down" class="btn btn-sm btn-danger" style="margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${ID}"><span class="glyphicon glyphicon-thumbs-down" aria-hidden="true"></span></button>
<button id="btn_close" class="btn btn-sm btn-danger" style="display: none; margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${ID}"><span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span> ${basic_close}</button>
<button id="btn_open" class="btn btn-sm btn-warning" style="display: none; margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${ID}"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span> ${basic_open}</button>
<button id="btn_open" class="btn btn-sm btn-warning" style="display: none; margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${ID}"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span> ${basic_open}</button>

View File

@ -2,6 +2,7 @@
<table class="table table-hover table-condensed">
<tr><th>${table_property}</th><th>${table_value}</th></tr>
<tr><td>${table_id}</td><td>${ID}</td></tr>
<tr><td>${table_priority}</td><td>${priority}</td></tr>
<tr><td>${table_ip}</td><td>${ip}</td></tr>
<tr><td>${table_querytime}</td><td>${querytime}</td></tr>
<tr><td>${table_time}</td><td>${time}</td></tr>
@ -21,6 +22,8 @@
</table>
<button id="btn_back" onClick="system.load('todo');" class="btn btn-sm btn-success" style="margin-right: 15px; height: 32px; font-size: 13px; float: left;"><span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> ${basic_back}</button>
<button id="btn_edit" class="btn btn-sm btn-warning" style="margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${ID}"><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> ${basic_edit}</button>
<button id="btn_prio_up" class="btn btn-sm btn-success" style="margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${ID}"><span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span></button>
<button id="btn_prio_down" class="btn btn-sm btn-danger" style="margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${ID}"><span class="glyphicon glyphicon-thumbs-down" aria-hidden="true"></span></button>
<button id="btn_close" class="btn btn-sm btn-danger" style="display: none; margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${ID}"><span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span> ${basic_close}</button>
<button id="btn_open" class="btn btn-sm btn-primary" style="display: none; margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${ID}"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span> ${basic_open}</button>
<button id="btn_assign" class="btn btn-sm btn-success" style="${display_assign} margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${ID}"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span> ${basic_assign}</button>