<commit_before># Setting Accordion methods included in OpsController.rb
module OpsController::Settings
  extend ActiveSupport::Concern

  include_concern 'AnalysisProfiles'
  include_concern 'CapAndU'
  include_concern 'Common'
  include_concern 'Ldap'
  include_concern 'Schedules'
  include_concern 'Tags'
  include_concern 'Upload'
  include_concern 'Zones'
  include_concern 'RHN'

  # Apply the good records from an uploaded import file
  def apply_imports
    if session[:imports]
      begin
        session[:imports].apply
      rescue StandardError => bang
        msg = _("Error during 'apply': %{error}") % {:error => bang}
        err = true
      else
        msg = _("Records were successfully imported")
        err = false
        session[:imports] = @sb[:imports] = nil
      end
    else
      msg = _("Use the Browse button to locate CSV file")
      err = true
    end
    @sb[:show_button] = err
    redirect_to :action => 'explorer', :flash_msg => msg, :flash_error => err, :no_refresh => true
  end

  def forest_get_form_vars
    @edit = session[:edit]
    @ldap_info = {}
    @ldap_info[:mode] = params[:user_proxies][:mode] if params[:user_proxies] && params[:user_proxies][:mode]
    @ldap_info[:ldaphost] = params[:user_proxies][:ldaphost] if params[:user_proxies] && params[:user_proxies][:ldaphost]
    @ldap_info[:ldapport] = params[:user_proxies][:ldapport] if params[:user_proxies] && params[:user_proxies][:ldapport]
    @ldap_info[:basedn] = params[:user_proxies][:basedn] if params[:user_proxies] && params[:user_proxies][:basedn]
    @ldap_info[:bind_dn] = params[:user_proxies][:bind_dn] if params[:user_proxies] && params[:user_proxies][:bind_dn]
    @ldap_info[:bind_pwd] = params[:user_proxies][:bind_pwd] if params[:user_proxies] && params[:user_proxies][:bind_pwd]
    nil
  end

  def forest_form_field_changed
    @edit = session[:edit]  # Need to reload @edit so it stays in the session
    port = params[:user_proxies_mode] == "ldap" ? "389" : "636"
    render :update do |page|
      page << javascript_prologue
      page << "$('#user_proxies_ldapport').val('#{port}');"
    end<commit_msg>Fix displaying of the mode in Trusted Forest Settings<commit_after># Setting Accordion methods included in OpsController.rb
module OpsController::Settings
  extend ActiveSupport::Concern

  include_concern 'AnalysisProfiles'
  include_concern 'CapAndU'
  include_concern 'Common'
  include_concern 'Ldap'
  include_concern 'Schedules'
  include_concern 'Tags'
  include_concern 'Upload'
  include_concern 'Zones'
  include_concern 'RHN'

  # Apply the good records from an uploaded import file
  def apply_imports
    if session[:imports]
      begin
        session[:imports].apply
      rescue StandardError => bang
        msg = _("Error during 'apply': %{error}") % {:error => bang}
        err = true
      else
        msg = _("Records were successfully imported")
        err = false
        session[:imports] = @sb[:imports] = nil
      end
    else
      msg = _("Use the Browse button to locate CSV file")
      err = true
    end
    @sb[:show_button] = err
    redirect_to :action => 'explorer', :flash_msg => msg, :flash_error => err, :no_refresh => true
  end

  def forest_get_form_vars
    @edit = session[:edit]
    @ldap_info = {}
    @ldap_info[:mode] = params[:user_proxies_mode] if params[:user_proxies] && params[:user_proxies_mode]
    @ldap_info[:ldaphost] = params[:user_proxies][:ldaphost] if params[:user_proxies] && params[:user_proxies][:ldaphost]
    @ldap_info[:ldapport] = params[:user_proxies][:ldapport] if params[:user_proxies] && params[:user_proxies][:ldapport]
    @ldap_info[:basedn] = params[:user_proxies][:basedn] if params[:user_proxies] && params[:user_proxies][:basedn]
    @ldap_info[:bind_dn] = params[:user_proxies][:bind_dn] if params[:user_proxies] && params[:user_proxies][:bind_dn]
    @ldap_info[:bind_pwd] = params[:user_proxies][:bind_pwd] if params[:user_proxies] && params[:user_proxies][:bind_pwd]
    nil
  end

  def forest_form_field_changed
    @edit = session[:edit]  # Need to reload @edit so it stays in the session
    port = params[:user_proxies_mode] == "ldap" ? "389" : "636"
    render :update do |page|
      page << javascript_prologue
      page << "$('#user_proxies_ldapport').val('#{port}');"
    end
{'fraction_non_alphanumeric': 0.13027352804821513, 'fraction_numerical': 0.0027816411682892906, 'mean_word_length': 4.2686202686202686, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '357616', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1475, 'n_words': 323}