Author: alain@barbason.be
Date: Sat Jun 10 21:48:07 2006
New Revision: 3545
Log:
Correction orthographique interactive (enfin on essaye)
Added:
_contribs_/_ecrire_/accessibilite/ortho_choix.php
_contribs_/_ecrire_/accessibilite/ortho_modif.php
Modified:
_contribs_/_ecrire_/accessibilite/articles_ortho.php
_contribs_/_ecrire_/accessibilite/lab_ortho.php
Modified: _contribs_/_ecrire_/accessibilite/articles_ortho.php
--- _contribs_/_ecrire_/accessibilite/articles_ortho.php (original)
+++ _contribs_/_ecrire_/accessibilite/articles_ortho.php Sat Jun 10 21:48:07 2006
@@ -18,6 +18,7 @@
include_spip("layer.php"); // Pour $browser_name
//charset_texte('utf-8');
+global $spip_display;
//
@@ -120,10 +121,14 @@
echo "<b>"._T('ortho_trop_de_fautes2')."</b><p>";
}
else {
+ if ($spip_display!=4) {
echo "<b>"._T('ortho_mode_demploi').aide('corrortho')."</b><p>\n";
+ } else {
+ echo "Les mots errones sont repris par des liens, attention, les liens extérieurs sont tjs actifs";
+ }
}
- panneau_ortho($result_ortho);
+ if ($spip_display!=4) {panneau_ortho($result_ortho);}
}
else {
$erreur = $result_ortho;
Modified: _contribs_/_ecrire_/accessibilite/lab_ortho.php
--- _contribs_/_ecrire_/accessibilite/lab_ortho.php (original)
+++ _contribs_/_ecrire_/accessibilite/lab_ortho.php Sat Jun 10 21:48:07 2006
@@ -638,6 +637,9 @@
function souligner_ortho($texte, $lang, $ortho_result) {
global $id_suggest;
+ global $spip_display;
+ global $id_article;
+
$vu = array();
$mauvais = $ortho_result['mauvais'];
@@ -656,12 +658,17 @@
foreach ($regs as $r) {
if ($vu[$cherche = $r[0]]) continue;
$vu[$cherche] = 1;
+ if ($spip_display!=4) {
$html = "<a class='ortho' onclick=\"suggest($id);return false;\" href=''>$mot_html</a>";
+ } else {
+ $html = "<a href=\"ortho_choix.php?id_article=$id_article&mot_corr=$mot_html\">$mot_html</a>";
+ }
$remplace = str_replace($mot, $html, $cherche);
souligner_match_ortho($texte, $cherche, $remplace);
}
}
}
+ if ($spip_display!=4) {
foreach ($bons as $mot) {
$pattern = ",$delim".$mot."$delim,us";
// Recuperer les occurences du mot dans le texte
@@ -677,6 +684,7 @@
}
}
}
+ } //oo
$texte = preg_replace(',(^ | $),', '', $texte);
return $texte;
Added: _contribs_/_ecrire_/accessibilite/ortho_choix.php
--- _contribs_/_ecrire_/accessibilite/ortho_choix.php (added)
+++ _contribs_/_ecrire_/accessibilite/ortho_choix.php Sat Jun 10 21:48:07 2006
@@ -0,0 +1,110 @@
+<?php
+
+/***************************************************************************\
+ * SPIP, Systeme de publication pour l'internet *
+ * *
+ * Copyright (c) 2001-2005 *
+ * 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. *
+\***************************************************************************/
+
+
+include("inc_lab.php");
+
+include_spip("ecrire.php");
+include_spip("ortho.php");
+include_spip("layer.php"); // Pour $browser_name
+
+global $spip_display;
+global $id_article;
+
+// actuellemnt on est en franco-francais
+if (!$lang_article) $lang_article = lire_meta('langue_site');
+
+//print $id_article;
+//print $mot_corr;
+//print $lang_article;
+
+//
+// Fonctions d'affichage HTML
+//
+
+function panneau_ortho_oo($ortho_result) {
+ global $id_suggest;
+ global $id_article;
+
+ $id_suggest = array();
+ $i = 1;
+
+ $mauvais = $ortho_result['mauvais'];
+ $bons = $ortho_result['bons'];
+ if (!count($mauvais) && !count($bons)) return;
+ ksort($mauvais);
+
+
+ // Mots mal orthographies :
+ // liste des suggestions plus lien pour ajouter au dico
+ foreach ($mauvais as $mot => $suggest) {
+ $id = $id_suggest[$mot];
+ $mot_html = afficher_ortho($mot);
+ echo "<div class='suggest-inactif' id='suggest$id'>";
+ echo "<span class='ortho'>Mot incorrect : $mot_html</span>\n";
+ echo "<div class='detail'>\n";
+ if (is_array($suggest) && count($suggest)) {
+ echo "<ul>\n";
+ $i = 0;
+ foreach ($suggest as $sug) {
+ if (++$i > 12) {
+ echo "<li><i>(...)</i></li>\n";
+ break;
+ }
+ echo "<li><a href=ortho_modif.php?id_article=$id_article&mot_corr=$mot_html&mot_modif=".typo(afficher_ortho($sug)).">".typo(afficher_ortho($sug))."</li>\n";
+ }
+ echo "</ul>\n";
+ }
+ else {
+ echo "<i>"._T('ortho_aucune_suggestion')."</i>";
+ }
+ echo "<br />";
+// $link = new Link;
+// $link->delVar('supp_ortho');
+// $link->addVar('ajout_ortho', $mot);
+// icone_horizontale(_T('ortho_ajouter_ce_mot'), $link->getUrl(), "ortho-24.gif", "creer.gif");
+ echo "<a href=\"articles_ortho?id_article=$id_article&ajout_ortho=$mot\">Ajouter $mot au dictionnaire</a>";
+ echo "</div>\n";
+ echo "</div>\n\n";
+ }
+ print "<p><form action=\"ortho_modif.php?id_article=$id_article&mot_corr=$mot_html\" method=\"get\">Remplacer par :
+ <input name=\"mot_modif\" type=\"text\">
+ <input type=\"hidden\" name=\"id_article\" value=\"$id_article\">
+ <input type=\"hidden\" name=\"mot_corr\" value=\"$mot_html\">
+ <input value=\"envoyer\" type=\"submit\"></form></p>";
+ print "<p><a href=\"articles_edit.php3?id_article=$id_article\">Modifier l'article </a></p>";
+}
+
+
+
+$ortho = preparer_ortho($mot_corr, $lang_article);
+$result_ortho = corriger_ortho($ortho, $lang_article);
+
+if (is_array($result_ortho)) {
+ $mots = $result_ortho['mauvais'];
+ if ($erreur = $result_ortho['erreur']) {
+ echo "<b>"._T('ortho_trop_de_fautes').aide('corrortho')."</b><p>\n";
+ echo "<b>"._T('ortho_trop_de_fautes2')."</b><p>";
+ }
+ else {
+ echo "<b>On peut soit sélectionner un mot proposé, soit en proposer un nouveau, soit ajouter l'original au dico, ou encore aller rééditer l'article </b><p>\n";
+ }
+
+ panneau_ortho_oo($result_ortho);
+}
+else {
+ $erreur = $result_ortho;
+ echo "<b>"._T('ortho_dico_absent').aide('corrortho')." (";
+ echo traduire_nom_langue($lang_article);
+ echo "). ";
+ echo _T('ortho_verif_impossible')."</b>";
+}
Added: _contribs_/_ecrire_/accessibilite/ortho_modif.php
--- _contribs_/_ecrire_/accessibilite/ortho_modif.php (added)
+++ _contribs_/_ecrire_/accessibilite/ortho_modif.php Sat Jun 10 21:48:07 2006
@@ -0,0 +1,48 @@
+<?php
+
+/***************************************************************************\
+ * SPIP, Systeme de publication pour l'internet *
+ * *
+ * Copyright (c) 2001-2005 *
+ * 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. *
+\***************************************************************************/
+
+
+include("inc_lab.php");
+
+include_spip("ecrire.php");
+include_spip("ortho.php");
+include_spip("layer.php"); // Pour $browser_name
+
+global $spip_display;
+
+// actuellemnt on est en franco-francais
+if (!$lang_article) $lang_article = lire_meta('langue_site');
+
+//print $id_article;
+//print $mot_corr;
+//print $mot_modif;
+
+$query = "SELECT * FROM spip_articles WHERE id_article='$id_article'";
+$result = spip_query($query);
+
+if ($row = spip_fetch_array($result)) {
+ $texte = $row["texte"];
+}
+
+//print "<p>$texte</p>";
+
+$texte=str_replace($mot_corr,$mot_modif,$texte);
+
+//print "<p>$texte</p>";
+
+$query = "UPDATE spip_articles SET texte = '".addslashes($texte)."' WHERE id_article='$id_article'";
+//print "<p>$query</p>";
+$result = spip_query($query);
+//print $result;
+
+print "<a href=\"articles_ortho.php?id_article=$id_article\">retour au texte</a>";
+