saimod todo show assignees, remove assignees, dehardcoded texts, text updates

This commit is contained in:
Ulf Gebhardt 2015-06-03 12:03:21 +02:00
parent cdd0c8efac
commit a5300cadee
7 changed files with 82 additions and 10 deletions

View File

@ -139,6 +139,7 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
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 (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');

View File

@ -877,6 +877,7 @@
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_http_referer', 'deDE', 'HTTP Referer', 2, 2, '2015-04-18 13:54:18', '2015-04-18 13:54:18');
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_http_referer', 'enUS', 'HTTP Referer', 2, 2, '2015-04-18 13:54:18', '2015-04-18 13:54:18');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_http_referer', 'sai_log');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_http_referer', 'sai_todo');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_http_referer', 'table');
DELETE FROM `system_text` WHERE id = 'table_http_user_agent';
@ -884,6 +885,7 @@
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_http_user_agent', 'deDE', 'HTTP User Agent', 2, 2, '2015-04-18 13:54:48', '2015-04-18 13:54:48');
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_http_user_agent', 'enUS', 'HTTP User Agent', 2, 2, '2015-04-18 13:54:48', '2015-04-18 13:54:48');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_http_user_agent', 'sai_log');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_http_user_agent', 'sai_todo');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_http_user_agent', 'table');
DELETE FROM `system_text` WHERE id = 'table_id';
@ -891,6 +893,7 @@
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_id', 'deDE', 'ID', 2, 2, '2015-04-23 01:54:42', '2015-04-23 01:54:42');
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_id', 'enUS', 'ID', 2, 2, '2015-04-18 13:49:38', '2015-04-18 13:49:38');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_id', 'sai_log');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_id', 'sai_todo');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_id', 'sai_text');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_id', 'table');
@ -942,6 +945,7 @@
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_property', 'deDE', 'Eigenschaft', 2, 2, '2015-04-18 13:56:35', '2015-04-18 13:56:35');
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_property', 'enUS', 'Property', 2, 2, '2015-04-18 13:56:35', '2015-04-18 13:56:35');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_property', 'sai_log');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_property', 'sai_todo');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_property', 'table');
DELETE FROM `system_text` WHERE id = 'table_querytime';
@ -997,6 +1001,7 @@
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_time', 'enUS', 'Time', 2, 2, '2015-04-18 13:52:11', '2015-04-18 13:52:11');
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_time', 'frFR', 'Temps', 3, 3, '2015-04-20 18:58:10', '2015-04-20 18:58:10');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_time', 'sai_log');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_time', 'sai_todo');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_time', 'table');
DELETE FROM `system_text` WHERE id = 'table_time_create';
@ -1045,6 +1050,7 @@
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_value', 'deDE', 'Wert(value)', 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_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', 'sai_todo');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_value', 'table');
DELETE FROM `system_text` WHERE id = 'table_assignee';
@ -1053,6 +1059,20 @@
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');
DELETE FROM `system_text` WHERE id = 'table_assignees';
DELETE FROM `system_text_tag` WHERE id = 'table_assignees';
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_assignees', 'deDE', 'Beauftragte', 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_assignees', 'enUS', 'Assignees', 2, 2, '2015-04-18 13:56:53', '2015-04-18 13:56:53');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_assignees', 'sai_todo');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_assignees', 'table');
DELETE FROM `system_text` WHERE id = 'table_action';
DELETE FROM `system_text_tag` WHERE id = 'table_action';
INSERT INTO `system_text` (`id`, `lang`, `text`, `author`, `author_edit`, `time_create`, `time_edit`) VALUES ('table_action', 'deDE', 'Aktion', 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_action', 'enUS', 'Action', 2, 2, '2015-04-18 13:56:53', '2015-04-18 13:56:53');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_action', 'sai_todo');
INSERT INTO `system_text_tag` (`id`, `tag`) VALUES ('table_action', 'table');
-- Time

View File

@ -52,6 +52,7 @@ function init_saimod_sys_todo_todoopen(){
register_open();
register_assign();
register_deassign();
register_deassign_user();
}
function init_saimod_sys_todo_todoclose(){
$('#btn_edit').click(function(){
@ -67,6 +68,7 @@ function init_saimod_sys_todo_todoclose(){
register_close();
register_assign();
register_deassign();
register_deassign_user();
}
function init_saimod_sys_todo_new(){
@ -139,4 +141,17 @@ function register_deassign(){
}
});
});
}
function register_deassign_user(){
$('.btn_deassign_user').click(function(){
$.ajax({ type : 'GET',
url : './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=deassign&todo='+$(this).attr('todo')+'&user='+$(this).attr('user'),
success : function(data) {
if(data.status){
window.location.reload();
}
}
});
});
}

View File

@ -0,0 +1,18 @@
<?php
namespace SYSTEM\DBD;
class SYS_SAIMOD_TODO_ASSIGNEES extends \SYSTEM\DB\QP {
protected static function query(){
return new \SYSTEM\DB\QQuery(get_class(),
//pg
'TODO',
//mys
' SELECT assign.'.\SYSTEM\DBD\system_todo_assign::FIELD_TODO.' as todo_id,'.
' assignee.'.\SYSTEM\DBD\system_user::FIELD_USERNAME.' as assignee,'.
' assignee.'.\SYSTEM\DBD\system_user::FIELD_ID.' as assignee_id'.
' FROM '.\SYSTEM\DBD\system_todo_assign::NAME_MYS.' as assign'.
' LEFT JOIN '.\SYSTEM\DBD\system_user::NAME_MYS.' as assignee ON assign.'.\SYSTEM\DBD\system_todo_assign::FIELD_USER.'=assignee.'.\SYSTEM\DBD\system_user::FIELD_ID.
' WHERE assign.'.\SYSTEM\DBD\system_todo_assign::FIELD_TODO.' = ?'.
' ORDER BY case when assign.'.\SYSTEM\DBD\system_todo_assign::FIELD_USER.' = ? then 1 else 2 end'.
' LIMIT 10'
);}}

View File

@ -146,10 +146,15 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
public static function sai_mod__SYSTEM_SAI_saimod_sys_todo_action_todo($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('</br>', 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;';
$vars['assignees'] = '';
$res = \SYSTEM\DBD\SYS_SAIMOD_TODO_ASSIGNEES::QQ(array($todo,$userid));
while($row = $res->next()){
$vars['assignees'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_todo/tpl/saimod_sys_todo_todo_user_assignee.tpl'), $row);
}
$vars = array_merge($vars,\SYSTEM\PAGE\text::tag(\SYSTEM\DBD\system_text::TAG_SAI_TODO));
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);}

View File

@ -1,14 +1,23 @@
<h3>ToDo ${ID}</h3>
<table class="table table-hover table-condensed">
<tr><th>Property</th><th>Value</th></tr>
<tr><td>ID</td><td>${ID}</td></tr>
<tr><td>ip</td><td>${ip}</td></tr>
<tr><td>querytime</td><td>${querytime}</td></tr>
<tr><td>time</td><td>${time}</td></tr>
<tr><td>http_referer</td><td>${http_referer}</td></tr>
<tr><td>http_user_agent</td><td>${http_user_agent}</td></tr>
<tr><td>user</td><td>${username}</td></tr>
<tr><td>message</td><td><textarea id="ta_message" style="width: 80%; height: 400px;">${message}</textarea></td></tr>
<tr><th>${table_property}</th><th>${table_value}</th></tr>
<tr><td>${table_id}</td><td>${ID}</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>
<tr><td>${table_http_referer}</td><td>${http_referer}</td></tr>
<tr><td>${table_http_user_agent}</td><td>${http_user_agent}</td></tr>
<tr><td>${table_author}</td><td>${username}</td></tr>
<tr><td>${table_message}</td><td><textarea id="ta_message" style="width: 80%; height: 400px;">${message}</textarea></td></tr>
<tr>
<td>${table_assignees}</td>
<td>
<table>
<tr><th>${table_user}</th><th>${table_action}</th></tr>
${assignees}
</table>
</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_edit" class="btn btn-sm btn-danger" 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>

View File

@ -0,0 +1,4 @@
<tr>
<td>${assignee}</td>
<td><button class="btn_deassign_user btn btn-sm btn-danger" style="margin-right: 15px; height: 32px; font-size: 13px; float: right;" todo="${todo_id}" user="${assignee_id}"><span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span></button></td>
</tr>