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 2b59f2fc445b2b471e0101e78cbaa11f2271fb68 Mon Sep 17 00:00:00 2001 From: zhuhao Date: Mon, 12 Jan 2015 14:19:51 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BC=B9=E7=AA=97=E6=8C=89=E9=92=AE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/resource.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/resource.css b/public/stylesheets/resource.css index 885423143..f0f969b4a 100644 --- a/public/stylesheets/resource.css +++ b/public/stylesheets/resource.css @@ -118,7 +118,7 @@ a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;} .upload_con { } .upload_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; margin-top:25px; padding-left:20px; padding-top:5px;} .upload_box{ width:430px; margin:15px auto;} -a.upload_btn{ display:block; float:left; margin-top:15px; width:80px; height:30px; text-align: center; color:#fff; font-size:14px; background:#15bccf; margin-right:15px;} +a.upload_btn{ display:block; float:left; margin-top:15px; width:80px; height:30px; text-align: center; color:#fff; font-size:14px; background:#15bccf; margin-right:15px;padding-top: 10px;} a:hover.upload_btn{ background:#55a1b9;} a.upload_btn_grey{background:#a3a3a3;} a:hover.upload_btn_grey{background:#8a8a8a;} From 9f807438d6bbc3ee035b0f396d625327fb1756a1 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 12 Jan 2015 14:58:11 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=95=99=E5=B8=88=E6=95=B0=E7=9B=AE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=EF=BC=9A-1=20=EF=BC=8C=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=A4=A7=E9=87=8F=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E3=80=82=E6=98=AF=E4=B8=8D=E6=98=AF=E5=8F=AA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E8=BF=91=E6=9C=9F3=E4=B8=AA=E6=9C=88=E7=9A=84=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: alan <547533434@qq.com> --- Gemfile | 24 +++++++++---------- app/controllers/courses_controller.rb | 4 ++-- app/controllers/projects_controller.rb | 8 +++---- app/views/welcome/_search_course.html.erb | 2 +- app/views/welcome/_search_project.html.erb | 2 +- .../20150112024820_add_data_for_members.rb | 10 ++++++++ db/schema.rb | 2 +- .../lib/acts_as_activity_provider.rb | 16 +++++++++---- lib/redmine/activity/fetcher.rb | 4 ++-- 9 files changed, 44 insertions(+), 28 deletions(-) create mode 100644 db/migrate/20150112024820_add_data_for_members.rb diff --git a/Gemfile b/Gemfile index 6bb141404..6c2101345 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'http://ruby.taobao.org' +source 'http://rubygems.org' #source 'http://ruby.sdutlinux.org/' unless RUBY_PLATFORM =~ /w32/ @@ -33,21 +33,21 @@ group :test do gem 'selenium-webdriver', '~> 2.42.0' - platforms :mri, :mingw do - group :rmagick do - # RMagick 2 supports ruby 1.9 - # RMagick 1 would be fine for ruby 1.8 but Bundler does not support - # different requirements for the same gem on different platforms - gem "rmagick", ">= 2.0.0" - end - end + # platforms :mri, :mingw do + # group :rmagick do + # # RMagick 2 supports ruby 1.9 + # # RMagick 1 would be fine for ruby 1.8 but Bundler does not support + # # different requirements for the same gem on different platforms + # gem "rmagick", ">= 2.0.0" + # end + #end end group :development, :test do - gem "guard-rails", '~> 0.5.3' + # gem "guard-rails", '~> 0.5.3' gem 'spork-testunit', '~> 0.0.8' - gem 'guard-spork', '~> 1.5.1' - gem 'guard-test', '~> 1.0.0' + # gem 'guard-spork', '~> 1.5.1' + # gem 'guard-test', '~> 1.0.0' gem 'ruby-prof', '~> 0.15.1' unless RUBY_PLATFORM =~ /w32/ gem 'pry' gem 'pry-nav' diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index e76fa31dc..9d35b9fb0 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -810,9 +810,9 @@ class CoursesController < ApplicationController # modify by nwb # 添加私密性判断 if User.current.member_of_course?(@course)|| User.current.admin? - events = @activity.events(@date_from, @date_to) + events = @activity.events(@days, @course.created_at) else - events = @activity.events(@date_from, @date_to, :is_public => 1) + events = @activity.events(@days, @course.created_at, :is_public => 1) end # 无新动态时,显示老动态 diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 0b7cbbb5f..5d43a4e20 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -597,8 +597,8 @@ class ProjectsController < ApplicationController "show_wiki_edits"=>true, "show_journals_for_messages" => true } - @date_to ||= Date.today + 1 - @date_from = @date_to - @days-1.years + + @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) # 决定显示所用用户或单个用户活动 @@ -612,9 +612,9 @@ class ProjectsController < ApplicationController # modify by nwb # 添加私密性判断 if User.current.member_of?(@project)|| User.current.admin? - events = @activity.events(@date_from, @date_to) + events = @activity.events(@days) else - events = @activity.events(@date_from, @date_to, :is_public => 1) + events = @activity.events(@days,nil, :is_public => 1) end @offset, @limit = api_offset_and_limit({:limit => 10}) diff --git a/app/views/welcome/_search_course.html.erb b/app/views/welcome/_search_course.html.erb index 5721af9fb..895f696fb 100644 --- a/app/views/welcome/_search_course.html.erb +++ b/app/views/welcome/_search_course.html.erb @@ -49,7 +49,7 @@ form #search_type{ <%= form_tag({controller: :welcome, action: :search }, method: :get) do %>