I wrote a GUI extension that adds an extra tab to many Item views in the SDL Tridion CME (e.g. component, page and layout, etc.). I also wrote some JavaScript that loads this tab directly if a URL is specified when viewing the view with the tab name.
As a result, if the page loads with the bookmark name added as follows:
http://localhost/WebUI/item.aspx?tcm=64
Instead of the default
http://localhost/WebUI/item.aspx?tcm=64
The Information tab will be loaded at the top, not the General tab. This runs with the following code snippet and works very well:
$evt.addEventHandler($display, "start", onDisplayStarted); // This callback is called when any view has finished loading function onDisplayStarted() { $evt.removeEventHandler($display, "start", onDisplayStarted); var tabname = $url.getHashParam("tab"); if (tabname != '') { var tabControl = $controls.getControl($("#MasterTabControl"), "Tridion.Controls.TabControl"); tabControl.selectItem(tabname); } }
Now I would like to make a context menu item to open items and link to tabs using my new functionality. My first thought was to create the Item URL myself and just open a new window in my execute method. So I looked at the default functionality in the standard Open.prototype_execute() GUI functionality. This is saved in the navigation.js CME file and executed by the Tridion.Cme.Commands.Open.prototype._execute method. The code is much more complicated than I expected, as it relates to shared elements, as well as permissions, etc.
Instead of just copying all this code into my own function, I was wondering if there is a way to elegantly extend the existing Open.prototype_execute() function and add my "& tab = MyTab" to the constant $cme.Popups.OPEN_ITEM_OPTIONS.URL for my own functions.
Any advice is appreciated.
source share