<?php
$sql = "SELECT * FROM " . PREFIX . "_Texte WHERE ID = \"" . $_POST['ID'] . "\";";
$result = $db->query($sql);
$nt = $result->fetch_assoc();
if ($_SESSION['Firma']['KfZ'])
{
	$nt['Name'] = str_replace("Leistungsverzeichnisse", "Kostenvoranschläge", $nt['Name']);
}
echo "<fieldset>\n";
echo "	<form action=\"index.php?" . $_SERVER['QUERY_STRING'] . "\" method=\"post\" />\n";
echo "		<input type=\"hidden\" name=\"ID\" value=\"" . $_POST['ID'] . "\" />\n";
echo "		<legend>" . $nt['Name'] . ": Texte editieren</legend>\n";
echo "		<h2>Bitte beachten Sie, dass Sie KEINE Grußformel in den Texten benötigen. Diese legen Sie in den Firmenstammdaten fest!</h2>\n";
echo "		<br />\n";
echo "		<fieldset>\n";
echo "			<legend class=\"sub\">PDF-Dokument Texte</legend>\n";
echo "			<label>Einleitender Text</label>\n";
echo "			<br />\n";
echo "			<textarea name=\"Text1\">" . stripslashes($nt['Text1']) . "</textarea>\n";
echo "			<script type=\"text/javascript\">\n";
echo "				CKEDITOR.replace( 'Text1',\n";
echo "					{\n";
echo "					toolbar :\n";
echo "					  [\n";
echo "						['tokens_" . $nt['section'] . "'],\n";
echo "						[ 'Bold', 'Italic' ],[ 'Cut', 'Copy', 'Paste', '-', '-', 'Scayt'],[ 'Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat']\n";
echo "					  ],\n";
echo "					  extraPlugins: 'tokens_" . $nt['section'] . "'\n";
echo "					}\n";
echo "				);\n";
echo "			</script>\n";
echo "			<br />\n";
echo "			<label>Abschließender Text</label>\n";
echo "			<br />\n";
echo "			<textarea name=\"Text2\">" . stripslashes($nt['Text2']) . "</textarea>\n";
echo "			<script type=\"text/javascript\">\n";
echo "				CKEDITOR.replace( 'Text2',\n";
echo "					{\n";
echo "					toolbar :\n";
echo "					  [\n";
echo "						['tokens_" . $nt['section'] . "'],\n";
echo "						[ 'Bold', 'Italic' ],[ 'Cut', 'Copy', 'Paste', '-', '-', 'Scayt'],[ 'Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat']\n";
echo "					  ],\n";
echo "					  extraPlugins: 'tokens_" . $nt['section'] . "'\n";
echo "					}\n";
echo "				);\n";
echo "			</script>\n";
echo "			<br />\n";
echo "		</fieldset>\n";
echo "		<br />\n";
echo "		<fieldset>\n";
echo "			<legend class=\"sub\">Email</legend>\n";
echo "			<label>Betreff</label>\n";
echo "			<input type=\"text\" name=\"Betreff\" value=\"" . stripslashes($nt['Betreff']) . "\" />\n";
echo "			<br />\n";
echo "			<label>Email Text</label>\n";
echo "			<br />\n";
echo "			<textarea name=\"EMail\">" . stripslashes($nt['EMail']) . "</textarea>\n";
echo "			<script type=\"text/javascript\">\n";
echo "				CKEDITOR.replace( 'EMail',\n";
echo "					{\n";
echo "					toolbar :\n";
echo "					  [\n";
echo "						['tokens_" . $nt['section'] . "'],\n";
echo "					  ],\n";
echo "					  extraPlugins: 'tokens_" . $nt['section'] . "'\n";
echo "					}\n";
echo "				);\n";
echo "			</script>\n";
echo "			<br />\n";
echo "		</fieldset>\n";
echo "		<br />\n";
echo "		<input type=\"submit\" class=\"button_save\" name=\"formaction\" value=\"save\" title=\"Speichern\" />\n";
echo "		<input type=\"submit\" class=\"button_stop\" name=\"formaction\" value=\"stop\" title=\"Abbrechen\" />\n";
echo "	</form>\n";
echo "</fieldset>\n";