You are not logged in.
Pages: 1
I've gotten Xinha integrated into the zencart which has always used htmlarea. My only problem is enabling plugins. The original code for htmlarea plugins has never worked and I can't get zencart to recognize my new config settings to enable certain plugins. I would just as rather bypass a separate file and enable them in XinhaCore.js but I don't see how to add them. I've enabled Xinha in other situations so I'm not a dummy, just stymied! Imagemanager will load and full screen loads no matter what I do. I was trying to get ExtendedFileManager to load as well. Is there something I'm missing here?
the resulting javascript includes this:
<script type="text/javascript">
if (typeof _editor_url == "string") HTMLArea.replaceAll();
}
// -->
</script>
<script type="text/javascript">
_editor_url = "/zen/editors/xinha/";
_editor_lang = "en";
</script>
<script type="text/javascript" src="/zen/editors/xinha/XinhaCore.js"></script>
<script type="text/javascript">
HTMLArea.loadPlugin("TableOperations");
HTMLArea.loadPlugin("SpellChecker");
HTMLArea.loadPlugin("ImageManager");
HTMLArea.loadPlugin("ExtendedFileManager");
HTMLArea.loadPlugin("FullScreen");
HTMLArea.loadPlugin("ListType");
HTMLArea.loadPlugin("CharacterMap");
</script>
Offline
I see that your setup can't work this way, but ad hoc I wouldn't know how to solve the issues, unfortunately.
If you want support, I'd ask ask and advise you to load Xinha the way described here: http://xinha.webfactional.com/wiki/NewbieGuide
Offline
I tried that but it doesn't acknowledge that code - just pretends it's not there for the other plugins. Since htmlarea can't load plugins either it must be something with how this is integrated. Thanks for responding.
Offline
Okay, a little more info. The full screen plugin comes with xinha so it loads automatically. ImageManager does load but it is the only one that does which interestingly enough is the only one that that code will load with the htmlarea in the cart. For sure if I removed that "HTMLArea.loadPlugin("ImageManager");" from my file, the imagemanager will not work.
Bizarrely, I've found that this is true for HTMLarea with that same code. So obviously, I need a a different way of approaching this. No one at zencart seems interested in this situation with the plugins not working.
I tried including a config file but it doesn't work. One thing I 'm sure of is that I don't need to name the textarea. It pops up for any textarea in the admin section. I've used this config file in another situation with no problems so I assume that's not it.
Anybody got an answer to my puzzles?
Offline
Hi, I jaust had the chance to have another look at your problem and found that it's really there's a problem converting all textareas with the described method. I fixed the code accordingly
Now, the way to convert all textareas in a document is to put
xinha_editors = xinha_editors ? xinha_editors : document.getElementsByTagName('textarea');
in your config as Step 1
For this to work at the moment you have to change the code of XinhaCore.js. Open the the file, locate the function Xinha.makeEditors and replace it by the following code (or simply put it at the end of the file, doesn't actually matter)
Xinha.makeEditors = function(editor_names, default_config, plugin_names)
{
if ( !Xinha.isSupportedBrowser ) return;
if ( typeof default_config == 'function' )
{
default_config = default_config();
}
var editors = {};
var textarea;
for ( var x = 0; x < editor_names.length; x++ )
{
if ( typeof editor_names[x] == 'string' ) // the regular case, an id of a textarea
{
textarea = Xinha.getElementById('textarea', editor_names[x] );
if (!textarea) // the id may be specified for a textarea that is maybe on another page; we simply skip it and go on
{
editor_names[x] = null;
continue;
}
}
// make it possible to pass a reference instead of an id, for example from document.getElementsByTagName('textarea')
else if ( typeof editor_names[x] == 'object' && editor_names[x].tagName && editor_names[x].tagName.toLowerCase() == 'textarea' )
{
textarea = editor_names[x];
if ( !textarea.id ) // we'd like to have the textarea have an id
{
textarea.id = 'xinha_id_' + x;
}
}
var editor = new Xinha(textarea, Xinha.cloneObject(default_config));
editor.registerPlugins(plugin_names);
editors[textarea.id] = editor;
}
return editors;
};
Offline
Nope, that makes no difference - the config file is being ignored completely.
Last edited by delia (2007-11-20 10:23:42)
Offline
I found why the textareas are working with xinha - javascript statement =
(typeof _editor_url == "string") HTMLArea.replaceAll();
would that interfere with the config file? I'm thinking it would but I just don't know javascript very well to be able to make an eductated guess.
Offline
ah, wait, if the editors are being started without the config file then the makeEditor statement gets ignored, right?
Offline
I'm getting there slowly. Don't know why the config statement wasn't working but now it is and plugins are loading, etc.
Only one problem left for you - now that I've got all textareas with editors, there's one that shouldn't have the editor. How do I exclude textareas?
Offline
Well from here on the thing starts to get a general JavaScript question, as opposed to a Xinha one. But here we go
if (!xinha_editors) // the init function may be executed several times during plugin loading, but we want to define the array only once
{
xinhas_editors = []; //new Array
var allTextareas = document.getElementsByTagName('textarea');
for (var i=0;i<allTextareas.length;i++) // iterate through the array
{
if (allTextareas[i].id != 'exclude') // check whatever condition you need to exclude your textarea
{
xinhas_editors.push(allTextareas[i]); // add the others to the array
}
}
}
Offline
thanks - as I am a php person and hate javascript - your help is invaluable. I'm very close to having everypage integrated into zencart - only one problem page remains due to the code. I've found that if the form start and end tags are between table elements, Xinha will not work. That's pretty crappy php coding and I've let them know!
Offline
Yeah, well, I don't know how to debug javascript but I do know what to look for in code! It really gripes me when I see a coder dynamically produce lousy html.
Offline
I finally had time to insert this . Uh, I must not be doing it right. I put the name of the content area to be excluded in the brackets and with apostrophes - 'content' but it seems to have no effect. I left in the other editors initiate statement:
xinha_editors = xinha_editors ? xinha_editors : document.getElementsByTagName('textarea');
I also tried comments out that line. No dice.
Offline
Pages: 1