From 94d216fe21f9abf6a4177f58a668214c74968102 Mon Sep 17 00:00:00 2001 From: nagoon97 Date: Thu, 11 Oct 2012 13:48:33 +0000 Subject: [PATCH] admin layout preview git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@11671 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/menu/tpl/sitemap.html | 238 ++++++++++++++++++++++++++++++---- 1 file changed, 212 insertions(+), 26 deletions(-) diff --git a/modules/menu/tpl/sitemap.html b/modules/menu/tpl/sitemap.html index a6cca4f5e..c06534e91 100644 --- a/modules/menu/tpl/sitemap.html +++ b/modules/menu/tpl/sitemap.html @@ -3,8 +3,9 @@ + - +

{$XE_VALIDATOR_MESSAGE}

@@ -99,7 +100,7 @@
  • - +
  • @@ -190,7 +191,7 @@
  • - +
  • @@ -285,14 +286,14 @@
    - +
    - +
    크게 보기 @@ -324,28 +325,19 @@ 사이트 기본 레이아웃 설정
    -
      -
    • +
        + +
      다른 레이아웃 설치 @@ -1152,6 +1145,19 @@ function setItemTypes(htTypes){ console.log($._xeAdminVar.htItemTypes); } jQuery(function($){ + $.fn.outerHTML = function(){ + + // IE, Chrome & Safari will comply with the non-standard outerHTML, all others (FF) will have a fall-back for cloning + return (!this.length) ? this : (this[0].outerHTML || ( + function(el){ + var div = document.createElement('div'); + div.appendChild(el.cloneNode(true)); + var contents = div.innerHTML; + div = null; + return contents; + })(this[0])); + } + var _hide = $.fn.hide; $.fn.hide = function(speed, easing, callback, htOpt) { $(this).trigger('hide', [htOpt]); @@ -1837,6 +1843,30 @@ jQuery(function($){ menu_item_srl : htInfo.sNodeSrl }; $.exec_json("module.getModuleInfoByMenuItemSrl", params, function(htData){ + /* + browser_title: "게시판" + content: "" + description: "" + footer_text: "" + header_text: "" + is_default: "N" + is_layout_fix: "Y" + is_skin_fix: "N" + layout_srl: "0" + mcontent: "" + menu_srl: "59" + mid: "board_CZEA8836" + mlayout_srl: "0" + module: "board" + module_category_srl: "0" + module_srl: "270" + mskin: "" + open_rss: "Y" + regdate: "20121009140036" + site_srl: "0" + skin: "" + use_mobile: "N" + */ console.log(htData); if(htData.error !== 0){ @@ -1855,9 +1885,17 @@ jQuery(function($){ htData : {} }; + updatePreview({ + sModuleName : htDesign.sModuleName, + sMID: htDesign.sMID, + sLayoutSrl : htDesign.sLayoutSrl, + sSkin : htDesign.sPCSkin + }); + /* var sURL = './?act=dispLayoutPreviewWithModule&module='+htDesign.sModuleName+'&mid='+htDesign.sMID+'&layout_srl='+htDesign.sLayoutSrl+'&skin='+htDesign.sPCSkin; $('._pc_preview').attr('src', sURL); $('._preview_form').attr('action', sURL); + */ }); //$('._pc_preview') @@ -1868,19 +1906,165 @@ jQuery(function($){ //layout_srl // }) + function updatePreview(htParam){ + if(htParam.bClearPrevSetting){ + $._xeAdminVar.htPrevSetting = {}; + } + var htSetting = $._xeAdminVar.htPrevSetting || {}; + + htSetting.sModuleName = htParam.sModuleName || htSetting.sModuleName || ""; + htSetting.sMID = htParam.sMID || htSetting.sMID || ""; + htSetting.sLayoutSrl = htParam.sLayoutSrl || htSetting.sLayoutSrl || ""; + htSetting.sSkin = htParam.sSkin || htSetting.sSkin || ""; + htSetting.bMobilePreviewTabOpen = htParam.bMobilePreviewTabOpen || htSetting.bMobilePreviewTabOpen || false; + htSetting.htLayoutData = htParam.htLayoutData || htSetting.htLayoutData || ""; + htSetting.htSkinData = htParam.htSkinData || htSetting.htSkinData || ""; + + var sURL = './?act=dispLayoutPreviewWithModule&module='+htSetting.sModuleName+'&mid='+htSetting.sMID+'&layout_srl='+htSetting.sLayoutSrl+'&skin='+htSetting.sSkin; + $('._preview_form').attr('action', sURL); + + var sTarget = "_pc_preview_ifr"; + if(htSetting.bMobilePreviewTabOpen) sTarget = "_mobile_preview_ifr"; + $('._preview_form').attr('target', sTarget); + $('._preview_form').submit(); + + $('._preview_form').attr('target', "xe_preview"); + + $._xeAdminVar.htPrevSetting = htSetting; + } + $('._pc_preview_open').click(function(ev){ - window.open($('._pc_preview').attr('src'), "xe_preview", "resizable=yes"); + window.open($('input[name=_pc_preview_ifr]').attr('src'), "xe_preview", "resizable=yes"); //ev.preventDefault(); // }); $('._mobile_preview_open').click(function(ev){ - window.open($('._mobile_preview').attr('src'), "xe_preview", "resizable=yes"); + window.open($('input[name=_mobile_preview_ifr]').attr('src'), "xe_preview", "resizable=yes"); //ev.preventDefault(); // }); $('#layout ._chkUseDefaultLayout').click(function(){ + updateLayoutListDisplayStatus(); }); + function updateLayoutListDisplayStatus(){ + $ChkBox = $('#layout ._chkUseDefaultLayout'); + if($ChkBox.attr('checked')){ + $('#layout .list').hide(); + + updatePreview({ + sLayoutSrl : -1, + htLayoutData : {} + }); + }else{ + $('#layout .list').show(); + } + } + $("#tmpl_layout_list_item_no_layout").template( "layoutListItem_nolayout" ); + $("#tmpl_layout_list_item").template( "layoutListItem" ); + $('#layout').on('show', function(ev){ + if(this !== ev.target){ + return; + } + + updateLayoutListDisplayStatus(); + //loadInstalledLayoutList("P"); + }); + $('#layout').on('hide', function(ev){ + if(this !== ev.target){ + return; + } + }); + $('#layout .list').on('show', function(){ + loadInstalledLayoutList("P"); + }); + + // sType: "P", "M" (PC/Mobile) + function loadInstalledLayoutList(sType){ + var params = { + site_srl : 0, + layout_type : sType + }; + $.exec_json("layout.getLayoutInstanceListForJSONP", params, function(htData){ + var sResult = ""; + //layout_list: Array[6] + /* + extra_vars: "" + layout: "user_layout" + layout_path: "" + layout_srl: "273" + layout_type: "P" + module_srl: "0" + regdate: "20121011112418" + site_srl: "0" + thumbnail: "./layouts/user_layout/thumbnail.png" + title: "테스트 레이아웃" + */ + var $List = $('#layout ._layout_list'); + $List.html(""); + + var sSelected = ""; + + var htDesign = $._xeAdminVar.htSelectedMenuDesign; + if(htDesign.sLayoutSrl == 0){ + sSelectedSrl = "0"; + sSelected = "selected"; + } + $List.append($.tmpl("layoutListItem_nolayout", { + Selected : sSelected + }).data('LayoutSrl', "0")); + + for(var i=0, nLen=htData.layout_list.length; i + + + +
    • + */ + } + $('#layout').on('click', 'button._btnScreenshot', function(){ + $(this).closest('li').find('input[name=layout_item]').click(); + }); + $('#layout').on('click', 'input[name=layout_item]', function(){ + $('#layout').find('li.selected').removeClass('selected'); + $(this).closest('li').addClass('selected'); + + var sLayoutSrl = $(this).closest('li').data('LayoutSrl'); + + updatePreview({ + sLayoutSrl : sLayoutSrl + }); + }) + $('._deleteMenu').click(function(){ confirmDialog({ sTitle : "메뉴를 삭제 하겠습니까?", @@ -2092,6 +2276,7 @@ setTimeout(function(){ // Theme(layout | skin) list toggle var $theme = $('.theme'); // layout, skin list toggle + /* $theme.find('.list').each(function(){ var $this = $(this); var $check = $this.prev('label').children('input:checkbox'); @@ -2105,6 +2290,7 @@ setTimeout(function(){ $(window).load(toggleList); $check.change(toggleList); }); + */ // .selected class toggle $theme.find(':radio').change(function(){ var $this = $(this);