issue 46 validator apply to layout module

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8513 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2011-06-21 08:31:10 +00:00
parent ee58f755a8
commit c8c03a898c
10 changed files with 93 additions and 26 deletions

View file

@ -33,12 +33,20 @@
$this->initLayout($args->layout_srl, $args->layout);
// Return result
$this->add('layout_srl', $args->layout_srl);
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispLayoutAdminContent');
header('location:'.$returnUrl);
return;
}
}
// Insert layout information into the DB
function insertLayout($args) {
$output = executeQuery("layout.insertLayout", $args);
return $output;
}
// Initiate if it is faceoff layout
function initLayout($layout_srl, $layout_name){
$oLayoutModel = &getModel('layout');
@ -162,10 +170,15 @@
$output = $this->updateLayout($args);
if(!$output->toBool()) return $output;
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('default_layout.html');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile("top_refresh.html");
//$this->setLayoutPath('./common/tpl');
//$this->setLayoutFile('default_layout.html');
//$this->setTemplatePath($this->module_path.'tpl');
//$this->setTemplateFile("top_refresh.html");
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispLayoutAdminModify', 'layout_srl', Context::get('layout_srl'));
header('location:'.$returnUrl);
return;
}
}
function updateLayout($args) {
@ -221,12 +234,12 @@
$layout_css_file = $oLayoutModel->getUserLayoutCss($layout_srl);
FileHandler::writeFile($layout_css_file, $code_css);
if($is_post) {
if(!$return_url) $return_url = getUrl('module','admin','act','dispLayoutAdminEdit', 'layout_srl', $layout_srl);
header('Location: '.$return_url);
} else {
$this->setMessage('success_updated');
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispLayoutAdminEdit', 'layout_srl', $layout_srl);
header('location:'.$returnUrl);
return;
}
$this->setMessage('success_updated');
}
/**
@ -266,13 +279,15 @@
$layout_srl = Context::get('layout_srl');
if(!is_uploaded_file($image['tmp_name'])) exit();
if(!preg_match('/\.(gif|jpg|jpeg|gif|png|swf|flv)$/i', $image['name'])){
return false;
}
$this->insertUserLayoutImage($layout_srl, $image);
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile("top_refresh.html");
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispLayoutAdminEdit', 'layout_srl', Context::get('layout_srl'));
header('location:'.$returnUrl);
return;
}
}
/**