Skip to content
Ondřej Košarko edited this page Jan 11, 2016 · 1 revision

Control Panel

The new refactored approach has the following advantages:

  • The tabs are configurable without changing the code. e.g. the names and order of the tabs can be changed in controlpanel.cfg
  • No more if else branching to identify current tab and creating links.
  • Unified approach to create normal tabs and checks.
  • Each tab has different class that is easy to manage and debug.
  • Addition of new tabs and checks are very easy.

Adding a new Control Panel Tab

  1. To add a new tab Create a class and extend it from AbstractControlPanelTab.
  2. Implements the function addBody(Map objectModel, Division div).
  3. Add the class as named plugin in controlpanel.cfg

Example Control Panel Tab

package cz.cuni.mff.ufal;

public class ControlPanelTestTab extends AbstractControlPanelTab {

    @Override
    public void addBody(Map objectModel, Division div) throws WingException {
        div.addPara("This is a tab.");
    }

}

controlpanel.cfg entries:

controlpanel.tabs = Test Panel

plugin.named.org.dspace.app.xmlui.aspect.administrative.ControlPanelTab = \
        cz.cuni.mff.ufal.ControlPanelTestTab = Test Panel

Make sure the controlpanel.tabs string is identical to the key for plugin.

Creating a Control Panel check

To include the tab as a check in MainControlCheck, add the named key to controlpanel.checks property in controlpanel.cfg. see the following example config file:

controlpanel.tabs = UFAL Summary, \
                    Verify Logging, \
                    Dspace Log(s), \
                    User Logins, \
                    Shib Raw Logins

plugin.named.org.dspace.app.xmlui.aspect.administrative.ControlPanelTab = \
        cz.cuni.mff.ufal.dspace.app.xmlui.aspect.administrative.MainControlCheck = UFAL Summary, \
        cz.cuni.mff.ufal.dspace.app.xmlui.aspect.administrative.checks.IsLoggingControlCheck = Verify Logging, \
        cz.cuni.mff.ufal.dspace.app.xmlui.aspect.administrative.checks.LoggingControlCheck = Dspace Log(s), \
        cz.cuni.mff.ufal.dspace.app.xmlui.aspect.administrative.checks.LoginControlCheck = User Logins, \
        cz.cuni.mff.ufal.dspace.app.xmlui.aspect.administrative.checks.ShibRawLoginControlCheck = Shib Raw Logins

controlpanel.checks = UFAL Summary, \
                        Verify Logging, \
                        Dspace Log(s), \
                        User Logins, \
                        Shib Raw Logins

Also add the following line as the first line of addBody method in your ControlCheck class. This will enable the ajax support:

    @Override
    public void addBody(Map objectModel, Division div) throws WingException {

        div = div.addDivision( this.getClass().getSimpleName(), "control_check" );
    }

Html helper class

Use the cz.cuni.mff.ufal.dspace.app.xmlui.aspect.administrative.HtmlHelper class to easily add basic html in your control panel tab.

Clone this wiki locally