mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-02-01 01:29:58 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1318 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
19b9fd314f
commit
e1ecee7484
12 changed files with 147 additions and 16 deletions
|
|
@ -36,24 +36,26 @@
|
||||||
|
|
||||||
$layout_path = $oModule->getLayoutPath();
|
$layout_path = $oModule->getLayoutPath();
|
||||||
$layout_file = $oModule->getLayoutFile();
|
$layout_file = $oModule->getLayoutFile();
|
||||||
|
$edited_layout_file = $oModule->getEditedLayoutFile();
|
||||||
|
|
||||||
if(!$layout_path) $layout_path = './common/tpl/';
|
if(!$layout_path) $layout_path = './common/tpl/';
|
||||||
if(!$layout_file) $layout_file = 'default_layout.html';
|
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) $GLOBALS['__layout_compile_elapsed__'] = getMicroTime()-$start;
|
||||||
|
|
||||||
// 각 플러그인, 에디터 컴포넌트의 코드 변경
|
// 각 플러그인, 에디터 컴포넌트의 코드 변경
|
||||||
if(__DEBUG__==3) $start = getMicroTime();
|
if(__DEBUG__==3) $start = getMicroTime();
|
||||||
|
|
||||||
$oContext = &Context::getInstance();
|
$oContext = &Context::getInstance();
|
||||||
$zbxe_final_content= $oContext->transContent($zbxe_final_content);
|
$zbxe_final_content= $oContext->transContent($zbxe_final_content);
|
||||||
|
|
||||||
if(__DEBUG__==3) $GLOBALS['__trans_plugin_editor_elapsed__'] = getMicroTime()-$start;
|
if(__DEBUG__==3) $GLOBALS['__trans_plugin_editor_elapsed__'] = getMicroTime()-$start;
|
||||||
|
|
||||||
// 최종 결과를 common_layout에 넣어버림
|
// 최종 결과를 common_layout에 넣어버림
|
||||||
Context::set('zbxe_final_content', $zbxe_final_content);
|
Context::set('zbxe_final_content', $zbxe_final_content);
|
||||||
$output = $oTemplate->compile('./common/tpl', 'common_layout');
|
$output = $oTemplate->compile('./common/tpl', 'common_layout');
|
||||||
|
|
||||||
// rewrite module을 위한 코드
|
|
||||||
// $output = preg_replace("/([0-9]+)\?(.*)/",'?\\2',$output);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$output = $content;
|
$output = $content;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,6 @@
|
||||||
foreach($layout_info->extra_var as $var_id => $val) {
|
foreach($layout_info->extra_var as $var_id => $val) {
|
||||||
$layout_info->{$var_id} = $val->value;
|
$layout_info->{$var_id} = $val->value;
|
||||||
}
|
}
|
||||||
//unset($layout_info->extra_var);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 레이아웃 정보중 menu를 Context::set
|
// 레이아웃 정보중 menu를 Context::set
|
||||||
|
|
@ -214,6 +213,10 @@
|
||||||
|
|
||||||
$oModule->setLayoutPath($layout_info->path);
|
$oModule->setLayoutPath($layout_info->path);
|
||||||
$oModule->setLayoutFile('layout');
|
$oModule->setLayoutFile('layout');
|
||||||
|
|
||||||
|
// 레이아웃이 수정되었을 경우 수정본을 지정
|
||||||
|
$edited_layout = sprintf('./files/cache/layout/%d.html', $layout_info->layout_srl);
|
||||||
|
if(file_exists($edited_layout)) $oModule->setEditedLayoutFile($edited_layout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
var $layout_path = ''; ///< 레이아웃 경로
|
var $layout_path = ''; ///< 레이아웃 경로
|
||||||
var $layout_file = ''; ///< 레이아웃 파일
|
var $layout_file = ''; ///< 레이아웃 파일
|
||||||
|
var $edited_layout_file = ''; ///< 관리자 모드에서 수정된 레이아웃 파일
|
||||||
|
|
||||||
var $stop_proc = false; ///< action 수행중 stop()를 호출하면 ModuleObject::proc()를 수행하지 않음
|
var $stop_proc = false; ///< action 수행중 stop()를 호출하면 ModuleObject::proc()를 수행하지 않음
|
||||||
|
|
||||||
|
|
@ -210,6 +211,21 @@
|
||||||
return $this->template_path;
|
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 파일 지정
|
* @brief layout 파일 지정
|
||||||
**/
|
**/
|
||||||
|
|
|
||||||
|
|
@ -33,22 +33,21 @@
|
||||||
/**
|
/**
|
||||||
* @brief 주어진 tpl파일의 컴파일
|
* @brief 주어진 tpl파일의 컴파일
|
||||||
**/
|
**/
|
||||||
function compile($tpl_path, $tpl_filename) {
|
function compile($tpl_path, $tpl_filename, $tpl_file = '') {
|
||||||
$this->tpl_path = $tpl_path;
|
|
||||||
|
|
||||||
// 디버그를 위한 컴파일 시작 시간 저장
|
// 디버그를 위한 컴파일 시작 시간 저장
|
||||||
if(__DEBUG__==3) $start = getMicroTime();
|
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';
|
if(substr($tpl_filename,-5)!='.html') $tpl_filename .= '.html';
|
||||||
|
|
||||||
// tpl_file 변수 생성
|
// tpl_file 변수 생성
|
||||||
$tpl_file = $this->tpl_path.$tpl_filename;
|
if(!$tpl_file) $tpl_file = $tpl_path.$tpl_filename;
|
||||||
|
|
||||||
// tpl_file이 비어 있거나 해당 파일이 없으면 return
|
// tpl_file이 비어 있거나 해당 파일이 없으면 return
|
||||||
if(!$tpl_file || !file_exists($tpl_file)) return;
|
if(!$tpl_file || !file_exists($tpl_file)) return;
|
||||||
|
|
||||||
|
$this->tpl_path = $tpl_path;
|
||||||
$this->tpl_file = $tpl_file;
|
$this->tpl_file = $tpl_file;
|
||||||
|
|
||||||
// compiled된(or 될) 파일이름을 구함
|
// compiled된(or 될) 파일이름을 구함
|
||||||
|
|
@ -252,7 +251,8 @@
|
||||||
**/
|
**/
|
||||||
function _compileImportCode($matches) {
|
function _compileImportCode($matches) {
|
||||||
// 현재 tpl 파일의 위치를 구해서 $base_path에 저장하여 적용하려는 xml file을 찾음
|
// 현재 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]);
|
$given_file = trim($matches[1]);
|
||||||
if(!$given_file) return;
|
if(!$given_file) return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
<action name="dispLayoutAdminContent" type="view" admin_index="true" standalone="true" />
|
<action name="dispLayoutAdminContent" type="view" admin_index="true" standalone="true" />
|
||||||
<action name="dispLayoutAdminInsert" type="view" standalone="true" />
|
<action name="dispLayoutAdminInsert" type="view" standalone="true" />
|
||||||
<action name="dispLayoutAdminModify" type="view" standalone="true" />
|
<action name="dispLayoutAdminModify" type="view" standalone="true" />
|
||||||
|
<action name="dispLayoutAdminEdit" type="view" standalone="true" />
|
||||||
<action name="dispLayoutAdminDownloadedList" type="view" standalone="true" />
|
<action name="dispLayoutAdminDownloadedList" type="view" standalone="true" />
|
||||||
|
|
||||||
<action name="dispLayoutAdminInfo" type="view" standalone="true" />
|
<action name="dispLayoutAdminInfo" type="view" standalone="true" />
|
||||||
|
|
@ -11,5 +12,6 @@
|
||||||
<action name="procLayoutAdminInsert" type="controller" standalone="true" />
|
<action name="procLayoutAdminInsert" type="controller" standalone="true" />
|
||||||
<action name="procLayoutAdminUpdate" type="controller" standalone="true" />
|
<action name="procLayoutAdminUpdate" type="controller" standalone="true" />
|
||||||
<action name="procLayoutAdminDelete" type="controller" standalone="true" />
|
<action name="procLayoutAdminDelete" type="controller" standalone="true" />
|
||||||
|
<action name="procLayoutAdminCodeUpdate" type="controller" standalone="true" />
|
||||||
</actions>
|
</actions>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@
|
||||||
**/
|
**/
|
||||||
|
|
||||||
$lang->cmd_layout_management = '레이아웃 설정';
|
$lang->cmd_layout_management = '레이아웃 설정';
|
||||||
|
$lang->cmd_layout_edit = '레이아웃 편집';
|
||||||
|
$lang->cmd_preview = '미리 보기';
|
||||||
|
$lang->cmd_load_source = '원본 불러오기';
|
||||||
|
|
||||||
$lang->layout_name = '레이아웃 이름';
|
$lang->layout_name = '레이아웃 이름';
|
||||||
$lang->layout_maker = "레이아웃 제작자";
|
$lang->layout_maker = "레이아웃 제작자";
|
||||||
|
|
@ -21,4 +24,8 @@
|
||||||
$lang->about_title = '모듈에 연결시 쉽게 구분할 수 있는 제목을 입력해주세요';
|
$lang->about_title = '모듈에 연결시 쉽게 구분할 수 있는 제목을 입력해주세요';
|
||||||
|
|
||||||
$lang->about_layout = "레이아웃 모듈은 사이트의 레이아웃을 쉽게 만들 수 있도록 도와줍니다.\n레이아웃 설정과 메뉴의 연결을 통해서 다양한 모듈이 완성된 사이트의 모습으로 보여줄 수 있도록 합니다.\n* 삭제나 수정이 불가능한 레이아웃은 블로그나 기타 모듈의 자체 레이아웃이므로 해당 모듈로 가서 설정하셔야 합니다.";
|
$lang->about_layout = "레이아웃 모듈은 사이트의 레이아웃을 쉽게 만들 수 있도록 도와줍니다.\n레이아웃 설정과 메뉴의 연결을 통해서 다양한 모듈이 완성된 사이트의 모습으로 보여줄 수 있도록 합니다.\n* 삭제나 수정이 불가능한 레이아웃은 블로그나 기타 모듈의 자체 레이아웃이므로 해당 모듈로 가서 설정하셔야 합니다.";
|
||||||
|
$lang->about_layout_code =
|
||||||
|
"아래 레이아웃의 코드를 직접 수정후 저장하시면 서비스에 반영이 됩니다.
|
||||||
|
꼭 미리보기를 하신 후에 저장을 하세요.
|
||||||
|
제로보드XE의 템플릿 문법은 <a href=\"#\">[제로보드XE 템플릿]</a> 을 참고하시면 됩니다.";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
$oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminContent');
|
$oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminContent');
|
||||||
$oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminInsert');
|
$oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminInsert');
|
||||||
$oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminModify');
|
$oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminModify');
|
||||||
|
$oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminEdit');
|
||||||
$oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminDownloadedList');
|
$oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminDownloadedList');
|
||||||
$oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminInfo');
|
$oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminInfo');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,5 +115,19 @@
|
||||||
$output = executeQuery("layout.deleteLayout", $args);
|
$output = executeQuery("layout.deleteLayout", $args);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 레이아웃 코드 추가
|
||||||
|
**/
|
||||||
|
function procLayoutAdminCodeUpdate() {
|
||||||
|
$layout_srl = Context::get('layout_srl');
|
||||||
|
$code = Context::get('code');
|
||||||
|
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
|
||||||
|
|
||||||
|
$layout_file = sprintf('./files/cache/layout/%d.html', $layout_srl);
|
||||||
|
FileHandler::writeFile($layout_file, $code);
|
||||||
|
|
||||||
|
$this->setMessage('success_updated');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,36 @@
|
||||||
$this->setTemplateFile('layout_modify');
|
$this->setTemplateFile('layout_modify');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 레이아웃 코드 편집
|
||||||
|
**/
|
||||||
|
function dispLayoutAdminEdit() {
|
||||||
|
// 선택된 레이아웃의 정보르 구해서 세팅
|
||||||
|
$layout_srl = Context::get('layout_srl');
|
||||||
|
|
||||||
|
// 레이아웃의 정보를 가져옴
|
||||||
|
$oLayoutModel = &getModel('layout');
|
||||||
|
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||||
|
|
||||||
|
// 등록된 레이아웃이 없으면 오류 표시
|
||||||
|
if(!$layout_info) return $this->dispLayoutAdminContent();
|
||||||
|
Context::set('layout_info', $layout_info);
|
||||||
|
|
||||||
|
// 레이아웃 코드 가져오기
|
||||||
|
$layout_file = sprintf('./files/cache/layout/%d.html', $layout_info->layout_srl);
|
||||||
|
if(!file_exists($layout_file)) $layout_file = sprintf('%s%s', $layout_info->path, 'layout.html');
|
||||||
|
|
||||||
|
$layout_code = FileHandler::readFile($layout_file);
|
||||||
|
Context::set('layout_code', $layout_code);
|
||||||
|
|
||||||
|
// 플러그인 목록을 세팅
|
||||||
|
$oPluginModel = &getModel('plugin');
|
||||||
|
$plugin_list = $oPluginModel->getDownloadedPluginList();
|
||||||
|
Context::set('plugin_list', $plugin_list);
|
||||||
|
|
||||||
|
$this->setTemplateFile('layout_edit');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 레이아웃 목록을 보여줌
|
* @brief 레이아웃 목록을 보여줌
|
||||||
**/
|
**/
|
||||||
|
|
|
||||||
10
modules/layout/tpl/filter/update_layout_code.xml
Normal file
10
modules/layout/tpl/filter/update_layout_code.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<filter name="update_layout_code" module="layout" act="procLayoutAdminCodeUpdate" confirm_msg_code="confirm_submit">
|
||||||
|
<form>
|
||||||
|
<node target="layout_srl" required="true" />
|
||||||
|
<node target="code" required="true" />
|
||||||
|
</form>
|
||||||
|
<response>
|
||||||
|
<tag name="error" />
|
||||||
|
<tag name="message" />
|
||||||
|
</response>
|
||||||
|
</filter>
|
||||||
|
|
@ -1,8 +1,17 @@
|
||||||
<!--%import("js/layout_admin.js")-->
|
<!--%import("js/layout_admin.js")-->
|
||||||
|
|
||||||
|
<!-- 관리자 페이지용 메뉴 -->
|
||||||
<!--@if($module == 'admin')-->
|
<!--@if($module == 'admin')-->
|
||||||
<div style="margin-bottom:20px;">
|
<div style="margin-bottom:20px;">
|
||||||
<span <!--@if($act=='dispLayoutAdminContent')-->style="font-weight:bold"<!--@end-->>[<a href="{getUrl('act','dispLayoutAdminContent')}">{$lang->layout_list}</a>]</span>
|
<span <!--@if($act=='dispLayoutAdminContent')-->style="font-weight:bold"<!--@end-->>[<a href="{getUrl('act','dispLayoutAdminContent')}">{$lang->layout_list}</a>]</span>
|
||||||
<span <!--@if($act=='dispLayoutAdminDownloadedList')-->style="font-weight:bold"<!--@end-->>[<a href="{getUrl('act','dispLayoutAdminDownloadedList')}">{$lang->downloaded_list}</a>]</span>
|
<span <!--@if($act=='dispLayoutAdminDownloadedList')-->style="font-weight:bold"<!--@end-->>[<a href="{getUrl('act','dispLayoutAdminDownloadedList')}">{$lang->downloaded_list}</a>]</span>
|
||||||
</div>
|
</div>
|
||||||
|
<!--@end-->
|
||||||
|
|
||||||
|
<!-- 레이아웃 수정 메뉴 -->
|
||||||
|
<!--@if($layout_info)-->
|
||||||
|
<div style="margin-bottom:20px;">
|
||||||
|
<span <!--@if($act=='dispLayoutAdminModify')-->style="font-weight:bold"<!--@end-->>[<a href="{getUrl('act','dispLayoutAdminModify')}">{$lang->cmd_layout_management}</a>]</span>
|
||||||
|
<span <!--@if($act=='dispLayoutAdminEdit')-->style="font-weight:bold"<!--@end-->>[<a href="{getUrl('act','dispLayoutAdminEdit')}">{$lang->cmd_layout_edit}</a>]</span>
|
||||||
|
</div>
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
|
|
|
||||||
37
modules/layout/tpl/layout_edit.html
Normal file
37
modules/layout/tpl/layout_edit.html
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
<!--%import("filter/update_layout_code.xml")-->
|
||||||
|
|
||||||
|
<!--#include("header.html")-->
|
||||||
|
|
||||||
|
<div style="margin-bottom:10px;border:4px solid #DDDDDD;padding:5px;font-weight:bold;">
|
||||||
|
{$layout_info->title} ver {$layout_info->version} ({$layout_info->layout})
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom:10px;border:1px solid #DDDDDD;padding:5px;">
|
||||||
|
{nl2br($lang->about_layout_code)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom:10px;border:1px solid #DDDDDD;padding:5px;">
|
||||||
|
<div style="font-weight:bold">{$lang->plugin}</div>
|
||||||
|
<div>
|
||||||
|
<!--@foreach($plugin_list as $plugin)-->
|
||||||
|
[<a href="#" onclick="popopen('./?module=plugin&act=dispPluginGenerateCode&selected_plugin={$plugin->plugin}&module_srl={$module_srl}','GenerateCodeInPage');return false;">{$plugin->title}</a>]
|
||||||
|
<!--@end-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="margin-bottom:10px;">
|
||||||
|
<form id="fo_layout" action="./" method="get" onsubmit="return procFilter(this, update_layout_code)">
|
||||||
|
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<textarea name="code" style="width:99%;height:400px;border:2px solid #DDDDDD;">{htmlspecialchars($layout_code)}</textarea>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type="submit" value="{$lang->cmd_save}" />
|
||||||
|
<input type="button" value="{$lang->cmd_preview}" onclick="doPreviewLayoutCode('{$layout_srl}');return false" />
|
||||||
|
<input type="button" value="{$lang->cmd_load_source}" onclick="doResetLayoutCode('{$layout_srl}');return false" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue