From 5dbb64c26ba05c8d0197d7b4e57b9b531582ed75 Mon Sep 17 00:00:00 2001 From: taggon Date: Fri, 23 Sep 2011 08:29:57 +0000 Subject: [PATCH] As now, private messages use an in-page notifying message instead of a popup window. git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9312 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- .../member_communication.addon.php | 17 ++++++----- .../tpl/member_communication.js | 28 +++++++++++++++++++ 2 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 addons/member_communication/tpl/member_communication.js diff --git a/addons/member_communication/member_communication.addon.php b/addons/member_communication/member_communication.addon.php index 1555c0f2a..7fa1f5cee 100644 --- a/addons/member_communication/member_communication.addon.php +++ b/addons/member_communication/member_communication.addon.php @@ -26,21 +26,20 @@ $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); // Pop-up to display messages if a flag on new message is set $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); + $flag_file = $flag_path.$logged_info->member_srl; if(file_exists($flag_file)) { - $new_message_count = FileHandler::readFile($flag_file); + $new_message_count = trim(FileHandler::readFile($flag_file)); FileHandler::removeFile($flag_file); Context::loadLang('./addons/member_communication/lang'); + Context::loadFile(array('./addons/member_communication/tpl/member_communication.js')); - $script = sprintf('', sprintf(Context::getLang('alert_new_message_arrived'), $new_message_count), Context::getRequestUri().'?module=communication&act=dispCommunicationNewMessage'); + $text = preg_replace('@\r?\n@', '\\n', addslashes(Context::getLang('alert_new_message_arrived'))); + $link = Context::getRequestUri().'?module=communication&act=dispCommunicationNewMessage'; + $script = ""; - Context::addHtmlHeader( $script ); - } - - /** - * Links are added on the pop-up menu which appears when clicking user name - **/ + Context::addHtmlFooter($script); + } } elseif($called_position == 'before_module_proc' && $this->act == 'getMemberMenu') { $oMemberController = &getController('member'); diff --git a/addons/member_communication/tpl/member_communication.js b/addons/member_communication/tpl/member_communication.js new file mode 100644 index 000000000..b7487b9a6 --- /dev/null +++ b/addons/member_communication/tpl/member_communication.js @@ -0,0 +1,28 @@ +(function($){ + +window.xeNotifyMessage = function(text, count){ + var $bar; + + $bar = $('div.notifyMessage'); + if(!$bar.length) { + $bar = $('
') + .hide() + .css({ + position : 'absolute', + background : '#ff0', + border : '1px solid #990', + textAlign : 'center' + }) + .appendTo(document.body); + } + + h = $bar.html(''+text+'').height(); + $bar.css('top', -h-4).show().animate({top:0}); + + // hide after 10 seconds + setTimeout(function(){ + $bar.animate({top:-h-4}, function(){ $bar.hide() }); + }, 10000); +}; + +})(jQuery);