From 12c8f4c82770ded6ea6b519e4451ed6757419ddf Mon Sep 17 00:00:00 2001 From: Sascha Daniels Date: Mon, 31 Dec 2012 02:09:05 +0100 Subject: Remove unused ontroller --- app/controllers/config_siemens_sort_controller.rb | 371 ---------------------- 1 file changed, 371 deletions(-) delete mode 100644 app/controllers/config_siemens_sort_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/config_siemens_sort_controller.rb b/app/controllers/config_siemens_sort_controller.rb deleted file mode 100644 index c0739e5..0000000 --- a/app/controllers/config_siemens_sort_controller.rb +++ /dev/null @@ -1,371 +0,0 @@ -require 'nokogiri' -#doc.search('Message/ItemList').each do |a| puts a.children end -class ConfigSiemensController < ApplicationController -#TODO Authentication - # No access for admins though as this contains personal data. - - # We can't use load_and_authorize_resource() here because - # ConfigSiemensController isn't a resource. - # We can try client certificates - - skip_authorization_check - - - def index - os40_keys=7 - os60_keys=8 - os80_keys=9 - doc = Nokogiri::XML(request.body.read) - #logger.debug("#{params[:WorkpointMessage].to_xml}") - #logger.debug("#{params[:WorkpointMessage][:Message][:ItemList].to_xml}") - @phone_items=Hash.new - contact_reason = params[:WorkpointMessage][:Message][:ReasonForContact] - reply_status = doc.search('Message/ReasonForContact').first[:status] - reply_action = doc.search('Message/ReasonForContact').first[:action] - - doc.search('Message/ItemList/Item').each do |post_item| - @phone_items[post_item[:name]]=post_item.children.to_s - end - - mac_address = @phone_items['mac-addr'] - phone_type = @phone_items['device-type'] - if phone_type == "OpenStage 40" - max_keys = (os40_keys) * 2 - elsif phone_type == "OpenStage 60" - max_keys = (os60_keys) * 2 - elsif phone_type == "OpenStage 80" - max_keys = (os80_keys) * 2 - else - max_keys = 0 - end - - blf_keys_max = max_keys / 2 - shift_key_position = blf_keys_max - 1 - - #logger.debug(request.body.read) - @phone = Phone.find_by_mac_address(mac_address.gsub(':','').upcase) - if ! @phone.nil? - @phone.update_attributes(:ip_address => request.remote_ip) - sip_account = SipAccount.where(:sip_accountable_type == @phone.phoneable_type, - :sip_accountable_id == @phone.phoneable_id).first - end - - if ! @phone.nil? && ! sip_account.nil? - #logger.debug(@phone_items) - @my_nonce = params[:WorkpointMessage][:Message][:nonce] - @new_settings = Array.new - - @new_settings << ['dhcp', nil, 'true'] - @new_settings << ['hostname', nil, mac_address.gsub(':', '') ] - @new_settings << ['e164-hostname', nil, 'false'] - @new_settings << ['mobility-enabled', nil, 'false'] - @new_settings << ['mobility-password-on-logoff', nil, 'false'] - @new_settings << ['e164', nil, sip_account.try(:phone_numbers).first.number] - @new_settings << ['sip-user-id', nil, sip_account.auth_name] - @new_settings << ['reg-id', nil, sip_account.auth_name] - @new_settings << ['reg-number', nil, sip_account.auth_name] - @new_settings << ['fully-qualified-phone-no', nil, sip_account.auth_name] - @new_settings << ['sip-pwd', nil, sip_account.password] - @new_settings << ['sip-name', nil, sip_account.caller_name] - @new_settings << ['register-by-name', nil, 'false'] - #OPTIMIZE Display ID ? - @new_settings << ['display-id', nil, sip_account.try(:phone_numbers).first.number] - @new_settings << ['display-id-unicode', nil, sip_account.caller_name] - @new_settings << ['use-display-id', nil, 'true'] - @new_settings << ['reg-addr', nil, sip_account.sip_domain.host] - @new_settings << ['reg-port', nil, '5060'] - @new_settings << ['registrar-addr', nil, sip_account.sip_domain.host] - @new_settings << ['registrar-port', nil, '5060'] - @new_settings << ['outbound-proxy', nil, sip_account.sip_domain.host] - @new_settings << ['outbound-proxy-user', nil, sip_account.sip_domain.host] - @new_settings << ['sgnl-gateway-addr', nil, sip_account.sip_domain.host] - @new_settings << ['sgnl-gateway-addr-user', nil, sip_account.sip_domain.host] - @new_settings << ['sgnl-gateway-port', nil, '5060' ] - @new_settings << ['sgnl-gateway-port-user', nil, '5060'] - @new_settings << ['sgnl-route', nil, '0' ] - @new_settings << ['mwi-e164', nil, '' ] - @new_settings << ['rtp-base-port', nil, '5004'] - @new_settings << ['default-domain', nil, '' ] - @new_settings << ['sip-transport', nil, '0' ] - @new_settings << ['sip-transport-user', nil, '0' ] - @new_settings << ['server-type', nil, '0' ] - @new_settings << ['session-timer', nil, 'true'] - @new_settings << ['session-duration', nil, '3600' ] - @new_settings << ['reg-ttl', nil, '3600' ] - @new_settings << ['realm', nil, sip_account.sip_domain.realm] - @new_settings << ['emergency-e164', nil, '0110' ] - @new_settings << ['voice-mail-e164', nil, 'voicemail'] - @new_settings << ['auto-answer', nil, 'false'] - @new_settings << ['beep-on-auto-answer', nil, 'true'] - @new_settings << ['auto-reconnect', nil, 'false' ] - @new_settings << ['beep-on-auto-reconnect', nil, 'true'] - @new_settings << ['permit-decline-call', nil, 'true'] - @new_settings << ['transfer-on-ring', nil, 'false' ] - @new_settings << ['join-allowed-in-conference', nil, 'true'] - @new_settings << ['pickup-group-uri', nil, '*8*'] - @new_settings << ['pickup-group-uri', nil, '' ] - @new_settings << ['hot-line-warm-line-digits', nil, '' ] - @new_settings << ['initial-digit-timer', nil, '30' ] - @new_settings << ['conference-factory-uri', nil, ''] - @new_settings << ['callback-busy-allow', nil, 'false'] - @new_settings << ['callback-busy-code', nil, '' ] - @new_settings << ['callback-ring-allow', nil, 'false'] - @new_settings << ['callback-ring-code', nil, ''] - @new_settings << ['callback-cancel-code', nil, ''] - @new_settings << ['park-server', nil, ''] - #OPTIMIZE Callwaiting - @new_settings << ['call-waiting-enabled', nil, 'true'] - @new_settings << ['qos-layer2', nil, 'true'] - @new_settings << ['l2qos-voice', nil, '5' ] - @new_settings << ['l2qos-signalling', nil, '3' ] - @new_settings << ['l2qos-default', nil, '0'] - @new_settings << ['qos-layer3', nil, 'true'] - @new_settings << ['l3qos-voice', nil, '46'] - @new_settings << ['l3qos-signalling', nil, '26'] - @new_settings << ['vlan-method', nil, '1'] - #OPTIMIZE Timezone - @new_settings << ['sntp-tz-offset', nil, ''] - @new_settings << ['daylight-save', nil, ''] - @new_settings << ['daylight-save-minutes', nil, ''] - #OPTIMIZE Use SNMP? - @new_settings << ['snmp-trap-addr', nil, ''] - @new_settings << ['snmp-trap-port', nil, ''] - @new_settings << ['snmp-trap-pwd', nil, 'snmp' ] - @new_settings << ['snmp-traps-active', nil, 'false' ] - @new_settings << ['diagnostic-trap-addr', nil, ''] - @new_settings << ['diagnostic-trap-port', nil, ''] - @new_settings << ['diagnostic-trap-pwd', nil, 'snmp' ] - @new_settings << ['diagnostic-traps-active', nil, 'false' ] - @new_settings << ['diagnostic-snmp-active', nil, 'false'] - @new_settings << ['qdc-collection-unit-addr', nil, ''] - @new_settings << ['qdc-collection-unit-port', nil, '12010'] - - @new_settings << ['qdc-trap-pwd', nil, 'QOSDC'] - @new_settings << ['qdc-snmp-active', nil, 'false'] - @new_settings << ['qdc-qcu-active', nil, 'false'] - @new_settings << ['snmp-queries-allowed', nil, 'false'] - @new_settings << ['snmp-pwd', nil, ''] - @new_settings << ['disable-microphone', nil, 'false'] - @new_settings << ['loudspeech-enabled', nil, 'true'] - @new_settings << ['audio-silence-suppression', nil, 'false'] - - @new_settings << ['port1', nil, '0' ] # 0=Automatic (speed) - @new_settings << ['port2', nil, '0' ] - @new_settings << ['port2-mode', nil, '1' ] - @new_settings << ['port2-auto-mdix-enabled', nil, 'true' ] - @new_settings << ['originating-line-preference', nil, '0'] - @new_settings << ['terminating-line-preference', nil, '0'] - @new_settings << ['line-key-operating-mode', nil, '0'] - @new_settings << ['line-rollover-type', nil, '2'] - @new_settings << ['line-rollover-volume', nil, '5' ]# 1-5 - @new_settings << ['line-registration-leds', nil, 'true'] - @new_settings << ['keyset-use-focus', nil, 'true' ] - @new_settings << ['keyset-remote-forward-ind', nil, 'true'] - @new_settings << ['keyset-reservation-timer', nil, '60' ] # 0-300 - @new_settings << ['dial-plan-enabled', nil, '' ] - @new_settings << ['Canonical-dialing-international-prefix', nil, ''] - @new_settings << ['Canonical-dialing-local-country-code', nil, ''] - @new_settings << ['Canonical-dialing-national-prefix', nil, ''] - @new_settings << ['Canonical-dialing-local-area-code', nil, ''] - @new_settings << ['Canonical-dialing-local-node', nil, ''] - @new_settings << ['Canonical-dialing-external-access', nil, '0'] - @new_settings << ['Canonical-dialing-operator-code', nil, ''] - @new_settings << ['Canonical-dialing-emergency-number', nil, ''] - @new_settings << ['Canonical-dialing-dial-needs-access-code', nil, '0'] - @new_settings << ['Canonical-dialing-dial-needs-intGWcode', nil, '0'] - @new_settings << ['Canonical-dialing-min-local-number-length', nil, '10'] - @new_settings << ['Canonical-dialing-extension-initial-digits', nil, ''] - @new_settings << ['Canonical-dialing-dial-internal-form', nil, '0' ] - @new_settings << ['Canonical-dialing-dial-external-form', nil, '0' ] - @new_settings << ['Canonical-lookup-local-code', nil, '' ] - @new_settings << ['Canonical-lookup-international-code', nil, ''] - @new_settings << ['hot-keypad-dialing', nil, ''] - @new_settings << ['ldap-transport', nil, '0'] - @new_settings << ['ldap-server-address', nil, '' ] - @new_settings << ['ldap-server-port', nil, '389' ] - @new_settings << ['ldap-authentication', nil, '1'] - @new_settings << ['ldap-user', nil, '' ] - @new_settings << ['ldap-pwd', nil, '' ] - @new_settings << ['ldap-max-responses', nil, '25'] - @new_settings << ['backup-addr', nil, ''] - @new_settings << ['backup-registration', nil, 'false'] - @new_settings << ['qdc-qcu-active', nil, 'false' ] - @new_settings << ['min-admin-passw-length', nil, '6' ] - @new_settings << ['default-locked-config-menus', nil, 'true' ] - @new_settings << ['locked-config-menus', nil, 'true' ] - @new_settings << ['default-locked-local-function-menus', nil, 'true' ] - @new_settings << ['locked-local-function-menus', nil, 'true' ] - @new_settings << ['dls-mode-secure', nil, '0' ] - @new_settings << ['dls-chunk-size', nil, '9492'] - @new_settings << ['default-passw-policy', nil, 'false'] - @new_settings << ['deflect-destination', nil, ''] - @new_settings << ['display-skin', nil, ''] - @new_settings << ['enable-bluetooth-interface', nil, 'true'] - @new_settings << ['usb-access-enabled', nil, 'false' ] - @new_settings << ['usb-backup-enabled', nil, 'false' ] - @new_settings << ['line-button-mode', nil, '0' ] - @new_settings << ['lock-forwarding', nil, '' ] - @new_settings << ['loudspeaker-function-mode', nil, '0' ] - @new_settings << ['max-pin-retries', nil, '' ] - @new_settings << ['inactivity-timeout', nil, '30' ] - @new_settings << ['not-used-timeout', nil, '2' ] - @new_settings << ['passw-char-set', nil, '0' ] - @new_settings << ['refuse-call', nil, 'true' ] - @new_settings << ['restart-password', nil, ''] - #OPTIMIZE clock format - @new_settings << ['time-format', nil, '0' ]# 1=12 h - @new_settings << ['uaCSTA-enabled', nil, 'false' ] - @new_settings << ['enable-test-interface', nil, 'false'] - @new_settings << ['enable-WBM', nil, 'true'] - @new_settings << ['pixelsaver-timeout', nil, '2' ]# 2 hours? - @new_settings << ['voice-message-dial-tone', nil, '' ] - @new_settings << ['call-pickup-allowed', nil, 'true' ] - @new_settings << ['group-pickup-tone-allowed', nil, 'true'] - @new_settings << ['group-pickup-as-ringer', nil, 'false'] - @new_settings << ['group-pickup-alert-type', nil, '0' ] - @new_settings << ['default-profile', nil, '' ] - @new_settings << ['count-medium-priority', nil, '5'] - @new_settings << ['timer-medium-priority', nil, '60'] # 1 - 999 - @new_settings << ['timer-high-priority', nil, '5'] # 0 - 999 - @new_settings << ['dss-sip-detect-timer', nil, '10'] - @new_settings << ['dss-sip-deflect', nil, 'false' ] - @new_settings << ['dss-sip-refuse', nil, 'false' ] - @new_settings << ['feature-availability', nil, 'false'] - @new_settings << ['feature-availability', nil, 'true' ] - @new_settings << ['feature-availability', nil, 'true' ] - @new_settings << ['local-control-feature-availability', nil, 'false' ] - @new_settings << ['trace-level', nil, '0' ] # Off - @new_settings << ['default-locked-function-keys', nil, 'true' ]# "unknown item" - #OPTIMIZE Put pickup prefix into database/global constant? - @new_settings << ['blf-code', nil, 'f_ia_'] # pickup prefix for softkey function 59 (BLF) - @new_settings << ['stimulus-feature-code', nil, true] - @new_settings << ['stimulus-led-control-uri', nil, true] - - - @new_settings << ['min-user-passw-length', nil, '6' ]# 6 - 24 - #OPTIMIZE language - @new_settings << ['country-iso', nil, 'DE' ] - @new_settings << ['language-iso', nil, 'de'] - @new_settings << ['date-format', nil, '0' ] # DD.MM.YYYY - #OPTIMIZE ringtones - @new_settings << ['ringer-melody', nil, '1'] - - @new_settings << ['ringer-melody', nil, '2'] - @new_settings << ['ringer-tone-sequence', nil, '2'] - - soft_keys = Array.new - # Getting BLF keys only for the first level - blf_keys = sip_account.softkeys.find( - :all, - :conditions => {:function => ['blf', 'conference']}, - :limit => blf_keys_max) - #Getting other keys - non_blf_keys = sip_account.softkeys.find( - :all, - :conditions => {:function => ['speed_dial']}) - - # Fill softkey array with BLF keys up to shift key - blf_keys.each do |k| - soft_keys << k - end - # Fill sofkey with other keys up to end - non_blf_keys.each do |k| - if soft_keys.length < max_keys - soft_keys << k - end - end - # Delete unset softkeys - while soft_keys.length < max_keys - soft_keys << Softkey.new - end - - key_pos=1 - - #soft_keys.each do |sk| - - while key_pos < shift_key_position - - (1..shift_key_position-1).each do |key_idx| - sk = soft_keys.shift - logger.debug(sk.function, key_idx) - if sk.function == "blf" - @new_settings << ['function-key-def', key_idx, '59'] - @new_settings << ['select-dial', key_idx, sk.number ] - elsif sk.function == "log_out" - @new_settings << ['function-key-def', key_idx, '1'] - @new_settings << ['select-dial', key_idx, 'f_lo' ] - elsif sk.function == "log_in" - @new_settings << ['function-key-def', key_idx, '1'] - @new_settings << ['select-dial', key_idx, "f_li_#{sk.number}" ] - elsif sk.function == "dtmf" - @new_settings << ['function-key-def', key_idx, '54'] - @new_settings << ['stimulus-DTMF-sequence', key_idx, sk.number ] - elsif sk.function.nil? - @new_settings << ['function-key-def', key_idx, '0'] - else - @new_settings << ['function-key-def', key_idx, '1'] - @new_settings << ['select-dial', key_idx, sk.number ] - end - @new_settings << ['key-label', key_idx, sk.label ] - @new_settings << ['key-label-unicode', key_idx, sk.label ] - key_pos = key_pos+1 - - end - end - if key_pos == shift_key_position - @new_settings << ['function-key-def', shift_key_position, '18'] - @new_settings << ['key-label', shift_key_position, 'Shift'] - @new_settings << ['key-label-unicode', shift_key_position, 'Shift'] - key_pos = key_pos+1 - end - - (1001..1000+shift_key_position-1).each do |key_idx| - sk = soft_keys.shift - if sk.function == "log_out" - @new_settings << ['function-key-def', key_idx, '1'] - @new_settings << ['select-dial', key_idx, 'f_lo' ] - elsif sk.function == "log_in" - @new_settings << ['function-key-def', key_idx, '1'] - @new_settings << ['select-dial', key_idx, "f_li_#{sk.number}" ] - elsif sk.function == "dtmf" - @new_settings << ['function-key-def', key_idx, '54'] - @new_settings << ['stimulus-DTMF-sequence', key_idx, sk.number ] - elsif sk.function.nil? - @new_settings << ['function-key-def', key_idx, '0'] - else - @new_settings << ['function-key-def', key_idx, '1'] - @new_settings << ['select-dial', key_idx, sk.number ] - end - @new_settings << ['key-label', key_idx, sk.label ] - @new_settings << ['key-label-unicode', key_idx, sk.label ] - key_pos = key_pos+1 - - end - - #end - logger.debug(@new_settings) - end - - if @phone.nil? || sip_account.nil? - respond_to { |format| - format.xml { render :action => "clean-up" } - } - - elsif (reply_status == 'accepted' && contact_reason == 'reply-to' && reply_action == 'ReadAllItems') - respond_to { |format| - format.xml { render :action => "write" } - } - - elsif ["reply-to"].include? contact_reason - respond_to { |format| - format.xml { render :action => "clean-up" } - } - - else - respond_to { |format| - format.xml { render :action => "index" } - } - end - - end -end -- cgit v1.2.3 From a3bf87ed7d6d693c28d081c2e7e8d8e55373cae4 Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 31 Dec 2012 09:31:43 +0100 Subject: show hot deskable option for user sip accounts only --- app/controllers/sip_accounts_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb index 1f3166e..8292a74 100644 --- a/app/controllers/sip_accounts_controller.rb +++ b/app/controllers/sip_accounts_controller.rb @@ -20,7 +20,9 @@ class SipAccountsController < ApplicationController @sip_account.clip = DEFAULT_CLIP_SETTING @sip_account.voicemail_pin = random_pin @sip_account.callforward_rules_act_per_sip_account = CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT - @sip_account.hotdeskable = true + if @parent.class == User + @sip_account.hotdeskable = true + end # Make sure that we don't use an already taken auth_name # -- cgit v1.2.3 From e29f14a7742e7fd049a7a09a6d1fa046c2741d67 Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 31 Dec 2012 09:32:41 +0100 Subject: fixed fallback_sip_accounts query --- app/controllers/phones_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 2698465..14735e6 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -78,11 +78,11 @@ class PhonesController < ApplicationController end def set_fallback_sip_accounts - used_sip_account_ids = Phone.where(:fallback_sip_account_id => SipAccount.pluck(:id)).pluck(:fallback_sip_account_id) - @fallback_sip_accounts = SipAccount.where(:sip_accountable_type => 'Tenant').where(:hotdeskable => true) - SipAccount.where(:id => used_sip_account_ids) - if @phone && !@phone.fallback_sip_account_id.blank? && SipAccount.exists?(@phone.fallback_sip_account_id) - @fallback_sip_accounts << SipAccount.where(:id => @phone.fallback_sip_account_id).first + used_sip_account_ids = Phone.pluck(:fallback_sip_account_id) + PhoneSipAccount.pluck(:sip_account_id) + if @phone + used_sip_account_ids = used_sip_account_ids - [ @phone.fallback_sip_account_id ] end + @fallback_sip_accounts = SipAccount.where(:sip_accountable_type => 'Tenant') - SipAccount.where(:id => used_sip_account_ids) end end -- cgit v1.2.3 From 7171f3ecfb8af4f9fcc30bcd168159d05ec4ae7f Mon Sep 17 00:00:00 2001 From: spag Date: Fri, 4 Jan 2013 10:23:47 +0100 Subject: snom idle icon settings --- app/controllers/config_snom_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb index 7542415..9a06a99 100644 --- a/app/controllers/config_snom_controller.rb +++ b/app/controllers/config_snom_controller.rb @@ -503,6 +503,11 @@ class ConfigSnomController < ApplicationController :idle_down => "keyevent F_NEXT_ID", :idle_left => "url #{xml_applications_url}/call_history.xml?type=received", :idle_right => "url #{xml_applications_url}/call_history.xml?type=missed", + :touch_idle_adr_book => "url #{xml_applications_url}/phone_book.xml", + :touch_idle_list_missed => "url #{xml_applications_url}/call_history.xml?type=missed", + :touch_idle_list_taken => "url #{xml_applications_url}/call_history.xml?type=received", + :touch_idle_redial => "url #{xml_applications_url}/call_history.xml?type=dialed", + :touch_idle_dialog => "url #{xml_applications_url}/call_history.xml", } # Remap conference key to first conference if found -- cgit v1.2.3 From 01f2ab4e3d5694de81f6ebb594e0e852616ebbd9 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 5 Jan 2013 12:42:53 +0100 Subject: Added GsParameter model as a replacement for gemeinschaft_parameters.rb --- app/controllers/gs_parameters_controller.rb | 83 +++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 app/controllers/gs_parameters_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb new file mode 100644 index 0000000..d6a92c6 --- /dev/null +++ b/app/controllers/gs_parameters_controller.rb @@ -0,0 +1,83 @@ +class GsParametersController < ApplicationController + # GET /gs_parameters + # GET /gs_parameters.json + def index + @gs_parameters = GsParameter.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @gs_parameters } + end + end + + # GET /gs_parameters/1 + # GET /gs_parameters/1.json + def show + @gs_parameter = GsParameter.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @gs_parameter } + end + end + + # GET /gs_parameters/new + # GET /gs_parameters/new.json + def new + @gs_parameter = GsParameter.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @gs_parameter } + end + end + + # GET /gs_parameters/1/edit + def edit + @gs_parameter = GsParameter.find(params[:id]) + end + + # POST /gs_parameters + # POST /gs_parameters.json + def create + @gs_parameter = GsParameter.new(params[:gs_parameter]) + + respond_to do |format| + if @gs_parameter.save + format.html { redirect_to @gs_parameter, notice: 'Gs parameter was successfully created.' } + format.json { render json: @gs_parameter, status: :created, location: @gs_parameter } + else + format.html { render action: "new" } + format.json { render json: @gs_parameter.errors, status: :unprocessable_entity } + end + end + end + + # PUT /gs_parameters/1 + # PUT /gs_parameters/1.json + def update + @gs_parameter = GsParameter.find(params[:id]) + + respond_to do |format| + if @gs_parameter.update_attributes(params[:gs_parameter]) + format.html { redirect_to @gs_parameter, notice: 'Gs parameter was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @gs_parameter.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /gs_parameters/1 + # DELETE /gs_parameters/1.json + def destroy + @gs_parameter = GsParameter.find(params[:id]) + @gs_parameter.destroy + + respond_to do |format| + format.html { redirect_to gs_parameters_url } + format.json { head :no_content } + end + end +end -- cgit v1.2.3 From e76890d5f4634d47514a592d501d9792ae2ff7bb Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 5 Jan 2013 21:00:52 +0100 Subject: Different scaffold for GsParameter. --- app/controllers/gs_parameters_controller.rb | 66 ++++++----------------------- 1 file changed, 12 insertions(+), 54 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index d6a92c6..be3378e 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -1,83 +1,41 @@ class GsParametersController < ApplicationController - # GET /gs_parameters - # GET /gs_parameters.json def index @gs_parameters = GsParameter.all - - respond_to do |format| - format.html # index.html.erb - format.json { render json: @gs_parameters } - end end - # GET /gs_parameters/1 - # GET /gs_parameters/1.json def show @gs_parameter = GsParameter.find(params[:id]) - - respond_to do |format| - format.html # show.html.erb - format.json { render json: @gs_parameter } - end end - # GET /gs_parameters/new - # GET /gs_parameters/new.json def new @gs_parameter = GsParameter.new + end - respond_to do |format| - format.html # new.html.erb - format.json { render json: @gs_parameter } + def create + @gs_parameter = GsParameter.new(params[:gs_parameter]) + if @gs_parameter.save + redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_created') + else + render :new end end - # GET /gs_parameters/1/edit def edit @gs_parameter = GsParameter.find(params[:id]) end - # POST /gs_parameters - # POST /gs_parameters.json - def create - @gs_parameter = GsParameter.new(params[:gs_parameter]) - - respond_to do |format| - if @gs_parameter.save - format.html { redirect_to @gs_parameter, notice: 'Gs parameter was successfully created.' } - format.json { render json: @gs_parameter, status: :created, location: @gs_parameter } - else - format.html { render action: "new" } - format.json { render json: @gs_parameter.errors, status: :unprocessable_entity } - end - end - end - - # PUT /gs_parameters/1 - # PUT /gs_parameters/1.json def update @gs_parameter = GsParameter.find(params[:id]) - - respond_to do |format| - if @gs_parameter.update_attributes(params[:gs_parameter]) - format.html { redirect_to @gs_parameter, notice: 'Gs parameter was successfully updated.' } - format.json { head :no_content } - else - format.html { render action: "edit" } - format.json { render json: @gs_parameter.errors, status: :unprocessable_entity } - end + if @gs_parameter.update_attributes(params[:gs_parameter]) + redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_updated') + else + render :edit end end - # DELETE /gs_parameters/1 - # DELETE /gs_parameters/1.json def destroy @gs_parameter = GsParameter.find(params[:id]) @gs_parameter.destroy - - respond_to do |format| - format.html { redirect_to gs_parameters_url } - format.json { head :no_content } - end + redirect_to gs_parameters_url, :notice => t('gs_parameters.controller.successfuly_destroyed') end end -- cgit v1.2.3 From ddb3dfa92ec0878240211cb2b7a8e125961b1360 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 5 Jan 2013 23:01:16 +0100 Subject: Moved to GsParemeter.get and set defaults for a couple of validations. --- app/controllers/api/rows_controller.rb | 2 +- app/controllers/application_controller.rb | 4 ++-- app/controllers/call_forwards_controller.rb | 4 ++-- app/controllers/call_histories_controller.rb | 2 +- app/controllers/conferences_controller.rb | 2 +- app/controllers/config_siemens_controller.rb | 26 +++++++++++------------ app/controllers/config_snom_controller.rb | 22 +++++++++---------- app/controllers/fax_accounts_controller.rb | 4 ++-- app/controllers/gemeinschaft_setups_controller.rb | 2 +- app/controllers/gs_nodes_controller.rb | 2 +- app/controllers/phone_book_entries_controller.rb | 2 +- app/controllers/phone_books_controller.rb | 4 ++-- app/controllers/sessions_controller.rb | 2 +- app/controllers/sip_accounts_controller.rb | 16 +++++++------- app/controllers/voicemail_messages_controller.rb | 6 +++--- 15 files changed, 50 insertions(+), 50 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/api/rows_controller.rb b/app/controllers/api/rows_controller.rb index 6e815eb..543aebe 100644 --- a/app/controllers/api/rows_controller.rb +++ b/app/controllers/api/rows_controller.rb @@ -84,7 +84,7 @@ class Api::RowsController < ApplicationController private def check_remote_ip_address_whitelist - if !(REMOTE_IP_ADDRESS_WHITELIST.empty? or REMOTE_IP_ADDRESS_WHITELIST.include?(ENV['REMOTE_ADDR'])) + if !(GsParameter.get('REMOTE_IP_ADDRESS_WHITELIST').empty? or GsParameter.get('REMOTE_IP_ADDRESS_WHITELIST').include?(ENV['REMOTE_ADDR'])) redirect_to root_url end end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c675f5c..e4165f3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -54,8 +54,8 @@ class ApplicationController < ActionController::Base # Generate a new random PIN # def random_pin - if MINIMUM_PIN_LENGTH > 0 - (1..MINIMUM_PIN_LENGTH).map{|i| (0 .. 9).to_a.sample}.join + if GsParameter.get('MINIMUM_PIN_LENGTH') > 0 + (1..GsParameter.get('MINIMUM_PIN_LENGTH')).map{|i| (0 .. 9).to_a.sample}.join end end diff --git a/app/controllers/call_forwards_controller.rb b/app/controllers/call_forwards_controller.rb index 5321b35..001ed60 100644 --- a/app/controllers/call_forwards_controller.rb +++ b/app/controllers/call_forwards_controller.rb @@ -21,10 +21,10 @@ class CallForwardsController < ApplicationController def new @call_forward = @phone_number.call_forwards.build - @call_forward.depth = DEFAULT_CALL_FORWARD_DEPTH + @call_forward.depth = GsParameter.get('DEFAULT_CALL_FORWARD_DEPTH') @call_forward.active = true @call_forwarding_destinations = call_forwarding_destination_types() - @call_forward.destination = CALLFORWARD_DESTINATION_DEFAULT.to_s if defined?(CALLFORWARD_DESTINATION_DEFAULT) + @call_forward.destination = GsParameter.get('CALLFORWARD_DESTINATION_DEFAULT').to_s if defined?(GsParameter.get('CALLFORWARD_DESTINATION_DEFAULT')) @available_call_forward_cases = [] CallForwardCase.all.each do |available_call_forward_case| diff --git a/app/controllers/call_histories_controller.rb b/app/controllers/call_histories_controller.rb index f956f88..f711f34 100644 --- a/app/controllers/call_histories_controller.rb +++ b/app/controllers/call_histories_controller.rb @@ -22,7 +22,7 @@ class CallHistoriesController < ApplicationController @call_histories = calls.paginate( :page => @pagination_page_number, - :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE + :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE') ) @calls_count = calls.count diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 302a23b..6091b46 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -19,7 +19,7 @@ class ConferencesController < ApplicationController @conference.start = nil @conference.end = nil @conference.open_for_anybody = true - @conference.max_members = DEFAULT_MAX_CONFERENCE_MEMBERS + @conference.max_members = GsParameter.get('DEFAULT_MAX_CONFERENCE_MEMBERS') @conference.pin = random_pin @conference.open_for_anybody = true diff --git a/app/controllers/config_siemens_controller.rb b/app/controllers/config_siemens_controller.rb index c09dfcf..b7fa107 100644 --- a/app/controllers/config_siemens_controller.rb +++ b/app/controllers/config_siemens_controller.rb @@ -64,8 +64,8 @@ class ConfigSiemensController < ApplicationController if mac_address @phone = Phone.find_by_mac_address(mac_address.gsub(':','').upcase) - if ! @phone && PROVISIONING_AUTO_ADD_PHONE - tenant = Tenant.where(:id => PROVISIONING_AUTO_TENANT_ID).first + if ! @phone && GsParameter.get('PROVISIONING_AUTO_ADD_PHONE') + tenant = Tenant.where(:id => GsParameter.get('PROVISIONING_AUTO_TENANT_ID')).first if ! tenant render( :status => 404, @@ -91,12 +91,12 @@ class ConfigSiemensController < ApplicationController return end - if ! PROVISIONING_AUTO_ADD_SIP_ACCOUNT + if ! GsParameter.get('PROVISIONING_AUTO_ADD_SIP_ACCOUNT') return end caller_name_index = 0 - sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}%").sort { |item1, item2| + sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}%").sort { |item1, item2| item1.caller_name.gsub(/[^0-9]/, '').to_i <=> item2.caller_name.gsub(/[^0-9]/, '').to_i }.last @@ -106,18 +106,18 @@ class ConfigSiemensController < ApplicationController caller_name_index = caller_name_index + 1 @sip_account = tenant.sip_accounts.build - @sip_account.caller_name = "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}#{caller_name_index}" - @sip_account.call_waiting = CALL_WAITING - @sip_account.clir = DEFAULT_CLIR_SETTING - @sip_account.clip = DEFAULT_CLIP_SETTING + @sip_account.caller_name = "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}#{caller_name_index}" + @sip_account.call_waiting = GsParameter.get('CALL_WAITING') + @sip_account.clir = GsParameter.get('DEFAULT_CLIR_SETTING') + @sip_account.clip = GsParameter.get('DEFAULT_CLIP_SETTING') @sip_account.voicemail_pin = random_pin - @sip_account.callforward_rules_act_per_sip_account = CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT + @sip_account.callforward_rules_act_per_sip_account = GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT') @sip_account.hotdeskable = false loop do - @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME) + @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME')) break unless SipAccount.exists?(:auth_name => @sip_account.auth_name) end - @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD) + @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD')) if ! @sip_account.save render( @@ -439,7 +439,7 @@ class ConfigSiemensController < ApplicationController @new_settings << ['XML-app-debug-prog-name', 2, ''] @new_settings << ['XML-app-num-tabs', 2, '3'] @new_settings << ['XML-app-restart', 2, 'true'] - @new_settings << ['XML-app-tab1-display-name', 2, "Gemeinschaft #{GEMEINSCHAFT_VERSION}"] + @new_settings << ['XML-app-tab1-display-name', 2, "Gemeinschaft #{GsParameter.get('GEMEINSCHAFT_VERSION')}"] @new_settings << ['XML-app-tab1-name', 2, 'menu'] @new_settings << ['XML-app-tab2-display-name', 2, 'Status'] @new_settings << ['XML-app-tab2-name', 2, 'menu_status'] @@ -816,7 +816,7 @@ class ConfigSiemensController < ApplicationController auto_reload_time = 60 - SIEMENS_HISTORY_RELOAD_TIMES.each_pair do |time_range, reload_value| + GsParameter.get('SIEMENS_HISTORY_RELOAD_TIMES').each_pair do |time_range, reload_value| if time_range === Time.now.localtime.hour auto_reload_time = reload_value end diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb index 9a06a99..123f2cd 100644 --- a/app/controllers/config_snom_controller.rb +++ b/app/controllers/config_snom_controller.rb @@ -34,8 +34,8 @@ class ConfigSnomController < ApplicationController @phone = Phone.where({ :mac_address => @mac_address }).first end - if ! @phone && PROVISIONING_AUTO_ADD_PHONE - tenant = Tenant.where(:id => PROVISIONING_AUTO_TENANT_ID).first + if ! @phone && GsParameter.get('PROVISIONING_AUTO_ADD_PHONE') + tenant = Tenant.where(:id => GsParameter.get('PROVISIONING_AUTO_TENANT_ID')).first if ! tenant render( :status => 404, @@ -94,12 +94,12 @@ class ConfigSnomController < ApplicationController return end - if ! PROVISIONING_AUTO_ADD_SIP_ACCOUNT + if ! GsParameter.get('PROVISIONING_AUTO_ADD_SIP_ACCOUNT') return end caller_name_index = 0 - sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}%").sort { |item1, item2| + sip_account_last = tenant.sip_accounts.where('caller_name LIKE ?', "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}%").sort { |item1, item2| item1.caller_name.gsub(/[^0-9]/, '').to_i <=> item2.caller_name.gsub(/[^0-9]/, '').to_i }.last @@ -109,18 +109,18 @@ class ConfigSnomController < ApplicationController caller_name_index = caller_name_index + 1 @sip_account = tenant.sip_accounts.build - @sip_account.caller_name = "#{PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX}#{caller_name_index}" - @sip_account.call_waiting = CALL_WAITING - @sip_account.clir = DEFAULT_CLIR_SETTING - @sip_account.clip = DEFAULT_CLIP_SETTING + @sip_account.caller_name = "#{GsParameter.get('PROVISIONING_AUTO_SIP_ACCOUNT_CALLER_PREFIX')}#{caller_name_index}" + @sip_account.call_waiting = GsParameter.get('CALL_WAITING') + @sip_account.clir = GsParameter.get('DEFAULT_CLIR_SETTING') + @sip_account.clip = GsParameter.get('DEFAULT_CLIP_SETTING') @sip_account.voicemail_pin = random_pin - @sip_account.callforward_rules_act_per_sip_account = CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT + @sip_account.callforward_rules_act_per_sip_account = GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT') @sip_account.hotdeskable = false loop do - @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME) + @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME')) break unless SipAccount.exists?(:auth_name => @sip_account.auth_name) end - @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD) + @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD')) if ! @sip_account.save render( diff --git a/app/controllers/fax_accounts_controller.rb b/app/controllers/fax_accounts_controller.rb index ce03bc5..031080e 100644 --- a/app/controllers/fax_accounts_controller.rb +++ b/app/controllers/fax_accounts_controller.rb @@ -15,8 +15,8 @@ class FaxAccountsController < ApplicationController def new @fax_account = @parent.fax_accounts.build @fax_account.name = generate_a_new_name(@parent, @fax_account) - @fax_account.days_till_auto_delete = DAYS_TILL_AUTO_DELETE - @fax_account.retries = DEFAULT_NUMBER_OF_RETRIES + @fax_account.days_till_auto_delete = GsParameter.get('DAYS_TILL_AUTO_DELETE') + @fax_account.retries = GsParameter.get('DEFAULT_NUMBER_OF_RETRIES') @fax_account.station_id = @parent.to_s @fax_account.phone_numbers.build if @parent.class == User && !@parent.email.blank? diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb index e871862..73a748c 100644 --- a/app/controllers/gemeinschaft_setups_controller.rb +++ b/app/controllers/gemeinschaft_setups_controller.rb @@ -21,7 +21,7 @@ class GemeinschaftSetupsController < ApplicationController def create if @gemeinschaft_setup.save super_tenant = Tenant.create( - :name => SUPER_TENANT_NAME, + :name => GsParameter.get('SUPER_TENANT_NAME'), :country_id => @gemeinschaft_setup.country.id, :language_id => @gemeinschaft_setup.language_id, :description => t('gemeinschaft_setups.initial_setup.super_tenant_description'), diff --git a/app/controllers/gs_nodes_controller.rb b/app/controllers/gs_nodes_controller.rb index 3667775..17c9e8b 100644 --- a/app/controllers/gs_nodes_controller.rb +++ b/app/controllers/gs_nodes_controller.rb @@ -70,7 +70,7 @@ class GsNodesController < ApplicationController @request_class = ''; end - @node = GsNode.where(:ip_address => HOMEBASE_IP_ADDRESS).first + @node = GsNode.where(:ip_address => GsParameter.get('HOMEBASE_IP_ADDRESS')).first if @request_class.blank? || @request_class == "tenants" @tenants = Tenant.where('updated_at > ?', @newer_as) diff --git a/app/controllers/phone_book_entries_controller.rb b/app/controllers/phone_book_entries_controller.rb index 823d50e..9cc9f18 100644 --- a/app/controllers/phone_book_entries_controller.rb +++ b/app/controllers/phone_book_entries_controller.rb @@ -71,7 +71,7 @@ class PhoneBookEntriesController < ApplicationController order([ :last_name, :first_name, :organization ]). paginate( :page => @pagination_page_number, - :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE + :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE') ) end diff --git a/app/controllers/phone_books_controller.rb b/app/controllers/phone_books_controller.rb index 54e7889..5f2d61f 100644 --- a/app/controllers/phone_books_controller.rb +++ b/app/controllers/phone_books_controller.rb @@ -22,7 +22,7 @@ class PhoneBooksController < ApplicationController order([ :last_name, :first_name ]). paginate( :page => @pagination_page_number, - :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE + :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE') ) else # search by name @@ -39,7 +39,7 @@ class PhoneBooksController < ApplicationController order([ :last_name, :first_name ]). paginate( :page => @pagination_page_number, - :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE + :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE') ) end end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index f92ae1c..81b04e0 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -36,7 +36,7 @@ class SessionsController < ApplicationController private def redirect_to_https - if GUI_REDIRECT_HTTPS and ! request.ssl? + if GsParameter.get('GUI_REDIRECT_HTTPS') and ! request.ssl? redirect_to :protocol => "https://" end end diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb index 8292a74..4d042b3 100644 --- a/app/controllers/sip_accounts_controller.rb +++ b/app/controllers/sip_accounts_controller.rb @@ -15,11 +15,11 @@ class SipAccountsController < ApplicationController def new @sip_account = @parent.sip_accounts.build @sip_account.caller_name = @parent - @sip_account.call_waiting = CALL_WAITING - @sip_account.clir = DEFAULT_CLIR_SETTING - @sip_account.clip = DEFAULT_CLIP_SETTING + @sip_account.call_waiting = GsParameter.get('CALL_WAITING') + @sip_account.clir = GsParameter.get('DEFAULT_CLIR_SETTING') + @sip_account.clip = GsParameter.get('DEFAULT_CLIP_SETTING') @sip_account.voicemail_pin = random_pin - @sip_account.callforward_rules_act_per_sip_account = CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT + @sip_account.callforward_rules_act_per_sip_account = GsParameter.get('CALLFORWARD_RULES_ACT_PER_SIP_ACCOUNT_DEFAULT') if @parent.class == User @sip_account.hotdeskable = true end @@ -27,11 +27,11 @@ class SipAccountsController < ApplicationController # Make sure that we don't use an already taken auth_name # loop do - @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME) + @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME')) break unless SipAccount.exists?(:auth_name => @sip_account.auth_name) end - @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD) + @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD')) end def create @@ -39,13 +39,13 @@ class SipAccountsController < ApplicationController if @sip_account.auth_name.blank? loop do - @sip_account.auth_name = SecureRandom.hex(DEFAULT_LENGTH_SIP_AUTH_NAME) + @sip_account.auth_name = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_AUTH_NAME')) break unless SipAccount.exists?(:auth_name => @sip_account.auth_name) end end if @sip_account.password.blank? - @sip_account.password = SecureRandom.hex(DEFAULT_LENGTH_SIP_PASSWORD) + @sip_account.password = SecureRandom.hex(GsParameter.get('DEFAULT_LENGTH_SIP_PASSWORD')) end if @sip_account.save diff --git a/app/controllers/voicemail_messages_controller.rb b/app/controllers/voicemail_messages_controller.rb index 58f5265..dfe0ae4 100644 --- a/app/controllers/voicemail_messages_controller.rb +++ b/app/controllers/voicemail_messages_controller.rb @@ -24,17 +24,17 @@ class VoicemailMessagesController < ApplicationController if @type == 'read' @voicemail_messages = @sip_account.voicemail_messages.where('read_epoch > 0').order('created_epoch DESC').paginate( :page => @pagination_page_number, - :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE + :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE') ) elsif @type == 'unread' @voicemail_messages = @sip_account.voicemail_messages.where(:read_epoch => 0).order('created_epoch DESC').paginate( :page => @pagination_page_number, - :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE + :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE') ) else @voicemail_messages = @sip_account.voicemail_messages.order('created_epoch DESC').paginate( :page => @pagination_page_number, - :per_page => DEFAULT_PAGINATION_ENTRIES_PER_PAGE + :per_page => GsParameter.get('DEFAULT_PAGINATION_ENTRIES_PER_PAGE') ) end end -- cgit v1.2.3 From 464a2f4907bd27b62f7b5cc5d7537b90469b03bd Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 6 Jan 2013 20:52:04 +0100 Subject: GsParameter can only be created or destroyed by migrations. --- app/controllers/gs_parameters_controller.rb | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index be3378e..8f693aa 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -1,6 +1,7 @@ class GsParametersController < ApplicationController def index - @gs_parameters = GsParameter.all + @gs_parameters = GsParameter.order([:section, :name]) + @sections = @gs_parameters.pluck(:section).uniq.sort end def show @@ -11,15 +12,6 @@ class GsParametersController < ApplicationController @gs_parameter = GsParameter.new end - def create - @gs_parameter = GsParameter.new(params[:gs_parameter]) - if @gs_parameter.save - redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_created') - else - render :new - end - end - def edit @gs_parameter = GsParameter.find(params[:id]) end @@ -32,10 +24,4 @@ class GsParametersController < ApplicationController render :edit end end - - def destroy - @gs_parameter = GsParameter.find(params[:id]) - @gs_parameter.destroy - redirect_to gs_parameters_url, :notice => t('gs_parameters.controller.successfuly_destroyed') - end end -- cgit v1.2.3 From 97e73758b2d61c90dc2d1bdbcfd61f7a80db21a8 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 7 Jan 2013 23:29:52 +0100 Subject: Added PROVISIONING_SET_HTTP_USER and PROVISIONING_SET_HTTP_PASSWORD. --- app/controllers/config_snom_controller.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb index 123f2cd..7ee8276 100644 --- a/app/controllers/config_snom_controller.rb +++ b/app/controllers/config_snom_controller.rb @@ -199,19 +199,19 @@ class ConfigSnomController < ApplicationController end end - if defined?(PROVISIONING_SET_HTTP_USER) && @phone.http_user.blank? - if PROVISIONING_SET_HTTP_USER.class == Fixnum - @phone.update_attributes({ :http_user => SecureRandom.hex(PROVISIONING_SET_HTTP_USER) }) - elsif PROVISIONING_SET_HTTP_USER.class == String - @phone.update_attributes({ :http_user => PROVISIONING_SET_HTTP_USER }) + if !GsParameter.get('PROVISIONING_SET_HTTP_USER').nil? && @phone.http_user.blank? + if GsParameter.get('PROVISIONING_SET_HTTP_USER').class == Fixnum + @phone.update_attributes({ :http_user => SecureRandom.hex(GsParameter.get('PROVISIONING_SET_HTTP_USER')) }) + elsif GsParameter.get('PROVISIONING_SET_HTTP_USER').class == String + @phone.update_attributes({ :http_user => GsParameter.get('PROVISIONING_SET_HTTP_USER') }) end end - if defined?(PROVISIONING_SET_HTTP_PASSWORD) && @phone.http_password.blank? - if PROVISIONING_SET_HTTP_PASSWORD.class == Fixnum - @phone.update_attributes({ :http_password => SecureRandom.hex(PROVISIONING_SET_HTTP_PASSWORD) }) - elsif PROVISIONING_SET_HTTP_PASSWORD.class == String - @phone.update_attributes({ :http_password => PROVISIONING_SET_HTTP_PASSWORD }) + if !GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD').nil? && @phone.http_password.blank? + if GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD').class == Fixnum + @phone.update_attributes({ :http_password => SecureRandom.hex(GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD')) }) + elsif GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD').class == String + @phone.update_attributes({ :http_password => GsParameter.get('PROVISIONING_SET_HTTP_PASSWORD') }) end end -- cgit v1.2.3 From b67c3f5ff6474ba117c75eb81c7d2d9371e8a103 Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 8 Jan 2013 14:11:54 +0100 Subject: Click to dial in phone book --- app/controllers/phone_numbers_controller.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/phone_numbers_controller.rb b/app/controllers/phone_numbers_controller.rb index 065934c..c562954 100644 --- a/app/controllers/phone_numbers_controller.rb +++ b/app/controllers/phone_numbers_controller.rb @@ -77,6 +77,23 @@ class PhoneNumbersController < ApplicationController redirect_to :back end + def call + sip_account = nil + current_user.sip_accounts.each do |user_sip_account| + if user_sip_account.registration + sip_account = user_sip_account + break + end + end + + if can?(:call, @phone_number) && sip_account + if ! @phone_number.number.blank? + sip_account.call(@phone_number.number) + end + end + redirect_to(:back) + end + private def set_and_authorize_parent @parent = @phone_book_entry || @sip_account || @conference || @fax_account || -- cgit v1.2.3 From 35a981aa271196adc5a265f52a5ed8b902cfa2c7 Mon Sep 17 00:00:00 2001 From: Julian Pawlowski Date: Tue, 8 Jan 2013 21:54:04 +0100 Subject: have Snom meetingPoint names the same as other Snom phones to have correct sort order --- app/controllers/config_snom_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb index 7ee8276..cb664db 100644 --- a/app/controllers/config_snom_controller.rb +++ b/app/controllers/config_snom_controller.rb @@ -80,7 +80,7 @@ class ConfigSnomController < ApplicationController '00041345' => 'Snom 821', '00041348' => 'Snom 821', '00041341' => 'Snom 870', - '00041332' => 'snom MeetingPoint', + '00041332' => 'Snom meetingPoint', } @phone.phone_model = PhoneModel.where(:name => mac_address_to_model[@mac_address[0, 8]]).first -- cgit v1.2.3 From 70c436c52c76cf866b03fcab6bc43437c9490cd1 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 10 Jan 2013 10:34:57 +0100 Subject: GsParameter :entity, :section and :name can't be changed in the GUI any more. --- app/controllers/gs_parameters_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index 8f693aa..a35e373 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -18,10 +18,15 @@ class GsParametersController < ApplicationController def update @gs_parameter = GsParameter.find(params[:id]) - if @gs_parameter.update_attributes(params[:gs_parameter]) + if @gs_parameter.update_attributes(gs_parameter_params) redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_updated') else render :edit end end + + private + def gs_parameter_params + params.require(:gs_parameter).permit(:value, :class_type, :description) + end end -- cgit v1.2.3 From 7b1295884861b222e441f431089ea3a6d99fd569 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Thu, 10 Jan 2013 11:45:46 +0100 Subject: Started to fragment cache gs_parameter views. --- app/controllers/gs_parameters_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/controllers') diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index a35e373..a7813dc 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -1,5 +1,6 @@ class GsParametersController < ApplicationController def index + @ps_parameters_unordered = GsParameter.scoped @gs_parameters = GsParameter.order([:section, :name]) @sections = @gs_parameters.pluck(:section).uniq.sort end -- cgit v1.2.3 From 2e3bddd415f03aa15cd2759d7c18f64d5545ea80 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 12 Jan 2013 10:53:20 +0100 Subject: Accept truncated MAC addresses. #80 --- app/controllers/phones_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/controllers') diff --git a/app/controllers/phones_controller.rb b/app/controllers/phones_controller.rb index 14735e6..3672390 100644 --- a/app/controllers/phones_controller.rb +++ b/app/controllers/phones_controller.rb @@ -46,6 +46,7 @@ class PhonesController < ApplicationController m = method( :"#{@phoneable.class.name.underscore}_phone_path" ) redirect_to m.( @phoneable, @phone ), :notice => t('phones.controller.successfuly_updated') else + set_fallback_sip_accounts render :edit end end -- cgit v1.2.3 From ec342d3d91d2cfa8c210722354353cfe8a90a8bc Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 12 Jan 2013 11:53:21 +0100 Subject: Add PROVISIONING_KEY_LENGTH as a GsParameter value. #73 --- app/controllers/config_snom_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb index cb664db..24f6e59 100644 --- a/app/controllers/config_snom_controller.rb +++ b/app/controllers/config_snom_controller.rb @@ -182,9 +182,9 @@ class ConfigSnomController < ApplicationController send_sensitve = @provisioning_authenticated || !@phone.provisioning_key_active @phone_settings = Hash.new() - if defined?(PROVISIONING_KEY_LENGTH) && PROVISIONING_KEY_LENGTH > 0 + if !GsParameter.get('PROVISIONING_KEY_LENGTH').nil? && GsParameter.get('PROVISIONING_KEY_LENGTH') > 0 if @phone.provisioning_key.blank? - @phone.update_attributes({ :provisioning_key => SecureRandom.hex(PROVISIONING_KEY_LENGTH), :provisioning_key_active => false }) + @phone.update_attributes({ :provisioning_key => SecureRandom.hex(GsParameter.get('PROVISIONING_KEY_LENGTH')), :provisioning_key_active => false }) elsif @provisioning_authenticated @phone.update_attributes({ :provisioning_key_active => true }) end -- cgit v1.2.3 From 9567f239586f253002dea0ed654b7bd18a15e572 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sat, 12 Jan 2013 23:05:51 +0100 Subject: Added the URLs for some GsParameters. #96 --- app/controllers/gemeinschaft_setups_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb index 73a748c..81faf2a 100644 --- a/app/controllers/gemeinschaft_setups_controller.rb +++ b/app/controllers/gemeinschaft_setups_controller.rb @@ -41,6 +41,11 @@ class GemeinschaftSetupsController < ApplicationController super_tenant_super_admin_group = super_tenant.user_groups.create(:name => t('gemeinschaft_setups.initial_setup.super_admin_group_name')) super_tenant_super_admin_group.user_group_memberships.create(:user_id => user.id) + # Set a couple of URLs in the GsParameter table + GsParameter.where(:name => 'phone_book_entry_image_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}/uploads/phone_book_entry/image") + GsParameter.where(:name => 'ringtone_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}") + GsParameter.where(:name => 'user_image_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}/uploads/user/image") + # Auto-Login: session[:user_id] = user.id -- cgit v1.2.3 From 35d855d7c0d174a77fb5edd2978c2381fad83520 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 13 Jan 2013 16:34:12 +0000 Subject: gateway controller --- app/controllers/gateways_controller.rb | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 app/controllers/gateways_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/gateways_controller.rb b/app/controllers/gateways_controller.rb new file mode 100644 index 0000000..6173ca3 --- /dev/null +++ b/app/controllers/gateways_controller.rb @@ -0,0 +1,41 @@ +class GatewaysController < ApplicationController + def index + @gateways = Gateway.all + end + + def show + @gateway = Gateway.find(params[:id]) + end + + def new + @gateway = Gateway.new + end + + def create + @gateway = Gateway.new(params[:gateway]) + if @gateway.save + redirect_to @gateway, :notice => t('gateways.controller.successfuly_created') + else + render :new + end + end + + def edit + @gateway = Gateway.find(params[:id]) + end + + def update + @gateway = Gateway.find(params[:id]) + if @gateway.update_attributes(params[:gateway]) + redirect_to @gateway, :notice => t('gateways.controller.successfuly_updated') + else + render :edit + end + end + + def destroy + @gateway = Gateway.find(params[:id]) + @gateway.destroy + redirect_to gateways_url, :notice => t('gateways.controller.successfuly_destroyed') + end +end -- cgit v1.2.3 From 778bcf22238298f3104ddf029b007656e92fc98a Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 13 Jan 2013 16:35:06 +0000 Subject: gateway settings controller --- app/controllers/gateway_settings_controller.rb | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 app/controllers/gateway_settings_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/gateway_settings_controller.rb b/app/controllers/gateway_settings_controller.rb new file mode 100644 index 0000000..04af795 --- /dev/null +++ b/app/controllers/gateway_settings_controller.rb @@ -0,0 +1,42 @@ +class GatewaySettingsController < ApplicationController + load_and_authorize_resource :gateway + load_and_authorize_resource :gateway_setting, :through => [:gateway] + + def index + end + + def show + end + + def new + # @gateway_setting = @gateway.gateway_settings.build + end + + def create + @gateway_setting = GatewaySetting.new(params[:gateway_setting]) + if @gateway_setting.save + redirect_to @gateway_setting, :notice => t('gateway_settings.controller.successfuly_created') + else + render :new + end + end + + def edit + @gateway_setting = GatewaySetting.find(params[:id]) + end + + def update + @gateway_setting = GatewaySetting.find(params[:id]) + if @gateway_setting.update_attributes(params[:gateway_setting]) + redirect_to @gateway_setting, :notice => t('gateway_settings.controller.successfuly_updated') + else + render :edit + end + end + + def destroy + @gateway_setting = GatewaySetting.find(params[:id]) + @gateway_setting.destroy + redirect_to gateway_settings_url, :notice => t('gateway_settings.controller.successfuly_destroyed') + end +end -- cgit v1.2.3 From 2452f145763d3d1972dc4238f4420da7c6cc02fe Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 13 Jan 2013 16:35:30 +0000 Subject: gateway parameters controller --- app/controllers/gateway_parameters_controller.rb | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 app/controllers/gateway_parameters_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/gateway_parameters_controller.rb b/app/controllers/gateway_parameters_controller.rb new file mode 100644 index 0000000..a5066d0 --- /dev/null +++ b/app/controllers/gateway_parameters_controller.rb @@ -0,0 +1,41 @@ +class GatewayParametersController < ApplicationController + def index + @gateway_parameters = GatewayParameter.all + end + + def show + @gateway_parameter = GatewayParameter.find(params[:id]) + end + + def new + @gateway_parameter = GatewayParameter.new + end + + def create + @gateway_parameter = GatewayParameter.new(params[:gateway_parameter]) + if @gateway_parameter.save + redirect_to @gateway_parameter, :notice => t('gateway_parameters.controller.successfuly_created') + else + render :new + end + end + + def edit + @gateway_parameter = GatewayParameter.find(params[:id]) + end + + def update + @gateway_parameter = GatewayParameter.find(params[:id]) + if @gateway_parameter.update_attributes(params[:gateway_parameter]) + redirect_to @gateway_parameter, :notice => t('gateway_parameters.controller.successfuly_updated') + else + render :edit + end + end + + def destroy + @gateway_parameter = GatewayParameter.find(params[:id]) + @gateway_parameter.destroy + redirect_to gateway_parameters_url, :notice => t('gateway_parameters.controller.successfuly_destroyed') + end +end -- cgit v1.2.3 From bfacc7b5de2f3a5a9d09a16683a9ba1fcf184d98 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 13 Jan 2013 22:11:11 +0100 Subject: Fixed some gateway stuff. --- app/controllers/gateway_settings_controller.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gateway_settings_controller.rb b/app/controllers/gateway_settings_controller.rb index 04af795..5d9f7e5 100644 --- a/app/controllers/gateway_settings_controller.rb +++ b/app/controllers/gateway_settings_controller.rb @@ -3,6 +3,7 @@ class GatewaySettingsController < ApplicationController load_and_authorize_resource :gateway_setting, :through => [:gateway] def index + @gateway_settings = @gateway.gateway_settings end def show @@ -13,30 +14,30 @@ class GatewaySettingsController < ApplicationController end def create - @gateway_setting = GatewaySetting.new(params[:gateway_setting]) + @gateway_setting = @gateway.gateway_settings.build(params[:gateway_setting]) if @gateway_setting.save - redirect_to @gateway_setting, :notice => t('gateway_settings.controller.successfuly_created') + redirect_to [@gateway, @gateway_setting], :notice => t('gateway_settings.controller.successfuly_created') else render :new end end def edit - @gateway_setting = GatewaySetting.find(params[:id]) + @gateway_setting = @gateway.gateway_settings.find(params[:id]) end def update - @gateway_setting = GatewaySetting.find(params[:id]) + @gateway_setting = @gateway.gateway_settings.find(params[:id]) if @gateway_setting.update_attributes(params[:gateway_setting]) - redirect_to @gateway_setting, :notice => t('gateway_settings.controller.successfuly_updated') + redirect_to [@gateway, @gateway_setting], :notice => t('gateway_settings.controller.successfuly_updated') else render :edit end end def destroy - @gateway_setting = GatewaySetting.find(params[:id]) + @gateway_setting = @gateway.gateway_settings.find(params[:id]) @gateway_setting.destroy - redirect_to gateway_settings_url, :notice => t('gateway_settings.controller.successfuly_destroyed') + redirect_to gateway_gateway_settings_path(@gateway), :notice => t('gateway_settings.controller.successfuly_destroyed') end end -- cgit v1.2.3 From 57097d16d2a7e86f9e03625fd2fb6796504c32a2 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 13 Jan 2013 22:26:28 +0100 Subject: Bugfixes for gateway stuff. --- app/controllers/gateway_parameters_controller.rb | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gateway_parameters_controller.rb b/app/controllers/gateway_parameters_controller.rb index a5066d0..565b575 100644 --- a/app/controllers/gateway_parameters_controller.rb +++ b/app/controllers/gateway_parameters_controller.rb @@ -1,41 +1,44 @@ class GatewayParametersController < ApplicationController + load_and_authorize_resource :gateway + load_and_authorize_resource :gateway_parameter, :through => [:gateway] + def index - @gateway_parameters = GatewayParameter.all + @gateway_parameters = @gateway.gateway_parameters end def show - @gateway_parameter = GatewayParameter.find(params[:id]) + @gateway_parameter = @gateway.gateway_parameters.find(params[:id]) end def new - @gateway_parameter = GatewayParameter.new + @gateway_parameter = @gateway.gateway_parameters.build end def create - @gateway_parameter = GatewayParameter.new(params[:gateway_parameter]) + @gateway_parameter = @gateway.gateway_parameters.build(params[:gateway_parameter]) if @gateway_parameter.save - redirect_to @gateway_parameter, :notice => t('gateway_parameters.controller.successfuly_created') + redirect_to [@gateway, @gateway_parameter], :notice => t('gateway_parameters.controller.successfuly_created') else render :new end end def edit - @gateway_parameter = GatewayParameter.find(params[:id]) + @gateway_parameter = @gateway.gateway_parameters.find(params[:id]) end def update - @gateway_parameter = GatewayParameter.find(params[:id]) + @gateway_parameter = @gateway.gateway_parameters.find(params[:id]) if @gateway_parameter.update_attributes(params[:gateway_parameter]) - redirect_to @gateway_parameter, :notice => t('gateway_parameters.controller.successfuly_updated') + redirect_to [@gateway, @gateway_parameter], :notice => t('gateway_parameters.controller.successfuly_updated') else render :edit end end def destroy - @gateway_parameter = GatewayParameter.find(params[:id]) + @gateway_parameter = @gateway.gateway_parameters.find(params[:id]) @gateway_parameter.destroy - redirect_to gateway_parameters_url, :notice => t('gateway_parameters.controller.successfuly_destroyed') + redirect_to gateway_gateway_parameters_path(@gateway), :notice => t('gateway_parameters.controller.successfuly_destroyed') end end -- cgit v1.2.3 From 191649e6bad92940fc502582f8fcdd842807b8e1 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 13 Jan 2013 22:55:06 +0100 Subject: Restart FreeSWITCH after initial setup. --- app/controllers/gemeinschaft_setups_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb index 81faf2a..7205a86 100644 --- a/app/controllers/gemeinschaft_setups_controller.rb +++ b/app/controllers/gemeinschaft_setups_controller.rb @@ -46,6 +46,10 @@ class GemeinschaftSetupsController < ApplicationController GsParameter.where(:name => 'ringtone_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}") GsParameter.where(:name => 'user_image_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}/uploads/user/image") + # Restart FreeSWITCH + require 'freeswitch_event' + FreeswitchAPI.execute('fsctl', 'shutdown restart') + # Auto-Login: session[:user_id] = user.id -- cgit v1.2.3 From 19a2a280765df3118e46f943628a378f1a4984ba Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 14 Jan 2013 00:11:17 +0100 Subject: redirect to gateway view --- app/controllers/gateway_parameters_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gateway_parameters_controller.rb b/app/controllers/gateway_parameters_controller.rb index 565b575..d5ade9e 100644 --- a/app/controllers/gateway_parameters_controller.rb +++ b/app/controllers/gateway_parameters_controller.rb @@ -17,7 +17,7 @@ class GatewayParametersController < ApplicationController def create @gateway_parameter = @gateway.gateway_parameters.build(params[:gateway_parameter]) if @gateway_parameter.save - redirect_to [@gateway, @gateway_parameter], :notice => t('gateway_parameters.controller.successfuly_created') + redirect_to @gateway, :notice => t('gateway_parameters.controller.successfuly_created') else render :new end @@ -30,7 +30,7 @@ class GatewayParametersController < ApplicationController def update @gateway_parameter = @gateway.gateway_parameters.find(params[:id]) if @gateway_parameter.update_attributes(params[:gateway_parameter]) - redirect_to [@gateway, @gateway_parameter], :notice => t('gateway_parameters.controller.successfuly_updated') + redirect_to @gateway, :notice => t('gateway_parameters.controller.successfuly_updated') else render :edit end @@ -39,6 +39,6 @@ class GatewayParametersController < ApplicationController def destroy @gateway_parameter = @gateway.gateway_parameters.find(params[:id]) @gateway_parameter.destroy - redirect_to gateway_gateway_parameters_path(@gateway), :notice => t('gateway_parameters.controller.successfuly_destroyed') + redirect_to gateway_path(@gateway), :notice => t('gateway_parameters.controller.successfuly_destroyed') end end -- cgit v1.2.3 From 7aac2daa0010293fc27e96f4f767d82ab88abea6 Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 14 Jan 2013 00:11:30 +0100 Subject: redirect to gateway view --- app/controllers/gateway_settings_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gateway_settings_controller.rb b/app/controllers/gateway_settings_controller.rb index 5d9f7e5..4d19b35 100644 --- a/app/controllers/gateway_settings_controller.rb +++ b/app/controllers/gateway_settings_controller.rb @@ -16,7 +16,7 @@ class GatewaySettingsController < ApplicationController def create @gateway_setting = @gateway.gateway_settings.build(params[:gateway_setting]) if @gateway_setting.save - redirect_to [@gateway, @gateway_setting], :notice => t('gateway_settings.controller.successfuly_created') + redirect_to @gateway, :notice => t('gateway_settings.controller.successfuly_created') else render :new end @@ -29,7 +29,7 @@ class GatewaySettingsController < ApplicationController def update @gateway_setting = @gateway.gateway_settings.find(params[:id]) if @gateway_setting.update_attributes(params[:gateway_setting]) - redirect_to [@gateway, @gateway_setting], :notice => t('gateway_settings.controller.successfuly_updated') + redirect_to @gateway, :notice => t('gateway_settings.controller.successfuly_updated') else render :edit end @@ -38,6 +38,6 @@ class GatewaySettingsController < ApplicationController def destroy @gateway_setting = @gateway.gateway_settings.find(params[:id]) @gateway_setting.destroy - redirect_to gateway_gateway_settings_path(@gateway), :notice => t('gateway_settings.controller.successfuly_destroyed') + redirect_to gateway_path(@gateway), :notice => t('gateway_settings.controller.successfuly_destroyed') end end -- cgit v1.2.3 From ece6303fa2a5aad373fdd4f1393366b846fd374e Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 14 Jan 2013 09:48:24 +0100 Subject: save class_type --- app/controllers/gateway_settings_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/controllers') diff --git a/app/controllers/gateway_settings_controller.rb b/app/controllers/gateway_settings_controller.rb index 4d19b35..0304411 100644 --- a/app/controllers/gateway_settings_controller.rb +++ b/app/controllers/gateway_settings_controller.rb @@ -15,6 +15,7 @@ class GatewaySettingsController < ApplicationController def create @gateway_setting = @gateway.gateway_settings.build(params[:gateway_setting]) + @gateway_setting.class_type = GatewaySetting::GATEWAY_SETTINGS[@gateway.technology][@gateway_setting.name] if @gateway_setting.save redirect_to @gateway, :notice => t('gateway_settings.controller.successfuly_created') else -- cgit v1.2.3 From 2928e0342ef45d5b6ecf27faf2940b424c8bd513 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 17:24:38 +0100 Subject: Temporarily fix. @span needs to have a look here. --- app/controllers/gemeinschaft_setups_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb index 7205a86..89a82cb 100644 --- a/app/controllers/gemeinschaft_setups_controller.rb +++ b/app/controllers/gemeinschaft_setups_controller.rb @@ -47,8 +47,8 @@ class GemeinschaftSetupsController < ApplicationController GsParameter.where(:name => 'user_image_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}/uploads/user/image") # Restart FreeSWITCH - require 'freeswitch_event' - FreeswitchAPI.execute('fsctl', 'shutdown restart') + # require 'freeswitch_event' + # FreeswitchAPI.execute('fsctl', 'shutdown restart') # Auto-Login: session[:user_id] = user.id -- cgit v1.2.3 From 4fbda07c7b593dcc22b90f571d1b85b1bdc47528 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 19:48:22 +0100 Subject: Check if Rails.env.production? before restarting FreeSWITCH. #101 --- app/controllers/gemeinschaft_setups_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb index 89a82cb..dbe8ff5 100644 --- a/app/controllers/gemeinschaft_setups_controller.rb +++ b/app/controllers/gemeinschaft_setups_controller.rb @@ -47,8 +47,10 @@ class GemeinschaftSetupsController < ApplicationController GsParameter.where(:name => 'user_image_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}/uploads/user/image") # Restart FreeSWITCH - # require 'freeswitch_event' - # FreeswitchAPI.execute('fsctl', 'shutdown restart') + if Rails.env.production? + require 'freeswitch_event' + FreeswitchAPI.execute('fsctl', 'shutdown restart') + end # Auto-Login: session[:user_id] = user.id -- cgit v1.2.3 From 5a49e044fe3a5bdeff40c15d363af6d0c36fa27a Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 20:27:39 +0100 Subject: Fixed breadcrumbs. --- app/controllers/gui_functions_controller.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gui_functions_controller.rb b/app/controllers/gui_functions_controller.rb index 2ab2c5e..0cb7898 100644 --- a/app/controllers/gui_functions_controller.rb +++ b/app/controllers/gui_functions_controller.rb @@ -1,4 +1,6 @@ class GuiFunctionsController < ApplicationController + load_resource :gui_function + before_filter :load_user_groups before_filter :spread_breadcrumbs @@ -60,14 +62,10 @@ class GuiFunctionsController < ApplicationController end def spread_breadcrumbs - if @tenant - add_breadcrumb t("user_groups.index.page_title"), tenant_user_groups_path(@tenant) - if @user_group && !@user_group.new_record? - add_breadcrumb @user_group, tenant_user_group_path(@tenant, @user_group) - end - end - add_breadcrumb t("gui_functions.index.page_title"), gui_functions_path + if @gui_function && !@gui_function.new_record? + add_breadcrumb @gui_function, gui_function_path(@gui_function) + end end end -- cgit v1.2.3 From ca77ad70f4c2df28f6460e0160f23d115174440d Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 20:42:02 +0100 Subject: Optimized caching. --- app/controllers/gs_parameters_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index a7813dc..0966132 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -1,6 +1,6 @@ class GsParametersController < ApplicationController def index - @ps_parameters_unordered = GsParameter.scoped + @gs_parameters_unordered = GsParameter.scoped @gs_parameters = GsParameter.order([:section, :name]) @sections = @gs_parameters.pluck(:section).uniq.sort end -- cgit v1.2.3 From 907d081bf1b45e876f9d5833bfe1f4d6319aeb81 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 20:44:19 +0100 Subject: Added breadcrumbs for GsParameter. --- app/controllers/gs_parameters_controller.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index 0966132..7ca4e8e 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -1,4 +1,8 @@ class GsParametersController < ApplicationController + load_resource :gs_parameter + + before_filter :spread_breadcrumbs + def index @gs_parameters_unordered = GsParameter.scoped @gs_parameters = GsParameter.order([:section, :name]) @@ -30,4 +34,11 @@ class GsParametersController < ApplicationController def gs_parameter_params params.require(:gs_parameter).permit(:value, :class_type, :description) end + + def spread_breadcrumbs + add_breadcrumb t("gs_parameters.index.page_title"), gs_parameters_path + if @gs_parameter && !@gs_parameter.new_record? + add_breadcrumb @gs_parameter, gs_parameter_path(@gs_parameter) + end + end end -- cgit v1.2.3 From 0820f0e79a28aaa22ff98e969cd202ed422298ff Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 15 Jan 2013 22:06:30 +0100 Subject: Redirect root_url to user#show. --- app/controllers/page_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb index 4ea4d25..dc5f57b 100644 --- a/app/controllers/page_controller.rb +++ b/app/controllers/page_controller.rb @@ -5,7 +5,12 @@ class PageController < ApplicationController before_filter :if_fresh_system_then_go_to_wizard skip_before_filter :home_breadcrumb, :only => [:index] - def index;end + def index + if current_user + redirect_to [current_user.current_tenant, current_user] + end + end + def conference;end def beginners_intro;end -- cgit v1.2.3 From 962e07e58451f5d21cab9804191139be0f20189b Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 16 Jan 2013 11:39:35 +0100 Subject: Downgraded CanCan to version 1.6.7 --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 454c26b..7af8e68 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -10,7 +10,7 @@ class UsersController < ApplicationController end def show - @phone_books = PhoneBook.accessible_by( Ability.new( @user ) ).all + @phone_books = PhoneBook.accessible_by( Ability.new( @user ), :read ) end def new -- cgit v1.2.3 From 113e3c6c6117fbeca7b9bf1f0e6dc26b0db9c407 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 16 Jan 2013 08:33:45 -0500 Subject: call_routes added --- app/controllers/call_routes_controller.rb | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 app/controllers/call_routes_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb new file mode 100644 index 0000000..631339b --- /dev/null +++ b/app/controllers/call_routes_controller.rb @@ -0,0 +1,41 @@ +class CallRoutesController < ApplicationController + def index + @call_routes = CallRoute.all + end + + def show + @call_route = CallRoute.find(params[:id]) + end + + def new + @call_route = CallRoute.new + end + + def create + @call_route = CallRoute.new(params[:call_route]) + if @call_route.save + redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created') + else + render :new + end + end + + def edit + @call_route = CallRoute.find(params[:id]) + end + + def update + @call_route = CallRoute.find(params[:id]) + if @call_route.update_attributes(params[:call_route]) + redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated') + else + render :edit + end + end + + def destroy + @call_route = CallRoute.find(params[:id]) + @call_route.destroy + redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed') + end +end -- cgit v1.2.3 From 8c83a89c6fbfdb31cae8ea6fcf2fd50c12c076a5 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Wed, 16 Jan 2013 08:37:56 -0500 Subject: route_elements added --- app/controllers/route_elements_controller.rb | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 app/controllers/route_elements_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/route_elements_controller.rb b/app/controllers/route_elements_controller.rb new file mode 100644 index 0000000..595a20d --- /dev/null +++ b/app/controllers/route_elements_controller.rb @@ -0,0 +1,41 @@ +class RouteElementsController < ApplicationController + def index + @route_elements = RouteElement.all + end + + def show + @route_element = RouteElement.find(params[:id]) + end + + def new + @route_element = RouteElement.new + end + + def create + @route_element = RouteElement.new(params[:route_element]) + if @route_element.save + redirect_to @route_element, :notice => t('route_elements.controller.successfuly_created') + else + render :new + end + end + + def edit + @route_element = RouteElement.find(params[:id]) + end + + def update + @route_element = RouteElement.find(params[:id]) + if @route_element.update_attributes(params[:route_element]) + redirect_to @route_element, :notice => t('route_elements.controller.successfuly_updated') + else + render :edit + end + end + + def destroy + @route_element = RouteElement.find(params[:id]) + @route_element.destroy + redirect_to route_elements_url, :notice => t('route_elements.controller.successfuly_destroyed') + end +end -- cgit v1.2.3 From 0ee17f52f8ad337c1240b4c55dbd8f6c6c74dc90 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 16 Jan 2013 16:32:59 +0100 Subject: Fixed routes and breadcrumbs. #106 --- app/controllers/call_routes_controller.rb | 19 ++++++++++----- app/controllers/route_elements_controller.rb | 36 ++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 16 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 631339b..41abe6d 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,14 +1,15 @@ class CallRoutesController < ApplicationController + load_and_authorize_resource :call_route + + before_filter :spread_breadcrumbs + def index - @call_routes = CallRoute.all end def show - @call_route = CallRoute.find(params[:id]) end def new - @call_route = CallRoute.new end def create @@ -21,11 +22,9 @@ class CallRoutesController < ApplicationController end def edit - @call_route = CallRoute.find(params[:id]) end def update - @call_route = CallRoute.find(params[:id]) if @call_route.update_attributes(params[:call_route]) redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated') else @@ -34,8 +33,16 @@ class CallRoutesController < ApplicationController end def destroy - @call_route = CallRoute.find(params[:id]) @call_route.destroy redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed') end + + private + def spread_breadcrumbs + add_breadcrumb t("call_routes.index.page_title"), call_routes_path + if @call_route && !@call_route.new_record? + add_breadcrumb @call_route, call_route_path(@call_route) + end + end + end diff --git a/app/controllers/route_elements_controller.rb b/app/controllers/route_elements_controller.rb index 595a20d..699fcc6 100644 --- a/app/controllers/route_elements_controller.rb +++ b/app/controllers/route_elements_controller.rb @@ -1,41 +1,57 @@ class RouteElementsController < ApplicationController + load_and_authorize_resource :call_route + load_and_authorize_resource :route_element, :through => [:call_route] + + before_filter :spread_breadcrumbs + def index - @route_elements = RouteElement.all + @route_elements = @call_route.route_elements end def show - @route_element = RouteElement.find(params[:id]) + @route_element = @call_route.route_elements.find(params[:id]) end def new - @route_element = RouteElement.new + @route_element = @call_route.route_elements.build end def create - @route_element = RouteElement.new(params[:route_element]) + @route_element = @call_route.route_elements.build(params[:route_element]) if @route_element.save - redirect_to @route_element, :notice => t('route_elements.controller.successfuly_created') + redirect_to [@call_route, @route_element], :notice => t('route_elements.controller.successfuly_created') else render :new end end def edit - @route_element = RouteElement.find(params[:id]) + @route_element = @call_route.route_elements.find(params[:id]) end def update - @route_element = RouteElement.find(params[:id]) + @route_element = @call_route.route_elements.find(params[:id]) if @route_element.update_attributes(params[:route_element]) - redirect_to @route_element, :notice => t('route_elements.controller.successfuly_updated') + redirect_to [@call_route, @route_element], :notice => t('route_elements.controller.successfuly_updated') else render :edit end end def destroy - @route_element = RouteElement.find(params[:id]) + @route_element = @call_route.route_elements.find(params[:id]) @route_element.destroy - redirect_to route_elements_url, :notice => t('route_elements.controller.successfuly_destroyed') + redirect_to call_route_route_elements_path(@call_route), :notice => t('route_elements.controller.successfuly_destroyed') end + + private + def spread_breadcrumbs + add_breadcrumb t("call_routes.index.page_title"), call_routes_path + add_breadcrumb @call_route, call_route_path(@call_route) + add_breadcrumb t("route_elements.index.page_title"), call_route_route_elements_path(@call_route) + if @route_element && !@route_element.new_record? + add_breadcrumb @route_element, call_route_route_element_path(@call_route, @route_element) + end + end + end -- cgit v1.2.3 From 0d5fd7ba5092b4d00826f3572448bb54ac2ec983 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 16 Jan 2013 17:14:12 +0100 Subject: Limit call_histories to 1000 and add caching. --- app/controllers/call_histories_controller.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/call_histories_controller.rb b/app/controllers/call_histories_controller.rb index f711f34..5335ed3 100644 --- a/app/controllers/call_histories_controller.rb +++ b/app/controllers/call_histories_controller.rb @@ -34,6 +34,8 @@ class CallHistoriesController < ApplicationController if ! @type.blank? @call_histories = @call_histories.where(:entry_type => @type) end + + @call_histories = @call_histories.order(:created_at).reverse_order.limit(1000) end -- cgit v1.2.3 From 7cdcbdc4b851b348bb21e0f2ff437138e8b9884b Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Wed, 16 Jan 2013 21:00:41 +0100 Subject: Added page caching for the gemeinschaft_setup#new page. --- app/controllers/gemeinschaft_setups_controller.rb | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb index dbe8ff5..27c0a83 100644 --- a/app/controllers/gemeinschaft_setups_controller.rb +++ b/app/controllers/gemeinschaft_setups_controller.rb @@ -1,8 +1,12 @@ class GemeinschaftSetupsController < ApplicationController + # We use the heater rake task to generate this file. + # So it loads super fast even on slow machines. + # + caches_page :new, :gzip => :best_compression + load_and_authorize_resource :gemeinschaft_setup skip_before_filter :go_to_setup_if_new_installation - # before_filter :redirect_if_not_a_fresh_installation def new @user = @gemeinschaft_setup.build_user( @@ -62,16 +66,4 @@ class GemeinschaftSetupsController < ApplicationController end end - private - - def redirect_if_not_a_fresh_installation - if GemeinschaftSetup.all.count > 0 - if current_user - redirect_to root_url , :alert => t('gemeinschaft_setups.initial_setup.access_denied_only_available_on_a_new_system') - else - redirect_to log_in_path , :alert => t('gemeinschaft_setups.initial_setup.access_denied_only_available_on_a_new_system') - end - end - end - end -- cgit v1.2.3 From 24e47521f1a57c73dc349de35909af7e1f8a4a1f Mon Sep 17 00:00:00 2001 From: spag Date: Thu, 17 Jan 2013 17:50:47 +0100 Subject: group by table --- app/controllers/call_routes_controller.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 41abe6d..b0c173d 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -4,6 +4,8 @@ class CallRoutesController < ApplicationController before_filter :spread_breadcrumbs def index + @call_routes = CallRoute.order(['`table`', :position]) + @tables = @call_routes.pluck('`table`').uniq.sort end def show -- cgit v1.2.3 From 17206a20e5bcb44fa4d90f0e176f7aa0fe43bca3 Mon Sep 17 00:00:00 2001 From: spag Date: Thu, 17 Jan 2013 21:51:58 +0100 Subject: rename_column table to routing_table --- app/controllers/call_routes_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index b0c173d..130a160 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -4,8 +4,8 @@ class CallRoutesController < ApplicationController before_filter :spread_breadcrumbs def index - @call_routes = CallRoute.order(['`table`', :position]) - @tables = @call_routes.pluck('`table`').uniq.sort + @call_routes = CallRoute.order([:routing_table, :position]) + @routing_tables = @call_routes.pluck(:routing_table).uniq.sort end def show -- cgit v1.2.3 From 73c9984510d572030329d967e44c6adb00d98613 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Fri, 18 Jan 2013 08:11:56 +0100 Subject: Clean up mess which was created by renaming :table to :routing_table. --- app/controllers/call_routes_controller.rb | 9 +++++++-- app/controllers/gs_parameters_controller.rb | 8 ++++---- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 130a160..89f66ba 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -15,7 +15,7 @@ class CallRoutesController < ApplicationController end def create - @call_route = CallRoute.new(params[:call_route]) + @call_route = CallRoute.new(call_route_parameter_params[:call_route]) if @call_route.save redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created') else @@ -27,7 +27,7 @@ class CallRoutesController < ApplicationController end def update - if @call_route.update_attributes(params[:call_route]) + if @call_route.update_attributes(call_route_parameter_params[:call_route]) redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated') else render :edit @@ -40,6 +40,10 @@ class CallRoutesController < ApplicationController end private + def call_route_parameter_params + params.require(:call_route).permit(:id, :routing_table, :name, :endpoint_type, :endpoint_id, :position) + end + def spread_breadcrumbs add_breadcrumb t("call_routes.index.page_title"), call_routes_path if @call_route && !@call_route.new_record? @@ -47,4 +51,5 @@ class CallRoutesController < ApplicationController end end + end diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index 7ca4e8e..3c212c1 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -10,7 +10,7 @@ class GsParametersController < ApplicationController end def show - @gs_parameter = GsParameter.find(params[:id]) + @gs_parameter = GsParameter.find(gs_parameter_params[:id]) end def new @@ -18,11 +18,11 @@ class GsParametersController < ApplicationController end def edit - @gs_parameter = GsParameter.find(params[:id]) + @gs_parameter = GsParameter.find(gs_parameter_params[:id]) end def update - @gs_parameter = GsParameter.find(params[:id]) + @gs_parameter = GsParameter.find(gs_parameter_params[:id]) if @gs_parameter.update_attributes(gs_parameter_params) redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_updated') else @@ -32,7 +32,7 @@ class GsParametersController < ApplicationController private def gs_parameter_params - params.require(:gs_parameter).permit(:value, :class_type, :description) + params.require(:gs_parameter).permit(:id, :value, :class_type, :description) end def spread_breadcrumbs -- cgit v1.2.3 From 5efd9bdd2f78a15569fb7d1569dceff3bb4f8800 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Fri, 18 Jan 2013 10:19:09 +0100 Subject: Fixed a strange strong_parameter cancan bug. --- app/controllers/call_routes_controller.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 89f66ba..8b8698f 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,6 +1,4 @@ class CallRoutesController < ApplicationController - load_and_authorize_resource :call_route - before_filter :spread_breadcrumbs def index @@ -9,13 +7,15 @@ class CallRoutesController < ApplicationController end def show + @call_route = CallRoute.find(params[:id]) end def new + @call_route = CallRoute.new end def create - @call_route = CallRoute.new(call_route_parameter_params[:call_route]) + @call_route = CallRoute.new(call_route_parameter_params) if @call_route.save redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created') else @@ -27,7 +27,8 @@ class CallRoutesController < ApplicationController end def update - if @call_route.update_attributes(call_route_parameter_params[:call_route]) + @call_route = CallRoute.find(params[:id]) + if @call_route.update_attributes(call_route_parameter_params) redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated') else render :edit @@ -35,13 +36,14 @@ class CallRoutesController < ApplicationController end def destroy + @call_route = CallRoute.find(params[:id]) @call_route.destroy redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed') end private def call_route_parameter_params - params.require(:call_route).permit(:id, :routing_table, :name, :endpoint_type, :endpoint_id, :position) + params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id) end def spread_breadcrumbs @@ -51,5 +53,4 @@ class CallRoutesController < ApplicationController end end - end -- cgit v1.2.3 From dc3f3ef9eb0d0669d48be0795ecd601350ac978f Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Fri, 18 Jan 2013 11:00:34 +0100 Subject: Closes #113 --- app/controllers/gs_parameters_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index 3c212c1..7ca4e8e 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -10,7 +10,7 @@ class GsParametersController < ApplicationController end def show - @gs_parameter = GsParameter.find(gs_parameter_params[:id]) + @gs_parameter = GsParameter.find(params[:id]) end def new @@ -18,11 +18,11 @@ class GsParametersController < ApplicationController end def edit - @gs_parameter = GsParameter.find(gs_parameter_params[:id]) + @gs_parameter = GsParameter.find(params[:id]) end def update - @gs_parameter = GsParameter.find(gs_parameter_params[:id]) + @gs_parameter = GsParameter.find(params[:id]) if @gs_parameter.update_attributes(gs_parameter_params) redirect_to @gs_parameter, :notice => t('gs_parameters.controller.successfuly_updated') else @@ -32,7 +32,7 @@ class GsParametersController < ApplicationController private def gs_parameter_params - params.require(:gs_parameter).permit(:id, :value, :class_type, :description) + params.require(:gs_parameter).permit(:value, :class_type, :description) end def spread_breadcrumbs -- cgit v1.2.3 From e7f51187fe563c559c5580e5091f01356a36b6c3 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Fri, 18 Jan 2013 15:09:32 +0100 Subject: load_and_authorize_resource :gs_parameter #114 --- app/controllers/gs_parameters_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/gs_parameters_controller.rb b/app/controllers/gs_parameters_controller.rb index 7ca4e8e..bd8b44b 100644 --- a/app/controllers/gs_parameters_controller.rb +++ b/app/controllers/gs_parameters_controller.rb @@ -1,5 +1,5 @@ class GsParametersController < ApplicationController - load_resource :gs_parameter + load_and_authorize_resource :gs_parameter before_filter :spread_breadcrumbs -- cgit v1.2.3 From 277744c7412c44b54ff46c1d6548c2c4242327e3 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Fri, 18 Jan 2013 15:20:20 +0100 Subject: added load_and_authorize_resource :call_route --- app/controllers/call_routes_controller.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/controllers') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 8b8698f..cdb425b 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,4 +1,5 @@ class CallRoutesController < ApplicationController + load_and_authorize_resource :call_route before_filter :spread_breadcrumbs def index -- cgit v1.2.3 From 6defcadbb9500efbfcf487c384ad41f958f5e46f Mon Sep 17 00:00:00 2001 From: spag Date: Sat, 19 Jan 2013 09:09:04 +0100 Subject: move actions added --- app/controllers/call_routes_controller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index cdb425b..5ef7c4b 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -42,6 +42,16 @@ class CallRoutesController < ApplicationController redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed') end + def move_higher + @call_route.move_higher + redirect_to :back + end + + def move_lower + @call_route.move_lower + redirect_to :back + end + private def call_route_parameter_params params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id) -- cgit v1.2.3 From 4c141a6d1c20745addd135d1cdd6844b90a20c33 Mon Sep 17 00:00:00 2001 From: spag Date: Sat, 19 Jan 2013 09:09:25 +0100 Subject: move actions added --- app/controllers/route_elements_controller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/route_elements_controller.rb b/app/controllers/route_elements_controller.rb index 699fcc6..c4e4c1a 100644 --- a/app/controllers/route_elements_controller.rb +++ b/app/controllers/route_elements_controller.rb @@ -44,6 +44,16 @@ class RouteElementsController < ApplicationController redirect_to call_route_route_elements_path(@call_route), :notice => t('route_elements.controller.successfuly_destroyed') end + def move_higher + @route_element.move_higher + redirect_to :back + end + + def move_lower + @route_element.move_lower + redirect_to :back + end + private def spread_breadcrumbs add_breadcrumb t("call_routes.index.page_title"), call_routes_path -- cgit v1.2.3 From a2abe7dffb8fe31687910ca4be6dc0374a247d00 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 20 Jan 2013 20:07:28 +0100 Subject: Fixed some strange cancan problem. #119 --- app/controllers/call_routes_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 5ef7c4b..0f4a02d 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,5 +1,5 @@ class CallRoutesController < ApplicationController - load_and_authorize_resource :call_route + authorize_resource :call_route before_filter :spread_breadcrumbs def index @@ -25,6 +25,7 @@ class CallRoutesController < ApplicationController end def edit + @call_route = CallRoute.find(params[:id]) end def update -- cgit v1.2.3 From 4e67f8769a3a3199bfb5b363fe9baa231c329a2b Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 20 Jan 2013 20:57:35 +0100 Subject: Refactoring --- app/controllers/tenants_controller.rb | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/tenants_controller.rb b/app/controllers/tenants_controller.rb index 7bb8ecd..cb67e5f 100644 --- a/app/controllers/tenants_controller.rb +++ b/app/controllers/tenants_controller.rb @@ -1,13 +1,17 @@ class TenantsController < ApplicationController - load_and_authorize_resource :tenant + authorize_resource :tenant def index + @tenants = Tenant.scoped end def show + @tenant = Tenant.find(params[:id]) + @gateways = Gateway.order(:updated_at) end def new + @tenant = Tenant.new @tenant.name = generate_a_new_name(@tenant) @tenant.sip_domain = SipDomain.last @tenant.country = GemeinschaftSetup.first.country @@ -18,6 +22,8 @@ class TenantsController < ApplicationController end def create + @tenant = Tenant.new(tenant_params) + if @tenant.save # Become a member of this tenant. # @@ -86,10 +92,12 @@ class TenantsController < ApplicationController end def edit + @tenant = Tenant.find(params[:id]) end def update - if @tenant.update_attributes(params[:tenant]) + @tenant = Tenant.find(params[:id]) + if @tenant.update_attributes(tenant_params) redirect_to @tenant, :notice => t('tenants.controller.successfuly_updated') else render :edit @@ -97,8 +105,15 @@ class TenantsController < ApplicationController end def destroy + @tenant = Tenant.find(params[:id]) @tenant.destroy redirect_to tenants_url, :notice => t('tenants.controller.successfuly_destroyed') end + + private + def tenant_params + params.require(:tenant).permit(:name, :description, :sip_domain_id, :country_id, :language_id, :from_field_pin_change_email, :from_field_voicemail_email +) + end end -- cgit v1.2.3 From fb18fd9bae2d24bef4652b40a4b0d206b77ebb4f Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Sun, 20 Jan 2013 21:09:10 +0100 Subject: Added breadcrumbs. --- app/controllers/call_routes_controller.rb | 9 +++++++-- app/controllers/gateways_controller.rb | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 0f4a02d..2437d8d 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -1,22 +1,25 @@ class CallRoutesController < ApplicationController authorize_resource :call_route - before_filter :spread_breadcrumbs def index @call_routes = CallRoute.order([:routing_table, :position]) @routing_tables = @call_routes.pluck(:routing_table).uniq.sort + spread_breadcrumbs end def show @call_route = CallRoute.find(params[:id]) + spread_breadcrumbs end def new @call_route = CallRoute.new + spread_breadcrumbs end def create @call_route = CallRoute.new(call_route_parameter_params) + spread_breadcrumbs if @call_route.save redirect_to @call_route, :notice => t('call_routes.controller.successfuly_created') else @@ -26,10 +29,12 @@ class CallRoutesController < ApplicationController def edit @call_route = CallRoute.find(params[:id]) + spread_breadcrumbs end def update @call_route = CallRoute.find(params[:id]) + spread_breadcrumbs if @call_route.update_attributes(call_route_parameter_params) redirect_to @call_route, :notice => t('call_routes.controller.successfuly_updated') else @@ -61,7 +66,7 @@ class CallRoutesController < ApplicationController def spread_breadcrumbs add_breadcrumb t("call_routes.index.page_title"), call_routes_path if @call_route && !@call_route.new_record? - add_breadcrumb @call_route, call_route_path(@call_route) + add_breadcrumb @call_route, @call_route end end diff --git a/app/controllers/gateways_controller.rb b/app/controllers/gateways_controller.rb index 6173ca3..5741195 100644 --- a/app/controllers/gateways_controller.rb +++ b/app/controllers/gateways_controller.rb @@ -1,18 +1,24 @@ class GatewaysController < ApplicationController + authorize_resource :gateway + def index @gateways = Gateway.all + spread_breadcrumbs end def show @gateway = Gateway.find(params[:id]) + spread_breadcrumbs end def new @gateway = Gateway.new + spread_breadcrumbs end def create @gateway = Gateway.new(params[:gateway]) + spread_breadcrumbs if @gateway.save redirect_to @gateway, :notice => t('gateways.controller.successfuly_created') else @@ -22,10 +28,12 @@ class GatewaysController < ApplicationController def edit @gateway = Gateway.find(params[:id]) + spread_breadcrumbs end def update @gateway = Gateway.find(params[:id]) + spread_breadcrumbs if @gateway.update_attributes(params[:gateway]) redirect_to @gateway, :notice => t('gateways.controller.successfuly_updated') else @@ -38,4 +46,12 @@ class GatewaysController < ApplicationController @gateway.destroy redirect_to gateways_url, :notice => t('gateways.controller.successfuly_destroyed') end + + private + def spread_breadcrumbs + add_breadcrumb t("gateways.index.page_title"), gateways_path + if @gateway && !@gateway.new_record? + add_breadcrumb @gateway, @gateway + end + end end -- cgit v1.2.3 From a6779c02f83d1873ebc33b1610013dcbadfeb10b Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 21 Jan 2013 11:07:54 +0100 Subject: Bug fix #121 --- app/controllers/call_routes_controller.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb index 2437d8d..0259a10 100644 --- a/app/controllers/call_routes_controller.rb +++ b/app/controllers/call_routes_controller.rb @@ -49,11 +49,13 @@ class CallRoutesController < ApplicationController end def move_higher + @call_route = CallRoute.find(params[:id]) @call_route.move_higher redirect_to :back end def move_lower + @call_route = CallRoute.find(params[:id]) @call_route.move_lower redirect_to :back end -- cgit v1.2.3 From 86e94e36e52ff7a3dbc7219db5b3bea5a7f56711 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Mon, 21 Jan 2013 14:09:38 +0100 Subject: factory_defaults_prerouting --- app/controllers/gemeinschaft_setups_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb index 27c0a83..347e043 100644 --- a/app/controllers/gemeinschaft_setups_controller.rb +++ b/app/controllers/gemeinschaft_setups_controller.rb @@ -45,6 +45,14 @@ class GemeinschaftSetupsController < ApplicationController super_tenant_super_admin_group = super_tenant.user_groups.create(:name => t('gemeinschaft_setups.initial_setup.super_admin_group_name')) super_tenant_super_admin_group.user_group_memberships.create(:user_id => user.id) + # Set CallRoute defaults + CallRoute.factory_defaults_prerouting(@gemeinschaft_setup.country.country_code, + @gemeinschaft_setup.country.trunk_prefix, + @gemeinschaft_setup.country.international_call_prefix, + '', + @gemeinschaft_setup.default_area_code + ) + # Set a couple of URLs in the GsParameter table GsParameter.where(:name => 'phone_book_entry_image_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}/uploads/phone_book_entry/image") GsParameter.where(:name => 'ringtone_url').first.update_attributes(:value => "http://#{@gemeinschaft_setup.sip_domain.host}") -- cgit v1.2.3 From 5fbbe9c7479a7dc615b8d5630b9e1b2a6ce11b15 Mon Sep 17 00:00:00 2001 From: spag Date: Mon, 21 Jan 2013 15:43:28 +0100 Subject: umlauts added --- app/controllers/config_snom_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb index 24f6e59..149e601 100644 --- a/app/controllers/config_snom_controller.rb +++ b/app/controllers/config_snom_controller.rb @@ -5,13 +5,13 @@ class ConfigSnomController < ApplicationController KEY_REGEXP = { '0' => "[ -.,_0]+", '1' => "[ -.,_1]+", - '2' => "[abc2]", - '3' => "[def3]", - '4' => "[ghi4]", + '2' => "[abc2\xC3\xA4]", + '3' => "[def3\xC3\xA9]", + '4' => "[ghi4\xC3\xAF]", '5' => "[jkl5]", - '6' => "[mno6]", - '7' => "[pqrs7]", - '8' => "[tuv8]", + '6' => "[mno6\xC3\xB6]", + '7' => "[pqrs7\xC3\x9F]", + '8' => "[tuv8\xC3\xBC]", '9' => "[wxyz9]", } -- cgit v1.2.3 From 186ce80e7b22920ea7d54c579f635eec2d1ee98f Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 22 Jan 2013 12:14:46 +0100 Subject: Added a voicemail and fax trigger. #127 --- app/controllers/trigger_controller.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/controllers/trigger_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/trigger_controller.rb b/app/controllers/trigger_controller.rb new file mode 100644 index 0000000..e9821f6 --- /dev/null +++ b/app/controllers/trigger_controller.rb @@ -0,0 +1,11 @@ +class TriggerController < ApplicationController + def voicemail + # Something is triggered when ever a local script fetches this action. + # + end + + def fax + # Something is triggered when ever a local script fetches this action. + # + end +end -- cgit v1.2.3 From 6f69c1a85055ec7c2515719d79d2a7a4e60cec50 Mon Sep 17 00:00:00 2001 From: Stefan Wintermeyer Date: Tue, 22 Jan 2013 15:31:47 +0100 Subject: UI improvements. --- app/controllers/sip_accounts_controller.rb | 2 +- app/controllers/user_groups_controller.rb | 2 +- app/controllers/users_controller.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/sip_accounts_controller.rb b/app/controllers/sip_accounts_controller.rb index 4d042b3..a83208b 100644 --- a/app/controllers/sip_accounts_controller.rb +++ b/app/controllers/sip_accounts_controller.rb @@ -71,7 +71,7 @@ class SipAccountsController < ApplicationController def destroy @sip_account.destroy m = method( :"#{@parent.class.name.underscore}_sip_accounts_url" ) - redirect_to m.( @parent ), :notice => t('sip_accounts.controller.successfuly_destroyed') + redirect_to :back, :notice => t('sip_accounts.controller.successfuly_destroyed') end private diff --git a/app/controllers/user_groups_controller.rb b/app/controllers/user_groups_controller.rb index ff3292c..9e08ff1 100644 --- a/app/controllers/user_groups_controller.rb +++ b/app/controllers/user_groups_controller.rb @@ -38,7 +38,7 @@ class UserGroupsController < ApplicationController def destroy @user_group.destroy - redirect_to method( :"#{@parent.class.name.underscore}_user_groups_path" ).(@parent), :notice => t('user_groups.controller.successfuly_destroyed') + redirect_to :back, :notice => t('user_groups.controller.successfuly_destroyed') end private diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 7af8e68..584d08c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -52,7 +52,7 @@ class UsersController < ApplicationController def destroy @user.destroy - redirect_to @parent, :notice => t('users.controller.successfuly_destroyed') + redirect_to :back, :notice => t('users.controller.successfuly_destroyed') end def destroy_avatar -- cgit v1.2.3