Accéder au contenu.
Menu Sympa

devel - [Devel] r412 - branches/dui

Objet : devel-adl

Archives de la liste

[Devel] r412 - branches/dui


Chronologique Discussions 
  • From: svn AT agendadulibre.org
  • To: devel AT agendadulibre.org
  • Subject: [Devel] r412 - branches/dui
  • Date: Sun, 7 Dec 2008 14:55:37 +0100 (CET)
  • List-archive: <http://agendadulibre.org/pipermail/devel>
  • List-id: Developpement de l'Agenda du Libre <devel.agendadulibre.org>

Author: ldayot
Date: Sun Dec 7 14:55:35 2008
New Revision: 412

Log:
Ajout d'un export possible en javascript a inclure dans un autre site
(pour celles et ceux qui n'auraient pas d'import RSS).
Ajout de liens pour proposer cet export.



Added:
branches/dui/javascript.php
branches/dui/javascriptlist.php
Modified:
branches/dui/funcs.inc.php
branches/dui/text.inc.php

Modified: branches/dui/funcs.inc.php
==============================================================================
--- branches/dui/funcs.inc.php (original)
+++ branches/dui/funcs.inc.php Sun Dec 7 14:55:35 2008
@@ -135,8 +135,6 @@
}
echo "<a href=\"index.php\">L'agenda</a>";
echo " - <a href=\"submit.php\">Proposer un évènement</a>";
- echo " - <a href=\"rsslist.php\">Flux RSS</a>";
- echo " - <a href=\"icallist.php\">Calendriers iCal</a>";
echo " - <a href=\"map.php\">Carte</a>";
echo " - <a href=\"tags.php\">Mots-clés</a>";
echo " - <a href=\"infos.php\">Informations</a>";
@@ -146,6 +144,10 @@
{ // moderateur
echo " - <a href=\"moderation.php\">(réservé)</a>\n";
}
+ echo "<br />\n";
+ echo "Exporter&nbsp;: <a href=\"rsslist.php\">Flux RSS</a>";
+ echo " - <a href=\"icallist.php\">Calendriers iCal</a>";
+ echo " - <a href=\"javascriptlist.php\">JavaScript</a>";
echo "</p>\n";


@@ -522,10 +524,11 @@
calendar($db, $month, $year, $region);

echo "<p id=\"notice\">Ce calendrier en ";
- echo "<a href=\"rss.php?region=" . $region . "\">rss</a>, ";
- echo "<a href=\"" . calendar_absolute_url("ical.php?region=" . $region,
"webcal") . "\">iCal</a> ou ";
+ echo "<a href=\"" . calendar_absolute_url("rss.php?region=" . $region,
"http"). "\">rss</a>, ";
+ echo "<a href=\"" . calendar_absolute_url("ical.php?region=" . $region,
"webcal") . "\">iCal</a>, ";
+ echo "<a href=\"" . calendar_absolute_url("javascript.php?region=" .
$region, "http") . "\">JavaScript</a> ou ";
echo "<a href=\"http://www.google.com/calendar/render?cid="; .
calendar_absolute_url("ical.php?region%3D" . $region, "http") .
"\">calendrier Google</a>";
- echo "</p>";
+ echo "</p>";
}

function year_calendar($db, $year, $region)

Added: branches/dui/javascript.php
==============================================================================
--- (empty file)
+++ branches/dui/javascript.php Sun Dec 7 14:55:35 2008
@@ -0,0 +1,73 @@
+<?php
+
+/* Copyright 2008
+ * - Loic Dayot <ldayot CHEZ ouvaton 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.
+ */
+
+/**@file
+ *
+ * Export Agenda in javascrit file
+ */
+
+include("bd.inc.php");
+include("funcs.inc.php");
+
+$db = new db();
+
+if (isset($_GET['region']) &&
+ ($_GET['region'] == "all" ||
+ ereg("^[0-9][0-9]?", $_GET['region'])))
+{
+ $region = $_GET['region'];
+}
+else
+{
+ $region = "all";
+}
+
+$count = isset($_GET['count']) ? $_GET['count'] : 10;
+
+function calendar_js($db, $region, $count)
+ {
+ $sql = "SELECT * FROM events WHERE start_time>CURRENT_DATE()";
+ $sql .= " AND moderated = 1";
+ $sql .= ($region!="all" ? " AND ((region = " . $db->quote_smart($region)
. ") OR (locality>=1))" : "");
+ $sql .= " ORDER BY start_time LIMIT 0, {$count}";
+ $result = $db->query ($sql);
+
+ // start javascript
+ echo "document.write(\"<ul>\");\n";
+ while ($record = mysql_fetch_object($result))
+ {
+ $event = fetch_event($db, $record->id);
+ echo "document.write(\"";
+ echo " <li>". strftime ("%d/%m/%Y",
date_mysql2timestamp($event->start_time));
+ echo " <a href='".
calendar_absolute_url("showevent.php?id={$event->id}", "http"). "'>";
+ echo "<b>" .
htmlentities(substr(utf8_decode(stripslashes($event->city)),0,15)) . "</b>: ";
+ echo
htmlentities(substr(utf8_decode(stripslashes($event->title)),0,35));
+ echo "</a>". "</li>\\n\");\n";
+ } // while chaque session
+ // End javascript
+ echo "document.write(\"</ul>\");\n";
+ } // end function calendar_js
+
+
+calendar_js($db, $region, $count);
+
+
+?>

Added: branches/dui/javascriptlist.php
==============================================================================
--- (empty file)
+++ branches/dui/javascriptlist.php Sun Dec 7 14:55:35 2008
@@ -0,0 +1,89 @@
+<?php
+
+/* Copyright 2004-2008
+ * - Mélanie Bats <melanie POINT bats CHEZ utbm POINT fr>
+ * - Thomas Petazzoni <thomas POINT petazzoni CHEZ enix POINT org>
+ * - Loic Dayot <ldayot CHEZ ouvaton 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.
+ *
+ * $Id: top.inc.php,v 1.51 2007/03/10 16:22:12 ldayot Exp $
+ */
+
+include("text.inc.php");
+include("bd.inc.php");
+include("funcs.inc.php");
+
+$db = new db();
+
+put_header("JavaScripts");
+
+echo "<h2>Sélection de JavaScripts</h2>";
+
+$ret = $db->query ("select * from regions");
+
+if ($ret == FALSE)
+{
+ error ("Erreur lors de la recherche des régions");
+ put_footer();
+ exit;
+}
+
+echo $adl_js_intro;
+
+// Purpose url
+
+echo "<fieldset><legend>". _("Sélection à copier-coller dans votre site").
"</legend>";
+
+if (isset($_GET["tags"]) && is_array($_GET["tags"]))
+{
+ $urltags="";
+ foreach ($_GET["tags"] AS $category=>$tag)
+ {
+ if (is_array($tag) || $tag>"") {
+ $urltags .= "&$category=". (is_array($tag) ? implode("+", $tag) :
$tags);
+ }
+ }
+}
+$url = calendar_absolute_url("javascript.php?region=".
(isset($_GET["region"]) ? $_GET["region"] : "all"). (isset($_GET["daylimit"])
&& $_GET["daylimit"]!="30" ? "&daylimit=". $_GET["daylimit"] : "").
(isset($urltags) ? $urltags : ""));
+echo "<a href='$url'>".
+ htmlentities("<script type=\"text/javascript\" language=\"JavaScript\"
src=\"{$url}\">".
+ "</script>\n"). "</a>";
+echo "</fieldset>\n";
+
+echo "<form action=\"javascriptlist.php\" method=\"get\"
enctype=\"multipart/form-data\">\n";
+echo "<fieldset><legend>". _("Critères de sélection"). "</legend>";
+
+// Select place
+echo selectPlaceHTML(isset($_GET["region"]) ? $_GET["region"] : "all"). "<br
/>\n";
+
+// Select duration
+//echo selectDurationHTML(isset($_GET["daylimit"]) ? $_GET["daylimit"] :
"30"). "<br />\n";
+
+// Select tags
+//echo selectTagsHTML(isset($_GET["tags"]) ? $_GET["tags"] : array());
+
+echo " <input type=\"submit\" name=\"submit\" value=\"". _("Mettre à jour
la sélection"). "\" /> <input type=\"reset\" name=\"reset\" value=\"".
_("Réinitialiser"). "\" />\n";
+echo "</fieldset>";
+
+echo "</form>\n";
+
+echo $adl_js_more;
+
+echo "<script type=\"text/javascript\" language=\"JavaScript\"
src=\"{$url}\"></script>\n";
+
+put_footer();
+?>

Modified: branches/dui/text.inc.php
==============================================================================
--- branches/dui/text.inc.php (original)
+++ branches/dui/text.inc.php Sun Dec 7 14:55:35 2008
@@ -122,6 +122,18 @@
"Exemple&nbsp;: <code>$adl_url/rss.php?region=6&amp;daylimit=42</code> ".
"</li>\n</ul>\n";

+// javascriptlist.php
+$adl_js_intro = "<p>Chaque javascript liste les 10 prochains évènements à
venir dans une région donnée. ".
+ "En recopiant le code javascript pour une région, vous recevrez des
informations sur les évènements à portée locale, ".
+ "mais également sur les évènements à portée nationale et
internationale.</p>";
+$adl_js_more = "<p>Quelques fonctionnalités intéressantes des flux
RSS&nbsp;:</p>\n".
+ "<ul>\n".
+ "<li>Vous pouvez obtenir plus ou moins d'événements dans votre liste ".
+ " en ajoutant le paramètre <code>count</code><br /> ".
+ "Exemple&nbsp;: <code>$adl_url/javascript.php?region=10&count=20</code>. ".
+ "</li>\n</ul>\n".
+ "<h5>Ci-dessous, vous pouvez voir le résultat de votre
sélection&nbsp;:</h5>";
+
// submit.php
$adl_submit_summary = "<p>L'événement proposé n'apparaîtra dans l'Agenda
qu'après ".
"sa validation par un modérateur. Vous en serez informé par un courrier ".




  • [Devel] r412 - branches/dui, svn, 07/12/2008

Archives gérées par MHonArc 2.6.16.

Haut de le page