Hi!
I'm constructing tree with my own nodetypes for different 
targets. Now I create new nodes and download files 
using dialogs and it works well. But I'm trying to implement adding nodes
by commands and have problems in a stage of downloading java scripts to the
browser.
The Script.js file (mgnl-resourses/js-classes) is:
classDef("Script",
    // constructor
    function(tree){
        this.tree = tree;
    },

    {

        addXMLnode: function() {
            this.executeCommand('addXMLnode');
        },

        executeCommand: function (commandName) {
            var node = this.tree.selectedNode;
            var parentNode = node.getParent();

            var params = new Object();
            params.forceReload = true;
            params.pathSelected=this.tree.selectedNode.id;
            params.command = commandName;
            parentNode.expand(params);
        },


        isCustom: function(tree) {
            this.tree = tree;
            this.test = function() {
                var itemType = this.tree.selectedNode.itemType;
                return (itemType == "mgnl:custom");
            }
        },

        ...


        isImage: function(tree) {
            this.tree = tree;
            this.test = function() {
                var itemType = this.tree.selectedNode.itemType;
                return (itemType == "mgnl:image");
            }
        }
}); 

and TreeConfiguration file:

        ...
    menuAddXMLNode.setLabel("new XML node");
    menuAddXMLNode.setOnclick("Script.addXMLnode();");          //(*)

//  menuAddXMLNode.setOnclick("mgnlTreeMenuOpenDialog("
//                + tree.getJavascriptTree() + 
",'.magnolia/dialogs/Edit.html');");

    menuAddXMLNode.addJavascriptCondition("new Script."
            + "isFolder" + "(" + tree.getJavascriptTree() + ")");
        ...
So, all conditions work, but 2 browsers (Mozilla,Opera) write 
relatively the (*) string:

"Uncaught exception: TypeError: 'Script.addXMLnode' is not a function"

So, I've tried different variants but without any effect yet.
What can be wrong?

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=9496c31d-3e49-4890-aca1-e64ab57ac433


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to