4

I have successfully retrieved all the components of a page in the SiteEdit using predefined JS function "getAllComponentPresentations". Now my question is how can I create a menu list of these components in the SiteEdit Ribbon Toolbar. Though I can create static menu item by adding "RibbonContextMenuItem" tags in the "MainToolbar.ascx" file. But I want to know how can I dynamically create the menu item list. Please provide me the steps to implement the same.

1
  • I'd be interested in seeing similar functionality for authors, but not necessarily as a list. I'd look at making component names visible on the page--either in Staging-specific markup or somehow added by XPM. Not sure if the CP borders/icons are extendable though? Aug 29, 2013 at 17:05

3 Answers 3

2

The UI extensions just allow you to add buttons, unfortunately it is not possible to do without changing the toolbar source.

4
  • Unless I'm reading it wrong, I believe we can use the Ribbon Item Group for more-complicated control layouts, without changing Tridion's controls. Aug 29, 2013 at 4:24
  • The Ribbon Item Group is for creating buttons under each other, but that still has a limit of three buttons in the expanded ribbon. I don't think it's usable for generating a list of CPs on a Page as a sub menu. Aug 29, 2013 at 9:24
  • @BartKoopman could you suggest, how should we display the CP list dynamically i.e using Javascript API in UI-2012?
    – Indra
    Aug 29, 2013 at 9:44
  • Okay, I assumed too much from the "control" part in Bart's article--the Ribbon Item Group lets us do more than single buttons, but we're still working with buttons. :-) Aug 29, 2013 at 16:32
2

As indicated in my other answer, I don't think you can use any of the available controls for the UI extension model to create a dynamic list (so it seems Eric is right). Trying to start with that and then adding Javascript to inject additional menu items is also not a smart thing to do I would say. You basically step away from the supported extension model and start hacking.

I think I would take a look at simply creating a ribbon button which opens a popup (you can display it as a modal dialog) and in there I would add the list and its functionality still staying inside the UI extension framework, but using your own display elements.

For how to create a popup, you can take a look at the Publish from Publishing Queue extension. Instead of calling an existing page ($cme.Popups.PUBLISH.URL) like is done in there, you can call a page you have in your extension (make it extend Tridion.Web.UI.Controls.TridionPage). To format it as a modal dialog, you can create the popup as follows:

My.Editor.POPUP = {
  URL: $config.expandEditorPath("/Views/Popups/MyPopup.aspx", "MyEditorName"),
  FEATURES: { width: 200, height: 400 },
  OPTIONS: { popupType: $popup.Type.MODAL_IFRAME }
};

p.popup = $popup.create(My.Editor.POPUP.URL, My.Editor.POPUP.FEATURES, My.Editor.POPUP.OPTIONS);

I'm not sure on how to add your items and lay them out etc, this isn't something trivial, so you still have some ground work to do here. Hopefully somebody else is inspired by my answer and can given some more tips and tricks for you to build on.

6
  • we even thought of this, but Menu was the choice from client as they wanted like 1.3 SE. even we do not want that hacking. let me check , if we go by Dialogue approach. I will post the code/tips. thanks for help
    – Indra
    Aug 29, 2013 at 10:51
  • @user662 maybe it's wise to talk to the customer again and see why they really want that feature back and if there perhaps is a simpler way to make them happy without it? Aug 29, 2013 at 11:10
  • Regarding opening the popup I have created a "MyPopup.aspx' file and its corresponding js and css files but when the popup page open up it shows this error "Could not load type 'Tridion.Web.UI.Editors.SiteEdit.Views.MyPopup". The page source have "inherits=Tridion.Web.UI.Editors.SiteEdit.Views.MyPopup". What could me the missing steps that I have to do, please help.
    – Indra
    Aug 29, 2013 at 15:13
  • @user662 Could you create a new question out of that, it deserves a proper answer which probably won't fit in a comment Aug 30, 2013 at 8:04
  • Somehow I resolve the issue by including the dll of the project that I have created for the popup into the bin folder and everything seems to work fine, will share the implementation details soon.
    – Indra
    Sep 2, 2013 at 18:59
1

I think what you are looking for is to create a submenu like the Insert Content button on the Home tab of the XPM ribbon (a similar one would be the Open button on the Home tab of the CME ribbon).

submenu

Should be possible but I haven't done it myself yet. As I showed in my Ribbon Item Group blog post, you basically need to take a look at the .ascx files in your ..\Tridion\web\WebUI\Editors\CME\Controls directory on your CMS and try to find examples of how this is done.

Looking at the Open button on the Home tab of the CME ribbon, this one I located in ..\Tridion\web\WebUI\Editors\CME\Controls\Toolbars\DashboardToolbar.ascx. So based on that I would say you need to use a RibbonSplitButton with RibbonContextMenuItem. But it doesn't look like this is well suited for a dynamic list like all Component Presentations on a Page. Here is how the RibbonSplitButton and RibbonContextMenuItem could be used in your own custom ribbon control:

<c:RibbonGroup runat="server" Label="my group" ID="MyGroup">
  <c:RibbonSplitButton runat="server" CommandName="MyCommand" Title="My Button" Label="My Button" ID="MyBtn">
    <c:RibbonContextMenuItem runat="server" ID="Itm1" Command="Itm1Cmd"  Title="CP 1" Label="CP 1" />
    <c:RibbonContextMenuItem runat="server" ID="Itm2" Command="Itm2Cmd"  Title="CP 2" Label="CP 2" />
    <c:RibbonContextMenuItem runat="server" ID="Itm3" Command="Itm3Cmd"  Title="CP 3" Label="CP 3" />
  </c:RibbonItemsGroup>
</c:RibbonGroup> 
3
  • could you suggest, how should we display the CP list dynamically i.e using Javascript API in UI-2012?
    – Indra
    Aug 29, 2013 at 9:47
  • Yeah come to think of it, I see that this completely wouldn't work for a dynamic list now, let me think about another answer. Aug 29, 2013 at 9:50
  • we are thinking to create a "RibbonSplitButton", then add li using JS in submenu.
    – Indra
    Aug 29, 2013 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.