forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 18
Controlpanel
Ondřej Košarko edited this page Jan 11, 2016
·
1 revision
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.
- To add a new tab Create a class and extend it from AbstractControlPanelTab.
- Implements the function addBody(Map objectModel, Division div).
- Add the class as named plugin in controlpanel.cfg
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.
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" );
}
Use the cz.cuni.mff.ufal.dspace.app.xmlui.aspect.administrative.HtmlHelper class to easily add basic html in your control panel tab.