Wednesday, November 3, 2010

Alfresco Task History

Article reference from

Step1 : Download entire code from  taskhistory.zip

Step2: Go to tomcat\webapps\alfresco\WEB-INF replace  faces-config-custom.xml with your downloaded  file.

Step3: Go to tomcat\webapps\alfresco\jsp\content  replace  document-details.jsp with your downloaded  file.

Step4: Go to tomcat\webapps\alfresco\WEB-INF\classes\alfresco\messages add your code into   webclient.properties don't replace the file.

Step5: Go to tomcat\webapps\alfresco\WEB-INF\lib and add custom-jsp.jar

Step6: Restart the server




Tuesday, November 2, 2010

Workflow in Share

Hi

here i  will explain about workflows in share , it will work for enterprise and community editions also with 3.4 version.

Step1: we can start work flow in two ways

a) From actions along right side on an item row in the list of Document Library items

b) By Clicking on the "Start Workflow" action links on document details page


Step2: after click on "start workflow",  you will get start work flow page with drop down on that page like as follows


Step3: For example select Adhoc (Assign task to colleague) from the drop down, then it will displays a form to enter parameters that defines work flow.  


If we need to add new custom work flow  follows these steps ( code from wiki page http://wiki.alfresco.com/wiki/WorkflowSample_Lifecycle)

Step4:  Go to \shared\classes\alfresco\extension folder  rename 

lifecycle_processdefinition.xml.sample to   lifecycle_processdefinition.xml
lifecycle-workflow-context.xml.sample to   lifecycle-workflow-context.xml
lifecycleModel.xml.sample to   lifecycleModel.xml
lifecycle-messages.properties.sample to    lifecycle-messages.properties

if you are not able to find those files copy these code and place those files into   \shared\classes\alfresco\extension folder 


Custom WorkFlow Code

Step5:  type this url in browser http://localhost:8080/alfresco/faces/jsp/admin/workflow-console.jsp

then enter

  deploy alfresco/extension/lifecycle_processdefinition.xml

Click on submit.




Step5: Restart the server then follow above procedure you will get your custom work flow in start workflow drop down list as shown

Thursday, August 12, 2010

Alfresco : JMX

JMX means Java Management Extensions (JMX) Technology

                                           The JMX technology provides the tools for building distributed, Web-based, modular and dynamic solutions for managing and monitoring devices, applications, and service-driven networks. By design, this standard is suitable for adapting legacy systems, implementing new management and monitoring solutions, and plugging into those of the future.

JMX in Alfresco
                        By default, system administrators can reconfigure Alfresco by shutting down the server, editing certain property and configuration files and then restarting the server. However, there are certain support operations that System Administrators would like to perform on-demand at runtime without needing to restart the server. For example, it should be possible to temporarily change log levels in order to debug and/or troubleshoot a live system.
                          In addition, as an Enterprise Only feature, Alfresco contains various subsystems that may be configured and restarted without needing to restart the entire alfresco repository.

In order to open JMX 

Step1: Start Alfresco

Step2:Go  C:\Program Files (x86)\Java\jdk1.6.0_18\bin ,(i.e., /bin/jconsole. ) double click on jconsole.exe this will open screen like as follows.

             select Local Process and enter 
                        JMX Username: controlRole
                        JMX Password: change_asap  and then click on Connect.





then select Bean you can made change as you like the window will like follows.



The best way to tell what all of your properties are is to hit: 
                    http://localhost:8080/alfresco/faces/jsp/admin/jmx-dumper.jsp 

Friday, July 9, 2010

Java-Backed Web Scripts

Hi., in this article i will explain about how to write Java backed web script in alfresco,if you are new to java this article may more helpful to you.just i will explain more which we have same thing in wiki i.e., http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples  

                      Java class is the controller rather than JavaScript .basically JavaScript is very light weighted language even we can write webscrpit using simple JavaScript but there are some reasons to write using Java.

1.accessing alfresco application services not available via JavaScript API
2.when the performance is absolutely critical
3.to get tighter control of the generated response.
4.when we need to access the Alfresco API
5.if we prefer stronger programming language like JAVA

the construction view for this script is shown below.


Example1:
                    in this example i will explain simple java backed webscript  step wise which is in http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples


Step1: use eclipse  to get the class file for a java code very easily.here i am using in same way.

a) create a java project in eclipse name it as java-backed-webscripts
b)create a folder and name it as lib import the jar files to this file from                 \tomcat\webapps\alfresco\WEB-INF\lib
c)create on more folder in the project and name it as source
d)right click the source folder then go to new>file name it as SimpleWebSript.java
                copy the below code in that
--------------------------------------------------------------------------------------------------------
package org.alfresco.module.demoscripts;

import java.io.IOException;

import org.alfresco.web.scripts.AbstractWebScript;
import org.alfresco.web.scripts.WebScriptException;
import org.alfresco.web.scripts.WebScriptRequest;
import org.alfresco.web.scripts.WebScriptResponse;
import org.json.JSONException;
import org.json.JSONObject;

public class SimpleWebScript extends AbstractWebScript
{
    public void execute(WebScriptRequest req, WebScriptResponse res)
        throws IOException
    {
     try
     {
    // build a json object
    JSONObject obj = new JSONObject();
   
    // put some data on it
    obj.put("field1", "data1");
   
    // build a JSON string and send it back
    String jsonString = obj.toString();
    res.getWriter().write(jsonString);
     }
     catch(JSONException e)
     {
     throw new WebScriptException("Unable to serialize JSON");
     }
    }    
}

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


d)right click on the project and new>file -- create a file with the name build.xml
                  copy the code ass shown below.

------------------------------------------------------------------------------------------------------
<?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" />
</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">
</target>
</project>

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


e)create one more file  module.properties

module.id=JavaBackedWebScript
module.title=test web script
module.description=Project to get class file for webscripts
module.version=1.0

f)then right click on build.xml  --> run as --> AntBuild

it will create a class file and jar file. in build folder. copy this jar file and paste it into  \tomcat\webapps\alfresco\WEB-INF\lib.

Step2: next  step is to declaring the webscript to spring  add the below code in web-scripts-application-context.xml, which is  /tomcat/webapps/alfresco/WEB-INF/classes/alfresco

<bean id="webscript.org.alfresco.demo.simple.get" 
      class="org.alfresco.module.demoscripts.SimpleWebScript"
      parent="webscript">
</bean>

Step3: next go to /tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco and create a folder and name it as demo

and then create a file in this folder with the name simple.get.desc.xml then add the below code in that  

<webscript>
  <shortname>The World's Simplest Webscript</shortname>
  <description>Hands back a little bit of JSON</description>
  <url>/demo/simple</url>
  <authentication>none</authentication>
  <format default="">argument</format>
</webscript>

Step4:  Just  restart the server and type this url in the browser 

      http://localhost:8080/alfresco/service/demo/simple

the JSON will return { “field1” : “data1” } 


Example 2:

Monday, June 14, 2010

Alfresco-Google Docs Integration

Steps For Google Docs Integration in Alfresco


this is integration in alfresco 3.3 version

step1: Goto tomcat\shared\classes\alfresco\web-extension

rename share-config-custom.xml.sample to share-config-custom.xml

step2: open share-config-custom.xml file and false to true which is in bold.

<google-docs>
<!--
Enable/disable the Google Docs UI integration (Extra types on Create Content menu, Google Docs actions).
If enabled, remember to also make sure the gd:googleEditable aspect is made visible in the <aspects> section above.
-->
<enabled>true</enabled>

<!--
The mimetypes of documents Google Docs allows you to create via the Share interface.
The I18N label is created from the "type" attribute, e.g. google-docs.doc=Google Docs&trade; Document
-->
<creatable-types>
<creatable type="doc">application/msword</creatable>
<creatable type="xls">application/vnd.ms-excel</creatable>
<creatable type="ppt">application/vnd.ms-powerpoint</creatable>
</creatable-types>
</google-docs>



step3:

add aspect <aspect name="gd:googleEditable" />

step4:

Add this to your alfresco-global properties

# GoogleDocs configuration
googledocs.googleeditable.enabled=true
googledocs.username=yourname@youraddress.com
googledocs.password=yourgooglepassword

log4j.logger.org.alfresco.repo.googledocs=debug

step5: resart the tomcat server.

Here Added video tutorial from YouTube










Wednesday, April 28, 2010

Code to Hide Actions in Alfresco

Here i added code to hide delete option on space and document in alfresco, add the following code in web-client-config-custom.xml

<config>
<actions>
<action-group id="space_browse">
<show-link>false</show-link>
<action idref="delete_space" hide="true" />
</action-group>

<action-group id="browse_actions_menu">
<show-link>false</show-link>
<action idref="delete_space" hide="true" />
</action-group>


<action-group id="doc_details_actions">
<action idref="delete_doc" hide="true" />
</action-group>


<action-group id="space_details_actions">
<action idref="delete_space" hide="true" />
</action-group>

<action-group id="document_browse">
<show-link>false</show-link>
<action idref="delete_doc" hide="true" />
</action-group>

<action-group id="document_browse_menu">
<action idref="delete_space" hide="true" />
</action-group>

<action-group id="space_browse_menu">
<action idref="delete_space" hide="true" />
</action-group>

</actions>
</config>



Here i added code to hide copy & cut  options on space and document in alfresco, add the following code in web-client-config-custom.xml

<config>
<actions>
<action-group id="space_browse">
<show-link>false</show-link>
<action idref="cut_node" hide="true" />
<action idref="copy_node" hide="true" />
</action-group>

<action-group id="browse_actions_menu">
<show-link>false</show-link>
<action idref="cut_node" hide="true" />
<action idref="copy_node" hide="true" />
</action-group>

<action-group id="doc_details_actions">
<action idref="cut_node" hide="true" />
<action idref="copy_node" hide="true" />
</action-group>

<action-group id="space_details_actions">
<action idref="cut_node" hide="true" />
<action idref="copy_node" hide="true" />
</action-group>

<action-group id="document_browse">
<show-link>false</show-link>
<action idref="cut_node" hide="true" />
<action idref="copy_node" hide="true" />
</action-group>

<action-group id="document_browse_menu">
<action idref="cut_node" hide="true" />
<action idref="copy_node" hide="true" />
</action-group>

<action-group id="space_browse_menu">
<action idref="cut_node" hide="true" />
<action idref="copy_node" hide="true" />
</action-group>
</actions>
</config>

Monday, April 19, 2010

Alfresco Outlook configuration for IMAP

Follow these steps to configure outlook send mail to alfresco

step1:  go to  C:\Windows\System32\drivers\etc

here add  server name. just for testing i  added chandu.com as follows

127.0.0.1 chandu.com

Step2:  next open Microsoft outlook ., select  tools > account settings.

click on new ... it will open a wind follow some steps to add a new account

a.select Microsoft POP3,IMAP, HTTP.... click next
b. select manually configure server settings...... click next
c.select internet Email
d.fill the details as follows
----------------------------------------------------------------------------------
         your name                  :             pradeep
         EmailAdd                   :             pradeep@chandu.com
  Server Information
         Account Type             :            IMAP
         Incoming mail Ser        :           chandu.com
         Outgoing Mail ser        :           chandu.com
Logon Information
         username                    :            pradeep
         password                    :            *********
-----------------------------------------------------------------------------------

Click on next and finish.

Step3: all the above configuration is in outlook now., just  login to alfresco go to Administration Console
Click on Manage system users --> create user

then fill the new wizard details., make sure that  email id is pradeep@chandu.com


just finish that wizard.

Step4:  then go to company home and create one space., name it as you like., here i am creating the space with the name mycompany.
      click on mycompany -- > view details --> manage space users --> invite user.
search for the user pradeep and add that user as contributor or what ever that you want but make sure about permissions, 


Step5: go to mycompany space and go to view details and click on run action ., it will open run action wizard
select add aspect  and click on set values and add,  select Email Alias , then click on next  and finish that wizard.
 next edit this space property., and create Email Alias as some companyadmin




Step6: go to   \tomcat\shared\classes\alfresco\extension

unzip the custom-email-server.sample.zip file and change  custom-email-server.properties as follows


# Email Server properties
email.server.enabled=true
email.server.port=25
email.server.domain=chandu.com

Step7: go to  \tomcat\shared\classes  ---- > alfresco-global.properties uncomment these lines.


# IMAP
#-------------
imap.server.enabled=true
imap.server.port=143
imap.server.host=localhost


Step8: restart the server and go to outlook to compose a mail ., with to address as companyadmin@chandu.com.
 you will get mail as document in mycompany space. and also you can find the alfresco folders in outlook.


here some information is available and also screen shots also .

http://wiki.alfresco.com/wiki/IMAP


  

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 .