Standardbildmodul CMS_IMG (file: include.CMS_IMG.php)
Verfasst: Sa 14. Mai 2005, 13:35
Mahlzeit zusammen,
nachdem ich mein - ursprünglich in diesem Thread - gepostetes Coding nun auch auf dem WebSpace - und nicht nur auf dem Localhost - einsetzen wollte, sind mir dort noch ein paar Fehler, insbesondere was die Wahl der Pfadvariablen angeht, aufgefallen.
Da ich diese natürlich im Zuge dessen korrigiert habe, möchte ich Euch diese auch nicht vorenthalten:
Das Coding in die Datei /contenido/includes/include.CMS_IMG.php pasten.
vG
Arno
PS ich darf mich, insbesondere beim Initiator des Ursprungsthreads, für das mangelnde Feedback bedanken!
nachdem ich mein - ursprünglich in diesem Thread - gepostetes Coding nun auch auf dem WebSpace - und nicht nur auf dem Localhost - einsetzen wollte, sind mir dort noch ein paar Fehler, insbesondere was die Wahl der Pfadvariablen angeht, aufgefallen.
Da ich diese natürlich im Zuge dessen korrigiert habe, möchte ich Euch diese auch nicht vorenthalten:
Code: Alles auswählen
<?php
/******************************************
* File : include.CMS_IMG.php
* Project : Contenido
* Descr : Include file for editiing
* content of type CMS_IMG
*
* Author : Jan Lengowski
* Created : 07.05.2003
* Modified : 14.05.2005 Arno Simon
*
* © four for business AG
******************************************/
if ($doedit == "1")
{
consaveContentEntry($idartlang, "CMS_IMG", $typenr, $CMS_IMG);
consaveContentEntry($idartlang, "CMS_IMGDESCR", $typenr, $CMS_IMGDESCR);
conGenerateCodeForArtInAllCategories($idart);
header("location:".$sess->url($cfgClient[$client]["path"]["htmlpath"]."front_content.php?area=$tmp_area&idart=$idart&idcat=$idcat&changeview=edit"));
}
if (!isset($cfgClient["set"]))
{
rereadClients ();
}
?>
<html>
<head>
<title>contenido</title>
<link rel="stylesheet" type="text/css" href="<?php print $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["styles"] ?>contenido.css">
</HEAD>
<body>
<script type="text/javascript">
<!--
function rewrite() {
var picture = new Array();
<?php
$sql = "SELECT * FROM ".$cfg["tab"]["upl"].
" WHERE idclient='".$client."' AND filetype IN ('jpg', 'gif', 'png') ORDER BY idupl";
$db->query($sql);
while ( $db->next_record() )
{
echo ' picture['.$db->f("idupl").']="'.$cfgClient[$client]["path"]["htmlpath"].$cfgClient[$client]["upload"].$db->f("dirname").$db->f("filename").'";
';
}
?> var selectedbutton = document.forms['user'].CMS_IMG
if (selectedbutton.options[selectedbutton.selectedIndex].value=="0")
{
var selectedbuttonvalue = "<?php echo $cfg["path"]["contenido_fullhtml"]; ?>images/spacer.gif";
} else {
var selectedbuttonvalue = picture[selectedbutton.options[selectedbutton.selectedIndex].value];
}
document.images.vorschau.src = "" + selectedbuttonvalue;
}
-->
</script>
<table width="100%" border=0 cellspacing="0" cellpadding="0" bgcolor="#ffffff">
<tr>
<td width="10" rowspan="4"><img src="<?php print $cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"] ?>spacer.gif" width="10" height="10"></td>
<td width="100%"><img src="<?php print $cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"] ?>spacer.gif" width="10" height="10"></td>
<td width="10" rowspan="4"><img src="<?php print $cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"] ?>spacer.gif" width="10" height="10"></td>
</tr>
<tr>
<td>
<?php
getAvailableContentTypes($idartlang);
//### next line name=...
?>
<FORM name="user" method="post" action="<?php echo $cfg["path"]["contenido_fullhtml"].$cfg["path"]["includes"]; ?>include.backendedit.php">
<?php
$sess->hidden_session();
?>
<INPUT type="hidden" name="lang" value="<?php echo $lang; ?>">
<!-- <INPUT type="hidden" name="submit" value="editcontent"> -->
<INPUT type="hidden" name="typenr" value="<?php echo $typenr; ?>">
<INPUT type="hidden" name="idart" value="<?php echo $idart; ?>">
<INPUT type="hidden" name="idcat" value="<?php echo $idcat; ?>">
<INPUT type="hidden" name="idartlang" value="<?php echo $idartlang; ?>">
<INPUT type="hidden" name="doedit" value="1">
<INPUT type="hidden" name="action" value="10">
<INPUT type="hidden" name="type" value="<?php echo $type; ?>">
<INPUT type="hidden" name="changeview" value="edit">
<TABLE cellpadding=$cellpadding cellspacing=$cellpadding border=0>
<TR>
<TD valign=\"top\" class=text_medium nowrap>
<?php echo $typenr.". ".$a_description["CMS_IMG"][$typenr]; ?>:
</TD>
<TD class=content>
<SELECT name="CMS_IMG" SIZE="1" ONCHANGE="rewrite()">
<?php if ($a_content["CMS_IMG"][$typenr] != "0")
{ ?>
<option value=0><?php echo '-- '.i18n("None").' --'; ?></option>
<?php } else { ?>
<option value="0" selected><?php echo '-- '.i18n("None").' --'; ?></option>
<?php }
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND filetype IN ('jpg', 'gif', 'png') ORDER BY dirname, filename";
$db->query($sql);
$default_image = $cfg["path"]["contenido_fullhtml"]."images/spacer.gif";
while ( $db->next_record() )
{
$descr = $db->f("description");
if ( strlen($descr) > 24 )
{
$descr = substr($descr, 0, 24);
$descr .= "..";
}
if ($db->f("idupl") != $a_content["CMS_IMG"][$typenr])
{
echo ' '.
'<option value="'.
$db->f("idupl").'">'.
$db->f("dirname").
$db->f("filename").
' ['.$descr.']'.
'</option>';
} else {
echo ' '.
'<option value="'.$db->f("idupl").
'" selected>'.$db->f("dirname").
$db->f("filename").
' ['.$descr.']'.
'</option>';
$default_image = $cfgClient[$client]["path"]["htmlpath"].
$cfgClient[$client]["upload"].
$db->f("dirname").$db->f("filename");
}
} ?>
</SELECT>
</TD>
<td rowspan ="2" width="15">
</td>
<TD rowspan ="2" width="300" valign="center" halign="center">
<img src="<?php echo $default_image; ?>" name="vorschau" border="0">
</TD>
</TR>
<TR>
<TD valign=top class=text_medium nowrap>
<?php echo $a_description["CMS_IMGDESCR"][$typenr]; ?>:
</TD>
<TD class="content">
<TEXTAREA class="text_medium" name="CMS_IMGDESCR" ROWS="3" COLS="30"><?php echo $a_content["CMS_IMGDESCR"][$typenr]; ?></TEXTAREA>
</TD>
</TR>
<?php
$tmp_area = "con_editcontent";
?>
<TR valign="top">
<TD colspan="2">
<br>
<a href="<?php echo $sess->url($cfgClient[$client]["path"]["htmlpath"].
'front_content.php?area=$tmp_area&idart=$idart&idcat=$idcat&idartlang=$idartlang'); ?>>
<img src="<?php echo $cfg['path']['contenido_fullhtml'].$cfg['path']['images'].'but_cancel.gif'; ?> border="0"></a>
<INPUT type="image" name="submit" value="editcontent" src="<?php echo $cfg['path']['contenido_fullhtml'].$cfg['path']['images'].'but_ok.gif'; ?>" border="0">
</TD>
</TR>
</TABLE>
</FORM>
</td>
</tr>
</table>
</body>
</HTML>
vG
Arno
PS ich darf mich, insbesondere beim Initiator des Ursprungsthreads, für das mangelnde Feedback bedanken!