Author: bill@adequates.com
Date: Wed Aug 16 15:36:53 2006
New Revision: 4558
Log:
tout baser sur la definition des choses possibles
Modified:
_plugins_/_amelioration_admin_/mots_partout/exec/mots_partout.php
_plugins_/_amelioration_admin_/mots_partout/exec/mots_tous.php
_plugins_/_amelioration_admin_/mots_partout/exec/mots_type.php
Modified: _plugins_/_amelioration_admin_/mots_partout/exec/mots_partout.php
--- _plugins_/_amelioration_admin_/mots_partout/exec/mots_partout.php (original)
+++ _plugins_/_amelioration_admin_/mots_partout/exec/mots_partout.php Wed Aug 16 15:36:53 2006
@@ -177,8 +177,9 @@
//------------------------la fonction qui fait tout-----------------------------------
function exec_mots_partout() {
-
+global $choses_possibles;
include(_DIR_PLUGIN_MOTS_PARTOUT."/mots_partout_choses.php");
+ include_spip("inc/choses");
include_spip ("inc/presentation");
include_spip ("inc/documents");
include_spip ("base/abstract_sql");
Modified: _plugins_/_amelioration_admin_/mots_partout/exec/mots_tous.php
--- _plugins_/_amelioration_admin_/mots_partout/exec/mots_tous.php (original)
+++ _plugins_/_amelioration_admin_/mots_partout/exec/mots_tous.php Wed Aug 16 15:36:53 2006
@@ -19,9 +19,9 @@
// DEBUT MODIF
// liste des types de tables sur lesquels on peut mettre des mots clés
// - ceux du core
- $choses= array('articles', 'breves', 'rubriques', 'syndic');
+// $choses= array('articles', 'breves', 'rubriques', 'syndic');
// - ceux du plugin
- include(_DIR_PLUGIN_MOTS_PARTOUT."/mots_partout_choses.php");
+// include(_DIR_PLUGIN_MOTS_PARTOUT."/mots_partout_choses.php");
$tables_installees = unserialize(lire_meta('MotsPartout:tables_installees'));
foreach($tables_installees as $chose => $m) { $choses[]= $chose; }
// FIN MODIF
@@ -38,7 +38,13 @@
if ($connect_statut=="0minirezo") $aff_articles="'prepa','prop','publie','refuse'";
else $aff_articles="'prop','publie'";
- $nb_articles = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots_articles AS lien, spip_articles AS article WHERE lien.id_mot=$conf_mot AND article.id_article=lien.id_article AND (article.statut IN ($aff_articles))>0 AND article.statut!='refuse'"));
+$nb_total=0;
+foreach ($choses as $chose){
+ $r = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots_".$chose." AS lien, spip_".$chose." AS chose WHERE lien.id_mot=$conf_mot AND chose.id_".$chose."=lien.id_".$chose." AND (chose.statut IN ($aff_articles))>0 AND chose.statut!='refuse'"));
+ $nb[$chose]=$r['n'];
+ $nb_total+=$r['n'];
+}
+/* $nb_articles = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots_articles AS lien, spip_articles AS article WHERE lien.id_mot=$conf_mot AND article.id_article=lien.id_article AND (article.statut IN ($aff_articles))>0 AND article.statut!='refuse'"));
$nb_articles = $nb_articles['n'];
$nb_rubriques = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots_rubriques AS lien, spip_rubriques AS rubrique WHERE lien.id_mot=$conf_mot AND rubrique.id_rubrique=lien.id_rubrique"));
@@ -55,6 +61,8 @@
// si le mot n'est pas lie, on demande sa suppression
if ($nb_articles + $nb_breves + $nb_sites + $nb_forum == 0) {
+*/
+ if ($nb_total == 0) {
redirige_par_entete(generer_url_ecrire("mots_edit","supp_mot=$id_mot&redirect_ok=oui&redirect=" . rawurlencode(generer_url_ecrire('mots_tous')), true));
} // else traite plus loin (confirmation de suppression)
}
@@ -97,13 +105,17 @@
}
+pipeline('exec_init',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
debut_page(_T('titre_page_mots_tous'), "documents", "mots");
debut_gauche();
+echo pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
+creer_colonne_droite();
+echo pipeline('affiche_droite',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
debut_droite();
gros_titre(_T('titre_mots_tous'));
-if ($connect_statut == '0minirezo' AND $connect_toutes_rubriques) {
+ if (acces_mots()) {
echo typo(_T('info_creation_mots_cles')) . aide ("mots") ;
}
echo "<br><br>";
@@ -209,7 +221,9 @@
//
$supprimer_groupe = afficher_groupe_mots($id_groupe);
- if ($connect_statut =="0minirezo" AND $connect_toutes_rubriques AND !$conf_mot){
+ echo $supprimer_groupe;
+
+ if (acces_mots() AND !$conf_mot){
echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
echo "<tr>";
echo "<td>";
@@ -232,7 +246,7 @@
}
-if ($connect_statut =="0minirezo" AND $connect_toutes_rubriques AND !$conf_mot){
+if (acces_mots() AND !$conf_mot){
echo "<p> </p><div align='right'>";
icone(_T('icone_creation_groupe_mots'), generer_url_ecrire("mots_type","new=oui"), "groupe-mot-24.gif", "creer.gif");
echo "</div>";
@@ -241,5 +255,5 @@
fin_page();
}
-error_log("aLORS QUOI ?");
+//error_log("aLORS QUOI ?");
?>
Modified: _plugins_/_amelioration_admin_/mots_partout/exec/mots_type.php
--- _plugins_/_amelioration_admin_/mots_partout/exec/mots_type.php (original)
+++ _plugins_/_amelioration_admin_/mots_partout/exec/mots_type.php Wed Aug 16 15:36:53 2006
@@ -28,11 +28,11 @@
$ancien_type = '';
$unseul = 'non';
$obligatoire = 'non';
- $articles = 'oui';
+/* $articles = 'oui';
$breves = 'oui';
$rubriques = 'non';
$syndic = 'oui';
- $acces_minirezo = 'oui';
+*/ $acces_minirezo = 'oui';
$acces_comite = 'oui';
$acces_forum = 'non';
} else {
@@ -48,11 +48,11 @@
$texte = $row['texte'];
$unseul = $row['unseul'];
$obligatoire = $row['obligatoire'];
- $articles = $row['articles'];
+/* $articles = $row['articles'];
$breves = $row['breves'];
$rubriques = $row['rubriques'];
$syndic = $row['syndic'];
- $acces_minirezo = $row['minirezo'];
+*/ $acces_minirezo = $row['minirezo'];
$acces_comite = $row['comite'];
$acces_forum = $row['forum'];
$onfocus ="";
@@ -60,11 +60,14 @@
}
}
+pipeline('exec_init',array('args'=>array('exec'=>'mots_types','id_groupe'=>$id_groupe),'data'=>''));
debut_page("« $titre »", "documents", "mots");
debut_gauche();
-
+echo pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_types','id_groupe'=>$id_groupe),'data'=>''));
+creer_colonne_droite();
+echo pipeline('affiche_droite',array('args'=>array('exec'=>'mots_types','id_groupe'=>$id_groupe),'data'=>''));
debut_droite();
@@ -131,7 +134,7 @@
echo "<div style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #dddddd;'>";
echo "<b>"._T('info_mots_cles_association')."</b>";
echo "<ul>";
-
+/*
if ($articles == "oui") $checked = "checked";
else $checked = "";
echo "<input type='checkbox' name='articles' value='oui' $checked id='articles'> <label for='articles'>"._T('item_mots_cles_association_articles')."</label><br>";
@@ -149,7 +152,7 @@
if ($syndic == "oui") $checked = "checked";
else $checked = "";
echo "<input type='checkbox' name='syndic' value='oui' $checked id='syndic'> <label for='syndic'>"._T('item_mots_cles_association_sites')."</label>";
-
+*/
// DEBUT MODIF
foreach($tables_installees as $chose => $m) {
if ($row[$chose] == "oui") $checked = "checked";