mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
새 쪽지 알림 문제 개선
This commit is contained in:
parent
5d3389a6ff
commit
cb206acfc0
3 changed files with 87 additions and 46 deletions
|
|
@ -254,15 +254,17 @@ class communicationController extends communication
|
|||
$oDB->rollback();
|
||||
return $trigger_output;
|
||||
}
|
||||
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
// create a flag that message is sent (in file format)
|
||||
$flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($receiver_srl);
|
||||
FileHandler::makeDir($flag_path);
|
||||
$flag_file = sprintf('%s%s', $flag_path, $receiver_srl);
|
||||
$flag_count = FileHandler::readFile($flag_file);
|
||||
FileHandler::writeFile($flag_file, ++$flag_count);
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$new_message_count = $oCommunicationModel->getNewMessageCount($receiver_srl);
|
||||
FileHandler::writeFile($flag_file, $new_message_count);
|
||||
|
||||
return new Object(0, 'success_sended');
|
||||
}
|
||||
|
|
@ -771,10 +773,30 @@ class communicationController extends communication
|
|||
*/
|
||||
function setMessageReaded($message_srl)
|
||||
{
|
||||
$args = new stdClass();
|
||||
$args = new stdClass;
|
||||
$args->message_srl = $message_srl;
|
||||
$args->related_srl = $message_srl;
|
||||
return executeQuery('communication.setMessageReaded', $args);
|
||||
$output = executeQuery('communication.setMessageReaded', $args);
|
||||
|
||||
// Renew a flag
|
||||
$logged_info = Context::get('logged_info');
|
||||
$flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl);
|
||||
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
|
||||
if(file_exists($flag_file))
|
||||
{
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$new_message_count = $oCommunicationModel->getNewMessageCount();
|
||||
if($new_message_count > 0)
|
||||
{
|
||||
FileHandler::writeFile($flag_file, $new_message_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileHandler::removeFile($flag_file);
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function triggerModuleHandlerBefore($obj)
|
||||
|
|
@ -805,18 +827,24 @@ class communicationController extends communication
|
|||
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
|
||||
}
|
||||
|
||||
if($config->enable_message == 'Y')
|
||||
if($config->enable_message == 'Y' && $obj->act != 'dispCommunicationNewMessage')
|
||||
{
|
||||
$flag_file = './files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl) . $logged_info->member_srl;
|
||||
$flag_path = './files/member_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl);
|
||||
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
|
||||
if(file_exists($flag_file))
|
||||
{
|
||||
// Pop-up to display messages if a flag on new message is set
|
||||
$new_message_count = (int) trim(FileHandler::readFile($flag_file));
|
||||
$text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived')));
|
||||
Context::addHtmlFooter("<script>jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>");
|
||||
Context::loadFile(array('./modules/communication/tpl/js/member_communication.js'), true);
|
||||
|
||||
FileHandler::removeFile($flag_file);
|
||||
if($new_message_count > 0)
|
||||
{
|
||||
$text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived')));
|
||||
Context::addHtmlFooter("<script>jQuery(function(){ xeNotifyMessage('{$text}','{$new_message_count}'); });</script>");
|
||||
Context::loadFile(array('./modules/communication/tpl/js/member_communication.js'), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
FileHandler::removeFile($flag_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ class communicationView extends communication
|
|||
{
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
$this->communication_config = $oCommunicationModel->getConfig();
|
||||
$skin = $this->communication_config->skin;
|
||||
$this->config = $oCommunicationModel->getConfig();
|
||||
$skin = $this->config->skin;
|
||||
|
||||
Context::set('communication_config', $this->communication_config);
|
||||
Context::set('communication_config', $this->config);
|
||||
|
||||
$config_parse = explode('|@|', $skin);
|
||||
|
||||
|
|
@ -36,10 +36,10 @@ class communicationView extends communication
|
|||
$this->setTemplatePath($tpl_path);
|
||||
|
||||
$oLayoutModel = getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($this->communication_config->layout_srl);
|
||||
$layout_info = $oLayoutModel->getLayout($this->config->layout_srl);
|
||||
if($layout_info)
|
||||
{
|
||||
$this->module_info->layout_srl = $this->communication_config->layout_srl;
|
||||
$this->module_info->layout_srl = $this->config->layout_srl;
|
||||
$this->setLayoutPath($layout_info->path);
|
||||
}
|
||||
}
|
||||
|
|
@ -50,6 +50,11 @@ class communicationView extends communication
|
|||
*/
|
||||
function dispCommunicationMessages()
|
||||
{
|
||||
if($this->config->enable_message == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
|
|
@ -58,11 +63,6 @@ class communicationView extends communication
|
|||
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
if(!array_key_exists('dispCommunicationMessages', $logged_info->menu_list))
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// Set the variables
|
||||
$message_srl = Context::get('message_srl');
|
||||
$message_type = Context::get('message_type');
|
||||
|
|
@ -138,6 +138,11 @@ class communicationView extends communication
|
|||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile('popup_layout');
|
||||
|
||||
if($this->config->enable_message == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
|
|
@ -157,11 +162,6 @@ class communicationView extends communication
|
|||
Context::set('message', $message);
|
||||
}
|
||||
|
||||
// Delete a flag
|
||||
$flag_path = './files/communication_extra_info/new_message_flags/' . getNumberingPath($logged_info->member_srl);
|
||||
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
|
||||
FileHandler::removeFile($flag_file);
|
||||
|
||||
$this->setTemplateFile('new_message');
|
||||
}
|
||||
|
||||
|
|
@ -174,9 +174,11 @@ class communicationView extends communication
|
|||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile("popup_layout");
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$oMemberModel = getModel('member');
|
||||
|
||||
if($this->config->enable_message == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
|
|
@ -199,6 +201,9 @@ class communicationView extends communication
|
|||
return $this->stop('msg_cannot_send_to_yourself');
|
||||
}
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
$oMemberModel = getModel('member');
|
||||
|
||||
// get message_srl of the original message if it is a reply
|
||||
$message_srl = Context::get('message_srl');
|
||||
if($message_srl)
|
||||
|
|
@ -235,8 +240,8 @@ class communicationView extends communication
|
|||
$option->resizable = FALSE;
|
||||
$option->disable_html = TRUE;
|
||||
$option->height = 300;
|
||||
$option->skin = $this->communication_config->editor_skin;
|
||||
$option->colorset = $this->communication_config->editor_colorset;
|
||||
$option->skin = $this->config->editor_skin;
|
||||
$option->colorset = $this->config->editor_colorset;
|
||||
$editor = $oEditorModel->getEditor($logged_info->member_srl, $option);
|
||||
Context::set('editor', $editor);
|
||||
|
||||
|
|
@ -249,12 +254,17 @@ class communicationView extends communication
|
|||
*/
|
||||
function dispCommunicationFriend()
|
||||
{
|
||||
if($this->config->enable_friend == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// Error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
return $this->stop('msg_not_logged');
|
||||
}
|
||||
|
||||
|
||||
$oCommunicationModel = getModel('communication');
|
||||
|
||||
// get a group list
|
||||
|
|
@ -307,7 +317,12 @@ class communicationView extends communication
|
|||
{
|
||||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile("popup_layout");
|
||||
|
||||
|
||||
if($this->config->enable_friend == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// error appears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
|
|
@ -349,7 +364,12 @@ class communicationView extends communication
|
|||
{
|
||||
$this->setLayoutPath('./common/tpl/');
|
||||
$this->setLayoutFile("popup_layout");
|
||||
|
||||
|
||||
if($this->config->enable_friend == 'N')
|
||||
{
|
||||
return $this->stop('msg_invalid_request');
|
||||
}
|
||||
|
||||
// error apprears if not logged-in
|
||||
if(!Context::get('is_logged'))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,16 +11,9 @@
|
|||
})
|
||||
.prependTo(document.body);
|
||||
}
|
||||
|
||||
text = text.replace('%d', count);
|
||||
var cur_module = current_url.getQuery('module');
|
||||
if( cur_module == "admin" )
|
||||
h = $bar.html('<p><a href="'+current_url.setQuery('module','').setQuery('act','dispCommunicationMessages')+'" target="_blank">'+text+'</a></p>').height();
|
||||
else
|
||||
h = $bar.html('<p><a href="'+current_url.setQuery('module','').setQuery('act','dispCommunicationMessages')+'">'+text+'</a></p>').height();
|
||||
$bar.html('<p><a href="'+current_url.setQuery('module','').setQuery('act','dispCommunicationNewMessage')+'" onclick="popopen(this.href, \'popup\'); return false;">'+text+'</a></p>').height();
|
||||
$bar.show().animate({top:0});
|
||||
// hide after 10 seconds
|
||||
setTimeout(function(){
|
||||
$bar.slideUp();
|
||||
}, 5000);
|
||||
};
|
||||
})(jQuery);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue