infopark_rails_connector 6.9.1.3.22208381 → 6.9.2.1.125136549

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.
Files changed (132) hide show
  1. data/README +2 -14
  2. data/app/assets/javascripts/infopark_rails_connector.js.erb +0 -3
  3. data/app/assets/stylesheets/infopark_rails_connector.css.erb +0 -4
  4. data/app/controllers/rails_connector/default_cms_controller.rb +0 -1
  5. data/app/helpers/rails_connector/default_cms_helper.rb +0 -6
  6. data/app/helpers/rails_connector/layout_helper.rb +2 -7
  7. data/app/views/cms/index.html.erb +0 -2
  8. data/app/views/errors/410_gone.html.erb +2 -2
  9. data/config/ca-bundle.crt +1 -1
  10. data/config/cms_routes.rb +2 -1
  11. data/config/locales/de.rails_connector.views.yml +0 -78
  12. data/config/locales/en.rails_connector.views.yml +0 -78
  13. data/lib/generators/rails_connector/install/install_generator.rb +0 -1
  14. data/lib/generators/rails_connector/install/templates/initializers/rails_connector.rb +0 -27
  15. data/lib/rails_connector/cms_accessible.rb +0 -4
  16. data/lib/rails_connector/configuration.rb +9 -72
  17. data/lib/rails_connector/engine.rb +0 -18
  18. metadata +3 -181
  19. data/app/assets/images/ratings/star.gif +0 -0
  20. data/app/assets/images/time_machine/calendar-menuarrow.gif +0 -0
  21. data/app/assets/images/time_machine/calendar_bg.png +0 -0
  22. data/app/assets/images/time_machine/icon.png +0 -0
  23. data/app/assets/images/time_machine/slider_bg.png +0 -0
  24. data/app/assets/images/time_machine/slider_handle.png +0 -0
  25. data/app/assets/images/time_machine/timemachine_bg.png +0 -0
  26. data/app/assets/javascripts/comments.js +0 -29
  27. data/app/assets/javascripts/initializer.js +0 -9
  28. data/app/assets/javascripts/ratings.js +0 -26
  29. data/app/assets/javascripts/time_machine.js +0 -8
  30. data/app/assets/javascripts/time_machine/calendar-setup.js +0 -200
  31. data/app/assets/javascripts/time_machine/calendar.js +0 -1806
  32. data/app/assets/javascripts/time_machine/lang/calendar-de.js +0 -127
  33. data/app/assets/javascripts/time_machine/lang/calendar-en.js +0 -127
  34. data/app/assets/javascripts/time_machine/lang/calendar-es.js +0 -129
  35. data/app/assets/javascripts/time_machine/lang/calendar-fr.js +0 -125
  36. data/app/assets/javascripts/time_machine/lang/calendar-it.js +0 -124
  37. data/app/assets/javascripts/time_machine/slider.js +0 -278
  38. data/app/assets/stylesheets/ratings.css +0 -97
  39. data/app/assets/stylesheets/time_machine.css +0 -6
  40. data/app/assets/stylesheets/time_machine/time_machine.css +0 -292
  41. data/app/controllers/comments_controller.rb +0 -6
  42. data/app/controllers/crm_form_controller.rb +0 -6
  43. data/app/controllers/rails_connector/default_comments_controller.rb +0 -70
  44. data/app/controllers/rails_connector/default_crm_form_controller.rb +0 -167
  45. data/app/controllers/rails_connector/default_ratings_controller.rb +0 -84
  46. data/app/controllers/rails_connector/default_rss_controller.rb +0 -30
  47. data/app/controllers/rails_connector/default_search_controller.rb +0 -60
  48. data/app/controllers/rails_connector/default_user_controller.rb +0 -269
  49. data/app/controllers/rails_connector/time_machine_controller.rb +0 -48
  50. data/app/controllers/ratings_controller.rb +0 -6
  51. data/app/controllers/rss_controller.rb +0 -6
  52. data/app/controllers/search_controller.rb +0 -6
  53. data/app/controllers/seo_sitemap_controller.rb +0 -12
  54. data/app/controllers/user_controller.rb +0 -6
  55. data/app/helpers/crm_form_helper.rb +0 -6
  56. data/app/helpers/rails_connector/default_crm_form_helper.rb +0 -58
  57. data/app/helpers/rails_connector/default_ratings_helper.rb +0 -38
  58. data/app/helpers/rails_connector/default_user_helper.rb +0 -90
  59. data/app/helpers/rails_connector/error_messages_helper.rb +0 -23
  60. data/app/helpers/rails_connector/link_helper.rb +0 -93
  61. data/app/helpers/rails_connector/mandatory_label_helper.rb +0 -10
  62. data/app/helpers/rails_connector/menu_helper.rb +0 -73
  63. data/app/helpers/rails_connector/micronav_helper.rb +0 -109
  64. data/app/helpers/rails_connector/seo_helper.rb +0 -44
  65. data/app/helpers/rails_connector/time_machine_helper.rb +0 -26
  66. data/app/helpers/rails_connector/tracking_helper.rb +0 -32
  67. data/app/helpers/ratings_helper.rb +0 -4
  68. data/app/helpers/user_helper.rb +0 -6
  69. data/app/mailers/confirmation_mailer.rb +0 -15
  70. data/app/models/crm_form.rb +0 -2
  71. data/app/models/rails_connector/default_comment.rb +0 -30
  72. data/app/models/rails_connector/default_rating.rb +0 -22
  73. data/app/views/cms/_comments.html.erb +0 -44
  74. data/app/views/cms/_rating.html.erb +0 -31
  75. data/app/views/comments/_comment.html.erb +0 -28
  76. data/app/views/confirmation_mailer/register_confirmation.erb +0 -5
  77. data/app/views/confirmation_mailer/reset_password.erb +0 -5
  78. data/app/views/crm_form/_flash_messages.html.erb +0 -11
  79. data/app/views/crm_form/_form.html.erb +0 -17
  80. data/app/views/crm_form/confirmation.html.erb +0 -3
  81. data/app/views/crm_form/index.html.erb +0 -5
  82. data/app/views/crm_form/not_logged_in.html.erb +0 -1
  83. data/app/views/layouts/rails_connector/time_machine.html.erb +0 -12
  84. data/app/views/rails_connector/time_machine/index.html.erb +0 -88
  85. data/app/views/rss/_item.rss.builder +0 -11
  86. data/app/views/rss/index.rss.builder +0 -11
  87. data/app/views/search/_hit.html.erb +0 -11
  88. data/app/views/search/_hits.html.erb +0 -11
  89. data/app/views/search/_mini_panel.html.erb +0 -4
  90. data/app/views/search/_pagination.html.erb +0 -5
  91. data/app/views/search/_panel.html.erb +0 -4
  92. data/app/views/search/search.html.erb +0 -12
  93. data/app/views/seo_sitemap/show.xml.builder +0 -16
  94. data/app/views/user/_flash_messages.html.erb +0 -11
  95. data/app/views/user/edit.html.erb +0 -6
  96. data/app/views/user/edit_password.html.erb +0 -11
  97. data/app/views/user/forgot_password.html.erb +0 -7
  98. data/app/views/user/login.html.erb +0 -15
  99. data/app/views/user/new.html.erb +0 -13
  100. data/app/views/user/profile.html.erb +0 -8
  101. data/app/views/user/register_pending.html.erb +0 -1
  102. data/app/views/user/set_password.html.erb +0 -14
  103. data/config/locales/de.rails_connector.controllers.yml +0 -28
  104. data/config/locales/de.rails_connector.helpers.yml +0 -9
  105. data/config/locales/de.rails_connector.models.yml +0 -8
  106. data/config/locales/en.rails_connector.controllers.yml +0 -28
  107. data/config/locales/en.rails_connector.helpers.yml +0 -9
  108. data/config/locales/en.rails_connector.models.yml +0 -8
  109. data/config/routes.rb +0 -31
  110. data/lib/generators/rails_connector/comments/comments_generator.rb +0 -20
  111. data/lib/generators/rails_connector/comments/templates/migration.rb +0 -16
  112. data/lib/generators/rails_connector/install/templates/initializers/crm_connector.rb +0 -22
  113. data/lib/generators/rails_connector/ratings/ratings_generator.rb +0 -20
  114. data/lib/generators/rails_connector/ratings/templates/migration.rb +0 -14
  115. data/lib/rails_connector/commentable.rb +0 -23
  116. data/lib/rails_connector/configuration/google_analytics.rb +0 -29
  117. data/lib/rails_connector/configuration/rss.rb +0 -46
  118. data/lib/rails_connector/crm.rb +0 -282
  119. data/lib/rails_connector/googlebot_checker.rb +0 -46
  120. data/lib/rails_connector/liquid_support.rb +0 -25
  121. data/lib/rails_connector/liquid_support/field_value_drop.rb +0 -22
  122. data/lib/rails_connector/liquid_support/general_helper_tag.rb +0 -44
  123. data/lib/rails_connector/liquid_support/link_drop.rb +0 -22
  124. data/lib/rails_connector/liquid_support/liquid_template_handler.rb +0 -162
  125. data/lib/rails_connector/liquid_support/named_object_drop.rb +0 -14
  126. data/lib/rails_connector/liquid_support/obj_drop.rb +0 -43
  127. data/lib/rails_connector/liquid_support/obj_filters.rb +0 -77
  128. data/lib/rails_connector/rateable.rb +0 -57
  129. data/lib/rails_connector/seo.rb +0 -52
  130. data/lib/rails_connector/ses.rb +0 -81
  131. data/lib/rails_connector/syndicateable.rb +0 -11
  132. data/lib/search_request.rb +0 -2
@@ -1,29 +0,0 @@
1
- module RailsConnector
2
- class Configuration
3
-
4
- # This module is an extension to the rails connector configuration.
5
- #
6
- # Configuration example:
7
- #
8
- # RailsConnector::Configuration::GoogleAnalytics.domains(
9
- # 'www.example.de' => 'UA-example-1',
10
- # 'www.example.com' => 'UA-example-2'
11
- # )
12
- module GoogleAnalytics
13
- @@domains = {}
14
-
15
- def self.domains=(domains_and_codes)
16
- @@domains = @@domains.merge(domains_and_codes)
17
- end
18
-
19
- def self.domains(domains_and_codes)
20
- self.domains = domains_and_codes
21
- end
22
-
23
- def self.domain_code(domain)
24
- @@domains[domain]
25
- end
26
- end
27
-
28
- end
29
- end
@@ -1,46 +0,0 @@
1
- module RailsConnector
2
- class Configuration
3
-
4
- # This module adds configuration options for the RSS feature.
5
- #
6
- # Specify the RSS root in
7
- # <code><em>RAILS_ROOT</em>/config/initializers/rails_connector.rb</code>:
8
- # RailsConnector::Configuration::Rss.root = lambda { NamedLink.get_object('news') }
9
- module Rss
10
-
11
- # Raised if no RSS root object has been specified.
12
- class RootUndefined < StandardError; end
13
- # Raised if the root is missing when accessing it
14
- # Inherits from {RootUndefined} for compatibility reasons
15
- class RootNotFound < RootUndefined; end
16
-
17
- @root_provider = nil
18
-
19
- # Stores the obj providing lambda for later use
20
- def self.root=(obj_provider)
21
- case obj_provider
22
- when Obj
23
- Rails.logger.warn("Rss.root= called with an Obj. Use an Obj returning lambda instead.")
24
- root_id = obj_provider.id
25
- @root_provider = lambda { Obj.find(root_id) }
26
- when Proc
27
- @root_provider = obj_provider
28
- else
29
- raise ArgumentError.new("Rss.root= called with '#{obj_provider.class.name}' instead of a lambda.")
30
- end
31
- end
32
-
33
- # Returns the RSS root object.
34
- # If no RSS root has been specified then {Rss::RootUndefined} is raised.
35
- def self.root
36
- raise RootUndefined unless @root_provider
37
- begin
38
- @root_provider.call
39
- rescue RailsConnector::ResourceNotFound
40
- raise RootNotFound
41
- end
42
- end
43
- end
44
-
45
- end
46
- end
@@ -1,282 +0,0 @@
1
- module RailsConnector
2
-
3
- # This module provides high-level access to the Infopark WebCRM.
4
- #
5
- # Methods from the {AuthenticationSupport} module are included
6
- # in all controllers when enabling the Crm feature in your RailsConnector configuration:
7
- #
8
- # RailsConnector::Configuration.enable(
9
- # :crm
10
- # )
11
- module Crm
12
-
13
- # This method requires the infopark_crm_connector gem.
14
- #
15
- # If the gem is available, it does the following:
16
- # * require it
17
- # * include +AuthenticationSupport+ in +ApplicationController+
18
- # * declares helper methods in +ApplicationController+
19
- # * adds a class-inheritable array to +ApplicationController+ for convenience
20
- # (see +session_attributes_for+)
21
- #
22
- # If not, it raises a {LoadError}.
23
- def self.enable
24
- require 'infopark_crm_connector'
25
- ApplicationController.__send__(:include, AuthenticationSupport)
26
- end
27
-
28
- module AuthenticationSupport
29
-
30
- protected
31
-
32
- def self.included(base)
33
- base.helper_method :logged_in?, :current_user, :admin?
34
- end
35
-
36
- # Returns a hash of attributes for the given user that are to be stored in the session.
37
- #
38
- # Uses the array {RailsConnector::Configuration.store_user_attrs_in_session} to determine which
39
- # fields to store.
40
- # Because the field <tt>:id</tt> must always be stored in the session, it is always in the array
41
- # returned by {session_attributes_for}, independent on the fields specified by
42
- # {RailsConnector::Configuration.store_user_attrs_in_session}.
43
- #
44
- # User live_server_groups are stored in the session by default.
45
- def session_attributes_for(user)
46
- attributes = {}
47
- serialized_attributes = \
48
- user.attributes.merge(:live_server_groups => user.live_server_groups).symbolize_keys
49
- (RailsConnector::Configuration.store_user_attrs_in_session + [:id]).each do |attr|
50
- attributes[attr.to_sym] = serialized_attributes[attr.to_sym]
51
- end
52
- attributes[:live_server_groups] = serialized_attributes[:live_server_groups]
53
- attributes
54
- end
55
-
56
- # Determines if the user is logged in.
57
- # Defined as helper method in +ApplicationController+ when enabling the Crm feature.
58
- # @return bool
59
- def logged_in?
60
- !session[:user].blank?
61
- end
62
-
63
- # Returns a +Contact+ object with attributes stored in the session.
64
- #
65
- # To change which fields {DefaultUserController} stores in the session use
66
- # {RailsConnector::Configuration.store_user_attrs_in_session}.
67
- # @return [Infopark::Crm::Contact]
68
- def current_user
69
- @current_user ||= if logged_in?
70
- incorrect_encoding = session[:user].any? do |key, value|
71
- value.is_a?(String) && value.encoding_aware? && value.encoding.name != 'UTF-8'
72
- end
73
- if incorrect_encoding
74
- self.current_user = Infopark::Crm::Contact.find(session[:user][:id])
75
- end
76
-
77
- user_session = session[:user].dup
78
- live_server_groups = user_session.delete(:live_server_groups)
79
- user = Infopark::Crm::Contact.new(user_session || {})
80
- user.live_server_groups = live_server_groups
81
- user
82
- end
83
- end
84
-
85
- # Takes a +Contact+ object and stores its user attributes in the session.
86
- #
87
- # This can be helpful if you want to set a user for e.g. Googlebot.
88
- # @param [Infopark::Crm::Contact] user
89
- # @return [void]
90
- def current_user=(user)
91
- @current_user = user
92
- session[:user] = user.nil? ? nil : session_attributes_for(user)
93
- end
94
-
95
- # Reloads the +Contact+ object in +current_user+ from the WebCRM,
96
- # and updates the user attribute cached in the session.
97
- # @return [void]
98
- def reload_current_user
99
- user = current_user
100
- user.reload
101
- self.current_user = user
102
- end
103
-
104
- # Determines if the current user is admin (+false+ by default).
105
- # Being admin enables to user to delete comments and reset ratings.
106
- # Defined as helper method in +ApplicationController+ when enabling the CRM feature.
107
- #
108
- # To change the default behavior overwrite <tt>admin?</tt> in your ApplicationController:
109
- #
110
- # class ApplicationController < ActionController::Base
111
- #
112
- # private
113
- #
114
- # def admin?
115
- # logged_in? && current_user.live_server_groups.include?("admins")
116
- # end
117
- #
118
- # end
119
- # @return bool
120
- def admin?
121
- false
122
- end
123
-
124
- end
125
-
126
- module Localizable
127
- # --------------------------------------------
128
- # This module can be included in controllers
129
- # that interface the WebCRM so error messages
130
- # are localized
131
- # --------------------------------------------
132
- def self.included(base)
133
- base.before_filter :set_crm_language
134
- end
135
-
136
- private
137
-
138
- def set_crm_language
139
- Infopark::Crm.configure {|config| config.locale = I18n.locale.to_s }
140
- end
141
- end
142
-
143
- module Sanitization
144
- # --------------------------------------------
145
- # This module is included in controllers to
146
- # sanitize user input, in reference to a given
147
- # whitelist
148
- # --------------------------------------------
149
-
150
- private
151
-
152
- def sanitize_user_params(user_params_or_nil, whitelist)
153
- user_params = user_params_or_nil || {}
154
-
155
- filtered_contact_attrs = filter_params_hash(
156
- user_params, whitelist[:contact]
157
- )
158
-
159
- filtered_contact_attrs
160
- end
161
-
162
- def filter_params_hash(source_hash, allowed_keys_unstringified)
163
- return {} unless source_hash
164
- allowed_keys = allowed_keys_unstringified.map(&:to_s)
165
- source_hash.reject { |key, value| !allowed_keys.include?(key) }
166
- end
167
- end
168
-
169
- # This module is included in {DefaultUserController} to provide callbacks for user functionality.
170
- #
171
- # If you want to add behavior before or after authentication, logout or register, override any of
172
- # the methods included in this module in your {UserController}.
173
- module Callbacks
174
-
175
- private
176
-
177
- # @!group Callbacks
178
-
179
- # Called by {DefaultUserController} on POST requests before a user is authenticated,
180
- # i.e. the user has already provided credentials in a form.
181
- #
182
- # By default, it doesn't do anything.
183
- # @return [void]
184
- def before_authenticate
185
- end
186
-
187
- # Called by {DefaultUserController} before a user is logged out,
188
- # i.e. the session is reset.
189
- #
190
- # By default, it doesn't do anything.
191
- # @return [void]
192
- def before_logout
193
- end
194
-
195
- # Called by {DefaultUserController} on POST requests before a user is created,
196
- # i.e. the user has already provided name, e-mail etc. in a form.
197
- #
198
- # By default, it doesn't do anything.
199
- # @return [void]
200
- def before_register
201
- end
202
-
203
- # Called by {DefaultUserController} on POST requests after a user is authenticated,
204
- # i.e. the user has already provided correct credentials but the session has not yet been set.
205
- #
206
- # By default, it doesn't do anything.
207
- # @return [void]
208
- def after_authenticate
209
- end
210
-
211
- # Called by {DefaultUserController} after a user is logged out,
212
- # i.e. the session is reset.
213
- #
214
- # By default, it doesn't do anything.
215
- # @return [void]
216
- def after_logout
217
- end
218
-
219
- # Called by {DefaultUserController} on POST requests after a user is created,
220
- # i.e. a WebCRM activity has been created or the user has been created directly in the WebCRM.
221
- #
222
- # By default, it doesn't do anything.
223
- # @return [void]
224
- def after_register
225
- end
226
-
227
- # Called by {DefaultUserController} whenever requests to the WebCRM fail.
228
- # This includes <tt>Errno::ECONNREFUSED</tt> or the ActiveResource errors +ForbiddenAccess+,
229
- # +UnauthorizedAccess+, and +BadRequest+.
230
- #
231
- # By default, it raises an error so that administrators are notified immediately
232
- # if the WebCRM is down or not configured properly.
233
- # @return [void]
234
- def on_crm_error(exception)
235
- raise exception
236
- end
237
-
238
- # @!endgroup
239
-
240
- end
241
-
242
- # Default attributes for WebCRM's Contact.
243
- #
244
- # Helpers like +form_for+ will fail on +ActiveResource+ attributes
245
- # until those attributes are set.
246
- # See http://www.ruby-forum.com/topic/113542
247
- #
248
- # This constant provides default values for nearly all attributes.
249
- #
250
- # You are free to use any of these attributes in your views.
251
- # If you try to use others, +form_for+ will fail.
252
- CONTACT_DEFAULT_ATTRS = {
253
- :id => '',
254
- :account_id => '',
255
- :org_name_address => '',
256
- :org_unit_address => '',
257
- :extended_address => '',
258
- :street_address => '',
259
- :postalcode => '',
260
- :locality => '',
261
- :region => '',
262
- :country => '',
263
- :email => '',
264
- :fax => '',
265
- :first_name => '',
266
- :gender => 'N',
267
- :job_title => '',
268
- :language => 'en',
269
- :last_name => '',
270
- :login => '',
271
- :mobile_phone => '',
272
- :name_prefix => '',
273
- :phone => '',
274
- :want_geo_location => '',
275
- :want_email => 0,
276
- :want_phonecall => 0,
277
- :want_snailmail => 0
278
- }.stringify_keys
279
-
280
- end
281
-
282
- end
@@ -1,46 +0,0 @@
1
- module RailsConnector
2
-
3
- module GooglebotChecker
4
- require 'socket'
5
-
6
- protected
7
-
8
- def referer_is_google?
9
- return true if request.headers['Referer'] =~ /google/
10
- end
11
-
12
- def is_genuine_googlebot?(ip_address)
13
- if ip_address =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/
14
- host = reverse_dns_lookup_for_ip(ip_address)
15
- return false unless host =~ /googlebot.com$/
16
- res = forward_dns_matcher(host, ip_address)
17
- return res
18
- else
19
- return false
20
- end
21
- end
22
-
23
- private
24
-
25
- def reverse_dns_lookup_for_ip(ip_address)
26
- begin
27
- addr = Socket.gethostbyname(ip_address)
28
- Socket.gethostbyaddr(addr[3],Socket::AF_INET)[0]
29
- rescue
30
- []
31
- end
32
- end
33
-
34
- def forward_dns_matcher(host, ip_address)
35
- begin
36
- lookup = Socket.getaddrinfo(host, 0,
37
- Socket::AF_INET, Socket::SOCK_STREAM, nil,
38
- Socket::AI_CANONNAME)
39
- return true if lookup.collect {|info| info[3]}.uniq.include?(ip_address)
40
- rescue
41
- false
42
- end
43
- false
44
- end
45
- end
46
- end
@@ -1,25 +0,0 @@
1
- require 'liquid'
2
-
3
- # A collection of modules and classes needed to enable Liquid templates with Rails Connector
4
- # @api public
5
- module RailsConnector::LiquidSupport
6
-
7
- # Helpers can be made available in Liquid templates by enabling them in the
8
- # app initialization like this:
9
- #
10
- # RailsConnector::LiquidSupport.enable_helpers(
11
- # :helper_a,
12
- # :helper_b
13
- # )
14
- # @api public
15
- def self.enable_helpers(*helpers)
16
- helpers.each do |helper|
17
- GeneralHelperTag << helper
18
- end
19
- end
20
-
21
- # set to +true+ if an error in a liquid template should lead to an 500 server error
22
- # @api public
23
- mattr_accessor :raise_template_errors
24
-
25
- end
@@ -1,22 +0,0 @@
1
- module RailsConnector::LiquidSupport
2
-
3
- class FieldValueDrop < Liquid::Drop
4
- attr_accessor :__value, :__marker
5
-
6
- def initialize(obj, field, value, marker)
7
- @obj, @field, @__value, @__marker = obj, field, value, marker
8
- end
9
-
10
- def to_s
11
- action_view = @context.registers[:action_view]
12
- safe_value = __value.to_s.html_safe
13
- if __marker
14
- action_view.edit_marker(@obj, @field) { safe_value }
15
- else
16
- safe_value
17
- end
18
- end
19
-
20
- end
21
-
22
- end