soung
soung

Reputation: 1614

alfresco categorie manager use another data url


Natively alfresco is using the url share/proxy/alfresco/slingshot/doclib/categorynode/node/alfresco/category/root?perms=false&children=true to retrieve categories and diplay them on catégory managment screen.

I want to use another url to get all catégories tree on repository and display them all after page loading. I think i have problem with YAHOO Ui tree library. I have done a webscript returning the categories tree. But i can't display them on screen.

I want to keep using action picto (add, remove or modify) categories. How can i use different url ?

In _buildTree methode i'm using a function to recursively display all categories. i have something like that :

var rootNode  = getAllCategoriesTree(); // this  function all categeries
                    this._buildNodeRecursively({
                        name : Alfresco.util.message("node.root", this.name),
                        path : "/",
                        nodeRef : "", 
                        children : results.items
                    }, rootNode, true);

And i define the function like this :

_buildNodeRecursively : function DLT__buildNodeRecursively(item,  nodeParent, isRootNode) 
    {
        var node ;
        if (isRootNode)
        {
            node   = nodeParent ;
        }
        else 
        {
            node  = this._buildTreeNode({
                name : item.name,
                path : item.path,
                nodeRef : item.nodeRef
            }, nodeParent, true); 
        }


        if(item.children)
        {
            for ( var i = 0 ;  i < item.children.length ; i++)
            {
                var child  = item.children[i];
                this._buildNodeRecursively(child, node);
            }
        }
    },

In firebug i can see the function is executed. but it doesn't display categories

Upvotes: 0

Views: 100

Answers (1)

mitpatoliya
mitpatoliya

Reputation: 2037

You can find category.js file under

<ALF_HOME>\tomcat\webapps\share\components\documentlibrary

inside which you will see following API

 _buildTreeNodeUrl: function DLT__buildTreeNodeUrl(path)
   {
      var nodeRef = new Alfresco.util.NodeRef(this.options.nodeRef),
        uriTemplate ="slingshot/doclib/categorynode/node/" + $combine(encodeURI(nodeRef.uri), Alfresco.util.encodeURIPath(path));

      return  Alfresco.constants.PROXY_URI + uriTemplate + "?perms=false&children=" + this.options.evaluateChildFolders;
   }

This is where default url is generated. You can changes this url to place yours and check weather it is working or not.

Other thing which you need to make sure is response format sent by out of box webscript is similar to your custom webscript. It that is the case then everything should be working fine just by overriding this API.

You will have to update min.js file as well in order to reflect your changes.

NOTE: Ideally you should create your own js file and extend Alfresco.DocListCategories class to override that url.

Upvotes: 1

Related Questions