Location: PHPKode > projects > PhpMyContent > phpMyContent-0.1/artikel_neu.php3
<?
	require 'inc/config.php3';			// Variablen Deklaration
	require "$inc_path/db_connect.php3";	// Datenbank Verbindung
	require "$inc_path/auth.php3";		// Authentifizierung
	require "$inc_path/header.php3";		// HTML Header (Layout)
	require "$inc_path/user_track.php3";	// User Logging
?>
	<center><h3><?echo $nav_artikel?> (<?echo $nav_neu?>)</h3>
	<table border=0 bgcolor="#dddddd" width=100%>
	<tr valign=top>
			<td align=center>
				<SCRIPT LANGUAGE="JavaScript">
					function doCheck() {
						if (document.dokVorlage.dokument.selectedIndex < 1) {
							alert("Bitte wählen Sie eine Vorlage aus!");
							return false;
						}
						return true;
					}
				</SCRIPT>
<?					if (($status == 'im Kontext nicht definiert') && ($benutzername != 'schneider')) {
						$sqlquery = " 	SELECT DISTINCT 
										Dokument.autoID, 
										Dokument.name, 
										Dokument.beschreibung 
								FROM 		Dokument , Redakteur, DokDef
								WHERE	 	Dokument.bereichID = $bereich AND 
										DokDef.dokID = Dokument.autoID AND 
										Redakteur.dokDefID = DokDef.autoID AND 
										Redakteur.benutzerID = $benutzerID AND 
										Dokument.aktiv = 1"; 
					} else {
						$sqlquery = "
								SELECT 	Dokument1.autoID,
									Dokument1.name,
									Dokument1.beschreibung
								FROM 	Dokument Dokument1
								WHERE 
									Dokument1.bereichID = $bereich AND
									Dokument1.aktiv = 1";
					}
 					$db_object->query_db($content_db, $sqlquery);
?>					<form name="dokVorlage" action="artikel_neu.php3" method="post"> 
					<input type="hidden" name="projekt" value="<?echo $projekt?>"> 
					<input type="hidden" name="bereich" value="<?echo $bereich?>"> 
					<select name="dokument"  onchange="if (doCheck()) { document.dokVorlage.submit(); }"> 
 						<option value="">[<?echo $label_dokument_waehlen;?>]</option> 
<?						while ($row = $db_object->getrow()) {
							if ( ($dokument) && ($dokument == $row[0]) ) { 
								$dokumentName = $db_object->unescapeChar($row[1]); 
							} 
?>							<option value="<?echo $row[0]?>"><?echo $db_object->unescapeChar($row[1])?></option> 
<?							if (!($dokument)) { 
								$dokument = $row[0]; 
								$dokumentName = $db_object->unescapeChar($row[1]); 
							} 
						}
?> 
					</select> 
					</form> 
					<?echo $label_gewaehltes_dokument?>: <b><?echo $dokumentName;?></b> 
			</td> 
		</tr> 
	</table> 
 
	<table border=0> 
	<tr valign=top> 
		<td valign=top> 
<?			if ($dokument) { 
?>				<form action="artikel_insert.php3" name="form" ENCTYPE="multipart/form-data" method="post" onsubmit="return check_required_fields();"> 
				<input type="hidden" name="projekt" value="<?echo $projekt?>"> 
				<input type="hidden" name="bereich" value="<?echo $bereich?>"> 
				<input type="hidden" name="dokument" value="<?echo $dokument?>"> 
				<table border=0>
<? 				if (($status == 'im Kontext nicht definiert') && ($benutzername != 'schneider')) { 
						$sqlquery = "	SELECT	DISTINCT 	DokDef.autoID, 
											DokDef.pflichtfeld, 
											DokDef.beschreibung,
											DokDef.name,
											DokDef.typ,
											DokDef.inhaltFeld,
											DokDef.wysiwyg,
											DokDef.reihenfolge,
											Redakteur.dokDefID
								FROM			Dokument, DokDef, Redakteur
								WHERE			Dokument.autoID = $dokument AND
											DokDef.dokID = Dokument.autoID AND 
											DokDef.autoID = Redakteur.dokDefID AND
											Redakteur.benutzerID = $benutzerID"; 
				} else { 
					$sqlquery = "	SELECT		DISTINCT 	DokDef.autoID, 
											DokDef.pflichtfeld, 
											DokDef.beschreibung,
											DokDef.name,
											DokDef.typ,
											DokDef.inhaltFeld,
											DokDef.wysiwyg,
											DokDef.reihenfolge
									FROM 		Dokument, 
											DokDef 
									WHERE 		Dokument.autoID = $dokument AND 
											DokDef.dokID = Dokument.autoID  
									ORDER BY	DokDef.reihenfolge"; 
				} 
				$db_object->query_db($content_db, $sqlquery);
				while ($row = $db_object->getrow()) {
					if ($row[2] == 1) { 
						$pflichtfeld = $row[1] . ", "; 
					} 
?>					<tr><td><b><a href="JavaScript:ShowSat('elementhilfe.php3?dokDefId=<?echo $row[0]?>', 'Elementhilfe', 600, 400)" onmouseover=" status='<?echo ereg_replace("'", "\'", $db_object->unescapeChar($row[2]))?>'; return true;" onmouseout="status=''; return true;"><?echo $row[3]?>:</a></b></td> </tr>
<?					if ( ($row[5] >= 1000) || ($row[6] == 'binaer') ) { 
?>						<tr><td><input type="file" name="element<?echo $row[1]?>" size=50 style="width=500pt; background='white';"></td></tr> 
<?					} else { 
						if ($row[5] == 'shorttext') { 
?>							<tr><td><input type="text" name="element<?echo $row[0]?>" size=50 value="" style="width=500pt; background='white';"></td></tr> 
<?						} else if ($row[5] == 'text') { 
							if ($row[6] == 1) { 
								$wysiwygElement = $row[0] . ', ' . $wysiwygElement; 
?>								<tr><td>
									<script language="JavaScript"> 
									if (navigator.userAgent.indexOf("MSIE") == -1){ 
										document.write('<textarea cols=80 rows=10 name="element<?echo $row[0]?>"></textarea>'); 
									} else{ 
										var browserVersionInfo = Array() 
										browserVersionInfo = navigator.userAgent.split(";") 
										IEVersion = browserVersionInfo[1].substring(6,7) 
										if(IEVersion <"5"){ 
											document.write('<textarea cols=80 rows=10 name="element<?echo $row[0]?>"></textarea>'); 
										} else { 
											document.write('<input type="hidden" name="element<?echo $row[0]?>" value="">'); 
											document.write('<iframe name="imageelement<?echo $row[0]?>" src="wysiwyg_imageform.html" style="width:1pt;height=1pt;"></iframe>'); 
											document.write('<iframe name="element<?echo $row[0]?>" src="wysiwyg.php3?id=&typ=<?echo $row[5]?>" style="width:500pt;height=400pt;"></iframe><br><br>'); 
										} 
									} 
									</script> 
								</td></tr>
<?							} else { 
?>								<tr><td>
									<textarea cols=45 rows=10 name="element<?echo $row[0]?>" style="width=500pt; background='white';"></textarea>
								</td></tr>
<?							} 
						} else if ($row[5] == 'shortzahl') { 
?>							<tr><td><input type="text" name="element<?echo $row[0]?>" size=50 value="" style="width=500pt; background='white';"></td></tr>
<?						} else if ($row[5] == 'zahl') { 
?>							<tr><td><input type="text" name="element<?echo $row[0]?>" size=50 value="" style="width=500pt; background='white';"></td></tr>
<?						} else if ($row[5] == 'zeit') { 
?>							<tr><td><input type="text" name="element<?echo $row[0]?>" size=50 value="" style="width=500pt; background='white';"></td></tr>
<?						} else if ($row[5] == 'binaer') { 
?>							<tr><td><input type="file" name="element<?echo $row[0]?>" size=50 style="width=500pt; background='white';"></td></tr>
<?						} else if ($row[5] == 'single_liste') { 
?>							<tr><td><select name="element<?echo $row[0]?>" style="width=500pt; background='white';"> 
<?							$sqlquery = "SELECT name, wert FROM DokDefListe WHERE dokDefID = " . $row[0] . " ORDER BY reihenfolge"; 
							$db_object->query_db($content_db, $sqlquery, 1);
							while ($row2 = $db_object->getrow(1)) { 
?>								<option value="<?echo $db_object->escapeChar($row2[1])?>"><?echo $db_object->escapeChar($row2[0])?></option> 
<?								$j++; 
							} 
?>							</select></td></tr>
<?						} else if ($row[5] == 'multi_liste') { 
?>							<tr><td><select multiple name="element<?echo $row[0]?>[]" style="width=500pt; background='white';"> 
<?							$sqlquery = "SELECT name, wert FROM DokDefListe WHERE dokDefID = " . $row[0] . " ORDER BY reihenfolge"; 
							$db_object->query_db($content_db, $sqlquery, 1);
							while ($row2 = $db_object->getrow(1)) { 
?>								<option value="<?echo $db_object->escapeChar($row2[1])?>"><?echo $db_object->escapeChar($row2[0])?></option> 
<?								$j++; 
							} 
?>							</select></td></tr>
<?						} 
					} 
				} 
				if (($status != 'Redakteur') && ($status != 'im Kontext nicht definiert') && ($benutzername != 'schneider') ) { 
?>					<tr><td><b><?echo $label_sichtbar;?></b>&nbsp;<input type="Checkbox" name="aktiv" <?if ($aktiv == 1) echo "CHECKED"?>></td></tr>
<?				} else { 
?>					<tr><td><input type="hidden" name="aktiv" VALUE="<?echo $aktiv?>"> </td></tr>
<?				} 
			}
?>			</table>
			<input type=submit value="<?echo $nav_speichern;?>" style="width: 500pt;"> 
			</form> 
	</td> 
</tr> 
</table> 
</center> 
 
<script language="JavaScript"> 
function check_required_fields() { 
	update_hidden(); 
<?
	if ($pflichtfeld) {
		$pflichtfeld = substr($pflichtfeld, 0, strlen($pflichtfeld) - 2); 
		$pflichtfeld = explode(', ', $pflichtfeld); 
		for ($i=0; $i<count($pflichtfeld); $i++) { 
?>			if (document.form.element<?echo $pflichtfeld[$i]?>.value.length == 0) { 
				alert("<?echo $check_required_fields;?>"); 
				document.form.element<?echo $pflichtfeld[$i]?>.focus(); 
				return false; 
			} 
<?		} 
	}
?>	return true; 
} 

	function update_hidden() {
<?		if (preg_match('/MSIE (\d*)/', $HTTP_USER_AGENT, $reg)) {
			if ($reg[1] >= 5) {
?>				var bildtag = /<img.+src="(\w.+)">/gi;
<?				$wysiwygElement = substr($wysiwygElement, 0, strlen($wysiwygElement) - 2);
				$wysiwygElement = explode(', ', $wysiwygElement);
				for ($i=0; $i<count($wysiwygElement); $i++) {
?>					document.form.element<?echo $wysiwygElement[$i]?>.value = frames['element<?echo $wysiwygElement[$i]?>'].tbContentElement.DOM.body.innerHTML;
					document.form.element<?echo $wysiwygElement[$i]?>.value = document.form.element<?echo $wysiwygElement[$i]?>.value.replace("\r\n", "");
					document.form.element<?echo $wysiwygElement[$i]?>.value = document.form.element<?echo $wysiwygElement[$i]?>.value.replace("\n", "");
					testwert = frames['element<?echo $wysiwygElement[$i]?>'].tbContentElement.DOM.body.innerHTML;
<?				}
			}
		}
?>		return true;
	}

</script> 

<?	require 'inc/db_disconnect.php3'; 
	require 'inc/footer.php3'; 
?>
Return current item: PhpMyContent