Sunday 30 October 2016

News and Article Module In DXA

Why Fresh Content is Critical for Your Website?
  1. Keep Your Audience Informed and Updated
  2. Fresh Content Increases Your Authority Potential
  3. More Content, More Keywords
  4. Google Loves Frequent Updates
So, add an article, an image or just make some change on your site to get noticed. The easiest and most effective way to stay fresh is to add a blog on your site and continue to add articles that will get noticed by your viewers.

Today,We are going to discuss and create News and Article module in DXA which will have following features  .DXA Modules allows us to extend its Functionality via creating new modules. Here we can create new modules which gives us flexibility & re-usability.
  1. Article searching
  2. Tag based filtering 
  3. Article list and detail articles 
  4. Author details page 
Let's discuss the CMS part first.
CMS structure
  1. Define module's folder structure
  2. DXA gives us predefined structure where we can putting all the building blocks of the module.
  3. For each new DXA module, we need to create a new folder in Modules Folder
  4. The name of folder is usually module name.
Next is creating the Schema and Component Templates. I have used dynamic components which render on the landing page as a list of articles and with details page link.

You need to create dynamic CT for the list of articles

Dynamic Component Template
Publish all the Dynamic Article components .
Dynamic N&M Components

To read dynamic Components we need to query Broker DB.
Get Article Dynamic Components ID

Build Criteria based on you will get the data from Broker DB
Now ,Let's see the Content Delivery 
New Area called NewsAndArticle in DXA 
Create new area in you DXA web Application. Here i have created Models,and helper class to get the data from broker using Broker Queries.

Register your views in NewsAndArticleAreaRegistration.cs . Once done now let run the application .

1. News and Article Landing Page
Landing Page
Here you can see list of articles are rendering from Broker DB using broker query .Using this view we can search an article ,filter by category and view the author details.

2. Search will search in the intro Text in metadata.
Search result
3. Filter your result based on Tags click on tag.
Result based on tags

4. Click on read more link for Article Details page 
Article details page
5. Author Details Page .
Author page

Happy coding and keep sharing !!!!

Saturday 8 October 2016

FormBuilder Module in DXA Content Delivery Settings

My First DXA Module - Form builder Step by Step  cont'd



In Previous post, we have discussed on the CMS Part of the DXA module. now lets discuss the CDA part

Step 1. Download the DXA framework Here
Step 2. I have created new area called FormBuilder 


Step 3. Create a ViewModel based on FormBuilder Schema

Step 4. Lets create Login.CHTML View which will consume the FormBuilder ViewModel and render the userControl based on the formFields attached to it.



Last Step is to update the form FormBuilderAreaRegistration.cs


Build and run the solution .In below screen shot you can see the form is rendering.

We have completed the Formbuilder Module this is a very basic Formbuilder soon i will be adding more functionality like custom error message and data save/authentication functionality .

Happy Coding and Keep Sharing !!!! 

FormBuilder Module in DXA

My First DXA Module - Form builder Step by Step

In this we will discuss how to setup CMS to create your own DXA module

  1. In this Post we will discuss how to setup DXA module in CMS
  2. Next, we will be discussing CD level setting 

  1. First we will define the folder structure 
  2. Create a new folder in the Modules folder
  3. Rename that folder to FormBuilder
  4. Create Admin ,Site Manager and Editor
Let's create FormBuilder Schemas

      Form field Schema: - Is used to create the controls such as text box, radio button etc.

  •     Here i have field type ,field name and label text
  •     You can create field Type as category,Keywords to list down all the possible controls

Form Builder Schema: - Is used to give the title, Description and here we also linked all our components 
which was created using Schema Form Field.
  •     In This component we will linked all are component created using Form Field  Schema which contains all the different types of fields type Components “First Name, Last Name”.
  •           Insert this component as component presentation in your page .

This schema will be used by Editor to define the FormBuilder components with 
       required details and attached to page.
     
      Component Template:I have created a new CT (FormBuilder) to be attached with component of above schema 


      Next Step is to configure the DXA and create new area called FormBuilder Here

     Happy Coding and Keep Sharing !!!!

Monday 30 May 2016

Exchange Integration 4 Tridion-Ei4T

Introduction 

Exchange Integration 4 Tridion-Ei4T is intent to provide the Tridion integration with Microsoft Exchange server to read emails and create components in SDL Tridion.


Ei4T-High Level Architecture
SETUP

Below are various set-up step and prerequisites 
  1. Dedicated Email-Id is required on which service will keep on checking for emails
  2. Task scheduler to schedule the service.
  3. Custom validator will get EWS url.
  4. Task scheduler and Exchange Service SearchFilter ItemSchema.DateTimeReceived time Interval
    should be in sync 
  5. Make sure you select right version of Exchange.I am using ExchangeVersion.Exchange2013 
  6. Publish component only if its marked as item.Importance == "High" again this is configurable
  7. Create Tridion coreService client using ISessionAwareCoreService
  8. Create model as Serializable
  9. Copy the configuration folder/logging.config file and update the path in app.config
  10. Update App.Config 
    1. coreService Url
    2. Exchange Dedicated Email-ID/Password
    3. Schema ID
    4. Folder ID
    5. Publication Target ID
    6. CM userid/password to run coreService
  11. Email format


You can Download the code from here.

Happy Coding and Keep Sharing !!!

Monday 23 May 2016

MongoDB Integration 4 Tridion-Mi4T

Introduction

MongoDB Integration 4 Tridion-Mi4T is intent to provide the Tridion integration with MongoDB

Let's see some of the features advantages of using MongoDB

Advantages
  1. Schema less : MongoDB is document database in which one collection holds different different documents. Number of fields, content and size of the document can be differ from one document to another.
  2. Structure of a single object is clear
  3. Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language
Why should use MongoDB
  1. Document Oriented Storage : Data is stored in the form of JSON style documents
  2. Index on any attribute
  3. Replication & High Availability
  4. Rich Queries
Where should use MongoDB?
  1. Big Data
  2. Content Management and Delivery
  3. Mobile and Social Infrastructure
  4. User Data Management

How to Set-up and Configure Mi4T

We have five different modules in the Mi4T
  1. MongoDB - Setup and configuration
  2. Template Bulding Block:- C# TBB is used to get the component DCP in XMLformat after some changes . 
  3. Custom Storage Extension – A JPAComponentPresentationDAO based custom storage extension to manipulate the dynamic component presentations
  4. MongoDBIndexService- WCFRestFul Service which get invoked by custom storage extension and take DCP as input
  5. MongoDBSearchService - WCFRestFul service to get the data from MongoDB and take input query in JSON format .

SETUP

Below are various setup steps
  1. CMS Setup
    • Copy and paste the templating building block (TBB) to a location on your Tridion CM Server 
    • Upload MI4TIndexing.Templating.dll TBB to Tridion CMS 
    • Create a Component Template with following attributes
      • Output Format – XML Fragment
      • Add GetComponentAsXML TBB ,Publish Binaries in Package, Link Resolver and Cleanup Template 
  2. MongoDB Setup
  3. Content Delivery Setup
    • Open the cd_storage_config.xml Storage Configuration file from the /bin/config folder and add following node under the Storages section:
      • <StorageBindings><Bundle src="CustomStorageDAOBundles.xml"/></StorageBindings>
    • Copy and paste CustomStorageConfig.xml file to change the value of following nodes
      • ServiceEndPoint - URL of the IndexService
      • TemplateIdToIndex - Tcm Id Of component Template which we have created in step 1 CMS setup. 
    • Copy the CustomStorageDAOBundles.xml XML file in the Content Delivery /bin/config folder
  4. MongoDB Index Service
    • Copy and paste MongoDBIndexService on your server host it in IIS 
    • Copy the configuration folder as well .
      • You can update the log files path from Logging.config inside the configuration folder
    • Update the path of configuration\logging.config file in web.config of index service
  5. MongoDB Search Service
    • Copy and paste MongoDBIndexService on your server host it in IIS 
    • Copy the configuration folder as well 
      • Update the log files path in Logging.config inside the configuration folder
    • Update the path of configuration\logging.config file in web.config of index service
  6. Index service support Publishing ,Re-publishing and un-publishing
  7. Search service will get the data in JSON format. 

To test the index and search services

  1. Index service

    1. You can use fiddler for debugging 
    2. I have created a sample schema article
      1. title
      2. description
      3. imageurl
    3. Run index service on fiddler
      • http://localhost/Service1.svc/AddDocument
      • Input JSON which will generated by custom storage 
      • {"ServicePayload":{"DCP":"<Content xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:tcm='http://www.tridion.com/ContentManager/5.0' Title='Copy of Demo Of MongoDB' Id='tcm:2073-13667'><title>Demo Of MongoDB</title><description><![CDATA[Demo of component creation in Tridion using MongoDB]]></description><imageurl>/images/demo.png</imageurl><publication Id='tcm:0-2073-1' Title='03 Content Master' /></Content>","LanguageInRequest":"en"}} 
    4. Execute this request in Fidler and verify the results returned
    5. Check in mongoDB as well inside the collection\document which you have created and entered in the index service 
    6. Result as 0 for success and 1 for failure
      •  {"ResponseContext":{"EnvironmentContext":null,"FaultCollection":[]},"ServicePayload":{"ErrorMessage":"","Result":0}}
    7. Test this by publishing the Component as well 
    8. Log File Where Response Result :0 means successfully published and data is index in MongoDB
  1. Search Service
    1. You use the fiddler for debugging 
    2. Run the search service on fiddler
      • Url:- http://localhost/SearchSvc.svc/GetContentFromMongoDB
      • {"ServicePayload":{"ContentType":"Content","Filters":[{"Key":"ItemURI","Value":"tcm:2073-13667"},{"Key":"publicationID","Value":"tcm:0-2073-1"}]}
      • Execute the request in fiddler and verify the results returned
      • This service will get you the result based on Filters you provide and  use //MAP/REDUCE  
      •  //Map/Reduce            
                            var map =
                                "function() {" +
                                "    for (var key in this) {" +
                                "        emit(key, { count : 1 });" +
                                "    }" +
                                "}";

                            var reduce =
                                "function(key, emits) {" +
                                "    total = 0;" +
                                "    for (var i in emits) {" +
                                "        total += emits[i].count;" +
                                "    }" +
                                "    return { count : total };" +
                                "}";
      • Output will be in the JSON format 
      • { "_id" : ObjectId("5741539eef525465db9eb131"), "title" : "Demo Of MongoDB", "description" : "Demo of component creation in Tridion using MongoDB", "imageUrl" : "/images/demo.png", "ItemURI" : 
      •  
      • "tcm:2073-13667", "publicationID" : "tcm:0-2073-1" }
      • You can have AND,OR and NOT as a logical operators to query the data from MongoDB
        • {"ServicePayload":{"ContentType":"Content","Filters":[{"Key":"ItemURI","Value":"tcm:278-13667"},{"Key":"publicationID","Value":"tcm:0-278-1"}],"MongoDatabase":"customerDatabase","Table":"article","QueryType":"OR"}
  2. You can download the code here

Happy Coding & Keep Sharing !!!

MongoDB Integration 4 Tridion-Mi4T

Introduction

MongoDB Integration 4 Tridion-Mi4T is intent to provide the Tridion integration with MongoDB

Let's see some of the features advantages of using MongoDB

Advantages
  1. Schema less : MongoDB is document database in which one collection holds different different documents. Number of fields, content and size of the document can be differ from one document to another.
  2. Structure of a single object is clear
  3. Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language
Why should use MongoDB
  1. Document Oriented Storage : Data is stored in the form of JSON style documents
  2. Index on any attribute
  3. Replication & High Availability
  4. Rich Queries
Where should use MongoDB?
  1. Big Data
  2. Content Management and Delivery
  3. Mobile and Social Infrastructure
  4. User Data Management

How to Set-up and Configure Mi4T

We have five different modules in the Mi4T
  1. MongoDB - Setup and configuration
  2. Template Bulding Block:- C# TBB is used to get the component DCP in XMLformat after some changes . 
  3. Custom Storage Extension – A JPAComponentPresentationDAO based custom storage extension to manipulate the dynamic component presentations
  4. MongoDBIndexService- WCFRestFul Service which get invoked by custom storage extension and take DCP as input
  5. MongoDBSearchService - WCFRestFul service to get the data from MongoDB and take input query in JSON format .

SETUP

Below are various setup steps
  1. CMS Setup
    • Copy and paste the templating building block (TBB) to a location on your Tridion CM Server 
    • Upload MI4TIndexing.Templating.dll TBB to Tridion CMS 
    • Create a Component Template with following attributes
      • Output Format – XML Fragment
      • Add GetComponentAsXML TBB ,Publish Binaries in Package, Link Resolver and Cleanup Template 
  2. MongoDB Setup
  3. Content Delivery Setup
    • Open the cd_storage_config.xml Storage Configuration file from the /bin/config folder and add following node under the Storages section:
      • <StorageBindings><Bundle src="CustomStorageDAOBundles.xml"/></StorageBindings>
    • Copy and paste CustomStorageConfig.xml file to change the value of following nodes
      • ServiceEndPoint - URL of the IndexService
      • TemplateIdToIndex - Tcm Id Of component Template which we have created in step 1 CMS setup. 
    • Copy the CustomStorageDAOBundles.xml XML file in the Content Delivery /bin/config folder
  4. MongoDB Index Service
    • Copy and paste MongoDBIndexService on your server host it in IIS 
    • Copy the configuration folder as well .
      • You can update the log files path from Logging.config inside the configuration folder
    • Update the path of configuration\logging.config file in web.config of index service
  5. MongoDB Search Service
    • Copy and paste MongoDBIndexService on your server host it in IIS 
    • Copy the configuration folder as well 
      • Update the log files path in Logging.config inside the configuration folder
    • Update the path of configuration\logging.config file in web.config of index service
  6. Index service support Publishing ,Re-publishing and un-publishing
  7. Search service will get the data in JSON format. 

To test the index and search services

  1. Index service

    1. You can use fiddler for debugging 
    2. I have created a sample schema article
      1. title
      2. description
      3. imageurl
    3. Run index service on fiddler
      • http://localhost/Service1.svc/AddDocument
      • Input JSON which will generated by custom storage 
      • {"ServicePayload":{"DCP":"<Content xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:tcm='http://www.tridion.com/ContentManager/5.0' Title='Copy of Demo Of MongoDB' Id='tcm:2073-13667'><title>Demo Of MongoDB</title><description><![CDATA[Demo of component creation in Tridion using MongoDB]]></description><imageurl>/images/demo.png</imageurl><publication Id='tcm:0-2073-1' Title='03 Content Master' /></Content>","LanguageInRequest":"en"}} 
    4. Execute this request in Fidler and verify the results returned
    5. Check in mongoDB as well inside the collection\document which you have created and entered in the index service 
    6. Result as 0 for success and 1 for failure
      •  {"ResponseContext":{"EnvironmentContext":null,"FaultCollection":[]},"ServicePayload":{"ErrorMessage":"","Result":0}}
    7. Test this by publishing the Component as well 
    8. Log File Where Response Result :0 means successfully published and data is index in MongoDB
  1. Search Service
    1. You use the fiddler for debugging 
    2. Run the search service on fiddler
      • Url:- http://localhost/SearchSvc.svc/GetContentFromMongoDB
      • {"ServicePayload":{"ContentType":"Content","Filters":[{"Key":"ItemURI","Value":"tcm:2073-13667"},{"Key":"publicationID","Value":"tcm:0-2073-1"}]}
      • Execute the request in fiddler and verify the results returned
      • This service will get you the result based on Filters you provide and  use //MAP/REDUCE  
      •  //Map/Reduce            
                            var map =
                                "function() {" +
                                "    for (var key in this) {" +
                                "        emit(key, { count : 1 });" +
                                "    }" +
                                "}";

                            var reduce =
                                "function(key, emits) {" +
                                "    total = 0;" +
                                "    for (var i in emits) {" +
                                "        total += emits[i].count;" +
                                "    }" +
                                "    return { count : total };" +
                                "}";
      • Output will be in the JSON format 
      • { "_id" : ObjectId("5741539eef525465db9eb131"), "title" : "Demo Of MongoDB", "description" : "Demo of component creation in Tridion using MongoDB", "imageUrl" : "/images/demo.png", "ItemURI" : 
      • "tcm:2073-13667", "publicationID" : "tcm:0-2073-1" }
      • You can have AND,OR and NOT as a logical operators to query the data from MongoDB
        • {"ServicePayload":{"ContentType":"Content","Filters":[{"Key":"ItemURI","Value":"tcm:278-13667"},{"Key":"publicationID","Value":"tcm:0-278-1"}],"MongoDatabase":"customerDatabase","Table":"article","QueryType":"OR"}
  2. You can download the code here

Happy Coding & Keep Sharing !!!

Monday 16 May 2016

Creating Components in SDL Tridion using MongoDB Data Feed

In one of my previuos post we've discussed how to create components in SDL Tridion using MSSQLServer as a DataSoucre but today we are going to create components in SDL Tridion using MongoDB as a DataSource


We are going to use SDL Tridion CoreService,MonoDB 3.2.6 ssl-signed and C# as a language

You can download MongoDB from here and to know more about MongoDB here

Create an empty solution

  1. MongoDb.Client
    • C# Console Based Application Running on .NET 4.5
    • which will get the data from mongoDB
  2. MongoDBToTridion.BAL
    • In this Class Liabrary  i have written all the logic in order to create component.
  3. Install MongoDB Drivers
    • Install-Package MongoDB.Driver
  4. Create SDL Tridion CoreService Client
    • ISessionAwareCoreService
  5. Create a model name Article as Serializable
  6. I have also create a Database called customerDatabase in MongoDB
  7. In my customerDatabase i have create document name article which we will use to create component
  8. Main Method which is starting point of this application 

     
      9.Update appsettings key in app.config file 


     10. Process List<Article>


   11.Serialize article model


  12.Create or update Component in Tridion 


 Compare your Data in MongoDB with components created in Tridion


All the data which are available in Article Document in MongoDB has been successfully  created as Components in Tridion .



Open Component and check 



You can download the code from here


Happy Coding and keep Sharing !!!!