summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-12 13:53:28 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-12 13:53:28 +0100
commitc9066760fd1f5f2f892ce2be5cf2a83bb5210246 (patch)
tree82ecdd528e803ccd1b469dc13482e06cf8ea0b8e /app
parent0b97717b2171820dea41de8df705f8f0e4b71464 (diff)
parentfb66a5e5a4c5d5f9eac4a5e8de6a286482cb55d5 (diff)
Release a new beta.5.1-beta4
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/application.js1
-rw-r--r--app/assets/javascripts/call_route.js.coffee6
-rw-r--r--app/assets/javascripts/phone_number.js.coffee6
-rw-r--r--app/assets/javascripts/route_element.js.coffee6
-rw-r--r--app/assets/javascripts/softkey.js.coffee6
-rw-r--r--app/assets/stylesheets/application.css4
-rw-r--r--app/assets/stylesheets/call_routes.css.scss5
-rw-r--r--app/assets/stylesheets/phone_numbers.css.scss5
-rw-r--r--app/assets/stylesheets/route_elements.css.scss5
-rw-r--r--app/assets/stylesheets/softkeys.css.scss5
-rw-r--r--app/controllers/application_controller.rb63
-rw-r--r--app/controllers/backup_jobs_controller.rb46
-rw-r--r--app/controllers/call_forwards_controller.rb4
-rw-r--r--app/controllers/call_routes_controller.rb93
-rw-r--r--app/controllers/config_polycom_controller.rb69
-rw-r--r--app/controllers/config_siemens_controller.rb12
-rw-r--r--app/controllers/config_snom_controller.rb48
-rw-r--r--app/controllers/fax_documents_controller.rb25
-rw-r--r--app/controllers/gemeinschaft_setups_controller.rb7
-rw-r--r--app/controllers/gui_functions_controller.rb2
-rw-r--r--app/controllers/intruders_controller.rb41
-rw-r--r--app/controllers/page_controller.rb14
-rw-r--r--app/controllers/phone_numbers_controller.rb45
-rw-r--r--app/controllers/route_elements_controller.rb16
-rw-r--r--app/controllers/softkeys_controller.rb23
-rw-r--r--app/controllers/system_messages_controller.rb30
-rw-r--r--app/controllers/tenants_controller.rb9
-rw-r--r--app/helpers/backup_jobs_helper.rb2
-rw-r--r--app/helpers/intruders_helper.rb2
-rw-r--r--app/helpers/system_messages_helper.rb2
-rw-r--r--app/models/ability.rb12
-rw-r--r--app/models/backup_job.rb51
-rw-r--r--app/models/call.rb70
-rw-r--r--app/models/call_forward.rb2
-rw-r--r--app/models/call_route.rb8
-rw-r--r--app/models/gateway.rb6
-rw-r--r--app/models/gateway_setting.rb1
-rw-r--r--app/models/intruder.rb37
-rw-r--r--app/models/sip_account.rb2
-rw-r--r--app/models/softkey.rb32
-rw-r--r--app/models/system_message.rb7
-rw-r--r--app/uploaders/backup_file_uploader.rb55
-rw-r--r--app/views/backup_jobs/_form.html.haml7
-rw-r--r--app/views/backup_jobs/_form_core.html.haml5
-rw-r--r--app/views/backup_jobs/_index_core.html.haml49
-rw-r--r--app/views/backup_jobs/edit.html.haml3
-rw-r--r--app/views/backup_jobs/index.html.haml6
-rw-r--r--app/views/backup_jobs/new.html.haml3
-rw-r--r--app/views/backup_jobs/show.html.haml22
-rw-r--r--app/views/call_histories/_index_core.html.haml2
-rw-r--r--app/views/call_routes/_form_core.html.haml4
-rw-r--r--app/views/call_routes/_index_core.html.haml12
-rw-r--r--app/views/call_routes/index.html.haml11
-rw-r--r--app/views/call_routes/show.html.haml46
-rw-r--r--app/views/call_routes/show.xml.haml5
-rw-r--r--app/views/call_routes/show_variables.html.haml13
-rw-r--r--app/views/config_snom/show.xml.haml8
-rw-r--r--app/views/fax_accounts/_index_core.html.haml4
-rw-r--r--app/views/fax_accounts/show.html.haml6
-rw-r--r--app/views/gateways/show.xml.haml17
-rw-r--r--app/views/gemeinschaft_setups/new.de.html.haml1
-rw-r--r--app/views/gemeinschaft_setups/new.html.haml1
-rw-r--r--app/views/gs_nodes/sync.xml.haml2
-rw-r--r--app/views/gs_parameters/_index_core.html.haml14
-rw-r--r--app/views/gs_parameters/index.html.haml12
-rw-r--r--app/views/intruders/_form.html.haml7
-rw-r--r--app/views/intruders/_form_core.html.haml5
-rw-r--r--app/views/intruders/_index_core.html.haml37
-rw-r--r--app/views/intruders/edit.html.haml3
-rw-r--r--app/views/intruders/index.html.haml6
-rw-r--r--app/views/intruders/new.html.haml3
-rw-r--r--app/views/intruders/show.html.haml52
-rw-r--r--app/views/layouts/_footer.html.haml4
-rw-r--r--app/views/layouts/_navbar.html.haml13
-rw-r--r--app/views/phone_numbers/_form_core.html.haml4
-rw-r--r--app/views/phone_numbers/_index_core.html.haml9
-rw-r--r--app/views/phones/_form_core.html.haml2
-rw-r--r--app/views/phones/show.html.haml2
-rw-r--r--app/views/route_elements/_index_core.html.haml50
-rw-r--r--app/views/route_elements/show.html.haml51
-rw-r--r--app/views/shared/_index_view_edit_destroy_part.html.haml18
-rw-r--r--app/views/softkeys/_form_core.html.haml2
-rw-r--r--app/views/softkeys/_index_core.html.haml34
-rw-r--r--app/views/softkeys/show.html.haml4
-rw-r--r--app/views/system_messages/_form.html.haml7
-rw-r--r--app/views/system_messages/_form_core.html.haml2
-rw-r--r--app/views/system_messages/_index_core.html.haml12
-rw-r--r--app/views/system_messages/index.html.haml3
-rw-r--r--app/views/system_messages/new.html.haml3
-rw-r--r--app/views/system_messages/show.html.haml8
-rw-r--r--app/views/tenants/_admin_area.de.html.haml (renamed from app/views/tenants/_admin_area.html.haml)6
-rw-r--r--app/views/tenants/_admin_area.en.html.haml42
-rw-r--r--app/views/tenants/_table_of_backup_jobs.html.haml11
-rw-r--r--app/views/tenants/show.html.haml2
94 files changed, 1136 insertions, 404 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 9097d83..c6f4107 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -11,5 +11,6 @@
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
+//= require jquery-ui
//= require jquery_ujs
//= require_tree .
diff --git a/app/assets/javascripts/call_route.js.coffee b/app/assets/javascripts/call_route.js.coffee
new file mode 100644
index 0000000..fab7f10
--- /dev/null
+++ b/app/assets/javascripts/call_route.js.coffee
@@ -0,0 +1,6 @@
+jQuery ->
+ $('.call_routes').sortable
+ axis: 'y'
+ handle: '.handle'
+ update: ->
+ $.post($(this).data('update-url'), $(this).sortable('serialize')) \ No newline at end of file
diff --git a/app/assets/javascripts/phone_number.js.coffee b/app/assets/javascripts/phone_number.js.coffee
new file mode 100644
index 0000000..ee983ee
--- /dev/null
+++ b/app/assets/javascripts/phone_number.js.coffee
@@ -0,0 +1,6 @@
+jQuery ->
+ $('#phone_numbers').sortable
+ axis: 'y'
+ handle: '.handle'
+ update: ->
+ $.post($(this).data('update-url'), $(this).sortable('serialize')) \ No newline at end of file
diff --git a/app/assets/javascripts/route_element.js.coffee b/app/assets/javascripts/route_element.js.coffee
new file mode 100644
index 0000000..75dc553
--- /dev/null
+++ b/app/assets/javascripts/route_element.js.coffee
@@ -0,0 +1,6 @@
+jQuery ->
+ $('#route_elements').sortable
+ axis: 'y'
+ handle: '.handle'
+ update: ->
+ $.post($(this).data('update-url'), $(this).sortable('serialize')) \ No newline at end of file
diff --git a/app/assets/javascripts/softkey.js.coffee b/app/assets/javascripts/softkey.js.coffee
new file mode 100644
index 0000000..a8d2d0c
--- /dev/null
+++ b/app/assets/javascripts/softkey.js.coffee
@@ -0,0 +1,6 @@
+jQuery ->
+ $('#softkeys').sortable
+ axis: 'y'
+ handle: '.handle'
+ update: ->
+ $.post($(this).data('update-url'), $(this).sortable('serialize')) \ No newline at end of file
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 9093f8e..44868e4 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -12,4 +12,8 @@
*= require bootstrap/bootstrap
*= require bootstrap/bootstrap-responsive
*= require gemeinschaft-generic
+ *= require call_routes
+ *= require softkeys
+ *= require phone_numbers
+ *= require route_elements
*/
diff --git a/app/assets/stylesheets/call_routes.css.scss b/app/assets/stylesheets/call_routes.css.scss
new file mode 100644
index 0000000..d39e1d1
--- /dev/null
+++ b/app/assets/stylesheets/call_routes.css.scss
@@ -0,0 +1,5 @@
+.call_routes .handle {
+ font-size: 12px;
+ color: #777;
+ cursor: move;
+} \ No newline at end of file
diff --git a/app/assets/stylesheets/phone_numbers.css.scss b/app/assets/stylesheets/phone_numbers.css.scss
new file mode 100644
index 0000000..141a1f7
--- /dev/null
+++ b/app/assets/stylesheets/phone_numbers.css.scss
@@ -0,0 +1,5 @@
+#phone_numbers .handle {
+ font-size: 12px;
+ color: #777;
+ cursor: move;
+} \ No newline at end of file
diff --git a/app/assets/stylesheets/route_elements.css.scss b/app/assets/stylesheets/route_elements.css.scss
new file mode 100644
index 0000000..a0080ab
--- /dev/null
+++ b/app/assets/stylesheets/route_elements.css.scss
@@ -0,0 +1,5 @@
+#route_elements .handle {
+ font-size: 12px;
+ color: #777;
+ cursor: move;
+} \ No newline at end of file
diff --git a/app/assets/stylesheets/softkeys.css.scss b/app/assets/stylesheets/softkeys.css.scss
new file mode 100644
index 0000000..425c6f1
--- /dev/null
+++ b/app/assets/stylesheets/softkeys.css.scss
@@ -0,0 +1,5 @@
+#softkeys .handle {
+ font-size: 12px;
+ color: #777;
+ cursor: move;
+} \ No newline at end of file
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index e4165f3..d1d918e 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -2,26 +2,21 @@ class ApplicationController < ActionController::Base
protect_from_forgery
- before_filter :set_locale
+ before_filter :start_setup_if_new_installation
- before_filter :go_to_setup_if_new_installation
- before_filter :home_breadcrumb
-
+ before_filter :set_locale
helper_method :current_user
-
+
helper_method :guess_local_ip_address
helper_method :guess_local_host
-
+
+ before_filter :home_breadcrumb
+
helper_method :'have_https?'
+ helper_method :'single_sign_on_system?'
helper_method :random_pin
-
- #TODO Add check_authorization. See
- # https://github.com/ryanb/cancan
- # https://github.com/ryanb/cancan/wiki/Ensure-Authorization
- # and Gemeinschaft 4
-
# Generate a new name for an Object
#
def generate_a_new_name(parent, child = nil)
@@ -56,6 +51,8 @@ class ApplicationController < ActionController::Base
def random_pin
if GsParameter.get('MINIMUM_PIN_LENGTH') > 0
(1..GsParameter.get('MINIMUM_PIN_LENGTH')).map{|i| (0 .. 9).to_a.sample}.join
+ else
+ (1..8).map{|i| (0 .. 9).to_a.sample}.join
end
end
@@ -106,33 +103,41 @@ class ApplicationController < ActionController::Base
end
rescue_from CanCan::AccessDenied do |exception|
- if @current_user
+ if current_user
redirect_to root_url, :alert => 'Access denied! Please ask your admin to grant you the necessary rights.'
else
- if Tenant.count == 0 && User.count == 0
- # This is a brand new system. We need to run a setup first.
- redirect_to wizards_new_initial_setup_path
- else
- # You need to login first.
- redirect_to log_in_path, :alert => 'Access denied! You need to login first.'
- end
+ # You need to login first.
+ redirect_to log_in_path, :alert => 'Access denied! You need to login first.'
end
end
private
- def current_user
- begin
- @current_user ||= User.find(session[:user_id]) if session[:user_id]
- rescue ActiveRecord::RecordNotFound
- session[:user_id] = nil
+ def current_user
+ if session[:user_id].nil? && single_sign_on_system?
+ auth_user = User.where(:user_name => request.env[GsParameter.get('SingleSignOnEnvUserNameKey')]).first
+ else
+ if session[:user_id] && User.where(:id => session[:user_id]).any?
+ auth_user = User.where(:id => session[:user_id]).first
+ else
+ auth_user = nil
+ end
+ end
+ session[:user_id] = auth_user.try(:id)
+ return auth_user
+ end
+
+ def single_sign_on_system?
+ if GsParameter.get('SingleSignOnEnvUserNameKey').blank?
+ false
+ else
+ true
end
- @current_user
- end
+ end
- def go_to_setup_if_new_installation
+ def start_setup_if_new_installation
if Rails.env != 'test'
- if GemeinschaftSetup.all.count == 0
+ if GemeinschaftSetup.count == 0
redirect_to new_gemeinschaft_setup_path
end
end
diff --git a/app/controllers/backup_jobs_controller.rb b/app/controllers/backup_jobs_controller.rb
new file mode 100644
index 0000000..31b9c21
--- /dev/null
+++ b/app/controllers/backup_jobs_controller.rb
@@ -0,0 +1,46 @@
+class BackupJobsController < ApplicationController
+ load_and_authorize_resource :backup_job
+
+ before_filter :spread_breadcrumbs
+
+ def index
+ end
+
+ def show
+ end
+
+ def new
+ # Do the same as create.
+ #
+ @backup_job = BackupJob.new(:started_at => Time.now)
+
+ if @backup_job.save
+ redirect_to backup_jobs_path, :notice => t('backup_jobs.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def create
+ @backup_job = BackupJob.new(:started_at => Time.now)
+
+ if @backup_job.save
+ redirect_to backup_jobs_path, :notice => t('backup_jobs.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def destroy
+ @backup_job.destroy
+ redirect_to backup_jobs_url, :notice => t('backup_jobs.controller.successfuly_destroyed')
+ end
+
+ private
+ def spread_breadcrumbs
+ add_breadcrumb t("backup_jobs.index.page_title"), backup_jobs_path
+ if @backup_job && !@backup_job.new_record?
+ add_breadcrumb @backup_job, @backup_job
+ end
+ end
+end
diff --git a/app/controllers/call_forwards_controller.rb b/app/controllers/call_forwards_controller.rb
index 001ed60..b1ced87 100644
--- a/app/controllers/call_forwards_controller.rb
+++ b/app/controllers/call_forwards_controller.rb
@@ -28,7 +28,7 @@ class CallForwardsController < ApplicationController
@available_call_forward_cases = []
CallForwardCase.all.each do |available_call_forward_case|
- if GuiFunction.display?("call_forward_case_#{available_call_forward_case.value}_field_in_call_forward_form", @current_user)
+ if GuiFunction.display?("call_forward_case_#{available_call_forward_case.value}_field_in_call_forward_form", current_user)
@available_call_forward_cases << available_call_forward_case
end
end
@@ -112,7 +112,7 @@ class CallForwardsController < ApplicationController
voice_mail_destination,
]
- if GuiFunction.display?('huntgroup_in_destination_field_in_call_forward_form', @current_user)
+ if GuiFunction.display?('huntgroup_in_destination_field_in_call_forward_form', current_user)
HuntGroup.all.each do |hunt_group|
hunt_group_destination = CallForwardingDestination.new()
hunt_group_destination.id = "#{hunt_group.id}:HuntGroup"
diff --git a/app/controllers/call_routes_controller.rb b/app/controllers/call_routes_controller.rb
index 0259a10..2dcd648 100644
--- a/app/controllers/call_routes_controller.rb
+++ b/app/controllers/call_routes_controller.rb
@@ -1,5 +1,11 @@
class CallRoutesController < ApplicationController
- authorize_resource :call_route
+ authorize_resource :call_route, :except => [:sort]
+
+ before_filter { |controller|
+ if !params[:call_route].blank? && !params[:call_route][:endpoint_str].blank?
+ params[:call_route][:endpoint_type], delimeter, params[:call_route][:endpoint_id] = params[:call_route][:endpoint_str].partition('=')
+ end
+ }
def index
@call_routes = CallRoute.order([:routing_table, :position])
@@ -14,6 +20,11 @@ class CallRoutesController < ApplicationController
def new
@call_route = CallRoute.new
+ @endpoints = Gateway.all.collect {|r| [ "gateway: #{r.to_s}", "gateway=#{r.id}" ] }
+ @endpoints << [ 'phonenumber', 'phonenumber=' ]
+ @endpoints << [ 'dialplanfunction', 'dialplanfunction=' ]
+ @endpoints << [ 'hangup', 'hangup=' ]
+ @endpoints << [ 'unknown', 'unknown=' ]
spread_breadcrumbs
end
@@ -29,12 +40,18 @@ class CallRoutesController < ApplicationController
def edit
@call_route = CallRoute.find(params[:id])
+ @endpoints = Gateway.all.collect {|r| [ "gateway: #{r.to_s}", "gateway=#{r.id}" ] }
+ @endpoints << [ 'phonenumber', 'phonenumber=' ]
+ @endpoints << [ 'dialplanfunction', 'dialplanfunction=' ]
+ @endpoints << [ 'hangup', 'hangup=' ]
+ @endpoints << [ 'unknown', 'unknown=' ]
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
@@ -48,21 +65,31 @@ class CallRoutesController < ApplicationController
redirect_to call_routes_url, :notice => t('call_routes.controller.successfuly_destroyed')
end
- def move_higher
- @call_route = CallRoute.find(params[:id])
- @call_route.move_higher
- redirect_to :back
+ def sort
+ params[:call_route].each_with_index do |id, index|
+ CallRoute.update_all({position: index+1}, {id: id})
+ #CallRoute.find(:id).move_to_bottom
+ end
+ render nothing: true
end
- def move_lower
- @call_route = CallRoute.find(params[:id])
- @call_route.move_lower
- redirect_to :back
+ def show_variables
+ @channel_variables = Hash.new()
+ file_name = '/var/log/freeswitch/variables'
+ if File.readable?(file_name)
+ File.readlines(file_name).each do |line|
+ key, delimeter, value = line.partition(': ')
+ key = to_channel_variable_name(key)
+ if !key.blank?
+ @channel_variables[key] = URI.unescape(value.gsub(/\n/, ''));
+ end
+ end
+ end
end
private
def call_route_parameter_params
- params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id)
+ params.require(:call_route).permit(:routing_table, :name, :endpoint_type, :endpoint_id, :position)
end
def spread_breadcrumbs
@@ -72,4 +99,50 @@ class CallRoutesController < ApplicationController
end
end
+ def to_channel_variable_name(name)
+ variables_map = {
+ 'Channel-State' => 'state',
+ 'Channel-State-Number' => 'state_number',
+ 'Channel-Name' => 'channel_name',
+ 'Unique-ID' => 'uuid',
+ 'Call-Direction' => 'direction',
+ 'Answer-State' => 'state',
+ 'Channel-Read-Codec-Name' => 'read_codec',
+ 'Channel-Read-Codec-Rate' => 'read_rate',
+ 'Channel-Write-Codec-Name' => 'write_codec',
+ 'Channel-Write-Codec-Rate' => 'write_rate',
+ 'Caller-Username' => 'username',
+ 'Caller-Dialplan' => 'dialplan',
+ 'Caller-Caller-ID-Name' => 'caller_id_name',
+ 'Caller-Caller-ID-Number' => 'caller_id_number',
+ 'Caller-ANI' => 'ani',
+ 'Caller-ANI-II' => 'aniii',
+ 'Caller-Network-Addr' => 'network_addr',
+ 'Caller-Destination-Number' => 'destination_number',
+ 'Caller-Unique-ID' => 'uuid',
+ 'Caller-Source' => 'source',
+ 'Caller-Context' => 'context',
+ 'Caller-RDNIS' => 'rdnis',
+ 'Caller-Channel-Name' => 'channel_name',
+ 'Caller-Profile-Index' => 'profile_index',
+ 'Caller-Channel-Created-Time' => 'created_time',
+ 'Caller-Channel-Answered-Time' => 'answered_time',
+ 'Caller-Channel-Hangup-Time' => 'hangup_time',
+ 'Caller-Channel-Transfer-Time' => 'transfer_time',
+ 'Caller-Screen-Bit' => 'screen_bit',
+ 'Caller-Privacy-Hide-Name' => 'privacy_hide_name',
+ 'Caller-Privacy-Hide-Number' => 'privacy_hide_number',
+ }
+
+ name = name.gsub(/[^a-zA-Z1-9_\-]/, '')
+
+ if variables_map[name]
+ return variables_map[name]
+ elsif name.match(/^variable_/)
+ return name.gsub(/^variable_/, '')
+ end
+
+ return nil
+ end
+
end
diff --git a/app/controllers/config_polycom_controller.rb b/app/controllers/config_polycom_controller.rb
index 9d44e51..fd730e3 100644
--- a/app/controllers/config_polycom_controller.rb
+++ b/app/controllers/config_polycom_controller.rb
@@ -26,12 +26,15 @@ class ConfigPolycomController < ApplicationController
if ! params[:sip_account].blank?
@sip_account = @phone.sip_accounts.where({ :id => params[:sip_account].to_i }).first
+ if ! @sip_account && @phone.fallback_sip_account && @phone.fallback_sip_account.id == params[:sip_account].to_i
+ @sip_account = @phone.fallback_sip_account
+ end
if ! @sip_account
render(
:status => 404,
:layout => false,
:content_type => 'text/plain',
- :text => "<!-- SipAccount not found -->",
+ :text => "<!-- SipAccount ID:#{params[:sip_account]} not found -->",
)
return false
end
@@ -113,37 +116,41 @@ class ConfigPolycomController < ApplicationController
softkey_index = 1
blf_index = 0
- @phone.sip_accounts.each do |sip_account|
- sip_account_index = 0
- if (sip_account.sip_accountable_type == @phone.phoneable_type) and (sip_account.sip_accountable_id == @phone.phoneable_id)
- sip_account_index += 1
- if sip_account_index == 1
- xml_applications_url = "#{request.protocol}#{request.host_with_port}/config_polycom/#{@phone.id}/#{sip_account.id}"
- @settings['voIpProt.SIP.outboundProxy.address'] = sip_account.host
- @settings['voIpProt.SIP.outboundProxy.port'] = SIP_DEFAULT_PORT
- end
+ phone_sip_accounts = Array.new()
+ if @phone.sip_accounts && @phone.sip_accounts.count > 0
+ phone_sip_accounts = @phone.sip_accounts
+ elsif @phone.fallback_sip_account
+ phone_sip_accounts.push( @phone.fallback_sip_account )
+ end
+ sip_account_index = 0
+ phone_sip_accounts.each do |sip_account|
+ sip_account_index += 1
+ if sip_account_index == 1
+ xml_applications_url = "#{request.protocol}#{request.host_with_port}/config_polycom/#{@phone.id}/#{sip_account.id}"
+ @settings['voIpProt.SIP.outboundProxy.address'] = sip_account.host
+ @settings['voIpProt.SIP.outboundProxy.port'] = SIP_DEFAULT_PORT
+ end
- @settings["reg.#{sip_account_index}.address"] = "#{sip_account.auth_name}@#{sip_account.host}"
- @settings["reg.#{sip_account_index}.auth.password"] = sip_account.password
- @settings["reg.#{sip_account_index}.auth.userId"] = sip_account.auth_name
- @settings["reg.#{sip_account_index}.displayName"] = 'Call'
- @settings["reg.#{sip_account_index}.label"] = sip_account.caller_name
- @settings["voIpProt.server.#{sip_account_index}.address"] = sip_account.host
- @settings["voIpProt.server.#{sip_account_index}.port"] = SIP_DEFAULT_PORT
- @settings["call.missedCallTracking.#{sip_account_index}.enabled"] = 0
-
- sip_account.softkeys.order(:position).each do |softkey|
- softkey_index += 1
- if softkey.softkey_function
- softkey_function = softkey.softkey_function.name
- end
- case softkey_function
- when 'blf'
- blf_index += 1
- @settings["lineKey.#{softkey_index}.category"] = 'BLF'
- @settings["attendant.resourceList.#{blf_index}.address"] = "#{softkey.number}@#{sip_account.host}"
- @settings["attendant.resourceList.#{blf_index}.label"] = softkey.label
- end
+ @settings["reg.#{sip_account_index}.address"] = "#{sip_account.auth_name}@#{sip_account.host}"
+ @settings["reg.#{sip_account_index}.auth.password"] = sip_account.password
+ @settings["reg.#{sip_account_index}.auth.userId"] = sip_account.auth_name
+ @settings["reg.#{sip_account_index}.displayName"] = 'Call'
+ @settings["reg.#{sip_account_index}.label"] = sip_account.caller_name
+ @settings["voIpProt.server.#{sip_account_index}.address"] = sip_account.host
+ @settings["voIpProt.server.#{sip_account_index}.port"] = SIP_DEFAULT_PORT
+ @settings["call.missedCallTracking.#{sip_account_index}.enabled"] = 0
+
+ sip_account.softkeys.order(:position).each do |softkey|
+ softkey_index += 1
+ if softkey.softkey_function
+ softkey_function = softkey.softkey_function.name
+ end
+ case softkey_function
+ when 'blf'
+ blf_index += 1
+ @settings["lineKey.#{softkey_index}.category"] = 'BLF'
+ @settings["attendant.resourceList.#{blf_index}.address"] = "#{softkey.number}@#{sip_account.host}"
+ @settings["attendant.resourceList.#{blf_index}.label"] = softkey.label
end
end
end
diff --git a/app/controllers/config_siemens_controller.rb b/app/controllers/config_siemens_controller.rb
index b7fa107..bbeba46 100644
--- a/app/controllers/config_siemens_controller.rb
+++ b/app/controllers/config_siemens_controller.rb
@@ -610,15 +610,21 @@ class ConfigSiemensController < ApplicationController
@new_settings << ['stimulus-led-control-uri', key_idx, '' ]
@new_settings << ['stimulus-DTMF-sequence', key_idx, '' ]
when 'call_forwarding'
+ if sk.softkeyable.class == CallForward then
@new_settings << ['function-key-def', key_idx, '63']
- @new_settings << ['stimulus-led-control-uri', key_idx, "f-cftg-#{sk.call_forward_id}" ]
+ @new_settings << ['stimulus-led-control-uri', key_idx, "f-cftg-#{sk.softkeyable.id}" ]
@new_settings << ['send-url-address', key_idx, request.host]
@new_settings << ['send-url-protocol', key_idx, 3]
@new_settings << ['send-url-port', key_idx, '80']
@new_settings << ['send-url-path', key_idx, "/config_siemens/#{@phone.id}/#{@sip_account.id}/call_forwarding.xml"]
- @new_settings << ['send-url-query', key_idx, "id=#{sk.call_forward_id}&function=toggle"]
+ @new_settings << ['send-url-query', key_idx, "id=#{sk.softkeyable.id}&function=toggle"]
@new_settings << ['send-url-method', key_idx, '0']
@new_settings << ['blf-popup', key_idx, 'false']
+ else
+ @new_settings << ['function-key-def', key_idx, '0']
+ @new_settings << ['stimulus-led-control-uri', key_idx, '' ]
+ @new_settings << ['stimulus-DTMF-sequence', key_idx, '' ]
+ end
when 'call_forwarding_always'
phone_number = PhoneNumber.where(:number => sk.number, :phone_numberable_type => 'SipAccount').first
if phone_number
@@ -887,7 +893,7 @@ class ConfigSiemensController < ApplicationController
if @call_forwarding_id
call_forwarding = @sip_account.call_forwards.where(:id => @call_forwarding_id).first
- if !call_forwarding and @sip_account.softkeys.where(:call_forward_id => @call_forwarding_id).count > 0
+ if !call_forwarding and @sip_account.softkeys.where(:softkeyable_id => @call_forwarding_id, :softkeyable_type => 'CallForward').count > 0
call_forwarding = CallForward.where(:id => @call_forwarding_id).first
end
diff --git a/app/controllers/config_snom_controller.rb b/app/controllers/config_snom_controller.rb
index e797a43..58cced2 100644
--- a/app/controllers/config_snom_controller.rb
+++ b/app/controllers/config_snom_controller.rb
@@ -247,6 +247,7 @@ class ConfigSnomController < ApplicationController
elsif @phone.fallback_sip_account
phone_sip_accounts.push( @phone.fallback_sip_account )
end
+ expiry_seconds = GsParameter.get('SIP_EXPIRY_SECONDS')
phone_sip_accounts.each do |sip_account|
if (sip_account.sip_accountable_type == @phone.phoneable_type) and (sip_account.sip_accountable_id == @phone.phoneable_id)
snom_sip_account = {
@@ -259,7 +260,8 @@ class ConfigSnomController < ApplicationController
:name => sip_account.auth_name,
:realname => 'Call',
:idle_text => sip_account.caller_name,
- :mailbox => "<sip:#{sip_account.auth_name}@#{sip_account.host}>"
+ :mailbox => "<sip:#{sip_account.auth_name}@#{sip_account.host}>",
+ :expiry => expiry_seconds,
}
@sip_accounts.push(snom_sip_account)
sip_account_index = @sip_accounts.length
@@ -280,23 +282,47 @@ class ConfigSnomController < ApplicationController
@softkeys.push({:context => sip_account_index, :label => softkey.label, :data => "speed f-li-#{softkey.number}"})
when 'conference'
@softkeys.push({:context => sip_account_index, :label => softkey.label, :data => "blf <sip:#{softkey.number}@#{sip_account.host}>|f-ta-"})
- when 'call_forwarding'
+ when 'call_parking'
@softkeys.push({
:context => sip_account_index,
- :function => softkey.function,
+ :function => softkey.softkey_function.name,
:label => softkey.label,
:softkey => softkey,
:general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
:subscription => {
- :to => "f-cftg-#{softkey.call_forward_id}@#{sip_account.host}",
+ :to => "park+#{@softkeys.softkeyable_id}@#{sip_account.host}",
:for => "#{sip_account.auth_name}@#{sip_account.host}"
},
:actions => [{
- :type => :url,
- :target => "#{request.protocol}#{request.host_with_port}/config_snom/#{@phone.id}/#{snom_sip_account[:id]}/call_forwarding.xml?id=#{softkey.call_forward_id}&function=toggle",
+ :type => :dial,
+ :target => "f-tpark-#{@softkeys.softkeyable_id}",
+ :when => 'on press',
+ :states => 'connected,holding',
+ },{
+ :type => :dial,
+ :target => "f-park-#{@softkeys.softkeyable_id}",
:when => 'on press',
}],
})
+ when 'call_forwarding'
+ if softkey.softkeyable.class == CallForward then
+ @softkeys.push({
+ :context => sip_account_index,
+ :function => softkey.softkey_function.name,
+ :label => softkey.label,
+ :softkey => softkey,
+ :general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
+ :subscription => {
+ :to => "f-cftg-#{softkey.softkeyable_id}@#{sip_account.host}",
+ :for => "#{sip_account.auth_name}@#{sip_account.host}"
+ },
+ :actions => [{
+ :type => :url,
+ :target => "#{request.protocol}#{request.host_with_port}/config_snom/#{@phone.id}/#{snom_sip_account[:id]}/call_forwarding.xml?id=#{softkey.softkeyable_id}&function=toggle",
+ :when => 'on press',
+ }],
+ })
+ end
when 'call_forwarding_always'
phone_number = PhoneNumber.where(:number => softkey.number, :phone_numberable_type => 'SipAccount').first
if phone_number
@@ -308,7 +334,7 @@ class ConfigSnomController < ApplicationController
@softkeys.push({
:context => sip_account_index,
- :function => softkey.function,
+ :function => softkey.softkey_function.name,
:label => softkey.label,
:softkey => softkey,
:general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
@@ -333,7 +359,7 @@ class ConfigSnomController < ApplicationController
@softkeys.push({
:context => sip_account_index,
- :function => softkey.function,
+ :function => softkey.softkey_function.name,
:label => softkey.label,
:softkey => softkey,
:general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
@@ -373,7 +399,7 @@ class ConfigSnomController < ApplicationController
if hunt_group_member
@softkeys.push({
:context => sip_account_index,
- :function => softkey.function,
+ :function => softkey.softkey_function.name,
:label => softkey.label,
:softkey => softkey,
:general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
@@ -403,7 +429,7 @@ class ConfigSnomController < ApplicationController
if acd_agent
@softkeys.push({
:context => sip_account_index,
- :function => softkey.function,
+ :function => softkey.softkey_function.name,
:label => softkey.label,
:softkey => softkey,
:general_type => t("softkeys.functions.#{softkey.softkey_function.name}"),
@@ -922,7 +948,7 @@ AAAA'
if @call_forwarding_id
call_forwarding = @sip_account.call_forwards.where(:id => @call_forwarding_id).first
- if !call_forwarding and @sip_account.softkeys.where(:call_forward_id => @call_forwarding_id).count > 0
+ if !call_forwarding and @sip_account.softkeys.where(:softkeyable_id => @call_forwarding_id, :softkeyable_type => 'CallForward').count > 0
call_forwarding = CallForward.where(:id => @call_forwarding_id).first
end
diff --git a/app/controllers/fax_documents_controller.rb b/app/controllers/fax_documents_controller.rb
index eff9604..5653683 100644
--- a/app/controllers/fax_documents_controller.rb
+++ b/app/controllers/fax_documents_controller.rb
@@ -58,23 +58,18 @@ class FaxDocumentsController < ApplicationController
end
private
+
def spread_breadcrumbs
- breadcrumbs = []
- breadcrumbs = case @fax_account.fax_accountable.class.to_s
- when 'User' ; [
- [@fax_account.fax_accountable.to_s, user_path(@fax_account.fax_accountable)],
- [t('fax_accounts.name').pluralize, user_fax_accounts_path(@fax_account.fax_accountable)],
- [t('fax_documents.name').pluralize, fax_account_fax_documents_path(@fax_account)],
- ]
- when 'UserGroup' ; [
- [@fax_account.fax_accountable, user_group_path(@fax_account.fax_accountable)],
- [t('fax_accounts.name').pluralize, user_group_fax_accounts_path(@fax_account.fax_accountable)],
- [t('fax_documents.name').pluralize, fax_account_fax_documents_path(@fax_account)],
- ]
+ if @fax_account && @fax_account.fax_accountable.class == User
+ add_breadcrumb t("users.index.page_title"), tenant_users_path(@fax_account.fax_accountable.current_tenant)
+ add_breadcrumb @fax_account.fax_accountable, tenant_user_path(@fax_account.fax_accountable.current_tenant, @fax_account.fax_accountable)
end
- if !breadcrumbs.blank?
- breadcrumbs.each do |breadcrumb|
- add_breadcrumb breadcrumb[0], breadcrumb[1]
+
+ if @fax_account
+ add_breadcrumb t("fax_accounts.index.page_title"), user_fax_accounts_path(@fax_account.fax_accountable)
+ add_breadcrumb @fax_account, user_fax_account_path(@fax_account.fax_accountable, @fax_account)
+ if @fax_document && !@fax_document.new_record?
+ add_breadcrumb @fax_document, fax_account_fax_document_path(@fax_account, @fax_document)
end
end
end
diff --git a/app/controllers/gemeinschaft_setups_controller.rb b/app/controllers/gemeinschaft_setups_controller.rb
index 4f4a72a..a62df99 100644
--- a/app/controllers/gemeinschaft_setups_controller.rb
+++ b/app/controllers/gemeinschaft_setups_controller.rb
@@ -4,9 +4,9 @@ class GemeinschaftSetupsController < ApplicationController
#
caches_page :new, :gzip => :best_compression
- load_and_authorize_resource :gemeinschaft_setup
+ skip_before_filter :start_setup_if_new_installation
- skip_before_filter :go_to_setup_if_new_installation
+ load_and_authorize_resource :gemeinschaft_setup
def new
@user = @gemeinschaft_setup.build_user(
@@ -23,6 +23,7 @@ class GemeinschaftSetupsController < ApplicationController
@gemeinschaft_setup.default_company_name = generate_a_new_name(Tenant.new)
@gemeinschaft_setup.default_system_email = 'admin@localhost'
+ @gemeinschaft_setup.trunk_access_code = '0'
end
def create
@@ -52,7 +53,7 @@ class GemeinschaftSetupsController < ApplicationController
CallRoute.factory_defaults_prerouting(@gemeinschaft_setup.country.country_code,
@gemeinschaft_setup.country.trunk_prefix,
@gemeinschaft_setup.country.international_call_prefix,
- '',
+ @gemeinschaft_setup.trunk_access_code,
@gemeinschaft_setup.default_area_code
)
diff --git a/app/controllers/gui_functions_controller.rb b/app/controllers/gui_functions_controller.rb
index 0cb7898..4b57322 100644
--- a/app/controllers/gui_functions_controller.rb
+++ b/app/controllers/gui_functions_controller.rb
@@ -58,7 +58,7 @@ class GuiFunctionsController < ApplicationController
private
def load_user_groups
- @user_groups = Tenant.find(@current_user.current_tenant).user_groups.order(:position)
+ @user_groups = Tenant.find(current_user.current_tenant).user_groups.order(:position)
end
def spread_breadcrumbs
diff --git a/app/controllers/intruders_controller.rb b/app/controllers/intruders_controller.rb
new file mode 100644
index 0000000..eb34f2b
--- /dev/null
+++ b/app/controllers/intruders_controller.rb
@@ -0,0 +1,41 @@
+class IntrudersController < ApplicationController
+ def index
+ @intruders = Intruder.all
+ end
+
+ def show
+ @intruder = Intruder.find(params[:id])
+ end
+
+ def new
+ @intruder = Intruder.new
+ end
+
+ def create
+ @intruder = Intruder.new(params[:intruder])
+ if @intruder.save
+ redirect_to @intruder, :notice => t('intruders.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @intruder = Intruder.find(params[:id])
+ end
+
+ def update
+ @intruder = Intruder.find(params[:id])
+ if @intruder.update_attributes(params[:intruder])
+ redirect_to @intruder, :notice => t('intruders.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @intruder = Intruder.find(params[:id])
+ @intruder.destroy
+ redirect_to intruders_url, :notice => t('intruders.controller.successfuly_destroyed')
+ end
+end
diff --git a/app/controllers/page_controller.rb b/app/controllers/page_controller.rb
index 8f4fa88..ed48e3c 100644
--- a/app/controllers/page_controller.rb
+++ b/app/controllers/page_controller.rb
@@ -2,7 +2,6 @@ class PageController < ApplicationController
# load_and_authorize_resource :class => false
# CanCan doesn't work here really good because Page is not a resource.
- before_filter :if_fresh_system_then_go_to_wizard
skip_before_filter :home_breadcrumb, :only => [:index]
def index
@@ -14,18 +13,5 @@ class PageController < ApplicationController
def help
end
-
- private
- def if_fresh_system_then_go_to_wizard
- if Tenant.count == 0 && User.count == 0
- # This is a brand new system. We need to run a setup first.
- redirect_to wizards_new_initial_setup_path
- else
- if current_user.nil?
- # You need to login first.
- redirect_to log_in_path, :alert => I18n.t('pages.controller.access_denied_login_first')
- end
- end
- end
end
diff --git a/app/controllers/phone_numbers_controller.rb b/app/controllers/phone_numbers_controller.rb
index c562954..67c4922 100644
--- a/app/controllers/phone_numbers_controller.rb
+++ b/app/controllers/phone_numbers_controller.rb
@@ -1,22 +1,22 @@
class PhoneNumbersController < ApplicationController
- load_resource :phone_book_entry
- load_resource :sip_account
- load_resource :conference
- load_resource :fax_account
- load_resource :phone_number_range
- load_resource :callthrough
- load_resource :whitelist
- load_resource :access_authorization
- load_resource :hunt_group
- load_resource :hunt_group_member
- load_resource :automatic_call_distributor
- load_and_authorize_resource :phone_number, :through => [:phone_book_entry, :sip_account, :conference,
+ load_resource :phone_book_entry, :except => [:sort]
+ load_resource :sip_account, :except => [:sort]
+ load_resource :conference, :except => [:sort]
+ load_resource :fax_account, :except => [:sort]
+ load_resource :phone_number_range, :except => [:sort]
+ load_resource :callthrough, :except => [:sort]
+ load_resource :whitelist, :except => [:sort]
+ load_resource :access_authorization, :except => [:sort]
+ load_resource :hunt_group, :except => [:sort]
+ load_resource :hunt_group_member, :except => [:sort]
+ load_resource :automatic_call_distributor, :except => [:sort]
+ load_and_authorize_resource :phone_number, :except => [:sort], :through => [:phone_book_entry, :sip_account, :conference,
:fax_account, :phone_number_range, :callthrough,
:whitelist, :access_authorization, :hunt_group,
:hunt_group_member, :automatic_call_distributor]
- before_filter :set_and_authorize_parent
- before_filter :spread_breadcrumbs
+ before_filter :set_and_authorize_parent, :except => [:sort]
+ before_filter :spread_breadcrumbs, :except => [:sort]
def index
end
@@ -67,16 +67,6 @@ class PhoneNumbersController < ApplicationController
redirect_to m.(), :notice => t('phone_numbers.controller.successfuly_destroyed')
end
- def move_higher
- @phone_number.move_higher
- redirect_to :back
- end
-
- def move_lower
- @phone_number.move_lower
- redirect_to :back
- end
-
def call
sip_account = nil
current_user.sip_accounts.each do |user_sip_account|
@@ -94,6 +84,13 @@ class PhoneNumbersController < ApplicationController
redirect_to(:back)
end
+ def sort
+ params[:phone_number].each_with_index do |id, index|
+ PhoneNumber.update_all({position: index+1}, {id: id})
+ end
+ render nothing: true
+ end
+
private
def set_and_authorize_parent
@parent = @phone_book_entry || @sip_account || @conference || @fax_account ||
diff --git a/app/controllers/route_elements_controller.rb b/app/controllers/route_elements_controller.rb
index c4e4c1a..9c9033e 100644
--- a/app/controllers/route_elements_controller.rb
+++ b/app/controllers/route_elements_controller.rb
@@ -5,7 +5,7 @@ class RouteElementsController < ApplicationController
before_filter :spread_breadcrumbs
def index
- @route_elements = @call_route.route_elements
+ @route_elements = @call_route.route_elements.order([:position])
end
def show
@@ -44,14 +44,14 @@ 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 sort
+ #call_route = RouteElement.find(params[:route_element].first).call_route
+
+ params[:route_element].each do |route_element_id|
+ @call_route.route_elements.find(route_element_id).move_to_bottom
+ end
- def move_lower
- @route_element.move_lower
- redirect_to :back
+ render nothing: true
end
private
diff --git a/app/controllers/softkeys_controller.rb b/app/controllers/softkeys_controller.rb
index d2a2bb9..c9e8c20 100644
--- a/app/controllers/softkeys_controller.rb
+++ b/app/controllers/softkeys_controller.rb
@@ -1,9 +1,9 @@
class SoftkeysController < ApplicationController
- load_and_authorize_resource :sip_account
- load_and_authorize_resource :softkey, :through => [:sip_account]
+ load_and_authorize_resource :sip_account, :except => [:sort]
+ load_and_authorize_resource :softkey, :through => [:sip_account], :except => [:sort]
before_filter :set_available_call_forwards_and_softkey_functions, :only => [ :new, :edit, :update ]
- before_filter :spread_breadcrumbs
+ before_filter :spread_breadcrumbs, :except => [:sort]
def index
end
@@ -44,16 +44,17 @@ class SoftkeysController < ApplicationController
redirect_to sip_account_softkeys_path(@softkey.sip_account), :notice => t('softkeys.controller.successfuly_destroyed')
end
- def move_higher
- @softkey.move_higher
- redirect_to :back
- end
+ def sort
+ sip_account = Softkey.find(params[:softkey].first).sip_account
+
+ params[:softkey].each do |softkey_id|
+ sip_account.softkeys.find(softkey_id).move_to_bottom
+ end
- def move_lower
- @softkey.move_lower
- redirect_to :back
+ render nothing: true
end
+
private
def set_available_call_forwards_and_softkey_functions
@@ -61,7 +62,7 @@ class SoftkeysController < ApplicationController
@softkey_functions = []
SoftkeyFunction.accessible_by(current_ability, :read).each do |softkey_function|
- if GuiFunction.display?("softkey_function_#{softkey_function.name.downcase}_field_in_softkey_form", @current_user)
+ if GuiFunction.display?("softkey_function_#{softkey_function.name.downcase}_field_in_softkey_form", current_user)
@softkey_functions << softkey_function
end
end
diff --git a/app/controllers/system_messages_controller.rb b/app/controllers/system_messages_controller.rb
deleted file mode 100644
index d7fe515..0000000
--- a/app/controllers/system_messages_controller.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-class SystemMessagesController < ApplicationController
- load_and_authorize_resource :user
- load_and_authorize_resource :system_message, :through => [:user]
-
- def index
- @system_messages = @system_messages.where(:created_at => Time.now - 6.hours .. Time.now)
- end
-
- def show
- end
-
- def new
- @system_message = @user.system_messages.build
- end
-
- def create
- @system_message = @user.system_messages.build(params[:system_message])
- if @system_message.save
- # Push the new message via AJAX to the browser.
- #
- # PrivatePub.publish_to("/users/#{@system_message.user.id}/system_messages",
- # "$('#system_message').empty();$('#system_message').append('<span class=\"created_at\">#{(I18n.l @system_message.created_at, :format => :short )}</span> #{@system_message.content}');$('#system_message_display').fadeIn();"
- # )
-
- redirect_to user_system_message_path(@user, @system_message), :notice => t('system_messages.controller.successfuly_created')
- else
- render :new
- end
- end
-end
diff --git a/app/controllers/tenants_controller.rb b/app/controllers/tenants_controller.rb
index 37874b2..b6a96b7 100644
--- a/app/controllers/tenants_controller.rb
+++ b/app/controllers/tenants_controller.rb
@@ -8,6 +8,7 @@ class TenantsController < ApplicationController
def show
@tenant = Tenant.find(params[:id])
@gateways = Gateway.order(:updated_at)
+ @backup_jobs = BackupJob.order(:finished_at).last(5)
end
def new
@@ -27,17 +28,17 @@ class TenantsController < ApplicationController
if @tenant.save
# Become a member of this tenant.
#
- @tenant.tenant_memberships.create(:user_id => @current_user.id)
+ @tenant.tenant_memberships.create(:user_id => current_user.id)
# Groups
#
admin_group = @tenant.user_groups.create(:name => t('gemeinschaft_setups.initial_setup.admin_group_name'))
- admin_group.users << @current_user
+ admin_group.users << current_user
user_group = @tenant.user_groups.create(:name => t('gemeinschaft_setups.initial_setup.user_group_name'))
- user_group.users << @current_user
+ user_group.users << current_user
- @current_user.update_attributes!(:current_tenant_id => @tenant.id)
+ current_user.update_attributes!(:current_tenant_id => @tenant.id)
# Generate the internal_extensions
#
diff --git a/app/helpers/backup_jobs_helper.rb b/app/helpers/backup_jobs_helper.rb
new file mode 100644
index 0000000..06d8b9b
--- /dev/null
+++ b/app/helpers/backup_jobs_helper.rb
@@ -0,0 +1,2 @@
+module BackupJobsHelper
+end
diff --git a/app/helpers/intruders_helper.rb b/app/helpers/intruders_helper.rb
new file mode 100644
index 0000000..7243cf3
--- /dev/null
+++ b/app/helpers/intruders_helper.rb
@@ -0,0 +1,2 @@
+module IntrudersHelper
+end
diff --git a/app/helpers/system_messages_helper.rb b/app/helpers/system_messages_helper.rb
deleted file mode 100644
index fef2386..0000000
--- a/app/helpers/system_messages_helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module SystemMessagesHelper
-end
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 0d13dab..4c0844c 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -56,14 +56,14 @@ class Ability
can :read, PhoneBookEntry, :phone_book => { :id => user_group.phone_book_ids }
end
- # SystemMessages
- #
- cannot [:destroy, :edit, :update], SystemMessage
-
# A FacDocument can't be changed
#
cannot [:edit, :update], FaxDocument
+ # Backups can't be edited
+ #
+ cannot [:edit, :update], BackupJob
+
# Can manage GsNodes
#
can :manage, GsNode
@@ -156,10 +156,6 @@ class Ability
#
can :manage, CallForward, :phone_number_id => user.phone_number_ids
- # SystemMessages
- #
- can :read, SystemMessage, :user_id => user.id
-
# SoftkeyFunctions
#
can :read, SoftkeyFunction
diff --git a/app/models/backup_job.rb b/app/models/backup_job.rb
new file mode 100644
index 0000000..96574a7
--- /dev/null
+++ b/app/models/backup_job.rb
@@ -0,0 +1,51 @@
+class BackupJob < ActiveRecord::Base
+ attr_accessible :started_at, :finished_at, :state, :directory
+
+ mount_uploader :backup_file, BackupFileUploader
+
+ before_create :set_state_to_queued
+ after_create :initiate_backup
+
+ def to_s
+ self.started_at.to_s
+ end
+
+ private
+ def set_state_to_queued
+ self.state = 'queued'
+ self.started_at = Time.now
+ end
+
+ def initiate_backup
+ self.delay.make_a_backup
+ end
+
+ def make_a_backup
+ backup_directory = '/var/backups/GS5'
+ backup_name_prefix = 'GS5-backup-'
+ if self.finished_at.nil? && self.state == 'queued'
+ self.state = 'running'
+ self.save
+ original_directories = Dir.glob("#{backup_directory}/*")
+ system "backup perform --trigger GS5 --config_file #{Rails.root.join('config','backup.rb')}"
+ tmp_backup_directory = (Dir.glob("#{backup_directory}/*") - original_directories).first
+ if tmp_backup_directory.blank?
+ self.state = 'failed'
+ else
+ system "cd #{backup_directory} && tar czf #{backup_name_prefix}#{File.basename(tmp_backup_directory)}.tar.gz #{File.basename(tmp_backup_directory)}"
+ require 'fileutils'
+ FileUtils.rm_rf tmp_backup_directory
+ file = File::Stat.new("#{backup_directory}/#{backup_name_prefix}#{File.basename(tmp_backup_directory)}.tar.gz")
+
+ self.directory = File.basename(tmp_backup_directory)
+
+ self.backup_file = File.open("#{backup_directory}/#{backup_name_prefix}#{File.basename(tmp_backup_directory)}.tar.gz")
+
+ self.finished_at = Time.now
+ self.state = 'successful'
+ end
+ self.save
+ end
+ end
+
+end
diff --git a/app/models/call.rb b/app/models/call.rb
index 57961ec..c0f0f08 100644
--- a/app/models/call.rb
+++ b/app/models/call.rb
@@ -1,36 +1,72 @@
class Call < ActiveRecord::Base
- self.table_name = 'channels'
+ self.table_name = 'detailed_calls'
self.primary_key = 'uuid'
- # Makes sure that this is a readonly model.
def readonly?
return true
end
-
- # Prevent objects from being destroyed
- def before_destroy
- raise ActiveRecord::ReadOnlyRecord
- end
- # Prevent objects from being deleted
- def self.delete_all
- raise ActiveRecord::ReadOnlyRecord
+ def destroy
+ return self.delete
end
- # Prevent objects from being deleted
def delete
- raise ActiveRecord::ReadOnlyRecord
+ require 'freeswitch_event'
+ return FreeswitchAPI.execute('uuid_kill', self.uuid, true);
end
def sip_account
- auth_name = self.name.match('^.+[/:](.+)@.+$')
- if auth_name && ! auth_name[1].blank?
- return SipAccount.where(:auth_name => auth_name[1]).first
+ result = self.presence_id.match('^(.+)@(.+)$')
+
+ if result && ! result[1].blank? and ! result[2].blank?
+ domain = SipDomain.where(:host => result[2]).first
+ if domain
+ return SipAccount.where(:auth_name => result[1], :sip_domain_id => domain.id).first
+ end
end
end
- def kill
+ def sip_account_bleg
+ result = self.b_presence_id.match('^(.+)@(.+)$')
+
+ if result && ! result[1].blank? and ! result[2].blank?
+ domain = SipDomain.where(:host => result[2]).first
+ if domain
+ return SipAccount.where(:auth_name => result[1], :sip_domain_id => domain.id).first
+ end
+ end
+ end
+
+ def get_variable_from_uuid(channel_uuid, variable_name)
+ if channel_uuid.blank?
+ return nil
+ end
+
require 'freeswitch_event'
- return FreeswitchAPI.execute('uuid_kill', self.uuid, true);
+ result = FreeswitchAPI.channel_variable_get(channel_uuid, variable_name);
+
+ if result == '_undef_'
+ return nil
+ end
+
+ return result
+ end
+
+ def get_variable(variable_name)
+ return get_variable_from_uuid(self.uuid, variable_name);
+ end
+
+ def get_variable_bleg(variable_name)
+ return get_variable_from_uuid(self.b_uuid, variable_name);
+ end
+
+ def is_sip
+ return self.name.match('^sofia') != nil
+ end
+
+ def is_caller
+ if (self.uuid == self.call_uuid) || self.call_uuid.blank?
+ true
+ end
end
end
diff --git a/app/models/call_forward.rb b/app/models/call_forward.rb
index 8a8d1df..c668993 100644
--- a/app/models/call_forward.rb
+++ b/app/models/call_forward.rb
@@ -145,7 +145,7 @@ class CallForward < ActiveRecord::Base
softkey_function_deactivated = SoftkeyFunction.find_by_name('deactivated')
self.softkeys.each do |softkey|
if softkey.softkey_function_id != softkey_function_deactivated.id
- softkey.update_attributes(:call_forward_id => nil, :softkey_function_id => softkey_function_deactivated.id)
+ softkey.update_attributes(:softkeyable_id => nil, :softkeyable_type => nil, :softkey_function_id => softkey_function_deactivated.id)
end
end
end
diff --git a/app/models/call_route.rb b/app/models/call_route.rb
index b4496ab..8bc811a 100644
--- a/app/models/call_route.rb
+++ b/app/models/call_route.rb
@@ -2,9 +2,9 @@ class CallRoute < ActiveRecord::Base
# https://github.com/rails/strong_parameters
include ActiveModel::ForbiddenAttributesProtection
- ROUTING_TABLES = ['prerouting', 'outbound', 'inbound']
+ ROUTING_TABLES = ['prerouting', 'outbound', 'inbound', 'dtmf']
- has_many :route_elements, :dependent => :destroy
+ has_many :route_elements, :dependent => :destroy, :order => :position
validates :name,
:presence => true
@@ -239,6 +239,10 @@ class CallRoute < ActiveRecord::Base
end
end
+ def endpoint_str
+ "#{endpoint_type}=#{endpoint_id}"
+ end
+
def endpoint
if self.endpoint_id.to_i > 0
begin
diff --git a/app/models/gateway.rb b/app/models/gateway.rb
index a8df41f..2f17b57 100644
--- a/app/models/gateway.rb
+++ b/app/models/gateway.rb
@@ -1,10 +1,12 @@
class Gateway < ActiveRecord::Base
TECHNOLOGIES = ['sip', 'xmpp']
+ GATEWAY_PREFIX = 'gateway'
attr_accessible :name, :technology, :inbound, :outbound, :description
has_many :gateway_settings, :dependent => :destroy
has_many :gateway_parameters, :dependent => :destroy
+ has_many :call_routes, :as => :endpoint, :dependent => :nullify
validates :name,
:presence => true,
@@ -21,6 +23,10 @@ class Gateway < ActiveRecord::Base
name
end
+ def identifier
+ "#{GATEWAY_PREFIX}#{self.id}"
+ end
+
private
def downcase_technology
self.technology = self.technology.downcase if !self.technology.blank?
diff --git a/app/models/gateway_setting.rb b/app/models/gateway_setting.rb
index e3eaadb..381dde5 100644
--- a/app/models/gateway_setting.rb
+++ b/app/models/gateway_setting.rb
@@ -10,6 +10,7 @@ class GatewaySetting < ActiveRecord::Base
'auth_source' => 'String',
'auth_pattern' => 'String',
'number_source' => 'String',
+ 'profile' => 'String',
},
'xmpp' => {
'server' => 'String',
diff --git a/app/models/intruder.rb b/app/models/intruder.rb
new file mode 100644
index 0000000..db14bf8
--- /dev/null
+++ b/app/models/intruder.rb
@@ -0,0 +1,37 @@
+class Intruder < ActiveRecord::Base
+ attr_accessible :list_type, :key, :points, :bans, :ban_last, :ban_end, :contact_ip, :contact_port, :contact_count, :contact_last, :contacts_per_second, :contacts_per_second_max, :user_agent, :to_user, :comment
+
+ LIST_TYPES = ['blacklist', 'whitelist']
+
+ validates :list_type,
+ :presence => true,
+ :inclusion => { :in => LIST_TYPES }
+
+ validates :key,
+ :presence => true,
+ :uniqueness => true
+
+ validates :contact_ip,
+ :presence => true,
+ :uniqueness => true
+
+ before_validation :set_key_if_empty
+
+
+ def whois
+ if ! self.contact_ip.blank?
+ begin
+ return Whois.whois(self.contact_ip)
+ rescue
+ return nil
+ end
+ end
+ end
+
+ private
+ def set_key_if_empty
+ if self.key.blank?
+ self.key = self.contact_ip
+ end
+ end
+end
diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb
index 444eb12..9ba1f8b 100644
--- a/app/models/sip_account.rb
+++ b/app/models/sip_account.rb
@@ -21,7 +21,7 @@ class SipAccount < ActiveRecord::Base
belongs_to :tenant
belongs_to :sip_domain
- has_many :softkeys, :dependent => :destroy
+ has_many :softkeys, :dependent => :destroy, :order => :position
has_many :voicemail_messages, :foreign_key => 'username', :primary_key => 'auth_name'
diff --git a/app/models/softkey.rb b/app/models/softkey.rb
index a709036..83c88ab 100644
--- a/app/models/softkey.rb
+++ b/app/models/softkey.rb
@@ -1,13 +1,11 @@
class Softkey < ActiveRecord::Base
- attr_accessible :softkey_function_id, :number, :label, :call_forward_id, :uuid
+ attr_accessible :softkey_function_id, :number, :label, :uuid, :softkeyable_type, :softkeyable_id
belongs_to :sip_account
belongs_to :softkey_function
- belongs_to :call_forward
+ belongs_to :softkeyable, :polymorphic => true
- # Any CallForward BLF must have a valid softkey_call_forward_id.
- #
- validates_presence_of :call_forward_id, :if => Proc.new{ |softkey| self.softkey_function_id != nil &&
+ validates_presence_of :softkeyable_id, :if => Proc.new{ |softkey| self.softkey_function_id != nil &&
self.softkey_function_id == SoftkeyFunction.find_by_name('call_forwarding').try(:id) }
# These functions need a number to act.
@@ -21,7 +19,6 @@ class Softkey < ActiveRecord::Base
acts_as_list :scope => :sip_account
before_validation :clean_up_and_leave_only_values_which_make_sense_for_the_current_softkey_function_id
- after_validation :save_function_name_in_function, :if => Proc.new{ |softkey| self.call_forward_id.blank? }
after_save :resync_phone
after_destroy :resync_phone
@@ -52,7 +49,7 @@ class Softkey < ActiveRecord::Base
def to_s
if (['call_forwarding'].include?(self.softkey_function.name))
- "#{self.call_forward}"
+ "#{self.softkeyable}"
else
if ['log_out', 'log_in'].include?(self.softkey_function.name)
I18n.t("softkeys.functions.#{self.softkey_function.name}")
@@ -78,21 +75,22 @@ class Softkey < ActiveRecord::Base
end
private
-
- def save_function_name_in_function
- self.function = self.softkey_function.name
- end
-
# Make sure that no number is set when there is no need for one.
# And make sure that there is no CallForward connected when not needed.
#
def clean_up_and_leave_only_values_which_make_sense_for_the_current_softkey_function_id
- if self.softkey_function_id != nil
- if ['blf','speed_dial','dtmf','conference'].include?(self.softkey_function.name)
- self.call_forward_id = nil
- end
- if ['call_forwarding'].include?(self.softkey_function.name)
+ if self.softkey_function_id != nil
+ case self.softkey_function.name
+ when 'blf'
+ self.softkeyable = PhoneNumber.where(:number => self.number, :phone_numberable_type => 'SipAccount').first.try(:phone_numberable)
+ when 'conference'
+ self.softkeyable = PhoneNumber.where(:number => self.number, :phone_numberable_type => 'Conference').first.try(:phone_numberable)
+ when 'call_forwarding'
+ self.softkeyable = CallForward.where(:id => self.softkeyable_id).first
self.number = nil
+ else
+ self.softkeyable_id = nil
+ self.softkeyable_type = nil
end
end
end
diff --git a/app/models/system_message.rb b/app/models/system_message.rb
deleted file mode 100644
index 0d9e862..0000000
--- a/app/models/system_message.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class SystemMessage < ActiveRecord::Base
- attr_accessible :content
-
- belongs_to :user
-
- validates_presence_of :content
-end
diff --git a/app/uploaders/backup_file_uploader.rb b/app/uploaders/backup_file_uploader.rb
new file mode 100644
index 0000000..8b126a9
--- /dev/null
+++ b/app/uploaders/backup_file_uploader.rb
@@ -0,0 +1,55 @@
+# encoding: utf-8
+
+class BackupFileUploader < CarrierWave::Uploader::Base
+
+ # Include RMagick or MiniMagick support:
+ # include CarrierWave::RMagick
+ # include CarrierWave::MiniMagick
+
+ # Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
+ # include Sprockets::Helpers::RailsHelper
+ # include Sprockets::Helpers::IsolatedHelper
+
+ # Choose what kind of storage to use for this uploader:
+ storage :file
+ # storage :fog
+
+ # Override the directory where uploaded files will be stored.
+ # This is a sensible default for uploaders that are meant to be mounted:
+ def store_dir
+ "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
+ end
+
+ # Provide a default URL as a default if there hasn't been a file uploaded:
+ # def default_url
+ # # For Rails 3.1+ asset pipeline compatibility:
+ # # asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
+ #
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
+ # end
+
+ # Process files as they are uploaded:
+ # process :scale => [200, 300]
+ #
+ # def scale(width, height)
+ # # do something
+ # end
+
+ # Create different versions of your uploaded files:
+ # version :thumb do
+ # process :scale => [50, 50]
+ # end
+
+ # Add a white list of extensions which are allowed to be uploaded.
+ # For images you might use something like this:
+ # def extension_white_list
+ # %w(jpg jpeg gif png)
+ # end
+
+ # Override the filename of the uploaded files:
+ # Avoid using model.id or version_name here, see uploader/store.rb for details.
+ # def filename
+ # "something.jpg" if original_filename
+ # end
+
+end
diff --git a/app/views/backup_jobs/_form.html.haml b/app/views/backup_jobs/_form.html.haml
new file mode 100644
index 0000000..e0adceb
--- /dev/null
+++ b/app/views/backup_jobs/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for(@backup_job) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .actions
+ = f.button :submit, conditional_t('backup_jobs.form.submit') \ No newline at end of file
diff --git a/app/views/backup_jobs/_form_core.html.haml b/app/views/backup_jobs/_form_core.html.haml
new file mode 100644
index 0000000..9d439c5
--- /dev/null
+++ b/app/views/backup_jobs/_form_core.html.haml
@@ -0,0 +1,5 @@
+.inputs
+ = f.input :started_at, :label => t('backup_jobs.form.started_at.label'), :hint => conditional_hint('backup_jobs.form.started_at.hint')
+ = f.input :finished_at, :label => t('backup_jobs.form.finished_at.label'), :hint => conditional_hint('backup_jobs.form.finished_at.hint')
+ = f.input :state, :label => t('backup_jobs.form.state.label'), :hint => conditional_hint('backup_jobs.form.state.hint')
+ = f.input :directory, :label => t('backup_jobs.form.directory.label'), :hint => conditional_hint('backup_jobs.form.directory.hint')
diff --git a/app/views/backup_jobs/_index_core.html.haml b/app/views/backup_jobs/_index_core.html.haml
new file mode 100644
index 0000000..0102546
--- /dev/null
+++ b/app/views/backup_jobs/_index_core.html.haml
@@ -0,0 +1,49 @@
+%table.table.table-striped
+ %tr
+ %th= t('backup_jobs.index.started_at')
+ %th
+ %span.hidden-phone
+ = t('backup_jobs.index.finished_at')
+ %th= t('backup_jobs.index.state')
+ %th
+ %span.hidden-phone
+ = t('backup_jobs.index.size_of_the_backup')
+ %th{:colspan => '2'}
+
+ - for backup_job in backup_jobs
+ - if backup_job.state == 'queued'
+ - row_marker = 'warning'
+ - else
+ - if backup_job.state == 'failed'
+ - row_marker = 'error'
+ - else
+ - row_marker = ''
+ %tr{:class => row_marker}
+ - if backup_job.finished_at.blank?
+ %td{:colspan => '2'}
+ - if (Time.now - 1.day) > backup_job.started_at
+ = l backup_job.started_at, :format => :short
+ - else
+ - case I18n.locale
+ - when :de
+ = "vor #{time_ago_in_words(backup_job.started_at)}"
+ - when :en
+ = "#{time_ago_in_words(backup_job.started_at)} ago"
+ - else
+ = l backup_job.started_at, :format => :short
+ - else
+ %td
+ = l backup_job.started_at, :format => :short
+ %td
+ %span.hidden-phone
+ = l backup_job.finished_at, :format => :short
+ %td= backup_job.state
+ %td
+ %span.hidden-phone
+ - if backup_job.backup_file?
+ %a{:href => backup_job.backup_file.url}
+ %i{:class => 'icon-download'}
+ = number_to_human_size(backup_job.backup_file.size, :precision => 2)
+ - else
+ = '-'
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => backup_job}
diff --git a/app/views/backup_jobs/edit.html.haml b/app/views/backup_jobs/edit.html.haml
new file mode 100644
index 0000000..7892edb
--- /dev/null
+++ b/app/views/backup_jobs/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("backup_jobs.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/backup_jobs/index.html.haml b/app/views/backup_jobs/index.html.haml
new file mode 100644
index 0000000..0bb4747
--- /dev/null
+++ b/app/views/backup_jobs/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("backup_jobs.index.page_title")
+
+- if @backup_jobs && @backup_jobs.count > 0
+ = render "index_core", :backup_jobs => @backup_jobs
+
+= render :partial => 'shared/create_link', :locals => {:child_class => BackupJob} \ No newline at end of file
diff --git a/app/views/backup_jobs/new.html.haml b/app/views/backup_jobs/new.html.haml
new file mode 100644
index 0000000..65efd4f
--- /dev/null
+++ b/app/views/backup_jobs/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("backup_jobs.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/backup_jobs/show.html.haml b/app/views/backup_jobs/show.html.haml
new file mode 100644
index 0000000..6fcb1dc
--- /dev/null
+++ b/app/views/backup_jobs/show.html.haml
@@ -0,0 +1,22 @@
+- content_for :title, t("backup_jobs.show.page_title")
+
+%p
+ %strong= t('backup_jobs.show.started_at') + ":"
+ = @backup_job.started_at
+%p
+ %strong= t('backup_jobs.show.finished_at') + ":"
+ = @backup_job.finished_at
+%p
+ %strong= t('backup_jobs.show.state') + ":"
+ = @backup_job.state
+%p
+ %strong= t('backup_jobs.show.directory') + ":"
+ = @backup_job.directory
+%p
+ %strong= t('backup_jobs.show.size_of_the_backup') + ":"
+ - if @backup_job.backup_file?
+ %a{:href => backup_job.backup_file.url}
+ %i{:class => 'icon-download'}
+ = number_to_human_size(backup_job.backup_file.size, :precision => 2)
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @backup_job } \ No newline at end of file
diff --git a/app/views/call_histories/_index_core.html.haml b/app/views/call_histories/_index_core.html.haml
index 4ca340d..8bbf761 100644
--- a/app/views/call_histories/_index_core.html.haml
+++ b/app/views/call_histories/_index_core.html.haml
@@ -22,7 +22,7 @@
- phone_book_entry = call_history.phone_book_entry_by_number(call_history.display_number)
%tr{:id => "call_history_id_#{call_history.id}_tr", :class => (call_history.duration.blank? ? 'warning' : '')}
%td
- = l call_history.start_stamp, :format => :date_only
+ = l call_history.start_stamp, :format => :short
%td
= l call_history.start_stamp, :format => :short
%td
diff --git a/app/views/call_routes/_form_core.html.haml b/app/views/call_routes/_form_core.html.haml
index b64d660..926c985 100644
--- a/app/views/call_routes/_form_core.html.haml
+++ b/app/views/call_routes/_form_core.html.haml
@@ -1,5 +1,5 @@
.inputs
= f.input :routing_table, :collection => CallRoute::ROUTING_TABLES, :label => t('call_routes.form.table.label'), :hint => conditional_hint('call_routes.form.table.hint'), :include_blank => false, :autofocus => true
= f.input :name, :label => t('call_routes.form.name.label'), :hint => conditional_hint('call_routes.form.name.hint')
- = f.input :endpoint_type, :label => t('call_routes.form.endpoint_type.label'), :hint => conditional_hint('call_routes.form.endpoint_type.hint')
- = f.input :endpoint_id, :label => t('call_routes.form.endpoint_id.label'), :hint => conditional_hint('call_routes.form.endpoint_id.hint')
+ = f.input :endpoint_str, :collection => @endpoints, :label => t('call_routes.form.endpoint.label'), :hint => conditional_hint('call_routes.form.endpoint.hint'), :include_blank => false
+ = f.input :position, :label => t('call_routes.form.position.label'), :hint => conditional_hint('call_routes.form.position.hint') \ No newline at end of file
diff --git a/app/views/call_routes/_index_core.html.haml b/app/views/call_routes/_index_core.html.haml
index f0acebb..a62a9c4 100644
--- a/app/views/call_routes/_index_core.html.haml
+++ b/app/views/call_routes/_index_core.html.haml
@@ -1,15 +1,19 @@
-- cache(['call_routes_table', call_routes.count, call_routes.reorder(:updated_at).last]) do
+- cache(['call_routes_table', I18n.locale, call_routes.count, call_routes.reorder(:updated_at).last]) do
%table.table.table-striped
%thead
%tr
+ %th
%th= t('call_routes.index.name')
%th= t('route_elements.index.pattern')
%th= t('call_routes.index.endpoint')
- %tbody
+ %tbody{ :class => "call_routes", :id => "call_routes_#{routing_table}", :'data-update-url' => sort_call_routes_url}
- for call_route in call_routes
- - cache(['call_route_single_table_row', call_route, call_routes.count]) do
- %tr
+ - cache(['call_route_single_table_row', I18n.locale, call_route]) do
+ = content_tag_for :tr, call_route do
+ %td
+ %span.handle
+ %i.icon-resize-vertical
%td= call_route.name
%td
- if call_route.route_elements.any?
diff --git a/app/views/call_routes/index.html.haml b/app/views/call_routes/index.html.haml
index 488e1c7..0108322 100644
--- a/app/views/call_routes/index.html.haml
+++ b/app/views/call_routes/index.html.haml
@@ -1,11 +1,8 @@
- content_for :title, t("call_routes.index.page_title")
-- if @call_routes && @call_routes.count > 0
- %table.table.table-striped
- - @routing_tables.each do |routing_table|
- %tr
- %td{:colspan => 3}
- %h3= routing_table
- = render "index_core", :call_routes => @call_routes.where(:routing_table => routing_table)
+- if @call_routes && @call_routes.any?
+ - @routing_tables.each do |routing_table|
+ %h3= routing_table
+ = render "index_core", :call_routes => @call_routes.where(:routing_table => routing_table), :routing_table => routing_table
= render :partial => 'shared/create_link', :locals => {:child_class => CallRoute}
diff --git a/app/views/call_routes/show.html.haml b/app/views/call_routes/show.html.haml
index 09daf53..7c695c8 100644
--- a/app/views/call_routes/show.html.haml
+++ b/app/views/call_routes/show.html.haml
@@ -1,23 +1,33 @@
- content_for :title, t("call_routes.show.page_title")
-%p
- %strong= t('call_routes.show.table') + ":"
- = @call_route.routing_table
-%p
- %strong= t('call_routes.show.name') + ":"
- = @call_route.name
-%p
- %strong= t('call_routes.show.endpoint') + ":"
- - endpoint = @call_route.endpoint
- - if endpoint
- = endpoint
- - else
- = @call_route.endpoint_type
+.row
+ .span5
+ %table.table.table-striped
+ %tr
+ %td
+ %strong= t('call_routes.show.table') + ":"
+ %td
+ = @call_route.routing_table
+ %tr
+ %td
+ %strong= t('call_routes.show.name') + ":"
+ %td
+ = @call_route.name
+ %tr
+ %td
+ %strong= t('call_routes.show.endpoint') + ":"
+ %td
+ - if @call_route.endpoint.blank?
+ = @call_route.endpoint_type
+ - else
+ = @call_route.endpoint
-= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @call_route }
+ = render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @call_route }
-%h3= t('route_elements.index.page_title')
-- if @call_route.route_elements && @call_route.route_elements.count > 0
- = render "route_elements/index_core", :route_elements => @call_route.route_elements
+.row
+ .span12
+ %h3= t('route_elements.index.page_title')
+ - if @call_route.route_elements && @call_route.route_elements.count > 0
+ = render "route_elements/index_core", :route_elements => @call_route.route_elements
-= render :partial => 'shared/create_link', :locals => { :parent => @call_route, :child_class => RouteElement }
+ = render :partial => 'shared/create_link', :locals => { :parent => @call_route, :child_class => RouteElement }
diff --git a/app/views/call_routes/show.xml.haml b/app/views/call_routes/show.xml.haml
new file mode 100644
index 0000000..5800816
--- /dev/null
+++ b/app/views/call_routes/show.xml.haml
@@ -0,0 +1,5 @@
+!!! XML
+%call_route{ :name => @call_route.name, :routing_table => @call_route.routing_table, :position => @call_route.position, :endpoint => @call_route.endpoint, :endpoint_type => @call_route.endpoint_type }
+ %route_elements{ :count => @call_route.route_elements.count }
+ - @call_route.route_elements.each do |route_element|
+ %route_element{ :var_in => route_element.var_in, :var_out => route_element.var_out, :pattern => route_element.pattern, :replacement => route_element.replacement, :action => route_element.action, :mandatory => route_element.mandatory.to_s, :position => route_element.position }
diff --git a/app/views/call_routes/show_variables.html.haml b/app/views/call_routes/show_variables.html.haml
new file mode 100644
index 0000000..4bec39d
--- /dev/null
+++ b/app/views/call_routes/show_variables.html.haml
@@ -0,0 +1,13 @@
+%h3= 'Channel Variables'
+
+%table.table.table-striped
+ %thead
+ %tr
+ %th= 'Variable'
+ %th= 'Value'
+
+ %tbody{ :id => "show_variables" }
+ - @channel_variables.each do |key, value|
+ %tr
+ %td= key
+ %td= value.gsub(/\n/, '<br/>').html_safe
diff --git a/app/views/config_snom/show.xml.haml b/app/views/config_snom/show.xml.haml
index 5f53802..33204dc 100644
--- a/app/views/config_snom/show.xml.haml
+++ b/app/views/config_snom/show.xml.haml
@@ -40,7 +40,11 @@
%mwi_notification{:perm => 'RW'}= 'silent'
%mwi_dialtone{:perm => 'RW'}= 'normal'
%prefer_saved_over_received_photo{:perm => 'RW'}= 'off'
- %no_dnd{:perm => 'RW'}= 'on'
+ %no_dnd{:perm => 'RW'}= 'off'
+ %transfer_on_hangup{:perm => 'RW'}= 'on'
+ %transfer_on_hangup_non_pots{:perm => 'RW'}= 'off'
+ %call_join_xfer{:perm => 'RW'}= 'on'
+ %conf_hangup{:perm => 'RW'}= 'on'
%logon_wizard{:perm => 'RW'}= 'off'
%disable_deflection{:perm => 'RW'}= 'off'
%csta_control{:perm => 'RW'}= 'on'
@@ -117,7 +121,7 @@
%user_realname{:idx => index, :perm => 'R'}= sip_account[:realname]
%user_idle_text{:idx => index, :perm => 'R'}= sip_account[:idle_text]
%user_mailbox{:idx => index, :perm => 'R'}= sip_account[:mailbox]
- %user_expiry{:idx => index, :perm => 'R'}= ''
+ %user_expiry{:idx => index, :perm => 'R'}= sip_account[:expiry]
%user_server_type{:idx => index, :perm => 'R'}= 'default'
%user_send_local_name{:idx => index, :perm => 'RW'}= 'on'
%user_dtmf_info{:idx => index, :perm => 'RW'}= 'off'
diff --git a/app/views/fax_accounts/_index_core.html.haml b/app/views/fax_accounts/_index_core.html.haml
index d694f8f..846cda8 100644
--- a/app/views/fax_accounts/_index_core.html.haml
+++ b/app/views/fax_accounts/_index_core.html.haml
@@ -39,8 +39,8 @@
= time_ago_in_words(fax_account.fax_documents.order(:updated_at).last.updated_at)
%td
- if can?(:new, FaxDocument, :fax_account_id => fax_account.id)
- %a.btn.btn-mini.btn-primary{:href => new_fax_account_fax_document_path(fax_account) }
- %i.icon-print.icon-white
+ %a.btn.btn-small{:href => new_fax_account_fax_document_path(fax_account) }
+ %i.icon-print
%span.hidden-phone
=t('fax_accounts.index.send_a_fax')
diff --git a/app/views/fax_accounts/show.html.haml b/app/views/fax_accounts/show.html.haml
index 1a32121..454ebee 100644
--- a/app/views/fax_accounts/show.html.haml
+++ b/app/views/fax_accounts/show.html.haml
@@ -12,7 +12,11 @@
= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @parent, :child => @fax_account }
-= render :partial => 'shared/create_link', :locals => { :parent => @fax_account, :child_class => FaxDocument }
+%p
+ %a.btn.btn-small{:href => new_fax_account_fax_document_path(@fax_account) }
+ %i.icon-print
+ %span.hidden-phone
+ =t('fax_accounts.index.send_a_fax')
%h2= t('phone_numbers.index.page_title')
- if @fax_account.phone_numbers.count > 0
diff --git a/app/views/gateways/show.xml.haml b/app/views/gateways/show.xml.haml
new file mode 100644
index 0000000..e0ff21a
--- /dev/null
+++ b/app/views/gateways/show.xml.haml
@@ -0,0 +1,17 @@
+!!! XML
+%gateway{ :identifier => @gateway.identifier, :name => @gateway.name, :technology => @gateway.technology, :inbound => @gateway.inbound.to_s, :outbound => @gateway.outbound.to_s, :description => @gateway.description }
+
+ %gateway_settings{ :count => @gateway.gateway_settings.count }
+ - @gateway.gateway_settings.each do |setting|
+ %setting{ :name => setting.name, :value => setting.value, :class_type => setting.class_type, :description => setting.description }
+
+ %gateway_parameters{ :count => @gateway.gateway_parameters.count }
+ - @gateway.gateway_parameters.each do |parameter|
+ %parameter{ :name => parameter.name, :value => parameter.value, :class_type => parameter.class_type, :description => parameter.description }
+
+ %call_routes{ :count => @gateway.call_routes.count }
+ - @gateway.call_routes.each do |call_route|
+ %call_route{ :name => call_route.name, :routing_table => call_route.routing_table, :position => call_route.position }
+ %route_elements{ :count => call_route.route_elements.count }
+ - call_route.route_elements.each do |route_element|
+ %route_element{ :var_in => route_element.var_in, :var_out => route_element.var_out, :pattern => route_element.pattern, :replacement => route_element.replacement, :action => route_element.action, :mandatory => route_element.mandatory.to_s, :position => route_element.position }
diff --git a/app/views/gemeinschaft_setups/new.de.html.haml b/app/views/gemeinschaft_setups/new.de.html.haml
index cf1f207..f977291 100644
--- a/app/views/gemeinschaft_setups/new.de.html.haml
+++ b/app/views/gemeinschaft_setups/new.de.html.haml
@@ -14,6 +14,7 @@
= f.association :country, :label => t('gemeinschaft_setups.form.country_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.country_id.hint'), :include_blank => false
= f.association :language, :label => t('gemeinschaft_setups.form.language_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.language_id.hint'), :include_blank => false
= f.input :default_area_code, :label => t('gemeinschaft_setups.form.default_area_code.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_area_code.hint')
+ = f.input :trunk_access_code, :label => t('gemeinschaft_setups.form.trunk_access_code.label'), :hint => conditional_hint('gemeinschaft_setups.form.trunk_access_code.hint')
= f.input :default_company_name, :label => t('gemeinschaft_setups.form.default_company_name.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_company_name.hint')
diff --git a/app/views/gemeinschaft_setups/new.html.haml b/app/views/gemeinschaft_setups/new.html.haml
index 5e2434e..44d9c5b 100644
--- a/app/views/gemeinschaft_setups/new.html.haml
+++ b/app/views/gemeinschaft_setups/new.html.haml
@@ -14,6 +14,7 @@
= f.association :country, :label => t('gemeinschaft_setups.form.country_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.country_id.hint'), :include_blank => false
= f.association :language, :label => t('gemeinschaft_setups.form.language_id.label'), :hint => conditional_hint('gemeinschaft_setups.form.language_id.hint'), :include_blank => false
= f.input :default_area_code, :label => t('gemeinschaft_setups.form.default_area_code.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_area_code.hint')
+ = f.input :trunk_access_code, :label => t('gemeinschaft_setups.form.trunk_access_code.label'), :hint => conditional_hint('gemeinschaft_setups.form.trunk_access_code.hint')
= f.input :default_company_name, :label => t('gemeinschaft_setups.form.default_company_name.label'), :hint => conditional_hint('gemeinschaft_setups.form.default_company_name.hint')
diff --git a/app/views/gs_nodes/sync.xml.haml b/app/views/gs_nodes/sync.xml.haml
index 0f097f8..a2fa71a 100644
--- a/app/views/gs_nodes/sync.xml.haml
+++ b/app/views/gs_nodes/sync.xml.haml
@@ -60,7 +60,7 @@
- if !@softkeys.blank?
%softkeys
- @softkeys.each do |softkey|
- %softkey{ :uuid => softkey.uuid, :function => softkey.softkey_function.try(:name), :number => softkey.number, :label => softkey.label, :position => softkey.position, :created_at => softkey.created_at, :updated_at => softkey.updated_at, :sip_account_uuid => softkey.sip_account.try(:uuid), :call_forward_uuid => softkey.call_forward.try(:uuid) }
+ %softkey{ :uuid => softkey.uuid, :function => softkey.softkey_function.try(:name), :number => softkey.number, :label => softkey.label, :position => softkey.position, :created_at => softkey.created_at, :updated_at => softkey.updated_at, :sip_account_uuid => softkey.sip_account.try(:uuid), :softkeyable_uuid => softkey.softkeyable.try(:uuid), :softkeyable_type => softkey.softkeyable_type) }
- if !@ringtones.blank?
%ringtones
diff --git a/app/views/gs_parameters/_index_core.html.haml b/app/views/gs_parameters/_index_core.html.haml
index 11d60db..2105126 100644
--- a/app/views/gs_parameters/_index_core.html.haml
+++ b/app/views/gs_parameters/_index_core.html.haml
@@ -1,6 +1,9 @@
-- cache(['gs_parameters_table_section', gs_parameters.first.section, gs_parameters.reorder(:updated_at).last, gs_parameters.pluck(:id)]) do
+- cache(['gs_parameter_sub_table', I18n.locale, gs_parameters.count, gs_parameters.reorder(:updated_at).first, gs_parameters.reorder(:updated_at).last]) do
%thead
%tr
+ %th
+ %span.hidden-phone
+ = t('gs_parameters.index.entity')
%th= t('gs_parameters.index.name')
- if !@sections
%th= t('gs_parameters.index.section')
@@ -8,9 +11,16 @@
%tbody
- for gs_parameter in gs_parameters
- - cache(['gs_parameters_table_single_row', gs_parameter]) do
+ - cache(['gs_parameters_table_single_row', I18n.locale, gs_parameter]) do
%tr
%td
+ - if gs_parameter.entity.blank?
+ %span.hidden-phone
+ = '-'
+ - else
+ %span.hidden-phone
+ = truncate(gs_parameter.entity, :length => GsParameter.get('DESKTOP_MAX_STRING_LENGTH'))
+ %td
%span.hidden-phone
= truncate(gs_parameter.name, :length => GsParameter.get('DESKTOP_MAX_STRING_LENGTH'))
%span.visible-phone
diff --git a/app/views/gs_parameters/index.html.haml b/app/views/gs_parameters/index.html.haml
index 1189a45..8df2bb3 100644
--- a/app/views/gs_parameters/index.html.haml
+++ b/app/views/gs_parameters/index.html.haml
@@ -1,13 +1,11 @@
- content_for :title, t("gs_parameters.index.page_title")
-- if @gs_parameters && @gs_parameters.count > 0
- - cache(['gs_parameters_table', I18n.locale, @gs_parameters_unordered.reorder(:updated_at).last, @gs_parameters_unordered.count]) do
+- cache(['gs_parameter_all_tables', I18n.locale, @gs_parameters.count, @gs_parameters.reorder(:updated_at).first, @gs_parameters.reorder(:updated_at).last]) do
+ - if @gs_parameters && @gs_parameters.count > 0
- if @sections
- %table.table.table-striped
- - @sections.each do |section|
- %tr
- %td{:colspan => 3}
- %h3= section
+ - @sections.each do |section|
+ %h3= section
+ %table.table.table-striped
-# Template Dependency: gs_parameters/_index_core
= render "index_core", :gs_parameters => @gs_parameters.where(:section => section)
- else
diff --git a/app/views/intruders/_form.html.haml b/app/views/intruders/_form.html.haml
new file mode 100644
index 0000000..26aab1c
--- /dev/null
+++ b/app/views/intruders/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for(@intruder) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .actions
+ = f.button :submit, conditional_t('intruders.form.submit') \ No newline at end of file
diff --git a/app/views/intruders/_form_core.html.haml b/app/views/intruders/_form_core.html.haml
new file mode 100644
index 0000000..780d8cd
--- /dev/null
+++ b/app/views/intruders/_form_core.html.haml
@@ -0,0 +1,5 @@
+.inputs
+ = f.input :list_type, :collection => Intruder::LIST_TYPES, :label => t('intruders.form.list_type.label'), :hint => conditional_hint('intruders.form.list_type.hint'), :include_blank => false
+ = f.input :contact_ip, :label => t('intruders.form.contact_ip.label'), :hint => conditional_hint('intruders.form.contact_ip.hint')
+ = f.input :ban_end, :label => t('intruders.form.ban_end.label'), :hint => conditional_hint('intruders.form.ban_end.hint')
+ = f.input :comment, :label => t('intruders.form.comment.label'), :hint => conditional_hint('intruders.form.comment.hint')
diff --git a/app/views/intruders/_index_core.html.haml b/app/views/intruders/_index_core.html.haml
new file mode 100644
index 0000000..0070c4d
--- /dev/null
+++ b/app/views/intruders/_index_core.html.haml
@@ -0,0 +1,37 @@
+%table.table.table-striped
+ %tr
+ %th= t('intruders.index.list_type')
+ %th= t('intruders.index.key')
+ %th= t('intruders.index.points')
+ %th= t('intruders.index.bans')
+ %th= t('intruders.index.ban_last')
+ %th= t('intruders.index.ban_end')
+ %th= t('intruders.index.contact_ip')
+ %th= t('intruders.index.contact_port')
+ %th= t('intruders.index.contact_count')
+ %th= t('intruders.index.contact_last')
+ %th= t('intruders.index.contacts_per_second')
+ %th= t('intruders.index.contacts_per_second_max')
+ %th= t('intruders.index.user_agent')
+ %th= t('intruders.index.to_user')
+ %th= t('intruders.index.comment')
+
+
+ - for intruder in intruders
+ %tr
+ %td= intruder.list_type
+ %td= intruder.key
+ %td= intruder.points
+ %td= intruder.bans
+ %td= intruder.ban_last
+ %td= intruder.ban_end
+ %td= intruder.contact_ip
+ %td= intruder.contact_port
+ %td= intruder.contact_count
+ %td= intruder.contact_last
+ %td= intruder.contacts_per_second
+ %td= intruder.contacts_per_second_max
+ %td= intruder.user_agent
+ %td= intruder.to_user
+ %td= intruder.comment
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => intruder} \ No newline at end of file
diff --git a/app/views/intruders/edit.html.haml b/app/views/intruders/edit.html.haml
new file mode 100644
index 0000000..1b5a31b
--- /dev/null
+++ b/app/views/intruders/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("intruders.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/intruders/index.html.haml b/app/views/intruders/index.html.haml
new file mode 100644
index 0000000..72b8882
--- /dev/null
+++ b/app/views/intruders/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("intruders.index.page_title")
+
+- if @intruders && @intruders.count > 0
+ = render "index_core", :intruders => @intruders
+
+= render :partial => 'shared/create_link', :locals => {:child_class => Intruder} \ No newline at end of file
diff --git a/app/views/intruders/new.html.haml b/app/views/intruders/new.html.haml
new file mode 100644
index 0000000..a24b55f
--- /dev/null
+++ b/app/views/intruders/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("intruders.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/intruders/show.html.haml b/app/views/intruders/show.html.haml
new file mode 100644
index 0000000..4941e89
--- /dev/null
+++ b/app/views/intruders/show.html.haml
@@ -0,0 +1,52 @@
+- content_for :title, t("intruders.show.page_title")
+
+%p
+ %strong= t('intruders.show.list_type') + ":"
+ = @intruder.list_type
+%p
+ %strong= t('intruders.show.key') + ":"
+ = @intruder.key
+%p
+ %strong= t('intruders.show.points') + ":"
+ = @intruder.points
+%p
+ %strong= t('intruders.show.bans') + ":"
+ = @intruder.bans
+%p
+ %strong= t('intruders.show.ban_last') + ":"
+ = @intruder.ban_last
+%p
+ %strong= t('intruders.show.ban_end') + ":"
+ = @intruder.ban_end
+%p
+ %strong= t('intruders.show.contact_ip') + ":"
+ = @intruder.contact_ip
+%p
+ %strong= t('intruders.show.contact_port') + ":"
+ = @intruder.contact_port
+%p
+ %strong= t('intruders.show.contact_count') + ":"
+ = @intruder.contact_count
+%p
+ %strong= t('intruders.show.contact_last') + ":"
+ = @intruder.contact_last
+%p
+ %strong= t('intruders.show.contacts_per_second') + ":"
+ = @intruder.contacts_per_second
+%p
+ %strong= t('intruders.show.contacts_per_second_max') + ":"
+ = @intruder.contacts_per_second_max
+%p
+ %strong= t('intruders.show.user_agent') + ":"
+ = @intruder.user_agent
+%p
+ %strong= t('intruders.show.to_user') + ":"
+ = @intruder.to_user
+%p
+ %strong= t('intruders.show.comment') + ":"
+ = @intruder.comment
+
+%p
+ %pre= @intruder.whois
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @intruder }
diff --git a/app/views/layouts/_footer.html.haml b/app/views/layouts/_footer.html.haml
index 97bf483..2703844 100644
--- a/app/views/layouts/_footer.html.haml
+++ b/app/views/layouts/_footer.html.haml
@@ -14,6 +14,6 @@
%li
= link_to 'GS5 Google Group', "https://groups.google.com/group/gs5-users/"
%li
- =link_to t('misc.send_a_bugreport'), URI::escape("https://github.com/amooma/GS5/issues/new?title=Bugreport&body=URL which triggered the bugreport is: #{request.fullpath}\nGS5 buildname: #{(GsParameter.get('GEMEINSCHAFT_BUILDNAME').blank? ? 'unknown' : GsParameter.get('GEMEINSCHAFT_BUILDNAME'))}\n\nPlease provide your bugreport below this line and update the title of this issue to a more specific one.")
+ =link_to t('misc.send_a_bugreport'), URI::escape("https://github.com/amooma/GS5/issues/new?title=Bugreport&body=URL which triggered the bugreport is: #{request.fullpath}\nGS5 buildname: #{(GsParameter.get('GEMEINSCHAFT_BUILDNAME').blank? ? 'unknown' : GsParameter.get('GEMEINSCHAFT_BUILDNAME'))} (#{GsParameter.get('GEMEINSCHAFT_VERSION')})\n\nPlease provide your bugreport below this line and update the title of this issue to a more specific one.")
%li{:class => 'pull-right'}
- = link_to 'brought to you by AMOOMA GmbH', 'http://amooma.de' \ No newline at end of file
+ = link_to '© AMOOMA GmbH', 'http://amooma.de' \ No newline at end of file
diff --git a/app/views/layouts/_navbar.html.haml b/app/views/layouts/_navbar.html.haml
index c2d9946..7084090 100644
--- a/app/views/layouts/_navbar.html.haml
+++ b/app/views/layouts/_navbar.html.haml
@@ -14,18 +14,16 @@
- if current_user && GemeinschaftSetup.any? && current_user.admin?
- if current_page?(page_help_path)
%li.active
- =link_to 'Admin-Doku', page_help_path
+ =link_to t('navigation.admin_docu'), page_help_path
- else
%li
- =link_to 'Admin-Doku', page_help_path
+ =link_to t('navigation.admin_docu'), page_help_path
- if current_user && current_user.sip_accounts.any?
%li
%a{:href => sip_account_call_histories_path(current_user.sip_accounts.first)}
- %i.icon-list-alt.icon-white
=t("call_histories.index.page_title")
%li
%a{:href => sip_account_voicemail_messages_path(current_user.sip_accounts.first)}
- %i.icon-volume-up.icon-white
=t("voicemail_messages.index.page_title")
- if current_user
@@ -48,7 +46,8 @@
%a.navbar-link{:href => tenant_user_path(current_user.current_tenant, current_user)}
= current_user
- %li
- %a.navbar-link{:href => log_out_path}
- %i.icon-off.icon-white
+ - if single_sign_on_system? == false
+ %li
+ %a.navbar-link{:href => log_out_path}
+ %i.icon-off.icon-white
diff --git a/app/views/phone_numbers/_form_core.html.haml b/app/views/phone_numbers/_form_core.html.haml
index a1ce1f3..a0a69db 100644
--- a/app/views/phone_numbers/_form_core.html.haml
+++ b/app/views/phone_numbers/_form_core.html.haml
@@ -4,7 +4,7 @@
= f.input :name, :collection => ['Office', 'Home', 'Mobile', 'Fax'], :include_blank => false, :label => t('phone_numbers.form.name.label'), :hint => conditional_hint('phone_numbers.form.name.hint')
= f.input :number, :label => t('phone_numbers.form.number.label'), :hint => conditional_hint('phone_numbers.form.number.hint'), :autofocus => true
- else
- - if @callthrough || @hunt_group_member || @access_authorization || @current_user.current_tenant.array_of_available_internal_extensions_and_dids.count == 0 || @current_user.current_tenant.array_of_available_internal_extensions_and_dids.count > 250
+ - if @callthrough || @hunt_group_member || @access_authorization || current_user.current_tenant.array_of_available_internal_extensions_and_dids.count == 0 || current_user.current_tenant.array_of_available_internal_extensions_and_dids.count > 250
= f.input :number, :label => t('phone_numbers.form.number.label'), :hint => conditional_hint('phone_numbers.form.number.hint'), :autofocus => true
- else
- = f.input :number, :collection => @current_user.current_tenant.array_of_available_internal_extensions_and_dids, :label => t('phone_numbers.form.number.label'), :hint => conditional_hint('phone_numbers.form.number.hint'), :include_blank => false, :autofocus => true
+ = f.input :number, :collection => current_user.current_tenant.array_of_available_internal_extensions_and_dids, :label => t('phone_numbers.form.number.label'), :hint => conditional_hint('phone_numbers.form.number.hint'), :include_blank => false, :autofocus => true
diff --git a/app/views/phone_numbers/_index_core.html.haml b/app/views/phone_numbers/_index_core.html.haml
index 80a1608..85982da 100644
--- a/app/views/phone_numbers/_index_core.html.haml
+++ b/app/views/phone_numbers/_index_core.html.haml
@@ -1,13 +1,18 @@
%table.table.table-striped
%thead
%tr
+ %th
- if phone_numbers.count > 1 && phone_numbers.first.phone_numberable_type == 'PhoneBookEntry'
%th= t('phone_numbers.index.name')
%th= t('phone_numbers.index.number')
- %tbody
+ %tbody{ :id => "phone_numbers", :'data-update-url' => sort_phone_numbers_url}
- for phone_number in phone_numbers.order(:position)
- %tr
+ = content_tag_for :tr, phone_number do
+ %td
+ - if phone_numbers.count > 1
+ %span.handle
+ %i.icon-resize-vertical
- if phone_number.phone_numberable_type == 'PhoneBookEntry'
%td= phone_number.name
%td= phone_number
diff --git a/app/views/phones/_form_core.html.haml b/app/views/phones/_form_core.html.haml
index 17b9ca8..31f3c24 100644
--- a/app/views/phones/_form_core.html.haml
+++ b/app/views/phones/_form_core.html.haml
@@ -11,5 +11,5 @@
- if defined? GsParameter.get('NIGHTLY_REBOOT_OF_PHONES') && GsParameter.get('NIGHTLY_REBOOT_OF_PHONES') == true
= f.input :nightly_reboot, :label => t('phones.form.nightly_reboot.label'), :hint => conditional_hint('phones.form.nightly_reboot.hint')
- - if !GsParameter.get('PROVISIONING_KEY_LENGTH').nil? && GsParameter.get('PROVISIONING_KEY_LENGTH') > 0
+ - if GsParameter.get('PROVISIONING_KEY_LENGTH') == 0
= f.input :provisioning_key_active, :label => t('phones.form.provisioning_key_active.label'), :hint => conditional_hint('phones.form.provisioning_key_active.hint')
diff --git a/app/views/phones/show.html.haml b/app/views/phones/show.html.haml
index 86ac380..e9b8b21 100644
--- a/app/views/phones/show.html.haml
+++ b/app/views/phones/show.html.haml
@@ -34,7 +34,7 @@
%td
= @phone.nightly_reboot == true ? t('simple_form.yes') : t('simple_form.no')
- - if !GsParameter.get('PROVISIONING_KEY_LENGTH').nil? && GsParameter.get('PROVISIONING_KEY_LENGTH') > 0
+ - if GsParameter.get('PROVISIONING_KEY_LENGTH') == 0
%tr
%td
%strong= t('phones.show.provisioning_key_active') + ":"
diff --git a/app/views/route_elements/_index_core.html.haml b/app/views/route_elements/_index_core.html.haml
index 37c0656..b7d2bc1 100644
--- a/app/views/route_elements/_index_core.html.haml
+++ b/app/views/route_elements/_index_core.html.haml
@@ -1,20 +1,46 @@
%table.table.table-striped
%thead
%tr
- %th= t('route_elements.index.var_in')
- %th= t('route_elements.index.var_out')
+ - if route_elements.count > 1
+ %th
+ %th
+ %span.hidden-phone
+ = t('route_elements.index.var_in')
+ %th
+ %span.hidden-phone
+ = t('route_elements.index.var_out')
%th= t('route_elements.index.pattern')
- %th= t('route_elements.index.replacement')
- %th= t('route_elements.index.action')
- %th= t('route_elements.index.mandatory')
+ %th
+ %span.hidden-phone
+ = t('route_elements.index.replacement')
+ %th
+ %span.hidden-phone
+ = t('route_elements.index.action')
+ %th
+ %span.hidden-phone
+ = t('route_elements.index.mandatory')
- %tbody
+ %tbody{ :id => "route_elements", :'data-update-url' => sort_call_route_route_elements_url(route_elements.first.call_route)}
- for route_element in route_elements
- %tr
- %td= route_element.var_in
- %td= route_element.var_out
+ = content_tag_for :tr, route_element do
+ - if route_elements.count > 1
+ %td
+ %span.handle
+ %i.icon-resize-vertical
+ %td
+ %span.hidden-phone
+ = route_element.var_in
+ %td
+ %span.hidden-phone
+ = route_element.var_out
%td= route_element.pattern
- %td= route_element.replacement
- %td= route_element.action
- %td= route_element.mandatory
+ %td
+ %span.hidden-phone
+ = route_element.replacement
+ %td
+ %span.hidden-phone
+ = route_element.action
+ %td
+ %span.hidden-phone
+ = route_element.mandatory
=render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => @call_route, :child => route_element} \ No newline at end of file
diff --git a/app/views/route_elements/show.html.haml b/app/views/route_elements/show.html.haml
index 808f2a0..937df5e 100644
--- a/app/views/route_elements/show.html.haml
+++ b/app/views/route_elements/show.html.haml
@@ -1,22 +1,37 @@
- content_for :title, t("route_elements.show.page_title")
-%p
- %strong= t('route_elements.show.var_in') + ":"
- = @route_element.var_in
-%p
- %strong= t('route_elements.show.var_out') + ":"
- = @route_element.var_out
-%p
- %strong= t('route_elements.show.pattern') + ":"
- = @route_element.pattern
-%p
- %strong= t('route_elements.show.replacement') + ":"
- = @route_element.replacement
-%p
- %strong= t('route_elements.show.action') + ":"
- = @route_element.action
-%p
- %strong= t('route_elements.show.mandatory') + ":"
- = @route_element.mandatory
+.row
+ .span6
+ %table.table.table-striped
+ %tr
+ %td
+ %strong= t('route_elements.show.var_in') + ":"
+ %td
+ = @route_element.var_in
+ %tr
+ %td
+ %strong= t('route_elements.show.var_out') + ":"
+ %td
+ = @route_element.var_out
+ %tr
+ %td
+ %strong= t('route_elements.show.pattern') + ":"
+ %td
+ = @route_element.pattern
+ %tr
+ %td
+ %strong= t('route_elements.show.replacement') + ":"
+ %td
+ = @route_element.replacement
+ %tr
+ %td
+ %strong= t('route_elements.show.action') + ":"
+ %td
+ = @route_element.action
+ %tr
+ %td
+ %strong= t('route_elements.show.mandatory') + ":"
+ %td
+ = @route_element.mandatory
= render :partial => 'shared/show_edit_destroy_part', :locals => {:parent => @call_route, :child => @route_element } \ No newline at end of file
diff --git a/app/views/shared/_index_view_edit_destroy_part.html.haml b/app/views/shared/_index_view_edit_destroy_part.html.haml
index 6bb1e7b..d396460 100644
--- a/app/views/shared/_index_view_edit_destroy_part.html.haml
+++ b/app/views/shared/_index_view_edit_destroy_part.html.haml
@@ -4,17 +4,20 @@
- if can? :show, child
%a.btn.btn-small.btn-success{:href => method( :"#{parent.class.name.underscore}_#{child.class.name.underscore}_path" ).(parent, child) }
%i.icon-info-sign.icon-white
- =t("#{child.class.name.underscore.pluralize}.index.actions.show")
+ %span.hidden-phone
+ =t("#{child.class.name.underscore.pluralize}.index.actions.show")
- if can? :edit, child
%a.btn.btn-small.btn-warning{:href => method( :"edit_#{parent.class.name.underscore}_#{child.class.name.underscore}_path" ).(parent, child) }
%i.icon-edit.icon-white
- =t("#{child.class.name.underscore.pluralize}.index.actions.edit")
+ %span.hidden-phone
+ =t("#{child.class.name.underscore.pluralize}.index.actions.edit")
- if can? :destroy, child
%a.btn.btn-small.btn-danger{"data-confirm" => t("#{child.class.name.underscore.pluralize}.index.actions.confirm_destroy"), "data-method" => "delete", :href => method( :"#{parent.class.name.underscore}_#{child.class.name.underscore}_path" ).(parent, child), :rel => "nofollow"}
%i.icon-remove.icon-white
- =t("#{child.class.name.underscore.pluralize}.index.actions.destroy")
+ %span.hidden-phone
+ =t("#{child.class.name.underscore.pluralize}.index.actions.destroy")
- elsif !(defined? child).nil?
%td
@@ -22,15 +25,18 @@
- if can? :show, child
%a.btn.btn-small.btn-success{:href => method( :"#{child.class.name.underscore}_path" ).(child) }
%i.icon-info-sign.icon-white
- =t("#{child.class.name.underscore.pluralize}.index.actions.show")
+ %span.hidden-phone
+ =t("#{child.class.name.underscore.pluralize}.index.actions.show")
- if can? :edit, child
%a.btn.btn-small.btn-warning{:href => method( :"edit_#{child.class.name.underscore}_path" ).(child) }
%i.icon-edit.icon-white
- =t("#{child.class.name.underscore.pluralize}.index.actions.edit")
+ %span.hidden-phone
+ =t("#{child.class.name.underscore.pluralize}.index.actions.edit")
- if can? :destroy, child
%a.btn.btn-small.btn-danger{"data-confirm" => t("#{child.class.name.underscore.pluralize}.index.actions.confirm_destroy"), "data-method" => "delete", :href => method( :"#{child.class.name.underscore}_path" ).(child), :rel => "nofollow"}
%i.icon-trash.icon-white
- =t("#{child.class.name.underscore.pluralize}.index.actions.destroy")
+ %span.hidden-phone
+ =t("#{child.class.name.underscore.pluralize}.index.actions.destroy")
\ No newline at end of file
diff --git a/app/views/softkeys/_form_core.html.haml b/app/views/softkeys/_form_core.html.haml
index b833aad..2863d5c 100644
--- a/app/views/softkeys/_form_core.html.haml
+++ b/app/views/softkeys/_form_core.html.haml
@@ -7,6 +7,6 @@
.inputs
= f.input :softkey_function_id, :as => :select, :collection => @softkey_functions.map {|x| [I18n.t("softkeys.functions.#{x}"), x.id] }, :label => t('softkeys.form.function.label'), :hint => conditional_hint('softkeys.form.function.hint'), :include_blank => false
- if @available_call_forwards && @available_call_forwards.count > 0
- = f.association :call_forward, :collection => @available_call_forwards, :label => t('softkeys.form.call_forward.label'), :hint => conditional_hint('softkeys.form.call_forward.hint'), :include_blank => false
+ = f.association :softkeyable, :collection => @available_call_forwards, :label => t('softkeys.form.call_forward.label'), :hint => conditional_hint('softkeys.form.call_forward.hint'), :include_blank => false
= f.input :number, :label => t('softkeys.form.number.label'), :hint => conditional_hint('softkeys.form.number.hint')
= f.input :label, :label => t('softkeys.form.label.label'), :hint => conditional_hint('softkeys.form.label.hint')
diff --git a/app/views/softkeys/_index_core.html.haml b/app/views/softkeys/_index_core.html.haml
index 398ee51..4a06c72 100644
--- a/app/views/softkeys/_index_core.html.haml
+++ b/app/views/softkeys/_index_core.html.haml
@@ -1,15 +1,21 @@
-%table.table.table-striped
- %thead
- %tr
- %th= t('softkeys.index.function')
- %th= t('softkeys.index.number')
- %th= t('softkeys.index.label')
-
- %tbody
- - for softkey in softkeys.order(:position)
+- cache(['softkeys_table', I18n.locale, current_user, softkeys]) do
+ %table.table.table-striped
+ %thead
%tr
- %td
- =softkey.to_s
- %td= softkey.number
- %td= softkey.label
- =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => softkey.sip_account, :child => softkey} \ No newline at end of file
+ %th
+ %th= t('softkeys.index.function')
+ %th= t('softkeys.index.number')
+ %th= t('softkeys.index.label')
+
+ %tbody{ :id => "softkeys", :'data-update-url' => sort_softkeys_url}
+ - for softkey in softkeys
+ - cache(['softkeys_table_tr', I18n.locale, current_user, softkey]) do
+ = content_tag_for :tr, softkey do
+ %td
+ - if softkeys.count > 1
+ %span.handle
+ %i.icon-resize-vertical
+ %td= t("softkeys.functions.#{softkey.softkey_function}")
+ %td= softkey.number
+ %td= softkey.label
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:parent => softkey.sip_account, :child => softkey} \ No newline at end of file
diff --git a/app/views/softkeys/show.html.haml b/app/views/softkeys/show.html.haml
index d0db111..7c068ae 100644
--- a/app/views/softkeys/show.html.haml
+++ b/app/views/softkeys/show.html.haml
@@ -1,7 +1,7 @@
- content_for :title, t("softkeys.show.page_title")
%p
- %strong= t('softkeys.show.function') + ":"
+ %strong= t("softkeys.functions.#{@softkey.softkey_function}") + ":"
=@softkey.to_s
-= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @softkey.sip_account, :child => @softkey } \ No newline at end of file
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :parent => @softkey.sip_account, :child => @softkey }
diff --git a/app/views/system_messages/_form.html.haml b/app/views/system_messages/_form.html.haml
deleted file mode 100644
index 036ee00..0000000
--- a/app/views/system_messages/_form.html.haml
+++ /dev/null
@@ -1,7 +0,0 @@
-= simple_form_for([@user, @system_message]) do |f|
- = f.error_notification
-
- = render "form_core", :f => f
-
- .actions
- = f.button :submit, conditional_t('system_messages.form.submit') \ No newline at end of file
diff --git a/app/views/system_messages/_form_core.html.haml b/app/views/system_messages/_form_core.html.haml
deleted file mode 100644
index a85db28..0000000
--- a/app/views/system_messages/_form_core.html.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-.inputs
- = f.input :content, :label => t('system_messages.form.content.label'), :hint => conditional_hint('system_messages.form.content.hint')
diff --git a/app/views/system_messages/_index_core.html.haml b/app/views/system_messages/_index_core.html.haml
deleted file mode 100644
index 7c9dab5..0000000
--- a/app/views/system_messages/_index_core.html.haml
+++ /dev/null
@@ -1,12 +0,0 @@
-%table.table.table-striped
- %thead
- %tr
- %th= t('system_messages.index.created_at')
- %th= t('system_messages.index.content')
-
- %tbody
- - for system_message in system_messages
- %tr
- %td= system_message.created_at
- %td= system_message.content
- =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => system_message} \ No newline at end of file
diff --git a/app/views/system_messages/index.html.haml b/app/views/system_messages/index.html.haml
deleted file mode 100644
index ffd3fc3..0000000
--- a/app/views/system_messages/index.html.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-- content_for :title, t("system_messages.index.page_title")
-
-= render "index_core", :system_messages => @system_messages \ No newline at end of file
diff --git a/app/views/system_messages/new.html.haml b/app/views/system_messages/new.html.haml
deleted file mode 100644
index 565f5c5..0000000
--- a/app/views/system_messages/new.html.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-- content_for :title, t("system_messages.new.page_title")
-
-= render "form"
diff --git a/app/views/system_messages/show.html.haml b/app/views/system_messages/show.html.haml
deleted file mode 100644
index 70be6f2..0000000
--- a/app/views/system_messages/show.html.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-- content_for :title, t("system_messages.show.page_title")
-
-%p
- %strong= t('system_messages.show.created_at') + ":"
- = @system_message.created_at
-%p
- %strong= t('system_messages.show.content') + ":"
- = @system_message.content
diff --git a/app/views/tenants/_admin_area.html.haml b/app/views/tenants/_admin_area.de.html.haml
index 28a8273..2aed4e1 100644
--- a/app/views/tenants/_admin_area.html.haml
+++ b/app/views/tenants/_admin_area.de.html.haml
@@ -23,7 +23,7 @@
%p
Das System kann
= PhoneModel.count
- verschiedene Telefonmodelle von den folgenden Herstellern verwalten:
+ verschiedene Telefonmodelle von den folgenden Herstellern automatisch provisionieren:
- Manufacturer.all.each do |manufacturer|
- if manufacturer != Manufacturer.last && manufacturer != Manufacturer.limit(Manufacturer.count - 1).last
= succeed ', ' do
@@ -37,4 +37,6 @@
= render :partial => 'call_routes', :locals => {:tenant => tenant}
- = render :partial => 'gateways', :locals => {:tenant => tenant, :gateways => gateways} \ No newline at end of file
+ = render :partial => 'gateways', :locals => {:tenant => tenant, :gateways => gateways}
+
+ = render :partial => 'table_of_backup_jobs', :locals => {:tenant => tenant, :backup_jobs => backup_jobs}
diff --git a/app/views/tenants/_admin_area.en.html.haml b/app/views/tenants/_admin_area.en.html.haml
new file mode 100644
index 0000000..8e7bfea
--- /dev/null
+++ b/app/views/tenants/_admin_area.en.html.haml
@@ -0,0 +1,42 @@
+
+.row
+ .span12
+ = render :partial => 'tenants/table_of_sip_accounts', :locals => {:tenant => tenant}
+ - if SipAccount.any?
+ = render :partial => 'tenants/table_of_phones', :locals => {:tenant => tenant}
+
+ - if SipAccount.any? || Gateway.any?
+ = render :partial => 'tenants/table_of_conferences', :locals => {:tenant => tenant}
+ = render :partial => 'tenants/table_of_callthroughs', :locals => {:tenant => tenant}
+ = render :partial => 'tenants/table_of_hunt_groups', :locals => {:tenant => tenant}
+ = render :partial => 'tenants/table_of_automatic_call_distributors', :locals => {:tenant => tenant}
+
+ = render :partial => 'tenants/users_table', :locals => {:tenant => tenant}
+ = render :partial => 'tenants/user_groups_table', :locals => {:tenant => tenant}
+
+ = render :partial => 'tenants/table_of_phone_books', :locals => {:tenant => tenant}
+
+ .well
+ %h2 Gemeinschaft Configuration
+ = render :partial => 'tenants/gs_parameter_table', :locals => {:tenant => tenant}
+
+ %p
+ This system can provision a total of
+ = PhoneModel.count
+ different phone models of the following manufacturers:
+ - Manufacturer.all.each do |manufacturer|
+ - if manufacturer != Manufacturer.last && manufacturer != Manufacturer.limit(Manufacturer.count - 1).last
+ = succeed ', ' do
+ =link_to link_to Haml::Engine.new("%i.icon-list").render + ' ' + manufacturer, manufacturer_path(manufacturer)
+ - elsif manufacturer == Manufacturer.limit(Manufacturer.count - 1).last
+ = succeed ' and ' do
+ =link_to link_to Haml::Engine.new("%i.icon-list").render + ' ' + manufacturer, manufacturer_path(manufacturer)
+ - else
+ = succeed '.' do
+ =link_to link_to Haml::Engine.new("%i.icon-list").render + ' ' + manufacturer, manufacturer_path(manufacturer)
+
+ = render :partial => 'call_routes', :locals => {:tenant => tenant}
+
+ = render :partial => 'gateways', :locals => {:tenant => tenant, :gateways => gateways}
+
+ = render :partial => 'table_of_backup_jobs', :locals => {:tenant => tenant, :backup_jobs => backup_jobs} \ No newline at end of file
diff --git a/app/views/tenants/_table_of_backup_jobs.html.haml b/app/views/tenants/_table_of_backup_jobs.html.haml
new file mode 100644
index 0000000..a585010
--- /dev/null
+++ b/app/views/tenants/_table_of_backup_jobs.html.haml
@@ -0,0 +1,11 @@
+-# BackupJobs
+-#
+- if (can?( :index, BackupJob ) && backup_jobs.count > 0 ) || can?( :create, BackupJob )
+ - if backup_jobs.count == BackupJob.count
+ %h2= t('backup_jobs.index.page_title')
+ - else
+ %h2= t('backup_jobs.index.page_title_with_limit', :limit => '5')
+
+ - if can?( :index, BackupJob ) && backup_jobs.count > 0
+ = render "backup_jobs/index_core", :backup_jobs => backup_jobs
+ = render :partial => 'shared/create_link', :locals => {:child_class => BackupJob} \ No newline at end of file
diff --git a/app/views/tenants/show.html.haml b/app/views/tenants/show.html.haml
index 818e584..23ec81a 100644
--- a/app/views/tenants/show.html.haml
+++ b/app/views/tenants/show.html.haml
@@ -15,4 +15,4 @@
= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @tenant }
- if @tenant.user_groups.where(:name => 'Admins').any? && @tenant.user_groups.where(:name => 'Admins').first.users.include?(current_user)
- = render :partial => 'admin_area', :locals => { :tenant => @tenant, :gateways => @gateways} \ No newline at end of file
+ = render :partial => 'admin_area', :locals => { :tenant => @tenant, :gateways => @gateways, :backup_jobs => @backup_jobs} \ No newline at end of file