SiteManager Views

Ways to show an alternate view:

  1. configs:

    1. sitemanagerView: name of the view to be shown

    2. sitemanagerViewType: “local” or otherwise, where local looks for files locally in client folder.

  2. Session vars:

    1. sitemanagerView: same as above

    2. sitemanagerViewType: same as above

    3. These currently pull from “extra_data” in user’s account and are set as properties directly in the session


To create an alternate view:

  1. Create a local/master version of CLS . sitemanager/sitemanagerInjector_{view}.php where {view} is view name.

  2. Create a local version of sitemanager/js/nav/nav_{view}.js

  3. Create local/master version of sitemanager/js/widgets/dashboard-notifications_{view}.js

 

SitemanagerInjector Class:

global/classes/sitemanager/views/sitemanagerInjector_{viewname}.php

This class defines functions that are used to inject the sitemanager header bar and side nav bar. It is overridden by using a naming convention sitemanagerInjector_{viewname}.php, with a class name inside sitemanagerInjector_{viewname}. The view is specified by the session for the user, or by the config for the whole client.

These replace the original printHeader and printNav functions in sitemanager/html/nav/main and sitemanager/html/header/main. They are called from html/header/main.php, html/footer/main.php, and global/classes/adminPageAssembler::printHeader()

SiteManager View Class:

v6master/global/classes/sitemanager/sitemanagerView.php

This class simply provides some utility functions for loading and identifying injector view classes

 

Troubleshooting:

Here are some issues that can cause complications showing the right view.

Caching:

When a config such as sitemanagerView is loaded, it is cached – even if it is a local config, specified in $client/global/localConfigs.php. Clearing the cache will help, after the config is set to the desired value. It is best to do this while the user is logged out.

Session Storage:

sitemanagerView and sitemanagerViewType are stored in the session for the user, so that they don’t have to be continually looked up in various places. Even after configs change, the user will still have these session variables set until they are logged out.