Implement loading documents from other modules

This commit is contained in:
Kijin Sung 2020-10-29 01:04:46 +09:00
parent 264c6f0e74
commit ba971f7b5a
6 changed files with 27 additions and 4 deletions

View file

@ -693,6 +693,11 @@ class ModuleHandler extends Handler
{ {
return null; return null;
} }
// If the requested mid is set to include documents from other modules, preserve the current mid.
elseif($this->mid && ($mid_info = ModuleModel::getModuleInfoByMid($this->mid)) && $mid_info->include_modules && in_array($module_info->module_srl, explode(',', $mid_info->include_modules)))
{
return $mid_info;
}
// If this is a GET request, redirect to the correct mid. // If this is a GET request, redirect to the correct mid.
elseif(Context::getRequestMethod() === 'GET') elseif(Context::getRequestMethod() === 'GET')
{ {

View file

@ -167,6 +167,13 @@ class boardController extends board
} }
} }
// Preserve module_srl if the document belongs to a module that is included in this board
if ($oDocument->get('module_srl') != $obj->module_srl && in_array($oDocument->get('module_srl'), explode(',', $this->module_info->include_modules ?: '')))
{
$obj->module_srl = $oDocument->get('module_srl');
$obj->category_srl = $oDocument->get('category_srl');
}
// notice & document style same as before if not manager // notice & document style same as before if not manager
if(!$this->grant->manager) if(!$this->grant->manager)
{ {

View file

@ -36,6 +36,11 @@ class boardView extends board
$this->page_count = $this->module_info->page_count; $this->page_count = $this->module_info->page_count;
} }
$this->except_notice = $this->module_info->except_notice == 'N' ? FALSE : TRUE; $this->except_notice = $this->module_info->except_notice == 'N' ? FALSE : TRUE;
$this->include_modules = $this->module_info->include_modules ? explode(',', $this->module_info->include_modules) : [];
if (count($this->include_modules) && !in_array($this->module_info->module_srl, $this->include_modules))
{
$this->include_modules[] = $this->module_info->module_srl;
}
// $this->_getStatusNameListecret option backward compatibility // $this->_getStatusNameListecret option backward compatibility
$statusList = $this->_getStatusNameList(); $statusList = $this->_getStatusNameList();
@ -244,7 +249,10 @@ class boardView extends board
// if the module srl is not consistent // if the module srl is not consistent
if($oDocument->get('module_srl') != $this->module_info->module_srl && $oDocument->get('is_notice') !== 'A') if($oDocument->get('module_srl') != $this->module_info->module_srl && $oDocument->get('is_notice') !== 'A')
{ {
throw new Rhymix\Framework\Exceptions\TargetNotFound; if (!in_array($oDocument->get('module_srl'), $this->include_modules))
{
throw new Rhymix\Framework\Exceptions\TargetNotFound;
}
} }
// check the manage grant // check the manage grant
@ -466,7 +474,7 @@ class boardView extends board
// setup module_srl/page number/ list number/ page count // setup module_srl/page number/ list number/ page count
$args = new stdClass(); $args = new stdClass();
$args->module_srl = $this->module_srl; $args->module_srl = $this->include_modules ?: $this->module_srl;
$args->page = intval(Context::get('page')) ?: null; $args->page = intval(Context::get('page')) ?: null;
$args->list_count = $this->list_count; $args->list_count = $this->list_count;
$args->page_count = $this->page_count; $args->page_count = $this->page_count;

View file

@ -94,4 +94,5 @@ $lang->delete_placeholder = 'Delete Placeholder';
$lang->msg_document_notify_mail = '[%s] The new post : %s'; $lang->msg_document_notify_mail = '[%s] The new post : %s';
$lang->cmd_board_combined_board = 'Combined Board'; $lang->cmd_board_combined_board = 'Combined Board';
$lang->about_board_combined_board = 'You can use this board to view documents from other boards. Press the Ctrl key and click to select multiple boards.'; $lang->about_board_combined_board = 'You can use this board to view documents from other boards. Press the Ctrl key and click to select multiple boards.';
$lang->cmd_board_include_modules = 'Include Boards'; $lang->cmd_board_include_modules = 'Include Boards';
$lang->cmd_board_include_modules_none = '(None)';

View file

@ -106,4 +106,5 @@ $lang->cmd_comment_vote_user = '이 댓글의 추천인 목록';
$lang->msg_not_target = '문서 또는 댓글의 추천인목록만 조회가능합니다.'; $lang->msg_not_target = '문서 또는 댓글의 추천인목록만 조회가능합니다.';
$lang->cmd_board_combined_board = '통합 게시판'; $lang->cmd_board_combined_board = '통합 게시판';
$lang->about_board_combined_board = '다른 게시판의 글을 모아서 볼 수 있습니다. 여러 게시판을 선택하려면 Ctrl 키를 누르고 클릭하세요.'; $lang->about_board_combined_board = '다른 게시판의 글을 모아서 볼 수 있습니다. 여러 게시판을 선택하려면 Ctrl 키를 누르고 클릭하세요.';
$lang->cmd_board_include_modules = '포함할 게시판 선택'; $lang->cmd_board_include_modules = '포함할 게시판 선택';
$lang->cmd_board_include_modules_none = '(포함하지 않음)';

View file

@ -17,6 +17,7 @@
<label for="use_history" class="x_control-label">{$lang->cmd_board_include_modules}</label> <label for="use_history" class="x_control-label">{$lang->cmd_board_include_modules}</label>
<div class="x_controls"> <div class="x_controls">
<select name="include_modules[]" size="8" multiple="multiple"> <select name="include_modules[]" size="8" multiple="multiple">
<option value="">{$lang->cmd_board_include_modules_none}</option>
<!--@foreach($board_list as $board_info)--> <!--@foreach($board_list as $board_info)-->
<option value="{$board_info->module_srl}" selected="selected"|cond="in_array($board_info->module_srl, $include_modules)">{$board_info->browser_title}</option> <option value="{$board_info->module_srl}" selected="selected"|cond="in_array($board_info->module_srl, $include_modules)">{$board_info->browser_title}</option>
<!--@endforeach--> <!--@endforeach-->