Pages

Thursday, September 17, 2015

How to create UCM custom component ?




How to create UCM / WCC custom component ?



Goal : Step by step to create a custom component using Component Wizard

Purpose : Create a new custom service 'DISPLAY_DELETE' to list deleted contents in past.


Basic : Component wizard  is required to create custom component , Because using this we can keep the required files and folders of component in proper format .

Basics :

1. Create Component structure and folders
2. Create Query to  find deleted contents from UCM database
3. Create a template to display result
4. Create UCM service to call the Query and Template



Detailed Steps




1.Start Component wizard


2.Add (Menstion the name and details) Display_DeletedContents.it is always good idea to start the component name like CUSTOM_DISPLAY_DELETE


























3.After clicking “ok” , it shows component is created
Add--> ( it will lead to  Add Resource Page ) -- > Select Query -->  






































4. Provide the details


Next   ---> Next ---> 

     
6.   provide Name of the query                                                                                                     mention Query  in the  query tab which has to run in UCM DB
Query is “select ddocName,duser,dactiondate from documenthistory where daction = 'Delete Revision' order by  dactiondate desc

Note that  ; is not required in the SQL 




































7.Define service call from UCM , Like step 4   Add--> ( it will lead to  Add Resource Page ) -- > Select Service  -->  Next --> Next 


8. Mention the Name of service                                                                                                        Service Class : Service  ( Select from drop down)
 Template  : Keep it blank now , after creating the htm template , it should be updated




































9.Then click to add under  action ( it will lead below screen shot )



10,Mention like this the screen shot                                                                                                           

 Type : "Select Cache Query"
 Action : DeleteContent   ( which is created before )
Parameter: myRS  ( which will be used by template )


                                                                                     







































  1.  Create Template to display : like step 4  Add--> ( it will lead to  Add Resource Page ) --  Select Template   -->  Next --> Next 


          it will lead to below screen shot :




Name : DISPLAY_DELETE
Class : User
FormType : HomePage
FileName : displayDelete
















































12.Click on Finish  . ( it will ask to edit the hda file , click on NO )

  Option 1 : Using HTML editor
      a.Set the HTML editor in Component Wizard  ( Options -- > Set HTML editor)
      b.Select Template  (Left Panel ) -->  Select htm ( Right Panel )
      c.Copy paste the html code from step 13


Option 2 : Edit directly in file system

    a.Go to Component Location
    b.Go to Template folder

Example : <DomainFolder>/ucm/cs/custom/<CustomComponent>/templates

   c.Edit the htm file create ( Copy paste the html code from step 13 )

  1. copy paste like this:

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
    <html>
    <head>
            <$defaultPageTitle="Display Delete"$>
            <$include std_html_head_declarations$>
    </head>

    <$include body_def$>

    <$include std_page_begin$>

    <$include std_header$>

    <table class="xuiTitleTable" width="100%" cellpadding="0" cellspacing="0" summary="">
            <tr>
               <td class="xuiPageHeadingCell" colspan=6 align=center>
                  <h1 class="xuiPageHeadingText" align=center><$defaultPageTitle$></h1>
               </td>
            </tr>

    <table class="xuiPageHeadingCell" width="100%" cellpadding="0" cellspacing="0" summary="" border="2">
    <tr>
    <td class="xuiPageHeadingText" align=center width="30%" style="font-weight:bold;"><strong>ContentID</strong></td>
    <td class="xuiPageHeadingText" align=center width=auto  style="font-weight:bold;"><strong>User</strong></td>
    <td class="xuiPageHeadingText" align=center width=auto  style="font-weight:bold;"><strong>ActionDate</strong></td>
    </tr>


    <br><br>


    <$loop myRS$>

    <tr>
    <td class="xuiPageHeadingText" align=center width="30%"><strong><$dDocName$><strong></td>
    <td class="xuiPageHeadingText" align=center width=auto><strong><$dUser$></strong></td>
    <td class="xuiPageHeadingText" align=center width=auto><strong><$dActionDate$></strong></td>
    </tr>


    <$endloop$>

    <$include std_page_end$>

    </body>
    </html>

14. Add template name in service , by editing service details ( Refer step 8 )
15.Go to build --> Build Settings ( click ok to create manifest file ) then Build --> Build the component

16.Option--> Enable
17. Add DisableAuthorizationTokenCheck=true in config.cfg (to disable to idcToken )
18.Restart the UCM

19.Call the IdcService=DISPLAY_DELETE (ex: http://IP:PORT/cs/idcplg?IdcService=DISPLAY_DELETE )

Sample output




















20 .if you want to add link from administration page , then
Add resource like step 3:

Add : Resoure (option 1)  , select html

a.Name : custom_finish_layout_init
b.In Text box :

  navBuilder.addChildNodeTo("ADMINISTRATION", "item", "id==DISPLAY_DELETE",
                                "label==DISPLAYDELETE", "url==<$HttpCgiPath$>?IdcService=DISPLAY_DELETE&idcToken=<$idcToken$>");
             





21 . Build and restart the WCC server
22. Now Idcservice link will under Administartion --> DISPLAY_DELETE

No comments:

Post a Comment