Author: pierre.basson@gmail.com
Date: Wed Jul 19 06:46:36 2006
New Revision: 4080
Log:
- modification sur l'ergonomie
- ajout des balises #POURCENTAGE et #URL_SONDAGE
- ajout du fichier de langue français
Added:
_plugins_/_contenu_editorial_/spip-sondages/img_pack/auteurs.png (with props)
_plugins_/_contenu_editorial_/spip-sondages/img_pack/checkbox.png (with props)
_plugins_/_contenu_editorial_/spip-sondages/img_pack/poubelle.png (with props)
_plugins_/_contenu_editorial_/spip-sondages/img_pack/radio.png (with props)
_plugins_/_contenu_editorial_/spip-sondages/img_pack/statistiques.png (with props)
_plugins_/_contenu_editorial_/spip-sondages/inc/sondages_balises.php
_plugins_/_contenu_editorial_/spip-sondages/lang/
_plugins_/_contenu_editorial_/spip-sondages/lang/sondages_fr.php
_plugins_/_contenu_editorial_/spip-sondages/public/
_plugins_/_contenu_editorial_/spip-sondages/public/composer.php
Removed:
_plugins_/_contenu_editorial_/spip-sondages/img_pack/auteur.png
Modified:
_plugins_/_contenu_editorial_/spip-sondages/balise/formulaire_sondage.php
_plugins_/_contenu_editorial_/spip-sondages/exec/sondages_visualisation.php
_plugins_/_contenu_editorial_/spip-sondages/formulaire_sondage.html
_plugins_/_contenu_editorial_/spip-sondages/inc/sondages_admin.php
_plugins_/_contenu_editorial_/spip-sondages/inc/sondages_fonctions.php
_plugins_/_contenu_editorial_/spip-sondages/resultat_sondage.html
Modified: _plugins_/_contenu_editorial_/spip-sondages/balise/formulaire_sondage.php
--- _plugins_/_contenu_editorial_/spip-sondages/balise/formulaire_sondage.php (original)
+++ _plugins_/_contenu_editorial_/spip-sondages/balise/formulaire_sondage.php Wed Jul 19 06:46:36 2006
@@ -24,6 +24,15 @@
return calculer_balise_dynamique($p,'FORMULAIRE_SONDAGE', array('id_sondage'));
}
+
+ /**
+ * balise_FORMULAIRE_SONDAGE_stat
+ *
+ * @param array args
+ * @param array filtres
+ * @return array args si le sondage est "votable"
+ * @author Pierre Basson
+ **/
function balise_FORMULAIRE_SONDAGE_stat($args, $filtres) {
// Pas d'id_sondage ? Erreur de squelette
if (!$args[0])
Modified: _plugins_/_contenu_editorial_/spip-sondages/exec/sondages_visualisation.php
--- _plugins_/_contenu_editorial_/spip-sondages/exec/sondages_visualisation.php (original)
+++ _plugins_/_contenu_editorial_/spip-sondages/exec/sondages_visualisation.php Wed Jul 19 06:46:36 2006
@@ -116,7 +116,7 @@
sondages_modifier_ordre_choix($id_sondage, $id_choix, $position);
}
$url_sondage = generer_url_ecrire('sondages_visualisation', 'id_sondage='.$id_sondage, '&');
-# sondages_rediriger_javascript($url_sondage);
+ sondages_rediriger_javascript($url_sondage);
}
$id_sondage = $_GET['id_sondage'];
@@ -178,13 +178,30 @@
if (!empty($_POST['changer_en_ligne'])) {
$en_ligne = $_POST['en_ligne'];
- if ($en_ligne == 'poubelle') {
+ if ($en_ligne == 'purger_avis') {
+ $requete_sondes = 'SELECT id_sonde FROM spip_sondes WHERE id_sondage="'.$id_sondage.'"';
+ $resultat_sondes = spip_query($requete_sondes);
+ while ($arr = spip_fetch_array($resultat_sondes)) {
+ spip_query('DELETE FROM spip_avis WHERE id_sonde="'.$arr['id_sonde'].'"');
+ }
+ $suppression = 'DELETE FROM spip_sondes WHERE id_sondage="'.$id_sondage.'"';
+ spip_query($suppression);
+ } else if ($en_ligne == 'poubelle') {
$suppression = 'DELETE FROM spip_sondages WHERE id_sondage="'.$id_sondage.'" LIMIT 1';
spip_query($suppression);
$suppression_mots = 'DELETE FROM spip_mots_sondages WHERE id_sondage="'.$id_sondage.'"';
spip_query($suppression_mots);
$suppression_auteurs = 'DELETE FROM spip_auteurs_sondages WHERE id_sondage="'.$id_sondage.'"';
spip_query($suppression_auteurs);
+ $requete_sondes = 'SELECT id_sonde FROM spip_sondes WHERE id_sondage="'.$id_sondage.'"';
+ $resultat_sondes = spip_query($requete_sondes);
+ while ($arr = spip_fetch_array($resultat_sondes)) {
+ spip_query('DELETE FROM spip_avis WHERE id_sonde="'.$arr['id_sonde'].'"');
+ }
+ $suppression = 'DELETE FROM spip_sondes WHERE id_sondage="'.$id_sondage.'"';
+ spip_query($suppression);
+ $suppression = 'DELETE FROM spip_choix WHERE id_sondage="'.$id_sondage.'"';
+ spip_query($suppression);
// suppression logos
$logo_on = array();
$logo_on = cherche_logo($id_sondage, 'son', 'on');
@@ -220,6 +237,25 @@
}
}
+ if (!empty($_GET['position'])) {
+ $id_sondage = $_GET['id_sondage'];
+ $id_choix = $_GET['id_choix'];
+ $position = intval($_GET['position']);
+ sondages_modifier_ordre_choix($id_sondage, $id_choix, $position);
+ sondages_rediriger_javascript($url_sondage);
+ }
+
+ if (!empty($_GET['supprimer_choix'])) {
+ $id_choix = intval($_GET['supprimer_choix']);
+ $id_sondage = $_GET['id_sondage'];
+ sondages_modifier_ordre_choix($id_sondage, $id_choix, 'dernier');
+ $suppression = 'DELETE FROM spip_avis WHERE id_choix="'.$id_choix.'"';
+ spip_query($suppression);
+ $suppression = 'DELETE FROM spip_choix WHERE id_choix="'.$id_choix.'" AND id_sondage="'.$id_sondage.'" LIMIT 1';
+ spip_query($suppression);
+ sondages_rediriger_javascript($url_sondage);
+ }
+
$requete_sondage = 'SELECT titre, id_rubrique, type, texte, lang, en_ligne, statut, date_debut, date_fin, extra FROM spip_sondages WHERE id_sondage="'.$id_sondage.'" LIMIT 1';
$resultat_sondage = spip_query($requete_sondage);
list($titre, $id_rubrique, $type, $texte, $lang, $en_ligne, $statut, $date_debut, $date_fin, $extra) = spip_fetch_array($resultat_sondage);
@@ -295,23 +331,94 @@
echo generer_url_post_ecrire("sondages_visualisation", "id_sondage=$id_sondage", 'formulaire');
sondages_afficher_dates($date_debut, $date_fin, true);
+
+ debut_cadre_enfonce('../'._DIR_PLUGIN_SONDAGES.'/img_pack/choix.png', false, '', _T('sondages:choix'));
+ $requete_choix = 'SELECT * FROM spip_choix WHERE id_sondage="'.$id_sondage.'" ORDER BY ordre';
+ $resultat_choix = spip_query($requete_choix);
+ $total = spip_num_rows($resultat_choix);
+ if ($type == 'multiple')
+ $icone = "checkbox";
+ else
+ $icone = "radio";
+ if ($total != 0) {
+ $position = 0;
+ echo "<div class='liste'>\n";
+ echo "<table width='100%' cellpadding='3' cellspacing='0' border='0' background=''>\n";
+ while ($arr = spip_fetch_array($resultat_choix)) {
+ echo "<tr class='tr_liste'>\n";
+ echo "<td width='25' class='arial11'>\n";
+ echo "<img src='"._DIR_PLUGIN_SONDAGES."/img_pack/".$icone.".png' alt='radio' width='16' height='16' border='0' />\n";
+ echo "</td>\n";
+ echo "<td class='arial2' width='150'>\n";
+ echo "<A HREF='".generer_url_ecrire("choix_edition","id_sondage=$id_sondage&id_choix=".$arr['id_choix'])."'>\n";
+ echo $arr['titre'];
+ echo "</A>\n";
+ echo "</td>\n";
+ echo "<td class='arial1' width='50' align='right'>\n";
+ $requete_nb_votes = 'SELECT id_avis FROM spip_avis WHERE id_choix="'.$arr['id_choix'].'"';
+ $resultat_nb_votes = spip_query($requete_nb_votes);
+ $nb_votes = intval(spip_num_rows($resultat_nb_votes));
+ echo $nb_votes.' '._T('sondages:votes');
+ echo "</td>\n";
+ echo "<td class='arial1' width='120'>\n";
+ $pourcentage = sondages_calculer_pourcentage($id_sondage, $arr['id_choix']);
+ echo "<img src='img_pack/jauge-vert.gif' alt='monter' title='".$pourcentage."%' width='".$pourcentage."' height='8' border='0' /> ".$pourcentage."%\n";
+ echo "</td>\n";
+ echo "<td class='arial2' width='24'>\n";
+ if ($position == 0) {
+ echo " ";
+ } else {
+ echo "<A HREF='".generer_url_ecrire("sondages_visualisation","id_sondage=$id_sondage&id_choix=".$arr['id_choix']."&position=".($position-1))."'>\n";
+ echo "<img src='img_pack/monter-16.png' alt='monter' width='16' height='16' border='0' />\n";
+ echo "</A>\n";
+ }
+ echo "</td>\n";
+ echo "<td class='arial2' width='24'>\n";
+ if ($position == ($total-1)) {
+ echo ' ';
+ } else {
+ echo "<A HREF='".generer_url_ecrire("sondages_visualisation","id_sondage=$id_sondage&id_choix=".$arr['id_choix']."&position=".($position+1))."'>\n";
+ echo "<img src='img_pack/descendre-16.png' alt='descendre' width='16' height='16' border='0' />\n";
+ echo "</A>\n";
+ }
+ echo "</td>\n";
+ echo "<td class='arial1' width='24'>\n";
+ echo "<A HREF='".generer_url_ecrire("sondages_visualisation","id_sondage=$id_sondage&supprimer_choix=".$arr['id_choix'])."'>\n";
+ echo "<img src='"._DIR_PLUGIN_SONDAGES."/img_pack/poubelle.png' alt='X' width='16' height='16' border='0' align='middle' />\n";
+ echo "</A>\n";
+ echo "</td>\n";
+ echo "</tr>\n";
+ $position++;
+ }
+ echo "</table>\n";
+ echo "</div>\n";
+
+ echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
+ echo "<tr>";
+ echo "<td>";
+ echo "<div align='$spip_lang_right'>";
+ icone(_T('sondages:ajouter_un_choix'), generer_url_ecrire("choix_edition","id_sondage=$id_sondage&new=oui"), '../'._DIR_PLUGIN_SONDAGES.'/img_pack/choix.png', "creer.gif");
+ echo "</div>";
+ echo "</td></tr></table>";
+ }
+ fin_cadre_enfonce();
+
sondages_afficher_auteurs($id_sondage, true);
sondages_afficher_mots_cles($id_sondage, true);
sondages_afficher_langue($lang, true);
echo "<br />";
debut_cadre_relief();
- echo "<center><B>"._T('sondages:action_en_ligne')."</B> ";
+ echo "<center><B>"._T('sondages:action')."</B> ";
echo "<SELECT NAME='en_ligne' SIZE='1' CLASS='fondl'>\n";
echo ' <OPTION VALUE="non"'.(($en_ligne == 'non') ? ' SELECTED' : '').'>'._T('sondages:action_hors_ligne').'</OPTION>'."\n";
[... 936 lines stripped ...]