Localization of content is one of the most important feature of a Content Management System. Over the years CMS vendors put a lot of emphasis on making content localization easy and user friendly. If we talk about SDL Tridion, its simply a click and user can localize an item and update it with local content. It is really easy and user friendly, But there is no way one can record the "Reason" to localize the item. So with the passing time no body remembers why the item was localized?
To address this issue, This plugin named "Localize Commenter" is developed. This available on Alchemy Web Store and can be downloaded from here.
The Plugin forces user to add Comments while localizing an Item in Tridion GUI. These Comments could be be viewed and Edited in a Tab inside Item View. Technically, The plugin stores the Comments inside App Data of the Item and doesn't maintain the history of the comments, so once comments are updated the last comments will be deleted forever.
The code for the plugin is available on Github. So if you look at the code, the plugin consists of three extension points as below:
1. Command Extension:
The first requirement was "when user clicks "Localize" from the context menu of an item, the plugin would open a dialog to enter the localize comments" as below:
To achieve this, a Command Extension is implemented which simply extends the Localize command using Anguilla Framework (Code reference "LocalizeCommenterCommandExtension.cs"). This extension simply open a popup "LocalizeCommenterPopUp.aspx" , and cancels the original Localize command.
"LocalizeCommenterPopUp.aspx" page is simple .aspx page, which has a text area, localize button and a cancel button. After entering the comments in the text area when user hit the localize button, item gets localized and comments gets saved to application data of the item.
2. Extension Group:
The second requirement was "when a user opens a shared item by choosing the option 'Localize this item and open it in edit mode', the plugin would open a popup to enter the comments" as below:
For this, a "ExtensionGroup" extension is implemented which simply extends this "Choose an Option" popup by extending "Tridion.Web.UI.Editors.CME.Views.Popups.SharedItemOptions" resource using Anguilla Framework (Code Reference "SharedItemOptionsPopUpExtension.cs"). This simply overrides the "_onOkButtonClicked" event of "Choose an Option" popup and open another popup "LocalizeCommenterPopUp.aspx" to enter the comments, when the "OK" button is clicked.
3. Tab Page Extension:
The third requirement was "Once the item is localized after adding the comments, There should be a way to check and update the saved comments". The plugin shows the saved comments in a "Localize Comments" tab when the item is opened.
To achieve this, a "TabPageExtenstion" extension is implemented (Code Reference "LocalizeCommenterTabPage.cs"). The extension creates a tab named "Localize Comments" in item's view and shows a user control "LocalizeCommenterTab.ascx" inside this. Inside the control, functionality to view/update the comments is implemented.
Please check the code for more details, This plugin is pretty good example of having multiple extensions in a single plugin. If you have any questions, please ask on the post.