issue 2168 set member skin through theme. And update path of theme skin using for '|@|'.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.2@11016 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
devjin 2012-08-09 12:09:18 +00:00
parent b36ed4295b
commit 2b6f473b26
15 changed files with 344 additions and 98 deletions

View file

@ -11,24 +11,43 @@ class HTMLDisplayHandler {
$oTemplate = &TemplateHandler::getInstance(); $oTemplate = &TemplateHandler::getInstance();
// compile module tpl // compile module tpl
if ($oModule->module_info->module == $oModule->module) // deprecated themes skin
$skin = $oModule->origin_module_info->skin;
else
$skin = $oModule->module_config->skin;
if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin') === false){ $template_path = $oModule->getTemplatePath();
if ($skin && is_string($skin)){
$theme_skin = explode('.', $skin); if(!is_dir($template_path))
$template_path = $oModule->getTemplatePath(); {
if (count($theme_skin) == 2) { if ($oModule->module_info->module == $oModule->module)
$theme_path = sprintf('./themes/%s',$theme_skin[0]); $skin = $oModule->origin_module_info->skin;
if(substr($theme_path,0,strlen($theme_path)) != $theme_path) else
$template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); $skin = $oModule->module_config->skin;
}
}else{ if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin') === false)
{
if ($skin && is_string($skin))
{
$theme_skin = explode('|@|', $skin);
$template_path = $oModule->getTemplatePath();
if (count($theme_skin) == 2)
{
$theme_path = sprintf('./themes/%s',$theme_skin[0]);
if(substr($theme_path,0,strlen($theme_path)) != $theme_path)
{
$template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]);
}
}
}
else
{
$template_path = $oModule->getTemplatePath();
}
}
else
{
$template_path = $oModule->getTemplatePath(); $template_path = $oModule->getTemplatePath();
} }
}else $template_path = $oModule->getTemplatePath(); }
$tpl_file = $oModule->getTemplateFile(); $tpl_file = $oModule->getTemplateFile();
$output = $oTemplate->compile($template_path, $tpl_file); $output = $oTemplate->compile($template_path, $tpl_file);

View file

@ -123,10 +123,16 @@
$args->site_srl = $site_info->site_srl; $args->site_srl = $site_info->site_srl;
$args->layout_srl = $vars->layout; $args->layout_srl = $vars->layout;
// layout submit // layout submit
$output = executeQuery('layout.updateAllLayoutInSiteWithTheme', $args); $output = executeQuery('layout.updateAllLayoutInSiteWithTheme', $args);
if (!$output->toBool()) return $output; if (!$output->toBool()) return $output;
// set layout info member
$oModuleController = &getController('module');
$memberConfig->layout_srl = $vars->layout;
$oModuleController->updateModuleConfig('member', $memberConfig);
$skin_args->site_srl = $site_info->site_srl; $skin_args->site_srl = $site_info->site_srl;
foreach($vars as $key=>$val){ foreach($vars as $key=>$val){
@ -148,13 +154,13 @@
$skin_args->module_srls = implode(',', $article_module_srls); $skin_args->module_srls = implode(',', $article_module_srls);
} }
} }
$skin_output = executeQuery('module.updateAllModuleSkinInSiteWithTheme', $skin_args); $skin_output = executeQuery('module.updateAllModuleSkinInSiteWithTheme', $skin_args);
if (!$skin_output->toBool()) return $skin_output; if (!$skin_output->toBool()) return $skin_output;
$oModuleModel = &getModel('module'); $oModuleModel = &getModel('module');
$module_config = $oModuleModel->getModuleConfig($module, $site_info->site_srl); $module_config = $oModuleModel->getModuleConfig($module, $site_info->site_srl);
$module_config->skin = $val; $module_config->skin = $val;
$oModuleController = &getController('module');
$oModuleController->insertModuleConfig($module, $module_config, $site_info->site_srl); $oModuleController->insertModuleConfig($module, $module_config, $site_info->site_srl);
} }
} }
@ -169,6 +175,7 @@
// Save File // Save File
FileHandler::writeFile($theme_file, $theme_buff); FileHandler::writeFile($theme_file, $theme_buff);
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminTheme'); $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminTheme');
return $this->setRedirectUrl($returnUrl, $output); return $this->setRedirectUrl($returnUrl, $output);
} }

View file

@ -302,7 +302,7 @@
case 'themes' : { case 'themes' : {
$is_theme = true; $is_theme = true;
$module_name = $skin_parse[count($skin_parse)-1]; $module_name = $skin_parse[count($skin_parse)-1];
$skin_info->name = $theme_name.'.'.$module_name; $skin_info->name = $theme_name.'|@|'.$module_name;
break; break;
} }
case 'modules' : { case 'modules' : {

View file

@ -23,6 +23,19 @@
**/ **/
function checkUpdate() { function checkUpdate() {
if(!is_dir("./files/member_extra_info/new_message_flags")) return true; if(!is_dir("./files/member_extra_info/new_message_flags")) return true;
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('message');
if($config->skin)
{
$config_parse = explode('.', $config->skin);
if (count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]);
if(is_dir($template_path)) return true;
}
}
return false; return false;
} }
@ -33,6 +46,24 @@
function moduleUpdate() { function moduleUpdate() {
if(!is_dir("./files/member_extra_info/new_message_flags")) if(!is_dir("./files/member_extra_info/new_message_flags"))
FileHandler::makeDir('./files/member_extra_info/new_message_flags'); FileHandler::makeDir('./files/member_extra_info/new_message_flags');
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('message');
if($config->skin)
{
$config_parse = explode('.', $config->skin);
if (count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]);
if(is_dir($template_path))
{
$config->skin = implode('|@|', $config_parse);
$oModuleController = &getController('module');
$oModuleController->updateModuleConfig('communication', $config);
}
}
}
return new Object(0, 'success_updated'); return new Object(0, 'success_updated');
} }

View file

@ -19,7 +19,7 @@
Context::set('communication_config', $this->communication_config); Context::set('communication_config', $this->communication_config);
$config_parse = explode('.', $skin); $config_parse = explode('|@|', $skin);
if (count($config_parse) > 1){ if (count($config_parse) > 1){
$tpl_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]); $tpl_path = sprintf('./themes/%s/modules/communication/', $config_parse[0]);
}else{ }else{

View file

@ -25,7 +25,20 @@
* *
* @return bool * @return bool
**/ **/
function checkUpdate() { function checkUpdate()
{
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('integration_search');
if($config->skin)
{
$config_parse = explode('.', $config->skin);
if (count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
if(is_dir($template_path)) return true;
}
}
return false; return false;
} }
@ -34,7 +47,26 @@
* *
* @return Object * @return Object
**/ **/
function moduleUpdate() { function moduleUpdate()
{
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('message');
if($config->skin)
{
$config_parse = explode('.', $config->skin);
if (count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
if(is_dir($template_path))
{
$config->skin = implode('|@|', $config_parse);
$oModuleController = &getController('module');
$oModuleController->updateModuleConfig('integration_search', $config);
}
}
}
return new Object(0, 'success_updated'); return new Object(0, 'success_updated');
} }

View file

@ -38,9 +38,27 @@
if(!$this->grant->access) return new Object(-1,'msg_not_permitted'); if(!$this->grant->access) return new Object(-1,'msg_not_permitted');
$config = $oModuleModel->getModuleConfig('integration_search'); $config = $oModuleModel->getModuleConfig('integration_search');
if(!$config->skin) $config->skin = 'default'; if(!$config->skin)
{
$config->skin = 'default';
$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
}
else
{
//check theme
$config_parse = explode('|@|', $config->skin);
if (count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
}
else
{
$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
}
}
// Template path
$this->setTemplatePath($template_path);
Context::set('module_info', unserialize($config->skin_vars)); Context::set('module_info', unserialize($config->skin_vars));
$this->setTemplatePath($this->module_path."/skins/".$config->skin."/");
$target = $config->target; $target = $config->target;
if(!$target) $target = 'include'; if(!$target) $target = 'include';

View file

@ -195,6 +195,16 @@
// check agreement field exist // check agreement field exist
if ($config->agreement) return true; if ($config->agreement) return true;
if($config->skin)
{
$config_parse = explode('.', $config->skin);
if (count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
if(is_dir($template_path)) return true;
}
}
// supprot multilanguage agreement. // supprot multilanguage agreement.
if (is_readable('./files/member_extra_info/agreement.txt')) return true; if (is_readable('./files/member_extra_info/agreement.txt')) return true;
@ -295,6 +305,21 @@
$output = $oModuleController->updateModuleConfig('member', $config); $output = $oModuleController->updateModuleConfig('member', $config);
} }
if($config->skin)
{
$config_parse = explode('.', $config->skin);
if (count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
if(is_dir($template_path))
{
$config->skin = implode('|@|', $config_parse);
$oModuleController = &getController('module');
$oModuleController->updateModuleConfig('member', $config);
}
}
}
if (is_readable('./files/member_extra_info/agreement.txt')) if (is_readable('./files/member_extra_info/agreement.txt'))
{ {
$source_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; $source_file = _XE_PATH_.'files/member_extra_info/agreement.txt';

View file

@ -22,9 +22,26 @@
$skin = $this->member_config->skin; $skin = $this->member_config->skin;
// Set the template path // Set the template path
$tpl_path = sprintf('%sskins/%s', $this->module_path, $skin); if(!$skin)
if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); {
$this->setTemplatePath($tpl_path); $skin = 'default';
$template_path = sprintf('%sskins/%s', $this->module_path, $skin);
}
else
{
//check theme
$config_parse = explode('|@|', $skin);
if (count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
}
else
{
$template_path = sprintf('%sskins/%s', $this->module_path, $skin);
}
}
// Template path
$this->setTemplatePath($template_path);
$oLayoutModel = &getModel('layout'); $oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayout($this->member_config->layout_srl); $layout_info = $oLayoutModel->getLayout($this->member_config->layout_srl);

View file

@ -17,14 +17,45 @@
/** /**
* @brief a method to check if successfully installed * @brief a method to check if successfully installed
**/ **/
function checkUpdate() { function checkUpdate()
{
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('message');
if($config->skin)
{
$config_parse = explode('.', $config->skin);
if (count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/message/', $config_parse[0]);
if(is_dir($template_path)) return true;
}
}
return false; return false;
} }
/** /**
* @brief Execute update * @brief Execute update
**/ **/
function moduleUpdate() { function moduleUpdate()
{
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('message');
if($config->skin)
{
$config_parse = explode('.', $config->skin);
if (count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/message/', $config_parse[0]);
if(is_dir($template_path))
{
$config->skin = implode('|@|', $config_parse);
$oModuleController = &getController('module');
$oModuleController->updateModuleConfig('message', $config);
}
}
}
return new Object(); return new Object();
} }

View file

@ -1,53 +1,63 @@
<?php <?php
/** /**
* @class messageView * @class messageView
* @author NHN (developers@xpressengine.com) * @author NHN (developers@xpressengine.com)
* @brief view class of the message module * @brief view class of the message module
**/ **/
class messageView extends message { class messageView extends message {
/** /**
* @brief Initialization * @brief Initialization
**/ **/
function init() { function init()
} {
}
/** /**
* @brief Display messages * @brief Display messages
**/ **/
function dispMessage() { function dispMessage()
// Get configurations (using module model object) {
$oModuleModel = &getModel('module'); // Get configurations (using module model object)
$this->module_config = $config = $oModuleModel->getModuleConfig('message', $this->module_info->site_srl); $oModuleModel = &getModel('module');
if(!$config->skin){ $this->module_config = $config = $oModuleModel->getModuleConfig('message', $this->module_info->site_srl);
$config->skin = 'default';
$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin); if(!$config->skin)
}else{ {
//check theme $config->skin = 'default';
$config_parse = explode('.', $config->skin); $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
if (count($config_parse) > 1){
$template_path = sprintf('./themes/%s/modules/message/', $config_parse[0]);
}else{
$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
} }
} else
// Template path {
$this->setTemplatePath($template_path); //check theme
$config_parse = explode('|@|', $config->skin);
if (count($config_parse) > 1)
{
$template_path = sprintf('./themes/%s/modules/message/', $config_parse[0]);
}
else
{
$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
}
}
// Template path
$this->setTemplatePath($template_path);
// Get the member configuration // Get the member configuration
$member_config = $oModuleModel->getModuleConfig('member'); $member_config = $oModuleModel->getModuleConfig('member');
Context::set('member_config', $member_config); Context::set('member_config', $member_config);
// Set a flag to check if the https connection is made when using SSL and create https url // Set a flag to check if the https connection is made when using SSL and create https url
$ssl_mode = false; $ssl_mode = false;
if($member_config->enable_ssl == 'Y') { if($member_config->enable_ssl == 'Y') {
if(preg_match('/^https:\/\//i',Context::getRequestUri())) $ssl_mode = true; if(preg_match('/^https:\/\//i',Context::getRequestUri())) $ssl_mode = true;
} }
Context::set('ssl_mode',$ssl_mode); Context::set('ssl_mode',$ssl_mode);
Context::set('system_message', nl2br($this->getMessage())); Context::set('system_message', nl2br($this->getMessage()));
$this->setTemplateFile('system_message'); $this->setTemplateFile('system_message');
} }
} }
?> ?>

View file

@ -79,6 +79,18 @@
if(!is_dir('./files/ruleset')) return true; if(!is_dir('./files/ruleset')) return true;
$args->skin = '.';
$output = executeQueryArray('module.getModuleSkinDotList', $args);
if($output->data && count($output->data) > 0)
{
foreach($output->data as $item)
{
$skin_path = explode('.', $item->skin);
if(count($skin_path) != 2) continue;
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1]))) return true;
}
}
return false; return false;
} }
@ -315,6 +327,24 @@
$oDB->addColumn('module_config', 'site_srl', 'number', 11, 0, true); $oDB->addColumn('module_config', 'site_srl', 'number', 11, 0, true);
} }
FileHandler::makeDir('./files/ruleset'); FileHandler::makeDir('./files/ruleset');
$args->skin = '.';
$output = executeQueryArray('module.getModuleSkinDotList', $args);
if($output->data && count($output->data) > 0)
{
foreach($output->data as $item)
{
$skin_path = explode('.', $item->skin);
if(count($skin_path) != 2) continue;
if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/modules/%s', $skin_path[0], $skin_path[1])))
{
unset($args);
$args->skin = $item->skin;
$args->new_skin = implode('|@|', $skin_path);
$output = executeQuery('module.updateSkinAll', $args);
}
}
}
return new Object(0, 'success_updated'); return new Object(0, 'success_updated');
} }

View file

@ -0,0 +1,15 @@
<query id="getModuleSkinDotList" action="select">
<tables>
<table name="modules" />
</tables>
<columns>
<column name="module" />
<column name="skin" />
</columns>
<conditions>
<condition operation="like" column="skin" var="skin" default="." />
</conditions>
<groups>
<group column="skin" />
</groups>
</query>

View file

@ -0,0 +1,11 @@
<query id="updateSkinAll" action="update">
<tables>
<table name="modules" />
</tables>
<columns>
<column name="skin" var="new_skin" />
</columns>
<conditions>
<condition operation="equal" column="skin" var="skin" notnull="notnull" />
</conditions>
</query>

View file

@ -2,42 +2,42 @@
<h3 class="pTitle1">{$lang->cmd_view_member_info}</h3> <h3 class="pTitle1">{$lang->cmd_view_member_info}</h3>
<table cellspacing="0" cellpadding="0" class="rowTable"> <table cellspacing="0" cellpadding="0" class="rowTable">
<!--@foreach($member_config->signupForm as $no=>$formInfo)--> <!--@foreach($member_config->signupForm as $no=>$formInfo)-->
<!--@if($formInfo->isUse && ($formInfo->name != 'password' && $formInfo->name != 'find_account_question'))--> <!--@if($formInfo->isUse && ($formInfo->name != 'password' && $formInfo->name != 'find_account_question'))-->
<!--@if($formInfo->isDefaultForm)--> <!--@if($formInfo->isDefaultForm)-->
{@$title = $formInfo->title} {@$title = Context::getLang($formInfo->name)}
{@$value = $memberInfo[$formInfo->name]} {@$value = $memberInfo[$formInfo->name]}
<!--@if($formInfo->name == 'profile_image' && $memberInfo['profile_image'])--> <!--@if($formInfo->name == 'profile_image' && $memberInfo['profile_image'])-->
{@$target = $memberInfo['profile_image']} {@$target = $memberInfo['profile_image']}
{@$value = '<img src="'.$target->src.'" />'} {@$value = '<img src="'.$target->src.'" />'}
<!--@elseif($formInfo->name == 'image_name' && $memberInfo['image_name'])--> <!--@elseif($formInfo->name == 'image_name' && $memberInfo['image_name'])-->
{@$target = $memberInfo['image_name']} {@$target = $memberInfo['image_name']}
{@$value = '<img src="'.$target->src.'" />'} {@$value = '<img src="'.$target->src.'" />'}
<!--@elseif($formInfo->name == 'image_mark' && $memberInfo['image_mark'])--> <!--@elseif($formInfo->name == 'image_mark' && $memberInfo['image_mark'])-->
{@$target = $memberInfo['image_mark']} {@$target = $memberInfo['image_mark']}
{@$value = '<img src="'.$target->src.'" />'} {@$value = '<img src="'.$target->src.'" />'}
<!--@end--> <!--@end-->
<!--@else--> <!--@else-->
{@$title = $extend_form_list[$formInfo->member_join_form_srl]->column_title} {@$title = $extend_form_list[$formInfo->member_join_form_srl]->column_title}
{@$orgValue = $extend_form_list[$formInfo->member_join_form_srl]->value} {@$orgValue = $extend_form_list[$formInfo->member_join_form_srl]->value}
<!--@if($formInfo->type=='tel')--> <!--@if($formInfo->type=='tel')-->
{@$value = htmlspecialchars($orgValue[0])} {@$value = $orgValue[0]}
<!--@if($orgValue[1])-->-<!--@end--> <!--@if($orgValue[1])-->{@$value .= '-'}<!--@end-->
{@$value .= htmlspecialchars($orgValue[1])} {@$value .= $orgValue[1]}
<!--@if($orgValue[2])-->-<!--@end--> <!--@if($orgValue[2])-->{@$value .= '-'}<!--@end-->
{@$value .= htmlspecialchars($orgValue[2])} {@$value .= $orgValue[2]}
<!--@elseif($formInfo->type=='kr_zip')--> <!--@elseif($formInfo->type=='kr_zip')-->
{@$value = htmlspecialchars($orgValue[0])}<!--@if($orgValue[1]&&$orgValue[0])--><br /><!--@end-->{@$value .= htmlspecialchars($orgValue[1])} {@$value = $orgValue[0]}<!--@if($orgValue[1]&&$orgValue[0])--><br /><!--@end-->{@$value .= ' ' .$orgValue[1]}
<!--@elseif($formInfo->type=='checkbox' && is_array($orgValue))--> <!--@elseif($formInfo->type=='checkbox' && is_array($orgValue))-->
{@$value = htmlspecialchars(implode(", ",$orgValue))} {@$value = implode(", ",$orgValue)}
<!--@elseif($formInfo->type=='date')--> <!--@elseif($formInfo->type=='date')-->
{@$value = zdate($orgValue, "Y-m-d")} {@$value = zdate($orgValue, "Y-m-d")}
<!--@else--> <!--@else-->
{@$value = nl2br(htmlspecialchars($orgValue))} {@$value = nl2br($orgValue)}
<!--@end--> <!--@end-->
<!--@end--> <!--@end-->
<tr> <tr cond="$memberInfo['member_srl'] == $logged_info->member_srl || $formInfo->isPublic == 'Y'">
<th scope="row" >{$title} <em cond="$formInfo->required || $formInfo->mustRequired">*</em></th> <th scope="row" >{$title} <em cond="$formInfo->required || $formInfo->mustRequired">*</em></th>
<td class="text">{$value}</td> <td class="text">{$value}</td>
</tr> </tr>