diff --git a/common/lang/ko.lang.php b/common/lang/ko.lang.php index 86699e06a..5d2265552 100644 --- a/common/lang/ko.lang.php +++ b/common/lang/ko.lang.php @@ -161,6 +161,7 @@ $lang->success_voted = '추천되었습니다'; $lang->success_moved = '이동되었습니다'; $lang->success_sended = '발송되었습니다'; + $lang->success_reset = '초기화되었습니다'; $lang->fail_to_delete = '삭제되었습니다'; $lang->fail_to_move = '이동되었습니다'; @@ -173,6 +174,7 @@ $lang->confirm_vote = '추천하시겠습니까?'; $lang->confirm_delete = '삭제하시겠습니까?'; $lang->confirm_move = '이동하시겠습니까?'; + $lang->confirm_reset = '초기화 하시겠습니까??'; $lang->column_type = '형식'; $lang->column_type_list['text'] = '한줄 입력칸 (text)'; diff --git a/layouts/sample_layout_js_menu/conf/info.xml b/layouts/sample_layout_js_menu/conf/info.xml index f76c70272..35ccac867 100644 --- a/layouts/sample_layout_js_menu/conf/info.xml +++ b/layouts/sample_layout_js_menu/conf/info.xml @@ -26,6 +26,10 @@ 상단 제목 레이아웃의 상단에 표시할 제목을 입력하세요. + + 홈 페이지 URL + 로고나 제목을 클릭시에 이동할 홈 페이지 URL을 입력해 주세요. + diff --git a/layouts/sample_layout_js_menu/layout.html b/layouts/sample_layout_js_menu/layout.html index 1a558aeb3..211a16f8f 100644 --- a/layouts/sample_layout_js_menu/layout.html +++ b/layouts/sample_layout_js_menu/layout.html @@ -33,7 +33,7 @@ xe_layout_menu['bottom_menu'][1][{$first_key}] = { "text":"{htmlspecialchars($fi
diff --git a/layouts/sample_layout_php_menu/conf/info.xml b/layouts/sample_layout_php_menu/conf/info.xml index 3cad460ee..7946afeac 100644 --- a/layouts/sample_layout_php_menu/conf/info.xml +++ b/layouts/sample_layout_php_menu/conf/info.xml @@ -26,6 +26,10 @@ 상단 제목 레이아웃의 상단에 표시할 제목을 입력하세요. + + 홈 페이지 URL + 로고나 제목을 클릭시에 이동할 홈 페이지 URL을 입력해 주세요. + diff --git a/layouts/sample_layout_php_menu/layout.html b/layouts/sample_layout_php_menu/layout.html index 9319b4ef1..993667fbf 100644 --- a/layouts/sample_layout_php_menu/layout.html +++ b/layouts/sample_layout_php_menu/layout.html @@ -4,7 +4,7 @@
diff --git a/modules/layout/conf/module.xml b/modules/layout/conf/module.xml index 1b1d88729..4c4ea1050 100644 --- a/modules/layout/conf/module.xml +++ b/modules/layout/conf/module.xml @@ -6,12 +6,13 @@ - + + diff --git a/modules/layout/lang/ko.lang.php b/modules/layout/lang/ko.lang.php index f4b008c54..57fc05a34 100644 --- a/modules/layout/lang/ko.lang.php +++ b/modules/layout/lang/ko.lang.php @@ -8,7 +8,7 @@ $lang->cmd_layout_management = '레이아웃 설정'; $lang->cmd_layout_edit = '레이아웃 편집'; $lang->cmd_preview = '미리 보기'; - $lang->cmd_load_source = '원본 불러오기'; + $lang->cmd_reset = '초기화'; $lang->layout_name = '레이아웃 이름'; $lang->layout_maker = "레이아웃 제작자"; @@ -17,6 +17,7 @@ $lang->layout_list = '레이아웃 목록'; $lang->menu_count = '메뉴수'; $lang->downloaded_list = '다운로드 목록'; + $lang->layout_preview_content = '내용이 출력되는 부분입니다'; $lang->cmd_move_to_installed_list = "생성된 목록 보기"; diff --git a/modules/layout/layout.controller.php b/modules/layout/layout.controller.php index e4d1f0d63..cccfa3c9a 100644 --- a/modules/layout/layout.controller.php +++ b/modules/layout/layout.controller.php @@ -102,6 +102,9 @@ } } + $layout_file = sprintf('./files/cache/layout/%d.html', $layout_srl); + if(file_exists($layout_file)) @unlink($layout_file); + // 레이아웃 삭제 $args->layout_srl = $layout_srl; @@ -129,5 +132,18 @@ $this->setMessage('success_updated'); } + + /** + * @brief 레이아웃 코드 초기화 + **/ + function procLayoutAdminCodeReset() { + $layout_srl = Context::get('layout_srl'); + if(!$layout_srl) return new Object(-1, 'msg_invalid_request'); + + $layout_file = sprintf('./files/cache/layout/%d.html', $layout_srl); + @unlink($layout_file); + + $this->setMessage('success_reset'); + } } ?> diff --git a/modules/layout/layout.view.php b/modules/layout/layout.view.php index 2652f6b10..722300265 100644 --- a/modules/layout/layout.view.php +++ b/modules/layout/layout.view.php @@ -104,6 +104,62 @@ $this->setTemplateFile('downloaded_layout_list'); } + /** + * @brief 레이아웃 미리 보기 + **/ + function dispLayoutAdminPreview() { + $layout_srl = Context::get('layout_srl'); + $code = Context::get('code'); + + if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request'); + //$code = str_replace(array('<','>','"'), array('<','>','"'), $code); + + // 레이아웃 정보 가져오기 + $oLayoutModel = &getModel('layout'); + $layout_info = $oLayoutModel->getLayout($layout_srl); + if(!$layout_info) return new Object(-1, 'msg_invalid_request'); + + // 레이아웃 정보중 extra_vars의 이름과 값을 $layout_info에 입력 + if($layout_info->extra_var_count) { + foreach($layout_info->extra_var as $var_id => $val) { + $layout_info->{$var_id} = $val->value; + } + } + + // 레이아웃 정보중 menu를 Context::set + if($layout_info->menu_count) { + foreach($layout_info->menu as $menu_id => $menu) { + if(file_exists($menu->php_file)) @include($menu->php_file); + Context::set($menu_id, $menu); + } + } + + Context::set('layout_info', $layout_info); + Context::set('content', Context::getLang('layout_preview_content')); + + // 코드를 임시로 저장 + $edited_layout_file = sprintf('./files/cache/layout/tmp.tpl'); + FileHandler::writeFile($edited_layout_file, $code); + + // 컴파일 + $oTemplate = &TemplateHandler::getInstance(); + + $layout_path = $layout_info->path; + $layout_file = 'layout'; + + $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file); + + // 플러그인등을 변환 + $oContext = &Context::getInstance(); + $layout_tpl = $oContext->transContent($layout_tpl); + Context::set('layout_tpl', $layout_tpl); + + // 임시 파일 삭제 + @unlink($edited_layout_file); + + $this->setTemplateFile('layout_preview'); + } + /** * @brief 레이아웃의 상세 정보(conf/info.xml)를 팝업 출력 **/ diff --git a/modules/layout/tpl/filter/reset_layout_code.xml b/modules/layout/tpl/filter/reset_layout_code.xml new file mode 100644 index 000000000..84137846d --- /dev/null +++ b/modules/layout/tpl/filter/reset_layout_code.xml @@ -0,0 +1,10 @@ + +
+ + + + + + + +
diff --git a/modules/layout/tpl/layout_preview.html b/modules/layout/tpl/layout_preview.html new file mode 100644 index 000000000..a90895a2b --- /dev/null +++ b/modules/layout/tpl/layout_preview.html @@ -0,0 +1 @@ +{$layout_tpl}