more work on lists archives.
authorx2000habouzit <x2000habouzit>
Mon, 29 Nov 2004 21:42:07 +0000 (21:42 +0000)
committerx2000habouzit <x2000habouzit>
Mon, 29 Nov 2004 21:42:07 +0000 (21:42 +0000)
see http://dev.m4x.org/~x2000habouzit/listes/archives.php?liste=foofoo

htdocs/listes/archives.php
install.d/lists/platal.mrc
templates/listes/archives.tpl

index 2f5116b..1ae5176 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: archives.php,v 1.1 2004-11-28 22:51:28 x2000habouzit Exp $
+        $Id: archives.php,v 1.2 2004-11-29 21:42:07 x2000habouzit Exp $
  ***************************************************************************/
 
 if(empty($_REQUEST['liste'])) header('Location: index.php');
@@ -31,8 +31,20 @@ require_once('xml-rpc-client.inc.php');
 $client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
 
 if (list($det) = $client->get_members($liste)) {
-    $file = isset($_GET['file']) ? $_GET['file'] : "dates.html";
-    $page->assign('url', $globals->lists->spool."/polytechnique.org-$liste/$file");
+    if (isset($_GET['file'])) {
+        $file = $_GET['file'];
+        $rep  = $_GET['rep'];
+        $page->assign('url', $globals->lists->spool."/polytechnique.org-$liste/$rep/$file");
+    } else {
+        $archs = Array();
+        foreach (glob($globals->lists->spool."/polytechnique.org-$liste/*/*") as $rep) {
+            if (preg_match(",/(\d*)/(\d*)$,", $rep, $matches)) {
+                $archs[intval($matches[1])][intval($matches[2])] = true;
+            }
+        }
+        $page->assign('archs', $archs);
+        $page->assign('range', range(1,12));
+    }
 } else
     $page->assign('no_list',true);
 
index 6dc287c..8446a93 100644 (file)
@@ -36,7 +36,12 @@ m2h_text_plain::filter; fancyquote maxwidth=80 quoteclass=quote
 
 <DefineVar>
 MY-LINK
-?liste={$$smarty.request.liste}&amp;file=
+?liste={$$smarty.request.liste}&amp;rep={$$smarty.request.rep}&amp;file=
+</DefineVar>
+
+<DefineVar>
+TOP-ARCH
+<p>[<a href="?liste={$$smarty.request.liste}">toutes les archives</a>]</p>
 </DefineVar>
 
 <DefineVar>
@@ -163,6 +168,7 @@ MY-SUBJNA
 
 <TopLinks>
     <h1>Vue de message</h1>
+    $TOP-ARCH$
     <table class='bicol' cellpadding="0" cellspacing="0">
     <tr>
       <th>fil&nbsp;précédent</th>
@@ -266,6 +272,7 @@ subject:strong
 
 <THead>
     <h1>Archives de la liste {$$smarty.request.liste} ($PAGENUM$/$NUMOFPAGES$)</h1>
+    $TOP-ARCH$
     <table class='bicol' cellpadding="0" cellspacing="0">
     <tr>
       <th>&nbsp;</th>
@@ -442,6 +449,7 @@ date
 
 <ListBegin>
     <h1>Archives de la liste {$$smarty.request.liste} ($PAGENUM$/$NUMOFPAGES$)</h1>
+    $TOP-ARCH$
     <table class='bicol' cellpadding="0" cellspacing="0">
     <tr>
       <th>&nbsp;</th>
index e78faab..99f98de 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: archives.tpl,v 1.1 2004-11-28 22:51:29 x2000habouzit Exp $
+        $Id: archives.tpl,v 1.2 2004-11-29 21:42:08 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
 
 {include file="listes/header_listes.tpl" on=archives}
 
+
+{if $archs}
+<h1>Archives de la liste {$smarty.request.liste}</h1>
+<table class="tinybicol" cellspacing="0" cellpadding="0">
+  <tr>
+    <th>Année</th>
+    <th colspan="6">
+      Mois
+    </th>
+  </tr>
+  {foreach from=$archs item=m key=y}
+  <tr class="center">
+    <td class="titre" rowspan="2">{$y}</td>
+    {foreach from=$range item=i}
+    <td>
+      {if $m[$i]}
+      [<a href="?liste={$smarty.request.liste}&amp;rep={$y}/{$i|string_format:"%02u"}&amp;file=dates.html">{"0000-$i-01"|date_format:"%b"}</a>]
+      {else}
+      [&nbsp;&nbsp;&nbsp;]
+      {/if}
+    </td>
+    {if $i eq 6}</tr><tr class="center">{/if}
+    {/foreach}
+  </tr>
+  {/foreach}
+</table>
+{elseif $url}
 {include file="$url"}
+{/if}
 
 {/if}