From 0ba9a26f9b8592bbc93bee8c45bad1fd4d84ceb3 Mon Sep 17 00:00:00 2001 From: chschy Date: Thu, 5 Jul 2012 07:32:42 +0000 Subject: [PATCH] issue 877 add instance of layout list page git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10836 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/layout/conf/module.xml | 2 +- modules/layout/lang/lang.xml | 6 ++ modules/layout/layout.admin.view.php | 69 ++++++++++++------- modules/layout/tpl/caption.html | 15 ++++ modules/layout/tpl/installed_layout_list.html | 11 +-- .../layout/tpl/layout_all_instance_list.html | 46 +++++++++++++ 6 files changed, 116 insertions(+), 33 deletions(-) create mode 100644 modules/layout/tpl/caption.html create mode 100644 modules/layout/tpl/layout_all_instance_list.html diff --git a/modules/layout/conf/module.xml b/modules/layout/conf/module.xml index 93e00320e..a5ad4100d 100644 --- a/modules/layout/conf/module.xml +++ b/modules/layout/conf/module.xml @@ -11,8 +11,8 @@ - + diff --git a/modules/layout/lang/lang.xml b/modules/layout/lang/lang.xml index 1571f05dd..0baaac8cd 100644 --- a/modules/layout/lang/lang.xml +++ b/modules/layout/lang/lang.xml @@ -1004,6 +1004,12 @@ + + + + + + diff --git a/modules/layout/layout.admin.view.php b/modules/layout/layout.admin.view.php index 1f9b67b3b..836a2b1c9 100644 --- a/modules/layout/layout.admin.view.php +++ b/modules/layout/layout.admin.view.php @@ -20,25 +20,30 @@ * @return void **/ function dispLayoutAdminInstalledList() { + $type = Context::get('type'); + $type = ($type != 'M') ? 'P' : 'M'; + // Set a layout list $oLayoutModel = &getModel('layout'); - $layout_list = $oLayoutModel->getDownloadedLayoutList('P', true); + $layout_list = $oLayoutModel->getDownloadedLayoutList($type, true); if(!is_array($layout_list)) { $layout_list = array(); } - // get Theme layout - $oAdminModel = &getAdminModel('admin'); - $themeList = $oAdminModel->getThemeList(); - $themeLayoutList = array(); - foreach($themeList as $themeInfo){ - if(strpos($themeInfo->layout_info->name, '.') === false) continue; - $themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P'); + if($type == 'P') + { + // get Theme layout + $oAdminModel = &getAdminModel('admin'); + $themeList = $oAdminModel->getThemeList(); + $themeLayoutList = array(); + foreach($themeList as $themeInfo){ + if(strpos($themeInfo->layout_info->name, '.') === false) continue; + $themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P'); + } + $layout_list = array_merge($layout_list, $themeLayoutList); + $layout_list[] = $oLayoutModel->getLayoutInfo('faceoff', null, 'P'); } - $layout_list = array_merge($layout_list, $themeLayoutList); - $layout_list[] = $oLayoutModel->getLayoutInfo('faceoff', null, 'P'); - Context::set('type', 'P'); $pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P'); $mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M'); @@ -61,29 +66,47 @@ } /** - * Display a installed mobile layout list - * @return void + * Display list of pc layout all instance + * @return void|Object (void : success, Object : fail) */ - function dispLayoutAdminInstalledMobileList() { - // Set a layout list - $oLayoutModel = &getModel('layout'); - $layout_list = $oLayoutModel->getDownloadedLayoutList('M', true); - Context::set('type', 'M'); + function dispLayoutAdminAllInstanceList() + { + $type = Context::get('type'); + if (!in_array($type, array('P', 'M'))) $type = 'P'; + + $oLayoutModel = &getModel('layout'); + $pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P'); $mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M'); Context::set('pcLayoutCount', $pcLayoutCount); Context::set('mobileLayoutCount', $mobileLayoutCount); - $this->setTemplateFile('installed_layout_list'); - $security = new Security($layout_list); - $layout_info = $security->encodeHTML('..', '..author..'); + $columnList = array('layout_srl', 'layout', 'module_srl', 'title', 'regdate'); + $_layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, null, $columnList); - foreach($layout_list as $no => $layout_info) + $layout_list = array(); + foreach($_layout_list as $item) { - $layout_list[$no]->description = nl2br(trim($layout_info->description)); + if(!$layout_list[$item->layout]) + { + $layout_list[$item->layout] = array(); + $layout_info = $oLayoutModel->getLayoutInfo($item->layout, null, $type); + if ($layout_info) + { + $layout_list[$item->layout]['title'] = $layout_info->title; + } + } + + $layout_list[$item->layout][] = $item; } + Context::set('layout_list', $layout_list); + + $this->setTemplateFile('layout_all_instance_list'); + + $security = new Security(); + $security->encodeHTML('layout_list..'); } /** diff --git a/modules/layout/tpl/caption.html b/modules/layout/tpl/caption.html new file mode 100644 index 000000000..d697b465f --- /dev/null +++ b/modules/layout/tpl/caption.html @@ -0,0 +1,15 @@ + + PC({$pcLayoutCount}) + PC({$pcLayoutCount}) + | + Mobile({$mobileLayoutCount}) + Mobile({$mobileLayoutCount}) + + + + {$lang->instance_layout} + {$lang->instance_layout} + | + {$lang->installed_layout} + {$lang->installed_layout} + diff --git a/modules/layout/tpl/installed_layout_list.html b/modules/layout/tpl/installed_layout_list.html index 0eadca49a..44d9389ab 100644 --- a/modules/layout/tpl/installed_layout_list.html +++ b/modules/layout/tpl/installed_layout_list.html @@ -1,14 +1,7 @@
- + @@ -55,4 +48,4 @@
- PC({$pcLayoutCount}) - PC({$pcLayoutCount}) - | - Mobile({$mobileLayoutCount}) - Mobile({$mobileLayoutCount}) - -
{$lang->layout_name}
-
\ No newline at end of file + diff --git a/modules/layout/tpl/layout_all_instance_list.html b/modules/layout/tpl/layout_all_instance_list.html new file mode 100644 index 000000000..3bbb9bce1 --- /dev/null +++ b/modules/layout/tpl/layout_all_instance_list.html @@ -0,0 +1,46 @@ + + + + +
+ + + + + + + + + + + + + + +{@$count=1} + +{@$layout_name = $layout['title']} +{@unset($layout['title'])} + + + + + + + + + + + +
{$lang->number}{$lang->layout_name}{$lang->title}{$lang->regdate}{$lang->cmd_layout_management}{$lang->cmd_layout_edit}{$lang->cmd_delete}
{$count++}{$layout_name}{$item->title}{zdate($item->regdate, "Y-m-d")}{$lang->cmd_layout_management}{$lang->cmd_layout_edit} +
+ + + + + +
+
+