~ubuntu-branches/debian/squeeze/spip/squeeze

« back to all changes in this revision

Viewing changes to ecrire/exec/mots_tous.php

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2009-03-06 20:06:46 UTC
  • Revision ID: james.westby@ubuntu.com-20090306200646-263me7r27w305lk3
Tags: upstream-2.0.5
ImportĀ upstreamĀ versionĀ 2.0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/***************************************************************************\
 
4
 *  SPIP, Systeme de publication pour l'internet                           *
 
5
 *                                                                         *
 
6
 *  Copyright (c) 2001-2009                                                *
 
7
 *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
 
8
 *                                                                         *
 
9
 *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
 
10
 *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
 
11
\***************************************************************************/
 
12
 
 
13
if (!defined("_ECRIRE_INC_VERSION")) return;
 
14
 
 
15
include_spip('inc/presentation');
 
16
include_spip('inc/actions');
 
17
 
 
18
// http://doc.spip.org/@exec_mots_tous_dist
 
19
function exec_mots_tous_dist()
 
20
{
 
21
        global $spip_lang, $spip_lang_left, $spip_lang_right;
 
22
 
 
23
        $conf_mot = intval(_request('conf_mot'));
 
24
        $son_groupe = intval(_request('son_groupe'));
 
25
 
 
26
        pipeline('exec_init',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
 
27
        $commencer_page = charger_fonction('commencer_page', 'inc');
 
28
        echo $commencer_page(_T('titre_page_mots_tous'), "naviguer", "mots");
 
29
        echo debut_gauche('', true);
 
30
 
 
31
 
 
32
        echo pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
 
33
 
 
34
        if (autoriser('creer','groupemots')  AND !$conf_mot){
 
35
                $out = "";
 
36
                $result = sql_select("*, ".sql_multi ("titre", "$spip_lang"), "spip_groupes_mots", "", "", "multi");
 
37
                while ($row_groupes = sql_fetch($result)) {
 
38
                        $id_groupe = $row_groupes['id_groupe'];
 
39
                        $titre_groupe = typo($row_groupes['titre']);            
 
40
                        $out .= "<li><a href='#mots_tous-$id_groupe' onclick='$(\"div.mots_tous\").hide().filter(\"#mots_tous-$id_groupe\").show();return false;'>$titre_groupe</a></li>";
 
41
                }
 
42
                if (strlen($out))
 
43
                        $out = "
 
44
                        <ul class='raccourcis_rapides'>".$out."</ul>
 
45
                        <a href='#' onclick='$(\"div.mots_tous\").show();return false;'>"._T('icone_voir_tous_mots_cles')."</a>";
 
46
 
 
47
                $res = icone_horizontale(_T('icone_creation_groupe_mots'), generer_url_ecrire("mots_type","new=oui"), "groupe-mot-24.gif", "creer.gif",false);
 
48
                echo bloc_des_raccourcis($res . $out);
 
49
        }
 
50
 
 
51
 
 
52
        echo creer_colonne_droite('', true);
 
53
        echo pipeline('affiche_droite',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
 
54
        echo debut_droite('', true);
 
55
 
 
56
        echo gros_titre(_T('titre_mots_tous'),'', false);
 
57
        if (autoriser('creer','groupemots')) {
 
58
          echo typo(_T('info_creation_mots_cles')) . aide ("mots") ;
 
59
        }
 
60
        echo "<br /><br />";
 
61
 
 
62
//
 
63
// On boucle d'abord sur les groupes de mots
 
64
//
 
65
 
 
66
        $result = sql_select("*, ".sql_multi ("titre", "$spip_lang"), "spip_groupes_mots", "", "", "multi");
 
67
 
 
68
        while ($row_groupes = sql_fetch($result)) {
 
69
                $id_groupe = $row_groupes['id_groupe'];
 
70
                $titre_groupe = typo($row_groupes['titre']);
 
71
                $descriptif = $row_groupes['descriptif'];
 
72
                $texte = $row_groupes['texte'];
 
73
                $unseul = $row_groupes['unseul'];
 
74
                $obligatoire = $row_groupes['obligatoire'];
 
75
                $tables_liees = $row_groupes['tables_liees'];
 
76
                $acces_minirezo = $row_groupes['minirezo'];
 
77
                $acces_comite = $row_groupes['comite'];
 
78
                $acces_forum = $row_groupes['forum'];
 
79
 
 
80
                // Afficher le titre du groupe
 
81
                echo "<div id='mots_tous-$id_groupe' class='mots_tous'>";
 
82
 
 
83
                echo debut_cadre_enfonce("groupe-mot-24.gif", true, '', $titre_groupe);
 
84
                // Affichage des options du groupe (types d'elements, permissions...)
 
85
                $res = '';
 
86
                $tables_liees = explode(',',$tables_liees);
 
87
                
 
88
                $libelles = array('articles'=>'info_articles_2','breves'=>'info_breves_02','rubriques'=>'info_rubriques','syndic'=>'icone_sites_references');
 
89
                $libelles = pipeline('libelle_association_mots',$libelles);
 
90
                foreach($tables_liees as $table)
 
91
                        if (strlen($table))
 
92
                                $res .= "> " . _T(isset($libelles[$table])?$libelles[$table]:"$table:info_$table") . " &nbsp;&nbsp;";
 
93
 
 
94
                if ($unseul == "oui" OR $obligatoire == "oui") $res .= "<br />";
 
95
                if ($unseul == "oui") $res .= "> "._T('info_un_mot')." &nbsp;&nbsp;";
 
96
                if ($obligatoire == "oui") $res .= "> "._T('info_groupe_important')." &nbsp;&nbsp;";
 
97
 
 
98
                $res .= "<br />";
 
99
                if ($acces_minirezo == "oui") $res .= "> "._T('info_administrateurs')." &nbsp;&nbsp;";
 
100
                if ($acces_comite == "oui") $res .= "> "._T('info_redacteurs')." &nbsp;&nbsp;";
 
101
                if ($acces_forum == "oui") $res .= "> "._T('info_visiteurs_02')." &nbsp;&nbsp;";
 
102
 
 
103
                echo "<span class='verdana1 spip_x-small'>", $res, "</span>";
 
104
                if (strlen($descriptif)) {
 
105
                        echo "<div style='border: 1px dashed #aaa; background-color: #fff;' class='verdana1 spip_x-small '>", propre("{{"._T('info_descriptif')."}} ".$descriptif), "&nbsp; </div>";
 
106
                }
 
107
 
 
108
                if (strlen($texte)>0){
 
109
                        echo "<div class='verdana1 spip_small'>", propre($texte), "</div>";
 
110
                }
 
111
 
 
112
                //
 
113
                // Afficher les mots-cles du groupe
 
114
                //
 
115
 
 
116
                $groupe = sql_countsel("spip_mots", "id_groupe=$id_groupe");
 
117
 
 
118
                echo "<div\nid='editer_mots-$id_groupe' style='position: relative;'>";
 
119
 
 
120
                // Preliminaire: confirmation de suppression d'un mot lie a qqch
 
121
                // (cf fin de afficher_groupe_mots_boucle executee a l'appel precedent)
 
122
                if ($conf_mot  AND $son_groupe==$id_groupe) {
 
123
                        include_spip('inc/grouper_mots');
 
124
                        echo confirmer_mot($conf_mot, $id_groupe, $groupe);
 
125
                }
 
126
                if ($groupe) {
 
127
                        $grouper_mots = charger_fonction('grouper_mots', 'inc');
 
128
                        echo $grouper_mots($id_groupe, $groupe);
 
129
                }
 
130
 
 
131
                echo "</div>";
 
132
 
 
133
                if (autoriser('modifier','groupemots',$id_groupe)){
 
134
                        echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
 
135
                        echo "<tr>";
 
136
                        echo "<td>";
 
137
                        echo icone_inline(_T('icone_modif_groupe_mots'), generer_url_ecrire("mots_type","id_groupe=$id_groupe"), "groupe-mot-24.gif", "edit.gif", $spip_lang_left);
 
138
                        echo "</td>";
 
139
                        echo "\n<td id='editer_mots-$id_groupe-supprimer'",
 
140
                          (!$groupe ? '' : " style='visibility: hidden'"),
 
141
                          ">";
 
142
                        echo icone_inline(_T('icone_supprimer_groupe_mots'), redirige_action_auteur('instituer_groupe_mots', "-$id_groupe", "mots_tous"), "groupe-mot-24.gif", "supprimer.gif", $spip_lang_left);
 
143
                        echo "</td>";
 
144
                        echo "<td>";
 
145
                        echo icone_inline(_T('icone_creation_mots_cles'), generer_url_ecrire("mots_edit","new=oui&id_groupe=$id_groupe&redirect=" . generer_url_retour('mots_tous', "#mots_tous-$id_groupe")), "mot-cle-24.gif", "creer.gif", $spip_lang_right);
 
146
                        echo "</td></tr></table>";
 
147
                }       
 
148
 
 
149
                echo fin_cadre_enfonce(true);
 
150
                echo "</div>";
 
151
        }
 
152
 
 
153
        echo pipeline('affiche_milieu',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
 
154
 
 
155
 
 
156
        echo fin_gauche(), fin_page();
 
157
}
 
158
 
 
159
// http://doc.spip.org/@confirmer_mot
 
160
function confirmer_mot ($conf_mot, $son_groupe, $total)
 
161
{
 
162
        $row = sql_fetsel("*", "spip_mots", "id_mot=$conf_mot");
 
163
        if (!$row) return ""; // deja detruit (acces concurrent etc)
 
164
 
 
165
        $id_mot = $row['id_mot'];
 
166
        $titre_mot = typo($row['titre']);
 
167
        $type_mot = typo($row['type']);
 
168
 
 
169
        if (($na = intval(_request('na'))) == 1) {
 
170
                $texte_lie = _T('info_un_article')." ";
 
171
        } else if ($na > 1) {
 
172
                $texte_lie = _T('info_nombre_articles', array('nb_articles' => $na)) ." ";
 
173
        }
 
174
        if (($nb = intval(_request('nb'))) == 1) {
 
175
                $texte_lie .= _T('info_une_breve')." ";
 
176
        } else if ($nb > 1) {
 
177
                $texte_lie .= _T('info_nombre_breves', array('nb_breves' => $nb))." ";
 
178
        }
 
179
        if (($ns = intval(_request('ns'))) == 1) {
 
180
                $texte_lie .= _T('info_un_site')." ";
 
181
        } else if ($ns > 1) {
 
182
                $texte_lie .= _T('info_nombre_sites', array('nb_sites' => $ns))." ";
 
183
        }
 
184
        if (($nr = intval(_request('nr'))) == 1) {
 
185
                $texte_lie .= _T('info_une_rubrique')." ";
 
186
        } else if ($nr > 1) {
 
187
                $texte_lie .= _T('info_nombre_rubriques', array('nb_rubriques' => $nr))." ";
 
188
        }
 
189
 
 
190
        return debut_boite_info(true)
 
191
        . "<div class='serif'>"
 
192
        . _T('info_delet_mots_cles', array('titre_mot' => $titre_mot, 'type_mot' => $type_mot, 'texte_lie' => $texte_lie))
 
193
        . "<p style='text-align: right'>"
 
194
        . generer_supprimer_mot($id_mot, $son_groupe, ("<b>" . _T('item_oui') . "</b>"), $total)
 
195
        . "<br />\n"
 
196
        .  _T('info_oui_suppression_mot_cle')
 
197
        . '</p>'
 
198
          /* troublant. A refaire avec une visibility
 
199
         . "<li><b><a href='" 
 
200
        . generer_url_ecrire("mots_tous")
 
201
        . "#editer_mots-$son_groupe"
 
202
        . "'>"
 
203
        . _T('item_non')
 
204
        . "</a>,</b> "
 
205
        . _T('info_non_suppression_mot_cle')
 
206
        . "</ul>" */
 
207
        . "</div>"
 
208
        . fin_boite_info(true);
 
209
}
 
210
?>