cancel
Showing results for 
Search instead for 
Did you mean: 

Share 4.1 extensibility question

jpfi
Champ in-the-making
Champ in-the-making
Hi guys,
I'm using Alfresco 4.1 Ent. & currently trying to add a new region to documentlibrary.ftl using a <customization> and map the region via <sub-component id="default">:

<customizations>
              <customization>
                  <targetPackageRoot>org.alfresco</targetPackageRoot>
                  <sourcePackageRoot>de.fme.alfresco.documentlibrary</sourcePackageRoot>
              </customization>
          </customizations>
in templates/de/fme/alfresco/documentlibrary/documentlibrary.ftl:

<@region id="my-new-region" target="flash-upload" action="after" scope="template"/>
and another module to map the region:

<components>
            <component>
               <region-id>my-new-region</region-id>
               <source-id>documentlibrary</source-id>
               <scope>template</scope>
               <sub-components>
                  <sub-component id="default">
                     <url>/myurl</url>
                  </sub-component>
               </sub-components>
            </component>
         </components>

It doesn't work as expected, my new region is not mapped to a webscript. It is working if I use the old template.my-new-region.documentlibrary.xml component definition…
any ideas?
Cheers, jan
6 REPLIES 6

erikwinlof
Confirmed Champ
Confirmed Champ
Hi Jan,

I can understand your confusion, the problem is that you will need to "bind in" your component in the alfresco/site-data/components directory rather than "binding it in" in the module. Reason is that Spring Surf doesn't pick up new components in the module extensions files (you can only add/remove/replace components when there already is an existing component boud in).

I think this is something we should try to fix. In the meanwhile you'll have to use the site-data/components directory I'm afraid 😞

Cheers, Erik

jpfi
Champ in-the-making
Champ in-the-making
Hi,
ok, thx for clarifying this. I think it would be a nice enhancement to be able to keep your stuff in one place.
Enjoy DevCon in SJ!
jan

ddraper
World-Class Innovator
World-Class Innovator
Technically this is not a bug and isn't something that will get fixed. The problem really is in the choice of name that the attribute has been given. The module configuration allows you to customise existing components but not declare new ones… It would have probably been clearer if the attribute was called "component-customizations" instead of just "components".

There are no plans to change this behaviour… It will be necessary to define your Components either in their own configuration file or within a Page configuration file.

Regards,
Dave

erikwinlof
Confirmed Champ
Confirmed Champ
Btw you sure you want to add a new region?
Another solution is to re-use the existing region and add your sub-component after the "default" sub-component.

Then you would be able to have your <component> code inside your extension module instead:

<component>
   <region-id>flash-upload</region-id>
   <source-id>documentlibrary</source-id>
   <scope>template</scope>
   <sub-components>
      <sub-component id="de-fme-myComponent" index="10">
         <evaluations>
            <evaluation id="de-fme-addMyComponent">
               <url>/myurl</url>
            </evaluation>
         </evaluations>
      </sub-component>
   </sub-components>
</component>

Here's a blog post with some additional samples:
http://blogs.alfresco.com/wp/ewinlof/2011/11/09/add-remove-or-replace-components-on-shares-document-...

Cheers, Erik

jpfi
Champ in-the-making
Champ in-the-making
Hi,
yes, but I like to have an addional uploader - a single file flash upload including a form based meta-data section. But I still need the default flash uploader, e.g. to upload as new version…
by the way: the index-attribute controls the sequential order of subcomponent evaluations, right?
Cheers, jan

ddraper
World-Class Innovator
World-Class Innovator
Hi Jan,

Yes, that's correct. When a Sub-Component is generated from the "legacy" Component configuration it is given the index of 50 (and an id of "default")

Regards,
Dave