issue 46 apply server side validator in comment module

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8494 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2011-06-16 01:48:33 +00:00
parent d904eb32f5
commit 657061e16a
7 changed files with 40 additions and 13 deletions

View file

@ -22,7 +22,8 @@
// Error display if none is selected
$cart = Context::get('cart');
if(!$cart) return $this->stop('msg_cart_is_null');
$comment_srl_list= explode('|@|', $cart);
if(!is_array($cart)) $comment_srl_list= explode('|@|', $cart);
else $comment_srl_list = $cart;
$comment_count = count($comment_srl_list);
if(!$comment_count) return $this->stop('msg_cart_is_null');
@ -52,6 +53,12 @@
$oDB->commit();
$this->setMessage( sprintf(Context::getLang('msg_checked_comment_is_deleted'), $deleted_count) );
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispCommentAdminList');
header('location:'.$returnUrl);
return;
}
}
function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB)
@ -63,7 +70,7 @@
$logged_info = Context::get('logged_info');
$oCommentModel = &getModel('comment');
$commentItemList = $oCommentModel->getComments($commentSrlList);
$oTrashController = &getController('trash');
$oTrashAdminController = &getAdminController('trash');
foreach($commentItemList AS $key=>$oComment)
{
@ -76,7 +83,7 @@
$oTrashVO->setRemoverSrl($logged_info->member_srl);
$oTrashVO->setRegdate(date('YmdHis'));
$output = $oTrashController->insertTrash($oTrashVO);
$output = $oTrashAdminController->insertTrash($oTrashVO);
if (!$output->toBool()) {
$oDB->rollback();
return $output;

View file

@ -10,8 +10,8 @@
<action name="procCommentVoteDown" type="controller" standalone="true" />
<action name="procCommentDeclare" type="controller" standalone="true" />
<action name="getCommentVotedMemberList" type="model" standalone="true" />
<action name="procCommentInsertModuleConfig" type="controller" standalone="true" />
<action name="procCommentAdminDeleteChecked" type="controller" standalone="true" />
<action name="procCommentInsertModuleConfig" type="controller" standalone="true" ruleset="insertCommentModuleConfig" />
<action name="procCommentAdminDeleteChecked" type="controller" standalone="true" ruleset="deleteChecked" />
<action name="procCommentAdminCancelDeclare" type="controller" standalone="true" />
</actions>
</module>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<ruleset version="1.5.0">
<customrules>
</customrules>
<fields>
<field name="cart" required="true"/>
</fields>
</ruleset>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<ruleset version="1.5.0">
<customrules>
</customrules>
<fields>
<field name="comment_count" required="true" rule="number"/>
</fields>
</ruleset>

View file

@ -1,4 +1,3 @@
<!--%import("filter/delete_checked.xml")-->
<!--#include("./header.html")-->
<!-- 검색 -->
@ -21,7 +20,10 @@
</form>
</div>
<form id="fo_list" action="./" method="get" onsubmit="return procFilter(this, delete_checked)">
<!--form id="fo_list" action="./" method="get" onsubmit="return procFilter(this, delete_checked)"-->
<p class="xe_validator_error">{$XE_VALIDATOR_ERROR}</p>
<form ruleset="deleteChecked" id="fo_list" action="./" method="post">
<input type="hidden" name="act" value="procCommentAdminDeleteChecked" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="is_trash" value="false" />
@ -50,7 +52,7 @@
{@ $comment = cut_str(trim(htmlspecialchars(strip_tags($val->content))), 200, '...')}
<tr>
<td class="number center">{$no}</td>
<td class="center"><input type="checkbox" name="cart" value="{$val->comment_srl}" /></td>
<td class="center"><input type="checkbox" name="cart[]" value="{$val->comment_srl}" /></td>
<td class="left"><a href="{getUrl('','document_srl',$val->document_srl)}#comment_{$val->comment_srl}" onclick="window.open(this.href);return false;"><!--@if(strlen($comment))-->{$comment}<!--@else--><em style="font-style:italic;">{$lang->no_text_comment}</em><!--@end--></a></td>
<td class="nowrap"><span class="member_{$val->member_srl}">{htmlspecialchars($val->nick_name)}</span></td>
<td class="date center nowrap">{(zdate($val->regdate,"Y-m-d\nH:i:s"))}</td>

View file

@ -1,6 +1,6 @@
<!--%import("filter/insert_comment_module_config.xml")-->
<form action="./" method="post" onsubmit="return procFilter(this, insert_comment_module_config)">
<p class="xe_validator_error">{$XE_VALIDATOR_ERROR}</p>
<form ruleset="insertCommentModuleConfig" action="./" method="post">
<input type="hidden" name="act" value="procCommentInsertModuleConfig" />
<input type="hidden" name="target_module_srl" value="{$module_info->module_srl?$module_info->module_srl:$module_srls}" />
<h4 class="xeAdmin">{$lang->comment}</h4>

View file

@ -1,7 +1,9 @@
<!--%import("filter/delete_checked.xml")-->
<!--#include("header.html")-->
<form id="fo_list" action="./" method="get" onsubmit="return procFilter(this, delete_checked)">
<p class="xe_validator_error">{$XE_VALIDATOR_ERROR}</p>
<form ruleset="deleteChecked" id="fo_list" action="./" method="post">
<input type="hidden" name="act" value="procCommentAdminDeleteChecked" />
<input type="hidden" value="{getUrl('', 'module', $module, 'act', $act)}" name="success_return_url">
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="is_trash" value="false" />