CMS_LINK für Contenido 4.3.2.1b
Verfasst: Mo 22. Sep 2003, 17:31
habe gerade eine kleine umbauarbeit für CMS_LINK vorgenommen...
vielleicht brauchts ja einer
es werden folgende typen von urls so angezeigt wie sie eingetragen wurden.
momentan definiert: "http://","mailto:","ftp://","../","./", "/", "#"
alle anderen werte erhalten wie bisher ein "http://" vorrangestellt
zusätzlich werden die werte $client und $lang ausgegeben.
ebenso eine änderung um den workaround von
http://www.contenido.de/forum/viewtopic.php?t=1853
zu umgehen wurde folgende zeile ergänzt:
wer das nicht möchte verwendet einfach:
für tabelle con_type | zeile: CMS_LINK | feld: code
zusätzlich gibts ein paar änderung in
/contenido/includes/include.CMS_LINK.php
die folgendes umfassen :
die internen links werden in korrekter schreibweise angezeigt und verarbeitet,
der pdf link wird korrekt gesetzt und verarbeitet
vielleicht brauchts ja einer

es werden folgende typen von urls so angezeigt wie sie eingetragen wurden.
momentan definiert: "http://","mailto:","ftp://","../","./", "/", "#"
alle anderen werte erhalten wie bisher ein "http://" vorrangestellt
zusätzlich werden die werte $client und $lang ausgegeben.
ebenso eine änderung um den workaround von
http://www.contenido.de/forum/viewtopic.php?t=1853
zu umgehen wurde folgende zeile ergänzt:
Code: Alles auswählen
if ( isset($changeview) ) $tmp = $sess->url("$tmp");
Code: Alles auswählen
$tmp = $sess->url("$tmp");
Code: Alles auswählen
/**
* CMS_LINK
*/
$tmp = urldecode($a_content["CMS_LINK"][$val]);
/* internal link */
if ( is_numeric($tmp) ) {
$tmp = "front_content.php?idcatart=". $tmp."&client=".$client."&lang=".$lang;
if ( isset($changeview) ) $tmp = $sess->url("$tmp");
} elseif (!((substr($tmp,0,7) == "http://") |
(substr($tmp,0,7) == "mailto:") |
(substr($tmp,0,6) == "ftp://") |
(substr($tmp,0,3) == "../") |
(substr($tmp,0,2) == "./") |
(substr($tmp,0,1) == "/") |
(substr($tmp,0,1) == "#"))) {
$tmp = "http://$tmp";
}
/contenido/includes/include.CMS_LINK.php
die folgendes umfassen :
die internen links werden in korrekter schreibweise angezeigt und verarbeitet,
der pdf link wird korrekt gesetzt und verarbeitet
Code: Alles auswählen
<?php
/******************************************
* File : include.CMS_LINK.php
* Project : Contenido 4.3
* Descr : Include file for editing
* content of type CMS_LINK
*
* Author : Jan Lengowski
* Created : 07.05.2003
* Modified : 22.09.2003
*
* © four for business AG
******************************************/
if ($doedit == "1") {
if($selectpdf){
$CMS_LINK = $cfgClient[$client]["path"]["html"] . $selectpdf;
}
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("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" bgcolor=<?php echo "$bg"; ?> >
<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
$sql = "SELECT
*
FROM
".$cfg["tab"]["content"]." AS a,
".$cfg["tab"]["art_lang"]." AS b,
".$cfg["tab"]["type"]." AS c
WHERE
a.idtype = c.idtype AND
a.idartlang = b.idartlang AND
b.idartlang = '".$idartlang."'";
$db->query($sql);
while ($db->next_record()) {
$a_content[$db->f("type")][$db->f("typeid")] = $db->f("value");
$a_description[$db->f("type")][$db->f("typeid")] = i18n($db->f("description"));
}
echo " <FORM name=\"editcontent\" method=\"post\" action=\"front_content.php\">";
$sess->hidden_session();
echo " <INPUT type=hidden name=lang value=\"$lang\">";
// echo " <INPUT type=hidden name=submit value=\"editcontent\">";
echo " <INPUT type=hidden name=typenr value=\"$typenr\">";
echo " <INPUT type=hidden name=idart value=\"$idart\">";
echo " <INPUT type=hidden name=idcat value=\"$idcat\">";
echo " <INPUT type=hidden name=idartlang value=\"$idartlang\">";
echo " <INPUT type=hidden name=action value=\"10\">";
echo "<INPUT type=hidden name=doedit value=1>";
echo " <INPUT type=hidden name=type value=\"$type\">";
echo "<INPUT type=hidden name=changeview value=\"edit\">";
echo " <TABLE cellpadding=2 cellspacing=0 border=0>";
echo " <TR><TD valign=\"top\" class=text_medium nowrap> ".$typenr.". ".$a_description["CMS_LINK"][$typenr].": </TD><TD class=content>";
echo "<INPUT type=hidden name=CMS_LINK VALUE=\"".urldecode($a_content["CMS_LINK"][$typenr])."\">";
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];
}
echo "<INPUT type=text name=CMS_LINKextern VALUE=\"".urldecode($a_link_extern_value)."\" SIZE=45 onchange=\"editcontent.CMS_LINK.value=this.value; editcontent.CMS_LINKintern.value=0;\"> <span class=text_medium>[Externer Link]</span> <b><span class=text_medium>oder</span></b><br>";
$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);
echo "<SELECT name=CMS_LINKintern SIZE=1 onChange=\"editcontent.CMS_LINK.value=this.value; editcontent.CMS_LINKextern.value='';\">";
if ($a_link_intern_value != 0) {
echo "<option value=0>-- ".i18n("None")." --</option>";
} else {
echo "<option value=0 selected>-- ".i18n("None")." --</option>";
}
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 .= "> ";
if ( $db->f("idcatart") != $a_link_intern_value ) {
echo "<option value=\"".$db->f("idcatart")."\">$spaces ".$db->f("name")."---".$tmp_title."</option>";
} else {
echo "<option value=\"".$db->f("idcatart")."\" selected>$spaces ".$db->f("name")."---".$tmp_title."</option>";
}
}
echo "</SELECT> <span class=text_medium>[Interner Link]</a> <b><span class=text_medium>oder</span></b><br>";
echo "<SELECT name=\"selectpdf\" SIZE=1>";
echo "<option value=\"\" selected>bitte auswählen</option>";
$sql = "SELECT * FROM ".$cfg["tab"]["upl"]." WHERE idclient='".$client."' AND filetype = 'pdf' ORDER BY filename";
$db->query($sql);
while ($db->next_record()) {
echo "<option value=\"./".$cfgClient[$client]["upload"].$db->f("dirname").$db->f("filename")."\">".$db->f("dirname").$db->f("filename")." [".$db->f("description")."]</option>";
}
echo "</SELECT> <span class=text_medium>[Link zu einem PDF]</span>";
echo " </TD></TR>";
echo " <TR><TD valign=top class=text_medium nowrap> ".$a_description["CMS_LINKDESCR"][$typenr].": </TD><TD class=content>";
echo " <TEXTAREA name=CMS_LINKDESCR ROWS=3 COLS=60>".$a_content["CMS_LINKDESCR"][$typenr]."</TEXTAREA>";
echo " </TD></TR>";
echo " <TR><TD valign=top class=text_medium nowrap> ".$a_description["CMS_LINKTARGET"][$typenr].": </TD><TD class=content>";
echo " <INPUT type=text name=CMS_LINKTARGET VALUE=\"".$a_content["CMS_LINKTARGET"][$typenr]."\" SIZE=60 onChange=\"setlinktargettosomething();\">";
echo " <INPUT TYPE=checkbox name=checkboxlinktarget value=\"1\" onClick=\"setlinktargettoblank();\"";if ($a_content["CMS_LINKTARGET"][$typenr]=="_blank") echo " checked"; echo "><span class=text_medium>Link in neuem Fenster öffnen.</span></INPUT>
<!---------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 = \"\";
document.editcontent.checkboxlinktarget.value = 0;
} else {
document.editcontent.CMS_LINKTARGET.value = \"_blank\";
document.editcontent.checkboxlinktarget.value = 1;
}
}
//-->
</SCRIPT>
";
echo " </TD></TR>";
$tmp_area = "con_editcontent";
echo " <TR valign=top><TD colspan=2><br>
<a href=".$sess->url("front_content.php?area=$tmp_area&idart=$idart&idcat=$idcat")."><img src=\"".$cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_cancel.gif\" border=0></a>
<INPUT type=image name=submit value=editcontent src=\"".$cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_ok.gif\" border=0>
</TD></TR>";
echo " </TABLE>
</FORM>";
?>
</td></tr></table>
</body>
</HTML>