array($this, 'show_top'));
if ($msg) {
- common_element('p', 'error', $msg);
+ common_element('p', array('id'=>'error'), $msg);
}
common_show_footer();
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');
}
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();
}
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');
}
$("#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));
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);
});