From 690803f3fc5358d21380cfe24685d4ae5a0c8a17 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Thu, 1 Aug 2019 00:20:40 +0900 Subject: [PATCH] Separate upload config screen from download config screen --- modules/file/conf/module.xml | 2 ++ modules/file/file.admin.controller.php | 40 ++++++++++++++++----- modules/file/file.admin.view.php | 18 +++++++++- modules/file/lang/en.php | 1 + modules/file/lang/ko.php | 1 + modules/file/tpl/adminConfig.html | 33 ----------------- modules/file/tpl/download_config.html | 49 ++++++++++++++++++++++++++ modules/file/tpl/header.html | 3 ++ 8 files changed, 105 insertions(+), 42 deletions(-) create mode 100644 modules/file/tpl/download_config.html diff --git a/modules/file/conf/module.xml b/modules/file/conf/module.xml index e43dbd322..2b4e0a3ea 100644 --- a/modules/file/conf/module.xml +++ b/modules/file/conf/module.xml @@ -15,10 +15,12 @@ + + diff --git a/modules/file/file.admin.controller.php b/modules/file/file.admin.controller.php index 46ba168a4..f8ad5c586 100644 --- a/modules/file/file.admin.controller.php +++ b/modules/file/file.admin.controller.php @@ -55,21 +55,18 @@ class fileAdminController extends file } /** - * Add file information + * Save upload configuration * * @return Object */ function procFileAdminInsertConfig() { - // Get configurations (using module model object) - $config = new stdClass(); + // Update configuration + $oFileModel = getModel('file'); + $config = $oFileModel->getFileConfig(); $config->allowed_filesize = Context::get('allowed_filesize'); $config->allowed_attach_size = Context::get('allowed_attach_size'); $config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes')); - $config->allow_outlink = Context::get('allow_outlink'); - $config->allow_outlink_format = Context::get('allow_outlink_format'); - $config->allow_outlink_site = Context::get('allow_outlink_site'); - $config->inline_download_format = array_map('utf8_trim', Context::get('inline_download_format')); // Check maximum file size if (PHP_INT_SIZE < 8) @@ -80,7 +77,7 @@ class fileAdminController extends file } } - // Create module Controller object + // Save and redirect $oModuleController = getController('module'); $output = $oModuleController->insertModuleConfig('file',$config); @@ -88,6 +85,33 @@ class fileAdminController extends file return $this->setRedirectUrl($returnUrl, $output); } + /** + * Save download configuration + * + * @return Object + */ + function procFileAdminInsertDownloadConfig() + { + // Update configuration + $oFileModel = getModel('file'); + $config = $oFileModel->getFileConfig(); + $config->allow_outlink = Context::get('allow_outlink'); + $config->allow_outlink_format = Context::get('allow_outlink_format'); + $config->allow_outlink_site = Context::get('allow_outlink_site'); + $config->inline_download_format = array_map('utf8_trim', Context::get('inline_download_format')); + + // Save and redirect + $oModuleController = getController('module'); + $output = $oModuleController->insertModuleConfig('file',$config); + if(!$output->toBool()) + { + return $output; + } + + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminDownloadConfig'); + return $this->setRedirectUrl($returnUrl, $output); + } + /** * Add file information for each module * diff --git a/modules/file/file.admin.view.php b/modules/file/file.admin.view.php index 8ae9804b0..a9723ac7a 100644 --- a/modules/file/file.admin.view.php +++ b/modules/file/file.admin.view.php @@ -210,7 +210,7 @@ class fileAdminView extends file } /** - * Set attachment information (for administrator) + * Upload config screen * * @return Object */ @@ -224,6 +224,22 @@ class fileAdminView extends file $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('adminConfig'); } + + /** + * Download config screen + * + * @return Object + */ + function dispFileAdminDownloadConfig() + { + $oFileModel = getModel('file'); + $config = $oFileModel->getFileConfig(); + Context::set('config',$config); + + // Set a template file + $this->setTemplatePath($this->module_path.'tpl'); + $this->setTemplateFile('download_config'); + } } /* End of file file.admin.view.php */ /* Location: ./modules/file/file.admin.view.php */ diff --git a/modules/file/lang/en.php b/modules/file/lang/en.php index 870a012fb..5bba633c1 100644 --- a/modules/file/lang/en.php +++ b/modules/file/lang/en.php @@ -3,6 +3,7 @@ $lang->file = 'File'; $lang->file_management = 'File Management'; $lang->file_upload = 'File Upload'; $lang->file_upload_config = 'File Upload Settings'; +$lang->file_download_config = 'File Download Settings'; $lang->file_name = 'File Name'; $lang->file_size = 'File Size'; $lang->download_count = 'Number of Downloads'; diff --git a/modules/file/lang/ko.php b/modules/file/lang/ko.php index bc271cbe2..cf3db1364 100644 --- a/modules/file/lang/ko.php +++ b/modules/file/lang/ko.php @@ -3,6 +3,7 @@ $lang->file = '파일'; $lang->file_management = '파일 관리'; $lang->file_upload = '파일 업로드'; $lang->file_upload_config = '파일 업로드 설정'; +$lang->file_download_config = '파일 다운로드 설정'; $lang->file_name = '파일 이름'; $lang->file_size = '파일 크기'; $lang->download_count = '다운로드 받은 수'; diff --git a/modules/file/tpl/adminConfig.html b/modules/file/tpl/adminConfig.html index 57f8047d3..0d8d52d04 100644 --- a/modules/file/tpl/adminConfig.html +++ b/modules/file/tpl/adminConfig.html @@ -8,39 +8,6 @@ -
- -
- - -

{$lang->about_allow_outlink}

-
-
-
- -
- -

{$lang->about_allow_outlink_format}

-
-
-
- -
- -

{$lang->about_allow_outlink_site}

-
-
-
- -
- - - - - -

{$lang->about_inline_download_format}

-
-
diff --git a/modules/file/tpl/download_config.html b/modules/file/tpl/download_config.html new file mode 100644 index 000000000..16493d05e --- /dev/null +++ b/modules/file/tpl/download_config.html @@ -0,0 +1,49 @@ + + +
+

{$XE_VALIDATOR_MESSAGE}

+
+ +
+ + + +
+ +
+ + +

{$lang->about_allow_outlink}

+
+
+
+ +
+ +

{$lang->about_allow_outlink_format}

+
+
+
+ +
+ +

{$lang->about_allow_outlink_site}

+
+
+
+ +
+ + + + + +

{$lang->about_inline_download_format}

+
+
+
+
+ +
+
+
diff --git a/modules/file/tpl/header.html b/modules/file/tpl/header.html index e2060cb46..bb2a3ed4c 100644 --- a/modules/file/tpl/header.html +++ b/modules/file/tpl/header.html @@ -10,4 +10,7 @@
  • {$lang->file_upload_config}
  • +
  • + {$lang->file_download_config} +