mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Allow pre-setting upload_target_type for each editor
This commit is contained in:
parent
fdc9e1e98d
commit
9a6524d63d
6 changed files with 27 additions and 6 deletions
|
|
@ -297,6 +297,7 @@ class CommunicationView extends communication
|
|||
if ($option->allow_fileupload)
|
||||
{
|
||||
$option->module_srl = MemberView::getInstance()->getMemberModuleSrl();
|
||||
$option->upload_target_type = 'msg';
|
||||
}
|
||||
$editor = $oEditorModel->getEditor(getNextSequence(), $option);
|
||||
$editor = $editor . "\n" . '<input type="hidden" name="temp_srl" value="" />' . "\n";
|
||||
|
|
|
|||
|
|
@ -263,13 +263,13 @@ class EditorModel extends Editor
|
|||
|
||||
// Set upload config in session
|
||||
$upload_config = [];
|
||||
if (isset($option->allowed_filesize) && $option->allowed_filesize > 0)
|
||||
$upload_config_keys = ['allowed_filesize', 'allowed_extensions', 'upload_target_type'];
|
||||
foreach ($upload_config_keys as $key)
|
||||
{
|
||||
$upload_config['allowed_filesize'] = $option->allowed_filesize;
|
||||
}
|
||||
if (isset($option->allowed_extensions) && !empty($option->allowed_extensions))
|
||||
{
|
||||
$upload_config['allowed_extensions'] = $option->allowed_extensions;
|
||||
if (isset($option->$key) && !empty($option->$key))
|
||||
{
|
||||
$upload_config[$key] = $option->$key;
|
||||
}
|
||||
}
|
||||
FileController::setUploadInfo($option->editor_sequence, $upload_target_srl, $option->module_srl ?? 0, $upload_config);
|
||||
|
||||
|
|
@ -455,6 +455,16 @@ class EditorModel extends Editor
|
|||
}
|
||||
}
|
||||
|
||||
// Preset upload target type
|
||||
if ($type === 'document')
|
||||
{
|
||||
$option->upload_target_type = 'doc';
|
||||
}
|
||||
elseif ($type === 'comment')
|
||||
{
|
||||
$option->upload_target_type = 'com';
|
||||
}
|
||||
|
||||
// Other settings
|
||||
$option->primary_key_name = $primary_key_name;
|
||||
$option->content_key_name = $content_key_name;
|
||||
|
|
|
|||
|
|
@ -1042,6 +1042,12 @@ class FileController extends File
|
|||
}
|
||||
}
|
||||
|
||||
// Set upload target type
|
||||
if ($editor_sequence && isset($_SESSION['upload_info'][$editor_sequence]->upload_target_type))
|
||||
{
|
||||
$args->upload_target_type = strval($_SESSION['upload_info'][$editor_sequence]->upload_target_type);
|
||||
}
|
||||
|
||||
$oDB = DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<columns>
|
||||
<column name="file_srl" var="file_srl" notnull="notnull" />
|
||||
<column name="upload_target_srl" var="upload_target_srl" filter="number" default="0" notnull="notnull" />
|
||||
<column name="upload_target_type" var="upload_target_type" />
|
||||
<column name="sid" var="sid" />
|
||||
<column name="module_srl" var="module_srl" filter="number" default="0" notnull="notnull" />
|
||||
<column name="member_srl" var="member_srl" default="0" />
|
||||
|
|
|
|||
|
|
@ -440,6 +440,7 @@ class MemberAdminView extends Member
|
|||
if ($option->allow_fileupload)
|
||||
{
|
||||
$option->module_srl = MemberView::getInstance()->getMemberModuleSrl();
|
||||
$option->upload_target_type = 'sig';
|
||||
}
|
||||
if ($member_config->member_max_filesize)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -358,6 +358,7 @@ class MemberView extends Member
|
|||
if ($option->allow_fileupload)
|
||||
{
|
||||
$option->module_srl = $this->getMemberModuleSrl();
|
||||
$option->upload_target_type = 'sig';
|
||||
}
|
||||
if ($member_config->member_max_filesize)
|
||||
{
|
||||
|
|
@ -480,6 +481,7 @@ class MemberView extends Member
|
|||
if ($option->allow_fileupload)
|
||||
{
|
||||
$option->module_srl = $this->getMemberModuleSrl();
|
||||
$option->upload_target_type = 'sig';
|
||||
}
|
||||
if ($member_config->member_max_filesize)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue