Add option to save changelog for files

This commit is contained in:
Kijin Sung 2019-09-13 23:57:21 +09:00
parent ee7f11b0f1
commit 2cd2d0528b
8 changed files with 76 additions and 0 deletions

View file

@ -16,11 +16,13 @@
<action name="dispFileAdminList" type="view" admin_index="true" menu_name="file" menu_index="true" />
<action name="dispFileAdminUploadConfig" type="view" menu_name="file" />
<action name="dispFileAdminDownloadConfig" type="view" menu_name="file" />
<action name="dispFileAdminOtherConfig" type="view" menu_name="file" />
<action name="procFileAdminAddCart" type="controller" />
<action name="procFileAdminDeleteChecked" type="controller" ruleset="deleteChecked" />
<action name="procFileAdminInsertUploadConfig" type="controller" ruleset="insertConfig" />
<action name="procFileAdminInsertDownloadConfig" type="controller" />
<action name="procFileAdminInsertOtherConfig" type="controller" />
<action name="procFileAdminInsertModuleConfig" type="controller" permission="manager" check_var="target_module_srl" ruleset="fileModuleConfig" />
</actions>
<menus>

View file

@ -138,6 +138,29 @@ class fileAdminController extends file
return $this->setRedirectUrl($returnUrl, $output);
}
/**
* Save other configuration
*
* @return Object
*/
function procFileAdminInsertOtherConfig()
{
// Update configuration
$config = getModel('module')->getModuleConfig('file');
$config->save_changelog = Context::get('save_changelog') === 'Y' ? 'Y' : 'N';
// 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', 'dispFileAdminOtherConfig');
return $this->setRedirectUrl($returnUrl, $output);
}
/**
* Add file information for each module
*

View file

@ -240,6 +240,22 @@ class fileAdminView extends file
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('download_config');
}
/**
* Other config screen
*
* @return Object
*/
function dispFileAdminOtherConfig()
{
$oFileModel = getModel('file');
$config = $oFileModel->getFileConfig();
Context::set('config',$config);
// Set a template file
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('other_config');
}
}
/* End of file file.admin.view.php */
/* Location: ./modules/file/file.admin.view.php */

View file

@ -207,6 +207,7 @@ class fileModel extends file
$config->allow_outlink = $file_config->allow_outlink;
$config->allow_outlink_site = $file_config->allow_outlink_site;
$config->allow_outlink_format = $file_config->allow_outlink_format;
$config->save_changelog = $file_config->save_changelog;
}
// Property for all files comes first than each property

View file

@ -4,6 +4,7 @@ $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_other_config = 'Other Settings';
$lang->file_name = 'File Name';
$lang->file_size = 'File Size';
$lang->download_count = 'Number of Downloads';
@ -36,6 +37,7 @@ $lang->inline_download_audio = 'Audio';
$lang->inline_download_video = 'Video';
$lang->inline_download_text = 'Text (except HTML)';
$lang->inline_download_pdf = 'PDF';
$lang->file_save_changelog = 'Save changelog';
$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.';
@ -53,6 +55,7 @@ $lang->about_max_image_size = 'You can limit the maximum width and/or height of
$lang->about_image_autoconv = 'Automatically convert types of images that often cause trouble or waste disk space into other types.<br />This also works for WebP images that incorrectly have the JPG extension.<br />If enabled, this feature also applies to images uploaded by the administrator.';
$lang->about_image_autoconv_mp4 = 'Automatically convert animated GIF images into MP4 videos to save storage and bandwidth.<br />Videos may not play properly in older browsers.';
$lang->about_image_autorotate = 'Automatically correct images that are rotated by mobile devices.<br />If enabled, this feature also applies to images uploaded by the administrator.';
$lang->about_save_changelog = 'Keep a log of new and deleted files in the database.';
$lang->cmd_delete_checked_file = 'Delete Selected Item(s)';
$lang->cmd_move_to_document = 'Move to Document';
$lang->cmd_download = 'Download';

View file

@ -4,6 +4,7 @@ $lang->file_management = '파일 관리';
$lang->file_upload = '파일 업로드';
$lang->file_upload_config = '파일 업로드 설정';
$lang->file_download_config = '파일 다운로드 설정';
$lang->file_other_config = '기타 설정';
$lang->file_name = '파일 이름';
$lang->file_size = '파일 크기';
$lang->download_count = '다운로드 받은 수';
@ -36,6 +37,7 @@ $lang->inline_download_audio = '오디오';
$lang->inline_download_video = '비디오';
$lang->inline_download_text = '텍스트 (HTML 제외)';
$lang->inline_download_pdf = 'PDF';
$lang->file_save_changelog = '변경 내역 기록';
$lang->use_default_file_config = '기본 파일 설정 사용';
$lang->about_use_default_file_config = '파일 모듈의 기본 설정을 따릅니다.';
$lang->about_inline_download_format = '선택한 종류의 파일은 다운로드 링크를 클릭하더라도 다운로드 창을 열지 않고 현재 창에 표시합니다.';
@ -53,6 +55,7 @@ $lang->about_max_image_size = '이미지 파일의 가로, 세로, 또는 가로
$lang->about_image_autoconv = '종종 문제를 일으키거나 용량을 낭비하는 이미지 타입을 다른 타입으로 자동 변환합니다.<br />WebP 이미지에 JPG 확장자가 잘못 부여된 경우에도 변환할 수 있습니다.<br />관리자가 업로드한 파일에도 적용됩니다.';
$lang->about_image_autoconv_mp4 = '움직이는 GIF 이미지를 MP4 동영상으로 변환하여 용량 및 트래픽을 절약합니다.<br />구형 브라우저에서는 동영상이 재생되지 않을 수도 있습니다.';
$lang->about_image_autorotate = '모바일 기기 등에서 잘못 회전된 이미지를 바로잡습니다.<br />관리자가 업로드한 파일에도 적용됩니다.';
$lang->about_save_changelog = '파일 저장 및 삭제 내역을 DB에 기록합니다.';
$lang->cmd_delete_checked_file = '선택항목 삭제';
$lang->cmd_move_to_document = '문서로 이동';
$lang->cmd_download = '다운로드';

View file

@ -13,4 +13,7 @@
<li class="x_active"|cond="$act == 'dispFileAdminDownloadConfig'">
<a href="{getUrl('', 'module', 'admin', 'act', 'dispFileAdminDownloadConfig')}">{$lang->file_download_config}</a>
</li>
<li class="x_active"|cond="$act == 'dispFileAdminOtherConfig'">
<a href="{getUrl('', 'module', 'admin', 'act', 'dispFileAdminOtherConfig')}">{$lang->file_other_config}</a>
</li>
</ul>

View file

@ -0,0 +1,25 @@
<include target="header.html" />
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/file/tpl/other_config/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form ruleset="insertConfig" action="./" method="post" class="x_form-horizontal section">
<input type="hidden" name="module" value="file" />
<input type="hidden" name="act" value="procFileAdminInsertOtherConfig" />
<input type="hidden" name="xe_validator_id" value="modules/file/tpl/other_config/1" />
<div class="x_control-group">
<label class="x_control-label">{$lang->file_save_changelog}</label>
<div class="x_controls">
<label class="x_inline"><input type="radio" name="save_changelog" value="Y" checked="checked"|cond="$config->save_changelog === 'Y'" /> {$lang->cmd_yes}</label>
<label class="x_inline"><input type="radio" name="save_changelog" value="N" checked="checked"|cond="$config->save_changelog !== 'Y'" /> {$lang->cmd_no}</label>
<p class="x_help-block">{$lang->about_save_changelog}</p>
</div>
</div>
<div class="x_clearfix btnArea">
<div class="x_pull-right">
<button type="submit" class="x_btn x_btn-primary">{$lang->cmd_save}</button>
</div>
</div>
{@ var_dump($config)}
</form>