diff --git a/dbd/sql/mysql/data/sai_api.sql b/dbd/sql/mysql/data/sai_api.sql
index 801a1cb..9889284 100644
--- a/dbd/sql/mysql/data/sai_api.sql
+++ b/dbd/sql/mysql/data/sai_api.sql
@@ -16,8 +16,9 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (30, 42, 2, 3, 'edit', 'id', 'ALL');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (31, 42, 2, 3, 'edit', 'lang', 'LANG');
-INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (32, 42, 2, 3, 'edit', 'newtext', 'ALL');
-INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (33, 42, 2, 3, 'delete', 'id', 'ALL');
+INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (32, 42, 2, 3, 'edit', 'category', 'ALL');
+INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (33, 42, 2, 3, 'edit', 'newtext', 'ALL');
+
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (34, 42, 2, 3, 'editmode', 'entry', 'ALL');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (35, 42, 2, 3, 'add', 'id', 'ALL');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (36, 42, 2, 3, 'add', 'category', 'INT');
@@ -28,6 +29,9 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (43, 42, 2, 3, 'rn', 'cat', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (44, 42, 2, 3, 'rn', 'id', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (45, 42, 2, 3, 'rn', 'newid', 'STRING');
+
+INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (47, 42, 2, 3, 'delete', 'id', 'ALL');
+
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (200, 42, 2, 3, 'tab', 'name', 'STRING');
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (50, 42, 3, 3, 'filter', 'filter', 'STRING');
diff --git a/sai/modules/saimod_sys_locale/entry.tpl b/sai/modules/saimod_sys_locale/entry.tpl
index cc4a4bd..8cc45f6 100644
--- a/sai/modules/saimod_sys_locale/entry.tpl
+++ b/sai/modules/saimod_sys_locale/entry.tpl
@@ -1,4 +1,4 @@
-
+
| ${id} |
${lang} |
\ No newline at end of file
diff --git a/sai/modules/saimod_sys_locale/saimod_sys_locale.js b/sai/modules/saimod_sys_locale/saimod_sys_locale.js
index c7f4375..2e23697 100644
--- a/sai/modules/saimod_sys_locale/saimod_sys_locale.js
+++ b/sai/modules/saimod_sys_locale/saimod_sys_locale.js
@@ -1,7 +1,8 @@
//saving content data
var cData = {group: '',
lang: '',
- id: ''};
+ id: ''};
+
function init__SYSTEM_SAI_saimod_sys_locale() {
if(!cData.lang && !cData.group) {
cData.group = $('.groups').first().attr('id');
@@ -27,12 +28,15 @@ function init__SYSTEM_SAI_saimod_sys_locale() {
saimod_sys_locale_loadcontent(cData.lang, cData.group);
});
$('#changetext').click(function(){
- saimod_sys_locale_savecontent(cData.id, cData.lang, $('#contenttextarea').html());
+ saimod_sys_locale_savecontent(cData.id, cData.lang);
});
}
-function saimod_sys_locale_savecontent(id, lang, newtext){
+function saimod_sys_locale_savecontent(id, lang){
+ tinyMCE.triggerSave();
+ newtext = $('#contenttextarea').val();
+
$.ajax({
url: SAI_ENDPOINT,
data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
@@ -43,27 +47,44 @@ function saimod_sys_locale_savecontent(id, lang, newtext){
newtext: newtext},
type: 'GET',
success: function(data) {
- if (data.status == false){
- alert("Addition could not be applied.");
- } else {
- alert("Addition has been saved.");}
- }
+ if (data.status == false){
+ $('#modal_success').hide();
+ $('#modal_fail').show();
+ } else {
+ $('#modal_fail').hide();
+ $('#modal_success').show();
+ saimod_sys_locale_loadcontent(cData.lang,cData.group);
+ $('#modal').modal('hide');
+ }
+ }
});
-}7
+}
function saimod_sys_locale_loadsinglecontent(id, lang){
- $('#contenttextarea').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=singleload&id='+id+'&lang='+lang, function(){
- $('#modaltitle').html(id);
- cData.id = id;
- tinymce.init({selector:'textarea'});
- $('#modal').modal('show');
+ tinymce.init({selector:'textarea'});
+
+ $.ajax({
+ url: SAI_ENDPOINT,
+ data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale',
+ action: 'singleload',
+ id: id,
+ lang: lang},
+ type: 'GET',
+ success: function(data) {
+ tinyMCE.activeEditor.setContent(data);
+ $('#modal_success').hide();
+ $('#modal_fail').hide();
+ $('#modaltitle').html(id);
+ cData.id = id;
+ $('#modal').modal('show');
+ }
});
}
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(){
- saimod_sys_locale_loadsinglecontent($(this).children().first().html(), cData.lang);
+ saimod_sys_locale_loadsinglecontent($(this).attr('text_id'), cData.lang);
});
});
}
@@ -88,13 +109,6 @@ function saimod_sys_locale_add(){
});
});
});
- //
- //window.location = SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=add&id='+$('#new').attr('value')+'&lang=deDE&newtext='+$('#areacontent').val();
- //window.location = SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale';
- //function(data){
- // if (data.status == false){ alert("false"); } else { alert("true");}
- //});
- // });
}
function saimod_sys_locale_delete(buttonID){
diff --git a/sai/modules/saimod_sys_locale/saimod_sys_locale.php b/sai/modules/saimod_sys_locale/saimod_sys_locale.php
index b7731ad..763ef5c 100644
--- a/sai/modules/saimod_sys_locale/saimod_sys_locale.php
+++ b/sai/modules/saimod_sys_locale/saimod_sys_locale.php
@@ -45,28 +45,28 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
return $entries;
}
- public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_singleload($lang, $id){
+ public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_singleload($id, $lang){
$con = new \SYSTEM\DB\Connection();
$result = "";
- $query = 'SELECT `'.$id.'` FROM `'.\SYSTEM\DBD\system_locale_string::NAME_MYS.'` WHERE id=\''.$lang.'\' ORDER BY category ASC;';
+ $query = 'SELECT `'.$lang.'` FROM `'.\SYSTEM\DBD\system_locale_string::NAME_MYS.'` WHERE id=\''.$id.'\' ORDER BY category ASC;';
new \SYSTEM\LOG\WARNING($query);
$res = $con->query($query);
$entries = '';
$temparr = array();
while($r = $res->next()){
- $entries .= $r[$id];
+ $entries .= $r[$lang];
}
return $entries;
}
- public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_edit($id, $lang, $newtext){
- $charset = 'utf-8';
+ public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_edit($id, $lang, $category, $newtext){
+ //$charset = 'utf-8';
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
$res = null;
if(\SYSTEM\system::isSystemDbInfoPG()){
- $res = $con->prepare('newText' ,'UPDATE '.\SYSTEM\DBD\system_locale_string::NAME_PG.' SET "'.$lang.'"=$1 WHERE id=$2;', array($newtext, $id));
+ $res = $con->prepare('newText' ,'UPDATE '.\SYSTEM\DBD\system_locale_string::NAME_PG.' SET "'.$lang.'"=$1 WHERE category = $1 AND id=$2;', array($newtext, $category, $id));
} else {
- $res = $con->prepare('newText' ,'UPDATE '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' SET '.$lang.'=? WHERE id=?;', array($newtext, $id));
+ $res = $con->prepare('newText' ,'UPDATE '.\SYSTEM\DBD\system_locale_string::NAME_MYS.' SET '.$lang.'=? WHERE category = ? AND id=?;', array($newtext, $category, $id));
}
return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no rows affected")) : \SYSTEM\LOG\JsonResult::ok();
}
diff --git a/sai/modules/saimod_sys_locale/tabs.tpl b/sai/modules/saimod_sys_locale/tabs.tpl
index d9a9793..ef9d090 100644
--- a/sai/modules/saimod_sys_locale/tabs.tpl
+++ b/sai/modules/saimod_sys_locale/tabs.tpl
@@ -16,13 +16,13 @@
${id}
-
+
-