parlement 0.10 → 0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/CHANGES +11 -0
  2. data/MEMORY +9 -1
  3. data/README +5 -4
  4. data/app/controllers/account_controller.rb +10 -13
  5. data/app/controllers/application.rb +4 -5
  6. data/app/controllers/elt_controller.rb +9 -7
  7. data/app/controllers/person_controller.rb +1 -3
  8. data/app/controllers/subscriber_controller.rb +10 -10
  9. data/app/helpers/elt_helper.rb +2 -0
  10. data/app/models/elt.rb +28 -19
  11. data/app/models/mail.rb +26 -14
  12. data/app/models/mail_notify.rb +5 -4
  13. data/app/models/person.rb +11 -2
  14. data/app/views/account/_login.rhtml +3 -3
  15. data/app/views/account/_show.rhtml +12 -14
  16. data/app/views/elt/_choice.rhtml +3 -3
  17. data/app/views/elt/_elt.rhtml +4 -4
  18. data/app/views/elt/_list.rhtml +2 -2
  19. data/app/views/elt/_listByDate.rhtml +1 -1
  20. data/app/views/elt/_listByVote.rhtml +1 -1
  21. data/app/views/elt/new.rhtml +3 -3
  22. data/app/views/elt/show.rhtml +2 -2
  23. data/app/views/layouts/top.rhtml +6 -0
  24. data/app/views/mail_notify/publish.text.html.rhtml +1 -1
  25. data/app/views/person/_listElts.rhtml +5 -3
  26. data/app/views/person/show.rhtml +1 -2
  27. data/config/boot.rb +5 -4
  28. data/config/environment.rb +6 -4
  29. data/config/routes.rb +3 -2
  30. data/db/development_structure.sql +15 -4
  31. data/db/migrate/006_last_activity.rb +10 -0
  32. data/db/schema.rb +67 -49
  33. data/public/dispatch.fcgi +1 -0
  34. data/public/javascripts/controls.js +41 -23
  35. data/public/javascripts/dragdrop.js +317 -99
  36. data/public/javascripts/effects.js +301 -166
  37. data/public/javascripts/prototype.js +932 -402
  38. data/public/stylesheets/default.css +3 -2
  39. data/test/unit/elt_test.rb +13 -0
  40. data/test/unit/mail_test.rb +3 -1
  41. data/vendor/plugins/engines/CHANGELOG +203 -99
  42. data/vendor/plugins/engines/MIT-LICENSE +1 -1
  43. data/vendor/plugins/engines/README +32 -384
  44. data/vendor/plugins/engines/Rakefile +14 -0
  45. data/vendor/plugins/engines/UPGRADING +93 -0
  46. data/vendor/plugins/engines/about.yml +7 -0
  47. data/vendor/plugins/engines/generators/plugin_migration/USAGE +45 -0
  48. data/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +79 -0
  49. data/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +13 -0
  50. data/vendor/plugins/engines/init.rb +34 -47
  51. data/vendor/plugins/engines/install.rb +32 -0
  52. data/vendor/plugins/engines/lib/engines/{ruby_extensions.rb → deprecated_config_support.rb} +135 -113
  53. data/vendor/plugins/engines/lib/engines/plugin.rb +214 -0
  54. data/vendor/plugins/engines/lib/engines/plugin_list.rb +31 -0
  55. data/vendor/plugins/engines/lib/engines/plugin_migrator.rb +60 -0
  56. data/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +19 -0
  57. data/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +143 -0
  58. data/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +155 -0
  59. data/vendor/plugins/engines/lib/engines/rails_extensions/public_asset_helpers.rb +116 -0
  60. data/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +20 -0
  61. data/vendor/plugins/engines/lib/engines/rails_extensions/rails_initializer.rb +86 -0
  62. data/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +77 -0
  63. data/vendor/plugins/engines/lib/engines/rails_extensions/templates.rb +140 -0
  64. data/vendor/plugins/engines/lib/engines/rails_extensions.rb +6 -0
  65. data/vendor/plugins/engines/lib/engines/testing.rb +88 -0
  66. data/vendor/plugins/engines/lib/engines.rb +281 -425
  67. data/vendor/plugins/engines/tasks/engines.rake +108 -137
  68. metadata +218 -250
  69. data/db/ROOT/perso.txt +0 -214
  70. data/public/images/indicator.gif +0 -0
  71. data/public/images/orange_by_darren_Hester_350o.jpg +0 -0
  72. data/public/images/smile.png +0 -0
  73. data/vendor/plugins/engines/generators/engine/USAGE +0 -26
  74. data/vendor/plugins/engines/generators/engine/engine_generator.rb +0 -199
  75. data/vendor/plugins/engines/generators/engine/templates/README +0 -85
  76. data/vendor/plugins/engines/generators/engine/templates/init_engine.erb +0 -15
  77. data/vendor/plugins/engines/generators/engine/templates/install.erb +0 -4
  78. data/vendor/plugins/engines/generators/engine/templates/lib/engine.erb +0 -6
  79. data/vendor/plugins/engines/generators/engine/templates/licenses/GPL +0 -18
  80. data/vendor/plugins/engines/generators/engine/templates/licenses/LGPL +0 -19
  81. data/vendor/plugins/engines/generators/engine/templates/licenses/MIT +0 -22
  82. data/vendor/plugins/engines/generators/engine/templates/licenses/None +0 -1
  83. data/vendor/plugins/engines/generators/engine/templates/public/javascripts/engine.js +0 -0
  84. data/vendor/plugins/engines/generators/engine/templates/public/stylesheets/engine.css +0 -0
  85. data/vendor/plugins/engines/generators/engine/templates/tasks/engine.rake +0 -0
  86. data/vendor/plugins/engines/generators/engine/templates/test/test_helper.erb +0 -17
  87. data/vendor/plugins/engines/lib/bundles/require_resource.rb +0 -124
  88. data/vendor/plugins/engines/lib/bundles.rb +0 -77
  89. data/vendor/plugins/engines/lib/engines/action_mailer_extensions.rb +0 -140
  90. data/vendor/plugins/engines/lib/engines/action_view_extensions.rb +0 -141
  91. data/vendor/plugins/engines/lib/engines/active_record_extensions.rb +0 -21
  92. data/vendor/plugins/engines/lib/engines/dependencies_extensions.rb +0 -129
  93. data/vendor/plugins/engines/lib/engines/migration_extensions.rb +0 -53
  94. data/vendor/plugins/engines/lib/engines/routing_extensions.rb +0 -28
  95. data/vendor/plugins/engines/lib/engines/testing_extensions.rb +0 -327
  96. data/vendor/plugins/engines/tasks/deprecated_engines.rake +0 -7
  97. data/vendor/plugins/engines/test/action_view_extensions_test.rb +0 -9
  98. data/vendor/plugins/engines/test/ruby_extensions_test.rb +0 -115
  99. data/vendor/plugins/guid/README.TXT +0 -29
  100. data/vendor/plugins/guid/init.rb +0 -30
  101. data/vendor/plugins/guid/lib/usesguid.rb +0 -37
  102. data/vendor/plugins/guid/lib/uuid22.rb +0 -43
  103. data/vendor/plugins/guid/lib/uuidtools.rb +0 -572
  104. data/vendor/plugins/responds_to_parent/MIT-LICENSE +0 -20
  105. data/vendor/plugins/responds_to_parent/README +0 -42
  106. data/vendor/plugins/responds_to_parent/Rakefile +0 -22
  107. data/vendor/plugins/responds_to_parent/init.rb +0 -1
  108. data/vendor/plugins/responds_to_parent/lib/responds_to_parent.rb +0 -46
  109. data/vendor/plugins/responds_to_parent/test/responds_to_parent_test.rb +0 -115
@@ -1,8 +1,8 @@
1
1
  <%e_pages = ActionController::Pagination::Paginator.new(
2
- self, elt.elts_count, PAGE_LENGTH, @params['page'])
2
+ self, elt.elts_count, PAGE_LENGTH, params['page'])
3
3
  elts = Elt.find(:all,
4
4
  :conditions => "parent_id = '#{elt.id}'",
5
- :order => 'position, elts.created_on DESC',
5
+ :order => 'position, last_activity DESC, elts.created_on DESC',
6
6
  :include => :person,
7
7
  :limit => e_pages.items_per_page,
8
8
  :offset => e_pages.current.offset) %>
@@ -1,5 +1,5 @@
1
1
  <%e_pages = ActionController::Pagination::Paginator.new(
2
- self, (@elt.rgt-@elt.lft-1)/2, LIST_LENGTH, @params['page'])
2
+ self, (@elt.rgt-@elt.lft-1)/2, LIST_LENGTH, params['page'])
3
3
  elts = Elt.find :all,
4
4
  :conditions => "lft > #{@elt.lft} AND rgt < #{@elt.rgt}",
5
5
  :order => 'elts.created_on DESC',
@@ -1,5 +1,5 @@
1
1
  <%e_pages = ActionController::Pagination::Paginator.new(
2
- self, (@elt.rgt-@elt.lft-1)/2, LIST_LENGTH, @params['page'])
2
+ self, (@elt.rgt-@elt.lft-1)/2, LIST_LENGTH, params['page'])
3
3
  elts = Elt.find :all,
4
4
  :select => 'SUM(value) AS resultLocal, elts.id, parent_id, elts.created_on, parent_id,' \
5
5
  +'elts_count, position, elts.person_id, subject, body, lft, rgt',
@@ -4,13 +4,13 @@
4
4
 
5
5
  <%= error_messages_for 'elt' %>
6
6
 
7
- <%= form_remote_tag(
7
+ <% form_remote_tag(
8
8
  :update => 'eltSubs_'+@elt.parent_id,
9
9
  :url => { :action => 'create', :id => @elt.parent },
10
10
  :position => 'top',
11
11
  :before => visual_effect(:BlindUp, 'eltNew_'+@elt.parent_id),
12
12
  :loading => "Element.show('eltSubs_#{@elt.parent_id}');
13
- Element.show('eltSubsClose_#{@elt.parent_id}')") %>
13
+ Element.show('eltSubsClose_#{@elt.parent_id}')") do %>
14
14
 
15
15
  <%= hidden_field 'elt', 'parent_id' %>
16
16
 
@@ -81,7 +81,7 @@
81
81
 
82
82
  <%= submit_tag 'Propose!' %>
83
83
  </div>
84
- <%= end_form_tag %>
84
+ <% end %>
85
85
 
86
86
  <span class="elt" id="eltNewPreview_<%= @elt.parent_id %>"/>
87
87
 
@@ -32,14 +32,14 @@
32
32
  <div class="box">
33
33
  <form action="http://google.com/search">
34
34
  <input type="hidden" name="q"
35
- value="site:<%= ActionMailer::Base.server_settings[:domain] %>"/>
35
+ value="site:<%= ActionMailer::Base.smtp_settings[:domain] %>"/>
36
36
  <input type="text" name="q"/>
37
37
  <%= submit_tag 'OK' %>
38
38
  </form>
39
39
  </div>
40
40
  </div>
41
41
 
42
- <% @flash.each do |key, value| %>
42
+ <% flash.each do |key, value| %>
43
43
  <div class="<%= key %>"><%= value %></div>
44
44
  <% end %>
45
45
 
@@ -3,6 +3,12 @@
3
3
 
4
4
  <html>
5
5
  <head>
6
+ <META name="verify-v1" content="5f3d3AgFwXPbIg9jJA/vBU8lZEz8m/F9InWWVNeJWMU=" />
7
+ <META name="verify-v1" content="GQG8JPKekfUN1haTZYQRLP+PvKkH43Rg2HQ53OTLgTg=" />
8
+ <!-- For www.echarp.org -->
9
+ <META name="verify-v1" content="GQG8JPKekfUN1haTZYQRLP+PvKkH43Rg2HQ53OTLgTg=" />
10
+ <!-- echarp.dyndns.org -->
11
+ <META name="verify-v1" content="6espv1bly2noRX0tNze9x9In903DuzgvEzmAQdDw250=" />
6
12
  <title><%= @title %></title>
7
13
 
8
14
  <link rel="alternate" type="application/rss+xml" title="Latest Posts - <%= @title %>"
@@ -6,7 +6,7 @@
6
6
  <title><%= @elt.subject %></title>
7
7
 
8
8
  <!-- Yes I use the mail domain for lack of another variable :-( -->
9
- <base href="http://<%= ActionMailer::Base.server_settings[:domain] %>"/>
9
+ <base href="http://<%= ActionMailer::Base.smtp_settings[:domain] %>"/>
10
10
 
11
11
  <link href="/stylesheets/default.css" media="screen" rel="Stylesheet" type="text/css" />
12
12
  <script src="/javascripts/prototype.js" type="text/javascript"></script>
@@ -1,7 +1,9 @@
1
1
  <% e_pages = ActionController::Pagination::Paginator.new(
2
- self, person.elts.count, PAGE_LENGTH, @params['page'])
3
- e = Elt.find_all("person_id = '#{person.id}'",
4
- 'created_on DESC', e_pages.current.to_sql) %>
2
+ self, person.elts.count, PAGE_LENGTH, params['page'])
3
+ e = Elt.find(:all, :conditions => ["person_id = '#{person.id}'"],
4
+ :order => 'created_on DESC',
5
+ :limit => e_pages.items_per_page,
6
+ :offset => e_pages.current.offset) %>
5
7
 
6
8
  <% if e_pages.length > 1 %>
7
9
  <li class="pager">
@@ -11,14 +11,13 @@
11
11
  <div class="box">
12
12
  <% for elt in @person.subscribed_elts.reverse[0...LIST_LENGTH] %>
13
13
  <div class="boxLine">
14
- <span class="choice result"><%= sprintf("%+d", elt.result) %></span>
15
14
  <%= link_to(elt.subject.gsub(/\[.*\]/, ''), :controller => 'elt', :action => 'show', :id => elt) %>
15
+ <span class="choice result"><%= sprintf("%+d", elt.result) %></span>
16
16
  </div>
17
17
  <% end %>
18
18
  </div>
19
19
  </div>
20
20
 
21
-
22
21
  <p class="created_on"><%= @person.created_on %></p>
23
22
 
24
23
  <h1><%= @person.name %></h1>
data/config/boot.rb CHANGED
@@ -22,20 +22,21 @@ unless defined?(Rails::Initializer)
22
22
  rails_gem_version = $1
23
23
 
24
24
  if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
25
- rails_gem = Gem.cache.search('rails', "=#{version}").first
25
+ # Asking for 1.1.6 will give you 1.1.6.5206, if available -- makes it easier to use beta gems
26
+ rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last
26
27
 
27
28
  if rails_gem
28
- require_gem "rails", "=#{version}"
29
+ gem "rails", "=#{rails_gem.version.version}"
29
30
  require rails_gem.full_gem_path + '/lib/initializer'
30
31
  else
31
- STDERR.puts %(Cannot find gem for Rails =#{version}:
32
+ STDERR.puts %(Cannot find gem for Rails ~>#{version}.0:
32
33
  Install the missing gem with 'gem install -v=#{version} rails', or
33
34
  change environment.rb to define RAILS_GEM_VERSION with your desired version.
34
35
  )
35
36
  exit 1
36
37
  end
37
38
  else
38
- require_gem "rails"
39
+ gem "rails"
39
40
  require 'initializer'
40
41
  end
41
42
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Uncomment below to force Rails into production mode
4
4
  # you don't control web/app server and can't set it the proper way
5
- # ENV['RAILS_ENV'] ||= 'production'
5
+ #ENV['RAILS_ENV'] ||= 'production'
6
6
 
7
7
  # Bootstrap the Rails environment, frameworks, and default configuration
8
8
  require File.join(File.dirname(__FILE__), 'boot')
@@ -83,7 +83,7 @@ CONFIG = { :default_language => 'en' }
83
83
 
84
84
  # This variable is of course used for mails, but also in the html mail
85
85
  # template, to set the base url for the generated html
86
- ActionMailer::Base.server_settings = {
86
+ ActionMailer::Base.smtp_settings = {
87
87
  :domain => 'leparlement.org'
88
88
  }
89
89
 
@@ -96,6 +96,9 @@ ActionMailer::Base.server_settings = {
96
96
  # :authentication => :login
97
97
  #
98
98
 
99
+ require File.join(RAILS_ROOT, "vendor", "plugins", "engines", "lib", "engines",
100
+ "deprecated_config_support")
101
+
99
102
  module LoginEngine
100
103
  config :salt, 'parle'
101
104
  config :email_from, 'facteur@leparlement.org'
@@ -104,9 +107,8 @@ module LoginEngine
104
107
  config :app_name, 'parlement'
105
108
  config :use_email_notification, true
106
109
  end
107
- Engines.start :login
108
110
 
109
111
  Rubaidh::GoogleAnalytics.tracker_id = 'UA-317241-1'
110
112
 
111
- PARLEMENT_VERSION='0.10'
113
+ PARLEMENT_VERSION='0.11'
112
114
 
data/config/routes.rb CHANGED
@@ -14,8 +14,6 @@ ActionController::Routing::Routes.draw do |map|
14
14
  map.connect 'index.rss', :controller => 'elt', :action => 'rss', :id => 'parlement'
15
15
  map.connect 'vote.rss', :controller => 'elt', :action => 'vote_rss', :id => 'parlement'
16
16
 
17
- map.connect ':id', :controller => 'elt', :action => 'rss', :requirements => { :id => /.*\.rss/ }
18
- map.connect ':id', :controller => 'elt', :action => 'show'
19
17
  map.connect ':id/index.rss', :controller => 'elt', :action => 'rss'
20
18
  map.connect ':id/vote.rss', :controller => 'elt', :action => 'vote_rss'
21
19
  map.connect ':id//index.rss', :controller => 'elt', :action => 'rss'
@@ -33,4 +31,7 @@ ActionController::Routing::Routes.draw do |map|
33
31
 
34
32
  # Install the default route as the lowest priority.
35
33
  map.connect ':controller/:action/:id'
34
+
35
+ map.connect ':id', :controller => 'elt', :action => 'rss', :requirements => { :id => /.*\.rss/ }
36
+ map.connect ':id', :controller => 'elt', :action => 'show'
36
37
  end
@@ -85,7 +85,8 @@ CREATE TABLE elts (
85
85
  body text,
86
86
  lft integer,
87
87
  rgt integer,
88
- elts_count integer DEFAULT 0
88
+ elts_count integer DEFAULT 0,
89
+ last_activity timestamp without time zone
89
90
  );
90
91
 
91
92
 
@@ -171,6 +172,16 @@ CREATE TABLE person_mails (
171
172
  );
172
173
 
173
174
 
175
+ --
176
+ -- Name: plugin_schema_info; Type: TABLE; Schema: public; Owner: manu; Tablespace:
177
+ --
178
+
179
+ CREATE TABLE plugin_schema_info (
180
+ plugin_name character varying(255),
181
+ version integer
182
+ );
183
+
184
+
174
185
  --
175
186
  -- Name: schema_info; Type: TABLE; Schema: public; Owner: manu; Tablespace:
176
187
  --
@@ -305,11 +316,11 @@ ALTER TABLE ONLY people
305
316
 
306
317
 
307
318
  --
308
- -- Name: sent_mails_pkey; Type: CONSTRAINT; Schema: public; Owner: manu; Tablespace:
319
+ -- Name: person_mails_pkey; Type: CONSTRAINT; Schema: public; Owner: manu; Tablespace:
309
320
  --
310
321
 
311
322
  ALTER TABLE ONLY person_mails
312
- ADD CONSTRAINT sent_mails_pkey PRIMARY KEY (id);
323
+ ADD CONSTRAINT person_mails_pkey PRIMARY KEY (id);
313
324
 
314
325
 
315
326
  --
@@ -448,4 +459,4 @@ ALTER TABLE ONLY choices
448
459
  -- PostgreSQL database dump complete
449
460
  --
450
461
 
451
- INSERT INTO schema_info (version) VALUES (5)
462
+ INSERT INTO schema_info (version) VALUES (6)
@@ -0,0 +1,10 @@
1
+ class LastActivity < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :elts, :last_activity, :datetime
4
+ execute 'UPDATE elts SET last_activity = (SELECT MAX(created_on) FROM elts c WHERE elts.lft <= c.lft AND c.rgt <= elts.rgt)'
5
+ end
6
+
7
+ def self.down
8
+ remove_column :elts, :last_activity
9
+ end
10
+ end
data/db/schema.rb CHANGED
@@ -2,88 +2,106 @@
2
2
  # migrations feature of ActiveRecord to incrementally modify your database, and
3
3
  # then regenerate this schema definition.
4
4
 
5
- ActiveRecord::Schema.define(:version => 0) do
5
+ ActiveRecord::Schema.define(:version => 6) do
6
6
 
7
7
  create_table "attachments", :force => true do |t|
8
- t.column "elt_id", :text, :null => false
9
- t.column "created_on", :datetime, :null => false
8
+ t.column "elt_id", :text, :null => false
9
+ t.column "created_on", :datetime, :null => false
10
10
  t.column "content_type", :text
11
- t.column "file", :text
11
+ t.column "file", :text
12
12
  end
13
13
 
14
- create_table "choices", :id => false, :force => true do |t|
15
- t.column "elt_id", :text, :null => false
16
- t.column "person_id", :text, :null => false
17
- t.column "created_on", :datetime, :null => false
14
+ create_table "choices", :force => true do |t|
15
+ t.column "elt_id", :string, :null => false
16
+ t.column "person_id", :string
17
+ t.column "created_on", :datetime, :null => false
18
+ t.column "value", :integer, :default => 1, :null => false
18
19
  end
19
20
 
20
- create_table "delegations", :id => false, :force => true do |t|
21
- t.column "elt_id", :text, :null => false
22
- t.column "person_id", :text, :null => false
23
- t.column "created_on", :datetime, :null => false
24
- t.column "temporary", :boolean, :default => false, :null => false
25
- t.column "delegate_to", :text, :null => false
21
+ add_index "choices", ["elt_id", "person_id"], :name => "elt_person_key", :unique => true
22
+
23
+ create_table "delegations", :force => true do |t|
24
+ t.column "elt_id", :text, :null => false
25
+ t.column "person_id", :text, :null => false
26
+ t.column "created_on", :datetime, :null => false
27
+ t.column "temporary", :boolean, :default => false, :null => false
28
+ t.column "delegate_to", :text, :null => false
26
29
  end
27
30
 
28
31
  create_table "elts", :force => true do |t|
29
- t.column "parent_id", :text
30
- t.column "position", :float
31
- t.column "created_on", :datetime, :null => false
32
- t.column "person_id", :text
33
- t.column "subject", :text
34
- t.column "body", :text
32
+ t.column "parent_id", :text
33
+ t.column "position", :float
34
+ t.column "created_on", :datetime, :null => false
35
+ t.column "person_id", :text
36
+ t.column "subject", :text
37
+ t.column "body", :text
38
+ t.column "lft", :integer
39
+ t.column "rgt", :integer
40
+ t.column "elts_count", :integer, :default => 0
41
+ t.column "last_activity", :datetime
35
42
  end
36
43
 
44
+ add_index "elts", ["parent_id"], :name => "elts_parent"
45
+ add_index "elts", ["parent_id"], :name => "elts_parent_key"
46
+ add_index "elts", ["lft"], :name => "lft"
47
+ add_index "elts", ["rgt"], :name => "rgt"
48
+
37
49
  create_table "engine_schema_info", :id => false, :force => true do |t|
38
50
  t.column "engine_name", :string
39
- t.column "version", :integer
51
+ t.column "version", :integer
40
52
  end
41
53
 
42
54
  create_table "mails", :force => true do |t|
43
- t.column "elt_id", :text, :null => false
44
- t.column "message", :text
55
+ t.column "elt_id", :text, :null => false
56
+ t.column "message", :text
45
57
  t.column "mail_parents", :text
46
- t.column "file", :text
58
+ t.column "file", :text
47
59
  end
48
60
 
49
61
  create_table "people", :force => true do |t|
50
62
  t.column "created_on", :datetime, :null => false
51
- t.column "name", :text
52
- t.column "email", :text
63
+ t.column "name", :text
64
+ t.column "email", :text
65
+ t.column "image", :text
53
66
  end
54
67
 
55
68
  add_index "people", ["name"], :name => "people_name_key", :unique => true
56
69
 
57
- create_table "subscribers", :id => false, :force => true do |t|
58
- t.column "elt_id", :text, :null => false
59
- t.column "person_id", :text, :null => false
70
+ create_table "person_mails", :force => true do |t|
71
+ t.column "mail_id", :string, :null => false
72
+ t.column "person_id", :string
73
+ t.column "created_on", :datetime, :null => false
74
+ end
75
+
76
+ create_table "subscriptions", :force => true do |t|
77
+ t.column "elt_id", :text, :null => false
78
+ t.column "person_id", :text, :null => false
79
+ t.column "filter", :integer, :default => 0
80
+ t.column "created_on", :datetime, :null => false
60
81
  end
61
82
 
62
83
  create_table "users", :force => true do |t|
63
- t.column "login", :string, :limit => 80, :default => "", :null => false
64
- t.column "salted_password", :string, :limit => 40, :default => "", :null => false
65
- t.column "email", :string, :limit => 60, :default => "", :null => false
66
- t.column "firstname", :string, :limit => 40
67
- t.column "lastname", :string, :limit => 40
68
- t.column "salt", :string, :limit => 40, :default => "", :null => false
69
- t.column "verified", :integer, :default => 0
70
- t.column "role", :string, :limit => 40
71
- t.column "security_token", :string, :limit => 40
72
- t.column "token_expiry", :datetime
73
- t.column "created_at", :datetime
74
- t.column "updated_at", :datetime
75
- t.column "logged_in_at", :datetime
76
- t.column "deleted", :integer, :default => 0
77
- t.column "delete_after", :datetime
84
+ t.column "login", :text, :null => false
85
+ t.column "salted_password", :string, :limit => 40, :null => false
86
+ t.column "email", :string, :limit => 60
87
+ t.column "firstname", :string, :limit => 40
88
+ t.column "lastname", :string, :limit => 40
89
+ t.column "salt", :string, :limit => 40, :null => false
90
+ t.column "verified", :integer, :default => 0
91
+ t.column "role", :string, :limit => 40
92
+ t.column "security_token", :string, :limit => 40
93
+ t.column "token_expiry", :datetime
94
+ t.column "deleted", :integer, :default => 0
95
+ t.column "delete_after", :datetime
78
96
  end
79
97
 
80
98
  create_table "usersold", :force => true do |t|
81
- t.column "person_id", :text, :null => false
99
+ t.column "person_id", :text, :null => false
82
100
  t.column "salted_password", :text
83
- t.column "salt", :text
84
- t.column "verified", :integer, :default => 0
85
- t.column "new_email", :text
86
- t.column "security_token", :text
101
+ t.column "salt", :text
102
+ t.column "verified", :integer, :default => 0
103
+ t.column "new_email", :text
104
+ t.column "security_token", :text
87
105
  end
88
106
 
89
107
  add_index "usersold", ["person_id"], :name => "usersold_person_id_key", :unique => true
data/public/dispatch.fcgi CHANGED
@@ -19,6 +19,7 @@
19
19
  # RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
20
20
  #
21
21
  require File.dirname(__FILE__) + "/../config/environment"
22
+ #require 'fcgi'
22
23
  require 'fcgi_handler'
23
24
 
24
25
  RailsFCGIHandler.process!
@@ -1,12 +1,13 @@
1
- // Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
2
- // (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
3
- // (c) 2005 Jon Tirsen (http://www.tirsen.com)
1
+ // Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
2
+ // (c) 2005, 2006 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
3
+ // (c) 2005, 2006 Jon Tirsen (http://www.tirsen.com)
4
4
  // Contributors:
5
5
  // Richard Livsey
6
6
  // Rahul Bhargava
7
7
  // Rob Wills
8
8
  //
9
- // See scriptaculous.js for full license.
9
+ // script.aculo.us is freely distributable under the terms of an MIT-style license.
10
+ // For details, see the script.aculo.us web site: http://script.aculo.us/
10
11
 
11
12
  // Autocompleter.Base handles all the autocompletion functionality
12
13
  // that's independent of the data source for autocompletion. This
@@ -33,6 +34,9 @@
33
34
  // useful when one of the tokens is \n (a newline), as it
34
35
  // allows smart autocompletion after linebreaks.
35
36
 
37
+ if(typeof Effect == 'undefined')
38
+ throw("controls.js requires including script.aculo.us' effects.js library");
39
+
36
40
  var Autocompleter = {}
37
41
  Autocompleter.Base = function() {};
38
42
  Autocompleter.Base.prototype = {
@@ -45,7 +49,7 @@ Autocompleter.Base.prototype = {
45
49
  this.index = 0;
46
50
  this.entryCount = 0;
47
51
 
48
- if (this.setOptions)
52
+ if(this.setOptions)
49
53
  this.setOptions(options);
50
54
  else
51
55
  this.options = options || {};
@@ -55,17 +59,20 @@ Autocompleter.Base.prototype = {
55
59
  this.options.frequency = this.options.frequency || 0.4;
56
60
  this.options.minChars = this.options.minChars || 1;
57
61
  this.options.onShow = this.options.onShow ||
58
- function(element, update){
59
- if(!update.style.position || update.style.position=='absolute') {
60
- update.style.position = 'absolute';
61
- Position.clone(element, update, {setHeight: false, offsetTop: element.offsetHeight});
62
- }
63
- Effect.Appear(update,{duration:0.15});
64
- };
62
+ function(element, update){
63
+ if(!update.style.position || update.style.position=='absolute') {
64
+ update.style.position = 'absolute';
65
+ Position.clone(element, update, {
66
+ setHeight: false,
67
+ offsetTop: element.offsetHeight
68
+ });
69
+ }
70
+ Effect.Appear(update,{duration:0.15});
71
+ };
65
72
  this.options.onHide = this.options.onHide ||
66
- function(element, update){ new Effect.Fade(update,{duration:0.15}) };
73
+ function(element, update){ new Effect.Fade(update,{duration:0.15}) };
67
74
 
68
- if (typeof(this.options.tokens) == 'string')
75
+ if(typeof(this.options.tokens) == 'string')
69
76
  this.options.tokens = new Array(this.options.tokens);
70
77
 
71
78
  this.observer = null;
@@ -94,7 +101,7 @@ Autocompleter.Base.prototype = {
94
101
  },
95
102
 
96
103
  fixIEOverlapping: function() {
97
- Position.clone(this.update, this.iefix);
104
+ Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
98
105
  this.iefix.style.zIndex = 1;
99
106
  this.update.style.zIndex = 2;
100
107
  Element.show(this.iefix);
@@ -202,11 +209,13 @@ Autocompleter.Base.prototype = {
202
209
  markPrevious: function() {
203
210
  if(this.index > 0) this.index--
204
211
  else this.index = this.entryCount-1;
212
+ this.getEntry(this.index).scrollIntoView(true);
205
213
  },
206
214
 
207
215
  markNext: function() {
208
216
  if(this.index < this.entryCount-1) this.index++
209
217
  else this.index = 0;
218
+ this.getEntry(this.index).scrollIntoView(false);
210
219
  },
211
220
 
212
221
  getEntry: function(index) {
@@ -254,11 +263,11 @@ Autocompleter.Base.prototype = {
254
263
  if(!this.changed && this.hasFocus) {
255
264
  this.update.innerHTML = choices;
256
265
  Element.cleanWhitespace(this.update);
257
- Element.cleanWhitespace(this.update.firstChild);
266
+ Element.cleanWhitespace(this.update.down());
258
267
 
259
- if(this.update.firstChild && this.update.firstChild.childNodes) {
268
+ if(this.update.firstChild && this.update.down().childNodes) {
260
269
  this.entryCount =
261
- this.update.firstChild.childNodes.length;
270
+ this.update.down().childNodes.length;
262
271
  for (var i = 0; i < this.entryCount; i++) {
263
272
  var entry = this.getEntry(i);
264
273
  entry.autocompleteIndex = i;
@@ -269,9 +278,14 @@ Autocompleter.Base.prototype = {
269
278
  }
270
279
 
271
280
  this.stopIndicator();
272
-
273
281
  this.index = 0;
274
- this.render();
282
+
283
+ if(this.entryCount==1 && this.options.autoSelect) {
284
+ this.selectEntry();
285
+ this.hide();
286
+ } else {
287
+ this.render();
288
+ }
275
289
  }
276
290
  },
277
291
 
@@ -459,6 +473,7 @@ Ajax.InPlaceEditor.prototype = {
459
473
  this.element = $(element);
460
474
 
461
475
  this.options = Object.extend({
476
+ paramName: "value",
462
477
  okButton: true,
463
478
  okText: "ok",
464
479
  cancelLink: true,
@@ -531,7 +546,7 @@ Ajax.InPlaceEditor.prototype = {
531
546
  Element.hide(this.element);
532
547
  this.createForm();
533
548
  this.element.parentNode.insertBefore(this.form, this.element);
534
- Field.scrollFreeActivate(this.editField);
549
+ if (!this.options.loadTextURL) Field.scrollFreeActivate(this.editField);
535
550
  // stop the event to avoid a page refresh in Safari
536
551
  if (evt) {
537
552
  Event.stop(evt);
@@ -590,7 +605,7 @@ Ajax.InPlaceEditor.prototype = {
590
605
  var textField = document.createElement("input");
591
606
  textField.obj = this;
592
607
  textField.type = "text";
593
- textField.name = "value";
608
+ textField.name = this.options.paramName;
594
609
  textField.value = text;
595
610
  textField.style.backgroundColor = this.options.highlightcolor;
596
611
  textField.className = 'editor_field';
@@ -603,7 +618,7 @@ Ajax.InPlaceEditor.prototype = {
603
618
  this.options.textarea = true;
604
619
  var textArea = document.createElement("textarea");
605
620
  textArea.obj = this;
606
- textArea.name = "value";
621
+ textArea.name = this.options.paramName;
607
622
  textArea.value = this.convertHTMLLineBreaks(text);
608
623
  textArea.rows = this.options.rows;
609
624
  textArea.cols = this.options.cols || 40;
@@ -636,6 +651,7 @@ Ajax.InPlaceEditor.prototype = {
636
651
  Element.removeClassName(this.form, this.options.loadingClassName);
637
652
  this.editField.disabled = false;
638
653
  this.editField.value = transport.responseText.stripTags();
654
+ Field.scrollFreeActivate(this.editField);
639
655
  },
640
656
  onclickCancel: function() {
641
657
  this.onComplete();
@@ -772,6 +788,8 @@ Object.extend(Ajax.InPlaceCollectionEditor.prototype, {
772
788
  collection.each(function(e,i) {
773
789
  optionTag = document.createElement("option");
774
790
  optionTag.value = (e instanceof Array) ? e[0] : e;
791
+ if((typeof this.options.value == 'undefined') &&
792
+ ((e instanceof Array) ? this.element.innerHTML == e[1] : e == optionTag.value)) optionTag.selected = true;
775
793
  if(this.options.value==optionTag.value) optionTag.selected = true;
776
794
  optionTag.appendChild(document.createTextNode((e instanceof Array) ? e[1] : e));
777
795
  selectTag.appendChild(optionTag);