From 264c6f0e74a26c38fb3ff93e93213b1319c111c2 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Thu, 29 Oct 2020 00:38:46 +0900 Subject: [PATCH] Add settings for combined board --- modules/board/board.admin.controller.php | 43 ++++++++++++++++++++++-- modules/board/board.admin.view.php | 6 ++++ modules/board/conf/module.xml | 1 + modules/board/lang/en.php | 3 ++ modules/board/lang/ko.php | 3 ++ modules/board/tpl/addition_setup.html | 28 +++++++++++++++ 6 files changed, 82 insertions(+), 2 deletions(-) diff --git a/modules/board/board.admin.controller.php b/modules/board/board.admin.controller.php index 3ac661689..f4df336d1 100644 --- a/modules/board/board.admin.controller.php +++ b/modules/board/board.admin.controller.php @@ -12,13 +12,16 @@ class boardAdminController extends board { /** * @brief initialization **/ - function init() { + function init() + { + } /** * @brief insert borad module **/ - function procBoardAdminInsertBoard($args = null) { + function procBoardAdminInsertBoard($args = null) + { // generate module model/controller object $oModuleController = getController('module'); $oModuleModel = getModel('module'); @@ -163,6 +166,42 @@ class boardAdminController extends board { $this->setMessage('success_deleted'); } + /** + * Save settings for combined board. + */ + public function procBoardAdminInsertCombinedConfig() + { + $vars = Context::getRequestVars(); + $module_srl = intval($vars->target_module_srl); + $include_modules = array_map('intval', $vars->include_modules ?: []); + + $module_info = ModuleModel::getModuleInfoByModuleSrl($module_srl); + if (!$module_info) + { + throw new Rhymix\Framework\Exceptions\TargetNotFound; + } + + $module_info->include_modules = implode(',', array_filter($include_modules, function($item) { + return $item > 0; + })); + + $output = getController('module')->updateModule($module_info); + if (!$output->toBool()) + { + return $output; + } + + $this->setMessage('success_updated'); + if (Context::get('success_return_url')) + { + $this->setRedirectUrl(Context::get('success_return_url')); + } + else + { + $this->setRedirectUrl(getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminBoardAdditionSetup', 'module_srl', $module_srl)); + } + } + function procBoardAdminSaveCategorySettings() { $module_srl = Context::get('module_srl'); diff --git a/modules/board/board.admin.view.php b/modules/board/board.admin.view.php index 08fc83251..e0671caf8 100644 --- a/modules/board/board.admin.view.php +++ b/modules/board/board.admin.view.php @@ -205,6 +205,12 @@ class boardAdminView extends board { ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content); Context::set('setup_content', $content); + // Get the list of boards to combine. + $args = new stdClass; + $args->list_count = 1000; + $output = executeQueryArray('board.getBoardList', $args, ['module_srl', 'mid', 'browser_title']); + Context::set('board_list', $output->data); + // setup the template file $this->setTemplateFile('addition_setup'); } diff --git a/modules/board/conf/module.xml b/modules/board/conf/module.xml index 39c2731f3..78ed29670 100644 --- a/modules/board/conf/module.xml +++ b/modules/board/conf/module.xml @@ -128,6 +128,7 @@ + diff --git a/modules/board/lang/en.php b/modules/board/lang/en.php index ab1e5541f..dbef6b2c5 100644 --- a/modules/board/lang/en.php +++ b/modules/board/lang/en.php @@ -92,3 +92,6 @@ $lang->cmd_all_comment_message = 'Always'; $lang->cmd_do_not_message = 'Never'; $lang->delete_placeholder = 'Delete Placeholder'; $lang->msg_document_notify_mail = '[%s] The new post : %s'; +$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->cmd_board_include_modules = 'Include Boards'; \ No newline at end of file diff --git a/modules/board/lang/ko.php b/modules/board/lang/ko.php index 50ea9c2d4..f827461cc 100644 --- a/modules/board/lang/ko.php +++ b/modules/board/lang/ko.php @@ -104,3 +104,6 @@ $lang->msg_document_notify_mail = '[%s] 새로운 게시글이 등록되었습 $lang->cmd_document_vote_user = '이 글의 추천인 목록'; $lang->cmd_comment_vote_user = '이 댓글의 추천인 목록'; $lang->msg_not_target = '문서 또는 댓글의 추천인목록만 조회가능합니다.'; +$lang->cmd_board_combined_board = '통합 게시판'; +$lang->about_board_combined_board = '다른 게시판의 글을 모아서 볼 수 있습니다. 여러 게시판을 선택하려면 Ctrl 키를 누르고 클릭하세요.'; +$lang->cmd_board_include_modules = '포함할 게시판 선택'; \ No newline at end of file diff --git a/modules/board/tpl/addition_setup.html b/modules/board/tpl/addition_setup.html index 627cc393d..7b0d4c0d4 100644 --- a/modules/board/tpl/addition_setup.html +++ b/modules/board/tpl/addition_setup.html @@ -3,4 +3,32 @@

{$XE_VALIDATOR_MESSAGE}

+ + +
+

{$lang->cmd_board_combined_board}

+
+ + + + + {@ $include_modules = explode(',', $module_info->include_modules ?? '')} +
+ +
+ +

{$lang->about_board_combined_board}

+
+
+
+ +
+
+
+ + {$setup_content}