diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php
index d06d11e22..6467cada9 100644
--- a/classes/display/DisplayHandler.class.php
+++ b/classes/display/DisplayHandler.class.php
@@ -36,24 +36,26 @@
$layout_path = $oModule->getLayoutPath();
$layout_file = $oModule->getLayoutFile();
+ $edited_layout_file = $oModule->getEditedLayoutFile();
+
if(!$layout_path) $layout_path = './common/tpl/';
if(!$layout_file) $layout_file = 'default_layout.html';
- $zbxe_final_content = $oTemplate->compile($layout_path, $layout_file);
+
+ $zbxe_final_content = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
+
if(__DEBUG__==3) $GLOBALS['__layout_compile_elapsed__'] = getMicroTime()-$start;
// 각 플러그인, 에디터 컴포넌트의 코드 변경
if(__DEBUG__==3) $start = getMicroTime();
+
$oContext = &Context::getInstance();
$zbxe_final_content= $oContext->transContent($zbxe_final_content);
+
if(__DEBUG__==3) $GLOBALS['__trans_plugin_editor_elapsed__'] = getMicroTime()-$start;
// 최종 결과를 common_layout에 넣어버림
Context::set('zbxe_final_content', $zbxe_final_content);
$output = $oTemplate->compile('./common/tpl', 'common_layout');
-
- // rewrite module을 위한 코드
- // $output = preg_replace("/([0-9]+)\?(.*)/",'?\\2',$output);
-
} else {
$output = $content;
}
diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php
index 43a4685e2..75387700a 100644
--- a/classes/module/ModuleHandler.class.php
+++ b/classes/module/ModuleHandler.class.php
@@ -198,7 +198,6 @@
foreach($layout_info->extra_var as $var_id => $val) {
$layout_info->{$var_id} = $val->value;
}
- //unset($layout_info->extra_var);
}
// 레이아웃 정보중 menu를 Context::set
@@ -214,6 +213,10 @@
$oModule->setLayoutPath($layout_info->path);
$oModule->setLayoutFile('layout');
+
+ // 레이아웃이 수정되었을 경우 수정본을 지정
+ $edited_layout = sprintf('./files/cache/layout/%d.html', $layout_info->layout_srl);
+ if(file_exists($edited_layout)) $oModule->setEditedLayoutFile($edited_layout);
}
}
diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php
index 13f40bbc7..ce806c4f3 100644
--- a/classes/module/ModuleObject.class.php
+++ b/classes/module/ModuleObject.class.php
@@ -22,6 +22,7 @@
var $layout_path = ''; ///< 레이아웃 경로
var $layout_file = ''; ///< 레이아웃 파일
+ var $edited_layout_file = ''; ///< 관리자 모드에서 수정된 레이아웃 파일
var $stop_proc = false; ///< action 수행중 stop()를 호출하면 ModuleObject::proc()를 수행하지 않음
@@ -210,6 +211,21 @@
return $this->template_path;
}
+ /**
+ * @brief edited layout 파일 지정
+ **/
+ function setEditedLayoutFile($filename) {
+ if(substr($filename,-5)!='.html') $filename .= '.html';
+ $this->edited_layout_file = $filename;
+ }
+
+ /**
+ * @brief layout 파일 return
+ **/
+ function getEditedLayoutFile() {
+ return $this->edited_layout_file;
+ }
+
/**
* @brief layout 파일 지정
**/
diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php
index d205a6a16..8b7e41dca 100644
--- a/classes/template/TemplateHandler.class.php
+++ b/classes/template/TemplateHandler.class.php
@@ -33,22 +33,21 @@
/**
* @brief 주어진 tpl파일의 컴파일
**/
- function compile($tpl_path, $tpl_filename) {
- $this->tpl_path = $tpl_path;
-
+ function compile($tpl_path, $tpl_filename, $tpl_file = '') {
// 디버그를 위한 컴파일 시작 시간 저장
if(__DEBUG__==3) $start = getMicroTime();
// 변수 체크
- $this->tpl_path = ereg_replace('(\/+)$', '', $this->tpl_path).'/';
+ $tpl_path = ereg_replace('(\/+)$', '', $tpl_path).'/';
if(substr($tpl_filename,-5)!='.html') $tpl_filename .= '.html';
// tpl_file 변수 생성
- $tpl_file = $this->tpl_path.$tpl_filename;
+ if(!$tpl_file) $tpl_file = $tpl_path.$tpl_filename;
// tpl_file이 비어 있거나 해당 파일이 없으면 return
if(!$tpl_file || !file_exists($tpl_file)) return;
+ $this->tpl_path = $tpl_path;
$this->tpl_file = $tpl_file;
// compiled된(or 될) 파일이름을 구함
@@ -252,7 +251,8 @@
**/
function _compileImportCode($matches) {
// 현재 tpl 파일의 위치를 구해서 $base_path에 저장하여 적용하려는 xml file을 찾음
- $base_path = dirname($this->tpl_file).'/';
+ //$base_path = dirname($this->tpl_file).'/';
+ $base_path = $this->tpl_path;
$given_file = trim($matches[1]);
if(!$given_file) return;
diff --git a/modules/layout/conf/module.xml b/modules/layout/conf/module.xml
index 372f4ea09..1b1d88729 100644
--- a/modules/layout/conf/module.xml
+++ b/modules/layout/conf/module.xml
@@ -4,6 +4,7 @@