backlog 0.36.2 → 0.37.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. data/Gemfile +16 -4
  2. data/Gemfile.lock +130 -0
  3. data/History.txt +17 -0
  4. data/README.txt +0 -2
  5. data/Rakefile +17 -7
  6. data/app/controllers/absences_controller.rb +1 -2
  7. data/app/controllers/application_controller.rb +13 -14
  8. data/app/controllers/application_controller.rb.rails2 +186 -0
  9. data/app/controllers/estimates_controller.rb +1 -1
  10. data/app/controllers/groups_controller.rb +3 -1
  11. data/app/controllers/periods_controller.rb +61 -50
  12. data/app/controllers/{backlogs_controller.rb → projects_controller.rb} +35 -35
  13. data/app/controllers/search_controller.rb +2 -2
  14. data/app/controllers/tasks_controller.rb +11 -11
  15. data/app/controllers/user_controller.rb +6 -4
  16. data/app/controllers/welcome_controller.rb +4 -4
  17. data/app/controllers/work_locks_controller.rb +2 -2
  18. data/app/controllers/works_controller.rb +31 -31
  19. data/app/helpers/application_helper.rb +2 -2
  20. data/app/helpers/application_helper.rb.rails2 +118 -0
  21. data/app/helpers/periods_helper.rb +3 -3
  22. data/app/helpers/{backlogs_helper.rb → projects_helper.rb} +5 -5
  23. data/app/helpers/user_helper.rb +2 -2
  24. data/app/{models → mailers}/user_notify.rb +1 -0
  25. data/app/models/absence.rb +2 -2
  26. data/{lib → app/models}/clock.rb +0 -0
  27. data/app/models/estimate.rb +2 -2
  28. data/app/models/party.rb +1 -2
  29. data/app/models/period.rb +17 -18
  30. data/app/models/{backlog.rb → project.rb} +2 -2
  31. data/app/models/sidebar.rb +2 -2
  32. data/app/models/task.rb +28 -28
  33. data/app/models/user.rb +5 -4
  34. data/app/models/work.rb +29 -23
  35. data/app/models/work_lock_nagger.rb +1 -1
  36. data/app/models/works_report_filter.rb +4 -4
  37. data/app/views/customers/_name_list.rhtml +1 -1
  38. data/app/views/layouts/_headers.rhtml +2 -1
  39. data/app/views/layouts/_left_top.rhtml +32 -29
  40. data/app/views/layouts/_shortcuts.rhtml +15 -9
  41. data/app/views/layouts/_shortcuts_js.rhtml +4 -4
  42. data/app/views/layouts/mwrt002.html.erb +44 -0
  43. data/app/views/periods/_burn_down_chart.rhtml +1 -1
  44. data/app/views/periods/_show_active.rhtml +3 -3
  45. data/app/views/periods/_title.rhtml +1 -1
  46. data/app/views/{backlogs → projects}/_buttons.rhtml +4 -4
  47. data/app/views/projects/_form.rhtml +44 -0
  48. data/app/views/projects/_name_list.rhtml +5 -0
  49. data/app/views/projects/edit.rhtml +14 -0
  50. data/app/views/{backlogs → projects}/finish_task.rjs +0 -0
  51. data/app/views/projects/list.rhtml +16 -0
  52. data/app/views/{backlogs → projects}/move_task_to_period.rjs +0 -0
  53. data/app/views/{backlogs → projects}/new.rhtml +1 -1
  54. data/app/views/{backlogs → projects}/reopen_task.rjs +0 -0
  55. data/app/views/{backlogs → projects}/show.rhtml +6 -6
  56. data/app/views/search/results.rhtml +3 -3
  57. data/app/views/tasks/_backlog_header.rhtml +4 -4
  58. data/app/views/tasks/_completed.rhtml +2 -2
  59. data/app/views/tasks/_form.rhtml +13 -13
  60. data/app/views/tasks/_task.rhtml +10 -10
  61. data/app/views/tasks/edit.rhtml +1 -1
  62. data/app/views/tasks/list.rhtml +3 -3
  63. data/app/views/tasks/list_started.rhtml +4 -4
  64. data/app/views/tasks/start_work.rjs +1 -1
  65. data/app/views/user/login.rhtml +1 -1
  66. data/app/views/user/signup.rhtml +1 -1
  67. data/app/views/user/welcome.rhtml +1 -1
  68. data/app/views/works/_description_list.rhtml +1 -1
  69. data/app/views/works/_form.rhtml +5 -5
  70. data/app/views/works/_new_row.rhtml +8 -8
  71. data/app/views/works/_row.rhtml +1 -1
  72. data/app/views/works/_task_id_list.rhtml +1 -1
  73. data/app/views/works/daily_work_sheet.rhtml +1 -1
  74. data/app/views/works/list.rhtml +5 -5
  75. data/app/views/works/list_excel.rhtml +2 -2
  76. data/app/views/works/timeliste.rhtml +14 -14
  77. data/app/views/works/weekly_work_sheet.rhtml +5 -5
  78. data/app/views/works/weekly_work_sheet_details.rhtml +5 -5
  79. data/backlog.gemspec +44 -0
  80. data/bin/backlog +5 -1
  81. data/config.ru +4 -0
  82. data/config/application.rb +10 -0
  83. data/config/boot.rb +12 -116
  84. data/config/database.yml +3 -6
  85. data/config/database.yml~ +17 -0
  86. data/config/environment.rb +28 -49
  87. data/config/environments/development.rb +24 -20
  88. data/config/environments/development.rb.rails2 +26 -0
  89. data/config/environments/production.rb +26 -22
  90. data/config/environments/test.rb +20 -15
  91. data/config/environments/user_environment.rb +1 -1
  92. data/config/initializers/backtrace_silencers.rb +7 -0
  93. data/config/initializers/inflections.rb +10 -0
  94. data/config/initializers/jdbc.rb +1 -1
  95. data/config/initializers/mime_types.rb +5 -0
  96. data/config/initializers/secret_token.rb +7 -0
  97. data/config/initializers/session_store.rb +8 -0
  98. data/config/locales/en.yml +22 -11
  99. data/config/locales/no.yml +1 -0
  100. data/config/routes.rb +4 -5
  101. data/cruise_build.sh +6 -2
  102. data/db/migrate/004_add_period.rb +22 -22
  103. data/db/migrate/015_add_user_option.rb +5 -19
  104. data/db/migrate/017_increase_backlog_name_limit.rb +10 -0
  105. data/db/migrate/021_create_work_accounts.rb +0 -2
  106. data/db/migrate/20101006092700_rename_backlogs_to_projects.rb +22 -0
  107. data/db/migrate/20101006092700_rename_backlogs_to_projects.rb~ +22 -0
  108. data/db/schema.rb +27 -30
  109. data/db/seeds.rb +7 -0
  110. data/lib/array_helper.rb +0 -8
  111. data/lib/class_table_inheritance.rb +8 -7
  112. data/lib/tasks/backup.rake +3 -3
  113. data/lib/tasks/jdbc.rake +2 -2
  114. data/lib/version_from_history.rb +1 -1
  115. data/public/404.html +23 -7
  116. data/public/422.html +26 -0
  117. data/public/500.html +23 -6
  118. data/public/images/rails.png +0 -0
  119. data/public/javascripts/controls.js +5 -3
  120. data/public/javascripts/dragdrop.js +7 -6
  121. data/public/javascripts/effects.js +8 -13
  122. data/public/javascripts/prototype.js +3381 -1700
  123. data/public/javascripts/rails.js +175 -0
  124. data/public/robots.txt +5 -1
  125. data/script/rails +6 -0
  126. data/test/client/login.rb +0 -2
  127. data/test/client/login_test.rb +1 -1
  128. data/test/client/setup.rb +25 -24
  129. data/test/fixtures/{backlogs.yml → projects.yml} +2 -2
  130. data/test/fixtures/tasks.yml +9 -9
  131. data/test/fixtures/work_lock_subscriptions.yml +2 -2
  132. data/test/fixtures/works.yml +7 -7
  133. data/test/functional/periods_controller_test.rb +1 -1
  134. data/test/functional/{backlogs_controller_test.rb → projects_controller_test.rb} +22 -21
  135. data/test/functional/search_controller_test.rb +1 -1
  136. data/test/functional/tasks_controller_test.rb +17 -17
  137. data/test/functional/user_controller_test.rb +16 -21
  138. data/test/functional/welcome_controller_test.rb +4 -3
  139. data/test/functional/works_controller_test.rb +5 -5
  140. data/test/integration/user_system_test.rb +1 -1
  141. data/test/mocks/test/clock.rb +1 -1
  142. data/test/performance/browsing_test.rb +9 -0
  143. data/test/performance/common.rb +1 -1
  144. data/test/test_helper.rb +23 -6
  145. data/test/test_helper.rb~ +121 -0
  146. data/test/unit/user_test.rb +3 -3
  147. data/test/unit/work_test.rb +7 -7
  148. data/vendor/plugins/assert_cookie/lib/assert_cookie.rb +0 -2
  149. data/vendor/plugins/{foreign_key_migrations → dynamic_form}/MIT-LICENSE +1 -1
  150. data/vendor/plugins/dynamic_form/README +13 -0
  151. data/vendor/plugins/dynamic_form/Rakefile +10 -0
  152. data/vendor/plugins/dynamic_form/dynamic_form.gemspec +12 -0
  153. data/vendor/plugins/dynamic_form/init.rb +1 -0
  154. data/vendor/plugins/dynamic_form/lib/action_view/helpers/dynamic_form.rb +300 -0
  155. data/vendor/plugins/dynamic_form/lib/action_view/locale/en.yml +8 -0
  156. data/vendor/plugins/dynamic_form/lib/dynamic_form.rb +5 -0
  157. data/vendor/plugins/dynamic_form/test/dynamic_form_i18n_test.rb +42 -0
  158. data/vendor/plugins/dynamic_form/test/dynamic_form_test.rb +370 -0
  159. data/vendor/plugins/dynamic_form/test/test_helper.rb +9 -0
  160. data/vendor/plugins/prototype_legacy_helper/lib/prototype_legacy_helper.rb +432 -0
  161. data/vendor/plugins/prototype_legacy_helper/test/test_prototype_helper.rb +297 -0
  162. data/vendor/plugins/rails_time/test/debug.log +1 -0
  163. data/vendor/plugins/{redhillonrails_core → verification}/MIT-LICENSE +1 -1
  164. data/vendor/plugins/verification/README +34 -0
  165. data/vendor/plugins/verification/Rakefile +22 -0
  166. data/vendor/plugins/verification/init.rb +3 -0
  167. data/vendor/plugins/verification/lib/action_controller/verification.rb +132 -0
  168. data/vendor/plugins/verification/test/test_helper.rb +18 -0
  169. data/vendor/plugins/verification/test/verification_test.rb +270 -0
  170. data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +1 -1
  171. metadata +115 -134
  172. data/Gemfile~ +0 -4
  173. data/History.txt~ +0 -961
  174. data/LICENSE_LOCALIZATION +0 -20
  175. data/README_LOCALIZATION +0 -61
  176. data/README_RAILS +0 -180
  177. data/app/views/backlogs/_form.rhtml +0 -44
  178. data/app/views/backlogs/_name_list.rhtml +0 -5
  179. data/app/views/backlogs/edit.rhtml +0 -14
  180. data/app/views/backlogs/list.rhtml +0 -16
  181. data/app/views/layouts/mwrt002.rhtml +0 -43
  182. data/config/initializers/mongrel.rb +0 -83
  183. data/config/preinitializer.rb +0 -20
  184. data/config/warble.rb~ +0 -84
  185. data/db/migrate/017_insert_datek_projects.rb +0 -98
  186. data/lib/change_column_null_migration_fix.rb +0 -15
  187. data/no_test.rb~ +0 -6
  188. data/public/dispatch.cgi +0 -10
  189. data/public/dispatch.fcgi +0 -24
  190. data/public/dispatch.rb +0 -10
  191. data/script/about +0 -3
  192. data/script/breakpointer +0 -3
  193. data/script/console +0 -3
  194. data/script/dbconsole +0 -3
  195. data/script/destroy +0 -3
  196. data/script/generate +0 -3
  197. data/script/performance/benchmarker +0 -3
  198. data/script/performance/profiler +0 -3
  199. data/script/plugin +0 -3
  200. data/script/process/inspector +0 -3
  201. data/script/process/reaper +0 -3
  202. data/script/process/spawner +0 -3
  203. data/script/runner +0 -3
  204. data/script/server +0 -3
  205. data/test/client/login.rb~ +0 -33
  206. data/test/mocks/test/user_notify.rb +0 -16
  207. data/vendor/plugins/foreign_key_migrations/CHANGELOG +0 -103
  208. data/vendor/plugins/foreign_key_migrations/README +0 -87
  209. data/vendor/plugins/foreign_key_migrations/about.yml +0 -5
  210. data/vendor/plugins/foreign_key_migrations/init.rb +0 -1
  211. data/vendor/plugins/foreign_key_migrations/install.rb +0 -1
  212. data/vendor/plugins/foreign_key_migrations/lib/foreign_key_migrations.rb +0 -3
  213. data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/base.rb +0 -22
  214. data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/abstract_adapter.rb +0 -22
  215. data/vendor/plugins/foreign_key_migrations/lib/red_hill_consulting/foreign_key_migrations/active_record/connection_adapters/table_definition.rb +0 -28
  216. data/vendor/plugins/lightwindow_helper/README +0 -33
  217. data/vendor/plugins/lightwindow_helper/assets/images/ajax-loading.gif +0 -0
  218. data/vendor/plugins/lightwindow_helper/assets/images/arrow-down.gif +0 -0
  219. data/vendor/plugins/lightwindow_helper/assets/images/arrow-up.gif +0 -0
  220. data/vendor/plugins/lightwindow_helper/assets/images/black-70.png +0 -0
  221. data/vendor/plugins/lightwindow_helper/assets/images/black.png +0 -0
  222. data/vendor/plugins/lightwindow_helper/assets/images/nextlabel.gif +0 -0
  223. data/vendor/plugins/lightwindow_helper/assets/images/prevlabel.gif +0 -0
  224. data/vendor/plugins/lightwindow_helper/assets/javascripts/lightwindow.js +0 -1921
  225. data/vendor/plugins/lightwindow_helper/assets/stylesheets/lightwindow.css +0 -376
  226. data/vendor/plugins/lightwindow_helper/init.rb +0 -1
  227. data/vendor/plugins/lightwindow_helper/install.rb +0 -7
  228. data/vendor/plugins/lightwindow_helper/lib/lightwindow_helper.rb +0 -31
  229. data/vendor/plugins/redhillonrails_core/CHANGELOG +0 -150
  230. data/vendor/plugins/redhillonrails_core/README +0 -124
  231. data/vendor/plugins/redhillonrails_core/init.rb +0 -19
  232. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/base.rb +0 -54
  233. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/abstract_adapter.rb +0 -31
  234. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/column.rb +0 -21
  235. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/foreign_key_definition.rb +0 -26
  236. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/index_definition.rb +0 -11
  237. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_adapter.rb +0 -74
  238. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_column.rb +0 -8
  239. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/postgresql_adapter.rb +0 -99
  240. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/schema_statements.rb +0 -16
  241. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/sqlite3_adapter.rb +0 -9
  242. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/table_definition.rb +0 -27
  243. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema.rb +0 -27
  244. data/vendor/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema_dumper.rb +0 -47
  245. data/vendor/plugins/transactional_migrations/CHANGELOG +0 -9
  246. data/vendor/plugins/transactional_migrations/MIT-LICENSE +0 -20
  247. data/vendor/plugins/transactional_migrations/README +0 -15
  248. data/vendor/plugins/transactional_migrations/about.yml +0 -5
  249. data/vendor/plugins/transactional_migrations/init.rb +0 -1
  250. data/vendor/plugins/transactional_migrations/lib/red_hill_consulting/transactional_migrations/active_record/migration.rb +0 -19
@@ -0,0 +1,297 @@
1
+ if ENV['RAILS_ROOT']
2
+ environment = File.expand_path('vendor/gems/environment', ENV['RAILS_ROOT'])
3
+ require environment if File.exist?("#{environment}.rb")
4
+ end
5
+
6
+ $:.unshift File.expand_path('../../lib', __FILE__)
7
+
8
+ require 'test/unit'
9
+ require 'action_view'
10
+ require 'action_controller'
11
+ require 'active_model'
12
+ require 'prototype_helper'
13
+
14
+ class Bunny < Struct.new(:Bunny, :id)
15
+ end
16
+
17
+ class Author
18
+ extend ActiveModel::Naming
19
+
20
+ attr_reader :id
21
+ def save; @id = 1 end
22
+ def new_record?; @id.nil? end
23
+ def name
24
+ @id.nil? ? 'new author' : "author ##{@id}"
25
+ end
26
+ end
27
+
28
+ class Article
29
+ extend ActiveModel::Naming
30
+
31
+ attr_reader :id
32
+ attr_reader :author_id
33
+ def save; @id = 1; @author_id = 1 end
34
+ def new_record?; @id.nil? end
35
+ def name
36
+ @id.nil? ? 'new article' : "article ##{@id}"
37
+ end
38
+ end
39
+
40
+ class Author::Nested < Author; end
41
+
42
+ class PrototypeHelperTest < ActionView::TestCase
43
+ attr_accessor :formats, :output_buffer, :template_format
44
+
45
+ def _evaluate_assigns_and_ivars() end
46
+
47
+ def reset_formats(format)
48
+ @format = format
49
+ end
50
+
51
+ def setup
52
+ @record = @author = Author.new
53
+ @article = Article.new
54
+ super
55
+ @template = self
56
+ @controller = Class.new do
57
+ def url_for(options)
58
+ if options.is_a?(String)
59
+ options
60
+ else
61
+ url = "http://www.example.com/"
62
+ url << options[:action].to_s if options and options[:action]
63
+ url << "?a=#{options[:a]}" if options && options[:a]
64
+ url << "&b=#{options[:b]}" if options && options[:a] && options[:b]
65
+ url
66
+ end
67
+ end
68
+ end.new
69
+ end
70
+
71
+
72
+ def test_observe_form
73
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Observer('cart', 2, function(element, value) {new Ajax.Request('http://www.example.com/cart_changed', {asynchronous:true, evalScripts:true, parameters:value})})\n//]]>\n</script>),
74
+ observe_form("cart", :frequency => 2, :url => { :action => "cart_changed" })
75
+ end
76
+
77
+ def test_observe_form_using_function_for_callback
78
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Observer('cart', 2, function(element, value) {alert('Form changed')})\n//]]>\n</script>),
79
+ observe_form("cart", :frequency => 2, :function => "alert('Form changed')")
80
+ end
81
+
82
+ def test_observe_field
83
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Element.Observer('glass', 300, function(element, value) {new Ajax.Request('http://www.example.com/reorder_if_empty', {asynchronous:true, evalScripts:true, parameters:value})})\n//]]>\n</script>),
84
+ observe_field("glass", :frequency => 5.minutes, :url => { :action => "reorder_if_empty" })
85
+ end
86
+
87
+ def test_observe_field_using_with_option
88
+ expected = %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Element.Observer('glass', 300, function(element, value) {new Ajax.Request('http://www.example.com/check_value', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(value)})})\n//]]>\n</script>)
89
+ assert_dom_equal expected, observe_field("glass", :frequency => 5.minutes, :url => { :action => "check_value" }, :with => 'id')
90
+ assert_dom_equal expected, observe_field("glass", :frequency => 5.minutes, :url => { :action => "check_value" }, :with => "'id=' + encodeURIComponent(value)")
91
+ end
92
+
93
+ def test_observe_field_using_json_in_with_option
94
+ expected = %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Element.Observer('glass', 300, function(element, value) {new Ajax.Request('http://www.example.com/check_value', {asynchronous:true, evalScripts:true, parameters:{'id':value}})})\n//]]>\n</script>)
95
+ assert_dom_equal expected, observe_field("glass", :frequency => 5.minutes, :url => { :action => "check_value" }, :with => "{'id':value}")
96
+ end
97
+
98
+ def test_observe_field_using_function_for_callback
99
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Element.Observer('glass', 300, function(element, value) {alert('Element changed')})\n//]]>\n</script>),
100
+ observe_field("glass", :frequency => 5.minutes, :function => "alert('Element changed')")
101
+ end
102
+
103
+ def test_observe_field_without_frequency
104
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Element.EventObserver('glass', function(element, value) {new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:value})})\n//]]>\n</script>),
105
+ observe_field("glass")
106
+ end
107
+
108
+
109
+ def test_periodically_call_remote
110
+ assert_dom_equal %(<script type="text/javascript">\n//<![CDATA[\nnew PeriodicalExecuter(function() {new Ajax.Updater('schremser_bier', 'http://www.example.com/mehr_bier', {asynchronous:true, evalScripts:true})}, 10)\n//]]>\n</script>),
111
+ periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" })
112
+ end
113
+
114
+ def test_periodically_call_remote_with_frequency
115
+ assert_dom_equal(
116
+ "<script type=\"text/javascript\">\n//<![CDATA[\nnew PeriodicalExecuter(function() {new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true})}, 2)\n//]]>\n</script>",
117
+ periodically_call_remote(:frequency => 2)
118
+ )
119
+ end
120
+
121
+
122
+ def test_form_remote_tag
123
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">),
124
+ form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast })
125
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({success:'glass_of_beer'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">),
126
+ form_remote_tag(:update => { :success => "glass_of_beer" }, :url => { :action => :fast })
127
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({failure:'glass_of_water'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">),
128
+ form_remote_tag(:update => { :failure => "glass_of_water" }, :url => { :action => :fast })
129
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({success:'glass_of_beer',failure:'glass_of_water'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">),
130
+ form_remote_tag(:update => { :success => 'glass_of_beer', :failure => "glass_of_water" }, :url => { :action => :fast })
131
+ end
132
+
133
+ def test_form_remote_tag_with_method
134
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\"><div style='margin:0;padding:0;display:inline'><input name='_method' type='hidden' value='put' /></div>),
135
+ form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, :html => { :method => :put })
136
+ end
137
+
138
+ def test_form_remote_tag_with_block_in_erb
139
+ __in_erb_template = ''
140
+ form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }) { concat "Hello world!" }
141
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">Hello world!</form>), output_buffer
142
+ end
143
+
144
+ def test_on_callbacks
145
+ callbacks = [:uninitialized, :loading, :loaded, :interactive, :complete, :success, :failure]
146
+ callbacks.each do |callback|
147
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on#{callback.to_s.capitalize}:function(request){monkeys();}, parameters:Form.serialize(this)}); return false;">),
148
+ form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, callback=>"monkeys();")
149
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({success:'glass_of_beer'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on#{callback.to_s.capitalize}:function(request){monkeys();}, parameters:Form.serialize(this)}); return false;">),
150
+ form_remote_tag(:update => { :success => "glass_of_beer" }, :url => { :action => :fast }, callback=>"monkeys();")
151
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({failure:'glass_of_beer'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on#{callback.to_s.capitalize}:function(request){monkeys();}, parameters:Form.serialize(this)}); return false;">),
152
+ form_remote_tag(:update => { :failure => "glass_of_beer" }, :url => { :action => :fast }, callback=>"monkeys();")
153
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater({success:'glass_of_beer',failure:'glass_of_water'}, 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on#{callback.to_s.capitalize}:function(request){monkeys();}, parameters:Form.serialize(this)}); return false;">),
154
+ form_remote_tag(:update => { :success => "glass_of_beer", :failure => "glass_of_water" }, :url => { :action => :fast }, callback=>"monkeys();")
155
+ end
156
+
157
+ #HTTP status codes 200 up to 599 have callbacks
158
+ #these should work
159
+ 100.upto(599) do |callback|
160
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on#{callback.to_s.capitalize}:function(request){monkeys();}, parameters:Form.serialize(this)}); return false;">),
161
+ form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, callback=>"monkeys();")
162
+ end
163
+
164
+ #test 200 and 404
165
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on200:function(request){monkeys();}, on404:function(request){bananas();}, parameters:Form.serialize(this)}); return false;">),
166
+ form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, 200=>"monkeys();", 404=>"bananas();")
167
+
168
+ #these shouldn't
169
+ 1.upto(99) do |callback|
170
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">),
171
+ form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, callback=>"monkeys();")
172
+ end
173
+ 600.upto(999) do |callback|
174
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">),
175
+ form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, callback=>"monkeys();")
176
+ end
177
+
178
+ #test ultimate combo
179
+ assert_dom_equal %(<form action=\"http://www.example.com/fast\" method=\"post\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, on200:function(request){monkeys();}, on404:function(request){bananas();}, onComplete:function(request){c();}, onFailure:function(request){f();}, onLoading:function(request){c1()}, onSuccess:function(request){s()}, parameters:Form.serialize(this)}); return false;\">),
180
+ form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast }, :loading => "c1()", :success => "s()", :failure => "f();", :complete => "c();", 200=>"monkeys();", 404=>"bananas();")
181
+ end
182
+
183
+ def test_remote_form_for_with_record_identification_with_new_record
184
+ remote_form_for(@record, {:html => { :id => 'create-author' }}) {}
185
+
186
+ expected = %(<form action='#{authors_path}' onsubmit="new Ajax.Request('#{authors_path}', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" class='new_author' id='create-author' method='post'></form>)
187
+ assert_dom_equal expected, output_buffer
188
+ end
189
+
190
+ def test_remote_form_for_with_record_identification_without_html_options
191
+ remote_form_for(@record) {}
192
+
193
+ expected = %(<form action='#{authors_path}' onsubmit="new Ajax.Request('#{authors_path}', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" class='new_author' method='post' id='new_author'></form>)
194
+ assert_dom_equal expected, output_buffer
195
+ end
196
+
197
+ def test_remote_form_for_with_record_identification_with_existing_record
198
+ @record.save
199
+ remote_form_for(@record) {}
200
+
201
+ expected = %(<form action='#{author_path(@record)}' id='edit_author_1' method='post' onsubmit="new Ajax.Request('#{author_path(@record)}', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" class='edit_author'><div style='margin:0;padding:0;display:inline'><input name='_method' type='hidden' value='put' /></div></form>)
202
+ assert_dom_equal expected, output_buffer
203
+ end
204
+
205
+ def test_remote_form_for_with_new_object_in_list
206
+ remote_form_for([@author, @article]) {}
207
+
208
+ expected = %(<form action='#{author_articles_path(@author)}' onsubmit="new Ajax.Request('#{author_articles_path(@author)}', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" class='new_article' method='post' id='new_article'></form>)
209
+ assert_dom_equal expected, output_buffer
210
+ end
211
+
212
+ def test_remote_form_for_with_existing_object_in_list
213
+ @author.save
214
+ @article.save
215
+ remote_form_for([@author, @article]) {}
216
+
217
+ expected = %(<form action='#{author_article_path(@author, @article)}' id='edit_article_1' method='post' onsubmit="new Ajax.Request('#{author_article_path(@author, @article)}', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" class='edit_article'><div style='margin:0;padding:0;display:inline'><input name='_method' type='hidden' value='put' /></div></form>)
218
+ assert_dom_equal expected, output_buffer
219
+ end
220
+
221
+
222
+ def test_button_to_remote
223
+ assert_dom_equal %(<input class=\"fine\" type=\"button\" value=\"Remote outpost\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true});\" />),
224
+ button_to_remote("Remote outpost", { :url => { :action => "whatnot" }}, { :class => "fine" })
225
+ assert_dom_equal %(<input type=\"button\" value=\"Remote outpost\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onComplete:function(request){alert(request.reponseText)}});\" />),
226
+ button_to_remote("Remote outpost", :complete => "alert(request.reponseText)", :url => { :action => "whatnot" })
227
+ assert_dom_equal %(<input type=\"button\" value=\"Remote outpost\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onSuccess:function(request){alert(request.reponseText)}});\" />),
228
+ button_to_remote("Remote outpost", :success => "alert(request.reponseText)", :url => { :action => "whatnot" })
229
+ assert_dom_equal %(<input type=\"button\" value=\"Remote outpost\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}});\" />),
230
+ button_to_remote("Remote outpost", :failure => "alert(request.reponseText)", :url => { :action => "whatnot" })
231
+ assert_dom_equal %(<input type=\"button\" value=\"Remote outpost\" onclick=\"new Ajax.Request('http://www.example.com/whatnot?a=10&amp;b=20', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}});\" />),
232
+ button_to_remote("Remote outpost", :failure => "alert(request.reponseText)", :url => { :action => "whatnot", :a => '10', :b => '20' })
233
+ end
234
+
235
+ def test_submit_to_remote
236
+ assert_dom_equal %(<input name=\"More beer!\" onclick=\"new Ajax.Updater('empty_bottle', 'http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form)});\" type=\"button\" value=\"1000000\" />),
237
+ submit_to_remote("More beer!", 1_000_000, :update => "empty_bottle")
238
+ end
239
+
240
+
241
+ def test_link_to_remote
242
+ assert_dom_equal %(<a class=\"fine\" href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true}); return false;\">Remote outauthor</a>),
243
+ link_to_remote("Remote outauthor", { :url => { :action => "whatnot" }}, { :class => "fine" })
244
+ assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onComplete:function(request){alert(request.responseText)}}); return false;\">Remote outauthor</a>),
245
+ link_to_remote("Remote outauthor", :complete => "alert(request.responseText)", :url => { :action => "whatnot" })
246
+ assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onSuccess:function(request){alert(request.responseText)}}); return false;\">Remote outauthor</a>),
247
+ link_to_remote("Remote outauthor", :success => "alert(request.responseText)", :url => { :action => "whatnot" })
248
+ assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.responseText)}}); return false;\">Remote outauthor</a>),
249
+ link_to_remote("Remote outauthor", :failure => "alert(request.responseText)", :url => { :action => "whatnot" })
250
+ assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot?a=10&amp;b=20', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.responseText)}}); return false;\">Remote outauthor</a>),
251
+ link_to_remote("Remote outauthor", :failure => "alert(request.responseText)", :url => { :action => "whatnot", :a => '10', :b => '20' })
252
+ assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:false, evalScripts:true}); return false;\">Remote outauthor</a>),
253
+ link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :type => :synchronous)
254
+ assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, insertion:'bottom'}); return false;\">Remote outauthor</a>),
255
+ link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :position => :bottom)
256
+ end
257
+
258
+ def test_link_to_remote_html_options
259
+ assert_dom_equal %(<a class=\"fine\" href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true}); return false;\">Remote outauthor</a>),
260
+ link_to_remote("Remote outauthor", { :url => { :action => "whatnot" }, :html => { :class => "fine" } })
261
+ end
262
+
263
+ def test_link_to_remote_url_quote_escaping
264
+ assert_dom_equal %(<a href="#" onclick="new Ajax.Request('http://www.example.com/whatnot\\\'s', {asynchronous:true, evalScripts:true}); return false;">Remote</a>),
265
+ link_to_remote("Remote", { :url => { :action => "whatnot's" } })
266
+ end
267
+
268
+ protected
269
+ def request_forgery_protection_token
270
+ nil
271
+ end
272
+
273
+ def protect_against_forgery?
274
+ false
275
+ end
276
+
277
+ def create_generator
278
+ block = Proc.new { |*args| yield *args if block_given? }
279
+ JavaScriptGenerator.new self, &block
280
+ end
281
+
282
+ def author_path(record)
283
+ "/authors/#{record.id}"
284
+ end
285
+
286
+ def authors_path
287
+ "/authors"
288
+ end
289
+
290
+ def author_articles_path(author)
291
+ "/authors/#{author.id}/articles"
292
+ end
293
+
294
+ def author_article_path(author, article)
295
+ "/authors/#{author.id}/articles/#{article.id}"
296
+ end
297
+ end
@@ -0,0 +1 @@
1
+ # Logfile created on Wed Nov 10 13:02:45 +0100 2010 by logger.rb/99999
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006 RedHill Consulting, Pty. Ltd.
1
+ Copyright (c) 2010 David Heinemeier Hansson
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,34 @@
1
+ This module provides a class-level method for specifying that certain
2
+ actions are guarded against being called without certain prerequisites
3
+ being met. This is essentially a special kind of before_filter.
4
+
5
+ An action may be guarded against being invoked without certain request
6
+ parameters being set, or without certain session values existing.
7
+
8
+ When a verification is violated, values may be inserted into the flash, and
9
+ a specified redirection is triggered. If no specific action is configured,
10
+ verification failures will by default result in a 400 Bad Request response.
11
+
12
+ Usage:
13
+
14
+ class GlobalController < ActionController::Base
15
+ # Prevent the #update_settings action from being invoked unless
16
+ # the 'admin_privileges' request parameter exists. The
17
+ # settings action will be redirected to in current controller
18
+ # if verification fails.
19
+ verify :params => "admin_privileges", :only => :update_post,
20
+ :redirect_to => { :action => "settings" }
21
+
22
+ # Disallow a post from being updated if there was no information
23
+ # submitted with the post, and if there is no active post in the
24
+ # session, and if there is no "note" key in the flash. The route
25
+ # named category_url will be redirected to if verification fails.
26
+
27
+ verify :params => "post", :session => "post", "flash" => "note",
28
+ :only => :update_post,
29
+ :add_flash => { "alert" => "Failed to create your message" },
30
+ :redirect_to => :category_url
31
+
32
+ Note that these prerequisites are not business rules. They do not examine
33
+ the content of the session or the parameters. That level of validation should
34
+ be encapsulated by your domain model or helper methods in the controller.
@@ -0,0 +1,22 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the verification plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.libs << 'test'
12
+ t.pattern = 'test/**/*_test.rb'
13
+ end
14
+
15
+ desc 'Generate documentation for the verification plugin.'
16
+ Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ rdoc.rdoc_dir = 'rdoc'
18
+ rdoc.title = 'Verification'
19
+ rdoc.options << '--line-numbers' << '--inline-source'
20
+ rdoc.rdoc_files.include('README')
21
+ rdoc.rdoc_files.include('lib/**/*.rb')
22
+ end
@@ -0,0 +1,3 @@
1
+ # Include hook code here
2
+
3
+ require 'action_controller/verification'
@@ -0,0 +1,132 @@
1
+ module ActionController #:nodoc:
2
+ module Verification #:nodoc:
3
+ extend ActiveSupport::Concern
4
+
5
+ include AbstractController::Callbacks, Flash, Rendering
6
+
7
+ # This module provides a class-level method for specifying that certain
8
+ # actions are guarded against being called without certain prerequisites
9
+ # being met. This is essentially a special kind of before_filter.
10
+ #
11
+ # An action may be guarded against being invoked without certain request
12
+ # parameters being set, or without certain session values existing.
13
+ #
14
+ # When a verification is violated, values may be inserted into the flash, and
15
+ # a specified redirection is triggered. If no specific action is configured,
16
+ # verification failures will by default result in a 400 Bad Request response.
17
+ #
18
+ # Usage:
19
+ #
20
+ # class GlobalController < ActionController::Base
21
+ # # Prevent the #update_settings action from being invoked unless
22
+ # # the 'admin_privileges' request parameter exists. The
23
+ # # settings action will be redirected to in current controller
24
+ # # if verification fails.
25
+ # verify :params => "admin_privileges", :only => :update_post,
26
+ # :redirect_to => { :action => "settings" }
27
+ #
28
+ # # Disallow a post from being updated if there was no information
29
+ # # submitted with the post, and if there is no active post in the
30
+ # # session, and if there is no "note" key in the flash. The route
31
+ # # named category_url will be redirected to if verification fails.
32
+ #
33
+ # verify :params => "post", :session => "post", "flash" => "note",
34
+ # :only => :update_post,
35
+ # :add_flash => { "alert" => "Failed to create your message" },
36
+ # :redirect_to => :category_url
37
+ #
38
+ # Note that these prerequisites are not business rules. They do not examine
39
+ # the content of the session or the parameters. That level of validation should
40
+ # be encapsulated by your domain model or helper methods in the controller.
41
+ module ClassMethods
42
+ # Verify the given actions so that if certain prerequisites are not met,
43
+ # the user is redirected to a different action. The +options+ parameter
44
+ # is a hash consisting of the following key/value pairs:
45
+ #
46
+ # <tt>:params</tt>::
47
+ # a single key or an array of keys that must be in the <tt>params</tt>
48
+ # hash in order for the action(s) to be safely called.
49
+ # <tt>:session</tt>::
50
+ # a single key or an array of keys that must be in the <tt>session</tt>
51
+ # in order for the action(s) to be safely called.
52
+ # <tt>:flash</tt>::
53
+ # a single key or an array of keys that must be in the flash in order
54
+ # for the action(s) to be safely called.
55
+ # <tt>:method</tt>::
56
+ # a single key or an array of keys--any one of which must match the
57
+ # current request method in order for the action(s) to be safely called.
58
+ # (The key should be a symbol: <tt>:get</tt> or <tt>:post</tt>, for
59
+ # example.)
60
+ # <tt>:xhr</tt>::
61
+ # true/false option to ensure that the request is coming from an Ajax
62
+ # call or not.
63
+ # <tt>:add_flash</tt>::
64
+ # a hash of name/value pairs that should be merged into the session's
65
+ # flash if the prerequisites cannot be satisfied.
66
+ # <tt>:add_headers</tt>::
67
+ # a hash of name/value pairs that should be merged into the response's
68
+ # headers hash if the prerequisites cannot be satisfied.
69
+ # <tt>:redirect_to</tt>::
70
+ # the redirection parameters to be used when redirecting if the
71
+ # prerequisites cannot be satisfied. You can redirect either to named
72
+ # route or to the action in some controller.
73
+ # <tt>:render</tt>::
74
+ # the render parameters to be used when the prerequisites cannot be satisfied.
75
+ # <tt>:only</tt>::
76
+ # only apply this verification to the actions specified in the associated
77
+ # array (may also be a single value).
78
+ # <tt>:except</tt>::
79
+ # do not apply this verification to the actions specified in the associated
80
+ # array (may also be a single value).
81
+ def verify(options={})
82
+ before_filter :only => options[:only], :except => options[:except] do
83
+ verify_action options
84
+ end
85
+ end
86
+ end
87
+
88
+ private
89
+
90
+ def verify_action(options) #:nodoc:
91
+ if prereqs_invalid?(options)
92
+ flash.update(options[:add_flash]) if options[:add_flash]
93
+ response.headers.merge!(options[:add_headers]) if options[:add_headers]
94
+ apply_remaining_actions(options) unless performed?
95
+ end
96
+ end
97
+
98
+ def prereqs_invalid?(options) # :nodoc:
99
+ verify_presence_of_keys_in_hash_flash_or_params(options) ||
100
+ verify_method(options) ||
101
+ verify_request_xhr_status(options)
102
+ end
103
+
104
+ def verify_presence_of_keys_in_hash_flash_or_params(options) # :nodoc:
105
+ [*options[:params] ].find { |v| v && params[v.to_sym].nil? } ||
106
+ [*options[:session]].find { |v| session[v].nil? } ||
107
+ [*options[:flash] ].find { |v| flash[v].nil? }
108
+ end
109
+
110
+ def verify_method(options) # :nodoc:
111
+ [*options[:method]].all? { |v| request.method_symbol != v.to_sym } if options[:method]
112
+ end
113
+
114
+ def verify_request_xhr_status(options) # :nodoc:
115
+ request.xhr? != options[:xhr] unless options[:xhr].nil?
116
+ end
117
+
118
+ def apply_redirect_to(redirect_to_option) # :nodoc:
119
+ (redirect_to_option.is_a?(Symbol) && redirect_to_option != :back) ? self.__send__(redirect_to_option) : redirect_to_option
120
+ end
121
+
122
+ def apply_remaining_actions(options) # :nodoc:
123
+ case
124
+ when options[:render] ; render(options[:render])
125
+ when options[:redirect_to] ; redirect_to(apply_redirect_to(options[:redirect_to]))
126
+ else head(:bad_request)
127
+ end
128
+ end
129
+ end
130
+ end
131
+
132
+ ActionController::Base.send :include, ActionController::Verification