mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Fix #985 improve responsive skin support
- 모바일에서 반응형 스킨 사용을 기본값으로 지정한 경우 - 사이트 디자인 설정 화면에서 /USE_RESPONSIVE/가 노출되는 문제 수정 - 신규 생성한 게시판에서 모바일 스킨을 찾지 못하는 문제 수정 - 게시판 모듈에서 스킨 처리하는 루틴을 ModuleObject로 이관하여 모든 모듈에서 혜택을 볼 수 있도록 함 - 반응형 스킨이 기본값으로 지정된 경우, 아무 것도 지정되지 않은 경우, 기본값으로 지정된 스킨이 삭제된 경우 등 다양한 상황에 대처 - TODO: 회원 모듈, 커뮤니케이션 모듈 등에서 자체 스킨을 들여오는 방식 재검토
This commit is contained in:
parent
ea964e72ba
commit
11858c0b13
5 changed files with 42 additions and 49 deletions
|
|
@ -550,28 +550,53 @@ class ModuleObject extends BaseObject
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// integrate skin information of the module(change to sync skin info with the target module only by seperating its table)
|
||||
// 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'));
|
||||
if(!$disable_skin && $default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module)
|
||||
$disable_skin = ($disable_skin && ($this->module === 'admin' || strpos($this->act, 'Admin') !== false || $this->module !== $this->module_info->module));
|
||||
if(!$disable_skin)
|
||||
{
|
||||
$skinType = ($is_mobile && $this->module_info->mskin !== '/USE_RESPONSIVE/') ? 'M' : 'P';
|
||||
$dir = $skinType === 'M' ? 'm.skins' : 'skins';
|
||||
$valueName = $skinType === 'M' ? 'mskin' : 'skin';
|
||||
$skinName = $this->module_info->{$valueName} === '/USE_DEFAULT/' ? $oModuleModel->getModuleDefaultSkin($this->module, $skinType) : $this->module_info->{$valueName};
|
||||
if($this->module == 'page')
|
||||
$valueName = $is_mobile ? 'mskin' : 'skin';
|
||||
$skinName = $this->module_info->{$valueName};
|
||||
$dirName = $is_mobile ? 'm.skins' : 'skins';
|
||||
if($is_mobile)
|
||||
{
|
||||
$this->module_info->{$valueName} = $skinName;
|
||||
if($skinName === '/USE_DEFAULT/' || !$skinName)
|
||||
{
|
||||
$skinName = $oModuleModel->getModuleDefaultSkin($this->module, 'M');
|
||||
$this->module_info->mskin = $skinName;
|
||||
}
|
||||
if($skinName === '/USE_RESPONSIVE/')
|
||||
{
|
||||
$skinName = $this->module_info->skin;
|
||||
$dirName = 'skins';
|
||||
if($skinName === '/USE_DEFAULT/')
|
||||
{
|
||||
$skinName = $oModuleModel->getModuleDefaultSkin($this->module, 'P');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE);
|
||||
if(!$isTemplatPath)
|
||||
if($skinName === '/USE_DEFAULT/' || !$skinName)
|
||||
{
|
||||
$this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName));
|
||||
$skinName = $oModuleModel->getModuleDefaultSkin($this->module, 'P');
|
||||
$this->module_info->skin = $skinName;
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
$oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
|
||||
|
|
|
|||
|
|
@ -61,27 +61,9 @@ class boardMobile extends boardView
|
|||
$this->consultation = false;
|
||||
}
|
||||
|
||||
$oDocumentModel = getModel('document');
|
||||
$extra_keys = $oDocumentModel->getExtraKeys($this->module_info->module_srl);
|
||||
Context::set('extra_keys', $extra_keys);
|
||||
|
||||
if($this->module_info->mskin === '/USE_RESPONSIVE/')
|
||||
{
|
||||
$template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin);
|
||||
if(!is_dir($template_path)||!$this->module_info->skin)
|
||||
{
|
||||
$template_path = sprintf("%sskins/%s/",$this->module_path, 'default');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$template_path = sprintf("%sm.skins/%s/",$this->module_path, $this->module_info->mskin);
|
||||
if(!is_dir($template_path)||!$this->module_info->mskin)
|
||||
{
|
||||
$template_path = sprintf("%sm.skins/%s/",$this->module_path, 'default');
|
||||
}
|
||||
}
|
||||
$this->setTemplatePath($template_path);
|
||||
Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,17 +90,6 @@ class boardView extends board
|
|||
$this->consultation = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* setup the template path based on the skin
|
||||
* the default skin is default
|
||||
**/
|
||||
$template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin);
|
||||
if(!is_dir($template_path)||!$this->module_info->skin)
|
||||
{
|
||||
$template_path = sprintf("%sskins/%s/",$this->module_path, 'default');
|
||||
}
|
||||
$this->setTemplatePath($template_path);
|
||||
|
||||
/**
|
||||
* use context::set to setup extra variables
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -354,6 +354,11 @@ class menuAdminModel extends menu
|
|||
$defaultMobileSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'M');
|
||||
$skinInfo = $oModuleModel->loadSkinInfo(ModuleHandler::getModulePath($module_name), $defaultSkin);
|
||||
$mobileSkinInfo = $oModuleModel->loadSkinInfo(ModuleHandler::getModulePath($module_name), $defaultMobileSkin, 'm.skins');
|
||||
if($defaultMobileSkin === '/USE_RESPONSIVE/' && !$mobileSkinInfo || !$mobileSkinInfo->title)
|
||||
{
|
||||
$mobileSkinInfo = $mobileSkinInfo ?: new stdClass;
|
||||
$mobileSkinInfo->title = lang('use_responsive_pc_skin');
|
||||
}
|
||||
$module->defaultSkin = new stdClass();
|
||||
$module->defaultSkin->skin = $defaultSkin;
|
||||
$module->defaultSkin->title = $skinInfo->title ? $skinInfo->title : $defaultSkin;
|
||||
|
|
|
|||
|
|
@ -107,15 +107,7 @@ class pageView extends page
|
|||
}
|
||||
Context::set('oDocument', $oDocument);
|
||||
|
||||
if ($this->module_info->skin)
|
||||
{
|
||||
$templatePath = (sprintf($this->module_path.'skins/%s', $this->module_info->skin));
|
||||
}
|
||||
else
|
||||
{
|
||||
$templatePath = ($this->module_path.'skins/default');
|
||||
}
|
||||
|
||||
$templatePath = sprintf('%sskins/%s', $this->module_path, $this->module_info->skin ?: 'default');
|
||||
$page_content = $oTemplate->compile($templatePath, 'content');
|
||||
|
||||
return $page_content;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue