Merge branch 'master' of mojotrollz.eu:system

This commit is contained in:
Messerbill 2015-06-08 18:49:46 +02:00
commit 22490ec6ec
9 changed files with 129 additions and 23 deletions

@ -1 +1 @@
Subproject commit 50c248947ca1dbee5f85cc973a022914f4a0d900 Subproject commit e8b11f1d77cc3aa4187162dae17ca95211c2e567

View File

@ -88,6 +88,7 @@ function init_saimod_sys_text_editor(){
}; };
function init_tinymce(){ function init_tinymce(){
tinymce.remove();
tinymce.init({ // General options tinymce.init({ // General options
/* /*
formats : { formats : {

View File

@ -24,6 +24,7 @@ function init_saimod_sys_todo_todo() {
$('#tabs_todo li').each(function(){ $('#tabs_todo li').each(function(){
$(this).removeClass('active');}); $(this).removeClass('active');});
$('#menu_todolist').parent().addClass('active'); $('#menu_todolist').parent().addClass('active');
init_tinymce();
} }
function init_saimod_sys_todo_doto() { function init_saimod_sys_todo_doto() {
@ -41,7 +42,7 @@ function init_saimod_sys_todo_stats() {
function init_saimod_sys_todo_todoopen(){ function init_saimod_sys_todo_todoopen(){
$('#btn_edit').click(function(){ $('#btn_edit').click(function(){
$.ajax({ type : 'GET', $.ajax({ type : 'GET',
url : './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=edit&todo='+$(this).attr('todo')+'&message='+encodeURIComponent($('#ta_message').val()), url : './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=edit&todo='+$(this).attr('todo')+'&message='+encodeURIComponent(tinyMCE.activeEditor.getContent({format : 'raw'})),
success : function(data) { success : function(data) {
if(data.status){ if(data.status){
system.load('todo'); system.load('todo');
@ -53,11 +54,12 @@ function init_saimod_sys_todo_todoopen(){
register_assign(); register_assign();
register_deassign(); register_deassign();
register_deassign_user(); register_deassign_user();
init_tinymce();
} }
function init_saimod_sys_todo_todoclose(){ function init_saimod_sys_todo_todoclose(){
$('#btn_edit').click(function(){ $('#btn_edit').click(function(){
$.ajax({ type : 'GET', $.ajax({ type : 'GET',
url : './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=edit&todo='+$(this).attr('todo')+'&message='+encodeURIComponent($('#ta_message').val()), url : './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=edit&todo='+$(this).attr('todo')+'&message='+encodeURIComponent(tinyMCE.activeEditor.getContent({format : 'raw'})),
success : function(data) { success : function(data) {
if(data.status){ if(data.status){
system.load('todo'); system.load('todo');
@ -69,12 +71,13 @@ function init_saimod_sys_todo_todoclose(){
register_assign(); register_assign();
register_deassign(); register_deassign();
register_deassign_user(); register_deassign_user();
init_tinymce();
} }
function init_saimod_sys_todo_new(){ function init_saimod_sys_todo_new(){
$('#btn_add').click(function(){ $('#btn_add').click(function(){
$.ajax({ type : 'GET', $.ajax({ type : 'GET',
url : './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=add&todo='+encodeURIComponent($('#input_message').val()), url : './sai.php?sai_mod=.SYSTEM.SAI.saimod_sys_todo&action=add&todo='+encodeURIComponent(tinyMCE.activeEditor.getContent({format : 'raw'})),
success : function(data) { success : function(data) {
if(data.status){ if(data.status){
system.load('todo'); system.load('todo');
@ -83,6 +86,7 @@ function init_saimod_sys_todo_new(){
}); });
}) })
$('#input_message').focus(); $('#input_message').focus();
init_tinymce();
} }
function register_open(){ function register_open(){
@ -154,4 +158,83 @@ function register_deassign_user(){
} }
}); });
}); });
} }
function init_tinymce(){
tinymce.remove();
tinymce.init({ // General options
/*
formats : {
italic : {inline : 'span', 'classes' : 'italic'}},
// Theme options
theme_modern_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_modern_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_modern_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_modern_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_modern_toolbar_location : "top",
theme_modern_toolbar_align : "left",
theme_modern_statusbar_location : "bottom",
theme_modern_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "../../page/index.css"*/
// General options
/* mode : "textareas",
plugins : "autolink,lists,pagebreak,layer,table,save,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,template,code",*/
//xhtmlxtras,emotions,advimage,advlink,iespell,inlinepopups,advhr,style,spellchecker,
// Theme options
/*theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,*/
// Skin options
//skin : "o2k7",
//skin_variant : "silver",
width: "99%",
height: "250px",
// Example content CSS (should be your site CSS)
//content_css : "css/example.css",
//content_css : "../../page/index.css"
// Drop lists for link/image/media/template dialogs
/*template_external_list_url : "js/template_list.js",
external_link_list_url : "js/link_list.js",
external_image_list_url : "js/image_list.js",
media_external_list_url : "js/media_list.js",
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}*/
selector: "textarea",
theme: "modern",
//theme : "advanced",
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor"
],
toolbar1: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
toolbar2: "print preview media | forecolor backcolor emoticons",
image_advtab: true,
templates: [
{title: 'Test template 1', content: 'Test 1'},
{title: 'Test template 2', content: 'Test 2'}
],
//remove p tag
forced_root_block : "",
force_br_newlines : true,
force_p_newlines : false
});
}

View File

@ -28,5 +28,21 @@ class SYS_SAIMOD_TODO_EXCEPTION_INSERT extends \SYSTEM\DB\QP {
\SYSTEM\DBD\system_todo::FIELD_HTTP_USER_AGENT.','.\SYSTEM\DBD\system_todo::FIELD_USER.','. \SYSTEM\DBD\system_todo::FIELD_HTTP_USER_AGENT.','.\SYSTEM\DBD\system_todo::FIELD_USER.','.
\SYSTEM\DBD\system_todo::FIELD_THROWN.','.\SYSTEM\DBD\system_todo::FIELD_MESSAGE_HASH.')'. \SYSTEM\DBD\system_todo::FIELD_THROWN.','.\SYSTEM\DBD\system_todo::FIELD_MESSAGE_HASH.')'.
'VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, SHA1(?))'. 'VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, SHA1(?))'.
'ON DUPLICATE KEY UPDATE '.\SYSTEM\DBD\system_todo::FIELD_COUNT.'='.\SYSTEM\DBD\system_todo::FIELD_COUNT.'+1, '.\SYSTEM\DBD\system_todo::FIELD_TIME.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_TIME.'), '.\SYSTEM\DBD\system_todo::FIELD_STATE.'='.\SYSTEM\DBD\system_todo::FIELD_STATE_OPEN.';' 'ON DUPLICATE KEY '.
' UPDATE '. \SYSTEM\DBD\system_todo::FIELD_COUNT.'='.\SYSTEM\DBD\system_todo::FIELD_COUNT.'+1, '.
\SYSTEM\DBD\system_todo::FIELD_TIME.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_TIME.'), '.
\SYSTEM\DBD\system_todo::FIELD_STATE.'='.\SYSTEM\DBD\system_todo::FIELD_STATE_OPEN.', '.
\SYSTEM\DBD\system_todo::FIELD_CODE.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_CODE.'), '.
\SYSTEM\DBD\system_todo::FIELD_TRACE.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_TRACE.'), '.
\SYSTEM\DBD\system_todo::FIELD_IP.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_IP.'), '.
\SYSTEM\DBD\system_todo::FIELD_QUERYTIME.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_QUERYTIME.'), '.
\SYSTEM\DBD\system_todo::FIELD_TIME.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_TIME.'), '.
\SYSTEM\DBD\system_todo::FIELD_SERVER_NAME.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_SERVER_NAME.'), '.
\SYSTEM\DBD\system_todo::FIELD_SERVER_PORT.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_SERVER_PORT.'), '.
\SYSTEM\DBD\system_todo::FIELD_REQUEST_URI.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_REQUEST_URI.'), '.
\SYSTEM\DBD\system_todo::FIELD_POST.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_POST.'), '.
\SYSTEM\DBD\system_todo::FIELD_HTTP_REFERER.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_HTTP_REFERER.'), '.
\SYSTEM\DBD\system_todo::FIELD_HTTP_USER_AGENT.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_HTTP_USER_AGENT.'), '.
\SYSTEM\DBD\system_todo::FIELD_USER.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_USER.'), '.
\SYSTEM\DBD\system_todo::FIELD_THROWN.'=VALUES('.\SYSTEM\DBD\system_todo::FIELD_THROWN.');'
);}} );}}

View File

@ -58,7 +58,7 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
$row['time_elapsed'] = \SYSTEM\time::time_ago_string(strtotime($row['time'])); $row['time_elapsed'] = \SYSTEM\time::time_ago_string(strtotime($row['time']));
$row['state_string'] = self::state($row['count']); $row['state_string'] = self::state($row['count']);
$row['state_btn'] = self::statebtn($row['count']); $row['state_btn'] = self::statebtn($row['count']);
$row['message'] = htmlspecialchars($row['message']); $row['message'] = $row['message'];
$row['request_uri'] = htmlspecialchars($row['request_uri']); $row['request_uri'] = htmlspecialchars($row['request_uri']);
$row['openclose'] = $state == \SYSTEM\DBD\system_todo::FIELD_STATE_OPEN ? 'close' : 'open'; $row['openclose'] = $state == \SYSTEM\DBD\system_todo::FIELD_STATE_OPEN ? 'close' : 'open';
if($row['type'] == \SYSTEM\DBD\system_todo::FIELD_TYPE_USER){ if($row['type'] == \SYSTEM\DBD\system_todo::FIELD_TYPE_USER){
@ -80,15 +80,17 @@ class saimod_sys_todo extends \SYSTEM\SAI\SaiModule {
public static function statistics(){ public static function statistics(){
$result = array(); $result = array();
$result['project'] = 0; $result['project'] = 0;
$result['project_count'] = 0; $result['project_closed'] = 0;
$result['project_open'] = 0;
$result['project_all'] = 0; $result['project_all'] = 0;
$result['data'] = array(); $result['data'] = array();
foreach(self::$stats as $stat){ foreach(self::$stats as $stat){
$data = \call_user_func(array($stat, 'stats')); $data = \call_user_func(array($stat, 'stats'));
$result['data'][] = $data; $result['data'][] = $data;
$result['project'] += $data->perc; $result['project'] += $data->perc;
$result['project_count'] += $data->part; $result['project_open'] += $data->open;
$result['project_all'] += $data->whole; $result['project_closed'] += $data->closed;
$result['project_all'] += $data->all;
} }
$result['project'] = round($result['project'] / (count($result['data'])),2); $result['project'] = round($result['project'] / (count($result['data'])),2);
return $result; return $result;

View File

@ -2,13 +2,15 @@
namespace SYSTEM\SAI; namespace SYSTEM\SAI;
class todo_stats_data { class todo_stats_data {
var $name = ''; var $name = '';
var $part = 0; var $open = 0;
var $whole = 1; var $closed = 0;
var $all = 1;
var $perc = 0; var $perc = 0;
public function __construct($name='',$part=0,$whole=1) { public function __construct($name='',$closed=0,$all=1) {
$this->name = $name; $this->name = $name;
$this->part = $part; $this->open = $all-$closed;
$this->whole = $whole; $this->closed = $closed;
$this->perc = round($this->part / $this->whole * 100,2); $this->all = $all;
$this->perc = round($this->closed / $this->all * 100,2);
} }
} }

View File

@ -1,19 +1,20 @@
<table class="table table-hover table-condensed sai_table" style="width: 100%"> <table class="table table-hover table-condensed sai_table" style="width: 100%">
<tr> <tr>
<th>${table_name}</th> <th>${table_name}</th>
<th>${table_count}</th> <th>${table_open}</th>
<th>${table_closed}</th>
<th>${table_all}</th> <th>${table_all}</th>
<th>${table_done}</th> <th>${table_done}</th>
</tr> </tr>
${entries} ${entries}
<tr> <tr>
<td>${table_project}</td> <td>${table_project}</td>
<td>${project_count}</td> <td>${project_open}</td>
<td>${project_closed}</td>
<td>${project_all}</td> <td>${project_all}</td>
<td>${project}%</td> <td>${project}%</td>
</tr> </tr>
</table> </table>
<table class="table table-hover table-condensed sai_table" style="width: 100%"> <table class="table table-hover table-condensed sai_table" style="width: 100%">
<tr> <tr>
<th>${table_username}</th> <th>${table_username}</th>

View File

@ -1,6 +1,7 @@
<tr> <tr>
<td>${name}</td> <td>${name}</td>
<td>${part}</td> <td>${open}</td>
<td>${whole}</td> <td>${closed}</td>
<td>${all}</td>
<td>${perc}%</td> <td>${perc}%</td>
</tr> </tr>

View File

@ -83,7 +83,7 @@
</div> </div>
<div class="well" id="todo"> <div class="well" id="todo">
<h2 class="muted"><a href="#!todo">${basic_todo}</a></h2> <h2 class="muted"><a href="#!todo">${basic_todo}</a></h2>
<b>${basic_status}:</b> ${project_count}/${project_all}<br/> <b>${basic_status}:</b> ${project_closed}/${project_all}<br/>
<b>${basic_progress}:</b> ${project}% <b>${basic_progress}:</b> ${project}%
<div id="todo_entries"></div> <div id="todo_entries"></div>
</div> </div>