/**
   * @see org.olat.login.auth.AuthenticationController#init(org.olat.core.gui.UserRequest,
   *     org.olat.core.gui.control.WindowControl)
   */
  public OLATAuthenticationController(UserRequest ureq, WindowControl winControl) {
    // use fallback translator to registration module
    super(
        ureq,
        winControl,
        Util.createPackageTranslator(RegistrationManager.class, ureq.getLocale()));

    loginComp = createVelocityContainer("olat_log", "olatlogin");

    if (userModule.isAnyPasswordChangeAllowed()) {
      pwLink = LinkFactory.createLink("_olat_login_change_pwd", "menu.pw", loginComp, this);
      pwLink.setElementCssClass("o_login_pwd");
    }

    if (registrationModule.isSelfRegistrationEnabled()
        && registrationModule.isSelfRegistrationLoginEnabled()) {
      registerLink =
          LinkFactory.createLink("_olat_login_register", "menu.register", loginComp, this);
      registerLink.setElementCssClass("o_login_register");
      registerLink.setTitle("menu.register.alt");
    }

    // prepare login form
    loginForm = new OLATAuthentcationForm(ureq, winControl, "olat_login", getTranslator());
    listenTo(loginForm);

    loginComp.put("loginForm", loginForm.getInitialComponent());

    // Check if form is triggered by external loginworkflow that has been failed
    if (ureq.getParameterSet().contains(PARAM_LOGINERROR)) {
      showError(translate("login.error", WebappHelper.getMailConfig("mailReplyTo")));
    }

    putInitialPanel(loginComp);
  }
Ejemplo n.º 2
0
  @Override
  protected void initRuntimeTools(Dropdown toolsDropdown) {
    if (reSecurity.isEntryAdmin()) {
      membersLink =
          LinkFactory.createToolLink(
              "members", translate("details.members"), this, "o_sel_repo_members");
      membersLink.setIconLeftCSS("o_icon o_icon-fw o_icon_membersmanagement");
      toolsDropdown.addComponent(membersLink);
    }

    if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach()) {
      assessmentLink =
          LinkFactory.createToolLink(
              "assessment", translate("command.openassessment"), this, "o_icon_assessment_tool");
      assessmentLink.setElementCssClass("o_sel_course_assessment_tool");
      toolsDropdown.addComponent(assessmentLink);
    }

    if (reSecurity.isEntryAdmin()) {
      RepositoryEntry re = getRepositoryEntry();
      ordersLink =
          LinkFactory.createToolLink(
              "bookings", translate("details.orders"), this, "o_sel_repo_booking");
      ordersLink.setIconLeftCSS("o_icon o_icon-fw o_icon_booking");
      boolean booking = acService.isResourceAccessControled(re.getOlatResource(), null);
      ordersLink.setEnabled(booking);
      toolsDropdown.addComponent(ordersLink);
    }
  }
  public CourseGlossaryToolLinkController(
      WindowControl wControl,
      UserRequest ureq,
      ICourse course,
      Translator translator,
      boolean allowGlossaryEditing,
      CourseEnvironment courseEnvironment,
      GlossaryMarkupItemController glossMarkupItmCtr) {
    super(ureq, wControl, translator);
    setBasePackage(RunMainController.class);
    this.allowGlossaryEditing = allowGlossaryEditing;
    courseEnvir = courseEnvironment;
    guiPrefsKey = CourseGlossaryFactory.createGuiPrefsKey(course);

    mainVC = createVelocityContainer("glossaryToolLink");

    Preferences prefs = ureq.getUserSession().getGuiPreferences();
    Boolean state = (Boolean) prefs.get(CourseGlossaryToolLinkController.class, guiPrefsKey);
    if (state == null || !state.booleanValue()) {
      onCommand = LinkFactory.createLink("command.glossary.on", mainVC, this);
      onCommand.setTitle("command.glossary.on.alt");
      onCommand.setCustomEnabledLinkCSS("b_toolbox_toggle");
    } else {
      offCommand = LinkFactory.createLink("command.glossary.off", mainVC, this);
      offCommand.setTitle("command.glossary.off.alt");
      offCommand.setCustomEnabledLinkCSS("b_toolbox_toggle");
    }

    // keep reference to textMarkerContainerCtr for later enabling/disabling
    this.glossMarkupItmCtr = glossMarkupItmCtr;

    putInitialPanel(mainVC);
  }
  public OverviewAuthoringController(UserRequest ureq, WindowControl wControl) {
    super(ureq, wControl);
    setTranslator(
        Util.createPackageTranslator(RepositoryManager.class, getLocale(), getTranslator()));
    isGuestonly = ureq.getUserSession().getRoles().isGuestOnly();

    mainPanel = new MainPanel("authoringMainPanel");
    mainPanel.setDomReplaceable(false);
    mainVC = createVelocityContainer("overview");
    mainPanel.setContent(mainVC);

    segmentView = SegmentViewFactory.createSegmentView("segments", mainVC, this);
    segmentView.setReselect(true);

    if (!isGuestonly) {
      favoriteLink = LinkFactory.createLink("search.mark", mainVC, this);
      segmentView.addSegment(favoriteLink, false);
    }
    myEntriesLink = LinkFactory.createLink("search.my", mainVC, this);
    segmentView.addSegment(myEntriesLink, false);
    searchLink = LinkFactory.createLink("search.generic", mainVC, this);
    segmentView.addSegment(searchLink, false);

    putInitialPanel(mainPanel);
  }
 /** Create all link components for workflow navigation */
 private void initLinks() {
   // link to search all referencable entries
   searchEntriesLink =
       LinkFactory.createCustomLink(
           "searchEntriesLink",
           CMD_SEARCH_ENTRIES,
           "referencableSearch." + CMD_SEARCH_ENTRIES,
           Link.LINK,
           mainVC,
           this);
   // link to show all referencable entries
   allEntriesLink =
       LinkFactory.createCustomLink(
           "allEntriesLink",
           CMD_ALL_ENTRIES,
           "referencableSearch." + CMD_ALL_ENTRIES,
           Link.LINK,
           mainVC,
           this);
   // link to show all my entries
   myEntriesLink =
       LinkFactory.createCustomLink(
           "myEntriesLink",
           CMD_MY_ENTRIES,
           "referencableSearch." + CMD_MY_ENTRIES,
           Link.LINK,
           mainVC,
           this);
 }
  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);
  }
  private void setLinks() {
    importLink =
        LinkFactory.createCustomLink(
            "cptreecontroller.importlink",
            "cptreecontroller.importlink",
            null,
            Link.NONTRANSLATED,
            contentVC,
            this);
    importLink.setCustomEnabledLinkCSS("o_cpeditor_import");
    importLink.setTooltip(translate("cptreecontroller.importlink_title"), false);
    importLink.setTitle(translate("cptreecontroller.importlink_title"));

    newLink =
        LinkFactory.createCustomLink(
            "cptreecontroller.newlink",
            "cptreecontroller.newlink",
            null,
            Link.NONTRANSLATED,
            contentVC,
            this);
    newLink.setCustomEnabledLinkCSS("o_cpeditor_new");
    newLink.setTooltip(translate("cptreecontroller.newlink_title"), false);
    newLink.setTitle(translate("cptreecontroller.newlink_title"));

    copyLink =
        LinkFactory.createCustomLink(
            "cptreecontroller.copylink",
            "cptreecontroller.copylink",
            null,
            Link.NONTRANSLATED,
            contentVC,
            this);
    copyLink.setTooltip(translate("cptreecontroller.copylink_title"), false);
    copyLink.setTitle(translate("cptreecontroller.copylink_title"));
    copyLink.setCustomEnabledLinkCSS("o_cpeditor_copy");

    deleteLink =
        LinkFactory.createCustomLink(
            "cptreecontroller.deletelink",
            "cptreecontroller.deletelink",
            null,
            Link.NONTRANSLATED,
            contentVC,
            this);
    deleteLink.setTooltip(translate("cptreecontroller.deletelink_title"), false);
    deleteLink.setTitle(translate("cptreecontroller.deletelink_title"));
    deleteLink.setCustomEnabledLinkCSS("o_cpeditor_delete");
  }
Ejemplo n.º 8
0
  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();
  }
Ejemplo n.º 9
0
  @Override
  protected void initEditionTools(Dropdown settingsDropdown) {
    super.initEditionTools(settingsDropdown);
    if (reSecurity.isEntryAdmin()) {
      settingsLink =
          LinkFactory.createToolLink("metaDataConfig", translate("tab.video.settings"), this);
      settingsLink.setIconLeftCSS("o_icon o_icon-fw o_icon_quota o_icon_settings");
      settingsDropdown.addComponent(4, settingsLink);

      changeVideoLink =
          LinkFactory.createToolLink("changeVideo", translate("tab.video.exchange"), this);
      changeVideoLink.setIconLeftCSS("o_icon o_icon_refresh o_icon-fw");
      settingsDropdown.addComponent(3, changeVideoLink);

      settingsDropdown.addComponent(new Spacer("metadata-poster"));
    }
  }
Ejemplo n.º 10
0
  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);
  }
  public JavaVMController(UserRequest ureq, WindowControl wControl) {
    super(ureq, wControl);

    mainVC = createVelocityContainer("segments");

    segmentView = SegmentViewFactory.createSegmentView("segments", mainVC, this);
    memoryLink = LinkFactory.createLink("java.memory", mainVC, this);
    segmentView.addSegment(memoryLink, true);

    threadsLink = LinkFactory.createLink("java.threads", mainVC, this);
    segmentView.addSegment(threadsLink, false);

    envPropsLink = LinkFactory.createLink("java.envProps", mainVC, this);
    segmentView.addSegment(envPropsLink, false);

    mainVC.put("segments", segmentView);
    doOpenMemory(ureq);
    putInitialPanel(mainVC);
  }
  /**
   * Constructor
   *
   * @param ureq
   * @param component
   */
  public NotificationsPortletRunController(
      WindowControl wControl,
      UserRequest ureq,
      Translator trans,
      String portletName,
      int defaultMaxEntries) {
    super(wControl, ureq, trans, portletName, defaultMaxEntries);

    sortingTermsList.add(SortingCriteria.TYPE_SORTING);
    sortingTermsList.add(SortingCriteria.ALPHABETICAL_SORTING);
    sortingTermsList.add(SortingCriteria.DATE_SORTING);

    this.notificationsVC = this.createVelocityContainer("notificationsPortlet");
    showAllLink = LinkFactory.createLink("notificationsPortlet.showAll", notificationsVC, this);
    showAllLink.setIconRightCSS("o_icon o_icon_start");

    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setTableEmptyMessage(trans.translate("notificationsPortlet.nonotifications"));
    tableConfig.setDisplayTableHeader(false);
    tableConfig.setCustomCssClass("o_portlet_table");
    tableConfig.setDisplayRowCount(false);
    tableConfig.setPageingEnabled(false);
    tableConfig.setDownloadOffered(false);
    // disable the default sorting for this table
    tableConfig.setSortingEnabled(false);
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), trans);
    listenTo(tableCtr);

    // dummy header key, won't be used since setDisplayTableHeader is set to false
    tableCtr.addColumnDescriptor(
        new DefaultColumnDescriptor(
            "notificationsPortlet.bgname", 0, CMD_LAUNCH, trans.getLocale()));
    tableCtr.addColumnDescriptor(
        new DefaultColumnDescriptor(
            "notificationsPortlet.type",
            1,
            null,
            trans.getLocale(),
            ColumnDescriptor.ALIGNMENT_RIGHT));

    this.sortingCriteria = getPersistentSortingConfiguration(ureq);
    man = NotificationsManager.getInstance();
    // default use the interval
    compareDate = man.getCompareDateFromInterval(man.getUserIntervalOrDefault(ureq.getIdentity()));
    reloadModel(sortingCriteria);

    this.notificationsVC.put("table", tableCtr.getInitialComponent());
    // notify us whenever we will be shown on screen shortly, so that we can reload the model if we
    // received a subscription changed event in the meantime
    ComponentUtil.registerForValidateEvents(notificationsVC, this);

    putInitialPanel(notificationsVC);

    man.registerAsListener(this, ureq.getIdentity());
  }
  public ReferencableEntriesSearchController(
      final WindowControl wControl,
      final UserRequest ureq,
      final String[] limitTypes,
      final String commandLabel,
      final boolean canImport,
      final boolean canCreate,
      final boolean canDirectLaunch) {
    super(ureq, wControl);
    this.canImport = canImport;
    this.canCreate = canCreate;
    this.limitTypes = limitTypes;
    this.commandLabel = commandLabel;
    setBasePackage(RepositoryManager.class);
    mainVC = createVelocityContainer("referencableSearch");
    // add all link to velocity
    initLinks();

    // add repo search controller
    searchCtr =
        new RepositorySearchController(
            commandLabel, ureq, getWindowControl(), false, canDirectLaunch, limitTypes);
    listenTo(searchCtr);

    // do instantiate buttons
    boolean isVisible = isCreateButtonVisible();
    if (isVisible) {
      createRessourceButton = LinkFactory.createButtonSmall("cmd.create.ressource", mainVC, this);
    }
    mainVC.contextPut("hasCreateRessourceButton", new Boolean(isVisible));
    isVisible = isImportButtonVisible();
    if (isVisible) {
      importRessourceButton = LinkFactory.createButtonSmall("cmd.import.ressource", mainVC, this);
    }
    mainVC.contextPut("hasImportRessourceButton", new Boolean(isVisible));

    event(ureq, myEntriesLink, null);
    searchCtr.enableSearchforAllReferencalbeInSearchForm(true);
    mainVC.put("searchCtr", searchCtr.getInitialComponent());

    putInitialPanel(mainVC);
  }
Ejemplo n.º 14
0
  @Override
  protected void initSettingsTools(Dropdown settingsDropdown) {
    super.initSettingsTools(settingsDropdown);
    if (reSecurity.isEntryAdmin()) {
      settingsDropdown.addComponent(new Spacer(""));

      deliveryOptionsLink =
          LinkFactory.createToolLink("layout", translate("tab.layout"), this, "o_sel_repo_layout");
      deliveryOptionsLink.setIconLeftCSS("o_icon o_icon-fw o_icon_options");
      settingsDropdown.addComponent(deliveryOptionsLink);
    }
  }
  private void initMyContent(UserRequest ureq) {
    QuotaManager qm = QuotaManager.getInstance();
    if (!qm.hasQuotaEditRights(ureq.getIdentity()))
      throw new OLATSecurityException("Insufficient permissions to access QuotaController");

    myContent = createVelocityContainer("edit");
    myContent.contextPut("modalMode", Boolean.valueOf(modalMode));
    addQuotaButton = LinkFactory.createButtonSmall("qf.new", myContent, this);
    delQuotaButton = LinkFactory.createButtonSmall("qf.del", myContent, this);
    cancelButton = LinkFactory.createButtonSmall("cancel", myContent, this);

    // TODO loop over QuotaManager.getDefaultQuotaIdentifyers instead
    myContent.contextPut("users", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_USERS));
    myContent.contextPut("powerusers", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_POWER));
    myContent.contextPut("groups", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_GROUPS));
    myContent.contextPut("repository", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_REPO));
    myContent.contextPut(
        "coursefolder", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_COURSE));
    myContent.contextPut("nodefolder", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_NODES));
    myContent.contextPut("feeds", qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_FEEDS));
  }
Ejemplo n.º 16
0
  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);
  }
Ejemplo n.º 17
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);
  }
Ejemplo n.º 20
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);
    }
  }
  /**
   * Constructor for tunneling editor controller
   *
   * @param config The node module configuration
   * @param ureq The user request
   * @param wControl The window controller
   * @param tuCourseNode The current single page course node
   * @param course
   */
  public LTIEditController(
      final ModuleConfiguration config,
      final UserRequest ureq,
      final WindowControl wControl,
      final BasicLTICourseNode ltCourseNode,
      final ICourse course,
      final UserCourseEnvironment euce) {
    super(ureq, wControl);

    this.config = config;
    this.courseNode = ltCourseNode;
    this.editCourseEnv = course.getCourseEnvironment();

    myContent = this.createVelocityContainer("edit");
    previewButton = LinkFactory.createButtonSmall("command.preview", myContent, this);

    ltConfigForm = new LTIConfigForm(ureq, wControl, config);
    listenTo(ltConfigForm);

    myContent.put("ltConfigForm", ltConfigForm.getInitialComponent());

    final CourseGroupManager groupMgr = course.getCourseEnvironment().getCourseGroupManager();
    final CourseEditorTreeModel editorModel = course.getEditorTreeModel();
    // Accessibility precondition
    final Condition accessCondition = courseNode.getPreConditionAccess();
    accessibilityCondContr =
        new ConditionEditController(
            ureq,
            getWindowControl(),
            groupMgr,
            accessCondition,
            "accessabilityConditionForm",
            AssessmentHelper.getAssessableNodes(editorModel, ltCourseNode),
            euce);
    this.listenTo(accessibilityCondContr);

    // Enable preview button only if node configuration is valid
    if (!(ltCourseNode.isConfigValid().isError())) {
      myContent.contextPut("showPreviewButton", Boolean.TRUE);
    } else {
      myContent.contextPut("showPreviewButton", Boolean.FALSE);
    }
  }
 private void init(UserRequest ureq) {
   String artFulltextContent = ePFMgr.getArtefactFullTextContent(artefact);
   if (!readOnlyMode) {
     // prepare an edit link
     String fulltext = FilterFactory.getHtmlTagAndDescapingFilter().filter(artFulltextContent);
     fulltext = StringHelper.xssScan(fulltext);
     fulltext = Formatter.truncate(fulltext, 50);
     editBtn =
         LinkFactory.createCustomLink(
             "text.edit.link", "edit", fulltext, Link.NONTRANSLATED, vC, this);
     editBtn.setIconRightCSS("o_icon o_icon_inline_editable");
   } else {
     // register a mapper to deliver uploaded media files
     final VFSContainer artefactFolder = ePFMgr.getArtefactContainer(artefact);
     String mapperBase = registerMapper(ureq, new VFSContainerMapper(artefactFolder));
     Filter urlFilter = FilterFactory.getBaseURLToMediaRelativeURLFilter(mapperBase);
     String wrappedText = urlFilter.filter(artFulltextContent);
     vC.contextPut("text", wrappedText);
   }
 }
 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);
 }
  private void doIdentityAssessmentOverview(UserRequest ureq, boolean initTable) {
    if (identityOverviewVC == null) {
      identityOverviewVC = createVelocityContainer("identityoverview");

      if (headers) {
        backLink = LinkFactory.createLinkBack(identityOverviewVC, this);
        Identity assessedIdentity =
            assessedUserCourseEnvironment.getIdentityEnvironment().getIdentity();
        identityOverviewVC.contextPut("user", assessedIdentity.getUser());
      }
    }
    if (initTable) {
      assessedUserCourseEnvironment.getScoreAccounting().evaluateAll();
      assessmentOverviewCtr =
          new IdentityAssessmentOverviewController(
              ureq, getWindowControl(), assessedUserCourseEnvironment, mayEdit, false, true);
      listenTo(assessmentOverviewCtr);
      identityOverviewVC.put(
          "assessmentOverviewTable", assessmentOverviewCtr.getInitialComponent());
    }
    main.setContent(identityOverviewVC);
  }
  /**
   * @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)
   */
  @Override
  public void event(UserRequest ureq, Component source, Event event) {
    if (source == onCommand) {
      // toggle on
      Preferences prefs = ureq.getUserSession().getGuiPreferences();
      prefs.put(CourseGlossaryToolLinkController.class, guiPrefsKey, Boolean.TRUE);
      prefs.save();
      // update gui
      mainVC.remove(onCommand);
      offCommand = LinkFactory.createLink("command.glossary.off", mainVC, this);
      offCommand.setTitle("command.glossary.off.alt");
      offCommand.setCustomEnabledLinkCSS("b_toolbox_toggle");
      // notify textmarker controller
      glossMarkupItmCtr.setTextMarkingEnabled(true);
      fireEvent(ureq, new Event("glossaryOn"));

    } else if (source == offCommand) {
      // toggle off
      Preferences prefs = ureq.getUserSession().getGuiPreferences();
      prefs.put(CourseGlossaryToolLinkController.class, guiPrefsKey, Boolean.FALSE);
      prefs.save();
      // update gui
      mainVC.remove(offCommand);
      onCommand = LinkFactory.createLink("command.glossary.on", mainVC, this);
      onCommand.setTitle("command.glossary.on.alt");
      onCommand.setCustomEnabledLinkCSS("b_toolbox_toggle");
      // notify textmarker controller
      glossMarkupItmCtr.setTextMarkingEnabled(false);
      fireEvent(ureq, new Event("glossaryOff"));
    } else if (source == mainVC && event.getCommand().equals("command.glossary")) {
      // start glossary in window
      final CourseConfig cc = courseEnvir.getCourseConfig(); // do not cache cc, not save

      // if glossary had been opened from LR as Tab before, warn user:
      DTabs dts = Windows.getWindows(ureq).getWindow(ureq).getDTabs();
      RepositoryEntry repoEntry =
          RepositoryManager.getInstance()
              .lookupRepositoryEntryBySoftkey(cc.getGlossarySoftKey(), false);
      DTab dt = dts.getDTab(repoEntry.getOlatResource());
      if (dt != null) {
        List<ContextEntry> entries =
            BusinessControlFactory.getInstance()
                .createCEListFromResourceType(allowGlossaryEditing ? "true" : "false");
        dts.activate(ureq, dt, entries);
      } else {
        ControllerCreator ctrlCreator =
            new ControllerCreator() {
              public Controller createController(UserRequest lureq, WindowControl lwControl) {
                GlossaryMainController glossaryController =
                    CourseGlossaryFactory.createCourseGlossaryMainRunController(
                        lwControl, lureq, cc, allowGlossaryEditing);
                listenTo(glossaryController);
                if (glossaryController == null) {
                  // happens in the unlikely event of a user who is in a course and
                  // now
                  // tries to access the glossary
                  String text = translate("error.noglossary");
                  return MessageUIFactory.createInfoMessage(lureq, lwControl, null, text);
                } else {
                  // use a one-column main layout
                  LayoutMain3ColsController layoutCtr =
                      new LayoutMain3ColsController(
                          lureq,
                          lwControl,
                          null,
                          null,
                          glossaryController.getInitialComponent(),
                          null);
                  // dispose glossary on layout dispose
                  layoutCtr.addDisposableChildController(glossaryController);
                  return layoutCtr;
                }
              }
            };

        ControllerCreator layoutCtrlr =
            BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator);
        // open in new browser window
        openInNewBrowserWindow(ureq, layoutCtrlr);
        return; // immediate return after opening new browser window!
      }
    }
  }