* Emails:
- #595: Update antispam description -FRU
+ * Newsletter:
+ - #648: Add navigation link in preview page -FRU
+ - #649: Fix layout of preview page -FRU
+
* Profile:
- Better checks on image type for photos -FRU
- #646: Don't send a mail to an invalid address -FRU
public $_head;
- function __construct($tpl, $css, $prefix)
+ protected $_table;
+ protected $_subscriptionTable;
+
+ function __construct($tpl, $css, $prefix, $tbl, $stbl)
{
$this->_tpl = $tpl;
$this->_css = $css;
$this->_prefix = $prefix;
+ $this->_table = $tbl;
+ $this->_subscriptionTable = $stbl;
}
public function id()
return is_null($this->_shortname) ? $this->_id : $this->_shortname;
}
+ private function selectId($where)
+ {
+ $res = XDB::query("SELECT IF (n.short_name IS NULL, n.id, n.short_name)
+ FROM {$this->_table} AS n
+ WHERE n.bits != 'new' AND {$where}
+ LIMIT 1");
+ if ($res->numRows() != 1) {
+ return null;
+ }
+ return $res->fetchOneCell();
+ }
+
+ public function prev()
+ {
+ static $val;
+ if (!isset($val)) {
+ $val = $this->selectId("n.id < {$this->_id} ORDER BY n.id DESC");
+ }
+ return $val;
+ }
+
+ public function next()
+ {
+ static $val;
+ if (!isset($val)) {
+ $val = $this->selectId("n.id > {$this->_id} ORDER BY n.id");
+ }
+ return $val;
+ }
+
+ public function last()
+ {
+ static $val;
+ if (!isset($val)) {
+ $res = XDB::query("SELECT MAX(n.id)
+ FROM {$this->_table} AS n
+ WHERE n.bits != 'new' AND n.id > {?}",
+ $this->_id);
+ if ($res->numRows() != 1) {
+ $val = null;
+ } else {
+ $val = $res->fetchOneCell();
+ }
+ }
+ return $val;
+ }
+
public function title($mail = false)
{
return $mail ? $this->_title_mail : $this->_title;
u.prenom, IF(u.nom_usage='', u.nom, u.nom_usage),
FIND_IN_SET('femme', u.flags),
q.core_mail_fmt AS pref, 0 AS hash
- FROM {$this->subscriptionTable()} AS ni
+ FROM {$this->_subscriptionTable} AS ni
INNER JOIN auth_user_md5 AS u USING(user_id)
INNER JOIN auth_user_quick AS q ON(q.user_id = u.user_id)
INNER JOIN aliases AS a ON(u.user_id=a.id AND FIND_IN_SET('bestalias',a.flags))
$sent[] = "(user_id='$uid'" . (!$uid ? " AND email='$bestalias')": ')');
$this->sendTo($prenom, $nom, $bestalias, $sexe, $fmt=='html', $hash);
}
- XDB::execute("UPDATE {$this->subscriptionTable()}
+ XDB::execute("UPDATE {$this->_subscriptionTable}
SET last = {?}
WHERE " . implode(' OR ', $sent), $this->_id);
abstract protected function assignData(&$smarty);
abstract protected function setSent();
- abstract protected function subscriptionTable();
abstract protected function subscriptionWhere();
}
function __construct($id = null)
{
- parent::__construct('newsletter/nl.tpl', 'nl.css', 'nl/show');
+ parent::__construct('newsletter/nl.tpl', 'nl.css', 'nl/show', 'newsletter', 'newsletter_ins');
if (isset($id)) {
if ($id == 'last') {
$res = XDB::query("SELECT MAX(id) FROM newsletter WHERE bits!='new'");
VALUES ({?}, 0)", $user);
}
- protected function subscriptionTable()
- {
- return 'newsletter_ins';
- }
-
protected function subscriptionWhere()
{
return '1';
function __construct($id)
{
- parent::__construct('axletter/letter.tpl', 'ax.css', 'ax/show');
+ parent::__construct('axletter/letter.tpl', 'ax.css', 'ax/show', 'axletter', 'axletter_ins');
$this->_head = '<cher> <prenom>,';
if (!is_array($id)) {
return XDB::execute("DELETE FROM axletter_rights WHERE user_id = {?}", $uid);
}
- protected function subscriptionTable()
- {
- return 'axletter_ins';
- }
-
protected function subscriptionWhere()
{
if (!$this->_promo_min && !$this->_promo_max) {
{* *}
{**************************************************************************}
-<h1>
+<h1 style="clear: both">
{if $am->_date}
Lettre de l'AX du {$am->_date|date_format}
{else}
{/if}
</h1>
-<p>
-[<a href='ax'>liste des lettres</a>]
+<p style="float: left">
{if $smarty.get.text}
[<a href='{$platal->pl_self()}'>version HTML</a>]
{else}
{/if}
</p>
+{include file="include/massmailer-nav.tpl" mm=$am base=ax}
+
<form method="post" action="{$platal->path}">
- <div class='center'>
+ <div class='center' style="clear: both">
<input type='submit' value="me l'envoyer" name='send' />
</div>
</form>
-<fieldset>
-<legend>{$am->title(true)}</legend>
- {include file="axletter/letter.tpl"}
+<table class="bicol">
+ <tr><th>{$am->title(true)}</th></tr>
+ <tr>
+ <td>
+ {include file="axletter/letter.tpl"}
+ </td>
+ </tr>
</fieldset>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 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 *}
+{* *}
+{**************************************************************************}
+
+<table style="float: right; text-align: center" id="letter_nav">
+ <tr>
+ {if $mm->prev() neq null}
+ <td rowspan="2" style="vertical-align: middle">
+ <a href="{$base}/show/{$mm->prev()}">
+ {icon name=resultset_previous title="Lettre précédente"}Lettre précédente
+ </a>
+ </td>
+ {/if}
+ <td>
+ [<a href="{$base}">Liste des lettres</a>]
+ </td>
+ {if $mm->next() neq null}
+ <td rowspan="2" style="vertical-align: middle">
+ <a href="{$base}/show/{$mm->next()}">
+ Lettre suivante{icon name=resultset_next title="Lettre suivante"}
+ </a>
+ </td>
+ {/if}
+ </tr>
+ {if $mm->last() neq null}
+ <tr>
+ <td>
+ <a href="{$base}/show/{$mm->last()}">
+ <img src="images/up.png" alt="" title="Liste des lettres" />Dernière lettre<img src="images/up.png" alt="" title="Liste des lettres" />
+ </a>
+ </td>
+ </tr>
+ {/if}
+</table>
+
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{* *}
{**************************************************************************}
-<h1>
+<h1 style="clear: both">
Lettre de Polytechnique.org du {$nl->_date|date_format}
</h1>
-<p>
-[<a href='nl'>liste des lettres</a>]
-{if $smarty.get.text}
-[<a href='nl/show/{$nl->id()}'>version HTML</a>]
-{else}
-[<a href='nl/show/{$nl->id()}?text=1'>version Texte</a>]
-{/if}
-{if $smarty.session.perms->hasFlag('admin')}
-[<a href='admin/newsletter/edit/{$nl->id()}'>Editer</a>]
-{/if}
+<p style="float: left">
+ {if $smarty.get.text}
+ [<a href='nl/show/{$nl->id()}'>version HTML</a>]
+ {else}
+ [<a href='nl/show/{$nl->id()}?text=1'>version Texte</a>]
+ {/if}
+ {if $smarty.session.perms->hasFlag('admin')}
+ [<a href='admin/newsletter/edit/{$nl->id()}'>Editer</a>]
+ {/if}
</p>
+{include file="include/massmailer-nav.tpl" mm=$nl base=nl}
+
<form method="post" action="{$platal->path}">
- <div class='center'>
+ <div class='center' style="clear: both">
<input type='submit' value="me l'envoyer" name='send' />
</div>
</form>
-<fieldset>
-<legend>{$nl->title(true)}</legend>
- {include file="newsletter/nl.tpl"}
-</fieldset>
+<table class="bicol">
+ <tr><th>{$nl->title(true)}</th></tr>
+ <tr>
+ <td>
+ {include file="newsletter/nl.tpl"}
+ </td>
+ </tr>
+</table>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}