kit_cms 2.3.20 → 2.3.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. data/app/assets/images/kit/toolbar/smile.png +0 -0
  2. data/app/assets/images/kit/toolbar/wink.gif +0 -0
  3. data/app/assets/images/kit/toolbar/wink.png +0 -0
  4. data/app/assets/javascripts/codemirror/editor.js +55 -17
  5. data/app/assets/javascripts/codemirror/jquery.js +0 -1
  6. data/app/assets/javascripts/codemirror/ruby.js +196 -0
  7. data/app/assets/javascripts/jquery.js +3036 -2838
  8. data/app/assets/javascripts/kit/utilities.js +655 -586
  9. data/app/assets/stylesheets/codemirror/style.css +1 -1
  10. data/app/assets/stylesheets/codemirror/theme.css +23 -3
  11. data/app/assets/stylesheets/kit/calendar.css +6 -1
  12. data/app/assets/stylesheets/kit/cms/cms.css +36 -0
  13. data/app/assets/stylesheets/kit/forums.css +5 -1
  14. data/app/assets/stylesheets/kit/kit.css +3 -1
  15. data/app/controllers/account_controller.rb +306 -0
  16. data/app/controllers/ad_controller.rb +2 -0
  17. data/app/controllers/admin/ad_units_controller.rb +1 -1
  18. data/app/controllers/admin/ad_zones_controller.rb +15 -0
  19. data/app/controllers/admin/ads_controller.rb +5 -0
  20. data/app/controllers/admin/block_controller.rb +1 -65
  21. data/app/controllers/admin/blocks_controller.rb +2 -0
  22. data/app/controllers/admin/content_controller.rb +3 -1
  23. data/app/controllers/admin/dashboard_controller.rb +28 -4
  24. data/app/controllers/admin/dj_controller.rb +45 -0
  25. data/app/controllers/admin/help_controller.rb +1 -1
  26. data/app/controllers/admin/html_asset_controller.rb +0 -12
  27. data/app/controllers/admin/q_controller.rb +120 -0
  28. data/app/controllers/admin/user_controller.rb +4 -4
  29. data/app/controllers/api_controller.rb +34 -0
  30. data/app/controllers/calendar_controller.rb +1 -1
  31. data/app/controllers/form_controller.rb +3 -3
  32. data/app/controllers/forum_controller.rb +39 -29
  33. data/app/controllers/kit_controller.rb +42 -15
  34. data/app/controllers/pages_controller.rb +25 -5
  35. data/app/controllers/q_controller.rb +235 -0
  36. data/app/controllers/repo_controller.rb +7 -0
  37. data/app/controllers/user_controller.rb +14 -10
  38. data/app/controllers/utility_controller.rb +1 -1
  39. data/app/helpers/account_helper.rb +47 -0
  40. data/app/helpers/admin/layouts_helper.rb +8 -0
  41. data/app/helpers/admin/page_templates_helper.rb +8 -0
  42. data/app/helpers/ads_helper.rb +11 -12
  43. data/app/helpers/calendar_helper.rb +6 -2
  44. data/app/helpers/form_data_helper.rb +1 -1
  45. data/app/helpers/form_helper.rb +8 -0
  46. data/app/helpers/forum_helper.rb +5 -1
  47. data/app/helpers/kit_helper.rb +65 -35
  48. data/app/helpers/kit_modules_helper.rb +4 -0
  49. data/app/helpers/user_helper.rb +0 -28
  50. data/app/jobs/page_link_job.rb +34 -0
  51. data/app/jobs/queue_job.rb +134 -0
  52. data/app/mailers/notification.rb +10 -0
  53. data/app/mailers/queue_mailer.rb +13 -0
  54. data/app/models/ad.rb +6 -6
  55. data/app/models/ad_unit.rb +1 -1
  56. data/app/models/ad_zone.rb +4 -0
  57. data/app/models/block.rb +1 -1
  58. data/app/models/delayed_job.rb +3 -0
  59. data/app/models/form.rb +16 -4
  60. data/app/models/html_asset.rb +19 -4
  61. data/app/models/html_asset_usage.rb +3 -0
  62. data/app/models/html_assetable.rb +4 -0
  63. data/app/models/layout.rb +36 -6
  64. data/app/models/newsletter.rb +1 -1
  65. data/app/models/page.rb +36 -2
  66. data/app/models/page_link.rb +5 -0
  67. data/app/models/page_template.rb +22 -2
  68. data/app/models/preference.rb +1 -1
  69. data/app/models/q_event.rb +12 -0
  70. data/app/models/q_klass.rb +5 -0
  71. data/app/models/q_message.rb +9 -0
  72. data/app/models/q_publisher.rb +35 -0
  73. data/app/models/q_subscription.rb +7 -0
  74. data/app/models/q_user.rb +29 -0
  75. data/app/models/q_users_method.rb +6 -0
  76. data/app/models/q_users_publisher.rb +6 -0
  77. data/app/models/user.rb +127 -19
  78. data/app/models/user_login.rb +4 -0
  79. data/app/validators/email_validator.rb +14 -0
  80. data/app/views/account/_edit.html.haml +40 -0
  81. data/app/views/account/_edit_intro.html.haml +3 -0
  82. data/app/views/account/_forgotten.html.haml +20 -0
  83. data/app/views/account/_forgotten_intro.html.haml +5 -0
  84. data/app/views/account/_sign_in.html.haml +31 -0
  85. data/app/views/account/_sign_in_intro.html.haml +4 -0
  86. data/app/views/account/_sign_up.html.haml +51 -0
  87. data/app/views/account/_sign_up_intro.html.haml +4 -0
  88. data/app/views/account/edit.html.haml +1 -0
  89. data/app/views/account/forgotten.html.haml +1 -0
  90. data/app/views/account/sign_in.html.haml +2 -0
  91. data/app/views/account/sign_up.html.haml +1 -0
  92. data/app/views/ad/_buy.html.haml +2 -1
  93. data/app/views/admin/ad_zones/_form.html.haml +1 -1
  94. data/app/views/admin/ad_zones/show.html.haml +2 -0
  95. data/app/views/admin/blocks/_form.html.haml +11 -1
  96. data/app/views/admin/dashboard/broken_links.html.haml +9 -0
  97. data/app/views/admin/dashboard/system.html.haml +11 -0
  98. data/app/views/admin/dj/index.html.haml +43 -0
  99. data/app/views/admin/form/_form.html.haml +15 -10
  100. data/app/views/admin/group/index.html.haml +1 -1
  101. data/app/views/admin/help/edit.html.haml +1 -1
  102. data/app/views/admin/html_asset/show.html.haml +9 -2
  103. data/app/views/admin/layouts/show.html.haml +10 -16
  104. data/app/views/admin/page_templates/_form.html.haml +9 -17
  105. data/app/views/admin/page_templates/show.html.haml +5 -4
  106. data/app/views/admin/q/events.html.haml +26 -0
  107. data/app/views/admin/q/index.html.haml +28 -0
  108. data/app/views/admin/q/klasses.html.haml +61 -0
  109. data/app/views/admin/q/messages.html.haml +37 -0
  110. data/app/views/admin/q/show.html.haml +98 -0
  111. data/app/views/admin/q/subscriptions.html.haml +26 -0
  112. data/app/views/admin/q/users.html.haml +27 -0
  113. data/app/views/admin/snippet/edit.html.erb +1 -1
  114. data/app/views/admin/snippet/new.html.erb +1 -1
  115. data/app/views/admin/stylesheet/show.html.haml +1 -1
  116. data/app/views/admin/user/index.html.erb +15 -6
  117. data/app/views/admin/user/view.html.erb +5 -4
  118. data/app/views/admin/views/_form.html.haml +3 -3
  119. data/app/views/calendar/_buy_tickets.html.haml +1 -1
  120. data/app/views/calendar/_calendar_entry.html.haml +1 -1
  121. data/app/views/calendar/_month.html.haml +7 -7
  122. data/app/views/form/_show.html.haml +1 -1
  123. data/app/views/forum/_add_post.html.haml +7 -8
  124. data/app/views/forum/_mod_thread.js.erb +46 -6
  125. data/app/views/forum/_post_moderation.html.haml +2 -1
  126. data/app/views/forum/_post_preview.html.haml +1 -9
  127. data/app/views/forum/_post_scripts.js.erb +29 -5
  128. data/app/views/forum/fetch_raw.html.haml +1 -0
  129. data/app/views/forum/moderate.html.haml +1 -0
  130. data/app/views/forum/topic_index.html.haml +4 -0
  131. data/app/views/notification/{event.txt.erb → event.text.erb} +0 -0
  132. data/app/views/notification/forgotten_password.text.erb +2 -0
  133. data/app/views/pages/content_edit.html.haml +1 -1
  134. data/app/views/pages/info.html.erb +13 -2
  135. data/app/views/pages/links.html.haml +63 -0
  136. data/app/views/user/edit_profile.html.haml +1 -1
  137. data/app/views/utility/_cm_editor.html.erb +13 -10
  138. data/app/views/utility/_cm_toolbar_markdown.html.haml +8 -1
  139. data/app/views/utility/_menu.html.haml +4 -0
  140. data/app/views/utility/mercury_html.html.haml +1 -0
  141. data/config/initializers/elastic_search.rb +6 -3
  142. data/config/initializers/extend_controller.rb +3 -0
  143. data/config/initializers/string.rb +9 -6
  144. data/config/initializers/warden.rb +49 -0
  145. data/config/locales/en.yml +29 -1
  146. data/config/routes.rb +35 -2
  147. data/lib/kit_cms.rb +7 -2
  148. data/lib/tasks/kit.rake +90 -2
  149. metadata +139 -27
  150. data/app/controllers/user/confirmations_controller.rb +0 -11
  151. data/app/controllers/user/passwords_controller.rb +0 -13
  152. data/app/controllers/user/registrations_controller.rb +0 -110
  153. data/app/controllers/user/sessions_controller.rb +0 -33
  154. data/app/controllers/user/unlocks_controller.rb +0 -13
  155. data/app/views/devise/_links.erb +0 -25
  156. data/app/views/devise/confirmations/new.html.erb +0 -12
  157. data/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
  158. data/app/views/devise/mailer/reset_password_instructions.html.erb +0 -8
  159. data/app/views/devise/mailer/unlock_instructions.html.erb +0 -7
  160. data/app/views/devise/passwords/edit.html.erb +0 -16
  161. data/app/views/devise/passwords/new.html.erb +0 -12
  162. data/app/views/devise/registrations/edit.html.erb +0 -28
  163. data/app/views/devise/registrations/new.html.erb +0 -18
  164. data/app/views/devise/sessions/new.html.erb +0 -18
  165. data/app/views/devise/shared/_links.erb +0 -25
  166. data/app/views/devise/unlocks/new.html.erb +0 -12
  167. data/app/views/pages/links.html.erb +0 -8
  168. data/app/views/user/shared/_links.erb +0 -25
  169. data/config/initializers/devise.rb +0 -196
  170. data/config/initializers/devise_extender.rb +0 -39
@@ -3,7 +3,7 @@
3
3
  .CodeMirror {
4
4
  /* Set height, width, borders, and global font properties here */
5
5
  font-family: monospace;
6
- height: 800px;
6
+ height: 600px;
7
7
  font-size: 15px;
8
8
  line-height: 18px;
9
9
  }
@@ -50,9 +50,16 @@
50
50
 
51
51
  .cm-s-neat {
52
52
  font-family: Arial, "sans serif";
53
+ }
54
+
55
+ .cm-s-neat .CodeMirror-cursor { border-left: 1px solid #111 !important;}
53
56
 
57
+ div.CodeMirror {
58
+ border: thin #AAA solid;
59
+ background-color: white;
54
60
  }
55
61
 
62
+
56
63
  .cm-s-neat span.cm-strong { font-weight: bold; }
57
64
  .cm-s-neat span.cm-em { text-decoration: underline; }
58
65
  .cm-s-neat span.cm-comment { color: #a86; }
@@ -65,13 +72,16 @@
65
72
  .cm-s-neat span.cm-meta {color: #555;}
66
73
  .cm-s-neat span.cm-link { color: #3a3; }
67
74
 
75
+ .cm-s-blackboard-cms .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }
76
+
77
+
68
78
 
69
79
  .toolbar ul {
70
80
  list-style-type: none;
71
81
  margin: 0;
72
82
  padding: 5px 5px 0 5px;
73
83
  background-color: #CCC;
74
- width: 99%;
84
+ width: 788px;
75
85
  height: 36px;
76
86
 
77
87
  }
@@ -106,20 +116,30 @@
106
116
  }
107
117
 
108
118
  .toolbar ul li.spacer {
109
- margin-right: 15px;
119
+ margin-right: 10px;
110
120
  }
111
121
 
112
122
  .toolbar ul li img {
113
123
  opacity: 0.6;
114
124
  }
115
125
 
126
+ .toolbar ul li.smile img, .toolbar ul li.wink img {
127
+ opacity: 1.0 ;
128
+ }
129
+
130
+
116
131
  .toolbar ul li label {
117
132
  position: absolute;
118
133
  width: 46px;
119
134
  text-align: center;
120
- bottom: 1px;
135
+ top: 12px;
121
136
  }
122
137
 
123
138
  .toolbar .list img, .toolbar .numbered_list img {
124
139
  margin-top: 2px;
125
140
  }
141
+
142
+
143
+ div#forums div#popup_form div.toolbar ul.markdown li {
144
+ margin-left: 0;
145
+ }
@@ -149,7 +149,6 @@ div#calendar table {
149
149
  margin: 0;
150
150
  border-collapse: collapse;
151
151
  border: 2px black solid !important;
152
- overflow: hidden;
153
152
  }
154
153
 
155
154
  div#calendar th, div#calendar td {
@@ -184,6 +183,12 @@ div#calendar table.full td, div#calendar table.full th {
184
183
  padding: 5px;
185
184
  }
186
185
 
186
+ div#calendar table.full div.day_entry {
187
+ height: 16px;
188
+ width: 74px;
189
+ overflow: hidden;
190
+ }
191
+
187
192
  div#calendar table td.pad {
188
193
  background-color: #DDD;
189
194
  }
@@ -1142,9 +1142,15 @@ a.icon:hover, a.no_icon:hover {
1142
1142
 
1143
1143
  h1.order_icon {
1144
1144
  background-image: url('/assets/kit/icons/32/cur_bp_icon&32.png');
1145
+ }
1145
1146
 
1147
+ h1.notificationqueue_icon {
1148
+ background-image: url('/assets/kit/icons/32/twitter_2_icon&32.png');
1146
1149
  }
1147
1150
 
1151
+ a.notificationqueue_wicon {
1152
+ background-image: url('/assets/kit/icons/white/16/twitter_2_icon&16.png');
1153
+ }
1148
1154
  h1.experiments_icon {
1149
1155
  background-image: url('/assets/kit/icons/32/balance_icon&32.png');
1150
1156
  }
@@ -1675,3 +1681,33 @@ ul#mapping li label {
1675
1681
  float: left;
1676
1682
  width: 300px;
1677
1683
  }
1684
+
1685
+ ul.link_list div.http_404 a {
1686
+ color: red;
1687
+ }
1688
+
1689
+ ul.link_list div.left {
1690
+ float: left;
1691
+ width: 300px;
1692
+ }
1693
+
1694
+ .auth label {
1695
+ font-weight: bold;
1696
+ float: left;
1697
+ width: 210px;
1698
+ }
1699
+
1700
+ .auth form label, .klass form label {
1701
+ float: none;
1702
+ display: block;
1703
+ }
1704
+ .auth form input, .klass form input[type=text] {
1705
+ width: 600px;
1706
+ }
1707
+
1708
+ .auth form textarea, .klass form textarea {
1709
+ width: 600px;
1710
+ height: 300px;
1711
+ }
1712
+
1713
+
@@ -537,4 +537,8 @@ div.ui-widget-overlay {
537
537
  background-color: black;
538
538
  }
539
539
 
540
-
540
+ img.smiley {
541
+ width: 16px;
542
+ height: 16px;
543
+ vertical-align: text-bottom;
544
+ }
@@ -149,4 +149,6 @@ label {
149
149
  border: thin dotted #BBB !important;
150
150
  }
151
151
 
152
-
152
+ .users #outro {
153
+ display: none;
154
+ }
@@ -0,0 +1,306 @@
1
+ require 'digest/md5'
2
+
3
+ class AccountController < KitController
4
+
5
+ before_filter :redirect_current, :only=>[:sign_in, :sign_up, :forgotten]
6
+
7
+ def edit
8
+ redirect_to sign_in_url unless current_user
9
+
10
+ if request.post?
11
+ user.email = params[:email] unless params[:must_change_password]
12
+ if params[:must_change_password] || params[:password].not_blank? || params[:password_confirmation].not_blank?
13
+ user.skip_password = false
14
+ user.password = params[:password]
15
+ user.password_confirmation = params[:password_confirmation]
16
+ else
17
+ user.skip_password = true
18
+ end
19
+ if user.save
20
+ redirect_after_signin(:edit)
21
+ return
22
+ end
23
+ end
24
+
25
+ render_action "edit"
26
+ end
27
+
28
+ def forgotten
29
+ if request.post? && (params[:email].not_blank? || (params[:user] && params[:user][:email].not_blank?))
30
+ u = User.sys(_sid).where(:email=>(params[:email] || params[:user][:email])).first
31
+ if u
32
+ u.skip_password = true
33
+ u.reset_password_token = Digest::MD5.hexdigest(u.email + Time.now.to_s + rand(100000).to_s)
34
+ u.reset_password_sent_at = Time.now
35
+ u.save!
36
+ Notification.forgotten_password(u.id).deliver
37
+ Activity.add(_sid, "Sent password reset to user <a href='/admin/user/#{u.id}'>#{u.email}</a>", nil, "Users")
38
+ end
39
+ redirect_to sign_in_url, :notice=>t("account.reset_sent")
40
+ return
41
+ end
42
+
43
+ render_action("forgotten")
44
+ end
45
+
46
+ def reset
47
+ code = params[:code]
48
+
49
+ u = User.sys(_sid).where(:reset_password_token=>params[:code]).where("reset_password_sent_at >= date_sub(now(), interval 24 hour)").where("reset_password_token is not null").first
50
+
51
+ if u
52
+ warden.set_user u
53
+ u.skip_password = true
54
+ u.record_signin(_sid, request)
55
+ u.reset_password_token = nil
56
+ u.save
57
+ render_action("edit", {:notice=>t("account.change_your_password"), :dont_show_intro=>true, :dont_show_leave_blank_passwords=>true, :must_change_password=>true})
58
+ else
59
+ render_action("forgotten", :notice=>t("account.reset_failed"))
60
+ end
61
+ end
62
+
63
+ def unauthenticated
64
+ store_sign_in_redirect
65
+
66
+ if params[(Preference.get_cached(_sid, "account_token_param") || 'token').to_sym]
67
+ authenticate
68
+ if current_user
69
+ current_user.record_signin(_sid, request)
70
+ redirect_after_signin(:token)
71
+ else
72
+ redirect_after_signin(:token, true)
73
+ end
74
+ return
75
+ end
76
+
77
+ redirect_to_signin
78
+ end
79
+
80
+ def sign_up
81
+ new_user = nil
82
+
83
+ if request.post?
84
+ new_user = User.new
85
+ new_user.skip_password = false
86
+ new_user.email = params[:email] || params[:user][:email]
87
+ new_user.password = params[:password] || params[:user][:password]
88
+ new_user.password_confirmation = params[:password_confirmation] || params[:user][:password_confirmation]
89
+ new_user.display_name = params[:display_name]
90
+ new_user.system_id = _sid
91
+ new_user.sign_up_ip = request.remote_ip
92
+
93
+ if new_user.save
94
+ process_new_user(new_user)
95
+ warden.set_user new_user
96
+ new_user.record_signin(_sid, request)
97
+ redirect_after_signup
98
+ return
99
+ end
100
+ end
101
+ @user = new_user
102
+ render_action("sign_up")
103
+ end
104
+
105
+ def sign_in
106
+ if request.post?
107
+ authenticate
108
+ if current_user
109
+ current_user.record_signin(_sid, request)
110
+ if params[:remember_me]
111
+ remember_for = (Preference.get_cached(_sid, "account_remember_for_days") || "90").to_i
112
+ cookies[:sign_in] = { :value=> current_user.remember_token, :expires=> remember_for.days.from_now }
113
+ end
114
+ if params[:return_to]
115
+ redirect_to params[:return_to]
116
+ elsif url = pref("url_after_sign_in")
117
+ redirect_to url
118
+ else
119
+ redirect_after_signin(:email)
120
+ end
121
+ return
122
+ else
123
+ u = User.record_failed_signin(_sid, request)
124
+ end
125
+ end
126
+
127
+ render_action("sign_in")
128
+ end
129
+
130
+ def sign_out
131
+ if current_user
132
+ if current_user.respond_to?(:last_sign_out)
133
+ current_user.update_attributes(:last_sign_out=>Time.now)
134
+ end
135
+ current_user.dont_remember
136
+ warden.logout
137
+
138
+ end
139
+
140
+ redirect_to params[:url] || pref("url_after_sign_out") || "/"
141
+ end
142
+
143
+ protected
144
+ def process_new_user(u)
145
+ attributes = UserAttribute.sys(_sid).where(:show_on_signup=>1).all
146
+
147
+ attributes.each do |attr|
148
+ if params[attr.code_name]
149
+ uav = UserAttributeValue.new
150
+ uav.user_attribute_id = attr.id
151
+ uav.user_id = u.id
152
+ uav.value = params[attr.code_name]
153
+ uav.updated_by = u.id
154
+ uav.system_id = _sid
155
+ uav.save
156
+ end
157
+ end if attributes
158
+
159
+ if params[:groups]
160
+ params[:groups].split(',').each do |gg|
161
+ group = Group.find_sys_id(_sid, gg)
162
+ user.groups << group
163
+ end
164
+ end
165
+ u.update_index
166
+ end
167
+
168
+ def redirect_after_signup
169
+ url = url_after_signup
170
+
171
+ redirect_to url, :notice=>view_context.t("You have successfully signed up")
172
+ end
173
+
174
+ def redirect_after_signin(mode, failed = false)
175
+ if mode==:token
176
+ if failed
177
+ redirect_after_signin_token_failed
178
+ else
179
+ redirect_after_signin_token
180
+ end
181
+ elsif mode==:email || mode==:edit
182
+ if failed
183
+ redirect_after_signin_email_failed
184
+ else
185
+ redirect_after_signin_email(mode == :edit)
186
+ end
187
+ else
188
+ redirect_to "/", :notice=>view_context.t("You have signed in")
189
+ end
190
+ end
191
+
192
+ def redirect_after_signin_token
193
+ redirect_to url_after_signin, :notice=>view_context.t("you_have_signed_in")
194
+ end
195
+
196
+ def redirect_after_signin_token_failed
197
+ redirect_to "/", :notice=>view_context.t("your_signin_failed")
198
+ end
199
+
200
+ def redirect_after_signin_email(show_notice)
201
+ if show_notice
202
+ redirect_to url_after_signin, :notice=>view_context.t("you_have_signed_in")
203
+ else
204
+ redirect_to url_after_signin
205
+ end
206
+ end
207
+
208
+ def redirect_after_signin_email_failed
209
+ redirect_to "/users/sign_in", :notice=>view_context.t("your_signin_failed")
210
+ end
211
+
212
+ def url_after_signup
213
+ path = session[:return_to] || url_after_group(:signup) || url_after_group(:signin) || '/'
214
+ session[:return_to] = nil
215
+ return path.to_s
216
+ end
217
+
218
+ def url_after_signin
219
+ path = session[:return_to] || url_after_group(:signin) || "/"
220
+ session[:return_to] = nil
221
+ return path.to_s
222
+ end
223
+
224
+ def url_after_group(mode)
225
+ Preference.sys(_sid).where("name like 'account_after_#{mode}_%'").all.each do |pref|
226
+ pref.name =~ /^account_after_#{mode}_(.*)$/
227
+ if user.groups.where(:name=>$1).count>0
228
+ return pref.value
229
+ end
230
+ end
231
+
232
+ return nil
233
+ end
234
+
235
+ def redirect_to_signin
236
+ redirect_to sign_in_url
237
+ end
238
+
239
+ def store_sign_up_redirect
240
+ if params[:return_to]
241
+ session[:return_to] = params[:return_to]
242
+ elsif url = pref("url_after_sign_up")
243
+ session[:return_to] ||= url
244
+ end
245
+ session[:return_to] = nil if session[:return_to] == sign_up_url
246
+ end
247
+
248
+ def store_sign_in_redirect
249
+ if params[:return_to]
250
+ session[:return_to] = params[:return_to]
251
+ elsif url = pref("url_after_sign_in")
252
+ session[:return_to] ||= url
253
+ else
254
+ session[:return_to] ||= env['warden.options'][:attempted_path]
255
+ end
256
+
257
+ session[:return_to] = nil if session[:return_to] == sign_in_url
258
+ end
259
+
260
+ def render_action(name, options = {})
261
+ flash[:notice] = options[:notice] if options[:notice]
262
+ flash[:error] = options[:error] if options[:error]
263
+
264
+ if params[:custom]
265
+ @page = Pagebase.sys(_sid).where(:full_path=>URI(request.referer).path).first
266
+ if @page
267
+ render_page(@page)
268
+ return
269
+ end
270
+ end
271
+
272
+ if page_id = pref("account_#{name}_pageid") && @page = Pagebase.sys(_sid).where(:id=>page_id.to_i).first
273
+ if @page
274
+ render_page(@page)
275
+ return
276
+ end
277
+ end
278
+
279
+ layout = Layout.preference(_sid, "account_#{name}_layout")
280
+ options[:layout] = layout.path
281
+ self.layout_being_used = layout
282
+ @options = options
283
+ render name, options
284
+ end
285
+
286
+ def sign_in_url
287
+ view_context.sign_in_url
288
+ end
289
+
290
+ def sign_up_url
291
+ view_context.sign_up_url
292
+ end
293
+
294
+ def sign_out_url
295
+ view_context.sign_out_url
296
+ end
297
+
298
+ def redirect_current
299
+ if current_user
300
+ redirect_to "/"
301
+ return false
302
+ else
303
+ return true
304
+ end
305
+ end
306
+ end