<?php
/* +----------------------------------------------------------------------+
| Netautor Professional Application Server |
+----------------------------------------------------------------------+
| Copyright (C) 1998-2005 digiconcept GmbH. <www.digiconcept.net> |
+----------------------------------------------------------------------+
| This file is subject to license, that is bundled with this package |
| in the file LICENSE.TXT, and is available at through the |
| world-wide-web at http://www.netautor.com/license/ |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| hide@address.com so we can mail you a copy. |
+----------------------------------------------------------------------+
| Authors: Stefan Rottensteiner <hide@address.com> |
| Marek Kadziela <hide@address.com> |
| Gregor Wollner |
| Christian Unger |
| Helli Kleinhans |
+----------------------------------------------------------------------+
+ @version $Revision: 1.16 $ +
+----------------------------------------------------------------------+*/
/**
* Call the bundled htmlAREA Wisiwig-Editor
*/
if (file_exists('../../include/init.inc')) include('../../include/init.inc');
$form = (empty($form) ?0 :"'{$form}'" );
$element= (empty($element) ?0 :"'{$element}'" );
if (empty($font_size)) $font_size=12;
if (empty($font_name)) $font_name='arial';
$ed_conf['logo' ]='<img src="../../grafik/na_logo.gif" border="0" title="Netautor Professional" alt="NEtautor Professional" >';
$ed_conf['style' ]='../../include/netautor.css';
$ed_conf['wysiwg_style' ]='../../include/netautor.css';
$ed_conf['toolbar' ]=' [
[ "fontname" ],
[ "fontsize" ],
[ "separator","bold", "italic", "underline", "separator" ],
[ "justifyleft", "justifycenter", "justifyright", "separator" ],
[ "strikethrough", "subscript", "superscript"],
[ "forecolor", "backcolor", "separator" ],
[ "linebreak" ],
[ "orderedlist", "unorderedlist", "outdent", "indent", "separator" ],
[ "horizontalrule", "createlink", "insertimage", "inserttable", "htmlmode"]
]';
$ed_conf['img_dir' ]='../../grafik/editor/';
$ed_conf['popup_dir2' ]='../../include/javascript/htmlarea2/popups/';
$ed_conf['popup_dir3' ]='../../include/javascript/htmlarea3/popups/';
$ed_conf['help_url' ]='help_popup.php' ;
$ed_conf['insert_link_url' ]='';
$ed_conf['insert_table_url' ]='insert_table.html';
$ed_conf['insert_image_url' ]='insert_image.html';
$ed_conf['insert_color_url' ]='select_color.html';
$ed_conf['filterTag' ]= '';
$ed_conf['editorsave' ]= 'Save';
$ed_conf['editorbreak' ]= 'Close window';
if(!empty($editor_config))
{
include($editor_config);
}
?><html>
<head>
<TITLE>digiconcept/netautor/Editor htmlArea</TITLE>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name ="robots" content="noindex">
</head>
<style type="text/css">
@import url( <?php echo($ed_conf['style']);?> );
</style>
<script type="text/javascript">
var editor = null;
var config = null;
function prepareHtmlText()
{
if (window.parent.opener)
{
text = window.parent.opener.document.forms[<?php echo($form);?>].elements[<?php echo($element);?>].value;
}
else
{
text='';
}
document.forms[0].ta.value = text;
}
function external_save(text)
{
window.parent.opener.document.forms[<?php echo($form);?>].elements[<?php echo($element);?>].value = text;
window.close();
return;
}
<?php if (!empty($ed_conf['filterTag'])) :?>
function na_filterTag(tagBody,tagName,tagAttr)
{
tagName = tagName.toUpperCase();
var closingTag = (tagBody.match(/^<\//)) ? true : false;
// fix placeholder URLS - remove absolute paths that IE adds
if (tagName == "img") { tagBody = tagBody.replace(/(src\s*=\s*.)[^*]*(\*\*\*)/, "$1$2"); }
if (tagName == "a") { tagBody = tagBody.replace(/(href\s*=\s*.)[^*]*(\*\*\*)/, "$1$2"); }
if (!tagAttr || tagAttr == null ) tagAttr = '';
tagAttr = tagAttr.replace(/\s*/,"");
<?php echo ($ed_conf['filterTag']);?>
return tagBody;
}
function na_filterOutput(contents) {
// ignore blank contents
if (contents.toLowerCase() == '<p> </p>') { contents = ""; }
// match tags and call filterTag
RegExp.lastIndex = 0;
var matchTag = /<\/?([\w\?]+)((?:[^'">]*|'[^']*'|"[^"]*")*)>/g; // this will match tags, but still doesn't handle container tags (textarea, comments, etc)
// "
contents = contents.replace(matchTag, na_filterTag);
return contents;
}
<?php endif; ?>
</script>
<?php
if(strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'gecko'))
{?>
<script type="text/javascript" src="../../include/javascript/htmlarea3/htmlarea.js"></script>
<script type="text/javascript" src="../../include/javascript/htmlarea3/htmlarea-lang-en.js"></script>
<script type="text/javascript" src="../../include/javascript/htmlarea3/dialog.js"></script>
<script type="text/javascript">
function inserteurosign(){
}
function _CloseOnEsc(ev) {
if (document.all) {
// IE
ev = window.event;
}
if (ev.keyCode == 27) {
// update_parent();
var c = editor.getHTML();
<?php if (!empty($ed_conf['filterTag'])) :?>
c = na_filterOutput(c);
<?php endif; ?>
window.parent.opener.document.forms[<?php echo($form);?>].elements[<?php echo($element);?>].value = c.replace(/^\s*/,'');
//window.close();
//return;
}
}
function save()
{
var c = editor.getHTML();
<?php if (!empty($ed_conf['filterTag'])) :?>
c = na_filterOutput(c);
<?php endif; ?>
window.parent.opener.document.forms[<?php echo($form);?>].elements[<?php echo($element);?>].value = c.replace(/^\s*/,'');
window.close();
return;
}
function resize_editor()
{ // resize editor to fix window
var newHeight;
if (document.all)
{
// IE
newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight-45;
if (newHeight < 0) { newHeight = 0; }
}
else
{
// Gecko
newHeight = window.innerHeight - editor._toolbar.offsetHeight-40;
}
editor._textArea2.style.height = editor._iframe.style.height = newHeight + "px";
}
function initEditor()
{
prepareHtmlText();
var config = new HTMLArea.Config();
config.width = "100%";
config.height = "auto";
config.toolbar = <?php echo($ed_conf['toolbar']);?>;
config.stylesheet = "<?php echo($ed_conf['wysiwg_style']);?>";
config.popupURL = "<?php echo($ed_conf['popup_dir3']);?>";
config.imgURL = "<?php echo($ed_conf['img_dir']);?>";
config.insert_image_url = "<?php echo($ed_conf['insert_image_url']);?>";
config.insert_table_url = "<?php echo($ed_conf['insert_table_url']);?>";
config.insert_link_url = "<?php echo($ed_conf['insert_link_url']);?>";
config.insert_color_url = "<?php echo($ed_conf['insert_color_url']);?>";
<?php
if ( !empty($ed_conf['btnList']))
{
foreach ($ed_conf['btnList'] as $index => $data )
{
$btn_ID = $data[0];
$btn_CMD = $data[0];
$btn_ToolTip = $data[1];
$btn_Icon = $data[3];
$btn_EnableTextMode = $data[4];
?>
config.btnList["<?php echo $btn_ID?>"] = [ "<?php echo $btn_CMD?>", "<?php echo $btn_ToolTip?>", "<?php echo $btn_Icon?>", <?php echo $btn_EnableTextMode ? 'true':'false' ?> ] ;
<?php
}
}
?>
// generate editor and resize it
editor = new HTMLArea("ta",config);
editor.generate();
resize_editor();
editor._iframe.style.width = "100%";
editor._textArea2.style.width = "100%";
<?php
if ( !empty($ed_conf['fncList']))
{
foreach ($ed_conf['fncList'] as $fncName => $fncCode )
{
?>
editor._iframe.<?php echo $fncName;?> = function(cmdID, UI, param, obj)
{
var htmlAreaVersion = '3';
<?php echo $fncCode;?>
}
<?php
}
?>
<?php
}
?>
// set child window contents and event handlers, after a small delay
setTimeout(
function()
{
// setup event handlers
//document.body.onkeypress = _CloseOnEsc;
//editor._doc.body.onkeypress = _CloseOnEsc;
//editor._textArea2.onkeypress = _CloseOnEsc;
window.onresize = resize_editor;
}, 333); // give it some time to meet the new frame
}
function insertHTML()
{
var html = prompt("Enter some HTML code here");
if (html) {
editor.insertHTML(html);
}
}
function highlight()
{
editor.surroundHTML('<span style="background:yellow">', '</span>');
}
</script>
<?php }
else
{?>
<script type="text/javascript" src="../../include/javascript/htmlarea2/editor.js"></script>
<script type="text/javascript">
<?php
echo("
var _editor_url = '';
var _popup_url = '{$ed_conf['popup_dir2' ]}';
var _help_url = '{$ed_conf['help_url' ]}';
var _insert_link_url = '{$ed_conf['insert_link_url' ]}';
var _insert_table_url = '{$ed_conf['insert_table_url' ]}';
var _insert_image_url = '{$ed_conf['insert_image_url' ]}';
var _select_color_url = '{$ed_conf['insert_color_url' ]}';
");
?>
var editor = null;
var config = null;
function save()
{
var c = editor_getHTML("ta");
<?php if (!empty($ed_conf['filterTag'])) :?>
c = na_filterOutput(c);
<?php endif; ?>
window.parent.opener.document.forms[<?php echo($form);?>].elements[<?php echo($element);?>].value = c;
window.close();
return;
}
function _CloseOnEsc()
{
if (event.keyCode == 27)
{
var c = editor_getHTML("ta");
<?php if (!empty($ed_conf['filterTag'])) :?>
c = na_filterOutput(c);
<?php endif; ?>
window.parent.opener.document.forms[<?php echo($form);?>].elements[<?php echo($element);?>].value = c;
window.close();
return;
}
}
function resize_editor()
{ // resize editor to fix window (name_textarea + '_editor')
newWidth = document.body.offsetWidth;
newHeight = document.body.offsetHeight - editor.offsetTop;
if (newWidth < 0) { newWidth = 0; }
if (newHeight < 0) { newHeight = 0; }
editor.style.width = newWidth;
editor.style.height = newHeight;
}
function initEditor()
{
prepareHtmlText();
var config = new editor_defaultConfig("ta");
config.toolbar = [
[ 'separator',"bold", "italic", "underline", 'separator' ],
[ "justifyleft", "justifycenter", "justifyright", "separator" ],
[ "orderedlist", "unorderedlist", "outdent", "indent", "break" , "separator" ,"htmlmode" ]
];
config.toolbar = <?php echo($ed_conf['toolbar']);?>;
config.stylesheet = "<?php echo($ed_conf['wysiwg_style']);?>";
config.imgURL = "<?php echo($ed_conf['img_dir']);?>";
<?php
if ( !empty($ed_conf['btnList']))
{
foreach ($ed_conf['btnList'] as $index => $data )
{
$btn_ID = $data[0];
$btn_CMD = $data[0];
$btn_ToolTip = $data[1];
$btn_Icon = $data[3];
$btn_EnableTextMode = $data[4];
?>
config.btnList["<?php echo $btn_ID?>"] = [ "<?php echo $btn_CMD?>", "<?php echo $btn_ToolTip?>", "editor_action(this.id)", "<?php echo $btn_Icon?>" ] ;
<?php
}
}
?>
editor_generate("ta", config);
editor = document.all["_ta_editor"];
resize_editor();
document.body.onkeypress = _CloseOnEsc;
window.onresize = resize_editor;
}
<?php
if ( !empty($ed_conf['fncList']))
{
foreach ($ed_conf['fncList'] as $fncName => $fncCode )
{
?>
document.<?php echo $fncName;?>= function(cmdID, UI, param, obj)
{
var htmlAreaVersion = "2";
<?php echo $fncCode;?>
}
<?php
}
?>
<?php
}
?>
</script>
<?php }
?>
</head>
<body onload="focus(); initEditor();" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class="bgeditorhead">
<td align="left" valign="center" height="37">
<?php echo($ed_conf['logo']); ?>
</td>
<td align="right" valign="center" class="bgeditorhead">
<input type="button" onclick="save()" value="<?php echo($ed_conf['editorsave']); ?>" class="editorsave">
<img src="../../grafik/pixel.gif" width="4" height="19">
<input type="button" onclick="window.close()" value="<?php echo($ed_conf['editorbreak']); ?>" class="editorbreak">
<img src="../../grafik/pixel.gif" width="8" height="19">
<br>
</td>
</tr>
</table>
<textarea id="ta" name="ta" style="width: 100%;" rows="20" cols="50" >
<p>If you can read this text, your browser dose not support this editor.</p>
<p>Pleas use:</p>
<p>Internet Explorer 5.5 or Mozilla 1.3b !!!</p>
</textarea>
</form>
</body>
</html>