%# BEGIN LICENSE BLOCK
%# 
%#  Copyright (c) 2002-2003 Jesse Vincent <jesse@bestpractical.com>
%#  
%#  This program is free software; you can redistribute it and/or modify
%#  it under the terms of version 2 of the GNU General Public License 
%#  as published by the Free Software Foundation.
%# 
%#  A copy of that license should have arrived with this
%#  software, but in any event can be snarfed from www.gnu.org.
%# 
%#  This program is distributed in the hope that it will be useful,
%#  but WITHOUT ANY WARRANTY; without even the implied warranty of
%#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%#  GNU General Public License for more details.
%# 
%# END LICENSE BLOCK

<& /RTFM/Elements/Header, Title => $Title &>
<& /Elements/PageLayout,
    current_toptab => 'RTFM/index.html',
    current_tab => $current_toptab,
    current_subtab => $current_tab,
    toptabs => $toptabs,
    tabs => $second_tabs,
    topactions => $topactions,
    actions => $actions,
    subactions => $subactions,
    title => $Title
&>
<& /Elements/Callback, %ARGS, _CallbackName => "Header" &>
<%INIT>
my $action;


my $toptabs = { a => { title => loc('RT'),
                       path  => '', },
                aab => { title   => loc('RTFM'),
                         path    => 'RTFM/index.html'}
                };

my $second_tabs = { 'aab' => { title => loc('Overview'),
                               path  => 'RTFM/index.html' },
                    'articles' => { title => loc('Articles'),
                                    path => 'RTFM/Article/Search.html' },
                    'atopics' => { title => loc('Topics'),
                                   path => 'RTFM/Topics.html'},
                  };

if ($session{'CurrentUser'}->HasRight( Right => 'ShowConfigTab',
                                       Object => $RT::System )) {
    $second_tabs->{config} = { title => loc('Configuration'),
                               path => 'Admin/RTFM/index.html',
                             };
}

my $topactions = {
        B => { html => $m->scomp('/RTFM/Elements/GotoArticle', %ARGS) }
        };

                    
  # Now let callbacks add their extra tabs
  $m->comp('/Elements/Callback', topactions => $topactions, toptabs => $toptabs, %ARGS);

  foreach my $tab (sort keys %{$second_tabs}) {
    if ($second_tabs->{$tab}->{'path'} eq $current_toptab) {
      $second_tabs->{$tab}->{"subtabs"} = $tabs;
      $second_tabs->{$tab}->{"current_subtab"} = $current_tab;
    }
        
  }
</%INIT>
<%ARGS>
$current_toptab => undef
$current_tab => undef
$tabs => undef
$actions => undef
$subactions => undef
$Title => undef
</%ARGS>
