loading table of contents...

7.9.2. Providing default Search Folders

The middle section of the CoreMedia Studio's favorites toolbar is made up of the component favoritesToolbarUserItemsArea which contains user-defined search folders. When you click a search folder, the collection view opens up in search mode showing the results of a predefined query. The user can create custom search folders via the Save Search button of the collection view's toolbar in search mode. Users can also modify existing search folders, change their order, rename them, or delete them altogether.

As a developer, you can provide a default set of search folders to your first-time users, so that the middle section won't appear empty on a user's first login to Studio.

[Warning]Warning

Note that the configuration option shown below explains solely the default set of search folders that users will see on their first login. When Studio detects that there are no custom search folders defined yet for the user logging in, this default set will be copied to this user's settings - from then on, management of the search folder section is completely up to the user, and your configuration will be ignored. If you want to permanently add buttons (including buttons representing search folders) to the Favorites Toolbar, please refer to Section 7.9.1, “Adding buttons to the Favorites Toolbar” above.

You can add default search folders by using the addArrayItemsPlugin on the favoritesToolbarUserItemsArea. Each array item has to include the relevant search parameters that you want to pass to the collection view on opening. These parameters are modularized in terms of the different parts of the collection view in search mode. Thus, each array item is a nested JavaScript object literal that itself contains possibly multiple objects for the various parameter parts. These embedded objects can be accessed via unique keys (see below). In addition, each array item is given a unique name that will also be used as the display text for the resulting search folder in the favorites toolbar.

By default, the different search parameters of the collection view are divided into the following parts:

  • The main part (key _main), featuring the search parameters searchText, contentType, mode, view, folder, orderBy, and limit.

    Note that for the folder property, it is possible to use both of the following notations:

    1. folder: {$Ref: "content/9"} (Rest URI path)

    2. folder: {path: "/Sites/Media"} (content repository path)

  • The status filter (key status), featuring the search parameters inProduction, editedByMe, editedByOthers, notEdited, approved, published and deleted.

  • The last edited filter (key lastEdited), featuring the search parameter lastEditedBy.

Further possible parameters may arise due to plugged in additional filters (c.f. Section 7.11.5, “Adding Search Filters”) where each of them makes up its own part of search parameters. In the source code example below, a default search folder is plugged in that shows all documents under the content repository path folder /Sites/Media that were last edited by the user. You can see that the array item is composed of two of the three parts listed above and has been given a name.

<editor:studioPlugin>
  <ui:rules>
    <editor:favoritesToolbarUserItemsArea>
      <plugins>
        <ui:addArrayItemsPlugin arrayProperty=
              "{favoritesToolbarUserItemsArea.DEFAULT_ITEMS}"
          items='{[
            {_main:{contentType: "Document_",
                    folder: {path: "/Sites/Media"},
                    mode: "search",
                    view: "list",
                    limit: 50},
             lastEdited: {lastEditedBy: "me"},
             _name: "Last edited"}
          ]}'/>
      </plugins>
    </editor:favoritesToolbarUserItemsArea>
  </ui:rules>
</editor:studioPlugin>

Example 7.33. Adding a custom search folder


If in doubt about the actual format for a default search folder entry, you can always customize a search manually in CoreMedia Studio, save it and have a look at the user's preferences where they get saved.