diff --git a/sai/modules/saimod_sys_locale/saimod_sys_locale.php b/sai/modules/saimod_sys_locale/saimod_sys_locale.php
index 9d8987a..e6ceb5e 100644
--- a/sai/modules/saimod_sys_locale/saimod_sys_locale.php
+++ b/sai/modules/saimod_sys_locale/saimod_sys_locale.php
@@ -3,23 +3,13 @@ namespace SYSTEM\SAI;
class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
- const INPUT_VAR = 'sai_input';
-
public static function getLanguages(){
return \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_LANGS);
}
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale(){
- $entries = array_merge($_POST,$_GET);
- if(isset($entries[self::INPUT_VAR])){
- return self::html_content_entry_edit($entries[self::INPUT_VAR]);
- }
- return self::html_content_table();
- }
-
- public static function html_content_table(){
$result = '
Locale String
'.
- '
'.
+ '
'.
''.'| '.'ID'.' | '.''.'Category'.' | ';
foreach (self::getLanguages() as $lang){
@@ -62,6 +52,27 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no rows affected")) : \SYSTEM\LOG\JsonResult::ok();
}
+ public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_add($id, $lang, $newtext){
+ $con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
+ $res = null;
+ if(\SYSTEM\system::isSystemDbInfoPG()){
+ throw new \SYSTEM\LOG\ERROR("action_edit failed");
+ } else {
+ $res = $con->prepare('addText' ,'INSERT INTO system_locale_string (id, '.$lang.') VALUES (?, ?);', array($id, $newtext));
+ }
+ return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no data added")) : \SYSTEM\LOG\JsonResult::ok();
+ }
+ public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_addcontent(){
+ $result = "Add new text
";
+ $result .= '
';
+ return $result;
+ }
+
public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_delete($id){
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
$res = null;
@@ -73,7 +84,7 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule {
return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("could not delete the permitted data")) : \SYSTEM\LOG\JsonResult::ok();
}
- public static function html_content_entry_edit($entry){
+ public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_editmode($entry){
$result =
''.$entry.'
'.
''.
diff --git a/sai/modules/saimod_sys_locale/saimod_sys_locale_submit.js b/sai/modules/saimod_sys_locale/saimod_sys_locale_submit.js
index ef2366b..4a05777 100644
--- a/sai/modules/saimod_sys_locale/saimod_sys_locale_submit.js
+++ b/sai/modules/saimod_sys_locale/saimod_sys_locale_submit.js
@@ -11,11 +11,25 @@ function init__SYSTEM_SAI_saimod_sys_locale() {
function(data){
if (data.status == false){ alert("false"); } else { alert("true");}
});
- });
+ });
+ $('.add_content').click(function(){
+ alert(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=add&id='+$(this).attr('id')+'&lang='+$(this).attr('lang')+'&newtext='+$('#edit_field_'+$(this).attr('name')+'_'+$(this).attr('lang')).attr('value'));
+ $.getJSON(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=add&id='+$(this).attr('id')+'&lang='+$(this).attr('lang')+'&newtext='+$('#edit_field_'+$(this).attr('name')+'_'+$(this).attr('lang')).attr('value'),
+ function(data){
+ if (data.status == false){ alert("false"); } else { alert("true");}
+ });
+ });
+ $('.add_form').click(function(){
+ alert(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=addcontent');
+ $('div#content-wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=addcontent',
+ function(data){
+ if (data.status == false){ alert("false"); } else { alert("true");}
+ });
+ });
}
function loadEntry(buttonID) {
- $('div#content-wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&sai_input='+buttonID, function(){
+ $('div#content-wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=editmode&entry='+buttonID, function(){
init__SYSTEM_SAI_saimod_sys_locale_edit();
});
}