From e6c40ada525cdc122f2bdec6b8e7ae2e8f196f6b Mon Sep 17 00:00:00 2001 From: haneul Date: Mon, 21 Jun 2010 04:54:56 +0000 Subject: [PATCH] #18953798 : manage mobile layouts git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7524 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/layout/conf/module.xml | 3 ++ modules/layout/lang/en.lang.php | 3 ++ modules/layout/lang/es.lang.php | 2 + modules/layout/lang/fr.lang.php | 2 + modules/layout/lang/jp.lang.php | 2 + modules/layout/lang/ko.lang.php | 3 ++ modules/layout/lang/ru.lang.php | 2 + modules/layout/lang/vi.lang.php | 2 + modules/layout/lang/zh-CN.lang.php | 2 + modules/layout/lang/zh-TW.lang.php | 2 + modules/layout/layout.admin.controller.php | 2 + modules/layout/layout.admin.view.php | 21 +++++++- modules/layout/layout.class.php | 6 +++ modules/layout/layout.model.php | 32 +++++++---- modules/layout/queries/getLayoutList.xml | 1 + modules/layout/queries/insertLayout.xml | 1 + modules/layout/schemas/layouts.xml | 1 + .../layout/tpl/downloaded_mlayout_list.html | 54 +++++++++++++++++++ modules/layout/tpl/filter/insert_layout.xml | 1 + modules/layout/tpl/header.html | 2 + modules/layout/tpl/insert_layout.html | 1 + modules/layout/tpl/mindex.html | 50 +++++++++++++++++ 22 files changed, 185 insertions(+), 10 deletions(-) create mode 100644 modules/layout/tpl/downloaded_mlayout_list.html create mode 100644 modules/layout/tpl/mindex.html diff --git a/modules/layout/conf/module.xml b/modules/layout/conf/module.xml index 445f5d725..cb4ad7377 100644 --- a/modules/layout/conf/module.xml +++ b/modules/layout/conf/module.xml @@ -14,6 +14,9 @@ + + + diff --git a/modules/layout/lang/en.lang.php b/modules/layout/lang/en.lang.php index 53c8f0c00..a35956c92 100644 --- a/modules/layout/lang/en.lang.php +++ b/modules/layout/lang/en.lang.php @@ -110,4 +110,7 @@ 'attribute' => 'You can set background color/image to every area except widget, and font color(include tag).', ); + + $lang->mobile_layout_list = "Mobile Layout List"; + $lang->mobile_downloaded_list = "Downloaded Mobile Layouts"; ?> diff --git a/modules/layout/lang/es.lang.php b/modules/layout/lang/es.lang.php index 311da99cf..c373338dd 100644 --- a/modules/layout/lang/es.lang.php +++ b/modules/layout/lang/es.lang.php @@ -109,4 +109,6 @@ 'attribute' => '위젯을 제외한 각 영역들은 모두 배경 색/ 이미지를 지정할 수 있고 글자색(a 태그 포함됨)을 정할 수 있습니다.', ); + $lang->mobile_layout_list = "Mobile Layout List"; + $lang->mobile_downloaded_list = "Downloaded Mobile Layouts"; ?> diff --git a/modules/layout/lang/fr.lang.php b/modules/layout/lang/fr.lang.php index 8671c98dc..2d469e1bf 100644 --- a/modules/layout/lang/fr.lang.php +++ b/modules/layout/lang/fr.lang.php @@ -109,4 +109,6 @@ 'attribute' => '위젯을 제외한 각 영역들은 모두 배경 색/ 이미지를 지정할 수 있고 글자색(a 태그 포함됨)을 정할 수 있습니다.', ); + $lang->mobile_layout_list = "Mobile Layout List"; + $lang->mobile_downloaded_list = "Downloaded Mobile Layouts"; ?> diff --git a/modules/layout/lang/jp.lang.php b/modules/layout/lang/jp.lang.php index 0a4db3d45..3eaf92f4b 100644 --- a/modules/layout/lang/jp.lang.php +++ b/modules/layout/lang/jp.lang.php @@ -110,4 +110,6 @@ 'attribute' => 'ウィジェットを除いた各領域はすべて背景の色・イメージ・文字のテキスト色(「a」タグを含む)の指定が可能です。', ); + $lang->mobile_layout_list = "Mobile Layout List"; + $lang->mobile_downloaded_list = "Downloaded Mobile Layouts"; ?> diff --git a/modules/layout/lang/ko.lang.php b/modules/layout/lang/ko.lang.php index a47bc3d5d..624b0230f 100644 --- a/modules/layout/lang/ko.lang.php +++ b/modules/layout/lang/ko.lang.php @@ -110,4 +110,7 @@ 'attribute' => '위젯을 제외한 각 영역들은 모두 배경 색/ 이미지를 지정할 수 있고 글자색(a 태그 포함됨)을 정할 수 있습니다.', ); + + $lang->mobile_layout_list = "모바일 레이아웃 목록"; + $lang->mobile_downloaded_list = "모바일 다운로드 목록"; ?> diff --git a/modules/layout/lang/ru.lang.php b/modules/layout/lang/ru.lang.php index 0b06297a1..3ba4f35f1 100644 --- a/modules/layout/lang/ru.lang.php +++ b/modules/layout/lang/ru.lang.php @@ -110,4 +110,6 @@ 'attribute' => 'You can set background color/image to every area except widget, and font color(include tag).', ); + $lang->mobile_layout_list = "Mobile Layout List"; + $lang->mobile_downloaded_list = "Downloaded Mobile Layouts"; ?> diff --git a/modules/layout/lang/vi.lang.php b/modules/layout/lang/vi.lang.php index 833b44282..6ea0de075 100644 --- a/modules/layout/lang/vi.lang.php +++ b/modules/layout/lang/vi.lang.php @@ -112,4 +112,6 @@ 'attribute' => 'Bạn có thể đặt màu nền / hình nền tới mọi khu vực trừ Widget, và màu chữ (bao gồm cả Tag).', ); + $lang->mobile_layout_list = "Mobile Layout List"; + $lang->mobile_downloaded_list = "Downloaded Mobile Layouts"; ?> diff --git a/modules/layout/lang/zh-CN.lang.php b/modules/layout/lang/zh-CN.lang.php index 92251592f..29ff870ef 100644 --- a/modules/layout/lang/zh-CN.lang.php +++ b/modules/layout/lang/zh-CN.lang.php @@ -110,4 +110,6 @@ 'attribute' => '除控件之外的各个区域都可以对其指定背景色/背景图片及字体颜色(包括a标签)。', ); + $lang->mobile_layout_list = "Mobile Layout List"; + $lang->mobile_downloaded_list = "Downloaded Mobile Layouts"; ?> diff --git a/modules/layout/lang/zh-TW.lang.php b/modules/layout/lang/zh-TW.lang.php index d847b1727..394d8fdff 100644 --- a/modules/layout/lang/zh-TW.lang.php +++ b/modules/layout/lang/zh-TW.lang.php @@ -110,4 +110,6 @@ 'attribute' => '除了Widget以外的各個區域都可以指定背景顏色/圖片及文字顏色(包含a標籤)。', ); + $lang->mobile_layout_list = "Mobile Layout List"; + $lang->mobile_downloaded_list = "Downloaded Mobile Layouts"; ?> diff --git a/modules/layout/layout.admin.controller.php b/modules/layout/layout.admin.controller.php index 4fd92bae9..c4565e2fd 100644 --- a/modules/layout/layout.admin.controller.php +++ b/modules/layout/layout.admin.controller.php @@ -24,6 +24,8 @@ $args->layout_srl = getNextSequence(); $args->layout = Context::get('layout'); $args->title = Context::get('title'); + $args->layout_type = Context::get('layout_type'); + if(!$args->layout_type) $args->layout_type = "P"; // DB 입력 $output = $this->insertLayout($args); diff --git a/modules/layout/layout.admin.view.php b/modules/layout/layout.admin.view.php index fa1e82c31..4acc3b52e 100644 --- a/modules/layout/layout.admin.view.php +++ b/modules/layout/layout.admin.view.php @@ -25,6 +25,15 @@ $this->setTemplateFile('index'); } + function dispLayoutAdminMobileContent() { + $oLayoutModel = &getModel('layout'); + $layout_list = $oLayoutModel->getLayoutList(0, "M"); + Context::set('layout_list', $layout_list); + + $this->setTemplateFile('mindex'); + + } + /** * @brief 레이아웃 등록 페이지 * 1차적으로 레이아웃만 선택한 후 DB 에 빈 값을 넣고 그 후 상세 값 설정하는 단계를 거침 @@ -32,7 +41,8 @@ function dispLayoutAdminInsert() { // 레이아웃 목록을 세팅 $oLayoutModel = &getModel('layout'); - $layout_list = $oLayoutModel->getDownloadedLayoutList(); + $layout_type = Context::get('layout_type'); + $layout_list = $oLayoutModel->getDownloadedLayoutList($layout_type); Context::set('layout_list', $layout_list); $this->setTemplateFile('insert_layout'); @@ -128,6 +138,15 @@ $this->setTemplateFile('downloaded_layout_list'); } + function dispLayoutAdminDownloadedMobileList() { + // 레이아웃 목록을 세팅 + $oLayoutModel = &getModel('layout'); + $layout_list = $oLayoutModel->getDownloadedLayoutList(0, "M"); + Context::set('layout_list', $layout_list); + + $this->setTemplateFile('downloaded_mlayout_list'); + } + /** * @brief 레이아웃 미리 보기 **/ diff --git a/modules/layout/layout.class.php b/modules/layout/layout.class.php index 1e9a808ce..c7659b91d 100644 --- a/modules/layout/layout.class.php +++ b/modules/layout/layout.class.php @@ -33,6 +33,8 @@ if(preg_match('/([0-9]+)\.html/i',$filename)) return true; } + if(!$oDB->isColumnExists('layouts', 'layout_type')) return true; + return false; } @@ -61,6 +63,10 @@ @unlink('./files/cache/layout/'.$filename); } + if(!$oDB->isColumnExists('layouts', 'layout_type')) { + $oDB->addColumn('layouts','layout_type','char',1,'P',true); + } + return new Object(0, 'success_updated'); } diff --git a/modules/layout/layout.model.php b/modules/layout/layout.model.php index 9508018e0..2361ceb71 100644 --- a/modules/layout/layout.model.php +++ b/modules/layout/layout.model.php @@ -19,12 +19,13 @@ * @brief DB 에 생성된 레이아웃의 목록을 구함 * 생성되었다는 것은 DB에 등록이 되었다는 것을 의미 **/ - function getLayoutList($site_srl = 0) { + function getLayoutList($site_srl = 0, $layout_type="P") { if(!$site_srl) { $site_module_info = Context::get('site_module_info'); $site_srl = (int)$site_module_info->site_srl; } $args->site_srl = $site_srl; + $args->layout_type = $layout_type; $output = executeQuery('layout.getLayoutList', $args); if(!$output->data) return; if(is_array($output->data)) return $output->data; @@ -42,17 +43,21 @@ if(!$output->data) return; // layout, extra_vars를 정리한 후 xml 파일 정보를 정리해서 return - $layout_info = $this->getLayoutInfo($layout, $output->data); + $layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type); return $layout_info; } /** * @brief 레이아웃의 경로를 구함 **/ - function getLayoutPath($layout_name) { + function getLayoutPath($layout_name, $layout_type = "P") { if($layout_name == 'faceoff'){ $class_path = './modules/layout/faceoff/'; - }else{ + }else if($layout_type == "M") { + $class_path = sprintf("./m.layouts/%s/", $layout_name); + } + else + { $class_path = sprintf('./layouts/%s/', $layout_name); } if(is_dir($class_path)) return $class_path; @@ -63,9 +68,18 @@ * @brief 레이아웃의 종류와 정보를 구함 * 다운로드되어 있는 레이아웃의 종류 (생성과 다른 의미) **/ - function getDownloadedLayoutList() { + function getDownloadedLayoutList($layout_type = "P") { // 다운받은 레이아웃과 설치된 레이아웃의 목록을 구함 - $searched_list = FileHandler::readDir('./layouts'); + if($layout_type == "M") + { + $directory = "./m.layouts"; + } + else + { + $directory = "./layouts"; + } + + $searched_list = FileHandler::readDir($directory); $searched_count = count($searched_list); if(!$searched_count) return; @@ -75,7 +89,7 @@ $layout = $searched_list[$i]; // 해당 레이아웃의 정보를 구함 - $layout_info = $this->getLayoutInfo($layout); + $layout_info = $this->getLayoutInfo($layout, null, $layout_type); $list[] = $layout_info; } @@ -86,7 +100,7 @@ * @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함 * 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다.. **/ - function getLayoutInfo($layout, $info = null) { + function getLayoutInfo($layout, $info = null, $layout_type = "P") { if($info) { $layout_title = $info->title; $layout = $info->layout; @@ -101,7 +115,7 @@ } // 요청된 모듈의 경로를 구한다. 없으면 return - if(!$layout_path) $layout_path = $this->getLayoutPath($layout); + if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); if(!is_dir($layout_path)) return; // 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음 diff --git a/modules/layout/queries/getLayoutList.xml b/modules/layout/queries/getLayoutList.xml index 97d8d161a..047a476b4 100644 --- a/modules/layout/queries/getLayoutList.xml +++ b/modules/layout/queries/getLayoutList.xml @@ -7,6 +7,7 @@ + diff --git a/modules/layout/queries/insertLayout.xml b/modules/layout/queries/insertLayout.xml index b4c983a97..20a229beb 100644 --- a/modules/layout/queries/insertLayout.xml +++ b/modules/layout/queries/insertLayout.xml @@ -10,5 +10,6 @@ + diff --git a/modules/layout/schemas/layouts.xml b/modules/layout/schemas/layouts.xml index 3b2ebc12b..1e6be0121 100644 --- a/modules/layout/schemas/layouts.xml +++ b/modules/layout/schemas/layouts.xml @@ -7,4 +7,5 @@ + diff --git a/modules/layout/tpl/downloaded_mlayout_list.html b/modules/layout/tpl/downloaded_mlayout_list.html new file mode 100644 index 000000000..878070d19 --- /dev/null +++ b/modules/layout/tpl/downloaded_mlayout_list.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$lang->layout_name}
{$lang->version}
{$lang->author}
{$lang->menu_count}
{$lang->date}
{$lang->path}
{$lang->cmd_make}
+
+ {$val->title}
+ ({$val->layout}) +
+
{$val->version} + + {$author->name} + + {$val->menu_count}{zdate($val->date, 'Y-m-d')}{$val->path}{$lang->cmd_make}
+ {nl2br(trim($val->description))} +
{$val->layout}{$val->path}{$lang->cmd_make}
diff --git a/modules/layout/tpl/filter/insert_layout.xml b/modules/layout/tpl/filter/insert_layout.xml index 9b5b52c1a..01f5035cd 100644 --- a/modules/layout/tpl/filter/insert_layout.xml +++ b/modules/layout/tpl/filter/insert_layout.xml @@ -5,6 +5,7 @@ + diff --git a/modules/layout/tpl/header.html b/modules/layout/tpl/header.html index a8013c439..abc581ce9 100644 --- a/modules/layout/tpl/header.html +++ b/modules/layout/tpl/header.html @@ -10,6 +10,8 @@
diff --git a/modules/layout/tpl/insert_layout.html b/modules/layout/tpl/insert_layout.html index 2e8097c33..e3ed8e83a 100644 --- a/modules/layout/tpl/insert_layout.html +++ b/modules/layout/tpl/insert_layout.html @@ -3,6 +3,7 @@
+ diff --git a/modules/layout/tpl/mindex.html b/modules/layout/tpl/mindex.html new file mode 100644 index 000000000..fe2d64b86 --- /dev/null +++ b/modules/layout/tpl/mindex.html @@ -0,0 +1,50 @@ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
{$lang->no}
{$lang->layout}
{$lang->title}
{$lang->regdate}
 
{$no+1} + {$val->layout} + + (module) + + {htmlspecialchars($val->title)}{zdate($val->regdate,"Y-m-d")} + + {$lang->cmd_layout_management} + +   + + {$lang->cmd_layout_edit}{$lang->cmd_delete}
+ {$lang->cmd_make} +