bcms_fckeditor 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bcms_fckeditor.rb +13 -12
- metadata +4 -4
data/lib/bcms_fckeditor.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'bcms_fckeditor/routes'
|
2
2
|
Cms.wysiwig_js = ['/bcms/fckeditor/fckeditor.js', '/bcms/fckeditor/editor.js']
|
3
3
|
|
4
|
-
# FCKeditor's file browser functionality is handled by SectionController#file_browser.
|
4
|
+
# FCKeditor's file browser functionality is handled by Cms::SectionController#file_browser.
|
5
5
|
# However, the current implementation does not handle file uploads or cerating
|
6
6
|
# new sections or 'folders'.
|
7
7
|
# This patch implements a FCKeditor connector that plays well with BrowserCMS.
|
@@ -28,7 +28,7 @@ Cms::SectionsController.class_eval do
|
|
28
28
|
protected
|
29
29
|
|
30
30
|
# Sections created through FCKeditor's file browser, are assigned to groups
|
31
|
-
# "guest", "cms-admin" and "content-editor" and are hidden from
|
31
|
+
# "guest", "cms-admin" and "content-editor" and are hidden from menus by
|
32
32
|
# default.
|
33
33
|
def create_section
|
34
34
|
section_path = build_path(params[:NewFolderName].to_slug)
|
@@ -39,12 +39,12 @@ Cms::SectionsController.class_eval do
|
|
39
39
|
:parent_id => @section.id,
|
40
40
|
:group_ids => [1, 2, 3],
|
41
41
|
:hidden => true)
|
42
|
-
|
42
|
+
result = "0"
|
43
43
|
rescue Exception => e
|
44
|
-
build_error_string(e)
|
44
|
+
result = build_error_string(e)
|
45
45
|
end
|
46
46
|
|
47
|
-
render_response
|
47
|
+
render_response(result)
|
48
48
|
end
|
49
49
|
|
50
50
|
# According to FCKeditor's documentation, server side connectors should rename
|
@@ -64,25 +64,26 @@ Cms::SectionsController.class_eval do
|
|
64
64
|
:attachment_file_path => file_path,
|
65
65
|
:publish_on_save => true,
|
66
66
|
:name => upfile.original_filename.capitalize)
|
67
|
-
|
67
|
+
result = "0"
|
68
68
|
rescue Exception => e
|
69
|
-
build_error_string(e)
|
69
|
+
result = build_error_string(e)
|
70
70
|
end
|
71
71
|
|
72
|
-
render_response
|
72
|
+
render_response(result)
|
73
73
|
end
|
74
74
|
|
75
75
|
private
|
76
76
|
|
77
|
-
def
|
78
|
-
|
77
|
+
def build_error_string(e)
|
78
|
+
"1, '#{escape_javascript(e.message.to_sentence)}'"
|
79
79
|
end
|
80
80
|
|
81
81
|
def build_path(resource_name)
|
82
82
|
"%s%s%s" % [@section.path, @section.path == "/" ? "" : "/", resource_name]
|
83
83
|
end
|
84
84
|
|
85
|
-
def render_response
|
86
|
-
|
85
|
+
def render_response(result)
|
86
|
+
result_string = %Q{<script type="text/javascript">window.parent.frames['frmUpload'].OnUploadCompleted(#{result});</script>}
|
87
|
+
render :text => result_string, :layout => false
|
87
88
|
end
|
88
89
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcms_fckeditor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 4
|
10
|
+
version: 1.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- BrowserMedia
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-21 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|