X-Git-Url: http://git.cyclocoop.org/?p=velocampus%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fecrire%2Fexec%2Fmots_tous.php;fp=www%2Fecrire%2Fexec%2Fmots_tous.php;h=06c583c00f051461916dd91305b2c2625d2d4eff;hp=0000000000000000000000000000000000000000;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c diff --git a/www/ecrire/exec/mots_tous.php b/www/ecrire/exec/mots_tous.php new file mode 100644 index 0000000..06c583c --- /dev/null +++ b/www/ecrire/exec/mots_tous.php @@ -0,0 +1,219 @@ +array('exec'=>'mots_tous'),'data'=>'')); + $commencer_page = charger_fonction('commencer_page', 'inc'); + echo $commencer_page(_T('titre_page_mots_tous'), "naviguer", "mots"); + echo debut_gauche('', true); + + + echo pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_tous'),'data'=>'')); + + if (autoriser('creer','groupemots') AND !$conf_mot){ + $out = ""; + $result = sql_select("*, ".sql_multi ("titre", "$spip_lang"), "spip_groupes_mots", "", "", "multi"); + while ($row_groupes = sql_fetch($result)) { + $id_groupe = $row_groupes['id_groupe']; + $titre_groupe = typo($row_groupes['titre']); + $out .= "
  • $titre_groupe
  • "; + } + if (strlen($out)) + $out = + ""._T('icone_voir_tous_mots_cles')."" + ."" + ; + + echo debut_boite_info(true) . $out . fin_boite_info(true); + $res = icone_horizontale(_T('icone_creation_groupe_mots'), generer_url_ecrire("mots_type","new=oui"), "groupe-mot-24.gif", "creer.gif",false); + echo bloc_des_raccourcis($res); + } + + + echo creer_colonne_droite('', true); + echo pipeline('affiche_droite',array('args'=>array('exec'=>'mots_tous'),'data'=>'')); + echo debut_droite('', true); + + echo gros_titre(_T('titre_mots_tous'),'', false); + if (autoriser('creer','groupemots')) { + echo typo(_T('info_creation_mots_cles')) . aide ("mots") ; + } + echo "

    "; + +// +// On boucle d'abord sur les groupes de mots +// + + $result = sql_select("*, ".sql_multi ("titre", "$spip_lang"), "spip_groupes_mots", "", "", "multi"); + + while ($row_groupes = sql_fetch($result)) { + if (autoriser('voir','groupemots',$row_groupes['id_groupe'])){ + $id_groupe = $row_groupes['id_groupe']; + $titre_groupe = typo($row_groupes['titre']); + $descriptif = $row_groupes['descriptif']; + $texte = $row_groupes['texte']; + $unseul = $row_groupes['unseul']; + $obligatoire = $row_groupes['obligatoire']; + $tables_liees = $row_groupes['tables_liees']; + $acces_minirezo = $row_groupes['minirezo']; + $acces_comite = $row_groupes['comite']; + $acces_forum = $row_groupes['forum']; + + // Afficher le titre du groupe + echo "
    "; + + echo debut_cadre_enfonce("groupe-mot-24.gif", true, '', $titre_groupe); + // Affichage des options du groupe (types d'elements, permissions...) + $res = ''; + $tables_liees = explode(',',$tables_liees); + + $libelles = array('articles'=>'info_articles_2','breves'=>'info_breves_02','rubriques'=>'info_rubriques','syndic'=>'icone_sites_references'); + $libelles = pipeline('libelle_association_mots',$libelles); + foreach($tables_liees as $table) + if (strlen($table)) + $res .= "> " . _T(isset($libelles[$table])?$libelles[$table]:"$table:info_$table") . "   "; + + if ($unseul == "oui" OR $obligatoire == "oui") $res .= "
    "; + if ($unseul == "oui") $res .= "> "._T('info_un_mot')."   "; + if ($obligatoire == "oui") $res .= "> "._T('info_groupe_important')."   "; + + $res .= "
    "; + if ($acces_minirezo == "oui") $res .= "> "._T('info_administrateurs')."   "; + if ($acces_comite == "oui") $res .= "> "._T('info_redacteurs')."   "; + if ($acces_forum == "oui") $res .= "> "._T('info_visiteurs_02')."   "; + + echo "", $res, ""; + if (strlen($descriptif)) { + echo "
    ", propre("{{"._T('info_descriptif')."}} ".$descriptif), " 
    "; + } + + if (strlen($texte)>0){ + echo "
    ", propre($texte), "
    "; + } + + // + // Afficher les mots-cles du groupe + // + + $groupe = sql_countsel("spip_mots", "id_groupe=$id_groupe"); + + echo ""; + + // Preliminaire: confirmation de suppression d'un mot lie a qqch + // (cf fin de afficher_groupe_mots_boucle executee a l'appel precedent) + if ($conf_mot AND $son_groupe==$id_groupe) { + echo confirmer_mot($conf_mot, $row_groupes, $groupe); + } + if ($groupe) { + $grouper_mots = charger_fonction('grouper_mots', 'inc'); + echo $grouper_mots($id_groupe, $groupe); + } + + echo "
    "; + + if (autoriser('modifier','groupemots',$id_groupe)){ + echo "\n"; + echo ""; + echo ""; + echo "\n"; + echo "
    "; + 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); + echo ""; + 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); + echo "
    "; + } + + echo fin_cadre_enfonce(true); + echo ""; + } + } + + echo pipeline('affiche_milieu',array('args'=>array('exec'=>'mots_tous'),'data'=>'')); + + + echo fin_gauche(), fin_page(); +} + +// http://doc.spip.org/@confirmer_mot +function confirmer_mot ($id_mot, $row_groupe, $total) +{ + $row = sql_fetsel("titre", "spip_mots", "id_mot=$id_mot"); + if (!$row) return ""; // deja detruit (acces concurrent etc) + + if (!autoriser('modifier', 'mot', $id_mot, null, array('id_groupe' => $row_groupe['id_groupe']))) + return ''; // usurpateur + + include_spip('inc/grouper_mots'); + $titre_mot = typo($row['titre']); + $type_mot = typo($row_groupe['titre']); + $son_groupe = $row_groupe['id_groupe']; + + if (($na = intval(_request('na'))) == 1) { + $texte_lie = _T('info_un_article')." "; + } else if ($na > 1) { + $texte_lie = _T('info_nombre_articles', array('nb_articles' => $na)) ." "; + } + if (($nb = intval(_request('nb'))) == 1) { + $texte_lie .= _T('info_une_breve')." "; + } else if ($nb > 1) { + $texte_lie .= _T('info_nombre_breves', array('nb_breves' => $nb))." "; + } + if (($ns = intval(_request('ns'))) == 1) { + $texte_lie .= _T('info_un_site')." "; + } else if ($ns > 1) { + $texte_lie .= _T('info_nombre_sites', array('nb_sites' => $ns))." "; + } + if (($nr = intval(_request('nr'))) == 1) { + $texte_lie .= _T('info_une_rubrique')." "; + } else if ($nr > 1) { + $texte_lie .= _T('info_nombre_rubriques', array('nb_rubriques' => $nr))." "; + } + + return debut_boite_info(true) + . "
    " + . _T('info_delet_mots_cles', array('titre_mot' => $titre_mot, 'type_mot' => $type_mot, 'texte_lie' => $texte_lie)) + . "

    " + . generer_supprimer_mot($id_mot, $son_groupe, ("" . _T('item_oui') . ""), $total) + . "
    \n" + . _T('info_oui_suppression_mot_cle') + . '

    ' + /* troublant. A refaire avec une visibility + . "
  • " + . _T('item_non') + . ", " + . _T('info_non_suppression_mot_cle') + . "" */ + . "
  • " + . fin_boite_info(true); +} +?>