public StatisticsAdminController(UserRequest ureq, WindowControl wControl) {
    super(ureq, wControl);
    content = createVelocityContainer("index");
    LinkFactory.createButton(STATISTICS_FULL_RECALCULATION_TRIGGER_BUTTON, content, this);
    LinkFactory.createButton(STATISTICS_UPDATE_TRIGGER_BUTTON, content, this);

    refreshUIState();

    putInitialPanel(content);
  }
  public GuiDemoTooltipsController(UserRequest ureq, WindowControl wControl) {
    super(ureq, wControl);

    Link button = LinkFactory.createButton("button", content, this);
    button.setTooltip("tooltip.content");
    Link linkT = LinkFactory.createLink("linkT", content, this);
    linkT.setTooltip("tooltip.content");
    Link link1 = LinkFactory.createLink("link1", content, this);
    link1.setTooltip("tooltip.content");
    Link link2 = LinkFactory.createLink("link2", content, this);
    link2.setTooltip("tooltip.content");

    // link with component content

    /**
     * works when passing a custom html id like id="blalala" and then fetching the content from this
     * id with getElementById("id").innerHTML but with the component the component is not invisible
     * and gets renderer somewhere and somehow not
     */
    LinkFactory.createLink("link3", content, this);
    content.put("tooltipContent", tooltipContent);
    link4 = LinkFactory.createLink("link4", tooltipContent, this);

    // add source view control
    Controller sourceview = new SourceViewController(ureq, wControl, this.getClass(), content);
    content.put("sourceview", sourceview.getInitialComponent());

    putInitialPanel(content);
  }
  public MoveCopySubtreeController(
      UserRequest ureq,
      WindowControl wControl,
      OLATResourceable ores,
      CourseEditorTreeNode moveCopyFrom,
      boolean copy) {
    super(ureq, wControl);
    this.ores = ores;
    this.moveCopyFrom = moveCopyFrom;
    this.copy = copy;

    ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
    addLoggingResourceable(LoggingResourceable.wrap(course));
    addLoggingResourceable(LoggingResourceable.wrap(moveCopyFrom.getCourseNode()));

    insertTree = new MenuTree(null, "copy_node_selection", this);
    insertTree.enableInsertTool(true);
    insertModel = new InsertTreeModel(course.getEditorTreeModel().getRootNode(), moveCopyFrom);
    insertTree.setTreeModel(insertModel);

    VelocityContainer mainVC = createVelocityContainer("moveCopyNode");

    selectButton = LinkFactory.createButton("insertAtSelectedTreepos", mainVC, this);
    selectButton.setCustomEnabledLinkCSS("btn btn-primary");
    selectButton.setCustomDisabledLinkCSS("btn btn-default");
    selectButton.setEnabled(false);
    cancelButton = LinkFactory.createButton("cancel", mainVC, this);

    int numOfNodes = TreeHelper.totalNodeCount(insertModel.getRootNode());
    if (numOfNodes > CourseModule.getCourseNodeLimit()) {
      String msg =
          getTranslator()
              .translate(
                  "warning.containsXXXormore.nodes",
                  new String[] {
                    String.valueOf(numOfNodes),
                    String.valueOf(CourseModule.getCourseNodeLimit() + 1)
                  });
      Controller tmp = MessageUIFactory.createWarnMessage(ureq, wControl, null, msg);
      listenTo(tmp);
      mainVC.put("nodelimitexceededwarning", tmp.getInitialComponent());
    }

    mainVC.put("selection", insertTree);
    putInitialPanel(mainVC);
  }
示例#4
0
 /**
  * Provides the show results button if results available or a message with the visibility period.
  *
  * @param ureq
  */
 private void exposeResults(UserRequest ureq) {
   // migration: check if old tests have no summary configured
   String configuredSummary = (String) modConfig.get(IQEditController.CONFIG_KEY_SUMMARY);
   boolean noSummary =
       configuredSummary == null
           || (configuredSummary != null
               && configuredSummary.equals(AssessmentInstance.QMD_ENTRY_SUMMARY_NONE));
   if (!noSummary) {
     Boolean showResultsObj =
         modConfig.getBooleanEntry(IQEditController.CONFIG_KEY_RESULT_ON_HOME_PAGE);
     boolean showResultsOnHomePage = (showResultsObj != null && showResultsObj.booleanValue());
     myContent.contextPut("showResultsOnHomePage", new Boolean(showResultsOnHomePage));
     boolean dateRelatedVisibility = AssessmentHelper.isResultVisible(modConfig);
     if (showResultsOnHomePage && dateRelatedVisibility) {
       myContent.contextPut("showResultsVisible", Boolean.TRUE);
       showResultsButton = LinkFactory.createButton("command.showResults", myContent, this);
       hideResultsButton = LinkFactory.createButton("command.hideResults", myContent, this);
     } else if (showResultsOnHomePage) {
       Date startDate = (Date) modConfig.get(IQEditController.CONFIG_KEY_RESULTS_START_DATE);
       Date endDate = (Date) modConfig.get(IQEditController.CONFIG_KEY_RESULTS_END_DATE);
       String visibilityStartDate =
           DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, ureq.getLocale())
               .format(startDate);
       String visibilityEndDate = "-";
       if (endDate != null) {
         visibilityEndDate =
             DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, ureq.getLocale())
                 .format(endDate);
       }
       String visibilityPeriod =
           getTranslator()
               .translate(
                   "showResults.visibility",
                   new String[] {visibilityStartDate, visibilityEndDate});
       myContent.contextPut("visibilityPeriod", visibilityPeriod);
       myContent.contextPut("showResultsVisible", Boolean.FALSE);
     }
   }
 }
  protected void showExportFinished() {
    ICourse course = CourseFactory.loadCourse(ores);
    VelocityContainer vcFeedback = createVelocityContainer("courselogs_feedback");
    showFileButton = LinkFactory.createButton("showfile", vcFeedback, this);
    vcFeedback.contextPut("body", translate("course.logs.feedback", course.getCourseTitle()));
    myPanel.setContent(vcFeedback);

    // note: polling can't be switched off unfortunatelly
    //       this is due to the fact that the jsandcsscomponent can only modify
    //       certain parts of the page and it would require a full page refresh
    //       to get rid of the poller - and that's not possible currently

    showInfo("course.logs.finished", course.getCourseTitle());
  }
  /**
   * Constructor for the course logs archive controller
   *
   * @param ureq
   * @param wControl
   * @param course
   */
  public CourseLogsArchiveController(
      UserRequest ureq, WindowControl wControl, OLATResourceable ores) {
    super(ureq, wControl);
    this.ores = ores;
    this.myPanel = new Panel("myPanel");
    myPanel.addListener(this);

    myContent = createVelocityContainer("start_courselogs");

    Identity identity = ureq.getIdentity();
    Roles roles = ureq.getUserSession().getRoles();

    RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(ores, false);
    boolean isOLATAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isOresOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(identity, re);
    boolean isOresInstitutionalManager =
        RepositoryManager.getInstance().isInstitutionalRessourceManagerFor(identity, roles, re);
    boolean aLogV = isOresOwner || isOresInstitutionalManager;
    boolean uLogV = isOLATAdmin;
    boolean sLogV = isOresOwner || isOresInstitutionalManager;

    if (AsyncExportManager.getInstance().asyncArchiveCourseLogOngoingFor(ureq.getIdentity())) {
      // then show the ongoing feedback
      showExportOngoing(false);
    } else if (isOLATAdmin || aLogV || uLogV || sLogV) {
      myContent.contextPut("hasLogArchiveAccess", true);
      logFileChooserForm = new LogFileChooserForm(ureq, wControl, isOLATAdmin, aLogV, uLogV, sLogV);
      listenTo(logFileChooserForm);
      myContent.put("logfilechooserform", logFileChooserForm.getInitialComponent());
      ICourse course = CourseFactory.loadCourse(ores);
      myContent.contextPut(
          "body", translate("course.logs.existingarchiveintro", course.getCourseTitle()));
      showFileButton = LinkFactory.createButton("showfile", myContent, this);
      File exportDir =
          CourseFactory.getDataExportDirectory(ureq.getIdentity(), course.getCourseTitle());
      boolean exportDirExists = false;
      if (exportDir != null && exportDir.exists() && exportDir.isDirectory()) {
        exportDirExists = true;
      }
      myContent.contextPut("hascourselogarchive", new Boolean(exportDirExists));
      myPanel.setContent(myContent);
    } else {
      myContent.contextPut("hasLogArchiveAccess", new Boolean(false));
      myPanel.setContent(myContent);
    }

    putInitialPanel(myPanel);
  }
示例#7
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);
    }
  }
  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();
  }
 public NotificationsEmailAdminController(final UserRequest ureq, final WindowControl wControl) {
   super(ureq, wControl);
   content = createVelocityContainer("index");
   boolean enabled;
   String cronExpression = "";
   try {
     CoreSpringFactory.getBean("org.olat.notifications.job.enabled");
     enabled = true;
     final CronTriggerBean bean =
         (CronTriggerBean) CoreSpringFactory.getBean("sendNotificationsEmailTrigger");
     cronExpression = bean.getCronExpression();
   } catch (final Exception e) {
     enabled = false;
   }
   content.contextPut(
       "status",
       getTranslator()
           .translate(
               "notification.status", new String[] {String.valueOf(enabled), cronExpression}));
   startNotifyButton = LinkFactory.createButton(TRIGGER_NOTIFY, content, this);
   putInitialPanel(content);
 }