Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2007-01-18 16:08:12

volhovec
Xinha Community Member
Registered: 2007-01-18
Posts: 13

Xinha and PEAR_HTML_QuickForm how to?

Somebody make Pear Quick Form element based on xinha??
I was tryed, but when i parse $_REQUEST, $_REQUEST['myTextArea'] - is not present.
I cann't put all xinha script in <head> tag, because QuickForm used dynamic template.
But simply script, like that, worked:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Simple example of Xinha</title>
<script type="text/javascript">
var _editor_skin = 'blue-look';
var _editor_url  = '/xinha';
var _editor_lang = "ru";
</script>
<script type="text/javascript" src="/xinha/XinhaCore.js"></script>
</head>
<body>
<form id="myForm" action="xinha.php" method="POST" >
<script type="text/javascript">
var xinha_plugins =
[
       'ContextMenu',
       'ListType',
       'SuperClean',
       'TableOperations',
       'PasteText',
       'UnFormat',
       'ExtendedFileManager',
       'InsertPicture',
       'ImageManager'
];
var xinha_editors =
[
  'myTextArea'
];
function xinha_init()
{
  if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
  var xinha_config = new Xinha.Config();
  xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
  xinha_editors.myTextArea.config.width = '550px';
  xinha_editors.myTextArea.config.height = '450px';
  Xinha.startEditors(xinha_editors);
}
window.onload = xinha_init;
</script>
<textarea id="myTextArea" name="myTextArea" rows="10" cols="80" style="width:100%">
<?
if ('' != $_REQUEST['myTextArea'])
{
    echo stripslashes(htmlspecialchars($_REQUEST['myTextArea'])); 
}
else 
{
    echo 'testing';
}
?>
</textarea>
<input type="hidden" value="1" name="hid">
<input type="submit" value="PASTE" name="go">
</form>
</body>
</html>

Offline

#2 2007-01-23 05:04:49

volhovec
Xinha Community Member
Registered: 2007-01-18
Posts: 13

Re: Xinha and PEAR_HTML_QuickForm how to?

I was made xinha element for quick form, based on textarea standart element
function toHtml() looks like that:

function toHtml()
    {
        if ($this->_flagFrozen) {
            return $this->getFrozenHtml();
        } 
        else 
        {
        ob_start();
?>

<script type="text/javascript">
var _editor_skin = 'blue-look';
var _editor_url  = '/xinha/';
var _editor_lang = "ru";
</script>
<script type="text/javascript" src="/xinha/XinhaCore.js"></script>
<script type="text/javascript">
var xinha_plugins =
[
       'ContextMenu',
       'ListType',
       'SuperClean',
       'TableOperations',
       'PasteText',
       'UnFormat',
       'ExtendedFileManager',
       'InsertPicture',
       'ImageManager'
];
var xinha_editors =
[
  <?echo "\"".$this->getName()."\"";?>
];
function xinha_init()
{
  if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
  var xinha_config = new Xinha.Config();
  xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
  xinha_editors.<?echo $this->getName();?>.config.width = '600px';
  xinha_editors.<?echo $this->getName();?>.config.height = '450px';
  Xinha.startEditors(xinha_editors);
}
window.onload = xinha_init;
</script>
<textarea style="width:600px;" name="<?echo $this->getName();?>" id="<?echo $this->getName();?>">
<? echo preg_replace("/(\r\n|\n|\r)/", '
', htmlspecialchars($this->_value));?>
</textarea><br>

<?php
            $code = ob_get_contents();
            ob_end_clean();
            return $code;
        }
    }

It's worked, but when i post something whith text changes in FireFox and the form reloaded, other parts of the form does not displayed propertly (screen 1)
screen1.JPG

But when i first time click on submit button, the form is unfolded (screen 2)
On second click - form posted.
screen2.JPG

IN IE all worked propertly...

Please, help me eliminate this bug...

Offline

Board footer

Powered by FluxBB