diff options
author | Sarven Capadisli <csarven@controlyourself.ca> | 2009-05-01 00:16:25 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@controlyourself.ca> | 2009-05-01 00:16:25 +0000 |
commit | d30df0790818d77b81ee8b271b9bd8ebe3063ee7 (patch) | |
tree | d3a9b32815252caabcf16f593fbf4e2080cff93f /actions/newmessage.php | |
parent | f798d1ea430d25c2f4a60179c65b39b1257a5340 (diff) | |
parent | b79fef307481b36b4d04dbabb54e3f6d9edf6896 (diff) |
Merge branch '0.7.x' into 0.8.x
Resolved Conflicts:
lib/queuehandler.php
lib/util.php
theme/base/css/display.css
Diffstat (limited to 'actions/newmessage.php')
-rw-r--r-- | actions/newmessage.php | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/actions/newmessage.php b/actions/newmessage.php index 82276ff34..52d4899ba 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -172,15 +172,54 @@ class NewmessageAction extends Action $this->notify($user, $this->other, $message); - $url = common_local_url('outbox', array('nickname' => $user->nickname)); + if ($this->boolean('ajax')) { + $this->startHTML('text/xml;charset=utf-8'); + $this->elementStart('head'); + $this->element('title', null, _('Message sent')); + $this->elementEnd('head'); + $this->elementStart('body'); + $this->element('p', array('id' => 'command_result'), + sprintf(_('Direct message to %s sent'), + $this->other->nickname)); + $this->elementEnd('body'); + $this->elementEnd('html'); + } else { + $url = common_local_url('outbox', + array('nickname' => $user->nickname)); + common_redirect($url, 303); + } + } - common_redirect($url, 303); + /** + * Show an Ajax-y error message + * + * Goes back to the browser, where it's shown in a popup. + * + * @param string $msg Message to show + * + * @return void + */ + + function ajaxErrorMsg($msg) + { + $this->startHTML('text/xml;charset=utf-8', true); + $this->elementStart('head'); + $this->element('title', null, _('Ajax Error')); + $this->elementEnd('head'); + $this->elementStart('body'); + $this->element('p', array('id' => 'error'), $msg); + $this->elementEnd('body'); + $this->elementEnd('html'); } function showForm($msg = null) { - $this->msg = $msg; + if ($msg && $this->boolean('ajax')) { + $this->ajaxErrorMsg($msg); + return; + } + $this->msg = $msg; $this->showPage(); } |