]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Direct message XHR response fix for IE and minor tweaks
authorSarven Capadisli <csarven@controlyourself.ca>
Tue, 16 Dec 2008 07:18:18 +0000 (02:18 -0500)
committerSarven Capadisli <csarven@controlyourself.ca>
Tue, 16 Dec 2008 07:18:18 +0000 (02:18 -0500)
darcs-hash:20081216071818-efd22-d2e59bb60a236538452be356f38d0974f35f0107.gz

actions/newmessage.php
actions/newnotice.php
classes/Channel.php
js/util.js

index 67695210ec21ebf5db6add7234fbd1f0d2ee1f33..da48fc7e7a07ad8806d6d2b0bd807952690585f9 100644 (file)
@@ -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();
index 142478341a47ddab075965cb81911a0a50beceb6..42b48923f56b8d104f68a58bc57b9e3410e224ba 100644 (file)
@@ -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();
        }
index 34735c450dacfe855c3ba43d44bf7a6ea6a8f54d..bcc0c36b56517a0ac813fcf885bd78bace4b0012 100644 (file)
@@ -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');
        }
index ef07464fbdc317486e53e876334ce87bba0cd92c..38a9589680ef9e9bb28d42f1240eded954bd1d3e 100644 (file)
@@ -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);
 });