Package org.olat.core.gui.control.generic.tool

Examples of org.olat.core.gui.control.generic.tool.ToolController


   */
  private ToolController initToolController(Identity identity, UserRequest ureq) {
    // guest never have a tool controller
    if (isGuest) return null;

    ToolController myTool = ToolFactory.createToolController(getWindowControl());
    CourseConfig cc = uce.getCourseEnvironment().getCourseConfig();

    // 1) administrative tools
    if (isCourseAdmin || isCourseCoach || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)
        || hasCourseRight(CourseRights.RIGHT_GROUPMANAGEMENT) || hasCourseRight(CourseRights.RIGHT_ARCHIVING)
        || hasCourseRight(CourseRights.RIGHT_ASSESSMENT)) {
      myTool.addHeader(translate("header.tools"));
      if (hasCourseRight(CourseRights.RIGHT_COURSEEDITOR) || isCourseAdmin) {
        myTool.addLink(COMMAND_EDIT, translate("command.openeditor"));
      }
      if (hasCourseRight(CourseRights.RIGHT_GROUPMANAGEMENT) || isCourseAdmin) {
        myTool.addLink("groupmngt", translate("command.opengroupmngt"));
      }
      if (isCourseAdmin) {
        myTool.addLink("rightmngt", translate("command.openrightmngt"));
      }
      if (hasCourseRight(CourseRights.RIGHT_ARCHIVING) || isCourseAdmin) {
        myTool.addLink("archiver", translate("command.openarchiver"));
      }
      if (hasCourseRight(CourseRights.RIGHT_ASSESSMENT) || isCourseCoach || isCourseAdmin) {
        myTool.addLink("assessment", translate("command.openassessment"));
      }
      /*
       * http://bugs.olat.org/jira/browse/OLAT-4928
       */
      if (hasCourseRight(CourseRights.RIGHT_STATISTICS) || isCourseAdmin) {
        myTool.addLink("statistic", translate("command.openstatistic"));
      }
     
      //
      /*
       * if (isCourseAdmin) { myTool.addLink(TOOLBOX_LINK_COURSECONFIG,
       * translate("command.courseconfig")); }
       */
      //
    }

    // 2) add coached groups
    if (ownedGroups.size() > 0) {
      myTool.addHeader(translate("header.tools.ownerGroups"));
      Iterator iter = ownedGroups.iterator();
      while (iter.hasNext()) {
        BusinessGroup group = (BusinessGroup) iter.next();
        myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName());
      }
    }

    // 3) add participating groups
    if (participatedGroups.size() > 0) {
      myTool.addHeader(translate("header.tools.participatedGroups"));
      Iterator iter = participatedGroups.iterator();
      while (iter.hasNext()) {
        BusinessGroup group = (BusinessGroup) iter.next();
        myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName());
      }
    }

    // 4) add right groups
    if (rightGroups.size() > 0) {
      myTool.addHeader(translate("header.tools.rightGroups"));
      Iterator iter = rightGroups.iterator();
      while (iter.hasNext()) {
        BusinessGroup group = (BusinessGroup) iter.next();
        myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName());
      }
    }

    // 5) add waiting-list groups
    if (waitingListGroups.size() > 0) {
      myTool.addHeader(translate("header.tools.waitingListGroups"));
      Iterator iter = waitingListGroups.iterator();
      while (iter.hasNext()) {
        BusinessGroup group = (BusinessGroup) iter.next();
        BusinessGroupManager businessGroupManager = BusinessGroupManagerImpl.getInstance();
        int pos = businessGroupManager.getPositionInWaitingListFor(identity, group);
        myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName() + "(" + pos + ")", group
            .getKey().toString(), null);
        myTool.setEnabled(group.getKey().toString(), false);
      }
    }

    // new toolbox 'general'
    myTool.addHeader(translate("header.tools.general"));
    if (cc.isCalendarEnabled()) {
      myTool.addPopUpLink(ACTION_CALENDAR, translate("command.calendar"), null, null, "950", "750", false);
    }
    if (cc.hasGlossary()) {
      myTool.addComponent(glossaryToolCtr.getInitialComponent());
    }
    if (showCourseConfigLink) {
      myTool.addLink(TOOLBOX_LINK_COURSECONFIG, translate("command.courseconfig"));
    }
    myTool.addPopUpLink("personalnote", translate("command.personalnote"), null, null, "750", "550", false);
    if (offerBookmark && !isGuest) {
      myTool.addLink(ACTION_BOOKMARK, translate("command.bookmark"), TOOL_BOOKMARK, null);
      BookmarkManager bm = BookmarkManager.getInstance();
      if (bm.isResourceableBookmarked(identity, courseRepositoryEntry)) myTool.setEnabled(TOOL_BOOKMARK, false);

    }
    if (cc.isEfficencyStatementEnabled() && course.hasAssessableNodes()) {
      // link to efficiency statements should
      // - not appear when not configured in course configuration
      // - not appear when configured in course configuration but no assessable
      // node exist
      // - appear but dimmed when configured, assessable node exist but no
      // assessment data exists for user
      // - appear as link when configured, assessable node exist and assessment
      // data exists for user
      myTool.addPopUpLink("efficiencystatement", translate("command.efficiencystatement"), "command.efficiencystatement", null,
          "750", "800", false);
      EfficiencyStatementManager esm = EfficiencyStatementManager.getInstance();
      EfficiencyStatement es = esm.getUserEfficiencyStatement(courseRepositoryEntry.getKey(), identity);
      if (es == null) {
        myTool.setEnabled("command.efficiencystatement", false);
      }
    }
   
    //add group chat to toolbox
    boolean instantMsgYes = InstantMessagingModule.isEnabled();
    boolean chatIsEnabled = CourseModule.isCourseChatEnabled() &&  cc.isChatEnabled();
    if (instantMsgYes && chatIsEnabled) {
      // we add the course chat link controller to the toolbox
      if (courseChatManagerCtr == null && ureq != null) createCourseGroupChatLink(ureq);
      if (courseChatManagerCtr != null){
        Controller groupChatController = courseChatManagerCtr.getGroupChatController(course);
        if(groupChatController !=null){
          myTool.addComponent(groupChatController.getInitialComponent());
          addCurrentUserCount(myTool);
        }
      }
    } else {
      addCurrentUserCount(myTool);
View Full Code Here


      if (nodeId != null) {
        catalogCntrllr.activate(ureq, nodeId);
      }
    }
    // set correct tool controller
    ToolController ccToolCtr = catalogCntrllr.createCatalogToolController();
    Component toolComp = (ccToolCtr == null ? null : ccToolCtr.getInitialComponent());
    columnsLayoutCtr.setCol2(toolComp);
  }
View Full Code Here

  public void event(UserRequest urequest, Controller source, Event event) {
    if (source == addController) { // process add controller finished()
      if (event.equals(Event.DONE_EVENT)) {
        // default to myEntries search
        cmc.deactivate();
        ToolController toolC = detailsController.setEntry(addController.getAddedEntry(), urequest, false);
        Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
        mainPanel.setContent(detailsController.getInitialComponent());
        columnsLayoutCtr.setCol2(toolComp);
        menuTree.setSelectedNodeId(myEntriesNodeId);

        // ask if we should start the editor right now.
        RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(addController.getAddedEntry());
        if (handler.supportsEdit()) { // start Editor
          removeAsListenerAndDispose(launchEditorDialog); // cleanup old                                                          // instance
          launchEditorDialog = activateYesNoDialog(urequest, null, translate("add.launchedit.msg"), launchEditorDialog);
          launchEditorDialog.setUserObject(addController.getAddedEntry());
          return;
        }
      } else if (event.equals(Event.CANCELLED_EVENT)) {
        cmc.deactivate();
      } else if (event.equals(Event.FAILED_EVENT)) {
        getWindowControl().setError(translate("add.failed"));
        mainPanel.setContent(main);
      }
    } else if (source == searchController) {
      RepositoryEntry selectedEntry = RepositoryManager.getInstance().lookupRepositoryEntry(searchController.getSelectedEntry().getKey());
      if (selectedEntry == null) {
        getWindowControl().setWarning(translate("warn.entry.meantimedeleted"));
        main.setPage(VELOCITY_ROOT + "/index.html");
        return;
      }
      if (event.getCommand().equals(RepositoryTableModel.TABLE_ACTION_SELECT_ENTRY)) {
        // entry has been selected to be launched in the
        // searchController
        ToolController toolC = detailsController.setEntry(selectedEntry, urequest, false);
        if (selectedEntry.getCanLaunch()) detailsController.doLaunch(urequest);
        else if (selectedEntry.getCanDownload()) detailsController.doDownload(urequest);
        else { // offer details view
          Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
          columnsLayoutCtr.setCol2(toolComp);
          mainPanel.setContent(detailsController.getInitialComponent());
        }
      } else if (event.getCommand().equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
        // entry has been selected in the searchController
        ToolController toolC = detailsController.setEntry(selectedEntry, urequest, false);
        Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
        columnsLayoutCtr.setCol2(toolComp);
        mainPanel.setContent(detailsController.getInitialComponent());
      }
    } else if (source == detailsController) { // back from details
      if (event.equals(Event.DONE_EVENT)) {
        if (backtocatalog) {
          backtocatalog = false;
          ToolController toolC = catalogCntrllr.createCatalogToolController();
          Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
          columnsLayoutCtr.setCol2(toolComp);
          mainPanel.setContent(catalogCntrllr.getInitialComponent());

        } else {
          Component toolComp = (mainToolC == null ? null : mainToolC.getInitialComponent());
          columnsLayoutCtr.setCol2(toolComp);
          mainPanel.setContent(main);
        }
      } else if (event instanceof EntryChangedEvent) {
        Component toolComp = (mainToolC == null ? null : mainToolC.getInitialComponent());
        columnsLayoutCtr.setCol2(toolComp);
        mainPanel.setContent(main);
      } else if (event.equals(Event.CHANGED_EVENT)) {
        ToolController toolC = detailsController.getDetailsToolController();
        Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
        columnsLayoutCtr.setCol2(toolComp);
      }
    } else if (source == mainToolC) {
      // handles the tools events for the Repository Actions
      handleToolEvents(urequest, event);
    } else if (source == launchEditorDialog) {
      if (DialogBoxUIFactory.isYesEvent(event)) {
        // do
        // launch
        // editor
        ToolController toolC = detailsController.setEntry((RepositoryEntry) launchEditorDialog.getUserObject(), urequest, false);
        Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
        columnsLayoutCtr.setCol2(toolComp);
        mainPanel.setContent(detailsController.getInitialComponent());
        detailsController.doEdit(urequest);
      } else {
        // no, don't launch editor }
      }
    }
    /*
     * from the catalog controller its sending change events if the tools
     * available have changed, e.g. no longer localTreeAdmin
     */
    else if (source == catalogCntrllr) {
      if (event == Event.CHANGED_EVENT) {
        ToolController toolC = catalogCntrllr.createCatalogToolController();
        Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
        columnsLayoutCtr.setCol2(toolComp);
      } else if (event instanceof EntryChangedEvent) {
        // REVIEW:pb:signal from the catalog to show Detail!
        // REVIEW:pb:the first event is also a change event, signalling a change
        // in the tools
        // REVIEW:pb:the EntryChangedEvent is misused to signal "show details"
        EntryChangedEvent entryChangedEvent = (EntryChangedEvent) event;
        RepositoryEntry e = RepositoryManager.getInstance().lookupRepositoryEntry(entryChangedEvent.getChangedEntryKey());
        if (e != null) {
          backtocatalog = true;
          ToolController toolC = detailsController.setEntry(e, urequest, false);
          Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
          columnsLayoutCtr.setCol2(toolComp);
          mainPanel.setContent(detailsController.getInitialComponent());
        }
      }

View Full Code Here

      } catch (NumberFormatException e) {
        throw new AssertException(e.getMessage());
      }
      RepositoryEntry selectedEntry = RepositoryManager.getInstance().lookupRepositoryEntry(key);
      if (selectedEntry != null) {
        ToolController toolC = detailsController.setEntry(selectedEntry, ureq, jumpfromcourse);
        Component toolComp = (toolC == null ? null : toolC.getInitialComponent());
        columnsLayoutCtr.setCol2(toolComp);
        mainPanel.setContent(detailsController.getInitialComponent());
      }
    } else if (viewIdentifier.startsWith(CatalogEntry.class.getSimpleName())) {
      String catId = viewIdentifier.substring(viewIdentifier.indexOf(':') + 1);
View Full Code Here

      CoordinatorManager.getCoordinator().getLocker().releaseLock(activeSessionLock);     
    }
  }

  private ToolController populateToolC() {
    ToolController tc = ToolFactory.createToolController(getWindowControl());
    // tools
    tc.addHeader(translate("tools.tools.header"));
    tc.addLink(CMD_TOOLS_PREVIEW, translate("tools.tools.preview"), CMD_TOOLS_PREVIEW, "b_toolbox_preview");
    tc.addLink(CMD_TOOLS_CLOSE_EDITOR, translate("tools.tools.closeeditor"), null, "b_toolbox_close");
    // if (!restrictedEdit) {
    tc.addHeader(translate("tools.add.header"));
    // adds within the qti document level
    tc.addLink(CMD_TOOLS_ADD_SECTION, translate("tools.add.section"), CMD_TOOLS_ADD_SECTION, "o_mi_qtisection");
    // adds within a section
    tc.addLink(CMD_TOOLS_ADD_SINGLECHOICE, translate("tools.add.singlechoice"), CMD_TOOLS_ADD_SINGLECHOICE, "o_mi_qtisc");
    tc.addLink(CMD_TOOLS_ADD_MULTIPLECHOICE, translate("tools.add.multiplechoice"), CMD_TOOLS_ADD_MULTIPLECHOICE, "o_mi_qtimc");
    if (!qtiPackage.getQTIDocument().isSurvey()) tc.addLink(CMD_TOOLS_ADD_KPRIM, translate("tools.add.kprim"), CMD_TOOLS_ADD_KPRIM,
        "o_mi_qtikprim");
    tc.addLink(CMD_TOOLS_ADD_FIB, translate("tools.add.cloze"), CMD_TOOLS_ADD_FIB, "o_mi_qtifib");
    if (qtiPackage.getQTIDocument().isSurvey()) tc.addLink(CMD_TOOLS_ADD_FREETEXT, translate("tools.add.freetext"),
        CMD_TOOLS_ADD_FREETEXT, "o_mi_qtiessay");
    // change
    tc.addHeader(translate("tools.change.header"));
    // change actions
    tc.addLink(CMD_TOOLS_CHANGE_DELETE, translate("tools.change.delete"), CMD_TOOLS_CHANGE_DELETE, "b_toolbox_delete");
    tc.addLink(CMD_TOOLS_CHANGE_MOVE, translate("tools.change.move"), CMD_TOOLS_CHANGE_MOVE, "b_toolbox_move");
    tc.addLink(CMD_TOOLS_CHANGE_COPY, translate("tools.change.copy"), CMD_TOOLS_CHANGE_COPY, "b_toolbox_copy");
    // }

    return tc;
  }
View Full Code Here

TOP

Related Classes of org.olat.core.gui.control.generic.tool.ToolController

Copyright © 2018 www.massapicom. 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.