zena 1.2.4 → 1.2.5

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 (104) hide show
  1. data/History.txt +18 -0
  2. data/app/controllers/nodes_controller.rb +11 -6
  3. data/app/controllers/sites_controller.rb +3 -2
  4. data/app/controllers/user_sessions_controller.rb +1 -1
  5. data/app/controllers/virtual_classes_controller.rb +3 -2
  6. data/app/models/document.rb +2 -2
  7. data/app/models/node.rb +6 -1
  8. data/app/models/note.rb +3 -27
  9. data/app/models/role.rb +11 -5
  10. data/app/models/site.rb +140 -43
  11. data/app/models/string_hash.rb +2 -0
  12. data/app/models/user.rb +9 -4
  13. data/app/models/user_session.rb +1 -1
  14. data/app/models/virtual_class.rb +49 -18
  15. data/app/views/sites/_form.erb +7 -4
  16. data/app/views/sites/_li.erb +15 -9
  17. data/app/views/users/_li.rhtml +3 -0
  18. data/app/views/users/index.rhtml +1 -1
  19. data/app/views/virtual_classes/_form.erb +1 -1
  20. data/bricks/acls/zena/init.rb +1 -2
  21. data/bricks/acls/zena/test/sites/erebus/roles.yml +4 -0
  22. data/bricks/activity/lib/bricks/activity.rb +24 -0
  23. data/bricks/activity/zena/migrate/20130711135905_add_activity_to_user.rb +9 -0
  24. data/bricks/activity/zena/test/integration/activity_integration_test.rb +29 -0
  25. data/bricks/captcha/zena/init.rb +0 -3
  26. data/bricks/fs_skin/lib/bricks/fs_skin.rb +3 -3
  27. data/bricks/fs_skin/zena/skins/blog/Node.zafu +1 -1
  28. data/bricks/fs_skin/zena/tasks.rb +2 -2
  29. data/bricks/fs_skin/zena/test/integration/fs_skin_integration_test.rb +2 -2
  30. data/bricks/fs_skin/zena/test/unit/fs_skin_test.rb +1 -1
  31. data/bricks/math/zena/init.rb +0 -3
  32. data/bricks/pdf/zena/init.rb +1 -5
  33. data/bricks/worker/zena/init.rb +0 -2
  34. data/bricks/zena/zena/migrate/20130617164527_add_master_id_to_site.rb +13 -0
  35. data/bricks/zena/zena/migrate/20130712081512_alter_login_users.rb +9 -0
  36. data/config/bricks.yml +4 -1
  37. data/lib/bricks/loader.rb +17 -9
  38. data/lib/tasks/zena.rake +40 -5
  39. data/lib/zafu/process/ruby_less_processing.rb +3 -5
  40. data/lib/zena.rb +2 -0
  41. data/lib/zena/acts/secure.rb +11 -2
  42. data/lib/zena/console.rb +5 -4
  43. data/lib/zena/core_ext/string.rb +2 -2
  44. data/lib/zena/deploy.rb +22 -6
  45. data/lib/zena/deploy/logrotate_app.rhtml +10 -7
  46. data/lib/zena/deploy/logrotate_host.rhtml +21 -26
  47. data/lib/zena/deploy/vhost.rhtml +3 -3
  48. data/lib/zena/foxy_parser.rb +1 -1
  49. data/lib/zena/info.rb +1 -1
  50. data/lib/zena/site_worker.rb +2 -2
  51. data/lib/zena/use.rb +0 -1
  52. data/lib/zena/use/ancestry.rb +1 -1
  53. data/lib/zena/use/authlogic.rb +2 -1
  54. data/lib/zena/use/display.rb +6 -0
  55. data/lib/zena/use/query_builder.rb +1 -1
  56. data/lib/zena/use/query_node.rb +3 -3
  57. data/lib/zena/use/rendering.rb +47 -13
  58. data/lib/zena/use/test_helper.rb +1 -1
  59. data/lib/zena/use/urls.rb +6 -104
  60. data/lib/zena/use/zafu_safe_definitions.rb +9 -4
  61. data/lib/zena/use/zafu_templates.rb +1 -0
  62. data/locale/app.pot +4 -0
  63. data/locale/de/LC_MESSAGES/zena.mo +0 -0
  64. data/locale/de/zena.po +6 -2
  65. data/locale/en/LC_MESSAGES/zena.mo +0 -0
  66. data/locale/en/zena.po +6 -2
  67. data/locale/fr/LC_MESSAGES/zena.mo +0 -0
  68. data/locale/fr/zena.po +5 -1
  69. data/locale/it/LC_MESSAGES/zena.mo +0 -0
  70. data/locale/it/zena.po +6 -2
  71. data/locale/zena.pot +4 -0
  72. data/test/functional/nodes_controller_test.rb +2 -133
  73. data/test/functional/sites_controller_test.rb +1 -1
  74. data/test/integration/multiple_hosts_test.rb +2 -1
  75. data/test/integration/navigation_test.rb +37 -0
  76. data/test/integration/query_node/basic.yml +1 -1
  77. data/test/integration/zafu_compiler/ajax.yml +7 -0
  78. data/test/integration/zafu_compiler/comments.yml +2 -2
  79. data/test/integration/zafu_compiler/context.yml +6 -2
  80. data/test/integration/zafu_compiler/display.yml +16 -4
  81. data/test/integration/zafu_compiler/forms.yml +1 -0
  82. data/test/integration/zafu_compiler/query.yml +7 -1
  83. data/test/integration/zafu_compiler/relations.yml +12 -7
  84. data/test/integration/zafu_compiler/roles.yml +3 -3
  85. data/test/integration/zafu_compiler/rubyless.yml +1 -2
  86. data/test/integration/zafu_compiler/safe_definitions.yml +5 -0
  87. data/test/sites/complex/roles.yml +1 -1
  88. data/test/sites/ocean/roles.yml +4 -0
  89. data/test/sites/zena/columns.yml +3 -1
  90. data/test/sites/zena/roles.yml +5 -1
  91. data/test/sites/zena/sites.yml +22 -0
  92. data/test/unit/document_test.rb +14 -0
  93. data/test/unit/node_test.rb +14 -0
  94. data/test/unit/role_test.rb +19 -4
  95. data/test/unit/site_test.rb +67 -0
  96. data/test/unit/user_test.rb +20 -0
  97. data/test/unit/virtual_class_test.rb +116 -11
  98. data/test/unit/zena/use/rendering_test.rb +1 -1
  99. data/zena.gemspec +67 -66
  100. metadata +126 -125
  101. data/bricks/fs_skin/zena/init.rb +0 -1
  102. data/bricks/grid/zena/init.rb +0 -4
  103. data/bricks/single/zena/init.rb +0 -1
  104. data/bricks/spreadsheet/zena/init.rb +0 -3
@@ -0,0 +1,9 @@
1
+ class AlterLoginUsers < ActiveRecord::Migration
2
+ def self.up
3
+ change_column :users, :login, :string, :limit => 255
4
+ end
5
+
6
+ def self.down
7
+ change_column :users, :login, :string, :limit => 20
8
+ end
9
+ end
@@ -9,10 +9,12 @@ test:
9
9
  worker: OFF
10
10
  uv: OFF
11
11
  spreadsheet: ON
12
+ activity: ON
12
13
 
13
14
 
14
15
  development:
15
- # asset_port: 7999
16
+ # asset_port: 7999
17
+ activity: ON
16
18
  mongrel: OFF
17
19
  passenger: ON
18
20
  uv:
@@ -53,6 +55,7 @@ production:
53
55
  # Port used only to provide assets during custom rendering (pdf).
54
56
  # We need this to avoid deadlocks with round-robin based serving.
55
57
  # asset_port: 7999
58
+ activity: ON
56
59
  cache_path: '/public/cache'
57
60
  mongrel: OFF
58
61
  passenger: ON
@@ -33,10 +33,6 @@ module Bricks
33
33
  paths_for('models')
34
34
  end
35
35
 
36
- def init_paths
37
- paths_for('zena/init.rb')
38
- end
39
-
40
36
  def migrations_for(brick)
41
37
  File.join(brick_path(brick), 'zena', 'migrate')
42
38
  end
@@ -93,7 +89,7 @@ module Bricks
93
89
  def load_zafu(mod)
94
90
  Bricks::CONFIG.keys.each do |brick_name|
95
91
  begin
96
- mod.send(:include, eval("Bricks::#{brick_name.capitalize}::ZafuMethods"))
92
+ mod.send(:include, eval("Bricks::#{brick_name.camelcase}::ZafuMethods"))
97
93
  rescue NameError
98
94
  # ignore
99
95
  end
@@ -121,16 +117,28 @@ module Bricks
121
117
  path = File.join(path, 'lib')
122
118
  ActiveSupport::Dependencies.autoload_paths << path
123
119
  ActiveSupport::Dependencies.autoload_once_paths << path
124
- $LOAD_PATH << path
120
+ $LOAD_PATH << path
125
121
  end
126
122
 
127
123
  if @@no_init
128
124
  puts "=> Not executing bricks init code."
129
125
  return
130
126
  end
131
- # load 'init'
132
- init_paths.each do |init_path|
133
- require init_path
127
+
128
+ # execute Zena.use module and load 'init'
129
+ bricks.each do |path|
130
+ mod = path.split('/').last
131
+ mod_path = "bricks/#{mod}"
132
+ if File.exist?("#{path}/lib/#{mod_path}.rb") # bricks/acl/lib/bricks/acl.rb
133
+ require mod_path
134
+ mod = eval "Bricks::#{mod.camelcase}"
135
+ Zena.use mod
136
+
137
+ init_rb = "#{path}/zena/init.rb"
138
+ if File.exist?(init_rb)
139
+ require init_rb
140
+ end
141
+ end
134
142
  end
135
143
  end
136
144
  end
@@ -143,6 +143,41 @@ namespace :zena do
143
143
  end
144
144
  end
145
145
  end
146
+
147
+ desc "Create a new site alias, parameters are ALIAS, HOST"
148
+ task :mkalias => :environment do
149
+ # 0. set host name
150
+ unless host = ENV['HOST']
151
+ puts "Please set HOST to the hostname for the master site. Aborting."
152
+ else
153
+ unless ali = ENV['ALIAS']
154
+ puts "Please set ALIAS to the hostname of the alias site. Aborting."
155
+ else
156
+ if Site.find_by_host(ali)
157
+ puts "Host alias already exists in the database. Aborting."
158
+ else
159
+ unless site = Site.find_by_host(host)
160
+ puts "Master host not found in the database. Aborting."
161
+ else
162
+ alias_site = site.create_alias(ali)
163
+
164
+ if alias_site.new_record?
165
+ puts "Could not create site alias ! Errors:"
166
+ alias_site.errors.each do |k,v|
167
+ puts "[#{k}] #{v}"
168
+ end
169
+ raise "Aborting."
170
+ else
171
+ # 1. create directories and symlinks
172
+ `rake zena:mksymlinks HOST=#{ali.inspect}`
173
+
174
+ puts "Site alias [#{ali} => #{host}] created."
175
+ end
176
+ end
177
+ end
178
+ end
179
+ end
180
+ end
146
181
 
147
182
  desc "Create symlinks for a site"
148
183
  task :mksymlinks => :zena_config do
@@ -362,11 +397,11 @@ namespace :zena do
362
397
  if ENV['HOST']
363
398
  sites = [Site.find_by_host(ENV['HOST'])]
364
399
  else
365
- sites = Site.all
400
+ sites = Site.master_sites
366
401
  end
367
402
 
368
403
  sites.each do |site|
369
- Thread.current[:visitor] = site.any_admin
404
+ setup_visitor(site.any_admin, site)
370
405
 
371
406
  if ENV['WORKER'] == 'false' || RAILS_ENV == 'test'
372
407
  # We avoid SiteWorker by passing nodes.
@@ -387,7 +422,7 @@ namespace :zena do
387
422
  if ENV['HOST']
388
423
  sites = [Site.find_by_host(ENV['HOST'])]
389
424
  else
390
- sites = Site.all
425
+ sites = Site.master_sites
391
426
  end
392
427
  sites.each do |site|
393
428
  # Does not use SiteWorker.
@@ -401,11 +436,11 @@ namespace :zena do
401
436
  if ENV['HOST']
402
437
  sites = [Site.find_by_host(ENV['HOST'])]
403
438
  else
404
- sites = Site.all
439
+ sites = Site.master_sites
405
440
  end
406
441
  sites.each do |site|
407
442
  # We avoid SiteWorker by passing nodes.
408
- Thread.current[:visitor] = site.any_admin
443
+ setup_visitor(site.any_admin, site)
409
444
  nodes = Node.find(:all,
410
445
  :conditions => ['site_id = ?', site.id]
411
446
  )
@@ -34,7 +34,8 @@ module Zafu
34
34
 
35
35
  rubyless_render(@method, params)
36
36
  rescue RubyLess::NoMethodError => err
37
- parser_continue("#{err.error_message} <span class='type'>#{err.method_with_arguments}</span> (#{node.klass} context)")
37
+ klass_name = node.list_context? ? "[#{node.klass}]" : node.klass.to_s
38
+ parser_continue("#{err.error_message} <span class='type'>#{err.method_with_arguments}</span> (#{klass_name} context)")
38
39
  rescue RubyLess::Error => err
39
40
  parser_continue(err.message)
40
41
  end
@@ -181,10 +182,7 @@ module Zafu
181
182
  elsif node && node.list_context? && type = safe_method_from(Array, signature, node)
182
183
  # FIXME: why do we need this here ? Remove with related code in zafu_safe_definitions ?
183
184
  type = type[:class].call(self, node.klass, signature) if type[:class].kind_of?(Proc)
184
- type.merge(:receiver => RubyLess::TypedString.new(node.name, :class => Array, :elem => node.klass.first))
185
- elsif node && node.list_context? && type = safe_method_from(node.klass.first, signature, node)
186
- type = type[:class].call(self, node.klass, signature) if type[:class].kind_of?(Proc)
187
- type.merge(:receiver => RubyLess::TypedString.new("#{node.name}.first", :class => node.klass.first, :h => true))
185
+ type.merge(:receiver => RubyLess::TypedString.new(node.name, :class => Array, :query => node.opts[:query], :elem => node.klass.first))
188
186
  elsif @rendering_block_owner && @blocks.first.kind_of?(String) && !added_options
189
187
  # Insert the block content into the method: <r:trans>blah</r:trans> becomes trans("blah")
190
188
  signature_with_block = signature.dup
@@ -333,6 +333,8 @@ EXT_TYPE = [
333
333
  [ "movie" , "video/x-sgi-movie" ],
334
334
  [ "mp2" , "audio/mpeg" ],
335
335
  [ "mp3" , "audio/mpeg" ],
336
+ [ "mp4" , "video/mp4" ],
337
+ [ "m4v" , "video/mp4" ],
336
338
  [ "mpe" , "video/mpeg" ],
337
339
  [ "mpeg" , "video/mpeg" ],
338
340
  [ "mpg" , "video/mpeg" ],
@@ -145,9 +145,10 @@ Just doing the above will filter all result according to the logged in user.
145
145
  find[:conditions] = node_find_scope
146
146
  end
147
147
  elsif klass.column_names.include?('site_id')
148
- find[:conditions] = {klass.table_name => {:site_id => visitor.site[:id]}}
148
+ find[:conditions] = {klass.table_name => {:site_id => visitor.site.id}}
149
149
  elsif klass <= ::Site
150
- find[:conditions] = {klass.table_name => {:id => visitor.site[:id]}}
150
+ id = visitor.site.id
151
+ find[:conditions] = ['id = ? or master_id = ?', id, id]
151
152
  end
152
153
 
153
154
  # FIXME: 'with_scope' is protected now. Can we live with something cleaner like this ?
@@ -309,6 +310,14 @@ def current_site
309
310
  visitor.site
310
311
  end
311
312
 
313
+ # This method should be used to install a given user and site as the current visitor.
314
+ def setup_visitor(user, site)
315
+ raise "Missing site information" unless site
316
+ Thread.current[:visitor] = user
317
+ # Load alias site in visitor
318
+ user.site = site
319
+ end
320
+
312
321
  # Return the current visitor. Raise an error if the visitor is not set.
313
322
  # For controllers, this method must be redefined in Application
314
323
  def visitor
@@ -99,17 +99,18 @@ module Zena
99
99
  def login(name, host = nil)
100
100
  finder = {}
101
101
  finder[:conditions] = cond = [[]]
102
+ site = nil
102
103
  if host
103
- finder[:joins] = 'INNER JOIN sites ON sites.id = users.site_id'
104
- cond.first << 'sites.host = ?'
105
- cond << host.to_s
104
+ site = Site.find_by_host(host)
105
+ cond.first << 'site_id = ?'
106
+ cond << site.id
106
107
  end
107
108
 
108
109
  cond.first << 'users.login = ?'
109
110
  cond << name.to_s
110
111
  cond[0] = cond.first.join(' AND ')
111
112
  if visitor = User.find(:first, finder)
112
- Thread.current[:visitor] = visitor
113
+ setup_visitor(visitor, site || visitor.site)
113
114
  puts "Logged #{visitor.login} in #{visitor.site.host}"
114
115
  else
115
116
  raise ActiveRecord::RecordNotFound
@@ -101,9 +101,9 @@ class String
101
101
  def limit(size, readmore = '…')
102
102
  if self.size > size
103
103
  # readmore can contain a link: <a...> but this is defined in the zafu template.
104
- ::ERB::Util.html_escape(self[0..(size-1)]) + readmore
104
+ self[0..(size-1)] + readmore
105
105
  else
106
- ::ERB::Util.html_escape(self)
106
+ self
107
107
  end
108
108
  end
109
109
 
@@ -162,6 +162,19 @@ Capistrano::Configuration.instance(:must_exist).load do
162
162
  run "chown -R www-data:www-data #{sites_root}/#{self[:host]}"
163
163
  end
164
164
 
165
+ desc "create a new site alias [-s host='...' -s alias='...' -s pass='...']"
166
+ task :mkalias, :roles => :app do
167
+ run "#{in_current} rake zena:mksite HOST='#{self[:host]}' ALIAS='#{self[:alias]}' RAILS_ENV='production'"
168
+
169
+ # Same as mksite
170
+ self[:host] = self[:alias]
171
+ run "test -e #{sites_root}/#{self[:host]} || mkdir #{sites_root}/#{self[:host]}"
172
+ create_vhost
173
+ create_awstats
174
+ logrotate
175
+ run "chown -R www-data:www-data #{sites_root}/#{self[:host]}"
176
+ end
177
+
165
178
  task :mksymlinks, :roles => :app do
166
179
  run "#{in_current} rake zena:mksymlinks HOST='#{self[:host]}'"
167
180
  run "chown -R www-data:www-data #{sites_root}/#{self[:host]}"
@@ -202,15 +215,18 @@ Capistrano::Configuration.instance(:must_exist).load do
202
215
  desc "Update vhost configuration file"
203
216
  task :create_vhost, :roles => :web do
204
217
  unless self[:host]
205
- puts "HOST not set (use -s host=...)"
218
+ puts "HOST not set (use -s host=... -s lang_list=...)"
206
219
  else
220
+ lang = self[:lang] ||= (self[:lang_list] || 'en').split(',').map(&:strip).first
221
+ self[:lang_list] ||= lang
207
222
  vhost_files = []
208
- if self[:ssl] == :all
209
223
 
210
- public_path = Bricks.raw_config['public_path'] || '/public'
211
- cache_path = Bricks.raw_config['cache_path'] || '/public'
224
+ public_path = Bricks.raw_config['public_path'] || '/public'
225
+ cache_path = Bricks.raw_config['cache_path'] || '/public'
226
+
227
+ self[:cache_path] = cache_path.sub(%r{^#{public_path}},'')
212
228
 
213
- self[:cache_path] = cache_path.sub(%r{^#{public_path}},'')
229
+ if self[:ssl] == :all
214
230
  vhost = render("#{templates}/vhost.rhtml", :config => self, :ssl => true, :vhost_port => ':443')
215
231
  put(vhost, "#{vhost_root}/#{self[:host]}.ssl")
216
232
  vhost_files << "#{self[:host]}.ssl"
@@ -331,7 +347,7 @@ Capistrano::Configuration.instance(:must_exist).load do
331
347
  awstats = '/etc/cron.d/awstats'
332
348
  run %Q{sed "/config=#{self[:host]} /d" #{awstats} >#{awstats}.tmp && mv #{awstats}.tmp #{awstats}}
333
349
 
334
- logrotate_conf = "/etc/logrotate.d/#{self[:old_host]}"
350
+ logrotate_conf = "/etc/logrotate.d/#{db_name}-#{self[:old_host]}"
335
351
  run "test -e #{logrotate_conf} && rm #{logrotate_conf} || true"
336
352
 
337
353
  create_vhost
@@ -1,9 +1,12 @@
1
+ # zena apache2 app logrotate configuration for <%= config[:db_name] %>
2
+ # automatically generated file
3
+
1
4
  <%= config[:app_root] %>/log/production.log {
2
- weekly
3
- missingok
4
- rotate 9
5
- compress
6
- delaycompress
7
- notifempty
8
- copytruncate
5
+ weekly
6
+ missingok
7
+ rotate 9
8
+ compress
9
+ delaycompress
10
+ notifempty
11
+ copytruncate
9
12
  }
@@ -1,34 +1,29 @@
1
+ # zena apache2 logrotate configuration for <%= config[:host] %>
2
+ # automatically generated file
3
+
1
4
  <%= config[:sites_root] %>/<%= config[:host] %>/log/apache2.access.log {
2
- weekly
3
- missingok
4
- rotate 52
5
- compress
6
- delaycompress
7
- notifempty
8
- create 640 www-data www-data
9
- sharedscripts
5
+ weekly
6
+ missingok
7
+ rotate 52
8
+ compress
9
+ delaycompress
10
+ notifempty
11
+ create 640 www-data www-data
12
+ copytruncate
13
+ sharedscripts
10
14
  prerotate
11
15
  /usr/lib/cgi-bin/awstats.pl -update -config=<%= config[:host] %>
12
16
  endscript
13
- postrotate
14
- if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
15
- /etc/init.d/apache2 reload > /dev/null
16
- fi
17
- endscript
18
17
  }
19
18
 
20
19
  <%= config[:sites_root] %>/<%= config[:host] %>/log/apache2.error.log {
21
- weekly
22
- missingok
23
- rotate 52
24
- compress
25
- delaycompress
26
- notifempty
27
- create 640 www-data www-data
28
- sharedscripts
29
- postrotate
30
- if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
31
- /etc/init.d/apache2 reload > /dev/null
32
- fi
33
- endscript
20
+ weekly
21
+ missingok
22
+ rotate 52
23
+ compress
24
+ delaycompress
25
+ notifempty
26
+ create 640 www-data www-data
27
+ copytruncate
28
+ sharedscripts
34
29
  }
@@ -75,10 +75,10 @@ end %>
75
75
  # Rewrite index to check for static
76
76
  RewriteRule ^/$ /index.html [QSA]
77
77
 
78
- # Serve static (cached) assets
78
+ # Serve static (recently cached) assets
79
79
  RewriteCond %{QUERY_STRING} ^[0-9]+$
80
- RewriteCond %{DOCUMENT_ROOT}<%= config[:cache_path] %>%{REQUEST_FILENAME}.%{QUERY_STRING} -f
81
- RewriteRule ^/(.*)$ <%= config[:cache_path] %>%{REQUEST_FILENAME}.%{QUERY_STRING} [L]
80
+ RewriteCond %{DOCUMENT_ROOT}<%= config[:cache_path] %>%{REQUEST_FILENAME} -f
81
+ RewriteRule ^/(.*)$ <%= config[:cache_path] %>%{REQUEST_FILENAME} [L]
82
82
 
83
83
  # Static CSS, JS
84
84
  RewriteCond %{QUERY_STRING} ^[0-9]+$
@@ -709,7 +709,7 @@ module Zena
709
709
  end
710
710
 
711
711
  def multi_site_id_keys
712
- super + ['su', 'anon']
712
+ super + ['su', 'anon', 'master']
713
713
  end
714
714
  end
715
715
 
@@ -1,4 +1,4 @@
1
1
  module Zena
2
- VERSION = '1.2.4'
2
+ VERSION = '1.2.5'
3
3
  ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
4
4
  end
@@ -19,7 +19,7 @@ module Zena
19
19
  def perform(site = nil)
20
20
  if site.nil?
21
21
  site ||= Site.find(site_id)
22
- Thread.current[:visitor] = site.any_admin
22
+ setup_visitor(site.any_admin, site)
23
23
  end
24
24
 
25
25
  if page.nil?
@@ -58,7 +58,7 @@ module Zena
58
58
 
59
59
  # Return a textual description of the operation.
60
60
  def info
61
- if site_id == current_site.id
61
+ if site_id == current_site.site_id
62
62
  "#{action}, #{_('page')} #{page}/#{page_count}"
63
63
  else
64
64
  # Do not show jobs from other sites
@@ -27,7 +27,6 @@ module Zena
27
27
  end
28
28
 
29
29
  def each_module_for(name)
30
- create_module_hash
31
30
  modules_for(name).each do |mod|
32
31
  yield(mod)
33
32
  end