mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 20:12:14 +09:00
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:
parent
ee58f755a8
commit
c8c03a898c
10 changed files with 93 additions and 26 deletions
|
|
@ -18,16 +18,16 @@
|
||||||
<action name="dispLayoutAdminDownloadedMobileList" type="view" standalone="true" />
|
<action name="dispLayoutAdminDownloadedMobileList" type="view" standalone="true" />
|
||||||
|
|
||||||
|
|
||||||
<action name="procLayoutAdminInsert" type="controller" standalone="true" />
|
<action name="procLayoutAdminInsert" type="controller" standalone="true" ruleset="insertLayout" />
|
||||||
<action name="procLayoutAdminUpdate" type="controller" standalone="true" />
|
<action name="procLayoutAdminUpdate" type="controller" standalone="true" ruleset="updateLayout" />
|
||||||
<action name="procLayoutAdminDelete" type="controller" standalone="true" />
|
<action name="procLayoutAdminDelete" type="controller" standalone="true" />
|
||||||
<action name="procLayoutAdminCodeUpdate" type="controller" standalone="true" />
|
<action name="procLayoutAdminCodeUpdate" type="controller" standalone="true" ruleset="codeUpdate" />
|
||||||
<action name="procLayoutAdminCodeReset" type="controller" standalone="true" />
|
<action name="procLayoutAdminCodeReset" type="controller" standalone="true" />
|
||||||
<action name="procLayoutAdminUserImageUpload" type="controller" standalone="true" />
|
<action name="procLayoutAdminUserImageUpload" type="controller" standalone="true" ruleset="imageUpload" />
|
||||||
<action name="procLayoutAdminUserImageDelete" type="controller" standalone="true" />
|
<action name="procLayoutAdminUserImageDelete" type="controller" standalone="true" />
|
||||||
<action name="procLayoutAdminUserValueInsert" type="controller" standalone="true" />
|
<action name="procLayoutAdminUserValueInsert" type="controller" standalone="true" />
|
||||||
<action name="procLayoutAdminUserLayoutExport" type="controller" standalone="true" />
|
<action name="procLayoutAdminUserLayoutExport" type="controller" standalone="true" />
|
||||||
<action name="procLayoutAdminUserLayoutImport" type="controller" standalone="true" />
|
<action name="procLayoutAdminUserLayoutImport" type="controller" standalone="true" ruleset="userLayoutImport" />
|
||||||
|
|
||||||
</actions>
|
</actions>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,20 @@
|
||||||
$this->initLayout($args->layout_srl, $args->layout);
|
$this->initLayout($args->layout_srl, $args->layout);
|
||||||
// Return result
|
// Return result
|
||||||
$this->add('layout_srl', $args->layout_srl);
|
$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
|
// Insert layout information into the DB
|
||||||
function insertLayout($args) {
|
function insertLayout($args) {
|
||||||
$output = executeQuery("layout.insertLayout", $args);
|
$output = executeQuery("layout.insertLayout", $args);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initiate if it is faceoff layout
|
// Initiate if it is faceoff layout
|
||||||
function initLayout($layout_srl, $layout_name){
|
function initLayout($layout_srl, $layout_name){
|
||||||
$oLayoutModel = &getModel('layout');
|
$oLayoutModel = &getModel('layout');
|
||||||
|
|
@ -162,10 +170,15 @@
|
||||||
$output = $this->updateLayout($args);
|
$output = $this->updateLayout($args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
||||||
$this->setLayoutPath('./common/tpl');
|
//$this->setLayoutPath('./common/tpl');
|
||||||
$this->setLayoutFile('default_layout.html');
|
//$this->setLayoutFile('default_layout.html');
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
//$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile("top_refresh.html");
|
//$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) {
|
function updateLayout($args) {
|
||||||
|
|
@ -221,12 +234,12 @@
|
||||||
$layout_css_file = $oLayoutModel->getUserLayoutCss($layout_srl);
|
$layout_css_file = $oLayoutModel->getUserLayoutCss($layout_srl);
|
||||||
FileHandler::writeFile($layout_css_file, $code_css);
|
FileHandler::writeFile($layout_css_file, $code_css);
|
||||||
|
|
||||||
if($is_post) {
|
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||||
if(!$return_url) $return_url = getUrl('module','admin','act','dispLayoutAdminEdit', 'layout_srl', $layout_srl);
|
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispLayoutAdminEdit', 'layout_srl', $layout_srl);
|
||||||
header('Location: '.$return_url);
|
header('location:'.$returnUrl);
|
||||||
} else {
|
return;
|
||||||
$this->setMessage('success_updated');
|
|
||||||
}
|
}
|
||||||
|
$this->setMessage('success_updated');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -266,13 +279,15 @@
|
||||||
$layout_srl = Context::get('layout_srl');
|
$layout_srl = Context::get('layout_srl');
|
||||||
if(!is_uploaded_file($image['tmp_name'])) exit();
|
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->insertUserLayoutImage($layout_srl, $image);
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile("top_refresh.html");
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
10
modules/layout/ruleset/codeUpdate.xml
Normal file
10
modules/layout/ruleset/codeUpdate.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ruleset version="1.5.0">
|
||||||
|
<customrules>
|
||||||
|
<rule name="imageExtension" type="regex" test="/\.(gif|jpg|jpeg|gif|png|swf|flv)$/i" />
|
||||||
|
</customrules>
|
||||||
|
<fields>
|
||||||
|
<field name="user_layout_image['name']" required="true" rule="imageExtension" />
|
||||||
|
<field name="layout_srl" required="true" rule="number" />
|
||||||
|
</fields>
|
||||||
|
</ruleset>
|
||||||
10
modules/layout/ruleset/imageUpload.xml
Normal file
10
modules/layout/ruleset/imageUpload.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ruleset version="1.5.0">
|
||||||
|
<customrules>
|
||||||
|
<rule name="imageExtension" type="regex" test="/\.(gif|jpg|jpeg|gif|png|swf|flv)$/i" />
|
||||||
|
</customrules>
|
||||||
|
<fields>
|
||||||
|
<field name="user_layout_image['name']" required="true" rule="imageExtension" />
|
||||||
|
<field name="layout_srl" required="true" rule="number" />
|
||||||
|
</fields>
|
||||||
|
</ruleset>
|
||||||
8
modules/layout/ruleset/insertLayout.xml
Normal file
8
modules/layout/ruleset/insertLayout.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ruleset version="1.5.0">
|
||||||
|
<customrules>
|
||||||
|
</customrules>
|
||||||
|
<fields>
|
||||||
|
<field name="title" required="true" length="1:250" />
|
||||||
|
</fields>
|
||||||
|
</ruleset>
|
||||||
8
modules/layout/ruleset/updateLayout.xml
Normal file
8
modules/layout/ruleset/updateLayout.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ruleset version="1.5.0">
|
||||||
|
<customrules>
|
||||||
|
</customrules>
|
||||||
|
<fields>
|
||||||
|
<field name="title" required="true" length="1:250" />
|
||||||
|
</fields>
|
||||||
|
</ruleset>
|
||||||
10
modules/layout/ruleset/userLayoutImport.xml
Normal file
10
modules/layout/ruleset/userLayoutImport.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ruleset version="1.5.0">
|
||||||
|
<customrules>
|
||||||
|
<rule name="importExtension" type="regex" test="/\.(tar)$/i" />
|
||||||
|
</customrules>
|
||||||
|
<fields>
|
||||||
|
<field name="file['name']" required="true" rule="importExtension" />
|
||||||
|
<field name="layout_srl" required="true" rule="number" />
|
||||||
|
</fields>
|
||||||
|
</ruleset>
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<!--%import("filter/insert_layout.xml")-->
|
|
||||||
|
|
||||||
<!--#include("header.html")-->
|
<!--#include("header.html")-->
|
||||||
|
|
||||||
<form action="./" method="get" onsubmit="return procFilter(this, insert_layout)">
|
<p class="xe_validator_error">{$XE_VALIDATOR_ERROR}</p>
|
||||||
|
<form ruleset="insertLayout" action="./" method="post">
|
||||||
|
<input type="hidden" name="act" value="procLayoutAdminInsert" />
|
||||||
<input type="hidden" name="layout_type" value="{$layout_type}" />
|
<input type="hidden" name="layout_type" value="{$layout_type}" />
|
||||||
|
|
||||||
<table cellspacing="0" class="rowTable">
|
<table cellspacing="0" class="rowTable">
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,9 @@
|
||||||
|
|
||||||
<h4 class="xeAdmin">{$lang->layout_image_repository}</h4>
|
<h4 class="xeAdmin">{$lang->layout_image_repository}</h4>
|
||||||
<p class="summary">{nl2br($lang->about_layout_image_repository)}</p>
|
<p class="summary">{nl2br($lang->about_layout_image_repository)}</p>
|
||||||
<form action="{Context::getRequestUri()}" target="hidden_iframe" method="post" onsubmit="return checkFile(this)" enctype="multipart/form-data">
|
|
||||||
|
<p class="xe_validator_error">{$XE_VALIDATOR_ERROR}</p>
|
||||||
|
<form ruleset="imageUpload" action="{Context::getRequestUri()}" method="post" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="module" value="layout" />
|
<input type="hidden" name="module" value="layout" />
|
||||||
<input type="hidden" name="act" value="procLayoutAdminUserImageUpload" />
|
<input type="hidden" name="act" value="procLayoutAdminUserImageUpload" />
|
||||||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||||
|
|
@ -70,7 +72,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><div>{$lang->layout_import}</div></th>
|
<th scope="row"><div>{$lang->layout_import}</div></th>
|
||||||
<td>
|
<td>
|
||||||
<form action="{getUrl('')}" method="post" enctype="multipart/form-data" target="hidden_iframe">
|
<form ruleset="userLayoutImport" action="{getUrl('')}" method="post" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="module" value="layout" />
|
<input type="hidden" name="module" value="layout" />
|
||||||
<input type="hidden" name="act" value="procLayoutAdminUserLayoutImport" />
|
<input type="hidden" name="act" value="procLayoutAdminUserLayoutImport" />
|
||||||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||||
|
|
@ -84,7 +86,7 @@
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
|
|
||||||
|
|
||||||
<form id="fo_layout" action="{getUrl('','module','admin')}" method="post">
|
<form ruleset="codeUpdate" id="fo_layout" action="{getUrl('','module','admin')}" method="post">
|
||||||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||||
<input type="hidden" name="act" value="procLayoutAdminCodeUpdate" />
|
<input type="hidden" name="act" value="procLayoutAdminCodeUpdate" />
|
||||||
<input type="hidden" name="_filter" value="update_layout_code" />
|
<input type="hidden" name="_filter" value="update_layout_code" />
|
||||||
|
|
@ -109,9 +111,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="button">
|
<th class="button">
|
||||||
<span class="button black strong"><button type="submit" onclick="this.form.act.value='procLayoutAdminCodeUpdate'">{$lang->cmd_save}</button></span>
|
<span class="button black strong"><button type="submit">{$lang->cmd_save}</button></span>
|
||||||
<span class="button"><button type="button" onclick="doPreviewLayoutCode();">{$lang->cmd_preview}</button></span>
|
<span class="button"><button type="button" onclick="doPreviewLayoutCode();">{$lang->cmd_preview}</button></span>
|
||||||
<span class="button red"><button type="reset" onclick="doResetLayoutCode('{$layout_srl}')">{$lang->cmd_reset}</button></span>
|
<span class="button red"><button type="reset" onclick="doResetLayoutCode('{$layout_srl}')">{$lang->cmd_reset}</button></span>
|
||||||
|
<!--button type="submit" name="act" value="procCommunicationMoveFriend">{$lang->cmd_move}</button>
|
||||||
|
<button type="submit" name="act" value="procCommunicationDeleteFriend">{$lang->cmd_delete}</button-->
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="fo_layout" action="./" method="post" enctype="multipart/form-data" target="hidden_iframe">
|
<p class="xe_validator_error">{$XE_VALIDATOR_ERROR}</p>
|
||||||
|
<form ruleset="updateLayout" id="fo_layout" action="./" method="post" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="module" value="layout" />
|
<input type="hidden" name="module" value="layout" />
|
||||||
<input type="hidden" name="act" value="procLayoutAdminUpdate" />
|
<input type="hidden" name="act" value="procLayoutAdminUpdate" />
|
||||||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||||
|
|
@ -176,5 +177,6 @@
|
||||||
<a href="{getUrl('act','')}" class="button"><span>{$lang->cmd_back}</span></a>
|
<a href="{getUrl('act','')}" class="button"><span>{$lang->cmd_back}</span></a>
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
<iframe name="hidden_iframe" frameborder="0" style="display:none"></iframe>
|
<iframe name="hidden_iframe" frameborder="0" style="display:none"></iframe>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue