tinymce init bugfix, statistics other part, renames etc

This commit is contained in:
Ulf Gebhardt 2015-06-08 18:09:19 +02:00
parent 4a1a8839cf
commit 3917a19dfc
6 changed files with 109 additions and 19 deletions

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

@ -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>