mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-24 04:42:14 +09:00
Enable file upload when sending messages
This commit is contained in:
parent
1c07b2e0d2
commit
46f19a9f17
9 changed files with 49 additions and 11 deletions
|
|
@ -108,6 +108,7 @@ $lang->replies = 'Comment';
|
|||
$lang->content = 'Content';
|
||||
$lang->document = 'Article';
|
||||
$lang->comment = 'Comment';
|
||||
$lang->member_message = 'Message';
|
||||
$lang->description = 'Description';
|
||||
$lang->trackback = 'Trackback';
|
||||
$lang->tag = 'Tag';
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ $lang->replies = '댓글';
|
|||
$lang->content = '내용';
|
||||
$lang->document = '문서';
|
||||
$lang->comment = '댓글';
|
||||
$lang->member_message = '쪽지';
|
||||
$lang->description = '설명';
|
||||
$lang->trackback = '엮인글';
|
||||
$lang->tag = '태그';
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class communicationAdminController extends communication
|
|||
function procCommunicationAdminInsertConfig()
|
||||
{
|
||||
// get the default information
|
||||
$args = Context::gets('enable_message', 'enable_friend', 'skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_send_default','grant_send_group');
|
||||
$args = Context::gets('enable_message', 'enable_friend', 'enable_attachment', 'skin', 'colorset', 'editor_skin', 'sel_editor_colorset', 'mskin', 'mcolorset', 'layout_srl', 'mlayout_srl', 'grant_send_default','grant_send_group');
|
||||
$args->editor_colorset = $args->sel_editor_colorset;
|
||||
unset($args->sel_editor_colorset);
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,12 @@ class communicationController extends communication
|
|||
{
|
||||
throw new Rhymix\Framework\Exception('msg_content_is_null');
|
||||
}
|
||||
|
||||
$temp_srl = intval(Context::get('temp_srl')) ?: null;
|
||||
if($temp_srl && !$_SESSION['upload_info'][$temp_srl]->enabled)
|
||||
{
|
||||
throw new Rhymix\Framework\Exceptions\InvalidRequest;
|
||||
}
|
||||
|
||||
// Check if there is a member to receive a message
|
||||
$oMemberModel = getModel('member');
|
||||
|
|
@ -111,7 +117,7 @@ class communicationController extends communication
|
|||
}
|
||||
|
||||
// send a message
|
||||
$output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
|
||||
$output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content, true, $temp_srl);
|
||||
|
||||
if(!$output->toBool())
|
||||
{
|
||||
|
|
@ -148,9 +154,10 @@ class communicationController extends communication
|
|||
* @param string $title
|
||||
* @param string $content
|
||||
* @param boolean $sender_log (default true)
|
||||
* @param int|null $temp_srl (default null)
|
||||
* @return Object
|
||||
*/
|
||||
function sendMessage($sender_srl, $receiver_srl, $title, $content, $sender_log = TRUE)
|
||||
function sendMessage($sender_srl, $receiver_srl, $title, $content, $sender_log = true, $temp_srl = null)
|
||||
{
|
||||
// Encode the title and content.
|
||||
$title = escape($title, false);
|
||||
|
|
@ -158,7 +165,7 @@ class communicationController extends communication
|
|||
$title = utf8_mbencode($title);
|
||||
$content = utf8_mbencode($content);
|
||||
|
||||
$message_srl = getNextSequence();
|
||||
$message_srl = $temp_srl ?: getNextSequence();
|
||||
$related_srl = getNextSequence();
|
||||
|
||||
// messages to save in the sendor's message box
|
||||
|
|
@ -227,6 +234,13 @@ class communicationController extends communication
|
|||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
// update attached files
|
||||
if ($temp_srl)
|
||||
{
|
||||
$oFileController = getController('file');
|
||||
$oFileController->setFilesValid($message_srl, 'msg');
|
||||
}
|
||||
|
||||
// Call a trigger (after)
|
||||
ModuleHandler::triggerCall('communication.sendMessage', 'after', $trigger_obj);
|
||||
|
|
|
|||
|
|
@ -197,6 +197,12 @@ class communicationView extends communication
|
|||
throw new Rhymix\Framework\Exceptions\NotPermitted;
|
||||
}
|
||||
|
||||
// Fix missing mid (it causes errors when uploading)
|
||||
if(!Context::get('mid'))
|
||||
{
|
||||
Context::set('mid', Context::get('site_module_info')->mid);
|
||||
}
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
|
|
@ -249,9 +255,9 @@ class communicationView extends communication
|
|||
// set a signiture by calling getEditor of the editor module
|
||||
$oEditorModel = getModel('editor');
|
||||
$option = $oEditorModel->getEditorConfig();
|
||||
$option->primary_key_name = 'receiver_srl';
|
||||
$option->primary_key_name = 'temp_srl';
|
||||
$option->content_key_name = 'content';
|
||||
$option->allow_fileupload = FALSE;
|
||||
$option->allow_fileupload = $this->config->enable_attachment === 'Y';
|
||||
$option->enable_autosave = FALSE;
|
||||
$option->enable_default_component = TRUE; // FALSE;
|
||||
$option->enable_component = FALSE;
|
||||
|
|
@ -261,9 +267,9 @@ class communicationView extends communication
|
|||
$option->skin = $this->config->editor_skin;
|
||||
$option->colorset = $this->config->editor_colorset;
|
||||
$option->editor_focus = Context::get('source_message') ? 'Y' : 'N';
|
||||
$editor = $oEditorModel->getEditor($logged_info->member_srl, $option);
|
||||
$editor = $oEditorModel->getEditor(getNextSequence(), $option);
|
||||
$editor = $editor . "\n" . '<input type="hidden" name="temp_srl" value="" />' . "\n";
|
||||
Context::set('editor', $editor);
|
||||
|
||||
$this->setTemplateFile('send_message');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,3 +44,4 @@ $lang->cmd_manage_base = 'Basic infomation';
|
|||
$lang->alert_new_message_arrived = 'You have %d new message(s). Do you want to check it now?';
|
||||
$lang->enable_communication_friend = 'Friend Enable';
|
||||
$lang->enable_communication_message = 'Message Enable';
|
||||
$lang->enable_attachment = 'Allow Attachment';
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ $lang->cmd_manage_base = '기본 정보';
|
|||
$lang->alert_new_message_arrived = '%d개의 새로운 메시지가 도착하였습니다. 확인하시겠습니까?';
|
||||
$lang->enable_communication_friend = '친구기능 사용';
|
||||
$lang->enable_communication_message = '쪽지기능 사용';
|
||||
$lang->enable_attachment = '파일첨부 허용';
|
||||
$lang->warning = '알려드립니다!';
|
||||
$lang->msg_allow_message_friend = '현재 회원님은 친구에게만 수신 가능한 상태입니다.';
|
||||
$lang->msg_allow_meesage_Block = '현재 회원님은 수신거부 상태입니다.';
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<input type="radio" name="enable_message" id="enable_message_yes" value="Y" checked="checked"|cond="$config->enable_message == 'Y'" /> {$lang->cmd_yes}
|
||||
</label>
|
||||
<label class="x_inline" for="enable_message_no">
|
||||
<input type="radio" name="enable_message" id="enable_message_no" value="N" checked="checked"|cond="$config->enable_message == 'N'" /> {$lang->cmd_no}
|
||||
<input type="radio" name="enable_message" id="enable_message_no" value="N" checked="checked"|cond="$config->enable_message !== 'Y'" /> {$lang->cmd_no}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -38,7 +38,18 @@
|
|||
<input type="radio" name="enable_friend" id="enable_friend_yes" value="Y" checked="checked"|cond="$config->enable_friend == 'Y'" /> {$lang->cmd_yes}
|
||||
</label>
|
||||
<label class="x_inline" for="enable_friend_no">
|
||||
<input type="radio" name="enable_friend" id="enable_friend_no" value="N" checked="checked"|cond="$config->enable_friend == 'N'" /> {$lang->cmd_no}
|
||||
<input type="radio" name="enable_friend" id="enable_friend_no" value="N" checked="checked"|cond="$config->enable_friend !== 'Y'" /> {$lang->cmd_no}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<div class="x_control-label">{$lang->enable_attachment}</div>
|
||||
<div class="x_controls">
|
||||
<label class="x_inline" for="enable_attachment_yes">
|
||||
<input type="radio" name="enable_attachment" id="enable_attachment_yes" value="Y" checked="checked"|cond="$config->enable_attachment == 'Y'" /> {$lang->cmd_yes}
|
||||
</label>
|
||||
<label class="x_inline" for="enable_attachment_no">
|
||||
<input type="radio" name="enable_attachment" id="enable_attachment_no" value="N" checked="checked"|cond="$config->enable_attachment !== 'Y'" /> {$lang->cmd_no}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -55,10 +55,13 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
|
|||
<!--@else-->
|
||||
<!--@if($val->upload_target_type == 'com')-->[{$lang->comment}] <!--@end-->
|
||||
<!--@if($val->upload_target_type == 'mod')-->[{$lang->module}] <!--@end-->
|
||||
<!--@if($val->upload_target_type == 'msg')-->[{$lang->member_message}] <!--@end-->
|
||||
|
||||
<!--@if($val->upload_target_type == 'doc' && $document_list[$document_srl] && $document_list[$document_srl]->get('module_srl') == $document_list[$document_srl]->get('member_srl'))-->[{$lang->cmd_temp_save}] <!--@end-->
|
||||
<!--@if($val->upload_target_type == 'doc' && $document_list[$document_srl] && $document_list[$document_srl]->get('module_srl') == 0)-->[{$lang->cmd_trash}] <!--@end-->
|
||||
<a href="{getUrl('', 'mid', $module_list[$val->module_srl]->mid)}" target="_blank">{$module_list[$val->module_srl]->browser_title}</a>
|
||||
<!--@if(in_array($val->upload_target_type, ['doc', 'com', 'mod']))-->
|
||||
<a href="{getUrl('', 'mid', $module_list[$val->module_srl]->mid)}" target="_blank">{$module_list[$val->module_srl]->browser_title}</a>
|
||||
<!--@end-->
|
||||
<!--@if($document_list[$document_srl] && ($val->upload_target_type == 'doc' || $val->upload_target_type == 'com'))-->
|
||||
- <!--@if($document_list[$document_srl]->get('module_srl') != $document_list[$document_srl]->get('member_srl'))--><a href="{$move_uri}" target="_blank">{$document_list[$document_srl]->getTitle()}</a><!--@else-->{$document_list[$document_srl]->getTitle()}<!--@end-->
|
||||
<!--@end-->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue