Friday, March 25, 2011

How to customize Alfresco Share 3.4 Advanced Search Form

This post will guide you - how you can define your custom content type and custom properties in Share 3.4 advanced search form.

I am assuming, you know how to deploy custom content model and you have deployed CustomContentModel. Which contains doc:testContractType content type and some custom properties like doc:conName, doc:conNumber, doc:conStatus and doc:conType

Modify → \tomcat\shared\classes\alfresco\web-extension\share-config-custom.xml

Add following configuration to include your custom content type in Advances Search option

<config evaluator="string-compare" condition="AdvancedSearch">
   <advanced-search>
       <forms>
           <form labelId="search.form.label.doc_testContractType"         descriptionId="search.form.desc.doc_testContractType">doc:testContractType</form>
      </forms>
  </advanced-search>
</config>

Add relavent i18 string in property file under test.properties
To add that property file, Go to tomcat\shared\classes\alfresco\web-extension
Modify – custom-slingshot-application-context.xml and add following code.


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!-- Add Knowledge Base messages -->
    <bean id="webscripts.test.resources" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
          <property name="resourceBundles">
           <list>
               <value>alfresco.messages.test</value>
           </list>
        </property>
</bean>
</beans>

Create property file named test.properties under \tomcat\shared\classes\alfresco\messages
Add following i18 string

search.form.label.doc_testContractType=Test Custom Type
search.form.desc.doc_testContractType=Searches for all types of TestCustomType

To include custom fields for search, add following configuration in share-config-custom.xml under \tomcat\shared\classes\alfresco\web-extension\

<config evaluator="model-type" condition="doc:testContractType">
    <forms>
       <!-- Following fields will be visible during advanced search form -->
            <form id="search">
                 <field-visibility>
                        <show id="cm:title"/>
                        <show id="doc:conName" />
                        <show id="doc:conNumber" />
                        <show id="doc:conStatus" />
                       <show id="doc:conType" />
                 </field-visibility>
        </form>
</forms>
</config>



How to exclude workflow from list in Alfresco Share 3.4

This post will guide you how you can exclude particular workflow from alfresco share Start Worklfow List

By default, all workflow those are registered in DM are available in Share.
If you want to exclude any particular workflow then add following configuration in
\tomcat\shared\classes\alfresco\web-extension\share-config-custom.xml

Under tag, define the list of the workflow that you want to exclude from list.

If you want to hide all the task of particular model then define its prefix in tag.
Suppose, you want to start your custom workflow from coding rather than manually. You may need users to perfrom that task then hide only the workflow not the task.


<config evaluator="string-compare" condition="Workflow">
   <hidden-workflows>
         <workflow name="jbpm$doc:testAppRej"/>
</hidden-workflows>

  <hidden-tasks>
        <task type="doc:*"/>
  </hidden-tasks>
 </config>

Getting started with Alfresco WCMQS

Alfresco WCM Quick Start

Web Quick Start is a sample application built on top of the Alfresco Share for Alfresco WCM platform. This application is built on Spring MVC, Spring Surf and OpenCMIS.

Advantages of Alfresco WCMQS
1.Easy-to-install package
2.To provide developers with a strong starting point for their Alfresco implementations
3.In context web editing: Edit the content from browser
4.Office-to-Web: Users can draft content using MS Office, collaborate in real time through Google Docs, and then use automated rules to publish to the web
5.Shared Network Drive: Map the web library to network drive. Drag-and-drop new web content from their desktop to the web.

Refer http://wiki.alfresco.com/wiki/Web_Quick_Start_Installation_and_Configuration to install and import WCM Quick start site data

Structure of the WCMQS

The Quick Start demo site has main two folders
1.Quick Start Editorial - Editorial version of site
2.Quick Start Live. - Live version of site

Folder hierarchy will be

Alfresco Quick Start cm:folder→ Quick Start Editorial - ws:website → root – ws:webroot →Section folder ws:section → collections- ws:webassetCollectionFolder / ws:article/ws:indexPage/ws:image → latest.articles - ws:webassetCollection

Within these folder hierarchy, every folders are type of ws:section - these folders are responsible for navigation link for the site header.
Each this section folder contains index.html(landing page) and collections sub folder. Where collections folder is responsible to manage assets collections. When user creates any section folder then index.html and collections folder will be created automatically.
Asset collections is collection of web assets.
In Collections folder three default asset collection - folder will be created. Featured.article, latest.articles and section.articles
In section folder user can have web content, image, landing page as asset.

Metadata for each type

Quick Start Editorial – ws:website
Host Name:localhost
Host Port :8080
Web App Context :wcmqs
Site Configuration:isEditorial=true/false – You want to allow editing of the content from the browser or not
Publish Target:Quick Start Live

Section folder ws:section
Template Mapping: ws:indexPage=sectionpage2
Templates are share page
Template mapping indicates the layout of your page/web content – how this page should be displayed, how the data should be rendered
Template mapping can be done at section level as well as asset level.
ws:indexPage=sectionpage2 - This indicates that all asset/web content of type ws:article should be rendered as per template articlepage1 for that particular section folder
If a template mapping is not found for the requested section, the parent is then checked. This process repeats up to the root section. The root section holds the site-wide template configuration settings.

Rendition Config:
The Alfresco Rendition Service is used to view content dynamically according to mapping. It is used for resizing images, producing flash previews of pdf documents
Content type or mime type can be mapped to rendition definition.
ws:image=ws:imagePreview,application/pdf=ws:swfPreview - Any asset of type "ws:image" will have two renditions generated ("ws:smallThumbnail" and "ws:imagePreview"), and any asset with the "application/pdf" MIME type will have a Flash preview rendition generated (the "ws:swfPreview" rendition).
Order Index:
To configure the order in which navigation links display
Lowest value of order index appears to the right of the Home link and the remaining links are added in ascending numerical order
Exclude from navigation :
It allows you to show or hide that section in the site header

ws:article
Template Name
User can define rendition template for this particular asset

latest.articles – ws:webassetCollection
Asset can be displayed two ways
1.Static asset collection – You may select assets manually to display in that particular section
2.Dynamic asset collection – You may provide query to include asset dynamically on a scheduled basis.
Query Language:
It allows you to render content dynamically by specifying either cmis-alfresco query string or by lucene.
Query:
Specify query - which asset should be included or excluded dynamically
Maximum Size :
Maximum number of assets to display
Minutes To Query Refresh:
Query will be fired within given time interval
Web Assets:
User can select web asset manually to display for that section

Create a web content
Select the section folder where you want to create an article. Create a content with mime type HTML.
You can add image from its Edit metadata page

Visitor feedback comment
Comment in quick start is stored in Data List page
You can check Visitor Feedback list which contains different column like comment, rating, asset on which it has been commented etc.
Different actions are available - Edit, Delete and Duplicate

How to Publish the web content
Content can be published using workflows. If content gets approved then content is copied from Quick Start Editorial folder to the Quick Start Live folder.

There are two workflows available in Share
1.Review and Publish Section Structure - Enables you to review and publish the structure of a section of the website
2.Review and Publish - Enables you to review and publish web content

To publish particular section, initialize workflow on that section's index.html. It will publish that section folder, collection folder as well its subsection folders.
To publish the content you must initialize the Review and Publish workflow