Adds two iGoogle gadgets (one for directory queries, the other for the latest events).
authorVincent Zanotti <vincent.zanotti@polytechnique.org>
Fri, 18 Jan 2008 00:25:15 +0000 (01:25 +0100)
committerVincent Zanotti <vincent.zanotti@polytechnique.org>
Fri, 18 Jan 2008 23:06:53 +0000 (00:06 +0100)
Signed-off-by: Vincent Zanotti <vincent.zanotti@polytechnique.org>
14 files changed:
ChangeLog
htdocs/css/igoogle.css [new file with mode: 0644]
htdocs/javascript/igoogle.js [new file with mode: 0644]
htdocs/xorg.php
include/userset.inc.php
modules/gadgets.php [new file with mode: 0644]
modules/gadgets/gadgets.inc.php [new file with mode: 0644]
templates/gadgets/ig-events.tpl [new file with mode: 0644]
templates/gadgets/ig-events.xml.tpl [new file with mode: 0644]
templates/gadgets/ig-login.tpl [new file with mode: 0644]
templates/gadgets/ig-minifiche.tpl [new file with mode: 0644]
templates/gadgets/ig-search.tpl [new file with mode: 0644]
templates/gadgets/ig-search.xml.tpl [new file with mode: 0644]
templates/gadgets/ig-skin.tpl [new file with mode: 0644]

index 9ea2e70..78aa29a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,9 @@ New:
     * Core:
         - New PlProfiler tool                                              -FRU
 
+    * Goodies:
+        - iGoogle gadgets for latest events and directory search           -VZA
+
 Bug/Wish:
 
     * Emails:
@@ -1152,6 +1155,7 @@ ACRONYMS:
     * SHK: Jeremy Lainé         (Sharky)    <jeremy.laine@m4x.org>
     * VP : Vincent Palatin                  <vincent.palatin@m4x.org>
     * XdX: Alexandre Hô         (XandreX)   <alexandre.ho@m4x.org>
+    * VZA: Vincent Zanotti      (vinZ2)     <vincent.zanotti@m4x.org>
 
 ================================================================================
 vim:et:ts=4:sw=4:tw=80:enc=utf-8:
diff --git a/htdocs/css/igoogle.css b/htdocs/css/igoogle.css
new file mode 100644 (file)
index 0000000..4fe8ada
--- /dev/null
@@ -0,0 +1,97 @@
+/***************************************************************************
+ *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  http://opensource.polytechnique.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                *
+ ***************************************************************************/
+
+body {
+    font-family: "Arial", sans-serif;
+    font-size: small;
+    color: #000000;
+    background: #ffffff;
+    background-position: center;
+    margin: 0.2em 0em;
+}
+
+a:link, a:visited, a:active, a:hover { color: #003399; background: none; }
+img   { vertical-align: middle; }
+a img { border: 0px; }
+td    { vertical-align: top; }
+div.more { font-size: x-small; text-align: right; }
+
+/* Events */
+div.events ul { margin: 0; padding: 0 0.2em 0 1em; }
+div.events ul li { margin: 0.5em 0.2em; padding: 0; }
+li.unread { font-weight: bold; }
+
+/* Search gadget: frame */
+div.welcome {
+    text-align: center;
+}
+
+div.search {
+    text-align: center;
+    margin-top: 1em;
+}
+
+div.error {
+    color: red;
+    font-weight: bold;
+}
+
+/* Search gadget: result page */
+div.contact-list div.contact {
+    width: 100%;
+    text-align: left;
+    border-top: 1px solid #003399;
+    background: #F4D09C;
+    color: inherit;
+}
+
+div.grayed {
+    color: #444444;
+    font-style: italic;
+}
+
+div.grayed div.contact {
+    background: #eee;
+}
+
+div.contact div.nom {
+    font-weight: bold;
+    float: left;
+}
+
+div.contact div.autre {
+    text-align: right;
+    float: right;
+}
+
+div.contact div.long {
+    width: 100%;
+    clear: both;
+    background: white;
+    color: inherit;
+    padding-top: 1px;
+    padding-bottom: 1px;
+}
+
+div.long table { width: 100%; }
+div.long td.lt { width: 35%; }
+div.long td.rt { width: 65%; }
+
+/* vim: set et ts=4 sts=4 sw=4: */
diff --git a/htdocs/javascript/igoogle.js b/htdocs/javascript/igoogle.js
new file mode 100644 (file)
index 0000000..abea945
--- /dev/null
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  http://opensource.polytechnique.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                *
+ ***************************************************************************/
+
+function igOnLoadHandler()
+{
+    if (typeof(_IG_AdjustIFrameHeight) != 'undefined') {
+        _IG_AdjustIFrameHeight();
+    }
+}
+
+function markEventAsRead(event_id)
+{
+    _toggle(_gel("mark-read-" + event_id));
+    _gel("evt-" + event_id).setAttribute("class", "read");
+    _gel("link-" + event_id).setAttribute("href", "events/unread/" + event_id);
+    Ajax.update_html(null, "events/read/" + event_id);
+    return false;
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
index 72026ca..f0faa4e 100644 (file)
@@ -27,7 +27,8 @@ if (!($path = Env::v('n')) || ($path{0} < 'A' || $path{0} > 'Z')) {
     $platal = new Platal('auth', 'banana', 'carnet', 'email', 'events',
                          'geoloc', 'lists', 'marketing', 'payment', 'platal',
                          'profile', 'register', 'search', 'stats', 'admin',
-                         'newsletter', 'axletter', 'bandeau', 'survey');
+                         'newsletter', 'axletter', 'bandeau', 'survey',
+                         'gadgets');
     $platal->run();
 
     exit;
index 0da93ad..382baa3 100644 (file)
@@ -374,5 +374,47 @@ class GeolocView implements PlView
     }
 }
 
+class GadgetView implements PlView
+{
+    public function __construct(PlSet &$set, $data, array $params)
+    {
+        $this->set =& $set;
+    }
+
+    public function fields()
+    {
+        return "u.user_id AS id,
+                u.*, a.alias AS forlife," .
+                (S::logged() ? "q.profile_mobile AS mobile, " : "IF(q.profile_mobile_pub = 'public', q.profile_mobile, NULL) as mobile, ") .
+               "u.perms != 'pending' AS inscrit,
+                u.perms != 'pending' AS wasinscrit,
+                u.deces != 0 AS dcd, u.deces,
+                FIND_IN_SET('femme', u.flags) AS sexe,
+                adr.city, gp.a2, gp.pays AS countrytxt, gr.name AS region" .
+                (S::logged() ? ", c.contact AS contact" : '');
+    }
+
+    public function joins()
+    {
+        return  "LEFT JOIN  adresses       AS adr ON (u.user_id = adr.uid AND FIND_IN_SET('active', adr.statut)".(S::logged() ? "" : " AND adr.pub = 'public'").")
+                 LEFT JOIN  geoloc_pays    AS gp  ON (adr.country = gp.a2)
+                 LEFT JOIN  geoloc_region  AS gr  ON (adr.country = gr.a2 AND adr.region = gr.region)" .
+                (S::logged() ?
+                 "LEFT JOIN  contacts       AS c   On (c.contact = u.user_id AND c.uid = " . S::v('uid') . ")"
+                 : "");
+    }
+
+    public function apply(PlatalPage &$page)
+    {
+        $page->assign_by_ref('set',
+          $this->set->get($this->fields(), $this->joins(), null, null, null, 5, 0));
+    }
+
+    public function args()
+    {
+        return null;
+    }
+}
+
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>
diff --git a/modules/gadgets.php b/modules/gadgets.php
new file mode 100644 (file)
index 0000000..0a90079
--- /dev/null
@@ -0,0 +1,92 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  http://opensource.polytechnique.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                *
+ ***************************************************************************/
+
+class GadgetsModule extends PLModule
+{
+    function handlers()
+    {
+        return array(
+            'gadgets/ig-events.xml' => $this->make_hook('ig_events_xml', AUTH_PUBLIC, 'user', NO_HTTPS),
+            'gadgets/ig-events'     => $this->make_hook('ig_events', AUTH_PUBLIC),
+            'gadgets/ig-search.xml' => $this->make_hook('ig_search_xml', AUTH_PUBLIC, 'user', NO_HTTPS),
+            'gadgets/ig-search'     => $this->make_hook('ig_search', AUTH_PUBLIC),
+        );
+    }
+
+    function handler_ig_events_xml(&$page) {
+        require_once 'gadgets/gadgets.inc.php';
+        init_igoogle_xml('gadgets/ig-events.xml.tpl');
+    }
+
+    function handler_ig_events(&$page) {
+        require_once 'gadgets/gadgets.inc.php';
+        init_igoogle_html('gadgets/ig-events.tpl', AUTH_COOKIE);
+
+        $events = XDB::iterator(
+            'SELECT  SQL_CALC_FOUND_ROWS
+                     e.id, e.titre, UNIX_TIMESTAMP(e.creation_date) AS creation_date,
+                     IF(u.nom_usage = "", u.nom, u.nom_usage) AS nom, u.prenom, u.promo,
+                     ev.user_id IS NULL AS nonlu
+               FROM  evenements AS e
+         INNER JOIN  auth_user_md5 AS u ON e.user_id = u.user_id
+          LEFT JOIN  evenements_vus AS ev ON (e.id = ev.evt_id AND ev.user_id = {?})
+              WHERE  FIND_IN_SET("valide", e.flags) AND peremption >= NOW()
+                     AND (e.promo_min = 0 || e.promo_min <= {?})
+                     AND (e.promo_max = 0 || e.promo_max >= {?})
+           ORDER BY  e.creation_date DESC
+              LIMIT  {?}',
+            S::i('uid'), S::i('promo'), S::i('promo'), 5);
+        $page->assign('events', $events);
+        $page->assign('event_count', XDB::query("SELECT FOUND_ROWS()")->fetchOneCell());
+    }
+
+    function handler_ig_search_xml(&$page) {
+        require_once 'gadgets/gadgets.inc.php';
+        init_igoogle_xml('gadgets/ig-search.xml.tpl');
+    }
+
+    function handler_ig_search(&$page)
+    {
+        if (Env::has('quick') && Env::s('quick') != '') {
+            require_once 'userset.inc.php';
+            $view = new SearchSet(true);
+            $view->addMod('gadget', 'Gadget', true);
+            $view->apply(null, $page);
+
+            $nb_tot = $view->count();
+            $page->assign('result_count', $nb_tot);
+
+            if (!S::logged() && $nb_tot > $globals->search->public_max) {
+                $page->assign('error', 'Votre recherche a généré trop de résultats pour un affichage public.');
+            } elseif ($nb_tot > $globals->search->private_max) {
+                $page->assign('error', 'Recherche trop générale.');
+            } elseif (empty($nb_tot)) {
+                $page->assign('error', 'Il n\'existe personne correspondant à ces critères dans la base !');
+            }
+        }
+
+        require_once 'gadgets/gadgets.inc.php';
+        init_igoogle_html('gadgets/ig-search.tpl', AUTH_PUBLIC);
+    }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
diff --git a/modules/gadgets/gadgets.inc.php b/modules/gadgets/gadgets.inc.php
new file mode 100644 (file)
index 0000000..613c2df
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  http://opensource.polytechnique.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                *
+ ***************************************************************************/
+
+// iGoogle gadgets helpers.
+function init_igoogle_xml($template)
+{
+    global $page;
+    $page->changeTpl($template, NO_SKIN);
+
+    header('Content-Type: application/xml; charset=utf-8');
+}
+
+function init_igoogle_html($template, $auth = AUTH_PUBLIC)
+{
+    global $page;
+    $page->changeTpl('gadgets/ig-skin.tpl', NO_SKIN);
+    $page->register_modifier('escape_html', 'escape_html');
+    $page->default_modifiers = Array('@escape_html');
+    header('Accept-Charset: utf-8');
+
+    // Adds external JavaScript libraries provided by iGoogle to the page.
+    if (Env::has('libs')) {
+        $libs = split(',', Env::s('libs'));
+        foreach ($libs as $lib) {
+            if (preg_match('@^[a-z0-9/._-]+$@i', $lib) && !preg_match('@([.][.])|([.]/)|(//)@', $lib)) {
+                $page->append('gadget_js', 'https://www.google.com/ig/f/' . $lib);
+            }
+        }
+    }
+
+    // Redirects the user to the login pagin if required.
+    if ($auth >  S::v('auth', AUTH_PUBLIC)) {
+        $page->assign('gadget_tpl', 'gadgets/ig-login.tpl');
+        return false;
+    }
+
+    $page->assign('gadget_tpl', $template);
+    return true;
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
diff --git a/templates/gadgets/ig-events.tpl b/templates/gadgets/ig-events.tpl
new file mode 100644 (file)
index 0000000..b6ab0c6
--- /dev/null
@@ -0,0 +1,51 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2008 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<div class="events">
+  <ul>
+  {iterate from=$events item=ev}
+    <li class="{if $ev.nonlu}unread{else}read{/if}" id="evt-{$ev.id}">
+      {if $ev.nonlu}
+      <div  id="mark-read-{$ev.id}" style="float: right">
+        <a href="events/read/{$ev.id}" target="_top" onclick="return markEventAsRead({$ev.id})">{*
+          *}{icon name=tick title="Marquer comme lu"}</a>
+      </div>
+      {/if}
+      <a href="events{if !$ev.nonlu}/unread/{$ev.id}{else}#newsid{$ev.id}{/if}" target="_blank" id="link-{$ev.id}"
+         title="Ajouté le {$ev.creation_date|date_format} par {$ev.prenom} {$ev.nom} (X{$ev.promo})">
+        {tidy}
+          {$ev.titre|nl2br}
+        {/tidy}
+      </a>
+    </li>
+  {assign var="has_evts" value=true}
+  {/iterate}
+  {if !$has_evts}
+    <li><em>Aucun article actuellement.</em></li>
+  {/if}
+  </ul>
+</div>
+<div class="more">
+  <a href="events" target="_blank">{$event_count} événements au total</a> &gt;&gt;&gt;
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/gadgets/ig-events.xml.tpl b/templates/gadgets/ig-events.xml.tpl
new file mode 100644 (file)
index 0000000..f077f08
--- /dev/null
@@ -0,0 +1,35 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2008 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<?xml version="1.0" encoding="UTF-8"?>
+<Module>
+  <ModulePrefs title="Polytechnique.org - Événements"
+    title_url="https://www.polytechnique.org/events" scrolling="false"
+    description="Les dernières annonces du site Polytechnique.org."
+    author="Polytechnique.org" author_email="support+gadgets@polytechnique.org">
+    <Locale lang="fr" />
+    <Require feature="dynamic-height" />
+  </ModulePrefs>
+  <Content type="url" href="{$globals->baseurl}/gadgets/ig-events" />
+</Module>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/gadgets/ig-login.tpl b/templates/gadgets/ig-login.tpl
new file mode 100644 (file)
index 0000000..6a0d9d7
--- /dev/null
@@ -0,0 +1,34 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2008 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<div style="text-align: center">
+  <img src="images/skins/default_headlogo.jpg" /><br />
+  <b>Polytechnique.org</b>
+</div>
+<div style="text-align: center" id="connect">
+  <a href="login" target="_blank">Me connecter !</a><br />
+  <a href="javascript:window.location.reload()">
+    Je suis déjà connecté à Polytechnique.Org.
+  </a>
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/gadgets/ig-minifiche.tpl b/templates/gadgets/ig-minifiche.tpl
new file mode 100644 (file)
index 0000000..b04a21d
--- /dev/null
@@ -0,0 +1,82 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2008 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+{if !$c.inscrit || $c.dcd}<div class='grayed'>{/if}
+<div class="contact" {if $c.inscrit}{if $smarty.session.auth ge AUTH_COOKIE}title="Fiche mise à jour le {$c.date|date_format}"{/if}{/if}>
+  <div class="nom">
+    {if $c.sexe}&bull;{/if}
+    {if !$c.dcd && $c.inscrit}<a href="profile/{$c.forlife}" class="popup2">{/if}
+    {if $c.nom_usage}{$c.nom_usage} {$c.prenom}<br />({$c.nom}){else}{$c.nom} {$c.prenom}{/if}
+    {if !$c.dcd && $c.inscrit}</a>{/if}
+  </div>
+  <div class="autre">
+    {if $c.iso3166}
+    <img src='images/flags/{$c.iso3166}.gif' alt='{$c.nat}' height='11' title='{$c.nat}' />&nbsp;
+    {/if}
+    (X {$c.promo})
+    {if $c.dcd}décédé{if $c.sexe}e{/if} le {$c.deces|date_format}{/if}
+    {if $smarty.session.auth ge AUTH_COOKIE}
+    {if !$c.wasinscrit && !$c.dcd}
+      {if $show_action eq ajouter}
+        <a href="carnet/notifs/add_nonins/{$c.user_id}" target="_top">{*
+        *}{icon name=add title="Ajouter à la liste de mes surveillances"}</a>
+      {else}
+        <a href="carnet/notifs/del_nonins/{$c.user_id}" target="_top">{*
+        *}{icon name=cross title="Retirer de la liste de mes surveillances"}</a>
+      {/if}
+    {elseif $c.wasinscrit && !$c.dcd}
+        <a href="vcard/{$c.forlife}.vcf">{*
+        *}{icon name=vcard title="Afficher la carte de visite"}</a>
+      {if $show_action eq ajouter}
+        <a href="carnet/contacts?action={$show_action}&amp;user={$c.forlife}" target="_top">{*
+        *}{icon name=add title="Ajouter à mes contacts"}</a>
+      {else}
+        <a href="carnet/contacts?action={$show_action}&amp;user={$c.forlife}" target="_top">{*
+        *}{icon name=cross title="Retirer de mes contacts"}</a>
+      {/if}
+    {/if}
+    {/if}
+  </div>
+  <div class="long">
+  {if $c.wasinscrit}
+    {if $c.mobile || $c.countrytxt || $c.city}
+    <table cellspacing="0" cellpadding="0">
+      {if $c.countrytxt || $c.city}
+      <tr>
+        <td class="lt">Géographie:</td>
+        <td class="rt">{$c.city}{if $c.city && $c.countrytxt}, {/if}{$c.countrytxt}</td>
+      </tr>
+      {/if}
+      {if $c.mobile && !$c.dcd}
+      <tr>
+        <td class="lt">Mobile:</td>
+        <td class="rt">{$c.mobile}</td>
+      </tr>
+      {/if}
+    </table>
+    {/if}
+  {/if}
+  </div>
+</div>
+{if !$c.inscrit || $c.dcd}</div>{/if}
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/gadgets/ig-search.tpl b/templates/gadgets/ig-search.tpl
new file mode 100644 (file)
index 0000000..67fdd83
--- /dev/null
@@ -0,0 +1,56 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2008 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+{if $error}
+<div class="error">{$error}</div>
+{elseif $set}
+<div class="contact-list">
+{iterate from=$set item=res}
+  {if $res.contact}
+  {include file="gadgets/ig-minifiche.tpl" c=$res show_action="retirer"}
+  {else}
+  {include file="gadgets/ig-minifiche.tpl" c=$res show_action="ajouter"}
+  {/if}
+{/iterate}
+</div>
+<div class="more">
+  <a href="search?quick={$smarty.request.quick}" target="_blank">{$result_count} résultats au total</a> &gt;&gt;&gt;
+</div>
+{else}
+<div class="welcome">
+  <img src="images/skins/default_headlogo.jpg" alt="Logo Polytechnique.org" />
+</div>
+{/if}
+
+<div class="search">
+  <form method="get" action="gadgets/ig-search">
+    <input name="extern_js" type="hidden" value="{$smarty.request.extern_js}" />
+    <input name="libs" type="hidden" value="{$smarty.request.libs}" />
+    <input name="mid" type="hidden" value="{$smarty.request.mid}" />
+    <input name="parent" type="hidden" value="{$smarty.request.parent}" /><br />
+    <input name="synd" type="hidden" value="{$smarty.request.synd}" />
+    <input name="quick" type="text" value="{$smarty.request.quick}" /><br />
+    <input value="Chercher sur Polytechnique.org" type="submit" />
+  </form>
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/gadgets/ig-search.xml.tpl b/templates/gadgets/ig-search.xml.tpl
new file mode 100644 (file)
index 0000000..ae4eae4
--- /dev/null
@@ -0,0 +1,35 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2008 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<?xml version="1.0" encoding="UTF-8"?>
+<Module>
+  <ModulePrefs title="Polytechnique.org - Annuaire"
+    title_url="https://www.polytechnique.org/search" scrolling="false"
+    description="Outil de recherche rapide de l'annuaire de Polytechnique.org."
+    author="Polytechnique.org" author_email="support+gadgets@polytechnique.org">
+    <Locale lang="fr" />
+    <Require feature="dynamic-height" />
+  </ModulePrefs>
+  <Content type="url" href="{$globals->baseurl}/gadgets/ig-search" />
+</Module>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/templates/gadgets/ig-skin.tpl b/templates/gadgets/ig-skin.tpl
new file mode 100644 (file)
index 0000000..050c14c
--- /dev/null
@@ -0,0 +1,41 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2008 Polytechnique.org                             *}
+{*  http://opensource.polytechnique.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 file="skin/common.doctype.tpl"}
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+    <link rel="stylesheet" type="text/css" href="css/base.css" media="all"/>
+    <link rel="stylesheet" type="text/css" href="css/igoogle.css" media="all"/>
+    <script type="text/javascript" src="javascript/ajax.js"></script>
+    <script type="text/javascript" src="javascript/base.js"></script>
+    <script type="text/javascript" src="javascript/igoogle.js"></script>
+    <script type="text/javascript" src="javascript/xorg.js"></script>
+    {foreach from=$gadget_js item=js}
+    <script type="text/javascript" src="{$js}"></script>
+    {/foreach}
+    <script type="text/javascript">var platal_baseurl = "{$globals->baseurl}/";</script>
+  </head>
+  <body onload="igOnLoadHandler();">
+{if $gadget_tpl}{include file=$gadget_tpl}{/if}
+  </body>
+</html>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}