mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set skin information
|
// Set module skin
|
||||||
$oModuleModel = getModel('module');
|
if(isset($this->module_info->skin) && $this->module_info->module === $this->module && strpos($this->act, 'Admin') === false)
|
||||||
$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())
|
|
||||||
{
|
{
|
||||||
$valueName = $is_mobile ? 'mskin' : 'skin';
|
$oModuleModel = getModel('module');
|
||||||
$skinName = $this->module_info->{$valueName};
|
$skin_type = $is_mobile ? 'M' : 'P';
|
||||||
$dirName = $is_mobile ? 'm.skins' : 'skins';
|
$skin_key = $is_mobile ? 'mskin' : 'skin';
|
||||||
if($is_mobile)
|
$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');
|
$module_skin = $oModuleModel->getModuleDefaultSkin($this->module, $skin_type);
|
||||||
$this->module_info->mskin = $skinName;
|
$this->module_info->{$skin_key} = $module_skin;
|
||||||
}
|
}
|
||||||
if($skinName === '/USE_RESPONSIVE/')
|
if($module_skin === '/USE_RESPONSIVE/')
|
||||||
{
|
{
|
||||||
$skinName = $this->module_info->skin;
|
$skin_dir = 'skins';
|
||||||
$dirName = 'skins';
|
$module_skin = $this->module_info->skin ?: '/USE_DEFAULT/';
|
||||||
if($skinName === '/USE_DEFAULT/')
|
if($module_skin === '/USE_DEFAULT/')
|
||||||
{
|
{
|
||||||
$skinName = $oModuleModel->getModuleDefaultSkin($this->module, 'P');
|
$module_skin = $oModuleModel->getModuleDefaultSkin($this->module, 'P');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if(!is_dir(sprintf('%s%s/%s', $this->module_path, $skin_dir, $module_skin)))
|
||||||
else
|
|
||||||
{
|
|
||||||
if($skinName === '/USE_DEFAULT/' || !$skinName)
|
|
||||||
{
|
{
|
||||||
$skinName = $oModuleModel->getModuleDefaultSkin($this->module, 'P');
|
$module_skin = 'default';
|
||||||
$this->module_info->skin = $skinName;
|
|
||||||
}
|
}
|
||||||
|
$this->setTemplatePath(sprintf('%s%s/%s', $this->module_path, $skin_dir, $module_skin));
|
||||||
}
|
}
|
||||||
if($this->module === 'page')
|
|
||||||
{
|
// Set skin variable
|
||||||
$this->module_info->{$valueName} = $skinName;
|
$oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
|
||||||
}
|
Context::set('module_info', $this->module_info);
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
|
|
||||||
Context::set('module_info', $this->module_info);
|
|
||||||
|
|
||||||
// Run
|
// Run
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,6 @@ class pageView extends page
|
||||||
*/
|
*/
|
||||||
function init()
|
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)
|
switch($this->module_info->page_type)
|
||||||
{
|
{
|
||||||
case 'WIDGET' :
|
case 'WIDGET' :
|
||||||
|
|
@ -61,7 +58,8 @@ class pageView extends page
|
||||||
|
|
||||||
Context::set('module_info', $this->module_info);
|
Context::set('module_info', $this->module_info);
|
||||||
Context::set('page_content', $page_content);
|
Context::set('page_content', $page_content);
|
||||||
|
|
||||||
|
$this->setTemplatePath($this->module_path . 'tpl');
|
||||||
$this->setTemplateFile('content');
|
$this->setTemplateFile('content');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue