dojoalfrescoalfresco-shareaikau

Alfresco Share Aikau PathTree to show documents not just folders


I am working on an Aikau Share Page where I a side bar that is using the Alfresco Share document library tree picker. The picker allows me to publish the nodeRef to another widget which will display information. I would like to use the tree view but i'm having trouble showing the documents and it is only showing the containers/folders. Anyone have any idea on what I need to do in order to solve this?

Here is the Aikua code i am using:

{
        align: "sidebar",
        name: "alfresco/layout/Twister",
        config: {
         label: "twister.library.label",
         additionalCssClasses: "no-borders",
         widgets: [
                {
                    name: "alfresco/navigation/PathTree",
                    config: {
                       showRoot: true,
                       rootLabel: "Repository",
                       rootNode: "/app:company_home",
                       publishTopic: "ALF_ITEM_SELECTED"
                    }
                    }                       
                ]
            }   
}

I am wondering if I need to write an extension to the CoreXhr or what the steps would be in order to make this work.

Any help would be appreciated


Solution

  • I was able to figure this out. The problem comes from the repository script in the alfresco explorer side "treenode.get.js". The solution was to do the following

    1. Create a new webscript in alfresco explorer and copy treenode.get.js code into the new webscript. I ended up calling mine customtreenode.get.js.
    2. Remove the logic check for IsContainer in the newly created webscript
    3. Create new Aikau file that extends PathTree. Here is the code below

          define(["dojo/_base/declare",
          "alfresco/navigation/PathTree",
          "alfresco/documentlibrary/_AlfDocumentListTopicMixin",
          "service/constants/Default",
          "dojo/_base/lang",
          "dojo/_base/array",
          "dojo/dom-class",
          "dojo/query",
          "dojo/NodeList-dom"], 
          function(declare, PathTree, _AlfDocumentListTopicMixin, AlfConstants, lang, array, domClass, query) {
      
          return declare([PathTree, _AlfDocumentListTopicMixin], {
      
                  useHash: true,
      
                   getTargetUrl: function alfresco_navigation_Tree__getTargetUrl() {
                       var url = null;
                       if (this.siteId && this.containerId)
                       {
                          url = AlfConstants.PROXY_URI + "slingshot/doclib/treenodeCustom/site/" + this.siteId + "/documentlibrary";
                       }
                       else if (this.rootNode)
                       {
                          url = AlfConstants.PROXY_URI + "slingshot/doclib/treenodeCustom/node/alfresco/company/home";
                       }
                       else if (!this.childRequestPublishTopic)
                       {
                          this.alfLog("error", "Cannot create a tree without 'siteId' and 'containerId' or 'rootNode' attributes", this);
                       }
                       return url;
                   }
          });
       });
      
    4. Change your code to use the new CustomPathTree

          {
          align: "sidebar",
          name: "alfresco/layout/Twister",
          config: {
           label: "twister.library.label",
           additionalCssClasses: "no-borders",
           widgets: [
                  {
                      name: "CustomWidgets/widgets/CustomTreeNode",
                      config: {
                         showRoot: true,
                         rootLabel: "Repository",
                         rootNode: "/app:company_home",
                         publishTopic: "ALF_ITEM_SELECTED"
                        }
                      }
                  ]
              }   
      }
      

    It works after that. I still need to change the icons from folders to documents.