rhymix/modules/admin/tpl/js/admin.min.js
devjin 90c18a8bb8 merge from 1.5.1.8
git-svn-id: http://xe-core.googlecode.com/svn/trunk@10157 201d5d3c-b55e-5fd7-737f-ddc643e51545
2012-02-21 07:42:16 +00:00

38 lines
18 KiB
JavaScript

jQuery(function(a){a(".form li").find('>input:text:not(".notmulti"),>input:password,>textarea').filter('input[value!=""],textarea:not(:empty)').prev("label").css("visibility","hidden").end().end().prev("label").addClass("overlap").css({top:"15px",left:"5px"}).next().focus(function(){var b=a(this).prev().stop().animate({opacity:0,left:"25px"},"fast",function(){b.css("visibility","hidden")})}).blur(function(){var b=a(this);""==a.trim(b.val())&&b.prev().stop().css("visibility","visible").animate({opacity:1,
left:"5px"},"fast")}).end().parent().css("position","relative");var c=a("input:radio+label,input:checkbox+label").prev("input");c.change(function(){var b=a(this).attr("name");c.filter(function(){return this.name==b}).next("label").css("font-weight","normal").end().filter(":checked").next("label").css("font-weight","bold").end()}).change();a(".form th>input:checkbox").change(function(){var b=a(this),d=b.data("name");b.closest("table").find("input:checkbox").filter(function(){var b=a(this);return!b.prop("disabled")&&
(b.attr("name")==d||b.data("name")==d)}).prop("checked",b.prop("checked")).end().end().trigger("update.checkbox",[d,this.checked])});a.fn.xePagination=function(){this.not(".xe-pagination").addClass("xe-pagination").find("span.tgContent").css("whiteSpace","nowrap").end().find("a.tgAnchor").each(function(){var b=a(this);b.after(a(b.attr("href")))}).end();return this};a(".pagination").xePagination();a(".portlet .action").css({display:"none",position:"absolute"}).parent().mouseleave(function(){a(this).find(">.action").fadeOut(100)}).mouseenter(function(){a(this).find(">.action").fadeIn(100)}).focusin(function(){a(this).mouseenter()}).focusout(function(){var b=
a(this),d;clearTimeout(b.data("timer"));d=setTimeout(function(){b.find(":focus").length||b.mouseleave()},10);b.data("timer",d)});a(window).resize(function(){1300>a(document).width()?(a(".dashboard>.section>br").remove(),a(".dashboard>.section>.portlet:odd").after('<br style="clear:both" />')):(a(".dashboard>.section>br").remove(),a(".dashboard>.section>.portlet:eq(2),.dashboard>.section>.portlet:eq(5)").after('<br style="clear:both" />'))});a(window).resize();a(".header>.siteTool>a.i").bind("before-open.tc",
function(){a(this).addClass("active").next("div.tgContent").find(">.section:gt(0)").hide().end().find(">.btnArea>button").show()}).bind("after-close.tc",function(){a(this).removeClass("active")}).next("#siteMapList").find(">.section:last").after('<p class="btnArea"><button type="button">&rsaquo; more</button></p>').find("+p>button").click(function(){a(this).hide().parent().prevAll(".section").show()});a.fn.xeMask=function(){this.each(function(){var b=a(this),d=b.text();/^([\w\-\.]+?)@(([\w-]+\.)+[a-z]{2,})$/ig.test(d)&&
b.html(d.replace(/(@.+)$/,'<span class="ellipsis">...</span><span class="cover">$1</span>')).find(">.ellipsis").css({position:"absolute",zIndex:1}).hover(function(){a(this).next(".cover").mouseover()},function(){a(this).next(".cover").mouseout()}).end().find(">.cover").css({zIndex:2,opacity:0}).hover(function(){a(this).css("opacity",1).prev("span").css("visibility","hidden")},function(){a(this).css("opacity",0).prev("span").css("visibility","visible")}).end()})};a(".masked").xeMask()});
jQuery(function(a){a.fn.xeMenu=function(){this.removeClass("jx").attr("role","navigation").find("li").attr("role","menuitem").find(">ul").hide().end().filter(":has(>ul)").attr("aria-haspopup","true").end().end().delegate("li",{mouseover:function(){a(this).addClass("active").find(">ul").show().end().parentsUntil(".gnb").filter("li").addClass("active").end().end()},mouseleave:function(){a(this).removeClass("active").find(">ul").hide()},focusout:function(){var c=a(this);setTimeout(function(){c.find(":focus").length||
c.removeClass("active").find(">ul").hide()},1)}}).delegate("a",{focus:function(){a(this).parent("li").mouseover()}})};a("div.gnb").xeMenu()});
jQuery(function(a){a.fn.xeModalWindow=function(){this.not(".xe-modal-window").addClass("xe-modal-window").each(function(){a(a(this).attr("href")).addClass("x").hide()}).click(function(){var c=a(this),b,d;b=a(c.attr("href"));b.parent("body").length||(d=a('<button type="button" class="modalClose" title="Close this layer">X</button>'),d.click(function(){b.data("anchor").trigger("close.mw")}),b.prepend('<span class="bg"></span>').append('<\!--[if IE 6]><iframe class="ie6"></iframe><![endif]--\>').find(">.fg").prepend(d).append(d.clone(!0)).end().appendTo("body"));
b.data("anchor",c);"showing"==b.data("state")?c.trigger("close.mw"):c.trigger("open.mw");return!1}).bind("open.mw",function(){var c=a(this),b,d;b=a.Event("before-open.mw");c.trigger(b);if(b.isDefaultPrevented())return!1;b=a(c.attr("href"));d=c.data("duration")||"fast";b.data("state","showing");a("html,body").addClass("modalContainer");a(document).bind("keydown.mw",function(a){if(27==a.which)return c.trigger("close.mw"),!1});b.fadeIn(d,function(){c.trigger("after-open.mw")}).find(">.bg").height(a(document).height()).end().find("button.modalClose:first").focus()}).bind("close.mw",
function(){var c=a(this),b,d;b=a.Event("before-close.mw");c.trigger(b);if(b.isDefaultPrevented())return!1;b=a(c.attr("href"));d=c.data("duration")||"fast";b.data("state","hiding");a("html,body").removeClass("modalContainer");b.fadeOut(d,function(){c.trigger("after-close.mw")});c.focus()})};a("a.modalAnchor").xeModalWindow();a("div.modal").addClass("x").hide()});
jQuery(function(a){var c=!1;a.fn.xeContentToggler=function(){this.not(".xe-content-toggler").addClass("xe-content-toggler").each(function(){var b=a(this);$layer=a(b.attr("href"));$layer.hide().not(".xe-toggling-content").addClass("xe-toggling-content").mousedown(function(){c=!0}).focusout(function(){setTimeout(function(){!c&&!$layer.find(":focus").length&&"showing"==$layer.data("state")&&b.trigger("close.tc");c=!1},1)})}).click(function(){var b=a(this),d;d=a(b.attr("href"));d.data("anchor",b);"showing"==
d.data("state")?b.trigger("close.tc"):b.trigger("open.tc");return!1}).bind("open.tc",function(){function b(){d.trigger("after-open.tc")}var d=a(this),g,f,e;g=a(d.attr("href"));f=d.data("effect");e=d.data("duration")||"fast";g.data("state","showing");d.trigger("before-open.tc");c=!1;a(document).unbind("mousedown.tc keydown.tc").bind("mousedown.tc keydown.tc",function(b){if(b&&("keydown"==b.type&&27!=b.which||"mousedown"==b.type&&(b=a(b.target),b.is("html,.tgAnchor,.tgContent")||g.has(b).length)))return!0;
d.trigger("close.tc");return!1});switch(f){case "slide":g.slideDown(e,b);break;case "slide-h":f=g.css({"overflow-x":"",width:""}).width();g.show().css({"overflow-x":"hidden",width:"0px"}).animate({width:f},e,function(){g.css({"overflow-x":"",width:""});b()});break;case "fade":g.fadeIn(e,b);break;default:g.show(),d.trigger("after-open.tc")}}).bind("close.tc",function(){function b(){d.trigger("after-close.tc")}var d=a(this),c,f,e;a(document).unbind("mousedown.tc keydown.tc");c=a(d.attr("href"));f=d.data("effect");
e=d.data("duration")||"fast";c.data("state","hiding");d.trigger("before-close.tc");switch(f){case "slide":c.slideUp(e,b);break;case "slide-h":c.animate({width:0},e,function(){c.hide();b()});break;case "fade":c.fadeOut(e,b);break;default:c.hide(),d.trigger("after-close.tc")}});return this};a("a.tgAnchor").xeContentToggler()});
jQuery(function(a){a.fn.xeModuleFinder=function(){this.not(".xe-module-finder").addClass("xe-module-finder").find("a.tgAnchor.findsite").bind("before-open.tc",function(){var c,b,d;c=a(this);b=a(c.attr("href")).find(">ul");d=c.prev("input:text").val();a.exec_json("admin.getSiteAllList",{domain:d},function(d){var f=d.site_list,e,i;b.empty();c.closest(".modulefinder").find(".moduleList,.moduleIdList").attr("disabled","disabled");if(d.error||!a.isArray(f))c.trigger("close.tc");else for(e=0,i=f.length;e<
i;e++)d=a("<li />").appendTo(b),a('<button type="button" />').text(f[e].domain).data("site_srl",f[e].site_srl).appendTo(d)})}).end().find(".tgContent.suggestion").delegate("button","click",function(){var c,b;c=a(this);b=c.closest(".modulefinder");b.find("a.tgAnchor.findsite").trigger("close.tc");a.exec_json("module.procModuleAdminGetList",{site_srl:c.data("site_srl")},function(d){var c=d.module_list,f;if(!d.error&&c){d=b.find(".moduleList").data("module_list",c).removeAttr("disabled").empty();for(f in c)c.hasOwnProperty(f)&&
a("<option />").attr("value",f).text(c[f].title).appendTo(d);d.prop("selectedIndex",0).change().focus();d.is(":visible")||d.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 c,b,d;c=a(this);b=c.val();d=c.data("module_list");if(d[b]){d=d[b].list;c=c.closest(".modulefinder").find(".moduleIdList").removeAttr("disabled").empty();for(var g in d)d.hasOwnProperty(g)&&
a("<option />").attr("value",d[g].module_srl).text(d[g].browser_title).appendTo(c);c.prop("selectedIndex",0).change()}});return this};a(".modulefinder").xeModuleFinder()});
jQuery(function(a){function c(a,b){for(var c=0,e=0;a&&a!=b;)c+=a.offsetTop,e+=a.offsetLeft,a=a.offsetParent;return{top:c,left:e}}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(d){var g,f,e,i,k,h,j,m,l,n;if(1==d.which){f=a(this);e=f.closest("tr");i=f.closest("table");n=i.get(0).offsetParent;f=e.height();k=e.width();before_event=a.Event("before-drag.st");
i.trigger(before_event);if(before_event.isDefaultPrevented())return!1;g=d.pageY;h=c(e.get(0),n);$clone=e.attr("target",!0).clone(!0).appendTo(i);l=(d=i.find("thead th")).length;d.filter("[colspan]").attr("colspan",function(a,b){l+=b-1});b.find("td").attr("colspan",l);j=[];i.find("tbody>tr:not([target],.sticky,:hidden)").each(function(){var b=a(this),d;d=c(this,n);j.push({top:d.top,bottom:d.top+b.height(),$item:b})});$clone.addClass("draggable").css({position:"absolute",opacity:0.6,width:k,height:f,
left:h.left,top:h.top,zIndex:100});b.css({position:"absolute",opacity:0.6,width:k,height:"10px",left:h.left,top:h.top,backgroundColor:"#bbb",overflow:"hidden",zIndex:99}).appendTo(i);e.css("opacity",0.6);a(document).unbind("mousedown.st mouseup.st").bind("mousemove.st",function(a){var d,c,l;m=null;a=h.top-(g-a.pageY);for(d=0,c=j.length;d<c;d++)l=j[d],d&&l.top>a||d<c-1&&l.bottom<a||(m={element:l.$item},l.top>a-12?(m.state="before",b.css("top",l.top-5)):(m.state="after",b.css("top",l.bottom-5)));$clone.css({top:a})}).bind("mouseup.st",
function(){a(document).unbind("mousemove.st mouseup.st");e.removeAttr("target").css("opacity","");$clone.remove();b.remove();m&&(a(m.element)[m.state](e),i.trigger("after-drag.st"))})}});return this};a("table.sortable").xeSortableTable()});
jQuery(function(a){function c(b){function d(){var a=[];f.each(function(){a.push(this.value)});return a.join("\n")}function c(){b.data("multilang-current-name")?b.find("h2").find("strong").text(i==q?h:k).end().find("a").text(i==q?k:h).show().end():b.find("h2").find("strong").text(h).end().find("a").hide()}var e,f,g="",j=0,i,h,k,o=[],q=0,s=1;b.data("init-multilang-editor")||(b.data("init-multilang-editor",!0).bind("multilang-reset",function(){b.data("multilang-current-name","").find(".langInput li").find(">input:text,>textarea").val(" ").prev("label").css("visibility",
"visible");i=q;c()}).find("h2 a").click(function(){i=!i;c();return!1}).end().delegate("a.langItem","click",function(){var f=a(this),r,h,k;h=b.data("multilang-list");k=f.data("multilang-name");if(h&&h[k]){h=h[k];r=b.find(".langInput");b.trigger("multilang-reset").find(".langList li.active").removeClass("active").end().data("multilang-current-name",k);f.parent("li").addClass("active");for(var p in h)h.hasOwnProperty(p)&&r.find("li."+p).find(">input:text,>textarea").data("multilang-value",h[p]).val(h[p]).prev("label").css("visibility",
"hidden");g=d();j=0;e.val(o[j]);i=s;c();return!1}}).data("layer_index",m).find(".langInput").attr("id","langInput_"+m++),k=b.find("h2 strong").text(),h=b.find("h2 a").text(),f=b.find("input:text,textarea").change(function(){var a=d()==g?0:1;a!=j&&e.val(o[j=a])}),e=b.find("input[type=submit]").click(function(){function c(){b.hide().closest(".multiLangEdit").find(".vLang").eq(0).val("$user_lang->"+h).end().eq(1).val(b.find(".langInput li."+xe.current_lang).find(">input:text,>textarea").val()).end()}
function e(){var b={};h&&i==s&&(b.lang_name=h);f.each(function(){var d=a(this);b[d.parent("li").attr("class")]=d.val()});a.exec_json("module.procModuleAdminInsertLang",b,t)}function t(a){a&&!a.error&&a.name&&(h=a.name,c())}var h=b.data("multilang-current-name");d()==g?c():e();return!1}),o=e.val().split("|"),e.val(o[0]))}function b(a){var b,d,c={},e;for(b=0,d=a.length;b<d;b++)e=a[b],c[e.name]||(c[e.name]={}),c[e.name][e.lang_code]=e.value;return c}function d(a){var b=0,d;for(d in a)a.hasOwnProperty(d)&&
b++;return b}var g=null,f=null,e=0,i=null,k=!1,h=!1,j;a(".multiLangEdit").delegate("input.vLang:text,textarea.vLang",{textchange:function(){var b=a(this),d=a.trim(b.val()),c;f&&(clearTimeout(f),f=null);b.data("mle-container");c=j.find(">ul");!d||k?(k=!1,c.parent().hide(),b.prev("input.vLang").val("")):(b.data("mle-langkey").val(""),b.prev("input.vLang").val(d),f=setTimeout(function(){b.addClass("loading");c.parent().is(":visible")&&c.parent().hide();show_waiting_message=!1;a.exec_json("module.getLangListByLangcodeForAutoComplete",
{search_keyword:d},function(d){return function(f){var h=f.results,g,n;if(!f.error&&h&&e==d+1){b.removeClass("loading");c.empty();for(g=0,n=h.length;g<n;g++)f=a('<button type="button" class="_btnLang" />').data("langkey",h[g].name).text(h[g].value),a("<li />").append(f).appendTo(c);j.trigger("show")}}}(e++));show_waiting_message=!0},100))},keydown:function(b){var d,c,e=b.which;a(this);b=j.find(">ul");if(!j.is(":visible")||0>a.inArray(e,[38,40,13,27]))return!0;if(27==e)return j.trigger("hide"),!1;d=
b.find("button.active");if(13==e)return d.click(),!1;if(!d.length)return b.find("li>button:first").addClass("active"),!1;38==e?(c=d.parent().prev("li").find(">button"),c.length||(c=b.find(">li:last>button"))):40==e&&(c=d.parent().next("li").find(">button"),c.length||(c=b.find(">li:first>button")));d.removeClass("active");c.addClass("active");return!1},focus:function(){var b=a(this),d=a.trim(b.val()),c=b.closest(".multiLangEdit");b.after(j);b.data("mle-container")||b.data("mle-container",c);b.data("mle-langkey")||
b.data("mle-langkey",c.find("input.vLang:first"));(function(){var c=a.trim(b.val());c!=d&&(d=c,b.trigger("textchange"));g=setTimeout(arguments.callee,50)})()},blur:function(){clearTimeout(g);g=null;a(this).closest(".multiLangEdit").focusout()},focusout:function(){var b=a(this);clearTimeout(i);i=setTimeout(function(){h?h=!1:b.find(":focus").is(".vLang,button._btnLang")||j.trigger("hide")},10)}}).delegate("a.tgAnchor.editUserLang",{"before-open.tc":function(){var e,f,g;e=a(this);f=a(e.attr("href")).insertBefore(e);
g=e.closest(".multiLangEdit").find("input.vLang,textarea.vLang");e=g.eq(0).val();g=g.eq(1).val();c(f);f.trigger("multilang-reset").removeClass("showChild").find(".langList").empty().end();f.find(".langInput li."+xe.current_lang).find(">input:text,>textarea").val(g).prev("label").css("visibility","hidden");j.trigger("hide");/^\$user_lang->(.+)$/.test(e)?(e="module.getModuleAdminLangListByName",g={lang_name:RegExp.$1}):(e="module.getModuleAdminLangListByValue",g={value:g});show_waiting_message=!1;a.exec_json(e,
g,function(c){var e=c.lang_list,g;!c.error&&e&&(e=b(e),f.data("multilang-list",e),g=f.find(".langList"),a.each(e,function(b){var c=a("<li />").appendTo(g),d=f.data("layer_index");a('<a href="#langInput_'+d+'" class="langItem" />').text(this[xe.current_lang]).data("multilang-name",b).appendTo(c)}),1<d(e)&&f.addClass("showChild"),f.find(".langList>li>a:first").click())});show_waiting_message=!0}}).delegate("button._btnLang",{click:function(){var b=a(this);k=!0;j.trigger("hide");b.closest(".multiLangEdit").find("input.vLang,textarea.vLang").eq(0).val(b.data("langkey")).end().eq(1).val(b.text()).end();
return!1},mousedown:function(){h=!0},focus:function(){a(this).mouseover()},mouseover:function(){a(this).closest("ul").find("button.active").removeClass("active")}});j=a('<div class="suggestion"><ul></ul></div>').bind("show",function(){a(this).show()}).bind("hide",function(){a(this).hide()});var m=0});
jQuery(function(a){a(".filebox").bind("before-open.mw",function(){function c(f){d.html(f.html);d.find(".lined .select").bind("click",function(){var c=a("input.select_checkbox:checked");0==c.length?(c=a(this).parent().find("img.filebox_item").attr("src"))?(b.trigger("filebox.selected",[c]),b.trigger("close.mw")):alert("None selected!"):(b.trigger("filebox.selected",[c]),b.trigger("close.mw"));return!1});d.find(".pagination").find("a").filter(function(){return a(this).hasClass("tgAnchor")?!1:!0}).bind("click",
function(){var b=a(this).attr("page");a.exec_json("module.getFileBoxListHtml",{page:b},c);a(window).scrollTop(a(g).find(".modalClose").offset().top);return!1});a("#FileBoxGoTo").find("button").bind("click",function(){var b=a(this).prev("input").val();a.exec_json("module.getFileBoxListHtml",{page:b},c);a(window).scrollTop(a(g).find(".modalClose").offset().top);return!1})}var b,d,g;b=a(this);g=b.attr("href");d=a(g).find(".filebox_list");a.exec_json("module.getFileBoxListHtml",{page:"1"},c)})});
function showWaitingFogLayer(){var a=jQuery('<span class="bg"></span>');a.height(jQuery(window).height());jQuery(".wfsr").wrap('<div class="wfsr_fog" />').before(a)}function hideWaitingFogLayer(){jQuery(".wfsr").prev("span").remove();jQuery(".wfsr").unwrap()}function doInstallModule(a){var c=[];c.module_name=a;exec_xml("install","procInstallAdminInstall",c,completeInstallModule);showWaitingFogLayer()}
function doUpdateModule(a){var c=[];c.module_name=a;exec_xml("install","procInstallAdminUpdate",c,completeInstallModule);showWaitingFogLayer()}function completeInstallModule(a){alert(a.message);location.reload()}jQuery(document).ready(function(a){a("body").ajaxComplete(function(){hideWaitingFogLayer()})});jQuery(function(a){0==a(".x>.body>.lnb").length&&a(".x>.body>.content").addClass("single")});