public GoToMeetingController(
      UserRequest ureq,
      WindowControl wControl,
      GoToMeeting meeting,
      boolean administrator,
      boolean moderator,
      boolean readOnly) {
    super(ureq, wControl);
    this.readOnly = readOnly;
    this.moderator = moderator;
    this.administrator = administrator;

    mainVC = createVelocityContainer("meeting");
    mainVC.contextPut("title", meeting.getName());
    mainVC.contextPut("description", meeting.getDescription());

    if (administrator || moderator) {
      startLink = LinkFactory.createButtonLarge("training.start", mainVC, this);
      startLink.setTarget("_blank");
    }
    registerLink = LinkFactory.createButtonLarge("training.register", mainVC, this);
    confirmLink = LinkFactory.createButtonLarge("training.confirm", mainVC, this);
    confirmLink.setTarget("_blank");
    joinLink = LinkFactory.createButtonLarge("training.join", mainVC, this);
    joinLink.setTarget("_blank");

    openRecordingsLink = LinkFactory.createButton("recordings", mainVC, this);

    GoToError error = new GoToError();
    this.meeting = meetingMgr.getMeeting(meeting, error);
    this.registrant = meetingMgr.getRegistrant(meeting, getIdentity());
    if (error.hasError() && error.getError() != null) {
      mainVC.contextPut("errorMessage", translate(error.getError().i18nKey()));
    }

    List<GoToRecordingsG2T> recordings = meetingMgr.getRecordings(meeting, error);
    openRecordingsLink.setVisible(recordings != null && recordings.size() > 0);

    Date start = meeting.getStartDate();
    Date end = meeting.getEndDate();
    Formatter formatter = Formatter.getInstance(getLocale());
    mainVC.contextPut("start", formatter.formatDateAndTime(start));
    mainVC.contextPut("end", formatter.formatDateAndTime(end));

    putInitialPanel(mainVC);
    updateButtons();
  }
Beispiel #2
0
  private void init(UserRequest ureq) {
    startButton = LinkFactory.createButton("start", myContent, this);
    startButton.setElementCssClass("o_sel_start_qti12_test");
    startButton.setPrimary(true);
    startButton.setVisible(!userCourseEnv.isCourseReadOnly());

    // fetch disclaimer file
    String sDisclaimer = (String) modConfig.get(IQEditController.CONFIG_KEY_DISCLAIMER);
    if (sDisclaimer != null) {
      VFSContainer baseContainer = userCourseEnv.getCourseEnvironment().getCourseFolderContainer();
      int lastSlash = sDisclaimer.lastIndexOf('/');
      if (lastSlash != -1) {
        baseContainer = (VFSContainer) baseContainer.resolve(sDisclaimer.substring(0, lastSlash));
        sDisclaimer = sDisclaimer.substring(lastSlash);
        // first check if disclaimer exists on filesystem
        if (baseContainer == null || baseContainer.resolve(sDisclaimer) == null) {
          showWarning("disclaimer.file.invalid", sDisclaimer);
        } else {
          // screenreader do not like iframes, display inline
          iFrameCtr = new IFrameDisplayController(ureq, getWindowControl(), baseContainer);
          listenTo(iFrameCtr); // dispose automatically
          myContent.put("disc", iFrameCtr.getInitialComponent());
          iFrameCtr.setCurrentURI(sDisclaimer);
          myContent.contextPut("hasDisc", Boolean.TRUE);
        }
      }
    }

    // push title and learning objectives, only visible on intro page
    myContent.contextPut("menuTitle", courseNode.getShortTitle());
    myContent.contextPut("displayTitle", courseNode.getLongTitle());

    // Adding learning objectives
    String learningObj = courseNode.getLearningObjectives();
    if (learningObj != null) {
      Component learningObjectives =
          ObjectivesHelper.createLearningObjectivesComponent(learningObj, ureq);
      myContent.put("learningObjectives", learningObjectives);
      myContent.contextPut("hasObjectives", learningObj); // dummy value, just an exists operator	
    }

    if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
      checkChats(ureq);
      singleUserEventCenter.registerFor(
          this, getIdentity(), InstantMessagingService.TOWER_EVENT_ORES);
    }
  }
  private void updateButtons() {
    if (readOnly) {
      startLink.setVisible(false);
      registerLink.setVisible(false);
      confirmLink.setVisible(false);
      joinLink.setVisible(false);
    } else {
      Date start = meeting.getStartDate();
      Date end = meeting.getEndDate();
      Date now = new Date();
      boolean canStart = (start.compareTo(now) <= 0 && end.compareTo(now) > 0);

      Calendar cal = Calendar.getInstance();
      cal.setTime(start);
      cal.add(Calendar.MINUTE, -60);
      Date startMinusOne = cal.getTime();
      boolean canCoachStart = (startMinusOne.compareTo(now) <= 0 && end.compareTo(now) > 0);

      boolean ended = (end.compareTo(now) <= 0);
      if (administrator || moderator) {
        if (canCoachStart) {
          startLink.setVisible(true);
          registerLink.setVisible(false);
        } else if (ended) {
          startLink.setVisible(false);
          registerLink.setVisible(false);
        } else if (registrant == null) {
          startLink.setVisible(false);
          registerLink.setVisible(true);
        } else {
          startLink.setVisible(false);
          registerLink.setVisible(false);
        }
        confirmLink.setVisible(false);
        joinLink.setVisible(false);
      } else if (ended) {
        registerLink.setVisible(false);
        confirmLink.setVisible(false);
        joinLink.setVisible(false);
      } else if (canStart) {
        if (registrant == null) {
          registerLink.setVisible(false);
          confirmLink.setVisible(false);
          joinLink.setVisible(true);
        } else {
          registerLink.setVisible(false);
          confirmLink.setVisible(false);
          joinLink.setVisible(true);
        }
      } else {
        if (registrant == null) {
          registerLink.setVisible(true);
          confirmLink.setVisible(false);
          joinLink.setVisible(false);
        } else {
          registerLink.setVisible(false);
          confirmLink.setVisible(true);
          joinLink.setVisible(false);
        }
      }
    }
    mainVC.setDirty(true);
  }