diff options
author | Sarven Capadisli <csarven@controlyourself.ca> | 2008-12-16 02:18:18 -0500 |
---|---|---|
committer | Sarven Capadisli <csarven@controlyourself.ca> | 2008-12-16 02:18:18 -0500 |
commit | 946eee42568918903bb357d5cfea57fbe40c4f6e (patch) | |
tree | 414a946473c79c72fccc302646321dc39fd387c1 | |
parent | c0977dfa1b03a65d420c2de75cfc72b1694b4b44 (diff) |
Direct message XHR response fix for IE and minor tweaks
darcs-hash:20081216071818-efd22-d2e59bb60a236538452be356f38d0974f35f0107.gz
-rw-r--r-- | actions/newmessage.php | 2 | ||||
-rw-r--r-- | actions/newnotice.php | 4 | ||||
-rw-r--r-- | classes/Channel.php | 8 | ||||
-rw-r--r-- | js/util.js | 17 |
4 files changed, 12 insertions, 19 deletions
diff --git a/actions/newmessage.php b/actions/newmessage.php index 67695210e..da48fc7e7 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -122,7 +122,7 @@ class NewmessageAction extends Action { array($this, 'show_top')); if ($msg) { - common_element('p', 'error', $msg); + common_element('p', array('id'=>'error'), $msg); } common_show_footer(); diff --git a/actions/newnotice.php b/actions/newnotice.php index 142478341..42b48923f 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -116,7 +116,7 @@ class NewnoticeAction extends Action { common_element('title', null, _('Ajax Error')); common_element_end('head'); common_element_start('body'); - common_element('p', array('class' => 'error'), $msg); + common_element('p', array('id' => 'error'), $msg); common_element_end('body'); common_element_end('html'); } @@ -141,7 +141,7 @@ class NewnoticeAction extends Action { common_show_header(_('New notice'), NULL, $content, array($this, 'show_top')); if ($msg) { - common_element('p', 'error', $msg); + common_element('p', array('id' => 'error'), $msg); } common_show_footer(); } diff --git a/classes/Channel.php b/classes/Channel.php index 34735c450..bcc0c36b5 100644 --- a/classes/Channel.php +++ b/classes/Channel.php @@ -124,23 +124,23 @@ class WebChannel extends Channel { class AjaxWebChannel extends WebChannel { function output($user, $text) { - common_start_html('text/xml;charset=utf-8', false); + common_start_html('text/xml;charset=utf-8', true); common_element_start('head'); common_element('title', null, _('Command results')); common_element_end('head'); common_element_start('body'); - common_element('p', array('class' => 'command_results'), $text); + common_element('p', array('id' => 'command_result'), $text); common_element_end('body'); common_element_end('html'); } function error($user, $text) { - common_start_html('text/xml;charset=utf-8', false); + common_start_html('text/xml;charset=utf-8', true); common_element_start('head'); common_element('title', null, _('Ajax Error')); common_element_end('head'); common_element_start('body'); - common_element('p', array('class' => 'error'), $text); + common_element('p', array('id' => 'error'), $text); common_element_end('body'); common_element_end('html'); } diff --git a/js/util.js b/js/util.js index ef07464fb..38a958968 100644 --- a/js/util.js +++ b/js/util.js @@ -144,15 +144,10 @@ $(document).ready(function(){ $("#status_form input[type=submit]").addClass("disabled"); return true; }, - success: function(xml) { if ($(".error", xml).length > 0) { - var response_error = document._importNode($(".error", xml).get(0), true); - response_error = response_error.textContent || response_error.innerHTML; - alert(response_error); - } - else if ($(".command_results", xml).length > 0) { - var command_results = document._importNode($(".command_results", xml).get(0), true); - command_results = command_results.textContent || command_results.innerHTML; - alert(command_results); + success: function(xml) { if ($("#error", xml).length > 0 || $("#command_result", xml).length > 0) { + var result = document._importNode($("p", xml).get(0), true); + result = result.textContent || result.innerHTML; + alert(result); } else { $("#notices").prepend(document._importNode($("li", xml).get(0), true)); @@ -160,13 +155,11 @@ $(document).ready(function(){ counter(); $(".notice_single:first").css({display:"none"}); $(".notice_single:first").fadeIn(2500); - } - $("#status_form input[type=submit]").removeAttr("disabled"); $("#status_form input[type=submit]").removeClass("disabled"); } - } + }; $("#status_form").ajaxForm(PostNotice); $("#status_form").each(addAjaxHidden); }); |