<?php

  require "atk/class.atknode.inc"; 
  include "theme.inc";
  $g_layout->output("<html>");
  $g_layout->head(text("app_title"));
  $g_layout->body();
  $g_layout->output("<br><div align='center'>"); 
  $g_layout->ui_top(text("menu"));
  $g_layout->output("<br>");

  require "config_modules.inc";

  while (list($modname, $actionarr) = each($modules))
  {
    if (is_array($actionarr))
    {      
      // new array based actiondefinitions..
      for ($i=0;$i<count($actionarr);$i++)
      {
        if (substr($actionarr[$i],0,1)=="*")
        {
          // This is a menu item..
          $action = substr($actionarr[$i],1);
          $title = "menu_".$modname."_".$action;
          
          if ($g_securityManager->allowed($modname, $action))
          {
            $menu.= '<a href="dispatch.php3?atknodetype='.$modname.'&atkaction='.$action.'" target="main">'.text($title).'</a>';
          }
          else
          {
            $menu.= text($title);
          }
          $menu.= $config_menu_delimiter;
        }
      }
    }
    else
    {
      // oldstyle 
      // actionarray is modname..     
      $modname = $actionarr;
      if ($modname!="-")
      {
        $title   = "title_".$modname;
        $url     = $modname."_url";
        $accessname  = $modname."_accessright";
        $access = $$accessname;
                
        if (!is_array($access)||$g_securityManager->allowed($access[0],$access[1]))
        {          
          $menu .= '<a href="'.$$url.'" target="main">'.text($title).'</a>';
        }
        else
        {
          $menu .= text($title);
        }
        $menu.= $config_menu_delimiter;
      }
      else
      {
        $menu .= '<br>';
      }
    }
  }      

  $g_layout->output($menu);
  $g_layout->output("<br><br>");
  $g_layout->ui_bottom();
  $g_layout->output("</div></html>"); 
  $g_layout->outputFlush();
  
?>
