From 96a8e3ab626aa285434422c53e5548a4066cf216 Mon Sep 17 00:00:00 2001 From: nagoon97 Date: Mon, 7 Jan 2013 06:56:22 +0000 Subject: [PATCH] UI bug fix git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12517 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/admin/tpl/index.html | 5 -- modules/admin/tpl/js/admin.js | 69 ++++++++++++++++++++----- modules/document/tpl/document_list.html | 2 +- 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/modules/admin/tpl/index.html b/modules/admin/tpl/index.html index b5918d0ba..62c67ee73 100644 --- a/modules/admin/tpl/index.html +++ b/modules/admin/tpl/index.html @@ -1,9 +1,4 @@ - diff --git a/modules/admin/tpl/js/admin.js b/modules/admin/tpl/js/admin.js index 8618cc2b1..0825459d7 100644 --- a/modules/admin/tpl/js/admin.js +++ b/modules/admin/tpl/js/admin.js @@ -1979,7 +1979,7 @@ jQuery(function($){ $.template( "menuSelector_menuTree", '
    {{html Nodes}}
' ); $.template( "menuSelector_menuTreeNode", '
  • \ - ${MenuTitle}\ + ${MenuTitle}\ {{html SubTree}}\
  • ' ); //data-param=\'{ "sMenuId":"${MenuId}", "sMenuUrl":"${MenuUrl}", "sMenuTitle":"${MenuTitle}" }\' @@ -2048,10 +2048,29 @@ jQuery(function($){ } } + //console.log($(this).find('A._menu_node').css('visibility', 'hidden')); + $(this).find('A._menu_node').filter(function(nIdx, node){ + var $node = $(node); + + if(!isSelectable($node)){ + $node.css('opacity', '0.2'); + } + }); + //jstree-leaf }) .bind("select_node.jstree", function(event, data){ //console.log(data); //jstree-clicked + }) + .bind('before.jstree', function (event, data){ + if (data.func == 'select_node') { + $node = $(data.args[0]); + + if(!isSelectable($node)){ + event.stopImmediatePropagation(); + return false; + } + } }); // disable sitemap labels and shortcuts. @@ -2063,6 +2082,20 @@ jQuery(function($){ } */ } + + function isSelectable($node){ + //data-param:{sMenuId":"578", "sMenuUrl":"page_ANom60", "sMenuTitle":"wwww", "sType":"WIDGET" } + var htParam = $.parseJSON($node.attr('data-param')); + //console.log(htParam); + if($.xeMenuSelectorVar.aAllowedType.length > 0 && $.inArray(htParam.sType, $.xeMenuSelectorVar.aAllowedType) < 0){ + return false; + } + if($.inArray(htParam.sType, $.xeMenuSelectorVar.aDisallowedType) > -1){ + return false; + } + + return true; + } $.xeShowMenuSelector = function($container_param, site_srl_param, fnOnSelect_param, aSelectedModules_param){ var $ = jQuery; @@ -2119,6 +2152,8 @@ jQuery(function($){ aSubNode = aNode[i].menuItems.list; sTargetPanel = "#propertiesRoot"; + sModuleType = "_ROOT"; + break; case 2: @@ -2212,6 +2247,18 @@ jQuery(function($){ function xeMenuSearch(ev){ var $btn = $(ev.target); $.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 !== ""}); + + if($.inArray("page", $.xeMenuSelectorVar.aAllowedType) > -1){ + $.xeMenuSelectorVar.aAllowedType.push("ARTICLE", "WIDGET", "OUTSIDE"); + } + + if($.inArray("page", $.xeMenuSelectorVar.aDisallowedType) > -1){ + $.xeMenuSelectorVar.aDisallowedType.push("ARTICLE", "WIDGET", "OUTSIDE"); + } + //bMultiSelect = //data-multiple $.xeMsgBox.confirmDialog({ @@ -2251,19 +2298,6 @@ jQuery(function($){ $container = $('.x_modal._common .tree'); - //console.log(aSiteList); - /* - [ - { - domain : "nagoon97.xpressengine.com/maserati/" - site_srl : "0" - }, - { - domain : "nagoon97.xpressengine.com/maserati123/" - site_srl : "1" - }, - ] - */ var nLen = aSiteList.length; if(nLen <= 1){ // leave the site selector hidden @@ -2290,8 +2324,15 @@ jQuery(function($){ if(!id) id = '__module_search_' + tmpCount; tmpCount++; + var sMultiple = $this.attr('data-multiple'); + var sAllowedType = $this.attr('data-allowedType'); + var sDisallowedType = $this.attr('data-disallowedType'); + // add html var $btn = $('' + xe.cmd_find + ''); + $btn.data('multiple', sMultiple); + $btn.data('allowedType', sAllowedType); + $btn.data('disallowedType', sDisallowedType); var $displayInput = $(''); $this.after($btn).after(' ').after($displayInput).hide(); $btn.data('multiple', $(this).data('multiple')); diff --git a/modules/document/tpl/document_list.html b/modules/document/tpl/document_list.html index 6d7ab5418..007989bb3 100644 --- a/modules/document/tpl/document_list.html +++ b/modules/document/tpl/document_list.html @@ -142,7 +142,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';