CMS_HTMLTEXT und Zeilenumbruch

Gesperrt
notaus
Beiträge: 98
Registriert: Di 13. Dez 2005, 14:18
Kontaktdaten:

CMS_HTMLTEXT und Zeilenumbruch

Beitrag von notaus »

Contenido 4.6.23

Hallo zusammen,

ich nutze das CMS_HTMLTEXT Element, um in der insite-Edit-Ansicht einfache Textbausteine eingeben zu können, ohne erst die Textarea-Seite aufrufen zu müssen.

Mir ist aufgefallen, dass Zeilenumbrüche in der Textarea zwar als <br> nachher interpretiert werden, wenn ich dann aber erneut auf "Save" in der insite-Artikelansicht klicke, wird dieser Tag wieder entfernt (leider). Kann ich das Strip-Tags für die insite-HTMLTEXT irgendwo deaktiveren?


Danke!
emergence
Beiträge: 10653
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence »

den con_type kannst du nur direkt in der db modifizieren
siehe -> con_type -> CMS_HTMLTEXT

vielleicht findest du dort was du suchst...
*** make your own tools (wishlist :: thx)
notaus
Beiträge: 98
Registriert: Di 13. Dez 2005, 14:18
Kontaktdaten:

Beitrag von notaus »

oje,

so wie's ausschaut ändert das CMS_HTML den div-content anders als das CMS_HTMLTEXT. das mit dem

Code: Alles auswählen

$insiteEditingDIV->setContent("_REPLACEMENT_"); 
schaut mir bei CMS_HTML wie ein Workaround aus. steig da aber nicht wirklich durch weshalb, warum.
vielleicht hat einer mehr Ahnung?

Gruß
emergence
Beiträge: 10653
Registriert: Mo 28. Jul 2003, 12:49
Wohnort: Austria
Kontaktdaten:

Beitrag von emergence »

ist kein workaround, das war ein bugfix...
-> http://www.contenido.org/forum/viewtopic.php?t=12829
*** make your own tools (wishlist :: thx)
notaus
Beiträge: 98
Registriert: Di 13. Dez 2005, 14:18
Kontaktdaten:

Beitrag von notaus »

ok,
habs gefixt.
Zeilenumbrüche gehen jetzt auch bei CMS_HTMLTEXT:

CMS_HTMLTEXT (con_type):

Code: Alles auswählen

/**
 * CMS_HTMLTEXT
 */
function br2nl( $data ) {
   return preg_replace( '!<BR.*>!iU', "\n", $data );
}

cInclude("classes", "class.htmlelements.php");
cInclude("includes", "functions.lang.php");

$content = $a_content['CMS_HTMLTEXT'][$val];
$content = urldecode($content);
$content = htmldecode($content);
$content = br2nl($content);
$content = strip_tags($content);


$content = str_replace("&nbsp;", " ", $content);

$content = htmlspecialchars($content);
if ($content == "")
{
  $content = "&nbsp;";
}

$content = nl2br($content);

if ($edit) {

$div = new cHTMLDiv;
$div->setID(implode("_", array("HTMLTEXT", $db->f("idtype"), $val)));
$div->setEvent("focus", "this.style.border='1px solid #bb5577'");
$div->setEvent("blur", "this.style.border='1px dashed #bfbfbf'");
$div->setStyleDefinition("border", "1px dashed #bfbfbf");
$div->updateAttributes(array("contentEditable" => "true"));
$div->setStyleDefinition("direction", langGetTextDirection($lang));

$editlink = new cHTMLLink;
$editlink->setLink($sess->url("front_content.php?action=10&idcat=$idcat&idart=$idart&idartlang=$idartlang&type=CMS_HTMLTEXT&typenr=$val&lang=$lang"));

$editimg = new cHTMLImage;
$editimg->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_edittext.gif");

$savelink = new cHTMLLink;
$savelink->setLink("javascript:setcontent('$idartlang','0')");

$saveimg = new cHTMLImage;
$saveimg->setSrc($cfg["path"]["contenido_fullhtml"].$cfg["path"]["images"]."but_speichern.gif");

$savelink->setContent($saveimg);

$editlink->setContent($editimg);

$div->setContent($content);

  $tmp = implode("", array($div->render(), $editlink->render(), " ", $savelink->render()));
  $tmp = str_replace('"', '\"', $tmp);
} else {
  $tmp = $content;
  $tmp = str_replace('"', '\"', $tmp);
}


$tmp = addslashes($tmp);
$tmp = str_replace('$', '\\\$', $tmp);
include.CMS_HTMLTEXT:

Code: Alles auswählen

<?php

/******************************************
* File      :   include.CMS_HTMLTEXT.php
* Project   :   Contenido 
* Descr     :   Include file for editiing
*               content of type CMS_HTMLTEXT
*
* Author    :   Jan Lengowski
* Created   :   07.05.2003
* Modified  :   07.05.2003
*
* © four for business AG
******************************************/

if ($doedit == "1") {
	conSaveContentEntry ($idartlang, "CMS_HTMLTEXT", $typenr,$CMS_HTMLTEXT);
	conMakeArticleIndex ($idartlang, $idart);
	conGenerateCodeForArtInAllCategories($idart);
	header("Location:".$sess->url($cfgClient[$client]["path"]["htmlpath"]."front_content.php?area=$tmp_area&idart=$idart&idcat=$idcat&lang=$lang&changeview=edit")."");
}
header("Content-Type: text/html; charset={$encoding[$lang]}");
?>
<html>
<head>
<title></title>
    <link rel="stylesheet" type="text/css" href="<?php print $cfg["path"]["contenido_fullhtml"] . $cfg["path"]["styles"] ?>contenido.css">
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $encoding[$lang] ?>">
</head>
<body>
<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

function br2nl( $data ) {
   return preg_replace( '!<BR.*>!iU', "\n", $data );
}
       getAvailableContentTypes($idartlang);
        
        echo "  <FORM name=\"editcontent\" method=\"post\" action=\"".$cfg["path"]["contenido_fullhtml"].$cfg["path"]["includes"]."include.backendedit.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=action value=\"10\">";
        echo "  <INPUT type=hidden name=type value=\"$type\">";
        echo "<INPUT type=hidden name=doedit value=1>";        
        echo "  <INPUT type=hidden name=idcat value=\"$idcat\">";
        echo "  <INPUT type=hidden name=idartlang value=\"$idartlang\">";
        echo "<INPUT type=hidden name=changeview value=\"edit\">";
        echo "  <TABLE cellpadding=$cellpadding cellspacing=$cellpadding border=0>";

        echo "  <TR><TD valign=top class=text_medium>&nbsp;".$typenr.".&nbsp;".$a_description[$type][$typenr].":&nbsp;</TD><TD class=content>";
        echo "  <TEXTAREA name=CMS_HTMLTEXT ROWS=15 COLS=90>".strip_tags(br2nl(urldecode($a_content[$type][$typenr])))."</TEXTAREA>";
        //echo "  <TEXTAREA name=CMS_HTMLTEXT ROWS=15 COLS=90>".urldecode($a_content[$type][$typenr])."</TEXTAREA>";
        echo "  </TD></TR>";
        $tmp_area = "con_editcontent";
        echo "  <TR valign=top><TD colspan=2><br>
                      <a href=".$sess->url($cfgClient[$client]["path"]["htmlpath"]."front_content.php?area=$tmp_area&idart=$idart&idcat=$idcat&lang=$lang")."><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>
Gesperrt