Monday, April 19, 2010

Creating a new Alfresco module to change the Alfresco Footer.

Hi., Here I am going to explain about to change the default footer of alfresco.

follow the below steps .

Step1: Create java project with  the structure as shown below in eclipse



Step2: Import the Alfresco related files to change the UI of it.suppose here i want to change  login page and the footer of the alfresco so., lets start to import the files to alfresco as shown below with below structure.

Step3: copy the below code for build.xml file.

<?xml version="1.0"?>

<project name="Sample Module" default="package-amp" basedir=".">

<property name="project.dir" value="." />
<property file="${project.dir}/build.properties" />
<property file="${project.dir}/module.properties" />

<property name="build.dir" value="${project.dir}/build" />
<property name="config.dir" value="${project.dir}/config" />
<property name="jar.file" value="${build.dir}/lib/${module.id}.jar" />
<property name="amp.file" value="${build.dir}/dist/${module.id}.amp" />

<target name="mkdirs">
<mkdir dir="${build.dir}/dist" />
<mkdir dir="${build.dir}/lib" />
<mkdir dir="${build.dir}/classes" />
</target>

<path id="class.path">
<dirset dir="${build.dir}" />
<fileset dir="${project.dir}/lib" includes="**/*.jar" />
<!-- fileset dir="${alfresco.sdk.dir}/lib/server" includes="**/*.jar" / -->
</path>

<target name="clean">
<delete dir="${build.dir}" />
</target>

<target name="compile" depends="mkdirs">
<javac classpathref="class.path" debug="${debug}" srcdir="${project.dir}/source/java" destdir="${build.dir}/classes" target="1.5" encoding="UTF-8" />
<copy todir="${build.dir}/classes">
<fileset dir="${project.dir}/source/java" defaultexcludes="false">
<exclude name="**/*.java" />
<exclude name="**/.svn/**" />
<exclude name="**/CVS/**" />
</fileset>
</copy>
</target>

<target name="package-jar" depends="compile">
<jar destfile="${jar.file}" encoding="UTF-8">
<fileset dir="${build.dir}/classes" excludes="**/custom*,**/*Test*" defaultexcludes="false" />
</jar>
</target>

<target name="package-amp" depends="package-jar" description="Package the Module">
<zip destfile="${amp.file}" encoding="UTF-8">
<fileset dir="${project.dir}/build" includes="lib/*.jar" />
<fileset dir="${project.dir}" includes="config/**/*.*" excludes="**/module.properties" />
<fileset dir="${project.dir}">
<include name="module.properties" />
<include name="file-mapping.properties" />
<include name="WEB-INF/**/*" />
<exclude name="WEB-INF/alfresco.tld" />
<exclude name="WEB-INF/repo.tld" />
</fileset>
<zipfileset dir="source/web" prefix="web" />
</zip>
</target>
</project>

Step4: for pagetag.java., copy the below code ., and change the code as follows., which is high lated in red color.
-------------------------------------------------------------------------------------------------------------

 /*
* Copyright (C) 2005-2010 Alfresco Software Limited.
 *
 * This file is part of Alfresco
 *
 * Alfresco is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Alfresco is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Alfresco. If not, see .
 */
package org.alfresco.web.ui.repo.tag;

import java.io.IOException;
import java.io.Writer;

import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import org.alfresco.web.app.Application;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.coci.CCProperties;
import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * A non-JSF tag library that adds the HTML begin and end tags if running in servlet mode
 * 
 * @author gavinc
 */
public class PageTag extends TagSupport
{
   private static final long serialVersionUID = 8142765393181557228L;
   
   private final static String SCRIPTS_START = "\n";
   private final static String STYLES_START  = "\n";

   private final static String[] SCRIPTS = 
   {
      // menu javascript
      "/scripts/menu.js",
      // webdav javascript
      "/scripts/webdav.js",
      // base yahoo file
      "/scripts/ajax/yahoo/yahoo/yahoo-min.js",
      // io handling (AJAX)
      "/scripts/ajax/yahoo/connection/connection-min.js",
      // event handling
      "/scripts/ajax/yahoo/event/event-min.js",
      // mootools
      "/scripts/ajax/mootools.v1.11.js",
      // common Alfresco util methods
      "/scripts/ajax/common.js",
      // pop-up panel helper objects
      "/scripts/ajax/summary-info.js",
      // ajax pickers
      "/scripts/ajax/picker.js",
      "/scripts/ajax/tagger.js"
   };
   
   private final static String[] CSS = 
   {
      "/css/main.css",
      "/css/picker.css"
   };

/**
 * Please ensure you understand the terms of the license before changing the contents of this file.
 */
   
   private final static String ALF_LOGO_HTTP  = "http://www.alfresco.com/assets/images/logos/community-edition-3.3.png";
   private final static String ALF_LOGO_HTTPS = "https://www.alfresco.com/assets/images/logos/community-edition-3.3.png";
   private final static String ALF_URL   = "http://www.alfresco.com";
   private final static String ALF_TEXT  = "Alfresco Community";
   private final static String ALF_COPY  = "Supplied free of charge with " +
        "no support, " +
        "no certification, " +
        "no maintenance, " +
        "no warranty and " +
        "no indemnity by " +
        "Alfresco or its " +
        "Certified Partners. " +
        "Click here for support. " +
        "Alfresco Software Inc. © 2005-2010 All rights reserved.";
   
   private final static Log logger = LogFactory.getLog(PageTag.class);
   private static String alfresco = null;
   private static String loginPage = null;
   
   private long startTime = 0;
   private String title;
   private String titleId;
   private String doctypeRootElement;
   private String doctypePublic;
   private String doctypeSystem;
   
   /**
    * @return The title for the page
    */
   public String getTitle()
   {
      return title;
   }

   /**
    * @param title Sets the page title
    */
   public void setTitle(String title)
   {
      this.title = title;
   }
   
   /**
    * @return The title message Id for the page
    */
   public String getTitleId()
   {
      return titleId;
   }

   /**
    * @param titleId Sets the page title message Id
    */
   public void setTitleId(String titleId)
   {
      this.titleId = titleId;
   }

   public String getDoctypeRootElement()
   {
      return this.doctypeRootElement;
   }

   public void setDoctypeRootElement(final String doctypeRootElement)
   {
      this.doctypeRootElement = doctypeRootElement;
   }
   
   public String getDoctypePublic()
   {
      return this.doctypePublic;
   }

   public void setDoctypePublic(final String doctypePublic)
   {
      this.doctypePublic = doctypePublic;
   }

   public String getDoctypeSystem()
   {
      return this.doctypeSystem;
   }
   
   public void setDoctypeSystem(final String doctypeSystem)
   {
      this.doctypeSystem = doctypeSystem;
   }
   
   public void release()
   {
      super.release();
      this.title = null;
      this.titleId = null;
      this.doctypeRootElement = null;
      this.doctypeSystem = null;
      this.doctypePublic = null;
   }

   /**
    * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
    */
   public int doStartTag() throws JspException
   {
      if (logger.isDebugEnabled())
         startTime = System.currentTimeMillis();
      
      try
      {
         String reqPath = ((HttpServletRequest)pageContext.getRequest()).getContextPath();
         Writer out = pageContext.getOut();
         
         if (!Application.inPortalServer())
         {
            if (this.getDoctypeRootElement() != null &&
                this.getDoctypePublic() != null)
            {
               out.write("\n");
            }
            else
            {
               out.write("\n");
            }
            out.write("\n");
            out.write("\n");
            out.write("\n");
            out.write("\n");
         }
         
         // CSS style includes
         for (final String css : PageTag.CSS)
         {
            out.write(STYLES_START);
            out.write(reqPath);
            out.write(css);
            out.write(STYLES_MAIN);
         }
         
         // JavaScript includes
         for (final String s : PageTag.SCRIPTS)
         {
            out.write(SCRIPTS_START);
            out.write(reqPath);
            out.write(s);
            out.write(SCRIPTS_END);
         }
         
         out.write("\n"); // end - generate naked javascript code

         if (!Application.inPortalServer())
         {
            out.write("");
            out.write("\n");
         }
      }
      catch (IOException ioe)
      {
         throw new JspException(ioe.toString());
      }
      
      return EVAL_BODY_INCLUDE;
   }

   /**
    * @see javax.servlet.jsp.tagext.TagSupport#doEndTag()
    */
   public int doEndTag() throws JspException
   {
      try
      {
         HttpServletRequest req = (HttpServletRequest)pageContext.getRequest();
         if (req.getRequestURI().endsWith(getLoginPage()) == false)
         {
            pageContext.getOut().write(getAlfrescoButton());
         }
         
         if (!Application.inPortalServer())
         {
            pageContext.getOut().write("\n");
         }
      }
      catch (IOException ioe)
      {
         throw new JspException(ioe.toString());
      }
      
      if (logger.isDebugEnabled())
      {
         long endTime = System.currentTimeMillis();
         logger.debug("Time to generate page: " + (endTime - startTime) + "ms");
      }
      
      return super.doEndTag();
   }
   
   private String getLoginPage()
   {
      if (PageTag.loginPage == null)
      {
         PageTag.loginPage = Application.getLoginPage(pageContext.getServletContext());
      }
      
      return PageTag.loginPage;
   }

/**
 * Please ensure you understand the terms of the license before changing the contents of this file.
 */

   private String getAlfrescoButton()
   {
      if (PageTag.alfresco == null)
      {
         final HttpServletRequest req = (HttpServletRequest)pageContext.getRequest();
 
PageTag.alfresco = ("<center><table style='margin: 0px auto;'><tr><td>"  
                             "<a href='"   ALF_URL   "'>"  
                             "<img style='vertical-align:middle;border-width:0px;' alt='' title='"   ALF_TEXT   
                             "' src='"   reqPath   ALF_LOGO   "'/>"  
                             "</a></td><td align='center'>"  
                             "<span class='footer'>"   ALF_COPY  
                             "</span></td><td>"  
                             "</td></tr></table></center>");
      }
      return PageTag.alfresco;
   }

   /**
    * This method generate code for setting window.onload reference as
    * we need to open WebDav or CIFS URL in a new window.
    * 
    * Executes via javascript code(function onloadFunc()) in "onload.js" include file.
    * 
    * @return Returns window.onload javascript code
    */
   private static void generateWindowOnloadCode(Writer out)
      throws IOException
   {
      FacesContext fc = FacesContext.getCurrentInstance();
      if (fc != null)
      {
          CCProperties ccProps = (CCProperties)FacesHelper.getManagedBean(fc, "CCProperties");
          if (ccProps.getWebdavUrl() != null || ccProps.getCifsPath() != null)
          {
             out.write("window.onload=onloadFunc(\"");
             if (ccProps.getWebdavUrl() != null)
             {
                out.write(ccProps.getWebdavUrl());
             }
             out.write("\",\"");
             if (ccProps.getCifsPath() != null)
             {
                String val = ccProps.getCifsPath();
                val = Utils.replace(val, "\\", "\\\\");   // encode escape character
                out.write(val);
             }
             out.write("\");");
             
             // reset session bean state
             ccProps.setCifsPath(null);
             ccProps.setWebdavUrl(null);
          }
      }
   }
}
----------------------------------------------------------------------------------
here i want to change  the following code to change the footer of alfresco.
   
   private final static String ALF_URL   = "http://aboutalfresco.blogspot.com/";
   private final static String ALF_LOGO  = "/images/MySite/footer_logo.gif";
   private final static String ALF_TEXT  = "Chandu Enterprise";
   private final static String ALF_COPY  = "Certified and supported. Chandu Software Inc. © 2005-2009 All rights reserved.";

Step5: add these jar files in lib



Step6: change remaining files  as per our requirement., here i changed login.jsp, relogin.jsp, getting-started.jsp, titlebar.jsp, error.jsp, noaccess.jsp.

Step7: add the below code in module.properties.





module.id=MySite-AlfrescoNewUI
module.title=MySite UI Project
module.description=MySite Project to build an amp file
module.version=1.0

Step8: Then go to build.xml ., right click on it then click on run as ant build. you will get the amp file in dist.as shown below.



Step9:  paste this amp file in to alfresco amp folder and click on apply_amps., then restart the server you can find the changes what you made.










Wednesday, April 7, 2010

Access the full Alfresco repository from the Share user interface

Alfresco 3.2r introduces the ability to access the full alfresco repo from share user interface

Here few steps are there.

step1: go to to tomcat\shared\classes\alfresco\web-extension
step2: rename the share-config-custom.xml.sample to share-config-custom.xml
step3: change the xml file as shown below which is marked in red color.


   <config evaluator="string-compare" condition="RepositoryLibrary" replace="true">
      <!--
         Whether the link to the Repository Library appears in the header component or not.
      -->
      <visible>true</visible>

      <!--
         Root nodeRef for top-level folder.
      -->
      <root-node>alfresco://company/home</root-node>

      <!--
         Whether the folder Tree component should enumerate child folders or not.
         This is a relatively expensive operation, so should be set to "false" for Repositories with broad folder structures.
      -->
      <tree>
         <evaluate-child-folders>false</evaluate-child-folders>
      </tree>
   </config>

step4: restart the server, then go to share admin dashboard you will find the screen as follows then click on repository.


step5: in the left side of the screen you can find the alfresco repository files as shown below.

Tuesday, March 30, 2010

Alfresco Record Management

Here i am going to explain about Record Management in alfresco.

Here is the nice Introduction about Record Management.


generally we have community edition and enterprise edition.,

for community user download the amp from here.., http://process.alfresco.com/ccdl/?file=release/community/build-2440/AlfrescoRMCommunity-3.2r2-Setup.exe

here i am using 3.2r verion., if you are an enterprise user you can download from amp files from network.alfresco.com

but there are some issues while using this amp., better to go for community edition.

follow these steps to RM in share

1.after installing alfresco RM module, go to share and login as admin with valid credentials.

2.click on customise-dashboard link

3. add  RecordManagement config dashlet as shown below..



4.You will get a this dashlet in  share administrator Dashboard as shown below.



5. Click on Record Management Site  u can find the screen as follows....


6. Here i attached one document for RM brief Introduction., which will  explain about alfresco RM in share


7. and video tutorial here.



Saturday, March 13, 2010

Alfresco Video Tutorials


Custom Data Lists in Alfresco 3.3





Try Create Record Categories, Set Security and Configure Disposition Schedules





Alfresco Records Management Administration Console





Spring Surf and OpenCMIS Integration






latest rules UI In Alfresco Share





Installing Alfresco on Windows




Tuesday, February 23, 2010

Accessing Alfresco repository in Share.

Hi, Here i am trying to explain how to access alfresco repository in alfresco share.

Here i am going to create a dashlet that will display all the spaces and content for particular site based upon site name.

(note: every time alfresco will create space or content in Company Home > Sites , which is depends upon site activities in alfresco share.)


Step1: Create a site in share, name it as chandu as follows



Step2: next go to alfresco and  create webscript  in alfreso for that we need two files create those two files

a)siteacts.get.desc.xml
b)siteacts.get.json.ftl

code to add in siteacts.get.desc.xml
-------------------------------------------------------------------------------------------------------
 <webscript>
    <shortname>Document Property</shortname>
    <description>It provides documents name and date of creation and Creator property</description>
    <url>/sample/siteacts.json?siteName={sitename)</url>
    <authentication>user</authentication>
    <transaction>required</transaction>
</webscript>
--------------------------------------------------------------------------------------------------------

code to add in siteacts.get.json.ftl
---------------------------------------------------------------------------------------------------------
{
<#assign dateformat="yyyy/MM/dd">
"siteacts" : [

<#macro recurse_macro node>

<#if node.isContainer>
{
    "name" : "${node.properties.name}" ,
  
    "creator" : "${node.properties.creator}",

   "createdDate" : "${node.properties.created?string(dateformat)}"
 },

<#list node.children as child>
    <#if child.isContainer>
         <@recurse_macro node=child/>
    <#else>
 {   
    "name" : "${child.properties.name}" ,
  
    "creator" : "${child.properties.creator}",

   "createdDate" : "${child.properties.created?string(dateformat)}"
 }
  ,</#if>
    </#list>
</#if>
</#macro>

<@recurse_macro node=companyhome.childByNamePath["Sites/${args.siteName}"] />

]
}
-----------------------------------------------------------------------------------------------------------
Step3: add these two files into
                      Company Home > Data Dictionary > Web Scripts > org > alfresco > sample 

Refresh the webscripts , for this go to  http://localhost:8080/alfresco/service/, click on Click on Refresh Web Scripts.

if is it successfully completed you will get the message like

Maintenance Completed
Reset Web Scripts Registry; registered 335 Web Scripts. Previously, there were 334.

      then check the webscript using below URI


http://localhost:8080/alfresco/service/sample/siteacts.json?siteName=chandu


here add the name of the site that you need. in my case it is chandu.


you will get the output will be like this
------------------------------------------------------------------------------------------------------------------------------
{
"siteacts" : [



{
    "name" : "chandu" ,
  
    "creator" : "admin",

   "createdDate" : "2010/02/23"
 },


{
    "name" : "documentLibrary" ,
  
    "creator" : "admin",

   "createdDate" : "2010/02/23"
 },



{
    "name" : "links" ,
  
    "creator" : "admin",

   "createdDate" : "2010/02/23"
 },



]
}

------------------------------------------------------------------------------------------------------

Step4: next step is to create dashlet in the share. for that we need three files.

a)siteacts.get.desc.xml
b)siteacts.get.html.ftl
c)siteacts.get.js

code for siteacts.get.desc.xml
-----------------------------------------------------------------------------------------
<webscript>
   <shortname>Site Activities</shortname>
   <description>Dashlet to list Site Activities from Alfresco</description>
   <family>site-dashlet</family>
   <url>/components/dashlets/siteactivites</url>
</webscript>
-------------------------------------------------------------------------------------------
note that here i added this as site dashlet not a user dashlet. code to add in siteacts.get.js

----------------------------------------------------------------------------------------
var connector = remote.connect("alfresco");
var data = connector.get("/sample/siteacts.json?siteName=" + page.url.templateArgs.site);

// create json object from data
var result = eval('(' + data + ')');
model.siteactivites= result["siteacts"];
------------------------------------------------------------------------------------------
code to add in siteacts.get.html.ftl
------------------------------------------------------------------------------------
<table>
<tr>
    <th>Name </th>
    <th>Creator </th>
    <th>Date of Creation </th>
</tr>
<#list siteactivites as x>
<tr>
    <td>${x.name}</td>
    <td>${x.creator}</td>
    <td>${x.createdDate}</td>
</tr>
</#list>
</table>
------------------------------------------------------------------------------------
place all these files into
\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\dashlets


Step5: next refresh the share webscripts using this URI http://localhost:8080/share/service/

click on refresh webscripts. is it is successes you will get the message like. as follows

Maintenance Completed
Reset Web Scripts Registry; registered 176 Web Scripts. Previously, there were 175.

next go to the site http://localhost:8080/share/page/site/chandu/dashboard

click on customise dashboard ., and add dashlet in to the site .


the dashlet will be updated if any activites performed on this site.

download the entire code here download code .

Thursday, February 4, 2010

Creating New Model And Advance Search Configuration.

We can add new Models in Alfresco with two ways.

Procedure-1:
        Create a new model XML file with the name exampleModel.xml ( although this may be any name as required). register this model with the repository by using another file called example-model-context.xml.
create one properties file as webclient.properties.and add property sheet for model in web-client-config-custom.xml.
               place these  files in to \tomcat\shared\classes\alfresco\extension.
          restart the server and you will get the new model values in alfresco.
Procedure-2:  
          here also we need to create model file exampleModel.xml,  webclient.properties, web-client-config-custom.xml.but place the  exampleModel.xml into Data Dictionary > Models
and  webclient.properties, web-client-config-custom.xml into Data Dictionary > Web Client Extension.
      Then go to web client admin console(http://localhost:8080/alfresco/faces/jsp/admin/webclientconfig-console.jsp) and type reload to reload the web client.

while uploading  exampleModel.xml in the first procedure make sure that model should be in Active. please check the model active box.and here we no need to restart the server.

Next  i am going to explain about the first procedure to create new model.

In Every Model it Contains the following Information
  1.Definition of new Model
  2.Importing Alfresco Dictionary Definitions.
  3.Introduction of new name spaces defined by model.
  4. Definition of new Content Type.


1.Definition of new Model

  <model name="tm:mynewmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

Here i written my Model name as tm:mynewmodel. . if we required any more information we can write the following code to know about model.

<description>Example custom Model</description>
<author>Chandu</author>
<version>1.0</version>


2.Importing Alfresco Dictionary Definitions.
If you need to import any new model you need to write import statement as follows.

 <imports>
        <!-- Import Alfresco Dictionary Definitions -->
        <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
        <!-- Import Alfresco Content Domain Model Definitions -->
        <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
 </imports>

3.Introduction of new namespaces defined by  model.

<namespaces>
        <namespace uri="http://www.chandu.com/model/content/1.0" prefix="tm" />
    </namespaces>

4. Definition of new Content Type:
here i am taking 3 types in model.  i.e, Production Dept,Finance Dept,Testing Dept. in this each dept type i added one mandatory-aspect. to add poperties for particular  dept. in the next step i will add aspects.
 ----------------------------------------------------------------------------------------------------
<types>
        <type name="tm:production">
            <title>Production Department</title>
            <parent>cm:content</parent>
            <mandatory-aspects>
                <aspect>cm:generalclassifiable</aspect>
                <aspect>tm:productionDetails</aspect>
            </mandatory-aspects>
        </type>
        <type name="tm:finance">
            <title>My Company Finance Department</title>
            <parent>cm:content</parent>
            <mandatory-aspects>
                <aspect>cm:generalclassifiable</aspect>
                <aspect>tm:financeDeptDetails</aspect>
            </mandatory-aspects>
        </type>
        <type name="tm:testing">
            <title>My Company Testing Department</title>
            <parent>cm:content</parent>
            <mandatory-aspects>
                <aspect>cm:generalclassifiable</aspect>
                <aspect>tm:testingDeptDetails</aspect>
            </mandatory-aspects>
        </type>
</types>
-------------------------------------------------------------------------------------------------------
It is very important to follow a specific sequence while defining a new content model.
here is the code for aspects.
--------------------------------------------------------------------------------------
<aspects>
    <aspect name="tm:productionDetails">
        <title>Compnay Prodution Department</title>
            <properties>
                <property name="tm:productid">
                    <type>d:text</type>
                    <index enabled="true">
                        <atomic>true</atomic>
                        <stored>true</stored>
                        <tokenised>true</tokenised>
                    </index>
                </property>
                <property name="tm:productName">
                    <type>d:text</type>
                    <index enabled="true">
                        <atomic>true</atomic>
                        <stored>true</stored>
                        <tokenised>true</tokenised>
                    </index>
                </property>
            </properties>
    </aspect>
    <aspect name="tm:financeDeptDetails">
        <title>Compnay Finance Department</title>
            <properties>
                <property name="tm:financedeptid">
                    <type>d:text</type>
                    <index enabled="true">
                        <atomic>true</atomic>
                        <stored>true</stored>
                        <tokenised>true</tokenised>
                    </index>
                </property>
                <property name="tm:financedeptloc">
                    <type>d:text</type>
                    <index enabled="true">
                        <atomic>true</atomic>
                        <stored>true</stored>
                        <tokenised>true</tokenised>
                    </index>
                </property>
            </properties>
    </aspect>   
    <aspect name="tm:testingDeptDetails">
        <title>Compnay Testing Department</title>
        <properties>
                <property name="tm:testingdeptid">
                    <type>d:text</type>
                    <index enabled="true">
                        <atomic>true</atomic>
                        <stored>true</stored>
                        <tokenised>true</tokenised>
                    </index>
                </property>
                <property name="tm:testingdeptloc">
                    <type>d:text</type>
                    <index enabled="true">
                        <atomic>true</atomic>
                        <stored>true</stored>
                        <tokenised>true</tokenised>
                    </index>
                </property>
            </properties>
    </aspect>
</aspects>
------------------------------------------------------------------------------------------------------
If the attribute enabled for index is set to true, then this property will be indexed in
the search engine. If this is false, there will be no entry for this property in the index.
If the option Atomic is set to true, then the property is indexed in the transaction. If
not, the property is indexed in the background.

If the option Stored is set to true, then the property value is stored in the index and
may be obtained through the Lucene low-level query API.

If the option Tokenized is set to true, then the string value of the property is
tokenized before indexing; if it is set to false, then it is indexed as it is, as a single
string.

next step is to write UI code in web-client-config-custom.xml.

------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8" ?>

<alfresco-config>
   
    <config evaluator="aspect-name" condition="tm:productionDetails">
        <property-sheet>
            <separator name="prod" display-label-id="prodDeptHeader" component-generator="HeaderSeparatorGenerator" />
            <show-property name="tm:productid" display-label-id="productid" />
            <show-property name="tm:productName" display-label-id="productName"/>           
        </property-sheet>
    </config>
    <!--  add aspect properties to property sheet -->
    <config evaluator="aspect-name" condition="tm:financeDeptDetails">
        <property-sheet>
           <separator name="finan" display-label-id="finanDeptHeader" component-generator="HeaderSeparatorGenerator" />
            <show-property name="tm:financedeptid" display-label-id="financedeptid" />
            <show-property name="tm:financedeptloc" display-label-id="financedeptloc"/>
        </property-sheet>
    </config>
    <config evaluator="aspect-name" condition="tm:testingDeptDetails">
        <property-sheet>
            <separator name="test" display-label-id="testingDeptHeader" component-generator="HeaderSeparatorGenerator" />
            <show-property name="tm:testingdeptid" display-label-id="testingdeptid" />
            <show-property name="tm:testingdeptloc" display-label-id="testingdeptloc"/>
        </property-sheet>
    </config>
      
  
    <!--  add types to add content list -->
    <config evaluator="string-compare" condition="Content Wizards">
        <content-types>
            <type name="tm:production"/>
            <type name="tm:finance"/>
            <type name="tm:testing"/>
        </content-types>
    </config>
    <config evaluator="string-compare" condition="Action Wizards">
        <aspects>
            <aspect name="tm:productid" />
            <aspect name="tm:productName"/>
            <aspect name="tm:financedeptid"/>
            <aspect name="tm:financedeptloc"/>
            <aspect name="tm:testingdeptid"/>
            <aspect name="tm:testingdeptloc"/>
        </aspects>       
        <specialise-types>
            <type name="tm:production"/>
            <type name="tm:finance"/>
            <type name="tm:testing"/>
        </specialise-types>
    </config>

</alfresco-config>
-------------------------------------------------------------------------------------------------------
next step is to write properties file for above configuration. i.e., webclient.properties
create a file with webclient.properties and add the below code.

------------------------------------------------------------------
#Prodution Department
prodDeptHeader = Production Department
productid = Product ID
productName = Product Name

#Finance Department
finanDeptHeader = Finance Department
financedeptid = Finance Dept ID
financedeptloc = Dept Location

#Testing Department
testingDeptHeader = Testing Department
testingdeptid = Testing Dept ID
testingdeptloc = Testing Location
------------------------------------------------------------------

next step is register this model with the repository. for that add a new file as  example-model-context.xml.
 add  the 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>

    <!-- Registration of new models -->   
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/exampleModel.xml</value>
            </list>
        </property>
    </bean>
         
</beans>
-------------------------------------------------------------------------------------------------

place these  files in to \tomcat\shared\classes\alfresco\extension.
Restart the server and add some content u will get the screen as shown below.
if you want to select Production Department, select that one click next




you will find the screen as shown below with two additional properties.




Our next step is to make these model as searchable. for that we need to add some code to  web-client-config-custom.xml

that i will explain as followed


Advance Search Configuration:

to get the Properties in advance search which we are created just now using above Model we need to add the following code

--------------------------------------------------------------------------------
<config evaluator="string-compare" condition="Advanced Search">
        <advanced-search>
            <folder-types>
             </folder-types>
            <content-types>
                <type name="tm:production"/>
                <type name="tm:finance"/>
                <type name="tm:testing"/>
            </content-types>
            <custom-properties>
                <meta-data aspect="tm:productionDetails" property="tm:productidr" display-label-id="productid"/>
                <meta-data aspect="tm:financeDeptDetails" property="tm:financedeptloc" display-label-id="financedeptloc" />
                <meta-data aspect="tm:testingDeptDetails" property="tm:testingdeptloc" display-label-id="testingdeptloc" />              
            </custom-properties>
        </advanced-search>
    </config>
----------------------------------------------------------------------------

Restart the server

and click on advance search which is at right corner of alfresco. you will find the ui as shown below.



Thanks.

Tuesday, February 2, 2010

Audit Surf

 In Previous post i explained about to enable audit. and also how to enable debugging.

here i will explain about audit surf which was created by atolcd .

you can download the code from forge. Click Here.

different versions of audit surf is availabe  in this forge .


Here is the best article to understand  the audit surf.

Audit Surf Article

i will explain more about to customize audit surf.