code factorization
authorx2000habouzit <x2000habouzit>
Mon, 20 Sep 2004 21:31:29 +0000 (21:31 +0000)
committerx2000habouzit <x2000habouzit>
Mon, 20 Sep 2004 21:31:29 +0000 (21:31 +0000)
templates/listes/index.tpl
templates/listes/listes.inc.tpl [new file with mode: 0644]
templates/listes/moderate.tpl

index 3684c25..ed7cbd7 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: index.tpl,v 1.3 2004-09-20 20:37:15 x2000habouzit Exp $
+        $Id: index.tpl,v 1.4 2004-09-20 21:31:29 x2000habouzit Exp $
  ***************************************************************************}
 
 <div class="rubrique">
@@ -62,80 +62,21 @@ NB : les gestionnaires d'une liste sont aussi ses mod
   Listes de diffusion publiques
 </div>
 
-<table class='bicol' cellpadding='0' cellspacing='0'>
-  <tr>
-    <th>Liste</th>
-    <th>Description</th>
-    <th>Diffusion</th>
-    <th>Inscription</th>
-  </tr>
-  {foreach from=$listes item=liste}
-  {if $liste.priv eq 0}
-  <tr class='{cycle values="impair,pair"}'>
-    <td>
-      <a href='liste.php?liste={$liste.list}'>{$liste.list}</a>
-      {if $liste.you>1}[<a href='moderate.php?liste={$liste.list}'>mod</a>]{/if}
-    </td>
-    <td>{$liste.desc}</td>
-    <td class='center'>{if $liste.diff}modérée{else}libre{/if}</td>
-    <td class='right'>{if $liste.you is odd}désinscription{elseif $liste.ins}ins modérée{else}inscription{/if}</td>
-  </tr>
-  {/if}
-  {/foreach}
-</table>
+{include file='listes/listes.inc.tpl' min=0}
 
 <div class="rubrique">
   Listes de diffusion privées
 </div>
 
-<table class='bicol' cellpadding='0' cellspacing='0'>
-  <tr>
-    <th>Liste</th>
-    <th>Description</th>
-    <th>Diffusion</th>
-    <th>Inscription</th>
-  </tr>
-  {foreach from=$listes item=liste}
-  {if $liste.priv eq 1}
-  <tr class='{cycle values="impair,pair"}'>
-    <td>
-      <a href='liste.php?liste={$liste.list}'>{$liste.list}</a>
-      {if $liste.you>1}[<a href='moderate.php?liste={$liste.list}'>mod</a>]{/if}
-    </td>
-    <td>{$liste.desc}</td>
-    <td class='center'>{if $liste.diff}modérée{else}libre{/if}</td>
-    <td class='right'>{if $liste.you is odd}désinscription{elseif $liste.ins}ins modérée{else}inscription{/if}</td>
-  </tr>
-  {/if}
-  {/foreach}
-</table>
+{include file='listes/listes.inc.tpl' min=1}
 
 {perms level=admin}
 <div class="rubrique">
   Listes d'administration
 </div>
 
-<table class='bicol' cellpadding='0' cellspacing='0'>
-  <tr>
-    <th>Liste</th>
-    <th>Description</th>
-    <th>Diffusion</th>
-    <th>Inscription</th>
-  </tr>
-  {foreach from=$listes item=liste}
-  {if $liste.priv > 1}
-  <tr class='{cycle values="impair,pair"}'>
-    <td>
-      <a href='liste.php?liste={$liste.list}'>{$liste.list}</a>
-      {if $liste.you>1}[<a href='moderate.php?liste={$liste.list}'>mod</a>]{/if}
-    </td>
-    <td>{$liste.desc}</td>
-    <td class='center'>{if $liste.diff}modérée{else}libre{/if}</td>
-    <td class='right'>{if $liste.you is odd}désinscription{elseif $liste.ins}ins modérée{else}inscription{/if}</td>
-  </tr>
-  {/if}
-  {/foreach}
-</table>
+{include file='listes/listes.inc.tpl' min=2 max=4}
+
 {/perms}
 
 {/dynamic}
diff --git a/templates/listes/listes.inc.tpl b/templates/listes/listes.inc.tpl
new file mode 100644 (file)
index 0000000..a0fd164
--- /dev/null
@@ -0,0 +1,55 @@
+{***************************************************************************
+ *  Copyright (C) 2003-2004 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                *
+ ***************************************************************************
+        $Id: listes.inc.tpl,v 1.1 2004-09-20 21:31:29 x2000habouzit Exp $
+ ***************************************************************************}
+
+<form action='{$smarty.server.PHP_SELF}'>
+  <table class='bicol' cellpadding='0' cellspacing='0'>
+    <tr>
+      <th>Liste</th>
+      <th>Description</th>
+      <th>Diffusion</th>
+      <th>Inscription</th>
+    </tr>
+    {foreach from=$listes item=liste}
+    {if $liste.priv >= $min && $liste.priv <= $max|default:$min}
+    <tr class='{cycle values="impair,pair"}'>
+      <td>
+        <a href='liste.php?liste={$liste.list}'>{$liste.list}</a>
+        {if $liste.you>1}[<a href='moderate.php?liste={$liste.list}'>mod</a>]{/if}
+      </td>
+      <td>{$liste.desc}</td>
+      <td class='center'>{if $liste.diff}modérée{else}libre{/if}</td>
+      <td class='right'>
+        {if $liste.you is odd}
+        {if $liste.ins}inscrit{/if} <input type='checkbox' checked='checked' name='{$liste.desc}' />
+        {elseif $liste.ins}
+        <input type='submit' name='{$liste.desc}' value='demander' />
+        {else}
+        <input type='checkbox' name='{$liste.desc}' />
+        {/if}
+      </td>
+    </tr>
+    {/if}
+    {/foreach}
+  </table>
+</form>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
index 5e18b43..771fa66 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: moderate.tpl,v 1.1 2004-09-20 20:04:38 x2000habouzit Exp $
+        $Id: moderate.tpl,v 1.2 2004-09-20 21:31:29 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
   Inscriptions en attente de modération
 </div>
 
+{if $subs|@count}
+{else}
+<p>pas d'inscriptions en attente de modération</p>
+{/if}
+
+{if $mails|@count}
 <div class='rubrique'>
   Mails en attente de modération
 </div>
@@ -56,6 +62,9 @@
   </tr>
   {/foreach}
 </table>
+{else}
+<p>pas de mails en attente de modération</p>
+{/if}
 
 {/if}