From ff9c21d04ff6ee8bae6776a42df828a29020c159 Mon Sep 17 00:00:00 2001 From: BJRambo Date: Thu, 8 Aug 2019 17:57:20 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8C=9D=EC=97=85=20=EB=A9=94=EB=89=B4?= =?UTF-8?q?=EC=97=90=20=EC=B6=94=EC=B2=9C,=20=EB=B9=84=EC=B6=94=EC=B2=9C,?= =?UTF-8?q?=20=EC=8B=A0=EA=B3=A0=20=EC=B7=A8=EC=86=8C=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20=EC=9E=91=EB=8F=99=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/lang/ko.php | 2 + modules/document/document.controller.php | 9 ++-- modules/document/document.model.php | 49 +++++++++++++++------- modules/document/tpl/declare_document.html | 6 ++- 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/common/lang/ko.php b/common/lang/ko.php index e25acfecb..b3ee2c7b9 100644 --- a/common/lang/ko.php +++ b/common/lang/ko.php @@ -31,6 +31,8 @@ $lang->cmd_vote = '추천'; $lang->cmd_vote_down = '비추천'; $lang->cmd_declare = '신고'; $lang->cmd_cancel_declare = '신고 취소'; +$lang->cmd_cancel_vote = '추천 취소'; +$lang->cmd_cancel_vote_down = '비추천 취소'; $lang->cmd_declared_list = '신고 목록'; $lang->cmd_copy = '복사'; $lang->cmd_move = '이동'; diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index 1eb67ff35..7ae295d34 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -311,13 +311,16 @@ class documentController extends document { throw new Rhymix\Framework\Exceptions\MustLogin; } + + $document_srl = intval(Context::get('target_srl')); + + $module_info = getModel('module')->getModuleInfoByDocumentSrl($document_srl); - if($this->module_info->cancel_vote !== 'Y') + if($module_info->cancel_vote !== 'Y') { - throw new Rhymix\Framework\Exception('failed_voted_cancel'); + throw new Rhymix\Framework\Exception('failed_declared_cancel'); } - $document_srl = intval(Context::get('target_srl')); if(!$document_srl) { throw new Rhymix\Framework\Exceptions\InvalidRequest; diff --git a/modules/document/document.model.php b/modules/document/document.model.php index 09c61e4bc..9b43142b9 100644 --- a/modules/document/document.model.php +++ b/modules/document/document.model.php @@ -431,9 +431,6 @@ class documentModel extends document { // Post number and the current login information requested Wanted $document_srl = Context::get('target_srl'); - $mid = Context::get('cur_mid'); - $logged_info = Context::get('logged_info'); - $act = Context::get('cur_act'); // to menu_list "pyosihalgeul, target, url" put into an array $menu_list = array(); // call trigger @@ -441,7 +438,7 @@ class documentModel extends document $oDocumentController = getController('document'); // Members must be a possible feature - if($logged_info->member_srl) + if($this->user->member_srl) { $oDocumentModel = getModel('document'); $columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress'); @@ -452,23 +449,45 @@ class documentModel extends document $oModuleModel = getModel('module'); $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); - if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl) + if($document_config->use_vote_up!='N' && $member_srl!=$this->user->member_srl) { - // Add a Referral Button - $url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl); - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript'); + if($oDocument->getVoted() === false || $oDocument->getVoted() < 0) + { + $url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl); + $oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript'); + } + elseif($oDocument->getVoted() > 0) + { + $url = sprintf("doCallModuleAction('document','procDocumentVoteUpCancel','%s')", $document_srl); + $oDocumentController->addDocumentPopupMenu($url,'cmd_cancel_vote','','javascript'); + } } - if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl) + if($document_config->use_vote_down!='N' && $member_srl!=$this->user->member_srl) { - // Add button to negative - $url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); - $oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript'); + if($oDocument->getVoted() === false || $oDocument->getVoted() > 0) + { + $url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); + $oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript'); + } + else if($oDocument->getVoted() < 0) + { + $url = sprintf("doCallModuleAction('document','procDocumentVoteDownCancel','%s')", $document_srl); + $oDocumentController->addDocumentPopupMenu($url,'cmd_cancel_vote_down','','javascript'); + } } // Adding Report - $url = getUrl('', 'act', 'dispDocumentDeclare', 'target_srl', $document_srl); - $oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','popup'); + if($oDocument->getDeclared()) + { + $url = getUrl('', 'act', 'dispDocumentDeclare', 'target_srl', $document_srl, 'type', 'cancel'); + $oDocumentController->addDocumentPopupMenu($url,'cmd_cancel_declare','','popup'); + } + else + { + $url = getUrl('', 'act', 'dispDocumentDeclare', 'target_srl', $document_srl); + $oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','popup'); + } // Add Bookmark button $url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl); @@ -487,7 +506,7 @@ class documentModel extends document } // If you are managing to find posts by ip - if($logged_info->is_admin == 'Y') + if($this->user->is_admin == 'Y') { $oDocumentModel = getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle diff --git a/modules/document/tpl/declare_document.html b/modules/document/tpl/declare_document.html index 602a296c3..77319edf2 100644 --- a/modules/document/tpl/declare_document.html +++ b/modules/document/tpl/declare_document.html @@ -8,7 +8,11 @@

{$lang->improper_document_declare}

+ + + + @@ -53,4 +57,4 @@ msg_area.hide(); $(document).load(setFixedPopupSize); })(jQuery); - \ No newline at end of file +