06 October 2014

Updating existing Version Creator Module

Hi Folks,

Because of some requirement I need an Sitecore module which can create language version of  Sitecore content based on selection from content tree and including sub-items if selected. The tool contributed by Nehemiah J is fit to bill.

But my project has new requirement that while creating the language version for the entire website from root node(Home Node) user should be able to select few items to exclude. This was due to the point that there will be certain items which are not required to be version for example environment specific items or certain settings items etc.,

Now from design POV, I just need to provide and TreeView List using which user can select items which need to be part of the exclude list. Saying is simple but doing this is another story as due to limitation we have in dialog boxes provided in Sitecore Shell Sheer UI.
Following are the hurdles which i faced:
a) A out of box control which can render a tree view in left hand side and can render list view at right hand side so that user can navigate through the tree while selecting the items. It is something similar to Item selection while creating package using static item selection but in left-right orientation. Remember Dialog boxes are crafted in XAML.
--- No such control.
b) So I planned to use existing tree view control and render it on left hand side and create a custom list view which i will render from server side having selected item list. But then what about whenever some item get clicked in tree view a Postback will be fired.
--- But can't handle this Postback as it required me to make 'enableEventValidation="false"' which is strictly no go.
--- Can't use simple Repeater or .NET List View or any server side control will not render as there is no page event life cycle present in context of dialog box. Dialog box has only following events: OnLoad, OnPreRender, OnOK, OnCancel.
c) Then i thought I will use jQueryAjax based Get request to the dialog box URL and differentiate between initial request based on query string.
--- Well this is the approach i have taken, but again I can't use my good old jQuery syntax straightaway. As Sitecore uses its own jQuery and overwrite the handler. So from Jhon West blog i found we can use it but first need to get my own custom handler for jQuery like following:
var $j = jQuery.noConflict();

Finally to conclude I used plain simple HTML generation at server side and flush that HTML string using jQuery Ajax request. For delete and add jQuery request works like charm. Following are the results of work.


Lesson Learned: Sheer UI customization is not easy always. I hope this is solved in SPEAK where jQuery and HTML have more say. One Open question I didn't put much brain into it but this jQuery based approach doesn't work at all in IE browser, but who likes IE ;-) ?
I will be happy if someone can let know about this open question

You can download the updated Sitecore package from here. You can also read the user manual here.
You can also find the source code for the same.

No comments:

Post a Comment