kümmer ich mich gleich drum.emergence hat geschrieben:noch ne wichtige sache...
hat einer schon versucht ein bild wieder auf kein zu stellen ?
das geht nämlich nicht...
Neue und benutzerfreundlichere include.CMS_IMG.php
-
- Beiträge: 6284
- Registriert: Do 15. Mai 2003, 18:32
- Wohnort: Da findet ihr mich nie!
- Kontaktdaten:
update:
- onLoad-Mechanismus eingebaut
- Auswahl von "kein" jetzt möglich
- onLoad-Mechanismus eingebaut
- Auswahl von "kein" jetzt möglich
Code: Alles auswählen
<?php
/*****************************************
* File : $RCSfile: include.CMS_IMG.php,v $
* Descr : CMS_IMG editor
*
* Author : $Author: timo.hummel $
*
* Created : 10.12.2003
* Modified : $Date: 2003/12/11 11:05:58 $
*
* © four for business AG, www.4fb.de
*
* Contributions by:
* 21.11.2003 (Ing. Christian Schuller - www.maurer-it.com)
*
* $Id: include.CMS_IMG.php,v 1.23 2003/12/11 11:05:58 timo.hummel Exp $
******************************************/
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"));
}
?>
<html>
<head>
<title>contenido</title>
<link rel="stylesheet" type="text/css" href="<?php print $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["styles"] ?>contenido.css">
</HEAD>
<script>
function disp_preview() {
if (document.editcontent.CMS_IMG.value) {
if (document.editcontent.CMS_IMG.value == "0")
{
preview.document.open();
preview.document.writeln('<html><body style="padding:0px; margin:0px;"><table border=0 width=100% height=100%><tr><td align="middle"></td></tr></table></body></html>');
preview.document.close();
} else {
preview.document.open();
preview.document.writeln('<html><body style="padding:0px; margin:0px;"><table border=0 width=100% height=100%><tr><td align="middle"><img src="'+imglnk[document.editcontent.CMS_IMG.value]+'"></td></tr></table></body></html>');
preview.document.close();
}
}
}
</script>
<body onLoad="window.setTimeout('disp_preview()',500);">
<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
cInclude("classes","class.ui.php");
cInclude("classes","class.htmlelements.php");
cInclude("classes","class.template.php");
cInclude("includes","functions.forms.php");
getAvailableContentTypes($idartlang);
$dirheight = 5;
$dirwidth = 300;
$filewidth = 300;
$fileheight = 5;
$descrwidth = 70;
$descrheight = 5;
$previewwidth = 600;
$previewheight = 400;
// COLLECT DATA
if (!isset($img_dir))
{
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND idupl = ".$a_content["CMS_IMG"][$typenr];
$db->query($sql);
$db->next_record();
$img_dir = $db->f("dirname");
}
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND filetype IN ('jpg', 'gif', 'png') ORDER BY dirname, filename";
$db->query($sql);
$ds_name = Array();
while ( $db->next_record() )
{
$descr = $db->f("description");
if ( strlen($descr) > 24 )
{
$descr = substr($descr, 0, 24);
$descr .= "..";
}
// collect data for dir selection
$tmp = split("/",$db->f("dirname"));
if (!in_array($tmp[count($tmp)-2],$ds_name))
{
$ds_lvl[] = count($tmp)-1;
$ds_name[] = $tmp[count($tmp)-2];
$ds_fullpath[] = $db->f("dirname");
}
if (strcmp($img_dir,$db->f("dirname"))==0)
{
$img_list[] = $db->f("filename");
$img_id[] = $db->f("idupl");
$img_descr[] = $descr;
}
}
$form = new UI_Table_Form("editcontent", $cfg["path"]["contenido_fullhtml"].$cfg["path"]["includes"]."include.backendedit.php");
$form->setVar("lang",$lang);
$form->setVar("typenr",$typenr);
$form->setVar("idart",$idart);
$form->setVar("idcat",$idcat);
$form->setVar("idartlang",$idartlang);
$form->setVar("contenido",$sess->id);
$form->setVar("action",10);
$form->setVar("doedit",1);
$form->setVar("type",$type);
$form->setVar("changeview","edit");
$form->setVar("CMS_LINK", $a_content["CMS_LINK"][$typenr]);
$header = sprintf(i18n("Edit image for container %s"),$typenr);
$form->addHeader($header);
$dirselect = new cHTMLSelectElement("img_dir");
$dirselect->setEvent("change", "doedit.value=0; submit();");
$dirselect->setSize($dirheight);
$dirselect->setStyle("width: {$dirwidth}px;");
foreach ($ds_lvl as $key => $value)
{
$text = str_repeat("-",$value*2)."> ".$ds_name[$key];
$option = new cHTMLOptionElement($text, $ds_fullpath[$key]);
switch ($value)
{
case 0:
case 1: $style="background-color:#C0C0C0;"; break;
case 2: $style="background-color:#D0D0D0;"; break;
case 3: $style="background-color:#E0E0E0;"; break;
default: $style="background-color:#F0F0F0;"; break;
}
if (strcmp($img_dir,$ds_fullpath[$key])==0)
{
$option->setSelected("selected");
}
$dirselect->addOptionElement($key, $option);
}
$script = '<script language="JavaScript">';
$script .= "imglnk = new Array();";
if (is_array($img_list))
{
foreach($img_list as $key => $value)
{
$script .= 'imglnk["'.$img_id[$key].'"] = "'.$cfgClient[$client]["path"]["htmlpath"]."upload/".$img_dir.$img_list[$key].'";';
}
}
$script .= "</script>";
$fileselect = new cHTMLSelectElement("CMS_IMG");
$fileselect->setEvent("change", "disp_preview(this.value);");
$fileselect->setSize($fileheight);
$fileselect->setStyle("width: {$filewidth}px;");
$option = new cHTMLOptionElement("-- ".i18n("None")." --", "0");
if ($a_content["CMS_IMG"][$typenr] == 0)
{
$option->setSelected("selected");
}
$fileselect->addOptionElement(-1,$option);
if (is_array($img_list))
{
foreach ($img_list as $key => $value)
{
$description = $img_descr[$key];
if ($description != "")
{
$text = $value . " (". $description .")";
} else {
$text = $value;
}
switch ($key % 2)
{
case 0: $style="background-color:#D0D0D0;"; break;
case 1: $style="background-color:#E0E0E0;"; break;
}
$option = new cHTMLOptionElement($text, $img_id[$key]);
if ($a_content["CMS_IMG"][$typenr]==$img_id[$key])
{
$option->setSelected("selected");
}
$option->setStyle($style);
$fileselect->addOptionElement($key, $option);
}
}
$form->add(i18n("Directory / File"), $dirselect->render().$script.$fileselect->render());
$textarea = new cHTMLTextarea("CMS_IMGDESCR", $a_content["CMS_IMGDESCR"][$typenr], $descrwidth, $descrheight);
$form->add("Description", $textarea->render());
$preview = '<iframe src="about:blank" name="preview" style="border: 0px; width:'.$previewwidth.'px; height:'.$previewheight.'px;">';
$preview .= '</iframe>';
$form->add("Preview", $preview);
$form->render(false);
?>
</td></tr></table>
</body>
</HTML>
Zuletzt geändert von timo am Do 11. Dez 2003, 12:06, insgesamt 2-mal geändert.
-
- Beiträge: 6284
- Registriert: Do 15. Mai 2003, 18:32
- Wohnort: Da findet ihr mich nie!
- Kontaktdaten:
Ja, hab ich schon gefixtemergence hat geschrieben:ähm timo check mal dein errorlog.txt
ich hab da nen sql fehler und Invalid argument supplied for foreach()
jeweils hängt es mit $img_dir zusammen...
erscheint wenn man die verzeichnisse mehrmals durchsieht...
Du bist manchmal echt zu schnell, bist du eine Maschine?
SQL-Fehler habe ich bisher keine erhalten...
kommt mit deiner aktualisierten version nicht mehr...
maschine, nein ich hab auch gefühle
ergänze noch das 'jpeg' bei filetype IN ('jpg', 'gif', 'png')
und das upload/ sollte durch $cfgClient[$client]["upl"]["frontendpath"]
ersetzt werden
damit wäre deine version perfekt...
ich geh was essen, mein magen fühlt sich nach dem schnaps noch nicht so gut an...
maschine, nein ich hab auch gefühle
ergänze noch das 'jpeg' bei filetype IN ('jpg', 'gif', 'png')
und das upload/ sollte durch $cfgClient[$client]["upl"]["frontendpath"]
ersetzt werden
damit wäre deine version perfekt...
ich geh was essen, mein magen fühlt sich nach dem schnaps noch nicht so gut an...
-
- Beiträge: 6284
- Registriert: Do 15. Mai 2003, 18:32
- Wohnort: Da findet ihr mich nie!
- Kontaktdaten:
Danke! Das hätte ich komplett übersehen.emergence hat geschrieben: ergänze noch das 'jpeg' bei filetype IN ('jpg', 'gif', 'png')
und das upload/ sollte durch $cfgClient[$client]["upl"]["frontendpath"]
ersetzt werden
damit wäre deine version perfekt...
ich geh was essen, mein magen fühlt sich nach dem schnaps noch nicht so gut an...
Klasse Sache
Dickes Lob und nen lauten Tusch...
Ihr seid wirklich spitze hier, aber eine Bitte hab ich noch:
könnt Ihr bitte den kompletten/perfekten Code posten?
Die Sache mit der "Upload/" Variabel habe ich nicht gebacken bekommen.
(jaaaaa, AnfängerAlarm...aber ich lerne noch)
Thx
TimeSpirit
Ihr seid wirklich spitze hier, aber eine Bitte hab ich noch:
könnt Ihr bitte den kompletten/perfekten Code posten?
Die Sache mit der "Upload/" Variabel habe ich nicht gebacken bekommen.
(jaaaaa, AnfängerAlarm...aber ich lerne noch)
Thx
TimeSpirit
Code: Alles auswählen
<?php
/*****************************************
* File : $RCSfile: include.CMS_IMG.php,v $
* Descr : CMS_IMG editor
*
* Author : $Author: timo.hummel $
*
* Created : 10.12.2003
* Modified : $Date: 2003/12/11 11:05:58 $
*
* © four for business AG, www.4fb.de
*
* Contributions by:
* 21.11.2003 (Ing. Christian Schuller - www.maurer-it.com)
*
* $Id: include.CMS_IMG.php,v 1.23 2003/12/11 11:05:58 timo.hummel Exp $
******************************************/
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"));
}
?>
<html>
<head>
<title>contenido</title>
<link rel="stylesheet" type="text/css" href="<?php print $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["styles"] ?>contenido.css">
</HEAD>
<script>
function disp_preview() {
if (document.editcontent.CMS_IMG.value) {
if (document.editcontent.CMS_IMG.value == "0")
{
preview.document.open();
preview.document.writeln('<html><body style="padding:0px; margin:0px;"><table border=0 width=100% height=100%><tr><td align="middle"></td></tr></table></body></html>');
preview.document.close();
} else {
preview.document.open();
preview.document.writeln('<html><body style="padding:0px; margin:0px;"><table border=0 width=100% height=100%><tr><td align="middle"><img src="'+imglnk[document.editcontent.CMS_IMG.value]+'"></td></tr></table></body></html>');
preview.document.close();
}
}
}
</script>
<body onLoad="window.setTimeout('disp_preview()',500);">
<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
cInclude("classes","class.ui.php");
cInclude("classes","class.htmlelements.php");
cInclude("classes","class.template.php");
cInclude("includes","functions.forms.php");
getAvailableContentTypes($idartlang);
$dirheight = 5;
$dirwidth = 300;
$filewidth = 300;
$fileheight = 5;
$descrwidth = 70;
$descrheight = 5;
$previewwidth = 600;
$previewheight = 400;
// COLLECT DATA
if (!isset($img_dir))
{
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND idupl = ".$a_content["CMS_IMG"][$typenr];
$db->query($sql);
$db->next_record();
$img_dir = $db->f("dirname");
}
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND filetype IN ('jpeg', 'jpg', 'gif', 'png') ORDER BY dirname, filename";
$db->query($sql);
$ds_name = Array();
while ( $db->next_record() )
{
$descr = $db->f("description");
if ( strlen($descr) > 24 )
{
$descr = substr($descr, 0, 24);
$descr .= "..";
}
// collect data for dir selection
$tmp = split("/",$db->f("dirname"));
if (!in_array($tmp[count($tmp)-2],$ds_name))
{
$ds_lvl[] = count($tmp)-1;
$ds_name[] = $tmp[count($tmp)-2];
$ds_fullpath[] = $db->f("dirname");
}
if (strcmp($img_dir,$db->f("dirname"))==0)
{
$img_list[] = $db->f("filename");
$img_id[] = $db->f("idupl");
$img_descr[] = $descr;
}
}
$form = new UI_Table_Form("editcontent", $cfg["path"]["contenido_fullhtml"].$cfg["path"]["includes"]."include.backendedit.php");
$form->setVar("lang",$lang);
$form->setVar("typenr",$typenr);
$form->setVar("idart",$idart);
$form->setVar("idcat",$idcat);
$form->setVar("idartlang",$idartlang);
$form->setVar("contenido",$sess->id);
$form->setVar("action",10);
$form->setVar("doedit",1);
$form->setVar("type",$type);
$form->setVar("changeview","edit");
$form->setVar("CMS_LINK", $a_content["CMS_LINK"][$typenr]);
$header = sprintf(i18n("Edit image for container %s"),$typenr);
$form->addHeader($header);
$dirselect = new cHTMLSelectElement("img_dir");
$dirselect->setEvent("change", "doedit.value=0; submit();");
$dirselect->setSize($dirheight);
$dirselect->setStyle("width: {$dirwidth}px;");
foreach ($ds_lvl as $key => $value)
{
$text = str_repeat("-",$value*2)."> ".$ds_name[$key];
$option = new cHTMLOptionElement($text, $ds_fullpath[$key]);
switch ($value)
{
case 0:
case 1: $style="background-color:#C0C0C0;"; break;
case 2: $style="background-color:#D0D0D0;"; break;
case 3: $style="background-color:#E0E0E0;"; break;
default: $style="background-color:#F0F0F0;"; break;
}
if (strcmp($img_dir,$ds_fullpath[$key])==0)
{
$option->setSelected("selected");
}
$dirselect->addOptionElement($key, $option);
}
$script = '<script language="JavaScript">';
$script .= "imglnk = new Array();";
if (is_array($img_list))
{
foreach($img_list as $key => $value)
{
$script .= 'imglnk["'.$img_id[$key].'"] = "'.$cfgClient[$client]["path"]["htmlpath"].$cfgClient[$client]["upl"]["frontendpath"].$img_dir.$img_list[$key].'";';
}
}
$script .= "</script>";
$fileselect = new cHTMLSelectElement("CMS_IMG");
$fileselect->setEvent("change", "disp_preview(this.value);");
$fileselect->setSize($fileheight);
$fileselect->setStyle("width: {$filewidth}px;");
$option = new cHTMLOptionElement("-- ".i18n("None")." --", "0");
if ($a_content["CMS_IMG"][$typenr] == 0)
{
$option->setSelected("selected");
}
$fileselect->addOptionElement(-1,$option);
if (is_array($img_list))
{
foreach ($img_list as $key => $value)
{
$description = $img_descr[$key];
if ($description != "")
{
$text = $value . " (". $description .")";
} else {
$text = $value;
}
switch ($key % 2)
{
case 0: $style="background-color:#D0D0D0;"; break;
case 1: $style="background-color:#E0E0E0;"; break;
}
$option = new cHTMLOptionElement($text, $img_id[$key]);
if ($a_content["CMS_IMG"][$typenr]==$img_id[$key])
{
$option->setSelected("selected");
}
$option->setStyle($style);
$fileselect->addOptionElement($key, $option);
}
}
$form->add(i18n("Directory / File"), $dirselect->render().$script.$fileselect->render());
$textarea = new cHTMLTextarea("CMS_IMGDESCR", $a_content["CMS_IMGDESCR"][$typenr], $descrwidth, $descrheight);
$form->add("Description", $textarea->render());
$preview = '<iframe src="about:blank" name="preview" style="border: 0px; width:'.$previewwidth.'px; height:'.$previewheight.'px;">';
$preview .= '</iframe>';
$form->add("Preview", $preview);
$form->render(false);
?>
</td></tr></table>
</body>
</HTML>
-
- Beiträge: 48
- Registriert: Mo 25. Aug 2003, 10:29
- Kontaktdaten:
Danke
Daaaaaaanke
hi,
habe meine includeCMS_IMG vor einiger zeit ebenfalls modifiziert.
folgende verbesserungen sind im vergleich zur hier veröffentlichten version enthalten:
- vorschaufunktion, welche man zum sparen von ladezeiten auch abstellen kann
- upload-funktion direkt aus der bildauswahl
- imagedescription-vorschlag, wenn imagedescr leer, aber in der datenbank eine filedescr existiert (funzt erst beim zweiten aufruf, da reine php lösung ohne reload <- hier wäre ein reload nach der bildauswahl bzw. eine reine javascript lösung besser)
folgendes ist allerdings schlechter als bei der hier vorgestellten version:
- design (was ja auch zur übersichtlichkeit beiträgt)
- keine auswahl nach ordnern möglich.
- eventuell schlechter code, kann das nicht beurteilen bin Programmier-Anfänger
für alle die es interessiert bzw. besser eine fusionierung der beiden modifikationen anstreben (bitte dann veröffentlichen) hier der code:
ein ähnliches feature (auswahl von internen artikeln nach kategorien getrennt, habe ich für die include.cmsLINK geschrieben. auch hier gilt das zur include.img gesagte. also hier der code:
habe meine includeCMS_IMG vor einiger zeit ebenfalls modifiziert.
folgende verbesserungen sind im vergleich zur hier veröffentlichten version enthalten:
- vorschaufunktion, welche man zum sparen von ladezeiten auch abstellen kann
- upload-funktion direkt aus der bildauswahl
- imagedescription-vorschlag, wenn imagedescr leer, aber in der datenbank eine filedescr existiert (funzt erst beim zweiten aufruf, da reine php lösung ohne reload <- hier wäre ein reload nach der bildauswahl bzw. eine reine javascript lösung besser)
folgendes ist allerdings schlechter als bei der hier vorgestellten version:
- design (was ja auch zur übersichtlichkeit beiträgt)
- keine auswahl nach ordnern möglich.
- eventuell schlechter code, kann das nicht beurteilen bin Programmier-Anfänger
für alle die es interessiert bzw. besser eine fusionierung der beiden modifikationen anstreben (bitte dann veröffentlichen) hier der code:
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
* Modified : 06.07.2005 Trixta
*
* © four for business AG
******************************************/
if ($doedit == "1") {
global $cfgClient;
global $client;
global $upldir;
global $uplfile;
cInclude("includes","functions.upl.php");
if (is_array($_FILES)) {
$userfile = Array($_FILES['uplfile']['tmp_name']);
$userfile_name = Array($_FILES['uplfile']['name']);
$userfile_size = Array($_FILES['uplfile']['size']);
$errno = uplupload($upldir,$userfile,$userfile_name,$userfile_size);
if (!$errno) {
if ($_FILES['uplfile']['name'][0] != "") {
$sql = "SELECT idupl
FROM
".$cfg["tab"]["upl"]."
WHERE
filename ='".$_FILES['uplfile']['name']."' AND
dirname ='".$upldir."'
ORDER BY idupl";
$db->query($sql);
while ( $db->next_record() )
{
$CMS_IMG = $db->f("idupl");
}
}
}
}
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 selectedbutton1 = document.forms['user'].vorschau
if (selectedbutton1.options[selectedbutton1.selectedIndex].value=="1") {
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 enctype="multipart/form-data" 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="vorschau" size="1">
<option value="1">Vorschau An</option>
<option value="0">Vorschau Aus</option>
</select>
<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");
$descr2 = $db->f("description");
}
}
?>
</SELECT>
</TD>
<td rowspan ="4" width="15">
</td>
<TD rowspan ="4" width="300" align="center">
<img src="<?php echo $default_image; ?>" name="vorschau" border="0">
</TD>
</TR>
<TR valign=top>
<TD 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
if ($a_content["CMS_IMGDESCR"][$typenr] == "" || $a_content["CMS_IMGDESCR"][$typenr] == " ")
echo $descr2;
else
echo $a_content["CMS_IMGDESCR"][$typenr]; ?></TEXTAREA>
</TD>
</TR>
<TR valign=top>
<TD class=text_medium nowrap>
Datei hochladen:
</TD>
<TD class="content">
<?php cInclude("includes","functions.upl.php");
// Laden der Verzeichnisse und Dateien in separate Arrays
$olddir = getcwd();
chdir($cfgClient[$client]['upl']['path'].rawurldecode($path));
$dirlist = uplDirectoryListRecursive($cfgClient[$client]['upl']['path'].rawurldecode($path));
chdir($olddir);
$upldirs = '<select name="upldir">';
$upldirs .= '<option value=""><upload>/</option>';
foreach ($dirlist as $key => $value)
{
$upldirs .= '<option value="'.$value["pathstring"].'">'."<upload>/".$value["pathstring"].'</option>';
}
$upldirs .= "</select>";
echo $upldirs; ?><input name="uplfile" type="file">
</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>
<TR><TD colspan="2" height="100%"><br><br><br><br><br><br><br><br><br><br><br></TD></TR>
</TABLE>
</FORM>
</td>
</tr>
</table>
</body>
</HTML>
Code: Alles auswählen
<?php
/******************************************
* File : include.CMS_LINK.php
* Project : Contenido
* Descr : Include file for editiing
* content of type CMS_LINK
*
* Author : Jan Lengowski
* Created : 07.05.2003
* Modified : 07.05.2003
*
* © four for business AG
******************************************/
if ($doedit == "1") {
global $cfgClient;
global $client;
global $_FILES;
global $upldir;
global $uplfile;
global $HTTP_POST_FILES;
cInclude("includes","functions.upl.php");
$rootpath = $cfgClient[$client]["path"]["htmlpath"] . $cfgClient[$client]["upload"];
$CMS_LINK = $CMS_LINKextern;
if ($CMS_LINKintern)
{
$CMS_LINK = $CMS_LINKintern;
}
if($selectpdf){
$CMS_LINK = $rootpath . $selectpdf;
}
if($selectimg){
$CMS_LINK = $rootpath . $selectimg;
}
if($selectzip){
$CMS_LINK = $rootpath . $selectzip;
}
if($selectaudio){
$CMS_LINK = $rootpath . $selectaudio;
}
if($selectany){
$CMS_LINK = $rootpath . $selectany;
}
if (is_array($HTTP_POST_FILES))
{
$userfile = Array($HTTP_POST_FILES['uplfile']['tmp_name']);
$userfile_name = Array($HTTP_POST_FILES['uplfile']['name']);
$userfile_size = Array($HTTP_POST_FILES['uplfile']['size']);
$errno = uplupload($upldir,$userfile,$userfile_name,$userfile_size);
if (!$errno)
{
if ($_FILES['uplfile']['name'][0] != "")
{
$CMS_LINK = $rootpath . $upldir.$_FILES['uplfile']['name'];
}
}
}
conSaveContentEntry($idartlang, "CMS_LINK", $typenr, $CMS_LINK);
conSaveContentEntry($idartlang, "CMS_LINKDESCR", $typenr, $CMS_LINKDESCR);
conSaveContentEntry($idartlang, "CMS_LINKTARGET", $typenr, $CMS_LINKTARGET);
conGenerateCodeForartInAllCategories($idart);
Header("Location:".$sess->url($cfgClient[$client]["path"]["htmlpath"]."front_content.php?area=$tmp_area&idart=$idart&idcat=$idcat&changeview=edit"));
}
?>
<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 MARGINHEIGHT=0 MARGINWIDTH=0 LEFTMARGIN=0 TOPMARGIN=0>
<table width="100%" border=0 cellspacing="0" cellpadding="0">
<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);
cInclude("classes","class.ui.php");
cInclude("classes","class.template.php");
cInclude("includes","functions.forms.php");
global $typenr;
$form = new UI_Table_Form("editcontent", $cfg["path"]["contenido_fullhtml"].$cfg["path"]["includes"]."include.backendedit.php");
$form->setVar("lang",$lang);
$form->setVar("typenr",$typenr);
$form->setVar("idart",$idart);
$form->setVar("idcat",$idcat);
$form->setVar("idartlang",$idartlang);
$form->setVar("contenido",$sess->id);
$form->setVar("action",10);
$form->setVar("doedit",1);
$form->setVar("type",$type);
$form->setVar("changeview","edit");
$form->setVar("CMS_LINK", $a_content["CMS_LINK"][$typenr]);
$header = sprintf(i18n("Edit link for container %s"),$typenr);
$form->addHeader($header);
if (is_numeric($a_content["CMS_LINK"][$typenr])) {
$a_link_intern_value = $a_content["CMS_LINK"][$typenr];
$a_link_extern_value = "";
} else {
$a_link_intern_value = "0";
$a_link_extern_value = $a_content["CMS_LINK"][$typenr];
}
$form->add(i18n("External link"),formGenerateField ("text", "CMS_LINKextern", $a_link_extern_value, 60, 255));
$sql = "SELECT
*
FROM
".$cfg["tab"]["cat_tree"]." AS a,
".$cfg["tab"]["cat_art"]." AS b,
".$cfg["tab"]["cat"]." AS c,
".$cfg["tab"]["cat_lang"]." AS d,
".$cfg["tab"]["art_lang"]." AS e
WHERE
a.idcat = b.idcat AND
b.idcat = d.idcat AND
d.idlang = '".$lang."' AND
b.idart = e.idart AND
c.idcat = a.idcat AND
c.idclient = '".$client."' AND
e.idlang = '".$lang."'
ORDER BY
a.idtree";
$db->query($sql);
$intlink .= "<SELECT name=internartauskat SIZE=1 onChange=\"document.editcontent.internartauskat.value=this.value;location.reload();\"><option value=all>aller Kategorien anzeigen</option>";
//Trixta Test:
// fetch all categorys
$db2 = new DB_Contenido;
$query = "SELECT A.idcat, A.level, C.name FROM ".$cfg["tab"]["cat_tree"]." AS A, ".
$cfg["tab"]["cat"]." AS B, ".$cfg["tab"]["cat_lang"]." AS C WHERE A.idcat=B.idcat ".
"AND B.idcat=C.idcat AND C.idlang='$lang' AND B.idclient='$client' ".
"AND C.visible=1 ORDER BY A.idtree";
// execute query
$db2->query($query);
// loop result and build the options
while ($db2->next_record()) {
// indent spacer
$spaces = "|";
// how many levels
$levels = $db2->f("level");
for ($i = 0; $i < $levels; $i ++) {
// add 2 spaces for every level
$spaces = $spaces . "--";
} // end for
$spaces .= ">";
if ($selected == $db2->f("idcat")) {
// selected category
$intlink .= "<option selected=\"selected\" value=\"". $db2->f("idcat") ."\">". $spaces . $db2->f("name") ."</option>";
} else {
// category
$intlink .= "<option value=\"". $db2->f("idcat") ."\">". $spaces . $db2->f("name") ."</option>";
} // end if
} // end while
$intlink .= "</SELECT><SELECT name=CMS_LINKintern SIZE=1 onChange=\"editcontent.CMS_LINK.value=this.value; editcontent.CMS_LINKextern.value='';\">";
if ($a_link_intern_value != 0) {
$intlink .= "<option value=0>-- ".i18n("None")." --</option>";
} else {
$intlink .= "<option value=0 selected>-- ".i18n("None")." --</option>";
}
$intlink .= "<script language=\"JavaScript\"><!-- ";
while ( $db->next_record() ) {
$spaces = "";
for ($i=0; $i<$db->f("level"); $i++) {
$spaces .= " ";
}
$tmp_title = $db->f("title");
if ( strlen($tmp_title) > 32 ) {
$tmp_title = substr($tmp_title, 0, 32);
}
$spaces .= "> ";
$tmp_title2 = addslashes($tmp_title);
if ( $db->f("idcatart") != $a_link_intern_value ) {
$intlink .= "if ((document.editcontent.internartauskat.value == \"all\") || (document.editcontent.internartauskat.value == \"".$db->f("idcat")."\"))
document.write(\"<option value=".$db->f("idcatart").">$spaces ".$db->f("name")."---".$tmp_title2."</option>\");";
} else {
$intlink .= "document.write(\"<option value=".$db->f("idcatart")." selected>$spaces ".$db->f("name")."---".$tmp_title2."</option>\");";
}
}
$intlink .= " //--></SCRIPT></SELECT>";
$form->add(i18n("Internal link"),$intlink);
$pdflink.= "<SELECT name=\"selectpdf\" SIZE=1>";
$pdflink.= "<option value=\"\" selected>".i18n("Please choose")."</option>";
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND filetype IN ('pdf','doc','ppt','xls','rtf','dot') ORDER BY dirname, filename";
$db->query($sql);
while ($db->next_record()) {
$pdflink.= "<option value=\"".$db->f("dirname").$db->f("filename")."\">".$db->f("dirname").$db->f("filename")." [".$db->f("description")."]</option>";
}
$pdflink.= "</SELECT>";
$form->add(i18n("Link to a document"),$pdflink);
$imglink .= "<SELECT name=\"selectimg\" SIZE=1>";
$imglink .= "<option value=\"\" selected>".i18n("Please choose")."</option>";
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND filetype IN ('png','gif','tif','jpg','jpeg','psd','pdd','iff','bmp','rle','eps','fpx','pcx','jpe','pct','pic','pxr','tga') ORDER BY dirname, filename";
$db->query($sql);
while ($db->next_record()) {
$imglink .= "<option value=\"".$db->f("dirname").$db->f("filename")."\">".$db->f("dirname").$db->f("filename")." [".$db->f("description")."]</option>";
}
$imglink .= "</SELECT>";
$form->add(i18n("Link to an image"),$imglink);
$ziplink .= "<SELECT name=\"selectzip\" SIZE=1>";
$ziplink .= "<option value=\"\" selected>".i18n("Please choose")."</option>";
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND filetype IN ('zip','arj','lha','lhx','tar','tgz','rar','gz') ORDER BY dirname, filename";
$db->query($sql);
while ($db->next_record()) {
$ziplink .= "<option value=\"".$db->f("dirname").$db->f("filename")."\">".$db->f("dirname").$db->f("filename")." [".$db->f("description")."]</option>";
}
$ziplink .= "</SELECT>";
$form->add(i18n("Link to an archive"),$ziplink);
$audiolink .= "<SELECT name=\"selectaudio\" SIZE=1>";
$audiolink .= "<option value=\"\" selected>".i18n("Please choose")."</option>";
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND filetype IN ('mp3','mp2','avi','mpg','mpeg','mid','wav','mov') ORDER BY dirname, filename";
$db->query($sql);
while ($db->next_record()) {
$audiolink .= "<option value=\"".$db->f("dirname").$db->f("filename")."\">".$db->f("dirname").$db->f("filename")." [".$db->f("description")."]</option>";
}
$audiolink .= "</SELECT>";
$form->add(i18n("Link to a media file"),$audiolink);
$anylink .= "<SELECT name=\"selectany\" SIZE=1>";
$anylink .= "<option value=\"\" selected>".i18n("Please choose")."</option>";
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' ORDER BY dirname, filename";
$db->query($sql);
while ($db->next_record()) {
$anylink .= "<option value=\"".$db->f("dirname").$db->f("filename")."\">".$db->f("dirname").$db->f("filename")." [".$db->f("description")."]</option>";
}
$anylink .= "</SELECT>";
$form->add(i18n("Link to any file"),$anylink);
cInclude("includes","functions.upl.php");
// Laden der Verzeichnisse und Dateien in separate Arrays
$olddir = getcwd();
chdir($cfgClient[$client]['upl']['path'].rawurldecode($path));
$dirlist = uplDirectoryListRecursive($cfgClient[$client]['upl']['path'].rawurldecode($path));
chdir($olddir);
$upldirs = '<select name="upldir">';
$upldirs .= '<option value=""><upload>/</option>';
foreach ($dirlist as $key => $value)
{
$upldirs .= '<option value="'.$value["pathstring"].'">'."<upload>/".$value["pathstring"].'</option>';
}
$upldirs .= "</select>";
$form->add(i18n("Upload file"),$upldirs.'<input name="uplfile" type="file">');
$form->add(i18n("Description"),"<TEXTAREA name=CMS_LINKDESCR ROWS=3 COLS=60>".htmlspecialchars($a_content["CMS_LINKDESCR"][$typenr])."</TEXTAREA>");
$linktarget = " <INPUT class=text_medium type=text name=CMS_LINKTARGET VALUE=\"".$a_content["CMS_LINKTARGET"][$typenr]."\" SIZE=60 onChange=\"setlinktargettosomething();\">";
$form->add(i18n("Target frame"),$linktarget);
$newwindow = " <INPUT TYPE=checkbox name=checkboxlinktarget value=\"1\" onClick=\"setlinktargettoblank();\" ";
if ($a_content["CMS_LINKTARGET"][$typenr]=="_blank")
{
$newwindow .= " checked";
}
$newwindow .= ">".i18n("Open link in new window")."</INPUT>";
$newwindow .= "
<!---------JavaScript-------------------->
<script language=\"JavaScript\">
<!--
function setlinktargettosomething() {
document.editcontent.checkboxlinktarget.value = 1;
document.editcontent.checkboxlinktarget.checked = false;
}
function setlinktargettoblank() {
if (document.editcontent.checkboxlinktarget.value == 1) {
document.editcontent.CMS_LINKTARGET.value = \"_blank\";
document.editcontent.checkboxlinktarget.value = 0;
} else {
document.editcontent.CMS_LINKTARGET.value = \"\";
document.editcontent.checkboxlinktarget.value = 1;
}
}
//-->
</SCRIPT>
";
$form->add(i18n("Open in new window"),$newwindow);
$tmp_area = "con_editcontent";
$form->addCancel($sess->url($cfgClient[$client]["path"]["htmlpath"]."front_content.php?area=$tmp_area&idart=$idart&idcat=$idcat"));
echo $form->render();
echo " </TD></TR>";
echo " </TABLE>
</FORM>";
?>
</td></tr></table>
</body>
</HTML>
und hier die verknüpfung beider scripts mit einer zusätzlichen modifikation
features:
- auswahl der bilder nach ordnerstruktur (habe hier wieder alle unterordner angezeigen lassen, da ja einige kunden 2 gleichnamige unterordner in verschiedenen "überordnern" haben)
- upload funktion
- bild beschreibung wird vorgeschlagen (wenn keine img_descr vorliegt, aber zum bild eine filedescr vorliegt und der redakteur ins img_descr feld klickt.
- universal-beschreibungsfunktion hängt mit dem feature zuvor zusammen und bedeutet, dass eine filedescr zum bild abgelegt wird, welche dann bei verwendung des selben bildes auf einer anderen seite als vorschlag angezeigt wird.
die einzelnen optionen hierzu funzen wie folgt:
auto: wenn keine filedescr vorliegt aber eine imgdescr zum bild angegeben wurde, wird die imgdescr zusätzlich als filedescr abgespeichert ja: wird imgdescr als filedescr abgespeichert
nein: wird imgdescr nicht als filedescr abgespeichert...
diese funktionen dienen also dazu dem redakteur zu helfen. im prinzip muss er nur einmal zum bild eine ordentlich beschreibung ablegen und bekommt bei wiederverwenden des bildes auf einer anderen seite diese dann als "vorschlag".
features:
- auswahl der bilder nach ordnerstruktur (habe hier wieder alle unterordner angezeigen lassen, da ja einige kunden 2 gleichnamige unterordner in verschiedenen "überordnern" haben)
- upload funktion
- bild beschreibung wird vorgeschlagen (wenn keine img_descr vorliegt, aber zum bild eine filedescr vorliegt und der redakteur ins img_descr feld klickt.
- universal-beschreibungsfunktion hängt mit dem feature zuvor zusammen und bedeutet, dass eine filedescr zum bild abgelegt wird, welche dann bei verwendung des selben bildes auf einer anderen seite als vorschlag angezeigt wird.
die einzelnen optionen hierzu funzen wie folgt:
auto: wenn keine filedescr vorliegt aber eine imgdescr zum bild angegeben wurde, wird die imgdescr zusätzlich als filedescr abgespeichert ja: wird imgdescr als filedescr abgespeichert
nein: wird imgdescr nicht als filedescr abgespeichert...
diese funktionen dienen also dazu dem redakteur zu helfen. im prinzip muss er nur einmal zum bild eine ordentlich beschreibung ablegen und bekommt bei wiederverwenden des bildes auf einer anderen seite diese dann als "vorschlag".
Code: Alles auswählen
<?php
/*****************************************
* File : $RCSfile: include.CMS_IMG.php,v $
* Descr : CMS_IMG editor
*
* Author : $Author: timo.hummel $
*
* Created : 10.12.2003
* Modified : $Date: 2003/12/11 11:05:58 $
*
* © four for business AG, www.4fb.de
*
* Contributions by:
* 21.11.2003 (Ing. Christian Schuller - www.maurer-it.com)
*
* $Id: include.CMS_IMG.php,v 1.23 2003/12/11 11:05:58 timo.hummel Exp $
******************************************/
if ($doedit == "1") {
global $cfgClient;
global $client;
global $upldir;
global $uplfile;
cInclude("includes","functions.upl.php");
if (is_array($_FILES)) {
$userfile = Array($_FILES['uplfile']['tmp_name']);
$userfile_name = Array($_FILES['uplfile']['name']);
$userfile_size = Array($_FILES['uplfile']['size']);
$errno = uplupload($upldir,$userfile,$userfile_name,$userfile_size);
if (!$errno) {
if ($_FILES['uplfile']['name'][0] != "") {
$sql = "SELECT idupl
FROM
".$cfg["tab"]["upl"]."
WHERE
filename ='".$_FILES['uplfile']['name']."' AND
dirname ='".$upldir."'
ORDER BY idupl";
$db->query($sql);
while ( $db->next_record() )
{
$CMS_IMG = $db->f("idupl");
}
}
}
}
if ($universaldescr == 2 && ($filedescrvorhanden == "" || $filedescrvorhanden == " ")) {
$db2 = new DB_Contenido;
$sqlitem = "UPDATE ".$cfg["tab"]["upl"]." Set description = '".$CMS_IMGDESCR."' WHERE idupl = ".$CMS_IMG." AND idclient='".$client."'";
$db2->query($sqlitem);
}
else if ($universaldescr == 1) {
$db2 = new DB_Contenido;
$sqlitem = "UPDATE ".$cfg["tab"]["upl"]." Set description = '".$CMS_IMGDESCR."' WHERE idupl = ".$CMS_IMG." AND idclient='".$client."'";
$db2->query($sqlitem);
}
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"));
}
?>
<html>
<head>
<title>contenido</title>
<link rel="stylesheet" type="text/css" href="<?php print $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["styles"] ?>contenido.css">
</HEAD>
<script>
function disp_preview() {
if (document.editcontent.CMS_IMG.value) {
if (document.editcontent.CMS_IMG.value == "0")
{
preview.document.open();
preview.document.writeln('<html><body style="padding:0px; margin:0px;"><table border=0 width=100% height=100%><tr><td align="middle"></td></tr></table></body></html>');
preview.document.close();
} else {
preview.document.open();
preview.document.writeln('<html><body style="padding:0px; margin:0px;"><table border=0 width=100% height=100%><tr valign="top"><td align="middle"><img src="'+imglnk[document.editcontent.CMS_IMG.value]+'"></td></tr></table></body></html>');
preview.document.close();
}
}
}
function img_descrvorschlag(imgdescr) {
if (document.editcontent.CMS_IMG.value) {
if (document.editcontent.CMS_IMG.value != "0" && (imgdescr == "" || imgdescr == " "))
{
document.editcontent.CMS_IMGDESCR.value = filedescr[document.editcontent.CMS_IMG.value];
}
if (document.editcontent.CMS_IMG.value != "0")
document.editcontent.filedescrvorhanden.value = filedescr[document.editcontent.CMS_IMG.value];
}
}
</script>
<body onLoad="window.setTimeout('disp_preview()',500);">
<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
cInclude("classes","class.ui.php");
cInclude("classes","class.htmlelements.php");
cInclude("classes","class.template.php");
cInclude("includes","functions.forms.php");
getAvailableContentTypes($idartlang);
$dirheight = 6;
$dirwidth = 320;
$filewidth = 360;
$fileheight = 6;
$descrwidth = 108;
$descrheight = 6;
$previewwidth = 680;
$previewheight = 800;
// COLLECT DATA
if (!isset($img_dir))
{
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND idupl = '".$a_content["CMS_IMG"][$typenr]."'";
$db->query($sql);
$db->next_record();
$img_dir = $db->f("dirname");
}
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND filetype IN ('jpeg', 'jpg', 'gif', 'png') ORDER BY dirname, filename";
$db->query($sql);
$ds_name = Array();
while ( $db->next_record() )
{
$descr = $db->f("description");
$descr2 = $db->f("description");
if ( strlen($descr) > 24 )
{
$descr = substr($descr, 0, 24);
$descr .= "..";
}
// collect data for dir selection
$tmp = split("/",$db->f("dirname"));
if (!in_array($tmp[count($tmp)-2],$ds_name))
{
$ds_lvl[] = count($tmp)-1;
$ds_name[] = $tmp[count($tmp)-2];
$ds_fullpath[] = $db->f("dirname");
}
if (strcmp($img_dir,$db->f("dirname"))==0)
{
$img_list[] = $db->f("filename");
$img_id[] = $db->f("idupl");
$img_descr[] = $descr;
$img_descr2[] = $descr2;
}
}
$form = new UI_Table_Form("editcontent", $cfg["path"]["contenido_fullhtml"].$cfg["path"]["includes"]."include.backendedit.php");
$form->setVar("lang",$lang);
$form->setVar("typenr",$typenr);
$form->setVar("idart",$idart);
$form->setVar("idcat",$idcat);
$form->setVar("idartlang",$idartlang);
$form->setVar("contenido",$sess->id);
$form->setVar("action",10);
$form->setVar("doedit",1);
$form->setVar("type",$type);
$form->setVar("changeview","edit");
$form->setVar("CMS_LINK", $a_content["CMS_LINK"][$typenr]);
$header = sprintf(i18n("Edit image for container %s"),$typenr);
$form->addHeader($header);
$dirselect = new cHTMLSelectElement("img_dir");
$dirselect->setEvent("change", "doedit.value=0; submit();");
$dirselect->setSize($dirheight);
$dirselect->setStyle("width: {$dirwidth}px;");
foreach ($ds_lvl as $key => $value)
{
$text = str_repeat("-",$value*2)."> ".$ds_name[$key];
//$option = new cHTMLOptionElement($text, $ds_fullpath[$key]);
$option = new cHTMLOptionElement($ds_fullpath[$key], $ds_fullpath[$key]);
switch ($value)
{
case 0:
case 1: $style="background-color:#C0C0C0;"; break;
case 2: $style="background-color:#D0D0D0;"; break;
case 3: $style="background-color:#E0E0E0;"; break;
default: $style="background-color:#F0F0F0;"; break;
}
if (strcmp($img_dir,$ds_fullpath[$key])==0)
{
$option->setSelected("selected");
}
$dirselect->addOptionElement($key, $option);
}
$script = '<script language="JavaScript">';
$script .= "imglnk = new Array();";
$script .= "filedescr = new Array();";
if (is_array($img_list))
{
foreach($img_list as $key => $value)
{
$script .= 'imglnk["'.$img_id[$key].'"] = "'.$cfgClient[$client]["path"]["htmlpath"].$cfgClient[$client]["upl"]["frontendpath"].$img_dir.$img_list[$key].'";';
$script .= 'filedescr["'.$img_id[$key].'"] = "'.$img_descr2[$key].'";';
}
}
$script .= "</script>";
$fileselect = new cHTMLSelectElement("CMS_IMG");
$fileselect->setEvent("change", "disp_preview(this.value);");
$fileselect->setSize($fileheight);
$fileselect->setStyle("width: {$filewidth}px;");
$option = new cHTMLOptionElement("-- ".i18n("None")." --", "0");
if ($a_content["CMS_IMG"][$typenr] == 0)
{
$option->setSelected("selected");
}
$fileselect->addOptionElement(-1,$option);
if (is_array($img_list))
{
foreach ($img_list as $key => $value)
{
$description = $img_descr[$key];
if ($description != "")
{
$text = $value . " (". $description .")";
} else {
$text = $value;
}
switch ($key % 2)
{
case 0: $style="background-color:#D0D0D0;"; break;
case 1: $style="background-color:#E0E0E0;"; break;
}
$option = new cHTMLOptionElement($text, $img_id[$key]);
if ($a_content["CMS_IMG"][$typenr]==$img_id[$key])
{
$option->setSelected("selected");
}
$option->setStyle($style);
$fileselect->addOptionElement($key, $option);
}
}
$form->add(i18n("Directory / File"), $dirselect->render().$script.$fileselect->render());
$textarea = new cHTMLTextarea("CMS_IMGDESCR", $a_content["CMS_IMGDESCR"][$typenr], $descrwidth, $descrheight);
$textarea->setEvent("focus", "img_descrvorschlag(this.value);");
$form->add("Description", $textarea->render());
$universaldescrselect = '<input type="hidden" name="filedescrvorhanden" value="1"><select name="universaldescr" title="Soll die Beschreibung universal abgespeichert werden, damit die Beschreibung bei Verwendung desselben Bildes auf anderen Seiten vorgeschlagen werden kann?">';
$universaldescrselect .= '<option value="2">auto</option>';
$universaldescrselect .= '<option value="1">Ja, die Beschreibung auch bei anderen Seiten vorschlagen</option>';
$universaldescrselect .= '<option value="0">Nein, die Beschreibung soll nur für die Seite gelten</option>';
$universaldescrselect .= "</select>";
$form->add('Universal-Beschreibung',$universaldescrselect);
cInclude("includes","functions.upl.php");
// Laden der Verzeichnisse und Dateien in separate Arrays
$olddir = getcwd();
chdir($cfgClient[$client]['upl']['path'].rawurldecode($path));
$dirlist = uplDirectoryListRecursive($cfgClient[$client]['upl']['path'].rawurldecode($path));
chdir($olddir);
$upldirs = '<select name="upldir">';
$upldirs .= '<option value=""><upload>/</option>';
foreach ($dirlist as $key => $value)
{
$upldirs .= '<option value="'.$value["pathstring"].'">'."<upload>/".$value["pathstring"].'</option>';
}
$upldirs .= "</select>";
$form->add(i18n("Upload file"),$upldirs.'<input name="uplfile" type="file" size="40">');
$preview = '<iframe src="about:blank" name="preview" style="border: 0px; width:'.$previewwidth.'px; height:'.$previewheight.'px;">';
$preview .= '</iframe>';
$form->add("Preview", $preview);
$form->render(false);
?>
</td></tr></table>
</body>
</HTML>
Zuletzt geändert von trixta am Mi 24. Aug 2005, 08:05, insgesamt 1-mal geändert.