^_^
ähm also modul kenne ich auf die schnelle keines...
die idee ist aber nicht schlecht...
wenn ich mich nicht ganz irre gibt es in der include.CMS_LINK.php eine integrierte upload funktion...
so etwas ähnliches(wenn nicht sogar das selbe) könnte man in der include.CMS_IMG.php ergänzen... (ich würd da aber die erweiterte version dieser datei nehmen die du ja auch schon verwendest...)
der code in der include.CMS_LINK.php mit upload beschäftigt wäre in etwa der da (hoffe ich vergesse jetzt nichts)
$form->add wird zb nur in der neueren version der include.CMS_IMG.php verwendet...
ob der teil überhaupt ohne änderungen so zu verwenden ist ??
es wäre auch möglich das es sofort auf anhieb läuft...
keine ahnung ist alles nicht getestet...
die idee ist aber nicht schlecht...
wenn ich mich nicht ganz irre gibt es in der include.CMS_LINK.php eine integrierte upload funktion...
so etwas ähnliches(wenn nicht sogar das selbe) könnte man in der include.CMS_IMG.php ergänzen... (ich würd da aber die erweiterte version dieser datei nehmen die du ja auch schon verwendest...)
der code in der include.CMS_LINK.php mit upload beschäftigt wäre in etwa der da (hoffe ich vergesse jetzt nichts)
Code: Alles auswählen
...
global $_FILES;
global $upldir;
global $uplfile;
global $HTTP_POST_FILES;
cInclude("includes","functions.upl.php");
$rootpath = $cfgClient[$client]["path"]["htmlpath"] . $cfgClient[$client]["upload"];
...
if (count($_FILES) == 1)
{
foreach ($_FILES['uplfile']['name'] as $key => $value)
{
if (file_exists($_FILES['uplfile']['tmp_name'][$key]))
{
$friendlyName = uplCreateFriendlyName($_FILES['uplfile']['name'][$key]);
move_uploaded_file($_FILES['uplfile']['tmp_name'][$key], $cfgClient[$client]['upl']['path'].$upldir.$friendlyName);
uplSyncDirectory($upldir);
if ($path == "") { $path = "/"; }
$sql = "SELECT idupl FROM ".$cfg["tab"]["upl"]." WHERE dirname='$upldir' AND filename='$friendlyName'";
$db->query($sql);
$db->next_record();
$CMS_LINK = $rootpath . $upldir. $friendlyName;
}
}
}
...
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">');
ob der teil überhaupt ohne änderungen so zu verwenden ist ??
es wäre auch möglich das es sofort auf anhieb läuft...
keine ahnung ist alles nicht getestet...
*** make your own tools (wishlist :: thx)
hab gerade das gefunden -> http://contenido.org/forum/viewtopic.php?p=53801#53801
*** make your own tools (wishlist :: thx)
^_^
Zuletzt geändert von i-fekt am Fr 22. Okt 2010, 13:10, insgesamt 1-mal geändert.
Gruss,
Michael
"Keep on riding this Bike!" (Jackson Mulham)
Michael
"Keep on riding this Bike!" (Jackson Mulham)
wenn ich nichts anderes zu tun hätte, klar könnte ich...i-fekt hat geschrieben:Meinst du, du kannst das verschmelzen?
*** make your own tools (wishlist :: thx)
hi i-fekt,
hoffe du änderst deine meinung über mich. ich mache nur spass und du solltest das wohlwollender aufnehmen. als zeichen meines guten willens
:
hoffe du änderst deine meinung über mich. ich mache nur spass und du solltest das wohlwollender aufnehmen. als zeichen meines guten willens

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>