From efe6c102a8ba4777c11b9c07e0c235da7a83291f Mon Sep 17 00:00:00 2001 From: rylon Date: Sun, 29 Sep 2013 20:33:07 +0200 Subject: [PATCH] fixes for editor encoding etc --- .../saimod_sys_locale/saimod_sys_locale.php | 19 +++++++++---------- .../saimod_sys_locale_submit.js | 18 +++++++++++++----- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/sai/modules/saimod_sys_locale/saimod_sys_locale.php b/sai/modules/saimod_sys_locale/saimod_sys_locale.php index 957a1e2..a7f2bdf 100644 --- a/sai/modules/saimod_sys_locale/saimod_sys_locale.php +++ b/sai/modules/saimod_sys_locale/saimod_sys_locale.php @@ -28,10 +28,8 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { } while($r = $res->next()){ $result .= ''.''.$r["id"].'

'.''.''.''.$r["category"].''; - foreach ($languages as $columns){ - //echo "+tututututututut:".$r[$columns]."nochmal tututututututut"; - $result .= ''.utf8_encode($r[$columns]).''; - //$_POST[$r["id"]] = $r[$columns]; + foreach ($languages as $columns){ + $result .= ''.$r[$columns].''; } $result .= ''; @@ -42,14 +40,14 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { return $result; } - public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_edit($id, $lang, $newtext){ + public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_edit($id, $lang, $newtext){ $charset = 'utf-8'; $con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo()); - $res = null; + $res = null; if(\SYSTEM\system::isSystemDbInfoPG()){ $res = $con->prepare('newText' ,'UPDATE system.locale_string SET "'.$lang.'"=$1 WHERE id=$2;', array($newtext, $id)); } else { - $res = $con->prepare('newText' ,'UPDATE system_locale_string SET '.$lang.'=? WHERE id=?;', array(utf8_decode($newtext), $id)); + $res = $con->prepare('newText' ,'UPDATE system_locale_string SET '.$lang.'=? WHERE id=?;', array($newtext, $id)); } return $res->affectedRows() == 0 ? \SYSTEM\LOG\JsonResult::error(new \SYSTEM\LOG\WARNING("no rows affected")) : \SYSTEM\LOG\JsonResult::ok(); } @@ -114,7 +112,7 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { foreach ($languages as $columns){ $result .= '
'. - ''. + ''. '

'; } @@ -122,7 +120,8 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { } $result .= '
'.''; return $result; } 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 4944f5d..c5978ae 100644 --- a/sai/modules/saimod_sys_locale/saimod_sys_locale_submit.js +++ b/sai/modules/saimod_sys_locale/saimod_sys_locale_submit.js @@ -38,10 +38,18 @@ function init__SYSTEM_SAI_saimod_sys_locale_edit(){ loadModuleContent('.SYSTEM.SAI.saimod_sys_locale'); }); $('.edit_content').click(function(){ - tinyMCE.triggerSave(); - $.getJSON(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=edit&id='+$(this).attr('name')+'&lang='+$(this).attr('lang')+'&newtext='+$('#edit_field_'+$(this).attr('name')+'_'+$(this).attr('lang')).val(), - function(data){ - if (data.status == false){ alert("Changes could not be changed."); } else { alert("Changes has been saved.");} - }); + tinyMCE.triggerSave(); + $.ajax({ + url: SAI_ENDPOINT, + data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale', + action: 'edit', + id: $(this).attr('name'), + lang: $(this).attr('lang'), + newtext: $('#edit_field_'+$(this).attr('name')+'_'+$(this).attr('lang')).val()}, + type: 'POST', + success: function(data) { + if (data.status == false){ alert("Changes could not be changed."); } else { alert("Changes has been saved.");} + } + }); }); }