zena 0.16.3 → 0.16.4
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/.gitignore +1 -0
- data/History.txt +11 -0
- data/app/controllers/nodes_controller.rb +1 -1
- data/app/controllers/versions_controller.rb +1 -1
- data/app/controllers/virtual_classes_controller.rb +29 -2
- data/app/models/cached_page.rb +3 -3
- data/app/models/document.rb +1 -20
- data/app/models/iformat.rb +4 -4
- data/app/models/image.rb +1 -1
- data/app/models/image_content.rb +5 -5
- data/app/models/node.rb +25 -0
- data/app/models/text_document_version.rb +11 -3
- data/app/models/virtual_class.rb +50 -0
- data/app/views/{nodes → sites}/404.html +0 -0
- data/app/views/templates/edit_tabs/_image.rhtml +1 -1
- data/app/views/versions/_list.rhtml +3 -1
- data/app/views/virtual_classes/_li.erb +2 -2
- data/app/views/virtual_classes/index.erb +9 -1
- data/bricks/tags/patch/node.rb +1 -1
- data/config/bricks.yml +1 -1
- data/config/gems.yml +4 -2
- data/db/migrate/047_change_default_link_id_to_zero.rb +1 -1
- data/db/migrate/20090825201159_insert_zero_link.rb +1 -1
- data/lib/bricks.rb +2 -2
- data/lib/bricks/requirements_validation.rb +13 -8
- data/lib/gettext_strings.rb +1 -0
- data/lib/tasks/zena.rake +15 -6
- data/lib/zena.rb +9 -3
- data/lib/{base_additions.rb → zena/base_additions.rb} +0 -0
- data/lib/{core_ext → zena/core_ext}/date_time.rb +0 -0
- data/lib/{core_ext → zena/core_ext}/dir.rb +0 -0
- data/lib/zena/core_ext/file_utils.rb +13 -0
- data/lib/{core_ext → zena/core_ext}/fixnum.rb +0 -0
- data/lib/{core_ext → zena/core_ext}/string.rb +0 -0
- data/lib/zena/deploy.rb +1 -1
- data/lib/zena/deploy/start.html +1 -1
- data/lib/zena/deploy/template.rb +5 -1
- data/lib/{fix_rails_layouts.rb → zena/fix_rails_layouts.rb} +0 -0
- data/lib/zena/info.rb +2 -2
- data/lib/zena/routes.rb +1 -1
- data/lib/zena/use/fixtures.rb +1 -1
- data/lib/zena/use/html_tags.rb +3 -3
- data/lib/zena/use/image_builder.rb +329 -0
- data/lib/zena/use/query_comment.rb +96 -0
- data/lib/zena/use/query_node.rb +408 -0
- data/lib/zena/use/query_node_finders.rb +91 -0
- data/lib/zena/use/rendering.rb +2 -2
- data/lib/{webdav_adapter.rb → zena/webdav_adapter.rb} +0 -0
- data/locale/de/LC_MESSAGES/zena.mo +0 -0
- data/locale/de/zena.po +1456 -0
- data/locale/en/LC_MESSAGES/zena.mo +0 -0
- data/locale/en/zena.po +626 -1197
- data/locale/fr/LC_MESSAGES/zena.mo +0 -0
- data/locale/fr/zena.po +895 -1221
- data/locale/zena.pot +527 -1027
- data/public/calendar/lang/calendar-de-utf8.js +128 -0
- data/public/calendar/menuarrow.gif +0 -0
- data/public/stylesheets/admin.css +2 -1
- data/test/custom_queries/complex.host.yml +1 -1
- data/test/fixtures/files/vclasses.yml +12 -0
- data/test/functional/virtual_classes_controller_test.rb +9 -0
- data/test/helpers/{node_query → query_node}/basic.yml +0 -0
- data/test/helpers/{node_query → query_node}/comments.yml +0 -0
- data/test/helpers/{node_query → query_node}/complex.yml +0 -0
- data/test/helpers/{node_query → query_node}/filters.yml +0 -0
- data/test/helpers/{node_query → query_node}/relations.yml +0 -0
- data/test/helpers/{node_query_test.rb → query_node_test.rb} +1 -2
- data/test/integration/navigation_test.rb +2 -0
- data/test/test_helper.rb +1 -1
- data/test/test_zena.rb +1 -1
- data/test/unit/core_ext_test.rb +3 -3
- data/test/unit/iformat_test.rb +3 -3
- data/test/unit/image_builder_test.rb +34 -34
- data/test/unit/node_test.rb +15 -1
- data/test/unit/virtual_class_test.rb +106 -0
- data/test/unit/zena/use/upload_test.rb +3 -3
- data/vendor/plugins/gettext_i18n_rails/tasks/gettext_rails_i18n.rake +3 -3
- data/zena.gemspec +36 -29
- data/zena_console.rb +33 -0
- metadata +30 -23
- data/lib/comment_query.rb +0 -92
- data/lib/image_builder.rb +0 -325
- data/lib/zena/use/node_query_finders.rb +0 -494
- data/vendor/bricks/20070122-172926.txt +0 -282
data/.gitignore
CHANGED
data/History.txt
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
== 0.16.4 2010-02-22
|
|
2
|
+
|
|
3
|
+
* 3 major enhancement
|
|
4
|
+
* fixed installation and runtime bugs on Windows
|
|
5
|
+
* moved ruby files in 'lib' into their Zena namespace
|
|
6
|
+
* german translations [Lars Kanis]
|
|
7
|
+
|
|
8
|
+
* 2 minor enhancments
|
|
9
|
+
* fixed edgy bug with name duplicates
|
|
10
|
+
* fixed bug that would show a 'site not found' error instead of a 404
|
|
11
|
+
|
|
1
12
|
== 0.16.3 2010-01-19
|
|
2
13
|
|
|
3
14
|
* 1 major enhancement
|
|
@@ -125,7 +125,7 @@ class NodesController < ApplicationController
|
|
|
125
125
|
# Get document data (inline if possible)
|
|
126
126
|
content_path = nil
|
|
127
127
|
|
|
128
|
-
if @node.kind_of?(Image) && !ImageBuilder.dummy?
|
|
128
|
+
if @node.kind_of?(Image) && !Zena::Use::ImageBuilder.dummy?
|
|
129
129
|
if img_format = Iformat[params[:mode]]
|
|
130
130
|
content_path = @node.version.content.filepath(img_format)
|
|
131
131
|
# force creation of image data
|
|
@@ -27,7 +27,7 @@ class VersionsController < ApplicationController
|
|
|
27
27
|
return redirect_to(params.merge(:format => (@node.safe_content_read('ext') || 'html')))
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
if @node.kind_of?(Image) && !ImageBuilder.dummy?
|
|
30
|
+
if @node.kind_of?(Image) && !Zena::Use::ImageBuilder.dummy?
|
|
31
31
|
img_format = Iformat[params[:mode]]
|
|
32
32
|
data = @node.version.content.file(img_format)
|
|
33
33
|
content_path = @node.version.content.filepath(img_format)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
class VirtualClassesController < ApplicationController
|
|
2
2
|
before_filter :visitor_node
|
|
3
|
-
before_filter :find_virtual_class, :except => [:index, :create, :new]
|
|
3
|
+
before_filter :find_virtual_class, :except => [:index, :create, :new, :import]
|
|
4
4
|
before_filter :check_is_admin
|
|
5
5
|
layout :admin_layout
|
|
6
6
|
|
|
7
7
|
def index
|
|
8
8
|
secure(VirtualClass) do
|
|
9
|
-
@virtual_classes = VirtualClass.paginate(:all, :order => '
|
|
9
|
+
@virtual_classes = VirtualClass.paginate(:all, :order => 'kpath', :per_page => 20, :page => params[:page])
|
|
10
10
|
end
|
|
11
11
|
@virtual_class = VirtualClass.new
|
|
12
12
|
respond_to do |format|
|
|
@@ -15,6 +15,33 @@ class VirtualClassesController < ApplicationController
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
def export
|
|
19
|
+
secure(VirtualClass) do
|
|
20
|
+
@virtual_classes = VirtualClass.all
|
|
21
|
+
end
|
|
22
|
+
###
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def import
|
|
26
|
+
attachment = params[:attachment]
|
|
27
|
+
if attachment.nil?
|
|
28
|
+
flass[:error] = "Upload failure: no definitions."
|
|
29
|
+
redirect_to :action => :index
|
|
30
|
+
else
|
|
31
|
+
data = YAML.load(attachment.read) rescue nil
|
|
32
|
+
if data.nil?
|
|
33
|
+
flash[:error] = "Could not parse yaml document"
|
|
34
|
+
redirect_to :action => :index
|
|
35
|
+
else
|
|
36
|
+
@virtual_classes = secure(VirtualClass) { VirtualClass.import(data) }.paginate(:per_page => 200)
|
|
37
|
+
@virtual_class = VirtualClass.new
|
|
38
|
+
respond_to do |format|
|
|
39
|
+
format.html { render :action => 'index' }
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
18
45
|
def show
|
|
19
46
|
respond_to do |format|
|
|
20
47
|
format.html # show.erb
|
data/app/models/cached_page.rb
CHANGED
|
@@ -111,8 +111,8 @@ class CachedPage < ActiveRecord::Base
|
|
|
111
111
|
filepath = "#{SITES_ROOT}#{path}"
|
|
112
112
|
FileUtils.mkpath(File.dirname(filepath))
|
|
113
113
|
if content_path
|
|
114
|
-
FileUtils
|
|
115
|
-
|
|
114
|
+
FileUtils.rm(filepath) if File.exist?(filepath)
|
|
115
|
+
FileUtils.symlink_or_copy(content_path, filepath)
|
|
116
116
|
else
|
|
117
117
|
File.open(filepath, "wb+") { |f| f.write(content_data) }
|
|
118
118
|
end
|
|
@@ -128,7 +128,7 @@ class CachedPage < ActiveRecord::Base
|
|
|
128
128
|
def cached_page_on_destroy
|
|
129
129
|
filepath = "#{SITES_ROOT}#{path.gsub('..','')}" # just in case...
|
|
130
130
|
CachedPage.logger.info "remove #{filepath}"
|
|
131
|
-
FileUtils
|
|
131
|
+
FileUtils.rm(filepath) if File.exist?(filepath)
|
|
132
132
|
CachedPage.connection.execute "DELETE FROM cached_pages_nodes WHERE cached_page_id = '#{id}'"
|
|
133
133
|
end
|
|
134
134
|
end
|
data/app/models/document.rb
CHANGED
|
@@ -125,26 +125,7 @@ class Document < Node
|
|
|
125
125
|
|
|
126
126
|
# Make sure name is unique
|
|
127
127
|
def node_before_validation
|
|
128
|
-
|
|
129
|
-
# FIXME: remove 'with_exclusive_scope' once scopes are clarified and removed from 'secure'
|
|
130
|
-
Node.send(:with_exclusive_scope) do
|
|
131
|
-
if new_record?
|
|
132
|
-
cond = ["name = ? AND parent_id = ? AND kpath LIKE 'ND%'", self[:name], self[:parent_id]]
|
|
133
|
-
else
|
|
134
|
-
cond = ["name = ? AND parent_id = ? AND kpath LIKE 'ND%' AND id != ? ", self[:name], self[:parent_id], self[:id]]
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
if taken_name = Node.find(:first, :select => 'name', :conditions => cond, :order => "LENGTH(name) DESC")
|
|
138
|
-
if taken_name =~ /^#{self[:name]}-(\d)/
|
|
139
|
-
self[:name] = "#{self[:name]}-#{$1.to_i + 1}"
|
|
140
|
-
i = $1.to_i + 1
|
|
141
|
-
else
|
|
142
|
-
self[:name] = "#{self[:name]}-1"
|
|
143
|
-
i = 1
|
|
144
|
-
end
|
|
145
|
-
version.title = "#{version.title}-#{i}" unless version.title.blank?
|
|
146
|
-
end
|
|
147
|
-
end
|
|
128
|
+
get_unique_name_in_scope('ND%')
|
|
148
129
|
super
|
|
149
130
|
end
|
|
150
131
|
end
|
data/app/models/iformat.rb
CHANGED
|
@@ -39,7 +39,7 @@ class Iformat < ActiveRecord::Base
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def formats_for_site(site_id, as_hash = true)
|
|
42
|
-
formats = ::ImageBuilder::DEFAULT_FORMATS.dup
|
|
42
|
+
formats = Zena::Use::ImageBuilder::DEFAULT_FORMATS.dup
|
|
43
43
|
|
|
44
44
|
site_formats = {}
|
|
45
45
|
last_update = nil
|
|
@@ -59,7 +59,7 @@ class Iformat < ActiveRecord::Base
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def new_from_default(key)
|
|
62
|
-
return nil unless default = ImageBuilder::DEFAULT_FORMATS[key]
|
|
62
|
+
return nil unless default = Zena::Use::ImageBuilder::DEFAULT_FORMATS[key]
|
|
63
63
|
obj = self.new
|
|
64
64
|
default.each do |k,v|
|
|
65
65
|
next if k == :hash_id
|
|
@@ -117,7 +117,7 @@ class Iformat < ActiveRecord::Base
|
|
|
117
117
|
:height => height,
|
|
118
118
|
:gravity => eval("Magick::#{gravity}"),
|
|
119
119
|
}
|
|
120
|
-
h.merge!(:hash_id => ImageBuilder.hash_id(h))
|
|
120
|
+
h.merge!(:hash_id => Zena::Use::ImageBuilder.hash_id(h))
|
|
121
121
|
h.merge!(:popup => popup) if popup
|
|
122
122
|
h
|
|
123
123
|
end
|
|
@@ -125,7 +125,7 @@ class Iformat < ActiveRecord::Base
|
|
|
125
125
|
# This is a unique identifier used to cache images with format:
|
|
126
126
|
# image30_pv.jpg#{node.updated_at.to_i + format.hash_id}
|
|
127
127
|
def hash_id
|
|
128
|
-
ImageBuilder.hash_id(self.as_hash)
|
|
128
|
+
Zena::Use::ImageBuilder.hash_id(self.as_hash)
|
|
129
129
|
end
|
|
130
130
|
|
|
131
131
|
def size
|
data/app/models/image.rb
CHANGED
data/app/models/image_content.rb
CHANGED
|
@@ -55,7 +55,7 @@ class ImageContent < DocumentContent
|
|
|
55
55
|
max = format['max_value'].to_f * (format['max_unit'] == 'Mb' ? 1024 : 1) * 1024
|
|
56
56
|
|
|
57
57
|
# crop image
|
|
58
|
-
img = ImageBuilder.new(:file=>original)
|
|
58
|
+
img = Zena::Use::ImageBuilder.new(:file=>original)
|
|
59
59
|
img.crop!(x, y, w, h) if x && y && w && h
|
|
60
60
|
img.format = format['format'] if new_type && new_type != content_type
|
|
61
61
|
img.max_filesize = max if format['max_value'] && max
|
|
@@ -71,7 +71,7 @@ class ImageContent < DocumentContent
|
|
|
71
71
|
# Set content file, will refuse to accept the file if it is not an image.
|
|
72
72
|
def file=(file)
|
|
73
73
|
super
|
|
74
|
-
return unless ImageBuilder.image_content_type?(file.content_type)
|
|
74
|
+
return unless Zena::Use::ImageBuilder.image_content_type?(file.content_type)
|
|
75
75
|
img = image_with_format(nil)
|
|
76
76
|
self[:width ] = img.width
|
|
77
77
|
self[:height] = img.height
|
|
@@ -132,11 +132,11 @@ class ImageContent < DocumentContent
|
|
|
132
132
|
|
|
133
133
|
def image_with_format(format=nil)
|
|
134
134
|
if @new_file
|
|
135
|
-
ImageBuilder.new(:file => @new_file).transform!(format)
|
|
135
|
+
Zena::Use::ImageBuilder.new(:file => @new_file).transform!(format)
|
|
136
136
|
elsif !new_record?
|
|
137
137
|
format ||= Iformat['full']
|
|
138
138
|
@formats ||= {}
|
|
139
|
-
@formats[format[:name]] ||= ImageBuilder.new(:path => filepath,
|
|
139
|
+
@formats[format[:name]] ||= Zena::Use::ImageBuilder.new(:path => filepath,
|
|
140
140
|
:width => self[:width], :height => self[:height]).transform!(format)
|
|
141
141
|
else
|
|
142
142
|
raise StandardError, "No image to work on"
|
|
@@ -170,7 +170,7 @@ class ImageContent < DocumentContent
|
|
|
170
170
|
|
|
171
171
|
def valid_file
|
|
172
172
|
return false unless super
|
|
173
|
-
if @new_file && !ImageBuilder.image_content_type?(@new_file.content_type)
|
|
173
|
+
if @new_file && !Zena::Use::ImageBuilder.image_content_type?(@new_file.content_type)
|
|
174
174
|
errors.add('file', 'must be an image')
|
|
175
175
|
return false
|
|
176
176
|
else
|
data/app/models/node.rb
CHANGED
|
@@ -1404,6 +1404,10 @@ class Node < ActiveRecord::Base
|
|
|
1404
1404
|
version.title = self.name
|
|
1405
1405
|
elsif !version.title.blank?
|
|
1406
1406
|
self.name = version.title.url_name
|
|
1407
|
+
if !new_record? && kind_of?(Page) && name_changed?
|
|
1408
|
+
# we only rebuild Page names on update
|
|
1409
|
+
get_unique_name_in_scope('NP%')
|
|
1410
|
+
end
|
|
1407
1411
|
end
|
|
1408
1412
|
end
|
|
1409
1413
|
|
|
@@ -1689,6 +1693,27 @@ class Node < ActiveRecord::Base
|
|
|
1689
1693
|
end
|
|
1690
1694
|
end
|
|
1691
1695
|
|
|
1696
|
+
def get_unique_name_in_scope(kpath)
|
|
1697
|
+
Node.send(:with_exclusive_scope) do
|
|
1698
|
+
if new_record?
|
|
1699
|
+
cond = ["name = ? AND parent_id = ? AND kpath LIKE ?", self[:name], self[:parent_id], kpath]
|
|
1700
|
+
else
|
|
1701
|
+
cond = ["name = ? AND parent_id = ? AND kpath LIKE ? AND id != ? ", self[:name], self[:parent_id], kpath, self[:id]]
|
|
1702
|
+
end
|
|
1703
|
+
|
|
1704
|
+
if taken_name = Node.find(:first, :select => 'name', :conditions => cond, :order => "LENGTH(name) DESC")
|
|
1705
|
+
if taken_name =~ /^#{self[:name]}-(\d)/
|
|
1706
|
+
self[:name] = "#{self[:name]}-#{$1.to_i + 1}"
|
|
1707
|
+
i = $1.to_i + 1
|
|
1708
|
+
else
|
|
1709
|
+
self[:name] = "#{self[:name]}-1"
|
|
1710
|
+
i = 1
|
|
1711
|
+
end
|
|
1712
|
+
version.title = "#{version.title}-#{i}" unless version.title.blank?
|
|
1713
|
+
end
|
|
1714
|
+
end
|
|
1715
|
+
end
|
|
1716
|
+
|
|
1692
1717
|
end
|
|
1693
1718
|
|
|
1694
1719
|
Bricks.apply_patches
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
=begin rdoc
|
|
2
2
|
This is the version used by TextDocument. It behave exactly like its superclass (DocumentVersion) except for the content class, set to TextDocumentContent.
|
|
3
3
|
=end
|
|
4
|
+
|
|
4
5
|
class TextDocumentVersion < DocumentVersion
|
|
6
|
+
class AssetHelper
|
|
7
|
+
attr_accessor :visitor
|
|
8
|
+
include Zena::Acts::Secure # secure
|
|
9
|
+
include Zena::Use::Zazen::ViewMethods # make_image, ...
|
|
10
|
+
include Zena::Use::Zafu::Common # template_url_for_asset
|
|
11
|
+
include Zena::Use::Urls::Common # data_path
|
|
12
|
+
end
|
|
13
|
+
|
|
5
14
|
before_save :parse_assets_before_save
|
|
6
15
|
|
|
7
16
|
def self.content_class
|
|
@@ -11,9 +20,8 @@ class TextDocumentVersion < DocumentVersion
|
|
|
11
20
|
private
|
|
12
21
|
def parse_assets_before_save
|
|
13
22
|
if text_changed? && content.content_type == 'text/css'
|
|
14
|
-
|
|
15
|
-
helper =
|
|
16
|
-
helper.instance_variable_set(:@visitor, visitor)
|
|
23
|
+
helper = AssetHelper.new
|
|
24
|
+
helper.visitor = visitor
|
|
17
25
|
self.text = node.parse_assets(self.text, helper, 'v_text')
|
|
18
26
|
end
|
|
19
27
|
end
|
data/app/models/virtual_class.rb
CHANGED
|
@@ -1,8 +1,54 @@
|
|
|
1
1
|
class VirtualClass < ActiveRecord::Base
|
|
2
|
+
attr_accessor :import_result
|
|
2
3
|
belongs_to :create_group, :class_name => 'Group', :foreign_key => 'create_group_id'
|
|
3
4
|
validate :valid_virtual_class
|
|
4
5
|
include Zena::Use::Relations::ClassMethods
|
|
5
6
|
|
|
7
|
+
# Import a hash of virtual class definitions and try to build the virtual classes.
|
|
8
|
+
def self.import(data)
|
|
9
|
+
data.keys.map do |klass|
|
|
10
|
+
build_virtual_class(klass, data)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Build a virtual class from a name and a hash of virtual class definitions. If
|
|
15
|
+
# the superclass is in the data hash, it is built first.
|
|
16
|
+
def self.build_virtual_class(klass, data)
|
|
17
|
+
return data[klass]['result'] if data[klass].has_key?('result')
|
|
18
|
+
if virtual_class = Node.get_class(klass)
|
|
19
|
+
if virtual_class.superclass.to_s == data[klass]['superclass']
|
|
20
|
+
virtual_class.import_result = 'same'
|
|
21
|
+
return data[klass]['result'] = virtual_class
|
|
22
|
+
else
|
|
23
|
+
virtual_class.errors.add(:base, 'conflict')
|
|
24
|
+
return data[klass]['result'] = virtual_class
|
|
25
|
+
end
|
|
26
|
+
else
|
|
27
|
+
superclass_name = data[klass]['superclass']
|
|
28
|
+
if data[superclass_name]
|
|
29
|
+
superclass = build_virtual_class(superclass_name, data)
|
|
30
|
+
unless superclass.errors.empty?
|
|
31
|
+
virtual_class = VirtualClass.new(:name => klass, :superclass => superclass_name, :create_group_id => current_site.public_group_id)
|
|
32
|
+
virtual_class.errors.add(:base, 'conflict in superclass')
|
|
33
|
+
return data[klass]['result'] = virtual_class
|
|
34
|
+
end
|
|
35
|
+
elsif superclass = Node.get_class(superclass_name)
|
|
36
|
+
# ok
|
|
37
|
+
else
|
|
38
|
+
virtual_class = VirtualClass.new(:name => klass, :superclass => superclass_name, :create_group_id => current_site.public_group_id)
|
|
39
|
+
virtual_class.errors.add(:base, 'missing superclass')
|
|
40
|
+
return data[klass]['result'] = virtual_class
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# build
|
|
44
|
+
create_group_id = superclass.kind_of?(VirtualClass) ? superclass.create_group_id : current_site.public_group_id
|
|
45
|
+
virtual_class = create(data[klass].merge(:name => klass, :create_group_id => create_group_id))
|
|
46
|
+
virtual_class.import_result = 'new'
|
|
47
|
+
return data[klass]['result'] = virtual_class
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
|
|
6
52
|
def to_s
|
|
7
53
|
name
|
|
8
54
|
end
|
|
@@ -84,6 +130,10 @@ class VirtualClass < ActiveRecord::Base
|
|
|
84
130
|
end
|
|
85
131
|
end
|
|
86
132
|
|
|
133
|
+
def import_result
|
|
134
|
+
@import_result || errors[:base]
|
|
135
|
+
end
|
|
136
|
+
|
|
87
137
|
private
|
|
88
138
|
def valid_virtual_class
|
|
89
139
|
if self[:name].blank?
|
|
File without changes
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<%= @node.c_version_id == @node.v_id ? "<b id='original_caution'>#{_('you are editing the original')}</b>" : "" %>
|
|
4
4
|
|
|
5
|
-
<% if !ImageBuilder.dummy? %>
|
|
5
|
+
<% if !Zena::Use::ImageBuilder.dummy? %>
|
|
6
6
|
<label for="c_crop_x"><%= _("image") %></label>
|
|
7
7
|
<div id="crop" class='toggle_div'>
|
|
8
8
|
<div class='img_left'><%= link_to_remote(img_tag(@node,:mode=>'pv'), :url => crop_form_document_path(@node[:zip]), :method => :get) %></div>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<table cellspacing="0" id='versions'>
|
|
2
|
-
<% if
|
|
2
|
+
<% if !@node.errors.empty? -%>
|
|
3
|
+
<tr><td class='warn' colspan='8'><%= error_messages_for(@node) %></td></tr>
|
|
4
|
+
<% elsif @node.versions.count == 1 && @node.version.status == Zena::Status[:rem] && !@node.can_destroy_version? %><tr><td class='warn' colspan='8'><%= _('This node contains sub-nodes: it cannot be destroyed.') %></td></tr><% end -%>
|
|
3
5
|
<%= render :partial=>'versions/tr', :collection => @node.versions %>
|
|
4
6
|
</table>
|
|
5
7
|
<div class='hidden' id='node_zip'><%= @node.zip %></div>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<tr id='virtual_class<%= li[:id] %>'>
|
|
2
|
-
<td class="adm_icon"><%= link_to_remote( _('virtual_class_img'),
|
|
2
|
+
<td class="adm_icon"><%= (li.new_record? || !li.errors.empty?) ? _('virtual_class_error_img') : link_to_remote( _('virtual_class_img'),
|
|
3
3
|
:update =>"virtual_class#{li[:id]}",
|
|
4
4
|
:url => edit_virtual_class_path(li),
|
|
5
5
|
:method => :get) %></td>
|
|
6
|
-
<td><%= li.name %></td>
|
|
6
|
+
<td style='font-size:90%;'><span style='font-family:monospace;color:white;'><%= li.kpath[1..-1] + li.kpath[1..-1] %></span><%= li.name %><%= li.import_result ? " (#{li.import_result})" : ''%></td>
|
|
7
7
|
<td class="adm_icon" ><%= !li.icon.blank? ? "<img src='#{li.icon}'/>" : "" %></td>
|
|
8
8
|
<td class="auto_create_discussion" ><%= li.auto_create_discussion ? _('auto discussion') : '' %></td>
|
|
9
9
|
<td class="create_group"><%= li.create_group.name %></td>
|
|
@@ -4,4 +4,12 @@
|
|
|
4
4
|
<tr><th class='nav' colspan='7'><%= will_paginate @virtual_classes %></th></tr>
|
|
5
5
|
<%= render :partial=>'virtual_classes/li', :collection=>@virtual_classes %>
|
|
6
6
|
<%= render :partial=>'virtual_classes/add' %>
|
|
7
|
-
</table>
|
|
7
|
+
</table>
|
|
8
|
+
|
|
9
|
+
<div class='admin_group'><h3><%= _('import definitions') %></h3>
|
|
10
|
+
|
|
11
|
+
<%= form_tag({ :controller => 'virtual_classes', :action => 'import'}, {:multipart => true} ) %>
|
|
12
|
+
<input style='line-height:1.5em;' name="attachment" class='file' type="file" />
|
|
13
|
+
<p class="btn_validate"><input type="submit" value='<%= _('import') %>'/></p>
|
|
14
|
+
</form>
|
|
15
|
+
</div>
|
data/bricks/tags/patch/node.rb
CHANGED
|
@@ -12,4 +12,4 @@ class Link
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Zena::Use::QueryNode.add_filter_field('tag', :key => 'comment', :table => ['nodes', 'links', 'TABLE1.id = TABLE2.source_id AND TABLE2.relation_id IS NULL'])
|
data/config/bricks.yml
CHANGED
data/config/gems.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
hpricot:
|
|
2
2
|
gettext: '= 1.93.0'
|
|
3
|
-
querybuilder: '= 0.5.
|
|
3
|
+
querybuilder: '= 0.5.8'
|
|
4
4
|
rubyless: '>= 0.3.5'
|
|
5
5
|
ruby-recaptcha: '= 1.0.0'
|
|
6
6
|
syntax: '= 1.0.0'
|
|
@@ -23,15 +23,17 @@ RedCloth:
|
|
|
23
23
|
rmagick:
|
|
24
24
|
optional: yes
|
|
25
25
|
lib: 'RMagick'
|
|
26
|
-
version: '>= 2.
|
|
26
|
+
version: '>= 2.10.0'
|
|
27
27
|
|
|
28
28
|
thinking-sphinx:
|
|
29
29
|
optional: yes
|
|
30
|
+
brick: sphinx
|
|
30
31
|
lib: 'thinking_sphinx'
|
|
31
32
|
version: '>= 1.3.14'
|
|
32
33
|
|
|
33
34
|
ts-delayed-delta:
|
|
34
35
|
optional: yes
|
|
36
|
+
brick: sphinx
|
|
35
37
|
lib: 'thinking_sphinx/deltas/delayed_delta'
|
|
36
38
|
version: '>= 1.0.2'
|
|
37
39
|
|