Skip to content

Commit

Permalink
#2341 모바일에서 쪽지 답장에 위지윅 에디터 적용
Browse files Browse the repository at this point in the history
- 쪽지 발신 후 페이지 이동 개선
  • Loading branch information
bnu committed Dec 11, 2018
1 parent 9735e16 commit 67887f5
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 15 deletions.
11 changes: 8 additions & 3 deletions modules/communication/communication.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ function procCommunicationSendMessage()
return $output;
}

$message_srl = $output->get('message_srl');

// send an e-mail
if($send_mail == 'Y')
{
Expand All @@ -140,7 +142,7 @@ function procCommunicationSendMessage()

if(!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
{
if(Context::get('is_popup') != 'Y')
if(Context::get('is_popup') === 'Y')
{
global $lang;
htmlHeader();
Expand All @@ -153,7 +155,7 @@ function procCommunicationSendMessage()
else
{
$this->setMessage('success_sended');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('','act', 'dispCommunicationMessages', 'message_type', 'S', 'receiver_srl', $receiver_srl, 'message_srl', '');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('act', 'dispCommunicationMessages', 'message_type', 'S', 'message_srl', $message_srl);
$this->setRedirectUrl($returnUrl);
}
}
Expand Down Expand Up @@ -262,7 +264,10 @@ function sendMessage($sender_srl, $receiver_srl, $title, $content, $sender_log =

$oDB->commit();

return new BaseObject(0, 'success_sended');
$result = new BaseObject(0, 'success_sended');
$result->add('message_srl', $message_srl);

return $result;
}

/**
Expand Down
17 changes: 17 additions & 0 deletions modules/communication/communication.mobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,24 @@ function dispCommunicationSendMessage()
return $this->stop('msg_invalid_request');
}

$oEditorModel = getModel('editor');
$option = new stdClass();
$option->primary_key_name = 'receiver_srl';
$option->content_key_name = 'new_content';
$option->allow_fileupload = FALSE;
$option->enable_autosave = FALSE;
$option->enable_default_component = TRUE;
$option->enable_component = FALSE;
$option->resizable = FALSE;
$option->disable_html = TRUE;
$option->height = 150;
$option->skin = $this->communication_config->editor_skin;
$option->colorset = $this->communication_config->editor_colorset;
$editor = $oEditorModel->getEditor($logged_info->member_srl, $option);

Context::set('receiver_info', $receiver_info);
Context::set('editor', $editor);

$this->setTemplateFile('send_message');
}

Expand Down
22 changes: 16 additions & 6 deletions modules/communication/m.skins/default/js/communication.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,20 @@ function completeDeleteMessage(ret_obj) {
location.href = current_url.setQuery('message_srl','');
}

function mergeContents()
{
var $form = jQuery('#fo_comm');
var content = $form.find('textarea[name=new_content]').val() + $form.find('input[name=source_content]').val();
$form.find('input[name=content]').val(content);
$form.submit();
function mergeContents(data) {
var $form = jQuery('#fo_comm')
var editotSequence = data.editor_sequence || null
var content = ''
var sourceContent = $form.find('input[name=source_content]').val() || ''

if (editotSequence) {
content = editorGetContent(editotSequence)
} else {
content = $form.find('[name=new_content]').val()
}

content += sourceContent

$form.find('input[name=content]').val(content)
$form.submit()
}
9 changes: 4 additions & 5 deletions modules/communication/m.skins/default/send_message.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ <h2>{$lang->cmd_send_message}</h2>
</div>
<form ruleset="sendMessage" action="./" method="post" class="ff" id="fo_comm">
<input type="hidden" name="module" value="communication" />
<input type="hidden" name="is_popup" value="Y" />
<input type="hidden" name="act" value="procCommunicationSendMessage" />
<input type="hidden" name="receiver_srl" value="{$receiver_info->member_srl}" />
<input type="hidden" name="source_content" value="{$source_message->content}" />
<input type="hidden" name="source_content" value="{$source_message->content|autoescape}" />
<input type="hidden" name="content" value="" />
<input type="hidden" name="xe_validator_id" value="modules/communication/m.skins/default/send_message/1" />
<input type="hidden" name="success_return_url" value="{getNotEncodedUrl('','act', 'dispCommunicationSendMessage', 'receiver_srl', $receiver_info->member_srl)}" />
<ul>
<li>
<span class="memberInfo">{$receiver_info->nick_name}</span>
Expand All @@ -29,15 +27,16 @@ <h2>{$lang->cmd_send_message}</h2>
</li>
<li>
<label for="message_content">{$lang->content}</label>
<textarea id="message_content" name="new_content" rows="8" style="width:100%"></textarea>
<textarea name="new_content" style="display:none;"></textarea>
{$editor}
</li>
<li>
<span id="message_send_mail"><input type="checkbox" value="Y" name="send_mail" /> {$lang->cmd_send_mail}</span>
</li>
</ul>
<div class="bna">
<span class="fl"><a href="{getUrl('act', 'dispCommunicationMessages')}" class="bn white">{$lang->cmd_back}</a></span>
<span class="fr"><button type="button" class="bn white" onClick="mergeContents();">{$lang->cmd_send_message}</button></span>
<span class="fr"><button type="button" class="bn white" onClick="mergeContents({editor_sequence: '{$editor_sequence}'});">{$lang->cmd_send_message}</button></span>
</div>
</form>

Expand Down
3 changes: 2 additions & 1 deletion modules/communication/skins/default/send_message.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ <h1>{$lang->cmd_send_message}</h1>
<form ruleset="sendMessage" action="./" method="post">
<input type="hidden" name="module" value="communication" />
<input type="hidden" name="act" value="procCommunicationSendMessage" />
<input type="hidden" name="content" value="{$source_message->content}" />
<input type="hidden" name="is_popup" value="Y" />
<input type="hidden" name="content" value="{$source_message->content|autoescape}" />
<input type="hidden" name="receiver_srl" value="{$receiver_info->member_srl}" />
<input type="hidden" name="xe_validator_id" value="modules/communication/skins/default/send_message/1" />
<table class="table table-striped table-hover">
Expand Down

0 comments on commit 67887f5

Please sign in to comment.