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

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

@ -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>