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 AssessedIdentityRepositoryEntryController(
      UserRequest ureq,
      WindowControl wControl,
      TooledStackedPanel stackPanel,
      RepositoryEntry assessableEntry,
      Identity assessedIdentity,
      AssessableResource element) {
    super(ureq, wControl);

    this.stackPanel = stackPanel;
    this.assessedIdentity = assessedIdentity;

    identityAssessmentVC = createVelocityContainer("identity_personal_infos");
    identityAssessmentVC.contextPut("user", assessedIdentity.getUser());

    infosController = new AssessedIdentityLargeInfosController(ureq, wControl, assessedIdentity);
    listenTo(infosController);
    identityAssessmentVC.put("identityInfos", infosController.getInitialComponent());

    RepositoryHandler handler = repositoryHandlerFactory.getRepositoryHandler(assessableEntry);
    if (handler.supportsAssessmentDetails()) {
      detailsCtrl =
          handler.createAssessmentDetailsController(
              assessableEntry, ureq, getWindowControl(), stackPanel, assessedIdentity);
      listenTo(detailsCtrl);
      identityAssessmentVC.put("details", detailsCtrl.getInitialComponent());
    }

    assessmentForm =
        new AssessmentForm(ureq, getWindowControl(), assessedIdentity, assessableEntry, element);
    listenTo(assessmentForm);
    identityAssessmentVC.put("assessmentForm", assessmentForm.getInitialComponent());

    putInitialPanel(identityAssessmentVC);
  }
Пример #3
0
 /** @return the gui stack handle */
 public GuiStack getGuiStackHandle() {
   if (guiStackHandle == null) {
     guiStackHandle =
         wControl.getWindowBackOffice().createGuiStack(controller.getInitialComponent());
   }
   return guiStackHandle;
 }
  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);
  }
 private void doStartPage(UserRequest ureq) {
   Controller startPageInner = new TUStartController(ureq, getWindowControl(), config);
   startPage =
       TitledWrapperHelper.getWrapper(
           ureq, getWindowControl(), startPageInner, courseNode, "o_tu_icon");
   listenTo(startPage);
   main.setContent(startPage.getInitialComponent());
 }
  /**
   * Constructor for a forum course building block runtime controller
   *
   * @param ureq The user request
   * @param userCourseEnv
   * @param wContr The current window controller
   * @param forum The forum to be displayed
   * @param foCallback The forum security callback
   * @param foCourseNode The current course node
   */
  public FOCourseNodeRunController(
      UserRequest ureq,
      WindowControl wControl,
      Forum forum,
      ForumCallback foCallback,
      FOCourseNode courseNode) {
    super(ureq, wControl);

    // set logger on this run controller
    addLoggingResourceable(LoggingResourceable.wrap(courseNode));

    forumCtrl = new ForumController(ureq, getWindowControl(), forum, foCallback, true);
    listenTo(forumCtrl);
    Controller titledCtrl =
        TitledWrapperHelper.getWrapper(
            ureq, getWindowControl(), forumCtrl, courseNode, "o_fo_icon");
    listenTo(titledCtrl);
    putInitialPanel(titledCtrl.getInitialComponent());
  }
Пример #7
0
 /**
  * @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;
 }
  protected RegistrationController openRegistration(UserRequest ureq) {
    removeAsListenerAndDispose(cmc);
    removeAsListenerAndDispose(subController);

    subController = new RegistrationController(ureq, getWindowControl());
    listenTo(subController);
    cmc =
        new CloseableModalController(
            getWindowControl(), translate("close"), subController.getInitialComponent());
    listenTo(cmc);
    cmc.activate();
    return (RegistrationController) subController;
  }
  /**
   * config.set
   *
   * @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(final UserRequest ureq, final Component source, final Event event) {
    if (source == previewButton) { // those must be links

      removeAsListenerAndDispose(tunnelRunCtr);
      tunnelRunCtr =
          new LTIRunController(getWindowControl(), config, ureq, courseNode, editCourseEnv);
      listenTo(tunnelRunCtr);

      // preview layout: only center column (col3) used
      removeAsListenerAndDispose(previewLayoutCtr);
      previewLayoutCtr =
          new LayoutMain3ColsPreviewController(
              ureq, getWindowControl(), null, null, tunnelRunCtr.getInitialComponent(), null);
      previewLayoutCtr.addDisposableChildController(tunnelRunCtr); // cascade dispose
      listenTo(previewLayoutCtr);

      previewLayoutCtr.activate();
    }
  }
  protected void openChangePassword(UserRequest ureq, String initialEmail) {
    // double-check if allowed first
    if (!userModule.isAnyPasswordChangeAllowed()) {
      throw new OLATSecurityException("chose password to be changed, but disallowed by config");
    }

    removeAsListenerAndDispose(cmc);
    removeAsListenerAndDispose(subController);

    subController = new PwChangeController(ureq, getWindowControl(), initialEmail, true);
    listenTo(subController);

    String title = ((PwChangeController) subController).getWizardTitle();
    cmc =
        new CloseableModalController(
            getWindowControl(),
            translate("close"),
            subController.getInitialComponent(),
            true,
            title);
    listenTo(cmc);

    cmc.activate();
  }
Пример #11
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);
    }
  }
  /**
   * @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)
   */
  @Override
  public void event(final UserRequest ureq, final Controller source, final Event event) {
    final String cmd = event.getCommand();
    if (source == searchCtr) {
      if (cmd.equals(RepositoryTableModel.TABLE_ACTION_SELECT_ENTRY)) {
        // user selected entry to get a preview
        selectedRepositoryEntry = searchCtr.getSelectedEntry();
        final RepositoryEntry repositoryEntry = searchCtr.getSelectedEntry();
        final RepositoryHandler typeToLaunch =
            RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry);
        if (typeToLaunch == null) {
          final StringBuilder sb = new StringBuilder(translate("error.launch"));
          sb.append(": No launcher for repository entry: ");
          sb.append(repositoryEntry.getKey());
          throw new OLATRuntimeException(RepositoryDetailsController.class, sb.toString(), null);
        }
        // do skip the increment launch counter, this is only a preview!
        final OLATResourceable ores = repositoryEntry.getOlatResource();

        removeAsListenerAndDispose(previewCtr);
        previewCtr = typeToLaunch.createLaunchController(ores, null, ureq, getWindowControl());
        listenTo(previewCtr);

        removeAsListenerAndDispose(previewModalCtr);
        previewModalCtr =
            new CloseableModalController(
                getWindowControl(),
                translate("referencableSearch.preview.close"),
                previewCtr.getInitialComponent());
        listenTo(previewModalCtr);

        previewModalCtr.activate();

      } else if (cmd.equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
        // done, user selected a repo entry
        selectedRepositoryEntry = searchCtr.getSelectedEntry();
        fireEvent(ureq, EVENT_REPOSITORY_ENTRY_SELECTED);
      }
      initLinks();
    } else if (source == addController) {
      if (event.equals(Event.DONE_EVENT)) {
        cmc.deactivate();

        selectedRepositoryEntry = addController.getAddedEntry();
        fireEvent(ureq, EVENT_REPOSITORY_ENTRY_SELECTED);
        // info message
        final String message =
            translate(
                "message.entry.selected",
                new String[] {
                  addController.getAddedEntry().getDisplayname(),
                  addController.getAddedEntry().getResourcename()
                });
        getWindowControl().setInfo(message);
      } else if (event.equals(Event.CANCELLED_EVENT)) {
        cmc.deactivate();

      } else if (event.equals(Event.FAILED_EVENT)) {
        showError("add.failed");
      }
    }
  }
Пример #13
0
 /** @see org.olat.core.gui.control.Disposable#dispose(boolean) */
 public void dispose() {
   if (controller != null) { // OLAT-3500
     controller.dispose();
   }
 }