Improvements
[infodrom.org/oldenburg.linux.de] / src / index.wml
index b838042..6751b75 100644 (file)
-#include "LUGO.style"
+#include <LUGO.style>
+#include <tools.inc>
 
-<PAGE>
+<?
+setlocale(LC_TIME, "de_DE");
 
-Die <em>Linux User Group Oldenburg</em> (LUGO) ist eine
-Interessengemeinschaft für Linux und Freie Software in und um <a
-href="http://www.oldenburg.de/">Oldenburg</a>.  Daraus hervorgegangen
-ist der <a href="http://www.ffis.de/">Verein zur Förderung Freier
-Informationen und Software e.V.</a> (ffis). Auf diesen Seiten finden
-sich Informationen rund um Linux und um die LUGO sowie deren
-Veranstaltungen. <p>
+$max_news = 2;
+$max_age = 7;
+$newsdir = "News";
+$datedb = "Termine/dates-".date("Y").".txt";
+$max_days = 14;
 
-Linux ist ein freier Unix-Clone f&uuml;r Rechner der Intel
-x86er-Klasse ab 80386 sowie weiterer Prozessorhersteller (Alpha,
-Sparc, PowerPC, PA-RISC, Motorola etc.).  Linux ist ein
-Betriebssystem, das echtes Multitasking und vernünftige
-Unterstützung für Multiuser-Umgebungen bietet.  Durch seine breite
-Hardwareunterst&uuml;tzung ist es f&uuml;r Privatanwender genauso
-interessant, wie f&uuml;r den gewerblichen Einsatz.  <p>
+function next_date()
+{
+  global $max_days;
+  global $datedb;
 
-<h3>Vorträge</h3>
+  $head = '<div class="news"><div class="datesbody"><h3 class="newstitle">%s</h3><div class="date">';
+  $head .= '<table class="font" cellpadding=2 cellspacing=0 width=100%%><tr class="head"><th>Wann</th><th>Was</th><th>Wo</th></tr>';
+  $foot = '</table></div></div></div>';
+  $row = '<tr class="%s"><td>%s</td><td>%s</td><td>%s</td></tr>';
+  $pivot = time() + 60*60*24*$max_days;
+  $now = mktime(0,0,0, date('m'), date('d'), date('Y'));
 
-Zusammen mit dem ffis e.V. und dem Hochschulrechenzentrum der <a
-href="http://www.uni-oldenburg.de/">Universit&auml;t Oldenburg</a>
-wird eine <a href="<url ffis-vortraege>">Vortragsreihe</a>
-veranstaltet, in der verschiedene Themen rund um Freie Software
-angesprochen werden.  &Uuml;ber eine rege Teilnahme w&uuml;rden wir
-uns freuen.  Anregungen und Themenvorschl&auml;ge werden an <mailto> geschickt.
+  if (($dates = @fopen($datedb,'r')) !== false) {
+    $lines = array();
+    while (!feof($dates)) {
+      $line = fgets($dates, 200);
 
-</PAGE>
+      if (!preg_match("/\|OL\|/", $line))
+       continue;
+
+      if (preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})\|/", $line, $match)) {
+       $when = mktime(0,0,0, $match[2], $match[3], $match[1]);
+       if ($when > $pivot || $when < $now)
+         continue;
+       $lines[] = $line;
+      }
+    }
+
+    if (count($lines)) {
+      sort($lines);
+      echo '<div style="padding-top: 10px"></div>'."\n";
+      printf($head."\n", "Kommende Termine in Oldenburg");
+
+      foreach ($lines as $line) {
+       if (preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})\|([^\|]*)\|OL\|([^\|]*)\|([^\|]*)\|(.*)/", $line, $match)) {
+         $when = mktime(0,0,0, $match[2], $match[3], $match[1]);
+
+         if ($when == $now) {
+           $date = '<strong>heute, ' . $match[4].'</strong>';
+           $class = 'today';
+         } else {
+           $date = strftime("%e.%m.%y", $when) . ', ' . $match[4];
+           $class = ($class == 'row0'?'row1':'row0');
+         }
+
+         if (empty($match[7]))
+           $what = $match[5];
+         else
+           $what = '<a href="'.$match[7].'">'.$match[5].'</a>';
+
+         printf($row, $class, $date, $what, $match[6]);
+       }
+      }
+      echo $foot;
+    }
+  }
+}
+function display_news($when, $file)
+{
+  global $newsdir;
+
+  $head = '<div class="news"><div class="newsbody"><h3 class="newstitle">%s</h3><div class="newscontent">';
+  $foot = '</div></div></div>';
+
+  $date = strftime("%e. %B %Y", $when);
+
+  if (($news = @fopen($newsdir.'/'.$file,'r')) !== false) {
+    $needp = 0;  // 0 = init, 1 = <p> need, 2 = no <p> needed
+
+    printf($head."\n", $date);
+    while (!feof($news)) {
+      $line = fgets($news, 200);
+
+      $line = str_replace ("\\\n", "", $line);
+
+      if ($needp == 0) {
+       if (substr($_, 0, 3) == "<p>") {
+         $needp = 2;
+       } else {
+         $needp = 1;
+         $line = '<p>'.$line;
+       }
+      }
+
+      echo $line;
+    }
+    if ($needp == 1)
+      echo '</p>';
+    echo $foot;
+  }
+}
+
+function newsbox()
+{
+  global $max_news;
+  global $max_age;
+  global $newsdir;
+
+  setlocale(LC_TIME, "de_DE");
+
+  $pivot = time() - 60*60*24*$max_age;
+  $news = array();
+  if (is_dir($newsdir)) {
+    if ($dir = opendir($newsdir)) {
+      while (($file = readdir($dir)) !== false) {
+       if (!preg_match("/news-([0-9]{4})-([0-9]{2})-([0-9]{2})\.txt/", $file, $matches))
+         continue;
+       $when = mktime(0,0,0, $matches[2], $matches[3], $matches[1]);
+       if ($when < $pivot)
+         continue;
+       $news[$when] = $file;
+      }
+      closedir($dir);
+    }
+  }
+
+  if (count($news)) {
+    echo '<div style="padding-top: 10px"></div>'."\n";
+
+    krsort($news);
+
+    $cnt = 0;
+    foreach ($news as $time => $file) {
+      if ($cnt >= $max_news)
+       continue;
+      display_news($time, $file);
+      $cnt++;
+    }
+  }
+}
+?>
+
+<page>
+
+<p>Die <strong>Linux User Group Oldenburg</strong> (LUGO) ist eine
+Interessengemeinschaft für GNU/Linux und Freie Software in und um <a
+href="http://www.oldenburg.de/">Oldenburg</a> in Niedersachsen.
+Wir <a href="Termine/">treffen</a> uns unregelmäßig auf dem
+Stammtisch und der <a href="http://www.linux-werkstatt-oldenburg.de/">Linux-Werkstatt</a>,
+reden über GNU/Linux und verbessern unsere Systeme.  Daneben veranstalten wir in unregelmäßigen Abständen Vorträge,
+Workshops, einen Brunch und eine öffentliche
+Ausstellung mit Vorträgen.  Aus der LUGO hervorgegangen
+ist der gemeinnützige <a href="http://www.ffis.de/">Verein zur
+Förderung Freier Informationen und Software e.V.</a>.</p>
+
+<?next_date()?>
+
+<p>Wir pflegen bewußt kein Web-Forum für Diskussionen sondern laden
+interessierte Anwender und Entwickler stattdessen ein, sich von
+Angesicht zu Angesicht mit uns auf unseren <a
+href="<root_prefix>Infos/stammtisch.html">Linux-Stammtischen</a> oder
+in der <a href="http://www.linux-werkstatt-oldenburg.de/">Linux-Werkstatt</a>
+zu unterhalten.  Zwischen den Stammtischen und für hartnäckige Probleme
+nutzen wir eine <a href="<root_prefix>Infos/liste.html">\ 
+Mailing-Liste</a>.</p>
+
+<p>
+<?newsbox()?>
+
+</page>
 
 # Local variables:
 # mode: html
 # mode: auto-fill
-# mode: iso-accents
 # end: