From 5dfdc90473a79c26c971b4ac4df17d453e91b0ba Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 10 May 2009 23:40:45 +0200 Subject: [PATCH] Adds ml reminder. --- include/reminder/ml.inc.php | 100 ++++++++++++++++++++++++++++++++++++++++++++ templates/reminder/ml.tpl | 54 ++++++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 include/reminder/ml.inc.php create mode 100644 templates/reminder/ml.tpl diff --git a/include/reminder/ml.inc.php b/include/reminder/ml.inc.php new file mode 100644 index 0000000..2e8deec --- /dev/null +++ b/include/reminder/ml.inc.php @@ -0,0 +1,100 @@ +next()) { + if (array_shift($subs) == "$sub@$domain") { + list($sub, $domain) = explode('@', $list); + if ($domain != $current_domain) { + $current_domain = $domain; + $client = new MMList(S::v('uid'), S::v('password'), $domain); + } + $client->subscribe($sub); + } + } + + $this->UpdateOnYes(); + pl_redirect('lists'); + break; + + case 'dismiss': + $this->UpdateOnDismiss(); + break; + + case 'no': + $this->UpdateOnNo(); + break; + } + } + + protected function GetDisplayText() {} + + public function Display(&$page) + { + header('Content-Type: text/html; charset=utf-8'); + $page->changeTpl('reminder/ml.tpl', NO_SKIN); + $page->assign('baseurl', $this->GetBaseUrl()); + + $res = XDB::iterRow("SELECT sub, domain + FROM register_subs + WHERE uid = {?} AND type = 'list' + ORDER BY domain", + S::i('uid')); + $current_domain = null; + $lists = array(); + while (list($sub, $domain) = $res->next()) { + if ($current_domain != $domain) { + $current_domain = $domain; + $client = new MMList(S::v('uid'), S::v('password'), $domain); + } + list($details, ) = $client->get_members($sub); + $lists["$sub@$domain"] = $details; + } + $page->assign_by_ref('lists', $lists); + } + + public static function IsCandidate(User &$user) + { + $res = XDB::execute("SELECT COUNT(*) AS lists + FROM register_subs + WHERE uid = {?} AND type = 'list'", + $user->id()); + + return $res->fetchOneCell(); + } +} + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: +?> diff --git a/templates/reminder/ml.tpl b/templates/reminder/ml.tpl new file mode 100644 index 0000000..a431fe7 --- /dev/null +++ b/templates/reminder/ml.tpl @@ -0,0 +1,54 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2009 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 *} +{* *} +{**************************************************************************} + +
+ + + {icon name=cross title="Cacher cet avertissement."} + + +
+ {xsrf_token_field} + Des camarades souhaitent que tu t'inscrives aux listes suivantes : +
+ {foreach from=$lists key=list item=details} +
+ +
+ {if $details.info} +
+ {$details.info|nl2br} +
+ {/if} + {/foreach} +
+ +
+ [ + {icon name=delete} Ne pas m'inscrire à ces listes de diffusion. + ] +
+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} -- 2.1.4