Examples of ICourse


Examples of org.olat.course.ICourse

   * @param ureq
   * @param chosenNode
   * @param groupMgr
   */
  private void initNodeEditor(UserRequest ureq, CourseNode chosenNode) {
    ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
    tabbedNodeConfig.removeAll();
    // dispose old one, if there was one
    removeAsListenerAndDispose(nodeEditCntrllr);
    nodeEditCntrllr = chosenNode.createEditController(ureq, getWindowControl(), course, euce);
    listenTo(nodeEditCntrllr);
View Full Code Here

Examples of org.olat.course.ICourse

   * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
   *      org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
   */
  public void event(UserRequest ureq, Controller source, Event event) {
    try {
    ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
   
    if (source == toolC) {
      if (event.getCommand().startsWith(TB_ACTION)) {
        String cnAlias = event.getCommand().substring(TB_ACTION.length());
        if (cnAlias == null) throw new AssertException("Received event from ButtonController which is not registered with the toolbox.");
       
        Codepoint.codepoint(EditorMainController.class, "startInsertNode");
        insertNodeController = new InsertNodeController(ureq, getWindowControl(), course, cnAlias);       
        listenTo(insertNodeController);
        cmc = new CloseableModalController(getWindowControl(), translate("close"), insertNodeController.getInitialComponent(), true, translate(NLS_INSERTNODE_TITLE));
        cmc.activate();
      } else if (event.getCommand().equals(CMD_DELNODE)) {
        TreeNode tn = menuTree.getSelectedNode();
        if (tn == null) {
          showError(NLS_DELETENODE_ERROR_SELECTFIRST);
          return;
        }
        if (tn.getParent() == null) {
          showError(NLS_DELETENODE_ERROR_ROOTNODE);
          return;
        }
        // deletion is possible, start asking if really to delete.
        tabbedNodeConfig.setVisible(false);
        deleteDialogController = activateYesNoDialog(ureq, translate("deletenode.header", tn.getTitle()), translate("deletenode.confirm"), deleteDialogController);
               
      } else if (event.getCommand().equals(CMD_MOVENODE) || event.getCommand().equals(CMD_COPYNODE)) {
        TreeNode tn = menuTree.getSelectedNode();
        if (tn == null) {
          showError(NLS_MOVECOPYNODE_ERROR_SELECTFIRST);
          return;
        }
        if (tn.getParent() == null) {
          showError(NLS_MOVECOPYNODE_ERROR_ROOTNODE);
          return;
        }
       
        CourseEditorTreeNode cetn = cetm.getCourseEditorNodeById(tn.getIdent());
        moveCopyController = new MoveCopySubtreeController(ureq, getWindowControl(), course, cetn, event.getCommand().equals(CMD_COPYNODE));       
        this.listenTo(moveCopyController);
        cmc = new CloseableModalController(getWindowControl(), translate("close"), moveCopyController.getInitialComponent(), true, translate(NLS_INSERTNODE_TITLE));
        cmc.activate();
      }
     
      else if (event.getCommand().equals(CMD_CLOSEEDITOR)) {
        doReleaseEditLock();
        fireEvent(ureq, Event.DONE_EVENT);
      } else if (event.getCommand().equals(CMD_PUBLISH)) {
        /*
         * start follwoing steps -> cancel wizardf does not touch data
         * (M) Mandatory (O) Optional
         * - (M)Step 00  -> show selection tree to choose changed nodes to be published
         * ...........-> calculate errors & warnings
         * ...........(next|finish) available if no errors or nothing to publish
         * - (O)Step 00A -> review errors & warnings
         * ...........(previous|next|finish) available
         * - (O)Step 00B -> review publish changes that will happen
         * ...........(previous|next|finish) available
         * - (O)Step 01  -> change general access to course
         * ...........(previous|finish) available
         * - FinishCallback -> apply course nodes change set
         * .................-> apply general access changes.
         */
       
        Step start  = new PublishStep00(ureq, cetm, course);
       
        /*
         * callback executed in case wizard is finished.
         */
        StepRunnerCallback finish = new StepRunnerCallback(){
          @SuppressWarnings("unchecked")
          public Step execute(UserRequest ureq1, WindowControl wControl1, StepsRunContext runContext) {
            /*
             * all information to do now is within the runContext saved
             */
            boolean hasChanges = false;

            if (runContext.containsKey("validPublish") && ((Boolean) runContext.get("validPublish")).booleanValue()) {

              Set<String> selectedNodeIds = (Set<String>) runContext.get("publishSetCreatedFor");
              hasChanges = (selectedNodeIds != null) && (selectedNodeIds.size() > 0);
              if (hasChanges) {
                PublishProcess publishManager = (PublishProcess) runContext.get("publishProcess");
                publishManager.applyPublishSet(ureq1.getIdentity(), ureq1.getLocale());
              }
            }
            if (runContext.containsKey("changedaccess")) {
              // there were changes made to the general course access
              String newAccessStr = (String) runContext.get("changedaccess");
              int newAccess = Integer.valueOf(newAccessStr);
              PublishProcess publishManager = (PublishProcess) runContext.get("publishProcess");
              // fires an EntryChangedEvent for repository entry notifying
              // about modification.
              publishManager.changeGeneralAccess(ureq1, newAccess);
              hasChanges = true;
            }

            // signal correct completion and tell if changes were made or not.
            return hasChanges ? StepsMainRunController.DONE_MODIFIED : StepsMainRunController.DONE_UNCHANGED;
          }
        };

        publishStepsController = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("publish.wizard.title") );
        listenTo(publishStepsController);
        getWindowControl().pushAsModalDialog(publishStepsController.getInitialComponent());
         
      } else if (event.getCommand().equals(CMD_COURSEPREVIEW)) {
        previewController = new PreviewConfigController(ureq, getWindowControl(), course);
        listenTo(previewController);   
        previewController.activate();
       
      } else if (event.getCommand().equals(CMD_COURSEFOLDER)) {
        // folder for course
        VFSContainer namedCourseFolder = new NamedContainerImpl(translate(NLS_COURSEFOLDER_NAME), course.getCourseFolderContainer());
        FolderRunController bcrun = new FolderRunController(namedCourseFolder, true, ureq, getWindowControl());
        bcrun.addLoggingResourceable(LoggingResourceable.wrap(course));
        Component folderComponent = bcrun.getInitialComponent();
        CloseableModalController clc = new CloseableModalController(getWindowControl(), translate(NLS_COURSEFOLDER_CLOSE),
            folderComponent);
        clc.activate();
       
      }
    } else if (source == nodeEditCntrllr) {
      // event from the tabbed pane (any tab)
      if (event == NodeEditController.NODECONFIG_CHANGED_EVENT) {
        // if the user changed the name of the node, we need to update the tree also.
        // the event is too generic to find out what happened -> update tree in all cases (applies to ajax mode only)
        menuTree.setDirty(true);
       
        cetm.nodeConfigChanged(menuTree.getSelectedNode());       
        CourseFactory.saveCourseEditorTreeModel(course.getResourceableId());
        euce.getCourseEditorEnv().validateCourse();
        StatusDescription[] courseStatus = euce.getCourseEditorEnv().getCourseStatus();
        updateCourseStatusMessages(ureq.getLocale(), courseStatus);
      }
    } else if (source == publishStepsController) {
      //if (event == Event.DONE_EVENT) {
        getWindowControl().pop();
        removeAsListenerAndDispose(publishStepsController);
        publishStepsController = null;
        // reset to root node... may have published a deleted node -> this
        // resets the view
        cetm = course.getEditorTreeModel();
        menuTree.setTreeModel(cetm);
        String rootNodeIdent = menuTree.getTreeModel().getRootNode().getIdent();
        menuTree.setSelectedNodeId(rootNodeIdent);
        updateViewForSelectedNodeId(ureq, rootNodeIdent);
        if(event == Event.CHANGED_EVENT){         
          showInfo("pbl.success", null);
          // do logging
          ThreadLocalUserActivityLogger.log(CourseLoggingAction.COURSE_EDITOR_PUBLISHED, getClass());
        }//else Event.DONE -> nothing changed / else Event.CANCELLED -> cancelled wizard
       
    } else if (source == previewController) {
      if (event == Event.DONE_EVENT) {
        // no need to deactivate preview controller, already done internally
        removeAsListenerAndDispose(previewController);
        previewController = null;
      }
    } else if (source == moveCopyController) { 
      cmc.deactivate();
      if (event == Event.DONE_EVENT) {         
        menuTree.setDirty(true); // setDirty when moving
        // Repositioning to move/copy course node
        String nodeId = moveCopyController.getCopyNodeId();       
        if (nodeId != null) {
          menuTree.setSelectedNodeId(nodeId);
          euce.getCourseEditorEnv().setCurrentCourseNodeId(nodeId);         
          CourseNode copyNode = cetm.getCourseNode(nodeId);
          initNodeEditor(ureq, copyNode);
        }                       
        euce.getCourseEditorEnv().validateCourse();
        StatusDescription[] courseStatus = euce.getCourseEditorEnv().getCourseStatus();
        updateCourseStatusMessages(ureq.getLocale(), courseStatus);
       
      } else if (event == Event.FAILED_EVENT) {       
        getWindowControl().setError("Error in copy of subtree.");       
      } else if (event == Event.CANCELLED_EVENT) {
        // user canceled           
      }
     
    } else if (source == insertNodeController) {          
      cmc.deactivate();
      if (event == Event.DONE_EVENT) {
        // Activate new node in menu and create necessary edit controllers
        // necessary if previous action was a delete node action       
        tabbedNodeConfig.setVisible(true);
        main.setPage(VELOCITY_ROOT + "/index.html");       
        CourseNode newNode = insertNodeController.getInsertedNode();       
        menuTree.setSelectedNodeId(newNode.getIdent());
        // update the current node in the editor course environment
        euce.getCourseEditorEnv().setCurrentCourseNodeId(newNode.getIdent());
        euce.getCourseEditorEnv().validateCourse();
        StatusDescription[] courseStatus = euce.getCourseEditorEnv().getCourseStatus();
        updateCourseStatusMessages(ureq.getLocale(), courseStatus);         
        initNodeEditor(ureq, newNode);
      }
      // in all cases:
      removeAsListenerAndDispose(insertNodeController);
      insertNodeController = null;
    } else if (source == deleteDialogController){
      removeAsListenerAndDispose(deleteDialogController);
      deleteDialogController = null;
      if (DialogBoxUIFactory.isYesEvent(event)){
        // delete confirmed
        String ident = menuTree.getSelectedNode().getIdent();
        // udpate the current node in the course editor environment
        euce.getCourseEditorEnv().setCurrentCourseNodeId(ident);
        CourseNode activeNode = cetm.getCourseNode(ident);

        cetm.markDeleted(activeNode);
        menuTree.setDirty(true);
     
        CourseFactory.saveCourseEditorTreeModel(course.getResourceableId());
        tabbedNodeConfig.removeAll();
        tabbedNodeConfig.setVisible(false);
        toolC.setEnabled(CMD_DELNODE, false);
        toolC.setEnabled(CMD_MOVENODE, false);
        toolC.setEnabled(CMD_COPYNODE, false);
View Full Code Here

Examples of org.olat.course.ICourse

  public LockResult getLockEntry() {
    return lockEntry;
  }

  protected void doDispose() {
    ICourse course = CourseFactory.loadCourse(ores.getResourceableId());
    CoordinatorManager.getCoordinator().getEventBus().deregisterFor(this, course);
    // those controllers are disposed by BasicController:
    nodeEditCntrllr = null;
    publishStepsController = null;
    deleteDialogController = null;
View Full Code Here

Examples of org.olat.course.ICourse

   */
  private void enableCustomCss(UserRequest ureq) {
    /*
     * add also the choosen courselayout css if any
     */
    final ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
    CourseConfig cc = course.getCourseEnvironment().getCourseConfig();
    if (cc.hasCustomCourseCSS()) {
      cssFileRef = cc.getCssLayoutRef();
      mapreg = MapperRegistry.getInstanceFor(ureq.getUserSession());
      if (cssUriMapper != null) {
        // deregister old mapper
        mapreg.deregister(cssUriMapper);
      }
      cssUriMapper = new Mapper() {
        final VFSContainer courseFolder = course.getCourseFolderContainer();

        @SuppressWarnings("unused")
        public MediaResource handle(String relPath, HttpServletRequest request) {
          VFSItem vfsItem = courseFolder.resolve(relPath);
          MediaResource mr;
View Full Code Here

Examples of org.olat.course.ICourse

    Long resId = publisher.getResId();
    if (publisher.getResName().equals( CourseModule.getCourseTypeName() ) ) {
      // resId = CourseResourceableId           p.getSubidentifier() = wikiCourseNode.getIdent()
      CourseNode courseNode = null;
      try {
        ICourse course = CourseFactory.loadCourse(resId);
        CourseEnvironment cenv = course.getCourseEnvironment();
        courseNode = cenv.getRunStructure().getNode(publisher.getSubidentifier());
      } catch (Exception e) {
        Log.warn("Could not load course with resid: "+resId, e);
        return null;
      }
View Full Code Here

Examples of org.olat.course.ICourse

    for (Iterator iter = identities.iterator(); iter.hasNext();) {
      Identity identity = (Identity) iter.next();
      if (identity != null){
        IdentityEnvironment ienv = new IdentityEnvironment();
        ienv.setIdentity(identity);
        ICourse course = CourseFactory.loadCourse(ores);
        UserCourseEnvironment uce = new UserCourseEnvironmentImpl(ienv, course.getCourseEnvironment());
        ScoreEvaluation scoreEvaluation = uce.getScoreAccounting().getScoreEvaluation(courseNode);
       
        if (scoreEvaluation == null){
            nodeScores.add(translator.translate("bulk.action.no.value"));
        }else{
View Full Code Here

Examples of org.olat.course.ICourse

    getUserActivityLogger().setStickyActionType(ActionType.admin);
   
    this.ores = ores;
    this.groupType = groupType;
    // set user activity logger for this controller
    ICourse course = CourseFactory.loadCourse(ores);
    addLoggingResourceable(LoggingResourceable.wrap(course));

    CourseGroupManager groupManager = course.getCourseEnvironment().getCourseGroupManager();

    List groupContexts;
    String defaultContextName;
   
    // init content panel. current panel content will be set later in init process, use null for now
    content = putInitialPanel(null);

    if (BusinessGroup.TYPE_LEARNINGROUP.equals(groupType)) {
      groupContexts = groupManager.getLearningGroupContexts();
      defaultContextName = CourseGroupManager.DEFAULT_NAME_LC_PREFIX + course.getCourseTitle();
    } else if (BusinessGroup.TYPE_RIGHTGROUP.equals(groupType)) {
      groupContexts = groupManager.getRightGroupContexts();
      defaultContextName = CourseGroupManager.DEFAULT_NAME_RC_PREFIX + course.getCourseTitle();
    } else {
      throw new AssertException("Invalid group type ::" + groupType);
    }

    if (groupContexts.size() == 0) {
View Full Code Here

Examples of org.olat.course.ICourse

        fireEvent(ureq, Event.DONE_EVENT);
      } else if (event == Event.BACK_EVENT) {
        // show context list again
        // reinitialize context list since it could be dirty
        List groupContexts;
        ICourse course = CourseFactory.loadCourse(ores);
        CourseGroupManager groupManager = course.getCourseEnvironment().getCourseGroupManager();
        if (BusinessGroup.TYPE_LEARNINGROUP.equals(groupType)) {
          groupContexts = groupManager.getLearningGroupContexts();
        } else {
          groupContexts = groupManager.getRightGroupContexts();
        }
View Full Code Here

Examples of org.olat.course.ICourse

    this.type = type;

    insertTree = new SelectionTree("insert_new_node_selection", getTranslator());
    insertTree.setFormButtonKey("insertAtSelectedTreepos");
    insertTree.addListener(this);
    ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
    insertModel = new InsertTreeModel(course.getEditorTreeModel());
    insertTree.setTreeModel(insertModel);   
    VelocityContainer insertVC = createVelocityContainer("insertNode");
    insertVC.put("selection", insertTree);
   
    if(insertModel.totalNodeCount() > CourseModule.getCourseNodeLimit()){
View Full Code Here

Examples of org.olat.course.ICourse

  public void event(UserRequest ureq, Component source, Event event) {
    if (source == insertTree) {
      TreeEvent te = (TreeEvent) event;
      if (te.getCommand().equals(TreeEvent.COMMAND_TREENODE_CLICKED)) {
        ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
        // user chose a position to insert a new node
        String nodeId = te.getNodeId();
        TreePosition tp = insertModel.getTreePosition(nodeId);
        int pos = tp.getChildpos();
        CourseNodeConfiguration newNodeConfig = CourseNodeFactory.getInstance().getCourseNodeConfiguration(type);
        insertedNode = newNodeConfig.getInstance();

        // Set some default values
        ///// START Special inline translation case: disable inline translation rendering (generates too long titles)
        I18nManager i18nMgr = I18nManager.getInstance();
        boolean isInlineTrans = i18nMgr.isCurrentThreadMarkLocalizedStringsEnabled();
        if (isInlineTrans) {
          i18nMgr.setMarkLocalizedStringsEnabled(ureq.getUserSession(), false);
        }
        //--
        String title = new String(newNodeConfig.getLinkText(ureq.getLocale()));
        insertedNode.setShortTitle(title);
        String longTitle = new String(translate("longtitle.default") + " " + title);
        insertedNode.setLongTitle(longTitle);
        insertedNode.setNoAccessExplanation(translate("form.noAccessExplanation.default"));
        //--
        if (isInlineTrans) {
          i18nMgr.setMarkLocalizedStringsEnabled(ureq.getUserSession(), true);
        }
        ///// END Special inline translation case
       
        // Insert it now
        CourseNode selectedNode = insertModel.getCourseNode(tp.getParentTreeNode());
        course.getEditorTreeModel().insertCourseNodeAt(insertedNode, selectedNode, pos);       
        CourseFactory.saveCourseEditorTreeModel(course.getResourceableId());

        fireEvent(ureq, Event.DONE_EVENT);
      } else {
        fireEvent(ureq, Event.CANCELLED_EVENT);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.