Merge branch 'rhymix:master' into master

This commit is contained in:
Lastorder 2025-05-02 17:07:35 +09:00 committed by GitHub
commit d327bb1926
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 588 additions and 221 deletions

View file

@ -290,30 +290,30 @@ class BoardController extends Board
public function procBoardRevertDocument()
{
$update_id = Context::get('update_id');
$logged_info = Context::get('logged_info');
if(!$update_id)
if (!$update_id)
{
throw new Rhymix\Framework\Exception('msg_no_update_id');
}
$oDocumentController = DocumentController::getInstance();
$update_log = DocumentModel::getUpdateLog($update_id);
if($logged_info->is_admin != 'Y')
{
$Exists_log = DocumentModel::getUpdateLogAdminisExists($update_log->document_srl);
if($Exists_log === true)
{
throw new Rhymix\Framework\Exception('msg_admin_update_log');
}
}
if(!$update_log)
if (!$update_log)
{
throw new Rhymix\Framework\Exception('msg_no_update_log');
}
$oDocument = DocumentModel::getDocument($update_log->document_srl);
if (!$oDocument->isGranted())
{
throw new Rhymix\Framework\Exceptions\NotPermitted();
}
if (!$this->user->isAdmin())
{
if (DocumentModel::getUpdateLogAdminisExists($update_log->document_srl))
{
throw new Rhymix\Framework\Exception('msg_admin_update_log');
}
}
$obj = new stdClass();
$obj->title = $update_log->title;
$obj->document_srl = $update_log->document_srl;
@ -322,10 +322,19 @@ class BoardController extends Board
$obj->content = $update_log->content;
$obj->update_log_setting = 'Y';
$obj->reason_update = lang('board.revert_reason_update');
$oDocumentController = DocumentController::getInstance();
$output = $oDocumentController->updateDocument($oDocument, $obj);
$this->setRedirectUrl(getNotEncodedUrl('', 'mid', Context::get('mid'),'act', '', 'document_srl', $update_log->document_srl));
if (!$output->toBool())
{
return $output;
}
$this->add('mid', Context::get('mid'));
$this->add('document_srl', $update_log->document_srl);
$this->setRedirectUrl(getNotEncodedUrl([
'mid' => Context::get('mid'),
'document_srl' => $update_log->document_srl,
]));
}
/**

View file

@ -1524,6 +1524,12 @@ class BoardView extends Board
throw new Rhymix\Framework\Exception('msg_not_target');
}
$features = Rhymix\Modules\Board\Models\Features::fromModuleInfo($this->module_info);
if (!$features->{$target}->vote_log)
{
throw new Rhymix\Framework\Exceptions\FeatureDisabled;
}
$output = executeQueryArray($queryId, $args);
if(!$output->toBool())
{
@ -1538,7 +1544,11 @@ class BoardView extends Board
{
if($log->point > 0)
{
if($log->member_srl == $vote_member_infos[$log->member_srl]->member_srl)
if (isset($vote_member_infos[$log->member_srl]))
{
continue;
}
if (!$features->{$target}->vote_up_log)
{
continue;
}
@ -1546,7 +1556,11 @@ class BoardView extends Board
}
else
{
if($log->member_srl == $blame_member_infos[$log->member_srl]->member_srl)
if (isset($blame_member_infos[$log->member_srl]))
{
continue;
}
if (!$features->{$target}->vote_down_log)
{
continue;
}
@ -1554,6 +1568,8 @@ class BoardView extends Board
}
}
}
Context::set('board_features', $features);
Context::set('vote_member_info', $vote_member_infos);
Context::set('blame_member_info', $blame_member_infos);
$this->setTemplateFile('vote_log');

View file

@ -61,8 +61,10 @@ class Features
// Document features
$features->document->vote_up = ($document_config->use_vote_up ?? 'Y') !== 'N';
$features->document->vote_up_log = ($document_config->use_vote_up ?? 'Y') === 'S';
$features->document->vote_down = ($document_config->use_vote_down ?? 'Y') !== 'N';
$features->document->vote_log = ($document_config->use_vote_up ?? 'Y') === 'S' || ($document_config->use_vote_down ?? 'Y') === 'S';
$features->document->vote_down_log = ($document_config->use_vote_down ?? 'Y') === 'S';
$features->document->vote_log = $features->document->vote_up_log || $features->document->vote_down_log;
if (isset($document_config->allow_vote_cancel))
{
$features->document->cancel_vote = $document_config->allow_vote_cancel === 'Y';
@ -92,8 +94,10 @@ class Features
// Comment features
$features->comment->vote_up = ($comment_config->use_vote_up ?? 'Y') !== 'N';
$features->comment->vote_up_log = ($comment_config->use_vote_up ?? 'Y') === 'S';
$features->comment->vote_down = ($comment_config->use_vote_down ?? 'Y') !== 'N';
$features->comment->vote_log = ($comment_config->use_vote_up ?? 'Y') === 'S' || ($comment_config->use_vote_down ?? 'Y') === 'S';
$features->comment->vote_down_log = ($comment_config->use_vote_down ?? 'Y') === 'S';
$features->comment->vote_log = $features->comment->vote_up_log || $features->comment->vote_down_log;
if (isset($comment_config->allow_vote_cancel))
{
$features->comment->cancel_vote = $comment_config->allow_vote_cancel === 'Y';

View file

@ -117,7 +117,7 @@
<!--@if($board_features->document->vote_log)-->
<a class="btn" href="{getUrl('', 'mid', $mid, 'act', 'dispBoardVoteLog', 'target_srl', $oDocument->document_srl, 'target', 'document')}"><i class="xi-list-ul"></i>{$lang->cmd_document_vote_user}</a>
<!--@endif-->
<!--@if($board_features->document->history)-->
<!--@if($module_info->update_log == 'Y' && $grant->can('update_view'))-->
<a cond="$update_view" class="btn" href="{getUrl('', 'mid', $mid, 'act', 'dispBoardUpdateLog', 'document_srl', $oDocument->document_srl)}"><i class="xi-list-ul"></i>{$lang->update_log}</a>
<!--@endif-->
<a cond="$oDocument->isEditable()" class="btn" href="{getUrl('', 'mid', $mid, 'act', 'dispBoardWrite', 'document_srl', $oDocument->document_srl)}"><i class="xi-eraser"></i>{$lang->cmd_modify}</a>