issue 160, change behavior for mid select

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9227 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2011-09-20 07:03:34 +00:00
parent bd7b16fbca
commit f3b6992b31
5 changed files with 70 additions and 11 deletions

View file

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

View file

@ -0,0 +1,50 @@
(function($){
xe.MidManager = xe.createApp("MidManager", {
$keyObj: null,
init: function(key){
var self = this;
var $keyObj = this.$keyObj = $('.extra_vars input[name='+key+']');
var $finder = $keyObj.siblings('.finder');
$keyObj.siblings('button.search').bind('click', function(){
$finder.slideDown(100);
return false;
});
$keyObj.siblings('button.delete').bind('click', function(){
$keyObj.val('').next().val('');
return false;
});
$finder.find('.moduleIdList').siblings('button').bind('click', function(){
$keyObj.val($finder.find('.moduleIdList').val());
self.cast('MID_SYNC');
$finder.slideUp(100);
return false;
});
},
API_MID_SYNC: function(){
var self = this;
var $finder = self.$keyObj.closest('.modulefinder');
var module_srl = this.$keyObj.val();
if (!module_srl) return;
function on_complete(data){
if (data.error){
alert(data.message);
return;
}
self.$keyObj.val(data.module_list[0].module_srl);
self.$keyObj.next().val(data.module_list[0].browser_title+' ('+data.module_list[0].mid+', '+data.module_list[0].module_name+')');
}
$.exec_json('module.getModuleAdminModuleList', {'module_srls': module_srl}, on_complete);
}
});
})(jQuery);

View file

@ -8,7 +8,7 @@ xe.ModuleListManager = xe.createApp("ModuleListManager", {
init: function(key){
var self = this;
var $keyObj = this.$keyObj = $('input[name='+key+']');
var $keyObj = this.$keyObj = $('.extra_vars input[name='+key+']');
this.$moduleNameObj = $keyObj.parent().find('.moduleList');
this.$moduleSrlObj = $keyObj.parent().find('.moduleIdList');
this.$selectedObj = $keyObj.parent().find('.modulelist_selected');

View file

@ -7,7 +7,7 @@ xe.MultiOrderManager = xe.createApp("MultiOrderManager", {
init: function(key){
var self = this;
var $keyObj = this.$keyObj = jQuery('input[name='+key+']');
var $keyObj = this.$keyObj = jQuery('.extra_vars input[name='+key+']');
this.$showObj = $keyObj.parent().find('.multiorder_show');
this.$selectedObj = $keyObj.parent().find('.multiorder_selected');

View file

@ -1,5 +1,6 @@
<load target="js/multi_order.js" usecdn="true" />
<load target="js/module_list.js" usecdn="true" />
<load target="js/mid.js" usecdn="true" />
<!--%load_js_plugin("ui.colorpicker")-->
<ul>
@ -31,11 +32,11 @@
{@$suggestion_id = 0}
<block loop="$widget_info->extra_var => $id, $var">
{@$suggestion_id++}
<block cond="!$not_first && !$var->group"><ul></block>
<block cond="!$not_first && !$var->group"><ul class="extra_vars"></block>
<block cond="$group != $var->group">
<block cond="$not_first"></ul></block>
<h3 class="h3">{$var->group}</h3>
<ul>
<ul class="extra_vars">
{@$group = $var->group}
</block>
{@$not_first = true}
@ -114,15 +115,22 @@
</script>
</block>
<block cond="$var->type == 'mid'">
<div class="a">
<input type="text" /> <a href="#suggestion_{$suggestion_id}" class="tgAnchor findsite">{$lang->find_site}</a>
<div id="suggestion_{$suggestion_id}" class="tgContent suggestion">
<ul>
</ul>
<input type="hidden" name="{$id}" value="" />
<input type="text" readonly="readonly" /> <button class="text search">{$lang->cmd_search}</button> <button class="text delete">{$lang->cmd_delete}</button>
<div class="finder" style="display: none;">
<div class="a">
<input type="text" class="site_keyword" /> <a href="#suggestion_{$suggestion_id}" class="tgAnchor findsite">{$lang->find_site}</a>
<div id="suggestion_{$suggestion_id}" class="tgContent suggestion">
<ul>
</ul>
</div>
</div>
<p class="a"><select class="moduleList" style="width:290px;"></select></p>
<p class="a"><select class="moduleIdList" style="width:290px;"></select> <button class="text">{$lang->cmd_select}</button></p>
</div>
<p class="a"><select class="moduleList" style="width:290px;"></select></p>
<p class="a"><select name="{$id}" class="moduleIdList" style="width:290px;"></select></p>
<script type="text/javascript">
xe.registerApp(new xe.MidManager('{$id}'));
</script>
</block>
<block cond="$var->type == 'filebox'">
{@$use_filebox = true}