use of org.olat.core.gui.components.stack.TooledStackedPanel in project OpenOLAT by OpenOLAT.
the class CourseSite method createController.
@Override
protected MainLayoutController createController(UserRequest ureq, WindowControl wControl, SiteConfiguration config) {
RepositoryManager rm = RepositoryManager.getInstance();
RepositoryService rs = CoreSpringFactory.getImpl(RepositoryService.class);
RepositoryEntry entry = rm.lookupRepositoryEntryBySoftkey(repositorySoftKey, false);
if (entry == null) {
return getAlternativeController(ureq, wControl, config);
}
MainLayoutController c;
ICourse course = CourseFactory.loadCourse(entry);
UserSession usess = ureq.getUserSession();
// course-launch-state depending course-settings
RepositoryEntrySecurity reSecurity = rm.isAllowed(ureq, entry);
boolean isAllowedToLaunch = reSecurity.canLaunch();
boolean hasAccess = false;
if (isAllowedToLaunch) {
// either check with securityCallback or use access-settings from course-nodes
if (siteSecCallback != null) {
hasAccess = siteSecCallback.isAllowedToLaunchSite(ureq);
} else if (usess.isInAssessmentModeProcess() && !usess.matchLockResource(course)) {
hasAccess = false;
} else {
// check within course: accessibility of course root node
CourseNode rootNode = course.getRunStructure().getRootNode();
UserCourseEnvironmentImpl uce = new UserCourseEnvironmentImpl(ureq.getUserSession().getIdentityEnvironment(), course.getCourseEnvironment());
NodeEvaluation nodeEval = rootNode.eval(uce.getConditionInterpreter(), new TreeEvaluation(), new VisibleTreeFilter());
boolean mayAccessWholeTreeUp = NavigationHandler.mayAccessWholeTreeUp(nodeEval);
hasAccess = mayAccessWholeTreeUp && nodeEval.isVisible();
}
}
// load course (admins always see content) or alternative controller if course is not launchable
if (hasAccess || usess.getRoles().isOLATAdmin()) {
rs.incrementLaunchCounter(entry);
// build up the context path for linked course
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, entry, new StateSite(this), wControl, true);
CourseRuntimeController runCtr = new CourseRuntimeController(ureq, bwControl, entry, reSecurity, new RuntimeControllerCreator() {
@Override
public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry re, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
return new RunMainController(uureq, wwControl, toolbarPanel, CourseFactory.loadCourse(re), re, security, assessmentMode);
}
}, false, true);
// Configure run controller
// a: don't show close link, is opened as site not tab
runCtr.setCourseCloseEnabled(false);
// b: don't show toolbar
if (!showToolController) {
runCtr.setToolControllerEnabled(false);
}
c = runCtr;
} else {
// access restricted (not in group / author) -> show controller
// defined in olat_extensions (type autoCreator)
c = getAlternativeController(ureq, wControl, config);
}
return c;
}
use of org.olat.core.gui.components.stack.TooledStackedPanel in project OpenOLAT by OpenOLAT.
the class PortfolioConfigForm method doPreview.
private void doPreview(UserRequest ureq) {
removeAsListenerAndDispose(previewCtr);
removeAsListenerAndDispose(columnLayoutCtr);
if (map != null) {
EPSecurityCallback secCallback = new EPSecurityCallbackImpl(false, true);
previewCtr = EPUIFactory.createPortfolioStructureMapPreviewController(ureq, getWindowControl(), map, secCallback);
} else if (binder != null && stackPanel instanceof TooledStackedPanel) {
BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getReadOnlyCallback();
BinderConfiguration bConfig = BinderConfiguration.createTemplateConfig(false);
previewCtr = new BinderController(ureq, getWindowControl(), (TooledStackedPanel) stackPanel, secCallback, binder, bConfig);
} else {
return;
}
listenTo(previewCtr);
columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), previewCtr);
stackPanel.pushController(translate("preview.map"), columnLayoutCtr);
listenTo(columnLayoutCtr);
}
use of org.olat.core.gui.components.stack.TooledStackedPanel in project OpenOLAT by OpenOLAT.
the class PortfolioResultDetailsController method doOpenMap.
private void doOpenMap(UserRequest ureq, Binder binder) {
if (stackPanel instanceof TooledStackedPanel) {
binder = portfolioService.getBinderByKey(binder.getKey());
portfolioService.updateBinderUserInformations(binder, getIdentity());
List<AccessRights> rights = portfolioService.getAccessRights(binder, getIdentity());
BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForCourseCoach(binder, rights);
BinderConfiguration config = BinderConfiguration.createConfig(binder);
BinderController binderCtrl = new BinderController(ureq, getWindowControl(), (TooledStackedPanel) stackPanel, secCallback, binder, config);
String displayName = StringHelper.escapeHtml(binder.getTitle());
stackPanel.pushController(displayName, binderCtrl);
binderCtrl.activate(ureq, null, null);
}
}
use of org.olat.core.gui.components.stack.TooledStackedPanel in project OpenOLAT by OpenOLAT.
the class QTIEditorMainController method init.
private void init(UserRequest ureq) {
main = createVelocityContainer("index");
JSAndCSSComponent jsAndCss;
// Add html header js
jsAndCss = new JSAndCSSComponent("qitjsandcss", new String[] { "js/openolat/qti.js" }, null);
main.put("qitjsandcss", jsAndCss);
mainPanel = new Panel("p_qti_editor");
mainPanel.setContent(main);
if (notEditable) {
// test not editable
VelocityContainer notEditableVc = createVelocityContainer("notEditable");
notEditableButton = LinkFactory.createButton("ok", notEditableVc, this);
Panel panel = new Panel("notEditable");
panel.setContent(notEditableVc);
columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), null, panel, null);
putInitialPanel(columnLayoutCtr.getInitialComponent());
return;
}
stackedPanel = new TooledStackedPanel("qtiEditorStackedPanel", getTranslator(), this);
stackedPanel.setCssClass("o_edit_mode");
// initialize the history
if (qtiPackage.isResumed() && qtiPackage.hasSerializedChangelog()) {
// there were already changes made -> reload!
history = qtiPackage.loadChangelog();
} else {
// start with a fresh history. Editor is resumed but no changes were made
// so far.
history = new HashMap<String, Memento>();
}
// The menu tree model represents the structure of the qti document.
// All insert/move operations on the model are propagated to the structure
// by the node
menuTreeModel = new QTIEditorTreeModel(qtiPackage);
menuTree = new MenuTree("QTIDocumentTree");
menuTree.setTreeModel(menuTreeModel);
menuTree.setSelectedNodeId(menuTree.getTreeModel().getRootNode().getIdent());
// listen to the tree
menuTree.addListener(this);
// remember the qtidoc title when we started this editor, to correctly name
// the history report
startedWithTitle = menuTree.getSelectedNode().getAltText();
//
main.put("tabbedPane", menuTreeModel.getQtiRootNode().createEditTabbedPane(ureq, getWindowControl(), getTranslator(), this));
main.contextPut("qtititle", menuTreeModel.getQtiRootNode().getAltText());
main.contextPut("isRestrictedEdit", restrictedEdit ? Boolean.TRUE : Boolean.FALSE);
//
columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), menuTree, mainPanel, "qtieditor" + qtiPackage.getRepresentingResourceable());
listenTo(columnLayoutCtr);
stackedPanel.pushController("Editor", columnLayoutCtr);
// qtiPackage must be loaded previousely
populateToolC();
// Add css background
if (restrictedEdit) {
addSectionLink.setEnabled(false);
addSCLink.setEnabled(false);
addMCLink.setEnabled(false);
addPoolLink.setEnabled(false);
addFIBLink.setEnabled(false);
if (!qtiPackage.getQTIDocument().isSurvey()) {
addKPrimLink.setEnabled(false);
}
addEssayLink.setEnabled(false);
columnLayoutCtr.addCssClassToMain("o_editor_qti_correct");
} else {
columnLayoutCtr.addCssClassToMain("o_editor_qti");
}
deleteLink.setEnabled(false);
moveLink.setEnabled(false);
copyLink.setEnabled(false);
putInitialPanel(stackedPanel);
if (restrictedEdit) {
// we would like to us a modal dialog here, but this does not work! we
// can't push to stack because the outher workflows pushes us after the
// controller to the stack. Thus, if we used a modal dialog here the
// dialog would never show up.
columnLayoutCtr.setCol3(new Panel("empty"));
columnLayoutCtr.hideCol1(true);
columnLayoutCtr.hideCol2(true);
String text = translate("qti.restricted.edit.warning") + "<br/><br/>" + createReferenceesMsg(ureq);
proceedRestricedEditDialog = DialogBoxUIFactory.createYesNoDialog(ureq, getWindowControl(), null, text);
listenTo(proceedRestricedEditDialog);
proceedRestricedEditDialog.activate();
}
}
use of org.olat.core.gui.components.stack.TooledStackedPanel in project OpenOLAT by OpenOLAT.
the class BlogHandler method createLaunchController.
/**
* @see org.olat.repository.handlers.RepositoryHandler#getLaunchController(org.olat.core.id.OLATResourceable,
* java.lang.String, org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.WindowControl)
*/
@Override
public MainLayoutController createLaunchController(final RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), re);
final FeedSecurityCallback callback = new FeedResourceSecurityCallback(isAdmin, isOwner);
SubscriptionContext subsContext = new SubscriptionContext(re.getOlatResource(), re.getSoftkey());
callback.setSubscriptionContext(subsContext);
return new FeedRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {
@Override
public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
return new FeedMainController(entry.getOlatResource(), uureq, wwControl, null, null, BlogUIFactory.getInstance(uureq.getLocale()), callback, null);
}
});
}
Aggregations