diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3 index e86978f9ed0c64959c2492dc50e7d9cc1d8cc461..780fd22a31734fcdb1cfaf2c6bdff483308ad9a9 100644 --- a/ecrire/inc_presentation.php3 +++ b/ecrire/inc_presentation.php3 @@ -2032,6 +2032,13 @@ else { icone_bandeau_secondaire (_T('icone_articles'), "articles_page.php3", "article-24.gif", "articles", $sous_rubrique); } + if ($connect_statut == "0minirezo") $req_where = " AND spip_articles.statut IN ('prepa','prop','publie')"; + else $req_where = " AND spip_articles.statut IN ('prop','publie')"; + $nombre_versions = spip_num_rows(spip_query("SELECT spip_versions.*, spip_articles.statut, spip_articles.titre FROM spip_versions, spip_articles WHERE spip_versions.id_article = spip_articles.id_article AND spip_versions.id_version > 1$req_where LIMIT 0,1")); + if ($nombre_versions > 0 OR 1==1) { + icone_bandeau_secondaire (_T('icone_suivi_revisions'), "suivi_versions.php", "historique-24.gif", "revisions", $sous_rubrique); + } + $activer_breves=lire_meta("activer_breves"); if ($activer_breves != "non"){ icone_bandeau_secondaire (_T('icone_breves'), "breves.php3", "breve-24.gif", "breves", $sous_rubrique); diff --git a/ecrire/inc_suivi_revisions.php b/ecrire/inc_suivi_revisions.php new file mode 100644 index 0000000000000000000000000000000000000000..42aabef4d73b6d383c07710a729a9c5dc268b897 --- /dev/null +++ b/ecrire/inc_suivi_revisions.php @@ -0,0 +1,155 @@ +<?php +// +// Ce fichier ne sera execute qu'une fois +if (defined("_ECRIRE_INC_SUIVI_REVISIONS")) return; +define("_ECRIRE_INC_SUIVI_REVISIONS", "1"); + +include_ecrire("inc.php"); +include_spip("ecrire.php"); +include_spip("revisions.php"); +include_spip("diff.php"); + + +function afficher_para_modifies ($texte) { + $paras = explode ("\n",$texte); + for ($i = 0; $i < count($paras); $i++) { + if (ereg("diff-", $paras[$i])) $texte_ret .= $paras[$i]."\n\n"; + } + $texte = $texte_ret; + return $texte; +} + +function afficher_suivi_versions ($debut = 0, $id_secteur = 0, $uniq_auteur = false) { + global $connect_id_auteur, $connect_statut, $dir_lang; + + $nb_aff = 10; + $champs = array('surtitre', 'titre', 'soustitre', 'descriptif', 'nom_site', 'url_site', 'chapo', 'texte', 'ps'); + + if ($connect_statut == "0minirezo") $req_where = " AND spip_articles.statut IN ('prepa','prop','publie')"; + else $req_where = " AND spip_articles.statut IN ('prop','publie')"; + + if ($uniq_auteur) $req_where = " AND spip_versions.id_auteur = $connect_id_auteur"; + + if ($id_secteur > 0) $req_where .= " AND spip_articles.id_secteur = $id_secteur"; + + $query = "SELECT spip_versions.*, spip_articles.statut, spip_articles.titre FROM spip_versions, spip_articles WHERE spip_versions.id_article = spip_articles.id_article AND spip_versions.id_version > 1$req_where ORDER BY spip_versions.date DESC LIMIT $debut, $nb_aff"; + $result = spip_query($query); + + if (spip_num_rows($result) > 0) { + $titre_table = _T('icone_suivi_revisions'); + echo "<div style='height: 12px;'></div>"; + echo "<div class='liste'>"; + bandeau_titre_boite2($titre_table, "historique-24.gif"); + + $query_total = "SELECT spip_versions.*, spip_articles.statut, spip_articles.titre FROM spip_versions, spip_articles WHERE spip_versions.id_article = spip_articles.id_article AND spip_versions.id_version > 1$req_where LIMIT 0, 149"; + $result_total = spip_query($query_total); + $total = spip_num_rows($result_total); + + if ($total > $nb_aff) { + $nb_tranches = ceil($total / $nb_aff); + + echo "<div class='arial2' style='background-color: #dddddd; padding: 5px;'>"; + + for ($i = 0; $i < $nb_tranches; $i++) { + if ($i > 0) echo " | "; + if ($i*$nb_aff == $debut) echo "<b>"; + else echo "<a href='suivi_versions.php?debut=".($i * $nb_aff)."&id_secteur=$id_secteur&uniq_auteur=$uniq_auteur'>"; + echo (($i * $nb_aff) + 1); + if ($i*$nb_aff == $debut) echo "</b>"; + else echo "</a>"; + } + echo "</div>"; + } + + while ($row = mysql_fetch_array($result)) { + $id_version = $row['id_version']; + $id_auteur = $row['id_auteur']; + $date = affdate_court($row['date']); + $id_article = $row['id_article']; + $statut = $row['statut']; + $titre = propre($row['titre']); + $nom = ""; + $query_auteur = "SELECT nom FROM spip_auteurs WHERE id_auteur = $id_auteur"; + $result_auteur = spip_query($query_auteur); + if ($row_auteur = spip_fetch_array($result_auteur)) { + $nom = propre($row_auteur["nom"]); + if (strlen($nom) > 0) $nom = "($nom)"; + } + + + $logo_statut = "puce-".puce_statut($statut).".gif"; + + echo "<div class='tr_liste' style='padding: 5px; border-top: 1px solid #aaaaaa;'>"; + + echo "<span class='arial2'>"; + echo bouton_block_invisible("$id_version-$id_article-$id_auteur"); + echo "<img src='img_pack/$logo_statut' border='0'> "; + echo "<a class='$statut' style='font-weight: bold;' href='articles.php3?id_article=$id_article'>$titre</a>"; + echo "</span>"; + echo "<span class='arial1'>"; + echo " $date $nom"; + echo "</span>"; + + $query_diff = "SELECT id_version FROM spip_versions WHERE id_article=$id_article ". + "AND id_version<$id_version ORDER BY id_version DESC LIMIT 0,1"; + if ($result_diff = spip_query($query_diff)) { + $row_diff = mysql_fetch_array($result_diff); + $id_diff = $row_diff['id_version']; + } + + + $query_art = "SELECT * FROM spip_articles WHERE id_article='$id_article'"; + $result_art = spip_query($query_art); + + if ($row_art = spip_fetch_array($result_art)) { + $id_article = $row_art["id_article"]; + $id_rubrique = $row_art["id_rubrique"]; + $date = $row_art["date"]; + $statut_article = $row_art["statut"]; + $maj = $row_art["maj"]; + $date_redac = $row_art["date_redac"]; + $visites = $row_art["visites"]; + $referers = $row_art["referers"]; + $extra = $row_art["extra"]; + $id_trad = $row_art["id_trad"]; + } + + $textes = recuperer_version($id_article, $id_version); + + if ($id_version && $id_diff) { + if ($id_diff > $id_version) { + $t = $id_version; + $id_version = $id_diff; + $id_diff = $t; + $old = $textes; + $new = $textes = recuperer_version($id_article, $id_version); + } + else { + $old = recuperer_version($id_article, $id_diff); + $new = $textes; + } + $textes = array(); + foreach ($champs as $champ) { + if (!$new[$champ] && !$old[$champ]) continue; + $diff = new Diff(new DiffTexte); + $textes[$champ] = afficher_para_modifies(afficher_diff($diff->comparer(preparer_diff($new[$champ]), preparer_diff($old[$champ])))); + } + } + + echo debut_block_invisible("$id_version-$id_article-$id_auteur"); + if (is_array($textes)) + foreach ($textes as $var => $t) { + if (strlen($t) > 0) { + echo "<blockquote class='spip serif1'>"; + echo propre($t).""; + echo "</blockquote>"; + } + } + echo fin_block(); + echo "</div>"; + } + echo "</div>"; + } +} + +?> \ No newline at end of file diff --git a/ecrire/index.php3 b/ecrire/index.php3 index a5d64b796d22030f2b9d69368b05552b7b66d9c1..7c9c3fa9c4855ff7f3ea1fd79f00652382ebd531 100644 --- a/ecrire/index.php3 +++ b/ecrire/index.php3 @@ -339,6 +339,13 @@ if ($options == 'avancees') { "WHERE articles.id_article=lien.id_article AND lien.id_auteur=\"$connect_id_auteur\" AND articles.statut=\"publie\" ORDER BY articles.date DESC", true); + // Dernieres modifications d'articles + echo "<p>"; + include_ecrire("inc_suivi_revisions.php"); + afficher_suivi_versions (); + + + } diff --git a/ecrire/spip_style.php3 b/ecrire/spip_style.php3 index 3973a02e6e75e4fecb5bf3c924dda32f2fccf119..cdc6595ab66cb0a41e10903fada8dd50876d6673 100644 --- a/ecrire/spip_style.php3 +++ b/ecrire/spip_style.php3 @@ -620,6 +620,7 @@ div.onglet_off { .verdana2 { font-family: Verdana, Arial, Sans, sans-serif; font-size: 11px; } .verdana3 { font-family: Verdana, Arial, Sans, sans-serif; font-size: 13px; } .serif { font-family: Georgia, Garamond, Times New Roman, serif; } +.serif1 { font-family: Georgia, Garamond, Times New Roman, serif; font-size: 11px; } .serif2 { font-family: Georgia, Garamond, Times New Roman, serif; font-size: 13px; } /* Liens hypertexte */ diff --git a/ecrire/suivi_versions.php b/ecrire/suivi_versions.php new file mode 100644 index 0000000000000000000000000000000000000000..7f48135291a1729d3a6f94d13cff33110be049e7 --- /dev/null +++ b/ecrire/suivi_versions.php @@ -0,0 +1,66 @@ +<?php + +include("inc.php"); + +include_ecrire("inc_suivi_revisions.php"); +include_spip("ecrire.php"); +include_spip("revisions.php"); +include_spip("diff.php"); + + + + +debut_page(_T("icone_suivi_revisions")); + + +////////////////////////////////////////////////////// +// Affichage de la colonne de gauche +// + +debut_gauche(); +if (!$debut) $debut = 0; + +if (!$uniq_auteur) $uniq_auteur = false ; +else $uniq_auteur = true; + + +if ($connect_statut == "0minirezo") $req_where = " AND spip_articles.statut IN ('prepa','prop','publie')"; +else $req_where = " AND spip_articles.statut IN ('prop','publie')"; + + +echo "<div class='arial1'>"; + +if (!$uniq_auteur AND $id_secteur < 1) echo "<li><b>tout afficher</b>"; +else echo "<li><a href='suivi_versions.php'>tout afficher</a>"; + +if ($uniq_auteur) echo "<li><b>mes modifications</b>"; +else echo "<li><a href='suivi_versions.php?uniq_auteur=true'>mes modifications</a>"; + +$query = "SELECT * FROM spip_rubriques WHERE id_parent = 0 ORDER BY titre"; +$result = spip_query($query); + +while ($row = mysql_fetch_array($result)) { + $id_rubrique = $row['id_rubrique']; + $titre = propre($row['titre']); + + $query_rub = "SELECT spip_versions.*, spip_articles.statut, spip_articles.titre FROM spip_versions, spip_articles WHERE spip_versions.id_article = spip_articles.id_article AND spip_versions.id_version > 1 AND spip_articles.id_secteur=$id_rubrique$req_where LIMIT 0,1"; + $result_rub = spip_query($query_rub); + + if ($id_rubrique == $id_secteur) echo "<li><b>$titre</b>"; + else if (spip_num_rows($result_rub) > 0) echo "<li><a href='suivi_versions.php?id_secteur=$id_rubrique'>$titre</a>"; +} +echo "</div>"; + + +////////////////////////////////////////////////////// +// Affichage de la colonne de droite +// + + +debut_droite(); + +afficher_suivi_versions ($debut, $id_secteur, $uniq_auteur); + +fin_page(); + +?>