issue 1571, Added a feature for setting of mobile skin

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.1@10872 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-07-12 07:25:00 +00:00
parent 1fd16401d9
commit 14961c7c9a
11 changed files with 363 additions and 162 deletions

View file

@ -738,6 +738,10 @@
foreach($extra_var_groups as $group) {
$extra_vars = $group->var;
if(!$extra_vars)
{
continue;
}
if(!is_array($group->var)) $extra_vars = array($group->var);
foreach($extra_vars as $key => $val) {
@ -893,7 +897,7 @@
$title = $color->title->body;
$screenshot = $color->attrs->src;
if($screenshot) {
$screenshot = sprintf("%sskins/%s/%s", $path, $skin, $screenshot);
$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
if(!file_exists($screenshot)) $screenshot = "";
} else $screenshot = "";
@ -1290,15 +1294,67 @@
**/
function syncSkinInfoToModuleInfo(&$module_info) {
if(!$module_info->module_srl) return;
if(Mobile::isFromMobilePhone())
{
$cache_key = 'object_module_mobile_skin_vars:' . $module_info->module_srl;
$query = 'module.getModuleMobileSkinVars';
}
else
{
$cache_key = 'object_module_skin_vars:' . $module_info->module_srl;
$query = 'module.getModuleSkinVars';
}
// cache controll
$oCacheHandler = &CacheHandler::getInstance('object');
if($oCacheHandler->isSupport()){
$cache_key = 'object_module_skin_vars:'.$module_info->module_srl;
$output = $oCacheHandler->get($cache_key);
}
if(!$output) {
$args->module_srl = $module_info->module_srl;
$output = executeQueryArray('module.getModuleSkinVars',$args);
$output = executeQueryArray($query,$args);
//insert in cache
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$output);
}
if(!$output->toBool() || !$output->data) return;
foreach($output->data as $val) {
if(isset($module_info->{$val->name})) continue;
$module_info->{$val->name} = $val->value;
}
}
/**
* Get mobile skin information of the module
* @param $module_srl Sequence of module
* @return array
**/
function getModuleMobileSkinVars($module_srl) {
$args->module_srl = $module_srl;
$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
if(!$output->toBool() || !$output->data) return;
$skin_vars = array();
foreach($output->data as $val) $skin_vars[$val->name] = $val;
return $skin_vars;
}
/**
* Combine skin information with module information
* @param $module_info Module information
**/
function syncMobileSkinInfoToModuleInfo(&$module_info) {
if(!$module_info->module_srl) return;
// cache controll
$oCacheHandler = &CacheHandler::getInstance('object');
if($oCacheHandler->isSupport()){
$cache_key = 'object_module_mobile_skin_vars:'.$module_info->module_srl;
$output = $oCacheHandler->get($cache_key);
}
if(!$output) {
$args->module_srl = $module_info->module_srl;
$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
//insert in cache
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$output);
}