From c5a3f5722acf0f43fb66e34a24cf9bdac53c7fa9 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Tue, 27 Jun 2023 21:41:42 +0900 Subject: [PATCH] Apply consistent layout and skin code to communication and ncenterlite modules --- .../communication/communication.mobile.php | 33 ++----------------- modules/communication/communication.view.php | 28 ++-------------- modules/ncenterlite/ncenterlite.mobile.php | 32 ------------------ modules/ncenterlite/ncenterlite.view.php | 19 +---------- 4 files changed, 5 insertions(+), 107 deletions(-) diff --git a/modules/communication/communication.mobile.php b/modules/communication/communication.mobile.php index 288031dc0..f940e1fca 100644 --- a/modules/communication/communication.mobile.php +++ b/modules/communication/communication.mobile.php @@ -11,38 +11,9 @@ class communicationMobile extends communicationView function init() { - $oCommunicationModel = getModel('communication'); - - $this->config = $oCommunicationModel->getConfig(); + $this->config = CommunicationModel::getConfig(); Context::set('communication_config', $this->config); - - $mskin = $this->config->mskin; - if(!$mskin) - { - $template_path = sprintf('%sm.skins/%s/', $this->module_path, 'default'); - } - elseif($mskin === '/USE_RESPONSIVE/') - { - $template_path = sprintf("%sskins/%s/", $this->module_path, $this->config->skin); - if(!is_dir($template_path) || !$this->config->skin) - { - $template_path = sprintf("%sskins/%s/", $this->module_path, 'default'); - } - } - else - { - $template_path = sprintf('%sm.skins/%s', $this->module_path, $mskin); - } - - $oLayoutModel = getModel('layout'); - $layout_info = $oLayoutModel->getLayout($this->config->mlayout_srl); - if($layout_info) - { - $this->module_info->mlayout_srl = $this->config->mlayout_srl; - $this->setLayoutPath($layout_info->path); - } - - $this->setTemplatePath($template_path); + $this->setLayoutAndTemplatePaths('M', $this->config); } /** diff --git a/modules/communication/communication.view.php b/modules/communication/communication.view.php index ec238552c..7d75780c0 100644 --- a/modules/communication/communication.view.php +++ b/modules/communication/communication.view.php @@ -15,33 +15,9 @@ class communicationView extends communication */ function init() { - $oCommunicationModel = getModel('communication'); - - $this->config = $oCommunicationModel->getConfig(); - $skin = $this->config->skin; - + $this->config = CommunicationModel::getConfig(); Context::set('communication_config', $this->config); - - $config_parse = explode('|@|', $skin); - - if(count($config_parse) > 1) - { - $tpl_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]); - } - else - { - $tpl_path = sprintf('%sskins/%s', $this->module_path, $skin); - } - - $this->setTemplatePath($tpl_path); - - $oLayoutModel = getModel('layout'); - $layout_info = $oLayoutModel->getLayout($this->config->layout_srl); - if($layout_info) - { - $this->module_info->layout_srl = $this->config->layout_srl; - $this->setLayoutPath($layout_info->path); - } + $this->setLayoutAndTemplatePaths('P', $this->config); } /** diff --git a/modules/ncenterlite/ncenterlite.mobile.php b/modules/ncenterlite/ncenterlite.mobile.php index 6d0ac9c21..c9adf2f98 100644 --- a/modules/ncenterlite/ncenterlite.mobile.php +++ b/modules/ncenterlite/ncenterlite.mobile.php @@ -2,37 +2,5 @@ class ncenterliteMobile extends ncenterliteView { - function init() - { - $oNcenterliteModel = getModel('ncenterlite'); - $config = $oNcenterliteModel->getConfig(); - $mskin = $config->mskin; - if(!$mskin) - { - $template_path = sprintf('%sm.skins/%s/', $this->module_path, 'default'); - } - elseif($mskin === '/USE_RESPONSIVE/') - { - $template_path = sprintf("%sskins/%s/", $this->module_path, $config->skin); - if(!is_dir($template_path) || !$config->skin) - { - $template_path = sprintf("%sskins/%s/", $this->module_path, 'default'); - } - } - else - { - $template_path = sprintf('%sm.skins/%s', $this->module_path, $mskin); - } - $this->setTemplatePath($template_path); - - $oLayoutModel = getModel('layout'); - $layout_info = $oLayoutModel->getLayout($config->mlayout_srl); - - if($layout_info) - { - $this->module_info->mlayout_srl = $config->mlayout_srl; - $this->setLayoutPath($layout_info->path); - } - } } diff --git a/modules/ncenterlite/ncenterlite.view.php b/modules/ncenterlite/ncenterlite.view.php index 43ac8eff2..3c19c5f03 100644 --- a/modules/ncenterlite/ncenterlite.view.php +++ b/modules/ncenterlite/ncenterlite.view.php @@ -6,24 +6,7 @@ class ncenterliteView extends ncenterlite { $oNcenterliteModel = ncenterliteModel::getInstance(); $config = $oNcenterliteModel->getConfig(); - $template_path = sprintf("%sskins/%s/",$this->module_path, $config->skin); - if(!is_dir($template_path)||!$config->skin) - { - $config->skin = 'default'; - $template_path = sprintf("%sskins/%s/",$this->module_path, $config->skin); - } - $this->setTemplatePath($template_path); - - $oLayoutModel = getModel('layout'); - if (isset($config->layout_srl) && $config->layout_srl) - { - $layout_info = $oLayoutModel->getLayout($config->layout_srl); - if ($layout_info) - { - $this->module_info->layout_srl = $config->layout_srl; - $this->setLayoutPath($layout_info->path); - } - } + $this->setLayoutAndTemplatePaths($this instanceof ncenterliteView ? 'P' : 'M', $config); } function dispNcenterliteNotifyList()