sugoi-mail 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +35 -0
- data/Rakefile +10 -0
- data/app/apis/mailservice_api.rb +178 -0
- data/app/controllers/.sugoi_admin_controller.rb.swp +0 -0
- data/app/controllers/account_controller.rb +39 -0
- data/app/controllers/address_controller.rb +49 -0
- data/app/controllers/application.rb +4 -0
- data/app/controllers/commandline_controller.rb +15 -0
- data/app/controllers/domain_controller.rb +37 -0
- data/app/controllers/mailinglist_controller.rb +51 -0
- data/app/controllers/mailservice_controller.rb +497 -0
- data/app/controllers/sugoi_admin_controller.rb +93 -0
- data/app/helpers/account_helper.rb +2 -0
- data/app/helpers/address_helper.rb +2 -0
- data/app/helpers/application_helper.rb +3 -0
- data/app/helpers/domain_helper.rb +2 -0
- data/app/helpers/mailservice_helper.rb +2 -0
- data/app/helpers/sugoi_admin_helper.rb +2 -0
- data/app/models/address.rb +110 -0
- data/app/models/admin_message.rb +45 -0
- data/app/models/confirmationcode.rb +59 -0
- data/app/models/domain.rb +76 -0
- data/app/models/mailinglist.rb +336 -0
- data/app/models/mailinglist_class.rb +39 -0
- data/app/models/message.rb +293 -0
- data/app/models/proxy_link.rb +25 -0
- data/app/models/user.rb +150 -0
- data/app/views/account/login.rhtml +22 -0
- data/app/views/account/logout.rhtml +10 -0
- data/app/views/account/signup.rhtml +17 -0
- data/app/views/account/welcome.rhtml +13 -0
- data/app/views/address/_form.rhtml +7 -0
- data/app/views/address/edit.rhtml +10 -0
- data/app/views/address/list.rhtml +27 -0
- data/app/views/address/new.rhtml +8 -0
- data/app/views/address/show.rhtml +8 -0
- data/app/views/domain/login.rhtml +22 -0
- data/app/views/domain/logout.rhtml +10 -0
- data/app/views/domain/signup.rhtml +17 -0
- data/app/views/domain/welcome.rhtml +13 -0
- data/app/views/layouts/address.rhtml +13 -0
- data/app/views/layouts/scaffold.rhtml +13 -0
- data/app/views/mailinglist/_form.rhtml +28 -0
- data/app/views/mailinglist/edit.rhtml +10 -0
- data/app/views/mailinglist/list.rhtml +27 -0
- data/app/views/mailinglist/new.rhtml +8 -0
- data/app/views/mailinglist/show.rhtml +16 -0
- data/app/views/sugoi_admin/create_domain.rhtml +1 -0
- data/app/views/sugoi_admin/list_addresses.rhtml +1 -0
- data/app/views/sugoi_admin/list_domains.rhtml +2 -0
- data/app/views/sugoi_admin/list_mailinglists.rhtml +1 -0
- data/bin/mailc +32 -0
- data/bin/maild +133 -0
- data/bin/sugoi-admin +21 -0
- data/bin/sugoi-mail +20 -0
- data/config/boot.rb +44 -0
- data/config/environment.rb +54 -0
- data/config/environments/bench.rb +21 -0
- data/config/environments/coverage.rb +21 -0
- data/config/environments/development.rb +21 -0
- data/config/environments/production.rb +18 -0
- data/config/environments/test.rb +19 -0
- data/config/lighttpd.conf +46 -0
- data/config/routes.rb +29 -0
- data/db/migrate/001_mailproxy.rb +7 -0
- data/db/migrate/002_create_users.rb +13 -0
- data/db/migrate/003_create_mailinglists.rb +13 -0
- data/db/migrate/004_create_addresses.rb +12 -0
- data/db/migrate/005_create_addresses_mailinglists.rb +13 -0
- data/db/migrate/006_alter_mailinglists.rb +9 -0
- data/db/migrate/007_create_messages.rb +25 -0
- data/db/migrate/008_add_mailinglistid_to_users.rb +14 -0
- data/db/migrate/009_add_domainadmin_to_users.rb +9 -0
- data/db/migrate/010_add_domain_to_users.rb +16 -0
- data/db/migrate/011_add_active_to_addresses.rb +14 -0
- data/db/migrate/012_create_confirmationcodes.rb +14 -0
- data/db/migrate/013_add_description_to_mailinglists.rb +9 -0
- data/db/migrate/014_create_admin_messages.rb +69 -0
- data/db/migrate/015_add_messages_to_mailinglists.rb +26 -0
- data/db/migrate/016_add_mailinglist_admin_to_users.rb +9 -0
- data/db/migrate/017_add_mailinglist_types.rb +94 -0
- data/db/migrate/018_add_bounciness_to_addresses.rb +20 -0
- data/db/migrate/019_add_archived_to_mailinglist_classes.rb +25 -0
- data/db/migrate/020_add_envelope_data_to_messages.rb +11 -0
- data/db/migrate/021_add_addresses_users.rb +14 -0
- data/db/migrate/022_add_virtual_to_users.rb +14 -0
- data/db/migrate/023_drop_openposting_from_mailinglists.rb +9 -0
- data/db/migrate/024_add_proxy_links.rb +21 -0
- data/db/migrate/025_add_proxify_to_mailinglist_classes.rb +25 -0
- data/db/schema.mysql.sql +104 -0
- data/db/schema.postgresql.sql +104 -0
- data/db/schema.rb +85 -0
- data/db/schema.sqlite.sql +104 -0
- data/db/schema.sqlserver.sql +113 -0
- data/db/schema_version +1 -0
- data/doc/README_FOR_APP +179 -0
- data/doc/mailinglist_classes description.txt +28 -0
- data/installer/rails_installer_defaults.yml +5 -0
- data/lib/daemonize.rb +56 -0
- data/lib/domain_system.rb +87 -0
- data/lib/gurgitate-rules.rb +69 -0
- data/lib/limitedfork.rb +66 -0
- data/lib/login_system.rb +87 -0
- data/public/.htaccess +40 -0
- data/public/404.html +8 -0
- data/public/500.html +8 -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 +815 -0
- data/public/javascripts/dragdrop.js +913 -0
- data/public/javascripts/effects.js +958 -0
- data/public/javascripts/prototype.js +2006 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/scaffold.css +74 -0
- data/public/stylesheets/trestle.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/fakedeliver +19 -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/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/sugoi-mail.gemspec +36 -0
- data/test/fixtures/addresses.yml +70 -0
- data/test/fixtures/addresses_mailinglists.yml +20 -0
- data/test/fixtures/admin_messages.yml +65 -0
- data/test/fixtures/confirmationcodes.yml +13 -0
- data/test/fixtures/domains.yml +9 -0
- data/test/fixtures/mailinglist_classes.yml +45 -0
- data/test/fixtures/mailinglists.yml +80 -0
- data/test/fixtures/messages.yml +154 -0
- data/test/fixtures/proxy_links.yml +5 -0
- data/test/fixtures/users.yml +50 -0
- data/test/functional/domain_controller_test.rb +74 -0
- data/test/functional/mailservice_controller_test.rb +546 -0
- data/test/integration/test_soap.rb +413 -0
- data/test/integration/test_xmlrpc.rb +198 -0
- data/test/mocks/test/net-smtp-stub.rb +24 -0
- data/test/test_helper.rb +28 -0
- data/test/unit/address_test.rb +44 -0
- data/test/unit/admin_message_test.rb +41 -0
- data/test/unit/confirmationcode_test.rb +64 -0
- data/test/unit/domain_test.rb +128 -0
- data/test/unit/mailinglist_class_test.rb +82 -0
- data/test/unit/mailinglist_test.rb +145 -0
- data/test/unit/message_test.rb +151 -0
- data/test/unit/user_test.rb +126 -0
- data/test/units.rb +4 -0
- data/vendor/plugins/active_command/init.rb +1 -0
- data/vendor/plugins/active_command/lib/active_command/request.rb +137 -0
- data/vendor/plugins/active_command/lib/active_command/response.rb +132 -0
- data/vendor/plugins/active_command/lib/active_command.rb +2 -0
- data/vendor/plugins/ar_fixtures/CHANGELOG +10 -0
- data/vendor/plugins/ar_fixtures/MIT-LICENSE +20 -0
- data/vendor/plugins/ar_fixtures/README +19 -0
- data/vendor/plugins/ar_fixtures/Rakefile +54 -0
- data/vendor/plugins/ar_fixtures/about.yml +7 -0
- data/vendor/plugins/ar_fixtures/init.rb +1 -0
- data/vendor/plugins/ar_fixtures/lib/ar_fixtures.rb +102 -0
- data/vendor/plugins/ar_fixtures/tasks/ar_fixtures.rake +39 -0
- data/vendor/plugins/ar_fixtures/test/ar_fixtures_test.rb +53 -0
- data/vendor/plugins/ar_fixtures/test/database.yml +18 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/beer.rb +5 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/beers.yml +9 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/beers_drunkards.yml +8 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/drunkard.rb +6 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/drunkards.yml +8 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/glass.rb +2 -0
- data/vendor/plugins/ar_fixtures/test/fixtures/glasses.yml +9 -0
- data/vendor/plugins/ar_fixtures/test/schema.rb +21 -0
- data/vendor/plugins/ar_fixtures/test/test_helper.rb +37 -0
- metadata +320 -0
data/README
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
ABOUT SUGOI MAIL
|
2
|
+
|
3
|
+
Sugoi Mail is a mailing list manager, with a difference!
|
4
|
+
|
5
|
+
Sure, you can use it just to run your normal mailing lists. Indeed, it
|
6
|
+
does that very well! You can have thousands of mailing lists at your
|
7
|
+
site with sugoi-mail.
|
8
|
+
|
9
|
+
But it's much more than that. It takes the concept of the mailing list,
|
10
|
+
and stretches it in every direction it can think of. Personal
|
11
|
+
distribution lists? Why, that's just another kind of mailing list. Closed
|
12
|
+
announcement lists? Sure thing. Personal mail forwarding addresses?
|
13
|
+
Absolutely.
|
14
|
+
|
15
|
+
And built using the combined forces of Ruby on Rails and Gurgitate-Mail,
|
16
|
+
you can combine the two in ways never thought of before. Want to build a
|
17
|
+
simple webmail system? Sure! Want to integrate mail-forwarding as an
|
18
|
+
extra for users of your bulletin board system? Don't want to do that
|
19
|
+
stuff yourself? Just call us and we'll be glad to help you out.
|
20
|
+
|
21
|
+
Sugoi Mail: Building mailing lists out of webs and toffee.
|
22
|
+
|
23
|
+
And because my boss told me to put this here: Sugoi-Mail is an open
|
24
|
+
source project proudly sponsored by Invio, the makers of the Ichinichi
|
25
|
+
Ichimon line of educational software.
|
26
|
+
|
27
|
+
NOTE FOR FOLKS GOING TO INSTALL IT: Right now, this is in a state that
|
28
|
+
I'd call PRE-ALPHA.
|
29
|
+
|
30
|
+
That is to say, parts of it have been in service for weeks, but there's
|
31
|
+
still no real interface, the SOAP interface is underdocumented and
|
32
|
+
probably incorrect at this point anyway, and everythings
|
33
|
+
overcomplicated. In other words: FOR ADVENTUROUS PEOPLE ONLY. That
|
34
|
+
said, if you do decide to install it, I greet you! I'll be writing an
|
35
|
+
installer presently.
|
data/Rakefile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
|
10
|
+
require 'tasks/rails'
|
@@ -0,0 +1,178 @@
|
|
1
|
+
class MailserviceApi < ActionWebService::API::Base
|
2
|
+
#------------------------------------------------------------------------
|
3
|
+
# Server methods
|
4
|
+
#------------------------------------------------------------------------
|
5
|
+
|
6
|
+
api_method :ping, :returns => [ :bool ],
|
7
|
+
:expects => [ ]
|
8
|
+
|
9
|
+
#------------------------------------------------------------------------
|
10
|
+
# domain methods
|
11
|
+
#------------------------------------------------------------------------
|
12
|
+
api_method :domain_login, :returns => [ :bool ],
|
13
|
+
:expects => [ { :domainname => :string },
|
14
|
+
{ :password => :string } ]
|
15
|
+
|
16
|
+
api_method :domain_logout, :returns => [ :bool ],
|
17
|
+
:expects => []
|
18
|
+
|
19
|
+
api_method :domain_logged_in, :returns => [ :bool ],
|
20
|
+
:expects => []
|
21
|
+
|
22
|
+
api_method :domain_name, :returns => [ :string ],
|
23
|
+
:expects => []
|
24
|
+
#------------------------------------------------------------------------
|
25
|
+
# admin methods
|
26
|
+
#------------------------------------------------------------------------
|
27
|
+
|
28
|
+
api_method :is_admin, :returns => [ :bool ],
|
29
|
+
:expects => [ ]
|
30
|
+
|
31
|
+
api_method :admin_user_signup, :returns => [ :bool ],
|
32
|
+
:expects => [ { :login => :string },
|
33
|
+
{ :password => :string },
|
34
|
+
{ :password_confirmation => :string } ]
|
35
|
+
|
36
|
+
api_method :admin_user_list, :returns => [ [ [:string, :string] ] ],
|
37
|
+
:expects => [ ]
|
38
|
+
|
39
|
+
api_method :admin_user_reset_password, :returns => [ :bool ],
|
40
|
+
:expects => [
|
41
|
+
{ :login => :string },
|
42
|
+
{ :password => :string },
|
43
|
+
{ :password_confirmation => :string }
|
44
|
+
]
|
45
|
+
|
46
|
+
api_method :admin_user_delete, :returns => [ :bool ],
|
47
|
+
:expects => [ { :login => :string },
|
48
|
+
{ :login_confirmation => :string } ]
|
49
|
+
|
50
|
+
api_method :admin_get_confirmation_code, :returns => [ :string ],
|
51
|
+
:expects => [ { :mailinglist_name => :string },
|
52
|
+
{ :address => :string } ]
|
53
|
+
|
54
|
+
#------------------------------------------------------------------------
|
55
|
+
# user methods
|
56
|
+
#------------------------------------------------------------------------
|
57
|
+
|
58
|
+
api_method :user_login, :returns => [ :bool ],
|
59
|
+
:expects => [ { :username => :string },
|
60
|
+
{ :password => :string } ]
|
61
|
+
|
62
|
+
api_method :user_logout, :returns => [ :bool ], :expects => []
|
63
|
+
|
64
|
+
api_method :user_logged_in, :returns => [ :bool ], :expects => []
|
65
|
+
api_method :user_name, :returns => [ :string ], :expects => []
|
66
|
+
|
67
|
+
api_method :user_mailinglists, :returns => [ [ :integer ] ],
|
68
|
+
:expects => []
|
69
|
+
|
70
|
+
api_method :user_email_address, :returns => [ :string ], :expects => []
|
71
|
+
|
72
|
+
api_method :user_email_addresses, :returns => [ [ :string ] ],
|
73
|
+
:expects => [ ]
|
74
|
+
api_method :user_email_addresses_confirmed, :returns => [ [ :string ] ],
|
75
|
+
:expects => [ ]
|
76
|
+
api_method :user_email_addresses_unconfirmed, :returns => [ [ :string ] ],
|
77
|
+
:expects => [ ]
|
78
|
+
|
79
|
+
api_method :user_email_address_confirm, :returns => [ :bool ],
|
80
|
+
:expects => [
|
81
|
+
{ :address => :string },
|
82
|
+
{ :code => :string }
|
83
|
+
]
|
84
|
+
|
85
|
+
api_method :user_change_password, :returns => [ :bool ],
|
86
|
+
:expects => [
|
87
|
+
{ :old_password => :string },
|
88
|
+
{ :password => :string },
|
89
|
+
{ :password_confirmation => :string }
|
90
|
+
]
|
91
|
+
|
92
|
+
api_method :user_real_name, :returns => [ :string ],
|
93
|
+
:expects => [ ]
|
94
|
+
|
95
|
+
api_method :user_change_real_name, :returns => [ :string ],
|
96
|
+
:expects => [
|
97
|
+
{ :password => :string },
|
98
|
+
{ :new_name => :string }
|
99
|
+
]
|
100
|
+
|
101
|
+
api_method :user_email_addresses_add, :returns => [ [ :string ] ],
|
102
|
+
:expects => [ { :addr => :string } ]
|
103
|
+
|
104
|
+
api_method :user_email_addresses_remove, :returns => [ :string ],
|
105
|
+
:expects => [ { :addr => :string } ]
|
106
|
+
|
107
|
+
#------------------------------------------------------------------------
|
108
|
+
# mailing list methods
|
109
|
+
#------------------------------------------------------------------------
|
110
|
+
|
111
|
+
api_method :mailinglist_create, :returns => [ :string ],
|
112
|
+
:expects => [ { :name => :string },
|
113
|
+
{ :mailinglist_class => :string } ]
|
114
|
+
|
115
|
+
api_method :mailinglist_classes, :returns => [ [ :string ] ],
|
116
|
+
:expects => [ ]
|
117
|
+
|
118
|
+
api_method :mailinglist_class_get_attributes,
|
119
|
+
:returns => [ MailinglistClass],
|
120
|
+
:expects => [ { :mlclass => :string } ]
|
121
|
+
|
122
|
+
api_method :mailinglist_name, :returns => [ :string ],
|
123
|
+
:expects => [ { :id => :integer } ]
|
124
|
+
|
125
|
+
api_method :mailinglist_address, :returns => [ :string ],
|
126
|
+
:expects => [ { :id => :integer } ]
|
127
|
+
|
128
|
+
api_method :mailinglist_find_by_name, :returns => [ :integer ],
|
129
|
+
:expects => [ { :name => :string } ]
|
130
|
+
|
131
|
+
api_method :mailinglist_delete, :returns => [ :bool ],
|
132
|
+
:expects => [ { :mailinglist_id => :integer } ]
|
133
|
+
|
134
|
+
api_method :mailinglist_subscribers, :returns => [ [ :string ] ],
|
135
|
+
:expects => [ { :mailinglist_id => :integer } ]
|
136
|
+
|
137
|
+
api_method :mailinglist_pending, :returns => [ [ :string ] ],
|
138
|
+
:expects => [ { :mailinglist_id => :integer } ]
|
139
|
+
|
140
|
+
api_method :mailinglist_subscribe, :returns => [ :bool ],
|
141
|
+
:expects => [
|
142
|
+
{ :mailinglist_id => :integer },
|
143
|
+
{ :address => :string }
|
144
|
+
]
|
145
|
+
|
146
|
+
api_method :mailinglist_confirm, :returns => [ :bool ],
|
147
|
+
:expects => [
|
148
|
+
{ :mailinglist_name => :string },
|
149
|
+
{ :address => :string },
|
150
|
+
{ :code => :string }
|
151
|
+
]
|
152
|
+
|
153
|
+
api_method :mailinglist_unsubscribe, :returns => [ :bool ],
|
154
|
+
:expects => [
|
155
|
+
{ :mailinglist_id => :integer },
|
156
|
+
{ :address => :string }
|
157
|
+
]
|
158
|
+
|
159
|
+
api_method :mailinglist_messages, :returns => [ [ :integer ] ],
|
160
|
+
:expects => [
|
161
|
+
{ :mailinglist_id => :integer }
|
162
|
+
]
|
163
|
+
|
164
|
+
api_method :message, :returns => [ Message ],
|
165
|
+
:expects => [
|
166
|
+
{ :message_id => :integer }
|
167
|
+
]
|
168
|
+
|
169
|
+
api_method :message_parent, :returns => [ :integer ],
|
170
|
+
:expects => [
|
171
|
+
{ :message_id => :integer }
|
172
|
+
]
|
173
|
+
|
174
|
+
api_method :message_responses, :returns => [ [ :integer ] ],
|
175
|
+
:expects => [
|
176
|
+
{ :message_id => :integer }
|
177
|
+
]
|
178
|
+
end
|
Binary file
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class AccountController < ApplicationController
|
2
|
+
layout 'scaffold'
|
3
|
+
|
4
|
+
include LoginSystem
|
5
|
+
|
6
|
+
def login
|
7
|
+
case @request.method
|
8
|
+
when :post
|
9
|
+
if @session[:user] = User.authenticate(@params[:user_login], @params[:user_password])
|
10
|
+
|
11
|
+
flash['notice'] = "Login successful"
|
12
|
+
redirect_back_or_default :action => "welcome"
|
13
|
+
else
|
14
|
+
flash.now['notice'] = "Login unsuccessful"
|
15
|
+
|
16
|
+
@login = @params[:user_login]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def signup
|
22
|
+
if @request.post?
|
23
|
+
@user = User.new(@params[:user])
|
24
|
+
if @user.save
|
25
|
+
@session[:user] = User.authenticate(@user.login, @params[:user][:password])
|
26
|
+
flash['notice'] = "Signup successful"
|
27
|
+
redirect_back_or_default :action => "welcome"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def logout
|
33
|
+
@session[:user] = nil
|
34
|
+
end
|
35
|
+
|
36
|
+
def welcome
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class AddressController < ApplicationController
|
2
|
+
verify :only => [ 'show', 'edit', 'destroy' ],
|
3
|
+
:params => :id,
|
4
|
+
:add_flash => { :notice => 'Missing address ID.' },
|
5
|
+
:redirect_to => { :action => 'list' }
|
6
|
+
|
7
|
+
def destroy
|
8
|
+
if request.post?
|
9
|
+
Address.find(params[:id]).destroy
|
10
|
+
flash[:notice] = 'The address was successfully destroyed.'
|
11
|
+
redirect_to :action => 'list'
|
12
|
+
else
|
13
|
+
flash[:notice] = 'Click Destroy to destroy the address.'
|
14
|
+
redirect_to :action => 'edit', :id => params[:id]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def edit
|
19
|
+
if request.post?
|
20
|
+
@address = Address.find(params[:id])
|
21
|
+
if @address.update_attributes(params[:address])
|
22
|
+
flash[:notice] = 'The address was successfully edited.'
|
23
|
+
redirect_to :action => 'show', :id => @address
|
24
|
+
end
|
25
|
+
else
|
26
|
+
@address = Address.find(params[:id])
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def list
|
31
|
+
@address_pages, @addresses = paginate(:addresses)
|
32
|
+
end
|
33
|
+
|
34
|
+
def new
|
35
|
+
if request.post?
|
36
|
+
@address = Address.new(params[:address])
|
37
|
+
if @address.save
|
38
|
+
flash[:notice] = 'A new address was successfully added.'
|
39
|
+
redirect_to :action => 'list'
|
40
|
+
end
|
41
|
+
else
|
42
|
+
@address = Address.new
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def show
|
47
|
+
@address = Address.find(params[:id])
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'highline/import'
|
2
|
+
|
3
|
+
# Controller for command line thingies
|
4
|
+
class CommandlineController < ApplicationController
|
5
|
+
def perform_action
|
6
|
+
if self.class.action_methods.include?(action_name.to_s) || self.class.action_methods.include?('method_missing')
|
7
|
+
send(action_name,*params["args"])
|
8
|
+
render unless performed?
|
9
|
+
elsif template_exists? && template_public?
|
10
|
+
render
|
11
|
+
else
|
12
|
+
raise UnknownAction, "No action responded to #{action_name}", caller
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class DomainController < ApplicationController
|
2
|
+
include DomainSystem
|
3
|
+
layout 'scaffold'
|
4
|
+
|
5
|
+
def login
|
6
|
+
case @request.method
|
7
|
+
when :post
|
8
|
+
if @session[:domain] = Domain.authenticate(@params[:domain_name], @params[:domain_password])
|
9
|
+
|
10
|
+
flash['notice'] = "Login successful"
|
11
|
+
redirect_back_or_default :action => "welcome"
|
12
|
+
else
|
13
|
+
flash.now['notice'] = "Login unsuccessful"
|
14
|
+
|
15
|
+
@login = @params[:domain_login]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def signup
|
21
|
+
@domain = Domain.new(@params[:domain])
|
22
|
+
|
23
|
+
if @request.post? and @domain.save
|
24
|
+
@session[:domain] = Domain.authenticate(@domain.name, @params[:domain][:password])
|
25
|
+
flash['notice'] = "Signup successful"
|
26
|
+
redirect_back_or_default :action => "welcome"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def logout
|
31
|
+
@session[:domain] = nil
|
32
|
+
end
|
33
|
+
|
34
|
+
def welcome
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class MailinglistController < ApplicationController
|
2
|
+
verify :only => [ 'show', 'edit', 'destroy' ],
|
3
|
+
:params => :id,
|
4
|
+
:add_flash => { :notice => 'Missing mailinglist ID.' },
|
5
|
+
:redirect_to => { :action => 'list' }
|
6
|
+
|
7
|
+
def destroy
|
8
|
+
if request.post?
|
9
|
+
Mailinglist.find(params[:id]).destroy
|
10
|
+
flash[:notice] = 'The mailinglist was successfully destroyed.'
|
11
|
+
redirect_to :action => 'list'
|
12
|
+
else
|
13
|
+
flash[:notice] = 'Click Destroy to destroy the mailinglist.'
|
14
|
+
redirect_to :action => 'edit', :id => params[:id]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def edit
|
19
|
+
if request.post?
|
20
|
+
@mailinglist = Mailinglist.find(params[:id])
|
21
|
+
if @mailinglist.update_attributes(params[:mailinglist])
|
22
|
+
if @mailinglist.save
|
23
|
+
flash[:notice] = 'The mailinglist was successfully edited.'
|
24
|
+
redirect_to :action => 'show', :id => @mailinglist
|
25
|
+
end
|
26
|
+
end
|
27
|
+
else
|
28
|
+
@mailinglist = Mailinglist.find(params[:id])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def list
|
33
|
+
@mailinglist_pages, @mailinglists = paginate(:mailinglists)
|
34
|
+
end
|
35
|
+
|
36
|
+
def new
|
37
|
+
if request.post?
|
38
|
+
@mailinglist = Mailinglist.new(params[:mailinglist])
|
39
|
+
if @mailinglist.save
|
40
|
+
flash[:notice] = 'A new mailinglist was successfully added.'
|
41
|
+
redirect_to :action => 'list'
|
42
|
+
end
|
43
|
+
else
|
44
|
+
@mailinglist = Mailinglist.new
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def show
|
49
|
+
@mailinglist = Mailinglist.find(params[:id])
|
50
|
+
end
|
51
|
+
end
|