merger from branch luminous (~r11576)

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@11580 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-10-04 05:04:23 +00:00
commit 51bb8d1985
91 changed files with 1157 additions and 703 deletions

View file

@ -272,9 +272,6 @@
return new Object(-1, 'msg_invalid_request');
}
$code = preg_replace('/<\?.*(\?>)?/Usm', '', $code);
$code = preg_replace('/<script[\s]*language[\s]*=("|\')php("|\')[\s]*>.*<\/script>/Usm', '', $code);
$oLayoutModel = &getModel('layout');
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_srl);
FileHandler::writeFile($layout_file, $code);

View file

@ -101,6 +101,8 @@
$layout_list[$item->layout][] = $item;
}
usort($layout_list, array($this, 'sortLayoutInstance'));
Context::set('layout_list', $layout_list);
$this->setTemplateFile('layout_all_instance_list');
@ -109,6 +111,22 @@
$security->encodeHTML('layout_list..');
}
/**
* Sort layout instance by layout name, instance name
*/
function sortLayoutInstance($a, $b)
{
$aTitle = strtolower($a['title']);
$bTitle = strtolower($b['title']);
if($aTitle == $bTitle)
{
return 0;
}
return ($aTitle < $bTitle) ? -1 : 1;
}
/**
* Display list of pc layout instance
* @return void|Object (void : success, Object : fail)
@ -425,7 +443,7 @@
}
if(count($style)) {
$script = '<script> var faceOffStyle = {'.implode(',',$style).'}; </script>';
$script = '<script type="text/javascript"> var faceOffStyle = {'.implode(',',$style).'}; </script>';
Context::addHtmlHeader($script);
}

View file

@ -232,7 +232,7 @@
$searched_count = count($searched_list);
if(!$searched_count) return;
natcasesort($searched_list);
// natcasesort($searched_list);
// Return information for looping searched list of layouts
$list = array();
for($i=0;$i<$searched_count;$i++) {
@ -241,6 +241,11 @@
// Get information of the layout
$layout_info = $this->getLayoutInfo($layout, null, $layout_type);
if(!$layout_info)
{
continue;
}
if ($withAutoinstallInfo)
{
// get easyinstall remove url
@ -259,9 +264,37 @@
}
$list[] = $layout_info;
}
usort($list, array($this, 'sortLayoutByTitle'));
return $list;
}
/**
* Sort layout by title
*/
function sortLayoutByTitle($a, $b)
{
if(!$a->title)
{
$a->title = $a->layout;
}
if(!$b->title)
{
$b->title = $b->layout;
}
$aTitle = strtolower($a->title);
$bTitle = strtolower($b->title);
if($aTitle == $bTitle)
{
return 0;
}
return ($aTitle < $bTitle) ? -1 : 1;
}
/**
* Get a count of layout
* @param string $layoutType (P : PC, M : Mobile)
@ -327,6 +360,7 @@
// Read the xml file for module skin information
if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path);
if(!file_exists($xml_file)) {
$layout_info->title = $layout;
$layout_info->layout = $layout;
$layout_info->path = $layout_path;
$layout_info->layout_title = $layout_title;
@ -343,6 +377,7 @@
if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) {
@include($cache_file);
if($layout_info->extra_var && $vars) {
foreach($vars as $key => $value) {
if(!$layout_info->extra_var->{$key} && !$layout_info->{$key}) {
@ -350,6 +385,12 @@
}
}
}
if(!$layout_info->title)
{
$layout_info->title = $layout;
}
return $layout_info;
}
// If no cache file exists, parse the xml and then return the variable.
@ -579,6 +620,12 @@
$buff = '<?php if(!defined("__ZBXE__")) exit(); '.$buff.' ?>';
FileHandler::writeFile($cache_file, $buff);
if(file_exists($cache_file)) @include($cache_file);
if(!$layout_info->title)
{
$layout_info->title = $layout;
}
return $layout_info;
}

View file

@ -146,9 +146,6 @@
$layout_srl = Context::get('layout_srl');
$code = Context::get('code');
$code = preg_replace('/<\?.*(\?>)?/Usm', '', $code);
$code = preg_replace('/<script[\s]*language[\s]*=("|\')php("|\')[\s]*>.*<\/script>/Usm', '', $code);
$code_css = Context::get('code_css');
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
// Get the layout information

View file

@ -96,6 +96,12 @@
<option loop="$var->options => $key, $val" value="{$key}" selected="selected"|cond="$key == $var->value">{$val->val}</option>
</select>
<block cond="$var->type == 'checkbox'">
<block loop="$var->options => $key, $val">
<label><input type="checkbox" name="{$name}[]" value="{$key}" checked="checked"|cond="@in_array($key, $var->value)" /> {$val->val}</label>
</block>
</block>
<block cond="$var->type == 'radio'">
<block loop="$var->options => $key, $val">
<block cond="$val->thumbnail">