Moved the predicate fragment_ok into jobs.inc since it is used by more
authorJoey Schulze <joey@infodrom.org>
Sat, 18 May 2002 08:42:56 +0000 (08:42 +0000)
committerJoey Schulze <joey@infodrom.org>
Sat, 18 May 2002 08:42:56 +0000 (08:42 +0000)
than only one page.

src/LinuxTag/2002/supporter/jobs.inc
src/LinuxTag/2002/supporter/supporter.wml

index cdb8a12..fbcf3bb 100644 (file)
 </protect>
 </define-tag>
 
+<define-tag fragment_ok>
+<?
+  function fragment_ok ($dbh, $fragment)
+  {
+    $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 true;
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
+  }
+?>
+</define-tag>
+
 <define-tag tab_avail_stubs>
 <?
   $f_header_head = '<tr bgcolor="%s"><th><font face="Helvetica,Arial">Name</font></th>';
index db7fdd1..7fe3f82 100644 (file)
@@ -5,6 +5,7 @@
 <build_timeframe>
 <tab_avail_stubs>
 <normal_time>
+<fragment_ok>
 <page func="LinuxTag 2002 Organisation" title="Supporter">
 
 # This page intends to provide an overview about a given supporter and
 </table>
 <hr>
 <?
-  function fragment_ok ($dbh, $fragment)
-  {
-    $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 true;
-      } else {
-        return false;
-      }
-    } else {
-      return false;
-    }
-  }
-
   function display_jobs ($dbh, $date, $start, $end, $name)
   {
     $query = sprintf ("SELECT fragment.id,job.title,starttime,endtime FROM job,fragment "