SDL Tridion GUI extension add deck page from extension configuration file - tridion

I've figured out how to inject a DeckPage into the GUI using javascript. I was wondering if there is a neater way to do this using the extension configuration. For example here is how a tab can be added to the page view in the CME:
<ext:tabpages>
<ext:add>
<ext:extension name="Name of Tab" assignid="TabName" insertbefore="">
<ext:control>~/tab.ascx</ext:control>
<ext:pagetype/>
<ext:apply>
<ext:view name="PageView">
<ext:control id="MasterTabControl"/>
</ext:view>
</ext:apply>
</ext:extension>
</ext:add>
</ext:tabpages>
And I see it's possible to create a <ext:PageDeck> item within the configuration, but so far I've not managed to get the file tab.ascx to display within one.
I'm trying to display the ascx in the Page View, within the Component Presentations tab (select a component presentation) and two PageDecks are shown 'Component Presentation' and 'Target Groups'
Here is what my attempted XML configuration looks like:
<ext:deckpages>
<ext:add>
<ext:extension name="Target Groups Editor" assignid="TargetGroupEditor" insertbefore="">
<ext:control>~/tab.ascx</ext:control>
<ext:pagetype></ext:pagetype>
<ext:apply>
<ext:view name="PageView">
<ext:container name="ComponentPresentationsTab">
<ext:container name="ComponentPresentationPropertiesTabControl">
<ext:control id="targetGroups"/>
</ext:container>
</ext:container>
</ext:view>
</ext:apply>
</ext:extension>
</ext:add>
</ext:deckpages>
I've opened up the CME code files (Page.aspx, ComponentPresentations.ascx) to obtain most of these ids and drill down through them, but i'm making a lot of assumtions as to what the <ext:container> is for and what can be associated to the <ext:control>.
If anyone has done something like this and knows if it's possible i'd be really happy to know the answer... I'd prefer to use the XML, rather than injecting via javascript.
Thanks in advance

I believe that would still be a tab. Try:
<ext:tabpages>
<ext:add>
<ext:extension insertbefore="targetGroups" assignid="TargetGroupEditor" name="Target Groups Editor">
<ext:control>~/tab.ascx</ext:control>
<ext:pagetype>TargetGroupEditor</ext:pagetype>
<ext:apply>
<ext:view name="PageView">
<ext:control id="ComponentPresentationPropertiesTabControl" />
</ext:view>
</ext:apply>
</ext:extension>
</ext:add>
</ext:tabpages>

I've added some deck pages before.
None of those used ext:container elements, but otherwise the XML looked like yours.
Have you tried it without those and just the "targetGroups" control?

Related

Enabling table plugin feature on CQ5

I am working with a task right now which I need to display the existing features of a "table" plugin. However, I am having a hard time enabling it. When using this code below, I only get to have the table properties feature. That's the only displayed tool/icon I have on my richtext editor. Can somebody help me enable/display other features/icons such as (insertcolumn, insertrow, etc)?
<tableField jcr:primaryType="cq:Widget" xtype="richtext">
<rtePlugins jcr:primaryType="nt:unstructured">
<table jcr:primaryType="nt:unstructured" features="*" />
</rtePlugins>
</tableField>
I have tried doing this (below) but I still failed.
<tableField jcr:primaryType="cq:Widget" xtype="richtext">
<rtePlugins jcr:primaryType="nt:unstructured">
<table jcr:primaryType="nt:unstructured" features="[insertcolumn,insertrow]" />
</rtePlugins>
</tableField>
http://dev.day.com/docs/en/cq/current/administering/configuring_rich_text_editor.html
That's the only toolbar button that the table plugin provides. To use the other features, right-click on the table itself:

add small ribbon button to PublishItemsGroup

sorry if this has been covered. I have found how to add a new ribbon toolbar group of small buttons, but I can't seem to find (or figure out) how to add a small button to an existing group of small buttons. I'm trying to add a new button to the PublishItemsGroup (under Publish/Unpublish to the right of Publishing Queue button). If I do this, it creates a whole new group:
<ext:ribbontoolbars>
<ext:add>
<ext:extension pageid="HomePage"
groupid="PublishItemsGroup"
name="Expire"
assignid="ext_expireWorkflow_Btn">
<ext:command>StartWorkflowExpiration</ext:command>
<ext:title>Expire</ext:title>
<ext:issmallbutton>true</ext:issmallbutton>
<ext:dependencies>
<cfg:dependency>mycompany.Resources.Workflow.StartWorkflowExpiration</cfg:dependency>
</ext:dependencies>
<ext:apply>
<ext:view name="DashboardView">
<ext:control id="DashboardToolbar"/>
</ext:view>
</ext:apply>
</ext:extension>
</ext:add>
</ext:ribbontoolbars>
but, if I just use "PublishGroup" then it puts the small button to the right of Publish/Unpublish (not under)
<ext:ribbontoolbars>
<ext:add>
<ext:extension pageid="HomePage"
groupid="PublishGroup"
name="Expire"
assignid="ext_expireWorkflow_Btn">
<ext:command>StartWorkflowExpiration</ext:command>
<ext:title>Expire</ext:title>
<ext:issmallbutton>true</ext:issmallbutton>
<ext:dependencies>
<cfg:dependency>mycompany.Resources.Workflow.StartWorkflowExpiration</cfg:dependency>
</ext:dependencies>
<ext:apply>
<ext:view name="DashboardView">
<ext:control id="DashboardToolbar"/>
</ext:view>
</ext:apply>
</ext:extension>
</ext:add>
</ext:ribbontoolbars>
Is it possible to add a small button to that group? or do I have to override and create a whole new group and then hide the existing PublishItemsGroup?
thanks
~Warner
No, it's not possible to add small button to existing sub-group (group has title on the bottom and they are separated with vertical lines).
And yes, you can add new group with your button in the sub-group and hide the original group.
I've written an explanation on how to use the Ribbon Item Group on tridiondeveloper.com. It is basically a Tridion User Control (.ascx) that you need to specify, and you specify the Ribbon Items Group as an extension in your extension Configuration file.

How to create the custom buttons horizontally one below the other in ribbon of Tridion

How to place more than one custom buttons horizontally - one below the other in tridion ribbon.
Like we have Check-in, Check-out, Undo Check-out buttons.
I tried in creating more than one custom buttons by placing them in a group, but by default they were getting aligned side-by-side but not one below the other.
In one of my articles on Tridion Developer I explained all about how to use the Ribbon Item Group, this fits small buttons under each other, so that you can place 3 buttons in the space of 2 large ones (which are next to each other).
The RibbonItemGroup is not something you can define in the Configuration file of your UI extension, it is a Tridion User Control (.ascx) that you need to specify.
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="ViewItemsGroup.ascx.cs" Inherits="SDL.Examples.UI.Controls.ViewItemsGroup" %>
<%# Import Namespace="Tridion.Web.UI" %>
<c:RibbonItemsGroup runat="server" ID="RibbonItemsGroup">
<c:RibbonButton runat="server" CommandName="ViewStaging" Title="View in Staging" Label="View In Staging" IsSmallButton="true" ID="ViewStagingBtn" />
<c:RibbonButton runat="server" CommandName="ViewLive" Title="View in Live" Label="View in Live" IsSmallButton="true" ID="ViewLiveBtn" />
</c:RibbonItemsGroup>
The code behind file extends a Tridion.Web.UI.Controls.TridionUserControl and doesn’t need any specific code. To include it in the Ribbon toolbar, you specify the Ribbon Items Group as an extension using the following XML in your Configuration file:
<ext:extension assignid="ViewItemsGroup" groupid="EditGroup" name="View" pageid="HomePage" insertbefore="PublishGroup">
<ext:group>~/Controls/ViewItemsGroup.ascx</ext:group>
<ext:dependencies>
<cfg:dependency>My.Theme</cfg:dependency>
<cfg:dependency>My.Commands</cfg:dependency>
</ext:dependencies>
<ext:apply>
<ext:view name="DashboardView">
<ext:control id="DashboardToolbar" />
</ext:view>
<ext:view name="PageView">
<ext:control id="ItemToolbar" />
</ext:view>
</ext:apply>
</ext:extension>

Extending the current publishing/unpublishing screen

I have a requirement where I need to show a an alert/popup when an editor clicks on the Unpublish menu command. I will show the popup with an Yes/No Button, if Yes is selected we proceed and show the existing UnPub screen. If No is selected No activity happens and the user return back to the screen.
How this can be achieved ?
Can we extend/override the existing CME command's without creating a new Command for ourselves?
I just learned how to do this yesterday (Thank to Nuno Linhares) - you need to be familiar with making a new Editor for the GUI first.
Next step is to find the name of the command that you want to overwrite (Probably "UnPublish" in your case). The easiest way to do that is to use "inspect element" with Chrome or FieFox in the GUI, and look for something like c:command="UnPublish" on the button you wish to extend.
Once you have a basic editor set up, you need to add your new command to overwrite your existing one something like this:
<extensions>
<ext:dataextenders />
<ext:editorextensions>
<ext:editorextension target="CME">
<ext:editurls />
<ext:listdefinitions />
<ext:taskbars />
<ext:commands />
<ext:commandextensions>
<ext:commands>
<ext:command name="UnPublish" extendingcommand="CustomUnPublishCommand"/>
</ext:commands>
<ext:dependencies>
<cfg:dependency>CustomUnPublish.CommandSet</cfg:dependency>
</ext:dependencies>
</ext:commandextensions>
<ext:contextmenus />
<ext:lists />
<ext:tabpages />
<ext:toolbars />
<ext:ribbontoolbars />
</ext:editorextension>
</ext:editorextensions>
</extensions>
Add all your dependencies (JS and CSS etc) and command references in the normal way.
Then write your JS execute function as you would any other GUI command, and call the existing command after you have worked on your popup, something like this:
CustomUnPublish.prototype._execute = function CustomUnPublish$_execute(selection, pipeline) {
//Insert some logic to make a popup and confirm
blnOkToProceed = true;
//
if (blnOkToProceed) {
//EDIT: Original code
$cme.getCommand("UnPublish")._execute(selection, pipeline);
//EDIT: Or using the suggestion from #Peter below
$commands.executeCommand("UnPublish", selection, pipeline);
//End Edit
}
return;
};

Whether Ribbon tool bar button will work in Home page tab of Tridion?

I implemented a Ribbon tool bar button for Format page of Tridion 2011 sp1 version. Now my requirement is to move the Ribbon button to Home page - Edit Group and make it work. For that I changed pageid to "FormatPage" and groupid to "EditGroup". It is enabled in home page. For Format page RTFfield I used "FaCommand". For Home page simple text field which command need to be used?
Config. Code:
<ext:extension assignid="EditGroup" pageid="HomePage" name="RTF Extensions">
<ext:group/>
<ext:apply>
<ext:view name="ComponentView">
<ext:control id="ItemToolbar"/>
</ext:view>
</ext:apply>
</ext:extension>
<!-- BUTTONS -->
<ext:extension pageid="HomePage" groupid="EditGroup"
name="Ribbon<br/>Button" assignid="InsertAttribute">
<ext:command>InsertAttribute</ext:command>
<ext:title>Ribbon Button</ext:title>
<ext:dependencies>
<cfg:dependency>InsertAttributeExtension.InsertAttribute.Commands</cfg:dependency>
</ext:dependencies>
<ext:apply>
<ext:view name="ComponentView">
<ext:control id="ItemToolbar"/>
</ext:view>
</ext:apply>
</ext:extension>
My button javascript:
Type.registerNamespace("RTFExtension.Commands");
RTFExtension.Commands.IA = function Commands$IA(name) {
Type.enableInterface(this, "RTFExtension.Commands.IA");
this.addInterface("Tridion.Cme.Command", [name || "IA"]);
this.addInterface("Tridion.Cme.FaCommand", [name || "IA"]);
};
For FormatPage and RTF field I used
FACommand
But for simple text field which command need to be used?
Please help in this issue. Thanks in advance.
I typically use firebug to find the PageId of a particular group in the html source of the tridion dialog. HomePage does seem right. I would have also thought if the value was blank this is where the button will show up.
I will update this answer shortly with a solution if this doesn't help in the short term.

Resources