Issue 2041: The module search component updated to support multiple instances in a single page.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.1@10933 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
nagoon97 2012-07-24 07:38:21 +00:00
parent 3516f0a9ce
commit 8a1f88ddf8
6 changed files with 55 additions and 43 deletions

View file

@ -20,6 +20,14 @@ jQuery(function($){
<load target="../install/lang/lang.xml" usecdn="true" />
<load target="../../session/tpl/js/session.js" usecdn="true" />
<script>
jQuery(function($){
$('.moduleSearch').bind('moduleSelect', function(e, sModuleType, sModuleInstanceName, sModuleInstanceSrl){
$('#_target_module').val(sModuleInstanceName);
$('#index_module_srl').val(sModuleInstanceSrl);
});
});
</script>
<form action="" method="post" id="ftp_form" class="form" enctype="multipart/form-data">
<input type="hidden" name="module" value="install" />
<input type="hidden" name="act" value="procInstallAdminConfig" />
@ -33,7 +41,7 @@ jQuery(function($){
<input type="hidden" name="index_module_srl" id="index_module_srl" value="{$start_module->index_module_srl}" />
<input type="text" name="_target_module" id="_target_module" value="{$start_module->browser_title} ({$start_module->mid})" readonly />
<a href="#moduleSearchWindow" class="tgAnchor moduleSearch">{$lang->cmd_find}</a>
<div id="moduleSearchWindow" class="tgContent">
<div id="moduleSearchWindow" class="moduleSearchWindow tgContent">
<div class="siteList sectionDiv">
<h2>{$lang->select_site}</h2>
<div class="siteListSearchBox">

View file

@ -678,25 +678,25 @@ body.modalContainer{_height:100%;_width:100%} /* IE6 only */
.x .crossTable input[type=file]{height:22px;line-height:22px;vertical-align:middle;padding:0 4px}
.x .clear:after{content:"";display:block;clear:both}
#moduleSearchWindow{position:absolute;width:700px;}
#moduleSearchWindow, #moduleSearchWindow div{margin:0;padding:0;color:#2d2c2d;font-size:12px;}
#moduleSearchWindow h2{margin:0;padding:4px;height:24px;line-height:24px;background:#666;text-align:left;color:#fff;font-size:12px;}
#moduleSearchWindow .sectionDiv{position:relative;margin:0px;background:#fff;border:1px solid;}
#moduleSearchWindow .siteList{float:left;width:295px;}
#moduleSearchWindow .highlight{background:yellow;color:red;font-style:italic;}
#moduleSearchWindow .moduleTypeList{margin-left:5px;float:left;width:200px;}
#moduleSearchWindow .moduleInstanceList{float:right;width:190px;}
#moduleSearchWindow ul{margin:0;padding:0;border:0;}
#moduleSearchWindow li{font-size:12px;border:0;border-bottom:1px solid #ccc;margin:0;padding: 4px 4px;font-family: ,NanumGothic,"맑은 고딕","Malgun Gothic",AppleGothic,,Dotum,,Gulim,sans-serif;}
#moduleSearchWindow li:hover, #moduleSearchWindow li.on{background:#eee;cursor:pointer;}
#moduleSearchWindow li div{margin:0;padding:0;display:inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
#moduleSearchWindow .siteList li div{width:270px;}
#moduleSearchWindow .siteListSearchBox{margin:0;padding:4px 0;height:24px;border-bottom:1px solid #888;}
#moduleSearchWindow .siteListSearchBoxBorder{margin-left:3px;height: 22px;width: 287px;border: 1px solid #ccc;}
#moduleSearchWindow .siteListSearchInput{margin:0;padding:0;position:relative; float:right; width: 260px; margin-right:4px;border:0;}
#moduleSearchWindow .siteListSearchBox .searchImg{position:relative;float:left;margin-top:4px;margin-left:4px;}
#moduleSearchWindow .moduleTypeList li div{width:170px;}
#moduleSearchWindow .moduleInstanceList li div{width:190px;}
.x .moduleSearchWindow{position:absolute;width:700px;}
.x .moduleSearchWindow, .moduleSearchWindow div{margin:0;padding:0;color:#2d2c2d;font-size:12px;}
.x .moduleSearchWindow h2{margin:0;padding:4px;height:24px;line-height:24px;background:#666;text-align:left;color:#fff;font-size:12px;}
.x .moduleSearchWindow .sectionDiv{position:relative;margin:0px;background:#fff;border:1px solid;}
.x .moduleSearchWindow .siteList{float:left;width:295px;}
.x .moduleSearchWindow .highlight{background:yellow;color:red;font-style:italic;}
.x .moduleSearchWindow .moduleTypeList{margin-left:5px;float:left;width:200px;}
.x .moduleSearchWindow .moduleInstanceList{float:right;width:190px;}
.x .moduleSearchWindow ul{margin:0;padding:0;border:0;}
.x .moduleSearchWindow li{font-size:12px;border:0;border-bottom:1px solid #ccc;margin:0;padding: 4px 4px;font-family: ,NanumGothic,"맑은 고딕","Malgun Gothic",AppleGothic,,Dotum,,Gulim,sans-serif;}
.x .moduleSearchWindow li:hover, .moduleSearchWindow li.on{background:#eee;cursor:pointer;}
.x .moduleSearchWindow li div{margin:0;padding:0;display:inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
.x .moduleSearchWindow .siteList li div{width:270px;}
.x .moduleSearchWindow .siteListSearchBox{margin:0;padding:4px 0;height:24px;border-bottom:1px solid #888;}
.x .moduleSearchWindow .siteListSearchBoxBorder{margin-left:3px;height: 22px;width: 287px;border: 1px solid #ccc;}
.x .moduleSearchWindow input.siteListSearchInput{margin:0;padding:0;position:relative; float:right; width: 260px; margin-right:4px;border:0;}
.x .moduleSearchWindow .siteListSearchBox .searchImg{position:relative;float:left;margin-top:4px;margin-left:4px;}
.x .moduleSearchWindow .moduleTypeList li div{width:170px;}
.x .moduleSearchWindow .moduleInstanceList li div{width:190px;}
/*!

File diff suppressed because one or more lines are too long

View file

@ -580,7 +580,7 @@ $('.modulefinder').xeModuleFinder();
jQuery(function($){
$.fn.xeModuleSearch = function(){
var $moduleSearchWindow = $("#moduleSearchWindow");
var $moduleSearchWindow = $(this).find(".moduleSearchWindow");
var $siteListDiv = $moduleSearchWindow.find('.siteList');
var $moduleTypeListDiv = $moduleSearchWindow.find('.moduleTypeList');
@ -596,11 +596,7 @@ $.fn.xeModuleSearch = function(){
var MAX_LIST_HEIGHT = 280;
var t = this;
this.onModuleSelect = function(sModuleType, sModuleInstanceName, sModuleInstanceSrl){
$('#_target_module').val(sModuleInstanceName);
$('#index_module_srl').val(sModuleInstanceSrl);
};
var $t = $(this);
function setListSize($UL, nHeight){
var nWidth, $div;
@ -757,8 +753,15 @@ $.fn.xeModuleSearch = function(){
t.sSelectedModuleInstanceName = $this.text();
t.sSelectedModuleSrl = $this.data('module_srl');
t.onModuleSelect(t.sSelectedModuleType, t.sSelectedModuleInstanceName, t.sSelectedModuleSrl);
/*
var onModuleSelect = t.onModuleSelect;
if(typeof $t.data('onModuleSelect') === 'function'){
onModuleSelect = $t.data('onModuleSelect');
}
onModuleSelect(t.sSelectedModuleType, t.sSelectedModuleInstanceName, t.sSelectedModuleSrl);
*/
t.trigger('moduleSelect', [t.sSelectedModuleType, t.sSelectedModuleInstanceName, t.sSelectedModuleSrl]);
$('.tgAnchor.moduleSearch').trigger('close.tc');
oEvent.preventDefault();
@ -767,7 +770,7 @@ $.fn.xeModuleSearch = function(){
return this;
};
xe.ModuleSearch = $('.modulefinder').xeModuleSearch();
xe.ModuleSearch = $('.moduleSearch').xeModuleSearch();
});

View file

@ -18,11 +18,11 @@ j;f++)e=a("<li />").appendTo(b),a('<button type="button" />').text(g[f].domain).
a("<option />").attr("value",g).text(d[g].title).appendTo(e);e.prop("selectedIndex",0).change().focus();e.is(":visible")||e.slideDown(100,function(){b.find(".moduleIdList:not(:visible)").slideDown(100).trigger("show")}).trigger("show")}})}).end().find(".moduleList,.moduleIdList").hide().end().find(".moduleList").change(function(){var d,b,e;d=a(this);b=d.val();e=d.data("module_list");if(e[b]){e=e[b].list;d=d.closest(".modulefinder").find(".moduleIdList").removeAttr("disabled").empty();for(var k in e)e.hasOwnProperty(k)&&
a("<option />").attr("value",e[k].module_srl).text(e[k].browser_title).appendTo(d);d.prop("selectedIndex",0).change()}});return this};a(".modulefinder").xeModuleFinder()});
jQuery(function(a){a.fn.xeModuleSearch=function(){function d(a,b){var e;a.find("li div").width("");a.css("height","");a.css("overflow-y","");a.height()>b&&(e=a.find("li div"),e.width(e.width()-20+"px"),a.css("height",b+"px"),a.css("overflow-y","auto"))}function b(b){var e,f=RegExp(b,"ig"),h=m;j.empty();i=0;for(c=h.length;i<c;i++){e=h[i].domain;if(b){if(!e.match(f))continue;e=e.replace(f,function(a){return'<span class="highlight">'+a+"</span>"})}$li=a("<li />").appendTo(j);a('<a href="#" >').html("<div>"+
e+'</div><span class="icon-circle-arrow-right" style="display:inline-block;float:right;width:16px;height:16px;"></span>').data("site_srl",h[i].site_srl).appendTo($li)}d(j,n-l.parent("DIV").height())}var e=a("#moduleSearchWindow"),k=e.find(".siteList"),g=e.find(".moduleTypeList"),f=e.find(".moduleInstanceList"),j=k.find("UL"),o=g.find("UL"),h=f.find("UL"),l=e.find("INPUT.siteListSearchInput"),m,n=280,p=this;this.onModuleSelect=function(b,e,d){a("#_target_module").val(e);a("#index_module_srl").val(d)};
l.keyup(function(){b(l.val())});"undefined"==typeof console&&(console={log:function(){}});this.not(".xe-module-search").addClass("xe-module-search").find("a.tgAnchor.moduleSearch").bind("before-open.tc",function(){var e;e=a(this);j.empty();h.empty();g.hide();f.hide();a.exec_json("admin.getSiteAllList",{domain:""},function(d){var h=d.site_list;d.error||!a.isArray(h)?e.trigger("close.tc"):(m=h,b(l.val()),l.focus())})}).end().find(".tgContent .siteListUL").delegate("a","click",function(b){var h;h=a(this);
h.closest(".modulefinder");o.empty();f.hide();a.exec_json("module.procModuleAdminGetList",{site_srl:h.data("site_srl")},function(b){var f=b.module_list,l;if(!b.error&&f){for(l in f)f.hasOwnProperty(l)&&($li=a("<li />").appendTo(o),a('<a href="#" >').html("<div>"+f[l].title+'</div><span class="icon-circle-arrow-right" style="display:inline-block;float:right;width:16px;height:16px;"></span>').data("moduleInstanceList",f[l].list).appendTo($li));e.find(".moduleTypeList").show();d(o,n);j.find("li").removeClass("on");
h.parent("li").addClass("on")}});b.preventDefault()}).end().find(".moduleTypeListUL").delegate("a","click",function(b){var e,l;e=a(this);if(l=e.data("moduleInstanceList")){p.sSelectedModuleType=e.text();h.empty();for(var g in l)l.hasOwnProperty(g)&&($li=a("<li />").appendTo(h),a('<a href="#" >').html("<div>"+l[g].browser_title+"</div>").data("module_srl",l[g].module_srl).appendTo($li));f.show();d(h,n);o.find("li").removeClass("on");e.parent("li").addClass("on");b.preventDefault()}}).end().find(".moduleInstanceListUL").delegate("a",
"click",function(b){$this=a(this);p.sSelectedModuleInstanceName=$this.text();p.sSelectedModuleSrl=$this.data("module_srl");p.onModuleSelect(p.sSelectedModuleType,p.sSelectedModuleInstanceName,p.sSelectedModuleSrl);a(".tgAnchor.moduleSearch").trigger("close.tc");b.preventDefault()});return this};xe.ModuleSearch=a(".modulefinder").xeModuleSearch()});
e+'</div><span class="icon-circle-arrow-right" style="display:inline-block;float:right;width:16px;height:16px;"></span>').data("site_srl",h[i].site_srl).appendTo($li)}d(j,n-l.parent("DIV").height())}var e=a(this).find(".moduleSearchWindow"),k=e.find(".siteList"),g=e.find(".moduleTypeList"),f=e.find(".moduleInstanceList"),j=k.find("UL"),o=g.find("UL"),h=f.find("UL"),l=e.find("INPUT.siteListSearchInput"),m,n=280,p=this;a(this);l.keyup(function(){b(l.val())});"undefined"==typeof console&&(console={log:function(){}});
this.not(".xe-module-search").addClass("xe-module-search").find("a.tgAnchor.moduleSearch").bind("before-open.tc",function(){var e;e=a(this);j.empty();h.empty();g.hide();f.hide();a.exec_json("admin.getSiteAllList",{domain:""},function(d){var h=d.site_list;d.error||!a.isArray(h)?e.trigger("close.tc"):(m=h,b(l.val()),l.focus())})}).end().find(".tgContent .siteListUL").delegate("a","click",function(b){var h;h=a(this);h.closest(".modulefinder");o.empty();f.hide();a.exec_json("module.procModuleAdminGetList",
{site_srl:h.data("site_srl")},function(b){var f=b.module_list,l;if(!b.error&&f){for(l in f)f.hasOwnProperty(l)&&($li=a("<li />").appendTo(o),a('<a href="#" >').html("<div>"+f[l].title+'</div><span class="icon-circle-arrow-right" style="display:inline-block;float:right;width:16px;height:16px;"></span>').data("moduleInstanceList",f[l].list).appendTo($li));e.find(".moduleTypeList").show();d(o,n);j.find("li").removeClass("on");h.parent("li").addClass("on")}});b.preventDefault()}).end().find(".moduleTypeListUL").delegate("a",
"click",function(b){var e,l;e=a(this);if(l=e.data("moduleInstanceList")){p.sSelectedModuleType=e.text();h.empty();for(var g in l)l.hasOwnProperty(g)&&($li=a("<li />").appendTo(h),a('<a href="#" >').html("<div>"+l[g].browser_title+"</div>").data("module_srl",l[g].module_srl).appendTo($li));f.show();d(h,n);o.find("li").removeClass("on");e.parent("li").addClass("on");b.preventDefault()}}).end().find(".moduleInstanceListUL").delegate("a","click",function(b){$this=a(this);p.sSelectedModuleInstanceName=
$this.text();p.sSelectedModuleSrl=$this.data("module_srl");p.trigger("moduleSelect",[p.sSelectedModuleType,p.sSelectedModuleInstanceName,p.sSelectedModuleSrl]);a(".tgAnchor.moduleSearch").trigger("close.tc");b.preventDefault()});return this};xe.ModuleSearch=a(".moduleSearch").xeModuleSearch()});
jQuery(function(a){function d(a,b){for(var d=0,f=0;a&&a!=b;)d+=a.offsetTop,f+=a.offsetLeft,a=a.offsetParent;return{top:d,left:f}}var b=a('<tr class="placeholder"><td>&nbsp;</td></tr>');a.fn.xeSortableTable=function(){this.not(".xe-sortable-table").addClass("xe-sortable-table").delegate("button.dragBtn","mousedown.st",function(e){var k,g,f,j,o,h,l,m,n,p;if(1==e.which){g=a(this);f=g.closest("tr");j=g.closest("table");p=j.get(0).offsetParent;g=f.height();o=f.width();before_event=a.Event("before-drag.st");
j.trigger(before_event);if(before_event.isDefaultPrevented())return!1;k=e.pageY;h=d(f.get(0),p);$clone=f.attr("target",!0).clone(!0).appendTo(j);n=(e=j.find("thead th")).length;e.filter("[colspan]").attr("colspan",function(a,b){n+=b-1});b.find("td").attr("colspan",n);l=[];j.find("tbody>tr:not([target],.sticky,:hidden)").each(function(){var b=a(this),e;e=d(this,p);l.push({top:e.top,bottom:e.top+b.height(),$item:b})});$clone.addClass("draggable").css({position:"absolute",opacity:0.6,width:o,height:g,
left:h.left,top:h.top,zIndex:100});b.css({position:"absolute",opacity:0.6,width:o,height:"10px",left:h.left,top:h.top,backgroundColor:"#bbb",overflow:"hidden",zIndex:99}).appendTo(j);f.css("opacity",0.6);a(document).unbind("mousedown.st mouseup.st").bind("mousemove.st",function(a){var e,d,f;m=null;a=h.top-(k-a.pageY);e=0;for(d=l.length;e<d;e++)f=l[e],e&&f.top>a||e<d-1&&f.bottom<a||(m={element:f.$item},f.top>a-12?(m.state="before",b.css("top",f.top-5)):(m.state="after",b.css("top",f.bottom-5)));$clone.css({top:a})}).bind("mouseup.st",