Merge pull request #672 from bjrambo/pr/vote-dev

추천인/기능 정리
This commit is contained in:
Johnny 2017-01-17 16:32:54 +09:00 committed by GitHub
commit 4ef83941fa
9 changed files with 176 additions and 14 deletions

View file

@ -1210,6 +1210,69 @@ class boardView extends board
$this->setTemplateFile('update_view');
}
function dispBoardVoteLog()
{
iF($this->grant->vote_log_view !== true)
{
return new Object(-1, 'msg_not_permitted');
}
$oMemberModel = getModel('member');
$target = Context::get('target');
$target_srl = Context::get('target_srl');
$args = new stdClass();
if($target === 'document')
{
$queryId = 'document.getDocumentVotedLog';
$args->document_srl = $target_srl;
}
elseif($target === 'comment')
{
$queryId = 'comment.getCommentVotedLog';
$args->comment_srl = $target_srl;
}
else
{
return new Object(-1, 'msg_not_target');
}
$output = executeQueryArray($queryId, $args);
if(!$output->toBool())
{
return $output;
}
$vote_member_infos = array();
$blame_member_infos = array();
if(count($output->data) > 0)
{
foreach($output->data as $key => $log)
{
if($log->point > 0)
{
if($log->member_srl == $vote_member_infos[$log->member_srl]->member_srl)
{
continue;
}
$vote_member_infos[$log->member_srl] = $oMemberModel->getMemberInfoByMemberSrl($log->member_srl);
}
else
{
if($log->member_srl == $blame_member_infos[$log->member_srl]->member_srl)
{
continue;
}
$blame_member_infos[$log->member_srl] = $oMemberModel->getMemberInfoByMemberSrl($log->member_srl);
}
}
}
Context::set('vote_member_info', $vote_member_infos);
Context::set('blame_member_info', $blame_member_infos);
$this->setTemplateFile('vote_log');
}
/**
* @brief the method for displaying the warning messages
* display an error message if it has not a special design

View file

@ -24,6 +24,9 @@
<grant name="update_view" default="guest">
<title xml:lang="ko">수정내역 조회</title>
</grant>
<grant name="vote_log_view" default="guest">
<title xml:lang="ko">추천인 조회</title>
</grant>
<grant name="write_document" default="guest">
<title xml:lang="ko">글 작성</title>
<title xml:lang="zh-CN">发表新主题</title>
@ -72,6 +75,7 @@
<action name="dispBoardContentCommentList" type="view" />
<action name="dispBoardContentFileList" type="view" />
<action name="dispBoardUpdateLog" type="view" />
<action name="dispBoardVoteLog" type="view" />
<action name="dispBoardTagList" type="view" />
<action name="dispBoardWrite" type="view" standalone="false" />

View file

@ -48,6 +48,7 @@ $lang->about_hide_category = '임시로 분류를 사용하지 않으려면 체
$lang->protect_content = '글 보호 기능';
$lang->protect_comment = '댓글 보호 기능';
$lang->protect_regdate = '기간 제한 기능';
$lang->non_login_vote = '비 로그인 추천기능';
$lang->about_protect_regdate = '글이나 댓글을 작성한 후 일정 기간이 지나면 수정 또는 삭제할 수 없도록 합니다. (단위 : day)';
$lang->about_protect_content = '댓글이 달린 글은 수정 또는 삭제할 수 없도록 합니다.';
$lang->msg_protect_delete_content = '댓글이 달린 글은 삭제할 수 없습니다.';
@ -78,3 +79,6 @@ $lang->cmd_all_comment_message = '모든 댓글에 남김';
$lang->cmd_do_not_message = '남기지 않음';
$lang->delete_placeholder = '완전 삭제';
$lang->msg_document_notify_mail = '[%s] 새로운 게시글이 등록되었습니다 : %s';
$lang->cmd_document_vote_user = '이 글의 추천인 목록';
$lang->cmd_comment_vote_user = '이 댓글의 추천인 목록';
$lang->msg_not_target = '문서 또는 댓글의 추천인목록만 조회가능합니다.';

View file

@ -34,6 +34,7 @@
</ul>
</div>
<p class="action" cond="!$comment->isDeleted()">
<a href="{getUrl('act','dispBoardVoteLog','target_srl',$comment->comment_srl,'target','comment')}">{$lang->cmd_comment_vote_user}</a>
<a cond="$comment->getVote() === false || $comment->getVote() < 0" href="#" onclick="doCallModuleAction('comment','procCommentVoteUp','{$comment->comment_srl}');return false;"|cond="$is_logged" class="voted"><i class="xi-thumbs-up"></i>{$lang->cmd_vote}{$comment->get('voted_count')}</a>
<a cond="$comment->getVote() > 0" href="#" onclick="doCallModuleAction('comment','procCommentVoteUpCancel','{$comment->comment_srl}');return false;"|cond="$is_logged" class="voted"><i class="xi-thumbs-up"></i>{$lang->cmd_vote}{$comment->get('voted_count')}</a>
<a cond="$comment->getVote() === false || $comment->getVote() > 0" href="#" onclick="doCallModuleAction('comment','procCommentVoteDown','{$comment->comment_srl}');return false;"|cond="$is_logged" class="voted"><i class="xi-thumbs-up"></i>{$lang->cmd_vote_down}{$comment->get('blamed_count')}</a>

View file

@ -84,12 +84,12 @@
<div class="vote">
<ul>
<li>
<a cond="$oDocument->getVoted() === false || $oDocument->getVoted() < 0" href="#" onclick="doCallModuleAction('document','procDocumentVoteUp','{$oDocument->document_srl}');return false;"|cond="$is_logged" class="voted"> <i class="xi-thumbs-up"></i><br>{$lang->cmd_vote} {$oDocument->get('voted_count')}</a>
<a cond="$oDocument->getVoted() > 0" href="#" onclick="doCallModuleAction('document','procDocumentVoteUpCancel','{$oDocument->document_srl}');return false;"|cond="$is_logged" class="voted"> <i class="xi-thumbs-up"></i><br>{$lang->cmd_vote} {$oDocument->get('voted_count')}</a>
<a cond="$oDocument->getVoted() === false || $oDocument->getVoted() < 0" href="#" onclick="doCallModuleAction('document','procDocumentVoteUp','{$oDocument->document_srl}');return false;" class="voted"> <i class="xi-thumbs-up"></i><br>{$lang->cmd_vote} {$oDocument->get('voted_count')}</a>
<a cond="$oDocument->getVoted() > 0" href="#" onclick="doCallModuleAction('document','procDocumentVoteUpCancel','{$oDocument->document_srl}');return false;" class="voted"> <i class="xi-thumbs-up"></i><br>{$lang->cmd_vote} {$oDocument->get('voted_count')}</a>
</li>
<li>
<a cond="$oDocument->getVoted() === false || $oDocument->getVoted() > 0" herf="#" onclick="doCallModuleAction('document','procDocumentVoteDown','{$oDocument->document_srl}');return false;"|cond="$is_logged" class="voted"> <i class="xi-thumbs-down"></i><br>{$lang->cmd_vote_down} {$oDocument->get('blamed_count')}</a>
<a cond="$oDocument->getVoted() < 0" herf="#" onclick="doCallModuleAction('document','procDocumentVoteDownCancel','{$oDocument->document_srl}');return false;"|cond="$is_logged" class="voted"> <i class="xi-thumbs-down"></i><br>{$lang->cmd_vote_down} {$oDocument->get('blamed_count')}</a>
<a cond="$oDocument->getVoted() === false || $oDocument->getVoted() > 0" herf="#" onclick="doCallModuleAction('document','procDocumentVoteDown','{$oDocument->document_srl}');return false;" class="voted"> <i class="xi-thumbs-down"></i><br>{$lang->cmd_vote_down} {$oDocument->get('blamed_count')}</a>
<a cond="$oDocument->getVoted() < 0" herf="#" onclick="doCallModuleAction('document','procDocumentVoteDownCancel','{$oDocument->document_srl}');return false;" class="voted"> <i class="xi-thumbs-down"></i><br>{$lang->cmd_vote_down} {$oDocument->get('blamed_count')}</a>
</li>
</ul>
</div>
@ -115,6 +115,7 @@
<div cond="$oDocument->getSignature()" class="tx">{$oDocument->getSignature()}</div>
</div>
<div class="btnArea">
<a class="btn" href="{getUrl('act','dispBoardVoteLog','target_srl',$oDocument->document_srl,'target','document')}"><i class="xi-list-ul"></i>{$lang->cmd_document_vote_user}</a>
<a cond="$update_view" class="btn" href="{getUrl('act','dispBoardUpdateLog','document_srl',$oDocument->document_srl,'comment_srl','')}"><i class="xi-list-ul"></i>{$lang->update_log}</a>
<a cond="$oDocument->isEditable()" class="btn" href="{getUrl('act','dispBoardWrite','document_srl',$oDocument->document_srl,'comment_srl','')}"><i class="xi-eraser"></i>{$lang->cmd_modify}</a>
<a cond="$oDocument->isEditable()" class="btn" href="{getUrl('act','dispBoardDelete','document_srl',$oDocument->document_srl,'comment_srl','')}"><i class="xi-trash"></i>{$lang->cmd_delete}</a>

View file

@ -1131,4 +1131,25 @@
.board .secretForm .btn {border-radius: 0 2px 2px 0; }
.board .secretForm p {margin-bottom:5px;}
.vote-list {
display:block;
overflow-x: hidden;
overflow-y: auto;
margin: 0px !important;
padding: 20px;
color: rgb(34, 34, 34);
font-size: 15px;
font-family: "Open Sans","나눔바른고딕",NanumBarunGothic,"맑은 고딕","Malgun Gothic","돋움",Dotum,"애플 SD 산돌고딕 Neo","Apple SD Gothic Neo",AppleGothic,Helvetica,sans-serif;
line-height: 1.6;
-webkit-font-smoothing: antialiased;
background: rgb(255, 255, 255);
}
.votelog {
display:inline-block;
padding:2px 15px;
background:#00b0a2;
border-radius: 23px;
color:#fff;
text-decoration: inherit;
}

View file

@ -0,0 +1,14 @@
<include target="_header.html" />
<div class="vote-list">
<h2>추천인</h2>
<block loop="$vote_member_info => $val">
<a href="#popup_menu_area" class="votelog member_{$val->member_srl}" onclick="return false">{$val->nick_name}</a>
</block>
<h2>비추천인</h2>
<block loop="$blame_member_info => $val">
<a href="#popup_menu_area" class="votelog member_{$val->member_srl}" onclick="return false">{$val->nick_name}</a>
</block>
</div>
<include target="_footer.html" />

View file

@ -285,7 +285,6 @@
<p class="x_help-block">{$lang->about_comment_delete_message}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->status}</label>
<div class="x_controls">
@ -299,6 +298,18 @@
<p class="x_help-block">{$lang->about_use_status}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->non_login_vote}</label>
<div class="x_controls">
<label class="x_inline">
<input type="radio" id="non_login_vote_y" name="non_login_vote" value="Y" checked="checked"|cond="$module_info->non_login_vote == 'Y'" /> {$lang->use}
</label>
<label class="x_inline">
<input type="radio" id="non_login_vote_n" name="non_login_vote" value="N" checked="checked"|cond="$module_info->non_login_vote != 'Y'" /> {$lang->notuse}
</label>
<p class="x_help-block">{$lang->about_document_force_to_move}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="admin_mail">{$lang->admin_mail}</label>
<div class="x_controls">

View file

@ -24,7 +24,13 @@ class documentController extends document
*/
function procDocumentVoteUp()
{
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
if($this->module_info->non_login_vote !== 'Y')
{
if(!Context::get('is_logged'))
{
return new Object(-1, 'msg_invalid_request');
}
}
$document_srl = Context::get('target_srl');
if(!$document_srl) return new Object(-1, 'msg_invalid_request');
@ -40,13 +46,23 @@ class documentController extends document
$point = 1;
$output = $this->updateVotedCount($document_srl, $point);
if(!$output->toBool())
{
return $output;
}
$this->add('voted_count', $output->get('voted_count'));
return $output;
}
function procDocumentVoteUpCancel()
{
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
if($this->module_info->non_login_vote !== 'Y')
{
if(!Context::get('is_logged'))
{
return new Object(-1, 'msg_invalid_request');
}
}
$document_srl = Context::get('target_srl');
if(!$document_srl) return new Object(-1, 'msg_invalid_request');
@ -59,6 +75,10 @@ class documentController extends document
}
$point = 1;
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
if(!$output->toBool())
{
return $output;
}
$output = new Object();
$output->setMessage('success_voted_canceled');
@ -90,7 +110,13 @@ class documentController extends document
*/
function procDocumentVoteDown()
{
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
if($this->module_info->non_login_vote !== 'Y')
{
if(!Context::get('is_logged'))
{
return new Object(-1, 'msg_invalid_request');
}
}
$document_srl = Context::get('target_srl');
if(!$document_srl) return new Object(-1, 'msg_invalid_request');
@ -106,13 +132,23 @@ class documentController extends document
$point = -1;
$output = $this->updateVotedCount($document_srl, $point);
if(!$output->toBool())
{
return $output;
}
$this->add('blamed_count', $output->get('blamed_count'));
return $output;
}
function procDocumentVoteDownCancel()
{
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
if($this->module_info->non_login_vote !== 'Y')
{
if(!Context::get('is_logged'))
{
return new Object(-1, 'msg_invalid_request');
}
}
$document_srl = Context::get('target_srl');
if(!$document_srl) return new Object(-1, 'msg_invalid_request');
@ -125,6 +161,10 @@ class documentController extends document
}
$point = -1;
$output = $this->updateVotedCountCancel($document_srl, $oDocument, $point);
if(!$output->toBool())
{
return $output;
}
$output = new Object();
$output->setMessage('success_blamed_canceled');
@ -1289,8 +1329,14 @@ class documentController extends document
*/
function updateVotedCount($document_srl, $point = 1)
{
if($point > 0) $failed_voted = 'failed_voted';
else $failed_voted = 'failed_blamed';
if($point > 0)
{
$failed_voted = 'failed_voted';
}
else
{
$failed_voted = 'failed_blamed';
}
// Return fail if session already has information about votes
if($_SESSION['voted_document'][$document_srl])
{
@ -1305,7 +1351,6 @@ class documentController extends document
$_SESSION['voted_document'][$document_srl] = false;
return new Object(-1, $failed_voted);
}
// Create a member model object
$oMemberModel = getModel('member');
$member_srl = $oMemberModel->getLoggedMemberSrl();
@ -1320,7 +1365,6 @@ class documentController extends document
return new Object(-1, $failed_voted);
}
}
// Use member_srl for logged-in members and IP address for non-members.
$args = new stdClass();
if($member_srl)
@ -1339,7 +1383,6 @@ class documentController extends document
$_SESSION['voted_document'][$document_srl] = false;
return new Object(-1, $failed_voted);
}
// begin transaction
$oDB = DB::getInstance();
$oDB->begin();