diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 17f179492..85c01bcbd 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -133,8 +133,9 @@ class StudentWorkController < ApplicationController format.js format.html format.xls { + filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_homework_list)}.xls" send_data(homework_to_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present", - :filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_homework_list)}.xls") + :filename => filename_for_content_disposition(filename)) } end end @@ -386,8 +387,9 @@ class StudentWorkController < ApplicationController end respond_to do |format| format.xls { + filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_absence_list)}.xls" send_data(absence_penalty_list_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present", - :filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_absence_list)}.xls") + :filename => filename_for_content_disposition(filename)) } end end @@ -396,8 +398,9 @@ class StudentWorkController < ApplicationController def evaluation_list respond_to do |format| format.xls { + filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_evaluation_list)}.xls" send_data(evaluation_list_xls(@homework.student_works), :type => "text/excel;charset=utf-8; header=present", - :filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_evaluation_list)}.xls") + :filename => filename_for_content_disposition(filename)) } end end diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index 41ae5f335..3d1ded552 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -1,4 +1,4 @@ -<% if course && tag_list.empty? == false%> +<% if course && tag_list && tag_list.empty? == false%> 5000){ - $("#error").html("内容 过长(最长为 5000 个字符)").show(); - return false; - } +// if(memo_content.html().trim().length > 5000){ +// $("#error").html("内容 过长(最长为 5000 个字符)").show(); +// return false; +// } return true; } diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb index 136e49b37..66d25a4b1 100644 --- a/app/views/layouts/_new_feedback.html.erb +++ b/app/views/layouts/_new_feedback.html.erb @@ -22,7 +22,7 @@ <% end %>
- + <%= l(:label_technical_support) %>白   羽
diff --git a/app/views/memos/edit.html.erb b/app/views/memos/edit.html.erb index 1ac86cf55..7ab460555 100644 --- a/app/views/memos/edit.html.erb +++ b/app/views/memos/edit.html.erb @@ -7,10 +7,10 @@ $("#error").html('主题不能超过50个字符').show(); return; } - if(memo_content.html().trim().length > 5000 ){ - $("#error").html('内容不能超过5000个字符').show(); - return; - } +// if(memo_content.html().trim().length > 5000 ){ +// $("#error").html('内容不能超过5000个字符').show(); +// return; +// } memo_content.sync(); $("#edit_memo").submit(); }else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.html().trim() != "" ){ diff --git a/db/schema.rb b/db/schema.rb index 3c1271dfb..4f3e5a018 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 => 20151014013243) do +ActiveRecord::Schema.define(:version => 20150930011457) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -497,26 +497,23 @@ ActiveRecord::Schema.define(:version => 20151014013243) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 + create_table "dts", :force => true do |t| + t.string "IPLineCode" t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "enabled_modules", :force => true do |t| @@ -1320,9 +1317,9 @@ ActiveRecord::Schema.define(:version => 20151014013243) do create_table "student_work_tests", :force => true do |t| t.integer "student_work_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "status", :default => 9 + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.text "results" t.text "src" end @@ -1570,6 +1567,7 @@ ActiveRecord::Schema.define(:version => 20151014013243) do t.string "identity_url" t.string "mail_notification", :default => "", :null => false t.string "salt", :limit => 64 + t.integer "gid" end add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" diff --git a/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb b/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb index d7d5948d4..0e1177563 100644 --- a/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb +++ b/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb @@ -13,7 +13,7 @@ class Kindeditor::AssetsController < ApplicationController logger.warn '========= Warning: the owner_id is 0, "delete uploaded files automatically" will not work. =========' if defined?(logger) && @asset.owner_id == 0 @asset.asset_type = @dir if @asset.save - render :text => ({:error => 0, :url => "http://"+Setting.host_name + "/" + @asset.asset.url,:asset_id => @asset.id}.to_json) + render :text => ({:error => 0, :url => @asset.asset.url,:asset_id => @asset.id}.to_json) else show_error(@asset.errors.full_messages) end diff --git a/public/assets/kindeditor/pasteimg.js b/public/assets/kindeditor/pasteimg.js index c413bbcb9..767cefb09 100644 --- a/public/assets/kindeditor/pasteimg.js +++ b/public/assets/kindeditor/pasteimg.js @@ -277,7 +277,10 @@ https://github.com/layerssss/paste.js if (!img["_paste_marked_" + timespan]) { cb(img.src); } - _results.push($(img).remove()); + //firefox问题处理,因为采用了 pastableContenteditable 模式,故只需要删除默认的粘贴 + if ($(img).attr('src').startsWith('data:image/')) { + _results.push($(img).remove()); + }; } return _results; }; @@ -290,10 +293,9 @@ https://github.com/layerssss/paste.js }).call(this); -function enablePasteImg(_editor) { - var editor = _editor, +KindEditor.plugin('paste', function(K) { + var editor = this, name = 'paste'; - //òƶ༭Ͳͻ if(editor.edit == undefined || editor.edit.iframe == undefined){ return; } @@ -303,7 +305,7 @@ function enablePasteImg(_editor) { var nodeBody = contentWindow.document.getElementsByTagName('body')[0]; console.log(nodeBody); $(nodeBody).pastableContenteditable(); - + dataURItoBlob = function(dataURI) { // convert base64/URLEncoded data component to raw binary data held in a string var byteString; @@ -329,7 +331,6 @@ function enablePasteImg(_editor) { console.log("dataURL: " + data.dataURL); console.log("width: " + data.width); console.log("height: " + data.height); - console.log(data.blob); var blob = dataURItoBlob(data.dataURL); if (data.blob !== null) { var data = new FormData(); @@ -342,6 +343,7 @@ function enablePasteImg(_editor) { data: data, processData: false, success: function(data) { + console.log(data); editor.exec('insertimage', JSON.parse(data).url); } }); @@ -349,37 +351,5 @@ function enablePasteImg(_editor) { }); return; - contentWindow.document.getElementsByTagName('body')[0].onpaste = function(event) { - // use event.originalEvent.clipboard for newer chrome versions - var items = (event.clipboardData || event.originalEvent.clipboardData).items; - console.log(JSON.stringify(items)); // will give you the mime types - // find pasted image among pasted items - var blob = null; - for (var i = 0; i < items.length; i++) { - if (items[i].type.indexOf("image") === 0) { - blob = items[i].getAsFile(); - } - } - // load image if there is a pasted image - if (blob !== null) { - var reader = new FileReader(); - reader.onload = function(event) { - console.log(event.target.result); // data url! - var data = new FormData(); - data.append("imgFile", blob, "imageFilename.png"); - console.log(blob); - $.ajax({ - url: '/kindeditor/upload?dir=image', - contentType: false, - type: 'POST', - data: data, - processData: false, - success: function(data) { - editor.exec('insertimage', JSON.parse(data).url); - } - }); - }; - reader.readAsDataURL(blob); - } - } -}; + +}); diff --git a/public/assets/kindeditor/plugins/paste/paste.js b/public/assets/kindeditor/plugins/paste/paste.js index 943c0bbe7..767cefb09 100644 --- a/public/assets/kindeditor/plugins/paste/paste.js +++ b/public/assets/kindeditor/plugins/paste/paste.js @@ -277,7 +277,10 @@ https://github.com/layerssss/paste.js if (!img["_paste_marked_" + timespan]) { cb(img.src); } - _results.push($(img).remove()); + //firefox问题处理,因为采用了 pastableContenteditable 模式,故只需要删除默认的粘贴 + if ($(img).attr('src').startsWith('data:image/')) { + _results.push($(img).remove()); + }; } return _results; }; @@ -293,7 +296,6 @@ https://github.com/layerssss/paste.js KindEditor.plugin('paste', function(K) { var editor = this, name = 'paste'; - //òƶ༭Ͳͻ if(editor.edit == undefined || editor.edit.iframe == undefined){ return; } @@ -303,7 +305,7 @@ KindEditor.plugin('paste', function(K) { var nodeBody = contentWindow.document.getElementsByTagName('body')[0]; console.log(nodeBody); $(nodeBody).pastableContenteditable(); - + dataURItoBlob = function(dataURI) { // convert base64/URLEncoded data component to raw binary data held in a string var byteString; @@ -329,7 +331,6 @@ KindEditor.plugin('paste', function(K) { console.log("dataURL: " + data.dataURL); console.log("width: " + data.width); console.log("height: " + data.height); - console.log(data.blob); var blob = dataURItoBlob(data.dataURL); if (data.blob !== null) { var data = new FormData(); @@ -342,6 +343,7 @@ KindEditor.plugin('paste', function(K) { data: data, processData: false, success: function(data) { + console.log(data); editor.exec('insertimage', JSON.parse(data).url); } }); @@ -349,37 +351,5 @@ KindEditor.plugin('paste', function(K) { }); return; - contentWindow.document.getElementsByTagName('body')[0].onpaste = function(event) { - // use event.originalEvent.clipboard for newer chrome versions - var items = (event.clipboardData || event.originalEvent.clipboardData).items; - console.log(JSON.stringify(items)); // will give you the mime types - // find pasted image among pasted items - var blob = null; - for (var i = 0; i < items.length; i++) { - if (items[i].type.indexOf("image") === 0) { - blob = items[i].getAsFile(); - } - } - // load image if there is a pasted image - if (blob !== null) { - var reader = new FileReader(); - reader.onload = function(event) { - console.log(event.target.result); // data url! - var data = new FormData(); - data.append("imgFile", blob, "imageFilename.png"); - console.log(blob); - $.ajax({ - url: '/kindeditor/upload?dir=image', - contentType: false, - type: 'POST', - data: data, - processData: false, - success: function(data) { - editor.exec('insertimage', JSON.parse(data).url); - } - }); - }; - reader.readAsDataURL(blob); - } - } + }); diff --git a/public/images/blue_line.png b/public/images/blue_line.png index 4ae87f343..b7654fb6a 100644 Binary files a/public/images/blue_line.png and b/public/images/blue_line.png differ diff --git a/public/javascripts/init_activity_KindEditor.js b/public/javascripts/init_activity_KindEditor.js index db871e723..977c62117 100644 --- a/public/javascripts/init_activity_KindEditor.js +++ b/public/javascripts/init_activity_KindEditor.js @@ -26,7 +26,7 @@ function init_editor(params){ if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){ params.submit_btn.hide(); this.resize("94%", null); - }else if(edit.html().val().trim() != ""){ + }else if(this.edit.html().trim() != ""){ params.submit_btn.show(); }