
sub PreCreateForm ()
{
   my $cConfigDirName;
   my @lAlleImages;
   my $cImageName;

   $cConfigDirName = &GetAttr("BaseDir") . "/lib/Images";

   $bIsAnon = $oSessionGL->getState("IsAnonymous");

   if($bIsAnon)
   {
      &MySetVal("State Init", "BtnNew", "-");
      &MySetVal("State Init", "BtnDef", "-");
      &MySetVal("Layout Label Comment", "Text",
                b(i18n("Please note that anonymous users " .
                       "can't change any settings.")));
   }

   if(&GetAttr("LastBtn") ne "BtnNew")
   {
      &SetField("Lang",
                $oSessionGL->getState("[WWWdb] Lang"));
      &SetField("BgColorForm",
                $oSessionGL->getState("[GUI] BgColor"));
      &SetField("BgColorTable",
                $oSessionGL->getState("[Layout Table] BgColor"));
      &SetField("BgColorTable1stCol",
                $oSessionGL->getState("[Layout Table] BgColor1stCol"));
      &SetField("BorderTable",
                $oSessionGL->getState("[Layout Table] Border"));
      &SetField("ConfirmIns",
                $oSessionGL->getState("[GUI] DontConfirmAfterInsert"));
      &SetField("ConfirmUpd",
                $oSessionGL->getState("[GUI] DontConfirmAfterUpdate"));
      &SetField("ConfirmDel",
                $oSessionGL->getState("[GUI] DontConfirmAfterDelete"));
      &SetField("DebugMode",
                $oSessionGL->getState("[Debug] Level"));
   }

}



sub MyBtnNew ()
{
   my $cApplName = &GetAttr("ScriptName");

   $oSessionGL->setState("[WWWdb] Lang", &GetField("Lang"));

   $oSessionGL->setState("[GUI] BgColor", &GetField("BgColorForm"));

   $oSessionGL->setState("[Layout Table] BgColor",
                       &GetField("BgColorTable"));

   $oSessionGL->setState("[Layout Table] BgColor1stCol",
                       &GetField("BgColorTable1stCol"));

   $oSessionGL->setState("[Layout Table] Border",
                       &GetField("BorderTable"));

   $oSessionGL->setState("[GUI] DontConfirmAfterInsert",
                       &GetField("ConfirmIns"));

   $oSessionGL->setState("[GUI] DontConfirmAfterUpdate",
                       &GetField("ConfirmUpd"));

   $oSessionGL->setState("[GUI] DontConfirmAfterDelete",
                       &GetField("ConfirmDel"));

   $oSessionGL->setState("[Debug] Level",
                       &GetField("DebugMode"));

   &OkForm("", i18n("Defaults changed!"));

   &MyExit();
}


sub MyBtnDef ()
{

   $oSessionGL->setState("[WWWdb] Lang", &GetAttr("BaseLang"));
   $oSessionGL->setState("[GUI] BgColor", undef);
   $oSessionGL->setState("[Layout Table] BgColor", undef);
   $oSessionGL->setState("[Layout Table] BgColor1stCol", undef);
   $oSessionGL->setState("[Layout Table] Border", undef);
   $oSessionGL->setState("[GUI] DontConfirmAfterDelete", undef);
   $oSessionGL->setState("[GUI] DontConfirmAfterUpdate", undef);
   $oSessionGL->setState("[GUI] DontConfirmAfterInsert", undef);
   $oSessionGL->setState("[Debug] Level", undef);

   &OkForm("", i18n("Set to defaults!"));

   # &Redirect(&GetAttr("SessionId"), &GetAttr("ConfigFile"));

}


sub PostFirstColumn ()
{
   my $cResult = "";


   if(&IsAttribOK("ActualLogin") && !&IsAttribOK("IsAnonymous"))
   {
      $cResult .= (br() x 2 .
                   b(i18n("See also:")) .
                   br().
                   li(&ResolveRefField("wwwdb://WWWdb:System:ChangePassword",
                                       i18n("Change my password"))));
   }

   return small($cResult);

}


1;
