Package org.olat.course.config

Examples of org.olat.course.config.CourseConfig


  /**
   * Initialize form data based on repository entry.
   */
  public void init(ICourse course) {
    CourseConfig cc = course.getCourseEnvironment().getCourseConfig();
//    java.util.logging.Level admin = cc.getLoglevelFor(UserActivityLogger.LOG_ADMIN);
//    java.util.logging.Level user = cc.getLoglevelFor(UserActivityLogger.LOG_USER);
//    java.util.logging.Level stat = cc.getLoglevelFor(UserActivityLogger.LOG_STAT);

    /*
    Translator logTrans = Util.createPackageTranslator(CourseLogController.class, getLocale());
    String[] valuesLogLevel = new String[] {
        logTrans.translate("log.disabled"),
        logTrans.translate("log.level.normal") + " (INFO)",
        logTrans.translate("log.level.detailed")+" (INFO + FINE)"};
    String[] keysLogLevel = new String[] { "" + CourseConfig.LOGLEVEL_OFF, "" + CourseConfig.LOGLEVEL_INFO, "" + CourseConfig.LOGLEVEL_FINE };
    */

/*    if (roles.isOLATAdmin() || CourseModule.isAdminLogVisible()) {
      logLevelSelectadmin = new StaticSingleSelectionElement("form.log.level.admin", keysLogLevel, valuesLogLevel);
      logLevelSelectadmin.select("" + admin.intValue(), true);
      addFormElement("logLeveladmin", logLevelSelectadmin);
    }

    if (roles.isOLATAdmin() || CourseModule.isUserLogVisible()) {
      logLevelSelectuser = new StaticSingleSelectionElement("form.log.level.user", keysLogLevel, valuesLogLevel);
      logLevelSelectuser.select("" + user.intValue(), true);
      addFormElement("logLeveluser", logLevelSelectuser);
    }

    if (roles.isOLATAdmin() || CourseModule.isStatisticLogVisible()) {
      logLevelSelectstat = new StaticSingleSelectionElement("form.log.level.stat", keysLogLevel, valuesLogLevel);
      logLevelSelectstat.select("" + stat.intValue(), true);
      addFormElement("logLevelstat", logLevelSelectstat);
    }*/
   
    if (InstantMessagingModule.isEnabled()&& CourseModule.isCourseChatEnabled()) {
      chatIsOn = new CheckBoxElement("chkbx.chat.onoff", cc.isChatEnabled());
      addFormElement("chatIsOn", chatIsOn);
    }

    // FIXME: remove "" and fix package...
    String[] values = new String[] { cc.getCssLayoutRef(), "" + translate("form.layout.setsystemcss") };
    String[] keys = new String[] { KEY_NO, KEY_YES };
    layout = new StaticSingleSelectionElement("form.layout.cssfile", keys, values);
    if (cc.hasCustomCourseCSS()) layout.select(KEY_NO, true);
    else layout.select(KEY_YES, true);
    addFormElement("layout", layout);

    String name;
    String softkey = cc.getSharedFolderSoftkey();

    RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(softkey, false);
    if (re == null) {
      cc.setSharedFolderSoftkey(CourseConfig.VALUE_EMPTY_SHAREDFOLDER_SOFTKEY);
      name = translate("sf.notconfigured");
    } else {
      name = re.getDisplayname();
    }
    String[] sfvalues = new String[] { name, translate("sf.notconfigured") };
    String[] sfkeys = new String[] { KEY_NO, KEY_YES };
    sfolder = new StaticSingleSelectionElement("sf.resourcetitle", sfkeys, sfvalues);
    if (cc.hasCustomSharedFolder()) sfolder.select(KEY_NO, true);
    else sfolder.select(KEY_YES, true);
    addFormElement("sfolder", sfolder);

    efficencyStatement = new CheckBoxElement("chkbx.efficency.onoff", cc.isEfficencyStatementEnabled());
    addFormElement("efficencyStatement", efficencyStatement);

    calendar = new CheckBoxElement("chkbx.calendar.onoff", cc.isCalendarEnabled());
    addFormElement("calendar", calendar);

   
    /*
     * glossary show name instead of check box OLAT-2126
     */
    String glossName;
    String glossSoftKey = cc.getGlossarySoftKey();
    re = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(glossSoftKey, false);
    if (re == null) {
      glossName = translate("glossary.no.glossary");
    } else {
      glossName = re.getDisplayname();
    }
   
    String[] glovalues = new String[] { glossName, translate("glossary.no.glossary") };
    glossary = new StaticSingleSelectionElement("glossary.isconfigured", sfkeys, glovalues);
    if (cc.hasGlossary()) glossary.select(KEY_NO, true);
    else glossary.select(KEY_YES, true);
    addFormElement("glossary", glossary);
   
   
   
View Full Code Here


    //  pro increased transaction timeout: would fix OLAT-5368 but only move the problem
    //@TODO OLAT-2597: real solution is a long-running background-task concept...
    DBFactory.getInstance().intermediateCommit();

    // export shared folder
    CourseConfig config = getCourseConfig();
    if (config.hasCustomSharedFolder()) {
      log.info("exportToFilesystem: exporting course "+this+": shared folder...");
      if (!SharedFolderManager.getInstance().exportSharedFolder(
          config.getSharedFolderSoftkey(), fExportedDataDir)) {
        // export failed, delete reference to shared folder in the course config
        log.info("exportToFilesystem: exporting course "+this+": export of shared folder failed.");
        config.setSharedFolderSoftkey(CourseConfig.VALUE_EMPTY_SHAREDFOLDER_SOFTKEY);
        CourseConfigManagerImpl.getInstance().saveConfigTo(this, config);
      }
      log.info("exportToFilesystem: exporting course "+this+": shared folder...done.");
    }
   
    //OLAT-5368: do intermediate commit to avoid transaction timeout
    // discussion intermediatecommit vs increased transaction timeout:
    //  pro intermediatecommit: not much
    //  pro increased transaction timeout: would fix OLAT-5368 but only move the problem
    //@TODO OLAT-2597: real solution is a long-running background-task concept...
    DBFactory.getInstance().intermediateCommit();

    // export glossary
    if (config.hasGlossary()) {
      log.info("exportToFilesystem: exporting course "+this+": glossary...");
      if (!GlossaryManager.getInstance().exportGlossary(
          config.getGlossarySoftKey(), fExportedDataDir)) {
        // export failed, delete reference to glossary in the course config
        log.info("exportToFilesystem: exporting course "+this+": export of glossary failed.");
        config.setGlossarySoftKey(null);
        CourseConfigManagerImpl.getInstance().saveConfigTo(this, config);
      }
      log.info("exportToFilesystem: exporting course "+this+": glossary...done.");
    }
   
View Full Code Here

      }
    }

    // add text marker wrapper controller to implement course glossary
    // textMarkerCtr must be created before the toolC!
    CourseConfig cc = uce.getCourseEnvironment().getCourseConfig();
    glossaryMarkerCtr = CourseGlossaryFactory.createGlossaryMarkupWrapper(ureq, wControl, contentP, cc);
 
    boolean hasGlossaryRights = hasCourseRight(CourseRights.RIGHT_GLOSSARY) || isCourseAdmin;
    glossaryToolCtr = new CourseGlossaryToolLinkController(getWindowControl(), ureq, course, getTranslator(), hasGlossaryRights,
        uce.getCourseEnvironment(), glossaryMarkerCtr);
View Full Code Here

  private ToolController initToolController(Identity identity, UserRequest ureq) {
    // guest never have a tool controller
    if (isGuest) return null;

    ToolController myTool = ToolFactory.createToolController(getWindowControl());
    CourseConfig cc = uce.getCourseEnvironment().getCourseConfig();

    // 1) administrative tools
    if (isCourseAdmin || isCourseCoach || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)
        || hasCourseRight(CourseRights.RIGHT_GROUPMANAGEMENT) || hasCourseRight(CourseRights.RIGHT_ARCHIVING)
        || hasCourseRight(CourseRights.RIGHT_ASSESSMENT)) {
      myTool.addHeader(translate("header.tools"));
      if (hasCourseRight(CourseRights.RIGHT_COURSEEDITOR) || isCourseAdmin) {
        myTool.addLink(COMMAND_EDIT, translate("command.openeditor"));
      }
      if (hasCourseRight(CourseRights.RIGHT_GROUPMANAGEMENT) || isCourseAdmin) {
        myTool.addLink("groupmngt", translate("command.opengroupmngt"));
      }
      if (isCourseAdmin) {
        myTool.addLink("rightmngt", translate("command.openrightmngt"));
      }
      if (hasCourseRight(CourseRights.RIGHT_ARCHIVING) || isCourseAdmin) {
        myTool.addLink("archiver", translate("command.openarchiver"));
      }
      if (hasCourseRight(CourseRights.RIGHT_ASSESSMENT) || isCourseCoach || isCourseAdmin) {
        myTool.addLink("assessment", translate("command.openassessment"));
      }
      /*
       * http://bugs.olat.org/jira/browse/OLAT-4928
       */
      if (hasCourseRight(CourseRights.RIGHT_STATISTICS) || isCourseAdmin) {
        myTool.addLink("statistic", translate("command.openstatistic"));
      }
     
      //
      /*
       * if (isCourseAdmin) { myTool.addLink(TOOLBOX_LINK_COURSECONFIG,
       * translate("command.courseconfig")); }
       */
      //
    }

    // 2) add coached groups
    if (ownedGroups.size() > 0) {
      myTool.addHeader(translate("header.tools.ownerGroups"));
      Iterator iter = ownedGroups.iterator();
      while (iter.hasNext()) {
        BusinessGroup group = (BusinessGroup) iter.next();
        myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName());
      }
    }

    // 3) add participating groups
    if (participatedGroups.size() > 0) {
      myTool.addHeader(translate("header.tools.participatedGroups"));
      Iterator iter = participatedGroups.iterator();
      while (iter.hasNext()) {
        BusinessGroup group = (BusinessGroup) iter.next();
        myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName());
      }
    }

    // 4) add right groups
    if (rightGroups.size() > 0) {
      myTool.addHeader(translate("header.tools.rightGroups"));
      Iterator iter = rightGroups.iterator();
      while (iter.hasNext()) {
        BusinessGroup group = (BusinessGroup) iter.next();
        myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName());
      }
    }

    // 5) add waiting-list groups
    if (waitingListGroups.size() > 0) {
      myTool.addHeader(translate("header.tools.waitingListGroups"));
      Iterator iter = waitingListGroups.iterator();
      while (iter.hasNext()) {
        BusinessGroup group = (BusinessGroup) iter.next();
        BusinessGroupManager businessGroupManager = BusinessGroupManagerImpl.getInstance();
        int pos = businessGroupManager.getPositionInWaitingListFor(identity, group);
        myTool.addLink(CMD_START_GROUP_PREFIX + group.getKey().toString(), group.getName() + "(" + pos + ")", group
            .getKey().toString(), null);
        myTool.setEnabled(group.getKey().toString(), false);
      }
    }

    // new toolbox 'general'
    myTool.addHeader(translate("header.tools.general"));
    if (cc.isCalendarEnabled()) {
      myTool.addPopUpLink(ACTION_CALENDAR, translate("command.calendar"), null, null, "950", "750", false);
    }
    if (cc.hasGlossary()) {
      myTool.addComponent(glossaryToolCtr.getInitialComponent());
    }
    if (showCourseConfigLink) {
      myTool.addLink(TOOLBOX_LINK_COURSECONFIG, translate("command.courseconfig"));
    }
    myTool.addPopUpLink("personalnote", translate("command.personalnote"), null, null, "750", "550", false);
    if (offerBookmark && !isGuest) {
      myTool.addLink(ACTION_BOOKMARK, translate("command.bookmark"), TOOL_BOOKMARK, null);
      BookmarkManager bm = BookmarkManager.getInstance();
      if (bm.isResourceableBookmarked(identity, courseRepositoryEntry)) myTool.setEnabled(TOOL_BOOKMARK, false);

    }
    if (cc.isEfficencyStatementEnabled() && course.hasAssessableNodes()) {
      // link to efficiency statements should
      // - not appear when not configured in course configuration
      // - not appear when configured in course configuration but no assessable
      // node exist
      // - appear but dimmed when configured, assessable node exist but no
      // assessment data exists for user
      // - appear as link when configured, assessable node exist and assessment
      // data exists for user
      myTool.addPopUpLink("efficiencystatement", translate("command.efficiencystatement"), "command.efficiencystatement", null,
          "750", "800", false);
      EfficiencyStatementManager esm = EfficiencyStatementManager.getInstance();
      EfficiencyStatement es = esm.getUserEfficiencyStatement(courseRepositoryEntry.getKey(), identity);
      if (es == null) {
        myTool.setEnabled("command.efficiencystatement", false);
      }
    }
   
    //add group chat to toolbox
    boolean instantMsgYes = InstantMessagingModule.isEnabled();
    boolean chatIsEnabled = CourseModule.isCourseChatEnabled() &&  cc.isChatEnabled();
    if (instantMsgYes && chatIsEnabled) {
      // we add the course chat link controller to the toolbox
      if (courseChatManagerCtr == null && ureq != null) createCourseGroupChatLink(ureq);
      if (courseChatManagerCtr != null){
        Controller groupChatController = courseChatManagerCtr.getGroupChatController(course);
View Full Code Here

      // 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 = (DTabs)Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
      RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(cc.getGlossarySoftKey(), false);
      DTab dt = dts.getDTab(repoEntry.getOlatResource());
      if (dt != null) {
        dts.activate(ureq, dt, ((Boolean)allowGlossaryEditing).toString());
      } else {
        ControllerCreator ctrlCreator = new ControllerCreator() {
View Full Code Here

        // event so that the course can take care of this rather than having it
        // here hardcoded
        OLATResourceImpl courseResource = ref.getSource();
        //ICourse course = CourseFactory.loadCourse(courseResource);
        ICourse course = CourseFactory.openCourseEditSession(courseResource.getResourceableId());
        CourseConfig cc = course.getCourseEnvironment().getCourseConfig();
        cc.setGlossarySoftKey(null);
        CourseFactory.setCourseConfig(course.getResourceableId(), cc);
        CourseFactory.closeCourseEditSession(course.getResourceableId(),true);
        // remove reference from the references table
        refM.delete(ref);
      }
View Full Code Here

  private void enableCustomCss(UserRequest ureq) {
    /*
     * add also the choosen courselayout css if any
     */
    final ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId());
    CourseConfig cc = course.getCourseEnvironment().getCourseConfig();
    if (cc.hasCustomCourseCSS()) {
      cssFileRef = cc.getCssLayoutRef();
      mapreg = MapperRegistry.getInstanceFor(ureq.getUserSession());
      if (cssUriMapper != null) {
        // deregister old mapper
        mapreg.deregister(cssUriMapper);
      }
View Full Code Here

   * @param repoEntryKey
   * @param checkForExistingProperty
   */
  private void updateUserEfficiencyStatement(final UserCourseEnvironment userCourseEnv, final Long repoEntryKey, ICourse course, final boolean checkForExistingProperty) {
    //  o_clusterOK: by ld
    CourseConfig cc = userCourseEnv.getCourseEnvironment().getCourseConfig();
    // write only when enabled for this course
    if (cc.isEfficencyStatementEnabled()) {
      final boolean logDebug = log.isDebug();
      final Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity();
      final PropertyManager pm = PropertyManager.getInstance();         
      final String courseRepoEntryKey = getPropertyName(repoEntryKey);         
       
View Full Code Here

      }
      if(courseConfigChanged && !initialCourseConfig.equals(changedCourseConfig) && DialogBoxUIFactory.isYesEvent(event)) {       
        //ICourse course = CourseFactory.loadCourse(repositoryEntry.getOlatResource());
        ICourse course = CourseFactory.openCourseEditSession(repositoryEntry.getOlatResource().getResourceableId());
        //change course config 
        CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
        courseConfig.setCalendarEnabled(changedCourseConfig.isCalendarEnabled());
        courseConfig.setChatIsEnabled(changedCourseConfig.isChatEnabled());
        courseConfig.setCssLayoutRef(changedCourseConfig.getCssLayoutRef());
        courseConfig.setEfficencyStatementIsEnabled(changedCourseConfig.isEfficencyStatementEnabled());
        courseConfig.setGlossarySoftKey(changedCourseConfig.getGlossarySoftKey());
        courseConfig.setSharedFolderSoftkey(changedCourseConfig.getSharedFolderSoftkey());
        CourseFactory.setCourseConfig(course.getResourceableId(), courseConfig);
        CourseFactory.closeCourseEditSession(course.getResourceableId(),true);
       
        //CourseChatSettingController
        if(ccc!=null) {
View Full Code Here

      continueButton = LinkFactory.createButton("import.redetails.continue", importSharedfolderVC, this);
      return;
    } else if (source == noopButton) {
      // delete reference
      CourseConfigManager ccm = CourseConfigManagerImpl.getInstance();
      CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
      courseConfig.setSharedFolderSoftkey(CourseConfig.VALUE_EMPTY_SHAREDFOLDER_SOFTKEY);
      ccm.saveConfigTo(course, courseConfig);
      fireEvent(ureq, Event.DONE_EVENT);
    } else if (source == cancelButton) {
      fireEvent(ureq, Event.CANCELLED_EVENT);
    } else if (source == continueButton){
View Full Code Here

TOP

Related Classes of org.olat.course.config.CourseConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.