Add a new special tip to announce the upgrade of the site
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 27 Feb 2007 17:29:48 +0000 (17:29 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 27 Feb 2007 17:29:48 +0000 (17:29 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1527 839d8a87-29fc-0310-9880-83ba4fa771e5

include/xorg/session.inc.php
modules/events.php
modules/profile.php
templates/include/tips.tpl
upgrade/0.9.14/02_auth_user_quick.tpl [new file with mode: 0644]

index 9669564..a5383b3 100644 (file)
@@ -225,7 +225,7 @@ function start_connexion ($uid, $identified)
     SELECT  u.user_id AS uid, prenom, nom, perms, promo, matricule, password, FIND_IN_SET('femme', u.flags) AS femme,
                 UNIX_TIMESTAMP(s.start) AS lastlogin, s.host, a.alias AS forlife, a2.alias AS bestalias,
                 q.core_mail_fmt AS mail_fmt, UNIX_TIMESTAMP(q.banana_last) AS banana_last, q.watch_last, q.core_rss_hash,
-                FIND_IN_SET('watch', u.flags) AS watch_account
+                FIND_IN_SET('watch', u.flags) AS watch_account, q.last_version
           FROM  auth_user_md5   AS u
     INNER JOIN  auth_user_quick AS q  USING(user_id)
     INNER JOIN  aliases         AS a  ON (u.user_id = a.id AND a.type='a_vie')
index 3601aef..96885f8 100644 (file)
@@ -37,6 +37,26 @@ class EventsModule extends PLModule
 
     function get_tips($exclude = null)
     {
+        global $globals;
+        // Add a new special tip when changing plat/al version
+        if ($globals->version != S::v('last_version') && is_null($exclude)) {
+            XDB::execute('UPDATE auth_user_quick
+                             SET last_version = {?}
+                           WHERE user_id = {?}',
+                           $globals->version, S::i('uid'));
+            return array('id' => 0,
+                         'titre' => 'Bienvenue sur la nouvelle version du site !',
+                         'text' => 'Le site a été mis à jour depuis ta dernière visite vers la version ' . $globals->version
+                                   . '. Nous t\'invitons à en découvrir les nouveautés en te rendant sur '
+                                   . '<a href="banana/xorg.m4x.innovation">nos forums</a> ou en consultant '
+                                   . '<a href="changelog">la liste exhaustive des modifications</a>',
+                         'priorite' => 255,
+                         'promo_min' => 0,
+                         'promo_max' => 0,
+                         'state'     => 'active',
+                         'special'   => true);
+        }
+
         $exclude  = is_null($exclude) ? '' : ' AND id != ' . $exclude . ' ';
         $priority = rand(0, 510);
         do {
index 75ea8a3..fccc738 100644 (file)
@@ -259,6 +259,7 @@ class ProfileModule extends PLModule
         $page->assign('virtualalias', $res->fetchOneCell());
 
         $page->addJsLink('close_on_esc.js');
+        header('Last-Modified: ' . date('r', strtotime($user['date'])));
     }
 
     function handler_p_edit(&$page, $opened_tab = 'general')
index 43b8b3a..27b2ccf 100644 (file)
 {if $full}
 <fieldset id="tod">
 {/if}
-  <legend>{icon name=lightbulb}Astuce&nbsp;: {$tips.titre}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+  <legend>{icon name=lightbulb}{if !$tips.special}
+    Astuce&nbsp;: {$tips.titre}
+  {else}
+    <span style="color: red; font-weight: bold;">{$tips.titre}</span>
+  {/if}
   {if !$nochange}
-  <a href="" onclick="Ajax.update_html('tod', 'ajax/tips/{$tips.id}'); return false">
+  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="" onclick="Ajax.update_html('tod', 'ajax/tips/{$tips.id}'); return false">
     {icon name=resultset_next title="Astuce suivante"}
   </a>
   {/if}
diff --git a/upgrade/0.9.14/02_auth_user_quick.tpl b/upgrade/0.9.14/02_auth_user_quick.tpl
new file mode 100644 (file)
index 0000000..b7bd154
--- /dev/null
@@ -0,0 +1,3 @@
+alter table auth_user_quick add column last_version varchar(16) not null default '0.9.13';
+
+# vim:set syntax=mysql: