parlement 0.3 → 0.4
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/CHANGES +16 -0
- data/README +36 -3
- data/Rakefile +8 -12
- data/app/controllers/account_controller.rb +2 -0
- data/app/controllers/elt_controller.rb +1 -5
- data/app/controllers/subscriber_controller.rb +1 -1
- data/app/helpers/elt_helper.rb +30 -10
- data/app/models/elt.rb +2 -1
- data/app/models/mail.rb +41 -41
- data/app/models/mail_notify.rb +27 -10
- data/app/views/account/_login.rhtml +9 -7
- data/app/views/account/_show.rhtml +4 -4
- data/app/views/elt/_elt.rhtml +52 -51
- data/app/views/elt/_list.rhtml +22 -14
- data/app/views/elt/new.rhtml +1 -1
- data/app/views/elt/show.rhtml +15 -16
- data/app/views/layouts/top.rhtml +13 -1
- data/app/views/person/show.rhtml +1 -7
- data/config/boot.rb +32 -7
- data/config/database.yml +3 -0
- data/config/environment.rb +3 -1
- data/config/environments/development.rb +1 -1
- data/db/ROOT/parlement/ddRing.txt +14 -0
- data/db/ROOT/parlement/top-politics.txt +12 -0
- data/db/ROOT/perso.txt +1 -1
- data/db/development_structure.sql +30 -16
- data/db/schema.rb +18 -10
- data/db/schema.sql +34 -34
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/blank.gif +0 -0
- data/public/javascripts/borders.js +687 -0
- data/public/javascripts/controls.js +95 -30
- data/public/javascripts/dragdrop.js +161 -21
- data/public/javascripts/effects.js +310 -211
- data/public/javascripts/ie7-load.htc +1 -0
- data/public/javascripts/prototype.js +228 -28
- data/test/fixtures/attachments.yml +3 -0
- data/test/fixtures/mail/mail_ruby +1 -0
- data/test/fixtures/people.yml +14 -0
- data/test/functional/account_controller_test.rb +3 -2
- data/test/unit/mail_notify_test.rb +2 -0
- data/test/unit/mail_test.rb +59 -6
- data/test/unit/person_test.rb +1 -1
- data/vendor/plugins/engines/CHANGELOG +92 -0
- data/vendor/plugins/engines/MIT-LICENSE +21 -0
- data/vendor/plugins/engines/README +325 -39
- data/vendor/plugins/engines/generators/engine/USAGE +26 -0
- data/vendor/plugins/engines/generators/engine/engine_generator.rb +199 -0
- data/vendor/plugins/engines/generators/engine/templates/README +85 -0
- data/vendor/plugins/engines/generators/engine/templates/init_engine.erb +13 -0
- data/vendor/plugins/engines/generators/engine/templates/install.erb +4 -0
- data/vendor/plugins/engines/generators/engine/templates/lib/engine.erb +6 -0
- data/vendor/plugins/engines/generators/engine/templates/licenses/GPL +18 -0
- data/vendor/plugins/engines/generators/engine/templates/licenses/LGPL +19 -0
- data/vendor/plugins/engines/generators/engine/templates/licenses/MIT +22 -0
- data/vendor/plugins/engines/generators/engine/templates/licenses/None +1 -0
- data/vendor/plugins/engines/generators/engine/templates/public/javascripts/engine.js +0 -0
- data/vendor/plugins/engines/generators/engine/templates/public/stylesheets/engine.css +0 -0
- data/vendor/plugins/engines/generators/engine/templates/tasks/engine.rake +0 -0
- data/vendor/plugins/engines/generators/engine/templates/test/test_helper.erb +13 -0
- data/vendor/plugins/engines/init.rb +18 -3
- data/vendor/plugins/engines/lib/bundles/require_resource.rb +124 -0
- data/vendor/plugins/engines/lib/bundles.rb +77 -0
- data/vendor/plugins/engines/lib/{action_mailer_extensions.rb → engines/action_mailer_extensions.rb} +15 -36
- data/vendor/plugins/engines/lib/{action_view_extensions.rb → engines/action_view_extensions.rb} +40 -33
- data/vendor/plugins/engines/lib/engines/active_record_extensions.rb +19 -0
- data/vendor/plugins/engines/lib/engines/dependencies_extensions.rb +118 -0
- data/vendor/plugins/engines/lib/engines/migration_extensions.rb +53 -0
- data/vendor/plugins/engines/lib/{ruby_extensions.rb → engines/ruby_extensions.rb} +14 -28
- data/vendor/plugins/engines/lib/engines/testing_extensions.rb +323 -0
- data/vendor/plugins/engines/lib/engines.rb +258 -148
- data/vendor/plugins/engines/tasks/engines.rake +161 -0
- data/vendor/plugins/engines/test/action_view_extensions_test.rb +9 -0
- data/vendor/plugins/engines/test/ruby_extensions_test.rb +24 -3
- data/vendor/plugins/guid/README.TXT +14 -4
- data/vendor/plugins/guid/init.rb +9 -2
- data/vendor/plugins/guid/lib/uuidtools.rb +22 -15
- data/vendor/plugins/login_engine/CHANGELOG +14 -0
- data/vendor/plugins/login_engine/README +93 -7
- data/vendor/plugins/login_engine/app/controllers/user_controller.rb +30 -20
- data/vendor/plugins/login_engine/app/helpers/user_helper.rb +1 -1
- data/vendor/plugins/login_engine/app/views/user/forgot_password.rhtml +2 -2
- data/vendor/plugins/login_engine/db/migrate/001_initial_schema.rb +25 -0
- data/vendor/plugins/login_engine/install.rb +4 -0
- data/vendor/plugins/login_engine/lib/login_engine/authenticated_system.rb +11 -5
- data/vendor/plugins/login_engine/lib/login_engine/authenticated_user.rb +15 -9
- data/vendor/plugins/login_engine/lib/login_engine.rb +7 -3
- data/vendor/plugins/login_engine/test/functional/user_controller_test.rb +22 -19
- data/vendor/plugins/login_engine/test/test_helper.rb +4 -8
- data/vendor/plugins/login_engine/test/unit/user_test.rb +31 -11
- metadata +60 -57
- data/app/models/attachment.rb +0 -6
- data/public/attachment/file/architecture.png +0 -0
- data/public/attachment/file/architecture.svg +0 -8972
- data/public/attachment/file/security.svg +0 -8960
- data/public/engine_files/login_engine/stylesheets/login_engine.css +0 -81
- data/public/oldREADME +0 -190
- data/public/stylesheets/default.css +0 -235
- data/public/stylesheets/live_tree.css +0 -62
- data/public/stylesheets/scaffold.css +0 -74
- data/script/about +0 -3
- data/script/benchmarker +0 -19
- data/script/breakpointer +0 -3
- data/script/console +0 -3
- data/script/create_db +0 -7
- data/script/destroy +0 -3
- data/script/generate +0 -3
- data/script/performance/benchmarker +0 -3
- data/script/performance/profiler +0 -3
- data/script/plugin +0 -3
- data/script/process/reaper +0 -3
- data/script/process/spawner +0 -3
- data/script/process/spinner +0 -3
- data/script/profiler +0 -34
- data/script/runner +0 -3
- data/script/server +0 -3
- data/test/unit/user_test.rb +0 -94
- data/vendor/plugins/engines/lib/dependencies_extensions.rb +0 -56
- data/vendor/plugins/engines/lib/testing_extensions.rb +0 -33
- data/vendor/plugins/login_engine/db/schema.rb +0 -25
- data/vendor/plugins/login_engine/test/fixtures/templates/users.yml +0 -41
- /data/public/images/{eltBackground.png → eltBackground.jng} +0 -0
data/CHANGES
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
- parlement changelog
|
2
2
|
|
3
|
+
== Version 0.4
|
4
|
+
|
5
|
+
Evolutions and corrections
|
6
|
+
|
7
|
+
* bug correction in the regexp managing title display
|
8
|
+
* bug managing incoming mails into the "lost+found" folder
|
9
|
+
* received mails are resent with the same id
|
10
|
+
* no more strange backgrounds in IE
|
11
|
+
* short lines (formatted lines in email for exemple), are now wrapped correctly
|
12
|
+
* permanent redirect header if an inexistant element is requested
|
13
|
+
* rails 1.1
|
14
|
+
* plugins now linked to their respective svn
|
15
|
+
* elements now in a list (ul/li)
|
16
|
+
* simplifications for w3m display
|
17
|
+
* yahoo and google footers now hidden
|
18
|
+
|
3
19
|
== Version 0.3
|
4
20
|
|
5
21
|
Major version, adding the possibility to use not only the web forums, but mails
|
data/README
CHANGED
@@ -5,15 +5,15 @@ I am using debian, so here are a few commands I use:
|
|
5
5
|
# apt-get install ruby
|
6
6
|
# apt-get install libpgsql-ruby
|
7
7
|
# apt-get install irb
|
8
|
-
# apt-get install libredcloth-ruby
|
9
8
|
# apt-get install rdoc
|
10
9
|
|
11
10
|
-> why???
|
12
11
|
# ln -s /sbin/ifconfig /bin/
|
13
12
|
|
14
|
-
# gem install
|
13
|
+
# gem install rails
|
14
|
+
# gem install redcloth
|
15
15
|
Only if you expect to develop and release:
|
16
|
-
# gem install
|
16
|
+
# gem install meta_project
|
17
17
|
|
18
18
|
|
19
19
|
The database is setup for user "manu", you may need to change the file
|
@@ -38,3 +38,36 @@ launch parlement thus:
|
|
38
38
|
|
39
39
|
Now you can go to localhost:3000
|
40
40
|
|
41
|
+
|
42
|
+
The problem: "how to display conversations"
|
43
|
+
The entities involved:
|
44
|
+
- element
|
45
|
+
- ancestor
|
46
|
+
- children
|
47
|
+
- children number
|
48
|
+
- author
|
49
|
+
- element's size
|
50
|
+
- title
|
51
|
+
- body
|
52
|
+
The possibilities
|
53
|
+
- show one element and its children closed
|
54
|
+
- show one element opened and its children closed
|
55
|
+
- show one element and its children opened, its grand children closed
|
56
|
+
- show one element opened, its children and grand children opened
|
57
|
+
- when an element is closed, also show its children?
|
58
|
+
Limits
|
59
|
+
- can not display all elements at once
|
60
|
+
- can not display one element and all its direct children at once
|
61
|
+
Parameters
|
62
|
+
- ordering
|
63
|
+
- date
|
64
|
+
- number of children displayed
|
65
|
+
- votes
|
66
|
+
|
67
|
+
|
68
|
+
Here is my console code to reset threads from their original mails:
|
69
|
+
|
70
|
+
>> elts=Mail.find_all.select{|m|m.file and mail=TMail::Mail.parse(m.file) and reply=mail.in_reply_to and mailObject=Mail.find_by_message(reply) and mailObject.elt.id!=m.elt.parent_id}.collect{|m| {:elt=>m.elt.id, :parent=>Mail.find_by_message(TMail::Mail.parse(m.file).in_reply_to).elt.id}}; puts elts.size
|
71
|
+
|
72
|
+
>> elts.each{|e|print e[:elt], ' ', e[:parent], ' '; puts Elt.update_all("parent_id='#{e[:parent]}'", "id='#{e[:elt]}'")}; puts elts.size
|
73
|
+
|
data/Rakefile
CHANGED
@@ -34,8 +34,10 @@ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
|
34
34
|
|
35
35
|
PKG_FILES = FileList[
|
36
36
|
'[A-Z]*', 'app/**/*', 'components/**/*', 'config/**/*', 'db/**/*',
|
37
|
-
'lib/**/*', 'public
|
38
|
-
|
37
|
+
'lib/**/*', 'public/*.*', 'public/dynamic/*', 'public/images/*',
|
38
|
+
'public/engine_files/*', 'public/javascripts/*', 'script/stylesheets/*',
|
39
|
+
'test/**/*', 'vendor/**/*'
|
40
|
+
].exclude(/\b(svn|tmp|attachment)\b|~$/)
|
39
41
|
|
40
42
|
spec = Gem::Specification.new do |s|
|
41
43
|
## Basic information.
|
@@ -54,7 +56,7 @@ spec = Gem::Specification.new do |s|
|
|
54
56
|
EOF
|
55
57
|
s.files = PKG_FILES
|
56
58
|
s.require_path = 'lib'
|
57
|
-
s.autorequire = 'rails'
|
59
|
+
s.autorequire = 'rails redcloth'
|
58
60
|
s.has_rdoc = false
|
59
61
|
s.requirements << 'none'
|
60
62
|
s.test_files = Dir.glob('test/unit/*')
|
@@ -163,21 +165,15 @@ task :publish_news => [:verify_env_vars] do
|
|
163
165
|
fm = DevTools::Freshmeat::FreshmeatService.new(ENV['FRESHMEAT_USER'], ENV['FRESHMEAT_PASSWORD'])
|
164
166
|
fm.get_project_list.each do |p|
|
165
167
|
branches = fm.get_branch_list( p.shortName )
|
168
|
+
puts branches.inspect
|
166
169
|
release = fm.get_release( p.shortName, branches[0], p.version )
|
167
170
|
if PKG_NAME == p.shortName
|
168
171
|
puts p
|
169
|
-
release.version = PKG_VERSION
|
170
|
-
release.changes = PKG_VERSION
|
172
|
+
#release.version = PKG_VERSION
|
173
|
+
#release.changes = PKG_VERSION
|
171
174
|
end
|
172
175
|
end
|
173
176
|
puts fm.logout
|
174
|
-
|
175
|
-
|
176
|
-
Rake::XForge::NewsPublisher.new(MetaProject::Project::XForge::Fresh.new(PKG_NAME)) do |news|
|
177
|
-
# Never hardcode user name and password in the Rakefile!
|
178
|
-
news.user_name = ENV['RUBYFORGE_USER']
|
179
|
-
news.password = ENV['RUBYFORGE_PASSWORD']
|
180
|
-
end
|
181
177
|
"""
|
182
178
|
end
|
183
179
|
|
@@ -53,6 +53,8 @@ class AccountController < UserController
|
|
53
53
|
User.transaction(@user) do
|
54
54
|
@user.login = login
|
55
55
|
@user.change_password(password)
|
56
|
+
# To make sure even a non email protected user can use a password
|
57
|
+
@user.email = login+'@nomailyet'
|
56
58
|
# This is a hack, to make sure this user can login even if he
|
57
59
|
# didn't verify his email
|
58
60
|
@user.verified = true
|
@@ -18,14 +18,10 @@ class EltController < ApplicationController
|
|
18
18
|
# TODO
|
19
19
|
rescue ActiveRecord::RecordNotFound => e
|
20
20
|
flash[:error] = "Element '#{params[:id]}' does not exist"
|
21
|
+
headers["Status"] = "301 Moved Permanently"
|
21
22
|
redirect_to '/'
|
22
23
|
end
|
23
24
|
|
24
|
-
#def show
|
25
|
-
# @elt = Elt.find(params[:id]) if @elt == nil
|
26
|
-
# render :partial => 'show'
|
27
|
-
#end
|
28
|
-
|
29
25
|
def list
|
30
26
|
@elt = Elt.find(params[:id]) if @elt == nil
|
31
27
|
render :partial => '/elt/list', :locals => { :elt => @elt }
|
@@ -15,7 +15,7 @@ class SubscriberController < ApplicationController
|
|
15
15
|
end
|
16
16
|
else
|
17
17
|
puts "Not logged in!"
|
18
|
-
render :inline => "First you need to login... it's easy,
|
18
|
+
render :inline => "First you need to login... it's easy, type a pseudo with at least 3 characters. Then ok. Then subscribe"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
data/app/helpers/elt_helper.rb
CHANGED
@@ -3,26 +3,44 @@ module EltHelper
|
|
3
3
|
# for italics /.../ to _..._ \
|
4
4
|
#.gsub(/(\s+)\/([\w\s�������]*)\//, '\\1_\\2_') \
|
5
5
|
|
6
|
-
#
|
6
|
+
# On Date Time someone wrote: blockquote
|
7
|
+
# Yahoo footer
|
8
|
+
# Google footer
|
7
9
|
# /italic/
|
8
10
|
# - listElement
|
9
|
-
# in reply to:\n>
|
10
11
|
# 1. numbered list
|
12
|
+
# short lines to which are added a break
|
11
13
|
text = auto_link data \
|
12
|
-
.gsub(
|
14
|
+
.gsub(/(wrote:.*)$(\n)^>\s/, '\\1<br/>\\2\\2> ') \
|
15
|
+
.gsub(/^Yahoo! Groups Links$(\n{2}^<*.*$\s.*$)*/, '') \
|
16
|
+
.gsub(/^[-~]*$\n^You.*$\n^To.*$\n^To.*$\n^For more.*$\n^[-~]*$/, '') \
|
13
17
|
.gsub(/(\s+)\/([\w\s]*)\//, '\\1_\\2_') \
|
14
18
|
.gsub(/^-\s/, '* ') \
|
15
|
-
.gsub(/(:)(\n)(^>\s)/, '\\1\\2\\2\\3') \
|
16
19
|
.gsub(/^\d+[\.-]\s+/, '# ') \
|
20
|
+
.gsub(/^\s*\b(.{2,50})$(\n)\b/, '\\1<br/>\\2') \
|
17
21
|
if data != nil
|
18
22
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
+
textiled = text.blank? ? "" : RedCloth.new(text)
|
24
|
+
begin
|
25
|
+
textiled = textiled.to_html if !textiled.blank?
|
26
|
+
rescue
|
27
|
+
# TODO discover why RedCloth fails on this!!!
|
28
|
+
textiled = textiled.gsub(/[->\[]/, ' ')
|
29
|
+
textiled = textiled.to_html
|
30
|
+
end
|
31
|
+
if ! textiled.match(/[.\s]<p>/) then
|
32
|
+
# Remove any leading and finishing <p> </p> as they are not required
|
33
|
+
if textiled[0..2] == "<p>" then textiled = textiled[3..-1] end
|
34
|
+
if textiled[-4..-1] == "</p>" then textiled = textiled[0..-5] end
|
35
|
+
end
|
23
36
|
|
24
37
|
textiled
|
25
38
|
|
39
|
+
# in reply to:\n>
|
40
|
+
# .gsub(/(:)(\n)(^>\s)/, '\\1\\2\\2\\3') \
|
41
|
+
# ^here: data
|
42
|
+
# .gsub(/^(\w*):\s/, ' \\1: ') \
|
43
|
+
|
26
44
|
# hard_breaks = false
|
27
45
|
# auto_link textilize_without_paragraph(data \
|
28
46
|
# .gsub(/\&\#8211\;/, '* ') \
|
@@ -42,8 +60,10 @@ module EltHelper
|
|
42
60
|
#
|
43
61
|
def displayTitle? elt
|
44
62
|
#elt.id and elt.subject.reverse.index(elt.parent.subject.reverse) != 0
|
45
|
-
elt.id and elt.parent and elt.subject
|
46
|
-
and
|
63
|
+
elt.id and elt.parent and !elt.subject.empty? \
|
64
|
+
and elt.subject != elt.parent.subject \
|
65
|
+
and elt.subject.downcase != elt.parent.subject.downcase \
|
66
|
+
and not elt.subject =~ /^((\[[\w]*\] )*(r�f|re|sv|aw)*(.)*:[ \t]*)+(#{Regexp.escape(elt.parent.subject)})/
|
47
67
|
end
|
48
68
|
end
|
49
69
|
|
data/app/models/elt.rb
CHANGED
@@ -48,6 +48,7 @@ class Elt < ActiveRecord::Base
|
|
48
48
|
self.mail = Mail.new if not self.mail
|
49
49
|
self.mail.elt = self
|
50
50
|
self.mail.receive(mail)
|
51
|
+
self.id = mail['X-Leparlement-Elt-Id'].to_s if mail['X-Leparlement-Elt-Id']
|
51
52
|
save
|
52
53
|
else
|
53
54
|
logger.info "Already received (id: #{mail.message_id})...\n"
|
@@ -70,7 +71,7 @@ class Elt < ActiveRecord::Base
|
|
70
71
|
#
|
71
72
|
def publish
|
72
73
|
logger.info "Publish #{subject}"
|
73
|
-
self.mail
|
74
|
+
self.mail ||= Mail.new
|
74
75
|
self.mail.elt = self
|
75
76
|
self.mail.publish
|
76
77
|
self.mail.save
|
data/app/models/mail.rb
CHANGED
@@ -39,62 +39,51 @@ class Mail < ActiveRecord::Base
|
|
39
39
|
elt.person.email = mail.from.first
|
40
40
|
|
41
41
|
# Try to find its mail parent in the db
|
42
|
-
if mail.
|
42
|
+
if mail.in_reply_to
|
43
|
+
m = Mail.find_by_message(mail.in_reply_to)
|
44
|
+
elt.parent = m.elt if m
|
45
|
+
end
|
46
|
+
|
47
|
+
# Try to find its mail parent in the db
|
48
|
+
if not elt.parent and mail.references
|
43
49
|
for parent in mail.references
|
44
50
|
m = Mail.find_by_message(parent.to_s)
|
45
51
|
elt.parent = m.elt if m
|
46
52
|
end
|
47
53
|
end
|
48
54
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
55
|
+
begin
|
56
|
+
# No reference matching an existing parent, let's try a mailing list we
|
57
|
+
# deduce from an eventual [subject]
|
58
|
+
if not elt.parent and elt.subject.match(/\[[\w-]*\]/)
|
59
|
+
parentId = elt.subject.match(/\[[\w-]*\]/)
|
60
|
+
parentId = parentId[0].gsub(/[\[\]]/, '') if parentId
|
54
61
|
|
55
|
-
begin
|
56
62
|
elt.parent = Elt.find(parentId)
|
57
|
-
|
58
|
-
rescue ActiveRecord::RecordNotFound
|
59
|
-
elt.parent = elt.build_parent
|
60
|
-
elt.parent.parent_id = 'mail'
|
61
|
-
elt.parent.subject = parentId
|
62
|
-
elt.parent.body = ''
|
63
|
-
elt.parent.save
|
64
63
|
end
|
65
|
-
end
|
66
64
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
.
|
65
|
+
# No reference matching an existing parent, let's try the "to" field
|
66
|
+
to = mail["Envelope-to"].to_s + ', ' + mail.to.to_s
|
67
|
+
if not elt.parent and to.match(/\w*@#{ActionMailer::Base.server_settings[:domain]}/)
|
68
|
+
parentId = to.match(/\w*@#{ActionMailer::Base.server_settings[:domain]}/)[0] \
|
69
|
+
.gsub(/@#{ActionMailer::Base.server_settings[:domain]}/, '')
|
71
70
|
|
72
|
-
begin
|
73
71
|
elt.parent = Elt.find(parentId)
|
74
|
-
|
75
|
-
rescue ActiveRecord::RecordNotFound
|
76
|
-
elt.parent = elt.build_parent
|
77
|
-
elt.parent.parent_id = 'mail'
|
78
|
-
elt.parent.subject = parentId
|
79
|
-
elt.parent.body = ''
|
80
|
-
elt.parent.save
|
81
72
|
end
|
82
|
-
end
|
83
73
|
|
84
|
-
|
85
|
-
|
74
|
+
if not elt.parent
|
75
|
+
parentId = "lost+found"
|
86
76
|
|
87
|
-
begin
|
88
77
|
elt.parent = Elt.find(parentId)
|
89
|
-
|
90
|
-
rescue ActiveRecord::RecordNotFound
|
91
|
-
elt.id = parentId
|
92
|
-
elt.parent = elt.build_parent
|
93
|
-
elt.parent.parent_id = 'mail'
|
94
|
-
elt.parent.subject = parentId
|
95
|
-
elt.parent.body = ''
|
96
|
-
elt.parent.save
|
97
78
|
end
|
79
|
+
|
80
|
+
rescue ActiveRecord::RecordNotFound
|
81
|
+
elt.parent = elt.build_parent
|
82
|
+
elt.parent.id = parentId
|
83
|
+
elt.parent.parent_id = 'mail'
|
84
|
+
elt.parent.subject = parentId
|
85
|
+
elt.parent.body = ''
|
86
|
+
elt.parent.save
|
98
87
|
end
|
99
88
|
|
100
89
|
#elt.parent = Elt.find('mail') if not elt.parent
|
@@ -121,7 +110,9 @@ class Mail < ActiveRecord::Base
|
|
121
110
|
if message and not message.blank? and file
|
122
111
|
mail = TMail::Mail.parse(file)
|
123
112
|
else
|
124
|
-
|
113
|
+
logger.info "there"
|
114
|
+
mail = MailNotify.create_publish(elt)
|
115
|
+
logger.info "tehre"
|
125
116
|
self.mail_parents = mail.references
|
126
117
|
self.file = mail.encoded
|
127
118
|
end
|
@@ -153,11 +144,19 @@ class Mail < ActiveRecord::Base
|
|
153
144
|
ret.empty? ? default : ret
|
154
145
|
end
|
155
146
|
|
147
|
+
if mail.message_id
|
148
|
+
# Let's not change the message id
|
149
|
+
def mail.add_message_id
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
156
153
|
# Added to make sure it is not lost, but not modified if already existant
|
157
154
|
mail['X-Message-Id'] = mail.message_id if not mail['X-Message-Id']
|
158
155
|
|
156
|
+
mail['X-leparlement-elt-Id'] = elt.id
|
157
|
+
|
159
158
|
|
160
|
-
MailNotify::deliver(mail) if not mail.destinations.empty?
|
159
|
+
MailNotify::deliver(mail) if mail.destinations and not mail.destinations.empty?
|
161
160
|
|
162
161
|
# Do it after sending, to get the actual message id as generated by the MTA
|
163
162
|
# Note that the id of a resent mail is regenerated, but we don't record it,
|
@@ -185,6 +184,7 @@ class Mail < ActiveRecord::Base
|
|
185
184
|
def mngAttachment(attachment)
|
186
185
|
if attachment.content_type == 'text/plain'
|
187
186
|
elt.body += attachment.body
|
187
|
+
#elt.body += Iconv.new(attachment.type_param('charset'), 'iso-8859-15').iconv(attachment.body)
|
188
188
|
|
189
189
|
elsif attachment.multipart?
|
190
190
|
attachment.parts.each { |part| mngAttachment(part) }
|
data/app/models/mail_notify.rb
CHANGED
@@ -6,29 +6,46 @@
|
|
6
6
|
#
|
7
7
|
class MailNotify < ActionMailer::Base
|
8
8
|
def publish(elt)
|
9
|
-
|
10
|
-
|
11
|
-
#@body = elt.body
|
12
|
-
@body[:elt] = elt
|
9
|
+
logger.info "Create a mail for publication"
|
10
|
+
subject elt.subject
|
13
11
|
|
14
|
-
|
12
|
+
recipients (mailing_list(elt.parent).subject.blank? ? '' : mailing_list(elt.parent).subject ) \
|
15
13
|
+ ' <' \
|
16
14
|
+ mailing_list(elt.parent).id + '@' + ActionMailer::Base.server_settings[:domain] \
|
17
15
|
+ '>'
|
18
16
|
|
19
|
-
|
17
|
+
from ((elt.person and elt.person.name) ? elt.person.name : ANONYMOUS_POSTER) \
|
20
18
|
+ ' <' \
|
21
19
|
+ ((elt.person and elt.person.email) \
|
22
20
|
? elt.person.email : ANONYMOUS_POSTER + '@' + ActionMailer::Base.server_settings[:domain]) \
|
23
21
|
+ '> '
|
24
22
|
|
23
|
+
# Try to render the element as html
|
24
|
+
body(:elt => elt)
|
25
|
+
|
26
|
+
#content_type 'multipart/alternative'
|
27
|
+
#part "text/html" do |a|
|
28
|
+
# a.body = render(:template => "/home/manu/develop/parlement/trunk/app/views/mail_notify/publish.text.html.rhtml",
|
29
|
+
# :locals => { :elt => elt })
|
30
|
+
#end
|
31
|
+
#part "text/plain" do |a|
|
32
|
+
# a.body = render(:template => "mail_notify/publish.text.plain",
|
33
|
+
# :locals => { :elt => elt })
|
34
|
+
#end
|
35
|
+
# :body => email_builder.render(:file => "mail_notify/publish.text.html.rhtml")
|
36
|
+
#attachment :content_type => "text/html",
|
37
|
+
# :body => email_builder.render(:file => "mail_notify/publish.text.html.rhtml")
|
38
|
+
#attachment :content_type => "text/plain",
|
39
|
+
# :body => email_builder.render(:file => "mail_notify/publish.text.plain.rhtml")
|
40
|
+
|
41
|
+
|
25
42
|
# This is the essential of a mailing list, you reply to the mailing list,
|
26
43
|
# where every body sends their mail.
|
27
44
|
# This very mail can be a mailing list all by itself...
|
28
45
|
@headers['Reply-to'] = mailing_list(elt).id + '@' + ActionMailer::Base.server_settings[:domain]
|
29
46
|
|
30
|
-
@headers['In-Reply-To'] = elt.parent.mail.message
|
31
|
-
and elt.parent.mail and elt.parent.mail.message
|
47
|
+
@headers['In-Reply-To'] = elt.parent.mail.message \
|
48
|
+
if elt.parent and elt.parent.mail and elt.parent.mail.message
|
32
49
|
|
33
50
|
@sent_on = elt.created_on
|
34
51
|
|
@@ -39,9 +56,9 @@ class MailNotify < ActionMailer::Base
|
|
39
56
|
@headers['references'] << parentMsg.message if parentMsg.message
|
40
57
|
end
|
41
58
|
|
42
|
-
@content_type = 'multipart/alternative'
|
43
|
-
|
44
59
|
@headers['X-Mailer'] = ActionMailer::Base.server_settings[:domain] + " v" + PARLEMENT_VERSION
|
60
|
+
|
61
|
+
logger.info "Mail created"
|
45
62
|
end
|
46
63
|
|
47
64
|
private
|
@@ -11,7 +11,8 @@
|
|
11
11
|
<%= text_field "person", "name", :size => 10 %>
|
12
12
|
|
13
13
|
<%= link_to_function('+',
|
14
|
-
|
14
|
+
"Element.toggle(this);"+visual_effect(:Grow, 'user_password_'+divId.to_s),
|
15
|
+
:class => "subscribeLink") %>
|
15
16
|
</span>
|
16
17
|
|
17
18
|
<span style="display: none;" id="user_password_<%= divId %>">
|
@@ -20,7 +21,8 @@
|
|
20
21
|
<%= password_field "user", "password", :size => 10 %>
|
21
22
|
|
22
23
|
<%= link_to_function('email? >',
|
23
|
-
|
24
|
+
"Element.toggle(this);"+visual_effect(:Grow, 'person_email_'+divId.to_s),
|
25
|
+
:class => "subscribeLink") %>
|
24
26
|
</span>
|
25
27
|
|
26
28
|
<span style="display: none;" id="person_email_<%= divId %>">
|
@@ -36,12 +38,12 @@
|
|
36
38
|
|
37
39
|
<%= render :partial => '/help',
|
38
40
|
:locals => { :divId => 'login'+divId.to_s, :content => '
|
39
|
-
<p>You can propose an element</p>
|
41
|
+
<p>You can propose an element with</p>
|
40
42
|
<ul>
|
41
|
-
<li>
|
42
|
-
<li>
|
43
|
-
<li>
|
44
|
-
<li>
|
43
|
+
<li>no pseudo</li>
|
44
|
+
<li>an unprotected pseudo</li>
|
45
|
+
<li>a password protected pseudo (click on "+")</li>
|
46
|
+
<li>a password protected and email verified pseudo</li>
|
45
47
|
</ul>
|
46
48
|
<p>
|
47
49
|
The last method is the only secure way to protect a nickname on
|
@@ -7,20 +7,20 @@
|
|
7
7
|
|
8
8
|
<% if @session[:person] %>
|
9
9
|
<% if @session[:person].name and @session[:person].name != '' %>
|
10
|
-
<
|
10
|
+
<span class="author">
|
11
11
|
<%= link_to(@session[:person].name,
|
12
12
|
:controller => 'person',
|
13
13
|
:action => 'show',
|
14
14
|
:id => @session[:person]) %>
|
15
|
-
</
|
15
|
+
</span>
|
16
16
|
<% end %>
|
17
17
|
|
18
|
-
<
|
18
|
+
<span class="logout">
|
19
19
|
<%= link_to_remote('[X]',
|
20
20
|
:update => divId,
|
21
21
|
:url => { :controller => 'account', :action => 'logout', :divId => divId },
|
22
22
|
:complete => visual_effect(:BlindDown, divId)) %>
|
23
|
-
</
|
23
|
+
</span>
|
24
24
|
<% else %>
|
25
25
|
|
26
26
|
<%= render :partial => '/account/login', :locals => { :divId => divId } %>
|
data/app/views/elt/_elt.rhtml
CHANGED
@@ -1,35 +1,21 @@
|
|
1
1
|
<% eltSubsNb = elt.children.count if eltSubsNb == nil %>
|
2
2
|
|
3
|
-
<
|
4
|
-
<% if elt.person %>
|
5
|
-
<div class="author">
|
6
|
-
<%= link_to(elt.person.name,
|
7
|
-
:controller => 'person', :action => 'show', :id => elt.person) %>
|
8
|
-
</div>
|
9
|
-
<% elsif not displayTitle? elt %>
|
10
|
-
<div class="author">
|
11
|
-
<%= ANONYMOUS_POSTER %>
|
12
|
-
</div>
|
13
|
-
<% end %>
|
14
|
-
|
15
|
-
<div class="eltInfo" title="<%= elt.created_on %>">
|
16
|
-
<!--
|
17
|
-
<= link_to('@', :action => 'raw_elt', :id => elt) if elt.mail != nil >
|
18
|
-
-->
|
19
|
-
<% if elt.id and elt.children.count == 0 %>
|
20
|
-
<%= link_to_remote('<span class="icon">>></span>',
|
21
|
-
:update => 'eltNew_'+elt.id.to_s,
|
22
|
-
:url => { :controller => 'elt', :action => 'new', :id => elt },
|
23
|
-
:loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
|
24
|
-
visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)) %>
|
25
|
-
<% end %>
|
26
|
-
</div>
|
27
|
-
|
3
|
+
<li id="elt_<%= elt.id %>" class="elt <%= displayTitle?(elt) ? 'titled' : '' %>">
|
28
4
|
<% if eltTop or displayTitle? elt %>
|
29
5
|
<span class="created_on">
|
30
6
|
<%= elt.created_on.strftime('%d/%m/%y %H:%M') %>
|
31
7
|
</span>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% if elt.person %>
|
11
|
+
<span class="author">
|
12
|
+
<%= link_to(elt.person.name, :controller => 'person', :action => 'show', :id => elt.person) %>
|
13
|
+
</span>
|
14
|
+
<% elsif not displayTitle? elt %>
|
15
|
+
<span class="author" <%= ANONYMOUS_POSTER %>><%= ANONYMOUS_POSTER %></span>
|
16
|
+
<% end %>
|
32
17
|
|
18
|
+
<% if eltTop or displayTitle? elt %>
|
33
19
|
<<%= eltTop ? 'h1' : 'h2' %>>
|
34
20
|
<% if elt.id %>
|
35
21
|
<%= link_to(textilize_without_paragraph(elt.subject),
|
@@ -40,46 +26,60 @@
|
|
40
26
|
</<%= eltTop ? 'h1' : 'h2' %>>
|
41
27
|
<% end %>
|
42
28
|
|
43
|
-
|
44
|
-
|
29
|
+
<%= format elt.body %>
|
30
|
+
|
31
|
+
<% for att in elt.attachments %>
|
32
|
+
<%= link_to image_tag('/attachment/file/'+att.file_relative_path),
|
33
|
+
'/attachment/file/'+att.file_relative_path %>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<!-- For IE --> 
|
45
37
|
|
46
|
-
|
47
|
-
|
48
|
-
|
38
|
+
<span class="eltQuickAdd" id="eltQuickAdd_<%= elt.id %>" title="<%= elt.created_on %>">
|
39
|
+
<% if elt.id and elt.children.count == 0 %>
|
40
|
+
<%= link_to_remote('<span class="icon">>></span>',
|
41
|
+
{ :update => 'eltNew_'+elt.id.to_s,
|
42
|
+
:url => { :controller => 'elt', :action => 'new', :id => elt },
|
43
|
+
:loading => visual_effect(:SwitchOff, 'eltQuickAdd_'+elt.id.to_s),
|
44
|
+
:loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
|
45
|
+
visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)},
|
46
|
+
{ :href => url_for(:controller => 'elt', :action => 'new', :id => @elt)}) %>
|
49
47
|
<% end %>
|
50
|
-
</
|
48
|
+
</span>
|
51
49
|
|
52
|
-
<
|
50
|
+
<span class="eltSub">
|
53
51
|
<!-- Display automatically one element threads -->
|
54
|
-
<
|
52
|
+
<span <%= (eltTop or eltSubsNb < 2) ? 'style="display: none"' : '' %>
|
55
53
|
class="eltMore" id="eltMore_<%= elt.id %>">
|
56
54
|
<%= link_to_remote(eltSubsNb.to_s+' more',
|
57
|
-
|
55
|
+
{ :update => 'eltSubs_'+elt.id.to_s,
|
58
56
|
:url => { :controller => 'elt', :action => 'list', :id => elt },
|
59
|
-
:loading => visual_effect(:SwitchOff, 'eltMore_'+elt.id.to_s)
|
60
|
-
|
61
|
-
|
57
|
+
:loading => visual_effect(:SwitchOff, 'eltMore_'+elt.id.to_s),
|
58
|
+
:loaded => visual_effect(:BlindDown, 'eltSubs_'+elt.id.to_s)+
|
59
|
+
visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)},
|
60
|
+
{ :href => url_for(:controller => 'elt', :action => 'show', :id => elt) }) %>
|
62
61
|
|
63
62
|
<%= link_to_remote('Add <span class="icon">>></span>',
|
64
|
-
|
63
|
+
{ :update => 'eltNew_'+elt.id.to_s,
|
65
64
|
:url => { :controller => 'elt', :action => 'new', :id => elt },
|
66
65
|
:loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
|
67
|
-
visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)
|
68
|
-
|
66
|
+
visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)},
|
67
|
+
{ :href => url_for(:controller => 'elt', :action => 'new', :id => elt)}) %>
|
68
|
+
</span>
|
69
69
|
|
70
|
-
<
|
71
|
-
|
70
|
+
<span <%= (eltTop or eltSubsNb == 1) ? '' : 'style="display: none"' %>
|
71
|
+
id="eltSubs_<%= elt.id %>">
|
72
72
|
<% if eltTop or eltSubsNb == 1 %>
|
73
73
|
<%= render :partial => '/elt/list', :locals => { :elt => elt } %>
|
74
74
|
<% end %>
|
75
|
-
</
|
75
|
+
</span>
|
76
76
|
|
77
|
-
<
|
77
|
+
<span style="display: none" class="eltNew" id="eltNew_<%= elt.id %>">
|
78
78
|
|
79
|
-
</
|
80
|
-
</
|
79
|
+
</span>
|
80
|
+
</span>
|
81
81
|
|
82
|
-
<
|
82
|
+
<span <%= ((eltTop and eltSubsNb > 0) or eltSubsNb == 1) ? '' : 'style="display: none"' %>
|
83
83
|
id="eltSubsClose_<%= elt.id %>" title="<%= elt.created_on %>"
|
84
84
|
class="eltSubsClose">
|
85
85
|
<%= link_to_function('<span class="icon"><<</span> Close',
|
@@ -96,10 +96,11 @@
|
|
96
96
|
<% end %>
|
97
97
|
|
98
98
|
<%= link_to_remote('Add <span class="icon">>></span>',
|
99
|
-
|
99
|
+
{ :update => 'eltNew_'+elt.id.to_s,
|
100
100
|
:url => { :controller => 'elt', :action => 'new', :id => elt },
|
101
101
|
:loaded => visual_effect(:BlindDown, 'eltNew_'+elt.id.to_s)+
|
102
|
-
visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)
|
103
|
-
|
104
|
-
</
|
102
|
+
visual_effect(:BlindDown, 'eltSubsClose_'+elt.id.to_s)},
|
103
|
+
{ :href => url_for(:controller => 'elt', :action => 'new', :id => elt)}) %>
|
104
|
+
</span>
|
105
|
+
</li>
|
105
106
|
|