#include <infodrom.style>
#include <fileutils.pl>
#include <tableutils.pl>
#read "search.xml"

<page title="Infodrom Service">

<h1>Infodrom Service - Search Engines</h1>

<:

  %search = parse_xmlfile ("search.xml");

  foreach $type (('Deutschland','Europa','Weltweit')) {
      $list = $search{$type};
      @list = @$list;
      $tabwidth = &web_calc_table_width(9,8,7,6,5,$#list+1);

      %list = ();
      foreach $r (@list) {
        %entry = %{$r};
	$list{$entry{'Name'}} = $r;
      }

      @slist = sort (keys %list);

      printf "<h3 align=center>%s</h3>", $type;
      print "<center><table border=0 cellspacing=3 cellpadding=2 summary=\"\">";

      $i=0;
      $width = 90;
      while ($i <= $#slist) {
        $r = $list{$slist[$i]};
	%entry = %$r;
	#%entry = %{$slist[$i]};

	print "<tr>" if (! ($i % $tabwidth));

	if (length ($entry{'Comment'})) {
	  # printf "<td align=center width=%d><font face=\"<infodrom-font />\"><b><a href=\"#%s\">%s</a></b></font></td>",
	  printf "<td bgcolor=\"<submenubgcolor>\" align=center width=%d><font face=\"<infodrom-font />\"><b>"
		."<a href=\"%s\">%s</a></b>"
		." <a href=\"#%s-%d\">*</a></font></td>",
	    $width, $entry{'Link'}, $entry{'Name'}, $type, $i;
	} else {
	  printf "<td bgcolor=\"<submenubgcolor>\" align=center width=%d><font face=\"<infodrom-font />\"><b>"
		."<a href=\"%s\">%s</a></b></font></td>",
	    $width, $entry{'Link'}, $entry{'Name'};
	}

	$i++;
	print OUT "</tr><p>" if (! ($i % $tabwidth));
      }
      if ($i % $tabwidth) {
	do {
	  print OUT "  <td>&nbsp;</td>";
	  $i++;
	  print OUT "</tr><p>" if (! ($i % $tabwidth));
	} until (!($i % $tabwidth));
      }
      print "</table></center>";
  }
:>
<br><line color=<menucolor>>
<:
  $comment = '<a name="%s-%d">'
	    .'<h3>%s</h3>'
	    .'<blockquote>'
	    .'%s'
	    .'</blockquote>'
	    .'</a>';

  foreach $type (('Deutschland','Europa','Weltweit')) {
      $list = $search{$type};
      @list = @$list;
      $tabwidth = &web_calc_table_width(9,8,7,6,5,$#list+1);

      %list = ();
      foreach $r (@list) {
        %entry = %{$r};
	$list{$entry{'Name'}} = $r;
      }

      @slist = sort (keys %list);

      $i=0;
      while ($i <= $#slist) {
        $r = $list{$slist[$i]};
	%entry = %$r;
	#%entry = %{$slist[$i]};
	$i++;

	next if (!length ($entry{'Comment'}));

	printf $comment, $type, $i-1, $entry{'Name'}, $entry{'Comment'};
      }
  }

:>

</page>

# Local variables:
# mode: indented-text
# mode: auto-fill
# end:
