mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
모듈 기본 스킨을 셋팅하는 코드 정리
init()에서 setTemplatePath(...)하는 모듈에서 사이트 기본 스킨을 사용할 경우 '/USE_DEFAULT/' 그대로 유지되어 템플릿 경로 오류가 발생하는 문제 수정 불필요한 코드 제거
This commit is contained in:
parent
7cabb04cac
commit
0a97a0de53
2 changed files with 29 additions and 44 deletions
|
|
@ -550,58 +550,45 @@ class ModuleObject extends BaseObject
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// Set skin information
|
||||
$oModuleModel = getModel('module');
|
||||
$default_skin = ((!$is_mobile && $this->module_info->is_skin_fix == 'N') || ($is_mobile && $this->module_info->is_mskin_fix == 'N'));
|
||||
$disable_skin = ($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET'));
|
||||
$disable_skin = ($disable_skin && ($this->module === 'admin' || strpos($this->act, 'Admin') !== false || $this->module !== $this->module_info->module));
|
||||
if(!$disable_skin && !$this->getTemplatePath())
|
||||
// Set module skin
|
||||
if(isset($this->module_info->skin) && $this->module_info->module === $this->module && strpos($this->act, 'Admin') === false)
|
||||
{
|
||||
$valueName = $is_mobile ? 'mskin' : 'skin';
|
||||
$skinName = $this->module_info->{$valueName};
|
||||
$dirName = $is_mobile ? 'm.skins' : 'skins';
|
||||
if($is_mobile)
|
||||
$oModuleModel = getModel('module');
|
||||
$skin_type = $is_mobile ? 'M' : 'P';
|
||||
$skin_key = $is_mobile ? 'mskin' : 'skin';
|
||||
$skin_dir = $is_mobile ? 'm.skins' : 'skins';
|
||||
$module_skin = $this->module_info->{$skin_key} ?: '/USE_DEFAULT/';
|
||||
$use_default_skin = $this->module_info->{'is_' . $skin_key . '_fix'} === 'N';
|
||||
|
||||
// Set default skin
|
||||
if(!$this->getTemplatePath() || $use_default_skin)
|
||||
{
|
||||
if($skinName === '/USE_DEFAULT/' || !$skinName)
|
||||
if($module_skin === '/USE_DEFAULT/')
|
||||
{
|
||||
$skinName = $oModuleModel->getModuleDefaultSkin($this->module, 'M');
|
||||
$this->module_info->mskin = $skinName;
|
||||
$module_skin = $oModuleModel->getModuleDefaultSkin($this->module, $skin_type);
|
||||
$this->module_info->{$skin_key} = $module_skin;
|
||||
}
|
||||
if($skinName === '/USE_RESPONSIVE/')
|
||||
if($module_skin === '/USE_RESPONSIVE/')
|
||||
{
|
||||
$skinName = $this->module_info->skin;
|
||||
$dirName = 'skins';
|
||||
if($skinName === '/USE_DEFAULT/')
|
||||
$skin_dir = 'skins';
|
||||
$module_skin = $this->module_info->skin ?: '/USE_DEFAULT/';
|
||||
if($module_skin === '/USE_DEFAULT/')
|
||||
{
|
||||
$skinName = $oModuleModel->getModuleDefaultSkin($this->module, 'P');
|
||||
$module_skin = $oModuleModel->getModuleDefaultSkin($this->module, 'P');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($skinName === '/USE_DEFAULT/' || !$skinName)
|
||||
if(!is_dir(sprintf('%s%s/%s', $this->module_path, $skin_dir, $module_skin)))
|
||||
{
|
||||
$skinName = $oModuleModel->getModuleDefaultSkin($this->module, 'P');
|
||||
$this->module_info->skin = $skinName;
|
||||
$module_skin = 'default';
|
||||
}
|
||||
$this->setTemplatePath(sprintf('%s%s/%s', $this->module_path, $skin_dir, $module_skin));
|
||||
}
|
||||
if($this->module === 'page')
|
||||
{
|
||||
$this->module_info->{$valueName} = $skinName;
|
||||
}
|
||||
elseif(strpos($this->getTemplatePath(), '/tpl/') === false)
|
||||
{
|
||||
if(!is_dir(sprintf('%s%s/%s', $this->module_path, $dirName, $skinName)))
|
||||
{
|
||||
$skinName = 'default';
|
||||
}
|
||||
$this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dirName, $skinName));
|
||||
}
|
||||
|
||||
// Set skin variable
|
||||
$oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
|
||||
Context::set('module_info', $this->module_info);
|
||||
}
|
||||
|
||||
$oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
|
||||
Context::set('module_info', $this->module_info);
|
||||
|
||||
|
||||
// Run
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,9 +19,6 @@ class pageView extends page
|
|||
*/
|
||||
function init()
|
||||
{
|
||||
// Get a template path (page in the administrative template tpl putting together)
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
|
||||
switch($this->module_info->page_type)
|
||||
{
|
||||
case 'WIDGET' :
|
||||
|
|
@ -61,7 +58,8 @@ class pageView extends page
|
|||
|
||||
Context::set('module_info', $this->module_info);
|
||||
Context::set('page_content', $page_content);
|
||||
|
||||
|
||||
$this->setTemplatePath($this->module_path . 'tpl');
|
||||
$this->setTemplateFile('content');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue