I have created a button, this will be visible in the toolbar only on opening a Component. I have written config and js file for the same, but the problem is this button is appearing as disabled. Button is there but its not enabled. Please help me, how can I make it enabled.
EDITED
Type.registerNamespace("Extensions.Commands");
Extensions.Commands.Button = function Extensions.Commands$Button(element) {
Type.enableInterface(this, "Extensions.Commands.Button");
this.addInterface("Tridion.Cme.Command", [element]);
this.addInterface("Tridion.Cme.FaCommand", [element]);
alert('inside the pageload');
};
Extensions.Commands.Button.prototype._isAvailable = function Button$_isAvailable(target) {
alert('inside the available mode');
if (target.editor.getDisposed()) {
return false;
}
return true;
};
Extensions.Commands.Button.prototype._isEnabled = function Button$_isEnabled(target) {
alert('inside the enable mode');
if (!Tridion.OO.implementsInterface(target.editor, "Tridion.FormatArea") || target.editor.getDisposed()) {
alert('indise if loop');
return false;
}
return true;
};
My Config file is like this :
<resources cache="true">
<cfg:filters/>
<cfg:groups>
<cfg:group name="Extensions.Commands" >
<cfg:fileset>
<cfg:file type="script">/Popups/PopupReference.js</cfg:file>
</cfg:fileset>
<cfg:dependencies>
<cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
<cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
</cfg:dependencies>
</cfg:group>
<cfg:group name="Extensions.Commands.Button.Commands" merger="Tridion.Web.UI.Core.Configuration.Resources.CommandGroupProcessor" include="byreference" merge="release">
<cfg:fileset>
<cfg:file type="script">/Commands/Button.js</cfg:file>
<cfg:file type="reference">Extensions.Button.CommandSet</cfg:file>
</cfg:fileset>
<cfg:dependencies>
<cfg:dependency>Tridion.Web.UI.Editors.CME</cfg:dependency>
<cfg:dependency>Tridion.Web.UI.Editors.CME.commands</cfg:dependency>
</cfg:dependencies>
</cfg:group>
</cfg:groups>
</resources>
<definitionfiles/>
<extensions>
<ext:editorextensions>
<ext:editorextension target="CME">
<ext:editurls/>
<ext:listdefinitions/>
<ext:taskbars/>
<ext:commands/>
<ext:commandextensions/>
<ext:contextmenus/>
<ext:lists/>
<ext:tabpages/>
<ext:toolbars/>
<ext:ribbontoolbars>
<ext:add>
<!-- RIBBON TAB -->
<!-- GROUPS -->
<ext:extension assignid="ExtensionGroup" pageid="FormatPage" name="ExtensionsName">
<ext:group/>
<ext:apply>
<ext:view name="ComponentView">
<ext:control id="ItemToolbar"/>
</ext:view>
</ext:apply>
</ext:extension>
<!-- BUTTONS -->
<ext:extension pageid="FormatPage" groupid="ExtensionGroup" name="Button" assignid="Button">
<ext:command>Button</ext:command>
<ext:title>Button</ext:title>
<ext:dependencies>
<cfg:dependency>Extensions.Commands.Button</cfg:dependency>
</ext:dependencies>
<ext:apply>
<ext:view name="ComponentView">
<ext:control id="ItemToolbar"/>
</ext:view>
</ext:apply>
</ext:extension>
</ext:add>
</ext:ribbontoolbars>
</ext:editorextension>
</ext:editorextensions>
<ext:dataextenders/>
</extensions>
<commands>
<cfg:commandset id="Extensions.Commands.Button.CommandSet">
<cfg:command name="Button" implementation="Extensions.Commands.Button"/>
<cfg:dependencies>
<cfg:dependency>Extensions.Commands.Button</cfg:dependency>
<cfg:dependency />
</cfg:dependencies>
</cfg:commandset>
</commands>
<contextmenus/>
<localization/>
<settings>
<defaultpage/>
<navigatorurl/>
<editurls/>
<listdefinitions/>
<itemicons/>
<theme>
<path>Themes</path>
</theme>
<customconfiguration/>
</settings>