OSI-Certified logo

Source code of file editorm.php
from the Content Management module for Phprojekt.

<?php
// WYSIWYG DHTML editor.
// Copyright 1999-2005 by Mario A. Valdez-Ramirez
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.

// This piece of code now integrated with:

// Content Management System module for PHProjekt (CMS4P).
// Copyright 2002-2005 by Mario A. Valdez-Ramirez
// http://www.mariovaldez.net/

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, 
// Boston, MA 02111-1307, USA.

// You can contact Mario A. Valdez-Ramirez by email 
// at mario@mariovaldez.org or paper mail at 
// Olmos 809, San Nicolas, NL. 66495, Mexico.

//session_start();
$path_pre="../";
include_once (
$path_pre "cm/cm_anon.inc.php");
$include_path $path_pre "lib/lib.inc.php";
include_once 
$include_path;
include_once (
$path_pre "cm/cm_lib.inc.php");
fcm_load_secdb ($cm_security);

if (
$cm_enable_visedit) {

$cm_html_header "<html><head>\n<title>{$cm_text["contentmanagement"]}</title>\n
<link rel=stylesheet type=\"text/css\" href=\"
$css_style\">\n$lang_cfg\n</head>\n
<body bgcolor=\"
$bgcolor3\" leftmargin=\"5\" topmargin=\"5\" rightmargin=\"5\" bottommargin=\"5\" onload=\"HideForm();HidePalette();UpdateEdit();\">\n";
echo 
$cm_html_header;

$cm_http_base "http://$cm_server_name/" substr ($cm_php_self1strrpos ($cm_php_self"/"));
$cm_https_base "https://$cm_server_name/" substr ($cm_php_self1strrpos ($cm_php_self"/"));

?>
<script><!--
function ToggleFColor(cm_fcolor) {
  document.getElementById("edittextarea").contentWindow.focus();  
  document.getElementById('edittextarea').contentWindow.document.execCommand("ForeColor", false, cm_fcolor);
  HidePalette();
  document.getElementById("edittextarea").contentWindow.focus();  
}
function HidePalette() {
  document.getElementById("cmpalette").style.display = "none";
}
function ShowPalette() {
  document.getElementById("cmpalette").style.display = "block";
}
function TogglePalette() {
  if (document.getElementById("cmpalette").style.display == "none") {
    document.getElementById("cmpalette").style.display = "block";
  }
  else {
    document.getElementById("cmpalette").style.display = "none";
  }
}
function InsertAtSelection(cm_newnode) {
  cm_cursel = document.getElementById("edittextarea").contentWindow.getSelection();
  cm_currange = cm_cursel.getRangeAt(0);
  cm_cursel.removeAllRanges();
  cm_currange.deleteContents();
  container = cm_currange.startContainer;
  pos = cm_currange.startOffset;
  cm_currange = document.createRange();
  if (container.nodeType==3 && cm_newnode.nodeType==3) {
    container.insertData(pos, cm_newnode.nodeValue);
    cm_currange.setEnd(container, pos+cm_newnode.length);
    cm_currange.setStart(container, pos+cm_newnode.length);
  } 
  else {
    if (container.nodeType==3) {
      textNode = container;
      container = textNode.parentNode;
      text = textNode.nodeValue;
      textBefore = text.substr(0,pos);
      textAfter = text.substr(pos);
      beforeNode = document.createTextNode(textBefore);
      afterNode = document.createTextNode(textAfter);
      container.insertBefore(afterNode, textNode);
      container.insertBefore(cm_newnode, afterNode);
      container.insertBefore(beforeNode, cm_newnode);
      container.removeChild(textNode);
    } else {
      afterNode = container.childNodes[pos];
      container.insertBefore(cm_newnode, afterNode);
    }
    cm_currange.setEnd(afterNode, 0);
    cm_currange.setStart(afterNode, 0);
  }
  cm_cursel.addRange(cm_currange);
};
function HideForm() {
  document.getElementById("cm_content").style.display = "none";
  window.focus();
  try {
    document.getElementById("edittextarea").contentDocument.designMode="on";
  } catch (e) {
    alert(cm_nocompat);
    self.close();
  }
  document.getElementById("edittextarea").contentWindow.focus();
}
function UpdateEdit() {
  window.frames["edittextarea"].document.body.innerHTML = document.getElementById("cm_content").value;
}
function UpdateHTML() {
  document.getElementById("cm_content").value = window.frames["edittextarea"].document.body.innerHTML;
}
function SendHTML() {
  cm_preprocess_content = document.getElementById("cm_content").value;
  cm_replace4 = document.URL;
  cm_replace4 = cm_replace4.substring(0, cm_replace4.indexOf("/", cm_replace4.lastIndexOf("/"))) + "/";
  cm_re1 = new RegExp(cm_replace1, "gi")
  cm_re2 = new RegExp(cm_replace2, "gi")
  cm_re3 = new RegExp("&amp;cm_file=", "gi")
  cm_re4 = new RegExp(cm_replace4, "gi");
  cm_preprocess_content = cm_preprocess_content.replace(cm_re1, "");
  cm_preprocess_content = cm_preprocess_content.replace(cm_re2, "");
  cm_preprocess_content = cm_preprocess_content.replace(cm_re3, "&cm_file=");
  cm_preprocess_content = cm_preprocess_content.replace(cm_re4, "");
  document.getElementById("cm_content").value = cm_preprocess_content;
  window.opener.document.getElementById("cm_content").value = document.getElementById("cm_content").value;  
}
function SetButtonVisualClue(buttonh) {
  buttonh.style.borderStyle = "ridge";
  }
function SetButtonVisualActivate(buttonh) {
  buttonh.style.borderStyle = "inset";
}
function SetButtonVisualDeactivate(buttonh) {  
  buttonh.style.borderStyle = "groove";
}
function ToggleButton(Operation, buttonh) {
  document.getElementById("edittextarea").contentWindow.focus();            
  switch (Operation) {
     case "N": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("Bold", false, null);
          break;
          }
     case "I": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("Italic", false, null);
          break;
          }
     case "S": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("Underline", false, null);
          break;
          }
     case "SuperS": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("SuperScript", false, null);
          break;
          }
     case "SubS": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("SubScript", false, null);
          break;
          }
     case "OL": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("InsertOrderedList", false, null);
          break;
          }
     case "UL": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("InsertUnorderedList", false, null);
          break;
          }
     case "HR": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("InsertHorizontalRule", false, null);
          break;
          }
     case "A": {
          cm_newlink = prompt (cm_linkprompt, "http://");
          if (cm_newlink) {
            cm_elink = false;
            cm_linkcaption = cm_newlink; 
            if ((cm_newlink.substr(0, 7) == "mailto:") || (cm_newlink.substr(0, 6) == "ftp://")) {
            }
            else {
              cm_elink = confirm (cm_elinkprompt);
              if ((cm_newlink.substr(0, 7) == "http://") || (cm_newlink.substr(0, 8) == "https://"))
                cm_lflink = true;
              else
                cm_lflink = false;
              if (cm_lflink) {                        
                cm_newlink = "redir.php?cm_elink=" + cm_newlink;
              }
              else {
                if (cm_direxist == 1) {
                  if (cm_elink)
                    cm_newlink = "getfile.php?cm_path=" + cm_path + "&cm_file=" + cm_newlink;
                  else
                    cm_newlink = "getfile.php?cm_path=" + cm_path + "&cm_file=" + cm_newlink;
                }
                else {
                  cm_newlink = "";
                  alert (cm_nolfprompt);
                }
              }
            }
            if (cm_newlink) {
              cm_htmllink = document.getElementById("edittextarea").contentWindow.document.createElement("a");
              cm_htmllink.setAttribute ("href", cm_newlink);
              if (cm_elink) {
                cm_htmllink.setAttribute ("target", "_blank");
              }
              cm_htmlhref = document.getElementById("edittextarea").contentWindow.document.createTextNode(cm_linkcaption);
              cm_htmllink.appendChild(cm_htmlhref);
              InsertAtSelection (cm_htmllink);
            }
          }
          break;
          }
     case "TABLE": {
          cm_tblrows = Math.abs (prompt (cm_rowsprompt, 2));
          if (cm_tblrows) {
            cm_tblcols = Math.abs (prompt (cm_colsprompt, 2));
            if (cm_tblcols) {
              cm_htmltable = document.getElementById("edittextarea").contentWindow.document.createElement("table");
              cm_htmltable.setAttribute ("border", "1");                
              cm_htmltable.setAttribute ("cellpadding", "4");                
              cm_htmltable.setAttribute ("cellspacing", "0");                
              cm_htmltbody = document.getElementById("edittextarea").contentWindow.document.createElement("tbody");
              for (var cmtr = 0; cmtr < cm_tblrows; cmtr++) {
                cm_htmltr = document.getElementById("edittextarea").contentWindow.document.createElement("tr");
                for (var cmtc = 0; cmtc < cm_tblcols; cmtc++) {
                  cm_htmltd = document.getElementById("edittextarea").contentWindow.document.createElement("td");
                  cm_htmltc = document.getElementById("edittextarea").contentWindow.document.createTextNode("x");
                  cm_htmltd.appendChild(cm_htmltc);                  
                  cm_htmltr.appendChild(cm_htmltd);
                }
                cm_htmltbody.appendChild(cm_htmltr);
              }
              cm_htmltable.appendChild(cm_htmltbody);
              InsertAtSelection (cm_htmltable);
            }
          }
          break;
          }
     case "IMG": {
          if (cm_direxist == 1) {
            cm_newimg = prompt (cm_imgprompt, "x.jpg");
            if (cm_newimg) {
              cm_newimghtml = "getfile.php?cm_path=" + cm_path + "&cm_file=" + cm_newimg;
              document.getElementById('edittextarea').contentWindow.document.execCommand("InsertImage", false, cm_newimghtml);
            }
          }
          else {
            alert (cm_nolfprompt);
          }
          break;
          }
     case "San": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("Indent", false, null);
          break;
          }
     case "DeSan": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("Outdent", false, null);
          break;
          }
     case "Izq": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("JustifyLeft", false, null);
          break;
          }
     case "Cen": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("JustifyCenter", false, null);
          break;
          }
     case "Der": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("JustifyRight", false, null);
          break;
          }
     case "Copy": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("Copy", false, null);
          break;
          }
     case "Cut": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("Cut", false, null);
          break;
          }
     case "Paste": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("Paste", false, null);
          break;
          }
     case "QuitarF": {
          document.getElementById('edittextarea').contentWindow.document.execCommand("RemoveFormat", false, null);
          break;
          }
     case "QuitarTF": {
          cm_contentrange = window.frames["edittextarea"].document.body.ownerDocument.createRange();
          cm_contentrange.selectNodeContents(window.frames["edittextarea"].document.body);
          window.frames["edittextarea"].document.body.innerHTML = cm_contentrange.toString();
          break;
          }
     case "Nuevo": {
          document.getElementById("cm_content").value = "";
          window.frames["edittextarea"].document.body.innerHTML = "";
          break;
          }
     case "ActHTML": {
          UpdateHTML ();
          SendHTML ();
          self.close();
          break;
          }
     case "CancelHTML": {
          self.close();
          break;
          }
     case "Tama": {
          theSize = document.getElementById('fontsize').value;
          if (theSize != "")    
            document.getElementById("edittextarea").contentWindow.document.execCommand("FontSize", false, theSize);
          document.getElementById("fontsize").selectedIndex = 0;
          break;
          }
     case "Tipo": {
          theName = document.getElementById("fontname").value;
          if (theName != "")
             document.getElementById("edittextarea").contentWindow.document.execCommand("FontName", false, theName);
          document.getElementById("fontname").selectedIndex = 0;
          break;
          }
     case "FBlock": {
          theBlock = document.getElementById("blocktype").value;
          if (theBlock != "") {
             document.getElementById("edittextarea").contentWindow.document.execCommand("FormatBlock", false, "<" + theBlock + ">");
          }
          document.getElementById("blocktype").selectedIndex = 0;
          break;
          }
  }
  if (buttonh) {
    buttonh.style.borderStyle = "groove";
  }
  document.getElementById("edittextarea").contentWindow.focus();
}
<?php
echo "var cm_replace1 = \"$cm_https_base\";\n";
echo 
"var cm_replace2 = \"$cm_http_base\";\n";
echo 
"var cm_path = \"$cm_path\";\n"
echo 
"var cm_linkprompt = \"{$cm_text["edit_enterurl"]}\";\n";
echo 
"var cm_elinkprompt = \"{$cm_text["edit_eurl"]}\";\n";
echo 
"var cm_imgprompt = \"{$cm_text["edit_enterimg"]}\";\n";
echo 
"var cm_rowsprompt = \"{$cm_text["edit_rows"]}\";\n";
echo 
"var cm_colsprompt = \"{$cm_text["edit_cols"]}\";\n";
echo 
"var cm_nolfprompt = \"{$cm_text["edit_nolocalfiles"]}\";\n";
echo 
"var cm_nocompat = \"{$cm_text["edit_notcompat"]}\";\n";
echo 
"var cm_direxist = \"$cm_direxist\";\n";
?>
-->
</script>



<?php
echo "
<div class=\"tbedicion01\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_delformatsel"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_delformatsel"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('QuitarF',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_delallformat"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_delallformat"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('QuitarTF',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_deleteall"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_deleteall"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('Nuevo',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
&nbsp;&nbsp;"
;
// Disabled as Mozilla don't allow clipboard operations due to security restrictions...
//echo "
//<img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_copy"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_copy"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('Copy',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
//<img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_cut"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_cut"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('Cut',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
//<img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_paste"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_paste"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('Paste',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
//&nbsp;&nbsp;";
echo "
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_bold"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_bold"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('N',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\" id=\"N\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_italics"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_italics"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('I',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\" id=\"I\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_underline"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_underline"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('S',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\" id=\"S\">
&nbsp;&nbsp;"
;
echo 
"
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_superscript"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_superscript"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('SuperS',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\" id=\"SuperS\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_underscript"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_underscript"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('SubS',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\" id=\"SubS\">
&nbsp;&nbsp;"
;
echo 
"
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_leftjustify"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_leftjustify"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('Izq',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\" id=\"Izq\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_center"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_center"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('Cen',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\" id=\"Cen\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_rightjustify"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_rightjustify"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('Der',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\" id=\"Der\">
&nbsp;&nbsp;"
;
echo 
"
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_deindent"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_deindent"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('DeSan',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_indent"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_indent"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('San',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
&nbsp;&nbsp;"
;
echo 
"
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_listorder"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_listorder"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('OL',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_listunorder"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_listunorder"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('UL',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
<br>
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_link"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_link"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('A',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_image"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_image"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('IMG',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_bar"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_bar"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('HR',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
<img src=\"
$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_table"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_table"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('TABLE',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">
&nbsp;&nbsp;"
;
echo 
"
  <select name=\"blocktype\" id=\"blocktype\" onchange=\"ToggleButton('FBlock');\" class=\"btngr\">
    <option SELECTED value=\"\">
{$cm_text["edit_selblock"]}</option>
    <option value=\"p\">
{$cm_text["edit_blockp"]}</option>
    <option value=\"h1\">
{$cm_text["edit_blockh1"]}</option>
    <option value=\"h2\">
{$cm_text["edit_blockh2"]}</option>
    <option value=\"h3\">
{$cm_text["edit_blockh3"]}</option>
    <option value=\"h4\">
{$cm_text["edit_blockh4"]}</option>
    <option value=\"h5\">
{$cm_text["edit_blockh5"]}</option>
    <option value=\"h6\">
{$cm_text["edit_blockh6"]}</option>
    <option value=\"pre\">
{$cm_text["edit_blockpre"]}</option>
  </select>\n"
;
if (
$cm_enable_platfonts) {
 echo 
"
  <select name=\"fontname\" id=\"fontname\" onchange=\"ToggleButton('Tipo',this);\" class=\"btngr\">
    <option SELECTED value=\"\">
{$cm_text["edit_selfont"]}</option>
    <option value=\"Andale Mono, Courier New, Courier, monospace\">Andale Mono</option>
    <option value=\"Arial, Helvetica, sans-serif\">Arial</option>
    <option value=\"Book Antiqua, Times New Roman, Times, serif\">Book Antiqua</option>
    <option value=\"Bookman Old Style, Times New Roman, Times, serif\">Bookman Old Style</option>
    <option value=\"Comic Sans MS, Arial, Helvetica, sans-serif\">Comic Sans MS</option>
    <option value=\"Courier New, Courier, monospace\">Courier</option>
    <option value=\"Times New Roman, Times, serif\">Times</option>
    <option value=\"Trebuchet MS, Arial, Helvetica, sans-serif\">Trebuchet MS</option>
    <option value=\"Verdana, Arial, Helvetica, sans-serif\">Verdana</option>
  </select>\n"
;
}
else {
 echo 
"
  <select name=\"fontname\" id=\"fontname\" onchange=\"ToggleButton('Tipo',this);\" class=\"btngr\">
    <option SELECTED value=\"\">
{$cm_text["edit_selfont"]}</option>
    <option value=\"Arial, Helvetica, sans-serif\">Arial</option>
    <option value=\"Courier New, Courier, monospace\">Courier</option>
    <option value=\"Times New Roman, Times, serif\">Times</option>
  </select>\n"
;
}
echo 
"
  <select name=\"fontsize\" id=\"fontsize\" onchange=\"ToggleButton('Tama',this);\" class=\"btngr\">
    <option SELECTED value=\"\">
{$cm_text["edit_selfontsize"]}</option>
    <option value=\"1\">1</option>
    <option value=\"2\">2</option>
    <option value=\"3\">3</option>
    <option value=\"4\">4</option>
    <option value=\"5\">5</option>
    <option value=\"6\">6</option>
    <option value=\"7\">7</option>
  </select>\n"
;
echo 
"<img src=\"$cm_imgpath/{$cm_image_filename[$cm_icon_set]["edit_colorpicker"]}\" width=\"16\" height=\"16\" title=\"{$cm_text["edit_colorpick"]}\" class=\"btngr\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"TogglePalette();\" onmouseout=\"SetButtonVisualDeactivate(this);\">";
echo 
"<table id=\"cmpalette\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n";
for (
$cpcr 0$cpcr 256$cpcr $cpcr 51) {
  echo 
"<tr>";
  for (
$cpcg 0$cpcg 256$cpcg $cpcg 51) {
    for (
$cpcb 0$cpcb 256$cpcb $cpcb 51) {
      echo 
"<td width=\"8\" height=\"8\" bgcolor=\"#" sprintf("%02X%02X%02X",$cpcr,$cpcg,$cpcb) . "\" title=\"" sprintf("%02X%02X%02X",$cpcr,$cpcg,$cpcb) . "\" onclick=\"ToggleFColor('" sprintf("%02X%02X%02X",$cpcr,$cpcg,$cpcb) . "');\"></td>";
    }
  echo 
"\n";
  }
  echo 
"</tr>\n";
}
echo 
"</table>";  
echo 
"</div>";

echo 
"<iframe id=\"edittextarea\" name=\"edittextarea\" src=\"dummy.htm\"></iframe>";

echo 
"
<div><br>
<span title=\"
{$cm_text["edit_update_alt"]}\" class=\"btntxt\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('ActHTML',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">{$cm_text["edit_update"]}</span>
<span title=\"
{$cm_text["edit_cancel_alt"]}\" class=\"btntxt\" onmouseover=\"SetButtonVisualClue(this);\" onmousedown=\"SetButtonVisualActivate(this);\" onmouseup=\"ToggleButton('CancelHTML',this);\" onmouseout=\"SetButtonVisualDeactivate(this);\">{$cm_text["edit_cancel"]}</span>
<br>
</div>"
;


//if (get_magic_quotes_gpc ()) {
  
$cm_content stripslashes ($cm_content);
//}

echo "<div><textarea cols=\"10\" rows=\"10\" id=\"cm_content\" name=\"cm_content\">$cm_content</textarea></div>\n";

// if cm_enable_visedit...
else {
echo 
$cm_html_header;
}
echo 
$cm_html_footer;
?>
 
 
NA fum/lmd: 2004.09.16
Copyright ©1994-2018 by Mario A. Valdez-Ramírez.
no siga este enlace / do not follow this link