Add option to apply default file settings to module

This commit is contained in:
Kijin Sung 2019-08-01 20:49:34 +09:00
parent 9d08cac27b
commit 6d2a91134c
9 changed files with 58 additions and 14 deletions

View file

@ -65,7 +65,7 @@ $lang->msg_auto_saved = 'Automatically Saved.';
$lang->cmd_disable = 'Inactive';
$lang->cmd_enable = 'Active';
$lang->cmd_select_cover = 'Be a cover image';
$lang->default_editor_settings = 'Default settings for this module';
$lang->default_editor_settings = 'Use Default Settings';
$lang->editor_skin = 'Editor Skin';
$lang->upload_file_grant = 'Permission to upload files';
$lang->enable_default_component_grant = 'Permission to use default components';
@ -75,7 +75,7 @@ $lang->enable_autosave = 'Enable Auto-Save';
$lang->allow_html = 'allow HTML';
$lang->height_resizable = 'Height Resizable';
$lang->editor_height = 'Height of Editor';
$lang->about_default_editor_settings = 'Follow editor settings of Rhymix Admin page through whole site.';
$lang->about_default_editor_settings = 'Follow the default settings from the Editor module.';
$lang->about_content_font = 'Please use comma for multiple input.';
$lang->about_content_font_size = 'Please input units such as px or em.';
$lang->about_enable_autosave = 'You may decide whether the auto-save function will be used.';

View file

@ -79,7 +79,7 @@ $lang->enable_autosave = '자동저장 사용';
$lang->allow_html = 'HTML 허용';
$lang->height_resizable = '높이 조절 가능';
$lang->editor_height = '에디터 높이';
$lang->about_default_editor_settings = '사이트 전체 에디터 설정을 통일하여서 모듈별 에디터 설정을 단순하게 합니다.';
$lang->about_default_editor_settings = '에디터 모듈의 기본 설정을 따릅니다.';
$lang->about_content_font = '콤마(,)로 여러 폰트를 지정할 수 있습니다.';
$lang->about_content_font_size = '12px, 1em등 단위까지 포함해서 입력해주세요.';
$lang->about_enable_autosave = '글 작성 시 자동 저장 기능을 활성화 시킬 수 있습니다.';

View file

@ -147,8 +147,6 @@ class fileAdminController extends file
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
else $module_srl = array($module_srl);
$download_grant = Context::get('download_grant');
$file_config = new stdClass;
$file_config->allowed_filesize = Context::get('allowed_filesize');
$file_config->allowed_attach_size = Context::get('allowed_attach_size');
@ -163,15 +161,6 @@ class fileAdminController extends file
$file_config->image_autorotate = Context::get('image_autorotate') === 'Y' ? true : false;
$file_config->image_autorotate_quality = max(50, min(100, intval(Context::get('image_autorotate_quality'))));
if(!is_array($download_grant))
{
$file_config->download_grant = explode('|@|',$download_grant);
}
else
{
$file_config->download_grant = array_values($download_grant);
}
// Check maximum file size
if (PHP_INT_SIZE < 8)
{
@ -196,6 +185,23 @@ class fileAdminController extends file
$file_config->allowed_filetypes = '*.*';
}
// Use default config
if(Context::get('use_default_file_config') === 'Y')
{
$file_config = new stdClass;
$file_config->use_default_file_config = true;
}
// Check download grant
$download_grant = Context::get('download_grant');
if(!is_array($download_grant))
{
$file_config->download_grant = explode('|@|',$download_grant);
}
else
{
$file_config->download_grant = array_values($download_grant);
}
$oModuleController = getController('module');
for($i=0;$i<count($module_srl);$i++)
{

View file

@ -187,6 +187,7 @@ class fileModel extends file
if($file_config)
{
$config->use_default_file_config = $file_config->use_default_file_config;
$config->allowed_filesize = $file_config->allowed_filesize;
$config->allowed_attach_size = $file_config->allowed_attach_size;
$config->allowed_filetypes = $file_config->allowed_filetypes;

View file

@ -32,6 +32,8 @@ $lang->inline_download_audio = 'Audio';
$lang->inline_download_video = 'Video';
$lang->inline_download_text = 'Text (except HTML)';
$lang->inline_download_pdf = 'PDF';
$lang->use_default_file_config = 'Use Default Settings';
$lang->about_use_default_file_config = 'Follow the default settings from the File module.';
$lang->about_inline_download_format = 'Selected types of files will be opened in the current window instead of a download dialog when a user clicks the download link.';
$lang->enable_download_group = 'Downloadable Groups';
$lang->about_allow_outlink = 'Allow other websites to link directly to your download URLs.<br />Rhymix does not control links to image files that can be embedded directly in a document.<br />in order to block external links to such images, you may need to modify your web server configuration.';

View file

@ -32,6 +32,8 @@ $lang->inline_download_audio = '오디오';
$lang->inline_download_video = '비디오';
$lang->inline_download_text = '텍스트 (HTML 제외)';
$lang->inline_download_pdf = 'PDF';
$lang->use_default_file_config = '기본 파일 설정 사용';
$lang->about_use_default_file_config = '파일 모듈의 기본 설정을 따릅니다.';
$lang->about_inline_download_format = '선택한 종류의 파일은 다운로드 링크를 클릭하더라도 다운로드 창을 열지 않고 현재 창에 표시합니다.';
$lang->enable_download_group = '다운로드 가능 그룹';
$lang->about_allow_outlink = '다른 사이트에서 파일 다운로드 링크에 직접 접근하는 것을 허용합니다.<br />본문에 바로 삽입할 수 있는 이미지 파일은 라이믹스에서 접근을 통제할 수 없으며, 이를 차단하려면 웹서버 설정이 필요합니다.';

View file

@ -0,0 +1,5 @@
.use_default_file_config {
margin-top: -10px;
border-bottom: 1px solid #ccc;
background: #f5f5f5;
}

View file

@ -1,3 +1,6 @@
<load target="css/config.css" />
<load target="js/config.js" />
<section class="section">
<h1>{$lang->file}</h1>
@ -7,6 +10,17 @@
<input type="hidden" name="success_return_url" value="{getRequestUriByServerEnviroment()}" />
<input type="hidden" name="target_module_srl" value="{$module_info->module_srl?$module_info->module_srl:$module_srls}" />
<div class="x_control-group use_default_file_config">
<label for="allowed_filesize" class="x_control-label">{$lang->use_default_file_config}</label>
<div class="x_controls">
<label for="use_default_file_config" class="x_inline">
<input type="checkbox" name="use_default_file_config" id="use_default_file_config" value="Y" checked="checked"|cond="$file_config->use_default_file_config" />
{$lang->about_use_default_file_config}
</label>
</div>
</div>
<div class="use_custom_file_config" style="display:none"|cond="$file_config->use_default_file_config">
<div class="x_control-group">
<label for="allowed_filesize" class="x_control-label">{$lang->allowed_filesize}</label>
<div class="x_controls">
@ -87,6 +101,8 @@
<p class="x_help-block">{$lang->about_allowed_filetypes}</p>
</div>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->enable_download_group}</label>
<div class="x_controls">

View file

@ -0,0 +1,12 @@
(function($) {
$(function() {
$('#use_default_file_config').on('change', function() {
if ($(this).is(':checked')) {
$('.use_custom_file_config').hide();
} else {
$('.use_custom_file_config').show();
}
});
});
})(jQuery);