Accéder au contenu.
Menu Sympa

devel - [Devel] r419 - trunk

Objet : devel-adl

Archives de la liste

[Devel] r419 - trunk


Chronologique Discussions 
  • From: svn AT agendadulibre.org
  • To: devel AT agendadulibre.org
  • Subject: [Devel] r419 - trunk
  • Date: Mon, 26 Jan 2009 20:04:32 +0100 (CET)
  • List-archive: <http://agendadulibre.org/pipermail/devel>
  • List-id: Developpement de l'Agenda du Libre <devel.agendadulibre.org>

Author: thomas
Date: Mon Jan 26 20:04:31 2009
New Revision: 419

Log:
Nouvelle fonctionnalité : des petites notes associées aux évènements
en cours de modération. Ces notes ont pour objectif de faciliter le
suivi de la modération au sein de l'équipe de modérateurs.

* UPGRADE

Documentation des changements intervenus sur la base de données.

* schema.sql

Mise à jour du schéma SQL, qui contient une nouvelle table 'notes'.

* addnoteevent.php

Script utilisé pour la saisie de nouvelles notes sur un évènement
donné.

* user.inc.php

Ajout d'une fonction user_get_name_from_id(). Il serait
probablement possible de faire ça plus proprement avec un
constructeur différent de la classe user(). Mais de toute façon,
l'authentification est gérée de manière tellement pourrie que je ne
préfère pas passer trop de temps là-dessus.

* requestinfosevent.php

Lorsqu'une information complémentaire est demandée au soumetteur
d'un évènement, une note est automatiquement ajoutée. Ainsi, les
modérateurs sont au courant, même si ils n'ont pas lu les mails.

* moderation.php

Dans la liste des évènements à modérer, chaque évènement est suivi
par la liste des notes associées, par ordre chronologique inverse.



Added:
trunk/addnoteevent.php
Modified:
trunk/UPGRADE
trunk/moderation.php
trunk/requestinfosevent.php
trunk/schema.sql
trunk/user.inc.php

Modified: trunk/UPGRADE
==============================================================================
--- trunk/UPGRADE (original)
+++ trunk/UPGRADE Mon Jan 26 20:04:31 2009
@@ -93,3 +93,18 @@
echo "drop table $t" | mysql -u user dbname
mysql -u user dbname --default-character-set=utf8 < $t.sql
done
+
+Revisions lower than 419
+========================
+
+At revision 419, a new table 'notes' has been added. The following SQL
+code allows to create this table :
+
+CREATE TABLE `notes` (
+ `id` int(11) NOT NULL auto_increment,
+ `contents` text NOT NULL,
+ `date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `event_id` int(11) default NULL,
+ `author_id` int(11) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;

Added: trunk/addnoteevent.php
==============================================================================
--- (empty file)
+++ trunk/addnoteevent.php Mon Jan 26 20:04:31 2009
@@ -0,0 +1,102 @@
+<?php
+
+/* Copyright 2009
+ * - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+include("bd.inc.php");
+include("funcs.inc.php");
+include("session.inc.php");
+include("user.inc.php");
+
+$db = new db();
+$user = new user($db);
+
+if ($_POST['__event_note_cancel'])
+{
+ header("Location: moderation.php");
+ exit;
+}
+else if ($_POST['__event_note_confirm'])
+{
+ calendar_setlocale();
+
+ $id = get_safe_integer('id', 0);
+
+
+ $sql = "insert into notes (contents, date, event_id, author_id) values (" .
+ $db->quote_smart($_POST['__event_note_text']) . "," .
+ "NOW()" . "," .
+ $id . "," .
+ $user->get() . ")";
+
+ $ret = $db->query($sql);
+ if ($ret == FALSE)
+ {
+ error("La requête a échoué");
+ return -1;
+ }
+
+ header("Location: moderation.php");
+
+}
+
+$id = get_safe_integer('id', 0);
+
+put_header("Ajout d'une note de modération");
+
+$event = fetch_event($db, $id);
+if (! $event)
+{
+ echo "<p>Pas d'évènement avec cet ID</p>";
+ put_footer();
+ exit;
+}
+
+if ($event->moderated)
+{
+ echo "<p>Évènement déjà modéré</p>";
+ put_footer();
+ exit;
+}
+
+echo '<p class="moderationheader">';
+echo "<a href=\"moderation.php\">Modération</a>&nbsp;&gt;&gt;&gt&nbsp;Ajout
d'une note de modération";
+echo "</p>";
+
+echo '<div class="moderationbox">';
+
+echo '<form action="addnoteevent.php?id=' . $id . '" method="post">';
+echo '<p style="text-align: center;">Votre commentaire&nbsp;:</p>';
+echo '<textarea name="__event_note_text" cols="70"
rows="10"></textarea><br/>';
+echo '<input name="__event_note_confirm" type="submit"
value="Enregistrer"/>&nbsp;';
+echo '<input name="__event_note_cancel" type="submit" value="Annuler"/>';
+echo '</form>';
+echo '</div>';
+
+echo '<div class="moderationbox">';
+echo format_event ($db, $event->title, strtotime($event->start_time),
+ strtotime($event->end_time), $event->description,
+ $event->city, $event->region, $event->locality,
+ $event->url, $event->contact, $event->submitter,
+ $event->tags);
+echo '</div>';
+
+put_footer();
+
+?>

Modified: trunk/moderation.php
==============================================================================
--- trunk/moderation.php (original)
+++ trunk/moderation.php Mon Jan 26 20:04:31 2009
@@ -93,10 +93,27 @@
echo "<a href=\"editevent.php?id=" . $row->id .
"\">Éditer</a>&nbsp;-&nbsp;";
echo "<a href=\"validateevent.php?id=" . $row->id .
"\">Valider</a>&nbsp;-&nbsp;";
echo "<a href=\"rejectevent.php?id=" . $row->id . "\">Refuser</a><br/>";
- echo "<a href=\"requestinfosevent.php?id=" . $row->id . "\">Demander des
infos</a>";
+ echo "<a href=\"requestinfosevent.php?id=" . $row->id . "\">Demander des
infos</a><br/>";
+ echo "<a href=\"addnoteevent.php?id=" . $row->id . "\">Ajouter une
note</a>";
echo "</td>\n";
echo "</tr>\n";

+ $sql = "select * from notes where event_id=" . $row->id . " order by date
desc";
+ $notes = $db->query($sql);
+ while($note = mysql_fetch_object($notes))
+ {
+ echo "<tr class=\"" . $class . "\">\n";
+ echo "<td style=\"background: white;\"></td>";
+ echo "<td style=\"text-align: left; padding: 5px;\" colspan=\"5\">";
+ echo $note->contents;
+ echo "<br/>";
+ echo "<p style=\"text-align: right; font-size: 80%; padding: 0px;
margin: 0px;\">";
+ echo "<i>Posté par " . user_get_name_from_id($db, $note->author_id) .
" le " . date_mysql2humanreadable($note->date) . "</i>";
+ echo "</p>";
+ echo "</td>";
+ echo "</tr>";
+ }
+
$i = $i + 1;
}


Modified: trunk/requestinfosevent.php
==============================================================================
--- trunk/requestinfosevent.php (original)
+++ trunk/requestinfosevent.php Mon Jan 26 20:04:31 2009
@@ -68,6 +68,23 @@
"Demande d'informations sur l'évènement '" .
stripslashes($event->title) . "'", $text);

+ $note =
+ "<p>Demande d'informations complémentaires&nbsp;:</p>" .
+ "<pre>" . stripslashes($_POST["__text"]) . "</pre>";
+
+ $sql = "insert into notes (contents, date, event_id, author_id) values (" .
+ $db->quote_smart($note) . "," .
+ "NOW()" . "," .
+ $id . "," .
+ $user->get() . ")";
+
+ $ret = $db->query($sql);
+ if ($ret == FALSE)
+ {
+ error("La requête a échoué");
+ return -1;
+ }
+
header("Location: moderation.php");
}


Modified: trunk/schema.sql
==============================================================================
--- trunk/schema.sql (original)
+++ trunk/schema.sql Mon Jan 26 20:04:31 2009
@@ -81,3 +81,12 @@
`longitude` float default NULL,
PRIMARY KEY (`id`)
);
+
+CREATE TABLE `notes` (
+ `id` int(11) NOT NULL auto_increment,
+ `contents` text NOT NULL,
+ `date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `event_id` int(11) default NULL,
+ `author_id` int(11) default NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
\ No newline at end of file

Modified: trunk/user.inc.php
==============================================================================
--- trunk/user.inc.php (original)
+++ trunk/user.inc.php Mon Jan 26 20:04:31 2009
@@ -134,4 +134,21 @@
}
}

+function user_get_name_from_id($db, $id)
+{
+ $sql = "select firstname, lastname from users where id=" . $id;
+ $ret = $db->query($sql);
+ if ($ret == FALSE)
+ {
+ error("Erreur lors de la requête <i>" . $sql . "</i>");
+ return -1;
+ }
+
+ if (mysql_num_rows($ret) != 1)
+ return -1;
+
+ $row = mysql_fetch_object($ret);
+ return $row->firstname . " " . $row->lastname;
+}
+
?>




  • [Devel] r419 - trunk, svn, 26/01/2009

Archives gérées par MHonArc 2.6.16.

Haut de le page