<?php
@session_start();

if ( strtolower( $_SESSION[ "benutzer_anmeldename" ] ) <> "superuser" )
{
	$_SESSION[ "benutzer_anmeldename" ] = "";
	header("Location: index.php");
}

$_SESSION[ "title" ] = "Systemkonfiguration";
virtual( 'ssi_header.php' );
$_SESSION[ "title" ] = "";

$mandant_name = $_SESSION[ "mandant_name" ];

//$wertemengen = liefere_alle_wertemengen_kuerzel( "Standard", false );



	include( "su_menu.php" );
	
	echo "<div style='margin-left:200px; padding-bottom:30px;  min-height:550px;'>";
	
	$html = '<select size="20" name="kategorie" id="select_style_1" onclick="fuelle_element( \'einst\', \' \' ); ajaxFunction( \'su_web.php?cmd=liefere_einstellungen_anhand_kategorie&mandant_name='.urlencode( $mandant_name ).'&kategorie=\'+this.value, \'div_select\' );"   >';
	$ergebnis = liefere_systemparameter_kategorien( $_SESSION[ "mandant_name" ] );
	foreach ( $ergebnis[ 2 ] as $kategorie )
	{
		$html = $html."<option value='".$kategorie."'>".$kategorie."</option>";
	}
	//
	
	$html = $html.'</select>';
	$html = $html.'<div id="div_select" style="display:inline;" ><select size="20" name="select_style_2" id="select_style_2"  onclick="$( \'#einst\' ).html( $( \'#select_style_2\' ).val() ); $( \'#systemeinstellung\' ).val( $( \'#select_style_2\' ).val() ); ajaxFunction( \'su_web.php?cmd=liefere_konfig&mandant_name='.urlencode( $mandant_name ).'&konfig_option=\'+this.value, \'sys_wert\' ); ajaxFunction( \'su_web.php?cmd=liefere_konfig_neu&mandant_name='.urlencode( $mandant_name ).'&konfig_option=\'+this.value, \'sys_wert_n\' ); ajaxFunction( \'su_web.php?cmd=liefere_konfig_beschreibung&mandant_name='.urlencode( $mandant_name ).'&konfig_option=\'+this.value, \'beschreibung\' );"   ></select></div>';
	$html = $html.'<br /><form action="" name="konfig_aendern" method="post" >';
	$html = $html.'<table style="font-size:90%"><tr><td style="height:22px;">Systemeinstellung</td><td><div  style="border:0px; font-weight:bold;" id="einst" name="einst" ></div><input type="hidden" name="systemeinstellung" id="systemeinstellung" value="" ></input></td></tr>';
	$html = $html.'<tr><td>aktueller Wert</td><td style="height:22px;"><span style="width:500px;height:22px; font-size:100%;" id="sys_wert" name="sys_wert"  ></span></td></tr>';
	$html = $html.'<tr><td style="height:25px;">neuer Wert</td><td><div id="sys_wert_n" name="sys_wert_n" style="width:500px;" ><input type="text" style="width:500px;height:22px; border:0px; display:inline;" /></div></td><td><input type="button" value="Aktualisieren" style="border:0px; width:90px;" onclick="konfiguration_aendern( \''.urlencode( $mandant_name ).'\', this.form.systemeinstellung.value, this.form.sys_wert_neu.value, \'meldung\', \'sys_wert\' );" /></td></tr>';
	$html = $html.'<tr><td style="vertical-align:top;height:22px;">Beschreibung</td><td colspan="2"><textarea name="beschreibung" id="beschreibung" style="width:600px;border:0px; height:150px; color:black;" disabled="disabled"></textarea></table>';
	$html = $html.'<input type="hidden" id="meldung" name="meldung" stye="display:hidden;" ></input></form>';
	
	$_SESSION[ "meldung_su" ] = '';
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	echo $html;
	
	//echo '<div name="wertemenge_ergebnis_3" id="wertemenge_ergebnis_3" style=" margin-top:10px;" >'.$_SESSION[ "meldung_su" ].'</div>';
	//$_SESSION[ "meldung_su" ] = "";
	


//echo "<p style='height:200px;' />";
echo "</div>";
echo "<p style='clear:both;' />";
include( 'ssi_footer.php' );

?>