english comments added

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0_english@8278 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
mosmartin 2011-04-06 16:48:06 +00:00
parent 693e215bc1
commit 4d272994dd
219 changed files with 6407 additions and 8705 deletions

View file

@ -2,23 +2,23 @@
/**
* @class layoutAdminController
* @author NHN (developers@xpressengine.com)
* @brief layout 모듈의 admin controller class
* @brief admin controller class of the layout module
**/
class layoutAdminController extends layout {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 레이아웃 신규 생성
* 레이아웃의 신규 생성은 제목만 받아서 layouts테이블에 입력함
* @brief Create a new layout
* Insert a title into "layouts" table in order to create a layout
**/
function procLayoutAdminInsert() {
// 레이아웃 생성과 관련된 기본 정보를 받음
// Get information to create a layout
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->layout_srl = getNextSequence();
@ -26,43 +26,37 @@
$args->title = Context::get('title');
$args->layout_type = Context::get('layout_type');
if(!$args->layout_type) $args->layout_type = "P";
// DB 입력
// Insert into the DB
$output = $this->insertLayout($args);
if(!$output->toBool()) return $output;
// faceOff 레이아웃일 경우 init 필요
// initiate if it is faceoff layout
$this->initLayout($args->layout_srl, $args->layout);
// 결과 리턴
// Return result
$this->add('layout_srl', $args->layout_srl);
}
// 레이아웃 정보를 DB에 입력
// Insert layout information into the DB
function insertLayout($args) {
$output = executeQuery("layout.insertLayout", $args);
return $output;
}
// faceOff 레이아웃을 경우 init
// Initiate if it is faceoff layout
function initLayout($layout_srl, $layout_name){
$oLayoutModel = &getModel('layout');
// faceOff일 경우 sample import
// Import a sample layout if it is faceoff
if($oLayoutModel->useDefaultLayout($layout_name)) {
$this->importLayout($layout_srl, $this->module_path.'tpl/faceOff_sample.tar');
// 디렉토리 제거
// Remove a directory
} else {
FileHandler::removeDir($oLayoutModel->getUserLayoutPath($layout_srl));
}
}
/**
* @brief 레이아웃 정보 변경
* 생성된 레이아웃의 제목과 확장변수(extra_vars) 적용한다
* @brief Update layout information
* Apply a title of the new layout and extra vars
**/
function procLayoutAdminUpdate() {
// module, act, layout_srl, layout, title을 제외하면 확장변수로 판단.. 좀 구리다..
// Consider the rest of items as extra vars, except module, act, layout_srl, layout, and title .. Some gurida ..
$extra_vars = Context::getRequestVars();
unset($extra_vars->module);
unset($extra_vars->act);
@ -73,8 +67,7 @@
unset($extra_vars->apply_mobile_view);
$args = Context::gets('layout_srl','title');
// 레이아웃의 정보를 가져옴
// Get layout information
$oLayoutModel = &getModel('layout');
$oMenuAdminModel = &getAdminModel('menu');
$layout_info = $oLayoutModel->getLayout($args->layout_srl);
@ -124,56 +117,46 @@
}
}
}
// extra_vars의 type이 image일 경우 별도 처리를 해줌
// Separately handle if a type of extra_vars is an image
if($layout_info->extra_var) {
foreach($layout_info->extra_var as $name => $vars) {
if($vars->type!='image') continue;
$image_obj = $extra_vars->{$name};
$extra_vars->{$name} = $layout_info->extra_var->{$name}->value;
// 삭제 요청에 대한 변수를 구함
// Get a variable on a request to delete
$del_var = $extra_vars->{"del_".$name};
unset($extra_vars->{"del_".$name});
// 삭제 요청이 있거나, 새로운 파일이 업로드 되면, 기존 파일 삭제
// Delete the old file if there is a request to delete or a new file is uploaded
if($del_var == 'Y' || $image_obj['tmp_name']) {
FileHandler::removeFile($extra_vars->{$name});
$extra_vars->{$name} = '';
if($del_var == 'Y' && !$image_obj['tmp_name']) continue;
}
// 정상적으로 업로드된 파일이 아니면 무시
// Ignore if the file is not successfully uploaded
if(!$image_obj['tmp_name'] || !is_uploaded_file($image_obj['tmp_name'])) continue;
// 이미지 파일이 아니어도 무시 (swf는 패스~)
// Ignore if the file is not an image (swf the paths ~)
if(!preg_match("/\.(jpg|jpeg|gif|png|swf)$/i", $image_obj['name'])) continue;
// 경로를 정해서 업로드
// Upload the file to a path
$path = sprintf("./files/attach/images/%s/", $args->layout_srl);
// 디렉토리 생성
// Create a directory
if(!FileHandler::makeDir($path)) continue;
$filename = $path.$image_obj['name'];
// 파일 이동
// Move the file
if(!move_uploaded_file($image_obj['tmp_name'], $filename)) continue;
$extra_vars->{$name} = $filename;
}
}
// header script를 레이아웃 모듈의 config에 저장
// Save header script into "config" of layout module
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
$layout_config->header_script = Context::get('header_script');
$oModuleController->insertModulePartConfig('layout',$args->layout_srl,$layout_config);
//menu의 title도 저장하자
// Save a title of the menu
$extra_vars->menu_name_list = $menu_name_list;
// DB에 입력하기 위한 변수 설정
// Variable setting for DB insert
$args->extra_vars = serialize($extra_vars);
$output = $this->updateLayout($args);
@ -196,8 +179,8 @@
}
/**
* @brief 레이아웃 삭제
* 삭제시 메뉴 xml 캐시 파일도 삭제
* @brief Delete Layout
* Delete xml cache file too when deleting a layout
**/
function procLayoutAdminDelete() {
$layout_srl = Context::get('layout_srl');
@ -212,8 +195,7 @@
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_srl);
if(file_exists($layout_file)) FileHandler::removeFile($layout_file);
// 레이아웃 삭제
// Delete Layout
$args->layout_srl = $layout_srl;
$output = executeQuery("layout.deleteLayout", $args);
if(!$output->toBool()) return $output;
@ -222,7 +204,7 @@
}
/**
* @brief 레이아웃 코드 추가
* @brief Adding Layout Code
**/
function procLayoutAdminCodeUpdate() {
$layout_srl = Context::get('layout_srl');
@ -248,7 +230,7 @@
}
/**
* @brief 레이아웃 코드 초기화
* @brief Reset layout code
**/
function procLayoutAdminCodeReset() {
$layout_srl = Context::get('layout_srl');
@ -274,7 +256,7 @@
/**
* @brief 레이아웃 설정페이지 -> 이미지 업로드
* @brief Layout setting page -> Upload an image
*
**/
function procLayoutAdminUserImageUpload(){
@ -294,7 +276,7 @@
}
/**
* @brief 레이아웃 설정페이지 -> 이미지 업로드
* @brief Layout setting page -> Upload an image
*
**/
function insertUserLayoutImage($layout_srl,$source){
@ -315,7 +297,7 @@
/**
* @brief 레이아웃 설정페이지 -> 이미지 삭제
* @brief Layout setting page -> Delete an image
*
**/
function removeUserLayoutImage($layout_srl,$filename){
@ -325,7 +307,7 @@
}
/**
* @brief 레이아웃 설정페이지 -> 이미지 삭제
* @brief Layout setting page -> Delete an image
*
**/
function procLayoutAdminUserImageDelete(){
@ -337,8 +319,8 @@
/**
* @brief 레이아웃 설정 저장
* ini 저장한다 faceoff
* @brief Save layout configuration
* save in "ini" format for faceoff
**/
function procLayoutAdminUserValueInsert(){
$oModuleModel = &getModel('module');
@ -387,7 +369,7 @@
}
/**
* @brief 레이아웃 설정 ini 저장
* @brief Layout setting, save "ini"
*
**/
function insertUserLayoutValue($layout_srl,$arr){
@ -401,7 +383,7 @@
}
/**
* @brief faceoff용 위젯코드를 사용자 layout 파일에 직접 추가한다
* @brief Add the widget code for faceoff into user layout file
*
**/
function addExtension($layout_srl,$arg,$content){
@ -426,7 +408,7 @@
/**
* @brief faceoff용 temp file들을 지운다
* @brief Delete temp files for faceoff
*
**/
function deleteUserLayoutTempFile($layout_srl){
@ -446,12 +428,10 @@
if(!$layout_srl) return new Object('-1','msg_invalid_request');
require_once(_XE_PATH_.'libs/tar.class.php');
// 압축할 파일 목록을 가져온다
// Get a list of files to zip
$oLayoutModel = &getModel('layout');
$file_list = $oLayoutModel->getUserLayoutFileList($layout_srl);
// 압축을 한다.
// Compress the files
$tar = new tar();
$user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl));
chdir($user_layout_path);
@ -468,8 +448,7 @@
header('Content-Disposition: attachment; filename="'. $filename .'"');
header("Content-Transfer-Encoding: binary\n");
echo $stream;
// Context를 강제로 닫고 종료한다.
// Close Context and then exit
Context::close();
exit();
}
@ -508,16 +487,14 @@
FileHandler::makeDir($image_path);
$tar = new tar();
$tar->openTAR($source_file);
// layout.ini 파일이 없으면
// If layout.ini file does not exist
if(!$tar->getFile('layout.ini')) return;
$replace_path = getNumberingPath($layout_srl,3);
foreach($tar->files as $key => $info) {
FileHandler::writeFile($user_layout_path . $info['name'],str_replace('__LAYOUT_PATH__',$replace_path,$info['file']));
}
// 업로드한 파일을 삭제
// Remove uploaded file
FileHandler::removeFile($source_file);
}
}

View file

@ -2,20 +2,20 @@
/**
* @class layoutAdminView
* @author NHN (developers@xpressengine.com)
* @brief layout 모듈의 admin view class
* @brief admin view class of the layout module
**/
class layoutAdminView extends layout {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 레이아웃 관리의 페이지
* @brief The first page of the layout admin
**/
function dispLayoutAdminContent() {
$oLayoutModel = &getModel('layout');
@ -35,11 +35,11 @@
}
/**
* @brief 레이아웃 등록 페이지
* 1차적으로 레이아웃만 선택한 DB 값을 넣고 상세 설정하는 단계를 거침
* @brief Layout setting page
* Once select a layout with empty value in the DB, then adjust values
**/
function dispLayoutAdminInsert() {
// 레이아웃 목록을 세팅
// Set layout list
$oLayoutModel = &getModel('layout');
$layout_type = Context::get('layout_type');
$layout_list = $oLayoutModel->getDownloadedLayoutList($layout_type);
@ -49,25 +49,20 @@
}
/**
* @brief 레이아웃 세부 정보 입력
* @brief Insert Layout details
**/
function dispLayoutAdminModify() {
// 선택된 레이아웃의 정보르 구해서 세팅
// Set the layout after getting layout information
$layout_srl = Context::get('layout_srl');
// 레이아웃의 정보를 가져옴
// Get layout information
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayout($layout_srl);
// 등록된 레이아웃이 없으면 오류 표시
// Error appears if there is no layout information is registered
if(!$layout_info) return $this->dispLayoutAdminContent();
// faceoff면 경로를 보여줄 필요는 없다
// If faceoff, no need to display the path
if($layout_info->type == 'faceoff') unset($layout_info->path);
Context::set('selected_layout', $layout_info);
// 메뉴 목록을 가져옴
// Get a menu list
$oMenuAdminModel = &getAdminModel('menu');
$menu_list = $oMenuAdminModel->getMenus();
Context::set('menu_list', $menu_list);
@ -76,25 +71,22 @@
}
/**
* @brief 레이아웃 코드 편집
* @brief Edit layout codes
**/
function dispLayoutAdminEdit() {
// 선택된 레이아웃의 정보르 구해서 세팅
// Set the layout with its information
$layout_srl = Context::get('layout_srl');
// 레이아웃의 정보를 가져옴
// Get layout information
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayout($layout_srl);
// 등록된 레이아웃이 없으면 오류 표시
// Error appears if there is no layout information is registered
if(!$layout_info) return $this->dispLayoutAdminContent();
Context::set('selected_layout', $layout_info);
// 레이아웃 코드 가져오기
// Get Layout Code
$oLayoutModel = &getModel('layout');
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
if(!file_exists($layout_file)){
// faceoff
// If faceoff
if($oLayoutModel->useDefaultLayout($layout_info->layout_srl)){
$layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
}else{
@ -117,8 +109,7 @@
$layout_image_path = $oLayoutModel->getUserLayoutImagePath($layout_info->layout_srl);
Context::set('layout_image_path', $layout_image_path);
// 위젯 목록을 세팅
// Set widget list
$oWidgetModel = &getModel('widget');
$widget_list = $oWidgetModel->getDownloadedWidgetList();
Context::set('widget_list', $widget_list);
@ -127,10 +118,10 @@
}
/**
* @brief 레이아웃 목록을 보여줌
* @brief Display a layout list
**/
function dispLayoutAdminDownloadedList() {
// 레이아웃 목록을 세팅
// Set a layout list
$oLayoutModel = &getModel('layout');
$layout_list = $oLayoutModel->getDownloadedLayoutList();
Context::set('layout_list', $layout_list);
@ -139,7 +130,7 @@
}
function dispLayoutAdminDownloadedMobileList() {
// 레이아웃 목록을 세팅
// Set a layout list
$oLayoutModel = &getModel('layout');
$layout_list = $oLayoutModel->getDownloadedLayoutList(0, "M");
Context::set('layout_list', $layout_list);
@ -148,33 +139,28 @@
}
/**
* @brief 레이아웃 미리 보기
* @brief Preview a layout
**/
function dispLayoutAdminPreview() {
$layout_srl = Context::get('layout_srl');
$code = Context::get('code');
$code_css = Context::get('code_css');
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
// 레이아웃 정보 가져오기
// Get the layout information
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayout($layout_srl);
if(!$layout_info) return new Object(-1, 'msg_invalid_request');
// faceoff 레이아웃일 경우 별도 처리
// Separately handle the layout if its type is faceoff
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
// 직접 입력된 CSS 적용
// Apply CSS directly
Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
// 레이아웃 정보중 extra_vars의 이름과 값을 $layout_info에 입력
// Set names and values of extra_vars to $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
// menu in layout information becomes an argument for 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);
@ -184,12 +170,10 @@
Context::set('layout_info', $layout_info);
Context::set('content', Context::getLang('layout_preview_content'));
// 코드를 임시로 저장
// Temporary save the codes
$edited_layout_file = sprintf('./files/cache/layout/tmp.tpl');
FileHandler::writeFile($edited_layout_file, $code);
// 컴파일
// Compile
$oTemplate = &TemplateHandler::getInstance();
$layout_path = $layout_info->path;
@ -197,44 +181,39 @@
$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
Context::set('layout','none');
// 위젯등을 변환
// Convert widgets and others
$oContext = &Context::getInstance();
Context::set('layout_tpl', $layout_tpl);
// 임시 파일 삭제
// Delete Temporary Files
FileHandler::removeFile($edited_layout_file);
$this->setTemplateFile('layout_preview');
}
/**
* @brief 레이아웃의 상세 정보(conf/info.xml) 팝업 출력
* @brief Pop-up details of the layout(conf/info.xml)
**/
function dispLayoutAdminInfo() {
// 선택된 레이아웃 정보를 구함
// Get the layout information
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
Context::set('layout_info', $layout_info);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('layout_detail_info');
}
/**
* @brief faceoff의 관리자 layout 수정
* @brief Modify admin layout of faceoff
**/
function dispLayoutAdminLayoutModify(){
//layout_srl 를 가져온다
// Get layout_srl
$current_module_info = Context::get('current_module_info');
$layout_srl = $current_module_info->layout_srl;
// 파일로 임시저장을 하기때문에 남아 있을지 모르는 tmp를 지운다
// to do 개선이 필요
// Remove the remaining tmp files because of temporarily saving
// This part needs to be modified
$delete_tmp = Context::get('delete_tmp');
if($delete_tmp =='Y'){
$oLayoutAdminController = &getAdminController('layout');
@ -242,11 +221,9 @@
}
$oLayoutModel = &getModel('layout');
// layout file들은 temp로 사용한다.
// layout file is used as a temp.
$oLayoutModel->setUseUserLayoutTemp();
// css 를 inline style로 뽑는다
// Apply CSS in inline style
$faceoffcss = $oLayoutModel->_getUserLayoutFaceOffCss($current_module_info->layout_srl);
$css = FileHandler::readFile($faceoffcss);
@ -267,24 +244,20 @@
$oTemplate = &TemplateHandler::getInstance();
Context::set('content', $oTemplate->compile($this->module_path.'tpl','about_faceoff'));
// 위젯 코드를 Javascript 수정모드로 변경
// Change widget codes in Javascript mode
$oWidgetController = &getController('widget');
$oWidgetController->setWidgetCodeInJavascriptMode();
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('faceoff_layout_edit');
}
function dispLayoutAdminLayoutImageList(){
$layout_srl = Context::get('layout_srl');
$oLayoutModel = &getModel('layout');
// 이미지 목록
// Image List
$layout_image_list = $oLayoutModel->getUserLayoutImageList($layout_srl);
Context::set('layout_image_list',$layout_image_list);
// 경로
// Path
$layout_image_path = $oLayoutModel->getUserLayoutImagePath($layout_srl);
Context::set('layout_image_path',$layout_image_path);

View file

@ -2,31 +2,29 @@
/**
* @class layout
* @author NHN (developers@xpressengine.com)
* @brief layout 모듈의 high class
* @brief high class of the layout module
**/
class layout extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// 레이아웃에서 사용할 디렉토리 생성
// Create a directory to be used in the layout
FileHandler::makeDir('./files/cache/layout');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oDB = &DB::getInstance();
// 2009. 02. 11 layout 테이블에 site_srl 추가
// 2009. 02. 11 Add site_srl to layout table
if(!$oDB->isColumnExists('layouts', 'site_srl')) return true;
// 2009. 02. 26 faceOff에 맞춰 기존 레이아웃 편집본을 이동
// 2009. 02. 26 Move the previous layout for faceoff
$files = FileHandler::readDir('./files/cache/layout');
for($i=0,$c=count($files);$i<$c;$i++) {
$filename = $files[$i];
@ -39,17 +37,15 @@
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
// 2009. 02. 11 menu 테이블에 site_srl 추가
// 2009. 02. 11 Add site_srl to menu table
if(!$oDB->isColumnExists('layouts', 'site_srl')) {
$oDB->addColumn('layouts','site_srl','number',11,0,true);
}
// 2009. 02. 26 faceOff에 맞춰 기존 레이아웃 편집본을 이동
// 2009. 02. 26 Move the previous layout for faceoff
$oLayoutModel = &getModel('layout');
$files = FileHandler::readDir('./files/cache/layout');
for($i=0,$c=count($files);$i<$c;$i++) {
@ -72,10 +68,10 @@
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
// 레이아웃 캐시 삭제 (수정본은 지우지 않음)
// Remove layout cache(modified layout is not deleted)
$path = './files/cache/layout';
if(!is_dir($path)) {
FileHandler::makeDir($path);

View file

@ -3,21 +3,21 @@
* @class layoutModel
* @author NHN (developers@xpressengine.com)
* @version 0.1
* @brief layout 모듈의 Model class
* @brief Model class of the layout module
**/
class layoutModel extends layout {
var $useUserLayoutTemp = null;
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief DB 생성된 레이아웃의 목록을 구함
* 생성되었다는 것은 DB에 등록이 되었다는 것을 의미
* @brief Get a layout list created in the DB
* If you found a new list, it means that the layout list is inserted to the DB
**/
function getLayoutList($site_srl = 0, $layout_type="P") {
if(!$site_srl) {
@ -33,22 +33,21 @@
}
/**
* @brief DB 생성된 한개의 레이아웃 정보를 구함
* 생성된 레이아웃의 DB정보+XML정보를 return
* @brief Get one of layout information created in the DB
* Return DB info + XML info of the generated layout
**/
function getLayout($layout_srl) {
// 일단 DB에서 정보를 가져옴
// Get information from the DB
$args->layout_srl = $layout_srl;
$output = executeQuery('layout.getLayout', $args);
if(!$output->data) return;
// layout, extra_vars를 정리한 후 xml 파일 정보를 정리해서 return
// Return xml file informaton after listing up the layout and extra_vars
$layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type);
return $layout_info;
}
/**
* @brief 레이아웃의 경로를 구함
* @brief Get a layout path
**/
function getLayoutPath($layout_name, $layout_type = "P") {
if($layout_name == 'faceoff'){
@ -65,11 +64,11 @@
}
/**
* @brief 레이아웃의 종류와 정보를 구함
* 다운로드되어 있는 레이아웃의 종류 (생성과 다른 의미)
* @brief Get a type and information of the layout
* A type of downloaded layout
**/
function getDownloadedLayoutList($layout_type = "P") {
// 다운받은 레이아웃과 설치된 레이아웃의 목록을 구함
// Get a list of downloaded layout and installed layout
if($layout_type == "M")
{
$directory = "./m.layouts";
@ -84,13 +83,11 @@
if(!$searched_count) return;
natcasesort($searched_list);
// 찾아진 레이아웃 목록을 loop돌면서 필요한 정보를 간추려 return
// Return information for looping searched list of layouts
for($i=0;$i<$searched_count;$i++) {
// 레이아웃의 이름
// Name of the layout
$layout = $searched_list[$i];
// 해당 레이아웃의 정보를 구함
// Get information of the layout
$layout_info = $this->getLayoutInfo($layout, null, $layout_type);
$list[] = $layout_info;
@ -99,8 +96,8 @@
}
/**
* @brief 모듈의 conf/info.xml 읽어서 정보를 구함
* 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다..
* @brief Get information by reading conf/info.xml in the module
* It uses caching to reduce time for xml parsing ..
**/
function getLayoutInfo($layout, $info = null, $layout_type = "P") {
if($info) {
@ -115,12 +112,10 @@
$xml_file = sprintf('%sskin.xml', $layout_path);
}
}
// 요청된 모듈의 경로를 구한다. 없으면 return
// Get a path of the requested module. Return if not exists.
if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type);
if(!is_dir($layout_path)) return;
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
// Read the xml file for module skin information
if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path);
if(!file_exists($xml_file)) {
$layout_info->layout = $layout;
@ -130,8 +125,7 @@
$layout_info->layout_type = $layout_type;
return $layout_info;
}
// cache 파일을 비교하여 문제 없으면 include하고 $layout_info 변수를 return
// Include the cache file if it is valid and then return $layout_info variable
if(!$layout_srl){
$cache_file = $this->getLayoutCache($layout, Context::getLangType());
}else{
@ -149,8 +143,7 @@
}
return $layout_info;
}
// cache 파일이 없으면 xml parsing하고 변수화 한 후에 캐시 파일에 쓰고 변수 바로 return
// If no cache file exists, parse the xml and then return the variable.
$oXmlParser = new XmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout;
@ -162,7 +155,7 @@
$buff .= sprintf('$layout_info->site_srl = "%s";', $site_srl);
if($xml_obj->version && $xml_obj->attrs->version == '0.2') {
// 레이아웃의 제목, 버전
// Layout title, version and other information
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$buff .= sprintf('$layout_info->layout = "%s";', $layout);
@ -178,8 +171,7 @@
$buff .= sprintf('$layout_info->license = "%s";', $xml_obj->license->body);
$buff .= sprintf('$layout_info->license_link = "%s";', $xml_obj->license->attrs->link);
$buff .= sprintf('$layout_info->layout_type = "%s";', $layout_type);
// 작성자 정보
// Author information
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
else $author_list = $xml_obj->author;
@ -188,10 +180,7 @@
$buff .= sprintf('$layout_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
$buff .= sprintf('$layout_info->author['.$i.']->homepage = "%s";', $author_list[$i]->attrs->link);
}
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
// Extra vars (user defined variables to use in a template)
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
@ -239,8 +228,7 @@
}
}
}
// 메뉴
// Menu
if($xml_obj->menus->menu) {
$menus = $xml_obj->menus->menu;
if(!is_array($menus)) $menus = array($menus);
@ -297,8 +285,7 @@
} else {
// 레이아웃의 제목, 버전
// Layout title, version and other information
sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$buff .= sprintf('$layout_info->layout = "%s";', $layout);
@ -309,13 +296,11 @@
$buff .= sprintf('$layout_info->date = "%s";', $date);
$buff .= sprintf('$layout_info->layout_srl = $layout_srl;');
$buff .= sprintf('$layout_info->layout_title = $layout_title;');
// 작성자 정보
// Author information
$buff .= sprintf('$layout_info->author[0]->name = "%s";', $xml_obj->author->name->body);
$buff .= sprintf('$layout_info->author[0]->email_address = "%s";', $xml_obj->author->attrs->email_address);
$buff .= sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link);
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
// Extra vars (user defined variables to use in a template)
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
@ -350,8 +335,7 @@
}
}
}
// 메뉴
// Menu
if($xml_obj->menus->menu) {
$menus = $xml_obj->menus->menu;
if(!is_array($menus)) $menus = array($menus);
@ -389,7 +373,7 @@
/**
* @brief layout설정화면에서의 업로드한 이미지목록을 반환한다
* @brief Return a list of images which are uploaded on the layout setting page
**/
function getUserLayoutImageList($layout_srl){
$path = $this->getUserLayoutImagePath($layout_srl);
@ -399,7 +383,7 @@
/**
* @brief ini config들을 가져온다 array다.
* @brief Get ini configurations and make them an array.
**/
function getUserLayoutIniConfig($layout_srl, $layout_name=null){
$file = $this->getUserLayoutIni($layout_srl);
@ -426,7 +410,7 @@
}
/**
* @brief user layout css 관리자가 설정화면에서 저장한 css
* @brief css which is set by an administrator on the layout setting page
**/
function getUserLayoutCss($layout_srl){
return $this->getUserLayoutPath($layout_srl). 'layout.css';
@ -434,7 +418,7 @@
/**
* @brief faceoff용 css module handler에서 import 한다
* @brief Import faceoff css from css module handler
**/
function getUserLayoutFaceOffCss($layout_srl){
$src = $this->_getUserLayoutFaceOffCss($layout_srl);
@ -444,7 +428,7 @@
/**
* @brief faceoff용 css module handler에서 import 한다
* @brief Import faceoff css from css module handler
**/
function _getUserLayoutFaceOffCss($layout_srl){
return $this->getUserLayoutPath($layout_srl). 'faceoff.css';
@ -504,7 +488,7 @@
/**
* @brief user layout cache
* todo 파일 자체를 삭제 필요가 있다
* todo It may need to remove the file itself
**/
function getUserLayoutCache($layout_srl,$lang_type){
return $this->getUserLayoutPath($layout_srl). "{$lang_type}.cache.php";
@ -518,28 +502,28 @@
}
/**
* @brief default layout ini 사용자의 임의 수정을 막기 위해
* @brief default layout ini to prevent arbitrary changes by a user
**/
function getDefaultLayoutIni($layout_name){
return $this->getDefaultLayoutPath($layout_name). 'layout.ini';
}
/**
* @brief default layout html 사용자의 임의 수정을 막기 위해
* @brief default layout html to prevent arbitrary changes by a user
**/
function getDefaultLayoutHtml($layout_name){
return $this->getDefaultLayoutPath($layout_name). 'layout.html';
}
/**
* @brief default layout css 사용자의 임의 수정을 막기 위해
* @brief default layout css to prevent arbitrary changes by a user
**/
function getDefaultLayoutCss($layout_name){
return $this->getDefaultLayoutPath($layout_name). 'css/layout.css';
}
/**
* @brief default layout path 사용자의 임의 수정을 막기 위해
* @brief default layout path to prevent arbitrary changes by a user
**/
function getDefaultLayoutPath() {
return "./modules/layout/faceoff/";
@ -547,7 +531,7 @@
/**
* @brief faceoff 인지
* @brief faceoff is
**/
function useDefaultLayout($layout_name){
$info = $this->getLayoutInfo($layout_name);
@ -557,7 +541,7 @@
/**
* @brief User Layout 임시 저장 모드로
* @brief Set user layout as temporary save mode
**/
function setUseUserLayoutTemp($flag='temp'){
$this->useUserLayoutTemp = $flag;
@ -565,7 +549,7 @@
/**
* @brief User Layout 임시 저장 파일 목록.
* @brief Temp file list for User Layout
**/
function getUserLayoutTempFileList($layout_srl){
$file_list = array(
@ -578,7 +562,7 @@
/**
* @brief User Layout 저장 파일 목록.
* @brief Saved file list for User Layout
**/
function getUserLayoutFileList($layout_srl){
$file_list = array(
@ -596,32 +580,26 @@
}
/**
* @brief faceOff관련 서비스 출력을 위한 동작 실행
* @brief faceOff related services for the operation run out
**/
function doActivateFaceOff(&$layout_info) {
$layout_info->faceoff_ini_config = $this->getUserLayoutIniConfig($layout_info->layout_srl, $layout_info->layout);
// 기본 faceoff layout CSS
// faceoff layout CSS
Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout));
// 레이아웃 매니져에서 생성된 CSS
// CSS generated in the layout manager
$faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl);
if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css);
// 레이아웃의 위젯을 위한 css출력
// CSS output for the widget
Context::addCSSFile($this->module_path.'/tpl/css/widget.css');
if($layout_info->extra_var->colorset->value == 'black') Context::addCSSFile($this->module_path.'/tpl/css/widget@black.css');
else Context::addCSSFile($this->module_path.'/tpl/css/widget@white.css');
// 권한에 따른 다른 내용 출력
// Different page displayed upon user's permission
$logged_info = Context::get('logged_info');
// faceOff 레이아웃 편집 버튼 노출
// Display edit button for faceoff layout
if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin')===false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) {
Context::addHtmlFooter("<div class=\"faceOffManager\"><a href=\"".getUrl('','mid',Context::get('mid'),'act','dispLayoutAdminLayoutModify','delete_tmp','Y')."\" class=\"buttonSet buttonLayoutEditor\"><span>".Context::getLang('cmd_layout_edit')."</span></a></div>");
}
// faceOff페이지 수정시에 메뉴 출력
// Display menu when editing the faceOff page
if(Context::get('act')=='dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) {
$oTemplate = &TemplateHandler::getInstance();
Context::addBodyHeader($oTemplate->compile($this->module_path.'/tpl', 'faceoff_layout_menu'));

View file

@ -2,32 +2,30 @@
/**
* @class layoutView
* @author NHN (developers@xpressengine.com)
* @brief layout 모듈의 admin view class
* @brief admin view class of the layout module
**/
class layoutView extends layout {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 레이아웃의 상세 정보(conf/info.xml) 팝업 출력
* @brief Pop-up layout details(conf/info.xml)
**/
function dispLayoutInfo() {
// 선택된 레이아웃 정보를 구함
// Get the layout information
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
if(!$layout_info) exit();
Context::set('layout_info', $layout_info);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('layout_detail_info');
}
}