Skip to content

Commit

Permalink
major restructure to separate the xml_curl and admin parts
Browse files Browse the repository at this point in the history
  • Loading branch information
manveru committed Jan 14, 2012
1 parent 5e1761f commit 54f75d9
Show file tree
Hide file tree
Showing 140 changed files with 2,768 additions and 1,227 deletions.
File renamed without changes.
26 changes: 5 additions & 21 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
begin; require 'rubygems'; rescue LoadError; end

require 'rake'
require 'rake/clean'
require 'rubygems/package_task'
require 'time'
Expand All @@ -16,12 +9,11 @@ PROJECT_SPECS = FileList[

PROJECT_MODULE = 'FXC'
PROJECT_README = 'README'
#PROJECT_RUBYFORGE_GROUP_ID = 3034
PROJECT_COPYRIGHT_SUMMARY = [
"# Copyright (c) 2008-#{Time.now.year} The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>",
"# Copyright (c) 2008-#{Time.now.year} The Rubyists, LLC <rubyists@rubyists.com>",
"# Distributed under the terms of the MIT license.",
"# The full text can be found in the LICENSE file included with this software",
"#",
"",
]
PROJECT_COPYRIGHT = PROJECT_COPYRIGHT_SUMMARY + [
"# Permission is hereby granted, free of charge, to any person obtaining a copy",
Expand Down Expand Up @@ -56,18 +48,10 @@ GEMSPEC = Gem::Specification.new{|s|
s.homepage = 'http://code.rubyists.com/projects/fxc'
s.platform = Gem::Platform::RUBY
s.version = (ENV['PROJECT_VERSION'] || (begin;Object.const_get(PROJECT_MODULE)::VERSION;rescue;Date.today.strftime("%Y.%m.%d");end))
s.files = `git ls-files`.split("\n").sort.reject { |f| IGNORE_FILES.detect { |exp| f.match(exp) } }
s.has_rdoc = true
s.files = `git ls-files`.split("\n").sort.
reject{|f| IGNORE_FILES.detect { |exp| f.match(exp) } }
s.has_rdoc = false
s.require_path = 'lib'


s.post_install_message = <<MESSAGE.strip
============================================================
Thank you for installing Fxc!
============================================================
MESSAGE
}

Dir['tasks/*.rake'].each{|f| import(f) }
Expand Down
29 changes: 5 additions & 24 deletions app.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,15 @@
require 'json'
require "innate"
require "ramaze"

require_relative "lib/fxc"

require_relative "options"

require_relative 'node/proxy'
require_relative 'node/directory'
require_relative 'node/dialplan'
require_relative 'node/admin'
require_relative 'node/admin/context'
require_relative 'node/main'
require_relative 'node/context'

require FXC::ROOT/"model/init"
require FXC::ROOT/"lib/rack/middleware"

Innate::Response.options.headers['Content-Type'] = 'freeswitch/xml'
Innate.options.roots = [FXC::ROOT.to_s]
Innate.options.publics = ['/public']

Innate.middleware! do |mw|
mw.use FXC::Rack::Middleware
mw.use Rack::Head
mw.use Rack::ContentLength
mw.use Rack::ShowExceptions
mw.use Rack::CommonLogger, Innate::Log
mw.use Rack::ShowStatus
mw.use Rack::ConditionalGet
mw.innate
end
require_relative 'model/init'

if $0 == __FILE__
Innate.start :root => FXC::ROOT.to_s, :file => __FILE__
Ramaze.start file: __FILE__
end
4 changes: 2 additions & 2 deletions coffee/context.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ loadContent = (root, plural, clear) ->

selectEntry root

$.get "/admin/context/#{plural}/#{id}.json", (data) ->
$.get "/context/#{plural}/#{id}.json", (data) ->
clear.html('')
for row in data
li = $('<li>', id: "#{plural}-#{row.id}")
Expand All @@ -66,7 +66,7 @@ setupLoader = (key, value) ->

postPositionUpdate = (li, position) ->
id = li.attr('id').split('-')[1]
$.post '/admin/context/position_update', {
$.post '/context/position_update', {
id: id,
category: li.closest('td').attr('id'),
position: position,
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/001_create_contexts.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:dialplan_contexts) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/002_create_extensions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:fs_extensions) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/003_create_conditions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:fs_conditions) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/004_create_actions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:fs_actions) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/005_create_anti_actions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:fs_anti_actions) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/006_create_servers.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:servers) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/007_add_server_id_to_contexts.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table(:dialplan_contexts) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/008_add_tod_to_conditions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table(:fs_conditions) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/009_create_providers.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:providers) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/010_create_users.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:users) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/011_create_user_variables.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:user_variables) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/012_add_active_to_users.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table(:users) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/013_add_user_dialstring.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table(:users) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/014_create_targets.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:targets) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/015_add_user_names.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
[:first_name, :last_name].each do |col|
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/016_create_dids.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:dids) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/017_add_did_id.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table(:targets) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/018_comment_schema.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
execute("COMMENT ON TABLE schema_info IS E'Migration info is stored here'")
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/019_add_extension_end_pin.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table(:users) do
Expand Down
10 changes: 3 additions & 7 deletions db/migrate/020_constrain_extensions_to_sanity.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table :users do
add_constraint :extension_is_digits do
add_constraint :extension_is_digits do
:extension.like /^[0-9]+$/
end
add_constraint :pin_is_digits do
end
add_constraint :pin_is_digits do
:pin.like /^([0-9]+)?$/
end
end
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/021_constrain_user_fields.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table :users do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/022_add_context_id_to_user_and_did.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
execute "CREATE FUNCTION lookup_context (TEXT) RETURNS INTEGER AS 'SELECT id FROM dialplan_contexts WHERE name = $1' LANGUAGE SQL"
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/025_create_voicemail_msgs.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:voicemail_msgs) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/026_create_voicemail_prefs.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:voicemail_prefs) do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table(:users) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/028_remove_format_column_from_providers.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table(:providers) do
Expand Down
5 changes: 0 additions & 5 deletions db/migrate/031_add_user_id_to_extension.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@

# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table(:fs_extensions) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrate/032_create_domains.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:domains) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrations/001_create_users.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:users) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrations/002_user_variables.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:user_variables) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrations/003_add_active_to_users.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table(:users) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrations/004_add_user_dialstring.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
alter_table(:users) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrations/005_create_targets.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:targets) do
Expand Down
4 changes: 0 additions & 4 deletions db/migrations/006_add_user_names.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
[:first_name, :last_name].each do |col|
Expand Down
4 changes: 0 additions & 4 deletions db/migrations/007_create_dids.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
# Distributed under the terms of the MIT license.
# The full text can be found in the LICENSE file included with this software
#
Class.new Sequel::Migration do
def up
create_table(:dids) do
Expand Down
Loading

0 comments on commit 54f75d9

Please sign in to comment.