issue 160, fix a bug for do not display user defined language when modify widget code

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9245 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2011-09-21 03:03:06 +00:00
parent 2a6f6e3c04
commit 5e4638ae94
5 changed files with 52 additions and 3 deletions

View file

@ -33,7 +33,7 @@
<action name="getModuleAdminIPCheck" type="model" standalone="true" />
<action name="getLangListByLangcodeForAutoComplete" type="model" standalone="true" />
<action name="getFileBoxListHtml" type="model" />
<action name="getLangByLangcode" type="model" />
<action name="procModuleAdminInsertCategory" type="controller" standalone="true" ruleset="insertCategory" />
<action name="procModuleAdminUpdateCategory" type="controller" standalone="true" ruleset="updateCategory" />

View file

@ -120,7 +120,7 @@
$site_args->index_module_srl = $mid_output->data->module_srl;
$site_args->domain = $domain;
$site_args->default_language = $db_info->lang_type;
if($output->data && !$output->data->index_module_srl) {
$output = executeQuery('module.updateSite', $site_args);
} else {
@ -989,7 +989,7 @@
return;
}
return $config;
}
/**
@ -1513,5 +1513,16 @@
}
$this->add('results', $list);
}
function getLangByLangcode()
{
$langCode = Context::get('langCode');
if (!$langCode) return;
$oModuleController = &getController('module');
$oModuleController->replaceDefinedLangCode($langCode);
$this->add('lang', $langCode);
}
}
?>

View file

@ -176,6 +176,7 @@ function doFillWidgetVars() {
xe.broadcast('MULTIORDER_SYNC');
xe.broadcast('MODULELIST_SYNC');
xe.broadcast('MID_SYNC');
xe.broadcast('MULTILANG_SYNC');
jQuery('.filebox')
.each(function(){

View file

@ -0,0 +1,30 @@
(function($){
xe.MultiLangManager = xe.createApp("MultiLangManager", {
$keyObj: null,
init: function(key){
var $keyObj = this.$keyObj = $('.extra_vars input[name='+key+']');
},
API_MULTILANG_SYNC: function(){
var self = this;
var regexp = /^\$user_lang\-\>/;
var langCode = this.$keyObj.val();
if (!regexp.test(langCode)) return;
function on_complete(data){
if (data.error){
alert(data.message);
return;
}
$('#' + self.$keyObj.attr('name')).val(data.lang);
}
$.exec_json('module.getLangByLangcode', {'langCode': langCode}, on_complete);
}
});
})(jQuery);

View file

@ -1,6 +1,7 @@
<load target="js/multi_order.js" usecdn="true" />
<load target="js/module_list.js" usecdn="true" />
<load target="js/mid.js" usecdn="true" />
<load target="js/multi_lang.js" usecdn="true" />
<!--%load_js_plugin("ui.colorpicker")-->
<ul>
@ -48,6 +49,9 @@
<input type="hidden" name="{$id}" value="" class="vLang" />
<input type="text" id="{$id}" class="vLang" />
<span class="desc"><a href="#langEdit" class="editUserLang tgAnchor">{$lang->cmd_set_multilingual}</a></span>
<script type="text/javascript">
xe.registerApp(new xe.MultiLangManager('{$id}'));
</script>
</div>
<input cond="$var->type == 'color'" type="text" name="{$id}" value="" id="{$id}" class="color-indicator" />
<div cond="$var->type == 'textarea'" class="multiLangEdit">
@ -55,6 +59,9 @@
<input type="hidden" name="{$id}" value="" class="vLang" />
<textarea cond="$var->type == 'textarea'" id="{$id}" class="vLang"></textarea>
<span class="desc"><a href="#langEditTextarea" class="editUserLang tgAnchor">{$lang->cmd_set_multilingual}</a></span>
<script type="text/javascript">
xe.registerApp(new xe.MultiLangManager('{$id}'));
</script>
</div>
<select cond="$var->type == 'select'" name="{$id}" id="{$id}" style="width:290px">
<option loop="$var->options => $key, $val" value="{$key}">{$val}</option>