Package org.olat.core.configuration

Examples of org.olat.core.configuration.PersistedProperties


  private static void init() {
    if (initialized_) {
      return;
    }
   
    persistentProperties = new PersistedProperties(new RequestBasedListener());
   
    String ipsAndLevels = loadIpsAndLevels();

    if (ipsAndLevels!=null) {
      String[] ipsAndLevelArray = ipsAndLevels.split("\r\n");
View Full Code Here


  private static void init() {
    if (initialized_) {
      return;
    }
   
    persistentProperties = new PersistedProperties(new UserBasedListener());
   
    String usernameAndLevels = loadUsernameAndLevels();

    if (usernameAndLevels!=null) {
      String[] usernameAndLevelArray = usernameAndLevels.split("\r\n");
View Full Code Here

    if (event instanceof PersistedPropertiesChangedEvent) {
      // Reload the properties
      if (persistedProperties != null) {
        persistedProperties.destroy();
      }
      persistedProperties = new PersistedProperties(this);
      maxNumOfVersions = null;
    }
  }
View Full Code Here

   *
   * @return
   */
  private PersistedProperties getPersistedProperties() {
    if (persistedProperties == null) {
      persistedProperties = new PersistedProperties(this);
      String empty = persistedProperties.getStringPropertyValue(MAX_NUMBER_OF_VERSIONS, true);
      //remove the warning if there is nothing in the properties
      if(!StringHelper.containsNonWhitespace(empty)) {
        persistedProperties.setStringProperty(MAX_NUMBER_OF_VERSIONS, "", true);
      }
View Full Code Here

   */
  public void initService() {
    // Initialize the user configuration and the spring default configuration
    //
    // Set the default theme configured in the spring configuration
    userConfigurableProperties = new PersistedProperties(this);
    userConfigurableProperties.setStringPropertyDefault(KEY_GUI_THEME_IDENTIFYER, guiThemeIdentifyer);   
    // Override gui theme with value from properties configuration
    guiThemeIdentifyer = userConfigurableProperties.getStringPropertyValue(KEY_GUI_THEME_IDENTIFYER, false);
  }
View Full Code Here

   *      org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
   */
  @Override
  protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    SystemRegistrationManager sysRegMgr = SystemRegistrationManager.getInstance();
    PersistedProperties registrationConfig = sysRegMgr.getRegistrationConfiguration();
    //
    // Add statistics
    sendAnonymousStatisticSelection = uifactory.addCheckboxesVertical("registration.sendAnonymousStatisticSelection", null, formLayout,
        new String[] { YES }, new String[] { "" }, null, 1);
    sendAnonymousStatisticSelection.addActionListener(this, FormEvent.ONCLICK);
    boolean sendStats = registrationConfig.getBooleanPropertyValue(SystemRegistrationManager.CONF_KEY_SEND_STATISTICS);
    sendAnonymousStatisticSelection.select(YES, sendStats);
    this.flc.contextPut("isRegisteredStatistics", Boolean.valueOf(sendStats));
    //
    // Add website
    publishWebSiteSelection = uifactory.addCheckboxesVertical("registration.publishWebSiteSelection", null,  formLayout,
        new String[] { YES }, new String[] { "" }, null, 1);
    publishWebSiteSelection.addActionListener(this, FormEvent.ONCLICK);
    boolean publishWebsiteCofig = registrationConfig.getBooleanPropertyValue(SystemRegistrationManager.CONF_KEY_PUBLISH_WEBSITE);
    publishWebSiteSelection.select(YES, publishWebsiteCofig);
    this.flc.contextPut("isRegisteredWeb", Boolean.valueOf(publishWebsiteCofig));
    // Disable statistics as long as website is enabled
    if (publishWebsiteCofig) {
      sendAnonymousStatisticSelection.select(YES, true);
      sendAnonymousStatisticSelection.setEnabled(false);
    } else {
      sendAnonymousStatisticSelection.setEnabled(true);     
    }
    // Add website description
    String webSiteDesc = registrationConfig.getStringPropertyValue(SystemRegistrationManager.CONF_KEY_WEBSITE_DESCRIPTION, true);
    webSiteDescription = uifactory.addTextAreaElement("registration.webSiteDescription", 5, 60, webSiteDesc, formLayout);
    webSiteDescription.addActionListener(this, FormEvent.ONCHANGE);
    this.flc.contextPut("webSiteURL", Settings.getServerContextPathURI());
    RulesFactory.createHideRule(publishWebSiteSelection, null, webSiteDescription, formLayout);
    RulesFactory.createShowRule(publishWebSiteSelection, YES, webSiteDescription, formLayout);
    // Add location input
    String location = registrationConfig.getStringPropertyValue(SystemRegistrationManager.CONF_KEY_LOCATION, true);
    locationBox = uifactory.addTextElement("registration.location", "registration.location", -1, location, formLayout);
    locationBox.setExampleKey("registration.location.example", null);
    String locationCSV = registrationConfig.getStringPropertyValue(SystemRegistrationManager.CONF_KEY_LOCATION_COORDS, false);
    if(locationCSV != null){
      this.flc.contextPut("locationCoordinates", locationCSV);
    }
    //
    // Add announce list
    addToAnnounceListSelection = uifactory.addCheckboxesVertical("registration.addToAnnounceListSelection", null, formLayout,
        new String[] { YES }, new String[] { "" }, null, 1);
    addToAnnounceListSelection.addActionListener(this, FormEvent.ONCLICK);
    addToAnnounceListSelection.select(YES, registrationConfig.getBooleanPropertyValue(SystemRegistrationManager.CONF_KEY_NOTIFY_RELEASES));
    //
    // Add email field
    String emailValue = registrationConfig.getStringPropertyValue(SystemRegistrationManager.CONF_KEY_EMAIL, true);
    email = uifactory.addTextElement("registration.email", "registration.email", 60, emailValue, formLayout);
    email.addActionListener(this, FormEvent.ONCHANGE);
    RulesFactory.createHideRule(addToAnnounceListSelection, null, email, formLayout);
    RulesFactory.createShowRule(addToAnnounceListSelection, YES, email, formLayout);
    //
    // Add summary field
    String summaryText = sysRegMgr.getRegistrationPropertiesMessage(registrationConfig.createPropertiesFromPersistedProperties());
    summaryText = StringEscapeUtils.escapeHtml(summaryText).toString();
    summary = uifactory.addTextAreaElement("registration.summary", null, -1, 5, 60, true, summaryText, formLayout);
    summary.setEnabled(false);
    //
    // Add submit button
View Full Code Here

   */
  @Override
  protected void formOK(UserRequest ureq) {
    // Now collect valid data
    SystemRegistrationManager sysRegMgr = SystemRegistrationManager.getInstance();
    PersistedProperties registrationConfig = sysRegMgr.getRegistrationConfiguration();
    boolean sendStatsConfig = sendAnonymousStatisticSelection.isSelected(0);
    registrationConfig.setBooleanProperty(SystemRegistrationManager.CONF_KEY_SEND_STATISTICS, sendStatsConfig, false);
    this.flc.contextPut("isRegisteredStatistics", Boolean.valueOf(sendStatsConfig));
    boolean publishWebsiteCofig = publishWebSiteSelection.isSelected(0);
    this.flc.contextPut("isRegisteredWeb", Boolean.valueOf(publishWebsiteCofig));
    registrationConfig.setBooleanProperty(SystemRegistrationManager.CONF_KEY_PUBLISH_WEBSITE, publishWebsiteCofig, false);
    String webSiteDesc = webSiteDescription.getValue();
    registrationConfig.setStringProperty(SystemRegistrationManager.CONF_KEY_WEBSITE_DESCRIPTION, webSiteDesc, false);
    if (MailHelper.isValidEmailAddress(email.getValue()) && StringHelper.containsNonWhitespace(email.getValue())) {
      boolean notifyConfig = addToAnnounceListSelection.isSelected(0);
      registrationConfig.setBooleanProperty(SystemRegistrationManager.CONF_KEY_NOTIFY_RELEASES, notifyConfig, false);
      registrationConfig.setStringProperty(SystemRegistrationManager.CONF_KEY_EMAIL, email.getValue(), false);     
    } else {
      registrationConfig.setBooleanProperty(SystemRegistrationManager.CONF_KEY_NOTIFY_RELEASES, false, false);     
    }
   
    //
    // Extract location -> uses http request for geolocation resolving
    String location = locationBox.getValue();
   
    registrationConfig.setStringProperty(SystemRegistrationManager.CONF_KEY_LOCATION, location, false);
    String locationCSV = SystemRegistrationManager.getInstance().getLocationCoordinates(location);
    if(locationCSV != null){
        registrationConfig.setStringProperty(SystemRegistrationManager.CONF_KEY_LOCATION_COORDS, locationCSV, false);
        this.flc.contextPut("locationCoordinates", locationCSV);
    }
   
   
    // Save to disk
    registrationConfig.savePropertiesAndFireChangedEvent();
    // Update summary view
    String summaryText = sysRegMgr.getRegistrationPropertiesMessage(registrationConfig.createPropertiesFromPersistedProperties());
    summaryText = StringEscapeUtils.escapeHtml(summaryText).toString();
    summary.setValue(summaryText);
    // Submit to olat.org
    sysRegMgr.sendRegistrationData();
  }
View Full Code Here

      }
    }
    // Now collect temporary valid data
    Properties tmp = new Properties();
    SystemRegistrationManager sysRegMgr = SystemRegistrationManager.getInstance();
    PersistedProperties registrationConfig = sysRegMgr.getRegistrationConfiguration();
    tmp.setProperty(SystemRegistrationManager.CONF_KEY_IDENTIFYER, registrationConfig.getStringPropertyValue(SystemRegistrationManager.CONF_KEY_IDENTIFYER, true));
    boolean sendStatsConfig = sendAnonymousStatisticSelection.isSelected(0);
    tmp.setProperty(SystemRegistrationManager.CONF_KEY_SEND_STATISTICS, sendStatsConfig + "");
    boolean publishWebsiteCofig = publishWebSiteSelection.isSelected(0);
    tmp.setProperty(SystemRegistrationManager.CONF_KEY_PUBLISH_WEBSITE, publishWebsiteCofig + "");
    String webSiteDesc = webSiteDescription.getValue();
View Full Code Here

    // Remove existing properties first
    if (persitedProperties != null) {
      persitedProperties.destroy();
    }
    // Initialize configuration properties
    persitedProperties = new PersistedProperties(this);
    persitedProperties.setBooleanPropertyDefault(CONF_KEY_SEND_STATISTICS, true);
    persitedProperties.setBooleanPropertyDefault(CONF_KEY_PUBLISH_WEBSITE, false);
    persitedProperties.setStringPropertyDefault(CONF_KEY_WEBSITE_DESCRIPTION, "");
    persitedProperties.setBooleanPropertyDefault(CONF_KEY_NOTIFY_RELEASES, false);
    persitedProperties.setStringPropertyDefault(CONF_KEY_EMAIL, WebappHelper.getMailConfig("mailSupport"));
View Full Code Here

TOP

Related Classes of org.olat.core.configuration.PersistedProperties

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.