diff --git a/.gitattributes b/.gitattributes index 345130166a92030389d4438a52198252f620599c..06f762667d29abb94b0bc786e9b4d28cbe01ff3f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -413,6 +413,7 @@ ecrire/exec/mots_type.php -text ecrire/exec/naviguer.php -text ecrire/exec/petitionner.php -text ecrire/exec/plonger.php -text +ecrire/exec/puce_statut_article.php -text ecrire/exec/recherche.php -text ecrire/exec/rechercher.php -text ecrire/exec/rechercher_auteur.php -text diff --git a/ecrire/exec/puce_statut_article.php b/ecrire/exec/puce_statut_article.php new file mode 100644 index 0000000000000000000000000000000000000000..cb1acde7de17196e6c5dbf7b41042a71a6a0e11f --- /dev/null +++ b/ecrire/exec/puce_statut_article.php @@ -0,0 +1,30 @@ +<?php + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2006 * + * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * + * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + + +if (!defined("_ECRIRE_INC_VERSION")) return; + +include_spip('inc/presentation'); +include_spip('inc/autoriser'); + +// http://doc.spip.org/@exec_articles_versions_dist +function exec_puce_statut_article_dist() +{ + $id = _request('id'); + $s = spip_query( + "SELECT id_rubrique,statut FROM spip_articles WHERE id_article="._q($id)); + $r = spip_fetch_array($s); + + ajax_retour(puce_statut_article($id,$r['statut'],$r['id_rubrique'],true)); +} + +?> \ No newline at end of file diff --git a/ecrire/inc/presentation.php b/ecrire/inc/presentation.php index 3d373f6243f9e2c63f018f9b8f1814bc2df1a451..c87550b80946eaec1d8d5c7f2b28a13ada79cbfd 100644 --- a/ecrire/inc/presentation.php +++ b/ecrire/inc/presentation.php @@ -516,8 +516,9 @@ function afficher_liste_fin_tableau() { // http://doc.spip.org/@puce_statut_article -function puce_statut_article($id, $statut, $id_rubrique) { +function puce_statut_article($id, $statut, $id_rubrique, $ajax = false) { global $spip_lang_left, $dir_lang, $connect_statut, $options; + static $script=NULL; switch ($statut) { case 'publie': @@ -547,8 +548,9 @@ function puce_statut_article($id, $statut, $id_rubrique) { break; } $puce = "puce-$puce.gif"; - - if ($connect_statut == '0minirezo' AND $options == 'avancees' AND acces_rubrique($id_rubrique)) { + + include_spip('inc/autoriser'); + if (autoriser('publier_dans', 'rubrique', $id_rubrique)) { // les versions de MSIE ne font pas toutes pareil sur alt/title // la combinaison suivante semble ok pour tout le monde. $titles = array( @@ -557,17 +559,44 @@ function puce_statut_article($id, $statut, $id_rubrique) { "verte" => _T('texte_statut_publie'), "rouge" => _T('texte_statut_refuse'), "poubelle" => _T('texte_statut_poubelle')); - $action = "onmouseover=\"montrer('statutdecalarticle$id');\""; - $inser_puce = "\n<div class='puce_article' id='statut$id'$dir_lang>" - . "\n<div class='puce_article_fixe' $action>" . - http_img_pack("$puce", "", "id='imgstatutarticle$id' style='margin: 1px;'") ."</div>" - . "\n<div class='puce_article_popup' id='statutdecalarticle$id' onmouseout=\"cacher('statutdecalarticle$id');\" style=' margin-left: -".((11*$clip)+1)."px;'>\n" - . afficher_script_statut($id, 'article', -1, 'puce-blanche.gif', 'prepa', $titles['blanche'], $action) - . afficher_script_statut($id, 'article', -12, 'puce-orange.gif', 'prop', $titles['orange'], $action) - . afficher_script_statut($id, 'article', -23, 'puce-verte.gif', 'publie', $titles['verte'], $action) - . afficher_script_statut($id, 'article', -34, 'puce-rouge.gif', 'refuse', $titles['rouge'], $action) - . afficher_script_statut($id, 'article', -45, 'puce-poubelle.gif', 'poubelle', $titles['poubelle'], $action) - . "</div></div>"; + if ($ajax){ + $action = "onmouseover=\"montrer('statutdecalarticle$id');\""; + $inser_puce = + // "\n<div class='puce_article' id='statut$id'$dir_lang>" . + "\n<div class='puce_article_fixe' $action>" . + http_img_pack("$puce", "", "id='imgstatutarticle$id' style='margin: 1px;'") ."</div>" + . "\n<div class='puce_article_popup' id='statutdecalarticle$id' onmouseout=\"cacher('statutdecalarticle$id');\" style=' margin-left: -".((11*$clip)+1)."px;'>\n" + . afficher_script_statut($id, 'article', -1, 'puce-blanche.gif', 'prepa', $titles['blanche'], $action) + . afficher_script_statut($id, 'article', -12, 'puce-orange.gif', 'prop', $titles['orange'], $action) + . afficher_script_statut($id, 'article', -23, 'puce-verte.gif', 'publie', $titles['verte'], $action) + . afficher_script_statut($id, 'article', -34, 'puce-rouge.gif', 'refuse', $titles['rouge'], $action) + . afficher_script_statut($id, 'article', -45, 'puce-poubelle.gif', 'poubelle', $titles['poubelle'], $action) + . "</div>" + //. "</div>" + ; + } + else{ + $inser_puce = "\n<div class='puce_article' id='statut$id'$dir_lang>". + http_img_pack("$puce", "", "id='imgstatutarticle$id' style='margin: 1px;'") ."</div>" + . "</div>"; + if ($script==NULL){ + $action = "'".generer_url_ecrire('puce_statut_article',"id='+id",true); + $script = "<script type='text/javascript'><!--\n"; + $script .= "$(document).ready(function(){ + $('div.puce_article').onemouseover( function() { + id = $(this).id(); + id = id.substr(6,id.length-1); + $('#statut'+id).load($action,function(){ + $('#statutdecalarticle'+id).show(); + /*$('#statut'+id).mouseover(function(){ $(this).children('.puce_article_popup').show(); });*/ + }); + }); + + })"; + $script .= "//--></script>"; + $inser_puce = $script . $inser_puce; + } + } } else { $inser_puce = http_img_pack("$puce", "", "id='imgstatutarticle$id' style='margin: 1px;'"); } @@ -631,7 +660,7 @@ function puce_statut_breve($id, $statut, $type, $droit) { // http://doc.spip.org/@afficher_script_statut function afficher_script_statut($id, $type, $n, $img, $statut, $title, $act) { - return http_href_img("javascript:selec_statut('$id', '$type', -1, '" . + return http_href_img("javascript:selec_statut('$id', '$type', $n, '" . http_wrapper($img) . "', '" . generer_action_auteur("instituer_$type","$id-$statut") .