a27bdbd12e3ff9b7a522539633c242d5c5351b18
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2011 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
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 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
14 include_spip('inc/presentation');
15 include_spip('inc/date');
16 include_spip('inc/config');
18 // http://doc.spip.org/@exec_sites_dist
19 function exec_sites_dist()
21 exec_sites_args(intval(_request('id_syndic')));
24 // http://doc.spip.org/@exec_sites_args
25 function exec_sites_args($id_syndic)
27 if (!autoriser('voir','site',$id_syndic)
28 OR (!$row = sql_fetsel("*", "spip_syndic", "id_syndic=$id_syndic"))) {
29 include_spip('inc/minipres');
30 echo minipres(_T('public:aucun_site'));
33 $id_rubrique = $row["id_rubrique"];
34 $nom_site = $row["nom_site"];
35 $titre_page = "« $nom_site »";
36 pipeline('exec_init',array('args'=>array('exec'=>'sites','id_syndic'=>$id_syndic),'data'=>''));
38 $commencer_page = charger_fonction('commencer_page', 'inc');
39 echo $commencer_page("$titre_page","naviguer","sites", $id_rubrique);
40 afficher_site($id_syndic, $id_rubrique, $nom_site, $row);
47 // http://doc.spip.org/@afficher_site
48 function afficher_site($id_syndic, $id_rubrique, $nom_site, $row){
50 global $spip_lang_left,
53 $cherche_mot = _request('cherche_mot');
54 $select_groupe = _request('select_groupe');
55 $id_secteur = $row["id_secteur"];
56 $url_site = $row["url_site"];
57 $url_syndic = $row["url_syndic"];
58 $descriptif = $row["descriptif"];
59 $syndication = $row["syndication"];
60 $statut = $row["statut"];
61 $date_heure = $row["date"];
62 $date_syndic = $row['date_syndic'];
63 $mod = $row['moderation'];
66 $flag_administrable = autoriser('modifier','site',$id_syndic);
67 $flag_editable = ($flag_administrable OR ($GLOBALS['meta']["proposer_sites"] > 0 AND ($statut == 'prop')));
69 $meme_rubrique = charger_fonction('meme_rubrique', 'inc');
70 $iconifier = charger_fonction('iconifier', 'inc');
71 if ($flag_editable AND ($statut == 'publie'))
72 $dater = charger_fonction('dater', 'inc');
73 $editer_mots = charger_fonction('editer_mots', 'inc');
74 if ($flag_administrable)
75 $instituer_site = charger_fonction('instituer_site','inc');
77 echo debut_grand_cadre(true);
78 echo afficher_hierarchie($id_rubrique);
79 echo fin_grand_cadre(true);
81 echo debut_gauche('', true);
82 echo debut_boite_info(true);
83 echo pipeline ('boite_infos', array('data' => '',
90 echo fin_boite_info(true);
91 echo $iconifier('id_syndic', $id_syndic, 'sites', false, $flag_administrable);
93 echo pipeline('affiche_gauche',array('args'=>array('exec'=>'sites','id_syndic'=>$id_syndic),'data'=>''));
95 echo creer_colonne_droite('', true);
96 echo $meme_rubrique($id_rubrique, $id_syndic, 'syndic');
97 echo pipeline('affiche_droite',array('args'=>array('exec'=>'sites','id_syndic'=>$id_syndic),'data'=>''));
99 echo bloc_des_raccourcis(
100 icone_horizontale(_T('icone_voir_sites_references'), generer_url_ecrire("sites_tous",""), "site-24.gif","rien.gif", false)
104 echo debut_droite('', true);
106 if ($syndication == 'off' OR $syndication == 'sus')
107 $droit = $id_rubrique;
110 $url_affichee = $url_site;
111 if (strlen($url_affichee) > 40) $url_affichee = substr($url_affichee, 0, 30)."...";
114 ($flag_editable ?
icone_inline(_T('icone_modifier_site'), generer_url_ecrire('sites_edit',"id_syndic=$id_syndic"), "site-24.gif", "edit.gif",$spip_lang_right) : "");
117 "<div class='bandeau_actions'>$actions</div>".
118 gros_titre($nom_site?
$nom_site:"("._T('info_sans_titre_2').")", '' , false)
119 . "<a href='$url_site' class='url_site'>$url_affichee</a>";
122 $contexte = array('id'=>$id_syndic,'id_rubrique'=>$id_rubrique);
123 $fond = recuperer_fond("prive/contenu/$type",$contexte);
124 // permettre aux plugin de faire des modifs ou des ajouts
125 $fond = pipeline('afficher_contenu_objet',
129 'id_objet'=>$id_syndic,
130 'contexte'=>$contexte),
133 $fond = "<div id='wysiwyg'>$fond</div>";
137 ($statut == 'prop' ?
"<p class='site_prop'>"._T('info_site_propose')." <b>".affdate($date_heure)." </b></p>" : "")
140 . (($syndication == "oui" OR $syndication == "off" OR $syndication == "sus") ?
141 "<p class='site_syndique'><a href='".htmlspecialchars($url_syndic)."'>"
142 . http_img_pack('feed.png', 'RSS'). '</a>'._T('info_site_syndique').'</p>'
144 . (($syndication == "off" OR $syndication=="sus") ?
145 "<div class='site_syndique_probleme'>" . _T('avis_site_syndique_probleme', array('url_syndic' => quote_amp($url_syndic)))
146 . redirige_action_auteur('editer_site', $id_syndic, 'sites', '',
147 "<input type='hidden' name='reload' value='oui' />
148 <input type='submit' value=\""
149 . attribut_html(_T('lien_nouvelle_recuperation'))
150 . "\" class='spip_xx-small' />")
154 . afficher_objets('syndic_article',_T('titre_articles_syndiques'), array('FROM' => 'spip_syndic_articles', 'WHERE' => "id_syndic=$id_syndic", 'ORDER BY' => "date DESC"), $id_syndic)
156 . ($date_syndic ?
"<div class='date_syndic'>" . _T('info_derniere_syndication').' '.affdate_heure($date_syndic) .".</div>" : "")
157 . "<div class='mise_a_jour_syndic'>"
158 . redirige_action_post('editer_site', $id_syndic, 'sites', "id_syndic=$id_syndic",
159 "<input type='hidden' name='reload' value='oui' />
160 <input type='submit' value=\""
161 . attribut_html(_T('lien_mise_a_jour_syndication'))
162 . "\" class='spip_xx-small' />")
165 : choix_feed($id_syndic, $id_rubrique, $nom_site, $row))
166 . (_INTERFACE_ONGLETS?
"":($flag_administrable ?
options_moderation($row) : ""))
171 (_INTERFACE_ONGLETS?
"":
173 . ($statut == 'prop' ?
"<p class='site_prop'>"._T('info_site_propose')." <b>".affdate($date_heure)." </b></p>" : "")
175 . afficher_site_rubrique($id_syndic, $id_rubrique, $id_secteur)
176 . ($dater ?
$dater($id_syndic, $flag_editable, $statut, 'syndic', 'sites', $date_heure) : "")
177 . $editer_mots('syndic', $id_syndic, $cherche_mot, $select_groupe, $flag_editable, true, 'sites')
178 . (_INTERFACE_ONGLETS?
($flag_administrable ?
options_moderation($row) : ""):"")
179 . pipeline('affiche_milieu',array('args'=>array('exec'=>'sites','id_syndic'=>$id_syndic),'data'=>''))
182 $discuter = charger_fonction('discuter', 'inc');
183 $onglet_discuter = $discuter($id_syndic, 'sites', 'id_syndic');
184 $onglet_documents = "" ;
185 $onglet_interactivite = "";
188 "<div class='fiche_objet'>"
190 . afficher_onglets_pages(array(
191 'voir' => _T('onglet_contenu'),
192 'props' => _T('onglet_proprietes'),
193 'docs' => _T('onglet_documents'),
194 'interactivite' => _T('onglet_interactivite'),
195 'discuter' => _T('onglet_discuter')),
198 'voir'=>$onglet_contenu,
199 'props'=>$onglet_proprietes,
200 'docs'=>$onglet_documents,
201 'interactivite'=>$onglet_interactivite,
202 'discuter'=>$onglet_discuter)
204 'props'=>$onglet_proprietes,
205 'voir'=>$onglet_contenu )
208 . (_INTERFACE_ONGLETS?
"":$onglet_discuter);
211 // http://doc.spip.org/@options_moderation
212 function options_moderation($row) {
214 global $spip_lang_left;
216 if ($row['syndication'] == 'non' or $row['syndication'] == '') return '';
218 $id_syndic = $row['id_syndic'];
219 $moderation = $row['moderation'];
220 if ($moderation != 'oui') $moderation='non';
223 $res .= "<div style='text-align: ".$GLOBALS['spip_lang_left']."'>".
224 _T('syndic_choix_moderation')
225 . "<div style='padding-$spip_lang_left: 40px;'>"
226 . afficher_choix('moderation', $moderation,
228 'non' => _T('info_publier') .' ('._T('bouton_radio_modere_posteriori').')',
229 'oui' => _T('info_bloquer') .' ('._T('bouton_radio_modere_priori').')' ))
232 // Oublier les vieux liens ?
233 // Depublier les liens qui ne figurent plus ?
235 $res .= "\n<div> </div>"
236 . "\n<div style='text-align:".$GLOBALS['spip_lang_left']."'>"._T('syndic_choix_oublier'). '</div>'
237 . "\n<ul style='text-align:".$GLOBALS['spip_lang_left']."'>\n";
239 $on = array('oui' => _T('item_oui'), 'non' => _T('item_non'));
240 if (!$miroir = $row['miroir'])
243 $res .= "\n<li>"._T('syndic_option_miroir').' '
244 . afficher_choix('miroir', $miroir, $on, " ")
247 if (!$oubli = $row['oubli'])
250 . _T('syndic_option_oubli', array('mois' => 2)).' '
251 . afficher_choix('oubli', $oubli, $on," ")
255 // Prendre les resumes ou le texte integral ?
256 if (!$resume = $row['resume'])
259 $res .= "\n<div style='text-align: $spip_lang_left'>"
260 . _T('syndic_choix_resume')
261 . "\n<div style='padding-$spip_lang_left: 40px;'>"
262 . afficher_choix('resume', $resume,
263 array( 'oui' => _T('syndic_option_resume_oui'),
264 'non' => _T('syndic_option_resume_non') ))
268 $res .= "\n<div style='text-align:".$GLOBALS['spip_lang_right'].";'><input type='submit' value='"._T('bouton_valider')."' /></div>\n";
271 debut_cadre_relief('feed.png', true, "", _T('syndic_options').aide('artsyn'))
272 . redirige_action_post('editer_site', "options/$id_syndic", 'sites', '', $res)
273 . fin_cadre_relief(true);
276 // Site pour lesquels feedfinder a un ou plusieurs flux,
277 // et l'on propose de choisir
279 // http://doc.spip.org/@choix_feed
280 function choix_feed($id_syndic, $id_rubrique, $nom_site, $row) {
282 global $spip_lang_left, $spip_lang_right;
284 if (!preg_match(',^\s*select: (.*),', $row['url_syndic'], $regs))
287 $url_site = $row["url_site"];
288 $descriptif = $row["descriptif"];
289 $statut = $row["statut"];
291 $date_heure = $row["date"];
292 $date_syndic = $row['date_syndic'];
293 $mod = $row['moderation'];
294 $extra=$row["extra"];
298 foreach (array('id_rubrique', 'nom_site', 'url_site', 'descriptif', 'statut') as $var) {
299 $res .= "<input type='hidden' name='$var' value=\"".entites_html($
$var)."\" />\n";
301 $res .= "<div style='text-align: $spip_lang_left'>\n";
302 $res .= "<div><input type='radio' name='syndication' value='non' id='syndication_non' checked='checked' />";
303 $res .= " <b><label for='syndication_non'>"._T('bouton_radio_non_syndication')."</label></b></div>\n";
304 $res .= "<div><input type='radio' name='syndication' value='oui' id='syndication_oui' />";
305 $res .= " <label for='syndication_oui'>"._T('bouton_radio_syndication')."</label></div>\n";
307 $res .= "<select name='url_syndic' id='url_syndic'>\n";
308 foreach (explode(' ',$regs[1]) as $feed) {
309 $res .= '<option value="'.entites_html($feed).'">'.$feed."</option>\n";
311 $res .= "</select>\n";
312 $res .= aide("rubsyn");
313 $res .= "<div style='text-align: $spip_lang_right'><input type='submit' value='"._T('bouton_valider')."' /></div>\n";
316 $res = redirige_action_post('editer_site', $id_syndic, 'sites','', $res);
318 return debut_cadre_relief('', true) . $res . fin_cadre_relief(true);
321 // http://doc.spip.org/@afficher_site_rubrique
322 function afficher_site_rubrique($id_syndic, $id_rubrique, $id_secteur)
324 global $spip_lang_right;
326 if (!_INTERFACE_ONGLETS
) return "";
328 $chercher_rubrique = charger_fonction('chercher_rubrique', 'inc');
330 $form = $chercher_rubrique($id_rubrique, 'site', false);
331 if (strpos($form,'<select')!==false) {
332 $form .= "<div style='text-align: $spip_lang_right;'>"
333 . '<input type="submit" value="'._T('bouton_choisir').'"/>'
337 $msg = _T('titre_cadre_interieur_rubrique');
339 $form = "<input type='hidden' name='editer_article' value='oui' />\n" . $form;
340 $form = redirige_action_post("editer_site", $id_syndic, 'sites', $form, " class='submit_plongeur'");
342 if ($id_rubrique == 0) $logo = "racine-site-24.gif";
343 elseif ($id_secteur == $id_rubrique) $logo = "secteur-24.gif";
344 else $logo = "rubrique-24.gif";
346 return debut_cadre_couleur($logo, true, "", $msg) . $form .fin_cadre_couleur(true);