Search in sources :

Example 1 with TitledWrapperController

use of org.olat.core.gui.control.generic.title.TitledWrapperController in project OpenOLAT by OpenOLAT.

the class TitledWrapperHelper method getWrapper.

public static Controller getWrapper(UserRequest ureq, WindowControl wControl, Controller controller, CourseNode courseNode, String iconCssClass) {
    String displayOption = courseNode.getDisplayOption();
    if (CourseNode.DISPLAY_OPTS_CONTENT.equals(displayOption)) {
    // don't change anything
    } else if (CourseNode.DISPLAY_OPTS_SHORT_TITLE_CONTENT.equals(displayOption)) {
        if (StringHelper.containsNonWhitespace(courseNode.getShortTitle())) {
            TitleInfo titleInfo = new TitleInfo(null, courseNode.getShortTitle(), null, courseNode.getIdent());
            titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
            if (StringHelper.containsNonWhitespace(iconCssClass)) {
                titleInfo.setIconCssClass(iconCssClass);
            }
            controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
        }
    } else if (CourseNode.DISPLAY_OPTS_TITLE_CONTENT.equals(displayOption)) {
        if (StringHelper.containsNonWhitespace(courseNode.getLongTitle())) {
            TitleInfo titleInfo = new TitleInfo(null, courseNode.getLongTitle(), null, courseNode.getIdent());
            titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
            if (StringHelper.containsNonWhitespace(iconCssClass)) {
                titleInfo.setIconCssClass(iconCssClass);
            }
            controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
        }
    } else if (CourseNode.DISPLAY_OPTS_SHORT_TITLE_DESCRIPTION_CONTENT.equals(displayOption)) {
        String title = courseNode.getShortTitle();
        String description = null;
        if (StringHelper.containsNonWhitespace(courseNode.getLearningObjectives())) {
            if (StringHelper.containsNonWhitespace(title)) {
                description = courseNode.getLearningObjectives();
            }
        }
        if (StringHelper.containsNonWhitespace(title) || StringHelper.containsNonWhitespace(description)) {
            TitleInfo titleInfo = new TitleInfo(null, title, description, courseNode.getIdent());
            titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
            if (StringHelper.containsNonWhitespace(iconCssClass)) {
                titleInfo.setIconCssClass(iconCssClass);
            }
            controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
        }
    } else if (CourseNode.DISPLAY_OPTS_TITLE_DESCRIPTION_CONTENT.equals(displayOption)) {
        String title = courseNode.getLongTitle();
        String description = null;
        if (StringHelper.containsNonWhitespace(courseNode.getLearningObjectives())) {
            description = courseNode.getLearningObjectives();
        }
        if (StringHelper.containsNonWhitespace(title) || StringHelper.containsNonWhitespace(description)) {
            TitleInfo titleInfo = new TitleInfo(null, title, description, courseNode.getIdent());
            titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
            if (StringHelper.containsNonWhitespace(iconCssClass)) {
                titleInfo.setIconCssClass(iconCssClass);
            }
            controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
        }
    }
    return controller;
}
Also used : TitledWrapperController(org.olat.core.gui.control.generic.title.TitledWrapperController) TitleInfo(org.olat.core.gui.control.generic.title.TitleInfo)

Example 2 with TitledWrapperController

use of org.olat.core.gui.control.generic.title.TitledWrapperController in project OpenOLAT by OpenOLAT.

the class ForumUIFactory method getTitledForumController.

/**
 * Provides a ForumController wrapped in a titled controller.
 * @param ureq
 * @param forum
 * @param forumCallback
 * @param title
 * @return a TitledWrapperController
 */
public static Controller getTitledForumController(UserRequest ureq, WindowControl wControl, Forum forum, ForumCallback forumCallback, TitleInfo titleInfo) {
    ForumController popupFoCtr = new ForumController(ureq, wControl, forum, forumCallback, true);
    TitledWrapperController forumWrapperController = new TitledWrapperController(ureq, wControl, popupFoCtr, "o_course_run", titleInfo);
    // Set CSS values to default forum icons if no values are set in the title info
    if (!StringHelper.containsNonWhitespace(titleInfo.getIconCssClass())) {
        forumWrapperController.setIconCssClass(ForumHelper.CSS_ICON_CLASS_FORUM);
    }
    return forumWrapperController;
}
Also used : TitledWrapperController(org.olat.core.gui.control.generic.title.TitledWrapperController) ForumController(org.olat.modules.fo.ui.ForumController)

Example 3 with TitledWrapperController

use of org.olat.core.gui.control.generic.title.TitledWrapperController in project openolat by klemens.

the class TitledWrapperHelper method getWrapper.

public static Controller getWrapper(UserRequest ureq, WindowControl wControl, Controller controller, CourseNode courseNode, String iconCssClass) {
    String displayOption = courseNode.getDisplayOption();
    if (CourseNode.DISPLAY_OPTS_CONTENT.equals(displayOption)) {
    // don't change anything
    } else if (CourseNode.DISPLAY_OPTS_SHORT_TITLE_CONTENT.equals(displayOption)) {
        if (StringHelper.containsNonWhitespace(courseNode.getShortTitle())) {
            TitleInfo titleInfo = new TitleInfo(null, courseNode.getShortTitle(), null, courseNode.getIdent());
            titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
            if (StringHelper.containsNonWhitespace(iconCssClass)) {
                titleInfo.setIconCssClass(iconCssClass);
            }
            controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
        }
    } else if (CourseNode.DISPLAY_OPTS_TITLE_CONTENT.equals(displayOption)) {
        if (StringHelper.containsNonWhitespace(courseNode.getLongTitle())) {
            TitleInfo titleInfo = new TitleInfo(null, courseNode.getLongTitle(), null, courseNode.getIdent());
            titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
            if (StringHelper.containsNonWhitespace(iconCssClass)) {
                titleInfo.setIconCssClass(iconCssClass);
            }
            controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
        }
    } else if (CourseNode.DISPLAY_OPTS_SHORT_TITLE_DESCRIPTION_CONTENT.equals(displayOption)) {
        String title = courseNode.getShortTitle();
        String description = null;
        if (StringHelper.containsNonWhitespace(courseNode.getLearningObjectives())) {
            if (StringHelper.containsNonWhitespace(title)) {
                description = courseNode.getLearningObjectives();
            }
        }
        if (StringHelper.containsNonWhitespace(title) || StringHelper.containsNonWhitespace(description)) {
            TitleInfo titleInfo = new TitleInfo(null, title, description, courseNode.getIdent());
            titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
            if (StringHelper.containsNonWhitespace(iconCssClass)) {
                titleInfo.setIconCssClass(iconCssClass);
            }
            controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
        }
    } else if (CourseNode.DISPLAY_OPTS_TITLE_DESCRIPTION_CONTENT.equals(displayOption)) {
        String title = courseNode.getLongTitle();
        String description = null;
        if (StringHelper.containsNonWhitespace(courseNode.getLearningObjectives())) {
            description = courseNode.getLearningObjectives();
        }
        if (StringHelper.containsNonWhitespace(title) || StringHelper.containsNonWhitespace(description)) {
            TitleInfo titleInfo = new TitleInfo(null, title, description, courseNode.getIdent());
            titleInfo.setDescriptionCssClass("o_objectives o_user_content_block");
            if (StringHelper.containsNonWhitespace(iconCssClass)) {
                titleInfo.setIconCssClass(iconCssClass);
            }
            controller = new TitledWrapperController(ureq, wControl, controller, null, titleInfo);
        }
    }
    return controller;
}
Also used : TitledWrapperController(org.olat.core.gui.control.generic.title.TitledWrapperController) TitleInfo(org.olat.core.gui.control.generic.title.TitleInfo)

Example 4 with TitledWrapperController

use of org.olat.core.gui.control.generic.title.TitledWrapperController in project openolat by klemens.

the class UserCommentDisplayController 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 == replyLink) {
        // Init reply workflow
        replyCommentFormCtr = new UserCommentFormController(ureq, getWindowControl(), userComment, null, ores, resSubPath);
        listenTo(replyCommentFormCtr);
        User parentUser = userComment.getCreator().getUser();
        String title = translate("comments.coment.reply.title", new String[] { parentUser.getProperty(UserConstants.FIRSTNAME, null), parentUser.getProperty(UserConstants.LASTNAME, null) });
        TitleInfo titleInfo = new TitleInfo(null, title);
        replyTitledWrapperCtr = new TitledWrapperController(ureq, getWindowControl(), replyCommentFormCtr, null, titleInfo);
        listenTo(replyTitledWrapperCtr);
        replyCmc = new CloseableModalController(getWindowControl(), "close", replyTitledWrapperCtr.getInitialComponent());
        replyCmc.activate();
    } else if (source == deleteLink) {
        // Init delete workflow
        List<String> buttonLabels = new ArrayList<String>();
        boolean hasReplies = false;
        for (UserComment comment : allComments) {
            if (comment.getParent() != null && comment.getParent().getKey().equals(userComment.getKey())) {
                hasReplies = true;
                break;
            }
        }
        if (hasReplies) {
            buttonLabels.add(translate("comments.button.delete.without.replies"));
            buttonLabels.add(translate("comments.button.delete.with.replies"));
        } else {
            buttonLabels.add(translate("delete"));
        }
        buttonLabels.add(translate("cancel"));
        String deleteText;
        if (hasReplies) {
            deleteText = translate("comments.dialog.delete.with.replies");
        } else {
            deleteText = translate("comments.dialog.delete");
        }
        deleteDialogCtr = DialogBoxUIFactory.createGenericDialog(ureq, getWindowControl(), translate("comments.dialog.delete.title"), deleteText, buttonLabels);
        listenTo(deleteDialogCtr);
        deleteDialogCtr.activate();
        // Add replies info as user object to retrieve it later when evaluating the events
        deleteDialogCtr.setUserObject(Boolean.valueOf(hasReplies));
    }
}
Also used : User(org.olat.core.id.User) TitledWrapperController(org.olat.core.gui.control.generic.title.TitledWrapperController) UserComment(org.olat.core.commons.services.commentAndRating.model.UserComment) TitleInfo(org.olat.core.gui.control.generic.title.TitleInfo) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ArrayList(java.util.ArrayList) List(java.util.List)

Example 5 with TitledWrapperController

use of org.olat.core.gui.control.generic.title.TitledWrapperController 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();
}
Also used : MessageController(org.olat.core.gui.control.generic.messages.MessageController) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) TitledWrapperController(org.olat.core.gui.control.generic.title.TitledWrapperController) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) NodeClickedRef(org.olat.course.run.navigation.NodeClickedRef) DisposedCourseRestartController(org.olat.course.DisposedCourseRestartController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) MessageController(org.olat.core.gui.control.generic.messages.MessageController) CourseGlossaryToolLinkController(org.olat.course.run.glossary.CourseGlossaryToolLinkController) TitledWrapperController(org.olat.core.gui.control.generic.title.TitledWrapperController) Controller(org.olat.core.gui.control.Controller) GlossaryMarkupItemController(org.olat.core.gui.control.generic.textmarker.GlossaryMarkupItemController) MainLayoutBasicController(org.olat.core.gui.control.controller.MainLayoutBasicController)

Aggregations

TitledWrapperController (org.olat.core.gui.control.generic.title.TitledWrapperController)10 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)4 Controller (org.olat.core.gui.control.Controller)4 TitleInfo (org.olat.core.gui.control.generic.title.TitleInfo)4 ArrayList (java.util.ArrayList)2 List (java.util.List)2 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)2 UserComment (org.olat.core.commons.services.commentAndRating.model.UserComment)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 TreeEvent (org.olat.core.gui.components.tree.TreeEvent)2 TreeNode (org.olat.core.gui.components.tree.TreeNode)2 ControllerEventListener (org.olat.core.gui.control.ControllerEventListener)2 WindowControl (org.olat.core.gui.control.WindowControl)2 MainLayoutBasicController (org.olat.core.gui.control.controller.MainLayoutBasicController)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)2 MessageController (org.olat.core.gui.control.generic.messages.MessageController)2 GlossaryMarkupItemController (org.olat.core.gui.control.generic.textmarker.GlossaryMarkupItemController)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 User (org.olat.core.id.User)2