#! /usr/bin/perl

# ---------------------------------
# SHARK e-business system
# Copyright (c)2000 Svatopluk Benes
# ---------------------------------

# -----------
# TEXTPAGE.PL - sablona pro zobrazeni statickych textovych stranek
# -----------
# text se natahne z messages pro sekci =ParTextTyp. 
#V messages je jmeno sablony, ktere se natahne ze souboru sharkid_ss_jmsablony.htm umisteneho v domovskem adresari firmy $sharkDir

# ------------
# Inicializace
# ------------               

  require "../shark/sharkcfg.pl";
		
	&FNPredejSharkId;
	$ParSekce = FNPredejPar(url_param('sekce'),"xxx");
	
	$ErrText = "";
	$ErrCode = 0;

	&SharkConnect;
	if ( $sqlErrCode != 0 ) { $ParAkce='error'; $ErrText = $sqlErrText}
	#overeni cookies -prihlaseni  uzivatele stools_uziv	  
	{
			&FNCtiUzivCookie;
			if (&FNStoolsLogCookie(@sharkUserCookie{'ID1'},@sharkUserCookie{'ID2'},@sharkUserCookie{'ID3'},@sharkUserCookie{'ID4'}))
			{
				$sharkCookUser = &FNVytvorUzivCookie(@sharkUserCookie{'ID1'},@DBStoolsUziv{'password'},$sharkId,time);
				$sharkUzivatelLog = 1;
				
			}		
			else
			{
				$sharkCookUser = &FNSmazUzivCookie;
				$sharkUzivatelLog = 0;
			}
	}

# --------------------------------
# Generovani staticke uvodni casti
# --------------------------------
	
	print header(-type=>'text/html; charset=utf8',
				 -content_language=>'cz',
				 -cookie=>[$sharkCookUser,$sharkSessionCookie]),"\n\n";
	
	&SharkPageBegin($ParSekce);	
	
	
	if ( $ParAkce ne 'error' )
	{
		&FNParagraf($ParSekce,0,0);
		if ( $sqlErrCode != 0 ) { $ParAkce='error'; $ErrText = $sqlErrText}
	}	
	if ( $ParAkce eq 'error' || $ErrCode > 0 )        # ErrCOde = -1 je neprihlasenz user, to se zde nepovazuje za chybu TODO: předelat ve FNStoolsLogCookie, nema to byt chyba ale stav !
	{
		&SharkMessage('Chyba',$ErrText,"");
	}
	   

	
# -----------------------------------
# Generovani statickeho konce stranky
# -----------------------------------

	&SharkPageEnd($ParSekce);
