use of org.olat.core.gui.control.Controller in project openolat by klemens.
the class CollaborationTools method createForumController.
/**
* @param ureq
* @param wControl
* @param isAdmin
* @param subsContext the subscriptioncontext if subscriptions to this forum
* should be possible
* @return a forum controller
*/
public Controller createForumController(UserRequest ureq, WindowControl wControl, boolean isAdmin, boolean isGuestOnly, final SubscriptionContext subsContext) {
final boolean isAdm = isAdmin;
final boolean isGuest = isGuestOnly;
Forum forum = getForum();
Translator trans = Util.createPackageTranslator(this.getClass(), ureq.getLocale());
TitleInfo titleInfo = new TitleInfo(null, trans.translate("collabtools.named.hasForum"));
titleInfo.setSeparatorEnabled(true);
Controller forumController = ForumUIFactory.getTitledForumController(ureq, wControl, forum, new ForumCallback() {
@Override
public boolean mayUsePseudonym() {
return false;
}
@Override
public boolean mayOpenNewThread() {
return true;
}
@Override
public boolean mayReplyMessage() {
return true;
}
@Override
public boolean mayEditOwnMessage() {
return true;
}
@Override
public boolean mayDeleteOwnMessage() {
return true;
}
@Override
public boolean mayEditMessageAsModerator() {
return isAdm;
}
@Override
public boolean mayDeleteMessageAsModerator() {
return isAdm;
}
@Override
public boolean mayArchiveForum() {
return !isGuest;
}
@Override
public boolean mayFilterForUser() {
return isAdm;
}
@Override
public SubscriptionContext getSubscriptionContext() {
return subsContext;
}
}, titleInfo);
return forumController;
}
use of org.olat.core.gui.control.Controller in project openolat by klemens.
the class UserAdminController method initTabbedPane.
/**
* Initialize the tabbed pane according to the users rights and the system
* configuration
* @param identity
* @param ureq
*/
private void initTabbedPane(Identity identity, UserRequest ureq) {
// first Initialize the user details tabbed pane
userTabP = new TabbedPane("userTabP", ureq.getLocale());
userTabP.addListener(this);
/**
* Determine, whether the user admin is or is not able to edit all fields in user
* profile form. The system admin is always able to do so.
*/
Boolean canEditAllFields = BaseSecurityModule.USERMANAGER_CAN_EDIT_ALL_PROFILE_FIELDS;
if (securityManager.isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_ADMIN)) {
canEditAllFields = Boolean.TRUE;
}
userProfileCtr = new ProfileAndHomePageEditController(ureq, getWindowControl(), identity, canEditAllFields.booleanValue());
listenTo(userProfileCtr);
userTabP.addTab(translate(NLS_EDIT_UPROFILE), userProfileCtr.getInitialComponent());
userTabP.addTab(translate(NLS_EDIT_UPREFS), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
prefsCtr = new ChangePrefsController(uureq, getWindowControl(), identity);
listenTo(prefsCtr);
return prefsCtr.getInitialComponent();
}
});
if (isPasswordChangesAllowed(identity)) {
userTabP.addTab(translate(NLS_EDIT_UPWD), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
pwdCtr = new UserChangePasswordController(uureq, getWindowControl(), identity);
listenTo(pwdCtr);
return pwdCtr.getInitialComponent();
}
});
}
Boolean canAuth = BaseSecurityModule.USERMANAGER_ACCESS_TO_AUTH;
if (canAuth.booleanValue() || isOlatAdmin) {
userTabP.addTab(translate(NLS_EDIT_UAUTH), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
authenticationsCtr = new UserAuthenticationsEditorController(uureq, getWindowControl(), identity);
listenTo(authenticationsCtr);
return authenticationsCtr.getInitialComponent();
}
});
}
Boolean canProp = BaseSecurityModule.USERMANAGER_ACCESS_TO_PROP;
if (canProp.booleanValue() || isOlatAdmin) {
userTabP.addTab(translate(NLS_EDIT_UPROP), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
propertiesCtr = new UserPropertiesController(uureq, getWindowControl(), identity);
listenTo(propertiesCtr);
return propertiesCtr.getInitialComponent();
}
});
}
Boolean canStartGroups = BaseSecurityModule.USERMANAGER_CAN_START_GROUPS;
userTabP.addTab(translate(NLS_VIEW_GROUPS), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
grpCtr = new GroupOverviewController(uureq, getWindowControl(), identity, canStartGroups);
listenTo(grpCtr);
return grpCtr.getInitialComponent();
}
});
userTabP.addTab(translate(NLS_VIEW_COURSES), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
courseCtr = new CourseOverviewController(uureq, getWindowControl(), identity);
listenTo(courseCtr);
return courseCtr.getInitialComponent();
}
});
if (isOlatAdmin) {
userTabP.addTab(translate(NLS_VIEW_ACCESS), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
Controller accessCtr = new UserOrderController(uureq, getWindowControl(), identity);
listenTo(accessCtr);
return accessCtr.getInitialComponent();
}
});
}
if (isOlatAdmin) {
userTabP.addTab(translate(NLS_VIEW_EFF_STATEMENTS), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
efficicencyCtrl = new CertificateAndEfficiencyStatementListController(uureq, getWindowControl(), identity, true);
listenTo(efficicencyCtrl);
BreadcrumbedStackedPanel stackPanel = new BreadcrumbedStackedPanel("statements", getTranslator(), efficicencyCtrl);
stackPanel.pushController(translate(NLS_VIEW_EFF_STATEMENTS), efficicencyCtrl);
efficicencyCtrl.setBreadcrumbPanel(stackPanel);
stackPanel.setInvisibleCrumb(1);
return stackPanel;
}
});
}
Boolean canSubscriptions = BaseSecurityModule.USERMANAGER_CAN_MODIFY_SUBSCRIPTIONS;
if (canSubscriptions.booleanValue() || isOlatAdmin) {
userTabP.addTab(translate(NLS_VIEW_SUBSCRIPTIONS), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
Controller subscriptionsCtr = new NotificationSubscriptionController(uureq, getWindowControl(), identity, true);
listenTo(subscriptionsCtr);
return subscriptionsCtr.getInitialComponent();
}
});
}
userTabP.addTab(translate(NLS_EDIT_UROLES), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
rolesCtr = new SystemRolesAndRightsController(getWindowControl(), uureq, identity);
listenTo(rolesCtr);
return rolesCtr.getInitialComponent();
}
});
Boolean canQuota = BaseSecurityModule.USERMANAGER_ACCESS_TO_QUOTA;
if (canQuota.booleanValue() || isOlatAdmin) {
userTabP.addTab(translate(NLS_EDIT_UQUOTA), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
String relPath = FolderConfig.getUserHomes() + "/" + identity.getName();
quotaCtr = QuotaManager.getInstance().getQuotaEditorInstance(uureq, getWindowControl(), relPath);
return quotaCtr.getInitialComponent();
}
});
}
if (lectureModule.isEnabled()) {
userTabP.addTab(translate(NLS_VIEW_LECTURES), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
lecturesCtrl = new ParticipantLecturesOverviewController(uureq, getWindowControl(), identity, true, true, true, true);
listenTo(lecturesCtrl);
BreadcrumbedStackedPanel stackPanel = new BreadcrumbedStackedPanel("lectures", getTranslator(), lecturesCtrl);
stackPanel.pushController(translate(NLS_VIEW_LECTURES), lecturesCtrl);
lecturesCtrl.setBreadcrumbPanel(stackPanel);
stackPanel.setInvisibleCrumb(1);
return stackPanel;
}
});
}
if (taxonomyModule.isEnabled()) {
userTabP.addTab(translate(NLS_VIEW_COMPETENCES), new TabCreator() {
@Override
public Component create(UserRequest uureq) {
competencesCtrl = new IdentityCompetencesController(uureq, getWindowControl(), identity);
listenTo(competencesCtrl);
BreadcrumbedStackedPanel stackPanel = new BreadcrumbedStackedPanel("competences", getTranslator(), competencesCtrl);
stackPanel.pushController(translate(NLS_VIEW_COMPETENCES), competencesCtrl);
competencesCtrl.setBreadcrumbPanel(stackPanel);
stackPanel.setInvisibleCrumb(1);
return stackPanel;
}
});
}
// now push to velocity
myContent.put("userTabP", userTabP);
}
use of org.olat.core.gui.control.Controller in project openolat by klemens.
the class NewControllerFactory method launch.
/**
* Launch a controller in a tab or site in the given window from a user
* request url
*
* @param ureq
* @param wControl
*/
public boolean launch(UserRequest ureq, WindowControl wControl) {
BusinessControl bc = wControl.getBusinessControl();
ContextEntry mainCe = bc.popLauncherContextEntry();
if (mainCe == null) {
// nothing to launch
return false;
}
OLATResourceable ores = mainCe.getOLATResourceable();
// Check for RepositoryEntry resource
RepositoryEntry re = null;
if (ores.getResourceableTypeName().equals(OresHelper.calculateTypeName(RepositoryEntry.class))) {
if (ores instanceof RepositoryEntry) {
re = (RepositoryEntry) ores;
ores = re.getOlatResource();
} else {
// It is a repository-entry => get OLATResourceable from RepositoryEntry
RepositoryManager repom = RepositoryManager.getInstance();
re = repom.lookupRepositoryEntry(ores.getResourceableId());
if (re != null) {
ores = re.getOlatResource();
mainCe.upgradeOLATResourceable(re);
}
}
}
// was brasato:: DTabs dts = wControl.getDTabs();
UserSession usess = ureq.getUserSession();
Window window = Windows.getWindows(usess).getWindow(ureq);
if (window == null) {
log.debug("Found no window for jumpin => take WindowBackOffice", null);
window = wControl.getWindowBackOffice().getWindow();
}
DTabs dts = window.getDTabs();
String firstType = mainCe.getOLATResourceable().getResourceableTypeName();
// String firstTypeId = ClassToId.getInstance().lookup() BusinessGroup
ContextEntryControllerCreator typeHandler = getContextEntryControllerCreator(firstType);
if (typeHandler == null) {
log.warn("Cannot found an handler for context entry: " + mainCe, null);
// simply return and don't throw a red screen
return false;
}
if (!typeHandler.validateContextEntryAndShowError(mainCe, ureq, wControl)) {
// simply return and don't throw a red screen
return false;
}
List<ContextEntry> entries = new ArrayList<ContextEntry>(5);
while (bc.hasContextEntry()) {
entries.add(bc.popLauncherContextEntry());
}
List<ContextEntry> ces = new ArrayList<ContextEntry>(entries.size() + 1);
ces.add(mainCe);
if (entries.size() > 0) {
ces.addAll(entries);
}
TabContext context = typeHandler.getTabContext(ureq, ores, mainCe, entries);
String siteClassName = typeHandler.getSiteClassName(ces, ureq);
// open in existing site
boolean launched = false;
boolean assessmentMode = usess.isInAssessmentModeProcess();
if (siteClassName != null) {
if (!assessmentMode) {
dts.activateStatic(ureq, siteClassName, context.getContext());
launched = true;
}
} else if (!assessmentMode || usess.matchLockResource(ores)) {
// get current tab or create new tab
DTab dt = dts.getDTab(ores);
if (dt == null) {
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, dts.getWindowControl());
usess.addToHistory(ureq, bc);
Controller launchC = typeHandler.createController(ces, ureq, bwControl);
if (launchC != null) {
dt = dts.createDTab(context.getTabResource(), re, launchC, context.getName());
if (dt == null) {
launched = false;
} else if (dts.addDTab(ureq, dt)) {
dts.activate(ureq, dt, context.getContext());
launched = true;
}
}
} else {
dts.activate(ureq, dt, context.getContext());
launched = true;
}
}
return launched;
}
use of org.olat.core.gui.control.Controller in project openolat by klemens.
the class UserAdminMainController method createAndLockDirectUserDeleteController.
/**
* Creates a DirectDeleteController and acquire a 'delete-user-lock'.
* The lock is for both direct-deletion and workflow with email.
* @param ureq
* @return
*/
private Component createAndLockDirectUserDeleteController(UserRequest ureq, WindowControl wControl) {
Controller lockCtrl = acquireDeleteUserLock(ureq);
if (lockCtrl == null) {
// success -> create new User deletion workflow
removeAsListenerAndDispose(contentCtr);
contentCtr = new DirectDeleteController(ureq, wControl);
listenTo(contentCtr);
return contentCtr.getInitialComponent();
} else {
// failure -> monolog controller with message that lock failed
return lockCtrl.getInitialComponent();
}
}
use of org.olat.core.gui.control.Controller in project openolat by klemens.
the class DENCourseNode method createNodeRunConstructionResult.
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
Controller controller;
// Do not allow guests to enroll to dates
Roles roles = ureq.getUserSession().getRoles();
if (roles.isGuestOnly()) {
Translator trans = Util.createPackageTranslator(CourseNode.class, ureq.getLocale());
String title = trans.translate("guestnoaccess.title");
String message = trans.translate("guestnoaccess.message");
controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
} else {
controller = new DENRunController(ureq, wControl, getModuleConfiguration(), userCourseEnv, this);
}
Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_en_icon");
return new NodeRunConstructionResult(ctrl);
}
Aggregations