advertnet 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +674 -0
- data/README +257 -0
- data/Rakefile +10 -0
- data/app/controllers/application.rb +40 -0
- data/app/controllers/container_controller.rb +83 -0
- data/app/controllers/content_controller.rb +61 -0
- data/app/controllers/furnitures_controller.rb +87 -0
- data/app/controllers/networks_controller.rb +269 -0
- data/app/controllers/objects_in_world_controller.rb +27 -0
- data/app/controllers/panels_controller.rb +186 -0
- data/app/helpers/application_helper.rb +31 -0
- data/app/helpers/container_helper.rb +2 -0
- data/app/helpers/content_helper.rb +2 -0
- data/app/helpers/furnitures_helper.rb +2 -0
- data/app/helpers/network_helper.rb +2 -0
- data/app/helpers/networks_helper.rb +2 -0
- data/app/helpers/objects_in_world_helper.rb +2 -0
- data/app/helpers/panels_helper.rb +2 -0
- data/app/models/container.rb +51 -0
- data/app/models/furniture.rb +60 -0
- data/app/models/mailer.rb +22 -0
- data/app/models/network.rb +38 -0
- data/app/models/object_in_world.rb +60 -0
- data/app/models/object_off_world.rb +77 -0
- data/app/models/panel.rb +136 -0
- data/app/models/panel_revision.rb +108 -0
- data/app/views/container/list.rhtml +27 -0
- data/app/views/container/show.rhtml +8 -0
- data/app/views/content/_form.rhtml +12 -0
- data/app/views/content/edit.rhtml +8 -0
- data/app/views/content/list.rhtml +26 -0
- data/app/views/content/new.rhtml +8 -0
- data/app/views/furnitures/list.rhtml +51 -0
- data/app/views/furnitures/show.rhtml +7 -0
- data/app/views/layouts/default.rhtml +30 -0
- data/app/views/mailer/avtouch.rhtml +1 -0
- data/app/views/networks/_form.rhtml +11 -0
- data/app/views/networks/_parameters_form.rhtml +8 -0
- data/app/views/networks/edit.rhtml +9 -0
- data/app/views/networks/list.rhtml +25 -0
- data/app/views/networks/new.rhtml +8 -0
- data/app/views/networks/show.rhtml +72 -0
- data/app/views/networks/show_parameters_form.rjs +5 -0
- data/app/views/objects_in_world/list.rhtml +30 -0
- data/app/views/objects_in_world/show.rhtml +8 -0
- data/app/views/panels/list.rhtml +48 -0
- data/app/views/panels/show.rhtml +8 -0
- data/bin/advertnet-install +144 -0
- data/config/boot.rb +45 -0
- data/config/database.yml.default +43 -0
- data/config/environment.rb +67 -0
- data/config/environments/development.rb +21 -0
- data/config/environments/production.rb +21 -0
- data/config/environments/test.rb +19 -0
- data/config/routes.rb +23 -0
- data/db/migrate/001_create_networks.rb +14 -0
- data/db/migrate/002_create_furnitures.rb +17 -0
- data/db/migrate/003_create_containers.rb +16 -0
- data/db/migrate/004_create_objects_in_world.rb +16 -0
- data/db/migrate/005_create_objects_off_world.rb +16 -0
- data/db/migrate/006_create_panels.rb +17 -0
- data/db/migrate/007_join_objects_in_world_panels.rb +17 -0
- data/db/migrate/008_join_objects_off_world_panels.rb +17 -0
- data/db/migrate/009_add_sessions.rb +19 -0
- data/db/migrate/010_add_or_rename_fields.rb +25 -0
- data/db/migrate/011_move_texture_to_object_in_world.rb +25 -0
- data/db/migrate/012_add_permanent_furniture_id.rb +18 -0
- data/db/migrate/013_create_panel_revisions.rb +42 -0
- data/db/schema.rb +102 -0
- data/doc/README_FOR_APP +108 -0
- data/lib/advertnet.rb +13 -0
- data/lib/second_life_validators.rb +89 -0
- data/lib/tasks/documentation.rake +16 -0
- data/lib/tasks/extract_fixtures.rake +23 -0
- data/lib/tasks/load_exported_fixtures.rake +14 -0
- data/public/404.html +30 -0
- data/public/500.html +30 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/rails.png +0 -0
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/controls.js +833 -0
- data/public/javascripts/dragdrop.js +942 -0
- data/public/javascripts/effects.js +1088 -0
- data/public/javascripts/prototype.js +2515 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/application.css +25 -0
- data/public/stylesheets/scaffold.css +74 -0
- data/script/about +3 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/plugin +3 -0
- data/script/process/inspector +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/test/fixtures/containers.yml +44 -0
- data/test/fixtures/furnitures.yml +47 -0
- data/test/fixtures/mailer/avtouch +1 -0
- data/test/fixtures/networks.yml +31 -0
- data/test/fixtures/objects_in_world.yml +71 -0
- data/test/fixtures/objects_in_world_panels.yml +43 -0
- data/test/fixtures/objects_off_world.yml +55 -0
- data/test/fixtures/objects_off_world_panels.yml +20 -0
- data/test/fixtures/panel_revisions.yml +28 -0
- data/test/fixtures/panels.yml +79 -0
- data/test/functional/container_controller_test.rb +167 -0
- data/test/functional/content_controller_test.rb +91 -0
- data/test/functional/furnitures_controller_test.rb +134 -0
- data/test/functional/networks_controller_test.rb +248 -0
- data/test/functional/objects_in_world_controller_test.rb +42 -0
- data/test/functional/panels_controller_test.rb +173 -0
- data/test/test_helper.rb +53 -0
- data/test/unit/container_test.rb +53 -0
- data/test/unit/furniture_test.rb +68 -0
- data/test/unit/mailer_test.rb +40 -0
- data/test/unit/network_test.rb +42 -0
- data/test/unit/object_in_world_test.rb +33 -0
- data/test/unit/object_off_world_test.rb +26 -0
- data/test/unit/panel_revision_test.rb +148 -0
- data/test/unit/panel_test.rb +63 -0
- data/vendor/plugins/annotate_models/ChangeLog +46 -0
- data/vendor/plugins/annotate_models/README +31 -0
- data/vendor/plugins/annotate_models/lib/annotate_models.rb +132 -0
- data/vendor/plugins/annotate_models/tasks/annotate_models_tasks.rake +7 -0
- data/vendor/plugins/foreign_key_migrations/CHANGELOG +99 -0
- data/vendor/plugins/foreign_key_migrations/MIT-LICENSE +20 -0
- data/vendor/plugins/foreign_key_migrations/README +87 -0
- data/vendor/plugins/foreign_key_migrations/about.yml +5 -0
- data/vendor/plugins/foreign_key_migrations/init.rb +3 -0
- data/vendor/plugins/foreign_key_migrations/install.rb +1 -0
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/base.rb +22 -0
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/abstract_adapter.rb +22 -0
- data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/table_definition.rb +28 -0
- data/vendor/plugins/redhillonrails_core/CHANGELOG +154 -0
- data/vendor/plugins/redhillonrails_core/MIT-LICENSE +20 -0
- data/vendor/plugins/redhillonrails_core/README +139 -0
- data/vendor/plugins/redhillonrails_core/init.rb +19 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/base.rb +54 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/abstract_adapter.rb +31 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/column.rb +21 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/foreign_key_definition.rb +26 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/index_definition.rb +11 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_adapter.rb +82 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_column.rb +8 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/postgresql_adapter.rb +107 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/schema_statements.rb +23 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/sqlite3_adapter.rb +9 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/table_definition.rb +27 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema.rb +27 -0
- data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema_dumper.rb +47 -0
- metadata +290 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
|
2
|
+
|
|
3
|
+
# The test environment is used exclusively to run your application's
|
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
7
|
+
config.cache_classes = true
|
|
8
|
+
|
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
|
10
|
+
config.whiny_nils = true
|
|
11
|
+
|
|
12
|
+
# Show full error reports and disable caching
|
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
|
14
|
+
config.action_controller.perform_caching = false
|
|
15
|
+
|
|
16
|
+
# Tell ActionMailer not to deliver emails to the real world.
|
|
17
|
+
# The :test delivery method accumulates sent emails in the
|
|
18
|
+
# ActionMailer::Base.deliveries array.
|
|
19
|
+
config.action_mailer.delivery_method = :test
|
data/config/routes.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
|
2
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
|
3
|
+
|
|
4
|
+
# Sample of regular route:
|
|
5
|
+
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
|
6
|
+
# Keep in mind you can assign values other than :controller and :action
|
|
7
|
+
|
|
8
|
+
# Sample of named route:
|
|
9
|
+
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
|
10
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
|
11
|
+
|
|
12
|
+
# You can have the root of your site routed by hooking up ''
|
|
13
|
+
# -- just remember to delete public/index.html.
|
|
14
|
+
map.connect '', :controller => 'networks'
|
|
15
|
+
|
|
16
|
+
# Allow downloading Web Service WSDL as a file with an extension
|
|
17
|
+
# instead of a file named 'wsdl'
|
|
18
|
+
map.connect ':controller/service.wsdl', :action => 'wsdl'
|
|
19
|
+
|
|
20
|
+
# Install the default route as the lowest priority.
|
|
21
|
+
map.connect ':controller/:action/:id.:format'
|
|
22
|
+
map.connect ':controller/:action/:id'
|
|
23
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class CreateNetworks < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :networks do |t|
|
|
4
|
+
t.column :name, :string, :limit => 64, :null => false
|
|
5
|
+
t.column :active, :boolean, :null => false, :default => true
|
|
6
|
+
t.column :created_at, :datetime
|
|
7
|
+
t.column :updated_at, :datetime
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.down
|
|
12
|
+
drop_table :networks
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class CreateFurnitures < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :furnitures do |t|
|
|
4
|
+
t.column :name, :string, :limit => 64, :null => false
|
|
5
|
+
t.column :furniture_key, :string, :limit => 36, :null => false
|
|
6
|
+
t.column :sim, :string, :limit => 64, :null => false
|
|
7
|
+
t.column :position, :string, :limit => 40, :null => false
|
|
8
|
+
t.column :delay, :integer, :null => false, :default => 30
|
|
9
|
+
t.column :created_at, :datetime
|
|
10
|
+
t.column :updated_at, :datetime
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.down
|
|
15
|
+
drop_table :furnitures
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class CreateContainers < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :containers do |t|
|
|
4
|
+
t.column :container_key, :string, :limit => 64, :null => false
|
|
5
|
+
t.column :sim, :string, :limit => 64, :null => false
|
|
6
|
+
t.column :position, :string, :limit => 40, :null => false
|
|
7
|
+
t.column :delay, :integer, :null => false, :default => 30
|
|
8
|
+
t.column :created_at, :datetime
|
|
9
|
+
t.column :updated_at, :datetime
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.down
|
|
14
|
+
drop_table :containers
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class CreateObjectsInWorld < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :objects_in_world do |t|
|
|
4
|
+
t.column :name, :string, :limit => 64, :null => false
|
|
5
|
+
t.column :object_key, :string, :limit => 36, :null => false
|
|
6
|
+
t.column :type, :string, :limit => 16, :null => false
|
|
7
|
+
t.column :container_id, :integer, :null => false, :on_update => :cascade, :on_delete => :restrict
|
|
8
|
+
t.column :created_at, :datetime
|
|
9
|
+
t.column :updated_at, :datetime
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.down
|
|
14
|
+
drop_table :objects_in_world
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class CreateObjectsOffWorld < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :objects_off_world do |t|
|
|
4
|
+
t.column :name, :string, :limit => 64, :null => false
|
|
5
|
+
t.column :object_key, :string, :limit => 36, :null => false
|
|
6
|
+
t.column :type, :string, :limit => 16, :null => false
|
|
7
|
+
t.column :content, :text
|
|
8
|
+
t.column :created_at, :datetime
|
|
9
|
+
t.column :updated_at, :datetime
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.down
|
|
14
|
+
drop_table :objects_off_world
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class CreatePanels < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :panels do |t|
|
|
4
|
+
t.column :name, :string, :limit => 64, :null => false
|
|
5
|
+
t.column :panel_key, :string, :limit => 36, :null => false
|
|
6
|
+
t.column :picture, :string, :limit => 36, :null => false
|
|
7
|
+
t.column :furniture_id, :integer, :null => false, :on_update => :cascade, :on_delete => :restrict
|
|
8
|
+
t.column :network_id, :integer, :null => true, :on_update => :cascade, :on_delete => :set_null
|
|
9
|
+
t.column :created_at, :datetime
|
|
10
|
+
t.column :updated_at, :datetime
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.down
|
|
15
|
+
drop_table :panels
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Table de jointure entre les modèles ObjectInWorld et Panel
|
|
2
|
+
class JoinObjectsInWorldPanels < ActiveRecord::Migration
|
|
3
|
+
def self.up
|
|
4
|
+
create_table :objects_in_world_panels, :id => false do |t|
|
|
5
|
+
t.column :panel_id, :integer, :null => false,
|
|
6
|
+
:on_update => :cascade, :on_delete => :cascade
|
|
7
|
+
# Attention au pluriel du nom de la table étrangère
|
|
8
|
+
t.column :object_in_world_id, :integer, :null => false,
|
|
9
|
+
:references => :objects_in_world,
|
|
10
|
+
:on_update => :cascade, :on_delete => :cascade
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.down
|
|
15
|
+
drop_table :objects_in_world_panels
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Table de jointure entre les modèles ObjectOffWorld et Panel
|
|
2
|
+
class JoinObjectsOffWorldPanels < ActiveRecord::Migration
|
|
3
|
+
def self.up
|
|
4
|
+
create_table :objects_off_world_panels, :id => false do |t|
|
|
5
|
+
t.column :panel_id, :integer, :null => false,
|
|
6
|
+
:on_update => :cascade, :on_delete => :cascade
|
|
7
|
+
# Attention au pluriel du nom de la table étrangère
|
|
8
|
+
t.column :object_off_world_id, :integer, :null => false,
|
|
9
|
+
:references => :objects_off_world,
|
|
10
|
+
:on_update => :cascade, :on_delete => :cascade
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.down
|
|
15
|
+
drop_table :objects_off_world_panels
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class AddSessions < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
create_table :sessions do |t|
|
|
4
|
+
# Attention : comme on utilise le plugin Foreign Key Migration, qui utilisent
|
|
5
|
+
# les champs dont le nom se finit par "_id" on doit explicitement signaler que
|
|
6
|
+
# ce champs n'est pas une clé étrangère.
|
|
7
|
+
t.column :session_id, :string, :references => nil
|
|
8
|
+
t.column :data, :text
|
|
9
|
+
t.column :updated_at, :datetime
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
add_index :sessions, :session_id
|
|
13
|
+
add_index :sessions, :updated_at
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.down
|
|
17
|
+
drop_table :sessions
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
class AddOrRenameFields < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
# Champ 'name' manquant. On veut qu'elle soit ajoutée après le champ 'sim'
|
|
4
|
+
# Cette commande ne convient pas : add_column :containers, :name, :string, :limit => 64, :null => false
|
|
5
|
+
say_with_time("Adding column 'name' to 'containers'") do
|
|
6
|
+
execute "ALTER TABLE containers ADD COLUMN `name` VARCHAR(64) NOT NULL AFTER `sim`"
|
|
7
|
+
end
|
|
8
|
+
# Le champ 'type' est réservé par Rails
|
|
9
|
+
# Attention, Rails perd les attributs d'une colonne renommée !!! On doit les remettre à la main.
|
|
10
|
+
rename_column :objects_in_world, :type, :otype
|
|
11
|
+
change_column :objects_in_world, :otype, :string, :limit => 16, :null => false
|
|
12
|
+
rename_column :objects_off_world, :type, :otype
|
|
13
|
+
change_column :objects_off_world, :otype, :string, :limit => 16, :null => false
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.down
|
|
17
|
+
remove_column :containers, :name
|
|
18
|
+
# Idem ici, en théorie même s'il y a peut de chance qu'on fasse une migration arrière,
|
|
19
|
+
# il faudrait redonner les attributs perdus lors du renommage.
|
|
20
|
+
rename_column :objects_in_world, :otype, :type
|
|
21
|
+
change_column :objects_in_world, :type, :string, :limit => 16, :null => false
|
|
22
|
+
rename_column :objects_off_world, :otype, :type
|
|
23
|
+
change_column :objects_off_world, :type, :string, :limit => 16, :null => false
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Déplace le contenu du champ "picture" de la table Panel dans la relation +hatm+ liant
|
|
2
|
+
# Panel à ObjectInWorld.
|
|
3
|
+
#
|
|
4
|
+
# Le codage de la texture d'un panneau n'a pas besoin d'avoir un statut particulier, qui
|
|
5
|
+
# rend en plus la programmation moins générique.
|
|
6
|
+
class MoveTextureToObjectInWorld < ActiveRecord::Migration
|
|
7
|
+
def self.up
|
|
8
|
+
panels = Panel.find(:all)
|
|
9
|
+
panels.each do |p|
|
|
10
|
+
# Suppression d'une ancienne texture liée, si nécessaire.
|
|
11
|
+
old_texture = p.objects_in_world.find_by_otype("texture")
|
|
12
|
+
p.objects_in_world.delete(old_texture) if old_texture
|
|
13
|
+
# Transfert de "picture" en texture liée. On ne crée pas l'objet, on sait qu'il existe déjà.
|
|
14
|
+
new_texture = ObjectInWorld.find_by_object_key(p.picture)
|
|
15
|
+
p.objects_in_world << new_texture
|
|
16
|
+
end
|
|
17
|
+
remove_column :panels, :picture
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.down
|
|
21
|
+
# Cette migration retour est incomplète car elle ne restaure pas les données, mais
|
|
22
|
+
# ce n'est pas grave car elle ne devrait jamais servir.
|
|
23
|
+
add_column :panels, :picture, :string, :limit => 36, :null => false
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
class AddPermanentFurnitureId < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
# Ce champ stocke l'ID permanent du mobilier urbain, qu'il faudra conserver
|
|
4
|
+
# à chaque fois que le mobilier est supprimé puis recréé dans SL.
|
|
5
|
+
# Attention : comme on utilise le plugin Foreign Key Migration, qui utilisent
|
|
6
|
+
# les champs dont le nom se finit par "_id" on doit explicitement signaler que
|
|
7
|
+
# ce champs n'est pas une clé étrangère.
|
|
8
|
+
add_column :furnitures, :permanent_id, :integer, :references => nil
|
|
9
|
+
Furniture.find(:all).each { |f|
|
|
10
|
+
f.permanent_id = f.id
|
|
11
|
+
f.save
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.down
|
|
16
|
+
remove_column :furnitures, :permanent_id
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
class CreatePanelRevisions < ActiveRecord::Migration
|
|
2
|
+
def self.up
|
|
3
|
+
# La table d'historique des panneaux n'a pas de clé primaire
|
|
4
|
+
create_table :panel_revisions, :id => false do |t|
|
|
5
|
+
# Identifiant unique de mobilier
|
|
6
|
+
t.column :permanent_id, :integer, :references => nil
|
|
7
|
+
# Attributs de panneau
|
|
8
|
+
t.column :panel_name, :string, :limit => 64, :null => false
|
|
9
|
+
t.column :panel_key, :string, :limit => 36, :null => false
|
|
10
|
+
# Attributs de mobilier
|
|
11
|
+
t.column :furniture_name, :string, :limit => 64, :null => false
|
|
12
|
+
t.column :furniture_key, :string, :limit => 36, :null => false
|
|
13
|
+
# Attributs de réseau
|
|
14
|
+
t.column :network_name, :string, :limit => 64
|
|
15
|
+
t.column :network_status, :boolean
|
|
16
|
+
# Attributs de texture
|
|
17
|
+
t.column :texture_name, :string, :limit => 64
|
|
18
|
+
t.column :texture_key, :string, :limit => 36
|
|
19
|
+
# Attributs de Landmark
|
|
20
|
+
t.column :landmark_name, :string, :limit => 64
|
|
21
|
+
t.column :landmark_key, :string, :limit => 36
|
|
22
|
+
# Attributs de Notecard
|
|
23
|
+
t.column :notecard_name, :string, :limit => 64
|
|
24
|
+
t.column :notecard_key, :string, :limit => 36
|
|
25
|
+
# Attributs de URL
|
|
26
|
+
t.column :url_name, :string, :limit => 64
|
|
27
|
+
t.column :url_content, :text
|
|
28
|
+
# Attributs de Media URL
|
|
29
|
+
t.column :mediaurl_name, :string, :limit => 64
|
|
30
|
+
t.column :mediaurl_content, :text
|
|
31
|
+
# Position dans Second Life
|
|
32
|
+
t.column :sim, :string, :limit => 64, :null => false
|
|
33
|
+
t.column :position, :string, :limit => 40, :null => false
|
|
34
|
+
# Date de création/modification de la révision
|
|
35
|
+
t.column :created_at, :datetime
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.down
|
|
40
|
+
drop_table :panel_revisions
|
|
41
|
+
end
|
|
42
|
+
end
|
data/db/schema.rb
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# This file is autogenerated. Instead of editing this file, please use the
|
|
2
|
+
# migrations feature of ActiveRecord to incrementally modify your database, and
|
|
3
|
+
# then regenerate this schema definition.
|
|
4
|
+
|
|
5
|
+
ActiveRecord::Schema.define(:version => 11) do
|
|
6
|
+
|
|
7
|
+
create_table "containers", :force => true do |t|
|
|
8
|
+
t.column "container_key", :string, :limit => 64, :null => false
|
|
9
|
+
t.column "sim", :string, :limit => 64, :null => false
|
|
10
|
+
t.column "name", :string, :limit => 64, :null => false
|
|
11
|
+
t.column "position", :string, :limit => 40, :null => false
|
|
12
|
+
t.column "delay", :integer, :default => 30, :null => false
|
|
13
|
+
t.column "created_at", :datetime
|
|
14
|
+
t.column "updated_at", :datetime
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
create_table "furnitures", :force => true do |t|
|
|
18
|
+
t.column "name", :string, :limit => 64, :null => false
|
|
19
|
+
t.column "furniture_key", :string, :limit => 36, :null => false
|
|
20
|
+
t.column "sim", :string, :limit => 64, :null => false
|
|
21
|
+
t.column "position", :string, :limit => 40, :null => false
|
|
22
|
+
t.column "delay", :integer, :default => 30, :null => false
|
|
23
|
+
t.column "created_at", :datetime
|
|
24
|
+
t.column "updated_at", :datetime
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
create_table "networks", :force => true do |t|
|
|
28
|
+
t.column "name", :string, :limit => 64, :null => false
|
|
29
|
+
t.column "active", :boolean, :default => true, :null => false
|
|
30
|
+
t.column "created_at", :datetime
|
|
31
|
+
t.column "updated_at", :datetime
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
create_table "objects_in_world", :force => true do |t|
|
|
35
|
+
t.column "name", :string, :limit => 64, :null => false
|
|
36
|
+
t.column "object_key", :string, :limit => 36, :null => false
|
|
37
|
+
t.column "otype", :string, :limit => 16, :null => false
|
|
38
|
+
t.column "container_id", :integer, :null => false
|
|
39
|
+
t.column "created_at", :datetime
|
|
40
|
+
t.column "updated_at", :datetime
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
add_index "objects_in_world", ["container_id"], :name => "container_id"
|
|
44
|
+
|
|
45
|
+
create_table "objects_in_world_panels", :id => false, :force => true do |t|
|
|
46
|
+
t.column "panel_id", :integer, :null => false
|
|
47
|
+
t.column "object_in_world_id", :integer, :null => false
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
add_index "objects_in_world_panels", ["panel_id"], :name => "panel_id"
|
|
51
|
+
add_index "objects_in_world_panels", ["object_in_world_id"], :name => "object_in_world_id"
|
|
52
|
+
|
|
53
|
+
create_table "objects_off_world", :force => true do |t|
|
|
54
|
+
t.column "name", :string, :limit => 64, :null => false
|
|
55
|
+
t.column "object_key", :string, :limit => 36, :null => false
|
|
56
|
+
t.column "otype", :string, :limit => 16, :null => false
|
|
57
|
+
t.column "content", :text
|
|
58
|
+
t.column "created_at", :datetime
|
|
59
|
+
t.column "updated_at", :datetime
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
create_table "objects_off_world_panels", :id => false, :force => true do |t|
|
|
63
|
+
t.column "panel_id", :integer, :null => false
|
|
64
|
+
t.column "object_off_world_id", :integer, :null => false
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
add_index "objects_off_world_panels", ["panel_id"], :name => "panel_id"
|
|
68
|
+
add_index "objects_off_world_panels", ["object_off_world_id"], :name => "object_off_world_id"
|
|
69
|
+
|
|
70
|
+
create_table "panels", :force => true do |t|
|
|
71
|
+
t.column "name", :string, :limit => 64, :null => false
|
|
72
|
+
t.column "panel_key", :string, :limit => 36, :null => false
|
|
73
|
+
t.column "furniture_id", :integer, :null => false
|
|
74
|
+
t.column "network_id", :integer
|
|
75
|
+
t.column "created_at", :datetime
|
|
76
|
+
t.column "updated_at", :datetime
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
add_index "panels", ["furniture_id"], :name => "furniture_id"
|
|
80
|
+
add_index "panels", ["network_id"], :name => "network_id"
|
|
81
|
+
|
|
82
|
+
create_table "sessions", :force => true do |t|
|
|
83
|
+
t.column "session_id", :string
|
|
84
|
+
t.column "data", :text
|
|
85
|
+
t.column "updated_at", :datetime
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
|
|
89
|
+
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
|
|
90
|
+
|
|
91
|
+
add_foreign_key "objects_in_world", ["container_id"], "containers", ["id"], :on_update => :cascade, :name => "objects_in_world_ibfk_1"
|
|
92
|
+
|
|
93
|
+
add_foreign_key "objects_in_world_panels", ["panel_id"], "panels", ["id"], :on_update => :cascade, :on_delete => :cascade, :name => "objects_in_world_panels_ibfk_1"
|
|
94
|
+
add_foreign_key "objects_in_world_panels", ["object_in_world_id"], "objects_in_world", ["id"], :on_update => :cascade, :on_delete => :cascade, :name => "objects_in_world_panels_ibfk_2"
|
|
95
|
+
|
|
96
|
+
add_foreign_key "objects_off_world_panels", ["panel_id"], "panels", ["id"], :on_update => :cascade, :on_delete => :cascade, :name => "objects_off_world_panels_ibfk_1"
|
|
97
|
+
add_foreign_key "objects_off_world_panels", ["object_off_world_id"], "objects_off_world", ["id"], :on_update => :cascade, :on_delete => :cascade, :name => "objects_off_world_panels_ibfk_2"
|
|
98
|
+
|
|
99
|
+
add_foreign_key "panels", ["furniture_id"], "furnitures", ["id"], :on_update => :cascade, :name => "panels_ibfk_1"
|
|
100
|
+
add_foreign_key "panels", ["network_id"], "networks", ["id"], :on_update => :cascade, :on_delete => :set_null, :name => "panels_ibfk_2"
|
|
101
|
+
|
|
102
|
+
end
|
data/doc/README_FOR_APP
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
= Webia / Réseaupub
|
|
2
|
+
|
|
3
|
+
== Description
|
|
4
|
+
|
|
5
|
+
Cette application sert à la gestion du réseau de panneaux publicitaires *Webia*
|
|
6
|
+
dans Second Life.
|
|
7
|
+
|
|
8
|
+
L'application, écrite en Ruby on Rails, fournit une interface web d'administration
|
|
9
|
+
du réseau de panneaux, ainsi qu'une interface de type <em>Web Services</em>, qui
|
|
10
|
+
répond aux requêtes, écrites en LSL, des objets Second Life.
|
|
11
|
+
|
|
12
|
+
== Auteurs / Licence
|
|
13
|
+
|
|
14
|
+
Copyright (C) 2007 Community Chest
|
|
15
|
+
|
|
16
|
+
Auteurs :
|
|
17
|
+
* Farzad FARID <ffarid@pramatic-source.com>
|
|
18
|
+
* Yves Rougy <yrougy@gmail.com>
|
|
19
|
+
|
|
20
|
+
Le code de cette application est diffusé sous licence GPL 2 ou supérieure :
|
|
21
|
+
|
|
22
|
+
This program is free software; you can redistribute it and/or modify
|
|
23
|
+
it under the terms of the GNU General Public License as published by
|
|
24
|
+
the Free Software Foundation; either version 2 of the License, or
|
|
25
|
+
(at your option) any later version.
|
|
26
|
+
|
|
27
|
+
This program is distributed in the hope that it will be useful,
|
|
28
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
29
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
30
|
+
GNU General Public License for more details.
|
|
31
|
+
|
|
32
|
+
You should have received a copy of the GNU General Public License
|
|
33
|
+
along with this program; if not, write to the Free Software
|
|
34
|
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
35
|
+
|
|
36
|
+
== Extensions utilisées
|
|
37
|
+
|
|
38
|
+
Ce projet utilise les plugins suivants :
|
|
39
|
+
+annotate_models+ ::
|
|
40
|
+
Ajoute une tâche Rake qui ajoute en commentaire aux modèles la structure de données.
|
|
41
|
+
+redhillonrails_core+ ::
|
|
42
|
+
Plugin de base pour +foreign_key_migrations+
|
|
43
|
+
+foreign_key_migrations+ ::
|
|
44
|
+
Ajout le support de la création automatique des clés étrangères dans les migrations.
|
|
45
|
+
|
|
46
|
+
== Librairies et tâches maison
|
|
47
|
+
|
|
48
|
+
=== Tâches
|
|
49
|
+
|
|
50
|
+
Les tâches sont installées dans <tt>lib/tasks</tt> ou dans <tt>vendors/plugins</tt>.
|
|
51
|
+
|
|
52
|
+
<tt>documentation</tt> ::
|
|
53
|
+
La tâche <tt>doc:app</tt> ne supporte pas les accents UTF-8 ! C'est pourquoi elle a été
|
|
54
|
+
dupliquée en locale et modifiée pour appeler +rdoc+ avec le charset UTF-8.
|
|
55
|
+
Un bug report a été ouvert sur Rails : http://dev.rubyonrails.org/ticket/8906.
|
|
56
|
+
Fournit la tâche <tt>doc:app_utf8</tt>.
|
|
57
|
+
<tt>extract_fixtures</tt> ::
|
|
58
|
+
Tâche tirée du livre "Rails Recipes", extrait les données des tables sous forme de
|
|
59
|
+
fixtures, dans le répertoire <tt>db/exported_fixtures</tt>.
|
|
60
|
+
Fournit la tâche <tt>db:fixtures:extract_fixtures</tt>. *RAILS_ENV* détermine la base
|
|
61
|
+
qui sera dumpée.
|
|
62
|
+
<tt>load_exported_fixtures</tt> ::
|
|
63
|
+
L'opération inverse, avec les mêmes données, qui sont importées dans la base.
|
|
64
|
+
Fournit la tâche <b>db:fixtures:load_extracted_fixtures</b>. *RAILS_ENV* détermine la base
|
|
65
|
+
qui sera dumpée. Si la variable d'environnement <b>FIXTURES=fichier1,fichier2,...</b> est fournie,
|
|
66
|
+
les fichiers passés en paramètres seront utilisés, sinon la tâche utilise les fichiers
|
|
67
|
+
du répertoire <tt>db/exported_fixtures</tt>.
|
|
68
|
+
<tt>annotate_models</tt> ::
|
|
69
|
+
Lancer cette tâche après toute modification des modèles. La tâche modifie tous les fichiers
|
|
70
|
+
décrivant les modèles de la base de données, en y ajoutant des commentaires décrivant le
|
|
71
|
+
modèle physique de chaque table.
|
|
72
|
+
Si la base est modifiée, alors les commentaires et le numéro de version seront modifiés aussi, ce
|
|
73
|
+
qui nécessitera de refaire un commit SVN.
|
|
74
|
+
*IMPORTANT* : Lors de modification ou déplacement de bloc de commentaires dans la documentation des modèles, il faut
|
|
75
|
+
penser à conserver une ligne vide après la dernière ligne "<tt>#</tt>" du bloc ajouté par +annotate_models+.
|
|
76
|
+
|
|
77
|
+
=== Librairies
|
|
78
|
+
|
|
79
|
+
La librairie SecondLifeSimPosNormalizer contient des validateurs pour Second Life. Voir la page de
|
|
80
|
+
SecondLifeSimPosNormalizer pour plus d'informations.
|
|
81
|
+
|
|
82
|
+
== Bugs et points importants
|
|
83
|
+
|
|
84
|
+
<b>ATTENTION AUX POINTS SUIVANTS</b>
|
|
85
|
+
|
|
86
|
+
=== Support des clés étrangères dans les tests
|
|
87
|
+
|
|
88
|
+
<tt>rake db:test:prepare</tt> ne copie pas les contraintes de clés étrangères dans la base <tt>*_test</tt>
|
|
89
|
+
si on garde <tt>:ruby</tt> comme schéma pour les dumps.
|
|
90
|
+
Il faut configurer le projet pour qu'il fasse les dumps au format SQL au lieu de Ruby.
|
|
91
|
+
Voir '<tt>config.active_record.schema_format = :sql</tt>' dans <tt>environment.rb</tt>.
|
|
92
|
+
|
|
93
|
+
=== Renommage de colonnes
|
|
94
|
+
|
|
95
|
+
Quand on renomme une colonne dans une migration (avec +rename_column+, on perd tous les attributs
|
|
96
|
+
(null, default..). Il faut remettre les attributs à la main avec +change_column+, on bien ne pas
|
|
97
|
+
utilisation les migrations.
|
|
98
|
+
|
|
99
|
+
=== Ajout de colonnes
|
|
100
|
+
|
|
101
|
+
De même, les migrations (avec +add_column+) ne permettent d'ajouter la colonne qu'en dernière position.
|
|
102
|
+
Il faut utiliser +execute+ et une commande SQL pour choisir l'emplacement de la nouvelle colonne.
|
|
103
|
+
|
|
104
|
+
== Installation
|
|
105
|
+
|
|
106
|
+
=== Génération de la documentation
|
|
107
|
+
|
|
108
|
+
Lancer '<tt>rake doc:app_utf8</tt>' pour génération la documentation à partir des sources du projet.
|