use of org.olat.core.gui.control.generic.messages.MessageController in project OpenOLAT by OpenOLAT.
the class DisposedCourseRestartController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
* org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == restartLink) {
OLATResourceable ores = OLATResourceManager.getInstance().findResourceable(courseRepositoryEntry.getOlatResource().getResourceableId(), courseRepositoryEntry.getOlatResource().getResourceableTypeName());
if (ores == null) {
// course was deleted!
MessageController msgController = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), translate("course.deleted.title"), translate("course.deleted.text"));
panel.setContent(msgController.getInitialComponent());
} else {
OLATResourceable reOres = OresHelper.clone(courseRepositoryEntry);
DTabs dtabs = getWindowControl().getWindowBackOffice().getWindow().getDTabs();
if (dtabs != null) {
DTab dt = dtabs.getDTab(reOres);
if (dt != null) {
dtabs.removeDTab(ureq, dt);
}
}
List<ContextEntry> entries = null;
List<HistoryPoint> stacks = ureq.getUserSession().getHistoryStack();
for (int i = stacks.size(); i-- > 0; ) {
HistoryPoint point = stacks.get(i);
if (point != null && point.getEntries() != null && point.getEntries().size() > 0) {
ContextEntry entry = point.getEntries().get(0);
if (reOres.equals(entry.getOLATResourceable())) {
entries = point.getEntries();
break;
}
}
}
WindowControl bwControl;
if (entries == null) {
bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(getWindowControl(), reOres);
} else {
BusinessControl bc = BusinessControlFactory.getInstance().createFromContextEntries(entries);
bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
}
NewControllerFactory.getInstance().launch(ureq, bwControl);
dispose();
}
}
}
use of org.olat.core.gui.control.generic.messages.MessageController in project OpenOLAT by OpenOLAT.
the class ScormRunController method doSetMissingResourcesWarning.
private void doSetMissingResourcesWarning(UserRequest ureq) {
String text = translate("error.cprepoentrymissing.user");
MessageController missingCtrl = MessageUIFactory.createWarnMessage(ureq, getWindowControl(), null, text);
listenTo(missingCtrl);
main.setContent(missingCtrl.getInitialComponent());
}
use of org.olat.core.gui.control.generic.messages.MessageController in project openolat by klemens.
the class RunMainController method updateTreeAndContent.
private CourseNode updateTreeAndContent(UserRequest ureq, CourseNode calledCourseNode, String nodecmd, List<ContextEntry> entries, StateEntry state) {
// might be used in both controllers with the same ID (e.g. the course folder)
if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
currentNodeController.dispose();
}
NodeClickedRef nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), calledCourseNode, this, nodecmd);
if (!nclr.isVisible()) {
// if not root -> fallback to root. e.g. when a direct node jump fails
if (calledCourseNode != null) {
nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), null, this, null);
}
if (!nclr.isVisible()) {
MessageController msgController = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), translate("course.noaccess.title"), translate("course.noaccess.text"));
contentP.setContent(msgController.getInitialComponent());
luTree.setTreeModel(new GenericTreeModel());
return null;
}
}
treeModel = nclr.getTreeModel();
luTree.setTreeModel(treeModel);
String selNodeId = nclr.getSelectedNodeId();
luTree.setSelectedNodeId(selNodeId);
luTree.setOpenNodeIds(nclr.getOpenNodeIds());
// get new run controller.
currentNodeController = nclr.getRunController();
addToHistory(ureq, currentNodeController);
if (currentNodeController instanceof TitledWrapperController) {
Controller contentcontroller = ((TitledWrapperController) currentNodeController).getContentController();
addToHistory(ureq, contentcontroller);
if (contentcontroller instanceof Activateable2) {
((Activateable2) contentcontroller).activate(ureq, entries, state);
}
} else if (currentNodeController instanceof Activateable2) {
((Activateable2) currentNodeController).activate(ureq, entries, state);
}
if (currentNodeController != null) {
contentP.setContent(currentNodeController.getInitialComponent());
} else {
MessageController msgCtrl = MessageUIFactory.createWarnMessage(ureq, getWindowControl(), null, translate("msg.nodenotavailableanymore"));
listenTo(msgCtrl);
contentP.setContent(msgCtrl.getInitialComponent());
}
updateNextPrevious();
updateCourseDataAttributes(nclr.getCalledCourseNode());
updateLastUsage(nclr.getCalledCourseNode());
return nclr.getCalledCourseNode();
}
use of org.olat.core.gui.control.generic.messages.MessageController in project OpenOLAT by OpenOLAT.
the class RepositoyUIFactory method createRepoEntryDisabledDueToSecurityMessageController.
/**
* Create main controller that does nothing but displaying a message that
* this resource is disabled due to security constraints
*
* @param ureq
* @param wControl
* @return
*/
public static GenericMainController createRepoEntryDisabledDueToSecurityMessageController(UserRequest ureq, WindowControl wControl) {
// wrap simple message into mainLayout
GenericMainController glc = new GenericMainController(ureq, wControl) {
@Override
public void init(UserRequest uureq) {
Panel empty = new Panel("empty");
setTranslator(Util.createPackageTranslator(RepositoryModule.class, uureq.getLocale()));
MessageController contentCtr = MessageUIFactory.createInfoMessage(uureq, getWindowControl(), translate("security.disabled.title"), translate("security.disabled.info"));
// auto dispose later
listenTo(contentCtr);
Component resComp = contentCtr.getInitialComponent();
LayoutMain3ColsController columnLayoutCtr = new LayoutMain3ColsController(uureq, getWindowControl(), empty, resComp, /*do not save no prefs*/
null);
// auto dispose later
listenTo(columnLayoutCtr);
putInitialPanel(columnLayoutCtr.getInitialComponent());
}
@Override
protected Controller handleOwnMenuTreeEvent(Object uobject, UserRequest uureq) {
// no menutree means no menu events.
return null;
}
};
glc.init(ureq);
return glc;
}
use of org.olat.core.gui.control.generic.messages.MessageController in project OpenOLAT by OpenOLAT.
the class RunMainController method updateTreeAndContent.
private CourseNode updateTreeAndContent(UserRequest ureq, CourseNode calledCourseNode, String nodecmd, List<ContextEntry> entries, StateEntry state) {
// might be used in both controllers with the same ID (e.g. the course folder)
if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
currentNodeController.dispose();
}
NodeClickedRef nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), calledCourseNode, this, nodecmd);
if (!nclr.isVisible()) {
// if not root -> fallback to root. e.g. when a direct node jump fails
if (calledCourseNode != null) {
nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), null, this, null);
}
if (!nclr.isVisible()) {
MessageController msgController = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), translate("course.noaccess.title"), translate("course.noaccess.text"));
contentP.setContent(msgController.getInitialComponent());
luTree.setTreeModel(new GenericTreeModel());
return null;
}
}
treeModel = nclr.getTreeModel();
luTree.setTreeModel(treeModel);
String selNodeId = nclr.getSelectedNodeId();
luTree.setSelectedNodeId(selNodeId);
luTree.setOpenNodeIds(nclr.getOpenNodeIds());
// get new run controller.
currentNodeController = nclr.getRunController();
addToHistory(ureq, currentNodeController);
if (currentNodeController instanceof TitledWrapperController) {
Controller contentcontroller = ((TitledWrapperController) currentNodeController).getContentController();
addToHistory(ureq, contentcontroller);
if (contentcontroller instanceof Activateable2) {
((Activateable2) contentcontroller).activate(ureq, entries, state);
}
} else if (currentNodeController instanceof Activateable2) {
((Activateable2) currentNodeController).activate(ureq, entries, state);
}
if (currentNodeController != null) {
contentP.setContent(currentNodeController.getInitialComponent());
} else {
MessageController msgCtrl = MessageUIFactory.createWarnMessage(ureq, getWindowControl(), null, translate("msg.nodenotavailableanymore"));
listenTo(msgCtrl);
contentP.setContent(msgCtrl.getInitialComponent());
}
updateNextPrevious();
updateCourseDataAttributes(nclr.getCalledCourseNode());
updateLastUsage(nclr.getCalledCourseNode());
return nclr.getCalledCourseNode();
}
Aggregations