cancel
Showing results for 
Search instead for 
Did you mean: 

Applying Custom menulinks to specific spaces

sureshganti
Champ in-the-making
Champ in-the-making
Hi,

I have added a custom menu link  using custom actions and custom dialog xml files to my alfresco.
My requirement is like it should be restricted to specific spaces.
But it is showing in all the spaces created in the web client.
Can any one help me out of this problem of showing that link in some specified spaces.
Its urgent.
8 REPLIES 8

jayjayecl
Confirmed Champ
Confirmed Champ
can your post here your web-client-config-custom.xml ?

sureshganti
Champ in-the-making
Champ in-the-making
Below is my webclient-config.custom.xml

<alfresco-config>

   <!– Example of overriding the from email address –>
   <!–
   <config>
      <client>
         <from-email-address>someone@your-domain.com</from-email-address>
         <search-max-results>100</search-max-results>
      </client>
   </config>
   –>

   <!– Example of adding languages to the list in the login page –>
   <!–
   <config evaluator="string-compare" condition="Languages">
      <languages>
         <language locale="ca_ES">Catalan</language>
         <language locale="hr_HR">Croatian</language>
         <language locale="cs_CZ">Czech</language>
         <language locale="da_DK">Danish</language>
         <language locale="de_DE">German</language>
         <language locale="es_ES">Spanish</language>
         <language locale="el_GR">Greek</language>
         <language locale="fi_FI">Finnish</language>
         <language locale="fr_FR">French</language>
         <language locale="it_IT">Italian</language>
         <language locale="ja_JP">Japanese</language>
         <language locale="du_NL">Dutch</language>
         <language locale="pl_PL">Polish</language>
         <language locale="pt_PT">Portuguese</language>
         <language locale="pt_BR">Portuguese (Brazilian)</language>
         <language locale="ru_RU">Russian</language>
         <language locale="sv_SV">Swedish</language>
         <language locale="tr_TR">Turkish</language>
         <language locale="zh_CN">Simplified Chinese</language>
      </languages>
   </config>
   –>
  
   <!– Example of configuring advanced search –>
   <!–
   <config evaluator="string-compare" condition="Advanced Search">
      <advanced-search>
         <content-types>
         </content-types>
         <custom-properties>
            <meta-data aspect="app:simpleworkflow" property="app:approveStep" />
         </custom-properties>
      </advanced-search>
   </config>
   –>

   <!– Example of changing the sort direction for a view in the client –>
   <!–
   <config evaluator="string-compare" condition="Views">
      <views>
         <view-defaults>
            <topic>
               <sort-direction>ascending</sort-direction>
            </topic>
         </view-defaults>
      </views>
   </config>
   –>

   <!– Example of adding a custom icon to the Create Space dialog –>
   <!–
   <config evaluator="string-compare" condition="cm:folder icons">
      <icons>
         <icon name="space-icon-custom" path="/images/icons/space-icon-custom.gif" />
      </icons>
   </config>
   –>

   <!– The config below shows how to incorporate the example model–>
   <!– into the web client, for this to work you will need to –>
   <!– rename example-model-context.xml.sample to example-model-context.xml –>
   <!–
   <config evaluator="string-compare" condition="Content Wizards">
      <content-types>
         <type name="my:sop" />
      </content-types>
   </config>

   <config evaluator="node-type" condition="my:sop">
      <property-sheet>
         <show-property name="mimetype" display-label-id="content_type"
                        component-generator="MimeTypeSelectorGenerator" />
         <show-property name="size" display-label-id="size"
                        converter="org.alfresco.faces.ByteSizeConverter"
                        show-in-edit-mode="false" />              
         <show-property name="mySmiley TongueublishedDate" />
         <show-association name="my:signOff" />
         <show-property name="my:authorisedBy" />
         <show-child-association name="mySmiley TonguerocessSteps" />
      </property-sheet>
   </config>

   <config evaluator="aspect-name" condition="my:imageClassification">
      <property-sheet>
         <show-property name="my:width"/>
         <show-property name="my:height"/>
         <show-property name="my:resolution"/>
      </property-sheet>
   </config>

   <config evaluator="string-compare" condition="Action Wizards">
      <aspects>
         <aspect name="my:imageClassification"/>
      </aspects>
   </config>

   <config evaluator="string-compare" condition="Advanced Search">
      <advanced-search>
         <content-types>
            <type name="my:sop" />
         </content-types>
         <custom-properties>
            <meta-data type="my:sop" property="my:authorisedBy" />
            <meta-data aspect="my:imageClassification" property="my:resolution" />
         </custom-properties>
      </advanced-search>
   </config>
   –>
   <config evaluator="string-compare" condition="Action Wizards">
      <aspects>
         <aspect name="custom:AdditionalMetadata"/>
      </aspects>
   </config>
   
   <!– Displays the properties in view details page –>
   <config evaluator="aspect-name" condition="custom:AdditionalMetadata">
      <property-sheet>
         <separator name="sepCust1" display-label="DublinCore Metadata" component-generator="HeaderSeparatorGenerator"/>
            <show-property name="custom:title"/>
            <show-property name="custom:title1"/>
            <show-property name="custom:barcode"/>
            <show-property name="custom:language"/>
            <show-property name="custom:languageOthers"/>
            <show-property name="custom:creator"/>
            <show-property name="custom:creator1"/>
            <show-property name="custom:creator2"/>
            <show-property name="custom:creator3"/>
            <show-property name="custom:creator4"/>
            <show-property name="custom:creator5"/>
            <show-property name="custom:creator6"/>
            <show-property name="custom:creator7"/>
            <show-property name="custom:creator8"/>
            <show-property name="custom:creator9"/>
            <show-property name="custom:subject"/>
            <show-property name="custom:subject1"/>
            <show-property name="custom:subject2"/>
            <show-property name="custom:subjectothers"/>
            <show-property name="customSmiley Tongueublisher"/>
            <show-property name="custom:date"/>
            <show-property name="custom:source"/>
            <show-property name="custom:sourcelibraryothers"/>
            <show-property name="custom:rights"/>
            <show-property name="custom:rightsothers"/>
            <show-property name="custom:rightsowner"/>
            <show-property name="custom:copyrightdate"/>
            <show-property name="custom:slocation"/>
            <show-property name="customSmiley Frustratedlocationothers"/>
            <show-property name="custom:vendor"/>
            <show-property name="custom:vendorothers"/>
            <show-property name="custom:scanningcentre"/>
            <show-property name="custom:scanningcentreothers"/>
            <show-property name="custom:numberedpages"/>
            <show-property name="custom:unnumberedpages"/>
            <show-property name="custom:totalpages"/>
            <show-property name="custom:digitalrepublisher"/>
            <show-property name="custom:digitalpublicationdate"/>
      </property-sheet>
   </config>
   <config>
      <client>
         <shelf-visible>false</shelf-visible>
         <initial-location>guesthome</initial-location>
         <allow-guest-config>true</allow-guest-config>
      </client>
   </config>
   
   <config>
      <actions>
      <!– Launch Add Aspect Dialog –>
         <action id="book_reader">
            <label>Book Reader</label>
            <action-listener>#{BrowseBean.setupSpaceAction}</action-listener>
            <action>dialog:bookReader</action>
            <params>
               <param name="id">#{actionContext.id}</param>
            </params>
         </action>
        
      <!– Add action to more actions menu for each space –>
         <action-group id="space_browse_menu">
            <action idref="book_reader" />
         </action-group>
         <action-group id="space_details_actions">
            <action idref="book_reader" />
         </action-group>
      </actions>
   <dialogs>
      <dialog name="bookReader" page="/jsp/extension/bookReader.jsp" managed-bean="BookReader"
           icon="/images/icons/add_content_large.gif" title="Book Reader"
           description="Book Reader for SVK" />
   </dialogs>   
   </config>
   

</alfresco-config>

jayjayecl
Confirmed Champ
Confirmed Champ
Hi,

you should add an "evaluator" in your "action" config.
See for example the following :

<!– Edit document offline action –>
         <action id="edit_doc_offline">
            <permissions>
               <permission allow="true">Write</permission>
            </permissions>
            <evaluator>org.alfresco.web.action.evaluator.EditDocOfflineEvaluator</evaluator>
            <label-id>edit_doc_offline</label-id>
            <image>/images/icons/edit_offline.gif</image>
            <action-listener>#{EditOfflineDialog.setupContentAction}</action-listener>
            <params>
                <param name="id">#{actionContext.id}</param>
            </params>
         </action>

The action will be displayed only if the evaluator "evaluate()" method returns true.
Then you can add your custom conditions in the evaluator

sureshganti
Champ in-the-making
Champ in-the-making
Hi Jay,
Thanks for the reply..

Here what exactly we r doing is like we have some digitized books.
So we are storing some .tiff images in one space which is inherited by many parent spaces.
I integrated a book reader for those images to display.
The problem with is using custom menu links.
I have to show the custom menu links only to the spaces which contain .tiff images not to the parent spaces.
So how can i write the code so that i will meet my requirement.
Because I dont know the flow form where the uuid of the space is coming and all the stuff.
Kindly please help me out of this problem.

Thanku.

jayjayecl
Confirmed Champ
Confirmed Champ
If yuo just follow my piece of advice, you'll do something like

public class BookReaderEvaluator implements ActionEvaluator {

   @Override
   public boolean evaluate(Node node) {
      NodeService nodeService = Repository.getServiceRegistry(
                  FacesContext.getCurrentInstance()).getNodeService();
                NodeRef spaceRef = node.getNodeRef();
      boolean hasTiffContentItems = false;
      List<ChildAssociationRef> childList = nodeService.getChildAssocs(
                spaceRef);

                Node childNode = null;
                for (ChildAssociationRef child : childList) {               
                childNode = new Node(child.getChildRef());
                if (childNode.getName().endsWith(".tiff")) {
                hasTiffContentItems = true;
                break;
            }
        }

      return hasTiffContentItems;
   }

   
}

sureshganti
Champ in-the-making
Champ in-the-making
Hi Jay,

Thanku Very much..

sureshganti
Champ in-the-making
Champ in-the-making
HI Jay,

I have a new problem with alfresco.
I tried to start alfresco as  a windows service.
But  I am unable to start the service.
One important point here is alfresco is not installed in my system.
I was taken as a dump.
I need to start mysql as well as tomcat at the startup.
please help me out of this problem.

Thanks,

Suresh.

jayjayecl
Confirmed Champ
Confirmed Champ
you should create a new topic for that