추천을 취소할 수 잇도록 개선.

This commit is contained in:
qw5414 2016-01-22 01:13:30 +09:00
parent 9241357a3e
commit 6a2dc541bb
8 changed files with 80 additions and 4 deletions

View file

@ -3014,6 +3014,10 @@
<value xml:lang="vi"><![CDATA[Đã bình chọn.]]></value>
<value xml:lang="mn"><![CDATA[Санал болгогдсон]]></value>
</item>
<item name="success_voted_canceled">
<value xml:lang="ko"><![CDATA[추천이 취소되었습니다.]]></value>
<value xml:lang="en"><![CDATA[]]></value>
</item>
<item name="success_blamed">
<value xml:lang="ko"><![CDATA[비추천했습니다.]]></value>
<value xml:lang="en"><![CDATA[Not recommended successfully.]]></value>
@ -3028,6 +3032,10 @@
<value xml:lang="vi"><![CDATA[Đã phê bình.]]></value>
<value xml:lang="mn"><![CDATA[Санал болгогдоогүй]]></value>
</item>
<item name="success_blamed_canceled">
<value xml:lang="ko"><![CDATA[비추천이 취소되었습니다.]]></value>
<value xml:lang="en"><![CDATA[]]></value>
</item>
<item name="success_copied">
<value xml:lang="ko"><![CDATA[복사했습니다.]]></value>
<value xml:lang="en"><![CDATA[Copied successfully.]]></value>

View file

@ -81,6 +81,15 @@
});
</script>
</div>
<div class="vote">
<ul>
<li>
{@ debugPrint($oDocument->getVoted())}
<a cond="$oDocument->getVoted() === false" 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() !== false" 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>
</li>
</ul>
</div>
<div cond="$oDocument->hasUploadedFiles()" class="fileList">
<button type="button" class="toggleFile" onclick="jQuery(this).next('ul.files').toggle();"><i class="xi-diskette"></i> {$lang->uploaded_file} [<strong>{$oDocument->get('uploaded_count')}</strong>]</button>
<ul class="files">

View file

@ -570,6 +570,13 @@
.read_footer .sns a:hover{border-color:#DECA79;background-color:#f9dc5f;transition: all 0.2s ease-in-out;-webkit-transition: all 0.2s ease-in-out}
.read_footer .sns a:hover {color:#747474;transition: all 0.2s ease-in-out;-webkit-transition: all 0.2s ease-in-out}
.read_footer .vote{ margin-top:51px;text-align:center; }
.read_footer .vote li{display:inline;vertical-align:top}
.read_footer .vote a{display:inline-block;width:46px;height:52px;border:1px solid #e0e0e0;background-color:#f4f4f4; border-radius:2px;}
.read_footer .vote i{font-size:22px;line-height:32px;color:#bcbcbc}
.read_footer .vote a:hover{border-color:#DECA79;background-color:#f9dc5f;transition: all 0.2s ease-in-out;-webkit-transition: all 0.2s ease-in-out}
.read_footer .vote a:hover {color:#747474;transition: all 0.2s ease-in-out;-webkit-transition: all 0.2s ease-in-out}
.read_footer .sign {
clear: both;
border: 1px solid #ddd;

View file

@ -6,7 +6,7 @@
<author email_address="developers@xpressengine.com" link="https://www.xpressengine.com/">
<name xml:lang="ko">NAVER</name>
</author>
<license>LGPL v2</license>
<license>GPL v2</license>
<extra_vars>
</extra_vars>
</skin>

View file

@ -29,6 +29,7 @@
<action name="getDocumentMenu" type="model" />
<action name="procDocumentVoteUp" type="controller" />
<action name="procDocumentVoteUpCancel" type="controller" />.
<action name="procDocumentVoteDown" type="controller" />
<action name="procDocumentDeclare" type="controller" />
<action name="procDocumentAddCart" type="controller" />

View file

@ -44,6 +44,32 @@ class documentController extends document
return $output;
}
function procDocumentVoteUpCancel()
{
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');
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
if($oDocument->get('voted_count') <= 0)
{
return new Object(-1, 'msg_document_voted_cancel_not');
}
$args = new stdClass();
$d_args = new stdClass();
$args->document_srl = $d_args->document_srl = $document_srl;
$args->voted_count = $oDocument->get('voted_count') - 1;
$output = executeQuery('document.updateVotedCount', $args);
$d_output = executeQuery('document.deleteDocumentVotedLog', $d_args);
//session reset
$_SESSION['voted_document'][$document_srl] = false;
$output->setMessage('success_voted_canceled');
return $output;
}
/**
* insert alias
* @param int $module_srl
@ -1153,11 +1179,11 @@ class documentController extends document
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
// Pass if the author's IP address is as same as visitor's.
if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
/*if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
{
$_SESSION['voted_document'][$document_srl] = true;
return new Object(-1, $failed_voted);
}
}*/
// Create a member model object
$oMemberModel = getModel('member');

View file

@ -369,6 +369,27 @@ class documentItem extends Object
return $title;
}
function getVoted()
{
if(!$this->document_srl) return;
$logged_info = Context::get('logged_info');
$member_srl = $logged_info->member_srl;
$document_srl = $this->document_srl;
$args = new stdClass();
$args->member_srl = $member_srl;
$args->document_srl = $document_srl;
$output = executeQuery('document.getDocumentVotedLogInfo', $args);
if($output->data->count)
{
return true;
}
return false;
}
function getTitle($cut_size = 0, $tail='...')
{
if(!$this->document_srl) return;

View file

@ -349,6 +349,10 @@
<value xml:lang="ko"><![CDATA[최고관리자의 게시글을 지울 권한이 없습니다.]]></value>
<value xml:lang="en"><![CDATA[You don't have permission to delete the posts of Top Admin.]]></value>
</item>
<item name="msg_document_voted_cancel_not">
<value xml:lang="ko"><![CDATA[추천수가 0이하일 경우 추천캔슬을 사용할 수 없습니다.]]></value>
<value xml:lang="en"><![CDATA[]]></value>
</item>
<item name="move_target_module">
<value xml:lang="ko"><![CDATA[대상 페이지]]></value>
<value xml:lang="en"><![CDATA[Target module ]]></value>