mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Separate upload config screen from download config screen
This commit is contained in:
parent
31b0bb4158
commit
690803f3fc
8 changed files with 105 additions and 42 deletions
|
|
@ -15,10 +15,12 @@
|
|||
|
||||
<action name="dispFileAdminList" type="view" admin_index="true" menu_name="file" menu_index="true" />
|
||||
<action name="dispFileAdminConfig" type="view" menu_name="file" />
|
||||
<action name="dispFileAdminDownloadConfig" type="view" menu_name="file" />
|
||||
|
||||
<action name="procFileAdminAddCart" type="controller" />
|
||||
<action name="procFileAdminDeleteChecked" type="controller" ruleset="deleteChecked" />
|
||||
<action name="procFileAdminInsertConfig" type="controller" ruleset="insertConfig" />
|
||||
<action name="procFileAdminInsertDownloadConfig" type="controller" />
|
||||
<action name="procFileAdminInsertModuleConfig" type="controller" permission="manager" check_var="target_module_srl" ruleset="fileModuleConfig" />
|
||||
</actions>
|
||||
<menus>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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 = '다운로드 받은 수';
|
||||
|
|
|
|||
|
|
@ -8,39 +8,6 @@
|
|||
<input type="hidden" name="module" value="file" />
|
||||
<input type="hidden" name="act" value="procFileAdminInsertConfig" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/file/tpl/adminConfig/1" />
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->allow_outlink}</label>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline"><input type="radio" name="allow_outlink" id="allow_outlink_y" value="Y" checked="checked"|cond="$config->allow_outlink == 'Y'" /> {$lang->cmd_yes}</label>
|
||||
<label class="x_inline"><input type="radio" name="allow_outlink" value="N" checked="checked"|cond="$config->allow_outlink == 'N'" /> {$lang->cmd_no}</label>
|
||||
<p class="x_help-block">{$lang->about_allow_outlink}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="allow_outlink_format">{$lang->allow_outlink_format}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" name="allow_outlink_format" id="allow_outlink_format" value="{$config->allow_outlink_format}" />
|
||||
<p class="x_help-block">{$lang->about_allow_outlink_format}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="allow_outlink_site">{$lang->allow_outlink_site}</label>
|
||||
<div class="x_controls">
|
||||
<textarea name="allow_outlink_site" id="allow_outlink_site" rows="4" cols="42">{$config->allow_outlink_site}</textarea>
|
||||
<p class="x_help-block">{$lang->about_allow_outlink_site}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->inline_download_format}</label>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline"><input type="checkbox" name="inline_download_format[]" id="inline_download_format_image" value="image" checked="checked"|cond="in_array('image', $config->inline_download_format)" /> {$lang->inline_download_image}</label>
|
||||
<label class="x_inline"><input type="checkbox" name="inline_download_format[]" id="inline_download_format_audio" value="audio" checked="checked"|cond="in_array('audio', $config->inline_download_format)" /> {$lang->inline_download_audio}</label>
|
||||
<label class="x_inline"><input type="checkbox" name="inline_download_format[]" id="inline_download_format_video" value="video" checked="checked"|cond="in_array('video', $config->inline_download_format)" /> {$lang->inline_download_video}</label>
|
||||
<label class="x_inline"><input type="checkbox" name="inline_download_format[]" id="inline_download_format_text" value="text" checked="checked"|cond="in_array('text', $config->inline_download_format)" /> {$lang->inline_download_text}</label>
|
||||
<label class="x_inline"><input type="checkbox" name="inline_download_format[]" id="inline_download_format_pdf" value="pdf" checked="checked"|cond="in_array('pdf', $config->inline_download_format)" /> {$lang->inline_download_pdf}</label>
|
||||
<p class="x_help-block">{$lang->about_inline_download_format}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label for="allowed_filesize" class="x_control-label">{$lang->allowed_filesize}</label>
|
||||
<div class="x_controls">
|
||||
|
|
|
|||
49
modules/file/tpl/download_config.html
Normal file
49
modules/file/tpl/download_config.html
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<include target="header.html" />
|
||||
|
||||
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/file/tpl/download_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="procFileAdminInsertDownloadConfig" />
|
||||
<input type="hidden" name="xe_validator_id" value="modules/file/tpl/download_config/1" />
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->allow_outlink}</label>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline"><input type="radio" name="allow_outlink" id="allow_outlink_y" value="Y" checked="checked"|cond="$config->allow_outlink == 'Y'" /> {$lang->cmd_yes}</label>
|
||||
<label class="x_inline"><input type="radio" name="allow_outlink" value="N" checked="checked"|cond="$config->allow_outlink == 'N'" /> {$lang->cmd_no}</label>
|
||||
<p class="x_help-block">{$lang->about_allow_outlink}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="allow_outlink_format">{$lang->allow_outlink_format}</label>
|
||||
<div class="x_controls">
|
||||
<input type="text" name="allow_outlink_format" id="allow_outlink_format" value="{$config->allow_outlink_format}" />
|
||||
<p class="x_help-block">{$lang->about_allow_outlink_format}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label" for="allow_outlink_site">{$lang->allow_outlink_site}</label>
|
||||
<div class="x_controls">
|
||||
<textarea name="allow_outlink_site" id="allow_outlink_site" rows="4" cols="42">{$config->allow_outlink_site}</textarea>
|
||||
<p class="x_help-block">{$lang->about_allow_outlink_site}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->inline_download_format}</label>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline"><input type="checkbox" name="inline_download_format[]" id="inline_download_format_image" value="image" checked="checked"|cond="in_array('image', $config->inline_download_format)" /> {$lang->inline_download_image}</label>
|
||||
<label class="x_inline"><input type="checkbox" name="inline_download_format[]" id="inline_download_format_audio" value="audio" checked="checked"|cond="in_array('audio', $config->inline_download_format)" /> {$lang->inline_download_audio}</label>
|
||||
<label class="x_inline"><input type="checkbox" name="inline_download_format[]" id="inline_download_format_video" value="video" checked="checked"|cond="in_array('video', $config->inline_download_format)" /> {$lang->inline_download_video}</label>
|
||||
<label class="x_inline"><input type="checkbox" name="inline_download_format[]" id="inline_download_format_text" value="text" checked="checked"|cond="in_array('text', $config->inline_download_format)" /> {$lang->inline_download_text}</label>
|
||||
<label class="x_inline"><input type="checkbox" name="inline_download_format[]" id="inline_download_format_pdf" value="pdf" checked="checked"|cond="in_array('pdf', $config->inline_download_format)" /> {$lang->inline_download_pdf}</label>
|
||||
<p class="x_help-block">{$lang->about_inline_download_format}</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>
|
||||
</form>
|
||||
|
|
@ -10,4 +10,7 @@
|
|||
<li class="x_active"|cond="$act == 'dispFileAdminConfig'">
|
||||
<a href="{getUrl('', 'module', 'admin', 'act', 'dispFileAdminConfig')}">{$lang->file_upload_config}</a>
|
||||
</li>
|
||||
<li class="x_active"|cond="$act == 'dispFileAdminDownloadConfig'">
|
||||
<a href="{getUrl('', 'module', 'admin', 'act', 'dispFileAdminDownloadConfig')}">{$lang->file_download_config}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue