Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extension to the page icon status in SDL Trdidion 2009

Tags:

tridion

We are using SDL Tridion 2009 SP1. We have implemented a new functionality, an extension in our CMS which allowed us to lock a page. If a page it is locked it cannot longer be published ( the information of a page that is locked is kept in a database which was created for this extension).

We want to add a new icon which will notify the user on the new status of the page.

Now there are 4 combination of icons ( no action , checked , published , checked and published )

Since I do not have a long experience with the CMS interface I want some help on finding a solution that have no impact on performance and that it easy to implement in terms of not doing of lot of modification.

Below is my investigation regarding this:

I noticed that the way the icons are render in the cms is not a simple mechanism that can be easy updated. Each time we click on an item in the left side of the CMS, in order to render the list from the right side a ajax call (with an xml request) is done to the WebGUIResponder.aspx. page.

The response we will get back is a xml that contain the attribute field Icon

<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0" 
    ID="tcm:yyy-zzzz-4" Managed="68" ItemType="4">
    <tcm:Item ID="tcm:yyy-zzzzz-64" Type="64" Title="NotificationTest" 
        Modified="2011-05-09T09:42:27" FromPub="400 YYYY Website Master (EN-GB)" 
        IsNew="false" Icon="T64L0P1"/>
</tcm:ListItems>

Based on this field Icon attribute (Icon="T64L0P1) the image name starts to be processed.

  • T64 = means it is a page
  • L0 = is not checked
  • P1 = it is already published

For such a field the image name result will be = T64.16x16.List.Published.gif

I couldn't find a way to update this field through the page xml, is not an information that is kept in the xml but rather is build in the dll when the xml request . (Somewhere based on other fields like published and something else this Icon field is calculated.)

So if it is not possible to modify this field the option we may have is: In order to integrate our change in the CMS without modifying their .dll (this for compatibility with the new version of the SDL Trdion is not good to modify in the dlll) and without changing too much the logic I was thinking to this approach.

We can make a new Ajax call to a a new page WebGUICheckPageLocked.aspx (need to be tested what will be the impact on the performance). In the code behind of this page we can determine if the page is locked or not ( used our internal function that determine if the page is locked or not this functionality is already done). In the page we will change the icon field to something T64L0P1E01 (adding some extra information which will allowed us to determine the new status of the page ). We will also modify the In the GetPNGIconName javascript function we can then make an extra check taking in consideration the new information E01 ...)

Please if someone have some better idea on this, maybe it is something easy that can be done, maybe it is a way we can update the Icon field.

Kind Regards, Cristina

like image 892
Cristina Avatar asked May 02 '12 16:05

Cristina


1 Answers

I'll paste my answer from the forums here, so everyone can see (and maybe bring ideas on how to do it differently?)...

In 2011 I would use a Data Extender to change the icon.

Since this is 2009 you will need to use the less elegant predecessor: the GUI Responder Extension. Essentially you need to manipulate the XML that is returned for the relevant requests (such as the GetList on a Folder).

I couldn't immediately find any documentation on this - which is not surprising as it is an older version. But it boils down to this:

  1. Create a .NET assembly containing a class with the following method signature and attribute:
    [ResponseMessageHandler]
    public XmlDocument HandleMessage(XmlDocument messageXml, string userName, HttpContext httpContext, object tcmSession)
  1. In that method, you can change the icon set in the XML based on your own logic.
  2. In the extension configuration file, add a section to hook into the response for the lists you care about (substitute "YourResponderExtension.dll" with the name of the assembly you added):
<ProcessResponse>
    <!-- GetList -->
    <ExecuteWhen>/tcmapi:Message/tcmapi:Response/tcmapi:Request/tcmapi:GetList</ExecuteWhen>                                                                                    

    <!-- Handler for all of the above -->
    <Execute>/bin/YourResponderExtension.dll</Execute>
</ProcessResponse>
  1. Add more elements before the if applicable - and make the XPath query as specific as you can to avoid your extension being called unnecessarily. You might also need to check for more cases in the .NET code that you can't do with the XPath query.
  2. ZIP up your extension and deploy it with TcmExtensionInstaller.exe.

From your text I'm assuming you've already worked out how to create and package an extension in 2009. I hope that these smalls steps can get you started.

If you have any trouble or follow-up questions, just let me know and I'll see if I can answer them.

like image 140
Peter Kjaer Avatar answered Nov 11 '22 12:11

Peter Kjaer