1

How to create button in context menu on component/page right click.

I tried to configure my extension.config file by refering as mentioned in "http://www.julianwraith.com/2010/10/helloworld-extension-for-tridion-2011/" but i was unable to see any button available.

Could anyone suggest me.

pavan
  • 451
  • 1
  • 5
  • 16
  • 1
    Did you try to clear your browser cache and/or restart IIS, else you will want to start with double checking every step in that example – Bart Koopman Aug 08 '12 at 16:30
  • 1
    Even better: increase the `Update` number in your System.xml as suggested here: http://www.curlette.com/?p=854&cpage=1#comment-1155. – Frank van Puffelen Aug 08 '12 at 19:20
  • Yes i tried to clear the browser cache. When i follow the steps mentioned mentioned in " http://www.julianwraith.com/2010/10/helloworld-extension-for-tridion-2011/ " like creating a virtual directory for the physical path of the source file(unzipped file) 2. Configuring it in Configuration-->System.config. – pavan Aug 09 '12 at 07:28
  • When i try to refresh tridion i ma facing the following error "Loading configuration file "F:\Program Files (x86)\Tridion\customizations\HelloWorld\config\HelloWorld.config" failed: The element 'extensions' in namespace 'http://www.sdltridion.com/2009/GUI/Configuration/Merge' has invalid child element 'taskbars' in namespace 'http://www.sdltridion.com/2009/GUI/extensions'. List of possible elements expected: 'resourceextensions, editorextensions, modelextensions, dataextenders' in namespace 'http://www.sdltridion.com/2009/GUI/extensions'." – pavan Aug 09 '12 at 07:29

1 Answers1

10

Check your configuration file (F:\Program Files (x86)\Tridion\customizations\HelloWorld\config\HelloWorld.config) for unclosed tags or some typo.

To create button in context menu:

  1. Check that your HelloWorld.config extends contextmenu node

    <ext:contextmenus>
        <ext:add>
            <ext:extension name="Hello World" assignid="" insertbefore="cm_preview">
                <ext:menudeclaration>
                    <cmenu:ContextMenuItem id="HelloWorld" name="Hello World" command="HelloWorld"/>
                </ext:menudeclaration>
                <ext:dependencies>
                    <cfg:dependency>RandomStringThatNeedsToBeCompiled2</cfg:dependency>
                </ext:dependencies>
                <ext:apply>
                    <ext:view name="DashboardView"/>
                </ext:apply>
            </ext:extension>
        </ext:add>
    </ext:contextmenus>
    
  2. Modify your helloworld.js to enable button only for Components

    Common.Tridion.MVP.HelloWorld.prototype.isAvailable = function HelloWorld$isAvailable(selection)
    {
        var itemID = selection.getItem(0);
        if ($models.getItemType(itemID) != $const.ItemType.COMPONENT) {
            return false;
        }
    };
    

Don't forget to clear your cache

Bart Koopman
  • 4,835
  • 17
  • 30