mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 04:24:14 +09:00
Set proper module_srl and mid when uploading in member and communication modules
This commit is contained in:
parent
f6a02fd006
commit
e1cfb09652
5 changed files with 82 additions and 3 deletions
|
|
@ -91,8 +91,8 @@
|
||||||
var chunkStatus = true;
|
var chunkStatus = true;
|
||||||
var defaultFormData = {
|
var defaultFormData = {
|
||||||
"editor_sequence": data.editorSequence,
|
"editor_sequence": data.editorSequence,
|
||||||
"upload_target_srl" : data.uploadTargetSrl,
|
"upload_target_srl" : data.uploadTargetSrl ? data.uploadTargetSrl : 0,
|
||||||
"mid" : window.current_mid,
|
"mid" : window.current_mid ? window.current_mid : window.editor_mid,
|
||||||
"act": 'procFileUpload'
|
"act": 'procFileUpload'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -293,6 +293,12 @@ class CommunicationView extends communication
|
||||||
{
|
{
|
||||||
$option->editor_toolbar_hide = 'Y';
|
$option->editor_toolbar_hide = 'Y';
|
||||||
}
|
}
|
||||||
|
if ($option->allow_fileupload)
|
||||||
|
{
|
||||||
|
$oMemberView = MemberView::getInstance();
|
||||||
|
$option->module_srl = $oMemberView->getMemberModuleSrl();
|
||||||
|
$option->mid = $oMemberView->getMemberModulePrefix();
|
||||||
|
}
|
||||||
$editor = $oEditorModel->getEditor(getNextSequence(), $option);
|
$editor = $oEditorModel->getEditor(getNextSequence(), $option);
|
||||||
$editor = $editor . "\n" . '<input type="hidden" name="temp_srl" value="" />' . "\n";
|
$editor = $editor . "\n" . '<input type="hidden" name="temp_srl" value="" />' . "\n";
|
||||||
Context::set('editor', $editor);
|
Context::set('editor', $editor);
|
||||||
|
|
|
||||||
|
|
@ -251,13 +251,25 @@ class EditorModel extends Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::set('file_config',$file_config);
|
Context::set('file_config',$file_config);
|
||||||
|
|
||||||
// Configure upload status such as file size
|
// Configure upload status such as file size
|
||||||
$upload_status = FileModel::getUploadStatus();
|
$upload_status = FileModel::getUploadStatus();
|
||||||
Context::set('upload_status', $upload_status);
|
Context::set('upload_status', $upload_status);
|
||||||
|
|
||||||
// Upload enabled (internally caching)
|
// Upload enabled (internally caching)
|
||||||
FileController::setUploadInfo($option->editor_sequence, $upload_target_srl, $option->module_srl ?? 0);
|
FileController::setUploadInfo($option->editor_sequence, $upload_target_srl, $option->module_srl ?? 0);
|
||||||
|
|
||||||
|
// Set editor mid
|
||||||
|
if (!empty($option->mid))
|
||||||
|
{
|
||||||
|
Context::addHtmlFooter('<script> var editor_mid = ' . json_encode($option->mid) . '; </script>');
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the file already exists
|
// Check if the file already exists
|
||||||
if($upload_target_srl) $files_count = FileModel::getFilesCount($upload_target_srl);
|
if ($upload_target_srl)
|
||||||
|
{
|
||||||
|
$files_count = FileModel::getFilesCount($upload_target_srl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Context::set('files_count', (int)$files_count);
|
Context::set('files_count', (int)$files_count);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -433,6 +433,16 @@ class MemberAdminView extends Member
|
||||||
$option->editor_toolbar_hide = 'Y';
|
$option->editor_toolbar_hide = 'Y';
|
||||||
$option->editor_skin = $member_config->signature_editor_skin;
|
$option->editor_skin = $member_config->signature_editor_skin;
|
||||||
$option->sel_editor_colorset = $member_config->sel_editor_colorset;
|
$option->sel_editor_colorset = $member_config->sel_editor_colorset;
|
||||||
|
if (!$option->allow_html)
|
||||||
|
{
|
||||||
|
$option->editor_skin = 'textarea';
|
||||||
|
}
|
||||||
|
if ($option->allow_fileupload)
|
||||||
|
{
|
||||||
|
$oMemberView = MemberView::getInstance();
|
||||||
|
$option->module_srl = $oMemberView->getMemberModuleSrl();
|
||||||
|
$option->mid = $oMemberView->getMemberModulePrefix();
|
||||||
|
}
|
||||||
|
|
||||||
Context::set('editor', getModel('editor')->getEditor($member_info->member_srl, $option));
|
Context::set('editor', getModel('editor')->getEditor($member_info->member_srl, $option));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,47 @@ class MemberView extends Member
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the member mid (prefix)
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getMemberModulePrefix(): string
|
||||||
|
{
|
||||||
|
if (!$this->member_config)
|
||||||
|
{
|
||||||
|
$this->member_config = MemberModel::getMemberConfig();
|
||||||
|
}
|
||||||
|
if (!empty($this->member_config->mid))
|
||||||
|
{
|
||||||
|
return $this->member_config->mid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get the module_srl for the member mid.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getMemberModuleSrl(): int
|
||||||
|
{
|
||||||
|
if (!$this->member_config)
|
||||||
|
{
|
||||||
|
$this->member_config = MemberModel::getMemberConfig();
|
||||||
|
}
|
||||||
|
if (!empty($this->member_config->mid))
|
||||||
|
{
|
||||||
|
return ModuleModel::getModuleInfoByMid($this->member_config->mid)->module_srl ?? 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module index
|
* Module index
|
||||||
*/
|
*/
|
||||||
|
|
@ -334,6 +375,11 @@ class MemberView extends Member
|
||||||
{
|
{
|
||||||
$option->editor_skin = 'textarea';
|
$option->editor_skin = 'textarea';
|
||||||
}
|
}
|
||||||
|
if ($option->allow_fileupload)
|
||||||
|
{
|
||||||
|
$option->module_srl = $this->getMemberModuleSrl();
|
||||||
|
$option->mid = $this->getMemberModulePrefix();
|
||||||
|
}
|
||||||
|
|
||||||
Context::set('editor', getModel('editor')->getEditor(0, $option));
|
Context::set('editor', getModel('editor')->getEditor(0, $option));
|
||||||
}
|
}
|
||||||
|
|
@ -448,6 +494,11 @@ class MemberView extends Member
|
||||||
{
|
{
|
||||||
$option->editor_skin = 'textarea';
|
$option->editor_skin = 'textarea';
|
||||||
}
|
}
|
||||||
|
if ($option->allow_fileupload)
|
||||||
|
{
|
||||||
|
$option->module_srl = $this->getMemberModuleSrl();
|
||||||
|
$option->mid = $this->getMemberModulePrefix();
|
||||||
|
}
|
||||||
|
|
||||||
Context::set('editor', getModel('editor')->getEditor($member_info->member_srl, $option));
|
Context::set('editor', getModel('editor')->getEditor($member_info->member_srl, $option));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue