use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.
the class CollaborationTools method createPortfolioController.
/**
* @param ureq
* @param wControl
* @param mapProperty The property is mandatory!
* @return
*/
private Controller createPortfolioController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, Property mapProperty) {
Long key = mapProperty.getLongValue();
String version = mapProperty.getStringValue();
Controller ctrl;
if ("2".equals(version)) {
PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
Binder binder = portfolioService.getBinderByKey(key);
portfolioService.updateBinderUserInformations(binder, ureq.getIdentity());
BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForBusinessGroup();
BinderController binderCtrl = new BinderController(ureq, wControl, stackPanel, secCallback, binder, BinderConfiguration.createBusinessGroupConfig());
ctrl = binderCtrl;
} else {
PortfolioStructureMap map = (PortfolioStructureMap) CoreSpringFactory.getImpl(EPFrontendManager.class).loadPortfolioStructureByKey(key);
EPSecurityCallback secCallback = new EPSecurityCallbackImpl(true, true);
ctrl = EPUIFactory.createMapViewController(ureq, wControl, map, secCallback);
}
return ctrl;
}
use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.
the class CollaborationTools method createPortfolioController.
/**
* return an controller for the wiki tool
* @param ureq
* @param wControl
* @return
*/
public Controller createPortfolioController(final UserRequest ureq, final WindowControl wControl, final TooledStackedPanel stackPanel, final BusinessGroup group) {
final NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
Property mapProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO);
if (mapProperty != null) {
return createPortfolioController(ureq, wControl, stackPanel, mapProperty);
} else {
return coordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerCallback<Controller>() {
@Override
public Controller execute() {
Controller ctrl;
Property mapKeyProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO);
if (mapKeyProperty == null) {
PortfolioV2Module moduleV2 = CoreSpringFactory.getImpl(PortfolioV2Module.class);
if (moduleV2.isEnabled()) {
PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
Binder binder = portfolioService.createNewBinder(group.getName(), group.getDescription(), null, null);
CoreSpringFactory.getImpl(BinderUserInformationsDAO.class).updateBinderUserInformationsInSync(binder, ureq.getIdentity());
mapKeyProperty = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO, null, binder.getKey(), "2", null);
BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForBusinessGroup();
BinderController binderCtrl = new BinderController(ureq, wControl, stackPanel, secCallback, binder, BinderConfiguration.createBusinessGroupConfig());
List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType("Toc");
binderCtrl.activate(ureq, entries, null);
ctrl = binderCtrl;
ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(binder));
ThreadLocalUserActivityLogger.log(PortfolioLoggingAction.PORTFOLIO_BINDER_CREATED, getClass());
} else {
EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
PortfolioStructureMap map = ePFMgr.createAndPersistPortfolioDefaultMap(group.getName(), group.getDescription());
Translator pT = Util.createPackageTranslator(EPCreateMapController.class, ureq.getLocale());
// add a page, as each map should have at least one per default!
ePFMgr.createAndPersistPortfolioPage(map, pT.translate("new.page.title"), pT.translate("new.page.desc"));
mapKeyProperty = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO, null, map.getKey(), null, null);
EPSecurityCallback secCallback = new EPSecurityCallbackImpl(true, true);
ctrl = EPUIFactory.createMapViewController(ureq, wControl, map, secCallback);
}
npm.saveProperty(mapKeyProperty);
} else {
ctrl = createPortfolioController(ureq, wControl, stackPanel, mapProperty);
}
return ctrl;
}
});
}
}
use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class ResumeSessionController method pushNextInterceptor.
private void pushNextInterceptor(UserRequest ureq) {
int currentCtrlIndex = -1;
if (currentInterceptor != null) {
currentCtrlIndex = interceptors.indexOf(currentInterceptor);
removeAsListenerAndDispose(currentInterceptor.getController());
}
if ((currentCtrlIndex + 1) < interceptors.size()) {
int nextCtrlIndex = currentCtrlIndex + 1;
if (interceptors.get(nextCtrlIndex) == null) {
return;
}
if (wizardCtrl != null) {
// actualCtrNr = ctrNr;
wizardCtrl.setCurStep(nextCtrlIndex + 1);
}
currentInterceptor = interceptors.get(nextCtrlIndex);
Controller currentCtrl = currentInterceptor.getController();
if (currentCtrl != null) {
listenTo(currentCtrl);
if (StringHelper.containsNonWhitespace(currentInterceptor.getI18nKey())) {
String[] introComb = currentInterceptor.getI18nKey().split(":");
mainVC.contextPut("introPkg", introComb[0]);
mainVC.contextPut("introKey", introComb[1]);
} else {
mainVC.contextRemove("introPkg");
mainVC.contextRemove("introKey");
}
currentPanel.setContent(currentCtrl.getInitialComponent());
}
} else {
cmc.deactivate();
if (StringHelper.containsNonWhitespace(redirect.getRedirectUrl())) {
String bc = redirect.getFormattedRedirectUrl();
launch(ureq, bc);
redirect(ureq, redirect.getRedirectUrl());
}
terminateInterception(ureq);
}
}
use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method addDTab.
@Override
public boolean addDTab(UserRequest ureq, DTab dt) {
if (isDisposed()) {
return false;
}
DTab old = getDTab(dt.getOLATResourceable());
if (old != null) {
return true;
}
// add to tabs list
synchronized (dtabs) {
// make dtabs and dtabsControllers access synchronized
dtabs.add(dt);
dtabsLinkNames.add(dtabCreateCounter);
Link link = LinkFactory.createCustomLink("a" + dtabCreateCounter, "a" + dtabCreateCounter, "", Link.NONTRANSLATED, navTabsVc, this);
link.setCustomDisplayText(StringHelper.escapeHtml(dt.getNavElement().getTitle()));
link.setIconLeftCSS("o_icon o_icon-fw " + dt.getNavElement().getIconCSSClass());
link.setTitle(dt.getTitle());
link.setUserObject(dt);
// Set accessibility access key using the 's' key. You can loop through all opened tabs by
// pressing s repetitively (works only in IE/FF which is normally used by blind people)
link.setAccessKey("s");
// add close links
Link calink = LinkFactory.createCustomLink("c" + dtabCreateCounter, "c" + dtabCreateCounter, "", Link.NONTRANSLATED, navTabsVc, this);
calink.setCustomEnabledLinkCSS("o_navbar_tab_close");
calink.setIconLeftCSS("o_icon o_icon_close_tab");
calink.setTitle(translate("close"));
calink.setUserObject(dt);
Controller dtabCtr = dt.getController();
dtabCtr.addControllerListener(this);
updateBusinessPath(ureq, dt);
// add to tabs controller lookup table for later event dispatching
dtabsControllers.add(dtabCtr);
// increase DTab added counter.
dtabCreateCounter++;
}
return true;
}
Aggregations