cancel
Showing results for 
Search instead for 
Did you mean: 

Share Extension - order of appearance

dhartford
Champ on-the-rise
Champ on-the-rise
Hi all,
Reviewing what is possible with extensions (based on examples), I think I've run into a stumbling block.

preface: The idea of using Extensions in /shared/lib/ to avoid AMP's being applied to the WAR (which can not be easily removed after applied) is really appealing.  Personal preference is to stay away from AMP's, and either go back to the /shared/classes/alfresco/** approach or the extension approach.


Question: For Document Details, I would like to change the order of the right-side pane such that the Metadata is on top.

Code snippet:


         <div class="yui-u">
            <@region id="document-actions" scope="template"/>
            <@region id="document-tags" scope="template"/>
            <@region id="document-links" scope="template"/>
            <@region id="document-metadata" scope="template"/>
            <@region id="document-sync" scope="template"/>
            <@region id="document-permissions" scope="template"/>
            <@region id="document-workflows" scope="template"/>
            <@region id="document-versions" scope="template"/>
            <@region id="document-publishing" scope="template"/>
            <#if imapServerEnabled>
               <@region id="document-attachments" scope="template"/>
            </#if>
         </div>


Is there a clean approach to simply reorder these?

(bonus: configure which ones are open or collapsed by default)

environment: alfresco 4.2.c CE

thanky!
-D

6 REPLIES 6

kaynezhang
World-Class Innovator
World-Class Innovator
Share extension module is used to replace alfresco amp,they are for differnt purpose .

Yes An AMP file can contain as little as a set of custom templates . It also can contain a custom model or a complete new set of functionality(for example records management).
Share extension module is used to make it easy to customize Alfresco Share through the use of Component extensions.

For your requirement please refer to http://blogs.alfresco.com/wp/developer/2011/08/12/customizing-alfresco-share-freemarker-templates/

ddraper
World-Class Innovator
World-Class Innovator
Just to clarify, I think kaynezhang meant to say that the Share extension modules are NOT used to replace the AMP. The extension modules are targeted primarily at Share extensions and can be quite happily used in tandem with AMPs. It should be relatively straightforward to undeploy and AMP? Is this something that you've had difficulty with.

To answer you last question first… the details sections that are opened or collapsed are controlled by the individual users preferences. It should be possible to override this but you'll almost certainly need to modify some JavaScript and you may want to ask whether not you want to take away an individuals users ability to control what they see.

I think it should be possible to reorder by removing and re-adding the regions using the "before" and "after" attributes - but there's no way of just modifying them to set an index value if that's what you were hoping for.

dhartford
Champ on-the-rise
Champ on-the-rise
I'm still not quite getting it…I used this as a reference as 'before' and 'after' didn't make sense until used in this context: http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2Ftu-share-FM-te...


JAR file deployed to TOMCAT/shared/lib/

JAR/alfresco/site-data/extensions/documentdetails.xml

<extension>        
  <modules>
<module>
<id>DocumentDetail: Metadata First Module</id>
  <customizations>           
    <customization>               
          <targetPackageRoot>org.alfresco</targetPackageRoot>               
          <sourcePackageRoot>demo.customizations</sourcePackageRoot>         
     </customization>      
    </customizations>       
</module>
  </modules>
</extension>        


JAR/alfresco/templates/demo/customizations/document-details.ftl

<@region id="document-actions" target="document-metadata" action="after" scope="global" />     
<@region id="document-versions" target="document-actions" action="after" scope="global" />     
<@region id="document-tags" target="title" action="remove" scope="global" />     
<@region id="document-links" target="title" action="remove" scope="global" />     
<@region id="document-permissions" target="title" action="remove" scope="global" />     
<@region id="document-workflows" target="title" action="remove" scope="global" />     
<@region id="document-publishing" target="title" action="remove" scope="global" />  


when the document-details.ftl is malformed I'll get an error, otherwise nothing seems to be changing.  I also have the media-viewer extension installed, so I put this module at the bottom, so it is processed last to ensure that wasn't the issue.

I would have expected that at least the 'remove' would provide feedback that I am making changes, but that is also not working.  (Alfresco 4.2.c)

Are there any steps I should be taking to help debug this issue, or do I simply mis-understand the right file/file location/file contents?

thanks for any help!
-D

ddraper
World-Class Innovator
World-Class Innovator
I've tried this out and was able to put the metadata region at top following your initial example but updating the JAR/alfresco/templates/demo/customizations/document-details.ftl file so that it contains:


<@region id="remove-metadata" target="document-metadata" action="remove" scope="global" />     
<@region id="document-metadata" target="document-actions" action="before" scope="template" />

I think there may have been a misunderstanding of what I was suggesting in my previous post. You need to remove the region you want to move and then add it back in at the location you want… however, it's important that you need to keep at least one of the original regions in as an anchor point.

In the code I've provided I'm removing the "document-metadata" region and then I'm immediately adding it back in again BEFORE the "document-actions" region. The other important thing to note is that I'm setting the "scope" of the "document-metadata" to "template" (as originally declared in the core Alfresco file) so that it can bind with it's component.

If you wanted to get additional debug information on the extension processing code then you would have needed to update your log4j properties file to target the relevant packages.

kaynezhang
World-Class Innovator
World-Class Innovator
I am so sorry  I Left out the word "not".
Share extension module is <strong> not </strong> used to replace alfresco amp,they are for differnt purpose /
Thank you ddraper for helping me out.

dhartford
Champ on-the-rise
Champ on-the-rise
Confirmed, thanks ddraper, here was the final .ftl changes for order of appearance via Extensions:


<!– remove document-actions, then add back in order below metadata –>
<@region id="remove-document-actions" target="document-actions" action="remove" scope="global" />
<@region id="document-actions" target="document-metadata" action="after" scope="template" /> 
<!– remove document-versions, then add back in order below actions–>
<@region id="remove-document-versions" target="document-versions" action="remove" scope="global" />     
<@region id="document-versions" target="document-actions" action="after" scope="template" />

<!– for this usecase, do not need the remainder, so remove completely –>
<@region id="remove-document-tags" target="document-tags" action="remove" scope="global" />     
<@region id="remove-document-links" target="document-links" action="remove" scope="global" />     
<@region id="remove-document-permissions" target="document-permissions" action="remove" scope="global" />     
<@region id="remove-document-workflows" target="document-workflows" action="remove" scope="global" />     
<@region id="remove-document-publishing" target="document-publishing" action="remove" scope="global" />