Mise en route du suivi.
[aidenligne_francais_universite.git] / ecrire / exec / brouteur_frame.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2007 *
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
17 // http://doc.spip.org/@exec_brouteur_frame_dist
18 function exec_brouteur_frame_dist() {
19 global $connect_statut,$connect_id_auteur, $spip_ecran, $spip_lang_left;
20
21 $id_rubrique = is_numeric(_request('rubrique')) ? intval(_request('rubrique')) : "";
22 $frame = _request('frame');
23 $effacer_suivant = _request('effacer_suivant');
24 $special = _request('special');
25
26 include_spip('inc/headers');
27 http_no_cache();
28
29 echo _DOCTYPE_ECRIRE
30 . html_lang_attributes()
31 . "<head>\n"
32 . "<title>brouteur_frame</title>\n"
33 . "<meta http-equiv='Content-Type' content='text/html"
34 . (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '')
35 . "' />\n"
36 . envoi_link(_T('info_mon_site_spip'))
37 . pipeline('header_prive', $head)
38 . '<script type="text/javascript"><!--
39
40 jQuery(function(){
41 jQuery("a.iframe").click(function(){
42 window.open(this.href,"iframe"+this.rel);
43 return false;
44 });
45 });
46
47 //--></script>
48 '
49 . "</head>\n<body>";
50
51 if ($spip_ecran == "large") {
52 $nb_col = 4;
53 } else {
54 $nb_col = 3;
55 }
56
57 if ($effacer_suivant == "oui" && $frame < $nb_col) {
58 echo '<script type="text/javascript">';
59 for ($i = $frame+1; $i < $nb_col; $i++) {
60 echo "\nparent.iframe$i.location.href='", generer_url_ecrire('brouteur_frame',"frame=$i"), "'";
61 }
62 echo '</script>';
63 }
64 echo "\n<div class='arial2'>";
65
66
67 if ($special == "redac") {
68 $result=spip_query("SELECT articles.id_article, articles.id_rubrique, articles.titre, articles.statut FROM spip_articles AS articles, spip_auteurs_articles AS lien WHERE articles.statut = 'prepa' AND articles.id_article = lien.id_article AND lien.id_auteur = $connect_id_auteur GROUP BY id_article ORDER BY articles.date DESC");
69 if (spip_num_rows($result)>0) {
70 echo "\n<div style='padding-top: 6px; padding-bottom: 3px;'><b class='verdana2'>"._T("info_cours_edition")."</b></div>";
71 echo "\n<div class='plan-articles'>";
72 while($row=spip_fetch_array($result)){
73 $id_article=$row['id_article'];
74 if (autoriser('voir','article',$id_article)){
75 $titre = typo($row['titre']);
76 $statut = $row['statut'];
77 echo "<a class='$statut'\nhref='javascript:window.parent.location=\"" . generer_url_ecrire('articles',"id_article=$id_article"),"\"'>",$titre,"</a>";
78 }
79 }
80 echo "</div>";
81 }
82
83 }
84 else if ($special == "valider") {
85 $result=spip_query("SELECT id_article, id_rubrique, titre, statut FROM spip_articles WHERE statut = 'prop' ORDER BY date DESC");
86 if (spip_num_rows($result)>0) {
87 echo "\n<div style='padding-top: 6px; padding-bottom: 3px;'><b class='verdana2'>"._T("info_articles_proposes")."</b></div>";
88 echo "\n<div class='plan-articles'>";
89 while($row=spip_fetch_array($result)){
90 $id_article=$row['id_article'];
91 if (autoriser('voir','article',$id_article)){
92 $titre = typo($row['titre']);
93 $statut = $row['statut'];
94 echo "<a class='$statut' href='javascript:window.parent.location=\"", generer_url_ecrire('articles',"id_article=$id_article"),"\"'>",$titre,"</a>";
95 }
96 }
97 echo "</div>";
98 }
99
100 $result=spip_query("SELECT * FROM spip_breves WHERE statut = 'prop' ORDER BY date_heure DESC LIMIT 20");
101 if (spip_num_rows($result)>0) {
102 echo "\n<div style='padding-top: 6px;'><b class='verdana2'>"._T("info_breves_valider")."</b></div>";
103 echo "\n<div class='plan-articles'>";
104 while($row=spip_fetch_array($result)){
105 $id_breve=$row['id_breve'];
106 if (autoriser('voir','breve',$id_breve)){
107 $titre = typo($row['titre']);
108 $statut = $row['statut'];
109 echo "<a class='$statut' href='javascript:window.parent.location=\"", generer_url_ecrire('breves_voir',"id_breve=$id_breve"),"\"'>",$titre,"</a>";
110 }
111 }
112 echo "</div>";
113 }
114
115 }
116 else {
117 if ($id_rubrique !== "" AND autoriser('voir','rubrique',$id_rubrique)) {
118
119 $result=spip_query("SELECT id_parent, id_rubrique, titre FROM spip_rubriques WHERE id_rubrique='$id_rubrique' ORDER BY 0+titre, titre");
120 if ($row=spip_fetch_array($result)){
121 $titre = typo($row['titre']);
122 $id_parent=$row['id_parent'];
123
124 if ($id_parent == 0) $icone = "secteur-24.gif";
125 else $icone = "rubrique-24.gif";
126
127 echo "\n<div style='background-color: #cccccc; border: 1px solid #444444;'>";
128 icone_horizontale($titre, "javascript:window.parent.location=\"" . generer_url_ecrire('naviguer',"id_rubrique=$id_rubrique") .'"', $icone);
129 echo "</div>";
130 } else if ($frame == 0) {
131 echo "\n<div style='background-color: #cccccc; border: 1px solid #444444;'>";
132 icone_horizontale(_T('info_racine_site'), "javascript:window.parent.location=\"" . generer_url_ecrire('naviguer') . '"', "racine-site-24.gif","");
133 echo "</div>";
134 }
135
136
137 $result=spip_query("SELECT id_rubrique, id_parent, titre FROM spip_rubriques WHERE id_parent='$id_rubrique' ORDER BY 0+titre, titre");
138 while($row=spip_fetch_array($result)){
139 $ze_rubrique=$row['id_rubrique'];
140 if (autoriser('voir','rubrique',$ze_rubrique)){
141 $titre = typo($row['titre']);
142 $id_parent=$row['id_parent'];
143
144 echo "\n<div class='brouteur_rubrique'
145 onmouseover=\"changeclass(this, 'brouteur_rubrique_on');\"
146 onmouseout=\"changeclass(this, 'brouteur_rubrique');\">";
147
148 if ($id_parent == '0') {
149 echo "\n<div style='", frame_background_image("secteur-24.gif"), ";'><a href='", generer_url_ecrire('brouteur_frame', "rubrique=$ze_rubrique&frame=".($frame+1)."&effacer_suivant=oui"), "' class='iframe' rel='", ($frame+1), "'>",
150 $titre,
151 "</a></div>";
152 }
153 else {
154 if ($frame+1 < $nb_col)
155 echo "\n<div style='",
156 frame_background_image("rubrique-24.gif"), ";'><a href='", generer_url_ecrire('brouteur_frame', "rubrique=$ze_rubrique&frame=".($frame+1)."&effacer_suivant=oui"), "' class='iframe' rel='",
157 ($frame+1),
158 "'>$titre</a></div>";
159 else echo "\n<div style='",
160 frame_background_image("rubrique-24.gif"), ";'><a href='javascript:window.parent.location=\"" . generer_url_ecrire('brouteur',"id_rubrique=$ze_rubrique")."\"'>",$titre,"</a></div>";
161 }
162 echo "</div>\n";
163 }
164 }
165
166
167 if ($id_rubrique > 0) {
168 if ($connect_statut == "0minirezo")
169 $result = spip_query("SELECT id_article, id_rubrique, titre, statut FROM spip_articles WHERE id_rubrique=$id_rubrique ORDER BY date DESC");
170 else
171 $result = spip_query("SELECT articles.id_article, articles.id_rubrique, articles.titre, articles.statut FROM spip_articles AS articles LEFT JOIN spip_auteurs_articles AS lien ON articles.id_article = lien.id_article WHERE articles.id_rubrique="._q($id_rubrique)." AND (articles.statut = 'publie' OR articles.statut = 'prop' OR (articles.statut = 'prepa' AND lien.id_auteur = "._q($connect_id_auteur).")) GROUP BY id_article ORDER BY articles.date DESC");
172
173 if (spip_num_rows($result)>0) {
174 echo "\n<div style='padding-top: 6px; padding-bottom: 3px;'><b class='verdana2'>"._T('info_articles')."</b></div>";
175 echo "\n<div class='plan-articles'>";
176 while($row=spip_fetch_array($result)){
177 $id_article=$row['id_article'];
178 if (autoriser('voir','article',$id_article)){
179 $titre = typo($row['titre']);
180 $statut = $row['statut'];
181 echo "<a class='$statut' href='javascript:window.parent.location=\"" . generer_url_ecrire('articles',"id_article=$id_article")."\"'>",$titre,"</a>";
182 }
183 }
184 echo "</div>";
185 }
186
187 $result=spip_query("SELECT * FROM spip_breves WHERE id_rubrique=$id_rubrique ORDER BY date_heure DESC LIMIT 20");
188 if (spip_num_rows($result)>0) {
189 echo "\n<div style='padding-top: 6px;'><b class='verdana2'>"._T('info_breves_02')."</b></div>";
190 echo "\n<div class='plan-articles'>";
191 while($row=spip_fetch_array($result)){
192 $id_breve=$row['id_breve'];
193 if (autoriser('voir','breve',$id_breve)){
194 $titre = typo($row['titre']);
195 $statut = $row['statut'];
196 echo "<a class='$statut' href='javascript:window.parent.location=\"", generer_url_ecrire('breves_voir',"id_breve=$id_breve")."\"'>",$titre,"</a>";
197 }
198 }
199 echo "</div>";
200
201
202 }
203
204 $result=spip_query("SELECT * FROM spip_syndic WHERE id_rubrique='$id_rubrique' AND statut!='refuse' ORDER BY nom_site");
205 if (spip_num_rows($result)>0) {
206 echo "\n<div style='padding-top: 6px;'><b class='verdana2'>"._T('icone_sites_references')."</b></div>";
207 while($row=spip_fetch_array($result)){
208 $id_syndic=$row['id_syndic'];
209 if (autoriser('voir','site',$id_syndic)){
210 $titre = typo($row['nom_site']);
211 $statut = $row['statut'];
212 echo "\n<div " . http_style_background('site-24.gif', "$spip_lang_left center no-repeat; margin:3px; padding-top: 5px; padding-bottom: 5px; padding-$spip_lang_left: 28px") . "><b><a href='javascript:window.parent.location=\"", generer_url_ecrire('sites',"id_syndic=$id_syndic"),"\"'>",$titre,"</a></b></div>";
213 }
214 }
215 }
216 }
217
218 // en derniere colonne, afficher articles et breves
219 if ($frame == 0 AND $id_rubrique==0) {
220
221 $cpt=spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_articles AS articles, spip_auteurs_articles AS lien WHERE articles.statut = 'prepa' AND articles.id_article = lien.id_article AND lien.id_auteur = $connect_id_auteur GROUP BY articles.id_article"));
222 if ($cpt['n']) {
223
224 echo "\n<div ", http_style_background('article-24.gif', "$spip_lang_left center no-repeat; margin:3px; padding-top: 5px; padding-bottom: 5px; padding-$spip_lang_left: 28px"),
225 "><b class='verdana2'><a href='", generer_url_ecrire('brouteur_frame', "special=redac&frame=".($frame+1)."&effacer_suivant=oui"), "' class='iframe' rel='",($frame+1),"'>",
226 _T("info_cours_edition"),"</a></b></div>";
227 }
228
229 $cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_articles AS articles WHERE articles.statut = 'prop'"));
230 if (!$cpt['n'])
231 $cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_breves WHERE statut = 'prop'"));
232 if ($cpt['n'])
233 echo "\n<div ", http_style_background('article-24.gif', "$spip_lang_left center no-repeat; margin:3px; padding-top: 5px; padding-bottom: 5px; padding-$spip_lang_left: 28px"),
234 "><b class='verdana2'><a href='", generer_url_ecrire('brouteur_frame', "special=valider&frame=".($frame+1)."&effacer_suivant=oui"), "' class='iframe' rel='",
235 ($frame+1)."'>",
236 _T("info_articles_proposes"),
237 " / "._T("info_breves_valider")."</a></b></div>";
238 }
239 }
240 }
241 echo "</div>";
242
243 echo "</body></html>";
244 }
245
246 // http://doc.spip.org/@frame_background_image
247 function frame_background_image($f)
248 {
249 return "background-image: url(" .
250 _DIR_IMG_PACK . $f .
251 ")";
252 }
253 ?>