<?php
@session_start();


include_once( "f_admin.php" );
include_once( "f_wfl.php" );
include_once( "kd_einsprungspunkte.php" );


///////////////////////////////
// Darf der Benutzer diese Seite sehen?

$exec = besitzt_benutzer_systemrecht( $_SESSION[ "mandant_name" ], $_SESSION[ "benutzer_anmeldename" ], "ADMINISTRATOR" );


if ( ( $exec[ 0 ] != 1 ) && ( mb_strtoupper( $_SESSION[ "benutzer_anmeldename" ], "UTF-8" ) != "SUPERUSER" ) )
{
	header( "Location: us_uebersicht.php" );
}

///////////////////////////////



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



if ( mb_strtoupper( $_SESSION[ "benutzer_anmeldename" ], "UTF-8" ) == "SUPERUSER" )
{
	include( "su_menu.php" );
}
else
{
	include( "ad_menu.php" );
}



echo "<div style='margin-left:200px; padding-bottom:30px;  min-height:550px;'><form action='' name='konfig_aendern' >";
?>

	<select size="20" name="kategorie" id="select_style_1" onchange="fuelle_element( 'einst', ' ' ); fuelle_element( 'sys_wert_n', '<input type=\'text\' style=\'width:500px;height:22px; border:0px; display:inline;\' />' ); fuelle_element( 'sys_wert', ' ' ); ajaxFunction( 'su_web.php?cmd=liefere_einstellungen_anhand_kategorie&mandant_name=<?php echo urlencode( $mandant_name ); ?>&kategorie='+encodeURIComponent( this.value ), 'div_select' );"   >

<?php
	$html = "";
	$ergebnis = liefere_systemparameter_kategorien( $_SESSION[ "mandant_name" ] );
	foreach ( $ergebnis[ 2 ] as $kategorie )
	{
		$html = $html."<option value='".$kategorie."'>".$kategorie."</option>";
		//echo "<option value='".$kategorie."'>".$kategorie."</option>";
	}
	//onclick
	
	$html = $html.'</select>';
	$html = $html.'<div id="div_select" style="display:inline;" ><select size="20" name="select_style_2" id="select_style_2"  onchange="$( \'#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=\'+encodeURIComponent( this.value ), \'beschreibung\' );"   ></select></div>';
	
	$html = $html.'<br />';
	
	$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; vertical-align: baseline;  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 ).'\', document.konfig_aendern.select_style_2.value, document.konfig_aendern.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.'<div style="display:none;" id="meldung" name="meldung"  ></div></form>';
	
	$_SESSION[ "meldung_ad" ] = '';
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	echo $html;




echo "</div>";

include( 'ssi_footer.php' );

?>