From 297b3c42b1d699439c64ea41e522d8b2205ae573 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 20 Mar 2015 18:02:33 +0800 Subject: [PATCH 01/24] =?UTF-8?q?=E6=8F=92=E5=85=A5=E7=9A=84=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E6=A0=B7=E5=BC=8F=E4=BC=9A=E8=A2=AB=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=A6=86=E7=9B=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/plugins/table/table.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/assets/kindeditor/plugins/table/table.js b/public/assets/kindeditor/plugins/table/table.js index 4033b6ae3..634e9b7fc 100644 --- a/public/assets/kindeditor/plugins/table/table.js +++ b/public/assets/kindeditor/plugins/table/table.js @@ -245,6 +245,10 @@ KindEditor.plugin('table', function(K) { if (bgColor !== '') { style += 'background-color:' + bgColor + ';'; } + if (border !== ''){ + style += 'border:'+border+'px solid;'; + } + var html = '') + ''; + html += '' + (K.IE ? ' ' : '
') + ''; } html += ''; } From 90bce764092970077b112ee1e3437bc3489a5d12 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 15:23:34 +0800 Subject: [PATCH 02/24] =?UTF-8?q?=E7=A7=81=E6=9C=89=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E8=B5=84=E6=BA=90=E6=95=B0=EF=BC=8C=E5=8F=AA=E8=A6=81?= =?UTF-8?q?=E4=B8=8D=E6=98=AF=E6=9C=AC=E4=BA=BA=E4=BC=A0=E7=9A=84=EF=BC=8C?= =?UTF-8?q?=E9=83=BD=E7=9C=8B=E4=B8=8D=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/files_helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 9eff409ff..884ebc2eb 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -87,7 +87,10 @@ module FilesHelper def visable_attachemnts attachments result = [] attachments.each do |attachment| - if attachment.is_public? || (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id + if attachment.is_public? || + (attachment.container_type == "Project" && User.current.member_of?(attachment.project)) || + (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))|| + attachment.author_id == User.current.id result << attachment end end From d1d40e1867ba515d1949a113a9a55f9ee7d60516 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 15:38:23 +0800 Subject: [PATCH 03/24] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=A1=86=E7=9A=84id=EF=BC=8C=E5=9C=A8?= =?UTF-8?q?=E8=AE=BA=E5=9D=9B=E6=A8=A1=E5=9D=97=E9=87=8C=EF=BC=8C=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E7=94=9F=E6=88=90=E7=9A=84id=E4=BC=9A=E5=92=8C?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8kindeditor=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=9A=84id=E5=86=B2=E7=AA=81=EF=BC=9A=E9=83=BD=E5=8F=ABmemo=5F?= =?UTF-8?q?content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_feedback.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index d964b788f..6a0e79673 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -167,7 +167,7 @@ function cookieget(n) <% get_memo %> <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> <%= f.text_area :subject, :class => "opnionText", :placeholder => l(:label_feedback_tips) %> - <%= f.hidden_field :content, :required => true , :value => l(:label_feedback_value) %> + <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> <%#= f.submit :value => l(:label_memo_create), :class => "opnionButton", :id => "button1" %> <%= l(:label_submit)%> <% end %> From 19b41c684fb74a80a780ecffc933de0810d40c3c Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 15:39:47 +0800 Subject: [PATCH 04/24] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E5=9C=A8?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AE=BA=E5=9D=9B=E5=92=8C=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=8E=9F=E6=9D=A5=E7=9A=84=E8=AE=BA=E5=9D=9B=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=EF=BC=8C=E6=9C=89=E6=89=80=E5=8C=BA=E5=88=AB=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=9C=A8=E4=BB=A3=E7=A0=81=E9=87=8C=E7=94=A8?= =?UTF-8?q?=E5=88=86=E6=94=AF=E5=88=A4=E6=96=AD=EF=BC=8C=E5=B0=B1=E7=94=A8?= =?UTF-8?q?=E4=BA=86=E4=B8=A4=E4=B8=AA=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/forums/_form_create_mode.html.erb | 51 +++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 app/views/forums/_form_create_mode.html.erb diff --git a/app/views/forums/_form_create_mode.html.erb b/app/views/forums/_form_create_mode.html.erb new file mode 100644 index 000000000..63162c7a0 --- /dev/null +++ b/app/views/forums/_form_create_mode.html.erb @@ -0,0 +1,51 @@ + + + +
+ <%= labelled_form_for(@forum) do |f| %> + <% if @forum.errors.any? %> + + <% end %> +
+
+ <%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share', :maxlength => 50%> +
+
+ <% if User.current.logged? && User.current.admin? %> + <% if @forum.safe_attribute? 'sticky' %> + <%= f.check_box :sticky %> + <%= label_tag 'message_sticky', l(:label_board_sticky) %> + <% end %> + <% if @forum.safe_attribute? 'locked' %> + <%= f.check_box :locked %> + <%= label_tag 'message_locked', l(:label_board_locked) %> + <% end %> + <% end %> +
+
+ + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> +

+ <%= f.kindeditor :description, :required => true %> +

+ + +

+ (<%= l(:label_forums_max_length) %>) +

+
+
+ <%= submit_tag l(:button_submit) %> + <%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %> +
+
+ <% end %> +
From fba9ced608ba410310dd04d21a3c32ce3cdf3d2f Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 15:40:04 +0800 Subject: [PATCH 05/24] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E5=9C=A8?= =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AE=BA=E5=9D=9B=E5=92=8C=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=8E=9F=E6=9D=A5=E7=9A=84=E8=AE=BA=E5=9D=9B=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=EF=BC=8C=E6=9C=89=E6=89=80=E5=8C=BA=E5=88=AB=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=9C=A8=E4=BB=A3=E7=A0=81=E9=87=8C=E7=94=A8?= =?UTF-8?q?=E5=88=86=E6=94=AF=E5=88=A4=E6=96=AD=EF=BC=8C=E5=B0=B1=E7=94=A8?= =?UTF-8?q?=E4=BA=86=E4=B8=A4=E4=B8=AA=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/forums/_form_edit_mode.html.erb | 49 +++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 app/views/forums/_form_edit_mode.html.erb diff --git a/app/views/forums/_form_edit_mode.html.erb b/app/views/forums/_form_edit_mode.html.erb new file mode 100644 index 000000000..a9bb05f79 --- /dev/null +++ b/app/views/forums/_form_edit_mode.html.erb @@ -0,0 +1,49 @@ + + + +
+ <%= labelled_form_for(@forum) do |f| %> + <% if @forum.errors.any? %> + + <% end %> +
+
+ <%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share', :maxlength => 50%> +
+
+ <% if User.current.logged? && User.current.admin? %> + <% if @forum.safe_attribute? 'sticky' %> + <%= f.check_box :sticky %> + <%= label_tag 'message_sticky', l(:label_board_sticky) %> + <% end %> + <% if @forum.safe_attribute? 'locked' %> + <%= f.check_box :locked %> + <%= label_tag 'message_locked', l(:label_board_locked) %> + <% end %> + <% end %> +
+
+

+ <%= f.kindeditor :description, :required => true,:owner_id => @forum.id,:owner_type => 2 %> +

+ + +

+ (<%= l(:label_forums_max_length) %>) +

+
+
+ <%= submit_tag l(:button_submit) %> + <%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %> +
+
+ <% end %> +
From 49148808ece11b38249ff327f59bb6cc3c922704 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 15:41:06 +0800 Subject: [PATCH 06/24] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=9F=9F=EF=BC=8C=E7=94=A8=E6=9D=A5=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=BF=99=E4=B8=AA=E5=9B=BE=E7=89=87=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=9A=84id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/memos/_reply_box.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/memos/_reply_box.html.erb b/app/views/memos/_reply_box.html.erb index 938952c32..1ee94dd3e 100644 --- a/app/views/memos/_reply_box.html.erb +++ b/app/views/memos/_reply_box.html.erb @@ -3,12 +3,12 @@ <%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %> <%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
- + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> <%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %> <%= label_tag(l(:label_reply_plural)) %>: - <%= f.text_area :content, :cols => 80, :rows => 15, :class => 'wiki-edit', :id => 'editor01', :value => @content %> - + <%= f.kindeditor :content, :cols => 80, :rows => 15, :value => @content %> +

<%= l(:label_attachment_plural) %>
From 643bfd47cbba13edb466f149c63fd996c6650fc9 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 15:41:55 +0800 Subject: [PATCH 07/24] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=9F=9F=EF=BC=8C=E7=94=A8=E6=9D=A5=E4=BF=9D?= =?UTF-8?q?=E5=AD=98kindeditor=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=90=8E=E8=BF=94=E5=9B=9E=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E7=89=87id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/memos/_topic_form.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/memos/_topic_form.html.erb b/app/views/memos/_topic_form.html.erb index d7d0aeca0..ec16fbc5c 100644 --- a/app/views/memos/_topic_form.html.erb +++ b/app/views/memos/_topic_form.html.erb @@ -1,9 +1,10 @@ <%= labelled_form_for(@memo, :url => forum_memos_path) do |f| %>

+ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>

<%= f.text_field :subject, :required => true, :size => 95 %>

-

<%= f.text_area :content, :required => true, :id => 'editor01' %>

- +

<%= f.kindeditor :content, :required => true %>

+

From 74029aee46c7827674de5af10b6c7766a02857c2 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 15:42:47 +0800 Subject: [PATCH 08/24] =?UTF-8?q?=E5=88=A0=E6=8E=89=E8=BF=99=E4=B8=AAform?= =?UTF-8?q?=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/forums/_form.html.erb | 49 --------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 app/views/forums/_form.html.erb diff --git a/app/views/forums/_form.html.erb b/app/views/forums/_form.html.erb deleted file mode 100644 index ac9c298ff..000000000 --- a/app/views/forums/_form.html.erb +++ /dev/null @@ -1,49 +0,0 @@ - - -

- <%= labelled_form_for(@forum) do |f| %> - <% if @forum.errors.any? %> - - <% end %> -
-
- <%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share', :maxlength => 50%> -
-
- <% if User.current.logged? && User.current.admin? %> - <% if @forum.safe_attribute? 'sticky' %> - <%= f.check_box :sticky %> - <%= label_tag 'message_sticky', l(:label_board_sticky) %> - <% end %> - <% if @forum.safe_attribute? 'locked' %> - <%= f.check_box :locked %> - <%= label_tag 'message_locked', l(:label_board_locked) %> - <% end %> - <% end %> -
-
- -

- <%= f.text_area :description, :required => true, :id => 'editor01' %> -

- - -

- (<%= l(:label_forums_max_length) %>) -

-
-
- <%= submit_tag l(:button_submit) %> - <%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %> -
-
- <% end %> -
From 0d487efea8724d2d190e2ee162dfd23ca80594b3 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 15:43:35 +0800 Subject: [PATCH 09/24] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=A4=E4=B8=AA?= =?UTF-8?q?=E5=85=AC=E7=94=A8=E7=9A=84=E6=96=B9=E6=B3=95=E3=80=82=E4=BB=8E?= =?UTF-8?q?=E7=A1=AC=E7=9B=98=E4=B8=8A=E5=88=A0=E9=99=A4=E5=AF=B9=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=EF=BC=8C=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=E7=9A=84owner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b4f54f075..a5cfc2b16 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,6 +33,35 @@ module ApplicationHelper extend Forwardable def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter + # Time 2015-03-24 15:27:29 + # Author lizanle + # Description 从硬盘上删除对应的资源文件 + def delete_kindeditor_assets_from_disk owner_id,owner_type + assets = Kindeditor::Asset.where(["owner_id = ? and owner_type = ?",owner_id,owner_type]) + if !assets.nil? && !assets.blank? + assets.all.each do |asset| + next if asset.nil? + filepath = File.join(Rails.root,"public","files","uploads", + asset[:created_at].to_s.gsub("+0800","").to_datetime.strftime("%Y%m").to_s, + asset[:asset].to_s) + File.delete(filepath) if File.exist?filepath + end + end + end + + # Time 2015-03-24 16:38:05 + # Author lizanle + # Description after save后需要进行资源记录的更新 + # owner_type = 1 对应的是 memo + def update_kindeditor_assets_owner ids,owner_id,owner_type + ids.each do |id| + asset = Kindeditor::Asset.find(id.to_i) + asset.owner_id = owner_id + asset.owner_type = owner_type + asset.save + end + end + # Added by young # Define the course menu's link class # 不是数组的转化成数组,然后判断当前menu_item是否在给定的列表 From cd976f951597076185ea543ed664cd7b010f4c10 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 15:44:39 +0800 Subject: [PATCH 10/24] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E8=AE=BA=E5=9D=9B?= =?UTF-8?q?=E7=9A=84description=E4=B8=8A=E4=BC=A0=E4=BA=86=E5=9B=BE?= =?UTF-8?q?=E7=89=87=EF=BC=8C=E9=82=A3=E4=B9=88=E8=BF=99=E4=B8=AA=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E4=BC=9A=E6=98=BE=E7=A4=BA=EF=BC=8C=E4=BD=BF=E5=BE=97?= =?UTF-8?q?=E8=AE=BA=E5=9D=9B=E7=9A=84=E7=95=8C=E9=9D=A2=E8=A2=AB=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=8D=A0=E6=8D=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_forums.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/base_forums.html.erb b/app/views/layouts/base_forums.html.erb index cc9cdd071..a7e2ef08a 100644 --- a/app/views/layouts/base_forums.html.erb +++ b/app/views/layouts/base_forums.html.erb @@ -12,11 +12,12 @@ <%= csrf_meta_tag %> <%= favicon %> + <%= javascript_include_tag "/assets/kindeditor/kindeditor" %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> <%= heads_for_theme %> - <%= javascript_include_tag "ckeditor/ckeditor.js" %> + <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> @@ -52,7 +53,7 @@ ' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()), + title = titleBox.val(); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (K.trim(title) === '') { + title = url; + } + clickFn.call(self, url, title); + } + } + }), + div = dialog.div; + + var urlBox = K('[name="url"]', div), + viewServerBtn = K('[name="viewServer"]', div), + titleBox = K('[name="title"]', div); + + if (allowFileUpload) { + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : filePostName, + url : K.addParam(uploadJson, 'dir=file'), + extraParams : extraParams, + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = data.url; + if (formatUploadUrl) { + url = K.formatUrl(url, 'absolute'); + } + urlBox.val(url); + if (self.afterUpload) { + self.afterUpload.call(self, url, data, name); + } + alert(self.lang('uploadSuccess')); + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + }); + } else { + K('.ke-upload-button', div).hide(); + } + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'LIST', + dirName : 'file', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + if (self.afterSelectFile) { + self.afterSelectFile.call(self, url); + } + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + urlBox.val(fileUrl); + titleBox.val(fileTitle); + urlBox[0].focus(); + urlBox[0].select(); + }; + self.clickToolbar(name, function() { + self.plugin.fileDialog({ + clickFn : function(url, title) { + var html = '' + title + ''; + self.insertHtml(html).hideDialog().focus(); + } + }); + }); +}); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/lineheight/lineheight.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/lineheight/lineheight.js new file mode 100644 index 000000000..ae679d788 --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/lineheight/lineheight.js @@ -0,0 +1,38 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('lineheight', function(K) { + var self = this, name = 'lineheight', lang = self.lang(name + '.'); + self.clickToolbar(name, function() { + var curVal = '', commonNode = self.cmd.commonNode({'*' : '.line-height'}); + if (commonNode) { + curVal = commonNode.css('line-height'); + } + var menu = self.createMenu({ + name : name, + width : 150 + }); + K.each(lang.lineHeight, function(i, row) { + K.each(row, function(key, val) { + menu.addItem({ + title : val, + checked : curVal === key, + click : function() { + self.cmd.toggle('', { + span : '.line-height=' + key + }); + self.updateState(); + self.addBookmark(); + self.hideMenu(); + } + }); + }); + }); + }); +}); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/link/link.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/link/link.js new file mode 100644 index 000000000..352fa3c64 --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/link/link.js @@ -0,0 +1,66 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('link', function(K) { + var self = this, name = 'link'; + self.plugin.link = { + edit : function() { + var lang = self.lang(name + '.'), + html = '
' + + //url + '
' + + '' + + '
' + + //type + '
' + + '' + + '' + + '
' + + '
', + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + self.exec('createlink', url, typeBox.val()).hideDialog().focus(); + } + } + }), + div = dialog.div, + urlBox = K('input[name="url"]', div), + typeBox = K('select[name="type"]', div); + urlBox.val('http://'); + typeBox[0].options[0] = new Option(lang.newWindow, '_blank'); + typeBox[0].options[1] = new Option(lang.selfWindow, ''); + self.cmd.selection(); + var a = self.plugin.getSelectedLink(); + if (a) { + self.cmd.range.selectNode(a[0]); + self.cmd.select(); + urlBox.val(a.attr('data-ke-src')); + typeBox.val(a.attr('target')); + } + urlBox[0].focus(); + urlBox[0].select(); + }, + 'delete' : function() { + self.exec('unlink', null); + } + }; + self.clickToolbar(name, self.plugin.link.edit); +}); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/map/map.html b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/map/map.html new file mode 100644 index 000000000..1a9ad7d7b --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/map/map.html @@ -0,0 +1,57 @@ + + + + + + + + + +
+ + \ No newline at end of file diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/map/map.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/map/map.js new file mode 100644 index 000000000..529087525 --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/map/map.js @@ -0,0 +1,137 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +// Google Maps: http://code.google.com/apis/maps/index.html + +KindEditor.plugin('map', function(K) { + var self = this, name = 'map', lang = self.lang(name + '.'); + self.clickToolbar(name, function() { + var html = ['
', + '
', + lang.address + ' ', + '', + '', + '', + '
', + '
', + '
'].join(''); + var dialog = self.createDialog({ + name : name, + width : 600, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var geocoder = win.geocoder, + map = win.map, + center = map.getCenter().lat() + ',' + map.getCenter().lng(), + zoom = map.getZoom(), + maptype = map.getMapTypeId(), + url = 'http://maps.googleapis.com/maps/api/staticmap'; + url += '?center=' + encodeURIComponent(center); + url += '&zoom=' + encodeURIComponent(zoom); + url += '&size=558x360'; + url += '&maptype=' + encodeURIComponent(maptype); + url += '&markers=' + encodeURIComponent(center); + url += '&language=' + self.langType; + url += '&sensor=false'; + self.exec('insertimage', url).hideDialog().focus(); + } + }, + beforeRemove : function() { + searchBtn.remove(); + if (doc) { + doc.write(''); + } + iframe.remove(); + } + }); + var div = dialog.div, + addressBox = K('[name="address"]', div), + searchBtn = K('[name="searchBtn"]', div), + win, doc; + var iframeHtml = ['', + '', + '', + '', + '', + '', + '', + '
', + ''].join('\n'); + // TODO:用doc.write(iframeHtml)方式加载时,在IE6上第一次加载报错,暂时使用src方式 + var iframe = K(''); + function ready() { + win = iframe[0].contentWindow; + doc = K.iframeDoc(iframe); + //doc.open(); + //doc.write(iframeHtml); + //doc.close(); + } + iframe.bind('load', function() { + iframe.unbind('load'); + if (K.IE) { + ready(); + } else { + setTimeout(ready, 0); + } + }); + K('.ke-map', div).replaceWith(iframe); + // search map + searchBtn.click(function() { + win.search(addressBox.val()); + }); + }); +}); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/media/media.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/media/media.js new file mode 100644 index 000000000..58034662a --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/media/media.js @@ -0,0 +1,170 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('media', function(K) { + var self = this, name = 'media', lang = self.lang(name + '.'), + allowMediaUpload = K.undef(self.allowMediaUpload, true), + allowFileManager = K.undef(self.allowFileManager, false), + formatUploadUrl = K.undef(self.formatUploadUrl, true), + extraParams = K.undef(self.extraFileUploadParams, {}), + filePostName = K.undef(self.filePostName, 'imgFile'), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'); + self.plugin.media = { + edit : function() { + var html = [ + '
', + //url + '
', + '', + '  ', + '  ', + '', + '', + '', + '
', + //width + '
', + '', + '', + '
', + //height + '
', + '', + '', + '
', + //autostart + '
', + '', + ' ', + '
', + '
' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 450, + height : 230, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var url = K.trim(urlBox.val()), + width = widthBox.val(), + height = heightBox.val(); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + var html = K.mediaImg(self.themesPath + 'common/blank.gif', { + src : url, + type : K.mediaType(url), + width : width, + height : height, + autostart : autostartBox[0].checked ? 'true' : 'false', + loop : 'true' + }); + self.insertHtml(html).hideDialog().focus(); + } + } + }), + div = dialog.div, + urlBox = K('[name="url"]', div), + viewServerBtn = K('[name="viewServer"]', div), + widthBox = K('[name="width"]', div), + heightBox = K('[name="height"]', div), + autostartBox = K('[name="autostart"]', div); + urlBox.val('http://'); + + if (allowMediaUpload) { + var uploadbutton = K.uploadbutton({ + button : K('.ke-upload-button', div)[0], + fieldName : filePostName, + extraParams : extraParams, + url : K.addParam(uploadJson, 'dir=media'), + afterUpload : function(data) { + dialog.hideLoading(); + if (data.error === 0) { + var url = data.url; + if (formatUploadUrl) { + url = K.formatUrl(url, 'absolute'); + } + urlBox.val(url); + if (self.afterUpload) { + self.afterUpload.call(self, url, data, name); + } + alert(self.lang('uploadSuccess')); + } else { + alert(data.message); + } + }, + afterError : function(html) { + dialog.hideLoading(); + self.errorDialog(html); + } + }); + uploadbutton.fileBox.change(function(e) { + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + }); + } else { + K('.ke-upload-button', div).hide(); + } + + if (allowFileManager) { + viewServerBtn.click(function(e) { + self.loadPlugin('filemanager', function() { + self.plugin.filemanagerDialog({ + viewType : 'LIST', + dirName : 'media', + clickFn : function(url, title) { + if (self.dialogs.length > 1) { + K('[name="url"]', div).val(url); + if (self.afterSelectFile) { + self.afterSelectFile.call(self, url); + } + self.hideDialog(); + } + } + }); + }); + }); + } else { + viewServerBtn.hide(); + } + + var img = self.plugin.getSelectedMedia(); + if (img) { + var attrs = K.mediaAttrs(img.attr('data-ke-tag')); + urlBox.val(attrs.src); + widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0); + heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0); + autostartBox[0].checked = (attrs.autostart === 'true'); + } + urlBox[0].focus(); + urlBox[0].select(); + }, + 'delete' : function() { + self.plugin.getSelectedMedia().remove(); + // [IE] 删除图片后立即点击图片按钮出错 + self.addBookmark(); + } + }; + self.clickToolbar(name, self.plugin.media.edit); +}); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/image.png b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/multiimage/images/image.png new file mode 100644 index 0000000000000000000000000000000000000000..fe79cf0ad566d774635ae23fcd10722361d4b56d GIT binary patch literal 1862 zcmc(f`#aMM9LMK=7m`llBuQEGxF#wI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rBVjO51{u}9GNGs4J3{trq1 z!{iVM!f$IWV=Aj2+fCj*oYSQ1e;clU6j;kvjSU&^tAS^c*M6w3{1CB>R92*i#p5I# z`FuT8U~SxV-jI!O-z3y?`%L#M57f7vScyEl2 ziG8$2cz~ybIwRjn zE;(&#R`fd5(>LbA747>z3srWJOL9=shJ ztZPK9&Obaejc%pyt%Ql>MY}0;9Q~!)VlDG}mUNgU<@OMY)o$|F(;- z48!5~ZByEl6Hdf9T6{w?g#Q{DmCkEBqMYLaYiM^>Or}FKj*;WMA7!(!e2L&(`Yx*~ zrMyV;l{xp(Q5WrX@hNJA1lu(>21T`c;D9e@()H0r;P#k%PR!FqK5kgAOp@|{XG^+Q z-Ws$C5l5vD5i+{5G~_KHBQ|UKY$&t)B8?8aQBTXon%Z)a#zX}UthV5&p-&6;J;Nvo zbkEora&0=BucS)Ox8Y++UG@Wh-%9prSnYp@(qtd&f!t(3XNnnuFytzWU<30{c3EC7@y&WUcMlF zGQ8X{`M9ZhA2&QgeMbs?$)Ek)_GjpPCSxwQ2iZ|89p}2~AAbZKt1Lg2&FsC03~ZeW z^E*CQx9(;7W$?>v-D?Qj#%pZdo2>dX<4v~iEmr-h@fKV62CM$Wc!RBbg;jrSyu#MK z&Z<8$UMChkE+}#VDH8MlrxyMI^G6o=YVifvzqDnnxDN8Ir*22&>caol!vE25cDAn6 zs+E?jG*%sG*?|yI{YkY8+g%+3vBA09zf0Wx#9Z?3!DJ&8NJnuFX;pGvO7COxI->Vp z@m9khX+!J1bk+Sbe2a72{j#_LAL@OC<-`SX??ZxG>)nkb!c*ABkFfCLc%13x!yb4@?FNzZ-jC&v|vFo-a?N%_$JJfKJKiLm(Y*V{xdb$=OH9S zekP(g3rc6kEdl|VrGgAQH@wY7i$lh+!M5e@Ax#>yI +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + + +(function(K) { + +function KSWFUpload(options) { + this.init(options); +} +K.extend(KSWFUpload, { + init : function(options) { + var self = this; + options.afterError = options.afterError || function(str) { + alert(str); + }; + self.options = options; + self.progressbars = {}; + // template + self.div = K(options.container).html([ + '
', + '
', + '
', + '', + '
', + '
' + options.uploadDesc + '
', + '', + '', + '', + '
', + '
', + '
' + ].join('')); + self.bodyDiv = K('.ke-swfupload-body', self.div); + + function showError(itemDiv, msg) { + K('.ke-status > div', itemDiv).hide(); + K('.ke-message', itemDiv).addClass('ke-error').show().html(K.escape(msg)); + } + + var settings = { + debug : false, + upload_url : options.uploadUrl, + flash_url : options.flashUrl, + file_post_name : options.filePostName, + button_placeholder : K('.ke-swfupload-button > input', self.div)[0], + button_image_url: options.buttonImageUrl, + button_width: options.buttonWidth, + button_height: options.buttonHeight, + button_cursor : SWFUpload.CURSOR.HAND, + file_types : options.fileTypes, + file_types_description : options.fileTypesDesc, + file_upload_limit : options.fileUploadLimit, + file_size_limit : options.fileSizeLimit, + post_params : options.postParams, + file_queued_handler : function(file) { + file.url = self.options.fileIconUrl; + self.appendFile(file); + }, + file_queue_error_handler : function(file, errorCode, message) { + var errorName = ''; + switch (errorCode) { + case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED: + errorName = options.queueLimitExceeded; + break; + case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: + errorName = options.fileExceedsSizeLimit; + break; + case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: + errorName = options.zeroByteFile; + break; + case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE: + errorName = options.invalidFiletype; + break; + default: + errorName = options.unknownError; + break; + } + K.DEBUG && alert(errorName); + }, + upload_start_handler : function(file) { + var self = this; + var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv); + K('.ke-status > div', itemDiv).hide(); + K('.ke-progressbar', itemDiv).show(); + }, + upload_progress_handler : function(file, bytesLoaded, bytesTotal) { + var percent = Math.round(bytesLoaded * 100 / bytesTotal); + var progressbar = self.progressbars[file.id]; + progressbar.bar.css('width', Math.round(percent * 80 / 100) + 'px'); + progressbar.percent.html(percent + '%'); + }, + upload_error_handler : function(file, errorCode, message) { + if (file && file.filestatus == SWFUpload.FILE_STATUS.ERROR) { + var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv).eq(0); + showError(itemDiv, self.options.errorMessage); + } + }, + upload_success_handler : function(file, serverData) { + var itemDiv = K('div[data-id="' + file.id + '"]', self.bodyDiv).eq(0); + var data = {}; + try { + data = K.json(serverData); + } catch (e) { + self.options.afterError.call(this, '' + serverData + ''); + } + if (data.error !== 0) { + showError(itemDiv, K.DEBUG ? data.message : self.options.errorMessage); + return; + } + file.url = data.url; + K('.ke-img', itemDiv).attr('src', file.url).attr('data-status', file.filestatus).data('data', data); + K('.ke-status > div', itemDiv).hide(); + } + }; + self.swfu = new SWFUpload(settings); + + K('.ke-swfupload-startupload input', self.div).click(function() { + self.swfu.startUpload(); + }); + }, + getUrlList : function() { + var list = []; + K('.ke-img', self.bodyDiv).each(function() { + var img = K(this); + var status = img.attr('data-status'); + if (status == SWFUpload.FILE_STATUS.COMPLETE) { + list.push(img.data('data')); + } + }); + return list; + }, + removeFile : function(fileId) { + var self = this; + self.swfu.cancelUpload(fileId); + var itemDiv = K('div[data-id="' + fileId + '"]', self.bodyDiv); + K('.ke-photo', itemDiv).unbind(); + K('.ke-delete', itemDiv).unbind(); + itemDiv.remove(); + }, + removeFiles : function() { + var self = this; + K('.ke-item', self.bodyDiv).each(function() { + self.removeFile(K(this).attr('data-id')); + }); + }, + appendFile : function(file) { + var self = this; + var itemDiv = K('
'); + self.bodyDiv.append(itemDiv); + var photoDiv = K('
') + .mouseover(function(e) { + K(this).addClass('ke-on'); + }) + .mouseout(function(e) { + K(this).removeClass('ke-on'); + }); + itemDiv.append(photoDiv); + + var img = K('' + file.name + ''); + photoDiv.append(img); + K('').appendTo(photoDiv).click(function() { + self.removeFile(file.id); + }); + var statusDiv = K('
').appendTo(photoDiv); + // progressbar + K(['
', + '
', + '
0%
'].join('')).hide().appendTo(statusDiv); + // message + K('
' + self.options.pendingMessage + '
').appendTo(statusDiv); + + itemDiv.append('
' + file.name + '
'); + + self.progressbars[file.id] = { + bar : K('.ke-progressbar-bar-inner', photoDiv), + percent : K('.ke-progressbar-percent', photoDiv) + }; + }, + remove : function() { + this.removeFiles(); + this.swfu.destroy(); + this.div.html(''); + } +}); + +K.swfupload = function(element, options) { + return new KSWFUpload(element, options); +}; + +})(KindEditor); + +KindEditor.plugin('multiimage', function(K) { + var self = this, name = 'multiimage', + formatUploadUrl = K.undef(self.formatUploadUrl, true), + uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'), + imgPath = self.pluginsPath + 'multiimage/images/', + imageSizeLimit = K.undef(self.imageSizeLimit, '1MB'), + imageFileTypes = K.undef(self.imageFileTypes, '*.jpg;*.gif;*.png'), + imageUploadLimit = K.undef(self.imageUploadLimit, 20), + filePostName = K.undef(self.filePostName, 'imgFile'), + lang = self.lang(name + '.'); + + self.plugin.multiImageDialog = function(options) { + var clickFn = options.clickFn, + uploadDesc = K.tmpl(lang.uploadDesc, {uploadLimit : imageUploadLimit, sizeLimit : imageSizeLimit}); + var html = [ + '
', + '
', + '
', + '
' + ].join(''); + var dialog = self.createDialog({ + name : name, + width : 650, + height : 510, + title : self.lang(name), + body : html, + previewBtn : { + name : lang.insertAll, + click : function(e) { + clickFn.call(self, swfupload.getUrlList()); + } + }, + yesBtn : { + name : lang.clearAll, + click : function(e) { + swfupload.removeFiles(); + } + }, + beforeRemove : function() { + // IE9 bugfix: https://github.com/kindsoft/kindeditor/issues/72 + if (!K.IE || K.V <= 8) { + swfupload.remove(); + } + } + }), + div = dialog.div; + + var swfupload = K.swfupload({ + container : K('.swfupload', div), + buttonImageUrl : imgPath + (self.langType == 'zh_CN' ? 'select-files-zh_CN.png' : 'select-files-en.png'), + buttonWidth : self.langType == 'zh_CN' ? 72 : 88, + buttonHeight : 23, + fileIconUrl : imgPath + 'image.png', + uploadDesc : uploadDesc, + startButtonValue : lang.startUpload, + uploadUrl : K.addParam(uploadJson, 'dir=image'), + flashUrl : imgPath + 'swfupload.swf', + filePostName : filePostName, + fileTypes : '*.jpg;*.jpeg;*.gif;*.png;*.bmp', + fileTypesDesc : 'Image Files', + fileUploadLimit : imageUploadLimit, + fileSizeLimit : imageSizeLimit, + postParams : K.undef(self.extraFileUploadParams, {}), + queueLimitExceeded : lang.queueLimitExceeded, + fileExceedsSizeLimit : lang.fileExceedsSizeLimit, + zeroByteFile : lang.zeroByteFile, + invalidFiletype : lang.invalidFiletype, + unknownError : lang.unknownError, + pendingMessage : lang.pending, + errorMessage : lang.uploadError, + afterError : function(html) { + self.errorDialog(html); + } + }); + + return dialog; + }; + self.clickToolbar(name, function() { + self.plugin.multiImageDialog({ + clickFn : function (urlList) { + if (urlList.length === 0) { + return; + } + K.each(urlList, function(i, data) { + if (self.afterUpload) { + self.afterUpload.call(self, data.url, data, 'multiimage'); + } + self.exec('insertimage', data.url, data.title, data.width, data.height, data.border, data.align); + }); + // Bugfix: [Firefox] 上传图片后,总是出现正在加载的样式,需要延迟执行hideDialog + setTimeout(function() { + self.hideDialog().focus(); + }, 0); + } + }); + }); +}); + + +/** + * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com + * + * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/ + * + * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilz閚 and Mammon Media and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + */ + + +/* ******************* */ +/* Constructor & Init */ +/* ******************* */ + +(function() { + +window.SWFUpload = function (settings) { + this.initSWFUpload(settings); +}; + +SWFUpload.prototype.initSWFUpload = function (settings) { + try { + this.customSettings = {}; // A container where developers can place their own settings associated with this instance. + this.settings = settings; + this.eventQueue = []; + this.movieName = "KindEditor_SWFUpload_" + SWFUpload.movieCount++; + this.movieElement = null; + + + // Setup global control tracking + SWFUpload.instances[this.movieName] = this; + + // Load the settings. Load the Flash movie. + this.initSettings(); + this.loadFlash(); + this.displayDebugInfo(); + } catch (ex) { + delete SWFUpload.instances[this.movieName]; + throw ex; + } +}; + +/* *************** */ +/* Static Members */ +/* *************** */ +SWFUpload.instances = {}; +SWFUpload.movieCount = 0; +SWFUpload.version = "2.2.0 2009-03-25"; +SWFUpload.QUEUE_ERROR = { + QUEUE_LIMIT_EXCEEDED : -100, + FILE_EXCEEDS_SIZE_LIMIT : -110, + ZERO_BYTE_FILE : -120, + INVALID_FILETYPE : -130 +}; +SWFUpload.UPLOAD_ERROR = { + HTTP_ERROR : -200, + MISSING_UPLOAD_URL : -210, + IO_ERROR : -220, + SECURITY_ERROR : -230, + UPLOAD_LIMIT_EXCEEDED : -240, + UPLOAD_FAILED : -250, + SPECIFIED_FILE_ID_NOT_FOUND : -260, + FILE_VALIDATION_FAILED : -270, + FILE_CANCELLED : -280, + UPLOAD_STOPPED : -290 +}; +SWFUpload.FILE_STATUS = { + QUEUED : -1, + IN_PROGRESS : -2, + ERROR : -3, + COMPLETE : -4, + CANCELLED : -5 +}; +SWFUpload.BUTTON_ACTION = { + SELECT_FILE : -100, + SELECT_FILES : -110, + START_UPLOAD : -120 +}; +SWFUpload.CURSOR = { + ARROW : -1, + HAND : -2 +}; +SWFUpload.WINDOW_MODE = { + WINDOW : "window", + TRANSPARENT : "transparent", + OPAQUE : "opaque" +}; + +// Private: takes a URL, determines if it is relative and converts to an absolute URL +// using the current site. Only processes the URL if it can, otherwise returns the URL untouched +SWFUpload.completeURL = function(url) { + if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) { + return url; + } + + var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : ""); + + var indexSlash = window.location.pathname.lastIndexOf("/"); + if (indexSlash <= 0) { + path = "/"; + } else { + path = window.location.pathname.substr(0, indexSlash) + "/"; + } + + return /*currentURL +*/ path + url; + +}; + + +/* ******************** */ +/* Instance Members */ +/* ******************** */ + +// Private: initSettings ensures that all the +// settings are set, getting a default value if one was not assigned. +SWFUpload.prototype.initSettings = function () { + this.ensureDefault = function (settingName, defaultValue) { + this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName]; + }; + + // Upload backend settings + this.ensureDefault("upload_url", ""); + this.ensureDefault("preserve_relative_urls", false); + this.ensureDefault("file_post_name", "Filedata"); + this.ensureDefault("post_params", {}); + this.ensureDefault("use_query_string", false); + this.ensureDefault("requeue_on_error", false); + this.ensureDefault("http_success", []); + this.ensureDefault("assume_success_timeout", 0); + + // File Settings + this.ensureDefault("file_types", "*.*"); + this.ensureDefault("file_types_description", "All Files"); + this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited" + this.ensureDefault("file_upload_limit", 0); + this.ensureDefault("file_queue_limit", 0); + + // Flash Settings + this.ensureDefault("flash_url", "swfupload.swf"); + this.ensureDefault("prevent_swf_caching", true); + + // Button Settings + this.ensureDefault("button_image_url", ""); + this.ensureDefault("button_width", 1); + this.ensureDefault("button_height", 1); + this.ensureDefault("button_text", ""); + this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;"); + this.ensureDefault("button_text_top_padding", 0); + this.ensureDefault("button_text_left_padding", 0); + this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES); + this.ensureDefault("button_disabled", false); + this.ensureDefault("button_placeholder_id", ""); + this.ensureDefault("button_placeholder", null); + this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW); + this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW); + + // Debug Settings + this.ensureDefault("debug", false); + this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API + + // Event Handlers + this.settings.return_upload_start_handler = this.returnUploadStart; + this.ensureDefault("swfupload_loaded_handler", null); + this.ensureDefault("file_dialog_start_handler", null); + this.ensureDefault("file_queued_handler", null); + this.ensureDefault("file_queue_error_handler", null); + this.ensureDefault("file_dialog_complete_handler", null); + + this.ensureDefault("upload_start_handler", null); + this.ensureDefault("upload_progress_handler", null); + this.ensureDefault("upload_error_handler", null); + this.ensureDefault("upload_success_handler", null); + this.ensureDefault("upload_complete_handler", null); + + this.ensureDefault("debug_handler", this.debugMessage); + + this.ensureDefault("custom_settings", {}); + + // Other settings + this.customSettings = this.settings.custom_settings; + + // Update the flash url if needed + if (!!this.settings.prevent_swf_caching) { + this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime(); + } + + if (!this.settings.preserve_relative_urls) { + //this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url); // Don't need to do this one since flash doesn't look at it + this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url); + this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url); + } + + delete this.ensureDefault; +}; + +// Private: loadFlash replaces the button_placeholder element with the flash movie. +SWFUpload.prototype.loadFlash = function () { + var targetElement, tempParent; + + // Make sure an element with the ID we are going to use doesn't already exist + if (document.getElementById(this.movieName) !== null) { + throw "ID " + this.movieName + " is already in use. The Flash Object could not be added"; + } + + // Get the element where we will be placing the flash movie + targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder; + + if (targetElement == undefined) { + throw "Could not find the placeholder element: " + this.settings.button_placeholder_id; + } + + // Append the container and load the flash + tempParent = document.createElement("div"); + tempParent.innerHTML = this.getFlashHTML(); // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers) + targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement); + + // Fix IE Flash/Form bug + if (window[this.movieName] == undefined) { + window[this.movieName] = this.getMovieElement(); + } + +}; + +// Private: getFlashHTML generates the object tag needed to embed the flash in to the document +SWFUpload.prototype.getFlashHTML = function () { + // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay + // Fix bug for IE9 + // http://www.kindsoft.net/view.php?bbsid=7&postid=5825&pagenum=1 + var classid = ''; + if (KindEditor.IE && KindEditor.V > 8) { + classid = ' classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'; + } + return ['', + '', + '', + '', + '', + '', + '', + ''].join(""); +}; + +// Private: getFlashVars builds the parameter string that will be passed +// to flash in the flashvars param. +SWFUpload.prototype.getFlashVars = function () { + // Build a string from the post param object + var paramString = this.buildParamString(); + var httpSuccessString = this.settings.http_success.join(","); + + // Build the parameter string + return ["movieName=", encodeURIComponent(this.movieName), + "&uploadURL=", encodeURIComponent(this.settings.upload_url), + "&useQueryString=", encodeURIComponent(this.settings.use_query_string), + "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), + "&httpSuccess=", encodeURIComponent(httpSuccessString), + "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), + "&params=", encodeURIComponent(paramString), + "&filePostName=", encodeURIComponent(this.settings.file_post_name), + "&fileTypes=", encodeURIComponent(this.settings.file_types), + "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), + "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), + "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), + "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), + "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), + "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), + "&buttonWidth=", encodeURIComponent(this.settings.button_width), + "&buttonHeight=", encodeURIComponent(this.settings.button_height), + "&buttonText=", encodeURIComponent(this.settings.button_text), + "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), + "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), + "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), + "&buttonAction=", encodeURIComponent(this.settings.button_action), + "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), + "&buttonCursor=", encodeURIComponent(this.settings.button_cursor) + ].join(""); +}; + +// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload +// The element is cached after the first lookup +SWFUpload.prototype.getMovieElement = function () { + if (this.movieElement == undefined) { + this.movieElement = document.getElementById(this.movieName); + } + + if (this.movieElement === null) { + throw "Could not find Flash element"; + } + + return this.movieElement; +}; + +// Private: buildParamString takes the name/value pairs in the post_params setting object +// and joins them up in to a string formatted "name=value&name=value" +SWFUpload.prototype.buildParamString = function () { + var postParams = this.settings.post_params; + var paramStringPairs = []; + + if (typeof(postParams) === "object") { + for (var name in postParams) { + if (postParams.hasOwnProperty(name)) { + paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString())); + } + } + } + + return paramStringPairs.join("&"); +}; + +// Public: Used to remove a SWFUpload instance from the page. This method strives to remove +// all references to the SWF, and other objects so memory is properly freed. +// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state. +// Credits: Major improvements provided by steffen +SWFUpload.prototype.destroy = function () { + try { + // Make sure Flash is done before we try to remove it + this.cancelUpload(null, false); + + + // Remove the SWFUpload DOM nodes + var movieElement = null; + movieElement = this.getMovieElement(); + + if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE + // Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround) + for (var i in movieElement) { + try { + if (typeof(movieElement[i]) === "function") { + movieElement[i] = null; + } + } catch (ex1) {} + } + + // Remove the Movie Element from the page + try { + movieElement.parentNode.removeChild(movieElement); + } catch (ex) {} + } + + // Remove IE form fix reference + window[this.movieName] = null; + + // Destroy other references + SWFUpload.instances[this.movieName] = null; + delete SWFUpload.instances[this.movieName]; + + this.movieElement = null; + this.settings = null; + this.customSettings = null; + this.eventQueue = null; + this.movieName = null; + + + return true; + } catch (ex2) { + return false; + } +}; + + +// Public: displayDebugInfo prints out settings and configuration +// information about this SWFUpload instance. +// This function (and any references to it) can be deleted when placing +// SWFUpload in production. +SWFUpload.prototype.displayDebugInfo = function () { + this.debug( + [ + "---SWFUpload Instance Info---\n", + "Version: ", SWFUpload.version, "\n", + "Movie Name: ", this.movieName, "\n", + "Settings:\n", + "\t", "upload_url: ", this.settings.upload_url, "\n", + "\t", "flash_url: ", this.settings.flash_url, "\n", + "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", + "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", + "\t", "http_success: ", this.settings.http_success.join(", "), "\n", + "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", + "\t", "file_post_name: ", this.settings.file_post_name, "\n", + "\t", "post_params: ", this.settings.post_params.toString(), "\n", + "\t", "file_types: ", this.settings.file_types, "\n", + "\t", "file_types_description: ", this.settings.file_types_description, "\n", + "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", + "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", + "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", + "\t", "debug: ", this.settings.debug.toString(), "\n", + + "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", + + "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", + "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", + "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", + "\t", "button_width: ", this.settings.button_width.toString(), "\n", + "\t", "button_height: ", this.settings.button_height.toString(), "\n", + "\t", "button_text: ", this.settings.button_text.toString(), "\n", + "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", + "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", + "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", + "\t", "button_action: ", this.settings.button_action.toString(), "\n", + "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", + + "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", + "Event Handlers:\n", + "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", + "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", + "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", + "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", + "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", + "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", + "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", + "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", + "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", + "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n" + ].join("") + ); +}; + +/* Note: addSetting and getSetting are no longer used by SWFUpload but are included + the maintain v2 API compatibility +*/ +// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used. +SWFUpload.prototype.addSetting = function (name, value, default_value) { + if (value == undefined) { + return (this.settings[name] = default_value); + } else { + return (this.settings[name] = value); + } +}; + +// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found. +SWFUpload.prototype.getSetting = function (name) { + if (this.settings[name] != undefined) { + return this.settings[name]; + } + + return ""; +}; + + + +// Private: callFlash handles function calls made to the Flash element. +// Calls are made with a setTimeout for some functions to work around +// bugs in the ExternalInterface library. +SWFUpload.prototype.callFlash = function (functionName, argumentArray) { + argumentArray = argumentArray || []; + + var movieElement = this.getMovieElement(); + var returnValue, returnString; + + // Flash's method if calling ExternalInterface methods (code adapted from MooTools). + try { + returnString = movieElement.CallFunction('' + __flash__argumentsToXML(argumentArray, 0) + ''); + returnValue = eval(returnString); + } catch (ex) { + throw "Call to " + functionName + " failed"; + } + + // Unescape file post param values + if (returnValue != undefined && typeof returnValue.post === "object") { + returnValue = this.unescapeFilePostParams(returnValue); + } + + return returnValue; +}; + +/* ***************************** + -- Flash control methods -- + Your UI should use these + to operate SWFUpload + ***************************** */ + +// WARNING: this function does not work in Flash Player 10 +// Public: selectFile causes a File Selection Dialog window to appear. This +// dialog only allows 1 file to be selected. +SWFUpload.prototype.selectFile = function () { + this.callFlash("SelectFile"); +}; + +// WARNING: this function does not work in Flash Player 10 +// Public: selectFiles causes a File Selection Dialog window to appear/ This +// dialog allows the user to select any number of files +// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names. +// If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around +// for this bug. +SWFUpload.prototype.selectFiles = function () { + this.callFlash("SelectFiles"); +}; + + +// Public: startUpload starts uploading the first file in the queue unless +// the optional parameter 'fileID' specifies the ID +SWFUpload.prototype.startUpload = function (fileID) { + this.callFlash("StartUpload", [fileID]); +}; + +// Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index. +// If you do not specify a fileID the current uploading file or first file in the queue is cancelled. +// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter. +SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) { + if (triggerErrorEvent !== false) { + triggerErrorEvent = true; + } + this.callFlash("CancelUpload", [fileID, triggerErrorEvent]); +}; + +// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue. +// If nothing is currently uploading then nothing happens. +SWFUpload.prototype.stopUpload = function () { + this.callFlash("StopUpload"); +}; + +/* ************************ + * Settings methods + * These methods change the SWFUpload settings. + * SWFUpload settings should not be changed directly on the settings object + * since many of the settings need to be passed to Flash in order to take + * effect. + * *********************** */ + +// Public: getStats gets the file statistics object. +SWFUpload.prototype.getStats = function () { + return this.callFlash("GetStats"); +}; + +// Public: setStats changes the SWFUpload statistics. You shouldn't need to +// change the statistics but you can. Changing the statistics does not +// affect SWFUpload accept for the successful_uploads count which is used +// by the upload_limit setting to determine how many files the user may upload. +SWFUpload.prototype.setStats = function (statsObject) { + this.callFlash("SetStats", [statsObject]); +}; + +// Public: getFile retrieves a File object by ID or Index. If the file is +// not found then 'null' is returned. +SWFUpload.prototype.getFile = function (fileID) { + if (typeof(fileID) === "number") { + return this.callFlash("GetFileByIndex", [fileID]); + } else { + return this.callFlash("GetFile", [fileID]); + } +}; + +// Public: addFileParam sets a name/value pair that will be posted with the +// file specified by the Files ID. If the name already exists then the +// exiting value will be overwritten. +SWFUpload.prototype.addFileParam = function (fileID, name, value) { + return this.callFlash("AddFileParam", [fileID, name, value]); +}; + +// Public: removeFileParam removes a previously set (by addFileParam) name/value +// pair from the specified file. +SWFUpload.prototype.removeFileParam = function (fileID, name) { + this.callFlash("RemoveFileParam", [fileID, name]); +}; + +// Public: setUploadUrl changes the upload_url setting. +SWFUpload.prototype.setUploadURL = function (url) { + this.settings.upload_url = url.toString(); + this.callFlash("SetUploadURL", [url]); +}; + +// Public: setPostParams changes the post_params setting +SWFUpload.prototype.setPostParams = function (paramsObject) { + this.settings.post_params = paramsObject; + this.callFlash("SetPostParams", [paramsObject]); +}; + +// Public: addPostParam adds post name/value pair. Each name can have only one value. +SWFUpload.prototype.addPostParam = function (name, value) { + this.settings.post_params[name] = value; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; + +// Public: removePostParam deletes post name/value pair. +SWFUpload.prototype.removePostParam = function (name) { + delete this.settings.post_params[name]; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; + +// Public: setFileTypes changes the file_types setting and the file_types_description setting +SWFUpload.prototype.setFileTypes = function (types, description) { + this.settings.file_types = types; + this.settings.file_types_description = description; + this.callFlash("SetFileTypes", [types, description]); +}; + +// Public: setFileSizeLimit changes the file_size_limit setting +SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) { + this.settings.file_size_limit = fileSizeLimit; + this.callFlash("SetFileSizeLimit", [fileSizeLimit]); +}; + +// Public: setFileUploadLimit changes the file_upload_limit setting +SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) { + this.settings.file_upload_limit = fileUploadLimit; + this.callFlash("SetFileUploadLimit", [fileUploadLimit]); +}; + +// Public: setFileQueueLimit changes the file_queue_limit setting +SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) { + this.settings.file_queue_limit = fileQueueLimit; + this.callFlash("SetFileQueueLimit", [fileQueueLimit]); +}; + +// Public: setFilePostName changes the file_post_name setting +SWFUpload.prototype.setFilePostName = function (filePostName) { + this.settings.file_post_name = filePostName; + this.callFlash("SetFilePostName", [filePostName]); +}; + +// Public: setUseQueryString changes the use_query_string setting +SWFUpload.prototype.setUseQueryString = function (useQueryString) { + this.settings.use_query_string = useQueryString; + this.callFlash("SetUseQueryString", [useQueryString]); +}; + +// Public: setRequeueOnError changes the requeue_on_error setting +SWFUpload.prototype.setRequeueOnError = function (requeueOnError) { + this.settings.requeue_on_error = requeueOnError; + this.callFlash("SetRequeueOnError", [requeueOnError]); +}; + +// Public: setHTTPSuccess changes the http_success setting +SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) { + if (typeof http_status_codes === "string") { + http_status_codes = http_status_codes.replace(" ", "").split(","); + } + + this.settings.http_success = http_status_codes; + this.callFlash("SetHTTPSuccess", [http_status_codes]); +}; + +// Public: setHTTPSuccess changes the http_success setting +SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) { + this.settings.assume_success_timeout = timeout_seconds; + this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]); +}; + +// Public: setDebugEnabled changes the debug_enabled setting +SWFUpload.prototype.setDebugEnabled = function (debugEnabled) { + this.settings.debug_enabled = debugEnabled; + this.callFlash("SetDebugEnabled", [debugEnabled]); +}; + +// Public: setButtonImageURL loads a button image sprite +SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) { + if (buttonImageURL == undefined) { + buttonImageURL = ""; + } + + this.settings.button_image_url = buttonImageURL; + this.callFlash("SetButtonImageURL", [buttonImageURL]); +}; + +// Public: setButtonDimensions resizes the Flash Movie and button +SWFUpload.prototype.setButtonDimensions = function (width, height) { + this.settings.button_width = width; + this.settings.button_height = height; + + var movie = this.getMovieElement(); + if (movie != undefined) { + movie.style.width = width + "px"; + movie.style.height = height + "px"; + } + + this.callFlash("SetButtonDimensions", [width, height]); +}; +// Public: setButtonText Changes the text overlaid on the button +SWFUpload.prototype.setButtonText = function (html) { + this.settings.button_text = html; + this.callFlash("SetButtonText", [html]); +}; +// Public: setButtonTextPadding changes the top and left padding of the text overlay +SWFUpload.prototype.setButtonTextPadding = function (left, top) { + this.settings.button_text_top_padding = top; + this.settings.button_text_left_padding = left; + this.callFlash("SetButtonTextPadding", [left, top]); +}; + +// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button +SWFUpload.prototype.setButtonTextStyle = function (css) { + this.settings.button_text_style = css; + this.callFlash("SetButtonTextStyle", [css]); +}; +// Public: setButtonDisabled disables/enables the button +SWFUpload.prototype.setButtonDisabled = function (isDisabled) { + this.settings.button_disabled = isDisabled; + this.callFlash("SetButtonDisabled", [isDisabled]); +}; +// Public: setButtonAction sets the action that occurs when the button is clicked +SWFUpload.prototype.setButtonAction = function (buttonAction) { + this.settings.button_action = buttonAction; + this.callFlash("SetButtonAction", [buttonAction]); +}; + +// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button +SWFUpload.prototype.setButtonCursor = function (cursor) { + this.settings.button_cursor = cursor; + this.callFlash("SetButtonCursor", [cursor]); +}; + +/* ******************************* + Flash Event Interfaces + These functions are used by Flash to trigger the various + events. + + All these functions a Private. + + Because the ExternalInterface library is buggy the event calls + are added to a queue and the queue then executed by a setTimeout. + This ensures that events are executed in a determinate order and that + the ExternalInterface bugs are avoided. +******************************* */ + +SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) { + // Warning: Don't call this.debug inside here or you'll create an infinite loop + + if (argumentArray == undefined) { + argumentArray = []; + } else if (!(argumentArray instanceof Array)) { + argumentArray = [argumentArray]; + } + + var self = this; + if (typeof this.settings[handlerName] === "function") { + // Queue the event + this.eventQueue.push(function () { + this.settings[handlerName].apply(this, argumentArray); + }); + + // Execute the next queued event + setTimeout(function () { + self.executeNextEvent(); + }, 0); + + } else if (this.settings[handlerName] !== null) { + throw "Event handler " + handlerName + " is unknown or is not a function"; + } +}; + +// Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout +// we must queue them in order to garentee that they are executed in order. +SWFUpload.prototype.executeNextEvent = function () { + // Warning: Don't call this.debug inside here or you'll create an infinite loop + + var f = this.eventQueue ? this.eventQueue.shift() : null; + if (typeof(f) === "function") { + f.apply(this); + } +}; + +// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have +// properties that contain characters that are not valid for JavaScript identifiers. To work around this +// the Flash Component escapes the parameter names and we must unescape again before passing them along. +SWFUpload.prototype.unescapeFilePostParams = function (file) { + var reg = /[$]([0-9a-f]{4})/i; + var unescapedPost = {}; + var uk; + + if (file != undefined) { + for (var k in file.post) { + if (file.post.hasOwnProperty(k)) { + uk = k; + var match; + while ((match = reg.exec(uk)) !== null) { + uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16))); + } + unescapedPost[uk] = file.post[k]; + } + } + + file.post = unescapedPost; + } + + return file; +}; + +// Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working) +SWFUpload.prototype.testExternalInterface = function () { + try { + return this.callFlash("TestExternalInterface"); + } catch (ex) { + return false; + } +}; + +// Private: This event is called by Flash when it has finished loading. Don't modify this. +// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded. +SWFUpload.prototype.flashReady = function () { + // Check that the movie element is loaded correctly with its ExternalInterface methods defined + var movieElement = this.getMovieElement(); + + if (!movieElement) { + this.debug("Flash called back ready but the flash movie can't be found."); + return; + } + + this.cleanUp(movieElement); + + this.queueEvent("swfupload_loaded_handler"); +}; + +// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE. +// This function is called by Flash each time the ExternalInterface functions are created. +SWFUpload.prototype.cleanUp = function (movieElement) { + // Pro-actively unhook all the Flash functions + try { + if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE + this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)"); + for (var key in movieElement) { + try { + if (typeof(movieElement[key]) === "function") { + movieElement[key] = null; + } + } catch (ex) { + } + } + } + } catch (ex1) { + + } + + // Fix Flashes own cleanup code so if the SWFMovie was removed from the page + // it doesn't display errors. + window["__flash__removeCallback"] = function (instance, name) { + try { + if (instance) { + instance[name] = null; + } + } catch (flashEx) { + + } + }; + +}; + + +/* This is a chance to do something before the browse window opens */ +SWFUpload.prototype.fileDialogStart = function () { + this.queueEvent("file_dialog_start_handler"); +}; + + +/* Called when a file is successfully added to the queue. */ +SWFUpload.prototype.fileQueued = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queued_handler", file); +}; + + +/* Handle errors that occur when an attempt to queue a file fails. */ +SWFUpload.prototype.fileQueueError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queue_error_handler", [file, errorCode, message]); +}; + +/* Called after the file dialog has closed and the selected files have been queued. + You could call startUpload here if you want the queued files to begin uploading immediately. */ +SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) { + this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]); +}; + +SWFUpload.prototype.uploadStart = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("return_upload_start_handler", file); +}; + +SWFUpload.prototype.returnUploadStart = function (file) { + var returnValue; + if (typeof this.settings.upload_start_handler === "function") { + file = this.unescapeFilePostParams(file); + returnValue = this.settings.upload_start_handler.call(this, file); + } else if (this.settings.upload_start_handler != undefined) { + throw "upload_start_handler must be a function"; + } + + // Convert undefined to true so if nothing is returned from the upload_start_handler it is + // interpretted as 'true'. + if (returnValue === undefined) { + returnValue = true; + } + + returnValue = !!returnValue; + + this.callFlash("ReturnUploadStart", [returnValue]); +}; + + + +SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]); +}; + +SWFUpload.prototype.uploadError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_error_handler", [file, errorCode, message]); +}; + +SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_success_handler", [file, serverData, responseReceived]); +}; + +SWFUpload.prototype.uploadComplete = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_complete_handler", file); +}; + +/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the + internal debug console. You can override this event and have messages written where you want. */ +SWFUpload.prototype.debug = function (message) { + this.queueEvent("debug_handler", message); +}; + + +/* ********************************** + Debug Console + The debug console is a self contained, in page location + for debug message to be sent. The Debug Console adds + itself to the body if necessary. + + The console is automatically scrolled as messages appear. + + If you are using your own debug handler or when you deploy to production and + have debug disabled you can remove these functions to reduce the file size + and complexity. +********************************** */ + +// Private: debugMessage is the default debug_handler. If you want to print debug messages +// call the debug() function. When overriding the function your own function should +// check to see if the debug setting is true before outputting debug information. +SWFUpload.prototype.debugMessage = function (message) { + if (this.settings.debug) { + var exceptionMessage, exceptionValues = []; + + // Check for an exception object and print it nicely + if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") { + for (var key in message) { + if (message.hasOwnProperty(key)) { + exceptionValues.push(key + ": " + message[key]); + } + } + exceptionMessage = exceptionValues.join("\n") || ""; + exceptionValues = exceptionMessage.split("\n"); + exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: "); + SWFUpload.Console.writeLine(exceptionMessage); + } else { + SWFUpload.Console.writeLine(message); + } + } +}; + +SWFUpload.Console = {}; +SWFUpload.Console.writeLine = function (message) { + var console, documentForm; + + try { + console = document.getElementById("SWFUpload_Console"); + + if (!console) { + documentForm = document.createElement("form"); + document.getElementsByTagName("body")[0].appendChild(documentForm); + + console = document.createElement("textarea"); + console.id = "SWFUpload_Console"; + console.style.fontFamily = "monospace"; + console.setAttribute("wrap", "off"); + console.wrap = "off"; + console.style.overflow = "auto"; + console.style.width = "700px"; + console.style.height = "350px"; + console.style.margin = "5px"; + documentForm.appendChild(console); + } + + console.value += message + "\n"; + + console.scrollTop = console.scrollHeight - console.clientHeight; + } catch (ex) { + alert("Exception: " + ex.name + " Message: " + ex.message); + } +}; + +})(); + +(function() { +/* + Queue Plug-in + + Features: + *Adds a cancelQueue() method for cancelling the entire queue. + *All queued files are uploaded when startUpload() is called. + *If false is returned from uploadComplete then the queue upload is stopped. + If false is not returned (strict comparison) then the queue upload is continued. + *Adds a QueueComplete event that is fired when all the queued files have finished uploading. + Set the event handler with the queue_complete_handler setting. + + */ + +if (typeof(SWFUpload) === "function") { + SWFUpload.queue = {}; + + SWFUpload.prototype.initSettings = (function (oldInitSettings) { + return function () { + if (typeof(oldInitSettings) === "function") { + oldInitSettings.call(this); + } + + this.queueSettings = {}; + + this.queueSettings.queue_cancelled_flag = false; + this.queueSettings.queue_upload_count = 0; + + this.queueSettings.user_upload_complete_handler = this.settings.upload_complete_handler; + this.queueSettings.user_upload_start_handler = this.settings.upload_start_handler; + this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler; + this.settings.upload_start_handler = SWFUpload.queue.uploadStartHandler; + + this.settings.queue_complete_handler = this.settings.queue_complete_handler || null; + }; + })(SWFUpload.prototype.initSettings); + + SWFUpload.prototype.startUpload = function (fileID) { + this.queueSettings.queue_cancelled_flag = false; + this.callFlash("StartUpload", [fileID]); + }; + + SWFUpload.prototype.cancelQueue = function () { + this.queueSettings.queue_cancelled_flag = true; + this.stopUpload(); + + var stats = this.getStats(); + while (stats.files_queued > 0) { + this.cancelUpload(); + stats = this.getStats(); + } + }; + + SWFUpload.queue.uploadStartHandler = function (file) { + var returnValue; + if (typeof(this.queueSettings.user_upload_start_handler) === "function") { + returnValue = this.queueSettings.user_upload_start_handler.call(this, file); + } + + // To prevent upload a real "FALSE" value must be returned, otherwise default to a real "TRUE" value. + returnValue = (returnValue === false) ? false : true; + + this.queueSettings.queue_cancelled_flag = !returnValue; + + return returnValue; + }; + + SWFUpload.queue.uploadCompleteHandler = function (file) { + var user_upload_complete_handler = this.queueSettings.user_upload_complete_handler; + var continueUpload; + + if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) { + this.queueSettings.queue_upload_count++; + } + + if (typeof(user_upload_complete_handler) === "function") { + continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true; + } else if (file.filestatus === SWFUpload.FILE_STATUS.QUEUED) { + // If the file was stopped and re-queued don't restart the upload + continueUpload = false; + } else { + continueUpload = true; + } + + if (continueUpload) { + var stats = this.getStats(); + if (stats.files_queued > 0 && this.queueSettings.queue_cancelled_flag === false) { + this.startUpload(); + } else if (this.queueSettings.queue_cancelled_flag === false) { + this.queueEvent("queue_complete_handler", [this.queueSettings.queue_upload_count]); + this.queueSettings.queue_upload_count = 0; + } else { + this.queueSettings.queue_cancelled_flag = false; + this.queueSettings.queue_upload_count = 0; + } + } + }; +} + +})(); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/pagebreak/pagebreak.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/pagebreak/pagebreak.js new file mode 100644 index 000000000..dfa883afc --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/pagebreak/pagebreak.js @@ -0,0 +1,27 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('pagebreak', function(K) { + var self = this; + var name = 'pagebreak'; + var pagebreakHtml = K.undef(self.pagebreakHtml, '
'); + + self.clickToolbar(name, function() { + var cmd = self.cmd, range = cmd.range; + self.focus(); + var tail = self.newlineTag == 'br' || K.WEBKIT ? '' : ''; + self.insertHtml(pagebreakHtml + tail); + if (tail !== '') { + var p = K('#__kindeditor_tail_tag__', self.edit.doc); + range.selectNodeContents(p[0]); + p.removeAttr('id'); + cmd.select(); + } + }); +}); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/plainpaste/plainpaste.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/plainpaste/plainpaste.js new file mode 100644 index 000000000..8f7bed803 --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/plainpaste/plainpaste.js @@ -0,0 +1,41 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('plainpaste', function(K) { + var self = this, name = 'plainpaste'; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '
' + + '
' + lang.comment + '
' + + '' + + '
', + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var html = textarea.val(); + html = K.escape(html); + html = html.replace(/ {2}/g, '  '); + if (self.newlineTag == 'p') { + html = html.replace(/^/, '

').replace(/$/, '

').replace(/\n/g, '

'); + } else { + html = html.replace(/\n/g, '
$&'); + } + self.insertHtml(html).hideDialog().focus(); + } + } + }), + textarea = K('textarea', dialog.div); + textarea[0].focus(); + }); +}); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/preview/preview.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/preview/preview.js new file mode 100644 index 000000000..ef6e2cf16 --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/preview/preview.js @@ -0,0 +1,31 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('preview', function(K) { + var self = this, name = 'preview', undefined; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '

' + + '' + + '
', + dialog = self.createDialog({ + name : name, + width : 750, + title : self.lang(name), + body : html + }), + iframe = K('iframe', dialog.div), + doc = K.iframeDoc(iframe); + doc.open(); + doc.write(self.fullHtml()); + doc.close(); + K(doc.body).css('background-color', '#FFF'); + iframe[0].contentWindow.focus(); + }); +}); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/quickformat/quickformat.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/quickformat/quickformat.js new file mode 100644 index 000000000..5b98c7227 --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/quickformat/quickformat.js @@ -0,0 +1,81 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('quickformat', function(K) { + var self = this, name = 'quickformat', + blockMap = K.toMap('blockquote,center,div,h1,h2,h3,h4,h5,h6,p'); + function getFirstChild(knode) { + var child = knode.first(); + while (child && child.first()) { + child = child.first(); + } + return child; + } + self.clickToolbar(name, function() { + self.focus(); + var doc = self.edit.doc, + range = self.cmd.range, + child = K(doc.body).first(), next, + nodeList = [], subList = [], + bookmark = range.createBookmark(true); + while(child) { + next = child.next(); + var firstChild = getFirstChild(child); + if (!firstChild || firstChild.name != 'img') { + if (blockMap[child.name]) { + child.html(child.html().replace(/^(\s| | )+/ig, '')); + child.css('text-indent', '2em'); + } else { + subList.push(child); + } + if (!next || (blockMap[next.name] || blockMap[child.name] && !blockMap[next.name])) { + if (subList.length > 0) { + nodeList.push(subList); + } + subList = []; + } + } + child = next; + } + K.each(nodeList, function(i, subList) { + var wrapper = K('

', doc); + subList[0].before(wrapper); + K.each(subList, function(i, knode) { + wrapper.append(knode); + }); + }); + range.moveToBookmark(bookmark); + self.addBookmark(); + }); +}); + +/** +-------------------------- +abcd
+1234
+ +to + +

+ abcd
+ 1234
+

+ +-------------------------- + +  abcd1233 +

1234

+ +to + +

abcd1233

+

1234

+ +-------------------------- +*/ \ No newline at end of file diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/table/table.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/table/table.js new file mode 100644 index 000000000..4033b6ae3 --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/table/table.js @@ -0,0 +1,712 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('table', function(K) { + var self = this, name = 'table', lang = self.lang(name + '.'), zeroborder = 'ke-zeroborder'; + // 设置颜色 + function _setColor(box, color) { + color = color.toUpperCase(); + box.css('background-color', color); + box.css('color', color === '#000000' ? '#FFFFFF' : '#000000'); + box.html(color); + } + // 初始化取色器 + var pickerList = []; + function _initColorPicker(dialogDiv, colorBox) { + colorBox.bind('click,mousedown', function(e){ + e.stopPropagation(); + }); + function removePicker() { + K.each(pickerList, function() { + this.remove(); + }); + pickerList = []; + K(document).unbind('click,mousedown', removePicker); + dialogDiv.unbind('click,mousedown', removePicker); + } + colorBox.click(function(e) { + removePicker(); + var box = K(this), + pos = box.pos(); + var picker = K.colorpicker({ + x : pos.x, + y : pos.y + box.height(), + z : 811214, + selectedColor : K(this).html(), + colors : self.colorTable, + noColor : self.lang('noColor'), + shadowMode : self.shadowMode, + click : function(color) { + _setColor(box, color); + removePicker(); + } + }); + pickerList.push(picker); + K(document).bind('click,mousedown', removePicker); + dialogDiv.bind('click,mousedown', removePicker); + }); + } + // 取得下一行cell的index + function _getCellIndex(table, row, cell) { + var rowSpanCount = 0; + for (var i = 0, len = row.cells.length; i < len; i++) { + if (row.cells[i] == cell) { + break; + } + rowSpanCount += row.cells[i].rowSpan - 1; + } + return cell.cellIndex - rowSpanCount; + } + self.plugin.table = { + //insert or modify table + prop : function(isInsert) { + var html = [ + '
', + //rows, cols + '
', + '', + lang.rows + '   ', + lang.cols + ' ', + '
', + //width, height + '
', + '', + lang.width + '   ', + '   ', + lang.height + '   ', + '', + '
', + //space, padding + '
', + '', + lang.padding + '   ', + lang.spacing + ' ', + '
', + //align + '
', + '', + '', + '
', + //border + '
', + '', + lang.borderWidth + '   ', + lang.borderColor + ' ', + '
', + //background color + '
', + '', + '', + '
', + '
' + ].join(''); + var bookmark = self.cmd.range.createBookmark(); + var dialog = self.createDialog({ + name : name, + width : 500, + title : self.lang(name), + body : html, + beforeRemove : function() { + colorBox.unbind(); + }, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var rows = rowsBox.val(), + cols = colsBox.val(), + width = widthBox.val(), + height = heightBox.val(), + widthType = widthTypeBox.val(), + heightType = heightTypeBox.val(), + padding = paddingBox.val(), + spacing = spacingBox.val(), + align = alignBox.val(), + border = borderBox.val(), + borderColor = K(colorBox[0]).html() || '', + bgColor = K(colorBox[1]).html() || ''; + if (rows == 0 || !/^\d+$/.test(rows)) { + alert(self.lang('invalidRows')); + rowsBox[0].focus(); + return; + } + if (cols == 0 || !/^\d+$/.test(cols)) { + alert(self.lang('invalidRows')); + colsBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + if (!/^\d*$/.test(padding)) { + alert(self.lang('invalidPadding')); + paddingBox[0].focus(); + return; + } + if (!/^\d*$/.test(spacing)) { + alert(self.lang('invalidSpacing')); + spacingBox[0].focus(); + return; + } + if (!/^\d*$/.test(border)) { + alert(self.lang('invalidBorder')); + borderBox[0].focus(); + return; + } + //modify table + if (table) { + if (width !== '') { + table.width(width + widthType); + } else { + table.css('width', ''); + } + if (table[0].width !== undefined) { + table.removeAttr('width'); + } + if (height !== '') { + table.height(height + heightType); + } else { + table.css('height', ''); + } + if (table[0].height !== undefined) { + table.removeAttr('height'); + } + table.css('background-color', bgColor); + if (table[0].bgColor !== undefined) { + table.removeAttr('bgColor'); + } + if (padding !== '') { + table[0].cellPadding = padding; + } else { + table.removeAttr('cellPadding'); + } + if (spacing !== '') { + table[0].cellSpacing = spacing; + } else { + table.removeAttr('cellSpacing'); + } + if (align !== '') { + table[0].align = align; + } else { + table.removeAttr('align'); + } + if (border !== '') { + table.attr('border', border); + } else { + table.removeAttr('border'); + } + if (border === '' || border === '0') { + table.addClass(zeroborder); + } else { + table.removeClass(zeroborder); + } + if (borderColor !== '') { + table.attr('borderColor', borderColor); + } else { + table.removeAttr('borderColor'); + } + self.hideDialog().focus(); + self.cmd.range.moveToBookmark(bookmark); + self.cmd.select(); + self.addBookmark(); + return; + } + //insert new table + var style = ''; + if (width !== '') { + style += 'width:' + width + widthType + ';'; + } + if (height !== '') { + style += 'height:' + height + heightType + ';'; + } + if (bgColor !== '') { + style += 'background-color:' + bgColor + ';'; + } + var html = '') + ''; + } + html += ''; + } + html += ''; + if (!K.IE) { + html += '
'; + } + self.insertHtml(html); + self.select().hideDialog().focus(); + self.addBookmark(); + } + } + }), + div = dialog.div, + rowsBox = K('[name="rows"]', div).val(3), + colsBox = K('[name="cols"]', div).val(2), + widthBox = K('[name="width"]', div).val(100), + heightBox = K('[name="height"]', div), + widthTypeBox = K('[name="widthType"]', div), + heightTypeBox = K('[name="heightType"]', div), + paddingBox = K('[name="padding"]', div).val(2), + spacingBox = K('[name="spacing"]', div).val(0), + alignBox = K('[name="align"]', div), + borderBox = K('[name="border"]', div).val(1), + colorBox = K('.ke-input-color', div); + _initColorPicker(div, colorBox.eq(0)); + _initColorPicker(div, colorBox.eq(1)); + _setColor(colorBox.eq(0), '#000000'); + _setColor(colorBox.eq(1), ''); + // foucs and select + rowsBox[0].focus(); + rowsBox[0].select(); + var table; + if (isInsert) { + return; + } + //get selected table node + table = self.plugin.getSelectedTable(); + if (table) { + rowsBox.val(table[0].rows.length); + colsBox.val(table[0].rows.length > 0 ? table[0].rows[0].cells.length : 0); + rowsBox.attr('disabled', true); + colsBox.attr('disabled', true); + var match, + tableWidth = table[0].style.width || table[0].width, + tableHeight = table[0].style.height || table[0].height; + if (tableWidth !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableWidth))) { + widthBox.val(match[1]); + widthTypeBox.val(match[2]); + } else { + widthBox.val(''); + } + if (tableHeight !== undefined && (match = /^(\d+)((?:px|%)*)$/.exec(tableHeight))) { + heightBox.val(match[1]); + heightTypeBox.val(match[2]); + } + paddingBox.val(table[0].cellPadding || ''); + spacingBox.val(table[0].cellSpacing || ''); + alignBox.val(table[0].align || ''); + borderBox.val(table[0].border === undefined ? '' : table[0].border); + _setColor(colorBox.eq(0), K.toHex(table.attr('borderColor') || '')); + _setColor(colorBox.eq(1), K.toHex(table[0].style.backgroundColor || table[0].bgColor || '')); + widthBox[0].focus(); + widthBox[0].select(); + } + }, + //modify cell + cellprop : function() { + var html = [ + '
', + //width, height + '
', + '', + lang.width + '   ', + '   ', + lang.height + '   ', + '', + '
', + //align + '
', + '', + lang.textAlign + ' ', + lang.verticalAlign + ' ', + '
', + //border + '
', + '', + lang.borderWidth + '   ', + lang.borderColor + ' ', + '
', + //background color + '
', + '', + '', + '
', + '
' + ].join(''); + var bookmark = self.cmd.range.createBookmark(); + var dialog = self.createDialog({ + name : name, + width : 500, + title : self.lang('tablecell'), + body : html, + beforeRemove : function() { + colorBox.unbind(); + }, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var width = widthBox.val(), + height = heightBox.val(), + widthType = widthTypeBox.val(), + heightType = heightTypeBox.val(), + padding = paddingBox.val(), + spacing = spacingBox.val(), + textAlign = textAlignBox.val(), + verticalAlign = verticalAlignBox.val(), + border = borderBox.val(), + borderColor = K(colorBox[0]).html() || '', + bgColor = K(colorBox[1]).html() || ''; + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + if (!/^\d*$/.test(border)) { + alert(self.lang('invalidBorder')); + borderBox[0].focus(); + return; + } + cell.css({ + width : width !== '' ? (width + widthType) : '', + height : height !== '' ? (height + heightType) : '', + 'background-color' : bgColor, + 'text-align' : textAlign, + 'vertical-align' : verticalAlign, + 'border-width' : border, + 'border-style' : border !== '' ? 'solid' : '', + 'border-color' : borderColor + }); + self.hideDialog().focus(); + self.cmd.range.moveToBookmark(bookmark); + self.cmd.select(); + self.addBookmark(); + } + } + }), + div = dialog.div, + widthBox = K('[name="width"]', div).val(100), + heightBox = K('[name="height"]', div), + widthTypeBox = K('[name="widthType"]', div), + heightTypeBox = K('[name="heightType"]', div), + paddingBox = K('[name="padding"]', div).val(2), + spacingBox = K('[name="spacing"]', div).val(0), + textAlignBox = K('[name="textAlign"]', div), + verticalAlignBox = K('[name="verticalAlign"]', div), + borderBox = K('[name="border"]', div).val(1), + colorBox = K('.ke-input-color', div); + _initColorPicker(div, colorBox.eq(0)); + _initColorPicker(div, colorBox.eq(1)); + _setColor(colorBox.eq(0), '#000000'); + _setColor(colorBox.eq(1), ''); + // foucs and select + widthBox[0].focus(); + widthBox[0].select(); + // get selected cell + var cell = self.plugin.getSelectedCell(); + var match, + cellWidth = cell[0].style.width || cell[0].width || '', + cellHeight = cell[0].style.height || cell[0].height || ''; + if ((match = /^(\d+)((?:px|%)*)$/.exec(cellWidth))) { + widthBox.val(match[1]); + widthTypeBox.val(match[2]); + } else { + widthBox.val(''); + } + if ((match = /^(\d+)((?:px|%)*)$/.exec(cellHeight))) { + heightBox.val(match[1]); + heightTypeBox.val(match[2]); + } + textAlignBox.val(cell[0].style.textAlign || ''); + verticalAlignBox.val(cell[0].style.verticalAlign || ''); + var border = cell[0].style.borderWidth || ''; + if (border) { + border = parseInt(border); + } + borderBox.val(border); + _setColor(colorBox.eq(0), K.toHex(cell[0].style.borderColor || '')); + _setColor(colorBox.eq(1), K.toHex(cell[0].style.backgroundColor || '')); + widthBox[0].focus(); + widthBox[0].select(); + }, + insert : function() { + this.prop(true); + }, + 'delete' : function() { + var table = self.plugin.getSelectedTable(); + self.cmd.range.setStartBefore(table[0]).collapse(true); + self.cmd.select(); + table.remove(); + self.addBookmark(); + }, + colinsert : function(offset) { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + index = cell.cellIndex + offset; + // 取得第一行的index + index += table.rows[0].cells.length - row.cells.length; + + for (var i = 0, len = table.rows.length; i < len; i++) { + var newRow = table.rows[i], + newCell = newRow.insertCell(index); + newCell.innerHTML = K.IE ? '' : '
'; + // 调整下一行的单元格index + index = _getCellIndex(table, newRow, newCell); + } + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colinsertleft : function() { + this.colinsert(0); + }, + colinsertright : function() { + this.colinsert(1); + }, + rowinsert : function(offset) { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0]; + var rowIndex = row.rowIndex; + if (offset === 1) { + rowIndex = row.rowIndex + (cell.rowSpan - 1) + offset; + } + var newRow = table.insertRow(rowIndex); + + for (var i = 0, len = row.cells.length; i < len; i++) { + // 调整cell个数 + if (row.cells[i].rowSpan > 1) { + len -= row.cells[i].rowSpan - 1; + } + var newCell = newRow.insertCell(i); + // copy colspan + if (offset === 1 && row.cells[i].colSpan > 1) { + newCell.colSpan = row.cells[i].colSpan; + } + newCell.innerHTML = K.IE ? '' : '
'; + } + // 调整rowspan + for (var j = rowIndex; j >= 0; j--) { + var cells = table.rows[j].cells; + if (cells.length > i) { + for (var k = cell.cellIndex; k >= 0; k--) { + if (cells[k].rowSpan > 1) { + cells[k].rowSpan += 1; + } + } + break; + } + } + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + rowinsertabove : function() { + this.rowinsert(0); + }, + rowinsertbelow : function() { + this.rowinsert(1); + }, + rowmerge : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex, // 当前行的index + nextRowIndex = rowIndex + cell.rowSpan, // 下一行的index + nextRow = table.rows[nextRowIndex]; // 下一行 + // 最后一行不能合并 + if (table.rows.length <= nextRowIndex) { + return; + } + var cellIndex = cell.cellIndex; // 下一行单元格的index + if (nextRow.cells.length <= cellIndex) { + return; + } + var nextCell = nextRow.cells[cellIndex]; // 下一行单元格 + // 上下行的colspan不一致时不能合并 + if (cell.colSpan !== nextCell.colSpan) { + return; + } + cell.rowSpan += nextCell.rowSpan; + nextRow.deleteCell(cellIndex); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colmerge : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex, // 当前行的index + cellIndex = cell.cellIndex, + nextCellIndex = cellIndex + 1; + // 最后一列不能合并 + if (row.cells.length <= nextCellIndex) { + return; + } + var nextCell = row.cells[nextCellIndex]; + // 左右列的rowspan不一致时不能合并 + if (cell.rowSpan !== nextCell.rowSpan) { + return; + } + cell.colSpan += nextCell.colSpan; + row.deleteCell(nextCellIndex); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + rowsplit : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex; + // 不是可分割单元格 + if (cell.rowSpan === 1) { + return; + } + var cellIndex = _getCellIndex(table, row, cell); + for (var i = 1, len = cell.rowSpan; i < len; i++) { + var newRow = table.rows[rowIndex + i], + newCell = newRow.insertCell(cellIndex); + if (cell.colSpan > 1) { + newCell.colSpan = cell.colSpan; + } + newCell.innerHTML = K.IE ? '' : '
'; + // 调整下一行的单元格index + cellIndex = _getCellIndex(table, newRow, newCell); + } + K(cell).removeAttr('rowSpan'); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + colsplit : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + cellIndex = cell.cellIndex; + // 不是可分割单元格 + if (cell.colSpan === 1) { + return; + } + for (var i = 1, len = cell.colSpan; i < len; i++) { + var newCell = row.insertCell(cellIndex + i); + if (cell.rowSpan > 1) { + newCell.rowSpan = cell.rowSpan; + } + newCell.innerHTML = K.IE ? '' : '
'; + } + K(cell).removeAttr('colSpan'); + self.cmd.range.selectNodeContents(cell).collapse(true); + self.cmd.select(); + self.addBookmark(); + }, + coldelete : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + index = cell.cellIndex; + for (var i = 0, len = table.rows.length; i < len; i++) { + var newRow = table.rows[i], + newCell = newRow.cells[index]; + if (newCell.colSpan > 1) { + newCell.colSpan -= 1; + if (newCell.colSpan === 1) { + K(newCell).removeAttr('colSpan'); + } + } else { + newRow.deleteCell(index); + } + // 跳过不需要删除的行 + if (newCell.rowSpan > 1) { + i += newCell.rowSpan - 1; + } + } + if (row.cells.length === 0) { + self.cmd.range.setStartBefore(table).collapse(true); + self.cmd.select(); + K(table).remove(); + } else { + self.cmd.selection(true); + } + self.addBookmark(); + }, + rowdelete : function() { + var table = self.plugin.getSelectedTable()[0], + row = self.plugin.getSelectedRow()[0], + cell = self.plugin.getSelectedCell()[0], + rowIndex = row.rowIndex; + // 从下到上删除 + for (var i = cell.rowSpan - 1; i >= 0; i--) { + table.deleteRow(rowIndex + i); + } + if (table.rows.length === 0) { + self.cmd.range.setStartBefore(table).collapse(true); + self.cmd.select(); + K(table).remove(); + } else { + self.cmd.selection(true); + } + self.addBookmark(); + } + }; + self.clickToolbar(name, self.plugin.table.prop); +}); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/html/1.html b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/html/1.html new file mode 100644 index 000000000..034126b72 --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/html/1.html @@ -0,0 +1,14 @@ + + + + + + +

+ 在此处输入标题 +

+

+ 在此处输入内容 +

+ + \ No newline at end of file diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/html/2.html b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/html/2.html new file mode 100644 index 000000000..dc2584a0d --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/html/2.html @@ -0,0 +1,42 @@ + + + + + + +

+ 标题 +

+ + + + + + + + + + + + + + + +
+

标题1

+
+

标题1

+
+ 内容1 + + 内容2 +
+ 内容3 + + 内容4 +
+

+ 表格说明 +

+ + \ No newline at end of file diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/html/3.html b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/html/3.html new file mode 100644 index 000000000..873f0c65d --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/html/3.html @@ -0,0 +1,36 @@ + + + + + + +

+ 在此处输入内容 +

+
    +
  1. + 描述1 +
  2. +
  3. + 描述2 +
  4. +
  5. + 描述3 +
  6. +
+

+ 在此处输入内容 +

+
    +
  • + 描述1 +
  • +
  • + 描述2 +
  • +
  • + 描述3 +
  • +
+ + \ No newline at end of file diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/template.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/template.js new file mode 100644 index 000000000..4029e8716 --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/template/template.js @@ -0,0 +1,58 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('template', function(K) { + var self = this, name = 'template', lang = self.lang(name + '.'), + htmlPath = self.pluginsPath + name + '/html/'; + function getFilePath(fileName) { + return htmlPath + fileName + '?ver=' + encodeURIComponent(K.DEBUG ? K.TIME : K.VERSION); + } + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + arr = ['
', + '
', + // left start + '
', + lang. selectTemplate + '
', + // right start + '
', + ' ', + '
', + '
', + '
', + '', + '
'].join(''); + var dialog = self.createDialog({ + name : name, + width : 500, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var doc = K.iframeDoc(iframe); + self[checkbox[0].checked ? 'html' : 'insertHtml'](doc.body.innerHTML).hideDialog().focus(); + } + } + }); + var selectBox = K('select', dialog.div), + checkbox = K('[name="replaceFlag"]', dialog.div), + iframe = K('iframe', dialog.div); + checkbox[0].checked = true; + iframe.attr('src', getFilePath(selectBox.val())); + selectBox.change(function() { + iframe.attr('src', getFilePath(this.value)); + }); + }); +}); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/wordpaste/wordpaste.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/wordpaste/wordpaste.js new file mode 100644 index 000000000..22061e15e --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/plugins/wordpaste/wordpaste.js @@ -0,0 +1,51 @@ +/******************************************************************************* +* KindEditor - WYSIWYG HTML Editor for Internet +* Copyright (C) 2006-2011 kindsoft.net +* +* @author Roddy +* @site http://www.kindsoft.net/ +* @licence http://www.kindsoft.net/license.php +*******************************************************************************/ + +KindEditor.plugin('wordpaste', function(K) { + var self = this, name = 'wordpaste'; + self.clickToolbar(name, function() { + var lang = self.lang(name + '.'), + html = '
' + + '
' + lang.comment + '
' + + '' + + '
', + dialog = self.createDialog({ + name : name, + width : 450, + title : self.lang(name), + body : html, + yesBtn : { + name : self.lang('yes'), + click : function(e) { + var str = doc.body.innerHTML; + str = K.clearMsWord(str, self.filterMode ? self.htmlTags : K.options.htmlTags); + self.insertHtml(str).hideDialog().focus(); + } + } + }), + div = dialog.div, + iframe = K('iframe', div), + doc = K.iframeDoc(iframe); + if (!K.IE) { + doc.designMode = 'on'; + } + doc.open(); + doc.write('WordPaste'); + doc.write(''); + if (!K.IE) { + doc.write('
'); + } + doc.write(''); + doc.close(); + if (K.IE) { + doc.body.contentEditable = 'true'; + } + iframe[0].contentWindow.focus(); + }); +}); diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/anchor.gif b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/anchor.gif new file mode 100644 index 0000000000000000000000000000000000000000..61145ea78138f12df43b666409bcc4b8e3231a60 GIT binary patch literal 371 zcmZ?wbhEHb6krfwxN6QYDW2i~>#Uh+4FA{5|NoTr{}#jK1cv|r8K$Q&OaU@(FieVN zn48I*>dcU0&(ImhkmAVj|0cu#%M2+_4F5kfq&hJ~TQO9G2;_J&L|HM+%VPe&MQ&C) z)BiVF|KBtGUnBJY9mD^(IUOMk|2NBZhcf(sRXQn=;s4jN|DPBp#xP8bXXprI=#FCe zf19B@45+gB{|AQI=^Wh=4F5Ms{Qp)u1*rHM&^`YdZ~(=hEQ|~c<_tO@d61tN*d`p9 zUBIEi)aIe0aDYcB+&yV9KvzU~I(C$-u_p#Ky|bWX>%jt!B=|&dL_YB{V~Gw$?l$E`JVT wW>zLW4P_lBR%X%3<`U-X1)1cSnFM$4@f6r##-+BwLW0RJL(*8l(j literal 0 HcmV?d00001 diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/blank.gif b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/blank.gif new file mode 100644 index 0000000000000000000000000000000000000000..5bfd67a2d6f72ac3a55cbfcea5866e841d22f5d9 GIT binary patch literal 43 mcmZ?wbhEHbWMp7uXkdT>#h)yUAf^t80Ld^gF}W}@SOWlZ0R#L1 literal 0 HcmV?d00001 diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/flash.gif b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/flash.gif new file mode 100644 index 0000000000000000000000000000000000000000..2cb12b28429f8c2e5294a177e14dfda6f533e6fc GIT binary patch literal 1089 zcmV-H1it%6Nk%w1VITk?0OkMy03afP|W&d}4=YJZZjyvFwT_~zc`k)Er>%FkqZjiIl;5K(o%zrQM3b^te9 zd4`jDi=FT9?{#&eq?= z&Da1aLZ`OBD`bS6tF=*bg7@$DY?G-hUVMa=piygoaD&NUadR3gv@04*cpk2HtAZvUIW`(NU|>7P#~?T>bqX|Nt1v+(S;PTf64}~3U<`K* zQ47$GNYff1*Ai|w>^DYkFnuK@BVh*%D~w4xavESj>TdAhksv{a02d;V89-(NkSuI; z@L1#^M-~tO-3&CsF~bdc0~it*00hhu2Mr1pabN>S0CfZnW|*lULdY2te1viHB@CVg z1qgY7;qQyaf-`3(IU!=e3^X@bV92&33(G+gUc?FW@&?kR8L&(l;AaAlsoK7*fT3iN z0U~q%z!>FW1nj{GBFO03AO)K?31H&ra3iS90S#U0+HDYFh8`v}B6JudMca-!L3sT^ zB4-6QuXZzBP@(6_l|57_pkSd5ND(Cl1R*iu`HMTd2E>>~fPf1Z)vU7t(V(D)Y}#Lv z-%h%q%M}DvqCe@fy0r!+#{ZCzBP6+ZHyZ7Ti2>ch3OeWm$Y^af)1M-T0sfWn#*7#Q z57J1*z<<5vB_D7g$Pfy|HD3m001!hA6j%`4eA$42M_Yq1qe%EK|&)k zXh97SJe+Zc4BqwW9T;;c;l(B#Xc2{!1+=56qF~s7#h|Om(1QYaXaIyvU>PAn5irQv z%OD}Npnx28(D6@68rYBn78UUL=^z+{(1R8VC{e2eSZKkAtFJC1!w^jb+eRKz^lI#< HfdBwIq8;my literal 0 HcmV?d00001 diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/loading.gif b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..c69e937232b24ea30f01c68bbd2ebc798dcecfcb GIT binary patch literal 2608 zcmdVcdr(tX9tZGC9yiG~=H_*Q-0%n(kWqP*D#hw{AQu8;1%gl-Hrf&{2?48KX;hHy z3Ze*zEz4t3XdUFyLbNPUYlA`|B}P=N1fqtL1*}S;87#|-W9v<#G;ul(e%d3)N(^9c$d2Dz{7}?ErjNd;{EMKkCsk21~b9Gvg zDo<7L=3Z5HNbVlZUcm1eg#o#CZCJU`3IYHwM->zCd?uYrF3vKFeM}v?f+%s?E>ly|3W25ry9#NNbTx-}0ON58dTrs^ix{_1O0Wh~SVSBlH)Ajn zPn^Gbjz}PCtN@#keR&hK&Dhl-b$kZ8^S)x#dh0{7X=X%CCJk7P1PSO>T&S8I4{#Lg zb5#)o=;!ZP*1nM{cI4@(x7o27*SA()NHmrn67aN@Pmi~(i_SnrjYnwh36aG%!@i0d zqbvfa44f|?OG4ntP|nbjhEl1)Yp6ZN@yjy zy4==QmLy%t;ps3R?~f2KfTTI|2?q8dFd6^z5GF+Xa&Y)sjG)hxit80pPcOP zJ z*LW{SyGHD%hUotV+W%I}fBLAIx!8|7#}$;clKQ+{&FjDqGQ2ZNx(lYM3*%~}ILnao zM`aui55~ZFJlu^!5rdA9Q_7H68H_;##u{x(Yn-vSfIRCb^Nqsg zGRS!Egm>h+o<}LeV4&CLReo9FrDjDvs}8?JwC)#Qs|ie=r?~xUh)&*d`Fx>FG}%X# zNdtDHBKhLPC0wpooFDAQKL%*6T|ULH$=wX!NhcasgD3d;-d$I6yRK3yN+E~C1335_iLOt+*9uvSZ`>*KA}vm}08wRq=>5l|t*Na&jR z-C1&C`nkEk#sB|@yyt-#fXngP04My zm7u$Q%EJbHp`>~`5W&L{W!6`y&}LMS;jfUpgO~7TLVMRZ9IC)IZp0A${`yp0{&wco z#1nx@XMkhqeK%7?RE7JdLr1^nwFfaJ0Q&Lv?WNJ%9}VSJsNY2+UYs2%EU0J~ayFXv zi*?7KCXQHkD)O6!0Q%4N+HTODHxJ{kQSuQX$l-rSwkwh(zMkdfzxyGwl@yHC)C4p< z&n2%8#M?)Q@mgHL1ot8`SFdSEj9ye|jHy+U8#@HoUExG=@AVkRAe_qYm4EpzK6L*& zh`)26?V#f4#_h^P9G^%>h2-H3)$QP zQovu6J9qDvsxqweDdNNa!Lb?L4_UF{tLX_nN7r0U_vF14YKcGR-*Gl} zx3oG)bzf|65dBxD-;2ZCp??K;+TuQ9onnK?==5hzbkb^r_g>z4#D8mcv8(+XdoszA zCx-qhdgxMNMotj}SiL_6V(tLcsK7(M(r(%u<}QrVfOvyK6_;~NOTlPGfX@M7S5YQF z&*$(ylJMHJt^_aQeu{C6NaTE$G3HNN@_SnN8YcaKn%`)F@~L1x+ah7-gEJPpc6w%3 zyX}r+Qk$4RHZzfH){e~F*qJ{d*L8a6n4;U?+{de0-t)mal#TVxe)3F}^UBh+zd T)6_**#cgp_+?JL9(ew3BlNF>u literal 0 HcmV?d00001 diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/media.gif b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/media.gif new file mode 100644 index 0000000000000000000000000000000000000000..e1c0e30afb2587f6d4ed4f8bd90bd4f865a98aa6 GIT binary patch literal 1036 zcmV+n1oQhxNk%w1VITk?0OkMy0A@37!Q*M$LcQvWmF_2mBqn_S(Z}jxMfqHi`g}=qph8>ajebfv(>`m;o;&^Lc|^(|NrX%akkXw-P74|0GZ6czP`)p_nDcQGnvdD zc0~XGnV{C}vBAMgeD0s2|`x$DghH8$$U7>xK#;fx3!ne0y#NE=_*_PMt z_y>GB^Uu$Ge1HG_;FiYa=8%l{_V#|d-OC&c_xDxA;Ovc%k|v_lc$J`Bwb{dadH?@r z@x;Xc|NqR)%}29%<|$If5zj<+@0oSRV;#1JEGEmvzHHo zK^dCR=H%o1@9)CL*8l%AwbJdn)bQZ%_W*P=|NlRu%(O41eiycq}AUsoyi)CnB1Zg8JKLBrW4U~m-5(Hdm1!Wys z4Ipt4096R0e^4V_5gm0MWn~S&2w8n^EmxFg1QETHV3Fir9=USl7#n1P3KbeR3g1gYqk`oMXDUdJ zg6G5<1`H+;N>ZXUoIFKRM`?WK43#rR-li^s2Z;d#4Ac+;Q@Vtg4^vcISU~)S9(%L( zWLR^X0f|Bt4oEkWMfidX7Ld;_BBsr40~!n&k?v(lk}OlwTaZ0F{ggZ!u-tZFNROBM zUII+Xg1(6R|5=FP02TxqAjBatc!2^6bG#4?e-QFV2OWA$Py>NjJb?%pb1?XT9|=uC zM+hX6s0SDm@Nvh5H9Uui3Ue%xR$D%Rv0V{DxbVaieAG~bZi-m(VE{u6@xoO;2%!dP z87{~m1CMu*K}ix#5P6jfD)^wrmPuopT&2f}B#@w_3l8kC!dHw;kpcxC zFu_3*$Ei6%4`Fx^L<(@mDTM+`1d)IeE3BYI0zoLDfE0n!l0^toq+n?ZQiPBNEu1nE G2mm`UjPBh4 literal 0 HcmV?d00001 diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/rm.gif b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/common/rm.gif new file mode 100644 index 0000000000000000000000000000000000000000..d013d551de909a5588a7d81be96aba60089a846b GIT binary patch literal 989 zcmV<310wuKNk%w1VITk?0OkMy0!fO7(d!x1vrw+q9#)Y6nas=J??8L1wang{j*6Pl=&;@Hf}+8--sXvYcn4dU zBZIas|JI-=;-JdPm1R7 z_XtOZ$=c^+!QzqB>;;U(l*HkTz1wT0#bS`RMUul|e~QY(!2kdMA^8La6aaq!EC2ui z03ZM$000O7fPaF6goTEOh>41ei!?V?RW~$@i!&HvFmVtNaWG;SGn9o&UUMfHRWmd+ zGgTNTb6!fKe>V^(Kr~9MGrhVrKqnA4lvV%^Sy?yB%+1LT09K1P0DE**6clA;Of@x3 z+u0O!djQ0UN@EigKM1Af(LLXatAr11&%Z_h6`n=>lNV z^yR^)?+hs*-k51&=*gSwS6oPNys-?J0@t4$no{7-ofRFn=RGLr!Ik$@5FIFD9txBn z7M?WOueJ%1BS+j(!~uzL0pNXFXt9P6FFe80K`&@QMu1!_ase4+D7eNCYj9!J0d{nt zMFeDAKuH55?C?V!b#MU{14O9s!ww@fAW8`zEI@_;P6WUJ16{~Y*f4+wG9-Cp2n1B1!4Q40z(OBGXixzGA!td9AaI}%LI{5N@g@pz LtZAnrfdBwIov+u= literal 0 HcmV?d00001 diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/default/background.png b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/default/background.png new file mode 100644 index 0000000000000000000000000000000000000000..bbfb056bd3e3bc7e7ada31f2ac3cb6ea37fc58b9 GIT binary patch literal 788 zcmeAS@N?(olHy`uVBq!ia0y~yVAKJ!w{S26Ny&!~?*b|2VkgfK4i1jn5B(nixr+jP zLR|m<|NrmbzrTO~{`vC4eT^vIy=DfX`88q2Zr0pWNp^$=r z0nahU!Y*Mg#l-*7n=jvVs879nXxq7)2X248^7s13rnHY&_+NO&T=H4NctlEJU545< zhK&nmMlc`Ap4DmUuxBBNX$@vBkE{VpsLwh&DeYrxS`x3o{S2}DnPTcD-4~z!J-n=Z z;u;^DJMn#wvNoTY_sd?#Jba_o&DZf|E3Aq(b$z{8_kUCJ+pudJ@5z7Fx4xE_Dm**= z{O{?q+1rDXde#1(?hAF_Hr>?jReaeRDd|qo#uBpGd@zseXN37<2*S8Ln zwba?zw+^Urb)U@Ch~w*jfmzcdE^h~GSf+aI*fFE{LBXNS0A;gW&_3$VbD;2Uw+L;!7@*W4txEcY@d*F`AcdHT8{004J`5a-_{zRQsOk8r#c z;Rb|+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$+AsoOcl0 zR;n}6BPuBR zt1aH?s=B*aV8In~9?X0F{Zq7EpgEEVph==5SF|ZN<*hcgmj%l~7HP&s+5C#!=gxMk zx&d=5-DEO%wWm#Zf-EU+tc~7-u0}}+*;?1kFW|lSPBPunFwmaW^e3uX;syVU1COox zaD;!I^P3hwZ-4fzU)|ROY>z}-y2jT7@_(a$V?9i~o`0XewjNl0pHPIyh#fs!Nl_Y{ zYa}&?$I)fv8IiVQ?`nvf#;lO*K-Dp7*Cb3tf%{Vo?b!nw2J3Ng{f;UyV__&|EK|4Z1BfYYYl^!!!jBO8tJytO@d$(MiMK>%D?Td79T3h_T7hH#ny literal 0 HcmV?d00001 diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/qq/editor.gif b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/qq/editor.gif new file mode 100644 index 0000000000000000000000000000000000000000..b256841f3088117a98b969499784042bab41aeca GIT binary patch literal 1449 zcmV;a1y=e;Nk%w1VL$>90M$PLQia8GoX|62nLBW?f~M5g+~Q1v!`Ir}#@Fmee!?zP zh+U1zmb2M1O>e8g;1W5WgsIkUn$Ip`%2$fVXMn^#bhsNcP%c~9LU_GjdBU~IL&`rMETD?m}ueX??hjiOzpp!m?j@drmO88u=IIcuapktQofL6Om9 zlnpU3=)x$aWkr|!ZjLRGtHu(6ln;RftGGxJA%N`& zB3!hPVK$<~K3mqbjTQ**Wh4;j?t!p}uD+aU3*p3)vL@2CO@zgW@33^N#Dz#wk2xug@*QIr;sbl%D3g@yevA{5qO(~K1eoM}ioR&X#O0XO)7 zC>}k1iN$(*CgI+kSUe&`4IOx}g9rC5+2j>lWz-reRe*J%2q`SIzyw-Cq+p#->}Q4# zF}^iMr9Y_9g9^Z^K!X7^1nVmeT%t%#6@roYClqeYl;aaH$uuS}8eNzxIp6R)VWWYR zQ|WoS0bydH7?X}U^)0D=w|T#%%iqME>NYuB9`8x$>wa8RoXF$6%Ydp?LATGHbA zgs*#?s|T{yMQ10C)X~ZW1B4l-Fd9ganG+En>$q9DlM2PI5qYfe0|!A?Q2+)+((phA z2T(9Cy%~)vg?|DJ!LvY8oU&@a2f`vNN+Cy~1s7}h0+)0hWBbIj%qqK#)e#@;#5mlE zV@}s153=!Ol48N~9_(Qu015=H@PGmZ+|16LV>f|q(o0P6!UCwYus~S`I3RezUZ%57 z7JpRs+u;ZkwF~2oSUjubjZ6FlG<~8G$s}!DL~*S;P0PgR6Wdy`=}{=4z+)>k5W)dT zLf%Bn=%v%f#0a?OuKNhJL+FG<6UZREE3X7DdlGu0SN9MABrrh2wOCf3(R2Ag z1jrcz4&fr|GN2ohS30~+PHIoc9OaS_0{~d-2c)yx0d;aK4zBMF69nDZ&}Anikgy3S zNTCW>s6s&~@EkAPN9PRl!5Yc|V;EEe>TJlv9@5YvNOQ@_kmti98u5rnh#?ZO69fP| DK<${p literal 0 HcmV?d00001 diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/qq/qq.css b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/qq/qq.css new file mode 100644 index 000000000..a45e08c69 --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/qq/qq.css @@ -0,0 +1,143 @@ +/* container */ +.ke-container-qq { + display: block; + border: 1px solid #c3c3c3; + background-color: #FFF; + overflow: hidden; + margin: 0; + padding: 0; +} +/* toolbar */ +.ke-container-qq .ke-toolbar { + border-bottom: 1px solid #c3c3c3; + background-color: #FFFFFF; + padding: 2px 5px; + text-align: left; + overflow: hidden; + zoom: 1; +} +.ke-toolbar-icon-url { + background-image: url(editor.gif); + width:18px; + *xwidth:20px; + height:18px; + *xheight:20px; +} +.ke-icon-checked{ + background-image: url(../default/default.png); + width:16px; + height:16px; +} +.ke-container-qq .ke-icon-bold{ + background-position: 4px 1px; +} +.ke-container-qq .ke-icon-italic{ + background-position: -27px 1px; +} +.ke-container-qq .ke-icon-italic{ + background-position: -28px 1px; +} +.ke-container-qq .ke-icon-underline{ + background-position: -60px 1px; +} +.ke-container-qq .ke-icon-fontname{ + background-position: -95px 1px; +} +.ke-container-qq .ke-icon-fontsize{ + background-position: -128px 1px; +} +.ke-container-qq .ke-icon-forecolor{ + background-position: -159px 1px; +} +.ke-container-qq .ke-icon-hilitecolor{ + background-position: -190px 1px; +} +.ke-container-qq .ke-icon-plug-align{ + background-position: -223px 1px; +} +.plug-align-justifyleft{ + background-position: -350px 1px; +} +.plug-align-justifycenter{ + background-position: -382px 1px; +} +.plug-align-justifyright{ + background-position: -414px 1px; +} +.plug-order-insertorderedlist{ + background-position: -446px 1px; +} +.plug-order-insertunorderedlist{ + background-position: -477px 1px; +} +.plug-indent-indent{ + background-position: -513px 1px; +} +.plug-indent-outdent{ + background-position: -545px 1px; +} +.ke-container-qq .ke-icon-plug-order{ + background-position: -255px 1px; +} +.ke-container-qq .ke-icon-plug-indent{ + background-position: -287px 1px; +} +.ke-container-qq .ke-icon-link{ + background-position: -319px 1px; +} + +.ke-container-qq .ke-toolbar .ke-outline { + cursor: default; + padding:0px; + border:1px solid #fff; +} +.ke-container-qq .ke-toolbar .ke-on { + border-left:1px solid white; + border-top:1px solid white; + border-right:1px solid gray; + border-bottom:1px solid gray; + background-color: #FFFFFF; +} +.ke-container-qq .ke-toolbar .ke-selected { + border-left:1px solid gray; + border-top:1px solid gray; + border-right:1px solid white; + border-bottom:1px solid white; + background-color: #FFFFFF; +} +.ke-container-qq .ke-toolbar .ke-disabled { + cursor: default; +} + +.ke-colorpicker-qq{ + background:#fff; +} +/* statusbar */ +.ke-container-qq .ke-statusbar { + display:none; +} +/* menu */ +.ke-menu-qq { + border:1px solid #a6a6a6; + position:absolute; + background:#fff; + -moz-box-shadow:2px 2px 4px #DDDDDD; + z-index:999; + left:-400px; + top:-386px; + right:218px; + width:130px; +} +.ke-menu-qq .ke-menu-item { + padding:0px; + background:#fff; +} +.ke-menu-qq .ke-menu-item-on { + border:1px solid #000080;background:#FFEEC2;color:#036; +} +.ke-menu-qq .ke-toolbar .ke-selected { + border:1px solid #9a9afb; +} +.ke-menu-qq .ke-menu-item-left{ + width:auto; +} diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/simple/simple.css b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/simple/simple.css new file mode 100644 index 000000000..4c76cf9d7 --- /dev/null +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/simple/simple.css @@ -0,0 +1,100 @@ +/* container */ +.ke-container-simple { + display: block; + border: 1px solid #CCC; + background-color: #FFF; + overflow: hidden; +} +/* toolbar */ +.ke-container-simple .ke-toolbar { + border-bottom: 1px solid #CCC; + background-color: #FFF; + padding: 2px 5px; + overflow: hidden; +} +.ke-container-simple .ke-toolbar .ke-outline { + border: 1px solid #FFF; + background-color: transparent; + margin: 1px; + padding: 1px 2px; + font-size: 0; + line-height: 0; + overflow: hidden; + cursor: pointer; +} +.ke-container-simple .ke-toolbar .ke-on { + border: 1px solid #5690D2; +} +.ke-container-simple .ke-toolbar .ke-selected { + border: 1px solid #5690D2; + background-color: #E9EFF6; +} +.ke-container-simple .ke-toolbar .ke-disabled { + cursor: default; +} +/* statusbar */ +.ke-container-simple .ke-statusbar { + position: relative; + background-color: #FFF; + border-top: 1px solid #CCCCCC; + font-size: 0; + line-height: 0; + *height: 12px; + overflow: hidden; + text-align: center; + cursor: s-resize; +} +/* menu */ +.ke-menu-simple { + border: 1px solid #A0A0A0; + background-color: #FFF; + color: #222222; + padding: 2px; + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + text-align: left; + overflow: hidden; +} +.ke-menu-simple .ke-menu-item { + border: 1px solid #FFF; + background-color: #FFF; + color: #222222; + height: 24px; + overflow: hidden; + cursor: pointer; +} +.ke-menu-simple .ke-menu-item-on { + border: 1px solid #5690D2; + background-color: #FFF; +} +/* colorpicker */ +.ke-colorpicker-simple { + border: 1px solid #A0A0A0; + background-color: #FEFEFE; + color: #222222; + padding: 2px; +} +.ke-colorpicker-simple .ke-colorpicker-cell { + font-size: 0; + line-height: 0; + border: 1px solid #FEFEFE; + cursor: pointer; + margin:3px; + padding:0; +} +.ke-colorpicker-simple .ke-colorpicker-cell-top { + font-family: "sans serif",tahoma,verdana,helvetica; + font-size: 12px; + line-height: 24px; + border: 1px solid #FEFEFE; + cursor: pointer; + margin:0; + padding:0; + text-align: center; +} +.ke-colorpicker-simple .ke-colorpicker-cell-on { + border: 1px solid #5690D2; +} +.ke-colorpicker-simple .ke-colorpicker-cell-selected { + border: 1px solid #2446AB; +} diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index e58e4b2be..e39c6e19e 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -258,14 +258,13 @@ K.options = { minChangeSize : 50, zIndex : 811213, items : [ - 'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste', + 'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', - 'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/', + 'superscript', 'quickformat', 'fullscreen','|', '/', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', - 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'multiimage', - 'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak', - 'anchor', 'link', 'unlink', '|', 'about' + 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak', + 'anchor', 'link', '|' ], noDisableItems : ['source', 'fullscreen'], colorTable : [ @@ -3533,11 +3532,11 @@ function _getInitHtml(themesPath, bodyClass, cssPath, cssData) { (_direction === '' ? '' : ''), '', ' +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> From c704ba71d9bd15078a26f25d6712426c90d8aec9 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 16:18:34 +0800 Subject: [PATCH 22/24] =?UTF-8?q?=E6=8F=90=E5=87=BA=E6=8C=89ckeditor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/forums/show.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 85fa8093a..2f4ec56a0 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -6,13 +6,14 @@ <% if User.current.logged? %> <%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %>
+ <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>

<%= f.text_field :subject, :required => true, :maxlength => 50%>

- <%= f.text_area :content, :required => true, :id => 'editor02' %> + <%= f.kindeditor :content, :required => true %>

- +

(<%= l(:label_memos_max_length) %>)

From 0de09e3b36294a14335d6d0b02a886ed390132cd Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 16:20:04 +0800 Subject: [PATCH 23/24] =?UTF-8?q?=E5=B0=86editor=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=8C=87=E5=90=91=E6=9C=AC=E5=B7=A5=E7=A8=8Blib=E4=B8=8B?= =?UTF-8?q?=E7=9A=84editor=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 29b2716a9..fb0312d5b 100644 --- a/Gemfile +++ b/Gemfile @@ -23,7 +23,7 @@ gem 'ruby-ole' #gem 'email_verifier', path: 'lib/email_verifier' gem 'rufus-scheduler' #gem 'dalli', path: 'lib/dalli-2.7.2' -gem 'rails_kindeditor' +gem 'rails_kindeditor',path:'lib/rails_kindeditor' group :development do gem 'grape-swagger' #gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git' From 04c064ddc8b687bfd31ba2f1b0247ebf701aceb2 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 26 Mar 2015 16:22:16 +0800 Subject: [PATCH 24/24] nothing --- db/schema.rb | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index bad1cf2ae..b676abe7f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150305081132) do +ActiveRecord::Schema.define(:version => 20150324021043) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -422,6 +422,13 @@ ActiveRecord::Schema.define(:version => 20150305081132) do add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id" add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized" + create_table "discuss_demos", :force => true do |t| + t.string "title" + t.text "body" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false @@ -631,6 +638,16 @@ ActiveRecord::Schema.define(:version => 20150305081132) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_details_copy", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" @@ -671,6 +688,17 @@ ActiveRecord::Schema.define(:version => 20150305081132) do t.integer "is_comprehensive_evaluation" end + create_table "kindeditor_assets", :force => true do |t| + t.string "asset" + t.integer "file_size" + t.string "file_type" + t.integer "owner_id" + t.string "asset_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "owner_type", :default => 0 + end + create_table "member_roles", :force => true do |t| t.integer "member_id", :null => false t.integer "role_id", :null => false @@ -1041,12 +1069,12 @@ ActiveRecord::Schema.define(:version => 20150305081132) do end create_table "roles", :force => true do |t| - t.string "name", :limit => 30, :default => "", :null => false - t.integer "position", :default => 1 - t.boolean "assignable", :default => true - t.integer "builtin", :default => 0, :null => false + t.string "name", :limit => 90 + t.integer "position" + t.boolean "assignable" + t.integer "builtin" t.text "permissions" - t.string "issues_visibility", :limit => 30, :default => "default", :null => false + t.string "issues_visibility", :limit => 90 end create_table "schools", :force => true do |t|