#19560480 추천 비추천 기능개선

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@8112 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ngleader 2011-02-21 01:38:28 +00:00
parent b230d45a71
commit 9b8e32d45b
10 changed files with 223 additions and 23 deletions

View file

@ -22,6 +22,15 @@
$comment_srl = Context::get('target_srl');
if(!$comment_srl) return new Object(-1, 'msg_invalid_request');
$oCommentModel = &getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl, false, false);
$module_srl = $oComment->get('module_srl');
if(!$module_srl) return new Object(-1, 'msg_invalid_request');
$oModuleModel = &getModel('module');
$comment_config = $oModuleModel->getModulePartConfig('comment',$module_srl);
if($comment_config->use_vote_up=='N') return new Object(-1, 'msg_invalid_request');
$point = 1;
return $this->updateVotedCount($comment_srl, $point);
}
@ -35,6 +44,15 @@
$comment_srl = Context::get('target_srl');
if(!$comment_srl) return new Object(-1, 'msg_invalid_request');
$oCommentModel = &getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl, false, false);
$module_srl = $oComment->get('module_srl');
if(!$module_srl) return new Object(-1, 'msg_invalid_request');
$oModuleModel = &getModel('module');
$comment_config = $oModuleModel->getModulePartConfig('comment',$module_srl);
if($comment_config->use_vote_down=='N') return new Object(-1, 'msg_invalid_request');
$point = -1;
return $this->updateVotedCount($comment_srl, $point);
}
@ -596,20 +614,28 @@
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
else $module_srl = array($module_srl);
$comment_count = (int)Context::get('comment_count');
$comment_config->comment_count = (int)Context::get('comment_count');
if(!$comment_config->comment_count) $comment_config->comment_count = 50;
$comment_config->use_vote_up = Context::get('use_vote_up');
if(!$comment_config->use_vote_up) $comment_config->use_vote_up = 'Y';
if($comment_config->use_vote_up!='Y') $comment_config->use_vote_up = 'N';
$comment_config->use_vote_down = Context::get('use_vote_down');
if(!$comment_config->use_vote_down) $comment_config->use_vote_down = 'Y';
if($comment_config->use_vote_down!='Y') $comment_config->use_vote_down = 'N';
for($i=0;$i<count($module_srl);$i++) {
$srl = trim($module_srl[$i]);
if(!$srl) continue;
$output = $this->setCommentModuleConfig($srl,$comment_count);
$output = $this->setCommentModuleConfig($srl,$comment_config);
}
$this->setError(-1);
$this->setMessage('success_updated');
}
function setCommentModuleConfig($srl, $comment_count=50){
$comment_config->comment_count = $comment_count;
function setCommentModuleConfig($srl, $comment_config){
$oModuleController = &getController('module');
$oModuleController->insertModulePartConfig('comment',$srl,$comment_config);
return new Object();

View file

@ -37,13 +37,23 @@
// 회원이어야만 가능한 기능
if($logged_info->member_srl) {
// 추천 버튼 추가
$url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url,'cmd_vote','./modules/document/tpl/icons/vote_up.gif','javascript');
$oCommentModel = &getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl, false, false);
$module_srl = $oComment->get('module_srl');
$member_srl = $oComment->get('member_srl');
// 비추천 버튼 추가
$url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url,'cmd_vote_down','./modules/document/tpl/icons/vote_down.gif','javascript');
$oModuleModel = &getModel('module');
$comment_config = $oModuleModel->getModulePartConfig('document',$module_srl);
if($comment_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl){
// 추천 버튼 추가
$url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url,'cmd_vote','./modules/document/tpl/icons/vote_up.gif','javascript');
}
if($comment_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl){
// 비추천 버튼 추가
$url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url,'cmd_vote_down','./modules/document/tpl/icons/vote_down.gif','javascript');
}
// 신고 기능 추가
$url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl);
@ -417,5 +427,29 @@
return $comment_config;
}
function getCommentVotedMemberList()
{
$comment_srl = Context::get('comment_srl');
if(!$comment_srl) return new Object(-1,'msg_invalid_request');
$point = Context::get('point');
if($point != -1) $point = 1;
$args->comment_srl = $comment_srl;
$args->point = $point;
$output = executeQueryArray('comment.getVotedMemberList',$args);
if(!$output->toBool()) return $output;
$oMemberModel = &getModel('member');
if($output->data){
foreach($output->data as $k => $d){
$profile_image = $oMemberModel->getProfileImage($d->member_srl);
$output->data[$k]->src = $profile_image->src;
}
}
$this->add('voted_member_list',$output->data);
}
}
?>

View file

@ -9,6 +9,7 @@
<action name="procCommentVoteUp" type="controller" standalone="true" />
<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="procCommentAdminCancelDeclare" type="controller" standalone="true" />

View file

@ -0,0 +1,18 @@
<query id="getVotedMemberList" action="select">
<tables>
<table name="comment_voted_log" alias="voted_log" />
<table name="member" alias="member" />
</tables>
<columns>
<column name="member.member_srl" alias="member_srl" />
<column name="member.nick_name" alias="nick_name" />
</columns>
<conditions>
<condition operation="equal" column="voted_log.comment_srl" var="comment_srl" filter="number" notnull="notnull" />
<condition operation="equal" column="voted_log.point" var="point" notnull="notnull" pipe="and" />
<condition operation="equal" column="voted_log.member_srl" default="member.member_srl" pipe="and" />
</conditions>
<navigation>
<index var="sort_index" default="voted_log.regdate" order="desc" />
</navigation>
</query>

View file

@ -4,14 +4,34 @@
<input type="hidden" name="target_module_srl" value="{$module_info->module_srl?$module_info->module_srl:$module_srls}" />
<h4 class="xeAdmin">{$lang->comment}</h4>
<p class="summary">{$lang->about_comment_count}</p>
<table cellspacing="0" class="rowTable">
<tr>
<th><div>{$lang->comment_count}</div></th>
<td class="wide">
<p>{$lang->about_comment_count}</p>
<input type="text" name="comment_count" value="{$comment_config->comment_count}" class="inputTypeText w80" />
</td>
</tr>
<tr>
<th><div>{$lang->cmd_vote}</div></th>
<td>
<select name="use_vote_up" class="w100">
<option value="Y" <!--@if($comment_config->use_vote_up=='Y')-->selected="selected"<!--@end-->>{$lang->use}</option>
<option value="N" <!--@if($comment_config->use_vote_up=='N')-->selected="selected"<!--@end-->>{$lang->notuse}</option>
</select>
</td>
</tr>
<tr>
<th><div>{$lang->cmd_vote_down}</div></th>
<td>
<select name="use_vote_down" class="w100">
<option value="Y" <!--@if($comment_config->use_vote_down=='Y')-->selected="selected"<!--@end-->>{$lang->use}</option>
<option value="N" <!--@if($comment_config->use_vote_down=='N')-->selected="selected"<!--@end-->>{$lang->notuse}</option>
</select>
</td>
</tr>
<tr>
<th colspan="2" class="button">
<span class="button strong black"><input type="submit" value="{$lang->cmd_save}"/></span>