cancel
Showing results for 
Search instead for 
Did you mean: 

Reg new content type in quick start?

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi,

I want to create a new type of content say news in wqs,how can i do this?

I want user to create user to create news items using this type & submit it for review & publishing?

Any help?
5 REPLIES 5

dynamolalit
Champ on-the-rise
Champ on-the-rise
No Help..Alas… Smiley Indifferent

bremmington
Champ on-the-rise
Champ on-the-rise
The starting point is to define your content type. This is defined in an XML format and is described on the wiki. An example of such a thing from WQS can be found in a file named "websiteModel.xml".

Then define a form that can be used to edit content of that type. The documentation about forms should help you here. An example of forms defined out-of-the-box by WQS can be found in the file "wcmquickstart-form-config.xml".

Finally, you probably want your new type to appear in the drop-down when your users click on "Create Content" in Share. To do this, create a file named "share-config-custom.xml" so that it's located at "<tomcat_home>/shared/classes/alfresco/web-extension/share-config-custom.xml". In this file put this (note the last line in the "create-content" element - that's for your new type):

<alfresco-config>
   <config evaluator="string-compare" condition="DocumentLibrary">
      <create-content>
         <content id="plain-text" mimetype="text/plain" label="create-content.text" itemid="cm:content" icon="text"/>
         <content id="html" mimetype="text/html"  label="create-content.html" itemid="cm:content"/>
         <content id="xml" mimetype="text/xml" label="create-content.xml" itemid="cm:content"/>
         <content id="yourtype" mimetype="text/xml" label="create-yourtype.xml" itemid="your:type"/>
      </create-content>
   </config>
</alfresco-config>

dynamolalit
Champ on-the-rise
Champ on-the-rise
Thanks Brian,

it is very helpful what you have suggested but i have some more questions into my mind, if you /any forum member can help me out here:

1. How can i customize out of box finance or government?
2. In real life, content will be displayed with styles but i could not find any styles added to out of box application content , so how can i add styles to my custom content , as only styles available are ones which are provided with TinyMCE editor?
3. As i can understand, content will be published to live from editorial space in document library. Say i want to publish this content to some other location say a file system or another alfresco repository, how can i do this?

Thanks again for help.

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi

I am using alfresco 3.4.e community edition bundled setup.

I am able to create a custom model ukpnNewsModel.xml as below under ..\tomcat\shared\classes\alfresco\extension

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

    <!– Definition of UKPN News Content model –>

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

    <!– Meta-data about the model –>
    <description>UKPN News Model</description>
    <author>Lalit Jangra</author>
    <version>1.0</version>

    <!–
        Imports are required to allow references to definitions in other
        models
    –>
    <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" />
        <!– Import Alfresco Content Domain Model Definitions –>
        <import uri="http://www.alfresco.org/model/system/1.0"
            prefix="sys" />
        <import uri="http://www.alfresco.org/model/datalist/1.0"
            prefix="dl" />
    </imports>

    <!– Content Model Namespace –>
    <namespaces>
        <namespace uri="http://www.ukpn.co.uk/model/news/1.0" prefix="ukpnnews" />
    </namespaces>

    <types>
        <type name="ukpnnews:news">
            <title>UKPN News</title>
            <parent>cm:content</parent>
            <properties>
                <property name="ukpnnews:newsName">
                    <title>News Name</title>
                    <type>d:text</type>                   
                </property>
                <property name="ukpnnews:newsTitle">
                    <title>News Title</title>
                    <type>d:text</type>
                </property>
            <property name="ukpnnews:newsType">
                    <title>News Type</title>
                    <type>d:text</type>
                </property>
            <property name="ukpnnews:newsBody">
                    <title>News Body</title>
                    <type>d:text</type>
                </property>
            <property name="ukpnnews:newsAuthor">
                    <title>News Author</title>
                    <type>d:text</type>
                </property>
            <property name="ukpnnews:newsApprover">
                    <title>News Approver</title>
                    <type>d:text</type>
                </property>
            <property name="ukpnnews:newsPublisher">
                    <title>News Publisher</title>
                    <type>d:text</type>
                </property>
            <property name="ukpnnews:newsPublishingDate">
                    <title>News Publishing Date</title>
                     <type>d:datetime</type>
                </property>
            <property name="ukpnnews:newsExpiryDate">
                    <title>News Expiration Date</title>
                     <type>d:datetime</type>
                </property>
            <property name="ukpnnews:newsTags">
                    <title>News Tags</title>
                    <type>d:text</type>
                </property>
            <property name="ukpnnews:newsLinks">
                    <title>News Links</title>
                    <type>d:text</type>
                </property>
         </properties>
        </type>
   </types>
</model>

Further i am able to bootstrap in repository  using ukpn-model-bootstrap-context.xml file placed in ..\tomcat\shared\classes\alfresco\extension


<?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 UKPN News model. –>
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/ukpnNewsModel.xml</value>
            </list>
        </property>
      <property name="labels">
            <list>
                <value>alfresco/extension/ukpnNewsModel</value>
            </list>
        </property>
    </bean>
</beans>


Now i can see newly added custom content type while creating content in alfresco explorer. But i am unable to see custom content type in create content dropdown in share wqs document library. Here is my share-config-custom.xml under
..\tomcat\shared\classes\alfresco\web-extension

<alfresco-config>
  
   <!– Repository Library config section –>
   <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>
   </config>

   <config evaluator="string-compare" condition="Remote">
      <remote>
         <endpoint>
            <id>alfresco-noauth</id>
            <name>Alfresco - unauthenticated access</name>
            <description>Access to Alfresco Repository WebScripts that do not require authentication</description>
            <connector-id>alfresco</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
            <identity>none</identity>
         </endpoint>

         <endpoint>
            <id>alfresco</id>
            <name>Alfresco - user access</name>
            <description>Access to Alfresco Repository WebScripts that require user authentication</description>
            <connector-id>alfresco</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
            <identity>user</identity>
         </endpoint>

         <endpoint>
            <id>alfresco-feed</id>
            <name>Alfresco Feed</name>
            <description>Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet</description>
            <connector-id>http</connector-id>
            <endpoint-url>http://localhost:8080/alfresco/s</endpoint-url>
            <basic-auth>true</basic-auth>
            <identity>user</identity>
         </endpoint>
      </remote>
   </config>
   
   <!– Added for UKPN News Model
   

    <config evaluator="string-compare" condition="DocumentLibrary">
      <createContent>
      <content mimetype="text/plain" icon="plain-text" label="menu.create-content.text" itemid="cm:content"/>
      <content mimetype="text/html" icon="html" label="menu.create-content.html" itemid="cm:content"/>
      <content mimetype="text/xml" icon="xml" label="menu.create-content.xml" itemid="cm:content"/>
      <content mimetype="text/html" icon="html" label="ukpnnews" itemid="ukpnnews:news"/>
      <content id="ukpnnews" mimetype="text/xml" icon="xml" label="ukpnnews" itemid="ukpnnews:news"/>
    </createContent>
   </config>–>

    <!– For UKPN News –>
   <config evaluator="model-type" condition="ukpnnews:news">
    <forms>
       <form>
          <field-visibility>           
             <!–  specific for ukpnnews:news –>
             <show id="ukpnnews:newsName" />
             <show id="ukpnnews:newsTitle" />        
          <show id="ukpnnews:newsType" />
          <show id="ukpnnews:newsBody" />        
          <show id="ukpnnews:newsAuthor" />        
          <show id="ukpnnews:newsApprover" />        
          <show id="ukpnnews:newsPublisher" />        
          <show id="ukpnnews:newsPublishingDate" />        
          <show id="ukpnnews:newsExpiryDate" />        
          <show id="ukpnnews:newsTags" />
          <show id="ukpnnews:newsLinks" />
          </field-visibility>
       </form>
    </forms>
</config>

   <!– For UKPN News –>
   <config evaluator="node-type" condition="ukpnnews:news">
    <forms>
       <form>
          <field-visibility>
             <!–  specific for ukpnnews:news –>
             <show id="ukpnnews:newsName" />
             <show id="ukpnnews:newsTitle" />        
          <show id="ukpnnews:newsType" />
          <show id="ukpnnews:newsBody" />        
          <show id="ukpnnews:newsAuthor" />        
          <show id="ukpnnews:newsApprover" />        
          <show id="ukpnnews:newsPublisher" />        
          <show id="ukpnnews:newsPublishingDate" />        
          <show id="ukpnnews:newsExpiryDate" />        
          <show id="ukpnnews:newsTags" />
          <show id="ukpnnews:newsLinks" />      
          </field-visibility>
       </form>
    </forms>
</config>

<config evaluator="string-compare" condition="DocumentLibrary" replace="true">
   <createContent>
      <content mimetype="text/plain" icon="plain-text" label="menu.create-content.text" itemid="cm:content"/>
      <content mimetype="text/html" icon="html" label="menu.create-content.html" itemid="cm:content"/>
      <content mimetype="text/xml" icon="xml" label="menu.create-content.xml" itemid="cm:content"/>
      <content id="ukpnnews" mimetype="text/xml" icon="xml" label="ukpnnews" itemid="ukpnnews:news"/>
    </createContent>
   <types>
         <type name="cm:content">
                <subtype name="ukpnnews:news" />
         </type>           
    </types>
</config>

</alfresco-config>

But when i add following line in <creaetcontent> tag in wcmqs-toolbar.get.config.xmlunder ..\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\documentlibrary


     <content mimetype="text/html" icon="html" label="ukpnnews" itemid="ukpnnews:news"/>

I can see custom content type in dropdown. But content thus created does not exhibits inline editing option.

As per my understanding, i should see the content type using share-config-custom.xml only but it is not the case.

Can anybody help me where i am missing it. The scarcity of documentation is again taking too much time to get any clue.

Please help urgently.

erikwinlof
Confirmed Champ
Confirmed Champ
Hi,

In Alfresco 4.0 a lot of the document library configs were moved to share-config.xml (including the config for the "create content menu") so on a 4.0 installation it will be possible to add the following in share-config.xml:
<config evaluator="string-compare" condition="DocumentLibrary">
<create-content>
         <content id="ukpnnews" mimetype="text/xml" icon="xml" label="ukpnnews" itemid="ukpnnews:news"/>
      </create-content>
</config>

On a Alfresco 3.4 installation, however, it is configured by overriding the toolbar get.config.xml just like you described, sorry for the inconvenience 😞

When it comes to the content not being inline editable you must add the "app:inline editable" aspect to your custom type.

Cheers, Erik