From f4e30f77cc61b1b75f728ddd703ce4cc75160965 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 10 Jan 2015 10:55:37 +0800 Subject: [PATCH 1/7] =?UTF-8?q?1.=E6=89=93=E5=8C=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=8D=95=E8=8E=B7=E5=8E=BB=E9=99=A4=202.?= =?UTF-8?q?=E6=89=93=E5=8C=85=E4=B8=8B=E8=BD=BD=E5=AF=BB=E6=89=BE=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E3=80=81=E9=A1=B9=E7=9B=AE=E6=96=B9=E6=B3=95=E9=9A=90?= =?UTF-8?q?=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 12637e2fb..ac8a74379 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -7,17 +7,6 @@ class ZipdownController < ApplicationController SAVE_FOLDER = "#{Rails.root}/files" OUTPUT_FOLDER = "#{Rails.root}/tmp/archiveZip" - #通过作业Id找到项目(课程) - def find_project_by_bid_id - obj_class = params[:obj_class] - obj_id = params[:obj_id] - obj = obj_class.constantize.find(obj_id) - case obj.class.to_s.to_sym - when :Bid - @project = obj.courses[0] - end - end - def assort if params[:obj_class] == "Bid" bid = Bid.find params[:obj_id] @@ -33,8 +22,8 @@ class ZipdownController < ApplicationController end send_file zipfile, :filename => bid.name + ".zip", :type => detect_content_type(zipfile) if zipfile - rescue Exception => e - render file: 'public/no_file_found.html' + #rescue Exception => e + # render file: 'public/no_file_found.html' end #下载某一学生的作业的所有文件 @@ -56,12 +45,23 @@ class ZipdownController < ApplicationController else render_403 end - rescue => e - render file: 'public/file_not_found.html' + #rescue => e + # render file: 'public/file_not_found.html' end private + #通过作业Id找到项目(课程) + def find_project_by_bid_id + obj_class = params[:obj_class] + obj_id = params[:obj_id] + obj = obj_class.constantize.find(obj_id) + case obj.class.to_s.to_sym + when :Bid + @project = obj.courses[0] + end + end + def zip_bid(bid) # Todo: User Access Controll bid_homework_path = [] @@ -113,9 +113,9 @@ class ZipdownController < ApplicationController end end zipfile_name - rescue Errno => e - logger.error "[zipdown#zipping] ===> #{e}" - @error = e + #rescue Errno => e + # logger.error "[zipdown#zipping] ===> #{e}" + # @error = e end def detect_content_type(name) content_type = Redmine::MimeType.of(name) From 477f4801751dbb6e863606f5e5971e7b0da0045a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 10 Jan 2015 16:06:33 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0EXCEL=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E7=9A=84gem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index 634af9683..498a4fca6 100644 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,8 @@ gem "coderay", "~> 1.0.6" gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] gem "builder", "3.0.0" gem 'acts-as-taggable-on', '2.4.1' +gem 'spreadsheet' +gem 'ruby-ole' group :development do gem 'better_errors', path: 'lib/better_errors' From 41679a8d5c04463883174f3ace0d158d30b317f0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 10 Jan 2015 16:20:36 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E6=97=B6=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/zh.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index d6e7815f9..36c26625e 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2239,5 +2239,5 @@ zh: label_course_prompt: 课程: label_contain_resource: 已包含资源: label_quote_resource_failed: ",此资源引用失败! " - label_file_lost: 以下文件在服务器丢失,请联系相关人员重新上传: + label_file_lost: 以下无法成功下载,请联系相关人员重新上传: From bf7eaa7a8084f76c0189f8f0279b1528161970d8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 10 Jan 2015 17:41:50 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=AD=A6=E7=94=9F=E6=8F=90=E4=BA=A4=E7=9B=B8=E5=90=8C?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6=E5=90=8E=EF=BC=8C=E6=89=93=E5=8C=85?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=BC=82=E5=B8=B8=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 12 +++++++++++- config/locales/zh.yml | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index ac8a74379..b329e4c27 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -101,10 +101,20 @@ class ZipdownController < ApplicationController Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile| input_filename.each do |filename| + flag = true + index = 1 rename_file = ic.iconv( (File.basename(filename)) ).to_s rename_file = ic.iconv( filename_to_real( File.basename(filename))).to_s if is_attachment - zipfile.add(rename_file, filename) + begin + zipfile.add(rename_file, filename) + flag = false + rescue Exception => e + zipfile.get_output_stream('FILE_NOTICE.txt') do |os| + os.write l(:label_file_exist) + end + next + end end unless not_exist_file.empty? zipfile.get_output_stream('FILE_LOST.txt') do |os| diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 36c26625e..568a60cac 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2240,4 +2240,5 @@ zh: label_contain_resource: 已包含资源: label_quote_resource_failed: ",此资源引用失败! " label_file_lost: 以下无法成功下载,请联系相关人员重新上传: + label_file_exist: 该作品中有重复命名文件,请通过文件名学号和姓名信息进入该作业详细界面手动下载 From 197068a2e2091b4818dce8257321d3b47edcc08d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 12 Jan 2015 15:44:56 +0800 Subject: [PATCH 5/7] 111 --- db/schema.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index eea50de35..9c6f4eac3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -831,8 +831,9 @@ ActiveRecord::Schema.define(:version => 20150112024820) do t.integer "user_id" t.datetime "published_at" t.datetime "closed_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.text "polls_description" end create_table "praise_tread_caches", :force => true do |t| From 6efe9ff5c6116c3a9a46de9847971179b740fc20 Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 12 Jan 2015 17:34:26 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=8E=89=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E6=96=B9=E6=B3=95=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0fcf35aff..7b4d488a9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -41,7 +41,7 @@ class UsersController < ApplicationController :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index] before_filter :auth_user_extension, only: :show - before_filter :rest_user_score, only: :show + #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx From 90925edce29199019eb1176bac9fc3297230d785 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 12 Jan 2015 17:56:09 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E6=84=8F?= =?UTF-8?q?=E8=A7=81=E5=8F=8D=E9=A6=88=E9=A1=B5=E9=9D=A2css=E5=BC=95?= =?UTF-8?q?=E8=B5=B7=E7=9A=84css=E9=94=99=E4=B9=B1=E3=80=8B=E5=92=8C?= =?UTF-8?q?=E3=80=8A=E8=AF=BE=E7=A8=8B=E9=A6=96=E9=A1=B5=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=A4=AA=E5=B0=91=E3=80=8Bbug=20Signed-off-by:=20alan=20<54753?= =?UTF-8?q?3434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_feedback.html.erb | 6 +++--- .../lib/acts_as_activity_provider.rb | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index 859ed0361..62b3a01e3 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -62,7 +62,7 @@ function f_submit()