use of org.olat.core.extensions.ExtManager in project OpenOLAT by OpenOLAT.
the class ArchiverMainController method buildTreeModel.
/**
* Generates the archiver menu
* @return The generated menu tree model
*/
private TreeModel buildTreeModel(UserRequest ureq) {
GenericTreeNode root, gtn;
GenericTreeModel gtm = new GenericTreeModel();
root = new GenericTreeNode();
root.setTitle(translate("menu.index"));
root.setUserObject(CMD_INDEX);
root.setAltText(translate("menu.index.alt"));
gtm.setRootNode(root);
if (archiverCallback.mayArchiveQtiResults()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.qtiresults"));
gtn.setUserObject(CMD_QTISURVRESULTS);
gtn.setAltText(translate("menu.qtiresults.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveQtiTestResults()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.qtitestresults"));
gtn.setUserObject(CMD_QTITESTRESULTS);
gtn.setAltText("menu.qtitestresults.alt");
root.addChild(gtn);
}
if (archiverCallback.mayArchiveProperties()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.scoreaccounting"));
gtn.setUserObject(CMD_SCOREACCOUNTING);
gtn.setAltText(translate("menu.scoreaccounting.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveHandedInTasks()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.handedintasks"));
gtn.setUserObject(CMD_HANDEDINTASKS);
gtn.setAltText(translate("menu.handedintasks.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveHandedInTasks()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.grouptasks"));
gtn.setUserObject(CMD_GROUPTASKS);
gtn.setAltText(translate("menu.grouptasks.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveProjectBroker()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.projectbroker"));
gtn.setUserObject(CMD_PROJECTBROKER);
gtn.setAltText(translate("menu.projectbroker.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveLogfiles()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.archivelogfiles"));
gtn.setUserObject(CMD_ARCHIVELOGFILES);
gtn.setAltText(translate("menu.archivelogfiles.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveForums()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.forums"));
gtn.setUserObject(CMD_FORUMS);
gtn.setAltText(translate("menu.forums.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveDialogs()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.dialogs"));
gtn.setUserObject(CMD_DIALOGS);
gtn.setAltText(translate("menu.dialogs.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveParticipantFolder()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.participantfolder"));
gtn.setUserObject(CMD_PARTICIPANTFOLDER);
gtn.setAltText("menu.participantfolder.alt");
root.addChild(gtn);
}
if (archiverCallback.mayArchiveWikis()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.wikis"));
gtn.setUserObject(CMD_WIKIS);
gtn.setAltText(translate("menu.wikis.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveScorm()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.scorm"));
gtn.setUserObject(CMD_SCORM);
gtn.setAltText(translate("menu.scorm.alt"));
root.addChild(gtn);
}
if (archiverCallback.mayArchiveChecklist()) {
gtn = new GenericTreeNode();
gtn.setTitle(translate("menu.checklist"));
gtn.setUserObject(CMD_CHECKLIST);
gtn.setAltText(translate("menu.checklist.alt"));
root.addChild(gtn);
}
// add extension menues
ExtManager extm = ExtManager.getInstance();
Class extensionPointMenu = this.getClass();
int cnt = extm.getExtensionCnt();
for (int i = 0; i < cnt; i++) {
Extension anExt = extm.getExtension(i);
// check for sites
ActionExtension ae = (ActionExtension) anExt.getExtensionFor(extensionPointMenu.getName(), ureq);
if (ae != null && anExt.isEnabled()) {
gtn = new GenericTreeNode();
String menuText = ae.getActionText(locale);
gtn.setTitle(menuText);
gtn.setUserObject(ae);
gtn.setAltText(ae.getDescription(locale));
root.addChild(gtn);
// inform only once
if (!extensionLogged) {
extensionLogged = true;
}
}
}
return gtm;
}
use of org.olat.core.extensions.ExtManager in project openolat by klemens.
the class GenericMainController method buildTreeModel.
private TreeModel buildTreeModel(UserRequest ureq) {
GenericTreeNode rootTreeNode = new GenericTreeNode();
rootTreeNode.setTitle(getTranslator().translate("main.menu.title"));
rootTreeNode.setAltText(getTranslator().translate("main.menu.title.alt"));
GenericTreeModel gtm = new GenericTreeModel();
gtm.setRootNode(rootTreeNode);
// Prepend
boolean rootNodeSet = false;
if (nodesToPrepend.size() != 0) {
for (GenericTreeNode node : nodesToPrepend) {
rootTreeNode.addChild(node);
if (!rootNodeSet) {
rootTreeNode.setDelegate(node);
rootTreeNode.setUserObject(node.getUserObject());
rootNodeSet = true;
}
}
}
// add extension menues
ExtManager extm = ExtManager.getInstance();
int j = 0;
GenericTreeNode gtnChild;
Map<GenericTreeNode, String> subMenuNodes = new LinkedHashMap<GenericTreeNode, String>();
for (Extension anExt : extm.getExtensions()) {
// check for sites
ActionExtension ae = (ActionExtension) anExt.getExtensionFor(className, ureq);
if (ae != null && ae instanceof GenericActionExtension) {
if (anExt.isEnabled()) {
GenericActionExtension gAe = (GenericActionExtension) ae;
gtnChild = gAe.createMenuNode(ureq);
if (StringHelper.containsNonWhitespace(gAe.getNavigationKey())) {
gtnChild.setCssClass("o_sel_" + gAe.getNavigationKey());
}
if (gAe.getNodeIdentifierIfParent() != null) {
// it's a parent-node, set identifier
gtnChild.setIdent(gAe.getNodeIdentifierIfParent());
}
if (j == 0 && !rootNodeSet) {
// first node, set as delegate of rootTreenode
rootTreeNode.setDelegate(gtnChild);
rootTreeNode.setUserObject(gAe);
rootTreeNode.addChild(gtnChild);
} else // navigation (submenues)
if (gAe.getParentTreeNodeIdentifier() != null) {
// this is a sub-menu-node, do not add to tree-model already, since
// parent tree may not yet be in model
// (parent could be "after" child, in ActionExtensions-Collection)
String parentNodeID = gAe.getParentTreeNodeIdentifier();
subMenuNodes.put(gtnChild, parentNodeID);
} else // "normal" menu-entry
{
rootTreeNode.addChild(gtnChild);
}
j++;
} else {
logInfo("found disabled GenericActionExtension for " + className + " ", ae.toString());
}
}
}
// loop over submenuNodes and add to their parents
for (Entry<GenericTreeNode, String> childNodeEntry : subMenuNodes.entrySet()) {
GenericTreeNode childNode = childNodeEntry.getKey();
GenericTreeNode parentNode = (GenericTreeNode) gtm.getNodeById(childNodeEntry.getValue());
if (parentNode != null) {
parentNode.addChild(childNode);
if (parentNode.getDelegate() == null) {
boolean addDelegate = true;
// add delegate only if hte parent hasn't not a controller defined
Object uo = parentNode.getUserObject();
if (uo instanceof GenericActionExtension) {
GenericActionExtension gae = (GenericActionExtension) uo;
if (StringHelper.containsNonWhitespace(gae.getClassNameOfCorrespondingController())) {
addDelegate = false;
}
}
if (addDelegate) {
parentNode.setDelegate(childNode);
parentNode.setUserObject(childNode.getUserObject());
}
}
} else {
logWarn("Could not add navigation-menu (" + childNode.getTitle() + ") to parent:: " + childNodeEntry.getValue(), null);
// make it at least appear on top level
rootTreeNode.addChild(childNode);
}
}
// Append
if (nodesToAppend.size() != 0) {
for (GenericTreeNode node : nodesToAppend) {
rootTreeNode.addChild(node);
}
}
return gtm;
}
use of org.olat.core.extensions.ExtManager in project OpenOLAT by OpenOLAT.
the class UserAdminMainController method buildTreeModel.
private TreeModel buildTreeModel(UserRequest ureq) {
boolean isOlatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
GenericTreeNode gtnChild, admin;
Translator translator = getTranslator();
GenericTreeModel gtm = new GenericTreeModel();
admin = new GenericTreeNode();
admin.setTitle(translator.translate("menu.useradmin"));
admin.setUserObject("useradmin");
admin.setCssClass("o_sel_useradmin");
admin.setAltText(translator.translate("menu.useradmin.alt"));
gtm.setRootNode(admin);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.usearch"));
gtnChild.setUserObject("usearch");
gtnChild.setCssClass("o_sel_useradmin_search");
gtnChild.setAltText(translator.translate("menu.usearch.alt"));
admin.setDelegate(gtnChild);
admin.addChild(gtnChild);
Boolean canCreate = BaseSecurityModule.USERMANAGER_CAN_CREATE_USER;
if (canCreate.booleanValue() || isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.ucreate"));
gtnChild.setUserObject("ucreate");
gtnChild.setCssClass("o_sel_useradmin_create");
gtnChild.setAltText(translator.translate("menu.ucreate.alt"));
admin.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.usersimport"));
gtnChild.setUserObject("usersimport");
gtnChild.setCssClass("o_sel_useradmin_import");
gtnChild.setAltText(translator.translate("menu.usersimport.alt"));
admin.addChild(gtnChild);
}
Boolean canDelete = BaseSecurityModule.USERMANAGER_CAN_DELETE_USER;
if (canDelete.booleanValue() || isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.userdelete"));
gtnChild.setUserObject("userdelete");
gtnChild.setCssClass("o_sel_useradmin_delete");
gtnChild.setAltText(translator.translate("menu.userdelete.alt"));
admin.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.userdelete.direct"));
gtnChild.setUserObject("userdelete_direct");
gtnChild.setCssClass("o_sel_useradmin_direct_delete");
gtnChild.setAltText(translator.translate("menu.userdelete.direct.alt"));
admin.addChild(gtnChild);
}
// START submenu access and rights
GenericTreeNode gtn3 = new GenericTreeNode();
gtn3.setTitle(translator.translate("menu.menuaccess"));
gtn3.setUserObject("menuaccess");
gtn3.setAltText(translator.translate("menu.menuaccess.alt"));
admin.addChild(gtn3);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.usergroup"));
gtnChild.setUserObject("usergroup");
gtnChild.setAltText(translator.translate("menu.usergroup.alt"));
gtn3.addChild(gtnChild);
Boolean canAuthors = BaseSecurityModule.USERMANAGER_CAN_MANAGE_AUTHORS;
if (canAuthors.booleanValue() || isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.authorgroup"));
gtnChild.setUserObject("authorgroup");
gtnChild.setAltText(translator.translate("menu.authorgroup.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.coauthors"));
gtnChild.setUserObject("coauthors");
gtnChild.setAltText(translator.translate("menu.coauthors.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.resourceowners"));
gtnChild.setUserObject("resourceowners");
gtnChild.setAltText(translator.translate("menu.resourceowners.alt"));
gtn3.addChild(gtnChild);
}
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.coursecoach"));
gtnChild.setUserObject("coursecoach");
gtnChild.setAltText(translator.translate("menu.coursecoach.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.courseparticipants"));
gtnChild.setUserObject("courseparticipants");
gtnChild.setAltText(translator.translate("menu.courseparticipants.alt"));
gtn3.addChild(gtnChild);
Boolean canGroupmanagers = BaseSecurityModule.USERMANAGER_CAN_MANAGE_GROUPMANAGERS;
if (canGroupmanagers.booleanValue() || isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.groupmanagergroup"));
gtnChild.setUserObject("groupmanagergroup");
gtnChild.setAltText(translator.translate("menu.groupmanagergroup.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.groupcoach"));
gtnChild.setUserObject("groupcoach");
gtnChild.setAltText(translator.translate("menu.groupcoach.alt"));
gtn3.addChild(gtnChild);
}
// admin group and user manager group always restricted to admins
if (isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.usermanagergroup"));
gtnChild.setUserObject("usermanagergroup");
gtnChild.setAltText(translator.translate("menu.usermanagergroup.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.admingroup"));
gtnChild.setUserObject("admingroup");
gtnChild.setAltText(translator.translate("menu.admingroup.alt"));
gtn3.addChild(gtnChild);
}
Boolean canGuests = BaseSecurityModule.USERMANAGER_CAN_MANAGE_GUESTS;
if (canGuests.booleanValue() || isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.anonymousgroup"));
gtnChild.setUserObject("anonymousgroup");
gtnChild.setAltText(translator.translate("menu.anonymousgroup.alt"));
gtn3.addChild(gtnChild);
}
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.noauthentication"));
gtnChild.setUserObject("noauthentication");
gtnChild.setAltText(translator.translate("menu.noauthentication.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.logondeniedgroup"));
gtnChild.setUserObject("logondeniedgroup");
gtnChild.setAltText(translator.translate("menu.logondeniedgroup.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.deletedusers"));
gtnChild.setUserObject("deletedusers");
gtnChild.setAltText(translator.translate("menu.deletedusers.alt"));
gtn3.addChild(gtnChild);
// END submenu access and rights
// START other queries
gtn3 = new GenericTreeNode();
gtn3.setTitle(translator.translate("menu.menuqueries"));
gtn3.setUserObject("menuqueries");
gtn3.setAltText(translator.translate("menu.menuqueries.alt"));
admin.addChild(gtn3);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.userswithoutgroup"));
gtnChild.setUserObject("userswithoutgroup");
gtnChild.setAltText(translator.translate("menu.userswithoutgroup.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.users.without.email"));
gtnChild.setUserObject("userswithoutemail");
gtnChild.setAltText(translator.translate("menu.users.without.email.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.users.email.duplicate"));
gtnChild.setUserObject("usersemailduplicates");
gtnChild.setAltText(translator.translate("menu.users.email.duplicate.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.created.lastweek"));
gtnChild.setUserObject("created.lastweek");
gtnChild.setAltText(translator.translate("menu.created.lastweek.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.created.lastmonth"));
gtnChild.setUserObject("created.lastmonth");
gtnChild.setAltText(translator.translate("menu.created.lastmonth.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.created.sixmonth"));
gtnChild.setUserObject("created.sixmonth");
gtnChild.setAltText(translator.translate("menu.created.sixmonth.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.created.newUsersNotification"));
gtnChild.setUserObject("created.newUsersNotification");
gtnChild.setAltText(translator.translate("menu.created.newUsersNotification.alt"));
gtn3.addChild(gtnChild);
// add extension menues as child items
ExtManager extm = ExtManager.getInstance();
int cnt = extm.getExtensionCnt();
for (int i = 0; i < cnt; i++) {
Extension anExt = extm.getExtension(i);
// 1) general menu extensions
ExtensionElement ee = anExt.getExtensionFor(UserAdminMainController.class.getName() + EXTENSIONPOINT_MENU_MENUQUERIES, ureq);
if (ee instanceof GenericActionExtension && anExt.isEnabled()) {
GenericActionExtension ae = (GenericActionExtension) ee;
gtnChild = new GenericTreeNode();
String menuText = ae.getActionText(getLocale());
gtnChild.setTitle(menuText);
gtnChild.setUserObject(ae);
gtnChild.setAltText(ae.getDescription(getLocale()));
gtn3.addChild(gtnChild);
// inform only once
if (!extensionLogged) {
logInfo("added menu entry for locale " + getLocale().toString() + " '" + menuText + "'", null);
}
}
}
extensionLogged = true;
// END other queries
return gtm;
}
use of org.olat.core.extensions.ExtManager in project OpenOLAT by OpenOLAT.
the class GenericMainController method buildTreeModel.
private TreeModel buildTreeModel(UserRequest ureq) {
GenericTreeNode rootTreeNode = new GenericTreeNode();
rootTreeNode.setTitle(getTranslator().translate("main.menu.title"));
rootTreeNode.setAltText(getTranslator().translate("main.menu.title.alt"));
GenericTreeModel gtm = new GenericTreeModel();
gtm.setRootNode(rootTreeNode);
// Prepend
boolean rootNodeSet = false;
if (nodesToPrepend.size() != 0) {
for (GenericTreeNode node : nodesToPrepend) {
rootTreeNode.addChild(node);
if (!rootNodeSet) {
rootTreeNode.setDelegate(node);
rootTreeNode.setUserObject(node.getUserObject());
rootNodeSet = true;
}
}
}
// add extension menues
ExtManager extm = ExtManager.getInstance();
int j = 0;
GenericTreeNode gtnChild;
Map<GenericTreeNode, String> subMenuNodes = new LinkedHashMap<GenericTreeNode, String>();
for (Extension anExt : extm.getExtensions()) {
// check for sites
ActionExtension ae = (ActionExtension) anExt.getExtensionFor(className, ureq);
if (ae != null && ae instanceof GenericActionExtension) {
if (anExt.isEnabled()) {
GenericActionExtension gAe = (GenericActionExtension) ae;
gtnChild = gAe.createMenuNode(ureq);
if (StringHelper.containsNonWhitespace(gAe.getNavigationKey())) {
gtnChild.setCssClass("o_sel_" + gAe.getNavigationKey());
}
if (gAe.getNodeIdentifierIfParent() != null) {
// it's a parent-node, set identifier
gtnChild.setIdent(gAe.getNodeIdentifierIfParent());
}
if (j == 0 && !rootNodeSet) {
// first node, set as delegate of rootTreenode
rootTreeNode.setDelegate(gtnChild);
rootTreeNode.setUserObject(gAe);
rootTreeNode.addChild(gtnChild);
} else // navigation (submenues)
if (gAe.getParentTreeNodeIdentifier() != null) {
// this is a sub-menu-node, do not add to tree-model already, since
// parent tree may not yet be in model
// (parent could be "after" child, in ActionExtensions-Collection)
String parentNodeID = gAe.getParentTreeNodeIdentifier();
subMenuNodes.put(gtnChild, parentNodeID);
} else // "normal" menu-entry
{
rootTreeNode.addChild(gtnChild);
}
j++;
} else {
logInfo("found disabled GenericActionExtension for " + className + " ", ae.toString());
}
}
}
// loop over submenuNodes and add to their parents
for (Entry<GenericTreeNode, String> childNodeEntry : subMenuNodes.entrySet()) {
GenericTreeNode childNode = childNodeEntry.getKey();
GenericTreeNode parentNode = (GenericTreeNode) gtm.getNodeById(childNodeEntry.getValue());
if (parentNode != null) {
parentNode.addChild(childNode);
if (parentNode.getDelegate() == null) {
boolean addDelegate = true;
// add delegate only if hte parent hasn't not a controller defined
Object uo = parentNode.getUserObject();
if (uo instanceof GenericActionExtension) {
GenericActionExtension gae = (GenericActionExtension) uo;
if (StringHelper.containsNonWhitespace(gae.getClassNameOfCorrespondingController())) {
addDelegate = false;
}
}
if (addDelegate) {
parentNode.setDelegate(childNode);
parentNode.setUserObject(childNode.getUserObject());
}
}
} else {
logWarn("Could not add navigation-menu (" + childNode.getTitle() + ") to parent:: " + childNodeEntry.getValue(), null);
// make it at least appear on top level
rootTreeNode.addChild(childNode);
}
}
// Append
if (nodesToAppend.size() != 0) {
for (GenericTreeNode node : nodesToAppend) {
rootTreeNode.addChild(node);
}
}
return gtm;
}
use of org.olat.core.extensions.ExtManager in project openolat by klemens.
the class UserAdminMainController method buildTreeModel.
private TreeModel buildTreeModel(UserRequest ureq) {
boolean isOlatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
GenericTreeNode gtnChild, admin;
Translator translator = getTranslator();
GenericTreeModel gtm = new GenericTreeModel();
admin = new GenericTreeNode();
admin.setTitle(translator.translate("menu.useradmin"));
admin.setUserObject("useradmin");
admin.setCssClass("o_sel_useradmin");
admin.setAltText(translator.translate("menu.useradmin.alt"));
gtm.setRootNode(admin);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.usearch"));
gtnChild.setUserObject("usearch");
gtnChild.setCssClass("o_sel_useradmin_search");
gtnChild.setAltText(translator.translate("menu.usearch.alt"));
admin.setDelegate(gtnChild);
admin.addChild(gtnChild);
Boolean canCreate = BaseSecurityModule.USERMANAGER_CAN_CREATE_USER;
if (canCreate.booleanValue() || isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.ucreate"));
gtnChild.setUserObject("ucreate");
gtnChild.setCssClass("o_sel_useradmin_create");
gtnChild.setAltText(translator.translate("menu.ucreate.alt"));
admin.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.usersimport"));
gtnChild.setUserObject("usersimport");
gtnChild.setCssClass("o_sel_useradmin_import");
gtnChild.setAltText(translator.translate("menu.usersimport.alt"));
admin.addChild(gtnChild);
}
Boolean canDelete = BaseSecurityModule.USERMANAGER_CAN_DELETE_USER;
if (canDelete.booleanValue() || isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.userdelete"));
gtnChild.setUserObject("userdelete");
gtnChild.setCssClass("o_sel_useradmin_delete");
gtnChild.setAltText(translator.translate("menu.userdelete.alt"));
admin.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.userdelete.direct"));
gtnChild.setUserObject("userdelete_direct");
gtnChild.setCssClass("o_sel_useradmin_direct_delete");
gtnChild.setAltText(translator.translate("menu.userdelete.direct.alt"));
admin.addChild(gtnChild);
}
// START submenu access and rights
GenericTreeNode gtn3 = new GenericTreeNode();
gtn3.setTitle(translator.translate("menu.menuaccess"));
gtn3.setUserObject("menuaccess");
gtn3.setAltText(translator.translate("menu.menuaccess.alt"));
admin.addChild(gtn3);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.usergroup"));
gtnChild.setUserObject("usergroup");
gtnChild.setAltText(translator.translate("menu.usergroup.alt"));
gtn3.addChild(gtnChild);
Boolean canAuthors = BaseSecurityModule.USERMANAGER_CAN_MANAGE_AUTHORS;
if (canAuthors.booleanValue() || isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.authorgroup"));
gtnChild.setUserObject("authorgroup");
gtnChild.setAltText(translator.translate("menu.authorgroup.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.coauthors"));
gtnChild.setUserObject("coauthors");
gtnChild.setAltText(translator.translate("menu.coauthors.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.resourceowners"));
gtnChild.setUserObject("resourceowners");
gtnChild.setAltText(translator.translate("menu.resourceowners.alt"));
gtn3.addChild(gtnChild);
}
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.coursecoach"));
gtnChild.setUserObject("coursecoach");
gtnChild.setAltText(translator.translate("menu.coursecoach.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.courseparticipants"));
gtnChild.setUserObject("courseparticipants");
gtnChild.setAltText(translator.translate("menu.courseparticipants.alt"));
gtn3.addChild(gtnChild);
Boolean canGroupmanagers = BaseSecurityModule.USERMANAGER_CAN_MANAGE_GROUPMANAGERS;
if (canGroupmanagers.booleanValue() || isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.groupmanagergroup"));
gtnChild.setUserObject("groupmanagergroup");
gtnChild.setAltText(translator.translate("menu.groupmanagergroup.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.groupcoach"));
gtnChild.setUserObject("groupcoach");
gtnChild.setAltText(translator.translate("menu.groupcoach.alt"));
gtn3.addChild(gtnChild);
}
// admin group and user manager group always restricted to admins
if (isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.usermanagergroup"));
gtnChild.setUserObject("usermanagergroup");
gtnChild.setAltText(translator.translate("menu.usermanagergroup.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.admingroup"));
gtnChild.setUserObject("admingroup");
gtnChild.setAltText(translator.translate("menu.admingroup.alt"));
gtn3.addChild(gtnChild);
}
Boolean canGuests = BaseSecurityModule.USERMANAGER_CAN_MANAGE_GUESTS;
if (canGuests.booleanValue() || isOlatAdmin) {
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.anonymousgroup"));
gtnChild.setUserObject("anonymousgroup");
gtnChild.setAltText(translator.translate("menu.anonymousgroup.alt"));
gtn3.addChild(gtnChild);
}
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.noauthentication"));
gtnChild.setUserObject("noauthentication");
gtnChild.setAltText(translator.translate("menu.noauthentication.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.logondeniedgroup"));
gtnChild.setUserObject("logondeniedgroup");
gtnChild.setAltText(translator.translate("menu.logondeniedgroup.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.deletedusers"));
gtnChild.setUserObject("deletedusers");
gtnChild.setAltText(translator.translate("menu.deletedusers.alt"));
gtn3.addChild(gtnChild);
// END submenu access and rights
// START other queries
gtn3 = new GenericTreeNode();
gtn3.setTitle(translator.translate("menu.menuqueries"));
gtn3.setUserObject("menuqueries");
gtn3.setAltText(translator.translate("menu.menuqueries.alt"));
admin.addChild(gtn3);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.userswithoutgroup"));
gtnChild.setUserObject("userswithoutgroup");
gtnChild.setAltText(translator.translate("menu.userswithoutgroup.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.users.without.email"));
gtnChild.setUserObject("userswithoutemail");
gtnChild.setAltText(translator.translate("menu.users.without.email.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.users.email.duplicate"));
gtnChild.setUserObject("usersemailduplicates");
gtnChild.setAltText(translator.translate("menu.users.email.duplicate.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.created.lastweek"));
gtnChild.setUserObject("created.lastweek");
gtnChild.setAltText(translator.translate("menu.created.lastweek.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.created.lastmonth"));
gtnChild.setUserObject("created.lastmonth");
gtnChild.setAltText(translator.translate("menu.created.lastmonth.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.created.sixmonth"));
gtnChild.setUserObject("created.sixmonth");
gtnChild.setAltText(translator.translate("menu.created.sixmonth.alt"));
gtn3.addChild(gtnChild);
gtnChild = new GenericTreeNode();
gtnChild.setTitle(translator.translate("menu.created.newUsersNotification"));
gtnChild.setUserObject("created.newUsersNotification");
gtnChild.setAltText(translator.translate("menu.created.newUsersNotification.alt"));
gtn3.addChild(gtnChild);
// add extension menues as child items
ExtManager extm = ExtManager.getInstance();
int cnt = extm.getExtensionCnt();
for (int i = 0; i < cnt; i++) {
Extension anExt = extm.getExtension(i);
// 1) general menu extensions
ExtensionElement ee = anExt.getExtensionFor(UserAdminMainController.class.getName() + EXTENSIONPOINT_MENU_MENUQUERIES, ureq);
if (ee instanceof GenericActionExtension && anExt.isEnabled()) {
GenericActionExtension ae = (GenericActionExtension) ee;
gtnChild = new GenericTreeNode();
String menuText = ae.getActionText(getLocale());
gtnChild.setTitle(menuText);
gtnChild.setUserObject(ae);
gtnChild.setAltText(ae.getDescription(getLocale()));
gtn3.addChild(gtnChild);
// inform only once
if (!extensionLogged) {
logInfo("added menu entry for locale " + getLocale().toString() + " '" + menuText + "'", null);
}
}
}
extensionLogged = true;
// END other queries
return gtm;
}
Aggregations