zena 0.15.0 → 0.15.1
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.
- data/History.txt +14 -0
- data/{README.txt → README.rdoc} +13 -19
- data/app/controllers/documents_controller.rb +7 -2
- data/app/controllers/nodes_controller.rb +4 -0
- data/app/models/iformat.rb +43 -1
- data/app/models/skin.rb +1 -2
- data/app/models/text_document.rb +2 -2
- data/app/models/version.rb +1 -0
- data/app/views/documents/new.rhtml +2 -2
- data/app/views/iformats/_form.rhtml +5 -4
- data/app/views/iformats/_li.rhtml +1 -0
- data/app/views/iformats/index.rhtml +1 -1
- data/app/views/nodes/_import_results.rhtml +1 -1
- data/app/views/nodes/edit.html.erb +2 -2
- data/app/views/templates/edit_tabs/_custom.rhtml +2 -2
- data/app/views/templates/edit_tabs/_document.rhtml +3 -3
- data/app/views/versions/_tr.rhtml +5 -6
- data/app/views/versions/edit.rhtml +2 -2
- data/bin/zena +2 -2
- data/bricks/captcha/patch/application_controller.rb +1 -1
- data/bricks/captcha/zafu/captcha.rb +1 -1
- data/config/deploy.rb +36 -380
- data/config/gems.yml +2 -7
- data/db/migrate/20091018200734_add_popup_info_to_image_format.rb +9 -0
- data/db/schema.rb +3 -2
- data/lib/gettext_strings.rb +8 -0
- data/lib/tasks/zena.rake +30 -12
- data/lib/zena/app.rb +2 -0
- data/{config → lib/zena/deploy}/awstats.conf.rhtml +0 -0
- data/{config → lib/zena/deploy}/database.rhtml +0 -0
- data/lib/zena/deploy/httpd.rhtml +22 -0
- data/{config → lib/zena/deploy}/start.html +2 -2
- data/{config → lib/zena/deploy}/stats.vhost.rhtml +0 -0
- data/{config/zena.rb → lib/zena/deploy/template.rb} +13 -8
- data/{config → lib/zena/deploy}/vhost.rhtml +28 -14
- data/{config → lib/zena/deploy}/vhost_www.rhtml +0 -0
- data/lib/zena/deploy.rb +377 -0
- data/lib/zena/info.rb +13 -0
- data/lib/zena/parser/zena_tags.rb +3 -0
- data/lib/zena/parser.rb +1 -0
- data/lib/zena/use/calendar.rb +2 -1
- data/lib/zena/use/dates.rb +6 -1
- data/lib/zena/use/fixtures.rb +9 -0
- data/lib/zena/use/html_tags.rb +44 -5
- data/lib/zena/use/node_query_finders.rb +1 -2
- data/lib/zena/use/refactor.rb +0 -13
- data/lib/zena/use/rendering.rb +13 -0
- data/lib/zena/use/zafu.rb +21 -9
- data/lib/zena.rb +4 -11
- data/locale/en/LC_MESSAGES/zena.mo +0 -0
- data/locale/en/zena.po +29 -1
- data/locale/fr/LC_MESSAGES/zena.mo +0 -0
- data/locale/fr/zena.po +29 -1
- data/locale/zena.pot +28 -0
- data/public/images/popup_next.png +0 -0
- data/public/images/popup_prev.png +0 -0
- data/public/javascripts/upload-progress.js +13 -3
- data/public/javascripts/zena.js +177 -23
- data/public/stylesheets/popup.css +5 -3
- data/public/stylesheets/zena.css +10 -1
- data/{lib/zena/use → test}/custom_queries/complex.host.yml +0 -0
- data/test/fixtures/iformats.yml +1 -0
- data/test/fixtures/nodes.yml +1 -1
- data/test/fixtures/versions.yml +3 -1
- data/test/sites/zena/iformats.yml +1 -0
- data/test/sites/zena/versions.yml +3 -1
- data/test/test_helper.rb +2 -0
- data/test/unit/iformat_test.rb +53 -1
- data/test/unit/text_document_test.rb +3 -0
- data/test/unit/zena/use/html_tags_test.rb +24 -2
- data/test/unit/zena/use/refactor_test.rb +0 -4
- data/test/unit/zena/use/zafu_test.rb +12 -0
- data/test/unit/zena/use/zazen_test.rb +6 -3
- data/test/unit/zena/zena_tags/basic.yml +3 -3
- data/vendor/apache2_upload_progress/MIT-LICENSE +22 -0
- data/vendor/apache2_upload_progress/README +53 -0
- data/vendor/apache2_upload_progress/mod_upload_progress.c +813 -0
- metadata +45 -45
- data/config/deploy_config_example.rb +0 -7
- data/config/httpd.rhtml +0 -18
- data/config/locales/de.yml +0 -120
- data/config/locales/fr-CH.yml +0 -123
- data/config/locales/fr.yml +0 -123
- data/lib/zena/root.rb +0 -3
data/History.txt
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
== 0.15.1 2009-10-27
|
2
|
+
|
3
|
+
* 2 major enhancements:
|
4
|
+
* Passenger support (deploy, upload progress)
|
5
|
+
* JS popup & gallery support (setting in image formats)
|
6
|
+
|
7
|
+
* 6 minor enhancements:
|
8
|
+
* fixed some deployment tasks (capistrano)
|
9
|
+
* fixed zena:setup task to copy files instead of symlink
|
10
|
+
* better versions list and diff select
|
11
|
+
* internal 'js_data' hook to insert javascript at end of page
|
12
|
+
* custom queries are loaded from bricks (bricks/brick_name/queries/test.host.yml)
|
13
|
+
* Fixed skin importation from zipped xhtml template
|
14
|
+
|
1
15
|
== 0.15.0 2009-10-16
|
2
16
|
|
3
17
|
* 5 major enhancements:
|
data/{README.txt → README.rdoc}
RENAMED
@@ -1,33 +1,27 @@
|
|
1
1
|
== DESCRIPTION:
|
2
2
|
|
3
|
-
CMS based on Ruby on Rails
|
3
|
+
CMS with super natural powers, based on Ruby on Rails
|
4
4
|
|
5
|
-
|
5
|
+
website: http://zenadmin.org
|
6
|
+
licence: MIT
|
6
7
|
|
7
|
-
==
|
8
|
-
You need to set collation and charset to utf8 when creating the database. Example :
|
9
|
-
# create database zena DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
|
8
|
+
== Getting started
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
# sudo gem sources -a http://gems.github.com
|
11
|
+
# sudo gem install zena
|
12
|
+
# zena myapp
|
14
13
|
|
15
|
-
|
14
|
+
== Details
|
16
15
|
|
17
|
-
|
18
|
-
rake zena:migrate
|
16
|
+
Have a look at the generator used by 'zena' command:
|
19
17
|
|
20
|
-
|
21
|
-
rake zena:mksite HOST=localhost PASSWORD=secret LANG=en
|
18
|
+
http://github.com/zena/zena/blob/master/config/zena.rb
|
22
19
|
|
23
|
-
|
24
|
-
script/server
|
25
|
-
|
26
|
-
6. Connect to site 'http://localhost:3000'
|
20
|
+
== Production
|
27
21
|
|
28
|
-
|
22
|
+
THE INSTRUCTIONS BELOW NO LONGER APPLY (they need an update since the way to go is
|
23
|
+
to use zena as a gem).
|
29
24
|
|
30
|
-
== Production
|
31
25
|
You should use capistrano to ease deployment. See 'config/delploy.rb'.
|
32
26
|
|
33
27
|
Manual deployment is done with the following commands:
|
@@ -55,7 +55,12 @@ class DocumentsController < ApplicationController
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def upload_progress
|
58
|
-
#
|
58
|
+
# When using the mod_upload_progress module, this is never hit:
|
59
|
+
# <Location /upload_progress>
|
60
|
+
# ReportUploads On
|
61
|
+
# </Location>
|
62
|
+
#
|
63
|
+
# When using Mongrel: mimic apache2 mod_upload_progress
|
59
64
|
#
|
60
65
|
# if (!found) {
|
61
66
|
# response = apr_psprintf(r->pool, "new Object({ 'state' : 'starting' })");
|
@@ -89,7 +94,7 @@ class DocumentsController < ApplicationController
|
|
89
94
|
# TODO: test
|
90
95
|
# display an upload field.
|
91
96
|
def file_form
|
92
|
-
render :inline=>"<%= link_to_function(_('cancel'), \"['file', 'file_form'].each(Element.toggle);$('file_form').innerHTML = '';\")%><input id='attachment#{params[:uuid]}' name='attachment' class='file' type='file' />"
|
97
|
+
render :inline=>"<%= link_to_function(_('cancel'), \"['file', 'file_form'].each(Element.toggle);$('file_form').innerHTML = '';\")%><input id='attachment#{params[:uuid]}' name='attachment' onchange=\"Zena.get_filename('attachment#{params[:uuid]}','node_v_title'); $('node_v_title').focus(); $('node_v_title').select();\" class='file' type='file' />"
|
93
98
|
end
|
94
99
|
|
95
100
|
# TODO: test
|
@@ -210,6 +210,9 @@ class NodesController < ApplicationController
|
|
210
210
|
def import
|
211
211
|
defaults = params[:node]
|
212
212
|
klass = defaults.delete(:klass)
|
213
|
+
if klass == 'Skin' && !defaults.has_key?('v_status')
|
214
|
+
defaults['v_status'] = Zena::Status[:pub]
|
215
|
+
end
|
213
216
|
@nodes = secure!(Node) { Node.create_nodes_from_folder(
|
214
217
|
:klass => klass,
|
215
218
|
:archive => params[:attachment],
|
@@ -471,6 +474,7 @@ class NodesController < ApplicationController
|
|
471
474
|
# Transform pseudo id into absolute paths (used after import)
|
472
475
|
def parse_assets(nodes)
|
473
476
|
nodes.each do |n|
|
477
|
+
n.errors.instance_variable_get(:@errors).delete('asset')
|
474
478
|
next unless n.errors.empty?
|
475
479
|
attrs = {}
|
476
480
|
|
data/app/models/iformat.rb
CHANGED
@@ -71,6 +71,45 @@ class Iformat < ActiveRecord::Base
|
|
71
71
|
|
72
72
|
# :size=>:force, :width=>280, :height=>120, :gravity=>Magick::NorthGravity
|
73
73
|
def as_hash
|
74
|
+
if self[:popup]
|
75
|
+
if self[:popup] =~ /^(\w+?)\s*\((.*)\)/
|
76
|
+
popup = {:name => $1}
|
77
|
+
show = $2.split(',').map(&:strip)
|
78
|
+
options = {}
|
79
|
+
popup[:show] = show.map do |k|
|
80
|
+
if k == 'link'
|
81
|
+
options['v_title'] = 'link'
|
82
|
+
'v_title'
|
83
|
+
else
|
84
|
+
k
|
85
|
+
end
|
86
|
+
end
|
87
|
+
popup[:options] = options
|
88
|
+
elsif self[:popup] =~ /^(\w+?)\s*(\{.*\})\s*$/
|
89
|
+
popup = {:name => $1}
|
90
|
+
options = JSON.load($2) rescue {}
|
91
|
+
unless popup[:show] = options.delete('show')
|
92
|
+
popup[:show] = options.keys.sort do |a,b|
|
93
|
+
# keep sort order
|
94
|
+
self[:popup].index(a) <=> self[:popup].index(b)
|
95
|
+
end
|
96
|
+
popup[:options] = {}
|
97
|
+
options.each do |k,v|
|
98
|
+
next if v == true
|
99
|
+
popup[:options][k] = v
|
100
|
+
end
|
101
|
+
end
|
102
|
+
else
|
103
|
+
popup = {
|
104
|
+
:name => self[:popup],
|
105
|
+
:options => {'v_title' => 'link'},
|
106
|
+
:show => ['navigation','v_title','v_summary']
|
107
|
+
}
|
108
|
+
end
|
109
|
+
else
|
110
|
+
popup = nil
|
111
|
+
end
|
112
|
+
|
74
113
|
h = {
|
75
114
|
:name => self[:name],
|
76
115
|
:size => size.to_sym,
|
@@ -78,7 +117,9 @@ class Iformat < ActiveRecord::Base
|
|
78
117
|
:height => height,
|
79
118
|
:gravity => eval("Magick::#{gravity}"),
|
80
119
|
}
|
81
|
-
h.merge(:hash_id => ImageBuilder.hash_id(h))
|
120
|
+
h.merge!(:hash_id => ImageBuilder.hash_id(h))
|
121
|
+
h.merge!(:popup => popup) if popup
|
122
|
+
h
|
82
123
|
end
|
83
124
|
|
84
125
|
# This is a unique identifier used to cache images with format:
|
@@ -128,6 +169,7 @@ class Iformat < ActiveRecord::Base
|
|
128
169
|
|
129
170
|
def iformat_before_validation
|
130
171
|
self[:site_id] = visitor.site[:id]
|
172
|
+
self[:popup] = nil if self[:popup].blank?
|
131
173
|
if self.size == SIZES.index('keep')
|
132
174
|
self[:width] = nil
|
133
175
|
self[:height] = nil
|
data/app/models/skin.rb
CHANGED
@@ -13,8 +13,7 @@ class Skin < Section
|
|
13
13
|
|
14
14
|
def update_skin_name
|
15
15
|
return unless @need_skin_name_update
|
16
|
-
# FIXME: escape correctly against sql injection
|
17
16
|
# FIXME: when moving a template or a page that is a parent of a template: we must sync skin_name after spread_project_and_section.
|
18
|
-
Skin.connection.execute "UPDATE
|
17
|
+
Skin.connection.execute "UPDATE template_contents SET skin_name = #{Zena::Db.quote(name)} WHERE template_contents.node_id IN (SELECT id FROM nodes WHERE nodes.section_id = #{Zena::Db.quote(self[:id])}) AND template_contents.site_id = #{Zena::Db.quote(self[:site_id])}"
|
19
18
|
end
|
20
19
|
end
|
data/app/models/text_document.rb
CHANGED
@@ -69,7 +69,7 @@ class TextDocument < Document
|
|
69
69
|
if new_src = helper.send(:template_url_for_asset, :src => src, :current_folder=>current_folder, :parse_assets => true)
|
70
70
|
"url(#{quote}#{new_src}#{quote})"
|
71
71
|
else
|
72
|
-
errors.add('
|
72
|
+
errors.add('asset', '{{asset}} not found', :asset => src.inspect)
|
73
73
|
"url(#{quote}#{src}#{quote})"
|
74
74
|
end
|
75
75
|
end
|
@@ -96,7 +96,7 @@ class TextDocument < Document
|
|
96
96
|
if url =~ /\A\/\w\w.*?(\d+)(_\w+|)\./
|
97
97
|
zip, mode = $1, $2
|
98
98
|
unless asset = secure(Node) { Node.find_by_zip(zip) }
|
99
|
-
errors.add('
|
99
|
+
errors.add('asset', '{{zip}} not found', :zip => zip)
|
100
100
|
"url(#{quote}#{url}#{quote})"
|
101
101
|
end
|
102
102
|
if asset.fullpath =~ /\A#{current_folder}\/(.+)/
|
data/app/models/version.rb
CHANGED
@@ -191,6 +191,7 @@ class Version < ActiveRecord::Base
|
|
191
191
|
{ 'content_id' => (content_class ? (content_id || id) : nil),
|
192
192
|
'user_id' => visitor.id,
|
193
193
|
'node' => self.node,
|
194
|
+
'number' => self.number,
|
194
195
|
'dyn' => self.dyn,
|
195
196
|
'status' => Zena::Status[:red],
|
196
197
|
'lang' => visitor.lang }
|
@@ -5,7 +5,7 @@
|
|
5
5
|
link_to_function _('btn_x'), "['add_iformat', 'add_iformat_form'].each(Element.toggle)"
|
6
6
|
end %>
|
7
7
|
</td>
|
8
|
-
<td class="add" colspan="
|
8
|
+
<td class="add" colspan="6">
|
9
9
|
<div id='iformat_errors'><%= error_messages_for(@iformat) %></div>
|
10
10
|
<% unless @iformat.name.blank? %>
|
11
11
|
<%= form_remote_tag(:url => iformat_path(@iformat.pseudo_id), :method => :put ) %>
|
@@ -13,11 +13,12 @@
|
|
13
13
|
<%= form_remote_tag(:url => iformats_path ) %>
|
14
14
|
<% end %>
|
15
15
|
<table cellspacing='0' class='edit_iformat'>
|
16
|
-
<tr><td class='label'><%= _("name")%> </td><td><%= text_field('iformat', 'name',
|
16
|
+
<tr><td class='label'><%= _("name")%> </td><td><%= text_field('iformat', 'name', :size=>15 ) %></td></tr>
|
17
17
|
<tr><td class='label'><%= _("type")%> </td><td><%= select('iformat', 'size', Iformat::SIZES, :selected => @iformat.size ) %></td></tr>
|
18
|
-
<tr><td class='label'><%= _("width")%></td><td><%= text_field('iformat', 'width',
|
19
|
-
<tr><td class='label'><%= _("height")%></td><td><%= text_field('iformat', 'height',
|
18
|
+
<tr><td class='label'><%= _("width")%></td><td><%= text_field('iformat', 'width', :size=>15 ) %></td></tr>
|
19
|
+
<tr><td class='label'><%= _("height")%></td><td><%= text_field('iformat', 'height', :size=>15 ) %></td></tr>
|
20
20
|
<tr><td class='label'><%= _("gravity")%></td><td><%= select('iformat', 'gravity', Iformat::GRAVITY, :selected => @iformat.gravity ) %></td></tr>
|
21
|
+
<tr><td class='label'><%= _("popup")%> </td><td><%= text_area('iformat', 'popup', :cols=>20, :rows=>2 ) %></td></tr>
|
21
22
|
<tr><td colspan='2'><p class='btn_validate'><input type='submit' value='<%= _('validate') %>'/></p></td></tr>
|
22
23
|
</table>
|
23
24
|
</form>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<h3><%= _('manage classes') %></h3>
|
2
2
|
|
3
3
|
<table id='iformat_list' class='admin' cellspacing="0">
|
4
|
-
<tr><th class='nav' colspan='
|
4
|
+
<tr><th class='nav' colspan='7'> </th></tr>
|
5
5
|
<%= render :partial=>'iformats/li', :collection=>@iformats %>
|
6
6
|
<%= render :partial=>'iformats/add' %>
|
7
7
|
</table>
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<% else -%>
|
13
13
|
<td><%= node.errors.empty? ? (node[:create_or_update]) : 'error' %></td>
|
14
14
|
<td><%= _('%{count} versions') % {:count => node.instance_variable_get(:@versions_count)} %></td>
|
15
|
-
<td><%= !node.errors.empty? ? node
|
15
|
+
<td><%= !node.errors.empty? ? error_messages_for(node) : 'ok' %></td>
|
16
16
|
<% end -%>
|
17
17
|
</tr>
|
18
18
|
<% end -%>
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
<% javascript_tag do -%>
|
2
2
|
var custom_loaded = false;
|
3
3
|
function load_custom_tab() {
|
4
4
|
new Ajax.Updater('custom_tab', '/nodes/<%= @node.zip %>/versions/0/custom_tab', {asynchronous:true, evalScripts:true, method:'get'});
|
5
5
|
}
|
6
|
-
|
6
|
+
<% end -%>
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<label for="node_c_file"><%= _("document file") %></label>
|
2
|
-
<div id="file"><%= link_to_remote(_("change
|
2
|
+
<div id="file" class='toggle_div'><%= link_to_remote(_("change"), :update=>'file_form', :url=>file_form_documents_path(:uuid => @uuid), :method => :get, :complete=>"['file', 'file_form'].each(Element.toggle);$('attachment#{@uuid}').click();") %></div>
|
3
|
+
<div id="file_form" class='toggle_div' style='display:none;'></div>
|
4
|
+
|
3
5
|
<label for='node_c_content_type'><%= _('content type') %></label>
|
4
6
|
<input id='node_c_content_type' type='text' name='node[c_content_type]' value='<%= @node.c_content_type %>'/><br/>
|
5
7
|
|
6
|
-
<div id="file_form" style='display:none;'></div>
|
7
|
-
|
8
8
|
<%= @node.c_version_id == @node.v_id ? "<b id='original_caution'>#{_('you are editing the original')}</b>" : "" %>
|
@@ -1,10 +1,9 @@
|
|
1
1
|
<tr class="v<%= tr.status %>">
|
2
|
-
<td class="box"><%= version_actions(
|
3
|
-
<td class="
|
2
|
+
<td class="box"><%= version_actions(tr, :actions => 'view') %></td>
|
3
|
+
<td class="number" onclick="Zena.diff_select(this);"><%= tr.number %></td>
|
4
4
|
<td class="box"><%= tr.lang %></td>
|
5
|
-
<td class="
|
5
|
+
<td class="actions"><%= version_actions(tr) %></td>
|
6
6
|
<td class="sign"><%= tr.user.initials %></td>
|
7
|
+
<td class="date"><%= format_date(tr.created_at, 'age') %></td>
|
7
8
|
<td class="comment"><%= tr.comment %></td>
|
8
|
-
|
9
|
-
<td class="actions"><%= version_actions(tr) %></td>
|
10
|
-
</tr>
|
9
|
+
</tr>
|
@@ -31,7 +31,7 @@
|
|
31
31
|
</div>
|
32
32
|
|
33
33
|
<%#= css_edit %>
|
34
|
-
|
34
|
+
<% javascript_tag do -%>
|
35
35
|
var current_sel = $('<%= partial[0] %>_sel');
|
36
36
|
var current_tab = $('<%= partial[0] %>_tab');
|
37
37
|
Event.observe(window, 'resize', function() { Zena.resizeElement('node_v_text'); } );
|
@@ -51,5 +51,5 @@ $('node_form').getElements().each(function(input, index) {
|
|
51
51
|
});
|
52
52
|
});
|
53
53
|
|
54
|
-
|
54
|
+
<% end -%>
|
55
55
|
<iframe id="UploadIFrame" name="UploadIFrame" src="about:blank"></iframe>
|
data/bin/zena
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
-
require 'zena/
|
3
|
+
require 'zena/info'
|
4
4
|
|
5
|
-
exec "rails -m #{File.join(Zena::ROOT, '
|
5
|
+
exec "rails -m #{File.join(Zena::ROOT, 'lib', 'zena', 'deploy', 'template.rb').inspect} #{ARGV.first}"
|
@@ -4,7 +4,7 @@ class ApplicationController
|
|
4
4
|
|
5
5
|
private
|
6
6
|
def save_if_not_spam(obj, params)
|
7
|
-
(!visitor.is_anon? || validate_recap(params, obj.errors, :rcc_pub => current_site.
|
7
|
+
(!visitor.is_anon? || validate_recap(params, obj.errors, :rcc_pub => current_site.dyn['recaptcha_pub'], :rcc_priv => current_site.dyn['recaptcha_priv'])) && obj.save
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -14,7 +14,7 @@ module Bricks
|
|
14
14
|
|
15
15
|
def r_mail_hide
|
16
16
|
text = get_text_for_erb
|
17
|
-
"<%= visitor.is_anon? ? mail_hide(#{text},:mh_pub => #{visitor.site.
|
17
|
+
"<%= visitor.is_anon? ? mail_hide(#{text},:mh_pub => #{visitor.site.dyn['mail_hide_pub'].inspect}, :mh_priv => #{visitor.site.dyn['mail_hide_priv'].inspect}#{get_recaptcha_params}) : #{text} %>"
|
18
18
|
end
|
19
19
|
|
20
20
|
def get_recaptcha_params
|