How can you extend the default behavior of Tridion.Cme.Commands.Open.prototype._execute ()?

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#id=tcm:1-48-64&tab=InfoTab 

Instead of the default

 http://localhost/WebUI/item.aspx?tcm=64#id=tcm:1-48-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.

+6
source share
1 answer

In the end, the Open command uses $config.getEditorUrl(item_type) to get the URL to represent the item (item_type - $const.ItemType.COMPONENT etc.). There are no extension points for this part of the functionality, but you can always try to overwrite it at your own risk.

+3
source

Source: https://habr.com/ru/post/928036/


All Articles