Copied the current set of files for the new year.
authorJoey Schulze <joey@infodrom.org>
Wed, 16 Jul 2003 21:44:50 +0000 (21:44 +0000)
committerJoey Schulze <joey@infodrom.org>
Wed, 16 Jul 2003 21:44:50 +0000 (21:44 +0000)
47 files changed:
src/LinuxTag/2004/edit.style [new file with mode: 0644]
src/LinuxTag/2004/functions.inc [new file with mode: 0644]
src/LinuxTag/2004/index.wml [new file with mode: 0644]
src/LinuxTag/2004/nili/index.wml [new file with mode: 0644]
src/LinuxTag/2004/nili/submenu.inc [new file with mode: 0644]
src/LinuxTag/2004/phpfunctions.inc [new file with mode: 0644]
src/LinuxTag/2004/projects/accounts.wml [new file with mode: 0644]
src/LinuxTag/2004/projects/admins.wml [new file with mode: 0644]
src/LinuxTag/2004/projects/edit.wml [new file with mode: 0644]
src/LinuxTag/2004/projects/edit_comment.wml [new file with mode: 0644]
src/LinuxTag/2004/projects/edit_person.wml [new file with mode: 0644]
src/LinuxTag/2004/projects/edit_url.wml [new file with mode: 0644]
src/LinuxTag/2004/projects/index.wml [new file with mode: 0644]
src/LinuxTag/2004/projects/infomail.wml [new file with mode: 0644]
src/LinuxTag/2004/projects/infomail_recipient.wml [new file with mode: 0644]
src/LinuxTag/2004/projects/infomail_send.wml [new file with mode: 0644]
src/LinuxTag/2004/projects/phptools.inc [new file with mode: 0644]
src/LinuxTag/2004/projects/show.wml [new file with mode: 0644]
src/LinuxTag/2004/projects/submenu.inc [new file with mode: 0644]
src/LinuxTag/2004/projects/update.wml [new file with mode: 0644]
src/LinuxTag/2004/submenu.inc [new file with mode: 0644]
src/LinuxTag/2004/supporter/accounts.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/availability.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/edit.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/edit_comment.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/edit_job.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/index.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/infomail.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/infomail_recipient.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/infomail_send.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/job.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/jobs.inc [new file with mode: 0644]
src/LinuxTag/2004/supporter/jobs.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/open.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/submenu.inc [new file with mode: 0644]
src/LinuxTag/2004/supporter/supporter.wml [new file with mode: 0644]
src/LinuxTag/2004/supporter/update.wml [new file with mode: 0644]
src/LinuxTag/2004/todo/edit.wml [new file with mode: 0644]
src/LinuxTag/2004/todo/index.wml [new file with mode: 0644]
src/LinuxTag/2004/todo/show.wml [new file with mode: 0644]
src/LinuxTag/2004/todo/submenu.inc [new file with mode: 0644]
src/LinuxTag/2004/todo/update.wml [new file with mode: 0644]
src/LinuxTag/2004/workshops/edit.wml [new file with mode: 0644]
src/LinuxTag/2004/workshops/index.wml [new file with mode: 0644]
src/LinuxTag/2004/workshops/submenu.inc [new file with mode: 0644]
src/LinuxTag/2004/workshops/update.wml [new file with mode: 0644]
src/LinuxTag/years.inc

diff --git a/src/LinuxTag/2004/edit.style b/src/LinuxTag/2004/edit.style
new file mode 100644 (file)
index 0000000..02fab1e
--- /dev/null
@@ -0,0 +1,172 @@
+# A horizontal checkbox fitting the table
+# <row_checkbox        title="<b>Wednesday</b>"
+#              name=dinner-07-04
+#              descr="Dinner&nbsp;&nbsp;&nbsp;: "
+#              checked="<? if ($row['list']==1) { echo \"checked\";} ?>"
+#              >
+<define-tag row_checkbox>
+<preserve title descr name checked value>
+<set-var %attributes>
+
+<if <not <get-var title>>
+  <set-var title="&nbsp;">>
+<if <not <get-var descr>>
+  <set-var descr="&nbsp;">>
+<if <not <get-var value>>
+  <set-var value="1">>
+
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><get-var title></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial">
+<input name=<get-var name> type=checkbox value="<get-var value>" <get-var checked>>&nbsp;<get-var descr>
+</font></td></tr>
+
+<restore title descr name checked value>
+</define-tag>
+
+# A horizontal radiobox fitting the table
+# <row_radiobox        title="<b>Night</b>"
+#              name=night
+#              descr_0=no  [optional]
+#              descr_1=yes [optional]
+#              checked_0="<? if ($row['night']==0) { echo \"checked\";} ?>"
+#              checked_1="<? if ($row['night']==1) { echo \"checked\";} ?>"
+#              >
+<define-tag row_radiobox>
+<preserve title descr_0 descr_1 name checked_0 checked_1>
+<set-var %attributes>
+
+<if <not <get-var title>>
+  <set-var title="&nbsp;">>
+<if <not <get-var descr_0>>
+  <set-var descr_0="no">>
+<if <not <get-var descr_1>>
+  <set-var descr_1="yes">>
+
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><get-var title></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial">
+<input name=<get-var name> type=radio value="0" <get-var checked_0>> <get-var descr_0>
+<input name=<get-var name> type=radio value="1" <get-var checked_1>> <get-var descr_1>
+</font></td></tr>
+
+<restore title descr_0 descr_1 name checked_0 checked_1>
+</define-tag>
+
+# A horizontal input line fitting the table
+# <row_input   name=name
+#              title="<b>Name</b>"
+#              value="<? echo $row['name']; ?>"
+#              size=50   (optional)
+#              maxlength=100   (optional)
+#              >
+<define-tag row_input>
+<preserve title name value size maxlength>
+<set-var %attributes>
+
+<if <not <get-var title>>
+  <set-var title="&nbsp;">>
+<if <not <get-var size>>
+  <set-var size="50">>
+<if <not <get-var maxlength>>
+  <set-var maxlength="100">>
+
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><get-var title></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial"><input name=<get-var name> value="<get-var value>" size=<get-var size> maxlength=<get-var maxlength>></font></td></tr>
+
+<restore title name value size maxlength>
+</define-tag>
+
+# A horizontal line with some text fitting the table
+# <row_info    title="<b>Name</b>"
+#              value="<? echo $row['name']; ?>"
+#              >
+<define-tag row_info>
+<preserve title value name>
+<set-var %attributes>
+
+<if <not <get-var title>>
+  <set-var title="&nbsp;">>
+
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><get-var title></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial"><get-var value></font>
+<input type=hidden name=<get-var name> value="<get-var value>">
+</td></tr>
+
+<restore title value name>
+</define-tag>
+
+# A textarea input field fitting the table
+# <row_textarea        name=name
+#              title="<b>Name</b>"
+#              value="<? echo $row['name']; ?>"
+#              cols=47   (optional)
+#              rows=5    (optional)
+#              >
+<define-tag row_textarea>
+<preserve title name value rows cols>
+<set-var %attributes>
+
+<if <not <get-var title>>
+  <set-var title="&nbsp;">>
+<if <not <get-var cols>>
+  <set-var cols="47">>
+<if <not <get-var rows>>
+  <set-var rows="5">>
+
+<tr><td align=right valign=top bgcolor="<colh>"><font face="Helvetica,Arial"><get-var title></font></td>
+<td valign=top bgcolor="<cold>"><font face="Helvetica,Arial"><textarea name=<get-var name> cols=<get-var cols> rows=<get-var rows>><get-var value></textarea></font></td></tr>
+
+<restore title name value rows cols>
+</define-tag>
+
+# A simple submit/reset button
+# <row_submit>
+<define-tag row_submit>
+<tr>
+<td colspan=2 align=center bgcolor="<cold>"><font face="Helvetica,Arial"><b><input type=submit value="<?echo $oid?"Change":"Submit";?>"> <input type=reset value="Reset"></b></font></td></tr>
+</define-tag>
+
+# A simple submit/reset button
+# <row_submit_plain>
+<define-tag row_submit_plain>
+<tr>
+<td colspan=2 align=center bgcolor="<cold>"><font face="Helvetica,Arial"><b><input type=submit value="Submit"> <input type=reset value="Reset"></b></font></td></tr>
+</define-tag>
+
+<define-tag row_delim>
+<preserve msg>
+<set-var %attributes>
+
+<tr>
+<td colspan=2 align=left bgcolor="<cold>"><font face="Helvetica,Arial"><get-var msg></font></td></tr>
+
+<restore msg>
+</define-tag>
+
+<define-tag row_select>
+<?
+  function row_select ($title, $name, $choices, $value, $empty)
+  {
+    $head = '<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><b>%s</b></font></td>'
+          .'<td bgcolor="<cold>"><font face="Helvetica,Arial"><select name="%s">';
+    $foot = '</select>'
+          .'</font></td></tr>';
+
+    printf ($head, $title, $name);
+
+    if ($empty == 1) {
+      echo ("<option value=\"\">-- select one --");
+    }
+
+    reset ($choices);
+    while (list($key, $val) = each($choices)) {
+      if ($key == $value) {
+       printf ("<option value=\"%s\" selected>%s", $key, $val);
+      } else {
+       printf ("<option value=\"%s\">%s", $key, $val);
+      }
+    }
+
+    echo ($foot);
+  }
+?>
+</define-tag>
diff --git a/src/LinuxTag/2004/functions.inc b/src/LinuxTag/2004/functions.inc
new file mode 100644 (file)
index 0000000..92832b3
--- /dev/null
@@ -0,0 +1,13 @@
+<p><strong>Functions</strong><br>
+
+&nbsp;<a href="$(prefix)projects/">Projects</a><br>
+&nbsp;<a href="$(prefix)workshops/">Workshops</a><br>
+&nbsp;<a href="$(prefix)todo/">Todo</a><br>
+&nbsp;<a href="$(prefix)supporter/">Supporter</a><br>
+<when <not <string-eq "$(NILI)" "" />>>
+&nbsp;<a href="$(prefix)nili/">Nili</a><br>
+</when>
+
+<p><line height=2>
+
+#include "$(prefix)../years.inc" prefix="$(prefix)../" year=2003
diff --git a/src/LinuxTag/2004/index.wml b/src/LinuxTag/2004/index.wml
new file mode 100644 (file)
index 0000000..5e5084f
--- /dev/null
@@ -0,0 +1,17 @@
+#include <lt2003.style>
+
+<page>
+
+<p>This page is intentionally left blank.</p>
+
+#<p><font size=-2><center>
+#<form action=search.php3 method=post><input name=key size=10 maxlength=100>
+#<br><input type=submit value="Search"></form>
+</center></font>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/nili/index.wml b/src/LinuxTag/2004/nili/index.wml
new file mode 100644 (file)
index 0000000..8d5a34e
--- /dev/null
@@ -0,0 +1,197 @@
+#include <lt2003.style>
+
+<page title="Nili">
+
+<?
+  $t_head  = "<p><div align=\"center\"><table cellpadding=\"0\" cellspacing=\"0\" summary=\"\">";
+  $t_title = "<tr bgcolor=\"%s\"><th><font face=\"Helvetica,Arial\">Name</font></th>"
+                              ."<th><font face=\"Helvetica,Arial\">Location</font></th>"
+                              ."<th><font face=\"Helvetica,Arial\"><name-event-date-1></font></th>"
+                              ."<th><font face=\"Helvetica,Arial\"><name-event-date_0></font></th>"
+                              ."<th><font face=\"Helvetica,Arial\"><name-event-date_1></font></th>"
+                              ."<th><font face=\"Helvetica,Arial\"><name-event-date_2></font></th>"
+                              ."<th><font face=\"Helvetica,Arial\"><name-event-date_3></font></th>"
+                              ."<th><font face=\"Helvetica,Arial\"><name-event-date_4></font></th></tr>";
+  $t_row   = "<tr bgcolor=\"%s\"><td><font face=\"Helvetica,Arial\">%s</font></td>"
+                              ."<td><font face=\"Helvetica,Arial\">%s</font></td>"
+                              ."<td align=\"center\"><font face=\"Helvetica,Arial\">%s</font></td>"
+                              ."<td align=\"center\"><font face=\"Helvetica,Arial\">%s</font></td>"
+                              ."<td align=\"center\"><font face=\"Helvetica,Arial\">%s</font></td>"
+                              ."<td align=\"center\"><font face=\"Helvetica,Arial\">%s</font></td>"
+                              ."<td align=\"center\"><font face=\"Helvetica,Arial\">%s</font></td>"
+                              ."<td align=\"center\"><font face=\"Helvetica,Arial\">%s</font></td></tr>";
+
+  $t_foot  = "</table></div><p>";
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = "SELECT person.oid,person.nightplace,nili.person,date(date),breakfast,dinner,sleeping,project "
+          ."FROM person,nili "
+         ."WHERE person.name = nili.person";
+
+  if (strlen ($project)) {
+    $query .= sprintf (" AND project = '%s'", addslashes ($project));
+    printf ("<p><b>Limit to project</b>: %s<p>", $project);
+  }
+
+  if (strlen ($nightplace)) {
+    $query .= sprintf (" AND nightplace = '%s'", addslashes ($nightplace));
+    printf ("<p><b>Limit to location</b>: %s<p>", $nightplace);
+  }
+
+  $query .= " AND date in ('<iso-event-date-1>', '<iso-event-date_0>', '<iso-event-date_1>', '<iso-event-date_2>', " .
+            "'<iso-event-date_3>', '<iso-event-date_4>')";
+
+  $query .= " ORDER BY upper(person)";
+
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+  for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+    $row = pg_fetch_array ($sth, $nr);
+    $nili[$row[2]][$row[3]] = $row;
+  }
+
+  if (pg_NumRows ($sth) > 0) {
+    echo ($t_head);
+    printf ($t_title, "<colh>");
+
+    $color = "<coln>";
+    $name='';
+    $people = 0;
+    $dinner = 0;
+    $breakfast = 0;
+    $days = array ('<iso-event-date-2>', '<iso-event-date-1>', '<iso-event-date_0>',
+                   '<iso-event-date_1>', '<iso-event-date_2>', '<iso-event-date_3>');
+    reset ($nili);
+    while (list($name,$row) = each($nili)) {
+      $color=$color == "<cold>"?"<coln>" : "<cold>";
+      $people++;
+
+      $info = array ();
+      $where = '';
+      reset ($days);
+      while (list(,$date) = each($days)) {
+       $info[$date] = sprintf ("&nbsp;%s&nbsp;%s&nbsp;%s&nbsp;",
+                               $row[$date]['breakfast']==1?"B":"&nbsp;",
+                               $row[$date]['dinner']==1?"D":"&nbsp;",
+                               $row[$date]['sleeping']==1?"S":"&nbsp;");
+       $sum[$date]['breakfast'] += $row[$date]['breakfast'];
+       $sum[$date]['dinner'] += $row[$date]['dinner'];
+       $sum[$date]['sleeping'] += $row[$date]['sleeping'];
+       if (strlen ($row[$date]['nightplace'])) { $where = $row[$date]['nightplace']; }
+       if (strlen ($row[$date]['oid'])) { $oid = $row[$date]['oid']; }
+       if (strlen ($row[$date]['project'])) { $project = $row[$date]['project']; }
+      }
+
+      if ($project == 'Supporter') {
+        $link = sprintf ("<a href=\"../supporter/edit.php3?oid=%d\">%s</a>", $oid, $name);
+      } else {
+        $link = sprintf ("<a href=\"../projects/edit_person.php3?oid=%d\">%s</a>", $oid, $name);
+      }
+
+      printf ($t_row, $color, $link, strlen ($where)?$where:"&nbsp;",
+             $info['<iso-event-date-1>'],
+             $info['<iso-event-date_0>'],
+             $info['<iso-event-date_1>'],
+             $info['<iso-event-date_2>'],
+             $info['<iso-event-date_3>'],
+             $info['<iso-event-date_4>']);
+    }
+
+    $color=$color == "<cold>"?"<coln>" : "<cold>";
+    $link = "<b>Sum</b>";
+
+    $info = array ();
+    reset ($days);
+    while (list(,$date) = each($days)) {
+      $info[$date] = sprintf ("&nbsp;%d&nbsp;%d&nbsp;%d&nbsp;",
+                    $sum[$date]['breakfast'], $sum[$date]['dinner'], $sum[$date]['sleeping']);
+
+      $breakfast += $sum[$date]['breakfast'];
+      $dinner += $sum[$date]['dinner'];
+    }
+    printf ($t_row, $color, $link, "&nbsp;",
+           $info['<iso-event-date-1>'],
+           $info['<iso-event-date_0>'],
+           $info['<iso-event-date_1>'],
+           $info['<iso-event-date_2>'],
+           $info['<iso-event-date_3>'],
+           $info['<iso-event-date_4>']);
+
+    echo ($t_foot);
+  }
+
+  printf ("<p>People: %d", $people);
+
+  if ($REMOTE_USER == "joey") {
+    printf ("<br>Breakfast: %d (%5.2f)", $breakfast, $breakfast * 3);
+    printf ("<br>Dinner: %d (%5.2f)", $dinner, $dinner * 12);
+  } else {
+    printf ("<br>Breakfast: %d", $breakfast);
+    printf ("<br>Dinner: %d", $dinner);
+  }
+?>
+
+<p>
+B = Breakfast<br>
+D = Dinner<br>
+S = Sleeping<br>
+
+
+<? if ($people > 0) { ?>
+<p>
+<b>Change view</b>:
+<form method=get action=index.php3>
+<br><b>Project</b>: <select name=project><option value="">unlimited<?
+
+  $query = "SELECT name FROM project ORDER BY upper(name)";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+      printf ("<option>%s", $row['name']);
+    }
+  }
+?></select>
+
+<?
+  $query = "SELECT DISTINCT nightplace FROM person,nili WHERE nili.person=person.name "
+         ."AND nightplace <> '' AND NOT nightplace IS NULL";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 1) {
+?>
+
+<br><b>Location</b>: <select name=nightplace><option value="">unlimited<?
+
+    $nightplaces = array ();
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+      $nightplaces[] = $row['nightplace'];
+    }
+
+    sort ($nightplaces);
+    for ($nr=0; $nr < count ($nightplaces); $nr++) {
+      if ($$nightplaces[$nr] == "<nili_name>") {
+        printf ("<option selected>%s", $nightplaces[$nr]);
+      } else {
+        printf ("<option>%s", $nightplaces[$nr]);
+      }
+    }
+  echo ("</select>");
+  }
+?>
+
+<br><input type=submit value="Redisplay">
+</form>
+<? } ?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/nili/submenu.inc b/src/LinuxTag/2004/nili/submenu.inc
new file mode 100644 (file)
index 0000000..1150bb4
--- /dev/null
@@ -0,0 +1,7 @@
+<strong>Menu</strong><br>
+
+&nbsp;<menu-item base=index text=Index href=index.php3><br>
+
+<p><line height=2>
+
+#include "../functions.inc" prefix="../"
diff --git a/src/LinuxTag/2004/phpfunctions.inc b/src/LinuxTag/2004/phpfunctions.inc
new file mode 100644 (file)
index 0000000..b80274b
--- /dev/null
@@ -0,0 +1,273 @@
+<?
+function string_to_unixtime($string)
+{
+       $year = substr($string, 0, 4);
+       $month = substr($string, 5, 2);
+       $day = substr($string, 8, 2);
+       $hour = substr($string, 11, 2);
+       $minute = substr($string, 14, 2);
+       $second = substr($string, 17, 2);
+        return mktime($hour, $minute, $second, $month, $day, $year);
+}
+?>
+<define-tag spokendate>
+<?
+  function spokendate ($date)
+  {
+    $mon = array ("January", "February", "March", "April", "May",
+           "June", "July", "August", "September", "October", "November", "December");
+    $rdate = explode ("-", $date);
+
+    if (($rdate[2] % 10) == 1) {
+      $appendix = "st";
+    } elseif (($rdate[2] % 10) == 2) {
+      $appendix = "nd";
+    } elseif (($rdate[2] % 10) == 3) {
+      $appendix = "rd";
+    } else {
+      $appendix = "th";
+    }
+
+    return (sprintf ("%s %d%s, %d", $mon[$rdate[1]-1], $rdate[2], $appendix, $rdate[0]));
+  }
+?>
+</define-tag>
+
+<define-tag insert_nili>
+<?
+  $days = array(
+  "<iso-event-date-1>" => array(  "dinner" => "dinner-<iso-event-date-1>",
+                         "sleeping" => "sleeping-<iso-event-date-1>"),
+  "<iso-event-date_0>" => array(  "breakfast" => "breakfast-<iso-event-date_0>",
+                         "dinner" => "dinner-<iso-event-date_0>",
+                         "sleeping" => "sleeping-<iso-event-date_0>"),
+  "<iso-event-date_1>" => array(  "breakfast" => "breakfast-<iso-event-date_1>",
+                         "dinner" => "dinner-<iso-event-date_1>",
+                         "sleeping" => "sleeping-<iso-event-date_1>"),
+  "<iso-event-date_2>" => array(  "breakfast" => "breakfast-<iso-event-date_2>",
+                         "dinner" => "dinner-<iso-event-date_2>",
+                         "sleeping" => "sleeping-<iso-event-date_2>"),
+  "<iso-event-date_3>" => array(  "breakfast" => "breakfast-<iso-event-date_3>",
+                         "dinner" => "dinner-<iso-event-date_3>",
+                         "sleeping" => "sleeping-<iso-event-date_3>"),
+  "<iso-event-date_4>" => array(  "breakfast" => "breakfast-<iso-event-date_4>")
+  );
+
+  function insert_nili()
+  {
+       # Now add the new ones
+       
+       reset ($GLOBALS['days']);
+       while (list($day,$value) = each($GLOBALS['days']))
+       {
+               $meals = array();
+               
+               reset ($value);
+               while (list($meal,$variable) = each($value))
+               {
+                       if ($GLOBALS[$variable] == 1) { $meals[$meal] = 1; }
+               }
+
+               if (($meals["breakfast"] != 0) || ($meals["dinner"] != 0) || ($meals["sleeping"] != 0)) {
+                   $query = sprintf("INSERT INTO nili (person, date, breakfast, dinner, sleeping) " .
+                                " VALUES ('%s', '%s', %d, %d, %d)", addslashes($GLOBALS['name']),
+                                addslashes($day), $meals["breakfast"],
+                                $meals["dinner"], $meals["sleeping"]);
+                   pg_exec($GLOBALS['dbh'], $query) or die ("Cannot insert into nili");
+               }
+               
+       }
+  }
+?>
+</define-tag>
+
+<define-tag randpass>
+<?
+  # This function is from phpdoc
+  #
+  function make_seed() {
+      list($usec, $sec) = explode(' ', microtime());
+      return (float) $sec + ((float) $usec * 100000);
+  }
+
+  function randpass()
+  {
+         mt_srand(make_seed());
+         return substr(md5(mt_rand()), 0, 8);
+  }
+
+  function mail_password($email, $newpass)
+  {
+      if (strlen ($email) > 0) {
+         $body  = "LinuxTag Projects Management\n";
+         $body .= "<url-projects>\n\n";
+         $body .= "Account: " . $email . "\n";
+         $body .= "Password: " . $newpass . "\n";
+         $body .= "\nThe password may be changed within the system.\n";
+         $body .= "\nYou are subscribed to the infomails.\nYou can change this using the web interface.\n";
+         $body .= "\nThis account is only valid for this years' LinuxTag.\n";
+         $body .= "\nThanks for your commitment.\n";
+         mail($email, "[LT Projects] New Password", $body, "From: joey@infodrom.org (LinuxTag Projects Management)");
+      }
+      return true;
+  }
+?>
+</define-tag>
+
+<define-tag job>
+<?
+
+function fragment_intro($fragmentid, $starttime, $endtime, $editable)
+{
+       ?><hspace 30><?
+       if ($editable == 1)
+       {
+       echo '<a href="edit_job_fragment.php3?id=' . $fragmentid . '">Edit</a> ';
+       echo '<a href="assign_person.php3?fragmentid=' . $fragmentid . '">Assign</a> ';
+       echo '<a href="update.php3?type=delete_job_fragment&id=' . $fragmentid . '">Delete</a>';
+       }
+       echo $starttime . ' - ' . $endtime . '<br>';
+}
+
+function job_assignment($fragmentid)
+{
+       global $dbh;
+       $query = sprintf("SELECT *,oid from assignment where fragment = %d", $fragmentid);
+       $sth = pg_exec($dbh, $query) or die ("Cannot execute query");
+       if (pg_NumRows($sth) > 0)
+       {
+       ?>
+       <table cellpadding=0 cellspacing=1>
+       <tr>
+       <td width=60>&nbsp;</td>
+       <td bgcolor="<colh>"><font face="Helvetica,Arial"><b>Name</b></font></td>
+       <td bgcolor="<colh>"><font face="Helvetica,Arial"><b>Starttime</b></font></td>
+       <td bgcolor="<colh>"><font face="Helvetica,Arial"><b>Endtime</b></font></td>
+       <td bgcolor="<colh>"><font face="Helvetica,Arial"><b>Delete</b></font></td>
+       <td bgcolor="<colh>"><font face="Helvetica,Arial"><b>Edit</b></font></td>
+       </tr>
+       <?
+       for ($z = 0; $z < pg_NumRows($sth); $z++)
+       {
+               $row = pg_fetch_array($sth, $z);
+               ?>
+               <tr><td width=60>&nbsp;</td>
+               <td bgcolor="<cold>">
+               <? echo $row['person']; ?>
+               &nbsp;</td><td bgcolor="<cold>">
+               <? echo $row['starttime']; ?>
+               &nbsp;</td><td bgcolor="<cold>">
+               <? echo $row['endtime']; ?>
+               &nbsp;</td><td bgcolor="<cold>">
+               <? echo "<a href=\"update.php3?type=delete_assignment&oid=" .
+                       $row['oid'] . "\">delete</a>"; ?>
+               </td><td bgcolor="<cold>">
+               <? echo "<a href=\"assign_person.php3?fragmentid=" . $fragmentid . "&oid=" .
+                       $row['oid'] . "\">edit</a>"; ?>
+               </td></tr> <?
+       }
+       ?>
+       </table>
+       <?
+       }
+}
+
+
+function fragment_overview($fragmentid, $printall, $printassignment, $printedit)
+{
+       global $dbh;
+       $changes = array();
+       $query = sprintf("SELECT * from fragment where id = %d", $fragmentid);
+       $sth = pg_exec($dbh, $query) or die ("DB");
+       $fragment = pg_fetch_array($sth, 0) or die ("No Rows");
+       
+       if ($printall == 1)
+       {
+       fragment_intro($fragmentid, $fragment['starttime'], $fragment['endtime'], $printedit);
+       }
+
+       $changes[string_to_unixtime($fragment['starttime'])] = 0;
+
+       $changes[string_to_unixtime($fragment['endtime'])] = 0;
+
+       $query2 = sprintf("SELECT starttime, endtime from assignment where fragment = %d", $fragmentid);
+       $sth2 = pg_exec($dbh, $query2) or die ("DB");
+
+       for ($x = 0; $x < pg_NumRows($sth2); $x++)
+       {
+               $row = pg_fetch_array($sth2, $x);
+               $changes[string_to_unixtime($row[0])]++;
+               $changes[string_to_unixtime($row[1])] = $changes[string_to_unixtime($row[1])] - 1;
+       }
+       ksort($changes);
+       list($oldkey, $oldchange) = each ($changes);
+       $y = 0;
+       for ($x = 0; $x < sizeof($changes) - 1; $x++)
+       {
+               list($key, $change) = each ($changes);
+               if ($printall == 0)
+               {
+                       // Check if we have to print
+                       if($fragment['min'] <= $oldchange)
+                       {
+                       $oldkey = $key;
+                       $oldchange = $change + $oldchange;
+                       continue;
+                       }
+               }
+               $y++;
+               if ($y == 1)
+               {
+               if ($printall <> 1)
+               {
+               fragment_intro($fragmentid, $fragment['starttime'], $fragment['endtime'], $printedit);
+               }
+               ?>
+               <table cellpadding=0 cellspacing=1>
+               <tr>
+               <td width=60>&nbsp;</td>
+               <td bgcolor="<colh>"><font face="Helvetica,Arial"><b>Time</font></b></td>
+               <td bgcolor="<colh>"><font face="Helvetica,Arial"><b>Number of Supporters</font></b></td>
+               <td bgcolor="<colh>"><font face="Helvetica,Arial"><b>Status</font></b></td>
+               </tr>
+               <?
+               }
+               
+               ?>
+               <tr>
+               <td>&nbsp;</td>
+               <td bgcolor="<cold>">
+               <? echo strftime("%Y-%m-%d %T", $oldkey) . " - " . strftime("%Y-%m-%d %T", $key); ?>
+               </td>
+               <td bgcolor="<cold>">
+               <? echo $oldchange; ?>
+               </td>
+               <td bgcolor="<cold>">
+               <?
+               if ($fragment['min'] > $oldchange)
+               {
+                       echo "Helpers missing";
+               } else {
+                       echo "Helpers sufficient";
+               }
+               ?>
+               </td>
+               </tr>
+               <?
+               $oldkey = $key;
+               $oldchange = $change + $oldchange;
+       }
+       if ($y > 0)
+       {
+       ?>
+       </table>
+       <?
+       }
+
+       if ($printassignment == 1)
+       {
+               job_assignment($fragmentid);
+       }
+}
+?>
+</define-tag>
diff --git a/src/LinuxTag/2004/projects/accounts.wml b/src/LinuxTag/2004/projects/accounts.wml
new file mode 100644 (file)
index 0000000..d6be3d1
--- /dev/null
@@ -0,0 +1,43 @@
+#include <lt2003.style>
+
+<page title="Accounts">
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+               or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  # As a sidenote, this excludes supporters just because there is no
+  # project record associated to it.
+  $query = "SELECT person.project,person.name,person.email,person.admin "
+          ."FROM project,person "
+          ."WHERE project.name = person.project AND list = 0 AND login = 1 AND email <> ''"
+          ."AND project.name <> 'Supporter' ORDER BY project,name";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    $project = '';
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+
+      if ($project != $row['project']) {
+        printf ("<h3>%s</h3>", $row['project']);
+        $project = $row['project'];
+      }
+
+      if ($row['admin'] == 1) {
+        printf ("<strong>%s &lt;%s&gt;</strong><br>", $row['name'], $row['email']);
+      } else {
+        printf ("%s &lt;%s&gt;<br>", $row['name'], $row['email']);
+      }
+    }
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/projects/admins.wml b/src/LinuxTag/2004/projects/admins.wml
new file mode 100644 (file)
index 0000000..0ca343a
--- /dev/null
@@ -0,0 +1,43 @@
+#include <lt2003.style>
+
+<page title="Project Admins">
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+               or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  # As a sidenote, this excludes supporters and additional projects
+  $query = "SELECT person.project,person.name,person.email,person.list,person.infomail "
+          ."FROM project,person "
+          ."WHERE project.name = person.project AND admin = 1 AND email <> '' "
+          ."AND project.name <> 'Supporter' AND project.name <> 'Sleeper' "
+          ."ORDER BY upper(project),name";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    $project = '';
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+
+      if ($project != $row['project']) {
+        printf ("<h3>%s</h3>", $row['project']);
+        $project = $row['project'];
+      }
+
+      if ($row['list']) {
+        printf ("%s<br>", $row['email']);
+      } else {
+        printf ("%s &lt;%s&gt;<br>", $row['name'], $row['email']);
+      }
+    }
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/projects/edit.wml b/src/LinuxTag/2004/projects/edit.wml
new file mode 100644 (file)
index 0000000..dd4ea4b
--- /dev/null
@@ -0,0 +1,94 @@
+#include <lt2003.style>
+#include "../edit.style"
+
+<page title="Projects">
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = sprintf ("SELECT * FROM project WHERE oid = %d ORDER BY name", $oid);
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    $data = pg_fetch_array ($sth, 0);
+
+    $query = sprintf ("SELECT * FROM appendix WHERE project = '%s'", $data['name']);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+      $data['boothtitle'] = $row['boothtitle'];
+      $data['description'] = $row['description'];
+      $data['description_en'] = $row['description_en'];
+    }
+  }
+?>
+
+<form method=post action=update.php3>
+<input type=hidden name=type value="project">
+<input type=hidden name=oid value="<? echo $oid; ?>">
+<center><table cellpadding=0 cellspacing=1>
+
+<row_input     name=name
+               title="<b>Name</b>"
+               value="<? echo $data['name']; ?>"
+               >
+<row_input     name=url
+               title="<b>URL</b>"
+               value="<? echo $data['url']; ?>"
+               >
+<row_input     name=boothtitle
+               title="<b>Booth Title</b>"
+               value="<? echo $data['boothtitle']; ?>"
+               >
+<row_input     name=boothnr
+               title="<b>Booth Nr.</b>"
+               value="<? echo $data['boothnr']; ?>"
+               >
+<row_input     name=boothsize
+               title="<b>Booth Size</b>"
+               value="<? echo $data['boothsize']>0?$data['boothsize']:''; ?>"
+               >
+<row_input     name=computer
+               title="<b>Computer</b>"
+               value="<? echo $data['computer']>0?$data['computer']:''; ?>"
+               >
+
+<row_input     name=comment
+               title="<b>Comment</b>"
+               value="<? echo $data['comment']>0?$data['comment']:''; ?>"
+               >
+
+<row_textarea  name=description
+               title="<b>Kurzbeschreibung</b> (1000 Zeichen)"
+               value="<? echo $data['description']; ?>"
+               rows=4
+               >
+
+<row_textarea  name=description_en
+               title="<b>Short description</b> (1000 Characters)"
+               value="<? echo $data['description_en']; ?>"
+               rows=4
+               >
+
+<? if ($oid > 0) { ?>
+<row_radiobox  name=delete
+               title="<b>Delete</b>"
+               checked_0="checked"
+               checked_1=""
+               >
+<? } ?>
+
+<row_submit>
+
+</table></center></form>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/projects/edit_comment.wml b/src/LinuxTag/2004/projects/edit_comment.wml
new file mode 100644 (file)
index 0000000..daeee1a
--- /dev/null
@@ -0,0 +1,140 @@
+#include <lt2003.style>
+#include "../edit.style"
+
+<page title="Edit Comments">
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  if ($oid > 0) {
+    pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+    $query = sprintf ("SELECT * FROM comments WHERE oid = %d", $oid);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+    }
+  } else {
+    $query = sprintf ("SELECT name FROM project WHERE oid = %d", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+    }
+  }
+?>
+
+<? if (strlen ($row['name']) > 0) { ?>
+<h3>Comment for Project <? echo strlen ($row['name'])?$row['name']:$row['project']; ?></h3>
+<? } ?>
+
+<form method=post action=update.php3>
+<input type=hidden name=type value="comment">
+<input type=hidden name=oid value="<? echo $oid; ?>">
+<? if (strlen ($row['name']) > 0) { ?>
+<input type=hidden name=project value="<? echo $row['name']; ?>">
+<? } ?>
+<center><table cellpadding=0 cellspacing=1>
+
+<?
+  if (strlen ($project) == 0) {
+    $query = "SELECT name FROM project ORDER BY name";
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+?>
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><b>Project</b></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial"><select name=project>
+<?
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+       $srow = pg_fetch_array ($sth, $nr);
+       printf ("<option value=\"%s\"%s>%s\n", $srow['name'],
+               $row['project'] == $srow['name']?" selected":"", $srow['name']);
+      }
+    }
+  }
+?>
+</select>
+</font></td></tr>
+
+<?
+  if (strlen ($oid) == 0) {
+    if (strlen ($row['name']) > 0) {
+      $query = sprintf ("SELECT person.name,person.oid FROM person,junction "
+                       ."WHERE junction.person = person.name AND junction.project = '%s' ORDER BY name",
+                      $row['name']);
+    } else {
+      $query = "SELECT person.name,junction.project,person.oid FROM person,junction "
+             ."WHERE junction.person = person.name ORDER BY project,name";
+    }
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+?>
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><b>Member</b></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial"><select name=personid><option value="">-- select one --
+<?
+      if (strlen ($row['name']) > 0) {
+       for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+         $row = pg_fetch_array ($sth, $nr);
+         printf ("<option value=\"%d\">%s\n", $row['oid'], $row['name']);
+       }
+      } else {
+       for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+         $row = pg_fetch_array ($sth, $nr);
+         printf ("<option value=\"%d\">%s: %s\n", $row['oid'], $row['project'], $row['name']);
+       }
+      }
+    }
+?>
+</select>
+</font></td></tr>
+<?
+  }
+?>
+
+<row_input     name=who
+               title="<b>Alt. Name</b>"
+               value="<? echo $row['who']; ?>"
+               >
+<row_input     name=email
+               title="<b>Alt. E-Mail</b>"
+               value="<? echo $row['email']; ?>"
+               >
+<? 
+  if ($oid > 0) {
+    $foo = explode (" ", $row['date']);
+    $date = explode (":", $foo[1]);
+    $date = sprintf ("%s %02d:%02d", $foo[0], $date[0], $date[1]);
+  }
+?>
+<row_input     name=date
+               title="<b>Date</b>"
+               value="<? echo $date; ?>"
+               >
+
+<row_textarea  name=body
+               title="<b>Comment</b>"
+               value="<? echo $row['body']; ?>"
+               rows=7
+               >
+
+<? if ($oid > 0) { ?>
+<row_radiobox  name=delete
+               title="<b>Delete</b>"
+               checked_0="checked"
+               checked_1=""
+               >
+<? } ?>
+
+<row_submit>
+
+</table></center></form>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/projects/edit_person.wml b/src/LinuxTag/2004/projects/edit_person.wml
new file mode 100644 (file)
index 0000000..c42056f
--- /dev/null
@@ -0,0 +1,301 @@
+#include <lt2003.style>
+#include "../edit.style"
+
+<page title="Edit Person">
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  if ($project) {
+    $query = sprintf ("SELECT name FROM project WHERE oid = %d", $project);
+  } else {
+    $query = sprintf ("SELECT * FROM person WHERE oid = %d", $oid);
+  }
+
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    $row = pg_fetch_array ($sth, 0);
+
+    if ($project) {
+      $row['project'] = $row['name'];
+      $row['name'] = '';
+      # Default to let people log in
+      $row['login'] = 1;
+      # Default: opt-out infomails
+      $row['infomail'] = 1;
+    } else {
+      $name = $row['name'];
+    }
+
+# Mögliche Optimierung: Nachfolgende Queries können durch einen
+# einzigen Query abgedeckt werden, der alle Tage Ã¼berdeckt und die
+# passenden internen Variablen mit sinnvollen Werten füttert.  Das
+# wären dann noch genzu zwei Queries anstelle von fünf.
+
+?>
+<form method=post action=update.php3>
+<input type=hidden name=type value="person">
+<input type=hidden name=oid value="<? echo $oid; ?>">
+<input type=hidden name=context value="<? echo $context; ?>">
+<center><table cellpadding=0 cellspacing=1>
+
+<? if ($project) { ?>
+<row_info      name=project
+               title="<b>Project</b>"
+               value="<? echo $row['project']; ?>"
+               >
+<? } else { ?>
+<?
+  if (strlen ($project) == 0) {
+    $projects = array ();
+    $query = sprintf ("SELECT project FROM junction WHERE person = '%s' ORDER BY project", $row['name']);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+       $srow = pg_fetch_array ($sth, $nr);
+       $projects[] = $srow['project'];
+      }
+    }
+
+    if ( count ($projects) > 1) {
+?>
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><b>Project</b></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial"><select name=project>
+<?
+      for ($nr=0; $nr < count ($projects); $nr++) {
+       printf ("<option value=\"%s\"%s>%s\n", $projects[$nr],
+               $row['project'] == $projects[$nr]?" selected":"", $projects[$nr]);
+      }
+?>
+</select>
+</font></td></tr>
+<?
+    } else {
+?>
+<row_info      name=project
+               title="<b>Project</b>"
+               value="<? echo $row['project']; ?>"
+               >
+<?
+    }
+  }
+?>
+<? } ?>
+
+<row_input     name=name
+               title="<b>Name</b>"
+               value="<? echo $row['name']; ?>"
+               >
+<row_input     name=email
+               title="<b>E-Mail</b>"
+               value="<? echo $row['email']; ?>"
+               >
+
+<when <not <string-eq "$(NILI)" "" />>>
+<? if ($row['list'] == 0) { ?>
+<row_input     name=nightplace
+               title="<b>Nightplace</b>"
+               value="<? echo $row['nightplace']; ?>"
+               >
+<? } ?>
+</when>
+
+<row_input     name=comment
+               title="<b>Comment</b>"
+               value="<? echo $row['comment']; ?>"
+               >
+
+<? if ($row['list'] == 0) { ?>
+<row_radiobox  name=infomail
+               title="<b>Infomail</b>"
+               checked_0="<? if ($row['infomail']==0) { echo "checked";} ?>"
+               checked_1="<? if ($row['infomail']==1) { echo "checked";} ?>"
+               >
+
+<when <not <string-eq "$(INSURANCE)" "" />>>
+<row_radiobox  name=insurance
+               title="<b>Insurance</b>"
+               checked_0="<? if ($row['insurance']==0) { echo "checked";} ?>"
+               checked_1="<? if ($row['insurance']==1) { echo "checked";} ?>"
+               >
+</when>
+
+<when <not <string-eq "$(SOCIALEVENT)" "" />>>
+<row_checkbox  name=socialevent
+               title="<b>Social Event</b>"
+               descr="Price &euro; <sev_price>"
+               checked="<? if ($row['socialevent']==1) { echo \"checked\";} ?>"
+               >
+</when>
+
+<? } ?>
+
+<row_checkbox  name=list
+               title="<b>List</b>"
+               descr="Address is a mailing list"
+               checked="<? if ($row['list'] == 1) { echo 'checked'; } ?>"
+               >
+<? if ($row['list'] == 0) { ?>
+<row_checkbox  name=admin
+               title="<b>Admin</b>"
+               descr="Manages the primary project"
+               checked="<? if ($row['admin']==1) { echo \"checked\";} ?>"
+               >
+
+<row_checkbox  name=login
+               title="<b>Login</b>"
+               descr="Permission to log in"
+               checked="<? if ($row['login']==1) { echo \"checked\";} ?>"
+               >
+
+<row_checkbox  name=password
+               title="<b>Password</b>"
+               descr="Randomize password"
+               checked="<? if ($project) { echo 'checked'; } ?>"
+               >
+
+<? } ?>
+
+<when <not <string-eq "$(NILI)" "" />>>
+<? if ($row['list'] == 0) {
+
+$nili = array();
+
+if ($new <> 1)
+{
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = sprintf ("SELECT oid,breakfast,dinner,sleeping,comment,date(date) FROM nili WHERE person = '%s'" .
+                  " AND date in ('<iso-event-date-1>', '<iso-event-date_0>', '<iso-event-date_1>', " .
+                  "'<iso-event-date_2>', '<iso-event-date_3>', '<iso-event-date_4>')", addslashes($row['name']));
+
+  $sth2 = pg_exec ($dbh, $query) or die ("Cannot execute nili-query");
+
+// This query is allowed to return 0 rows
+
+  for ($x = 0; $x < pg_NumRows($sth2); $x++)
+  {
+       $row2 = pg_fetch_array ($sth2, $x);
+       $nili[$row2[5]] = $row2;
+  }
+}
+?>
+
+<row_checkbox  name=dinner-<iso-event-date-1>
+               title="<b><name-event-date-1></b>"
+               descr="Dinner"
+               checked="<? if ($nili['<iso-event-date-1>']['dinner'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=sleeping-<iso-event-date-1>
+               title="<iso-event-date-1>"
+               descr="Sleeping"
+               checked="<? if ($nili['<iso-event-date-1>']['sleeping'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=breakfast-<iso-event-date_0>
+               title="<b><name-event-date_0></b>"
+               descr="Breakfast"
+               checked="<? if ($nili['<iso-event-date_0>']['breakfast'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=dinner-<iso-event-date_0>
+               title="<iso-event-date_0>"
+               descr="Dinner"
+               checked="<? if ($nili['<iso-event-date_0>']['dinner'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=sleeping-<iso-event-date_0>
+               title=""
+               descr="Sleeping"
+               checked="<? if ($nili['<iso-event-date_0>']['sleeping'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=breakfast-<iso-event-date_1>
+               title="<b><name-event-date_1></b>"
+               descr="Breakfast"
+               checked="<? if ($nili['<iso-event-date_1>']['breakfast'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=dinner-<iso-event-date_1>
+               title="<iso-event-date_1>"
+               descr="Dinner"
+               checked="<? if ($nili['<iso-event-date_1>']['dinner'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=sleeping-<iso-event-date_1>
+               title=""
+               descr="Sleeping"
+               checked="<? if ($nili['<iso-event-date_1>']['sleeping'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="breakfast-<iso-event-date_2>"
+               title="<b><name-event-date_2></b>"
+               descr="Breakfast"
+               checked="<? if ($nili['<iso-event-date_2>']['breakfast'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="dinner-<iso-event-date_2>"
+               title="<iso-event-date_2>"
+               descr="Dinner"
+               checked="<? if ($nili['<iso-event-date_2>']['dinner'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="sleeping-<iso-event-date_2>"
+               title=""
+               descr="Sleeping"
+               checked="<? if ($nili['<iso-event-date_2>']['sleeping'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="breakfast-<iso-event-date_3>"
+               title="<b><name-event-date_3></b>"
+               descr="Breakfast"
+               checked="<? if ($nili['<iso-event-date_3>']['breakfast'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="dinner-<iso-event-date_3>"
+               title="<iso-event-date_3>"
+               descr="Dinner"
+               checked="<? if ($nili['<iso-event-date_3>']['dinner'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="sleeping-<iso-event-date_3>"
+               title=""
+               descr="Sleeping"
+               checked="<? if ($nili['<iso-event-date_3>']['sleeping'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="breakfast-<iso-event-date_4>"
+               title="<b><name-event-date_4></b>"
+               descr="Breakfast"
+               checked="<? if ($nili['<iso-event-date_4>']['breakfast'] == 1) { echo 'checked'; } ?>"
+               >
+<? } ?>
+</when>
+
+<? if ($oid > 0) { ?>
+<row_radiobox  name=delete
+               title="<b>Delete</b>"
+               checked_0="checked"
+               checked_1=""
+               >
+<? } ?>
+
+<row_submit>
+
+</table></center></form>
+<?
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: indented-text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/projects/edit_url.wml b/src/LinuxTag/2004/projects/edit_url.wml
new file mode 100644 (file)
index 0000000..4825fb4
--- /dev/null
@@ -0,0 +1,72 @@
+#include <lt2003.style>
+#include "../edit.style"
+
+<page title="Projects - URLs">
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  if ($project) {
+    $query = sprintf ("SELECT name FROM project WHERE oid = %d", $project);
+  } else {
+    $query = sprintf ("SELECT * FROM urls WHERE oid = %d", $oid);
+  }
+
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    $row = pg_fetch_array ($sth, 0);
+
+?>
+<form method=post action=update.php3>
+<input type=hidden name=type value="url">
+<input type=hidden name=oid value="<? echo $oid; ?>">
+<input type=hidden name=project value="<? echo $row['name']; ?>">
+<center><table cellpadding=0 cellspacing=1>
+
+<? if ($project) { ?>
+<row_info      name=project_unused
+               title="<b>Project</b>"
+               value="<? echo $row['name']; ?>"
+               >
+<? } ?>
+<row_input     name=url
+               size=65
+               title="<b>URL</b>"
+               value="<? echo $row['url']; ?>"
+               >
+<row_input     name=description
+               size=65
+               title="<b>Description</b>"
+               value="<? echo $row['description']; ?>"
+               >
+<row_checkbox  name=visible
+               title="<b>Visible</b>"
+               descr="Publically visible"
+               checked="<? if ($row['visible'] == 1) { echo 'checked'; } ?>"
+               >
+
+<? if ($oid > 0) { ?>
+<row_radiobox  name=delete
+               title="<b>Delete</b>"
+               checked_0="checked"
+               checked_1=""
+               >
+<? } ?>
+
+<row_submit>
+
+</table></center></form>
+<?
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/projects/index.wml b/src/LinuxTag/2004/projects/index.wml
new file mode 100644 (file)
index 0000000..df824d3
--- /dev/null
@@ -0,0 +1,89 @@
+#include <lt2003.style>
+#include "phptools.inc"
+
+<page title="Projects">
+
+<?
+  function night ($project)
+  {
+    global $dbh;
+
+    $query = sprintf ("SELECT COUNT(*) FROM person WHERE project = '%s' AND list = 0 AND nightplace <> ''", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+      return $row[0];
+    }
+  }
+  function comments ($project)
+  {
+    global $dbh;
+
+    $query = sprintf ("SELECT COUNT(*) FROM comments WHERE project = '%s'", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+      return $row[0];
+    }
+  }
+  function total_members ()
+  {
+    global $dbh;
+
+    $query = sprintf ("SELECT COUNT(*) FROM person WHERE project <> 'Supporter' AND list = 0");
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+      return $row[0];
+    }
+  }
+
+  $t_head  = "<p><div align=\"center\"><table width=\"99%\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\">";
+  $t_title = "<tr bgcolor=\"%s\"><th><font face=\"Helvetica,Arial\">Name</font></th><th><font face=\"Helvetica,Arial\">Members</font></th><th><font face=\"Helvetica,Arial\">Night</font></th><th><font face=\"Helvetica,Arial\">Puters</font></th><th><font face=\"Helvetica,Arial\">Size</font></th><th><font face=\"Helvetica,Arial\">Comments</font></th></tr>";
+  $t_row   = "<tr bgcolor=\"%s\"><td><font face=\"Helvetica,Arial\">%s</font></td><td align=\"right\"><font face=\"Helvetica,Arial\">%d</font></td><td align=\"right\"><font face=\"Helvetica,Arial\">%d</font></td><td align=\"right\"><font face=\"Helvetica,Arial\">%d</font></td><td align=\"right\"><font face=\"Helvetica,Arial\">%d</font></td><td align=\"right\"><font face=\"Helvetica,Arial\">%d</font></td></tr>";
+  $t_foot  = "</table></div><p>";
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = "SELECT name,oid,boothsize,computer FROM project WHERE name <> 'Supporter' ORDER BY upper (name)";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    echo ($t_head);
+    printf ($t_title, "<colh>");
+
+    $color = "<cold>";
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $color=$color == "<cold>"?"<coln>" : "<cold>";
+      $row = pg_fetch_array ($sth, $nr);
+      $members = members ($row['name']);
+      $night = night ($row['name']);
+      $comments = comments ($row['name']);
+      $name = sprintf ("<a href=\"show.php3?oid=%d\">%s</a>", $row['oid'], $row['name']);
+      printf ($t_row, $color, $name, $members, $night, $row['computer'], $row['boothsize'], $comments);
+      $sum['project']++;
+      $sum['night']+= $night;
+      $sum['comments']+= $comments;
+      $sum['computer']+=$row['computer'];
+      $sum['boothsize']+=$row['boothsize'];
+    }
+    $color=$color == "<cold>"?"<coln>" : "<cold>";
+    $foo = sprintf ("<b>Sum</b> (%d projects)", $sum['project']);
+    printf ($t_row, $color, $foo, total_members(), $sum['night'],
+           $sum['computer'], $sum['boothsize'], $sum['comments']);
+    echo ($t_foot);
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/projects/infomail.wml b/src/LinuxTag/2004/projects/infomail.wml
new file mode 100644 (file)
index 0000000..fb71a78
--- /dev/null
@@ -0,0 +1,35 @@
+#include <lt2003.style>
+#include "../edit.style"
+
+<page title="Infomail">
+
+<form method=post action=infomail_send.php3>
+<center><table cellpadding=0 cellspacing=1>
+
+<row_input      name=number
+                title="<b>Nr.</b>"
+                size=55
+                value=""
+                >
+<row_input      name=subject
+                title="<b>Subject</b>"
+                value=""
+                size=55
+                >
+<row_textarea   name=body
+                title="<b>Content</b>"
+                value=""
+                cols=53
+                rows=10
+                >
+
+<row_submit_plain>
+
+</table></center></form>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/projects/infomail_recipient.wml b/src/LinuxTag/2004/projects/infomail_recipient.wml
new file mode 100644 (file)
index 0000000..3a27148
--- /dev/null
@@ -0,0 +1,43 @@
+#include <lt2003.style>
+
+<page title="Infomail Addresses">
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+               or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  # As a sidenote, this excludes supporters and additional projects
+  $query = "SELECT person.project,person.name,person.email,person.list,person.infomail "
+          ."FROM project,person "
+          ."WHERE project.name = person.project AND ( infomail = 1 OR list = 1) AND email <> '' "
+          ."AND project.name <> 'Supporter' AND project.name <> 'Sleeper' "
+          ."ORDER BY project,name";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    $project = '';
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+
+      if ($project != $row['project']) {
+        printf ("<h3>%s</h3>", $row['project']);
+        $project = $row['project'];
+      }
+
+      if ($row['list']) {
+        printf ("%s<br>", $row['email']);
+      } else {
+        printf ("%s &lt;%s&gt;<br>", $row['name'], $row['email']);
+      }
+    }
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/projects/infomail_send.wml b/src/LinuxTag/2004/projects/infomail_send.wml
new file mode 100644 (file)
index 0000000..dfce650
--- /dev/null
@@ -0,0 +1,102 @@
+#include <lt2003.style>
+
+<page title="Infomail">
+
+<?
+
+  function get_email ($project)
+  {
+    global $dbh;
+
+    $query = sprintf ("SELECT email FROM person WHERE project = '%s' AND ( list = 1 OR infomail = 1 ) AND email <> ''", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+        $row = pg_fetch_array ($sth, $nr);
+        if (strlen ($addr) > 0) {
+          $addr .= "," . $row['email'];
+        } else {
+          $addr = $row['email'];
+        }
+      }
+    }
+    return $addr;
+  }
+
+  function php_unscrew ($text)
+  {
+    # Der Himmel ist blau, das Wasser ist klar, die Vögel zwitschern
+    # draußen, doch PHP weigert sich beharrlich, vernünftig zu
+    # arbeiten.
+    #
+    # Problem: Im Form kommt " an, PHP macht daraus freundlicherweise \"
+    #          und schon sind unsere Daten in der SQL-DB kaputt.  Danke
+    # $mytext = ereg_replace ("\\\\", "\\\\", $text);
+    $mytext = ereg_replace ("\\\\", "", $text);
+    return ($mytext);
+  }
+
+  if ((strlen ($subject) > 0) && (strlen ($body) > 0) && (strlen ($number) > 0)) {
+    $dbh = pg_pconnect ("<dbconnstring>")
+                 or die("Unable to connect to SQL server");
+    // We don't need that anymore with magic_quotes_gpc off
+    // $body = php_unscrew ($body);
+
+    # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+    $query = "SELECT name FROM project WHERE name <> 'Supporter' ORDER by name";
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+
+<when <string-eq "$(ALTER_DATA)" "yes" />>
+       $url = sprintf ("http://www.infodrom.org/Debian/events/LinuxTag2003/infomail-%d.html", $number);
+       $url .= "\n[ available in a couple of hours ]";
+        
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+         $row = pg_fetch_array ($sth, $nr);
+
+         $msubject = sprintf ("[LT Infomail#%d] %s - %s", $number, $subject, $row['name']);
+         $header = "From: Martin Schulze <joey@linuxtag.org>";
+         $header .= "\nBcc: joey@infodrom.org";
+         $header .= "\nContent-Type: text/plain; charset=iso-8859-1";
+         $header .= "\nContent-Disposition: inline";
+         $header .= "\nContent-Transfer-Encoding: 8bit";
+
+         $email = get_email ($row['name']);
+
+        if (strlen ($email) > 0) {
+           # mail ("joey", $msubject, "To: " . $email . "\n\n" . $url . "\n\n" . $body, $header);
+           mail ($email, $msubject, $url . "\n\n" . $body, $header);
+        }
+      }
+
+      # Copy for mailing list
+      #
+      $msubject = sprintf ("[LT Infomail#%d] %s", $number, $subject);
+      $header = "From: Martin Schulze <joey@linuxtag.org>";
+      $header .= "\nBcc: lt2k-email@linuxtag.de,joey@infodrom.org";
+      $header .= "\nContent-Type: text/plain; charset=iso-8859-1";
+      $header .= "\nContent-Disposition: inline";
+      $header .= "\nContent-Transfer-Encoding: 8bit";
+
+      mail ("linuxtag-projects@lists.infodrom.org", $msubject, $url . "\n\n" . $body, $header);
+      # mail ("joey", $msubject, $url . "\n\n" . $body, $header);
+      echo ("<p><b>Mails sent.</b><p>");
+</when>
+<when <not <string-eq "$(ALTER_DATA)" "yes" />>>
+      echo ("<p><b>Mails not sent, because LinuxTag 2003 is over.</b><p>");
+</when>
+    }
+  } else {
+    echo ("<p><b>Empty fields, bugger.</b><p>");
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/projects/phptools.inc b/src/LinuxTag/2004/projects/phptools.inc
new file mode 100644 (file)
index 0000000..cd07154
--- /dev/null
@@ -0,0 +1,15 @@
+<?
+  function members ($project)
+  {
+    global $dbh;
+
+    $query = sprintf ("SELECT COUNT(*) FROM person,junction WHERE person = name "
+                    ."AND junction.project = '%s' AND list = 0", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+      return $row[0];
+    }
+  }
+?>
diff --git a/src/LinuxTag/2004/projects/show.wml b/src/LinuxTag/2004/projects/show.wml
new file mode 100644 (file)
index 0000000..41e6cbc
--- /dev/null
@@ -0,0 +1,189 @@
+#include <lt2003.style>
+#include "phptools.inc"
+#include "../phpfunctions.inc"
+
+<page title="Projects">
+
+<spokendate>
+<?
+  function display_description ($project)
+  {
+    global $dbh;
+
+    $query = sprintf ("SELECT description FROM appendix WHERE project = '%s'", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+       $row = pg_fetch_array ($sth, $nr);
+       printf ("<blockquote>%s</blockquote>", $row['description']);
+      }
+    }
+  }
+
+  function display_urls ($project, $url)
+  {
+    global $dbh;
+
+    $query = sprintf ("SELECT oid,url,description FROM urls WHERE project = '%s'", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    echo ("<strong>URLs</strong>:<br>");
+    if (strlen ($url)) {
+      printf ("&nbsp;&nbsp;<a href=\"%s\">%s</a> <br>", $url, $project);
+    }
+    if (pg_NumRows ($sth) > 0) {
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+       $row = pg_fetch_array ($sth, $nr);
+       printf ("&nbsp;&nbsp;<a href=\"%s\">%s</a> [<a href=\"edit_url.php3?oid=%d\">edit</a>]<br>",
+         $row['url'], $row['description'], $row['oid']);
+      }
+    }
+  }
+
+  function night ($project)
+  {
+    global $dbh;
+
+    $query = sprintf ("SELECT COUNT(*) FROM person WHERE project = '%s' AND list = 0 AND nightplace <> ''", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+      return $row[0];
+    }
+  }
+
+  function socialevent ($project)
+  {
+    global $dbh;
+
+    $query = sprintf ("SELECT COUNT(*) FROM person WHERE project = '%s' AND list = 0 AND socialevent = 1", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+      return $row[0];
+    }
+  }
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = sprintf ("SELECT * FROM project WHERE oid = %d ORDER BY name", $oid);
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    $row = pg_fetch_array ($sth, 0);
+
+    $project = $row['name'];
+
+    printf ("<h3><strong>%s</strong></h3>", $row['name']);
+    display_description ($row['name']);
+    display_urls ($row['name'], $row['url']);
+
+    if (strlen ($row['boothnr'])) {
+      printf ("<strong>Booth Nr.</strong>: %s<br>", $row['boothnr']);
+    }
+    if (strlen ($row['boothsize'])) {
+      printf ("<strong>Booth Size</strong>: %d<br>", $row['boothsize']);
+    }
+    printf ("<strong>Computer</strong>: %d<br>", $row['computer']);
+    $comment = $row['comment'];
+
+    $night = night ($project);
+    if ($night > 0) {
+      printf ("<strong>Night</strong>: %d<br>", $night);
+    }
+
+    $se = socialevent ($project);
+    if ($se > 0) {
+      printf ("<strong>Social Event Tickets</strong>: %d<br>", $se);
+    }
+
+    $query = sprintf ("SELECT name,email,list,socialevent,person.oid FROM person,junction "
+                    ."WHERE person = name AND junction.project = '%s' ORDER BY name", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      printf ("<strong>Members</strong> (%d):<br>", members ($project));
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+       $row = pg_fetch_array ($sth, $nr);
+       if ($row['list']) {
+         if (strlen ($row['name']) && ($row['name'] != $row['email'])) {
+           printf ("&nbsp;&nbsp;(<a href=\"edit_person.php3?context=%s&oid=%d\">%s</a> &lt;%s&gt;)<br>",
+                   urlencode ($project),
+                   $row['oid'], $row['name'], $row['email']);
+         } else {
+           printf ("&nbsp;&nbsp;(<a href=\"edit_person.php3?context=%s&oid=%d\">%s</a>)<br>",
+                   urlencode ($project),
+                   $row['oid'], $row['email']);
+         }
+       } elseif ($row['email']) {
+         printf ("&nbsp;&nbsp;<a href=\"edit_person.php3?context=%s&oid=%d\">%s</a> &lt;%s&gt;%s<br>",
+                 urlencode ($project),
+                 $row['oid'], $row['name'], $row['email'],
+                 $row['socialevent'] == 1?" [S]":"");
+       } else {
+         printf ("&nbsp;&nbsp;<a href=\"edit_person.php3?context=%s&oid=%d\">%s</a>%s<br>",
+                 urlencode ($project),
+                 $row['oid'], $row['name'],
+                 $row['socialevent'] == 1?" [S]":"");
+       }
+      }
+    }
+
+    # Supplies ----------------------------------------
+    $query = sprintf ("SELECT supplies.amount,supplylist.name,supplylist.height,supplylist.width,supplylist.depth,supplylist.id"
+                    .",supplylist.price FROM supplylist,supplies "
+                    ."WHERE supplylist.id = supplies.supply AND project='%s' ORDER by id",
+                    $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      echo "<strong>Supplies</strong><br>";
+      $price = 0.00;
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+       $row = pg_fetch_array ($sth, $nr);
+
+       printf ("<br>&nbsp;&nbsp;%d [%s] %s", $row['amount'], $row['id'], $row['name']);
+       if ($row['height'] > 0) {
+         printf (" (%dx%dx%d)", $row['height'], $row['width'], $row['depth']);
+       }
+       $price += ($row['amount'] * $row['price']);
+      }
+      printf ("<br>Kosten: %6.2f Euro", $price);
+    }
+
+    # Comments ----------------------------------------
+    $query = sprintf ("SELECT oid,date,who,email,body FROM comments WHERE project = '%s' ORDER BY date", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+       $row = pg_fetch_array ($sth, $nr);
+
+       $date = explode (" ", $row['date']);
+       $date = spokendate ($date[0]);
+
+       printf ("<hr><strong><a href=\"edit_comment.php3?oid=%d\">%s by %s <font size=\"-1\">&lt;%s&gt;</font></a></strong><p>%s",
+         $row['oid'], $date, $row['who'], $row['email'], $row['body']);
+      }
+    }
+
+    # FIXME -- DELETEME
+    #if (strlen ($comment)) {
+    #  echo ("<p>" . $comment . "<p>");
+    #}
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/projects/submenu.inc b/src/LinuxTag/2004/projects/submenu.inc
new file mode 100644 (file)
index 0000000..0f029b5
--- /dev/null
@@ -0,0 +1,33 @@
+<strong>Menu</strong><br>
+
+&nbsp;<menu-item base=index text=Index href=index.php3><br>
+
+<when <string-eq "<get-var WML_SRC_BASENAME>" "show" />>
+<?
+  printf ("&nbsp;<a href=\"edit.php3?oid=%d\">Edit</a><br>", $oid);
+  printf ("&nbsp;<a href=\"edit_person.php3?project=%d\">Add member</a><br>", $oid);
+  printf ("&nbsp;<a href=\"edit_url.php3?project=%d\">Add url</a><br>", $oid);
+  printf ("&nbsp;<a href=\"../workshops/edit.php3?project=%d\">Add workshop</a><br>", $oid);
+# printf ("&nbsp;<a href=\"edit_supplies.php3?project=%d\">Edit supplies</a><br>", $oid);
+  printf ("&nbsp;<a href=\"edit_comment.php3?project=%d\">Add comment</a><br>", $oid);
+?>
+</when>
+
+<when <not <string-eq "<get-var WML_SRC_BASENAME>" "show" />>>
+&nbsp;<menu-item base=edit text="New" href=edit.php3><br>
+&nbsp;<menu-item base=edit_comment text="Add&nbsp;Comment" href=edit_comment.php3><br>
+</when>
+
+&nbsp;<menu-item base=infomail text="Infomail"><br>
+
+<p><line height=2>
+
+<p><strong>Reports</strong><br>
+
+&nbsp;<menu-item base=infomail_recipient text="Addresses" href=infomail_recipient.php3><br>
+&nbsp;<menu-item base=accounts text="Accounts" href=accounts.php3><br>
+&nbsp;<menu-item base=accounts text="Admins" href=admins.php3><br>
+
+<p><line height=2>
+
+#include "../functions.inc" prefix="../"
diff --git a/src/LinuxTag/2004/projects/update.wml b/src/LinuxTag/2004/projects/update.wml
new file mode 100644 (file)
index 0000000..b4bd0d6
--- /dev/null
@@ -0,0 +1,391 @@
+#include <lt2003.style>
+#include "../phpfunctions.inc"
+
+<when <not <string-eq "$(NILI)" "" />>>
+<insert_nili>
+</when>
+
+<randpass>
+
+<page title="Projects">
+
+<?
+  function update_supply ($project, $supply, $amount)
+  {
+    global $dbh;
+
+    $query = sprintf ("SELECT amount FROM supplies WHERE project = '%s' AND supply = '%s'", $project, $supply);
+    $sth = pg_exec ($dbh, $query); # or die("Datenbank-Abfrage!");
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+    }
+
+    if ($row['amount'] > 0) {
+      if ($row['amount'] != $amount) {
+        if ($amount > 0) {
+         $query = sprintf ("UPDATE supplies SET amount = %d WHERE project = '%s' AND supply = '%s'",
+                           $amount, addslashes ($project), $supply);
+       } else {
+         $query = sprintf ("DELETE FROM supplies WHERE project = '%s' AND supply = '%s'", $project, $supply);
+       }
+      }
+    } else {
+      if ($amount > 0) {
+        $query = sprintf ("INSERT INTO supplies (supply,project,amount,comment) VALUES ('%s','%s',%d,'')",
+                         $supply, addslashes ($project), $amount);
+      }
+    }
+
+    if (strlen ($query)) {
+      $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+    }
+  }
+
+  function find_person ($dbh, $oid)
+  {
+    $query = sprintf ("SELECT name,email FROM person WHERE oid = %d", $oid);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+    } else {
+      $row['email'] = "";
+      $row['name'] = "";
+    }
+    return $row;
+  }
+
+  if (!$type) die ("No type given");
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  if ($type == "project") {
+    pg_exec ($dbh, "BEGIN TRANSACTION") or die("Datenbank-Abfrage!");
+
+    if ($delete == 1) {
+
+      # The following should not be required if CASCADE is supported by PostgreSQL
+      #
+      $query = sprintf ("SELECT name FROM person WHERE project = '%s'", addslashes ($name));
+      $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+        $row = pg_fetch_array ($sth, $nr);
+        pg_exec ($dbh, sprintf ("DELETE FROM nili WHERE person = '%s'",
+                               addslashes ($row['name']))) or die ("Cannot delete nili.");
+      }
+
+      pg_exec ($dbh, sprintf ("DELETE FROM person WHERE project = '%s'", addslashes ($name))) or die ("Cannot delete persons.");
+      pg_exec ($dbh, sprintf ("DELETE FROM project WHERE oid = %d", $oid));
+
+      # This should be handled by a cascade in the next version
+      if ($appendixoid > 0) {
+        pg_exec ($dbh, sprintf ("DELETE FROM appendix WHERE oid = %d", $appendixoid));
+      }
+
+    } elseif ($oid == 0) {
+      $query = sprintf ("INSERT INTO project (name,url,boothnr,boothsize,computer,comment) VALUES ('%s','%s','%s',%d,%d,'%s')",
+                       addslashes ($name),
+                       addslashes ($url),
+                       addslashes ($boothnr),
+                       $boothsize, $computer,
+                       addslashes ($comment));
+      pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+      if (strlen ($boothtitle) > 0 || strlen ($description) > 0 || strlen ($description_en) > 0) {
+       $query = sprintf ("INSERT INTO appendix (project,boothtitle,description,description_en) VALUES ('%s','%s','%s','%s')",
+                         addslashes ($name),
+                         addslashes ($boothtitle),
+                         addslashes ($description),
+                         addslashes ($description_en));
+       pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+      }
+
+    } else {
+    $query = sprintf ("SELECT name FROM project WHERE oid = %d", $oid);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+      $oldname = $row['name'];
+    } else {
+      die ("Project without a name?  Uh?");
+    }
+
+    $query = sprintf ("SELECT oid FROM appendix WHERE project = '%s'", $oldname);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+      $appendixoid = $row['oid'];
+    } else {
+      $appendixoid = 0;
+    }
+
+    # Now we know enough and can continue
+
+      $query = sprintf ("UPDATE project SET name='%s',url='%s',boothnr='%s',"
+                      ."boothsize=%d,computer=%d,comment='%s' WHERE oid = %d",
+                      addslashes ($name),
+                      addslashes ($url),
+                      addslashes ($boothnr),
+                      $boothsize, $computer,
+                      addslashes ($comment), $oid);
+      pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+      if (strlen ($boothtitle) > 0 || strlen ($description) > 0 || strlen ($description_en) > 0) {
+        if ($appendixoid > 0) {
+         $query = sprintf ("UPDATE appendix SET project='%s',boothtitle='%s',description='%s',description_en='%s'"
+                          ." WHERE oid = %d",
+                          addslashes ($name),
+                          addslashes ($boothtitle),
+                          addslashes ($description),
+                          addslashes ($description_en),
+                          $appendixoid);
+       } else {
+         $query = sprintf ("INSERT INTO appendix (project,boothtitle,description,description_en) VALUES ('%s','%s','%s','%s')",
+                           addslashes ($name),
+                           addslashes ($boothtitle),
+                           addslashes ($description),
+                           addslashes ($description_en));
+       }
+        pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+      } else {
+        if ($appendixoid > 0) {
+          pg_exec ($dbh, sprintf ("DELETE FROM appendix WHERE oid = %d", $appendixoid));
+       }
+      }
+    }
+
+    pg_exec ($dbh, "COMMIT") or die("Datenbank-Abfrage!");
+
+    # Only to ensure no query is executed later
+    $query = '';
+  } elseif ($type == "person") {
+    # Begin transaction
+    pg_exec($dbh, "BEGIN TRANSACTION") or die ("Could not start transaction.");
+
+    if ($delete == 1) {
+      $query = sprintf ("SELECT name,project FROM person WHERE oid = %d", $oid);
+      $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+      if (pg_NumRows ($sth) > 0) {
+        $row = pg_fetch_array ($sth, 0);
+       $name = $row['name'];
+       $primproject = $row['project'];
+      }
+
+      $query = sprintf ("SELECT project FROM junction WHERE person = '%s' AND project <> '%s'",
+                       addslashes($name),
+                       addslashes($context));
+      $sth = pg_exec($dbh, $query) or die ("Cannot investigate junction.");
+
+      if (pg_NumRows ($sth) == 0) {
+
+        $query = sprintf ("DELETE FROM junction WHERE person = '%s'", addslashes ($name));
+        pg_exec($dbh, $query) or die ("Cannot delete person");
+
+        $query = sprintf ("DELETE FROM person WHERE oid = %d", $oid);
+        pg_exec($dbh, $query) or die ("Cannot delete person");
+
+<when <not <string-eq "$(NILI)" "" />>>
+        $query = sprintf("DELETE from nili where person = '%s'", addslashes($name));
+        pg_exec($dbh, $query) or die ("Cannot delete nilis");
+</when>                
+
+      } else { # pg_NumRows() > 0 ==> user is member of >1 projects
+       $query = sprintf("DELETE from junction where person = '%s' AND project = '%s'",
+                        addslashes($name),
+                        addslashes($context));
+       pg_exec($dbh, $query) or die ("Cannot delete junction.");
+
+        if ($primproject == $context) {
+          $row = pg_fetch_array($sth, 0);
+        
+          $query = sprintf ("UPDATE person SET project = '%s',admin=0 WHERE name = '%s'",
+                          addslashes ($row['project']),
+                          addslashes ($name));
+          pg_exec($dbh, $query) or die ("Cannot adjust person.");
+        }
+      }
+    } else {
+      $newpass = '';
+      $oldmail = $email;
+      if (empty($email)) {
+       $email = 'NULL';
+      } else {
+       $email = "'".addslashes ($email)."'";
+      }
+
+      if ($list == 1) {
+        $infomail = 0;
+       $insurance = 0;
+       $socialevent = 0;
+       $admin = 0;
+       $nightplace = '';
+       $login = 0;
+      }
+
+      if ($password == 1 && $login == 1 && strlen ($oldmail) > 0) {
+        $newpass = randpass();
+      }
+
+      if ($oid == 0) {
+       $query = sprintf ("SELECT name FROM person WHERE name = '%s'", addslashes ($name));
+       $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+       if (pg_NumRows ($sth) == 0) {
+          $query = sprintf ("INSERT INTO person (name,email,project,nightplace,infomail,insurance,socialevent,list,admin,"
+                      ."login,password,comment) "
+                      ."VALUES ('%s',%s,'%s','%s',%d,%d,%d,%d,%d,%d,'%s','%s')",
+                      addslashes ($name),
+                      $email,
+                      addslashes ($project),
+                      addslashes ($nightplace),
+                      $infomail, $insurance, $socialevent, $list,
+                      $admin, $login, strlen ($newpass)?md5 ($newpass):"",
+                      addslashes ($comment));
+         pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+       } else {
+         $nerwpass = '';
+       }
+
+       # Check if the person is already a member of this project
+       $query = sprintf ("SELECT person FROM junction WHERE person = '%s' AND project = '%s'",
+                         addslashes ($name),
+                         addslashes ($project));
+       $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+       if (pg_NumRows ($sth) == 0) {
+         $query = sprintf ("INSERT INTO junction (person,project) VALUES ('%s', '%s')",
+                          addslashes ($name),
+                          addslashes ($project));
+         pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+       }
+      } else {
+        $query = sprintf ("UPDATE person SET name='%s',email=%s,project='%s',"
+                      ."nightplace='%s',infomail=%d,insurance=%d,socialevent=%d,list=%d,admin=%d,login=%d,comment='%s'",
+                      addslashes ($name),
+                      $email,
+                      addslashes ($project),
+                      addslashes ($nightplace),
+                      $infomail, $insurance, $socialevent, $list, $admin, $login,
+                      addslashes ($comment));
+
+        if (strlen ($newpass) > 0) {
+          $query .= sprintf (",password='%s'", addslashes (md5 ($newpass)));
+        }
+        $query .= sprintf (" WHERE oid = %d", $oid);
+       pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+<when <not <string-eq "$(NILI)" "" />>>
+       $query = sprintf("DELETE from nili where person = '%s'", addslashes($name));
+       pg_exec($dbh, $query) or die ("Cannot delete from nili");
+</when>
+      }
+
+<when <not <string-eq "$(NILI)" "" />>>
+      insert_nili();
+</when>
+
+      if (strlen ($newpass) > 0) {
+       mail_password($oldmail, $newpass);
+      }
+
+    }
+
+    # Finish transaction
+    pg_exec($dbh, "COMMIT") or die ("Could not finish transaction.");
+
+    # Only to ensure no query is executed later
+    $query = '';
+  } elseif ($type == "url") {
+    if ($delete == 1) {
+      $query = sprintf ("DELETE FROM urls WHERE oid = %d", $oid);
+    } elseif ($oid == 0) {
+      $query = sprintf ("INSERT INTO urls (project,url,description,visible) "
+                      ."VALUES ('%s','%s','%s', %d)",
+                      addslashes ($project), $url, addslashes ($description), $visible);
+    } else {
+      $query = sprintf ("UPDATE urls SET url='%s',description='%s',visible=%d WHERE oid = %d",
+                      $url, addslashes ($description), $visible, $oid);
+    }
+  } elseif ($type == "comment") {
+    if (strlen ($personid)) {
+      $foo = find_person ($dbh, $personid);
+      $who = $foo['name'];
+      $email = $foo['email'];
+    }
+
+    if (!strlen ($who)) {
+      $who = $REMOTE_USER;
+      if ($who == "joey") {
+        $who = "Martin Schulze";
+      }
+      $email = $REMOTE_USER . "@linuxtag.de";
+   }
+   if ($delete == 1) {
+      $query = sprintf ("DELETE FROM comments WHERE oid = %d", $oid);
+    } elseif ($oid == 0) {
+      if (! isset ($date) || $date == '') {
+        $date = date ("Y-m-j H:i");
+      }
+      $query = sprintf ("INSERT INTO comments (project,date,who,email,body) "
+                      ."VALUES ('%s','%s','%s','%s','%s')",
+                      addslashes ($project),
+                      addslashes ($date),
+                      addslashes ($who),
+                      addslashes ($email),
+                      addslashes ($body));
+    } else {
+      $query = sprintf ("UPDATE comments SET who='%s',email='%s',project='%s',date='%s',body='%s' "
+                      ."WHERE oid = %d",
+                      addslashes ($who),
+                      addslashes ($email),
+                      addslashes ($project),
+                      addslashes ($date),
+                      addslashes ($body),
+                      $oid);
+    }
+  } elseif ($type == "supplylist") {
+   if ($delete == 1) {
+      $query = sprintf ("DELETE FROM supplylist WHERE oid = %d", $oid);
+    } elseif ($oid == 0) {
+      $price = ereg_replace(",", ".", $price);
+      $query = sprintf ("INSERT INTO supplylist (id,name,height,width,depth,img_src,img_height,img_width,price,visible,comment) "
+                      ."VALUES ('%s','%s',%d,%d,%d,'%s',%d,%d,%s,%d,'%s')",
+                      $id,$name,$height,$width,$depth,$img_src,$img_height,$img_width,$price,$visible,$comment);
+    } else {
+      $price = ereg_replace(",", ".", $price);
+      $query = sprintf ("UPDATE supplylist SET id='%s',name='%s',height=%d,width=%d,depth=%d,"
+                      ."img_src='%s',img_height=%d,img_width=%d,price=%s,visible=%d,comment='%s' "
+                      ."WHERE oid = %d",
+                      $id,$name,$height,$width,$depth,$img_src,$img_height,$img_width,$price,$visible,$comment, $oid);
+    }
+  } elseif ($type == "supplies") {
+    $query = "SELECT id FROM supplylist";
+
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+       $row = pg_fetch_array ($sth, $nr);
+
+       update_supply ($project, $row['id'], $HTTP_POST_VARS[$row['id']]);
+      }
+    }
+
+  } else {
+    echo ("<p><b>Unknown type</b><p>");
+  }
+
+  if (strlen ($query)) {
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+  }
+?>
+
+<p><b>Done</b><p>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/submenu.inc b/src/LinuxTag/2004/submenu.inc
new file mode 100644 (file)
index 0000000..bb5576c
--- /dev/null
@@ -0,0 +1 @@
+#include "functions.inc"
diff --git a/src/LinuxTag/2004/supporter/accounts.wml b/src/LinuxTag/2004/supporter/accounts.wml
new file mode 100644 (file)
index 0000000..9676176
--- /dev/null
@@ -0,0 +1,40 @@
+#include <lt2003.style>
+
+<page title="Supporter -- Accounts">
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+               or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = "SELECT name,email,admin FROM person "
+          ."WHERE project = 'Supporter' AND list = 0 AND login = 1 AND email <> ''"
+          ."ORDER BY name";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    $project = '';
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+
+      if ($project != $row['project']) {
+        printf ("<h3>%s</h3>", $row['project']);
+        $project = $row['project'];
+      }
+
+      if ($row['admin'] == 1) {
+        printf ("<strong>%s &lt;%s&gt;</strong><br>", $row['name'], $row['email']);
+      } else {
+        printf ("%s &lt;%s&gt;<br>", $row['name'], $row['email']);
+      }
+    }
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/supporter/availability.wml b/src/LinuxTag/2004/supporter/availability.wml
new file mode 100644 (file)
index 0000000..a5359ac
--- /dev/null
@@ -0,0 +1,175 @@
+#include <lt2003.style>
+#include "../edit.style"
+#include "jobs.inc"
+
+<build_timeframe>
+<tab_avail_stubs>
+<page title="Supporter -- Availability">
+
+<?
+  $limit = '';
+  reset ($ltdays);
+  while (list($key,$day) = each ($ltdays)) {
+    if ($GLOBALS["day_".$key] == 1) {
+      $foo = explode (",", $day);
+      if (strlen ($limit) == 0) {
+        $limit = $foo[0];
+     } else {
+        $limit .= ", " . $foo[0];
+      }
+    }
+  }
+
+  if (strlen ($limit) > 0) {
+    printf ("<p><b>Output limited to</b>: %s</p>", $limit);
+  }
+
+?>
+
+<p>
+<table cellpadding=0 cellspacing=1>
+<?
+  printf ($f_header_head, "<colh>");
+  reset ($ltdays);
+  $col = array();
+  while (list($key,$day) = each ($ltdays)) {
+    if ($limitation != 1 || $GLOBALS["day_".$key] == 1) {
+      $foo = explode (",", $day);
+      printf ($f_header_day, $foo[0]);
+      $col[] = $key;
+    }
+  }
+  echo ($f_header_tail);
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+               or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $person = array ();
+
+  if ($limitation != 1) {
+    $query = "SELECT person.oid,name FROM person,junction "
+           ."WHERE junction.person = person.name AND junction.project='Supporter' "
+           ."ORDER BY upper(name)";
+
+    $sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
+
+    for ($nr = 0; $nr < pg_NumRows($sth); $nr++)
+    {
+      $row = pg_fetch_array($sth, $nr);
+      $person[] = $row['name'];
+      $available[$row['name']] = array ('oid' => $row['oid']);
+    }
+  }
+
+  $query = "SELECT person.oid,name,starttime,endtime FROM availability,person "
+                  ."WHERE person.name = availability.person "
+                  ."ORDER BY upper(name)";
+
+  $sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
+
+  $thisname = '';
+  for ($nr = 0; $nr < pg_NumRows($sth); $nr++)
+  {
+    $row = pg_fetch_array($sth, $nr);
+
+    if ($thisname != $row['name']) {
+      if ($thisname != '') {
+        $available[$thisname] = $avail;
+      }
+      if ($limitation == 1) {
+        $person[] = $row['name'];
+      }
+      $avail = array ('oid' => $row['oid']);
+      $thisname = $row['name'];
+    }
+
+    $foo = explode (" ", $row['starttime']);
+    $time = build_timeframe ($row['starttime'], $row['endtime']);
+    if (strlen ($avail[$foo[0]]) > 0) {
+      $avail[$foo[0]] .= "&nbsp;" . $time;
+    } else {
+      $avail[$foo[0]] = $time;
+    }
+  }
+  $available[$thisname] = $avail;
+
+  $colindex = count ($col);
+  $color = "<cold>";
+  $empty = true;
+  $line = '';
+  reset ($person);
+  while (list(,$name) = each ($person)) {
+    reset ($col);
+    while (list(,$day) = each ($col)) {
+      if (strlen ($available[$name][$day]) > 0) {
+       $empty = false;
+        $line .= sprintf ($f_row_day, $available[$name][$day]);
+      } else {
+        $line .= sprintf ($f_row_day, "&nbsp;");
+      }
+    }
+
+    if (isset ($limitation) && $empty) {
+      $line = '';
+    } else {
+      $color = $color=="<cold>"?"<coln>":"<cold>";
+      printf ($f_row_head, $color, "supporter", $available[$name]['oid'], $name);
+      echo ($line);
+      echo ($f_row_tail);
+      $empty = true;
+      $line = '';
+    }
+  }
+?>
+</table>
+</p>
+
+<p>
+<b>Limit Output</b>.  You can limit the output to certain days and
+people working on certain tasks.</p>
+
+<form method=get action=availability.php3>
+<input type=hidden name=limitation value=1>
+
+<center><table cellpadding=0 cellspacing=1>
+
+<?
+  $first = true;
+  reset ($ltdays);
+  while (list($key,$day) = each ($ltdays)) {
+    if ($first) {
+      $first = false;
+?>
+<row_checkbox  name="day_<? echo $key; ?>"
+               title="<b>Days</b>"
+               descr="<? echo $day; ?>"
+               checked="<? echo (!isset ($limitation) || $GLOBALS["day_".$key] == 1)?"checked":''; ?>"
+               >
+<?
+    } else {
+?>
+<row_checkbox  name="day_<? echo $key; ?>"
+               title="&nbsp;"
+               descr="<? echo $day; ?>"
+               checked="<? echo (!isset ($limitation) || $GLOBALS["day_".$key] == 1)?"checked":''; ?>"
+               >
+<?
+    }
+  }
+?>
+
+<row_submit_plain>
+
+</table></center>
+
+</form>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
+
diff --git a/src/LinuxTag/2004/supporter/edit.wml b/src/LinuxTag/2004/supporter/edit.wml
new file mode 100644 (file)
index 0000000..c8a226d
--- /dev/null
@@ -0,0 +1,360 @@
+#include <lt2003.style>
+#include "../edit.style"
+#include "jobs.inc"
+
+<row_select>
+<build_timeframe>
+<page title="Edit Supporter">
+
+<?
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  if ($oid) {
+    $query = sprintf ("SELECT * FROM person WHERE oid = %d", $oid);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+
+      $name = $row['name'];
+    }
+  } else {
+    # Default to let people log in
+    $row = array();
+    $row['login'] = 1;
+    $row['project'] = 'Supporter';
+  }
+
+
+# Mögliche Optimierung: Nachfolgende Queries können durch einen
+# einzigen Query abgedeckt werden, der alle Tage Ã¼berdeckt und die
+# passenden internen Variablen mit sinnvollen Werten füttert.  Das
+# wären dann noch genzu zwei Queries anstelle von fünf.
+
+?>
+<form method=post action=update.php3>
+<input type=hidden name=type value="person">
+<input type=hidden name=oid value="<? echo $oid; ?>">
+<center><table cellpadding=0 cellspacing=1>
+
+<?
+  $projects = array ();
+  $query = sprintf ("SELECT project FROM junction WHERE person = '%s' ORDER BY project", $row['name']);
+  $sth2 = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth2) > 0) {
+    for ($nr=0; $nr < pg_NumRows ($sth2); $nr++) {
+      $srow = pg_fetch_array ($sth2, $nr);
+      $projects[] = $srow['project'];
+    }
+  }
+
+  if ( count ($projects) > 1) {
+?>
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><b>Project</b></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial"><select name=project>
+<?
+      for ($nr=0; $nr < count ($projects); $nr++) {
+       printf ("<option value=\"%s\"%s>%s\n", $projects[$nr],
+               $row['project'] == $projects[$nr]?" selected":"", $projects[$nr]);
+      }
+?>
+</select>
+</font></td></tr>
+<?
+  } else {
+?>
+<input type=hidden name=project value="<? echo $row['project']; ?>">
+<?
+  }
+?>
+
+<row_input     name=name
+               title="<b>Name</b>"
+               value="<? echo $row['name']; ?>"
+               >
+<row_input     name=email
+               title="<b>E-Mail</b>"
+               value="<? echo $row['email']; ?>"
+               >
+
+<when <not <string-eq "$(NILI)" "" />>>
+<? if ($row['list'] == 0) { ?>
+<row_input     name=nightplace
+               title="<b>Nightplace</b>"
+               value="<? echo $row['nightplace']; ?>"
+               >
+<? } ?>
+</when>
+
+<row_input     name=comment
+               title="<b>Comment</b>"
+               value="<? echo $row['comment']; ?>"
+               >
+
+<row_radiobox  name=infomail
+               title="<b>Infomail</b>"
+               checked_0="<? if ($row['infomail']==0) { echo "checked";} ?>"
+               checked_1="<? if ($row['infomail']==1) { echo "checked";} ?>"
+               >
+
+<? if ($row['list'] == 0) { ?>
+
+<when <not <string-eq "$(INSURANCE)" "" />>>
+<row_radiobox  name=insurance
+               title="<b>Insurance</b>"
+               checked_0="<? if ($row['insurance']==0) { echo "checked";} ?>"
+               checked_1="<? if ($row['insurance']==1) { echo "checked";} ?>"
+               >
+</when>
+
+<? } ?>
+
+<row_radiobox  name=list
+               title="<b>List</b>"
+               checked_0="<? if ($row['list']==0) { echo "checked";} ?>"
+               checked_1="<? if ($row['list']==1) { echo "checked";} ?>"
+               >
+
+<row_checkbox  name=admin
+               title="<b>Admin</b>"
+               descr="Manages the primary project"
+               checked="<? if ($row['admin']==1) { echo \"checked\";} ?>"
+               >
+
+<row_checkbox  name=login
+               title="<b>Login</b>"
+               descr="Permission to log in"
+               checked="<? if ($row['login']==1) { echo \"checked\";} ?>"
+               >
+
+<row_checkbox  name=password
+               title="<b>Password</b>"
+               descr="Randomize password"
+               checked="<? if (!isset ($oid)) { echo 'checked'; } ?>"
+               >
+
+<when <not <string-eq "$(NILI)" "" />>>
+<?
+$nili = array();
+
+if ($new <> 1)
+{
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = sprintf ("SELECT oid,breakfast,dinner,sleeping,comment,date(date) FROM nili WHERE person = '%s'" .
+                  " AND date in ('<iso-event-date-1>', '<iso-event-date_0>', '<iso-event-date_1>', " .
+                  "'<iso-event-date_2>', '<iso-event-date_3>', '<iso-event-date_4>')", addslashes($row['name']));
+
+  $sth2 = pg_exec ($dbh, $query) or die ("Cannot execute nili-query");
+
+// This query is allowed to return 0 rows
+
+  for ($x = 0; $x < pg_NumRows($sth2); $x++)
+  {
+       $row2 = pg_fetch_array ($sth2, $x);
+       $nili[$row2[5]] = $row2;
+  }
+
+}
+?>
+
+<row_checkbox  name=dinner-<iso-event-date-1>
+               title="<b><name-event-date-1></b>"
+               descr="Dinner"
+               checked="<? if ($nili['<iso-event-date-1>']['dinner'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=sleeping-<iso-event-date-1>
+               title="<iso-event-date-1>"
+               descr="Sleeping"
+               checked="<? if ($nili['<iso-event-date-1>']['sleeping'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=breakfast-<iso-event-date_0>
+               title="<b><name-event-date_0></b>"
+               descr="Breakfast"
+               checked="<? if ($nili['<iso-event-date_0>']['dinner'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=dinner-<iso-event-date_0>
+               title="<iso-event-date_0>"
+               descr="Dinner"
+               checked="<? if ($nili['<iso-event-date_0>']['dinner'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=sleeping-<iso-event-date_0>
+               title=""
+               descr="Sleeping"
+               checked="<? if ($nili['<iso-event-date_0>']['sleeping'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=breakfast-<iso-event-date_1>
+               title="<b><name-event-date_1></b>"
+               descr="Breakfast"
+               checked="<? if ($nili['<iso-event-date_1>']['breakfast'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=dinner-<iso-event-date_1>
+               title="<iso-event-date_1>"
+               descr="Dinner"
+               checked="<? if ($nili['<iso-event-date_1>']['dinner'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name=sleeping-<iso-event-date_1>
+               title=""
+               descr="Sleeping"
+               checked="<? if ($nili['<iso-event-date_1>']['sleeping'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="breakfast-<iso-event-date_2>"
+               title="<b><name-event-date_2></b>"
+               descr="Breakfast"
+               checked="<? if ($nili['<iso-event-date_2>']['breakfast'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="dinner-<iso-event-date_2>"
+               title="<iso-event-date_2>"
+               descr="Dinner"
+               checked="<? if ($nili['<iso-event-date_2>']['dinner'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="sleeping-<iso-event-date_2>"
+               title=""
+               descr="Sleeping"
+               checked="<? if ($nili['<iso-event-date_2>']['sleeping'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="breakfast-<iso-event-date_3>"
+               title="<b><name-event-date_3></b>"
+               descr="Breakfast"
+               checked="<? if ($nili['<iso-event-date_3>']['breakfast'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="dinner-<iso-event-date_3>"
+               title="<iso-event-date_3>"
+               descr="Dinner"
+               checked="<? if ($nili['<iso-event-date_3>']['dinner'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="sleeping-<iso-event-date_3>"
+               title=""
+               descr="Sleeping"
+               checked="<? if ($nili['<iso-event-date_3>']['sleeping'] == 1) { echo 'checked'; } ?>"
+               >
+
+<row_checkbox  name="breakfast-<iso-event-date_4>"
+               title="<b><name-event-date_4></b>"
+               descr="Breakfast"
+               checked="<? if ($nili['<iso-event-date_4>']['breakfast'] == 1) { echo 'checked'; } ?>"
+               >
+</when>
+
+<row_delim     msg="<b>Availability</b>"
+               >
+
+<?
+  if (! isset ($oid)) {
+    reset ($ltdays);
+    $counter=0;
+    while (list($key,$day) = each ($ltdays)) {
+      if ($day == $ltdays[0]) { continue; }
+      $append = sprintf ("_%d", $counter);
+
+      row_select ("Date", "date".$append, $ltdays, $key, 0);
+?>
+
+<row_input     name="shift<? echo $append; ?>"
+               title="<b>Shift</b>"
+               value=""
+               >
+
+<?
+      $counter++;
+    }
+    $empties = 1;
+  } else {
+    $thisday = '';
+    $counter = 0;
+    $query = sprintf ("SELECT starttime,endtime,comment,oid FROM availability "
+                    ."WHERE person = '%s' ORDER BY starttime",
+                    addslashes ($row['name']));
+    $sth = pg_exec($dbh, $query) or die ("Database Query");
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $append = sprintf ("_%d", $counter);
+      $row = pg_fetch_array($sth, $nr);
+
+      printf ("<input type=\"hidden\" name=\"oid%s\" value=\"%d\">", $append, $row['oid']);
+      $foo = explode (" ", $row['starttime']);
+      if ($thisday != $foo[0]) {
+        $thisday = $foo[0];
+       row_select ("Date", "date".$append, $ltdays, $thisday, 0);
+      }
+      $shift = build_timeframe ($row['starttime'], $row['endtime']);      
+?>
+<row_input     name="shift<? echo $append; ?>"
+               title="<b>Shift</b>"
+               value="<? echo $shift; ?>"
+               >
+<row_input     name="comment<? echo $append; ?>"
+               title="<b>Comment</b>"
+               value="<? echo $row['comment']; ?>"
+               >
+<?
+      $counter++;
+    }
+
+    
+    if (strlen ($row2['section'])) {
+      $sections[$row2['section']] = $row2['section'];
+    }
+    if (pg_NumRows ($sth) > 0) {
+      $empties = 2;
+    } else {
+      $empties = 5;
+    }
+  }
+
+  # Warning: Continues to use the counter variable from above
+  for ($nr=0; $nr < $empties; $nr++) {
+    $append = sprintf ("_%d", $counter);
+    row_select ("Date", "date".$append, $ltdays, "", 1);
+?>
+<row_input     name="shift<? echo $append; ?>"
+               title="<b>Shift</b>"
+               value=""
+               >
+<?  if (isset ($oid)) { ?>
+<row_input     name="comment<? echo $append; ?>"
+               title="<b>Comment</b>"
+               value=""
+               >
+<?
+    }
+    $counter++;
+  }
+  printf ("<input type=\"hidden\" name=\"maxcounter\" value=\"%d\">", $counter);
+?>
+
+<? if ($oid > 0) { ?>
+<row_radiobox  name=delete
+               title="<b>Delete</b>"
+               checked_0="checked"
+               checked_1=""
+               >
+<? } ?>
+
+<row_submit>
+
+</table></center></form>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/supporter/edit_comment.wml b/src/LinuxTag/2004/supporter/edit_comment.wml
new file mode 100644 (file)
index 0000000..ed09dcc
--- /dev/null
@@ -0,0 +1,119 @@
+#include <lt2003.style>
+#include "../edit.style"
+
+<page title="Edit Comments">
+
+<?
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  if ($oid > 0) {
+    pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+    $query = sprintf ("SELECT * FROM comments WHERE oid = %d", $oid);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+    }
+  } else {
+    $query = sprintf ("SELECT name FROM project WHERE oid = %d", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+    }
+  }
+
+  if (strlen ($row['name']) == 0) {
+    $row['name'] = "Supporter";
+  }
+
+?>
+
+<? if (strlen ($row['name']) > 0) { ?>
+<h3>Comment for Support</h3>
+<? } ?>
+
+<form method=post action=update.php3>
+<input type=hidden name=type value="comment">
+<input type=hidden name=oid value="<? echo $oid; ?>">
+<? if (strlen ($row['name']) > 0) { ?>
+<input type=hidden name=project value="<? echo $row['name']; ?>">
+<? } ?>
+<center><table cellpadding=0 cellspacing=1>
+
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><b>Project</b></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial">Supporter</font></td></tr>
+
+<?
+  if (strlen ($oid) == 0) {
+    if (strlen ($row['name']) > 0) {
+      $query = sprintf ("SELECT person.name,person.oid FROM person,junction "
+                       ."WHERE junction.person = person.name AND junction.project = '%s' ORDER BY name",
+                      $row['name']);
+    } else {
+      $query = "SELECT person.name,junction.project,person.oid FROM person,junction "
+             ."WHERE junction.person = person.name ORDER BY project,name";
+    }
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+?>
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><b>Member</b></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial"><select name=personid><option value="">-- select one --
+<?
+      if (strlen ($row['name']) > 0) {
+       for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+         $row = pg_fetch_array ($sth, $nr);
+         printf ("<option value=\"%d\">%s\n", $row['oid'], $row['name']);
+       }
+      } else {
+       for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+         $row = pg_fetch_array ($sth, $nr);
+         printf ("<option value=\"%d\">%s: %s\n", $row['oid'], $row['project'], $row['name']);
+       }
+      }
+    }
+?>
+</select>
+</font></td></tr>
+<?
+  }
+?>
+
+<row_input     name=who
+               title="<b>Name</b>"
+               value="<? echo $row['who']; ?>"
+               >
+<row_input     name=email
+               title="<b>E-Mail</b>"
+               value="<? echo $row['email']; ?>"
+               >
+<? 
+  if ($oid > 0) {
+    $foo = explode (" ", $row['date']);
+    $date = explode (":", $foo[1]);
+    $date = sprintf ("%s %02d:%02d", $foo[0], $date[0], $date[1]);
+?>
+<row_input     name=date
+               title="<b>Date</b>"
+               value="<? echo $date; ?>"
+               >
+<? } ?>
+<row_textarea  name=body
+               title="<b>Comment</b>"
+               value="<? echo $row['body']; ?>"
+               rows=7
+               >
+
+<row_submit>
+
+</table></center></form>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/supporter/edit_job.wml b/src/LinuxTag/2004/supporter/edit_job.wml
new file mode 100644 (file)
index 0000000..7484588
--- /dev/null
@@ -0,0 +1,193 @@
+#include <lt2003.style>
+#include "../edit.style"
+#include "jobs.inc"
+
+<page title="Edit Comments">
+
+<row_select>
+<build_timeframe>
+<center><table cellpadding=0 cellspacing=1>
+<form action=update.php3 method=post>
+
+<?
+  $maxframes = <nrfragments>;
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  if (isset ($id)) {
+       pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+       $query = sprintf("SELECT * FROM job WHERE id = %d", $id);
+       $sth = pg_exec($dbh, $query) or die ("Datenbank-Fehler");
+       if (pg_NumRows($sth) > 0)
+       {
+               $row = pg_fetch_array($sth, 0);
+       } else {
+               die ("Cannot fetch rows");
+       }
+  } else {
+       $row = array();
+  }
+?>
+
+<input type=hidden name=type value=job>
+<input type=hidden name=id value="<? echo $id; ?>">
+
+<row_input     name=title
+               title="<b>Title</b>"
+               value="<? echo $row['title']; ?>"
+               >
+
+<row_input     name=location
+               title="<b>Location</b>"
+               value="<? echo $row['location']; ?>"
+               >
+
+<row_input     name=priority
+               title="<b>Priority</b>"
+               value="<? echo $row['priority']>0?$row['priority']:''; ?>"
+               >
+
+<row_input     name=comment
+               title="<b>Comment</b>"
+               value="<? echo $row['comment']; ?>"
+               >
+
+<?
+  $sections = array();
+  $query = sprintf("SELECT DISTINCT section FROM job ORDER BY section");
+  $sth2 = pg_exec($dbh, $query) or die ("Cannot get sections");
+  for ($x = 0; $x < pg_NumRows($sth2); $x++)
+  {
+    $row2 = pg_fetch_array($sth2, $x);
+    if (strlen ($row2['section'])) {
+      $sections[$row2['section']] = $row2['section'];
+    }
+  }
+
+  row_select ("Section", "section", $sections, $row['section'], 1);
+?>
+
+<row_input     name=usersection
+               title=""
+               value=""
+               >
+
+<row_textarea  name=description
+               title="<b>Description</b>"
+               value="<? echo $row['description']; ?>"
+               >
+
+<row_delim     msg="<b>Job Fragments</b>"
+               >
+
+<?
+  if (isset ($id) && $row['id'] > 0) {
+    $oids = array();
+    $query = sprintf ("SELECT oid,id,starttime,endtime,min,max,comment FROM fragment "
+                    ."WHERE job = %d ORDER BY starttime", $row['id']);
+    $sth = pg_exec($dbh, $query) or die ("Cannot get job fragments.");
+
+    if (pg_NumRows ($sth) > 0) {
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+       $row = pg_fetch_array ($sth, $nr);
+
+       $append = sprintf ("_%d", $row['oid']);
+       $oids[] = $row['oid'];
+
+       # Bug: This can only handle fragments that don't pass day borders
+       $foo = explode (" ", $row['starttime']);
+       $bar = explode (" ", $row['endtime']);
+       $fragment["date".$append] = $foo[0];
+
+       $fragment["timeframe".$append] = build_timeframe ($row['starttime'], $row['endtime']);
+
+       if ($row['max'] > $row['min']) {
+         $fragment["minmax".$append] = sprintf ("%d-%d", $row['min'], $row['max']);
+       } else {
+         $fragment["minmax".$append] = sprintf ("%d", $row['min']);
+       }
+       $fragment["comment".$append] = $row['comment'];
+      }
+
+      $foo = '';
+      reset ($oids);
+      while (list(,$oid) = each ($oids)) {
+       $append = sprintf ("_%d", $oid);
+       $foo = $foo . " " . $oid;
+
+       row_select ("Date", "date".$append, $ltdays, $fragment["date".$append], 0);
+?>
+<row_input     name="timeframe<? echo $append; ?>"
+               title="<b>Timeframe</b>"
+               value="<? echo $fragment["timeframe".$append]; ?>"
+               >
+<row_input     name="minmax<? echo $append; ?>"
+               title="<b>Min-Max People</b>"
+               value="<? echo $fragment["minmax".$append]; ?>"
+               >
+<row_input     name="comment<? echo $append; ?>"
+               title="<b>Comment</b>"
+               value="<? echo $fragment["comment".$append]; ?>"
+               >
+<?
+      }
+      printf ("<input type=\"hidden\" name=\"oids\" value=\"%s\">", $foo);
+
+      # Ensure the entire list won't be too long
+      $maxframes = 2;
+    }
+  }
+?>
+
+<?
+  for ($nr=0; $nr < $maxframes; $nr++) {
+    $append = sprintf ("_%d", $nr);
+    row_select ("Date", "date".$append, $ltdays, "", 0);
+?>
+
+<row_input     name="timeframe<? echo $append; ?>"
+               title="<b>Timeframe</b>"
+               value=""
+               >
+<row_input     name="minmax<? echo $append; ?>"
+               title="<b>Min-Max People</b>"
+               value=""
+               >
+<row_input     name="comment<? echo $append; ?>"
+               title="<b>Comment</b>"
+               value=""
+               >
+<? } ?>
+
+<? if ($id > 0) { ?>
+<row_radiobox  name=delete
+               title="<b>Delete</b>"
+               checked_0="checked"
+               checked_1=""
+               >
+<? } ?>
+<row_submit>
+
+</form>
+</table></center>
+
+<h3>Legend</h3>
+
+<p><b>Location</b>: Where does the job need to be done?
+
+<p><b>Priority</b>: optional, numerical.
+
+<p><b>Timeframe</b>: Something like 10-12 (for 10 o'clock - 12
+o'clock), or just 11 (for 11 o'clock and a minimum job duration of 30
+minutes).
+
+<p><b>Min-Max</b>: Number of people required for this job, either 2
+(for two people required) or 1-3 (for one to three people required).
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/supporter/index.wml b/src/LinuxTag/2004/supporter/index.wml
new file mode 100644 (file)
index 0000000..590c668
--- /dev/null
@@ -0,0 +1,69 @@
+#include <lt2003.style>
+#include "phptools.inc"
+#include "../phpfunctions.inc"
+
+<page title="Supporters">
+
+<spokendate>
+<?
+  $t_head  = "<p><div align=\"center\"><table width=\"99%\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\">";
+  $t_title = "<tr bgcolor=\"%s\"><th><font face=\"Helvetica,Arial\">Name</font></th></tr>";
+  $t_row   = "<tr bgcolor=\"%s\"><td><font face=\"Helvetica,Arial\">%s</font></td></tr>";
+  $t_foot  = "</table></div><p>";
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = "SELECT name,person.oid,email,comment FROM person,junction "
+          ."WHERE person = name AND junction.project = 'Supporter' ORDER BY name";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    echo ($t_head);
+    printf ($t_title, "<colh>");
+
+    $color = "<cold>";
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $color=$color == "<cold>"?"<coln>" : "<cold>";
+      $row = pg_fetch_array ($sth, $nr);
+      $name = sprintf ("<a href=\"supporter.php3?oid=%d\">%s</a>", $row['oid'], $row['name']);
+      if (strlen ($row['email'])) {
+        $name .= " &lt;" . $row['email'] . "&gt;";
+      }
+      if (strlen ($row['comment']) && ereg ("(\+[0-9]+ [0-9]+ [0-9]+)", $row['comment'], $phone)) {
+        $name .= " (" . $phone[1] .")";
+      }
+
+      printf ($t_row, $color, $name);
+    }
+    $color=$color == "<cold>"?"<coln>" : "<cold>";
+    echo ($t_foot);
+  }
+
+  # Comments ----------------------------------------
+  $query = sprintf ("SELECT oid,date,who,email,body FROM comments WHERE project = '%s' ORDER BY date", "Supporter");
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+
+      $date = explode (" ", $row['date']);
+      $date = spokendate ($date[0]);
+
+      printf ("<hr><h3><a href=\"edit_comment.php3?oid=%d\">%s by %s &lt;%s&gt;</a></h3>%s<p>",
+       $row['oid'], $date, $row['who'], $row['email'], $row['body']);
+    }
+  }
+
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/supporter/infomail.wml b/src/LinuxTag/2004/supporter/infomail.wml
new file mode 100644 (file)
index 0000000..1784a8e
--- /dev/null
@@ -0,0 +1,36 @@
+#include <lt2003.style>
+#include "../edit.style"
+
+#<page title="Supporters -- Infomail">
+<page title="Supporters -- Infomail">
+
+<form method=post action=infomail_send.php3>
+<center><table cellpadding=0 cellspacing=1>
+
+<row_input      name=number
+                title="<b>Nr.</b>"
+                size=55
+                value=""
+                >
+<row_input      name=subject
+                title="<b>Subject</b>"
+                value=""
+                size=55
+                >
+<row_textarea   name=body
+                title="<b>Content</b>"
+                value=""
+                cols=53
+                rows=10
+                >
+
+<row_submit_plain>
+
+</table></center></form>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/supporter/infomail_recipient.wml b/src/LinuxTag/2004/supporter/infomail_recipient.wml
new file mode 100644 (file)
index 0000000..9216a98
--- /dev/null
@@ -0,0 +1,40 @@
+#include <lt2003.style>
+
+<page title="Supporters -- Addresses">
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+               or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = "SELECT name,email,list,infomail FROM person "
+          ."WHERE project = 'Supporter' AND ( infomail = 1 OR list = 1 ) AND email <> '' "
+          ."ORDER BY name";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    $project = '';
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+
+      if ($project != $row['project']) {
+        printf ("<h3>%s</h3>", $row['project']);
+        $project = $row['project'];
+      }
+
+      if ($row['list']) {
+        printf ("%s<br>", $row['email']);
+      } else {
+        printf ("%s &lt;%s&gt;<br>", $row['name'], $row['email']);
+      }
+    }
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/supporter/infomail_send.wml b/src/LinuxTag/2004/supporter/infomail_send.wml
new file mode 100644 (file)
index 0000000..76ab130
--- /dev/null
@@ -0,0 +1,89 @@
+#include <lt2003.style>
+
+<page title="Supporters -- Infomail">
+
+<?
+
+  function get_email ($project)
+  {
+    global $dbh;
+
+    $query = sprintf ("SELECT email FROM person WHERE project = '%s' AND ( list = 1 OR infomail = 1 ) AND email <> ''", $project);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+        $row = pg_fetch_array ($sth, $nr);
+        if (strlen ($addr) > 0) {
+          $addr .= "," . $row['email'];
+        } else {
+          $addr = $row['email'];
+        }
+      }
+    }
+    return $addr;
+  }
+
+  function php_unscrew ($text)
+  {
+    # Der Himmel ist blau, das Wasser ist klar, die Vögel zwitschern
+    # draußen, doch PHP weigert sich beharrlich, vernünftig zu
+    # arbeiten.
+    #
+    # Problem: Im Form kommt " an, PHP macht daraus freundlicherweise \"
+    #          und schon sind unsere Daten in der SQL-DB kaputt.  Danke
+    # $mytext = ereg_replace ("\\\\", "\\\\", $text);
+    $mytext = ereg_replace ("\\\\", "", $text);
+    return ($mytext);
+  }
+
+  if ((strlen ($subject) > 0) && (strlen ($body) > 0)) {
+    $dbh = pg_pconnect ("<dbconnstring>")
+                 or die("Unable to connect to SQL server");
+    // We don't need that anymore with magic_quotes_gpc off
+    // $body = php_unscrew ($body);
+
+    # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+<when <string-eq "$(ALTER_DATA)" "yes" />>
+    $msubject = sprintf ("[LT Supporter Infomail#%d] %s", $number, $subject);
+    $header = "From: Martin Schulze <joey@linuxtag.org>";
+    $header .= "\nBcc: lt2k-email@linuxtag.de,joey@infodrom.org";
+    $header .= "\nContent-Type: text/plain; charset=iso-8859-1";
+    $header .= "\nContent-Disposition: inline";
+    $header .= "\nContent-Transfer-Encoding: 8bit";
+
+    $email = get_email ('Supporter');
+
+    if (strlen ($email) > 0) {
+      # mail ("joey", $msubject, "To: " . $email . "\n\n" . $body, $header);
+      mail ($email, $msubject, $body, $header);
+    }
+
+    # Copy for mailing list
+    #
+    $msubject = sprintf ("[LT Supporter Infomail#%d] %s", $number, $subject);
+    $header = "From: Martin Schulze <joey@linuxtag.org>";
+    $header .= "\nBcc: joey@infodrom.org";
+    $header .= "\nContent-Type: text/plain; charset=iso-8859-1";
+    $header .= "\nContent-Disposition: inline";
+    $header .= "\nContent-Transfer-Encoding: 8bit";
+
+    mail ("helfer@linuxtag.org", $msubject, $body, $header);
+    # mail ("joey", $msubject, $body, $header);
+    echo ("<p><b>Mails sent.</b><p>");
+</when>
+<when <not <string-eq "$(ALTER_DATA)" "yes" />>>
+    echo ("<p><b>Mails not sent, because LinuxTag 2003 is over.</b><p>");
+</when>
+  } else {
+    echo ("<p><b>Empty fields, bugger.</b><p>");
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/supporter/job.wml b/src/LinuxTag/2004/supporter/job.wml
new file mode 100644 (file)
index 0000000..6f3c44e
--- /dev/null
@@ -0,0 +1,234 @@
+#include <lt2003.style>
+#include "../edit.style"
+#include "jobs.inc"
+
+<build_timeframe>
+<tab_frag_stubs>
+<normal_time>
+<fragment_ok>
+<page title="Jobs">
+
+# This page intends to provide an overview about a given job and
+# provide means to assign a person to the job.  Hence, the page contains:
+#  . All Job fragments through the entire week
+#  . Fragments and assignments splitted by day
+#  . Including hooks to unassigned supporters for assignments
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $title = '';
+  if (isset ($id)) {
+    $query = sprintf ("SELECT title,location,description,priority,comment,section FROM job WHERE id = %d", $id);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+
+      printf ("<h3>%s</h3>", $row['title']);
+
+      if (strlen ($row['section']) > 0) { printf ("<br>Section: %s</p>", $row['section']); }
+      if ($row['priority'] > 0) { printf ("<br>Priority: %s</p>", $row['priority']); }
+      if (strlen ($row['location']) > 0) { printf ("<br>Location: %s</p>", $row['location']); }
+      if (strlen ($row['comment']) > 0) { printf ("<br>Comment: %s</p>", $row['comment']); }
+
+      $title = $row['title'];
+      $description = $row['description'];
+    }
+  }
+
+  if ($id > 0 && strlen ($title) > 0) {
+    $query = sprintf ("SELECT oid,* FROM fragment WHERE job = %d ORDER BY starttime", $id);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+
+      $foo = explode (" ", $row['starttime']);
+      $time = build_timeframe ($row['starttime'], $row['endtime']);
+      if (strlen ($frag[$foo[0]]) > 0) {
+       $frag[$foo[0]] .= "&nbsp;" . $time;
+      } else {
+       $frag[$foo[0]] = $time;
+      }
+
+      $foo = normal_time ($row['starttime'], $row['endtime']);
+      $fragments[$foo[0]][] = array ('start' => $foo[1],
+                                    'end' => $foo[2],
+                                    'id' => $row['id'],
+                                    'oid' => $row['oid']);
+    }
+
+    $query = sprintf ("SELECT assignment.starttime,assignment.endtime,assignment.person,assignment.oid,person.oid as peroid "
+                    ."FROM assignment,fragment,job,person WHERE job.id = %d "
+                    ."AND assignment.fragment = fragment.id "
+                    ."AND fragment.job = job.id "
+                    ."AND person.name = assignment.person "
+                    ."ORDER BY starttime", $id);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+
+      $foo = normal_time ($row['starttime'], $row['endtime']);
+      $assignment[$foo[0]][] = array ('start' => $foo[1],
+                                     'end'   => $foo[2],
+                                     'person' => $row['person'],
+                                     'oid'   => $row['oid'],
+                                     'peroid'   => $row['peroid']);
+    }
+
+    $columns = '';
+    $empty = true;
+    reset ($ltdays);
+    while (list($date,$day) = each ($ltdays)) {
+      if (strlen ($frag[$date]) > 0) {
+        $columns .= sprintf ($f_row_day, $frag[$date]);
+       $empty = false;
+      } else {
+        $columns .= sprintf ($f_row_day, "&nbsp;");
+      }
+    }
+
+    if (!$empty) {
+?>
+
+# Basically, this table is a copy of a single line from jobs
+#
+<p><table cellpadding=0 cellspacing=1>
+<?
+    printf ($f_header_head, "<colh>");
+    reset ($ltdays);
+    while (list($key,$day) = each ($ltdays)) {
+      $foo = explode (",", $day);
+      printf ($f_header_day, $foo[0]);
+      $col[] = $key;
+    }
+    echo ($f_header_tail);
+
+    printf ($f_row_head, "<cold>", "edit_job", $id, $title);
+
+    echo $columns;
+
+    echo ($f_row_tail);
+?>
+</table>
+<hr>
+<?
+    } else {
+      printf ("<br><a href=\"edit_job.php3?id=%d\">Edit</a>", $id);
+    }
+
+  function display_supporters ($dbh, $date, $start, $end, $fragment)
+  {
+    if ($start == "24:00") { $start = "23:59"; }
+    if ($end == "24:00") { $end = "23:59"; }
+
+    $query = sprintf ("SELECT name,person.oid FROM person,availability "
+                    ."WHERE starttime <= '%s %s' AND endtime >= '%s %s' "
+                    ."AND person.name = availability.person ORDER BY name",
+                    $date, $start, $date, $end);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if ( pg_NumRows ($sth) > 0) {
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+        $row = pg_fetch_array ($sth, $nr);
+
+# Fragment                     [----------------]       a=assignment && f=fragment
+# Illegal Assignment  (a)   [-------]                    a.s <= f.s && a.e >= f.s
+# Illegal Assignment  (b)         [-------]              a.s >= f.s && a.e <= f.e
+# Illegal Assignment  (c)                   [-------]    a.s <= f.e && a.e >= f.e
+# Illegal Assignment  (a/c) [------------------------]
+<protect>
+
+       $query = sprintf ("SELECT person FROM assignment "
+                        ."WHERE person = '%s' "
+                        ."AND ( starttime <= '%s %s' AND endtime >= '%s %s' "
+                        ."OR  starttime >= '%s %s' AND endtime <= '%s %s' "
+                        ."OR  starttime <= '%s %s' AND endtime >= '%s %s' ) ",
+                        $row['name'],
+                        $date, $start, $date, $start,
+                        $date, $start, $date, $end,
+                        $date, $end, $date, $end);
+</protect>
+        $sth2 = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+       if ( pg_NumRows ($sth2) == 0) {
+         echo ("<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;");
+
+         printf (" %s-%s: <a href=\"supporter.php3?oid=%d\">%s</a> "
+                ."(<a href=\"update.php3?type=assign&fragment=%d&person=%s\">assign</a>)",
+                 $start, $end, $row['oid'], $row['name'],
+                 $fragment, urlencode ($row['name']));
+       }
+      }
+    }
+  }
+
+    reset ($ltdays);
+    while (list($date,$day) = each ($ltdays)) {
+      if (strlen ($frag[$date]) > 0) {
+       printf ("<h3>%s</h3>", $day);
+       # printf ("<p><b>Fragments:</b> %s (DEBUG)", $frag[$date]);
+
+       if (is_array ($assignment[$date])) {
+         $assign = $assignment[$date];
+       } else {
+         $assign = array ();
+       }
+
+       if (is_array ($fragments[$date])) {
+         $fragment = $fragments[$date];
+       } else {
+         $fragment = array ();
+       }
+
+       $as_pivot = 0;   // assignment
+       for ($nr=0; $nr < count ($fragment); $nr++) {
+         while ($as_pivot < count ($assign) && time_lt ($assign[$as_pivot]['start'], $fragment[$nr]['start'])) { $as_pivot++; }
+         if ($as_pivot < count ($assign)) {
+           if ( ($assign[$as_pivot]['start'] == $fragment[$nr]['start'])
+             && ($assign[$as_pivot]['end'] == $fragment[$nr]['end'])) {
+
+             while ( ($assign[$as_pivot]['start'] == $fragment[$nr]['start'])
+                  && ($assign[$as_pivot]['end'] == $fragment[$nr]['end'])) {
+               printf ("<br>%s-%s: <a href=\"supporter.php3?oid=%d\">%s</a> "
+                      ."(<a href=\"update.php3?type=loose&assignment=%d\">loose this</a>)",
+                      $fragment[$nr]['start'], $fragment[$nr]['end'],
+                      $assign[$as_pivot]['peroid'], $assign[$as_pivot]['person'],
+                      $assign[$as_pivot]['oid']);
+               $as_pivot++;
+             }
+
+             if (!fragment_ok ($dbh, $fragment[$nr]['id'])) {
+               display_supporters ($dbh, $date, $fragment[$nr]['start'], $fragment[$nr]['end'], $fragment[$nr]['id']);
+             }
+             # FIXME
+           } else {
+             printf ("<br>%s-%s: free", $fragment[$nr]['start'], $fragment[$nr]['end']);
+             display_supporters ($dbh, $date, $fragment[$nr]['start'], $fragment[$nr]['end'], $fragment[$nr]['id']);
+           }
+         } else {
+           printf ("<br>%s-%s: free", $fragment[$nr]['start'], $fragment[$nr]['end']);
+           display_supporters ($dbh, $date, $fragment[$nr]['start'], $fragment[$nr]['end'], $fragment[$nr]['id']);
+         }
+       }
+      }
+    }
+
+    if (strlen ($description) > 0) {
+      printf ("<h3>Description of %s</h3><blockquote>%s</blockquote>", $title, $description);
+    }
+  } else {
+    echo "<p><b>No such job found.</b></p>";
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/supporter/jobs.inc b/src/LinuxTag/2004/supporter/jobs.inc
new file mode 100644 (file)
index 0000000..e60e629
--- /dev/null
@@ -0,0 +1,205 @@
+<define-tag nrfragments>5</define-tag>
+
+<?
+  $ltdays = array (
+           "<iso-event-date-2>" => "<date-event-date-2>",
+           "<iso-event-date-1>" => "<date-event-date-1>",
+           "<iso-event-date_0>" => "<date-event-date_0>",
+           "<iso-event-date_1>" => "<date-event-date_1>",
+           "<iso-event-date_2>" => "<date-event-date_2>",
+           "<iso-event-date_3>" => "<date-event-date_3>",
+           "<iso-event-date_4>" => "<date-event-date_4>"
+           );
+?>
+
+#  Getestet mit diesen Testzeiten
+#  $frame[] = "10-12";
+#  $frame[] = "10:30-12";
+#  $frame[] = "10.20-12";
+#  $frame[] = "12";
+#  $frame[] = "11.30";
+#  $frame[] = "23.29";
+#  $frame[] = "23.30";
+#
+#  while (list($k,$v) = each ($frame)) {
+#    $foo = split_timeframe ($v);
+#    printf ("<p>%s -- %s - %s", $v, $foo[0], $foo[1]);
+#  }
+#  
+<define-tag split_timeframe>
+<protect>
+<?
+  function split_timeframe ($timeframe)
+  {
+    $fromto = explode ("-", $timeframe);
+
+    if (!ereg ("([0-9]+)[\.:]([0-9]+)", $fromto[0], $frompart)) {
+      $frompart[1] = $fromto[0];
+      $frompart[2] = 0;
+    }
+    $from = sprintf ("%02d:%02d", $frompart[1], $frompart[2]);
+
+    if (strlen ($fromto[1])) {
+      if (!ereg ("([0-9]+)[\.:]([0-9]+)", $fromto[1], $to)) {
+       $to[1] = $fromto[1];
+       $to[2] = 0;
+      }
+      
+      $to = sprintf ("%02d:%02d", $to[1], $to[2]);
+    } else {
+      # Bug: This can't handle cases like 23:30 -> 0:00
+      if ($frompart[2] <30) {
+        $to = sprintf ("%02d:%02d", $frompart[1], $frompart[2]+30);
+      } else {
+        $to = sprintf ("%02d:%02d", $frompart[1]+1, ($frompart[2]+30)%60);
+      }
+    }
+
+    # Special encoding for 24:00 which we can't handle otherwise
+    if ($from == "24:00") { $from = "23:59"; }
+    if ($to   == "24:00") { $to   = "23:59"; }
+
+    return array ($from, $to);
+  }
+
+?>
+</protect>
+</define-tag>
+
+<define-tag build_timeframe><protect><?
+  function build_timeframe ($start, $end)
+  {
+    # Bug: This can only handle fragments that don't pass day borders
+    $foo = explode (" ", $start);
+    $bar = explode (" ", $end);
+
+    $foo = explode (":", $foo[1]);
+    $bar = explode (":", $bar[1]);
+
+    # Special decoding for 24:00 which we can't handle otherwise
+    if ($foo[0] == 23 && $foo[1] == 59) { $foo[0] = 24; $foo[1] = 0; }
+    if ($bar[0] == 23 && $bar[1] == 59) { $bar[0] = 24; $bar[1] = 0; }
+
+    if ($foo[1] == 0) {
+      if ($bar[1] == 0) {
+       return sprintf ("%d-%d", $foo[0], $bar[0]);
+      } else {
+       return sprintf ("%d-%d:%02d", $foo[0], $bar[0], $bar[1]);
+      }
+    } else {
+      if ($bar[1] == 0) {
+       return sprintf ("%d:%02d-%d", $foo[0], $foo[1], $bar[0]);
+      } else {
+       return sprintf ("%d:%02d-%d:%02d", $foo[0], $foo[1], $bar[0], $bar[1]);
+      }
+    }
+
+  }
+?></protect></define-tag>
+
+<define-tag normal_time>
+<protect>
+<?
+  function normal_time ($start, $end)
+  {
+    # Bug: This can only handle fragments that don't pass day borders
+    $foo = explode (" ", $start);
+    $bar = explode (" ", $end);
+
+    $date = $foo[0];
+
+    $foo = explode (":", $foo[1]);
+    $bar = explode (":", $bar[1]);
+
+    # Special decoding for 24:00 which we can't handle otherwise
+    if ($foo[0] == 23 && $foo[1] == 59) { $foo[0] = 24; $foo[1] = 0; }
+    if ($bar[0] == 23 && $bar[1] == 59) { $bar[0] = 24; $bar[1] = 0; }
+
+    $starttime = sprintf ("%02d:%02d", $foo[0], $foo[1]);
+    $endtime = sprintf ("%02d:%02d", $bar[0], $bar[1]);
+
+    return array ($date, $starttime, $endtime);
+  }
+
+  function time_lt ($this, $that)
+  {
+    $foo = explode (":", $this);
+    $bar = explode (":", $that);
+
+    if ($foo[0] < $bar[0]) {
+      return true;
+    } elseif ($foo[0] == $bar[0] && $foo[1] < $bar[1]) {
+      return true;
+    } else {
+      return false;
+    }
+
+  }
+?>
+</protect>
+</define-tag>
+
+<define-tag fragment_ok>
+<?
+  function fragment_ok ($dbh, $fragment)
+  {
+    return missing_supporters ($dbh, $fragment)==0?true:false;
+  }
+
+  function missing_supporters ($dbh, $fragment)
+  {
+    $query = sprintf ("SELECT max FROM fragment WHERE id = %d ", $fragment);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+    if ( pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+
+      $query = sprintf ("SELECT max,person FROM fragment,assignment WHERE id = %d "
+                      ."AND fragment.id = assignment.fragment",
+                      $fragment);
+      $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+      if ( pg_NumRows ($sth) > 0) {
+       $row = pg_fetch_array ($sth, 0);
+       if (pg_NumRows ($sth) >= $row['max']) {
+         return 0;
+       } else {
+         return $row['max'] - pg_NumRows ($sth);
+       }
+      } else {
+        return $row['max'];
+      }
+    } else {
+      return 0;
+    }
+  }
+?>
+</define-tag>
+
+<define-tag tab_avail_stubs>
+<?
+  $f_header_head = '<tr bgcolor="%s"><th><font face="Helvetica,Arial">Name</font></th>';
+  $f_header_tail = '</tr>';
+  $f_header_day  = '<th><strong><font face="Helvetica,Arial">%s</font></strong></th>';
+
+  $f_row_head = '<tr bgcolor="%s"><td align="left"><font face="Helvetica,Arial"><a href="%s.php3?oid=%d">%s</a></font></td>';
+  $f_row_tail = '</tr>';
+  $f_row_day = '<td align="center"><font face="Helvetica,Arial">%s</font></td>';
+?>
+</define-tag>
+
+<define-tag tab_frag_stubs>
+<?
+  $f_header_head = '<tr bgcolor="%s"><th><font face="Helvetica,Arial">Title</font></th>';
+  $f_header_tail = '</tr>';
+  $f_header_day  = '<th><strong><font face="Helvetica,Arial">%s</font></strong></th>';
+
+  $f_row_head = '<tr bgcolor="%s"><td align="left"><font face="Helvetica,Arial"><a href="%s.php3?id=%d">%s</a></font></td>';
+  $f_row_tail = '</tr>';
+  $f_row_day = '<td align="center"><font face="Helvetica,Arial">%s</font></td>';
+?>
+</define-tag>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/supporter/jobs.wml b/src/LinuxTag/2004/supporter/jobs.wml
new file mode 100644 (file)
index 0000000..6be9f4f
--- /dev/null
@@ -0,0 +1,193 @@
+#include <lt2003.style>
+#include "../edit.style"
+#include "jobs.inc"
+
+<build_timeframe>
+<tab_frag_stubs>
+<page title="Supporter -- Jobs">
+
+<?
+  $limit = '';
+  reset ($ltdays);
+  while (list($key,$day) = each ($ltdays)) {
+    if ($GLOBALS["day_".$key] == 1) {
+      $foo = explode (",", $day);
+      if (strlen ($limit) == 0) {
+        $limit = $foo[0];
+     } else {
+        $limit .= ", " . $foo[0];
+      }
+    }
+  }
+
+  if (strlen ($limit) > 0) {
+    printf ("<p><b>Output limited to</b>: %s</p>", $limit);
+  }
+
+?>
+
+<p>
+<table cellpadding=0 cellspacing=1>
+<?
+  printf ($f_header_head, "<colh>");
+  reset ($ltdays);
+  $col = array();
+  while (list($key,$day) = each ($ltdays)) {
+    if ($limitation != 1 || $GLOBALS["day_".$key] == 1) {
+      $foo = explode (",", $day);
+      printf ($f_header_day, $foo[0]);
+      $col[] = $key;
+    }
+  }
+  echo ($f_header_tail);
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+               or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = "SELECT id,title FROM job ORDER BY upper(title)";
+  $sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
+
+  $job = array ();
+  for ($nr = 0; $nr < pg_NumRows($sth); $nr++)
+  {
+    $row = pg_fetch_array($sth, $nr);
+    $job[] = $row['title'];
+    $available[$row['title']] = array ('id' => $row['id']);
+  }
+
+  $query = "SELECT job.id,title,starttime,endtime FROM job,fragment "
+                  ."WHERE job.id = fragment.job ORDER BY title";
+
+  $sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
+
+  $thisname = '';
+  for ($nr = 0; $nr < pg_NumRows($sth); $nr++)
+  {
+    $row = pg_fetch_array($sth, $nr);
+
+    if ($thisname != $row['title']) {
+      if ($thisname != '') {
+        $available[$thisname] = $avail;
+      }
+      $avail = array ('id' => $row['id']);
+      $thisname = $row['title'];
+    }
+
+    $foo = explode (" ", $row['starttime']);
+    $time = build_timeframe ($row['starttime'], $row['endtime']);
+    if (strlen ($avail[$foo[0]]) > 0) {
+      $avail[$foo[0]] .= "&nbsp;" . $time;
+    } else {
+      $avail[$foo[0]] = $time;
+    }
+  }
+  $available[$thisname] = $avail;
+
+  $colindex = count ($col);
+  $color = "<cold>";
+  $empty = true;
+  $line = '';
+  reset ($job);
+  while (list(,$name) = each ($job)) {
+
+    reset ($col);
+    while (list(,$day) = each ($col)) {
+      if (strlen ($available[$name][$day]) > 0) {
+        $empty = false;
+        $line .= sprintf ($f_row_day, $available[$name][$day]);
+      } else {
+        $line .= sprintf ($f_row_day, "&nbsp;");
+      }
+    }
+
+    if (isset ($limitation) && $empty) {
+      $line = '';
+    } else {
+      $color = $color=="<cold>"?"<coln>":"<cold>";
+      printf ($f_row_head, $color, "job", $available[$name]['id'], $name);
+      echo ($line);
+      echo ($f_row_tail);
+      $empty = true;
+      $line = '';
+    }
+  }
+?>
+</table>
+</p>
+
+<p>
+<b>Limit Output</b>.  You can limit the output to certain days and
+people working on certain tasks.</p>
+<p>Warning: Limiting to sections is not yet implemented.</p>
+
+<form method=get action=jobs.php3>
+<input type=hidden name=limitation value=1>
+
+<center><table cellpadding=0 cellspacing=1>
+
+<?
+  $first = true;
+  reset ($ltdays);
+  while (list($key,$day) = each ($ltdays)) {
+    if ($first) {
+      $first = false;
+?>
+<row_checkbox  name="day_<? echo $key; ?>"
+               title="<b>Days</b>"
+               descr="<? echo $day; ?>"
+               checked="<? echo (!isset ($limitation) || $GLOBALS["day_".$key] == 1)?"checked":''; ?>"
+               >
+<?
+    } else {
+?>
+<row_checkbox  name="day_<? echo $key; ?>"
+               title="&nbsp;"
+               descr="<? echo $day; ?>"
+               checked="<? echo (!isset ($limitation) || $GLOBALS["day_".$key] == 1)?"checked":''; ?>"
+               >
+<?
+    }
+  }
+?>
+
+<row_checkbox  name="section_<? echo $nr; ?>"
+               title="<b>Sections</b>"
+               descr="Any section"
+               value="any"
+               checked="checked"
+               >
+
+<?
+  $query = "SELECT DISTINCT section FROM job WHERE section <> '' ORDER BY section";
+  $sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
+
+  for ($nr = 0; $nr < pg_NumRows($sth); $nr++)
+  {
+    $row = pg_fetch_array($sth, $nr);
+?>
+<row_checkbox  name="section_<? echo $nr; ?>"
+               title="&nbsp;"
+               descr="<? echo $row['section']; ?>"
+               value="<? echo $row['section']; ?>"
+               checked=""
+               >
+<?
+    printf ("<input type=\"hidden\" name=\"maxsection\" value=\"%d\">", $nr);
+  }
+?>
+
+<row_submit_plain>
+
+</table></center>
+
+</form>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
+
diff --git a/src/LinuxTag/2004/supporter/open.wml b/src/LinuxTag/2004/supporter/open.wml
new file mode 100644 (file)
index 0000000..fb1c65c
--- /dev/null
@@ -0,0 +1,193 @@
+#include <lt2003.style>
+#include "../edit.style"
+#include "jobs.inc"
+
+<build_timeframe>
+<tab_frag_stubs>
+<fragment_ok>
+<page title="Supporter -- Open Jobs">
+
+<?
+  $limit = '';
+  reset ($ltdays);
+  while (list($key,$day) = each ($ltdays)) {
+    if ($GLOBALS["day_".$key] == 1) {
+      $foo = explode (",", $day);
+      if (strlen ($limit) == 0) {
+        $limit = $foo[0];
+     } else {
+        $limit .= ", " . $foo[0];
+      }
+    }
+  }
+
+  if (strlen ($limit) > 0) {
+    printf ("<p><b>Output limited to</b>: %s</p>", $limit);
+  }
+
+?>
+
+<p>
+<table cellpadding=0 cellspacing=1>
+<?
+  printf ($f_header_head, "<colh>");
+  reset ($ltdays);
+  $col = array();
+  while (list($key,$day) = each ($ltdays)) {
+    if ($limitation != 1 || $GLOBALS["day_".$key] == 1) {
+      $foo = explode (",", $day);
+      printf ($f_header_day, $foo[0]);
+      $col[] = $key;
+    }
+  }
+  echo ($f_header_tail);
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+               or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = "SELECT job.id,title,starttime,endtime,fragment.id as fragment FROM job,fragment "
+                  ."WHERE job.id = fragment.job ORDER BY title";
+
+  $sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
+
+  $thisname = '';
+  for ($nr = 0; $nr < pg_NumRows($sth); $nr++)
+  {
+    $row = pg_fetch_array($sth, $nr);
+
+    if ($thisname != $row['title']) {
+      if ($thisname != '') {
+        $available[$thisname] = $avail;
+      }
+      $avail = array ('id' => $row['id']);
+      $thisname = $row['title'];
+    }
+
+    $miss = missing_supporters ($dbh, $row['fragment']);
+    if ($miss > 0) {
+      # FIXME: Link setzen
+      $foo = explode (" ", $row['starttime']);
+      $time = build_timeframe ($row['starttime'], $row['endtime']);
+      if (strlen ($avail[$foo[0]]) > 0) {
+       $avail[$foo[0]] .= "&nbsp;" . $time;
+       if ($miss > 1) {
+         $avail[$foo[0]] .= "(" . $miss . ")";
+       }
+      } else {
+       $avail[$foo[0]] = $time;
+       if ($miss > 1) {
+         $avail[$foo[0]] .= "(" . $miss . ")";
+       }
+      }
+    }
+  }
+  $available[$thisname] = $avail;
+
+  $colindex = count ($col);
+  $color = "<cold>";
+  $empty = true;
+  $line = '';
+  reset ($available);
+  while (list($name,) = each ($available)) {
+
+    reset ($col);
+    while (list(,$day) = each ($col)) {
+      if (strlen ($available[$name][$day]) > 0) {
+        $empty = false;
+        $line .= sprintf ($f_row_day, $available[$name][$day]);
+      } else {
+        $line .= sprintf ($f_row_day, "&nbsp;");
+      }
+    }
+
+    if ($empty) {
+      $line = '';
+    } else {
+      $color = $color=="<cold>"?"<coln>":"<cold>";
+      printf ($f_row_head, $color, "job", $available[$name]['id'], $name);
+      echo ($line);
+      echo ($f_row_tail);
+      $empty = true;
+      $line = '';
+    }
+  }
+?>
+</table>
+</p>
+
+<p>
+<b>Limit Output</b>.  You can limit the output to certain days and
+people working on certain tasks.</p>
+<p>Warning: Limiting to sections is not yet implemented.</p>
+
+<form method=get action=open.php3>
+<input type=hidden name=limitation value=1>
+
+<center><table cellpadding=0 cellspacing=1>
+
+<?
+  $first = true;
+  reset ($ltdays);
+  while (list($key,$day) = each ($ltdays)) {
+    if ($first) {
+      $first = false;
+?>
+<row_checkbox  name="day_<? echo $key; ?>"
+               title="<b>Days</b>"
+               descr="<? echo $day; ?>"
+               checked="<? echo (!isset ($limitation) || $GLOBALS["day_".$key] == 1)?"checked":''; ?>"
+               >
+<?
+    } else {
+?>
+<row_checkbox  name="day_<? echo $key; ?>"
+               title="&nbsp;"
+               descr="<? echo $day; ?>"
+               checked="<? echo (!isset ($limitation) || $GLOBALS["day_".$key] == 1)?"checked":''; ?>"
+               >
+<?
+    }
+  }
+?>
+
+<row_checkbox  name="section_<? echo $nr; ?>"
+               title="<b>Sections</b>"
+               descr="Any section"
+               value="any"
+               checked="checked"
+               >
+
+<?
+  $query = "SELECT DISTINCT section FROM job WHERE section <> '' ORDER BY section";
+  $sth = pg_exec ($dbh, $query) or die ("Datenbank-Abfrage!");
+
+  for ($nr = 0; $nr < pg_NumRows($sth); $nr++)
+  {
+    $row = pg_fetch_array($sth, $nr);
+?>
+<row_checkbox  name="section_<? echo $nr; ?>"
+               title="&nbsp;"
+               descr="<? echo $row['section']; ?>"
+               value="<? echo $row['section']; ?>"
+               checked=""
+               >
+<?
+    printf ("<input type=\"hidden\" name=\"maxsection\" value=\"%d\">", $nr);
+  }
+?>
+
+<row_submit_plain>
+
+</table></center>
+
+</form>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
+
diff --git a/src/LinuxTag/2004/supporter/submenu.inc b/src/LinuxTag/2004/supporter/submenu.inc
new file mode 100644 (file)
index 0000000..c2c8bc6
--- /dev/null
@@ -0,0 +1,22 @@
+<strong>Menu</strong><br>
+
+&nbsp;<menu-item base=index text=Index href=index.php3><br>
+&nbsp;<menu-item base=edit text="Add Supporter" href=edit.php3><br>
+&nbsp;<menu-item base=edit_comment text="Add&nbsp;Comment" href=edit_comment.php3><br>
+&nbsp;<menu-item base=edit_job text="Add&nbsp;Job" href=edit_job.php3><br>
+&nbsp;<menu-item base=edit_availability text="Add&nbsp;Availability" href=edit_availability.php3><br>
+&nbsp;<menu-item base=infomail text="Infomail"><br>
+
+<p><line height=2>
+
+<p><strong>Reports</strong><br>
+
+&nbsp;<menu-item base=infomail_recipient text="Addresses" href=infomail_recipient.php3><br>
+&nbsp;<menu-item base=accounts text="Accounts" href=accounts.php3><br>
+&nbsp;<menu-item base=availability text="Availability" href=availability.php3><br>
+&nbsp;<menu-item base=jobs text="Jobs" href=jobs.php3><br>
+&nbsp;<menu-item base=open text="Open&nbsp;Jobs" href=open.php3><br>
+
+<p><line height=2>
+
+#include "../functions.inc" prefix="../"
diff --git a/src/LinuxTag/2004/supporter/supporter.wml b/src/LinuxTag/2004/supporter/supporter.wml
new file mode 100644 (file)
index 0000000..9d41b81
--- /dev/null
@@ -0,0 +1,207 @@
+#include <lt2003.style>
+#include "../edit.style"
+#include "jobs.inc"
+
+<build_timeframe>
+<tab_avail_stubs>
+<normal_time>
+<fragment_ok>
+<page title="Supporter">
+
+# This page intends to provide an overview about a given supporter and
+# provide means to assign a job to the person.  Hence, the page contains:
+#  . Availability through the entire week
+#  . Availability splitted by day
+#  . Including hooks to unassigned jobs for assignments
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  if (isset ($oid)) {
+    $query = sprintf ("SELECT name,email,comment FROM person WHERE oid = %d", $oid);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+      $name = $row['name'];
+      $email = $row['email'];
+      $comment = $row['comment'];
+    }
+  }
+
+  if (strlen ($name) > 0) {
+    $query = sprintf ("SELECT * FROM availability WHERE person = '%s' ORDER BY starttime", $name);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+
+      $foo = explode (" ", $row['starttime']);
+      $time = build_timeframe ($row['starttime'], $row['endtime']);
+      if (strlen ($avail[$foo[0]]) > 0) {
+       $avail[$foo[0]] .= "&nbsp;" . $time;
+      } else {
+       $avail[$foo[0]] = $time;
+      }
+
+      $foo = normal_time ($row['starttime'], $row['endtime']);
+      $available[$foo[0]][] = array ('start' => $foo[1], 'end' => $foo[2]);
+    }
+
+    $query = sprintf ("SELECT assignment.starttime,assignment.endtime,job.title,job.id,assignment.oid "
+                    ."FROM assignment,fragment,job WHERE person = '%s' "
+                    ."AND fragment=fragment.id AND fragment.job = job.id "
+                    ."ORDER BY starttime", $name);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+
+      $foo = normal_time ($row['starttime'], $row['endtime']);
+      $assignment[$foo[0]][] = array ('start' => $foo[1],
+                                     'end'   => $foo[2],
+                                     'title' => $row['title'],
+                                     'oid'   => $row['oid'],
+                                     'job'   => $row['id']);
+    }
+
+    if (strlen ($email) > 0) {
+      printf ("<h3>%s &lt;%s&gt;</h3>", $name, $email);
+    } else {
+      printf ("<h3>%s</h3>", $name);
+    }
+    if (strlen ($comment) > 0) {
+      printf ("<p>Comment: %s</p>", $comment);
+    }
+
+    $columns = '';
+    $empty = true;
+    reset ($ltdays);
+    while (list($date,$day) = each ($ltdays)) {
+      if (strlen ($avail[$date]) > 0) {
+        $columns .= sprintf ($f_row_day, $avail[$date]);
+       $empty = false;
+      } else {
+        $columns .= sprintf ($f_row_day, "&nbsp;");
+      }
+    }
+
+    if (!$empty) {
+?>
+
+# Basically, this table is a copy of a single line from availability
+#
+<p><table cellpadding=0 cellspacing=1>
+<?
+    printf ($f_header_head, "<colh>");
+    reset ($ltdays);
+    while (list($key,$day) = each ($ltdays)) {
+      $foo = explode (",", $day);
+      printf ($f_header_day, $foo[0]);
+      $col[] = $key;
+    }
+    echo ($f_header_tail);
+
+    printf ($f_row_head, "<cold>", "edit", $oid, $name);
+
+    echo $columns;
+
+    echo ($f_row_tail);
+?>
+</table>
+<hr>
+<?
+    } else {
+      printf ("<br><a href=\"edit.php3?oid=%d\">Edit</a>", $oid);
+    }
+
+  function display_jobs ($dbh, $date, $start, $end, $name)
+  {
+    if ($start == "24:00") { $start = "23:59"; }
+    if ($end == "24:00") { $end = "23:59"; }
+
+    $query = sprintf ("SELECT fragment.id,job.title,starttime,endtime,job FROM job,fragment "
+                    ."WHERE starttime >= '%s %s' AND endtime <= '%s %s' "
+                    ."AND job.id=fragment.job ORDER BY starttime,endtime",
+                    $date, $start, $date, $end);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    printf ("<br>%s-%s: free", $start, $end);
+    if ( pg_NumRows ($sth) > 0) {
+      for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+        $row = pg_fetch_array ($sth, $nr);
+
+       if (!fragment_ok ($dbh, $row['id'])) {
+         $foo = normal_time ($row['starttime'], $row['endtime']);
+
+         echo ("<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt;");
+
+         printf (" %s-%s: <a href=\"job.php3?id=%d\">%s</a> "
+                ."(<a href=\"update.php3?type=assign&fragment=%d&person=%s\">assign</a>)",
+                 $foo[1], $foo[2], $row['job'], $row['title'],
+                 $row['id'], urlencode ($name));
+        }
+      }
+    }
+  }
+
+    reset ($ltdays);
+    while (list($date,$day) = each ($ltdays)) {
+      if (strlen ($avail[$date]) > 0) {
+       printf ("<h3>%s</h3>", $day);
+       # printf ("<p><b>Available:</b> %s (DEBUG)", $avail[$date]);
+
+       if (is_array ($assignment[$date])) {
+         $assign = $assignment[$date];
+       } else {
+         $assign = array ();
+       }
+
+       if (is_array ($available[$date])) {
+         $around = $available[$date];
+       } else {
+         $around = array ();
+       }
+
+       $av_pivot = 0;   // availability
+       $as_pivot = 0;   // assignment
+       $slot = $around[0]['start'];
+
+       while (!($av_pivot >= count ($around) && $as_pivot >= count ($assign))) {
+         if ($as_pivot >= count ($assign)) {
+           display_jobs ($dbh, $date, $slot, $around[$av_pivot++]['end'], $name);
+           if ($av_pivot < count ($around)) {
+             $slot = $around[$av_pivot]['start'];
+           }
+         } elseif (time_lt ($slot, $assign[$as_pivot]['start'])) {
+           display_jobs ($dbh, $date, $slot, $assign[$as_pivot]['start'], $name);
+           $slot = $assign[$as_pivot]['start'];
+         } else {
+           printf ("<br>%s-%s: <a href=\"job.php3?id=%d\">%s</a> "
+                  ."(<a href=\"update.php3?type=loose&assignment=%d\">loose this</a>)",
+                  $assign[$as_pivot]['start'], $assign[$as_pivot]['end'],
+                  $assign[$as_pivot]['job'], $assign[$as_pivot]['title'],
+                  $assign[$as_pivot]['oid']);
+           $slot = $assign[$as_pivot++]['end'];
+           if (!time_lt ($slot, $around[$av_pivot]['end'])) {
+             $slot = $around[++$av_pivot]['start'];
+           }
+         }
+       }
+      }
+    }
+
+  } else {
+    echo "<p><b>No such user found.</b></p>";
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/supporter/update.wml b/src/LinuxTag/2004/supporter/update.wml
new file mode 100644 (file)
index 0000000..4edc2bb
--- /dev/null
@@ -0,0 +1,398 @@
+#include <lt2003.style>
+#include "../phpfunctions.inc"
+#include "jobs.inc"
+
+<when <not <string-eq "$(NILI)" "" />>>
+<insert_nili>
+</when>
+
+<randpass>
+<split_timeframe>
+
+<page title="Supporters">
+
+<?
+  function find_person ($dbh, $oid)
+  {
+    $query = sprintf ("SELECT name,email FROM person WHERE oid = %d", $oid);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+    } else {
+      $row['email'] = "";
+      $row['name'] = "";
+    }
+    return $row;
+  }
+
+  if (!$type) die ("No type given");
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  if ($type == "person") {
+    if (!isset ($project)) {
+      $project = 'Supporter';
+    }
+
+    # Begin transaction
+    pg_exec($dbh, "BEGIN TRANSACTION") or die ("Could not start transaction.");
+
+    if ($delete == 1) {
+      $query = sprintf ("SELECT name,project FROM person WHERE oid = %d", $oid);
+      $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+      if (pg_NumRows ($sth) > 0) {
+        $row = pg_fetch_array ($sth, 0);
+       $name = $row['name'];
+       $primproject = $row['project'];
+      }
+
+      $query = sprintf ("SELECT project FROM junction WHERE person = '%s' AND project <> 'Supporter'",
+                       addslashes($name));
+      $sth = pg_exec($dbh, $query) or die ("Cannot investigate junction.");
+
+      if (pg_NumRows ($sth) == 0) {
+
+        $query = sprintf ("DELETE FROM junction WHERE person = '%s'", addslashes ($name));
+        pg_exec($dbh, $query) or die ("Cannot delete person");
+
+        $query = sprintf ("DELETE FROM person WHERE oid = %d", $oid);
+        pg_exec($dbh, $query) or die ("Cannot delete person");
+
+<when <not <string-eq "$(NILI)" "" />>>
+        $query = sprintf("DELETE from nili WHERE person = '%s'", addslashes($name));
+        pg_exec($dbh, $query) or die ("Cannot delete nilis");
+</when>                
+      # pg_NumRows() > 0 ==> user is member of >1 projects
+      } else {
+       $query = sprintf("DELETE from junction where person = '%s' AND project = 'Supporter'",
+                        addslashes($name));
+       pg_exec($dbh, $query) or die ("Cannot delete junction.");
+
+        if ($primproject == 'Supporter') {
+          $row = pg_fetch_array($sth, 0);
+        
+          $query = sprintf ("UPDATE person SET project = '%s',admin=0 WHERE name = '%s'",
+                          addslashes ($row['project']),
+                          addslashes ($name));
+          pg_exec($dbh, $query) or die ("Cannot adjust person.");
+        }
+      }
+
+      $query = sprintf("DELETE from availability WHERE person = '%s'", addslashes($name));
+      pg_exec($dbh, $query) or die ("Cannot delete availability");
+
+      $query = sprintf("DELETE from assignment WHERE person = '%s'", addslashes($name));
+      pg_exec($dbh, $query) or die ("Cannot delete availability");
+    } else {
+      $newpass = '';
+      if ($password == 1 && $list == 0 && strlen ($email) > 0) {
+        $newpass = randpass();
+      }
+      $oldmail = $email;
+      if (empty($email)) {
+       $email = 'NULL';
+      } else {
+       $email = "'".addslashes ($email)."'";
+      }
+
+      if ($oid == 0) {
+       $query = sprintf ("SELECT name FROM person WHERE name = '%s'", addslashes ($name));
+       $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+       if (pg_NumRows ($sth) == 0) {
+          $query = sprintf ("INSERT INTO person (name,email,project,nightplace,infomail,insurance,list,admin,"
+                      ."login,password,comment) "
+                      ."VALUES ('%s',%s,'%s','%s',%d,%d,%d,%d,%d,'%s','%s')",
+                      addslashes ($name), $email, $project, $nightplace, $infomail, $insurance, $list,
+                      $admin, $login, strlen ($newpass)?md5 ($newpass):"", $comment);
+         pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+        } else {
+         $newpass = '';
+       }
+
+       # Check if the person is already a member of this project
+       $query = sprintf ("SELECT person FROM junction WHERE person = '%s' AND project = '%s'",
+                         addslashes ($name),
+                         addslashes ($project));
+       $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+       if (pg_NumRows ($sth) == 0) {
+         $query = sprintf ("INSERT INTO junction (person,project) VALUES ('%s', '%s')",
+                          addslashes ($name),
+                          addslashes ($project));
+         pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+       }
+<when <not <string-eq "$(NILI)" "" />>>
+       insert_nili();
+</when>
+
+       if (strlen ($newpass) > 0) {
+         mail_password($oldmail, $newpass);
+       }
+
+      } else {
+        $query = sprintf ("UPDATE person SET name='%s',email=%s,project='%s',"
+                      ."nightplace='%s',infomail=%d,insurance=%d,list=%d,admin=%d,login=%d,comment='%s'",
+                      $name, $email, $project, $nightplace, $infomail, $insurance, $list, $admin, $login, $comment);
+        if (strlen ($newpass)) {
+          $query .= sprintf (",password='%s'", addslashes (md5 ($newpass)));
+        }
+        $query .= sprintf (" WHERE oid = %d", $oid);
+       pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+<when <not <string-eq "$(NILI)" "" />>>
+       $query = sprintf("DELETE from nili where person = '%s'", addslashes($name));
+       pg_exec($dbh, $query) or die ("Cannot delete from nili");
+       
+       insert_nili();
+</when>
+
+      }
+
+      if (strlen ($newpass) > 0) {
+       mail_password($oldmail, $newpass);
+      }
+
+      # Now process the availability table
+      $thisday = '';
+      $counter = 0;
+      for ($nr=0; $nr < $maxcounter; $nr++) {
+        $append = sprintf ("_%d", $counter);
+
+       if (strlen ($GLOBALS["date".$append]) > 0) {
+         $thisday = $GLOBALS["date".$append];
+       }
+
+       if ($GLOBALS["oid".$append] > 0) {
+         if (strlen ($GLOBALS["shift".$append]) > 0) {
+            $fromto = split_timeframe ($GLOBALS["shift".$append]);
+           $query = sprintf ("UPDATE availability SET starttime='%s',endtime='%s',comment='%s' "
+                            ."WHERE oid = %d",
+                            addslashes ($thisday." ".$fromto[0]),
+                             addslashes ($thisday." ".$fromto[1]),
+                             addslashes ($GLOBALS["comment".$append]),
+                            $GLOBALS["oid".$append]);
+           pg_exec($dbh, $query) or die ("Cannot update availability");
+         } else {
+           $query = sprintf ("DELETE FROM availability WHERE oid = %d", $GLOBALS["oid".$append]);
+           pg_exec($dbh, $query) or die ("Cannot delete from availability");
+         }
+       } else {
+         if (strlen ($GLOBALS["shift".$append]) > 0) {
+           $fromto = split_timeframe ($GLOBALS["shift".$append]);
+           $query = sprintf ("INSERT INTO availability (person,starttime,endtime,comment) "
+                            ."VALUES ('%s','%s','%s','%s')",
+                             addslashes ($name),
+                             addslashes ($thisday." ".$fromto[0]),
+                             addslashes ($thisday." ".$fromto[1]),
+                             addslashes ($GLOBALS["comment".$append]));
+           pg_exec($dbh, $query) or die ("Cannot insert into availability");
+         }
+       }
+
+       $counter++;
+      }
+    }
+
+    # Finish transaction
+    pg_exec($dbh, "COMMIT") or die ("Could not finish transaction.");
+
+    # Only to ensure no query is executed later
+    $query = '';
+  } elseif ($type == "comment") {
+    if (strlen ($personid)) {
+      $foo = find_person ($dbh, $personid);
+      $who = $foo['name'];
+      $email = $foo['email'];
+    }
+
+    if (!strlen ($who)) {
+      $who = $REMOTE_USER;
+      if ($who == "joey") {
+        $who = "Martin Schulze";
+      }
+      $email = $REMOTE_USER . "@linuxtag.de";
+   }
+   if ($delete == 1) {
+      $query = sprintf ("DELETE FROM comments WHERE oid = %d", $oid);
+    } elseif ($oid == 0) {
+      $date = date ("Y-m-j H:i");
+      $query = sprintf ("INSERT INTO comments (project,date,who,email,body) "
+                      ."VALUES ('%s','%s','%s','%s','%s')",
+                      $project, $date, $who, $email, $body);
+    } else {
+      $query = sprintf ("UPDATE comments SET who='%s',email='%s',date='%s',body='%s' "
+                      ."WHERE oid = %d",
+                      $who, $email, $date, $body, $oid);
+    }
+  } elseif ($type == "job") {
+    # Begin transaction
+    pg_exec($dbh, "BEGIN TRANSACTION") or die ("Could not start transaction.");
+
+    if ($id > 0 && $delete == 1) {
+      $query = sprintf ("SELECT id FROM fragment WHERE job = %d", $id);
+      $sth = pg_exec ($dbh, $query) or die ("Cannot execute query");
+      for ($x = 0; $x < pg_NumRows($sth); $x++)
+      {
+       $row = pg_fetch_array($sth, $x);
+       $query = sprintf("DELETE FROM assignment WHERE fragment = %d", $row['id']);
+       pg_exec($dbh, $query) or die ("Cannot execute query");
+      }
+      $query = sprintf ("DELETE FROM job WHERE id = %d", $id);
+      pg_exec($dbh, $query) or die ("Can't delete job.");
+      $query = sprintf ("DELETE FROM fragment WHERE job = %d", $id);
+      pg_exec($dbh, $query) or die ("Can't delete job fragments.");
+    } else {
+
+      if (!strlen ($section))
+      {
+           $section = $usersection;
+      }
+      if (!strlen ($section)) { die ("Error: Section required."); }
+      if (!strlen ($location)) { die ("Error: Location required."); }
+      if (!strlen ($title)) { die ("Error: Title required."); }
+      if ($id == 0) {
+       $query = sprintf("INSERT INTO job (title, location, description, priority, comment, section) " .
+                        " VALUES ('%s', '%s', '%s', %d, '%s', '%s')",
+                        addslashes($title),
+                        addslashes($location),
+                        addslashes($description),
+                        $priority, 
+                        addslashes($comment),
+                        addslashes($section));
+      } else {
+       $query = sprintf("UPDATE job SET title = '%s', location = '%s', description = '%s', " .
+                        " priority = %d, comment = '%s', section = '%s' WHERE id = %d",
+                        addslashes($title),
+                        addslashes($location),
+                        addslashes($description),
+                        $priority,
+                        addslashes($comment),
+                        addslashes($section),
+                        $id);
+      }
+      $sth = pg_exec($dbh, $query) or die ("Cannot add or edit this job.");
+
+      if ($id == 0) {
+       $query = sprintf ("SELECT id FROM job WHERE oid = %d", pg_getlastoid ($sth));
+       $sth = pg_exec($dbh, $query) or die ("Database Query.");
+       if (pg_NumRows ($sth) > 0) {
+         $row = pg_fetch_array ($sth, 0);
+         $id = $row['id'];
+       } else {
+         die ("Can't find the job.");
+       }
+      }
+
+      for ($nr=0; $nr < <nrfragments>; $nr++) {
+       $append = sprintf ("_%d", $nr);
+
+       # Calculate min. and max. people required
+       #
+       $foo = explode ("-", $GLOBALS["minmax".$append]);
+       $min = $foo[0];
+       $max = $foo[1];
+       if ($max < $min) { $max = $min; }
+
+       if ($min > 0) {
+         $fromto = split_timeframe ($GLOBALS["timeframe".$append]);
+
+         $query = sprintf ("INSERT INTO fragment (job, min, max, starttime, endtime, comment) "
+                        ."VALUES (%d, %d, %d, '%s', '%s', '%s')",
+                        $id, $min, $max,
+                        addslashes ($GLOBALS["date".$append] . " " . $fromto[0]),
+                        addslashes ($GLOBALS["date".$append] . " " . $fromto[1]),
+                        addslashes ($GLOBALS["comment".$append]));
+         pg_exec($dbh, $query) or die ("Database Query.");
+       }
+      }
+
+      # Let's see if old fragments need to be altered
+      if (isset ($oids)) {
+       $bar = explode (" ", $oids);
+       reset ($bar);
+       while (list(,$oid) = each ($bar)) {
+         if ($oid == 0) { continue; }
+
+         $append = sprintf ("_%d", $oid);
+
+         # Calculate min. and max. people required
+         #
+         if (strlen ($GLOBALS["minmax".$append]) > 0 && strlen ($GLOBALS["timeframe".$append]) > 0) {
+           $foo = explode ("-", $GLOBALS["minmax".$append]);
+           $min = $foo[0];
+           $max = $foo[1];
+           if ($max < $min) { $max = $min; }
+         } else {
+           $min = 0;
+         }
+
+         if ($min > 0) {
+           $fromto = split_timeframe ($GLOBALS["timeframe".$append]);
+
+           $query = sprintf ("UPDATE fragment SET min=%d,max=%d,starttime='%s',endtime='%s',comment='%s' "
+                          ."WHERE oid = %d",
+                          $min, $max,
+                          addslashes ($GLOBALS["date".$append] . " " . $fromto[0]),
+                          addslashes ($GLOBALS["date".$append] . " " . $fromto[1]),
+                          addslashes ($GLOBALS["comment".$append]),
+                          $oid);
+           pg_exec($dbh, $query) or die ("Database Query.");
+         } else {
+           $query = sprintf ("SELECT id FROM fragment WHERE oid = %d", $oid);
+           $sth = pg_exec($dbh, $query) or die ("Cannot execute query");
+           if (pg_NumRows($sth) > 0)
+           {
+             $row = pg_fetch_array($sth, 0);
+           } else {
+             die ("Could not find fragment");
+           }
+           $query = sprintf ("DELETE FROM assignment WHERE fragment = %d", $row['id']);
+           pg_exec($dbh, $query) or die ("Cannot execute query");
+           $query = sprintf ("DELETE FROM fragment WHERE oid = %d", $oid);
+           pg_exec($dbh, $query) or die ("Database Query.");
+         }
+       }
+      }
+    }
+
+    # Finish transaction
+    pg_exec($dbh, "COMMIT") or die ("Could not finish transaction.");
+
+    # Only to ensure no query is executed later
+    $query = '';
+  } elseif ($type == "assign") {
+    $query = sprintf ("SELECT starttime,endtime FROM fragment WHERE id = %d", $fragment);
+    $sth = pg_exec($dbh, $query) or die ("Cannot execute query");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array($sth, 0);
+      $query = sprintf ("INSERT INTO assignment (fragment,person,starttime,endtime) "
+                      ." VALUES (%d,'%s','%s','%s')",
+                      $fragment,
+                      addslashes($person),
+                      $row['starttime'], $row['endtime']);
+    } else {
+      $query = '';
+    }
+  } elseif ($type == "loose") {
+    $query = sprintf ("DELETE FROM assignment WHERE oid = %d", $assignment);
+  } else
+  {
+    echo ("<p><b>Unknown type!</b></p>");
+  }
+
+  if (strlen ($query)) {
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+  }
+?>
+
+<p><b>Done</b></p>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/todo/edit.wml b/src/LinuxTag/2004/todo/edit.wml
new file mode 100644 (file)
index 0000000..725145a
--- /dev/null
@@ -0,0 +1,83 @@
+#include <lt2003.style>
+#include "../edit.style"
+
+<page title="Todo">
+
+<?
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  if ($oid > 0) {
+    $query = sprintf ("SELECT * FROM todo WHERE oid = %d", $oid);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+    }
+  }
+?>
+
+<form method=post action=update.php3>
+<input type=hidden name=type value="todo">
+<input type=hidden name=oid value="<? echo $oid; ?>">
+<center><table cellpadding=0 cellspacing=1>
+
+<row_input     name=subject
+               title="<b>Subject</b>"
+               value="<? echo $row['subject']; ?>"
+               >
+<row_input     name=name
+               title="<b>Name</b>"
+               value="<? echo $row['name']; ?>"
+               >
+<row_input     name=email
+               title="<b>E-Mail</b>"
+               value="<? echo $row['email']; ?>"
+               >
+
+<? if ($oid > 0) {
+    if (!strlen ($row['done'])) { ?>
+
+<row_radiobox  name=done
+               title="<b>Done</b>"
+               checked_0="checked"
+               checked_1=""
+               >
+
+<? } else { ?>
+
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><b>Done</b></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial"><?
+  $done = explode (" ", $row['done']);
+  $done = explode ("-", $done[0]);
+  $done = sprintf ("%d.%d.%d", $done[2], $done[1], $done[0]);
+  echo $done;
+?></font></td></tr>
+
+<? } ?>
+<row_radiobox  name=delete
+               title="<b>Delete</b>"
+               checked_0="checked"
+               checked_1=""
+               >
+<? } ?>
+
+<row_textarea  name=body
+               title="<b>Text</b>"
+               value="<? echo $row['body']; ?>"
+               rows=7
+               >
+
+<row_submit>
+
+</table></center></form>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/todo/index.wml b/src/LinuxTag/2004/todo/index.wml
new file mode 100644 (file)
index 0000000..fd2130c
--- /dev/null
@@ -0,0 +1,67 @@
+#include <lt2003.style>
+
+<page title="Todo">
+
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = "SELECT subject,who,email,date,oid FROM todo WHERE done IS NULL ORDER BY subject";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    echo ("<h3>Open jobs</h3><ul>");
+
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+  
+      $date = explode (" ", $row['date']);
+      $date = explode ("-", $date[0]);
+      $date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]);
+
+      printf ("<li> <a href=\"show.php3?oid=%d\">%s</a><br>%s, %s",
+        $row['oid'], $row['subject'], $date, $row['who']);
+      if (strlen ($row['email'])) {
+        echo (" &lt;" . $row['email'] . "&gt;");
+      }
+    }
+    echo ("</ul>");
+  }
+
+  $query = "SELECT subject,who,email,date,done,oid FROM todo WHERE done IS NOT NULL ORDER BY subject";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    echo ("<h3>Done jobs</h3><ul>");
+
+    for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
+      $row = pg_fetch_array ($sth, $nr);
+  
+      $date = explode (" ", $row['date']);
+      $date = explode ("-", $date[0]);
+      $date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]);
+
+      $done = explode (" ", $row['done']);
+      $done = explode ("-", $done[0]);
+      $done = sprintf ("%d.%d.%d", $done[2], $done[1], $done[0]);
+
+      printf ("<li> <a href=\"show.php3?oid=%d\">%s</a><br>%s, %s",
+        $row['oid'], $row['subject'], $date, $row['who']);
+      if (strlen ($row['email'])) {
+        echo (" &lt;" . $row['email'] . "&gt;");
+      }
+      printf ("<br>Done: %s", $done);
+    }
+    echo ("</ul>");
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# mode: iso-accents
+# end:
diff --git a/src/LinuxTag/2004/todo/show.wml b/src/LinuxTag/2004/todo/show.wml
new file mode 100644 (file)
index 0000000..4976e4e
--- /dev/null
@@ -0,0 +1,55 @@
+#include <lt2003.style>
+
+<page title="Todo">
+
+<?
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  if ($oid > 0) {
+    $query = sprintf ("SELECT * FROM todo WHERE oid = %d", $oid);
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+
+      $date = explode (" ", $row['date']);
+      $date = explode ("-", $date[0]);
+      $date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]);
+
+      if (strlen ($row['done'])) {
+        $done = explode (" ", $row['done']);
+        $done = explode ("-", $done[0]);
+        $done = sprintf ("%d.%d.%d", $done[2], $done[1], $done[0]);
+      }
+
+    } else {
+      die ("No id given");
+    }
+  }
+?>
+
+
+<h3><? echo $row['subject']; ?></h3>
+
+<p>Submitted by: <? echo $row['who']; ?>
+<br>Submitted at: <? echo $date; ?>
+<? if (strlen ($row['done'])) { ?>
+<br>Done at: <? echo $done; ?>
+<? } ?>
+
+<blockquote>
+<? echo $row['body']; ?>
+</blockquote>
+
+<center><a href="edit.php3?oid=<? echo $oid; ?>">Edit</a></center>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/todo/submenu.inc b/src/LinuxTag/2004/todo/submenu.inc
new file mode 100644 (file)
index 0000000..da22637
--- /dev/null
@@ -0,0 +1,8 @@
+<strong>Menu</strong><br>
+
+&nbsp;<menu-item base=index text=Index href=index.php3><br>
+&nbsp;<menu-item base=edit text="New" href=edit.php3><br>
+
+<p><line height=2>
+
+#include "../functions.inc" prefix="../"
diff --git a/src/LinuxTag/2004/todo/update.wml b/src/LinuxTag/2004/todo/update.wml
new file mode 100644 (file)
index 0000000..cc570de
--- /dev/null
@@ -0,0 +1,67 @@
+#include <lt2003.style>
+
+<page title="Todo">
+
+<?
+  if (!$type) die ("No type given");
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  if ($type == "todo") {
+    $date = date ("Y-m-j H:i");
+    if (!strlen ($who)) {
+      $who = $REMOTE_USER;
+      if ($who == "joey") {
+        $who = "Martin Schulze";
+      }
+      $email = $REMOTE_USER . "@linuxtag.de";
+   }
+   if ($delete == 1) {
+      $query = sprintf ("DELETE FROM todo WHERE oid = %d", $oid);
+    } elseif ($oid == 0) {
+      $query = sprintf ("INSERT INTO todo (subject,who,email,date,body,done) "
+                      ."VALUES ('%s','%s','%s','%s','%s',NULL)",
+                      addslashes ($subject)
+                      addslashes ($who)
+                      addslashes ($email)
+                      $date, $body);
+    } else {
+      if ($done == 1) {
+        $query = sprintf ("UPDATE todo SET subject='%s',who='%s',email='%s',body='%s',done='%s'"
+                      ."WHERE oid = %d",
+                      addslashes ($subject),
+                      addslashes ($who),
+                      addslashes ($email),
+                      addslashes ($body),
+                      $date, $oid);
+      } else {
+        $query = sprintf ("UPDATE todo SET subject='%s',who='%s',email='%s',body='%s'"
+                      ."WHERE oid = %d",
+                      addslashes ($subject),
+                      addslashes ($who),
+                      addslashes ($email),
+                      addslashes ($body),
+                      $oid);
+      }
+    }
+  } else {
+    echo ("<p><b>Unknown type</b><p>");
+  }
+
+  if (strlen ($query)) {
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+  }
+?>
+
+<p><b>Done</b><p>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# mode: iso-accents
+# end:
diff --git a/src/LinuxTag/2004/workshops/edit.wml b/src/LinuxTag/2004/workshops/edit.wml
new file mode 100644 (file)
index 0000000..8b70000
--- /dev/null
@@ -0,0 +1,131 @@
+#include <lt2003.style>
+#include "../edit.style"
+#include "../phpfunctions.inc"
+
+<page title="Workshops">
+
+<spokendate>
+<?
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  if ($project) {
+    $query = sprintf ("SELECT name FROM project WHERE oid = %d", $project);
+  } else {
+    if ($oid > 0) {
+      $query = sprintf ("SELECT * FROM workshop WHERE oid = %d", $oid);
+    } else {
+      $query = '';
+    }
+  }
+  if (strlen ($query)) {
+
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+    if (pg_NumRows ($sth) > 0) {
+      $row = pg_fetch_array ($sth, 0);
+      if ($project) {
+       $row['project'] = $row['name'];
+      }
+    }
+  }
+?>
+
+<form method=post action=update.php3>
+<input type=hidden name=type value="workshop">
+<input type=hidden name=oid value="<? echo $oid; ?>">
+<center><table cellpadding=0 cellspacing=1>
+
+<? if ($project) { ?>
+<row_info      name=project
+               title="<b>Project</b>"
+               value="<? echo $row['project']; ?>"
+               >
+<? } else { ?>
+<row_input     name=project
+               title="<b>Project</b>"
+               value="<? echo $row['project']; ?>"
+               >
+
+<? } ?>
+
+<row_input     name=title
+               title="<b>Title</b>"
+               value="<? echo $row['title']; ?>"
+               >
+<row_input     name=speaker
+               title="<b>Speaker</b>"
+               value="<? echo $row['speaker']; ?>"
+               >
+
+<?
+  $date        = explode (" ", $row['date_time']);
+  $time        = $date[1];
+  $time        = explode (":", $time);
+  $time = sprintf ("%02d:%02d", $time[0], $time[1]);
+  $date        = $date[0];
+?>
+
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><b>Date/Time</b></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial"><select name=date>
+<option value=<iso-event-date_0><? if ($date=="<iso-event-date_0>")
+  { echo " selected";} ?>>Thu, <? echo spokendate ("<iso-event-date_0>"); ?>
+<option value=<iso-event-date_1><? if ($date=="<iso-event-date_1>")
+  { echo " selected";} ?>>Fri, <? echo spokendate ("<iso-event-date_1>"); ?>
+<option value=<iso-event-date_2><? if ($date=="<iso-event-date_2>")
+  { echo " selected";} ?>>Sat, <? echo spokendate ("<iso-event-date_2>"); ?>
+<option value=<iso-event-date_3><? if ($date=="<iso-event-date_3>")
+  { echo " selected";} ?>>Sun, <? echo spokendate ("<iso-event-date_3>"); ?>
+</select>&nbsp;<select name=time>
+<:
+    $start = 10;
+    while ($start < 18) {
+       printf "<option value=\"%02d:00:00\"<? if (\$time==\"%02d:00\") { echo \" selected\";} ?>>%02d:00\n", $start, $start, $start;
+        $start++;
+    }
+:>
+</select>
+</font></td></tr>
+
+<tr><td align=right bgcolor="<colh>"><font face="Helvetica,Arial"><b>Room</b></font></td>
+<td bgcolor="<cold>"><font face="Helvetica,Arial"><select name=room>
+<option value="<room-1-internal>"<? if ($row['room']=="<room-1-internal>") { echo "selected";} ?>><room-1>
+<option value="<room-2-internal>"<? if ($row['room']=="<room-2-internal>") { echo " selected";} ?>><room-2>
+</select></font></td></tr>
+
+<row_textarea  name=abstract
+               title="<b>Abstract</b>"
+               value="<? echo $row['abstract']; ?>"
+               rows=7
+               >
+<row_textarea  name=comment
+               title="<b>Comment</b>"
+               value="<? echo $row['comment']; ?>"
+               rows=7
+               >
+<row_radiobox  name=visible
+               title="<b>Visible</b>"
+               checked_0="<? if ($row['visible']==0) { echo "checked";} ?>"
+               checked_1="<? if ($row['visible']==1) { echo "checked";} ?>"
+               >
+
+<? if ($oid > 0) { ?>
+<row_radiobox  name=delete
+               title="<b>Delete</b>"
+               checked_0="checked"
+               checked_1=""
+               >
+<? } ?>
+
+<row_submit>
+
+</table></center></form>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/workshops/index.wml b/src/LinuxTag/2004/workshops/index.wml
new file mode 100644 (file)
index 0000000..3d12ddc
--- /dev/null
@@ -0,0 +1,104 @@
+#include <lt2003.style>
+#include "../phpfunctions.inc"
+
+<page title="Workshops">
+
+<define-tag nextrow whitespace=delete>
+if ($nr < pg_NumRows ($sth)) {
+  $row = pg_fetch_array ($sth, $nr++);
+  $rdate = explode (" ", $row['date_time']);
+  $rtime = $rdate[1];
+  $rdate = $rdate[0];
+  $rtime = explode (":", $rtime);
+  $rtime = sprintf ("%s:%s", $rtime[0], $rtime[1]);
+  $rows++;
+}
+</define-tag>
+
+<spokendate>
+<?
+  $t_head  = "<p><div align=\"center\"><table width=\"99%%\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\">"
+           ."<tr bgcolor=\"%s\"><th><font face=\"Helvetica,Arial\">Time</font></th>";
+  $t_room  = "<th><font face=\"Helvetica,Arial\">%s</font></th>";
+  $t_head2 = "</tr>";
+
+  $t_row   = "<tr bgcolor=\"%s\">";
+  $t_time  = "<td><font face=\"Helvetica,Arial\">%s</font></td>";
+  $t_talk  = "<td><font face=\"Helvetica,Arial\"><font size=\"-1\"><b>%s</b>: </font><font size=\"-1\">%s</font></font></td>";
+  $t_talke = "<td>&nbsp;</td>";
+  $t_row2  = "</tr>";
+
+  $t_foot  = "</table></div><p>";
+
+  $dbh = pg_pconnect ("<dbconnstring>") or
+              die("Unable to connect to SQL server");
+
+  pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  $query = "SELECT room,date_time,title,speaker,oid FROM workshop ORDER BY date_time,room";
+  $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+
+  if (pg_NumRows ($sth) > 0) {
+    $nr = 0;
+    $color = "<coln>";
+
+    $day[]="<iso-event-date_0>";
+    $day[]="<iso-event-date_1>";
+    $day[]="<iso-event-date_2>";
+    $day[]="<iso-event-date_3>";
+    $dayname[]="<name-event-date_0>";
+    $dayname[]="<name-event-date_1>";
+    $dayname[]="<name-event-date_2>";
+    $dayname[]="<name-event-date_3>";
+    $time[]="10:00";
+    $time[]="11:00";
+    $time[]="12:00";
+    $time[]="13:00";
+    $time[]="14:00";
+    $time[]="15:00";
+    $time[]="16:00";
+    $time[]="17:00";
+    $room[]="<room-1-internal>";
+    $room[]="<room-2-internal>";
+    $name['<room-1-internal>']="<room-1>";
+    $name['<room-2-internal>']="<room-2>";
+
+    $rows = 0;
+    <nextrow>
+    for ($thisday=$day[0],$daycount=1; $daycount<=count($day); $thisday=$day[$daycount++]) {
+      printf ("<h3>%s, %s</h3>", $dayname[$daycount-1], spokendate ($thisday));
+      printf ($t_head, "<colh>");
+      for ($thisroom=$room[0],$roomcount=1; $roomcount<=count($room); $thisroom=$room[$roomcount++]) {
+        printf ($t_room, $name[$thisroom]);
+      }
+      echo ($t_head2);
+      $color = "<cold>";
+
+      for ($thistime=$time[0],$timecount=1; $timecount<=count($time); $thistime=$time[$timecount++]) {
+        $color=$color == "<cold>"?"<coln>" : "<cold>";
+        printf ($t_row, $color);
+       printf ($t_time, $thistime);
+
+        for ($thisroom=$room[0],$roomcount=1; $roomcount<=count($room); $thisroom=$room[$roomcount++]) {
+         if (($rdate == $thisday) && ($rtime == $thistime) && ($row['room'] == $thisroom)) {
+           $talk = sprintf ("<a href=\"edit.php3?oid=%d\">%s</a>", $row['oid'], $row['title']);
+           printf ($t_talk, $row['speaker'], $talk);
+           <nextrow>
+         } else {
+           echo ($t_talke);
+         }
+       }
+       echo ($t_row2);
+      }
+      echo ($t_foot);
+    }
+    printf ("<p>%d sessions", $rows);
+  }
+?>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# end:
diff --git a/src/LinuxTag/2004/workshops/submenu.inc b/src/LinuxTag/2004/workshops/submenu.inc
new file mode 100644 (file)
index 0000000..da22637
--- /dev/null
@@ -0,0 +1,8 @@
+<strong>Menu</strong><br>
+
+&nbsp;<menu-item base=index text=Index href=index.php3><br>
+&nbsp;<menu-item base=edit text="New" href=edit.php3><br>
+
+<p><line height=2>
+
+#include "../functions.inc" prefix="../"
diff --git a/src/LinuxTag/2004/workshops/update.wml b/src/LinuxTag/2004/workshops/update.wml
new file mode 100644 (file)
index 0000000..3847157
--- /dev/null
@@ -0,0 +1,57 @@
+#include <lt2003.style>
+
+<page title="Workshops">
+
+<?
+  if (!$type) die ("No type given");
+
+  $dbh = pg_pconnect ("<dbconnstring>")
+              or die("Unable to connect to SQL server");
+
+  # pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");
+
+  if ($type == "workshop") {
+   if ($delete == 1) {
+      $query = sprintf ("DELETE FROM workshop WHERE oid = %d", $oid);
+    } elseif ($oid == 0) {
+      $query = sprintf ("INSERT INTO workshop (title,speaker,date_time,room,project,abstract,visible,comment) "
+                      ."VALUES ('%s','%s','%s %s','%s','%s','%s',%d,'%s')",
+                      addslashes ($title),
+                      addslashes ($speaker),
+                      $date, $time, $room,
+                      addslashes ($project),
+                      addslashes ($abstract),
+                      $visible,
+                      addslashes ($comment));
+    } else {
+      $query = sprintf ("UPDATE workshop SET title='%s',speaker='%s',date_time='%s %s',"
+                      ."room='%s',project='%s',abstract='%s',visible=%d,comment='%s' "
+                      ."WHERE oid = %d",
+                      addslashes ($title),
+                      addslashes ($speaker),
+                      $date, $time, $room,
+                      addslashes ($project),
+                      addslashes ($abstract),
+                      $visible,
+                      addslashes ($comment),
+                      $oid);
+    }
+  } else {
+    echo ("<p><b>Unknown type</b><p>");
+  }
+
+  if (strlen ($query)) {
+    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
+  }
+
+?>
+
+<p><b>Done</b><p>
+
+</page>
+
+# Local variables:
+# mode: text
+# mode: auto-fill
+# mode: iso-accents
+# end:
index cb8cbb2..6c0dbb6 100644 (file)
@@ -1,6 +1,6 @@
 <center>
 <:
-  @years = (2001, 2002, 2003);
+  @years = (2001, 2002, 2003, 2004);
 
   foreach my $y (sort @years) {
     if ($y != $(year)) {