Revisited and improved: PageType based filtering of EPiServer’s EditMode PageTree

Some time ago I developed a small plug-in to EPiServer‘s edit mode page tree, allowing web editors to filter its pages based on all available page types. I decided to spend this weekend in the sun on my balcony with my laptop extending the functionality a great deal. The code is as usual available over at GitHub, and also as a NuGet package in the EPiServer NuGet feed.

Apart from employing the Model-View-Presenter paradigm with unit testing, the largest improvement is the possibility to select which page types that should be available in the filter DropDownList; both on a global as well as on a user specific level. Logging and translation has also been added using log4net and the build-in EPiServer translation language file functionality.

Global PageTypeTreeFilter settings using EPiServer Dynamic Data Store

The global settings for the PageTypeTreeFilter are persisted using EPiServer’s Dynamic Data Store; so it will not work for earlier versions of the EPiServer CMS. Should you still want to use it, you will have to create your own implementation of the IGlobalSettingsRepository interface.

Global settings interface link for the PageTypeTreeFilter functionality

The global settings are available through a Settings link right next to the PageType DropDownList in EPiServer’s Edit Mode. This link will only be shown to users that are members of specific EPiServer roles; defined in the web.config file as seen below.

web.config

<applicationSettings>
 <PageTypeTreeFilter.Properties.Settings>
  <setting name="GlobalSettingsRoles" serializeAs="String">
   <value>WebAdmins, Administrators</value>
  </setting>
 </PageTypeTreeFilter.Properties.Settings>
</applicationSettings>

When installing the NuGet package or looking at the code on GitHub, the default roles for this are the administrator roles (87), but may of course be changed at your discretion.

Global settings interface for the PageTypeTreeFilter functionality

In the global settings interface you may specify which page types that should be included in the DropDownList by moving them to the Selected page types box; either by using the arrows, or by double clicking on them. This works just like the EPiServer Role boxes over in the Admin Mode. At the top there is a checkbox allowing you to let users override your global settings, should you like to grant your web editors that freedom. The Reset to default button will do just this by removing everything from the Dynamic Data Store.

User specific PageTypeTreeFilter settings with the built-in EPiServer User Profile functionality

The user specific settings employs EPiServer’s user profile functionality to store its values. An extra tab has been added when clicking on the My Settings menu alternative as seen below.

User settings interface for the PageTypeTreeFilter functionality

Here each user may define their own available page types if their web administrator allows them to. It works the same way as the global settings, with the difference that there is no reset button. Should the user want to, they can choose not to use their own settings, but rather go with the global ones. If the web administrator did not check the Allow users to override..-checkbox, the whole interface will be disabled and showing an explanation blaming the web admin.

Deactivated user settings interface for the PageTypeTreeFilter functionality