00001 
00002 
00003 
#include "BaseForm.h"
00004 
#include "SimpleWeb.h"
00005 
00006 
00007 
00008 BaseForm::BaseForm(
SimpleWeb& www, 
const std::string& name)
00009 :WebForm(&www, name)
00010 ,m_web(www)
00011 ,m_name(name)
00012 {
00013 }
00014 
00015 
00016 BaseForm::~BaseForm()
00017 {
00018 }
00019 
00020 
00021 void BaseForm::Header(Database& db,Query& q,db::Account& acct,db::Player& pl,db::Location& loc,
char *sql)
00022 {
00023         printf(
"<div class=box style='background: #e0e0e0;'>");
00024         printf(
"Account: <b>%s</b> Player: <b>%s</b>\n", 
00025                 acct.name.c_str(), pl.name.c_str());
00026 
00027         
00028         printf(
"   <a class=button href='%s?%s=player'>Select another player</a>", 
GetWeb().GetCgiName().c_str(), GetFormName().c_str());
00029         printf(
"   <a class=button href='%s'>Main</a>", 
GetWeb().GetCgiName().c_str());
00030         printf(
"   <a class=button href='%s?BuildForm=try_build'>Build</a>", 
GetWeb().GetCgiName().c_str());
00031         printf(
"   <a class=button href='%s?%s=logout'>Logout</a>", 
GetWeb().GetCgiName().c_str(), GetFormName().c_str());
00032         
if (acct.superuser && !
GetWeb().
GetBuild())
00033         {
00034                 
if (
GetWeb().
GetSuperuservy())
00035                 {
00036                         printf(
"   <a class=button href='%s?%s=normalvy'>Normal mode</a>", 
GetWeb().GetCgiName().c_str(), GetFormName().c_str());
00037                 }
00038                 
else
00039                 {
00040                         printf(
"   <a class=button href='%s?%s=supervy'>Administration mode</a>", 
GetWeb().GetCgiName().c_str(), GetFormName().c_str());
00041                 }
00042                 printf(
"   <a class=button href='%s?%s=run'>Run</a>", 
GetWeb().GetCgiName().c_str(), GetFormName().c_str());
00043         }
00044         printf(
"</div>");
00045 }
00046 
00047