diff --git a/dbd/tbl/locale_string.php b/dbd/tbl/locale_string.php index 13425d8..dcab86c 100644 --- a/dbd/tbl/locale_string.php +++ b/dbd/tbl/locale_string.php @@ -16,7 +16,8 @@ class locale_string { const VALUE_CATEGORY_SYSTEM = 10; const VALUE_CATEGORY_SYSTEM_ERROR = 11; - const VALUE_CATEGORY_SYSTEM_SAI = 12; + const VALUE_CATEGORY_SYSTEM_SAI = 42; + const VALUE_CATEGORY_SYSTEM_SAI_ERROR = 43; const VALUE_CATEGORY_SYSTEM_ENDCAT = 99; } \ No newline at end of file diff --git a/sai/modules/saimod_sys_locale/1.jpg b/sai/modules/saimod_sys_locale/1.jpg deleted file mode 100644 index 2ce29f6..0000000 Binary files a/sai/modules/saimod_sys_locale/1.jpg and /dev/null differ diff --git a/sai/modules/saimod_sys_locale/add.tpl b/sai/modules/saimod_sys_locale/add.tpl new file mode 100644 index 0000000..4ad9c5a --- /dev/null +++ b/sai/modules/saimod_sys_locale/add.tpl @@ -0,0 +1,15 @@ +

Add new text

+
+ + + + + + + + + +
ID:
Category:
+
+ + \ No newline at end of file diff --git a/sai/modules/saimod_sys_locale/edit.tpl b/sai/modules/saimod_sys_locale/edit.tpl new file mode 100644 index 0000000..e4902b8 --- /dev/null +++ b/sai/modules/saimod_sys_locale/edit.tpl @@ -0,0 +1,20 @@ +

${entry}

+ + ${langhead} + ${content} +
+
+ + \ No newline at end of file diff --git a/sai/modules/saimod_sys_locale/edit_entry.tpl b/sai/modules/saimod_sys_locale/edit_entry.tpl new file mode 100644 index 0000000..7c30302 --- /dev/null +++ b/sai/modules/saimod_sys_locale/edit_entry.tpl @@ -0,0 +1,7 @@ + +
+ +
+ +
+ \ No newline at end of file diff --git a/sai/modules/saimod_sys_locale/list.tpl b/sai/modules/saimod_sys_locale/list.tpl new file mode 100644 index 0000000..8d8be8b --- /dev/null +++ b/sai/modules/saimod_sys_locale/list.tpl @@ -0,0 +1,8 @@ +

Locale String

+
+ + + ${langhead} + +${content} +
IDCategory
\ No newline at end of file diff --git a/sai/modules/saimod_sys_locale/list_entry.tpl b/sai/modules/saimod_sys_locale/list_entry.tpl new file mode 100644 index 0000000..e1d14c3 --- /dev/null +++ b/sai/modules/saimod_sys_locale/list_entry.tpl @@ -0,0 +1,9 @@ + + + ${id}

+ + + +${category} +${content} + \ 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 new file mode 100644 index 0000000..affb1e2 --- /dev/null +++ b/sai/modules/saimod_sys_locale/saimod_sys_locale.js @@ -0,0 +1,64 @@ +function init__SYSTEM_SAI_saimod_sys_locale() { + $('.content_edit').click(function () {saimod_sys_locale_edit($(this).attr('name'));}); + $('.content_delete').click(function(){saimod_sys_locale_delete($(this).attr('name'));}); + $('.content_add').click(function(){saimod_sys_locale_add();}); +} +function saimod_sys_locale_add(){ + $('div#content-wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=addmode',function(){ + $('.localeMain').click(function(){ + loadModuleContent('.SYSTEM.SAI.saimod_sys_locale'); + }); + $('.add').click(function(){ + $.ajax({ url: SAI_ENDPOINT, + data: { sai_mod: '.SYSTEM.SAI.saimod_sys_locale', + action: 'add', + id: $('#content_new_id').val(), + category: $('#content_new_cat').val()}, + type: 'GET', + success: function(data) { + if (data.status == false){ + alert("Addition could not be applied."); + } else { + alert("Addition has been saved.");} + } + }); + }); + }); + // + //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){ + $.getJSON(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=delete&id='+buttonID, + function(data){if (data.status == false){ alert("false"); } else { alert("true");}}); +} + +function saimod_sys_locale_edit(buttonID){ + $('div#content-wrapper').load(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=editmode&entry='+buttonID, function(){ + $('.localeMain').click(function(){ + loadModuleContent('.SYSTEM.SAI.saimod_sys_locale'); + }); + $('.edit_content').click(function(){ + 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 applied."); + } else { + alert("Changes has been saved.");} + } + }); + }); + }); +} diff --git a/sai/modules/saimod_sys_locale/saimod_sys_locale.php b/sai/modules/saimod_sys_locale/saimod_sys_locale.php index a7f2bdf..5ea0efa 100644 --- a/sai/modules/saimod_sys_locale/saimod_sys_locale.php +++ b/sai/modules/saimod_sys_locale/saimod_sys_locale.php @@ -8,36 +8,31 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { } public static function sai_mod__SYSTEM_SAI_saimod_sys_locale(){ - $result = '

Locale String

'. - // - '
'. - ''.''.''; - - foreach (self::getLanguages() as $lang){ - $result .= ''; - $languages[] = $lang; - } - - $result .= ''; - + $vars = array(); + + $vars['langhead'] = ''; + foreach (self::getLanguages() as $lang){ + $vars['langhead'] .= ''; + $languages[] = $lang; + } + $con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo()); if(\SYSTEM\system::isSystemDbInfoPG()){ $res = $con->query('SELECT * FROM system.locale_string ORDER BY "category" ASC;'); } else { $res = $con->query('SELECT * FROM system_locale_string ORDER BY category ASC;'); } + $vars['content'] = ''; while($r = $res->next()){ - $result .= ''.''.''; - foreach ($languages as $columns){ - $result .= ''; - } - - $result .= ''; - + $content = ''; + foreach ($languages as $columns){ + $content .= ''; } - $result .= '
'.'ID'.''.'Category'.''.$lang.'
'.$lang.'
'.$r["id"].'

'.''.'
'.$r["category"].''.$r[$columns].'
'.$r[$columns].'
'; + $r['content'] = $content; + $vars['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/list_entry.tpl'), $r); + } - return $result; + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/list.tpl'), $vars); } public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_edit($id, $lang, $newtext){ @@ -52,25 +47,19 @@ 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){ + public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_add($id, $category){ $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.', category) VALUES (?, ?, 100);', array($id, $newtext)); + $res = $con->prepare('addText' ,'INSERT INTO system_locale_string (id, category) VALUES (?, ?);', array($id, $category)); } 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_addmode(){ + $vars = array(); + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/add.tpl'), $vars); } public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_delete($id){ @@ -85,16 +74,6 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { } public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_action_editmode($entry){ - $result = '

'.$entry.'

'. - ''. - ''; - - foreach (self::getLanguages() as $lang){ - $result .= ''; - $languages[] = $lang; - } - - $result .= ''; $con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo()); $res = null; if(\SYSTEM\system::isSystemDbInfoPG()){ @@ -105,33 +84,25 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { $res = $con->prepare( 'edit', 'SELECT * FROM system_locale_string WHERE id = ? ORDER BY "category" ASC;', array($entry)); - } - while($r = $res->next()){ - $result .= ""; - $fu = 0; - foreach ($languages as $columns){ - $result .= ''; - } - $result .= "
'.$lang.'
-
'. - ''. - '
-
"; } - $result .= '
'.''; - return $result; + if(!$r = $res->next()){ + throw new \SYSTEM\LOG\ERROR("No such Entry found!");} + + $vars = array(); + $vars['entry'] = $entry; + $vars['langhead'] = ''; + + foreach (self::getLanguages() as $lang){ + $vars['langhead'] .= ''.$lang.''; + $languages[] = $lang; + } + $vars['content'] = ''; + foreach ($languages as $lang){ + $r['lang'] = $lang; + $r['value'] = $r[$lang]; + $vars['content'] .= \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/edit_entry.tpl'), $r);} + + return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/edit.tpl'), $vars); } public static function html_li_menu(){return '
  • DB Text
  • ';} @@ -141,5 +112,5 @@ class saimod_sys_locale extends \SYSTEM\SAI\SaiModule { public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_flag_css(){} public static function sai_mod__SYSTEM_SAI_saimod_sys_locale_flag_js(){ return \SYSTEM\LOG\JsonResult::toString( - array( \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/saimod_sys_locale_submit.js')));} + array( \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_locale/saimod_sys_locale.js')));} } \ No newline at end of file diff --git a/sai/modules/saimod_sys_locale/saimod_sys_locale_submit.js b/sai/modules/saimod_sys_locale/saimod_sys_locale_submit.js deleted file mode 100644 index c5978ae..0000000 --- a/sai/modules/saimod_sys_locale/saimod_sys_locale_submit.js +++ /dev/null @@ -1,55 +0,0 @@ -function init__SYSTEM_SAI_saimod_sys_locale() { - // handle navigation link click - $('.btn').click(function () { - loadEntry($(this).attr('name')); - }); - $('.delete_content').click(function(){ - $.getJSON(SAI_ENDPOINT+'sai_mod=.SYSTEM.SAI.saimod_sys_locale&action=delete&id='+$(this).attr('id'), - function(data){ - if (data.status == false){ alert("false"); } else { alert("true");} - }); - }); - $('.add_form').click(function(){ - $('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 add(){ - //$('.add').click(function(){ - 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 loadEntry(buttonID) { - - $('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(); - -}); -} - -function init__SYSTEM_SAI_saimod_sys_locale_edit(){ - $('.localeMain').click(function(){ - loadModuleContent('.SYSTEM.SAI.saimod_sys_locale'); - }); - $('.edit_content').click(function(){ - 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.");} - } - }); - }); -} diff --git a/sai/modules/saimod_sys_login/login.tpl b/sai/modules/saimod_sys_login/login.tpl index e71f419..8c4f06a 100644 --- a/sai/modules/saimod_sys_login/login.tpl +++ b/sai/modules/saimod_sys_login/login.tpl @@ -9,26 +9,26 @@ size="30" style="margin-bottom: 15px;" id="bt_login_user" - placeholder="${loginUsername}" - minlength="3" data-validation-minlength-message="${login_username_too_short}" - maxlength="16" data-validation-maxlength-message="${login_username_too_long}" - required data-validation-required-message="${login_username_required}"/> + placeholder="${sai_mod_login_username}" + minlength="3" data-validation-minlength-message="${sai_error_mod_login_username_too_short}" + maxlength="16" data-validation-maxlength-message="${sai_error_mod_login_username_too_long}" + required data-validation-required-message="${sai_error_mod_login_username_required}"/>
    + placeholder="${sai_mod_login_password}" + minlength="5" data-validation-minlength-message="${sai_error_mod_login_password_too_short}" + maxlength="16" data-validation-maxlength-message="${sai_error_mod_login_password_too_long}" + required data-validation-required-message="${sai_error_mod_login_password_required}"/>
    + id="login_submit">${sai_mod_login_login} Register an Account
    diff --git a/sai/modules/saimod_sys_login/logout.tpl b/sai/modules/saimod_sys_login/logout.tpl index a63e63a..4c7ad22 100644 --- a/sai/modules/saimod_sys_login/logout.tpl +++ b/sai/modules/saimod_sys_login/logout.tpl @@ -6,11 +6,11 @@ - + - + - + - + - + - + - + diff --git a/sai/modules/saimod_sys_login/saimod_sys_login.php b/sai/modules/saimod_sys_login/saimod_sys_login.php index 2e504cd..b9f0df4 100644 --- a/sai/modules/saimod_sys_login/saimod_sys_login.php +++ b/sai/modules/saimod_sys_login/saimod_sys_login.php @@ -13,6 +13,7 @@ class saimod_sys_login extends \SYSTEM\SAI\SaiModule { $vars['login_password_too_short'] = 'Password to short.'; $vars['isadmin'] = \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI) ? "yes" : "no"; $vars = array_merge($vars, \SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_SYSTEM_SAI)); + $vars = array_merge($vars, \SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_SYSTEM_SAI_ERROR)); if(\SYSTEM\SECURITY\Security::isLoggedIn()){ return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_login/logout.tpl'), $vars); diff --git a/sai/page/default_page/default_page.php b/sai/page/default_page/default_page.php index d336a0b..cc48302 100644 --- a/sai/page/default_page/default_page.php +++ b/sai/page/default_page/default_page.php @@ -58,6 +58,7 @@ class default_page extends \SYSTEM\PAGE\Page { $vars['title'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_TITLE); //da_sense | Developer Center $vars['copyright'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT); //© da_sense, TU Darmstadt 2013 + $vars = array_merge($vars,\SYSTEM\locale::getStrings(\SYSTEM\DBD\locale_string::VALUE_CATEGORY_SYSTEM_SAI)); return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'page/default_page/sai.tpl'), $vars); } } \ No newline at end of file
    ${ua_name}${sai_mod_login_username}
    ${ua_email}${sai_mod_login_email}
    ${ua_password}${sai_mod_login_password} ****
    ${ua_last_active}${sai_mod_login_last_active}
    ${ua_joindate}${sai_mod_login_join_date}
    ${ua_locale}${sai_mod_login_locale}
    Admin Rights${sai_mod_login_admin_rights} ${isadmin}