From 4ab54bcda094c2c0f61d6b6737d0a3db6c9bf5e8 Mon Sep 17 00:00:00 2001 From: nagoon97 Date: Thu, 17 Jan 2013 05:38:24 +0000 Subject: [PATCH] Menu Selector git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12569 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/admin/tpl/js/admin.js | 35 ++++++++++++++++++++----- modules/document/tpl/declared_list.html | 21 +++++++++++++-- modules/document/tpl/document_list.html | 21 +++++++++++++-- 3 files changed, 66 insertions(+), 11 deletions(-) diff --git a/modules/admin/tpl/js/admin.js b/modules/admin/tpl/js/admin.js index 49e031f4b..c2cd17e8a 100644 --- a/modules/admin/tpl/js/admin.js +++ b/modules/admin/tpl/js/admin.js @@ -2256,11 +2256,27 @@ jQuery(function($){ return $.tmpl( sMenuTree, {Nodes:sResult} ).get()[0].outerHTML; } + + $.xeShowMenuSelectorIn = function($container){ + $.xeMenuSelectorVar.$container = $container; + var $btn = $container; + + $.xeMenuSelectorVar.bMultiSelect = ""+$btn.data('multiple') == "true"; + //{sMenuId":"578", "sMenuUrl":"page_ANom60", "sMenuTitle":"wwww", "sType":"WIDGET" } + $.xeMenuSelectorVar.aAllowedType = $.grep((""+($btn.data('allowedType') || "")).split(','), function(el){return el !== ""}); + $.xeMenuSelectorVar.aDisallowedType = $.grep((""+($btn.data('disallowedType') || "")).split(','), function(el){return el !== ""}); + $.xeMenuSelectorVar.aDisallowedType.push("_ROOT"); + $.xeMenuSelectorVar.aDisallowedType.push("_SHORTCUT"); -}); - - -jQuery(function($){ + $container.not('._eventBound').addClass('_eventBound').on('change', '.site_selector', function(ev){ + var sSiteSrl = $(this).val(); + $.xeShowMenuSelector($container.find('.tree'), sSiteSrl); + + $container.trigger('site_changed'); + }); + + $.exec_json('admin.getSiteAllList', {domain:""}, onSiteAllListCompleted); + } // 찾기 /* $t @@ -2287,7 +2303,9 @@ jQuery(function($){ } //bMultiSelect = //data-multiple - + + $.xeMenuSelectorVar.$container = $.xeMsgBox.$msgBox; + $.xeMsgBox.confirmDialog({ sTitle : xe.msg_select_menu, @@ -2323,10 +2341,12 @@ jQuery(function($){ function onSiteAllListCompleted(htRes){ var aSiteList = htRes.site_list; - $container = $('.x_modal._common .tree'); + //$container = $('.x_modal._common .tree'); + $container = $.xeMenuSelectorVar.$container.find('.tree'); // show and fill in - var $SiteSelector = $('.x_modal._common .site_selector'); + //var $SiteSelector = $('.x_modal._common .site_selector'); + var $SiteSelector = $.xeMenuSelectorVar.$container.find('.site_selector'); var nLen = aSiteList.length; if(nLen <= 1){ @@ -2402,6 +2422,7 @@ jQuery(function($){ $('.moduleTrigger').xeMenuSearch(); }); + //----------------menu selector end jQuery(function($){ diff --git a/modules/document/tpl/declared_list.html b/modules/document/tpl/declared_list.html index 3137464f6..0b54a062b 100644 --- a/modules/document/tpl/declared_list.html +++ b/modules/document/tpl/declared_list.html @@ -108,6 +108,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}'; +

{$lang->document_manager}:

@@ -138,8 +139,8 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';

{$lang->msg_select_menu}

{$lang->selected_document_move}

-
- <!-- Tree Here --> +
+
@@ -177,7 +178,23 @@ jQuery(function($){ if(thisValue == 'trash' || thisValue == 'delete' || thisValue == 'cancelDeclare'){ $modalBody.removeClass('showTree'); } else if(thisValue == 'move' || thisValue == 'copy') { + $.xeShowMenuSelectorIn($('._menuSelector')); + $modalBody.addClass('showTree'); + $tree = $('._menuSelector .tree'); + $tree.bind('select_node.jstree', function(a,b){ + var aSelected = []; + $tree.find('.jstree-clicked').each(function(idx, el){ + var htParam = $.parseJSON($(this).attr('data-param')); + aSelected.push({browser_title: htParam.sMenuTitle, mid: htParam.sMenuUrl, module_srl: htParam.sModuleSrl, menu_id: htParam.sMenuId, type: htParam.sType}); + //module_srl + }); + + $('#manageForm input[name=module_srl]').val(aSelected[0].module_srl); + }); + $('._menuSelector').bind('site_changed', function(){ + $('#manageForm input[name=module_srl]').val(''); + }); } } }); diff --git a/modules/document/tpl/document_list.html b/modules/document/tpl/document_list.html index 0338e972c..989a4452f 100644 --- a/modules/document/tpl/document_list.html +++ b/modules/document/tpl/document_list.html @@ -123,6 +123,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}'; +

{$lang->document_manager}:

@@ -149,8 +150,8 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
@@ -188,7 +189,23 @@ jQuery(function($){ if(thisValue == 'trash' || thisValue == 'delete'){ $modalBody.removeClass('showTree'); } else if(thisValue == 'move' || thisValue == 'copy') { + $.xeShowMenuSelectorIn($('._menuSelector')); + $modalBody.addClass('showTree'); + $tree = $('._menuSelector .tree'); + $tree.bind('select_node.jstree', function(a,b){ + var aSelected = []; + $tree.find('.jstree-clicked').each(function(idx, el){ + var htParam = $.parseJSON($(this).attr('data-param')); + aSelected.push({browser_title: htParam.sMenuTitle, mid: htParam.sMenuUrl, module_srl: htParam.sModuleSrl, menu_id: htParam.sMenuId, type: htParam.sType}); + //module_srl + }); + + $('#manageForm input[name=module_srl]').val(aSelected[0].module_srl); + }); + $('._menuSelector').bind('site_changed', function(){ + $('#manageForm input[name=module_srl]').val(''); + }); } } });