title: How can you extend the default behavior of Tridion.Cme.Commands.Open.prototype._execute()?
body: <p>I have written a GUI extension which adds an additional tab to many of the Item views in the SDL Tridion CME (e.g. Component, Page and Schema etc.). I have also written some JavaScript which loads that tab directly if when the view is loaded with a tab name is specified in the URL.</p>
  
  <p>The result is that if a page is loaded with the tab name added as follows:</p>
  
  <pre><code>http://localhost/WebUI/item.aspx?tcm=64#id=tcm:1-48-64&amp;tab=InfoTab
  </code></pre>
  
  <p>Rather than the default of</p>
  
  <pre><code>http://localhost/WebUI/item.aspx?tcm=64#id=tcm:1-48-64
  </code></pre>
  
  <p>The Info Tab will be loaded on top, instead of the General Tab. This is performed with the following code snippet and works very well:</p>
  
  <pre><code>$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);        
      }
  }
  </code></pre>
  
  <p>Now I would like to make a context menu item to open items and link  to the tabs using my new functionality. My first thought was to construct the Item URL myself and simply open a new window in my execute method. So I looked at the default functionality in the standard <code>Open.prototype_execute()</code> functionality of the GUI. This is stored in the <code>navigation.js</code> file of the CME, and is performed by the <code>Tridion.Cme.Commands.Open.prototype._execute</code> method. The code is a lot more complicated than I had anticipated as it deals with shared items, and permissions etc.</p>
  
  <p>Rather than just copying all of this code to my own function, I was wondering if there is a way to elegantly extend the existing <code>Open.prototype_execute()</code> function and append my “&amp;tab=MyTab” to the <code>$cme.Popups.OPEN_ITEM_OPTIONS.URL</code> constant for my own functions.</p>
  
  <p>Any advice would be greatly appreciated.</p>