AnsweredAssumed Answered

Tutorial: Cambiar default  content type Add content Dialog

Question asked by dfernandezgonzalez on Jul 7, 2011
Latest reply on Sep 9, 2011 by cristinamr
Hola buenas, he creado un AMP para cambiar el tipo de contenido por defecto  al añadir un contenido .

Software necesario. Alfresco-community y alfresco-community-sdk tienen que coincidir en versión.

ALFRESCO http://process.alfresco.com/ccdl/?file=release/community/build-3370/alfresco-community-3.4.d-installer-linux-x64.bin.
ALFRESCO SDK  http://process.alfresco.com/ccdl/?file=release/community/build-3370/alfresco-community-sdk-3.4.d.zip

ALFRESCO MMT http://process.alfresco.com/ccdl/?file=release/community/build-2860/alfresco-mmt-3.3g.jar

Código fuente.

CARPETA RAÍZ (/)


1.1) build.xml




<?xml version="1.0"?>

<project name="Change Default Content" default="package-amp" basedir=".">

<property name="project.dir" value="." />
<property file="${project.dir}/amp-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/${lib.name}.jar" />
<property name="amp.file" value="${build.dir}/dist/${amp.name}.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-community-sdk-3.4.d/lib/server" includes="**/*.jar"/>
    <!– Tiene que indicar la ruta a esa carpeta dentro de alfresco-community-sdk-3.4.d –>
</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>


1.2) amp-build.properties


amp.name=NewModule
lib.name=NewModule

1.3) module.properties


module.id=org.alfresco.module.NewContent
module.title=NewContent Project
module.description=NewContent Project to build an amp file
module.version=1.0

1.4) file-mapping.properties


include.default=true
/web/WEB-INF=/WEB-INF


CARPETA  /config/alfresco/extension/model

2.1) customModel.xml


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

<!– Custom Model –>

<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>

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

   <!– Optional meta-data about the model –>
   <description>Custom Model</description>
   <author></author>
   <version>1.0</version>

   <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>

   <!– Introduction of new namespaces defined by this model –>
   <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="http://www.alfresco.org/model/custom/1.0" prefix="custom"/>
   </namespaces>
   <types>
                <type name="custom:contenido">
                        <title>Versionable Aspect</title>
                        <parent>cm:content</parent>
                        <mandatory-aspects>
                            <aspect>cm:versionable</aspect> <!– Contenidos versionables –>
                            <aspect>cm:generalclassifiable</aspect><!– Contenidos Categorizables –>
                        </mandatory-aspects>
                </type>
   </types>
</model>


CARPETA  /config/alfresco/extension

2.2)web-client-config-custom.xml



<alfresco-config>

    <config evaluator="string-compare" condition="Content Wizards">

     <content-types>
        <type name="custom:contenido"  display-label-id="custom_title" />
        <!–Se añade el nuevo tipo de contenido a la lista –>
     </content-types>

    </config>
   
    <config>
        <!-Indicamos la nueva jsp para el Bean AddContentDialog –>
        <dialogs>
            <dialog name="addContent" page="/jsp/extension/add-content-dialog.jsp" managed-bean="AddContentDialog"
             icon="/images/icons/add_content_large.gif" title-id="custom_add_content_dialog_title"
             description-id="custom_add_content_dialog_desc"/>
        </dialogs>
    </config>

     <config>
      <wizards>
         <!-Indicamos los nuevos pasos del Wizard Crear Contenido. Se añade paso 3 (selección de categorías) –>
         <wizard name="createContent" managed-bean="CustomCreateContentWizard"
                 title-id="custom_create_content_wizard_title"
                 description-id="create_content_desc"
                 icon="/images/icons/new_content_large.gif">
            <step name="details" title-id="details" description-id="create_content_step1_desc">
               <page path="/jsp/content/create-content-wizard/details.jsp"
                     title-id="create_content_step1_title"
                     description-id="create_content_step1_desc"
                     instruction-id="default_instruction" />
            </step>
            <step name="content" title-id="enter_content" description-id="create_content_step2_desc">
               <condition if="#{CreateContentWizard.mimeType == 'text/html'}">
                  <page path="/jsp/content/create-content-wizard/create-html.jsp"
                        title-id="create_content_step2_title"
                        description-id="create_content_step2_desc"
                        instruction-id="default_instruction" />
               </condition>
               <!– Default to the inline text editor –>
               <page path="/jsp/content/create-content-wizard/create-text.jsp"
                     title-id="create_content_step2_title"
                     description-id="create_content_step2_desc"
                     instruction-id="default_instruction" />
            </step>
            <step name="aspect" title-id="select_category" description-id="create_content_step3_desc">
               <page path="/jsp/extension/add-category.jsp"
                     title-id="create_content_step3_title"
                     description-id="create_content_step3_desc"
                     instruction-id="default_instruction" />
            </step>
            <step name="summary" title-id="summary" description-id="summary_step_description">
               <page path="/jsp/wizard/summary.jsp"
                     title-id="summary"
                     description-id="summary_desc"
                     instruction-id="content_finish_instruction" />
            </step>
         </wizard>
      </wizards>
   </config>


    <config evaluator="string-compare" condition="Languages" replace="true">
      <!– the list of available language files –>
        <languages>
                <language locale="es_ES">Spanish</language>
                <language locale="en_US">English</language>
                <language locale="it_IT">Italian</language>
                <language locale="fr_FR">French</language>
                <language locale="de_DE">German</language>
      </languages>
    </config>


   

 
    
</alfresco-config>


CARPETA  /config/alfresco/extension/messages

2.2)messages_newContent.properties


custom_add_content_dialog_title=Add Content Dialog
custom_add_content_dialog_desc=This dialog helps you to add content to a space.
custom_title=New  Content


custom_create_content_wizard_title=Create Content Wizard
select_category=Select a category
create_content_step3_title=Step Three - Select categories
create_content_step3_desc=Select categories to the content. Must have previously chosen the right model (New Content)

custom_title=New Content




CARPETA  /config/alfresco/extension/module/org.alfresco.module.NewContent/context

2.3)service-context.xml


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

<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
 

     <bean id="AddContentDialog" class="org.alfresco.module.NewContent.CustomAddContentDialog" >
       
    </bean>
   
</beans>


CARPETA  /config/alfresco/extension/module/org.alfresco.module.NewContent/

2.3)log4j.properties


log4j.logger.org.alfresco.module.NewContent.CustomAddContentDialog=debug


2.4)module-context.xml


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

    <import resource="classpath:alfresco/module/org.alfresco.module.NewContent/context/service-context.xml" />

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

    <!– Load the UI customizations –>
    <bean id="content.ConfigBootstrap" class="org.alfresco.web.config.WebClientConfigBootstrap" init-method="init">
    <property name="configs">
        <list>
            <value>classpath:alfresco/module/org.alfresco.module.NewContent/ui/web-client-config-custom.xml</value>
        </list>
    </property>
    </bean>

    <bean id="bootstrapExtraBundlesBean" class="org.alfresco.web.app.ResourceBundleBootstrap">
        <property name="resourceBundles">
            <list>
                <value>alfresco.messages.messages_newContent</value>
            </list>
        </property>
    </bean>

</beans>




CARPETA  /source/java/org/alfresco/module/NewContent

3.1)CustomAddContentDialog.java


package org.alfresco.module.NewContent;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.io.Serializable;

import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef;

import org.alfresco.web.bean.content.AddContentDialog;

import org.apache.log4j.Logger;

@SuppressWarnings({"serial", "unchecked"})
public class CustomAddContentDialog extends AddContentDialog
{
 
    /**
    * Log variable
    */
    private Logger logger = Logger.getLogger(CustomAddContentDialog.class);

    private NodeRef addedCategory;
    private List<NodeRef> categories;

    public List getCategories(){
        return this.categories;
    }

    public void setCategories(List categories)
    {
        this.categories = categories;
    }


    public void setAddedCategory(NodeRef addedCategory)
    {
        this.addedCategory = addedCategory;
    }

    public NodeRef getAddedCategory()
    {
        return this.addedCategory;
    }


    // ——————————————————————————
    // Dialog implementation

    @Override
    protected String finishImpl(FacesContext context, String outcome) throws Exception
    {
       
        outcome = super.finishImpl(context, outcome);

        Map updateProps = getNodeService().getProperties(this.createdNode);

        updateProps.put(ContentModel.PROP_CATEGORIES, (Serializable)this.categories);

        getNodeService().setProperties(this.createdNode, updateProps);


        // return default outcome
        return outcome;
    }

    @Override
    public void init(Map<String, String> parameters)
    {
       
        super.init(parameters);

        clearUpload();
      
        this.categories = new ArrayList<NodeRef>();
        this.addedCategory = null;
       
    }



    @Override
    public boolean getFinishButtonDisabled()
    {
     return false;
    }


    /**
    * @return Returns a list of object types to allow the user to select from
    */
    @Override
    public List<SelectItem> getObjectTypes()
    {
     
        this.objectTypes = newGetObjectTypes();
        return this.objectTypes;

    }

    /*
     * Función que sirve para cambiar el orden en el que aparece el desplegable con los tipos de contenido
     *  Modificar a gusto del consumidor
     */
    public List<SelectItem> newGetObjectTypes()
    {

        /*
         * En este ejemplo simplemente creo una lista con los valores originales que aparecen
         * en el desplegable y los ordeno de tal manera  que el Nuevo Contenido definido
         * anteriormente sea el primero de la lista
         *
         * Modelos que pertenecen a la lista original del desplegable de Añadir Contenido
         */
        String contentModel = ContentModel.TYPE_CONTENT.toString();
        String articleModel = "{http://www.alfresco.org/model/website/1.0}article";
        String imageModel = "{http://www.alfresco.org/model/website/1.0}image";
        String visitorFeedbackModel = "{http://www.alfresco.org/model/website/1.0}visitorFeedback";

        /**
         * Lista auxiliar que recibe la lista original del desplegable de Añadir Contenido
         */
        List<SelectItem> original_objectTypes;
        original_objectTypes = new ArrayList<SelectItem>(5);
        original_objectTypes = super.getObjectTypes();

        /**
         * Lista reordenada para el desplegable de Añadir Contenido
         */
        List<SelectItem> new_objectTypes;
        new_objectTypes = new ArrayList<SelectItem>(5);

        /*
         * Array con los modelos originales de alfresco
         */
        List<String> codes = Arrays.asList(contentModel,articleModel,imageModel,visitorFeedbackModel);

        /*
         * Iterador sobre la lista original
         */
        Iterator itr =  original_objectTypes.iterator();


        while(itr.hasNext())
        {

            SelectItem selectItem = (SelectItem)itr.next();
         


            if(codes.contains(selectItem.getValue().toString()))
            {
                new_objectTypes.add(selectItem);

            }
            else // Si no es un modelo original (si es el modelo que creamos ) se añade en la primera
            {       //   posición para que salga por defecto en el desplegable
           
                new_objectTypes.add(0, selectItem);

            }

        }

        return new_objectTypes;

    }

}




3.2)CustomCreateContentWizard.java


package org.alfresco.module.NewContent;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.io.Serializable;

import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeRef;

import org.alfresco.web.bean.content.CreateContentWizard;

import org.apache.log4j.Logger;

@SuppressWarnings({"serial", "unchecked"})
public class CustomCreateContentWizard extends CreateContentWizard
{
 
   
    /**
    * Log variable
    */
    private Logger logger = Logger.getLogger(CustomCreateContentWizard.class);

    private NodeRef addedCategory;
    private List<NodeRef> categories;

    public List getCategories(){
        return this.categories;
    }

    public void setCategories(List categories)
    {
        this.categories = categories;
    }


    public void setAddedCategory(NodeRef addedCategory)
    {
        this.addedCategory = addedCategory;
    }

    public NodeRef getAddedCategory()
    {
        return this.addedCategory;
    }


    // ——————————————————————————
    // Dialog implementation

    @Override
    protected String finishImpl(FacesContext context, String outcome) throws Exception
    {
       
        outcome = super.finishImpl(context, outcome);

        Map updateProps = getNodeService().getProperties(this.createdNode);

        updateProps.put(ContentModel.PROP_CATEGORIES, (Serializable)this.categories);

        getNodeService().setProperties(this.createdNode, updateProps);


        // return default outcome
        return outcome;
    }

    @Override
    public void init(Map<String, String> parameters)
    {
       
        super.init(parameters);

        this.categories = new ArrayList<NodeRef>();
        this.addedCategory = null;
       
    }



    @Override
    public boolean getFinishButtonDisabled()
    {
     return false;
    }


    /**
    * @return Returns a list of object types to allow the user to select from
    */
    @Override
    public List<SelectItem> getObjectTypes()
    {
     
        this.objectTypes = newGetObjectTypes();
        return this.objectTypes;

    }

    /*
     *
     */
    public List<SelectItem> newGetObjectTypes()
    {

       /* FALTA CÓDIGO PARA REORDENAR EL DESPLEGABLE
   *
   */

    }

}



CARPETA  /source/web/WEB-INF

4.1)faces-config-custom.xml


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                              "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>

   <!– *************************************************************** –>
   <!– Empty JSF config file to prevent errors being thrown during JSF –>
   <!– initialisation. Overwrite this file with your custom version.   –>
   <!– *************************************************************** –>

    <managed-bean>
        <description>
         The bean that backs up the Add Content Dialog
        </description>
        <managed-bean-name>AddContentDialog</managed-bean-name>
        <managed-bean-class>org.alfresco.module.NewContent.CustomAddContentDialog</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
        <managed-property>
             <property-name>nodeService</property-name>
             <value>#{NodeService}</value>
        </managed-property>
        <managed-property>
             <property-name>fileFolderService</property-name>
             <value>#{FileFolderService}</value>
        </managed-property>
        <managed-property>
             <property-name>searchService</property-name>
             <value>#{SearchService}</value>
        </managed-property>
        <managed-property>
             <property-name>navigator</property-name>
             <value>#{NavigationBean}</value>
        </managed-property>
        <managed-property>
             <property-name>browseBean</property-name>
             <value>#{BrowseBean}</value>
        </managed-property>
        <managed-property>
             <property-name>contentService</property-name>
             <value>#{ContentService}</value>
        </managed-property>
        <managed-property>
             <property-name>dictionaryService</property-name>
             <value>#{DictionaryService}</value>
        </managed-property>
    </managed-bean>

    <managed-bean>
      <managed-bean-name>CustomCreateContentWizard</managed-bean-name>
      <managed-bean-class>org.alfresco.module.NewContent.CustomCreateContentWizard</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      <managed-property>
         <property-name>nodeService</property-name>
         <value>#{NodeService}</value>
      </managed-property>
      <managed-property>
         <property-name>fileFolderService</property-name>
         <value>#{FileFolderService}</value>
      </managed-property>
      <managed-property>
         <property-name>searchService</property-name>
         <value>#{SearchService}</value>
      </managed-property>
      <managed-property>
         <property-name>navigator</property-name>
         <value>#{NavigationBean}</value>
      </managed-property>
      <managed-property>
         <property-name>browseBean</property-name>
         <value>#{BrowseBean}</value>
      </managed-property>
      <managed-property>
         <property-name>contentService</property-name>
         <value>#{ContentService}</value>
      </managed-property>
      <managed-property>
         <property-name>dictionaryService</property-name>
         <value>#{DictionaryService}</value>
      </managed-property>
   </managed-bean>
 
</faces-config>


CARPETA  /source/web/jsp/extension

4.2)add-category.jsp


<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>



<f:verbatim>
    <table cellpadding="2" cellspacing="2" border="0" width="100%">
        <tr>
            <td colspan="2" class="paddingRow"></td>
        </tr>
        <tr>
            <td>
                </f:verbatim><h:outputText value="#{msg.categories}" /><f:verbatim>:
             </td>
            <td width="98%">
            </f:verbatim>
                <r:multiValueSelector id="multi-category-selector"
                value="#{AddContentDialog.categories}"
                lastItemAdded="#{AddContentDialog.addedCategory}"
                selectItemMsg="#{msg.select_category}"
                selectedItemsMsg="#{msg.selected_categories}"
                noSelectedItemsMsg="#{msg.no_selected_categories}"
                styleClass="multiValueSelector">
                <f:subview id="categorySelector">
                <r:ajaxCategorySelector id="catSelector" styleClass="selector"
                value="#{AddContentDialog.addedCategory}"
                label="#{msg.select_category_prompt}" />
                </f:subview>
                </r:multiValueSelector>
            <f:verbatim>
            </td>
        </tr>
        <tr>
            <td colspan="2" class="paddingRow"></td>
        </tr>
    </table>
</f:verbatim>



4.3)add-content-dialog.jsp



<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%>

<%@ page buffer="32kb" contentType="text/html;charset=UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ page import="javax.faces.context.FacesContext"%>
<%@ page import="org.alfresco.web.app.Application"%>
<%@ page import="org.alfresco.web.bean.content.AddContentDialog"%>
<%@ page import="org.alfresco.web.app.servlet.FacesHelper"%>
<%@ page import="org.alfresco.web.ui.common.PanelGenerator"%>

<%
   boolean fileUploaded = false;

   AddContentDialog dialog = (AddContentDialog) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "AddContentDialog");
   if (dialog != null && dialog.getFileName() != null)
   {
       fileUploaded = true;
   }
%>
<f:verbatim>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/validation.js"> </script>

<%
if (fileUploaded)
{
   PanelGenerator.generatePanelStart(out, request.getContextPath(), "yellowInner", "#ffffcc");
   out.write("<img alt='' align='absmiddle' src='");
   out.write(request.getContextPath());
   out.write("/images/icons/info_icon.gif' />  ");
   out.write(dialog.getFileUploadSuccessMsg());
   PanelGenerator.generatePanelEnd(out, request.getContextPath(), "yellowInner");
   out.write("<div style='padding:2px;'></div>");
}
%>

<table cellpadding="2" cellspacing="2" border="0" width="100%">
</f:verbatim>
   <%
      if (fileUploaded == false)
      {
   %>
   <f:verbatim>

   <tr>
      <td colspan="3" class="wizardSectionHeading"></f:verbatim><h:outputText id="text0" value="#{msg.upload_content}" /><f:verbatim></td>
   </tr>

   <tr>
         <td></f:verbatim>
         <h:panelGrid id="upload_panel" columns="2" cellpadding="2" cellspacing="2" border="0" width="100%" columnClasses="panelGridLabelColumn,panelGridValueColumn,panelGridRequiredImageColumn">

            <h:outputText value="#{msg.locate_content}" style="padding-left:8px"/>
            <f:verbatim/>

            <h:outputText id="out_schema" value="#{msg.file_location}:" style="padding-left:8px" />
            <r:upload id="uploader" value="#{DialogManager.bean.fileName}" framework="dialog"/>
         </h:panelGrid>

         <f:verbatim></td>
   </tr></f:verbatim>
   <%}
      if (fileUploaded)
      {
   %>
      <f:verbatim>

      <tr>
         <td colspan="3">

         <table border="0" cellspacing="2" cellpadding="2" class="selectedItems">
            <tr>
               <td colspan="2" class="selectedItemsHeader"></f:verbatim><h:outputText id="text2" value="#{msg.uploaded_content}" />
               <f:verbatim>
               </td>
            </tr>
            <tr>
               <td class="selectedItemsRow"></f:verbatim><h:outputText id="text3" value="#{AddContentDialog.fileName}" /><f:verbatim></td>
               <td></f:verbatim><a:actionLink image="/images/icons/delete.gif" value="#{msg.remove}" action="#{AddContentDialog.removeUploadedFile}" showLink="false" id="link1" /><f:verbatim></td>
            </tr>
         </table>
         </td>
      </tr>
      <tr>
         <td class="paddingRow"></td>
      </tr>
      <tr>
         <td colspan="3" class="wizardSectionHeading"> </f:verbatim><h:outputText id="text4" value="#{msg.general_properties}" /><f:verbatim></td>
      </tr>
      <tr>
         <td class="paddingRow"></td>
      </tr>
      <tr>
         <td align="middle"></f:verbatim><h:graphicImage id="img0" value="/images/icons/required_field.gif" alt="#{msg.required_field}" /><f:verbatim></td>
         <td></f:verbatim><h:outputText id="text5" value="#{msg.name}:" /><f:verbatim></td>
         <td width="85%"></f:verbatim><h:inputText id="name" value="#{AddContentDialog.fileName}" maxlength="1024" size="35" onkeyup="checkButtonState();" onchange="checkButtonState();" /><f:verbatim></td>
      </tr>
      <tr>
         <td></td>
         <td></f:verbatim><h:outputText id="text6" value="#{msg.type}:" /><f:verbatim></td>
         <td></f:verbatim><h:selectOneMenu id="object-type" value="#{AddContentDialog.objectType}">
            <f:selectItems value="#{AddContentDialog.objectTypes}" />
         </h:selectOneMenu><f:verbatim></td>
      </tr>
      <tr>
         <td></td>
         <td></f:verbatim><h:outputText id="text12" value="#{msg.encoding}:" /><f:verbatim></td>
         <td></f:verbatim><h:selectOneMenu id="encoding" value="#{AddContentDialog.encoding}">
            <f:selectItems value="#{AddContentDialog.encodings}" />
         </h:selectOneMenu><f:verbatim></td>
      </tr>
      <tr>
         <td></td>
         <td></f:verbatim><h:outputText id="text7" value="#{msg.content_type}:" /><f:verbatim></td>
         <td></f:verbatim><r:mimeTypeSelector id="mime-type" value="#{AddContentDialog.mimeType}" /><f:verbatim></td>
      </tr>
      </f:verbatim>
      <%
         if (dialog.getOtherPropertiesChoiceVisible())
         {
      %>
      <f:verbatim>
      <tr>
         <td class="paddingRow"></td>
      </tr>
      <tr>
         <td colspan="3" class="wizardSectionHeading"> </f:verbatim><h:outputText id="text8" value="#{msg.other_properties}" /><f:verbatim></td>
      </tr>
      <tr>
         <td colspan="3">
         <table style="padding-top: 2px;">
            <tr>
               <td colspan="3"></f:verbatim><h:outputText id="text9" value="#{msg.modify_props_help_text}" /><f:verbatim></td>
            </tr>
            <tr>
               <td class="paddingRow"></td>
            </tr>
            <tr>
               <td></f:verbatim><h:selectBooleanCheckbox value="#{AddContentDialog.showOtherProperties}" /><f:verbatim></td>
               <td width="100%"></f:verbatim><h:outputText id="text10" value="#{msg.modify_props_when_page_closes}" /><f:verbatim></td>
            </tr>

<%–    AÑADIDO                –%>
         </table>
         </td>
      </tr>
      <tr>
          <td colspan="3">
            <table cellpadding="2" cellspacing="2" border="0" width="100%">
                <tr>

                    <td colspan="2" class="wizardSectionHeading"> </f:verbatim><h:outputText id="text15" value="#{msg.categories}" /><f:verbatim></td>
                </tr>
                <tr>
                    <td>
                    </f:verbatim>
                    <h:outputText value="#{msg.categories}" /><f:verbatim>:</td>
                    <td width="98%">
                        </f:verbatim>
                        <r:multiValueSelector id="multi-category-selector"
                        value="#{AddContentDialog.categories}"
                        lastItemAdded="#{AddContentDialog.addedCategory}"
                        selectItemMsg="#{msg.select_category}"
                        selectedItemsMsg="#{msg.selected_categories}"
                        noSelectedItemsMsg="#{msg.no_selected_categories}"
                        styleClass="multiValueSelector">
                        <f:subview id="categorySelector">
                        <r:ajaxCategorySelector id="catSelector" styleClass="selector"
                        value="#{AddContentDialog.addedCategory}"
                        label="#{msg.select_category_prompt}" />
                        </f:subview>
                        </r:multiValueSelector>
                        <f:verbatim>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="paddingRow"></td>
                </tr>
            </table>
          </td>
        </tr>




<%–     FIN AÑADIDO               –%>
      </f:verbatim>
        <%
         }

        %>


<%

      }
      %>
   <f:verbatim>


</table>

<script type="text/javascript">
      var finishButtonPressed = false;
      addEventToElement(window, 'load', pageLoaded, false);

      function pageLoaded()
      {
         document.getElementById("dialog:finish-button").onclick = function() {finishButtonPressed = true; clear_dialog();}
      }

      function checkButtonState()
      {
         if (document.getElementById("dialog:dialog-body:name").value.length == 0 )
         {
            document.getElementById("dialog:finish-button").disabled = true;
         }
         else
         {
            document.getElementById("dialog:finish-button").disabled = false;
         }
      }
   </script>
</f:verbatim>


Una vez terminado, nos situamos en el directorio base del proyecto y ejecutamos.


ant

Despues ejecutamos, teniendo en cuenta que las direcciones relativas a los archivos  alfresco-mmt-3.3g.jar  y alfresco.war
Para más opciones http://wiki.alfresco.com/wiki/Module_Management_Tool


java -jar alfresco-mmt-3.3g.jar install build/dist/NewModule.amp alfresco.war -verbose


Ahora ya tenemos nuestro nuevo módulo dentro del archivo war, con lo que lo copiamos en el directorio $TOMCAT_HOME/webapps y arrancamos tomcat.


Espero que os sea útil y que no haya ningún problema con este código.

Un saludo

Outcomes