11

Some of our folders have a mandatory Multimedia Schema attached to them, and as such can only contain images. We would like the CME to default to thumbnail view rather than list view for the folders. Can this be achieved with configuration, or would we need to write a GUI extension. Any examples would be greatly appreciated.

This may apply for standard folders, and ECL folders, would the approach be the same for each type of folder?

  • There is no fundamental difference between ECL folders and "standard" CME folders. So the bearded guys :) response should work for both. – Lars Møllebjerg Jun 19 '13 at 10:02
6

I hope there is a better and smarter way to achieve this functionality. But..

There are few points to consider:

  • How to determine if the view should be Thumbnail

When you load Folder content, it does not necessarily mean that you load folder itself. As you mentioned you have a MM schema associated. But unless UI loaded a folder it knows nothing about this folder associations.

As a list solution, you can put an extra/extension information in List root element such as list parent id or its managed action. <tcm:ListItems ID="tcm:1-1-2" Managed="10682" />

I'd advice to put this new attribute into your extension xml namespace. <tcm:ListItems ID="tcm:1-1-2" Managed="10682" uibc:isThumbnailView="true" xmlns:uibc="http://tridion.uibeardcore.com/BeardcoreListExtensions" />

  • How to do it in CME

When you done with data extender. You should extend CME.

Probably the simplest way is to attach “load” event listener on dashboard List. When list loaded, you can check its content and extract an attribute from root element.

if ($display)
{
    (function ()
    {
        $evt.addEventHandler($display, "start", Extension$FolderThumbnailsView$_onDisplayStart);

        function Extension$FolderThumbnailsView$_onDisplayStart()
        {
            $evt.removeEventHandler($display, "start", Extension$FolderThumbnailsView$_onDisplayStart);

            var view = $display.getView();
            if (view && Tridion.OO.implementsInterface(view, "Tridion.Cme.Views.DashboardBase"))
            {
                // Either (to avoid accessing private properties)
                    var filteredDashboardList = $controls.getControl($("#FilteredDashboardList"), "Tridion.Controls.FilteredList");
                    var list = filteredDashboardList && filteredDashboardList.getList();
                // OR 
                    //var list = view.properties.controls.list;

                if (list)
                {
                    $evt.addEventHandler(list, "draw", Extension$FolderThumbnailsView$_switchView);
                }
            }
        };

        function Extension$FolderThumbnailsView$_switchView(event)
        {
            var list = event && event.source;
            if (list && !$evt.isUnloading())
            {
                var isThumbnailView = $xml.getInnerText(list.getContent(), "/tcm:*/@uibc:isThumbnailView", "false", { "uibc": "http://tridion.uibeardcore.com/BeardcoreListExtensions" });
                if (isThumbnailView == "true")
                {
                    list.setView(Tridion.Controls.List.ViewType.THUMBNAILS);
                }
            }
        };
    })();
}
7

That's an interesting requirement, I suspect there's certainly nothing in the CMS to set this.

I suspect this might be quite easy to build using a GUI extension. The list views (in list or details modes) are built (as Iframes) and rendered into the HTML output always, the buttons to toggle the views simply show and hide the relevant frames. I guess you'd just need to know the location ID from the top window and store somewhere a display mode against that ID.

Good luck :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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