cancel
Showing results for 
Search instead for 
Did you mean: 

Create Content Menu

itzamna
Confirmed Champ
Confirmed Champ
Hi all,

I'm not sure if this question was already answered, but I couldn't use the search of this forum as this results always in an error…!?

Here's my question:
Is there an opportunity to enhance the "Create Context" menu in Share with a submenu? I'm able to create additional entries in the menu. But as all of my entries are all related to our own content model, I'm looking for a way to collect (group) all of these entries in an own submenu.
 
This is the part of my share-custom-config.xml that contains the menu entries:

<config evaluator="string-compare" condition="DocumentLibrary">
   <create-content>
      <content id="myType1" mimetype="text/plain" icon="myType1" label="myType1.createcontent" itemid="cc:myType1"/>
      <content id="myType2" mimetype="text/plain" icon="myType2" label="myType2.createcontent" itemid="cc:myType2"/>
      <content id="myType3" mimetype="text/plain" icon="myType3" label="myType3.createcontent" itemid="cc:myType3"/>
   </create-content>



I'm looking for something like:

<config evaluator="string-compare" condition="DocumentLibrary">
   <create-content>
           <content id="mySubmenu" icon="mySubmenu" label="mySubmenu.createcontent" />
         <content id="myType1" mimetype="text/plain" icon="myType1" label="myType1.createcontent" itemid="cc:myType1"/>
         <content id="myType2" mimetype="text/plain" icon="myType2" label="myType2.createcontent" itemid="cc:myType2"/>
         <content id="myType3" mimetype="text/plain" icon="myType3" label="myType3.createcontent" itemid="cc:myType3"/>
      </content>
   </create-content>


In principle, the same structure as it is provided for the menu "By Templated Node…" (screenshot).

Is this feasable in one of the current Alfresco versions (4.1.5 Enterprise and up) by simple customizing (without writing additional source-code)?

Thanks!
1 REPLY 1

arnoldschrijve1
Champ on-the-rise
Champ on-the-rise
Hi,

It depends what you mean by simple customizing Smiley Happy I think you'll have to write quite a bit of source code. Unfortunately there is no easy configuration option.
The Create Content menu is constructed in the Toolbar component of the Document Library, ie. Alfresco.DocListToolbar (webscript located at: config/alfresco/site-webscripts/org/alfresco/components/documentlibrary/toolbar.get.desc.xml). Most of the work is done in the client-side toolbar.js (/source/web/components/documentlibrary/toolbar.js).

You could directly hack the code in toolbar.js. A quick look shows you'll have to at least adapt onReady() method and maybe onCreateContent().

Much better but much more involved would be to create your own share extension module and extend the webscript by creating your own extension of toolbar.js that overrides the appropriate methods. Then add that script in the webscript header (config/alfresco/site-webscripts/org/alfresco/components/documentlibrary/toolbar.get.head.ftl) or create your own toolbar webscript altogether and swap it with the default using the surf extension mechanism.
Finally you should also adjust the mechanism of passing the createContentActions, i.e. add some mechanism to determine the hierarchy of the menu, if you want to retain the easy configuration option in share-custom-config.xml.