#!/usr/bin/perl
# ================================================================================
# $Rev: 196 $ $URL: svn://localhost/PlayChess/trunk/cgi/tutorial.cgi $
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Author: $Author: Thomas $
# Modified: $Date: 2006-09-02 18:52:49 +0200 (Sa, 02 Sep 2006) $
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright at playchess.de - all rights reserved
# ================================================================================
use lib "../cgi-bin";
use CGI::Carp qw(fatalsToBrowser);
use CGI qw( :standard );
use PCSession;
use Template;
use Util;
local $cgi = CGI->new(); DBG(__FILE__,__LINE__, $cgi );
local $sobj = PCSession->new( $cgi );
local $sname = $sobj->getValue( 'name' );
local $topic = $cgi->param( 'topic' );
local $oldtopic = $cgi->param( 'oldtopic' );
local $action = $cgi->param( 'action' );
local $config = getConfig();
local @topics = qw( basics register login playerhome playerinfo playerstats
settings enroll games move condmove priv annotations
member memberlist memberbenefits memberstandard memberpremium membertrial
translate translate-files translate-workflow
translate-page translate-makros translate-field
translate-change translate-approve translate-lang translate-apply translate-first
);
unshift @topics, '';
# print "topic=$topic
\n";
if( $topic eq 'next' )
{
for( $k=0; $k<@topics; $k++ )
{
if( $topics[$k] eq $oldtopic )
{
$topic = $topics[$k+1];
break;
}
}
}
elsif( $topic eq 'prev' )
{
for( $k=0; $k<@topics; $k++ )
{
if( $topics[$k] eq $oldtopic )
{
$topic = $topics[$k-1];
break;
}
}
}
# print "topic=$topic
\n";
my $tplfile = ($topic) ? "tutorial-$topic.tpl" : "tutorial.tpl";
my $isPopup = ( $action =~ /^(print|popup)$/ );
$tplfile =~ s/\.tpl/.pop/ if( $isPopup );
local $tpl = Template->new( $tplfile );
$tpl->addMakro( 'OLDTOPIC', $topic );
$tpl->addMakro( 'POPUP', $isPopup );
print $tpl->Expand($sobj);
exit(0);