Esempio n. 1
0
  /**
   * @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 urequest, Controller source, Event event) {
    if (source == displayController) {
      if (event instanceof IQSubmittedEvent) {
        // Save results in case of test
        if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
          exposeUserTestDataToVC(urequest);
        }
        // Save results in case of questionnaire
        else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SURVEY)) {
          exposeUserQuestionnaireDataToVC();

          if (displayContainerController != null) {
            displayContainerController.deactivate(urequest);
          } else {
            getWindowControl().pop();
          }
          OLATResourceable ores = OresHelper.createOLATResourceableInstance("test", -1l);
          addToHistory(urequest, ores, null);
        }
        // Don't save results in case of self-test
        // but do safe attempts !
        else if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_SELF)) {
          // am.incrementNodeAttempts(courseNode, urequest.getIdentity(), userCourseEnv);
        }
      } else if (event.equals(Event.DONE_EVENT)) {
        stopAssessment(urequest, event);
      } else if (IQEvent.TEST_PULLED.equals(event.getCommand())) {
        stopAssessment(urequest, event);
        showWarning("error.assessment.pulled");
      } else if (IQEvent.TEST_STOPPED.equals(event.getCommand())) {
        stopAssessment(urequest, event);
        showWarning("error.assessment.stopped");
      }
    }
  }
  public MembersManagementMainController(
      UserRequest ureq, WindowControl wControl, RepositoryEntry re) {
    super(ureq, wControl);
    this.repoEntry = re;
    acModule = CoreSpringFactory.getImpl(AccessControlModule.class);
    acService = CoreSpringFactory.getImpl(ACService.class);

    // logging
    getUserActivityLogger().setStickyActionType(ActionType.admin);
    ICourse course = CourseFactory.loadCourse(re.getOlatResource());
    addLoggingResourceable(LoggingResourceable.wrap(course));

    // ui stuff
    menuTree = new MenuTree("menuTree");
    menuTree.setTreeModel(buildTreeModel());
    menuTree.setRootVisible(false);
    menuTree.addListener(this);

    mainVC = createVelocityContainer("main_members");

    columnLayoutCtr =
        new LayoutMain3ColsController(
            ureq, getWindowControl(), menuTree, null, mainVC, "members-" + repoEntry.getKey());
    listenTo(columnLayoutCtr);
    putInitialPanel(columnLayoutCtr.getInitialComponent());

    selectMenuItem(ureq, CMD_MEMBERS);
  }
 /**
  * @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 OLATResourceable res,
     final String initialViewIdentifier,
     final UserRequest ureq,
     final WindowControl wControl) {
   final RepositoryEntry repoEntry =
       RepositoryManager.getInstance().lookupRepositoryEntry(res, false);
   final boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
   final boolean isOwner =
       RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), repoEntry);
   final FeedSecurityCallback callback = new FeedResourceSecurityCallback(isAdmin, isOwner);
   final Controller blogCtr =
       BlogUIFactory.getInstance(ureq.getLocale())
           .createMainController(res, ureq, wControl, callback);
   final LayoutMain3ColsController layoutCtr =
       new LayoutMain3ColsController(
           ureq, wControl, null, null, blogCtr.getInitialComponent(), null);
   layoutCtr.addDisposableChildController(blogCtr);
   return layoutCtr;
 }
Esempio n. 4
0
 private void stopAssessment(UserRequest ureq, Event event) {
   if (displayContainerController != null) {
     displayContainerController.deactivate(ureq);
   } else {
     getWindowControl().pop();
   }
   removeHistory(ureq);
   OLATResourceable ores = OresHelper.createOLATResourceableInstance("test", -1l);
   addToHistory(ureq, ores, null);
   if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS) && !assessmentStopped) {
     assessmentStopped = true;
     AssessmentEvent assessmentStoppedEvent =
         new AssessmentEvent(AssessmentEvent.TYPE.STOPPED, userSession);
     singleUserEventCenter.deregisterFor(this, assessmentInstanceOres);
     singleUserEventCenter.fireEventToListenersOf(assessmentStoppedEvent, assessmentEventOres);
   }
   fireEvent(ureq, event);
 }
Esempio n. 5
0
  /**
   * @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)
   */
  public void event(UserRequest ureq, Component source, Event event) {
    if (source == startButton && startButton.isEnabled() && startButton.isVisible()) {
      long courseResId = userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue();
      String courseNodeIdent = courseNode.getIdent();
      removeAsListenerAndDispose(displayController);

      OLATResourceable ores = OresHelper.createOLATResourceableTypeWithoutCheck("test");
      ThreadLocalUserActivityLogger.addLoggingResourceInfo(
          LoggingResourceable.wrapBusinessPath(ores));
      WindowControl bwControl = addToHistory(ureq, ores, null);
      Controller returnController =
          iqManager.createIQDisplayController(
              modConfig, secCallback, ureq, bwControl, courseResId, courseNodeIdent, this);
      /*
       * either returnController is a MessageController or it is a IQDisplayController
       * this should not serve as pattern to be copy&pasted.
       * FIXME:2008-11-21:pb INTRODUCED because of read/write QTI Lock solution for scalability II, 6.1.x Release
       */
      if (returnController instanceof IQDisplayController) {
        displayController = (IQDisplayController) returnController;
        listenTo(displayController);
        if (displayController.isClosed()) {
          // do nothing
        } else if (displayController.isReady()) {
          // in case displayController was unable to initialize, a message was set by
          // displayController
          // this is the case if no more attempts or security check was unsuccessfull
          displayContainerController =
              new LayoutMain3ColsController(ureq, getWindowControl(), displayController);
          listenTo(displayContainerController); // autodispose

          // need to wrap a course restart controller again, because IQDisplay
          // runs on top of GUIStack
          ICourse course = CourseFactory.loadCourse(courseResId);
          RepositoryEntry courseRepositoryEntry =
              course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
          Panel empty = new Panel("empty"); // empty panel set as "menu" and "tool"
          Controller courseCloser =
              new DisposedCourseRestartController(ureq, getWindowControl(), courseRepositoryEntry);
          Controller disposedRestartController =
              new LayoutMain3ColsController(
                  ureq,
                  getWindowControl(),
                  empty,
                  courseCloser.getInitialComponent(),
                  "disposed course whily in iqRun" + courseResId);
          displayContainerController.setDisposedMessageController(disposedRestartController);

          final boolean fullWindow =
              modConfig.getBooleanSafe(IQEditController.CONFIG_FULLWINDOW, true);
          if (fullWindow) {
            displayContainerController.setAsFullscreen(ureq);
          }
          displayContainerController.activate();

          if (modConfig
              .get(IQEditController.CONFIG_KEY_TYPE)
              .equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
            assessmentStopped = false;
            singleUserEventCenter.registerFor(this, getIdentity(), assessmentInstanceOres);
            singleUserEventCenter.fireEventToListenersOf(
                new AssessmentEvent(AssessmentEvent.TYPE.STARTED, ureq.getUserSession()),
                assessmentEventOres);
          }
        } // endif isReady

      } else {
        // -> qti file was locked -> show info message
        // user must click again on course node to activate
        mainPanel.pushContent(returnController.getInitialComponent());
      }
    } else if (source == showResultsButton) {
      AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
      Long assessmentID = am.getAssessmentID(courseNode, ureq.getIdentity());
      if (assessmentID == null) {
        // fallback solution: if the assessmentID is not available via AssessmentManager than try to
        // get it via IQManager
        long callingResId =
            userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue();
        String callingResDetail = courseNode.getIdent();
        assessmentID =
            iqManager.getLastAssessmentID(ureq.getIdentity(), callingResId, callingResDetail);
      }
      if (assessmentID != null && !assessmentID.equals("")) {
        Document doc =
            iqManager.getResultsReportingFromFile(ureq.getIdentity(), type, assessmentID);
        // StringBuilder resultsHTML =
        // LocalizedXSLTransformer.getInstance(ureq.getLocale()).renderResults(doc);
        String summaryConfig = (String) modConfig.get(IQEditController.CONFIG_KEY_SUMMARY);
        int summaryType = AssessmentInstance.getSummaryType(summaryConfig);
        String resultsHTML =
            iqManager.transformResultsReporting(doc, ureq.getLocale(), summaryType);
        myContent.contextPut("displayreporting", resultsHTML);
        myContent.contextPut("resreporting", resultsHTML);
        myContent.contextPut("showResults", Boolean.TRUE);
      }
    } else if (source == hideResultsButton) {
      myContent.contextPut("showResults", Boolean.FALSE);
    }
  }