diff --git a/ecrire/inc/actions.php b/ecrire/inc/actions.php index 7abfc1e0927cfce9da4b919537642ae32ba5a875..5168e7158fd21dde633e2a0c56367a7f6484b8e2 100644 --- a/ecrire/inc/actions.php +++ b/ecrire/inc/actions.php @@ -136,17 +136,11 @@ function ajax_retour($corps, $content_type = null) { ) { $e = erreur_squelette(); } - if (isset($GLOBALS['transformer_xml']) or (isset($GLOBALS['exec']) and $GLOBALS['exec'] == 'valider_xml')) { - $debut = _DOCTYPE_ECRIRE - . '<html><head><title>Debug Spip Ajax</title></head>' - . "<body><div>\n\n" - . "<!-- %%%%%%%%%%%%%%%%%%% Ajax %%%%%%%%%%%%%%%%%%% -->\n"; - $fin = '</div></body></html>'; - } else { - $c = $GLOBALS['meta']['charset']; - header('Content-Type: ' . $content_type . '; charset=' . $c); - $debut = (($xml and strlen(trim($corps))) ? '<' . "?xml version='1.0' encoding='" . $c . "'?" . ">\n" : ''); - $fin = ''; - } + + $c = $GLOBALS['meta']['charset']; + header('Content-Type: ' . $content_type . '; charset=' . $c); + $debut = (($xml and strlen(trim($corps))) ? '<' . "?xml version='1.0' encoding='" . $c . "'?" . ">\n" : ''); + $fin = ''; + echo $debut, $corps, $fin, $e; } diff --git a/ecrire/inc/headers.php b/ecrire/inc/headers.php index 8b18633b80629dfdee48af5969d8f8646c8bc558..3ab091b873e83c4705dd49f933ef4531f856dee0 100644 --- a/ecrire/inc/headers.php +++ b/ecrire/inc/headers.php @@ -49,10 +49,6 @@ function redirige_par_entete($url, $equiv = '', $status = 302) { $url = url_absolue($url); } - if ($x = _request('transformer_xml')) { - $url = parametre_url($url, 'transformer_xml', $x, '&'); - } - if (defined('_AJAX') and _AJAX) { $url = parametre_url($url, 'var_ajax_redir', 1, '&'); } diff --git a/ecrire/index.php b/ecrire/index.php index 08c50684494fffb922c4a9eec3fc2c21a2aab11f..3df42112372276d299499ad13f98f527c9e759e8 100644 --- a/ecrire/index.php +++ b/ecrire/index.php @@ -45,7 +45,6 @@ if (autoriser_sans_cookie($exec)) { if (!isset($reinstall)) { $reinstall = 'non'; } - set_request('transformer_xml'); $var_auth = true; } else { // Authentification, redefinissable @@ -160,13 +159,6 @@ if (!$var_auth and isset($_COOKIE['spip_lang_ecrire']) action_converser_post($GLOBALS['visiteur_session']['lang'], true); } - -// Passer la main aux outils XML a la demande (meme les redac s'ils veulent). -// mais seulement si on a bien ete auhentifie -if ($var_f = _request('transformer_xml')) { - set_request('var_url', $exec); - $exec = $var_f; -} if ($var_f = tester_url_ecrire($exec)) { $var_f = charger_fonction($var_f); $var_f(); // at last diff --git a/prive/javascript/layer.js b/prive/javascript/layer.js index e1090a6a0cc4acbbed9b1f4e44ae5d28e51a0458..5eefb3cd7ee65214fd84667326c5a75afb118257 100644 --- a/prive/javascript/layer.js +++ b/prive/javascript/layer.js @@ -174,66 +174,38 @@ function verifForm(racine) { // et son resultat booleen est inverse ce qui lui permet de retourner // le gestionnaire Ajax comme valeur non fausse function AjaxSqueezeNode(trig, target, f, event) { - var i, callback; + var callback; // retour std si pas precise: affecter ce noeud avec ce retour if (!f) { callback = function() { verifForm(this);} - } - else { + } else { callback = function(res,status) { f.apply(this,[res,status]); verifForm(this); } } - valid = false; - if (typeof(window['_OUTILS_DEVELOPPEURS']) != 'undefined'){ - if (!(navigator.userAgent.toLowerCase().indexOf("firefox/1.0"))) - valid = (typeof event == 'object') && (event.altKey || event.metaKey); - } - - if (typeof(trig) == 'string') { - // laisser le choix de la touche enfoncee au moment du clic - // car beaucoup de systemes en prenne une a leur usage - if (valid) { - window.open(trig+'&transformer_xml=valider_xml'); - } else { - jQuery(target).animeajax(); - } - res = jQuery.ajax({ + if (typeof(trig) === 'string') { + jQuery(target).animeajax(); + return jQuery.ajax({ "url":trig, "complete": function(r,s) { AjaxRet(r,s,target, callback); jQuery(target).endLoading(); } }); - return res; } - if(valid) { - //open a blank window - var doc = window.open("","valider").document; - //create a document to enable receiving the result of the ajax post - doc.open(); - doc.close(); - //set the element receiving the ajax post - target = doc.body; - } - else { - jQuery(target).animeajax(); - } + jQuery(target).animeajax(); jQuery(trig).ajaxSubmit({ "target": target, "success": function(res,status) { - if(status=='error') return this.html('Erreur HTTP'); + if (status === 'error') { + return this.html('Erreur HTTP'); + } callback.apply(this,[res,status]); - }, - "beforeSubmit":function (vars) { - if (valid) - vars.push({"name":"transformer_xml","value":"valider_xml"}); - return true; } }); return true; @@ -241,8 +213,12 @@ function AjaxSqueezeNode(trig, target, f, event) { function AjaxRet(res,status, target, callback) { - if (res.aborted) return; - if (status=='error') return jQuery(target).html('HTTP Error'); + if (res.aborted) { + return; + } + if (status === 'error') { + return jQuery(target).html('HTTP Error'); + } // Inject the HTML into all the matched elements jQuery(target)