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);
  }
예제 #2
0
  @Override
  public boolean isInterceptionRequired(UserRequest ureq) {
    UserSession usess = ureq.getUserSession();

    boolean interception = false;
    if (isREST(ureq)) {
      // do nothing
    } else if (!historyModule.isResumeEnabled()) {
      String bc = getLandingBC(ureq);
      launch(ureq, bc);
    } else if (usess.getRoles().isGuestOnly()) {
      String bc = getLandingBC(ureq);
      launch(ureq, bc);
    } else {
      Preferences prefs = usess.getGuiPreferences();
      String resumePrefs = (String) prefs.get(WindowManager.class, "resume-prefs");
      if (!StringHelper.containsNonWhitespace(resumePrefs)) {
        resumePrefs = historyModule.getResumeDefaultSetting();
      }

      if ("none".equals(resumePrefs)) {
        String bc = getLandingBC(ureq);
        launch(ureq, bc);
      } else if ("auto".equals(resumePrefs)) {
        HistoryPoint historyEntry =
            HistoryManager.getInstance().readHistoryPoint(ureq.getIdentity());
        if (historyEntry != null
            && StringHelper.containsNonWhitespace(historyEntry.getBusinessPath())) {
          List<ContextEntry> cloneCes =
              BusinessControlFactory.getInstance().cloneContextEntries(historyEntry.getEntries());
          BusinessControl bc =
              BusinessControlFactory.getInstance().createFromContextEntries(cloneCes);
          launch(ureq, bc);
        } else {
          String bc = getLandingBC(ureq);
          launch(ureq, bc);
        }
      } else if ("ondemand".equals(resumePrefs)) {
        HistoryPoint historyEntry = historyManager.readHistoryPoint(ureq.getIdentity());
        if (historyEntry != null
            && StringHelper.containsNonWhitespace(historyEntry.getBusinessPath())) {
          interception = true;

          String bc = getLandingBC(ureq);
          if (StringHelper.containsNonWhitespace(bc)) {
            noButton.setVisible(false);
          } else {
            landingButton.setVisible(false);
          }
        } else {
          String bc = getLandingBC(ureq);
          launch(ureq, bc);
        }
      }
    }
    return interception;
  }
예제 #3
0
 /**
  * Search first in the user preferences, after in rules
  *
  * @param ureq
  * @return
  */
 private String getLandingBC(UserRequest ureq) {
   Preferences prefs = ureq.getUserSession().getGuiPreferences();
   String landingPage = (String) prefs.get(WindowManager.class, "landing-page");
   if (StringHelper.containsNonWhitespace(landingPage)) {
     String path = Rules.cleanUpLandingPath(landingPage);
     if (StringHelper.containsNonWhitespace(path)) {
       return BusinessControlFactory.getInstance().formatFromURI(path);
     }
   }
   return lpModule.getRules().match(ureq.getUserSession());
 }