diff --git a/api/api_system.php b/api/api_system.php index 736e2e0..a760030 100644 --- a/api/api_system.php +++ b/api/api_system.php @@ -27,7 +27,10 @@ class api_system extends api_login{ return \SYSTEM\SECURITY\Security::check($rightid);} public static function call_account_action_create($username, $password_sha, $email, $locale){ return \SYSTEM\SECURITY\Security::create($username, $password_sha, $email, $locale);}*/ - + + public static function call_cron(){ + return \SYSTEM\CRON\cron::run();} + public static function call_locale($request,$lang){ return \SYSTEM\LOG\JsonResult::toString(\SYSTEM\locale::getStrings($request, $lang));} @@ -37,5 +40,5 @@ class api_system extends api_login{ public static function static__lang($lang){ \SYSTEM\locale::set($lang);} public static function static__result($result){ - \SYSTEM\CONFIG\config::set(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_RESULT, $result);} + \SYSTEM\CONFIG\config::set(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_DEFAULT_RESULT, $result);} } \ No newline at end of file diff --git a/autoload.inc.php b/autoload.inc.php index c718e94..dc05dbd 100644 --- a/autoload.inc.php +++ b/autoload.inc.php @@ -26,14 +26,12 @@ require_once dirname(__FILE__).'/system/autoload.php'; \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/qq','SYSTEM\DB'); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/security','SYSTEM\SECURITY'); - \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/config','SYSTEM\CONFIG'); - \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/cache','SYSTEM\CACHE'); - \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/sai','SYSTEM\SAI'); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/docu','SYSTEM\DOCU'); \SYSTEM\autoload::registerFolder(dirname(__FILE__).'/files','SYSTEM\FILES'); +\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/cron','SYSTEM\CRON'); require_once dirname(__FILE__).'/lib/autoload.inc.php'; require_once dirname(__FILE__).'/docu/register_sys_docu.php'; diff --git a/cron/cron.php b/cron/cron.php new file mode 100644 index 0000000..9a26f6b --- /dev/null +++ b/cron/cron.php @@ -0,0 +1,41 @@ +next()){ + //check module + if(!self::check($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS])){ + self::status($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS], \SYSTEM\CRON\cronstatus::CRON_STATUS_FAIL_CLASS); + continue;} + //time to execute? + if(!\SYSTEM\CRON\crontime::check_now( time($cron[\SYSTEM\DBD\system_cron::FIELD_LAST_RUN]), + $cron[\SYSTEM\DBD\system_cron::FIELD_MIN], + $cron[\SYSTEM\DBD\system_cron::FIELD_HOUR], + $cron[\SYSTEM\DBD\system_cron::FIELD_DAY], + $cron[\SYSTEM\DBD\system_cron::FIELD_DAY_WEEK], + $cron[\SYSTEM\DBD\system_cron::FIELD_MONTH])){ + continue;} + //Status is ok? + if($cron[\SYSTEM\DBD\system_cron::FIELD_STATUS] != \SYSTEM\CRON\cronstatus::CRON_STATUS_SUCCESFULLY){ + new \SYSTEM\LOG\CRON('Cron for Class '.$cron[\SYSTEM\DBD\system_cron::FIELD_CLASS].' could not execute cuz Status aint good: '. \SYSTEM\CRON\cronstatus::decode($cron[\SYSTEM\DBD\system_cron::FIELD_STATUS])); + continue;} + //set running + self::status($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS], \SYSTEM\CRON\cronstatus::CRON_STATUS_RUNNING); + self::status($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS], call_user_func(array($cron[\SYSTEM\DBD\system_cron::FIELD_CLASS],'run'))); + } + return \SYSTEM\LOG\JsonResult::ok(); + } + + private static function status($class, $status){ + new \SYSTEM\LOG\CRON('Cron Status for Class '.$class.' updated to: '. \SYSTEM\CRON\cronstatus::decode($status)); + return \SYSTEM\DBD\SYS_CRON_UPD::QI(array($status,time(),$class));} +} \ No newline at end of file diff --git a/cron/cronjob.php b/cron/cronjob.php new file mode 100644 index 0000000..b0c58f0 --- /dev/null +++ b/cron/cronjob.php @@ -0,0 +1,7 @@ + $now_month){ $last_year -= 1;} + $last_month = $month;} + if($day){ + if($day > $now_day){ $last_month -= 1;} + $last_day = $day;} + if($hour){ + if($hour > $now_hour){ $last_day -= 1;} + $last_hour = $hour;} + if($min){ + if($min > $now_min){ $last_hour -= 1;} + $last_min = $min;} + if($day_week){ + $day_week = $day_week % 6; // 7 and 0 both mean Sunday + $now_day_week = $now_day_week % 6; // 7 and 0 both mean Sunday + $last_day -= abs($day_week - $now_day_week);} + return mktime($last_hour, $last_min, 0, $last_month, $last_day, $last_year); + } + public static function check($base_time,$last_run,$min,$hour,$day,$day_week,$month){ + return crontime::next($last_run, $min, $hour, $day, $day_week, $month) < $base_time ? true : false;} + public static function next_now($min,$hour,$day,$day_week,$month){ + self::next(time(),$min,$hour,$day,$day_week,$month);} + public static function last_now($min,$hour,$day,$day_week,$month){ + return self::last(time(),$min,$hour,$day,$day_week,$month);} + public static function check_now($last_run,$min,$hour,$day,$day_week,$month){ + return self::check(time(),$last_run,$min,$hour,$day,$day_week,$month);} +} \ No newline at end of file diff --git a/dbd/qq/SYS_CRON_LIST.php b/dbd/qq/SYS_CRON_LIST.php new file mode 100644 index 0000000..9c9f1fc --- /dev/null +++ b/dbd/qq/SYS_CRON_LIST.php @@ -0,0 +1,11 @@ + vll ist es einfach nicht hochgeladen, großkleinschreibeung... + + * E: 23:45:05: mmh + * E: 23:45:07: ich schau mal + * E: 23:45:10: vielleicht mal alles klein schreiben + * E: 23:47:02: mmh nein + * E: 23:47:06: auch das hat nichts gebracht + + - A: 23:52:23: kp + - A: 23:52:29: sonst fällt mir nix ein + + * E: 23:52:50: aber in der Datenbank muss dafür nichts geändert werden oder ? + + - A: 23:52:58: nö + + * E: 23:52:58: die Parameter die ich übergebe sollen ja die selben bleiben + * E: 23:53:01: kk + + - A: 23:53:06: hats n namespace? + + * E: 23:53:09: das ist schon mal gut zu wissen + + - A: 23:53:13: den musst du beim autloaden angeben + + * E: 23:53:20: mmh wie meinst du das ? + + - A: 23:53:27: namespace SYSTEM/LOG + - A: 23:53:41: dann musste beim autoload SYSTEM/LOG mit angeben + + * E: 23:54:20: in der algorithmen klasse selbst nicht nein + + - A: 23:54:31: dann müsste es passen + + * E: 23:54:59: mmh seltsam seltsam + * E: 23:55:06: ich stelle ich wahrscheinlich nur zu blöd an ^^ + + - A: 23:55:16: xD ich hab keinen plan was du da schaffst + - ##### A: 23:55:27: aber prüfe nochmal genau groß und kleinschreibung + + * E: 23:55:30: eigentlich sollte es doch nicht so kompliziert sein + + - ##### A: 23:55:31: KlassenName.php + + * E: 23:55:40: den ordner kopiern umbenennen + * E: 23:55:41: ne is eientlich ziemlich simpel + + - A: 23:56:00: der pfad im autoload haste angepasst?!^^ + + * E: 23:56:23: ja da hab ich noch einen hinzugefügt + + - A: 23:56:36: ajo + - A: 23:56:46: wenn er den ordner net findet schreit er auch + + * E: 23:56:54: genau + * E: 23:56:59: das hab ich ja auch ausprobiert + * E: 23:57:02: durch umbennenn vom ordner + * E: 23:57:07: den findet er also scheints + + - A: 23:57:12: vll ist es beim aufruf falsch geschrieben? + + * E: 23:59:06: /home/mona-srv/da-sense/test2/system/system/autoload.php + * E: 23:59:11: in der datei schmiert das system dann ab + * E: 23:59:30: aber das hilft mir auch nicht so richtig weiter + + - A: 23:59:32: joa mit der message class not found? + + * E: 23:59:37: exakt + + - A: 23:59:41: geb dir mal den klassennamen aus + - A: 23:59:50: und schau obs der gleiche ist + + * E: 00:00:41: public static function autoload($class){ + $classns = self::getClassNamespaceFromClass($class); + + if(!self::autoload_($classns[0],$classns[1]) || (!class_exists($class) && !interface_exists($class))){ + throw new \SYSTEM\LOG\ERROR("Class not found: ".$class);} + + return true; + } + * E: 00:00:48: mmh was davon ist der klassenname ? :D + * E: 00:00:55: classns[0] ? + + - A: 00:00:57: throw new \SYSTEM\LOG\ERROR("Class not found: ".$class);} + - A: 00:01:05: sollte dir den klassennamen schon sagen + + * E: 00:01:17: Class not found: s_algo + + - A: 00:01:22: ajo + + * E: 00:01:23: habs mal auf 1 buchstaben reduziert + + - ##### A: 00:01:26: da haste dein problem + + * E: 00:01:31: um schreibfehler auszuschließen + * E: 00:01:33: mmh ? + + - ##### A: 00:01:38: s_algo + + - ##### A: 00:01:45: so soll die klasse heißen + + - ##### A: 00:01:56: s_algo.php + + * ##### * E: 00:01:58: ja so heißt sie + * E: 00:02:03: und der ornder heißt auch s_algo + + - ##### A: 00:02:11: und die klasse heißt auch s_algo? + + * E: 00:02:41: oh man - ja ich bin echt zu blöd :( + + - A: 00:03:00: das war das erste, zweite und dritte was ich dich gefragt hab + + * E: 00:03:05: zu viele namen :/ + + - ##### A: 00:03:07: ob die klasse wie die datei heißt + + * E: 00:03:12: tut mir leid + + - A: 00:03:15: np + + * E: 00:03:30: ich habe dateinamen als ordnernamen fehl interpretiert + + - A: 00:03:46: kk^^ + + * E: 00:03:50: jetzt gehts - besten Dank. + * E: 00:04:04: bin mit blödheit geschlagen echt + * E: 00:04:53: danke - dann kann ich nämlich jetzt so nach herzenslust modifizieren + * E: 00:04:57: ohne das es was macht + + - A: 00:06:47: super, wenns läuft ;-) \ No newline at end of file diff --git a/log/exceptions/CRON.php b/log/exceptions/CRON.php new file mode 100644 index 0000000..ee48664 --- /dev/null +++ b/log/exceptions/CRON.php @@ -0,0 +1,5 @@ + +
Api Call: ${ID}
+
+ + + + + + + + + + + + + + + + + + + +
IDGroupTypeParentIDParentValueNameVerify
${ID}${group}${type}${parentID}${parentValue}${name}${verify}
+ + + diff --git a/sai/modules/saimod_sys_api/list_entry.tpl b/sai/modules/saimod_sys_api/list_entry.tpl index 895e5ce..b7d9845 100644 --- a/sai/modules/saimod_sys_api/list_entry.tpl +++ b/sai/modules/saimod_sys_api/list_entry.tpl @@ -1,4 +1,4 @@ - + ${ID} ${group} ${type} diff --git a/sai/modules/saimod_sys_api/saimod_sys_api.css b/sai/modules/saimod_sys_api/saimod_sys_api.css new file mode 100644 index 0000000..07df088 --- /dev/null +++ b/sai/modules/saimod_sys_api/saimod_sys_api.css @@ -0,0 +1,64 @@ +p { + font-size: 90%; +} +.tree { + min-height:20px; + padding:19px; + margin-bottom:20px; + background-color:#fbfbfb; + border:1px solid #999; + -webkit-border-radius:4px; + -moz-border-radius:4px; + border-radius:4px; + -webkit-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05); + -moz-box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05); + box-shadow:inset 0 1px 1px rgba(0, 0, 0, 0.05) +} +.tree li { + list-style-type:none; + margin:0; + padding:10px 5px 0 5px; + position:relative +} +.tree li::before, .tree li::after { + content:''; + left:-20px; + position:absolute; + right:auto +} +.tree li::before { + border-left:1px solid #999; + bottom:50px; + height:100%; + top:0; + width:1px +} +.tree li::after { + border-top:1px solid #999; + height:20px; + top:25px; + width:25px +} +.tree li span { + -moz-border-radius:5px; + -webkit-border-radius:5px; + border:1px solid #999; + border-radius:5px; + display:inline-block; + padding:3px 8px; + text-decoration:none +} +.tree li.parent_li>span { + cursor:pointer +} +.tree>ul>li::before, .tree>ul>li::after { + border:0 +} +.tree li:last-child::before { + height:30px +} +.tree li.parent_li>span:hover, .tree li.parent_li>span:hover+ul li span { + background:#eee; + border:1px solid #94a0b4; + color:#000 +} \ No newline at end of file diff --git a/sai/modules/saimod_sys_api/saimod_sys_api.js b/sai/modules/saimod_sys_api/saimod_sys_api.js index 7231266..c80b5a1 100644 --- a/sai/modules/saimod_sys_api/saimod_sys_api.js +++ b/sai/modules/saimod_sys_api/saimod_sys_api.js @@ -1,3 +1,98 @@ -function init__SYSTEM_SAI_saimod_sys_api() { +var currentID = ''; + +function init__SYSTEM_SAI_saimod_sys_api() { + saimod_sys_api_tree(); + saimod_sys_api_register_clickevents(); + +} + +function saimod_sys_api_loadcontent(){ + $('#api_wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_api', function(){ + console.log('api module loaded'); + saimod_sys_api_register_clickevents(); + }); + +} + +function saimod_sys_api_register_clickevents(){ + $('tr.api_entries').click(function() { + console.log("ahsf"); + currentID = $(this).attr("id"); + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: '.SYSTEM.SAI.saimod_sys_api', + action: 'deletedialog', + ID: currentID}, + type: 'GET', + success: function(data) { + console.log("works"); + $('#api_content').html(data); + $('#del_api_close').click(function() { + console.log("olenski"); + $('#del_api_description').hide(); + $('#del_api_del').show(); + saimod_sys_api_loadcontent(); + }); + $('#del_api_del').click(function() { + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: '.SYSTEM.SAI.saimod_sys_api', + action: 'deletecall', + ID: currentID}, + type: 'GET', + success: function(data) { + console.log("api call deleted"); + $('#api_deletedialog').html('

Api call deleted!

'); + $('#del_api_del').hide(); + }});});}});}); + + $('#addcall').click(function() { + var id = $('#new_call_id').val(); + var group = $('#new_call_group').val(); + var type = $('#new_call_type').val(); + var parentid = $('#new_call_parentid').val(); + var parentvalue = $('#new_call_parentvalue').val(); + var name = $('#new_call_name').val(); + var verify = $('#new_call_verify').val(); + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: '.SYSTEM.SAI.saimod_sys_api', + action: 'addcall', + ID: id, + group: group, + type: type, + parentID: parentid, + parentValue : parentvalue, + name: name, + verify: verify}, + type: 'GET', + success: function(data) { + console.log("new api call added"); + saimod_sys_api_loadcontent(); + } + }); + + }); + $('#del_api_close').click(function() { + console.log("olenski"); + $('#del_api_description').hide(); + $('#del_api_del').show(); + saimod_sys_api_loadcontent(); + }); $('#localetab a').click(function (e) {e.preventDefault(); $(this).tab('show');}); +} + +function saimod_sys_api_tree(){ + $('.tree li:has(ul)').addClass('parent_li').find(' > span').attr('title', 'Collapse this branch'); + $('.tree li.parent_li > span').on('click', function (e) { + var children = $(this).parent('li.parent_li').find(' > ul > li'); + if (children.is(":visible")) { + children.hide('fast'); + $(this).attr('title', 'Expand this branch').find(' > i').addClass('icon-plus-sign').removeClass('icon-minus-sign'); + } else { + children.show('fast'); + $(this).attr('title', 'Collapse this branch').find(' > i').addClass('icon-minus-sign').removeClass('icon-plus-sign'); + } + e.stopPropagation(); + }); } \ No newline at end of file diff --git a/sai/modules/saimod_sys_api/saimod_sys_api.php b/sai/modules/saimod_sys_api/saimod_sys_api.php index ed9eaa4..3601d32 100644 --- a/sai/modules/saimod_sys_api/saimod_sys_api.php +++ b/sai/modules/saimod_sys_api/saimod_sys_api.php @@ -50,6 +50,25 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule { return $result;*/ } + public static function sai_mod__system_sai_saimod_sys_api_action_deletedialog($ID){ + $res = \SYSTEM\DBD\SYS_SAIMOD_API_SINGLE_SELECT::Q1(array($ID)); + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/delete_dialog.tpl'), $res); + } + + public static function sai_mod__system_sai_saimod_sys_api_action_addcall($ID,$group,$type,$parentID,$parentValue,$name,$verify){ + if(!\SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){ + throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");} + \SYSTEM\DBD\SYS_SAIMOD_API_ADD::QI(array($ID,$group,$type,$parentID,$parentValue,$name,$verify)); + return \SYSTEM\LOG\JsonResult::ok(); + } + + public static function sai_mod__system_sai_saimod_sys_api_action_deletecall($ID){ + if(!\SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API)){ + throw new \SYSTEM\LOG\ERROR("You dont have edit Rights - Cant proceeed");} + \SYSTEM\DBD\SYS_SAIMOD_API_DEL::QI(array($ID)); + return \SYSTEM\LOG\JsonResult::ok(); + } + private static function type_names($type){ switch($type){ case 0: return 'COMMAND'; @@ -72,9 +91,11 @@ class saimod_sys_api extends \SYSTEM\SAI\SaiModule { public static function html_li_menu(){return '
  • API
  • ';} public static function right_public(){return false;} - public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);} + public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI) && \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI_API);} - public static function sai_mod__SYSTEM_SAI_saimod_sys_api_flag_css(){} + public static function sai_mod__SYSTEM_SAI_saimod_sys_api_flag_css(){ + return \SYSTEM\LOG\JsonResult::toString( + array( \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/saimod_sys_api.css')));} public static function sai_mod__SYSTEM_SAI_saimod_sys_api_flag_js(){ return \SYSTEM\LOG\JsonResult::toString( array( \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_api/saimod_sys_api.js')));} diff --git a/sai/modules/saimod_sys_api/tab.tpl b/sai/modules/saimod_sys_api/tab.tpl index 7b52a39..7e43161 100644 --- a/sai/modules/saimod_sys_api/tab.tpl +++ b/sai/modules/saimod_sys_api/tab.tpl @@ -10,5 +10,5 @@ Verify ${content} - + \ No newline at end of file diff --git a/sai/modules/saimod_sys_api/tabs.tpl b/sai/modules/saimod_sys_api/tabs.tpl index a042195..aa9102c 100644 --- a/sai/modules/saimod_sys_api/tabs.tpl +++ b/sai/modules/saimod_sys_api/tabs.tpl @@ -1,5 +1,7 @@ +

    System API


    +
    \ No newline at end of file +
    + + + + + + + + + + + + + + + + + + + + +
    IDGroupTypeParentIDParentValueNameVerify
    + +
    + diff --git a/sai/modules/saimod_sys_files/saimod_sys_files.js b/sai/modules/saimod_sys_files/saimod_sys_files.js index 264f45b..c2d2548 100644 --- a/sai/modules/saimod_sys_files/saimod_sys_files.js +++ b/sai/modules/saimod_sys_files/saimod_sys_files.js @@ -1,4 +1,5 @@ -function init__SYSTEM_SAI_saimod_sys_files() { +function init__SYSTEM_SAI_saimod_sys_files() { + $('.tooltip').tooltipster(); $('#filestab a').click(function (e) {e.preventDefault(); load_tab($(this).attr('tabname')); $(this).tab('show');}); register_controlls(); } diff --git a/sai/modules/saimod_sys_locale/saimod_sys_locale.js b/sai/modules/saimod_sys_locale/saimod_sys_locale.js index 8e08acb..c5e1736 100644 --- a/sai/modules/saimod_sys_locale/saimod_sys_locale.js +++ b/sai/modules/saimod_sys_locale/saimod_sys_locale.js @@ -1,9 +1,11 @@ //saving content data var cData = {group: '', lang: '', - id: ''}; + id: '', + editmode: false}; function init__SYSTEM_SAI_saimod_sys_locale() { + $('#addtext').show(); if(!cData.lang && !cData.group) { cData.group = $('.groups').first().attr('id'); cData.lang = $('.langli').first().attr('id'); @@ -16,8 +18,14 @@ function init__SYSTEM_SAI_saimod_sys_locale() { $('.content_add').click(function(){ saimod_sys_locale_newtext();}); + $('#edit_close').click(function(){ + $('#addtext').show(); + cData.editmode = false;}); + $('#newtext').click(function(){ - saimod_sys_locale_savenewcontent();}); + $('#addtext').show(); + saimod_sys_locale_savenewcontent(); + cData.editmode = false;}); $('.groups').click(function(){ if (cData.group){ @@ -26,29 +34,40 @@ function init__SYSTEM_SAI_saimod_sys_locale() { cData.group = $(this).attr('id'); saimod_sys_locale_loadcontent(cData.lang, cData.group);} cData.group = $(this).attr('id'); - $(this).addClass('active');}); - + $(this).addClass('active'); + }); + $('#langtabs_').click(function(){ + cData.editmode = true; + }); $('.langli').click(function(){ + console.log(cData.editmode); if (cData.group && cData.lang){ $('#langtabs_ li#'+cData.lang).removeClass('active'); $('#'+cData.lang).removeClass('active');} cData.lang = $(this).attr('id'); $('#langtabs_ li#'+cData.lang).addClass('active'); $('#'+cData.lang).addClass('active'); - saimod_sys_locale_loadcontent(cData.lang, cData.group);}); + saimod_sys_locale_loadcontent(cData.lang, cData.group); + if (cData.editmode === true){ + saimod_sys_locale_loadsinglecontent(cData.id, cData.lang); + cData.editmode = false; + }}); $('#changetext').click(function(){ saimod_sys_locale_savecontent(cData.id, cData.lang);}); $('#del_text').click(function(){ saimod_sys_locale_delete($('#modaltitle').html());}); - + $(document).keyup(function(e) { + if (e.keyCode === 27) { $('#addtext').show(); } // esc + }); } function saimod_sys_locale_newtext(){ $('#modaltitle').hide(); $('#modaltextarea').hide(); $('#del_text').hide(); + $('#addtext').hide(); $.ajax({ url: SAI_ENDPOINT, data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale', @@ -117,7 +136,7 @@ function saimod_sys_locale_loadsinglecontent(id, lang){ $('#modaltextarea').show(); $('#changetext').show(); $('#del_text').show(); - tinymce.init({selector:'textarea'}); + init_tinymce(); $.ajax({ url: SAI_ENDPOINT, @@ -141,6 +160,7 @@ function saimod_sys_locale_loadsinglecontent(id, lang){ function saimod_sys_locale_loadcontent(id, group){ $('#tab-content').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=load&id='+id+'&group='+group, function(){ $('.tableentry').click(function(){ + cData.editmode = true; saimod_sys_locale_loadsinglecontent($(this).attr('text_id'), cData.lang); }); }); @@ -155,3 +175,27 @@ function saimod_sys_locale_delete(buttonID){ saimod_sys_locale_loadcontent(cData.lang,cData.group); $('#modal').modal('hide'); } + +function init_tinymce(){ + tinymce.init({ // General options + mode : "textareas", + theme : "modern", + plugins : "anchor,bbcode,charmap,code,contextmenu,directionality,link,textcolor,table,hr,fullscreen,autolink,lists,spellchecker,pagebreak,layer,table,save,emoticons,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,template", + + // 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, + + width: "100%", + height: "250px", + + // Example content CSS (should be your site CSS) + content_css : "../../page/index.css" +}); +} diff --git a/sai/modules/saimod_sys_locale/tabs.tpl b/sai/modules/saimod_sys_locale/tabs.tpl index 32cd24e..1d787fd 100644 --- a/sai/modules/saimod_sys_locale/tabs.tpl +++ b/sai/modules/saimod_sys_locale/tabs.tpl @@ -10,13 +10,14 @@
    -