================================================================================
VERSION 0.9.16 XX XX 2007
+New:
+
+ * Carnet:
+ - List updated fields in notifications -FRU
+
================================================================================
VERSION 0.9.15 08 10 2007
if (empty($date)) {
$date = date('Y-m-d');
};
- XDB::execute('REPLACE INTO watch_ops (uid,cid,known,date,info) VALUES({?},{?},NOW(),{?},{?})',
- $uid, $cid, $date, $info);
+ XDB::execute('REPLACE INTO watch_ops (uid,cid,known,date,info)
+ VALUES ({?}, {?}, NOW(), {?}, {?})',
+ $uid, $cid, $date, $info);
if($cid == WATCH_FICHE) {
+ if ($info) {
+ register_profile_update($uid, $info);
+ }
XDB::execute('UPDATE auth_user_md5 SET DATE=NOW() WHERE user_id={?}', $uid);
} elseif($cid == WATCH_INSCR) {
XDB::execute('REPLACE INTO contacts (uid,contact)
}
// }}}
+// {{{
+
+global $prf_desc;
+$prf_desc = array('nom' => 'Son patronyme',
+ 'freetext' => 'Le texte libre',
+ 'mobile' => 'Son numéro de téléphone portable',
+ 'nationalite' => 'Sa nationalité',
+ 'nick' => 'Son surnom',
+ 'web' => 'L\'adresse de son site web',
+ 'appli1' => 'Son école d\'application',
+ 'appli2' => 'Son école de post-application',
+ 'addresses' => 'Ses adresses',
+ 'section' => 'Sa section sportive',
+ 'binets' => 'La liste de ses binets',
+ 'medals' => 'Ses décorations',
+ 'cv' => 'Son Curriculum Vitae',
+ 'jobs' => 'Ses informations professionnelles',
+ 'photo' => 'Sa photographie');
+
+function get_profile_change_details($event, $limit) {
+ global $prf_desc;
+ $res = XDB::iterRow("SELECT field
+ FROM watch_profile
+ WHERE uid = {?} AND ts > {?}
+ ORDER BY ts DESC",
+ $event['uid'], $limit);
+ if ($res->total() > 0) {
+ $data = array();
+ while (list($field) = $res->next()) {
+ $data[] .= $prf_desc[$field];
+ }
+ return '<ul><li>' . implode('</li><li>', $data) . '</li></ul>';
+ }
+ return null;
+}
+
+// }}}
+// {{{ function register_profile_update
+
+function register_profile_update($uid, $field) {
+ XDB::execute("REPLACE INTO watch_profile (uid, ts, field)
+ VALUES ({?}, NOW(), {?})",
+ $uid, $field);
+}
+
// {{{ class AllNotifs
class AllNotifs
// depuis la semaine dernière, meme ceux sans surveillance, ordonnés
$res = select_notifs(false, $uid, $lastweek);
while($tmp = $res->next()) {
+ if ($tmp['cid'] == WATCH_FICHE) {
+ $tmp['data'] = get_profile_change_details($tmp, $lastweek);
+ }
$this->_data[$tmp['cid']][$tmp['promo']][] = $tmp;
}
public function commit ()
{
- return XDB::execute('REPLACE INTO profile_medals_sub VALUES({?}, {?}, {?})', $this->uid, $this->mid, $this->gid);
+ require_once 'notifs.inc.php';
+ register_watch_op($this->uid, WATCH_FICHE, 'medals');
+ return XDB::execute('REPLACE INTO profile_medals_sub
+ VALUES ({?}, {?}, {?})',
+ $this->uid, $this->mid, $this->gid);
}
// }}}
public function commit()
{
+ require_once 'notifs.inc.php';
+ register_watch_op($this->uid, WATCH_FICHE, 'nom');
require_once('user.func.inc.php');
$this->bestalias = set_new_usage($this->uid, $this->nom_usage, $this->alias);
return true;
public function commit()
{
+ require_once 'notifs.inc.php';
XDB::execute('REPLACE INTO photo (uid, attachmime, attach, x, y)
VALUES ({?},{?},{?},{?},{?})',
$this->uid, $this->mimetype, $this->data, $this->x, $this->y);
- require_once('notifs.inc.php');
- register_watch_op($this->uid, WATCH_FICHE);
+ register_watch_op($this->uid, WATCH_FICHE, 'photo');
return true;
}
{
parent::__construct($wiz);
$this->settings['addresses'] = new ProfileAddress();
+ $this->watched['addresses'] = true;
}
protected function _fetchData()
parent::__construct($wiz);
$this->settings['medals'] = new ProfileDeco();
$this->settings['medals_pub'] = new ProfilePub();
+ $this->watched['medals'] = true;
}
protected function _fetchData()
$this->settings['appli1']
= $this->settings['appli2']
= new ProfileAppli();
+ $this->watched= array('nom' => true, 'freetext' => true, 'mobile' => true, 'web' => true,
+ 'appli1' => true, 'appli2' => true, 'nationalite' => true, 'nick' => true);
}
protected function _fetchData()
parent::__construct($wiz);
$this->settings['section'] = new ProfileSection();
$this->settings['binets'] = new ProfileGroup('binets', 'user_id', 'binet_id');
+ $this->watched['section'] = $this->watched['binets'] = true;
}
public function _prepare(PlatalPage &$page, $id)
parent::__construct($wiz);
$this->settings['cv'] = null;
$this->settings['jobs'] = new ProfileJob();
+ $this->watched['cv'] = $this->watched['jobs'] = true;
}
protected function _fetchData()
protected $settings = array(); // A set ProfileSetting objects
protected $errors = array(); // A set of boolean with the value check errors
protected $changed = array(); // A set of boolean indicating wether the value has been changed
+ protected $watched = array(); // A set of boolean indicating the fields that are watched
public $orig = array();
public $values = array();
protected function saveData()
{
+ require_once 'notifs.inc.php';
foreach ($this->settings as $field=>&$setting) {
if (!is_null($setting) && $this->changed[$field]) {
$setting->save($this, $field, $this->values[$field]);
}
+ if ($this->changed[$field] && @$this->watched[$field]) {
+ register_profile_update(S::i('uid'), $field);
+ }
}
$this->_saveData();
XDB::execute('REPLACE INTO user_changes
SET user_id = {?}', S::v('uid'));
if (!S::has('suid')) {
- require_once 'notifs.inc.php';
register_watch_op(S::i('uid'), WATCH_FICHE);
}
global $platal;
{foreach from=$c key=p item=promo}
{section name=row loop=$promo}
<tr {if ( $promo[row].known > $smarty.session.watch_last ) || ( $promo[row].date eq $today ) }style="font-weight: bold"{/if}>
- <td class='titre' style="width:15%">{if $smarty.section.row.first}{$p}{/if}</td>
+ <td class='titre' style="width:15%" {if $promo[row].data}rowspan="2"{/if}>{if $smarty.section.row.first}{$p}{/if}</td>
<td>
{if $promo[row].inscrit}
<a href="profile/{$promo[row].bestalias}" class="popup2">
{$promo[row].prenom} {$promo[row].nom}
{/if}
</td>
- <td style="width:25%">
+ <td style="width:25%" {if $promo[row].data}rowspan="2"{/if}>
{$promo[row].date|date_format}
</td>
+ {if $promo[row].data}
+ <tr><td>{$promo[row].data|smarty:nodefaults}</td></tr>
+ {/if}
</tr>
{/section}
{/foreach}
<link>{#globals.baseurl#}/profile/private/{$x.bestalias}</link>
<guid isPermaLink="false">carnet{$x.known}{$cid}{$x.bestalias}</guid>
<description><![CDATA[
+ {if $x.data}{$x.prenom} {$x.nom} a mis à jours les données suivantes :<br />{$x.data}<br />{/if}
{if !$x.contact and !$x.dcd}
<a href="{#globals.baseurl#}/carnet/contacts?action=ajouter&user={$x.bestalias}">
{icon name=add title="Ajouter" full=true} Ajouter à mes contacts
--- /dev/null
+create table watch_profile (
+ uid int(5) unsigned not null,
+ ts timestamp not null default CURRENT_TIMESTAMP,
+ field enum('nom', 'freetext', 'mobile', 'nationalite', 'nick', 'web', 'appli1', 'appli2',
+ 'addresses', 'section', 'binets', 'medals', 'cv', 'jobs', 'photo'),
+
+ primary key field (uid, field)
+) charset=utf8;
+
+# vim:set syntax=mysql:
--- /dev/null
+#!/bin/bash
+
+. ../inc/pervasive.sh
+
+mailman_stop
+mailman_templates
+mailman_start
+
+
+###########################################################
+for sql in *.sql
+do
+ echo -n $sql
+ $MYSQL x4dat < $sql &>/dev/null || echo -n " ERROR"
+ echo .
+done
+
+###########################################################
+
+echo "we will now upgrade the search table (this may be a long operation)
+
+please hit ^D to continue
+"
+
+cat
+
+pushd ../../bin
+./search.rebuild_db.php
+popd
+
+###########################################################
+