From c331e5a9c8933064f8460de75e6cbec8a5805b42 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 3 Jun 2015 17:42:41 +0800 Subject: [PATCH 001/130] =?UTF-8?q?=E8=BD=AChtml=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E8=BD=ACpdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 13 ++++++++++--- lib/trustie/utils/office.rb | 9 ++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index c8b6a6fda..9c3b624af 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -62,6 +62,10 @@ class AttachmentsController < ApplicationController render :action => 'file' end + def pdf?(file) + file.downcase.end_with?(".pdf") + end + def download # modify by nwb # 下载添加权限设置 @@ -69,9 +73,12 @@ class AttachmentsController < ApplicationController if candown || User.current.admin? || User.current.id == @attachment.author_id @attachment.increment_download if stale?(:etag => @attachment.digest) - convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".html") - if File.exist?(convered_file) - send_file convered_file, :type => 'text/html; charset=utf-8', :disposition => 'inline' + convered_file = @attachment.disk_filename + unless pdf?(convered_file) + convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf") + end + if File.exist?(convered_file) && pdf?(convered_file) + send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline' else send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), :type => detect_content_type(@attachment), diff --git a/lib/trustie/utils/office.rb b/lib/trustie/utils/office.rb index 1bc18cb84..adfa3fb5c 100644 --- a/lib/trustie/utils/office.rb +++ b/lib/trustie/utils/office.rb @@ -7,7 +7,7 @@ module Trustie end def office? - %w(doc docx ppt pptx xls xlsx pdf).any?{|word| @file.downcase.end_with?(word)} + %w(doc docx ppt pptx xls xlsx).any?{|word| @file.downcase.end_with?(word)} end def conver(saved_file, force=false) @@ -21,8 +21,11 @@ module Trustie :open_timeout => -1 ) req = resource.post :txtDes => File.new(@file, 'rb') - File.open(saved_file, "wb+") do |f| - f.write(req.body) + File.delete(saved_file) if File.exist?(saved_file) + if req.body.length > 10 && !req.body.eql?('转换出错') + File.open(saved_file, "wb+") do |f| + f.write(req.body) + end end return true rescue =>e From 9ecb119aa46354f9e1de47166d6c79857c83499a Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 3 Jun 2015 17:43:42 +0800 Subject: [PATCH 002/130] =?UTF-8?q?task=E4=B8=AD=E4=B9=9F=E6=94=B9?= =?UTF-8?q?=E4=B8=BApdf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/office.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/office.rake b/lib/tasks/office.rake index 3e4c0a286..ce2d3a221 100644 --- a/lib/tasks/office.rake +++ b/lib/tasks/office.rake @@ -10,7 +10,7 @@ namespace :office do unless Dir.exist?(saved_path) Dir.mkdir(saved_path) end - convered_file = File.join(saved_path, a.disk_filename + ".html") + convered_file = File.join(saved_path, a.disk_filename + ".pdf") office = Trustie::Utils::Office.new(a.diskfile) if office.conver(convered_file) puts "process ok: #{convered_file} " From e4d68e988ea2b95b06d5d842f9369b8aaa5200ce Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 3 Jun 2015 17:52:59 +0800 Subject: [PATCH 003/130] =?UTF-8?q?=E5=8A=A0=E4=B8=8Autf8=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- lib/tasks/office.rake | 2 ++ lib/trustie/utils/office.rb | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 9c3b624af..d3781d747 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -73,7 +73,7 @@ class AttachmentsController < ApplicationController if candown || User.current.admin? || User.current.id == @attachment.author_id @attachment.increment_download if stale?(:etag => @attachment.digest) - convered_file = @attachment.disk_filename + convered_file = @attachment.diskfile unless pdf?(convered_file) convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf") end diff --git a/lib/tasks/office.rake b/lib/tasks/office.rake index ce2d3a221..c6ee8b4dd 100644 --- a/lib/tasks/office.rake +++ b/lib/tasks/office.rake @@ -1,3 +1,5 @@ +#coding=utf-8 + namespace :office do desc "conver any files to html" task :conver => :environment do diff --git a/lib/trustie/utils/office.rb b/lib/trustie/utils/office.rb index adfa3fb5c..61d6b9d4c 100644 --- a/lib/trustie/utils/office.rb +++ b/lib/trustie/utils/office.rb @@ -1,3 +1,5 @@ +#coding=utf-8 + module Trustie module Utils class Office From 3cc6fc1a64663df304b07a8059361dc994162069 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 3 Jun 2015 18:15:08 +0800 Subject: [PATCH 004/130] =?UTF-8?q?=E5=88=A0=E6=8E=89additional=5Fenvirome?= =?UTF-8?q?nt.rb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/additional_environment.rb | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 config/additional_environment.rb diff --git a/config/additional_environment.rb b/config/additional_environment.rb deleted file mode 100644 index 5c73f6aab..000000000 --- a/config/additional_environment.rb +++ /dev/null @@ -1,3 +0,0 @@ -if Rails.env.production? - config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 90.minutes } -end \ No newline at end of file From f86acbb10f08b99175f722536476a54209dcde05 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 3 Jun 2015 18:30:49 +0800 Subject: [PATCH 005/130] =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E7=9A=84=E9=A2=84=E8=A7=88=E6=96=87=E4=BB=B6=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/office.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/office.rake b/lib/tasks/office.rake index c6ee8b4dd..8bfc0c0ea 100644 --- a/lib/tasks/office.rake +++ b/lib/tasks/office.rake @@ -3,9 +3,9 @@ namespace :office do desc "conver any files to html" task :conver => :environment do - all_count = Attachment.count + all_count = Attachment.where(["container_type IN (?)", %w(Project Course)]).count i = 0 - Attachment.find_each do |a| + Attachment.where(["container_type IN (?)", %w(Project Course)]).find_each do |a| i += 1 puts "process [#{i}/#{all_count}] => id #{a.id}" saved_path = File.join(Rails.root, "files", "convered_office") From d2eb51bbb6f47644d64e156b54c3e8e26535326b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 3 Jun 2015 18:47:23 +0800 Subject: [PATCH 006/130] =?UTF-8?q?=E5=8F=AA=E5=A4=84=E7=90=86=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=BA=93=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 1e477ed04..4a6580a7a 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -259,11 +259,12 @@ class Attachment < ActiveRecord::Base end def office_conver + return unless %w(Project Course).included? (self.container_type) saved_path = File.join(Rails.root, "files", "convered_office") unless Dir.exist?(saved_path) Dir.mkdir(saved_path) end - convered_file = File.join(saved_path, self.disk_filename + ".html") + convered_file = File.join(saved_path, self.disk_filename + ".pdf") OfficeConverTask.new.conver(self.diskfile, convered_file) end From 3f9c5764e96f82e57c4438296c4e166df9959bfa Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 3 Jun 2015 18:50:26 +0800 Subject: [PATCH 007/130] . --- app/models/attachment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 4a6580a7a..380e98e02 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -259,7 +259,7 @@ class Attachment < ActiveRecord::Base end def office_conver - return unless %w(Project Course).included? (self.container_type) + return unless %w(Project Course).include? (self.container_type) saved_path = File.join(Rails.root, "files", "convered_office") unless Dir.exist?(saved_path) Dir.mkdir(saved_path) From d3baada893c2ceba398dfc399518d2cb6ee05d31 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 3 Jun 2015 18:57:05 +0800 Subject: [PATCH 008/130] =?UTF-8?q?=E5=9C=A8=E6=9B=B4=E6=96=B0Attachments?= =?UTF-8?q?=E6=97=B6=E4=B9=9F=E8=A6=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 380e98e02..1f1d61581 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -72,8 +72,8 @@ class Attachment < ActiveRecord::Base @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") before_save :files_to_final_location - after_create :office_conver, :be_user_score ,:act_as_forge_activity# user_score - after_update :be_user_score + after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score + after_update :office_conver, :be_user_score after_destroy :delete_from_disk,:down_user_score # add by nwb From 444658d0b3a8ef46431396bd9ec7ffb3f6df8364 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Thu, 4 Jun 2015 10:24:05 +0800 Subject: [PATCH 009/130] =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E5=8F=98=E4=B8=BA?= =?UTF-8?q?=E6=97=A2=E6=97=B6=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 33 ++++++++++++++------- app/models/attachment.rb | 15 +++++----- app/views/files/_project_file_list.html.erb | 5 ++-- lib/trustie/utils/office.rb | 13 ++++---- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index d3781d747..8ad48c9b2 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -66,6 +66,12 @@ class AttachmentsController < ApplicationController file.downcase.end_with?(".pdf") end + def direct_download + send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), + :type => detect_content_type(@attachment), + :disposition => 'attachment' #inline can open in browser + end + def download # modify by nwb # 下载添加权限设置 @@ -73,23 +79,30 @@ class AttachmentsController < ApplicationController if candown || User.current.admin? || User.current.id == @attachment.author_id @attachment.increment_download if stale?(:etag => @attachment.digest) - convered_file = @attachment.diskfile - unless pdf?(convered_file) - convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf") - end - if File.exist?(convered_file) && pdf?(convered_file) - send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline' + if params[:force] == 'true' + direct_download else - send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), - :type => detect_content_type(@attachment), - :disposition => 'attachment' #inline can open in browser + convered_file = @attachment.diskfile + #如果本身不是pdf文件,则先寻找是不是已转换化,如果没有则转化 + unless pdf?(convered_file) + convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf") + unless File.exist?(convered_file) + office = Trustie::Utils::Office.new(@attachment.diskfile) + office.conver(convered_file) + end + end + if File.exist?(convered_file) && pdf?(convered_file) + send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline' + else + direct_download + end end end else render_403 :message => :notice_not_authorized end rescue => e - redirect_to "http: //" + (Setting.host_name.to_s) +"/file_not_found.html" + redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html" end #更新资源文件类型 diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 1f1d61581..f999e27d6 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -259,13 +259,14 @@ class Attachment < ActiveRecord::Base end def office_conver - return unless %w(Project Course).include? (self.container_type) - saved_path = File.join(Rails.root, "files", "convered_office") - unless Dir.exist?(saved_path) - Dir.mkdir(saved_path) - end - convered_file = File.join(saved_path, self.disk_filename + ".pdf") - OfficeConverTask.new.conver(self.diskfile, convered_file) + # 不在这里做后台转换,换为点击时做转换 + # return unless %w(Project Course).include? (self.container_type) + # saved_path = File.join(Rails.root, "files", "convered_office") + # unless Dir.exist?(saved_path) + # Dir.mkdir(saved_path) + # end + # convered_file = File.join(saved_path, self.disk_filename + ".pdf") + # OfficeConverTask.new.conver(self.diskfile, convered_file) end # Copies the temporary file to its final location diff --git a/app/views/files/_project_file_list.html.erb b/app/views/files/_project_file_list.html.erb index 35aa36195..a5152ecdc 100644 --- a/app/views/files/_project_file_list.html.erb +++ b/app/views/files/_project_file_list.html.erb @@ -30,6 +30,7 @@ <% else %> <%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> <% end %> + <%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %> <% end %>
@@ -37,7 +38,7 @@

文件大小:<%= number_to_human_size(file.filesize) %>

<%= link_to( l(:button_delete), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if manage_allowed && file.container_id == project.id && file.container_type == "Project"%> -

<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

+

<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

@@ -51,4 +52,4 @@ -
\ No newline at end of file +
diff --git a/lib/trustie/utils/office.rb b/lib/trustie/utils/office.rb index 61d6b9d4c..2b4a5f1ac 100644 --- a/lib/trustie/utils/office.rb +++ b/lib/trustie/utils/office.rb @@ -17,12 +17,13 @@ module Trustie if File.exist? @file if office? begin - resource = RestClient::Resource.new( - 'http://192.168.80.107/Any2HtmlHandler.ashx', - :timeout => -1, - :open_timeout => -1 - ) - req = resource.post :txtDes => File.new(@file, 'rb') + # resource = RestClient::Resource.new( + # 'http://192.168.80.107/Any2HtmlHandler.ashx', + # :timeout => -1, + # :open_timeout => -1 + # ) + # req = resource.post :txtDes => File.new(@file, 'rb') + req = RestClient.post 'http://192.168.80.107/Any2HtmlHandler.ashx',:txtDes => File.new(@file, 'rb') File.delete(saved_file) if File.exist?(saved_file) if req.body.length > 10 && !req.body.eql?('转换出错') File.open(saved_file, "wb+") do |f| From fb7c65a70d41f918503285039b9bebd37aec73f4 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Thu, 4 Jun 2015 10:26:35 +0800 Subject: [PATCH 010/130] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E5=8E=9F=E5=A7=8B=E6=96=87=E4=BB=B6=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_course_list.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 6039b543b..6516135a8 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -40,6 +40,7 @@ <% else %> <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <% end %> + <%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %> <% else %> <% end %>
@@ -65,4 +66,4 @@ -
\ No newline at end of file +
From 36afb4d1f801e8350ed011b54610123abc50ea3b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Thu, 4 Jun 2015 13:55:38 +0800 Subject: [PATCH 011/130] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=9C=A8=E5=85=AC?= =?UTF-8?q?=E5=85=B1=E8=B4=B4=E5=90=A7=E7=9A=84=E5=B8=96=E5=AD=90=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E9=87=8C=E5=8F=91=E4=B8=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_course_list.html.erb | 6 +++--- app/views/memos/show.html.erb | 8 ++++---- config/application.rb | 2 ++ db/schema.rb | 7 +++++++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 6516135a8..00080db00 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -31,9 +31,9 @@ <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %> - - <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %> - + + <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %> + <% else %> <% end %> diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 5452aa893..05358c32a 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -131,9 +131,9 @@ <%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %> -
- <%=h sanitize(reply.content.html_safe) %> -
+
+ <%=h sanitize(reply.content.html_safe) %> +

<% if reply.attachments.any?%> <% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %> @@ -183,4 +183,4 @@ }); }; $("img").removeAttr("align"); - \ No newline at end of file + diff --git a/config/application.rb b/config/application.rb index 9e7a2ba81..83ba21b05 100644 --- a/config/application.rb +++ b/config/application.rb @@ -67,6 +67,8 @@ module RedmineApp # Do not include all helpers config.action_controller.include_all_helpers = false + config.action_view.sanitized_allowed_tags = 'div', 'p', 'span', 'img', 'embed' + if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb')) end diff --git a/db/schema.rb b/db/schema.rb index 42c743588..1a59ccc86 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -606,6 +606,13 @@ ActiveRecord::Schema.define(:version => 20150602055730) do t.datetime "updated_at", :null => false end + create_table "invite_lists", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "issue_categories", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "name", :limit => 30, :default => "", :null => false From cd8f3bdea3394e00b6abb18247cb3e7e81ee2184 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Thu, 4 Jun 2015 17:49:53 +0800 Subject: [PATCH 012/130] ... --- app/views/courses/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 0feca0d1b..63285a2cd 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -35,7 +35,7 @@ :class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type, 'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link", 'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%> - <%if @controller_name=='ActivityNotifys' && !e.get_notify_is_read%> + <%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%> <%end%>
From 2f2d0a79422de47a883ba4982d138193c8774ce5 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 09:37:56 +0800 Subject: [PATCH 013/130] =?UTF-8?q?bid=E5=B7=B2=E7=BB=8F=E5=BA=9F=E5=BC=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/factories/homeworks.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/spec/factories/homeworks.rb b/spec/factories/homeworks.rb index 208255a8d..d7fb1cab6 100644 --- a/spec/factories/homeworks.rb +++ b/spec/factories/homeworks.rb @@ -2,16 +2,16 @@ # #:author_id, :budget, :deadline, :name, :description, :homework_type, :password -FactoryGirl.define do - factory :homework, class: Bid do - name "test homework" - budget 0 - deadline {(Time.now+1.days).strftime('%Y-%m-%d')} - description "description" - homework_type 3 - reward_type 3 - end - - factory :homework_attach, class: HomeworkAttach do - end -end +# FactoryGirl.define do +# factory :homework, class: Bid do +# name "test homework" +# budget 0 +# deadline {(Time.now+1.days).strftime('%Y-%m-%d')} +# description "description" +# homework_type 3 +# reward_type 3 +# end +# +# factory :homework_attach, class: HomeworkAttach do +# end +# end From d2c51f27b6c79baebf815d8c6a031789c3450e0a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 09:48:23 +0800 Subject: [PATCH 014/130] =?UTF-8?q?Bid=E5=8A=9F=E8=83=BD=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E5=BA=9F=E5=BC=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 2193 ++++++++++++++-------------- 1 file changed, 1097 insertions(+), 1096 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 35236414f..7db03aca1 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -1,1096 +1,1097 @@ -# fq -class BidsController < ApplicationController - #Added by young - menu_item l(:label_homework), :only => [:edit, :udpate] - menu_item :respond - menu_item :course, :only => :show_courseEx - menu_item :project, :only => [:show_project,:show_results, :new_submit_homework] - menu_item :homework_respond, :only => :homework_respond - menu_item :homework_statistics, :only => :homework_statistics - menu_item :edit, :only => :edit - - before_filter :auth_login1, :only => [:show_courseEx] - - before_filter :can_show_course,only: [] - before_filter :can_show_contest,only: [] - #Ended by young - before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:delete,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork, - :show_course, :show_courseEx,:show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings] - # added by fq - before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest] - # end - before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ] - - #before_filter :memberAccess, only: :show_project - - helper :watchers - helper :attachments - include AttachmentsHelper - include ApplicationHelper - include BidsHelper - - helper :projects - helper :words - helper :welcome - helper :project_score - - def find_project_by_bid_id - @bid = Bid.find(params[:id]) - @project = @bid.courses[0] - rescue ActiveRecord::RecordNotFound - render_404 - end - - def homework_ajax_modal - @bid = Bid.find_by_id(params[:id]) - # find_bid - respond_to do |format| - format.js - end - end - - - def index - @project_type = params[:project_type] - # Modified by nie - # @requirement_title = "4" - @offset, @limit = api_offset_and_limit({:limit => 10}) - if @project_type == '1' - @bids = Bid.visible.where('reward_type = ?', 3) - # elsif - # @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 4) - else - @bids = Bid.visible.where('reward_type = ?', 1) - end - - @bids = @bids.like(params[:name]) if params[:name].present? - @bid_count = @bids.count - @bid_pages = Paginator.new @bid_count, @limit, params['page'] - - @offset ||= @bid_pages.reverse_offset - #added by nie - if params[:bid_sort_type].present? - case params[:bid_sort_type] - when '0' - unless @offset == 0 - @bids = @bids.offset(@offset).limit(@limit).all.reverse - else - limit = @bid_count % @limit - limit = @limit if limit == 0 - @bids = @bids.offset(@offset).limit(limit).all.reverse - end - @s_state = 0 - when '1' - unless @offset == 0 - @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse - else - limit = @bid_count % @limit - limit = @limit if limit == 0 - @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse - end - @s_state = 1 - when '2' - unless @offset == 0 - @bids = @bids.offset(@offset).limit(@limit).all.reverse - else - limit = @bid_count % @limit - limit = @limit if limit == 0 - @bids = @bids.offset(@offset).limit(@limit).all.reverse - end - @s_state = 0 - end - else - unless @offset == 0 - @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse - else - limit = @bid_count % @limit - limit = @limit if limit == 0 - @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse - end - @s_state = 1 - end - #end - end - #huang - def contest - - # Modified by nie - # @requirement_title = "4" - @offset, @limit = api_offset_and_limit({:limit => 10}) - - @bids = Bid.visible.where('reward_type = ?', 2) - - # elsif - # @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 4) - @bids = @bids.like(params[:name]) if params[:name].present? - @bid_count = @bids.count - @bid_pages = Paginator.new @bid_count, @limit, params['page'] - - @offset ||= @bid_pages.reverse_offset - #added by nie - if params[:contest_sort_type].present? - case params[:contest_sort_type] - when '0' - unless @offset == 0 - @bids = @bids.offset(@offset).limit(@limit).all.reverse - else - limit = @bid_count % @limit - limit = @limit if limit == 0 - @bids = @bids.offset(@offset).limit(limit).all.reverse - end - @s_state = 0 - when '1' - unless @offset == 0 - @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse - else - limit = @bid_count % @limit - limit = @limit if limit == 0 - @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse - end - @s_state = 1 - when '2' - unless @offset == 0 - @bids = @bids.offset(@offset).limit(@limit).all.reverse - else - limit = @bid_count % @limit - limit = @limit if limit == 0 - @bids = @bids.offset(@offset).limit(@limit).all.reverse - end - @s_state = 0 - end - else - unless @offset == 0 - @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse - else - limit = @bid_count % @limit - limit = @limit if limit == 0 - @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse - end - @s_state = 1 - end - #end - end - - def fork - @courses = [] - @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) - @membership.each do |membership| - if membership.project.project_type == 1 - @courses << membership.project - end - end - end - - #将某个企业外包需求选为作业,目前此功能已放弃 - def create_fork - @homework = Bid.new - @homework.name = params[:bid][:name] - @homework.description = params[:bid][:description] - @homework.reward_type = 3 - # @bid.budget = params[:bid][:budget] - @homework.deadline = params[:bid][:deadline] - @homework.budget = 0 - @homework.author_id = User.current.id - @homework.commit = 0 - @homework.homework_type = 1 - @homework.is_evaluation = params[:bid][:is_evaluation] - @homework.parent_id = @bid.id - @homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) - # @bid. - if @homework.save - HomeworkForCourse.create(:course_id => params[:course], :bid_id => @homework.id) - unless @bid.watched_by?(User.current) - if @bid.add_watcher(User.current) - flash[:notice] = l(:label_bid_succeed) - end - end - redirect_to course_for_bid_path(@homework) - else - @bid.safe_attributes = params[:bid] - @courses = [] - @membership = User.current.coursememberships.all#(:conditions => Project.visible_condition(User.current)) - @membership.each do |membership| - @courses << membership.course - end - render :action => 'fork' - end - end - - #有两个路由链接到此方法:/bids/:id /calls/:id但是貌似这两个路由都不能访问。。方法作用有待确认 - def show - @user = @bid.author - @jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @limit = 10 - @feedback_count = @jours.count - @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - @offset ||= @feedback_pages.offset - @jour = @jours[@offset, @limit] - @state = false - - respond_to do |format| - layout_file = '' - case @bid.reward_type - when 3 - html_title(l(:label_question_student)) - layout_file = 'base_homework' - when 1 - layout_file = 'base_bids' - else - layout_file = 'base_contest' - end - format.html { - render :layout => layout_file - } - format.api - end - end - - def join_in_contest - if @bid.reward_type == 2 && params[:course_password] == @bid.password - JoinInContest.create(:user_id => User.current.id, :bid_id => @bid.id) - @state = 0 - else - @state = 1 - end - respond_to do |format| - format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} } - end - end - - def unjoin_in_contest - joined = JoinInContest.where('bid_id = ? and user_id = ?', @bid.id, User.current.id) - joined.each do |join| - join.delete - end - respond_to do |format| - format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} } - end - end - - def new_join - - end - - # added by bai 增加了参与者和竞赛设置 - def show_participator - render :layout => 'base_contest' - end - - #配置竞赛 - def settings - if @bid.author.id == User.current.id - if @bid.reward_type == 2 - @contest = Bid.find_by_reward_type(@bid.reward_type) - render :layout => 'base_contest' - end - else - render_403 :message => :notice_not_contest_setting_authorized - end - end - #end - - # 显示课程作业,但是好像已经废弃 - def show_course - bids = Bid.where('parent_id = ?', @bid.id) - @courses = [] - for bid in bids - @courses << bid.courses.first - end - - respond_to do |format| - if @bid.reward_type == 3 - format.html { - render :layout => 'base_homework' - } - elsif @bid.reward_type == 1 - format.html { - render :layout => 'base_bids' - } - else - format.html { - render :layout => 'base_contest' - } - end - format.api - - end - end - - def show_bid_project - bids = Bid.where('parent_id = ?', @bid.id) - @projects = [] - for bid in bids - @projects += bid.biding_projects - end - - respond_to do |format| - if @bid.reward_type == 3 - format.html { - render :layout => 'base_homework' - } - elsif @bid.reward_type == 1 - format.html { - render :layout => 'base_bids' - } - else - format.html { - render :layout => 'base_contest' - } - end - format.api - - end - end - - def show_bid_user - bids = Bid.where('parent_id = ?', @bid.id) - @users = [] - for bid in bids - for project in bid.projects - @users += project.users - end - end - - respond_to do |format| - if @bid.reward_type == 3 - format.html { - render :layout => 'base_homework' - } - elsif @bid.reward_type == 1 - format.html { - render :layout => 'base_bids' - } - else - format.html { - render :layout => 'base_contest' - } - end - format.api - - end - end - - def show_project - # flash[:notice] = "" - @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) - @option = [] - @membership.each do |membership| - unless(membership.project.project_type==1) - if membership.user.allowed_to?(:quote_project,membership.project) - @option << membership.project - end - end - end - - # a = [1] - # @project = Project.where("id in []", a) - @user = @bid.author - @bidding_project = @bid.biding_projects.all - if params[:student_id].present? - @temp = [] - @bidding_project.each do |pro| - if pro.project && pro.project.project_status - if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id - @temp << pro - end - end - @temp - end - @bidding_project = @temp - else - #added by nie - @temp = [] - @bidding_project.each do |pro| - if pro.project && pro.project.project_status - @temp << pro - end - @temp - end - if @temp.size > 0 - @bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade} - end - #ended - end - - if @bid.homework_type == 1 - @homework = HomeworkAttach.new - #@homework_list = @bid.homeworks - #增加作业按评分排序, - @homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC") - if params[:student_id].present? - @temp = [] - @homework_list.each do |pro| - if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id - @temp << pro - end - @temp - end - @homework_list = @temp - end - end - - respond_to do |format| - if @bid.reward_type == 3 - format.html { - render :layout => 'base_homework' - } - elsif @bid.reward_type == 1 - format.html { - render :layout => 'base_bids' - } - else - format.html { - render :layout => 'base_contest' - } - end - format.api - end - end - - # 显示作业课程 - # add by nwb - def show_courseEx - - if (User.current.logged? && (User.current.member_of_course?(@bid.courses.first) || User.current.admin?)) - @membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current)) - @user = @bid.author - @bidding_project = @bid.biding_projects.all - - if params[:student_id].present? - @temp = [] - @bidding_project.each do |pro| - if pro.project && pro.project.project_status - if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id - @temp << pro - end - end - @temp - end - @bidding_project = @temp - else - #added by nie - @temp = [] - @bidding_project.each do |pro| - if pro.project && pro.project.project_status - @temp << pro - end - @temp - end - if @temp.size > 0 - @bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade} - end - #ended - end - - if @bid.homework_type - @homework = HomeworkAttach.new - @is_teacher = is_course_teacher(User.current,@bid.courses.first) - if @is_teacher - all_homework_list = HomeworkAttach.find_by_sql("SELECT * FROM (SELECT homework_attaches.*, - (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score - FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1 - WHERE table1.t_score IS NULL") - @not_batch_homework = true - @cur_type = 1 - else - all_homework_list = HomeworkAttach.find_by_sql("SELECT homework_attaches.*, - (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, - (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score, - (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = #{@is_teacher ? 1 : 0}) AS m_score - FROM homework_attaches - INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id - WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC") - @is_student_batch_homework = true - @cur_type = 4 - end - - @cur_page = params[:page] || 1 - # @homework_list = paginateHelper all_homework_list,10 - @homework_list = all_homework_list - @jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count - if params[:student_id].present? - @temp = [] - @homework_list.each do |pro| - if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id - @temp << pro - end - @temp - end - @homework_list = @temp - end - end - - respond_to do |format| - if @bid.reward_type == 3 - format.html { - html_title(l(:label_homework_info)) - render :layout => 'base_homework' - } - elsif @bid.reward_type == 1 - format.html { - render :layout => 'base_bids' - } - else - format.html { - render :layout => 'base_contest' - } - end - format.api - end - else - render_403 :message => :notice_not_authorized - end - end - - ##### by huang - def show_project_homework - # flash[:notice] = "" - @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) - @option = [] - @membership.each do |membership| - end - # a = [1] - # @project = Project.where("id in []", a) - @user = @bid.author - @bidding_project = @bid.biding_projects - respond_to do |format| - if @bid.reward_type == 3 - format.html { - render :layout => 'base_homework' - } - elsif @bid.reward_type == 1 - format.html { - render :layout => 'base_bids' - } - else - format.html { - render :layout => 'base_contest' - } - end - format.api - end - end - - ###添加应标项目 - def add - project = Project.find(params[:bid]) - bid_message = params[:bid_for_save][:bid_message] - if BidingProject.where("project_id = ? and bid_id = ?", project.id, @bid.id).size == 0 - if BidingProject.cerate_bidding(@bid.id, project.id, bid_message) - - # added by bai type ==1 需求,type==2 竞赛, type==3 作业 - if @bid.reward_type == 1 - flash.now[:notice] = l(:label_bidding_succeed) - - elsif @bid.reward_type == 2 - flash.now[:notice] = l(:label_bidding_contest_succeed) - - else @bid.reward_type == 3 - flash.now[:notice] = l(:label_bidding_homework_succeed) - end - # end - - end - else - if @bid.reward_type == 3 - flash.now[:error] = l(:label_bidding_homework_fail) - else - flash.now[:error] = l(:label_bidding_fail) - end - end - @bidding_project = @bid.biding_projects - respond_to do |format| - # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} - # format.html - format.html { redirect_to :back } - format.js - #format.api { render_api_ok } - end - end - - #删除已提交的项目作业(不删项目) - def delete - binding_project = params[:binding_project] - if can_delete_project_homework(BidingProject.find(binding_project),User.current) - if BidingProject.delete(binding_project) - redirect_to project_for_bid_url - else - render_403; - end - end - end - ## 新建留言 - def create - - if params[:bid_message][:message].size>0 - if params[:reference_content] - message = params[:bid_message][:message] + "\n" + params[:reference_content] - else - message = params[:bid_message][:message] - @m = message - end - refer_user_id = params[:bid_message][:reference_user_id].to_i - @bid.add_jour(User.current, message, refer_user_id) - end - @user = @bid.author - @jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jour = paginateHelper @jours,10 - @bid.set_commit(@feedback_count) - respond_to do |format| - format.js - #format.api { render_api_ok } - end - - end - - ##删除留言 - def destroy - @user = @bid.author - if User.current.admin? || User.current.id == @user.id - JournalsForMessage.delete_message(params[:object_id]) - end - @jours = @bid.journals_for_messages.reverse - @limit = 10 - @feedback_count = @jours.count - @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - @offset ||= @feedback_pages.offset - @jour = @jours[@offset, @limit] - - @bid.set_commit(@feedback_count) - # if a_message.size > 5 - # @message = a_message[-5, 5] - # else - # @message = a_message - # end - # @message_count = a_message.count - - respond_to do |format| - # format.html - format.js - #format.api { render_api_ok } - end - end - - #删除作业 - #by xianbo - def homework_destroy - @bid_to_destroy = Bid.find params[:id] - course_url = course_homework_path(@bid_to_destroy.courses.first) - (render_403; return false) unless User.current.admin?||User.current.id==@bid_to_destroy.author_id - @bid_to_destroy.destroy - respond_to do |format| - format.html { redirect_to course_url } - format.js - #format.api { render_api_ok } - end - end - - #end by xianbo - ##引用 - def new - @jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id] - if @jour - user = @jour.user - text = @jour.notes - else - user = @bid.author - text = @bid.description - end - # Replaces pre blocks with [...] - text = text.to_s.strip.gsub(%r{

((.|\s)*?)
}m, '[...]') - @content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> " - @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" - @id = user.id - rescue ActiveRecord::RecordNotFound - render_404 - end - - ##新建需求 - def new_bid - @bid = Bid.new - @bid.safe_attributes = params[:bid] - end - - #huang - def create_contest - @bid = Bid.new - @bid.name = params[:bid][:name] - @bid.description = params[:bid][:description] - @bid.reward_type = 2 - @bid.budget = params[:bid][:budget] - @bid.deadline = params[:bid][:deadline] - @bid.password = params[:bid][:password] #added by bai - @bid.author_id = User.current.id - @bid.commit = 0 - if @bid.save - unless @bid.watched_by?(User.current) - if @bid.add_watcher(User.current) - flash[:notice] = l(:label_bid_succeed) - end - end - redirect_to respond_url(@bid) - else - @bid.safe_attributes = params[:bid] - render :action => 'new_bid' - end - end - - # added by bai - def update_contest - @bid = Bid.find(params[:id]) - @bid.name = params[:bid][:name] - @bid.description = params[:bid][:description] - @bid.reward_type = 2 - @bid.budget = params[:bid][:budget] - @bid.deadline = params[:bid][:deadline] - @bid.password = params[:bid][:password] - @bid.author_id = User.current.id - @bid.commit = 0 - if @bid.save - unless @bid.watched_by?(User.current) - if @bid.add_watcher(User.current) - flash[:notice] = l(:label_bid_succeed) - end - end - redirect_to respond_url(@bid) - else - @bid.safe_attributes = params[:bid] - render :action => 'new_bid' - end - end - #huang - def new_contest - @bid = Bid.new - @bid.safe_attributes = params[:bid] - end - - def create_bid - @bid = Bid.new - @bid.name = params[:bid][:name] - @bid.description = params[:bid][:description] - @bid.reward_type = 1 - @bid.budget = params[:bid][:budget] - @bid.deadline = params[:bid][:deadline] - @bid.author_id = User.current.id - @bid.commit = 0 - if @bid.save - unless @bid.watched_by?(User.current) - if @bid.add_watcher(User.current) - flash[:notice] = l(:label_bid_succeed) - end - end - redirect_to respond_url(@bid) - else - @bid.safe_attributes = params[:bid] - render :action => 'new_bid' - end - end - - def create_homework - @bid = Bid.new - @bid.name = params[:bid][:name] - @bid.description = params[:bid][:description] - @bid.is_evaluation = params[:bid][:is_evaluation] - @bid.proportion = params[:bid][:proportion] - @bid.evaluation_num = params[:bid][:evaluation_num] - params[:bid][:open_anonymous_evaluation] ? @bid.open_anonymous_evaluation = 1 : @bid.open_anonymous_evaluation = 0 - @bid.reward_type = 3 - # @bid.budget = params[:bid][:budget] - @bid.deadline = params[:bid][:deadline] - @bid.budget = 0 - @bid.author_id = User.current.id - @bid.commit = 0 - @bid.homework_type = 1 - @bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) - # @bid. - if @bid.save - HomeworkForCourse.create(:course_id => params[:course_id], :bid_id => @bid.id) - unless @bid.watched_by?(User.current) - if @bid.add_watcher(User.current) - flash[:notice] = l(:label_bid_succeed) - end - end - redirect_to course_homework_url(params[:course_id]) - else - @bid.safe_attributes = params[:bid] - @homework = @bid - @course = Course.find_by_id(params[:course_id]) - @course_id = @course.id - #respond_to do |format| - # format.html { redirect_to new_homework_course_path(params[:course_id]),:layout => 'base_courses'} - # format.api { render_validation_errors(@bid) } - #end - render file: 'courses/new_homework', layout: 'base_courses' - end - end - - # modify by nwb\ - # 编辑作业 - def edit - @bid = Bid.find(params[:bid_id]) - if (User.current.admin?||User.current.allowed_to?(:as_teacher,@bid.courses.first)) - @course_id = params[:course_id] - respond_to do |format| - format.html { - @course = Course.find(params[:course_id]) - @user= User.find(User.current.id) - render :layout => 'base_courses' - } - end - else - render_403 - end - end - - def update - @bid = Bid.find(params[:id]) - @course = @bid.courses.first#Project.find(params[:course_id]) - @bid.name = params[:bid][:name] - @bid.description = params[:bid][:description] - @bid.is_evaluation = params[:bid][:is_evaluation] - @bid.proportion = params[:bid][:proportion] - @bid.evaluation_num = params[:bid][:evaluation_num] - params[:bid][:open_anonymous_evaluation] ? @bid.open_anonymous_evaluation = 1 : @bid.open_anonymous_evaluation = 0 - @bid.reward_type = 3 - @bid.deadline = params[:bid][:deadline] - @bid.budget = 0 - #@bid.author_id = User.current.id - @bid.commit = 0 - @bid.homework_type = 1 - @bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) - if @bid.save - flash[:notice] = l(:label_update_homework_succeed) - redirect_to course_homework_url(@course) - else - @bid.safe_attributes = params[:bid] - render :action => 'edit', :layout =>'base_courses' - end - end - - def new_submit_homework - #render html to prepare create submit homework - find_bid - find_bid - render :layout => 'base_homework' - end - - def add_homework - if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) - # homework = HomeworkAttach.create(:bid_id => @bid.id, :user_id => User.current.id) - # homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) - - if hadcommittedhomework(User.current.id, @bid.id) == true - @homework_flag = l(:label_bidding_homework_committed) - else - @homework = HomeworkAttach.new - @homework.safe_attributes = params[:homeworkattach] - @homework.bid_id = @bid.id - @homework.user_id = User.current.id - @homework.save_attachments(params[:attachments]) - - render_attachment_warning_if_needed(@homework) - - @homework_flag = if @homework.save - l(:label_bidding_homework_succeed) - else - l(:label_bidding_homework_failed) - end - - if @homework.attachments.empty? - @homework.delete - #flash[:error] = l(:no_attachmens_allowed) - @homework_flag = l(:no_attachmens_allowed) - # else - end - end - end - - @homework_list = @bid.homeworks - respond_to do |format| - format.html{ - #redirect_to project_for_bid_path, notice: @homework_flag.to_s - flash[:notice] = @homework_flag.to_s - redirect_back_or_default(project_for_bid_path) - } - format.js - end - - end - - # 作业统计 - def homework_statistics - @course = @bid.courses.first - @member = [] - @course.memberships.each do |member| - unless (member.roles && Role.where('id = ? ', 3)).empty? - @member.push member - end - end - if @bid.homework_type = 1 - @student = User.where("id in (select DISTINCT user_id from #{HomeworkAttach.table_name} where bid_id = ? )", @bid.id) - @homework_type = true - else - - @homework_type = false - end - @user = @bid.author - render :layout => 'base_homework' - end - - def homework_respond - @user = @bid.author - render :layout => 'base_homework' - end - - def more - @jour = @bid.journals_for_messages - @jour.each_with_index {|j,i| j.indice = i+1} - @state = true - - respond_to do |format| - format.html { redirect_to :back } - format.js - #format.api { render_api_ok } - end - end - - def back - @jour = @bid.journals_for_messages - @jour.each_with_index {|j,i| j.indice = i+1} - @state = false - - respond_to do |format| - format.html { redirect_to :back } - format.js - #format.api { render_api_ok } - end - end - - #added by william - #used to set the bidding project reward - def set_reward - @b_p = nil - @biding_project_id = nil - - if params[:set_reward][:reward]&&((User.current.id==@bid.author_id)||User.current.admin) - # @bid_id = params[:id] - @biding_project_id = params[:set_reward][:b_id] - @b_p = BidingProject.find_by_id(@biding_project_id) - - # 把字段存进表中 - @b_p.update_reward(params[:set_reward][:reward].to_s) - end - - respond_to do |format| - format.js - end - end - - # added by william - # used to manage the bid and end the bid - def manage - - end - - # 启动匿评 - def start_anonymous_comment - @bid = Bid.find(params[:id]) - @course = @bid.courses.first - if(@bid.comment_status == 0) - homeworks = @bid.homeworks - if(homeworks && homeworks.size >= 2) - homeworks.each_with_index do |homework, index| - user = homework.user - n = @bid.evaluation_num - n = n < homeworks.size ? n : homeworks.size - 1 - assigned_homeworks = get_assigned_homeworks(homeworks, n, index) - assigned_homeworks.each do |h| - @homework_evaluation = HomeworkEvaluation.new(user_id: user.id, homework_attach_id: h.id) - @homework_evaluation.save - end - end - @bid.update_column('comment_status', 1) - @statue = 1 - else - @statue = 2 - end - else - @statue = 3 - end - - respond_to do |format| - format.js - end - end - - def stop_anonymous_comment - @bid = Bid.find(params[:id]) - - @bid.update_column('comment_status', 2) - - respond_to do |format| - format.js - end - end - - def alert_anonymous_comment - @bid = Bid.find params[:id] - @course = @bid.courses.first - @cur_size = 0 - @totle_size = 0 - if @bid.comment_status == 0 - @totle_size = searchStudent(@course).size - @cur_size = @bid.homeworks.size - elsif @bid.comment_status == 1 - @bid.homeworks.map { |homework| @totle_size += homework.homework_evaluations.count} - @cur_size = 0 - @bid.homeworks.map { |homework| @cur_size += homework.rates(:quality).where("seems_rateable_rates.is_teacher_score = 0").count} - end - @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) - respond_to do |format| - format.js - end - end - - private - - def get_assigned_homeworks(homeworks, n, index) - homeworks += homeworks - homeworks[index + 1 .. index + n] - end - - def find_bid - if params[:id] - @bid = Bid.find(params[:id], :include => [{:homeworks => :user}]) - @user = @bid.author - end - rescue - render_404 - end - - def memberAccess - # 是课程,则判断当前用户是否参加了课程 - return true if current_user.admin? - #return 0 if @bid.courses.first.project_type == Project::ProjectType_project - currentUser = User.current - render_403 unless currentUser.member_of_course?(@bid.courses.first) - end - - #验证是否显示课程 - def can_show_course - @first_page = FirstPage.find_by_page_type('project') - if @first_page.show_course == 2 - render_404 - end - end - - #验证是否显示竞赛 - def can_show_contest - @first_page = FirstPage.find_by_page_type('project') - if @first_page.show_contest == 2 - render_404 - end - end -end - +# # fq +#Bid功能已经废弃 +# class BidsController < ApplicationController +# #Added by young +# menu_item l(:label_homework), :only => [:edit, :udpate] +# menu_item :respond +# menu_item :course, :only => :show_courseEx +# menu_item :project, :only => [:show_project,:show_results, :new_submit_homework] +# menu_item :homework_respond, :only => :homework_respond +# menu_item :homework_statistics, :only => :homework_statistics +# menu_item :edit, :only => :edit +# +# before_filter :auth_login1, :only => [:show_courseEx] +# +# before_filter :can_show_course,only: [] +# before_filter :can_show_contest,only: [] +# #Ended by young +# before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:delete,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork, +# :show_course, :show_courseEx,:show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings] +# # added by fq +# before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest] +# # end +# before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ] +# +# #before_filter :memberAccess, only: :show_project +# +# helper :watchers +# helper :attachments +# include AttachmentsHelper +# include ApplicationHelper +# include BidsHelper +# +# helper :projects +# helper :words +# helper :welcome +# helper :project_score +# +# def find_project_by_bid_id +# @bid = Bid.find(params[:id]) +# @project = @bid.courses[0] +# rescue ActiveRecord::RecordNotFound +# render_404 +# end +# +# def homework_ajax_modal +# @bid = Bid.find_by_id(params[:id]) +# # find_bid +# respond_to do |format| +# format.js +# end +# end +# +# +# def index +# @project_type = params[:project_type] +# # Modified by nie +# # @requirement_title = "4" +# @offset, @limit = api_offset_and_limit({:limit => 10}) +# if @project_type == '1' +# @bids = Bid.visible.where('reward_type = ?', 3) +# # elsif +# # @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 4) +# else +# @bids = Bid.visible.where('reward_type = ?', 1) +# end +# +# @bids = @bids.like(params[:name]) if params[:name].present? +# @bid_count = @bids.count +# @bid_pages = Paginator.new @bid_count, @limit, params['page'] +# +# @offset ||= @bid_pages.reverse_offset +# #added by nie +# if params[:bid_sort_type].present? +# case params[:bid_sort_type] +# when '0' +# unless @offset == 0 +# @bids = @bids.offset(@offset).limit(@limit).all.reverse +# else +# limit = @bid_count % @limit +# limit = @limit if limit == 0 +# @bids = @bids.offset(@offset).limit(limit).all.reverse +# end +# @s_state = 0 +# when '1' +# unless @offset == 0 +# @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse +# else +# limit = @bid_count % @limit +# limit = @limit if limit == 0 +# @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse +# end +# @s_state = 1 +# when '2' +# unless @offset == 0 +# @bids = @bids.offset(@offset).limit(@limit).all.reverse +# else +# limit = @bid_count % @limit +# limit = @limit if limit == 0 +# @bids = @bids.offset(@offset).limit(@limit).all.reverse +# end +# @s_state = 0 +# end +# else +# unless @offset == 0 +# @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse +# else +# limit = @bid_count % @limit +# limit = @limit if limit == 0 +# @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse +# end +# @s_state = 1 +# end +# #end +# end +# #huang +# def contest +# +# # Modified by nie +# # @requirement_title = "4" +# @offset, @limit = api_offset_and_limit({:limit => 10}) +# +# @bids = Bid.visible.where('reward_type = ?', 2) +# +# # elsif +# # @bids = Bid.visible.where('reward_type = ? or reward_type = ?', 4) +# @bids = @bids.like(params[:name]) if params[:name].present? +# @bid_count = @bids.count +# @bid_pages = Paginator.new @bid_count, @limit, params['page'] +# +# @offset ||= @bid_pages.reverse_offset +# #added by nie +# if params[:contest_sort_type].present? +# case params[:contest_sort_type] +# when '0' +# unless @offset == 0 +# @bids = @bids.offset(@offset).limit(@limit).all.reverse +# else +# limit = @bid_count % @limit +# limit = @limit if limit == 0 +# @bids = @bids.offset(@offset).limit(limit).all.reverse +# end +# @s_state = 0 +# when '1' +# unless @offset == 0 +# @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse +# else +# limit = @bid_count % @limit +# limit = @limit if limit == 0 +# @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse +# end +# @s_state = 1 +# when '2' +# unless @offset == 0 +# @bids = @bids.offset(@offset).limit(@limit).all.reverse +# else +# limit = @bid_count % @limit +# limit = @limit if limit == 0 +# @bids = @bids.offset(@offset).limit(@limit).all.reverse +# end +# @s_state = 0 +# end +# else +# unless @offset == 0 +# @bids = @bids.reorder('bids.commit').offset(@offset).limit(@limit).all.reverse +# else +# limit = @bid_count % @limit +# limit = @limit if limit == 0 +# @bids = @bids.reorder('bids.commit').offset(@offset).limit(limit).all.reverse +# end +# @s_state = 1 +# end +# #end +# end +# +# def fork +# @courses = [] +# @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) +# @membership.each do |membership| +# if membership.project.project_type == 1 +# @courses << membership.project +# end +# end +# end +# +# #将某个企业外包需求选为作业,目前此功能已放弃 +# def create_fork +# @homework = Bid.new +# @homework.name = params[:bid][:name] +# @homework.description = params[:bid][:description] +# @homework.reward_type = 3 +# # @bid.budget = params[:bid][:budget] +# @homework.deadline = params[:bid][:deadline] +# @homework.budget = 0 +# @homework.author_id = User.current.id +# @homework.commit = 0 +# @homework.homework_type = 1 +# @homework.is_evaluation = params[:bid][:is_evaluation] +# @homework.parent_id = @bid.id +# @homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) +# # @bid. +# if @homework.save +# HomeworkForCourse.create(:course_id => params[:course], :bid_id => @homework.id) +# unless @bid.watched_by?(User.current) +# if @bid.add_watcher(User.current) +# flash[:notice] = l(:label_bid_succeed) +# end +# end +# redirect_to course_for_bid_path(@homework) +# else +# @bid.safe_attributes = params[:bid] +# @courses = [] +# @membership = User.current.coursememberships.all#(:conditions => Project.visible_condition(User.current)) +# @membership.each do |membership| +# @courses << membership.course +# end +# render :action => 'fork' +# end +# end +# +# #有两个路由链接到此方法:/bids/:id /calls/:id但是貌似这两个路由都不能访问。。方法作用有待确认 +# def show +# @user = @bid.author +# @jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') +# @limit = 10 +# @feedback_count = @jours.count +# @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] +# @offset ||= @feedback_pages.offset +# @jour = @jours[@offset, @limit] +# @state = false +# +# respond_to do |format| +# layout_file = '' +# case @bid.reward_type +# when 3 +# html_title(l(:label_question_student)) +# layout_file = 'base_homework' +# when 1 +# layout_file = 'base_bids' +# else +# layout_file = 'base_contest' +# end +# format.html { +# render :layout => layout_file +# } +# format.api +# end +# end +# +# def join_in_contest +# if @bid.reward_type == 2 && params[:course_password] == @bid.password +# JoinInContest.create(:user_id => User.current.id, :bid_id => @bid.id) +# @state = 0 +# else +# @state = 1 +# end +# respond_to do |format| +# format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} } +# end +# end +# +# def unjoin_in_contest +# joined = JoinInContest.where('bid_id = ? and user_id = ?', @bid.id, User.current.id) +# joined.each do |join| +# join.delete +# end +# respond_to do |format| +# format.js { render :partial => 'set_join', :locals => {:user => User.current, :object_id => params[:id]} } +# end +# end +# +# def new_join +# +# end +# +# # added by bai 增加了参与者和竞赛设置 +# def show_participator +# render :layout => 'base_contest' +# end +# +# #配置竞赛 +# def settings +# if @bid.author.id == User.current.id +# if @bid.reward_type == 2 +# @contest = Bid.find_by_reward_type(@bid.reward_type) +# render :layout => 'base_contest' +# end +# else +# render_403 :message => :notice_not_contest_setting_authorized +# end +# end +# #end +# +# # 显示课程作业,但是好像已经废弃 +# def show_course +# bids = Bid.where('parent_id = ?', @bid.id) +# @courses = [] +# for bid in bids +# @courses << bid.courses.first +# end +# +# respond_to do |format| +# if @bid.reward_type == 3 +# format.html { +# render :layout => 'base_homework' +# } +# elsif @bid.reward_type == 1 +# format.html { +# render :layout => 'base_bids' +# } +# else +# format.html { +# render :layout => 'base_contest' +# } +# end +# format.api +# +# end +# end +# +# def show_bid_project +# bids = Bid.where('parent_id = ?', @bid.id) +# @projects = [] +# for bid in bids +# @projects += bid.biding_projects +# end +# +# respond_to do |format| +# if @bid.reward_type == 3 +# format.html { +# render :layout => 'base_homework' +# } +# elsif @bid.reward_type == 1 +# format.html { +# render :layout => 'base_bids' +# } +# else +# format.html { +# render :layout => 'base_contest' +# } +# end +# format.api +# +# end +# end +# +# def show_bid_user +# bids = Bid.where('parent_id = ?', @bid.id) +# @users = [] +# for bid in bids +# for project in bid.projects +# @users += project.users +# end +# end +# +# respond_to do |format| +# if @bid.reward_type == 3 +# format.html { +# render :layout => 'base_homework' +# } +# elsif @bid.reward_type == 1 +# format.html { +# render :layout => 'base_bids' +# } +# else +# format.html { +# render :layout => 'base_contest' +# } +# end +# format.api +# +# end +# end +# +# def show_project +# # flash[:notice] = "" +# @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) +# @option = [] +# @membership.each do |membership| +# unless(membership.project.project_type==1) +# if membership.user.allowed_to?(:quote_project,membership.project) +# @option << membership.project +# end +# end +# end +# +# # a = [1] +# # @project = Project.where("id in []", a) +# @user = @bid.author +# @bidding_project = @bid.biding_projects.all +# if params[:student_id].present? +# @temp = [] +# @bidding_project.each do |pro| +# if pro.project && pro.project.project_status +# if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id +# @temp << pro +# end +# end +# @temp +# end +# @bidding_project = @temp +# else +# #added by nie +# @temp = [] +# @bidding_project.each do |pro| +# if pro.project && pro.project.project_status +# @temp << pro +# end +# @temp +# end +# if @temp.size > 0 +# @bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade} +# end +# #ended +# end +# +# if @bid.homework_type == 1 +# @homework = HomeworkAttach.new +# #@homework_list = @bid.homeworks +# #增加作业按评分排序, +# @homework_list = @bid.homeworks.eager_load(:rate_averages, :user, :attachments).order('seems_rateable_cached_ratings.avg DESC').order("#{HomeworkAttach.table_name}.created_at ASC") +# if params[:student_id].present? +# @temp = [] +# @homework_list.each do |pro| +# if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id +# @temp << pro +# end +# @temp +# end +# @homework_list = @temp +# end +# end +# +# respond_to do |format| +# if @bid.reward_type == 3 +# format.html { +# render :layout => 'base_homework' +# } +# elsif @bid.reward_type == 1 +# format.html { +# render :layout => 'base_bids' +# } +# else +# format.html { +# render :layout => 'base_contest' +# } +# end +# format.api +# end +# end +# +# # 显示作业课程 +# # add by nwb +# def show_courseEx +# +# if (User.current.logged? && (User.current.member_of_course?(@bid.courses.first) || User.current.admin?)) +# @membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current)) +# @user = @bid.author +# @bidding_project = @bid.biding_projects.all +# +# if params[:student_id].present? +# @temp = [] +# @bidding_project.each do |pro| +# if pro.project && pro.project.project_status +# if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id +# @temp << pro +# end +# end +# @temp +# end +# @bidding_project = @temp +# else +# #added by nie +# @temp = [] +# @bidding_project.each do |pro| +# if pro.project && pro.project.project_status +# @temp << pro +# end +# @temp +# end +# if @temp.size > 0 +# @bidding_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade} +# end +# #ended +# end +# +# if @bid.homework_type +# @homework = HomeworkAttach.new +# @is_teacher = is_course_teacher(User.current,@bid.courses.first) +# if @is_teacher +# all_homework_list = HomeworkAttach.find_by_sql("SELECT * FROM (SELECT homework_attaches.*, +# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, +# (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score +# FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1 +# WHERE table1.t_score IS NULL") +# @not_batch_homework = true +# @cur_type = 1 +# else +# all_homework_list = HomeworkAttach.find_by_sql("SELECT homework_attaches.*, +# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, +# (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score, +# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = #{@is_teacher ? 1 : 0}) AS m_score +# FROM homework_attaches +# INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id +# WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY s_score DESC") +# @is_student_batch_homework = true +# @cur_type = 4 +# end +# +# @cur_page = params[:page] || 1 +# # @homework_list = paginateHelper all_homework_list,10 +# @homework_list = all_homework_list +# @jours_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count +# if params[:student_id].present? +# @temp = [] +# @homework_list.each do |pro| +# if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id +# @temp << pro +# end +# @temp +# end +# @homework_list = @temp +# end +# end +# +# respond_to do |format| +# if @bid.reward_type == 3 +# format.html { +# html_title(l(:label_homework_info)) +# render :layout => 'base_homework' +# } +# elsif @bid.reward_type == 1 +# format.html { +# render :layout => 'base_bids' +# } +# else +# format.html { +# render :layout => 'base_contest' +# } +# end +# format.api +# end +# else +# render_403 :message => :notice_not_authorized +# end +# end +# +# ##### by huang +# def show_project_homework +# # flash[:notice] = "" +# @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) +# @option = [] +# @membership.each do |membership| +# end +# # a = [1] +# # @project = Project.where("id in []", a) +# @user = @bid.author +# @bidding_project = @bid.biding_projects +# respond_to do |format| +# if @bid.reward_type == 3 +# format.html { +# render :layout => 'base_homework' +# } +# elsif @bid.reward_type == 1 +# format.html { +# render :layout => 'base_bids' +# } +# else +# format.html { +# render :layout => 'base_contest' +# } +# end +# format.api +# end +# end +# +# ###添加应标项目 +# def add +# project = Project.find(params[:bid]) +# bid_message = params[:bid_for_save][:bid_message] +# if BidingProject.where("project_id = ? and bid_id = ?", project.id, @bid.id).size == 0 +# if BidingProject.cerate_bidding(@bid.id, project.id, bid_message) +# +# # added by bai type ==1 需求,type==2 竞赛, type==3 作业 +# if @bid.reward_type == 1 +# flash.now[:notice] = l(:label_bidding_succeed) +# +# elsif @bid.reward_type == 2 +# flash.now[:notice] = l(:label_bidding_contest_succeed) +# +# else @bid.reward_type == 3 +# flash.now[:notice] = l(:label_bidding_homework_succeed) +# end +# # end +# +# end +# else +# if @bid.reward_type == 3 +# flash.now[:error] = l(:label_bidding_homework_fail) +# else +# flash.now[:error] = l(:label_bidding_fail) +# end +# end +# @bidding_project = @bid.biding_projects +# respond_to do |format| +# # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} +# # format.html +# format.html { redirect_to :back } +# format.js +# #format.api { render_api_ok } +# end +# end +# +# #删除已提交的项目作业(不删项目) +# def delete +# binding_project = params[:binding_project] +# if can_delete_project_homework(BidingProject.find(binding_project),User.current) +# if BidingProject.delete(binding_project) +# redirect_to project_for_bid_url +# else +# render_403; +# end +# end +# end +# ## 新建留言 +# def create +# +# if params[:bid_message][:message].size>0 +# if params[:reference_content] +# message = params[:bid_message][:message] + "\n" + params[:reference_content] +# else +# message = params[:bid_message][:message] +# @m = message +# end +# refer_user_id = params[:bid_message][:reference_user_id].to_i +# @bid.add_jour(User.current, message, refer_user_id) +# end +# @user = @bid.author +# @jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') +# @jour = paginateHelper @jours,10 +# @bid.set_commit(@feedback_count) +# respond_to do |format| +# format.js +# #format.api { render_api_ok } +# end +# +# end +# +# ##删除留言 +# def destroy +# @user = @bid.author +# if User.current.admin? || User.current.id == @user.id +# JournalsForMessage.delete_message(params[:object_id]) +# end +# @jours = @bid.journals_for_messages.reverse +# @limit = 10 +# @feedback_count = @jours.count +# @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] +# @offset ||= @feedback_pages.offset +# @jour = @jours[@offset, @limit] +# +# @bid.set_commit(@feedback_count) +# # if a_message.size > 5 +# # @message = a_message[-5, 5] +# # else +# # @message = a_message +# # end +# # @message_count = a_message.count +# +# respond_to do |format| +# # format.html +# format.js +# #format.api { render_api_ok } +# end +# end +# +# #删除作业 +# #by xianbo +# def homework_destroy +# @bid_to_destroy = Bid.find params[:id] +# course_url = course_homework_path(@bid_to_destroy.courses.first) +# (render_403; return false) unless User.current.admin?||User.current.id==@bid_to_destroy.author_id +# @bid_to_destroy.destroy +# respond_to do |format| +# format.html { redirect_to course_url } +# format.js +# #format.api { render_api_ok } +# end +# end +# +# #end by xianbo +# ##引用 +# def new +# @jour = JournalsForMessage.find(params[:journal_id]) if params[:journal_id] +# if @jour +# user = @jour.user +# text = @jour.notes +# else +# user = @bid.author +# text = @bid.description +# end +# # Replaces pre blocks with [...] +# text = text.to_s.strip.gsub(%r{
((.|\s)*?)
}m, '[...]') +# @content = "> #{ll(User.current.language, :text_user_wrote, user)}\n> " +# @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" +# @id = user.id +# rescue ActiveRecord::RecordNotFound +# render_404 +# end +# +# ##新建需求 +# def new_bid +# @bid = Bid.new +# @bid.safe_attributes = params[:bid] +# end +# +# #huang +# def create_contest +# @bid = Bid.new +# @bid.name = params[:bid][:name] +# @bid.description = params[:bid][:description] +# @bid.reward_type = 2 +# @bid.budget = params[:bid][:budget] +# @bid.deadline = params[:bid][:deadline] +# @bid.password = params[:bid][:password] #added by bai +# @bid.author_id = User.current.id +# @bid.commit = 0 +# if @bid.save +# unless @bid.watched_by?(User.current) +# if @bid.add_watcher(User.current) +# flash[:notice] = l(:label_bid_succeed) +# end +# end +# redirect_to respond_url(@bid) +# else +# @bid.safe_attributes = params[:bid] +# render :action => 'new_bid' +# end +# end +# +# # added by bai +# def update_contest +# @bid = Bid.find(params[:id]) +# @bid.name = params[:bid][:name] +# @bid.description = params[:bid][:description] +# @bid.reward_type = 2 +# @bid.budget = params[:bid][:budget] +# @bid.deadline = params[:bid][:deadline] +# @bid.password = params[:bid][:password] +# @bid.author_id = User.current.id +# @bid.commit = 0 +# if @bid.save +# unless @bid.watched_by?(User.current) +# if @bid.add_watcher(User.current) +# flash[:notice] = l(:label_bid_succeed) +# end +# end +# redirect_to respond_url(@bid) +# else +# @bid.safe_attributes = params[:bid] +# render :action => 'new_bid' +# end +# end +# #huang +# def new_contest +# @bid = Bid.new +# @bid.safe_attributes = params[:bid] +# end +# +# def create_bid +# @bid = Bid.new +# @bid.name = params[:bid][:name] +# @bid.description = params[:bid][:description] +# @bid.reward_type = 1 +# @bid.budget = params[:bid][:budget] +# @bid.deadline = params[:bid][:deadline] +# @bid.author_id = User.current.id +# @bid.commit = 0 +# if @bid.save +# unless @bid.watched_by?(User.current) +# if @bid.add_watcher(User.current) +# flash[:notice] = l(:label_bid_succeed) +# end +# end +# redirect_to respond_url(@bid) +# else +# @bid.safe_attributes = params[:bid] +# render :action => 'new_bid' +# end +# end +# +# def create_homework +# @bid = Bid.new +# @bid.name = params[:bid][:name] +# @bid.description = params[:bid][:description] +# @bid.is_evaluation = params[:bid][:is_evaluation] +# @bid.proportion = params[:bid][:proportion] +# @bid.evaluation_num = params[:bid][:evaluation_num] +# params[:bid][:open_anonymous_evaluation] ? @bid.open_anonymous_evaluation = 1 : @bid.open_anonymous_evaluation = 0 +# @bid.reward_type = 3 +# # @bid.budget = params[:bid][:budget] +# @bid.deadline = params[:bid][:deadline] +# @bid.budget = 0 +# @bid.author_id = User.current.id +# @bid.commit = 0 +# @bid.homework_type = 1 +# @bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) +# # @bid. +# if @bid.save +# HomeworkForCourse.create(:course_id => params[:course_id], :bid_id => @bid.id) +# unless @bid.watched_by?(User.current) +# if @bid.add_watcher(User.current) +# flash[:notice] = l(:label_bid_succeed) +# end +# end +# redirect_to course_homework_url(params[:course_id]) +# else +# @bid.safe_attributes = params[:bid] +# @homework = @bid +# @course = Course.find_by_id(params[:course_id]) +# @course_id = @course.id +# #respond_to do |format| +# # format.html { redirect_to new_homework_course_path(params[:course_id]),:layout => 'base_courses'} +# # format.api { render_validation_errors(@bid) } +# #end +# render file: 'courses/new_homework', layout: 'base_courses' +# end +# end +# +# # modify by nwb\ +# # 编辑作业 +# def edit +# @bid = Bid.find(params[:bid_id]) +# if (User.current.admin?||User.current.allowed_to?(:as_teacher,@bid.courses.first)) +# @course_id = params[:course_id] +# respond_to do |format| +# format.html { +# @course = Course.find(params[:course_id]) +# @user= User.find(User.current.id) +# render :layout => 'base_courses' +# } +# end +# else +# render_403 +# end +# end +# +# def update +# @bid = Bid.find(params[:id]) +# @course = @bid.courses.first#Project.find(params[:course_id]) +# @bid.name = params[:bid][:name] +# @bid.description = params[:bid][:description] +# @bid.is_evaluation = params[:bid][:is_evaluation] +# @bid.proportion = params[:bid][:proportion] +# @bid.evaluation_num = params[:bid][:evaluation_num] +# params[:bid][:open_anonymous_evaluation] ? @bid.open_anonymous_evaluation = 1 : @bid.open_anonymous_evaluation = 0 +# @bid.reward_type = 3 +# @bid.deadline = params[:bid][:deadline] +# @bid.budget = 0 +# #@bid.author_id = User.current.id +# @bid.commit = 0 +# @bid.homework_type = 1 +# @bid.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) +# if @bid.save +# flash[:notice] = l(:label_update_homework_succeed) +# redirect_to course_homework_url(@course) +# else +# @bid.safe_attributes = params[:bid] +# render :action => 'edit', :layout =>'base_courses' +# end +# end +# +# def new_submit_homework +# #render html to prepare create submit homework +# find_bid +# find_bid +# render :layout => 'base_homework' +# end +# +# def add_homework +# if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) +# # homework = HomeworkAttach.create(:bid_id => @bid.id, :user_id => User.current.id) +# # homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads])) +# +# if hadcommittedhomework(User.current.id, @bid.id) == true +# @homework_flag = l(:label_bidding_homework_committed) +# else +# @homework = HomeworkAttach.new +# @homework.safe_attributes = params[:homeworkattach] +# @homework.bid_id = @bid.id +# @homework.user_id = User.current.id +# @homework.save_attachments(params[:attachments]) +# +# render_attachment_warning_if_needed(@homework) +# +# @homework_flag = if @homework.save +# l(:label_bidding_homework_succeed) +# else +# l(:label_bidding_homework_failed) +# end +# +# if @homework.attachments.empty? +# @homework.delete +# #flash[:error] = l(:no_attachmens_allowed) +# @homework_flag = l(:no_attachmens_allowed) +# # else +# end +# end +# end +# +# @homework_list = @bid.homeworks +# respond_to do |format| +# format.html{ +# #redirect_to project_for_bid_path, notice: @homework_flag.to_s +# flash[:notice] = @homework_flag.to_s +# redirect_back_or_default(project_for_bid_path) +# } +# format.js +# end +# +# end +# +# # 作业统计 +# def homework_statistics +# @course = @bid.courses.first +# @member = [] +# @course.memberships.each do |member| +# unless (member.roles && Role.where('id = ? ', 3)).empty? +# @member.push member +# end +# end +# if @bid.homework_type = 1 +# @student = User.where("id in (select DISTINCT user_id from #{HomeworkAttach.table_name} where bid_id = ? )", @bid.id) +# @homework_type = true +# else +# +# @homework_type = false +# end +# @user = @bid.author +# render :layout => 'base_homework' +# end +# +# def homework_respond +# @user = @bid.author +# render :layout => 'base_homework' +# end +# +# def more +# @jour = @bid.journals_for_messages +# @jour.each_with_index {|j,i| j.indice = i+1} +# @state = true +# +# respond_to do |format| +# format.html { redirect_to :back } +# format.js +# #format.api { render_api_ok } +# end +# end +# +# def back +# @jour = @bid.journals_for_messages +# @jour.each_with_index {|j,i| j.indice = i+1} +# @state = false +# +# respond_to do |format| +# format.html { redirect_to :back } +# format.js +# #format.api { render_api_ok } +# end +# end +# +# #added by william +# #used to set the bidding project reward +# def set_reward +# @b_p = nil +# @biding_project_id = nil +# +# if params[:set_reward][:reward]&&((User.current.id==@bid.author_id)||User.current.admin) +# # @bid_id = params[:id] +# @biding_project_id = params[:set_reward][:b_id] +# @b_p = BidingProject.find_by_id(@biding_project_id) +# +# # 把字段存进表中 +# @b_p.update_reward(params[:set_reward][:reward].to_s) +# end +# +# respond_to do |format| +# format.js +# end +# end +# +# # added by william +# # used to manage the bid and end the bid +# def manage +# +# end +# +# # 启动匿评 +# def start_anonymous_comment +# @bid = Bid.find(params[:id]) +# @course = @bid.courses.first +# if(@bid.comment_status == 0) +# homeworks = @bid.homeworks +# if(homeworks && homeworks.size >= 2) +# homeworks.each_with_index do |homework, index| +# user = homework.user +# n = @bid.evaluation_num +# n = n < homeworks.size ? n : homeworks.size - 1 +# assigned_homeworks = get_assigned_homeworks(homeworks, n, index) +# assigned_homeworks.each do |h| +# @homework_evaluation = HomeworkEvaluation.new(user_id: user.id, homework_attach_id: h.id) +# @homework_evaluation.save +# end +# end +# @bid.update_column('comment_status', 1) +# @statue = 1 +# else +# @statue = 2 +# end +# else +# @statue = 3 +# end +# +# respond_to do |format| +# format.js +# end +# end +# +# def stop_anonymous_comment +# @bid = Bid.find(params[:id]) +# +# @bid.update_column('comment_status', 2) +# +# respond_to do |format| +# format.js +# end +# end +# +# def alert_anonymous_comment +# @bid = Bid.find params[:id] +# @course = @bid.courses.first +# @cur_size = 0 +# @totle_size = 0 +# if @bid.comment_status == 0 +# @totle_size = searchStudent(@course).size +# @cur_size = @bid.homeworks.size +# elsif @bid.comment_status == 1 +# @bid.homeworks.map { |homework| @totle_size += homework.homework_evaluations.count} +# @cur_size = 0 +# @bid.homeworks.map { |homework| @cur_size += homework.rates(:quality).where("seems_rateable_rates.is_teacher_score = 0").count} +# end +# @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) +# respond_to do |format| +# format.js +# end +# end +# +# private +# +# def get_assigned_homeworks(homeworks, n, index) +# homeworks += homeworks +# homeworks[index + 1 .. index + n] +# end +# +# def find_bid +# if params[:id] +# @bid = Bid.find(params[:id], :include => [{:homeworks => :user}]) +# @user = @bid.author +# end +# rescue +# render_404 +# end +# +# def memberAccess +# # 是课程,则判断当前用户是否参加了课程 +# return true if current_user.admin? +# #return 0 if @bid.courses.first.project_type == Project::ProjectType_project +# currentUser = User.current +# render_403 unless currentUser.member_of_course?(@bid.courses.first) +# end +# +# #验证是否显示课程 +# def can_show_course +# @first_page = FirstPage.find_by_page_type('project') +# if @first_page.show_course == 2 +# render_404 +# end +# end +# +# #验证是否显示竞赛 +# def can_show_contest +# @first_page = FirstPage.find_by_page_type('project') +# if @first_page.show_contest == 2 +# render_404 +# end +# end +# end +# From 59c4e04e37101bac8a6ad373f3c6afcb3e386514 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 09:57:33 +0800 Subject: [PATCH 015/130] =?UTF-8?q?=E5=88=A0=E9=99=A4bid=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 2 +- config/routes.rb | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 7db03aca1..aa1c369a0 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -1,5 +1,5 @@ # # fq -#Bid功能已经废弃 +#Bid功能已经废弃,代码参考用 # class BidsController < ApplicationController # #Added by young # menu_item l(:label_homework), :only => [:edit, :udpate] diff --git a/config/routes.rb b/config/routes.rb index e166e37e5..d2c21f6ea 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -257,7 +257,6 @@ RedmineApp::Application.routes.draw do post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' # boards end - # delete 'bids/homework', :to => 'bids#homework_destroy' # Misc issue routes. TODO: move into resources match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' @@ -764,7 +763,6 @@ RedmineApp::Application.routes.draw do delete 'attachment/:id', :to => 'attachments#delete_homework' match 'new_join', :to => 'courses#new_join', :as => 'try_join' match 'new_join_group', :to => 'courses#new_join_group', :as => 'try_join_group' - # match 'new_join_in_contest', :to => 'bids#new_join', :as => 'try_join_in_contest' match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post ######################## From 523dc9b343dae770e1ae6ed9ab38b32917790438 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 10:06:30 +0800 Subject: [PATCH 016/130] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E3=80=81=E5=8F=91=E5=B8=96=E5=9B=9E=E5=B8=96=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 9e36d15f4..c3cb3d8c9 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -94,8 +94,8 @@ class MessagesController < ApplicationController update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE end # 与我相关动态的记录add start - if(@board.course_id>0) #项目的先不管 - teachers = searchTeacherAndAssistant(@board.course); + if(@board && @board.course) #项目的先不管 + teachers = searchTeacherAndAssistant(@board.course) for teacher in teachers if(teacher.user_id != User.current.id) notify = ActivityNotify.new() @@ -178,7 +178,7 @@ class MessagesController < ApplicationController end # 与我相关动态的记录add start - if(@board.course_id>0) #项目的先不管 + if(@board && @board.course) #项目的先不管 notifyto_arr = {} notifyto_arr[@topic.author_id] = @topic.author_id if( params[:parent_topic] != nil && params[:parent_topic] != '') From d9dd744fb1f20781c23bb5e9aabe0993bfc275d8 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 5 Jun 2015 10:16:16 +0800 Subject: [PATCH 017/130] ... --- app/controllers/messages_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index c3cb3d8c9..b1da35cfc 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -99,7 +99,7 @@ class MessagesController < ApplicationController for teacher in teachers if(teacher.user_id != User.current.id) notify = ActivityNotify.new() - if(@board.course_id>0) + if(@board.course) notify.activity_container_id = @board.course_id notify.activity_container_type = 'Course' else @@ -188,7 +188,7 @@ class MessagesController < ApplicationController notifyto_arr.each do |k,user_id| if(user_id != User.current.id) notify = ActivityNotify.new() - if(@board.course_id>0) + if(@board.course) notify.activity_container_id = @board.course_id notify.activity_container_type = 'Course' else From 8fcf7ac7a815bfed361a1fc617a5dc52802fd14f Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 5 Jun 2015 10:25:42 +0800 Subject: [PATCH 018/130] ... --- app/views/courses/show.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 63285a2cd..60134381f 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -49,6 +49,8 @@ <% end%> <% end%> +<% elsif @controller_name=='ActivityNotifys' %> +

<%= l(:label_no_data) %>

<% end%> <% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
From 7bab135ac795e69001cc7fa89c8d90dae8260efc Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 10:25:58 +0800 Subject: [PATCH 019/130] =?UTF-8?q?1=E3=80=81=E4=B8=8A=E4=BC=A0=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=97=B6=E5=85=AC=E5=BC=80=E5=8D=95=E9=80=89=E6=A1=86?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=202=E3=80=81=E8=AF=BE=E7=A8=8B=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=E6=9C=89=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_course_file.html.erb | 2 +- public/stylesheets/courses.css | 2 -- public/stylesheets/project.css | 2 -- public/stylesheets/public.css | 1 + 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index ebccfcaf4..8283e15b7 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -31,7 +31,7 @@ } showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before(""); + $('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("popbox_polls"); } diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 7d4436704..bbc6f5b55 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -380,8 +380,6 @@ span.add_attachment {font-size: 80%;line-height: 2.5em;} .attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';} .attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; } a.remove-upload:hover {text-decoration:none !important;} -.attachments_fields input.is_public_checkbox {width:20px;} - .attachments_fields span.ispublic-label {display: inline-block;width: 30px;margin-left: 10px;} a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%;width: 1px;display: inline-block;padding-left: 16px;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 6cba7011f..a32a050d7 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -241,8 +241,6 @@ blockquote {background: #eeeeee;padding: 10px;margin-bottom: 10px;} #attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';} #attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; } a.remove-upload:hover {text-decoration:none !important;} -#attachments_fields input.is_public_checkbox {width:20px;} - #attachments_fields span.ispublic-label {display: inline-block;width: 30px;margin-left: 10px;} a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%;width: 1px;display: inline-block;padding-left: 16px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 306520f96..59431b3ad 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -438,3 +438,4 @@ a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} .tl{text-align: left;} img{max-width: 100%;} .attachments {clear: both;} +.is_public_checkbox{margin-left: 15px;margin-right: 10px;} From bf653fa94f37ec0fa0391167532cb814bc429e56 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 10:31:51 +0800 Subject: [PATCH 020/130] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/index.html.erb | 2 +- public/javascripts/course.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 1cd665569..c9e8cd4c6 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -36,7 +36,7 @@ <% if @show_all%> - 搜索 + 搜索 <% end%> <% if @is_teacher%>
diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 0570ec437..74dceddc1 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -793,7 +793,7 @@ function SearchByName(obj,url,event) location.href = url + "&name=" + obj.val(); } } -function SearchByName(obj,url) +function SearchByName_1(obj,url) { location.href = url + "&name=" + obj.val(); } From a456616212ac7c0d964068e62eae1d5701a49715 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 5 Jun 2015 10:33:42 +0800 Subject: [PATCH 021/130] ... --- app/controllers/activity_notifys_controller.rb | 4 +--- app/views/courses/show.html.erb | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/activity_notifys_controller.rb b/app/controllers/activity_notifys_controller.rb index c696836b2..01e4260ea 100644 --- a/app/controllers/activity_notifys_controller.rb +++ b/app/controllers/activity_notifys_controller.rb @@ -15,11 +15,10 @@ class ActivityNotifysController < ApplicationController end if( query != nil ) - logger.info('xxoo') limit = 10; @obj_count = query.count(); @obj_pages = Paginator.new @obj_count,limit,params['page'] - list = query.order('id desc').limit(limit).offset(@obj_pages.offset).all(); + list = query.order('is_read,id desc').limit(limit).offset(@obj_pages.offset).all(); events=[]; for item in list event = item.activity; @@ -29,7 +28,6 @@ class ActivityNotifysController < ApplicationController end @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} @controller_name = 'ActivityNotifys' - logger.info('aavv') end respond_to do |format| format.html {render :template => 'courses/show', :layout => 'base_courses'} diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 60134381f..9bbe4ea5a 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -3,7 +3,9 @@ <%= l(:label_activity)%>

与我相关

- + + +
<% else %>

<%= l(:label_activity)%>

From c31e370ad62db1330dc298a058fbd49247f41544 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 10:37:24 +0800 Subject: [PATCH 022/130] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=9A=E9=80=89=E4=BA=BA=E6=88=91=E7=9A=84?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E3=80=81=E9=80=89=E5=85=A5=E6=88=91=E7=9A=84?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E8=AF=BE=E7=A8=8B=E5=BC=B9=E5=87=BA=E6=A1=86?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E6=8C=89=E9=92=AE=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/quote_resource_show.js.erb | 2 +- public/javascripts/course.js | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/views/files/quote_resource_show.js.erb b/app/views/files/quote_resource_show.js.erb index fa1f8f4ca..76025fbd2 100644 --- a/app/views/files/quote_resource_show.js.erb +++ b/app/views/files/quote_resource_show.js.erb @@ -6,6 +6,6 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); +$('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 74dceddc1..b629530f0 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -757,8 +757,8 @@ function goTopEx() { } } -//匿评评分提示 $(function(){ + //匿评评分提示 $(".student_score_info").bind("mouseover",function(e){ //alert($(this).html()); $(this).find("div").show(); @@ -769,6 +769,8 @@ $(function(){ //alert($(this).html()); $(this).find("div").hide(); }); + + $("#about_project label").eq(1).remove(); }); //匿评弹框取消按钮 @@ -797,7 +799,3 @@ function SearchByName_1(obj,url) { location.href = url + "&name=" + obj.val(); } - -$(function(){ - $("#about_project label").eq(1).remove(); -}); \ No newline at end of file From 9d1100a9dfb0a6a56915ffc5602d54eb3ba628da Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 10:50:43 +0800 Subject: [PATCH 023/130] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=86=85=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E9=80=89=E4=BA=BA=E6=88=91=E7=9A=84=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_project_file_new.html.erb | 2 +- app/views/files/quote_resource_show_project.js.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/files/_project_file_new.html.erb b/app/views/files/_project_file_new.html.erb index 1e217f991..878e6a75e 100644 --- a/app/views/files/_project_file_new.html.erb +++ b/app/views/files/_project_file_new.html.erb @@ -5,7 +5,7 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => project}) %>'); showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); - $('#ajax-modal').before(""); + $('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","40%").css("left","36%"); $('#ajax-modal').parent().addClass("popbox_polls"); } diff --git a/app/views/files/quote_resource_show_project.js.erb b/app/views/files/quote_resource_show_project.js.erb index d1a44e90f..41dc19fc5 100644 --- a/app/views/files/quote_resource_show_project.js.erb +++ b/app/views/files/quote_resource_show_project.js.erb @@ -6,6 +6,6 @@ showModal('ajax-modal', '513px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); +$('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","30%").css("left","35%"); $('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file From 8b0eb21d0828b7948a6a9056d94a3d5aea2ef2d6 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 11:17:00 +0800 Subject: [PATCH 024/130] =?UTF-8?q?=E5=85=B3=E6=B3=A8=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=8F=96=E6=B6=88=EF=BC=8C=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=BF=9B=E5=85=A5=E4=B8=AA=E4=BA=BA=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 84 ++++++++++++++--------------- lib/redmine.rb | 4 +- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0382e7be0..23053a48e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -25,7 +25,7 @@ class UsersController < ApplicationController menu_item :user_course, :only => :user_courses menu_item :user_homework, :only => :user_homeworks menu_item :user_project, :only => [:user_projects, :watch_projects] - menu_item :requirement_focus, :only => :watch_bids + # menu_item :requirement_focus, :only => :watch_bids menu_item :requirement_focus, :only => :watch_contests menu_item :user_newfeedback, :only => :user_newfeedback @@ -36,14 +36,14 @@ class UsersController < ApplicationController # before_filter :can_show_course, :only => [:user_courses,:user_homeworks] - before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info, + before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_contests, :info, :user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index, :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,:update_score,:user_activities,:user_projects_index] #edit has been deleted by huang, 2013-9-23 before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, - :watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, + :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :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 @@ -141,25 +141,25 @@ class UsersController < ApplicationController ##added by fq def watch_bids - cond = 'bids.reward_type <> 1' - @bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang - @offset, @limit = api_offset_and_limit({:limit => 10}) - @bid_count = @bids.count - @bid_pages = Paginator.new @bid_count, @limit, params['page'] - @offset ||= @bid_pages.reverse_offset - unless @offset == 0 - @bid = @bids.offset(@offset).limit(@limit).all.reverse - else - limit = @bid_count % @limit - @bid = @bids.offset(@offset).limit(limit).all.reverse - end - - respond_to do |format| - format.html { - render :layout => 'base_users' - } - format.api - end + # cond = 'bids.reward_type <> 1' + # @bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang + # @offset, @limit = api_offset_and_limit({:limit => 10}) + # @bid_count = @bids.count + # @bid_pages = Paginator.new @bid_count, @limit, params['page'] + # @offset ||= @bid_pages.reverse_offset + # unless @offset == 0 + # @bid = @bids.offset(@offset).limit(@limit).all.reverse + # else + # limit = @bid_count % @limit + # @bid = @bids.offset(@offset).limit(limit).all.reverse + # end + # + # respond_to do |format| + # format.html { + # render :layout => 'base_users' + # } + # format.api + # end end #new add by linchun @@ -215,24 +215,24 @@ class UsersController < ApplicationController # added by huang def user_homeworks - @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current)) - @memberships = [] - @membership.each do |membership| - if membership.project.project_type == 1 - @memberships << membership - end - end - @bid = [] - @memberships.each do |membership| - @bid += membership.project.homeworks - end - @bid = @bid.group_by {|bid| bid.courses.first.id} - unless User.current.admin? - if !@user.active? - render_404 - return - end - end + # @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current)) + # @memberships = [] + # @membership.each do |membership| + # if membership.project.project_type == 1 + # @memberships << membership + # end + # end + # @bid = [] + # @memberships.each do |membership| + # @bid += membership.project.homeworks + # end + # @bid = @bid.group_by {|bid| bid.courses.first.id} + # unless User.current.admin? + # if !@user.active? + # render_404 + # return + # end + # end end @@ -757,7 +757,7 @@ class UsersController < ApplicationController when '3' then @obj = Issue.find_by_id(@obj_id) when '4' then - @obj = Bid.find_by_id(@obj_id) + # @obj = Bid.find_by_id(@obj_id) when '5' then @obj = Forum.find_by_id(@obj_id) when '6' @@ -800,7 +800,7 @@ class UsersController < ApplicationController when '3' then @obj = Issue.find_by_id(@obj_id) when '4' then - @obj = Bid.find_by_id(@obj_id) + # @obj = Bid.find_by_id(@obj_id) when '5' then @obj = Forum.find_by_id(@obj_id) when '6' diff --git a/lib/redmine.rb b/lib/redmine.rb index 60488b8d0..ba0fd0cee 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -451,7 +451,7 @@ Redmine::MenuManager.map :user_enterprise_menu do |menu| menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.host_name} - menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user} + # menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user} menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.host_user} end @@ -459,7 +459,7 @@ Redmine::MenuManager.map :user_menu_self do |menu| menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.host_name } menu.push :user_information, {:controller => 'users', :action => 'info', :host => Setting.host_user} menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.host_name} - menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user} + # menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user} menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.host_user} end From f466084a17ab9d14956bd2bf2f31f45d22f636ec Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 11:22:38 +0800 Subject: [PATCH 025/130] =?UTF-8?q?=E5=9C=B0=E5=8C=BA=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=B0=B1=E4=B8=8D=E6=98=BE=E7=A4=BA=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_users.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 269017eb8..0ebdea211 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -218,7 +218,7 @@ <% end %> - <% unless @user.user_extensions.nil?&&@user.user_extensions.location.empty?%> + <% if @user.user_extensions && @user.user_extensions.location && !@user.user_extensions.location.empty?%> From 2e7c6c4afbdd0251a9fca2879f0379f2f02cbcb5 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 5 Jun 2015 11:39:55 +0800 Subject: [PATCH 026/130] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug#2725=20:=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=90=9C=E7=B4=A2--=E9=BB=98=E8=AE=A4=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8D=E5=92=8C=E5=A7=93=E5=90=8D=E4=B8=80=E8=B5=B7?= =?UTF-8?q?=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/users_service.rb | 4 +++- app/views/users/search.html.erb | 4 ++-- app/views/welcome/_search_project.html.erb | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/services/users_service.rb b/app/services/users_service.rb index aff0a975c..7e8e775ed 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -255,7 +255,9 @@ class UsersService watcher.push(params[:user_id]) scope = scope.where("id not in (?)",watcher) end - scope = scope.like(params[:name],search_by) + #scope = scope.like(params[:name],search_by) + scope = scope.where("( LOWER(login) LIKE ? or LOWER(concat(lastname, firstname)) LIKE ? or LOWER(mail) LIKE ? )", + "%#{params[:name]}%","%#{params[:name]}%","%#{params[:name]}%") end #modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end else diff --git a/app/views/users/search.html.erb b/app/views/users/search.html.erb index ef1db3b0c..13979f79f 100644 --- a/app/views/users/search.html.erb +++ b/app/views/users/search.html.erb @@ -30,8 +30,8 @@ <%#= hidden_field_tag 'project_type', project_type %>
From 427553d4e5b03ef789a682928f7ed42a4c49d9bb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 13:56:13 +0800 Subject: [PATCH 027/130] =?UTF-8?q?=E8=80=81=E5=B8=88=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E3=80=81=E5=AD=A6=E7=94=9F=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=97=B6=E5=88=A0=E9=99=A4=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E6=B2=A1=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 8 ++++---- app/views/layouts/base_users.html.erb | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index ec0480c19..353108dc7 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -216,13 +216,13 @@ class AttachmentsController < ApplicationController if @attachment.container.is_a?(News) format.html { redirect_to_referer_or news_path(@attachment.container) } elsif @attachment.container.is_a?(StudentWorksScore) - @is_destroy = true #根据ID删除页面对应的数据,js刷新页面 + @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据,js刷新页面 format.js elsif @attachment.container.is_a?(HomeworkCommon) - @is_destroy = true #根据ID删除页面对应的数据,js刷新页面 + @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据,js刷新页面 format.js elsif @attachment.container.is_a?(StudentWork) - @is_destroy = true #根据ID删除页面对应的数据,js刷新页面 + @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据,js刷新页面 format.js elsif @attachment.container.is_a?(Message) format.html { redirect_to_referer_or new_board_message_path(@attachment.container) } @@ -246,7 +246,7 @@ class AttachmentsController < ApplicationController end format.js - end + end end def delete_homework diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 0ebdea211..5686c9a1b 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -220,7 +220,6 @@ <% end %> <% if @user.user_extensions && @user.user_extensions.location && !@user.user_extensions.location.empty?%> - <%= l(:label_location) %>: From 18e41e562a3a71d877aa16c3f03b8831e1dabcc6 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 5 Jun 2015 14:16:21 +0800 Subject: [PATCH 028/130] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E5=8A=A0=E4=B8=8A=E5=85=B6=E4=BB=96=E7=9A=84?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/show.html.erb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 589a0f25d..bf276925a 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -1,11 +1,11 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +<%#= javascript_include_tag "/assets/kindeditor/kindeditor-min" %> <% if @project %> <%= render :partial => 'project_show', locals: {project: @project} %> @@ -123,21 +124,20 @@ function nh_init_board(params){ if(params.textarea.data('init') == undefined){ //初始化编辑器 var editor = params.kindutil.create(params.textarea, { - resizeType : 1, - allowPreviewEmoticons : false, - allowImageUpload : false, - minWidth:"1px", - width:"565px", - items : ['emoticons'], +// allowPreviewEmoticons : false, +// allowImageUpload : false, + resizeType : 1,minWidth:"1px",width:"565px",height:"150px", + allowFileManager:true,uploadJson:"/kindeditor/upload", + fileManagerJson:"/kindeditor/filemanager", afterChange:function(){//按键事件 nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); }, afterCreate:function(){ - var toolbar = $("div[class='ke-toolbar']",params.about_talk); - $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); - params.toolbar_container.append(toolbar); +// var toolbar = $("div[class='ke-toolbar']",params.about_talk); +// $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); +// params.toolbar_container.append(toolbar); } - }); + }).loadPlugin('paste'); //主题输入框按键事件 params.inputsubject.keyup(function(){ From a967a86a1dbf8794287f13caccadfee9d63f950b Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 14:24:50 +0800 Subject: [PATCH 029/130] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6500?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 12 ++++++++++++ .../projects/invite_members_by_mail.html.erb | 18 +++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 3c34aa549..1793eb39c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -365,6 +365,18 @@ class ProjectsController < ApplicationController def invite_members_by_mail if User.current.member_of?(@project) || User.current.admin? @inviter_lists = InviteList.where(project_id:@project.id).all + unless @inviter_lists.blank? + @inviter_lists.each do|inviter_list| + @inviters = [] + @waiters = [] + @inviters << inviter_list.user + @inviters_count = @inviters.size + unless inviter_list.user.member_of?(@project) + @waiters << inviter_list.user + @waiters_count = @waiters.size + end + end + end @is_zhuce = false respond_to do |format| format.html diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index ce7ea2aa1..bb98b3356 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -79,19 +79,23 @@ <% end %> <%# 邀请用户的状态 %> <% unless @inviter_lists.blank? %> -
+
+ <% if @inviters_count > 0 %> 已邀请的用户
<% @inviter_lists.each do |inviter_list| %> - <%= inviter_list.user.name %>
+ <%= inviter_list.user.name unless inviter_list.user.nil? %>
<% end %> -
+ <% end %> +
+ <% unless @waiters_count == 0 %> 等待加入项目的用户
<% @inviter_lists.each do |inviter_list| %> - <% unless inviter_list.user.member_of?(@project) %> - <%= inviter_list.user.name %>
- <% end %> + <% unless inviter_list.user.member_of?(@project) %> + <%= inviter_list.user.name unless inviter_list.user.nil? %>
+ <% end %> <% end %> -
+ <% end %> +
<% end %>
From f7b3229065c264944ef42f32244bc48c5e9ee223 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 14:33:22 +0800 Subject: [PATCH 030/130] =?UTF-8?q?=E5=BD=93=E4=BD=9C=E5=93=81=E4=B8=AD?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E9=99=84=E4=BB=B6=E6=97=B6=EF=BC=8C=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 6 ++--- public/javascripts/application.js | 34 ++++++++++++++++----------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 043552872..d932d8b4d 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -30,8 +30,7 @@ class ZipdownController < ApplicationController if file_count > 0 zipfile = zip_bid bid else - render file: 'public/no_file_found.html' - return + zipfile = {:message => "no file"} end elsif params[:obj_class] == "HomeworkCommon" homework = HomeworkCommon.find params[:obj_id] @@ -41,8 +40,7 @@ class ZipdownController < ApplicationController if file_count > 0 zipfile = zip_homework_common homework else - render file: 'public/no_file_found.html' - return + zipfile = {:message => "no file"} end else logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!" diff --git a/public/javascripts/application.js b/public/javascripts/application.js index d9100b0bb..c514e8940 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -901,24 +901,30 @@ $(function(){ $('#download_homework_attachments').bind('ajax:complete', function (event, data, status, xhr) { if(status == 'success'){ var res = JSON.parse(data.responseText); - if(res.length<1){ - return; + if(res.length == null){ + alert("该作业没有任何附件可下载"); } - if(res.length==1){ - location.href = '/zipdown/download?file='+res[0].file;return; + else if(res.length<1){ + return; } - document.getElementById('light').style.display='block'; - $container = $('#light .upload_box_ul'); - $container.empty(); - for(var i = 0; i 1){ - des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载'; - } else { - des = '第'+res[i].index+'个学生的作品下载'; + else + { + if(res.length==1){ + location.href = '/zipdown/download?file='+res[0].file;return; } - $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + document.getElementById('light').style.display='block'; + $container = $('#light .upload_box_ul'); + $container.empty(); + for(var i = 0; i 1){ + des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载'; + } else { + des = '第'+res[i].index+'个学生的作品下载'; + } + $('
  • '+(i+1)+'. '+des+'  (共'+res[i].size+'M)
  • ').appendTo($container); + } } } }); From 412efb28fe1dac0a0352a85ac52fa26414ea244d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 14:39:37 +0800 Subject: [PATCH 031/130] =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E6=89=93=E5=BC=80=E4=B8=80=E4=B8=AAtab?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/index.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index 87bf37f04..1e8189ddb 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -16,9 +16,9 @@
    <%= link_to(image_tag(url_to_avatar(homework.user), :width => "42", :height => "42"), user_path(homework.user), :class => "problem_pic fl") %>
    - <%= link_to(homework.user.lastname+homework.user.firstname, user_path(homework.user),:class => 'problem_name fl') %> + <%= link_to(homework.user.lastname+homework.user.firstname, user_path(homework.user),:class => 'problem_name fl',:target => "_blank") %> <%= l(:label_user_create_project_homework) %>: - <%= link_to(homework.name, student_work_index_path(:homework => homework.id), :class => 'problem_tit fl fb c_dblue') %> + <%= link_to(homework.name, student_work_index_path(:homework => homework.id), :class => 'problem_tit fl fb c_dblue',:target => "_blank") %>

    <%= l(:lebel_homework_commit)%> From 54abe5d85820c3d6c8f991804563c3f1ca6589e8 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 14:51:36 +0800 Subject: [PATCH 032/130] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=AD=89=E5=BE=85?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E7=9A=84=E6=88=90=E5=91=98=E5=88=99=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/invite_members_by_mail.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index bb98b3356..7b3a4c552 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -87,7 +87,7 @@ <% end %> <% end %>
    - <% unless @waiters_count == 0 %> + <% unless @waiters_count.nil? %> 等待加入项目的用户
    <% @inviter_lists.each do |inviter_list| %> <% unless inviter_list.user.member_of?(@project) %> From a148c49fa9ba5a44a948342d1578d854b2608bc0 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 15:02:22 +0800 Subject: [PATCH 033/130] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E7=BB=99=E5=87=BA?= =?UTF-8?q?=E6=BF=80=E6=B4=BB=E8=B4=A6=E5=8F=B7=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/send_invite_in_project.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/mailer/send_invite_in_project.html.erb b/app/views/mailer/send_invite_in_project.html.erb index 6dbfcbda6..51b189f37 100644 --- a/app/views/mailer/send_invite_in_project.html.erb +++ b/app/views/mailer/send_invite_in_project.html.erb @@ -4,9 +4,9 @@

  • <%= l(:mail_issue_content)%> -

    <%= @subject %>

    -

    <%= link_to @project_url, @project_url%>

    -

    点击链接后,将自动为您注册账号

    +

    <%= @subject %>

    +

    点击链接激活账号,系统会依据给出的密码和账号自动登录Trustie平台。

    +

    <%= link_to @project_url, @project_url%>

    您的账号为:<%= @email %>

    密码为: <%= @password %>

    From 8adb00fccb70e5f865fd3f6f78c3ae1a38cd1b55 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 15:26:14 +0800 Subject: [PATCH 034/130] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E9=82=AE=E4=BB=B6=E4=B8=AD=E6=A0=B7=E5=BC=8F=E5=92=8C?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=B8=8D=E4=B8=80=E8=87=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/message_posted.html.erb | 2 +- app/views/mailer/send_invite_in_project.html.erb | 2 +- app/views/mailer/wiki_content_added.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/mailer/message_posted.html.erb b/app/views/mailer/message_posted.html.erb index dbe41976a..2be4e486e 100644 --- a/app/views/mailer/message_posted.html.erb +++ b/app/views/mailer/message_posted.html.erb @@ -23,7 +23,7 @@
  • <%= l(:mail_issue_content)%> - <%= @message.content %> + <%= @message.content.html_safe? %>
  • diff --git a/app/views/mailer/send_invite_in_project.html.erb b/app/views/mailer/send_invite_in_project.html.erb index 51b189f37..ec559732f 100644 --- a/app/views/mailer/send_invite_in_project.html.erb +++ b/app/views/mailer/send_invite_in_project.html.erb @@ -5,7 +5,7 @@
  • <%= l(:mail_issue_content)%>

    <%= @subject %>

    -

    点击链接激活账号,系统会依据给出的密码和账号自动登录Trustie平台。

    +

    点击下面的链接即可激活账号,系统会根据给出的密码和账号自动登录Trustie平台。

    <%= link_to @project_url, @project_url%>

    您的账号为:<%= @email %>

    密码为: <%= @password %>

    diff --git a/app/views/mailer/wiki_content_added.html.erb b/app/views/mailer/wiki_content_added.html.erb index 8c83f62c8..c4f6929a8 100644 --- a/app/views/mailer/wiki_content_added.html.erb +++ b/app/views/mailer/wiki_content_added.html.erb @@ -1,3 +1,3 @@

    <%= l(:mail_body_wiki_content_added, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url), :author => h(@wiki_content.author)).html_safe %>
    -<%=h @wiki_content.comments %>

    +<%=h @wiki_content.comments.html_safe? %>

    From f67521164261784815f58c6c587bcd4241b50435 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 15:26:35 +0800 Subject: [PATCH 035/130] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=EF=BC=8C=E6=B2=A1=E6=9C=89=E7=9C=9F=E5=AE=9E?= =?UTF-8?q?=E5=A7=93=E5=90=8D=E5=B0=B1=E6=98=BE=E7=A4=BAlogin=EF=BC=8C?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E9=99=84=E4=BB=B6=E5=AF=BC=E5=87=BA=E4=B9=9F?= =?UTF-8?q?=E4=B8=80=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 6 +++--- app/models/user.rb | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index d932d8b4d..7eb06d270 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -60,7 +60,7 @@ class ZipdownController < ApplicationController unless homework.attachments.empty? zipfile = zip_homework_by_user homework send_file zipfile.file_path, :filename => ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) + - "_" + (homework.user.lastname.nil? ? "" : homework.user.lastname) + (homework.user.firstname.nil? ? "" : homework.user.firstname) + + "_" + homework.user.show_name + "_" + homework.name + ".zip", :type => detect_content_type(zipfile.file_path) if(zipfile) else render file: 'public/no_file_found.html' @@ -148,7 +148,7 @@ class ZipdownController < ApplicationController end end out_file = find_or_pack(homework_attach.bid_id, homework_attach.user_id, digests.sort){ - zipping("#{homework_attach.user.lastname}#{homework_attach.user.firstname}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", + zipping("#{homework_attach.user.show_name}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file) } end @@ -168,7 +168,7 @@ class ZipdownController < ApplicationController end end out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){ - zipping("#{work.user.lastname}#{work.user.firstname}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", + zipping("#{work.user.show_name}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file) } end diff --git a/app/models/user.rb b/app/models/user.rb index a1f00a234..b4723cceb 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -277,15 +277,18 @@ class User < Principal end def show_name + name = "" unless self.user_extensions.nil? if self.user_extensions.identity == 2 - firstname + name = firstname else - lastname+firstname + name = lastname+firstname end else - lastname+firstname + name = lastname+firstname end + name = name.empty? || name.nil? ? login : name + name end ## end From bef1917c4efff2eb6837a0adc6668b0ec7008e0c Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 15:32:19 +0800 Subject: [PATCH 036/130] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/message_posted.html.erb | 2 +- app/views/mailer/wiki_content_added.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/mailer/message_posted.html.erb b/app/views/mailer/message_posted.html.erb index 2be4e486e..c55f4b000 100644 --- a/app/views/mailer/message_posted.html.erb +++ b/app/views/mailer/message_posted.html.erb @@ -23,7 +23,7 @@
  • <%= l(:mail_issue_content)%> - <%= @message.content.html_safe? %> + <%= @message.content.html_safe %>
  • diff --git a/app/views/mailer/wiki_content_added.html.erb b/app/views/mailer/wiki_content_added.html.erb index c4f6929a8..244597a1b 100644 --- a/app/views/mailer/wiki_content_added.html.erb +++ b/app/views/mailer/wiki_content_added.html.erb @@ -1,3 +1,3 @@

    <%= l(:mail_body_wiki_content_added, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url), :author => h(@wiki_content.author)).html_safe %>
    -<%=h @wiki_content.comments.html_safe? %>

    +<%=h @wiki_content.comments.html_safe %>

    From c62d468ed3d1c8970eaedc16014e1f9c798e3862 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 15:54:56 +0800 Subject: [PATCH 037/130] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=96=B0=E9=97=BB=E5=92=8C=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/send_for_user_activities.html.erb | 2 +- config/locales/projects/zh.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 81a65442f..da8b4c8c3 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -262,7 +262,7 @@ <% unless @project_news.first.nil? %>

      - <%= l(:label_course_news) %> + <%= l(:label_project_news) %> (<%= @project_news.count %>)

      <% @project_news.each do |project_new|%> diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 78f608a80..e01e2992c 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -86,7 +86,7 @@ zh: label_roadmap: 里程碑 #版本路线图 project_module_dts: DTS测试工具 label_project_tool_response: 用户反馈 - label_course_news: 项目新闻 + label_project_news: 项目新闻 label_project_overview: "项目简介" label_expend_information: 展开更多信息 From b4732814e6174d07742c2b429021907e7944a923 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 5 Jun 2015 16:20:26 +0800 Subject: [PATCH 038/130] ... --- app/controllers/courses_controller.rb | 1 + app/helpers/activity_notifys_helper.rb | 7 +++++++ app/views/courses/show.html.erb | 23 ++++++++++++++++++++--- public/stylesheets/courses.css | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 app/helpers/activity_notifys_helper.rb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 333ad77b1..e89f621c8 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -6,6 +6,7 @@ class CoursesController < ApplicationController helper :members helper :words helper :attachments + helper :activity_notifys before_filter :auth_login1, :only => [:show, :feedback] menu_item :overview diff --git a/app/helpers/activity_notifys_helper.rb b/app/helpers/activity_notifys_helper.rb new file mode 100644 index 000000000..15fc43b54 --- /dev/null +++ b/app/helpers/activity_notifys_helper.rb @@ -0,0 +1,7 @@ +module ActivityNotifysHelper + def get_new_notify_count(container,type) + logger.info('xxoo') + query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=?',container.id,type,User.current.id); + return query.count() + end +end \ No newline at end of file diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 9bbe4ea5a..4fbf3ad43 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -1,7 +1,9 @@
      <% if @controller_name=='ActivityNotifys' %> - <%= l(:label_activity)%> -

      与我相关

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

      与我相关 + +

      @@ -80,6 +84,14 @@ \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index bbc6f5b55..edb70075b 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -677,7 +677,7 @@ input#score{ width:40px;} /* 与我相关 */ .new_icon{background:url(../images/new_icon.png) 0px 0px no-repeat; width:35px; height:15px; display:block;} -a.about_me{ width:80px;text-align:center;font-size:16px; color:#64bdd9; margin:10px 0 0 10px;} +a.about_me{text-align:center;font-size:16px; color:#64bdd9; margin:10px 0 0 10px;} a:hover.about_me{ color:#0781b4;} From 79893c4917548bb0b1f3dc09a888fa00479e2033 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 5 Jun 2015 16:57:09 +0800 Subject: [PATCH 039/130] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=A0=B9=E6=8D=AE=E9=AA=8C=E8=AF=81=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E7=9B=B8=E5=BA=94=E7=A9=BA=E9=97=B4focus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/course.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/javascripts/course.js b/public/javascripts/course.js index b629530f0..4c0cae670 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -470,7 +470,15 @@ $(function(){ //老师提交 新建/修改 作业 function submit_homework(id) { - if(regex_homework_name()&®ex_evaluation_num()) + if(!regex_homework_name()) + { + $("#homework_name").focus(); + } + else if(!regex_evaluation_num()) + { + $("#evaluation_num").focus(); + } + else { homework_description_editor.sync(); $("#"+id).submit(); From c85fd9f7b8c2c81fc5282c33740dd3d7f600bdd2 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 5 Jun 2015 17:17:35 +0800 Subject: [PATCH 040/130] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=96=B0=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=A8=A1=E5=9D=97=E7=9A=84=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 7 ++--- .../mailer/send_for_user_activities.html.erb | 27 ++----------------- .../mailer/send_for_user_activities.text.erb | 24 ++--------------- 3 files changed, 8 insertions(+), 50 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 087fb6d73..1325ef613 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -115,14 +115,15 @@ class Mailer < ActionMailer::Base count = courses.count count = count - 1 for i in 0..count do - bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc") + bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc") attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC') @bids += bids if bids.count > 0 @attachments += attachments if attachments.count > 0 + end end # user 提交的作业 - @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") + # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") # 查询user在课程。项目中发布的讨论帖子 messages = Message.find_by_sql("select me.* from messages me, boards b, members m where @@ -157,7 +158,7 @@ class Mailer < ActionMailer::Base @memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id})) and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc") - has_content = [@issues,@homeworks,@course_messages,@project_messages,@course_news,@project_news, + has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news, @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?} mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" #有内容才发,没有不发 diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index da8b4c8c3..e1712a15d 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -3,7 +3,7 @@ <%= @subject %> <% if @attachments.first || @course_news.first || @bids.first || - @homeworks.first || @course_journal_messages.first|| @course_messages.first %> + @course_journal_messages.first|| @course_messages.first %>

      <%= l(:label_course_overview)%>

      <% unless @course_news.first.nil? %> @@ -39,7 +39,7 @@ <% end %> - <% if !@bids.first.nil? || !@homeworks.first.nil? %> + <% if !@bids.first.nil? %>

        <%= l(:label_homework_overview) %>(<%= @bids.count %>)

        <% unless @bids.first.nil?%> @@ -65,29 +65,6 @@ <% end %> <% end %> - <% unless @homeworks.first.nil? %> - <% @homeworks.each do |homework| %> -
      • - - [ - - <%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value), - :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - ] - - <%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_course_submit_homework) %> - - <%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,:token => @token.value), - :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" - %> - <%= format_time(homework.created_at) %> -
      • - <% end %> - <% end %>
      diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb index 59735225d..2a2382301 100644 --- a/app/views/mailer/send_for_user_activities.text.erb +++ b/app/views/mailer/send_for_user_activities.text.erb @@ -1,6 +1,6 @@ <%= @subject %> <% if @attachments.first || @course_news.first || @bids.first || - @homeworks.first || @course_journal_messages.first|| @course_messages.first %> + @course_journal_messages.first|| @course_messages.first %> <%= l(:label_course_overview)%> <% unless @course_news.first.nil? %> <%= l(:label_course_news) %> @@ -27,7 +27,7 @@ <% end %> <% end %> - <% if !@bids.first.nil? || !@homeworks.first.nil? %> + <% if !@bids.first.nil? %> <%= l(:label_homework_overview) %><%= @bids.count %> <% unless @bids.first.nil?%> <% @bids.each do |bid| %> @@ -51,26 +51,6 @@ <% end %> <% end %> - <% unless @homeworks.first.nil? %> - <% @homeworks.each do |homework| %> - ▪[ - - <%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value) - - %> - ] - - <%= link_to homework.user, user_activities_url(homework.user,:token => @token.value) - %> - <%= l(:label_course_submit_homework) %> - - <%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(homework.bid,:token => @token.value) - - - %> - <%= format_time(homework.created_at) %> - <% end %> - <% end %> From b1ce342b3d71d1bcbd8267bd3970e54337dc2170 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 6 Jun 2015 09:44:23 +0800 Subject: [PATCH 041/130] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E8=A1=A8=E4=BF=AE=E6=94=B9=E5=90=8E=E5=BC=95=E8=B5=B7=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/send_for_user_activities.html.erb | 10 +++++----- app/views/mailer/send_for_user_activities.text.erb | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index e1712a15d..3d53acd5a 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -39,7 +39,7 @@ <% end %> - <% if !@bids.first.nil? %> + <% unless @bids.empty? %>

        <%= l(:label_homework_overview) %>(<%= @bids.count %>)

        <% unless @bids.first.nil?%> @@ -48,20 +48,20 @@ [ - <%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'), course_url(bid.courses.first, :token => @token.value), + <%= link_to truncate(bid.course.name,length: 30,omission: '...'), course_url(bid.course, :token => @token.value), :class=> "wmail_column", :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> ] - <%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name", + <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value), :class => "wmail_name", :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_course_homework) %> - <%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(:id => bid.id,:token => @token.value), + <%= link_to truncate(bid.name,length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value), :class => 'wmail_info', :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(bid.created_on) %> + <%= format_time(bid.created_at) %> <% end %> <% end %> diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb index 2a2382301..669aca3d1 100644 --- a/app/views/mailer/send_for_user_activities.text.erb +++ b/app/views/mailer/send_for_user_activities.text.erb @@ -27,27 +27,27 @@ <% end %> <% end %> - <% if !@bids.first.nil? %> + <% unless @bids.empty? %> <%= l(:label_homework_overview) %><%= @bids.count %> <% unless @bids.first.nil?%> <% @bids.each do |bid| %> ▪ [ - <%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'),course_url(bid.courses.first, :token => @token.value) + <%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value) %> ] - <%= link_to bid.author, user_activities_url(bid.author,:token => @token.value) + <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value) %> <%= l(:label_course_homework) %> - <%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(bid,:token => @token.value) + <%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value) %> - <%= format_time(bid.created_on) %> + <%= format_time(bid.created_at) %> <% end %> <% end %> From 1a3a23b0ed3928c77aa67292d7a84280a390b54f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 6 Jun 2015 09:44:37 +0800 Subject: [PATCH 042/130] =?UTF-8?q?BId=E5=B7=B2=E5=8F=96=E6=B6=88=E7=95=99?= =?UTF-8?q?=E8=A8=80=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 1325ef613..ec46917d9 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -199,8 +199,8 @@ class Mailer < ActionMailer::Base @title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}" @issue_author_url = url_for(user_activities_url(@user)) @url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型 - when :Bid - course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") + # when :Bid + # course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") when :Project return -1 if journals_for_message.jour.project_type == Project::ProjectType_project project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}") @@ -236,12 +236,12 @@ class Mailer < ActionMailer::Base mail :to => @recipients, :subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ", :filter => true - elsif journals_for_message.jour.class.to_s.to_sym == :Bid - if !journals_for_message.jour.author.notify_about? journals_for_message - return -1 - end - - mail :to => recipients, :subject => @title,:filter => true + # elsif journals_for_message.jour.class.to_s.to_sym == :Bid + # if !journals_for_message.jour.author.notify_about? journals_for_message + # return -1 + # end + # + # mail :to => recipients, :subject => @title,:filter => true elsif journals_for_message.jour.class.to_s.to_sym == :Contest if !journals_for_message.jour.author.notify_about? journals_for_message return -1 From 7e89cd27aacfd30390788a4f3faf589c16a97d9e Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 6 Jun 2015 10:22:56 +0800 Subject: [PATCH 043/130] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E9=82=80=E8=AF=B7bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 16 +++++++++------- .../mailer/send_for_user_activities.html.erb | 1 - .../projects/invite_members_by_mail.html.erb | 6 ++++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1793eb39c..70efa47fa 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -367,13 +367,15 @@ class ProjectsController < ApplicationController @inviter_lists = InviteList.where(project_id:@project.id).all unless @inviter_lists.blank? @inviter_lists.each do|inviter_list| - @inviters = [] - @waiters = [] - @inviters << inviter_list.user - @inviters_count = @inviters.size - unless inviter_list.user.member_of?(@project) - @waiters << inviter_list.user - @waiters_count = @waiters.size + inviters = [] + waiters = [] + inviters << inviter_list.user + @inviters_count = inviters.size + unless inviter_list.user.nil? + unless inviter_list.user.member_of?(@project) + waiters << inviter_list.user + @waiters_count = waiters.size + end end end end diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 3d53acd5a..9723783fe 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -138,7 +138,6 @@ <%= l(:label_course_attendingcontestwork_download) %> (<%= @attachments.count %>) - <% @attachments.each do |attachment|%>
      • diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index 7b3a4c552..349bc2b56 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -90,8 +90,10 @@ <% unless @waiters_count.nil? %> 等待加入项目的用户
        <% @inviter_lists.each do |inviter_list| %> - <% unless inviter_list.user.member_of?(@project) %> - <%= inviter_list.user.name unless inviter_list.user.nil? %>
        + <% unless inviter_list.user.nil? %> + <% unless inviter_list.user.member_of?(@project) %> + <%= inviter_list.user.name %>
        + <% end %> <% end %> <% end %> <% end %> From 543ae1bbd027e122e428812682d15075398605fe Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 6 Jun 2015 11:39:22 +0800 Subject: [PATCH 044/130] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E9=A1=B9=E7=9B=AE=E9=80=BB=E8=BE=91=EF=BC=9A?= =?UTF-8?q?=E6=94=B9=E6=88=90=E5=B7=B2=E5=8A=A0=E5=85=A5=E5=92=8C=E7=AD=89?= =?UTF-8?q?=E5=BE=85=E5=8A=A0=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 15 ++++++++------- .../projects/invite_members_by_mail.html.erb | 16 ++++++---------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 70efa47fa..efe5a52ee 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -365,16 +365,17 @@ class ProjectsController < ApplicationController def invite_members_by_mail if User.current.member_of?(@project) || User.current.admin? @inviter_lists = InviteList.where(project_id:@project.id).all + @inviters = [] + @waiters = [] unless @inviter_lists.blank? @inviter_lists.each do|inviter_list| - inviters = [] - waiters = [] - inviters << inviter_list.user - @inviters_count = inviters.size unless inviter_list.user.nil? - unless inviter_list.user.member_of?(@project) - waiters << inviter_list.user - @waiters_count = waiters.size + if inviter_list.user.member_of?(@project) + @inviters << inviter_list.user + @inviters_count = @inviters.size + else + @waiters << inviter_list.user + @waiters_count = @waiters.size end end end diff --git a/app/views/projects/invite_members_by_mail.html.erb b/app/views/projects/invite_members_by_mail.html.erb index 349bc2b56..4c6ee47d8 100644 --- a/app/views/projects/invite_members_by_mail.html.erb +++ b/app/views/projects/invite_members_by_mail.html.erb @@ -80,21 +80,17 @@ <%# 邀请用户的状态 %> <% unless @inviter_lists.blank? %>
        - <% if @inviters_count > 0 %> - 已邀请的用户
        - <% @inviter_lists.each do |inviter_list| %> - <%= inviter_list.user.name unless inviter_list.user.nil? %>
        + <% unless @inviters_count.nil? %> + 已加入项目的用户
        + <% @inviters.each do |inv| %> + <%= inv.name unless inv.nil? %>
        <% end %> <% end %>
        <% unless @waiters_count.nil? %> 等待加入项目的用户
        - <% @inviter_lists.each do |inviter_list| %> - <% unless inviter_list.user.nil? %> - <% unless inviter_list.user.member_of?(@project) %> - <%= inviter_list.user.name %>
        - <% end %> - <% end %> + <% @waiters.each do |wai| %> + <%= wai.name unless wai.nil?%>
        <% end %> <% end %>
        From 6a997bace384f0fc72588e7f2c0b2f1998700c0c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 6 Jun 2015 12:11:19 +0800 Subject: [PATCH 045/130] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=A7=93=E5=90=8D?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E8=B0=83=E6=95=B4=20=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=AD=A6=E5=8F=B7=E6=98=BE=E7=A4=BA--?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_evaluation_work.html.erb | 6 ++++-- app/views/student_work/_student_work.html.erb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index 5a339dc03..11ce7b080 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -6,13 +6,15 @@ <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> + <% else%> + -- <% end%>
      • <% if is_my_work%> - <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name %> + <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02" %> <% else%> - <%= link_to "匿名","javascript:void(0)"%> + <%= link_to "匿名","javascript:void(0)", :class => "c_blue02"%> <% end%>
      • diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb index e8fb2ce3a..e39cb130d 100644 --- a/app/views/student_work/_student_work.html.erb +++ b/app/views/student_work/_student_work.html.erb @@ -6,7 +6,7 @@
      • - <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name%> + <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
      • <%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%> From da9a607a5bf6f0bc0280bf989162b06e82efc51e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 6 Jun 2015 16:11:37 +0800 Subject: [PATCH 046/130] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E5=90=8E=E6=B7=BB=E5=8A=A0=E9=99=84=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E4=B8=8D=E5=88=B7=E6=83=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/add_score.js.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb index 5e6c4fe6d..0ba275d5d 100644 --- a/app/views/student_work/add_score.js.erb +++ b/app/views/student_work/add_score.js.erb @@ -2,7 +2,7 @@ $("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :parti $('#score_<%= @work.id%>').peSlider({range: 'min'}); <% if @is_new%> - $("#score_list_<%= @work.id%>").prepend("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>"); + $("#score_list_<%= @work.id%>").prepend("
        <%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>
        "); <% else %> $("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>"); <% end%> From 0e2db5fc73bf4e20d10d2d6e97c83a061d081f9d Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 8 Jun 2015 09:07:32 +0800 Subject: [PATCH 047/130] schema --- db/schema.rb | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index f8d638a5f..b3f5eab2f 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 => 20150514133640) do +ActiveRecord::Schema.define(:version => 20150528024616) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -438,6 +438,13 @@ ActiveRecord::Schema.define(:version => 20150514133640) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + 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 @@ -558,6 +565,13 @@ ActiveRecord::Schema.define(:version => 20150514133640) do t.datetime "updated_at", :null => false end + create_table "invite_lists", :force => true do |t| + t.integer "project_id" + t.integer "user_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "issue_categories", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "name", :limit => 30, :default => "", :null => false @@ -652,6 +666,16 @@ ActiveRecord::Schema.define(:version => 20150514133640) 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" From 52f7c66ff0fccd0bdadc1c3c66d8792cf13f1a89 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 8 Jun 2015 14:32:10 +0800 Subject: [PATCH 048/130] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E4=B8=AD=E9=82=AE=E4=BB=B6=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E9=87=8D=E5=A4=8D=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ec46917d9..b6a2bfa32 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -107,6 +107,7 @@ class Mailer < ActionMailer::Base and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc" @issues = Issue.find_by_sql(sql) + # @bids 查询课程作业,包括老师发布的作业,以及user提交作业 # @attachments查询课程课件更新 @attachments ||= [] @@ -125,21 +126,29 @@ class Mailer < ActionMailer::Base # user 提交的作业 # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") - # 查询user在课程。项目中发布的讨论帖子 - messages = Message.find_by_sql("select me.* from messages me, boards b, members m where - b.id = me.board_id and b.project_id = m.project_id and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + # 查询user在课程中发布的讨论帖子 + course_mesages = Message.find_by_sql("select me.* from messages me, boards b, members m where + b.id = me.board_id and b.course_id = m.course_id + and b.course_id is not Null and m.user_id = '#{user.id}' + and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + # 查询user在项目中发布的讨论帖子 + project_messages = Message.find_by_sql("select me.* from messages me, boards b, members m where + b.id = me.board_id and b.project_id = m.project_id + and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") # messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") @course_messages ||= [] @project_messages ||= [] - unless messages.first.nil? - messages.each do |msg| - if msg.project - @project_messages << msg - elsif msg.course - @course_messages << msg - end + unless course_mesages.first.nil? + course_mesages.each do |msg| + @course_messages << msg end end + unless project_messages.first.nil? + project_messages.each do |msg| + @project_messages << msg + end + end + # wiki # 查询user在课程中发布的通知,项目中发的新闻 @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n @@ -157,7 +166,7 @@ class Mailer < ActionMailer::Base @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") @memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id})) and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc") - + puts @attachments has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news, @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?} mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" From 29edf5ece7d753a4df27f1d07a76d8c97fd3feab Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Mon, 8 Jun 2015 14:46:25 +0800 Subject: [PATCH 049/130] =?UTF-8?q?=E8=A7=A3=E5=86=B3kindeditor=E5=A4=9A?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/kindeditor.js | 19 ++++++++++++++----- public/assets/kindeditor/plugins/less/less.js | 17 ++++++++++------- public/assets/kindeditor/plugins/more/more.js | 17 ++++++++++------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index d97f1cd2e..176e00ec8 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -3909,14 +3909,22 @@ _extend(KToolbar, KWidget, { }); }, get : function(name) { + //if(this._itemMap[name])return this._itemMap[name]; + //return this._itemMap[name]=K("span.ke-icon-"+name,this.div).parent() // if (this._itemMap[name]) { // return this._itemMap[name]; // } - if($("#define").css('display') == 'block'){ - pdiv = $("#define") - }else if($("#full").css('display') == 'block'){ - pdiv = $("#full") - } +// if($("#define").css('display') == 'block'){ +// pdiv = $("#define") +// }else if($("#full").css('display') == 'block'){ +// pdiv = $("#full") +// } + var container = this.div; + if(!$("#define",container).is(':hidden')){ + pdiv = $("#define",container); + }else if(!$("#full",container).is(':hidden')){ + pdiv = $("#full",container); + } return (this._itemMap[name] = K('span.ke-icon-' + name, pdiv).parent()); }, select : function(name) { @@ -4865,6 +4873,7 @@ KEditor.prototype = { }); return self; } + //if(name=='more')alert(fn); return self.handler(key, fn); }, updateState : function() { diff --git a/public/assets/kindeditor/plugins/less/less.js b/public/assets/kindeditor/plugins/less/less.js index b24d31723..12e8436bc 100644 --- a/public/assets/kindeditor/plugins/less/less.js +++ b/public/assets/kindeditor/plugins/less/less.js @@ -2,13 +2,16 @@ KindEditor.plugin('less', function(K) { var self = this, name = 'less'; self.plugin.less = { click : function(){ - if($("#define").css('display') == 'block'){ - $("#define").css('display','none') - $("#full").css('display','block') - }else if($("#full").css('display') == 'block'){ - $("#full").css('display','none') - $("#define").css('display','block') - } + var container = self.toolbar.div; + $("#full",container).hide(); + $("#define",container).show(); + //if($("#define").css('display') == 'block'){ + // $("#define").css('display','none') + // $("#full").css('display','block') + //}else if($("#full").css('display') == 'block'){ + // $("#full").css('display','none') + // $("#define").css('display','block') + //} } } self.clickToolbar(name,self.plugin.less.click) diff --git a/public/assets/kindeditor/plugins/more/more.js b/public/assets/kindeditor/plugins/more/more.js index 31eb8567f..03d7640ec 100644 --- a/public/assets/kindeditor/plugins/more/more.js +++ b/public/assets/kindeditor/plugins/more/more.js @@ -2,13 +2,16 @@ KindEditor.plugin('more', function(K) { var self = this, name = 'more'; self.plugin.more = { click : function(){ - if($("#define").css('display') == 'block'){ - $("#define").css('display','none') - $("#full").css('display','block') - }else if($("#full").css('display') == 'block'){ - $("#full").css('display','none') - $("#define").css('display','block') - } + var container = self.toolbar.div; + $("#define",container).hide(); + $("#full",container).show(); + //if($("#define").css('display') == 'block'){ + // $("#define").css('display','none') + // $("#full").css('display','block') + //}else if($("#full").css('display') == 'block'){ + // $("#full").css('display','none') + // $("#define").css('display','block') + //} } } self.clickToolbar(name,self.plugin.more.click) From 999e96a85763a755bbd49533680497e0f1330f91 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 8 Jun 2015 15:45:12 +0800 Subject: [PATCH 050/130] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=8E=89=E6=89=93?= =?UTF-8?q?=E5=8D=B0attachment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index b6a2bfa32..204aa109a 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -166,7 +166,7 @@ class Mailer < ActionMailer::Base @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") @memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id})) and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc") - puts @attachments + has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news, @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?} mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" From 7d76b20574505e300df1328e61ba3ac8483bf804 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 8 Jun 2015 17:16:34 +0800 Subject: [PATCH 051/130] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=82=A3=E5=9D=97?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=AF=B9=E4=BA=8E?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=9A=84=E5=AD=A6=E7=94=9F=E6=8F=90=E9=97=AE?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E5=9B=9E=E5=A4=8D=E5=8A=9F=E8=83=BD=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=8F=96=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/homework.rb | 2 +- app/services/courses_service.rb | 54 ++++++++++++++--------------- app/services/homework_service.rb | 22 ++++++------ 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/app/api/mobile/entities/homework.rb b/app/api/mobile/entities/homework.rb index d4c34ffec..ee623d9ff 100644 --- a/app/api/mobile/entities/homework.rb +++ b/app/api/mobile/entities/homework.rb @@ -10,7 +10,7 @@ module Mobile else f[field] end - elsif f.is_a?(::Bid) + elsif f.is_a?(::HomeworkCommon) if f.respond_to?(field) f.send(field) else diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 49170bf30..d4a197aff 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -330,7 +330,7 @@ class CoursesService def homework_list params,current_user course = Course.find(params[:id]) if course.is_public != 0 || current_user.member_of_course?(course) - bids = course.homeworks.order('deadline DESC') + bids = course.homework_commons.order('end_time DESC') bids = bids.like(params[:name]) if params[:name].present? homeworks = [] bids.each do |bid| @@ -375,9 +375,9 @@ class CoursesService unless latest_attachment.nil? latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message =>latest_attachment.author.realname<< l(:label_recently_updated_courseware,:locale => get_user_language(current_user))<<":"< 4,:time => latest_bid.updated_on,:message => latest_bid.author.realname< get_user_language(current_user))<<":"< 4,:time => latest_bid.updated_at,:message => latest_bid.user.realname< get_user_language(current_user))<<":"< order.created_on} - end - latest_bid_message = messages.first - unless latest_bid_message.nil? - latest_course_dynamics << {:type => 4,:time => latest_bid_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))} - end + # messages = [] + # course.homework_commons.each do |hc| + # jour = hc.journals_for_messages.order("created_on desc").first + # unless jour.nil? + # messages << jour + # end + # end + # unless messages.count == 0 + # messages.sort!{|order,newer| newer.created_on <=> order.created_on} + # end + # latest_bid_message = messages.first + # unless latest_bid_message.nil? + # latest_course_dynamics << {:type => 4,:time => latest_bid_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))} + # end #每个作业中学生最后提交的作业 homeworks = [] - course.homeworks.each do |bid| - homework_attach = bid.homeworks.order('updated_at DESC').first + course.homework_commons.each do |bid| + homework_attach = bid.student_works.order('updated_at DESC').first unless homework_attach.nil? homeworks << homework_attach end @@ -533,21 +533,21 @@ class CoursesService mems end def show_homework_info course,bid,current_user,is_course_teacher - author_real_name = bid.author.lastname + bid.author.firstname - many_times = course.homeworks.index(bid) + 1 + author_real_name = bid.user.lastname + bid.user.firstname + many_times = course.homework_commons.index(bid) + 1 name = bid.name - homework_count = bid.homeworks.count #已提交的作业数量 - student_questions_count = bid.journals_for_messages.where('m_parent_id IS NULL').count + homework_count = bid.student_works.count #已提交的作业数量 + #student_questions_count = bid.journals_for_messages.where('m_parent_id IS NULL').count description = bid.description #if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2 - state = bid.comment_status + state = bid.homework_detail_manual.comment_status unless is_course_teacher homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user end #end - open_anonymous_evaluation = bid.open_anonymous_evaluation - {:course_name => course.name,:course_id => course.id,:id => bid.id, :author => bid.author,:author_real_name => author_real_name, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count, - :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments,:created_on => bid.created_on,:deadline => bid.deadline} + open_anonymous_evaluation = bid.homework_detail_manual.comment_status + {:course_name => course.name,:course_id => course.id,:id => bid.id, :author => bid.user,:author_real_name => author_real_name, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => 0, + :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments,:created_on => bid.created_at,:deadline => bid.end_time} end diff --git a/app/services/homework_service.rb b/app/services/homework_service.rb index 2e7f59888..2a2c6613c 100644 --- a/app/services/homework_service.rb +++ b/app/services/homework_service.rb @@ -14,21 +14,21 @@ class HomeworkService # state=1 关闭匿评 # state=2 匿评结束 def show_homework params - @bid = Bid.find(params[:id]) - course = @bid.courses.first - author = @bid.author.lastname + @bid.author.firstname - many_times = course.homeworks.index(@bid) + 1 + @bid = HomeworkCommon.find(params[:id]) + course = @bid.course + author = @bid.user.lastname + @bid.user.firstname + many_times = course.homework_commons.index(@bid) + 1 name = @bid.name - homework_count = @bid.homeworks.count #已提交的作业数量 - student_questions_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count + homework_count = @bid.student_works.count #已提交的作业数量 + #student_questions_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count description = @bid.description #if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2 - state = @bid.comment_status + state = @bid.homework_detail_manual.comment_status #end - open_anonymous_evaluation = @bid.open_anonymous_evaluation - jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - {:course_name => course.name,:course_id => course.id,:id => @bid.id, :author => @bid.author,:author_real_name =>author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count, - :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:created_on => @bid.created_on,:deadline => @bid.deadline,:jours => jours} + open_anonymous_evaluation = @bid.homework_type + #jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + {:course_name => course.name,:course_id => course.id,:id => @bid.id, :author => @bid.user,:author_real_name =>author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => 0, + :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:created_on => @bid.created_at,:deadline => @bid.end_time,:jours => nil} end # 启动作业匿评前提示信息 From 05a77caeda767d694281eea19e41f95c38a55b27 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 9 Jun 2015 12:58:54 +0800 Subject: [PATCH 052/130] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E9=87=8D=E5=A4=8D=E5=8F=8A=E7=BB=9F=E8=AE=A1=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 4 ++-- app/views/mailer/send_for_user_activities.html.erb | 2 +- app/views/mailer/send_for_user_activities.text.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 204aa109a..7411dd30f 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -127,12 +127,12 @@ class Mailer < ActionMailer::Base # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") # 查询user在课程中发布的讨论帖子 - course_mesages = Message.find_by_sql("select me.* from messages me, boards b, members m where + course_mesages = Message.find_by_sql("select distinct me.* from messages me, boards b, members m where b.id = me.board_id and b.course_id = m.course_id and b.course_id is not Null and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") # 查询user在项目中发布的讨论帖子 - project_messages = Message.find_by_sql("select me.* from messages me, boards b, members m where + project_messages = Message.find_by_sql("select distinct me.* from messages me, boards b, members m where b.id = me.board_id and b.project_id = m.project_id and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") # messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 9723783fe..54d2db43c 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -108,7 +108,7 @@

          <%= l(:view_borad_course) %> - (<%= @course_journal_messages.count %>) + (<%= @course_messages.count %>)

          <% @course_messages.each do |course_message|%>
        • diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb index 669aca3d1..1bfbca4a1 100644 --- a/app/views/mailer/send_for_user_activities.text.erb +++ b/app/views/mailer/send_for_user_activities.text.erb @@ -88,7 +88,7 @@ <% unless @course_messages.first.nil? %> <%= l(:view_borad_course) %> - (<%= @course_journal_messages.count %>) + (<%= @course_messages.count %>) <% @course_messages.each do |course_message|%> From 63785564e8df5bcaca36c35e3d330d94d2b75d78 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 9 Jun 2015 16:06:26 +0800 Subject: [PATCH 053/130] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=8D=E6=94=AF=E6=8C=81=E5=A4=9A=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/kindeditor.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index 176e00ec8..d9b51648c 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -1,3 +1,10 @@ +//function dump_obj(myObject) { +// var s = ""; +// for (var property in myObject) { +// s = s + "\n "+property +": " + myObject[property] ; +// } +// alert(s); +//} /******************************************************************************* * KindEditor - WYSIWYG HTML Editor for Internet * Copyright (C) 2006-2013 kindsoft.net @@ -4150,6 +4157,7 @@ function KUploadButton(options) { } _extend(KUploadButton, { init : function(options) { + //dump_obj(options); var self = this, button = K(options.button), fieldName = options.fieldName || 'file', @@ -4180,6 +4188,7 @@ _extend(KUploadButton, { button.hide(); button.before(div); self.div = div; + options.ops.up_file_div = div;//options.ops是KindEditor.create()的options参数 self.button = button; self.iframe = options.target ? K('iframe[name="' + target + '"]') : K('iframe', div); self.form = options.form ? K(options.form) : K('form', div); @@ -5602,8 +5611,11 @@ _plugin('core', function(K) { inputObj.setAttribute('type', 'button'); inputObj.setAttribute('style', 'visibility:hidden'); document.body.appendChild(inputObj); - window.uploadButton = K.uploadbutton({ - button: inputObj, + + //window.uploadButton = K.uploadbutton({ + self.uploadButton = K.uploadbutton({ + ops:self, //self 是KindEditor.create()的options参数 + button: inputObj, fieldName:'imgFile', url:K.addParam('/kindeditor/upload', 'dir=image'), afterUpload : function(data) { @@ -5625,8 +5637,8 @@ _plugin('core', function(K) { alert('error: ' + str); } }); - uploadButton.fileBox.change(function(e) { - uploadButton.submit(); + self.uploadButton.fileBox.change(function(e) { + self.uploadButton.submit(); }); if (self.fullscreenShortcut) { @@ -5663,7 +5675,7 @@ _plugin('core', function(K) { }); }); self.clickToolbar('imagedirectupload', function() { - $('.ke-upload-file').focus().trigger('click'); + $('.ke-upload-file',this.up_file_div).trigger('click'); }); self.clickToolbar('formatblock', function() { From 4ed4d3fa44169a3a45199105b5fdfea470351ce6 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Tue, 9 Jun 2015 16:21:19 +0800 Subject: [PATCH 054/130] ... --- public/assets/kindeditor/kindeditor.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index d9b51648c..b019bccf1 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -4188,7 +4188,7 @@ _extend(KUploadButton, { button.hide(); button.before(div); self.div = div; - options.ops.up_file_div = div;//options.ops是KindEditor.create()的options参数 + if(options.ops!=undefined)options.ops.up_file_div = div;//options.ops是KindEditor.create()的options参数 self.button = button; self.iframe = options.target ? K('iframe[name="' + target + '"]') : K('iframe', div); self.form = options.form ? K(options.form) : K('form', div); @@ -4990,13 +4990,13 @@ KEditor.prototype = { 'emoticons', 'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|', 'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', - 'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'link', "less", + 'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'media', "less", '/', 'undo', 'redo', '|', 'preview', 'print', 'template', 'justifyfull', 'insertunorderedlist', 'indent', 'outdent', 'subscript', - 'superscript', 'clearhtml', 'quickformat', 'selectall', 'fontname', + 'superscript', 'clearhtml', 'quickformat', /* 'selectall',*/ 'fontname', 'strikethrough', 'lineheight', 'hr', 'pagebreak', - 'anchor' , 'unlink' + 'anchor' , 'link','unlink' ] K.each(fullItems, function(i, name) { if (name == '|') { From 857d3d5f623eb918b3ab6b15078c1b1f7f08b7a4 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 9 Jun 2015 17:03:28 +0800 Subject: [PATCH 055/130] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E8=B0=83=E6=9F=A5?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 52 ++++++++++++++++++++++++++++-- app/views/poll/_poll.html.erb | 2 ++ config/locales/zh.yml | 1 + config/routes.rb | 1 + 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 32ec3dad2..73650a782 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -1,8 +1,8 @@ class PollController < ApplicationController - before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll] + before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll] before_filter :find_container, :only => [:new,:create, :index] before_filter :is_member_of_course, :only => [:index,:show,:poll_result] - before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll] + before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll] include PollHelper def index if @course @@ -360,6 +360,17 @@ class PollController < ApplicationController end end + #导出问卷 + def export_poll + poll_questions = @poll.poll_questions + respond_to do |format| + format.xls { + send_data(poll_to_xls(poll_questions), :type => "text/excel;charset=utf-8; header=present", + :filename => "#{@poll.polls_name}.xls") + } + end + end + private def find_poll_and_course @poll = Poll.find params[:id] @@ -438,4 +449,41 @@ class PollController < ApplicationController end pu end + + #将poll中题目转换为Excel + def poll_to_xls poll_questions + xls_report = StringIO.new + book = Spreadsheet::Workbook.new + sheet1 = book.create_worksheet :name => "poll" + blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 + count_row = 0 + poll_questions.each do |poll_question| + if poll_question.question_type == 1 || poll_question.question_type == 2 + sheet1.row(count_row).default_format = blue + sheet1[count_row,0]= l(:label_poll_question_num,:num => poll_question.question_number) + sheet1[count_row + 1,0] = l(:label_poll_subtotal) + sheet1[count_row + 2,0] = l(:label_poll_proportion) + poll_question.poll_answers.each_with_index do |poll_answer,i| + sheet1[count_row, i + 1] = poll_answer.answer_text + sheet1[count_row + 1, i + 1] = poll_answer.poll_votes.count + sheet1[count_row + 2, i + 1] = statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)).to_s + "%" + end + sheet1[count_row + 3,0] = l(:label_poll_valid_commit) + sheet1[count_row + 3,1] = total_answer(poll_question.id) + count_row += 5 + else + sheet1.row(count_row).default_format = blue + sheet1[count_row,0] = l(:label_poll_question_num,:num => poll_question.question_number) + sheet1[count_row,1] = poll_question.question_title + count_row += 1 + poll_question.poll_votes.each do |poll_vote| + sheet1[count_row,0] = poll_vote.vote_text + count_row += 1 + end + count_row += 1 + end + end + book.write xls_report + xls_report.string + end end \ No newline at end of file diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index 3c4426696..14f351182 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -25,6 +25,8 @@ <%= link_to(l(:button_delete), poll,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %> +
        • <%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "polls_de fr ml5"%>
        • + <% if poll.polls_status == 1 %>
        • <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml5"%>
        • <% else%> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7653a0c4e..8434843d6 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1936,6 +1936,7 @@ zh: label_poll_description: 问卷描述 label_poll_options: 选项 label_poll_subtotal: 小计 + label_poll_question_num: "第%{num}题" label_poll_proportion: 比例 label_poll_valid_commit: 本题有效填写人次 label_poll_result: 问卷调查_问卷统计 diff --git a/config/routes.rb b/config/routes.rb index d2c21f6ea..c92c732d2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -70,6 +70,7 @@ RedmineApp::Application.routes.draw do get 'republish_poll' get 'poll_result' get 'close_poll' + get 'export_poll' end collection do delete 'delete_poll_question' From 4c5d2d50559d05df48abac44e6bad426497c8482 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 9 Jun 2015 17:08:00 +0800 Subject: [PATCH 056/130] =?UTF-8?q?poll=E5=88=97=E8=A1=A8=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4=EF=BC=8C=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=8A=9F=E8=83=BD=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_poll.html.erb | 9 +++++++-- public/stylesheets/polls.css | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index 14f351182..180fed0f0 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -25,8 +25,6 @@ <%= link_to(l(:button_delete), poll,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %> -
        • <%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "polls_de fr ml5"%>
        • - <% if poll.polls_status == 1 %>
        • <%= link_to l(:button_edit), edit_poll_path(poll.id), :class => "polls_de fr ml5"%>
        • <% else%> @@ -39,6 +37,13 @@
        • 关闭
        • <% end%> + <% if poll.polls_status == 1%> +
        • 导出
        • + <% elsif poll.polls_status == 2 || poll.polls_status == 3 %> +
        • <%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "polls_de fr ml5"%>
        • + <% end%> + +
        • <%= format_date poll.created_at.to_date%>
        • <% else%> <% if poll.polls_status == 2%> diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index f1b5023bd..353ec3937 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -127,7 +127,7 @@ a:hover.btn_de{ background:#ff5d31;} a.btn_pu{ border:1px solid #3cb761; color:#3cb761; } a:hover.btn_pu{ background:#3cb761;} .pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:19px; padding-top:3px; } -.polls_title_w { width:330px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} +.polls_title_w { width:300px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .polls_title_st { max-width:530px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .polls_de_grey{ color:#b1b1b1; margin-top:3px;} .ml5{ margin-left:5px;} From f3dd7c11b6bb44865ff3fee6fd37e2aced0d8bb0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 9 Jun 2015 17:11:54 +0800 Subject: [PATCH 057/130] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E7=AD=94=E6=A1=88=E6=97=B6=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/commit_poll.js.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/poll/commit_poll.js.erb b/app/views/poll/commit_poll.js.erb index 8f68dae68..76e5e53df 100644 --- a/app/views/poll/commit_poll.js.erb +++ b/app/views/poll/commit_poll.js.erb @@ -1,6 +1,6 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status}) %>'); -showModal('ajax-modal', '250px'); -$('#ajax-modal').css('height','100px'); +showModal('ajax-modal', '270px'); +$('#ajax-modal').css('height','110px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + ""); From 918d03d4ddda6602f018e5d6853ff2fbf2d90ce5 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Wed, 10 Jun 2015 10:29:17 +0800 Subject: [PATCH 058/130] ... --- app/views/boards/show.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index bf276925a..2a280fe03 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -104,7 +104,8 @@ function nh_check_field(params){ result=false; } if(params.content.html()!=params.textarea.html() || params.issubmit==true){ - params.textarea.html(params.content.html()); +// params.textarea.html(params.content.html()); //用这个ie11提交到服务器居然木有值 真特么旧梦已尘风 + params.content.sync(); //但是这个貌似编辑器没内容时不会同步到textarea中 新愁不言中... if(params.content.isEmpty()){ params.contentmsg.html('内容不能为空'); params.contentmsg.css({color:'#ff0000'}); From 0d9bdae5b074f1683db15cb7726eb05af0c3a2f5 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 10 Jun 2015 15:02:44 +0800 Subject: [PATCH 059/130] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=8C=89=E5=A4=A9?= =?UTF-8?q?=E5=8F=91=E9=80=81=E6=96=B0=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 1 - .../mailer/send_for_user_activities.html.erb | 215 +++++++++--------- config/locales/zh.yml | 1 + 3 files changed, 107 insertions(+), 110 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 7411dd30f..b3aff41d2 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -107,7 +107,6 @@ class Mailer < ActionMailer::Base and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc" @issues = Issue.find_by_sql(sql) - # @bids 查询课程作业,包括老师发布的作业,以及user提交作业 # @attachments查询课程课件更新 @attachments ||= [] diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 54d2db43c..38805d837 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -5,61 +5,62 @@ <% if @attachments.first || @course_news.first || @bids.first || @course_journal_messages.first|| @course_messages.first %>
          -

          <%= l(:label_course_overview)%>

          +

          <%= l(:label_course_overview)%>

          <% unless @course_news.first.nil? %> -
            -

            +
              + <%= l(:label_course_news) %> - (<%= @course_news.count %>) -

            + + <% @course_news.each do |course_new|%>
          • - [ - + [ <%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value), :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - ] + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + ] <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_project_notice) %> + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_project_notice) %> <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value), :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(course_new.created_on) %>
          • <% end %> -
          <% end %> <% unless @bids.empty? %> -
            -

            <%= l(:label_homework_overview) %>(<%= @bids.count %>)

            +
              + + <%= l(:label_homework_overview) %> + + <% unless @bids.first.nil?%> <% @bids.each do |bid| %>
            • - [ + [ <%= link_to truncate(bid.course.name,length: 30,omission: '...'), course_url(bid.course, :token => @token.value), :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - ] + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + ] <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_course_homework) %> + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_course_homework) %> <%= link_to truncate(bid.name,length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value), :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(bid.created_at) %>
            • @@ -72,29 +73,29 @@ <% unless @course_journal_messages.first.nil? %> -
                -

                +
                  + <%= l(:view_course_journals_for_messages) %> - (<%= @course_journal_messages.count %>) -

                + + <% @course_journal_messages.each do |course_journal_message|%>
              • - [ + [ <%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value), :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - ] + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + ] <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_send_course_journals_for_messages) %> + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_send_course_journals_for_messages) %> <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value), :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(course_journal_message.created_on) %>
              • @@ -105,25 +106,25 @@ <% unless @course_messages.first.nil? %> -
                  -

                  +
                    + <%= l(:view_borad_course) %> - (<%= @course_messages.count %>) -

                  + + <% @course_messages.each do |course_message|%>
                • - [ + [ <%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value), :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - ] + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + ] <%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_send_course_messages) %> + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_send_course_messages) %> <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value), :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(course_message.created_on) %>
                • <% end %> @@ -133,28 +134,28 @@ <% unless @attachments.first.nil? %> -
                    -

                    +
                      + <%= l(:label_course_attendingcontestwork_download) %> - (<%= @attachments.count %>) -

                    + + <% @attachments.each do |attachment|%>
                  • - [ + [ <%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value), :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - ] + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + ] <%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_course_file_upload) %> + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_course_file_upload) %> <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value), :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(attachment.created_on) %>
                  • @@ -165,32 +166,29 @@
          <% end %> - - <% if @issues.first || @project_messages.first %>
          -

          <%= l(:label_project_overview_new)%>

          +

          <%= l(:label_project_overview_new)%>

          <% unless @issues.first.nil? %> -
            -

            +
              + <%= l(:label_issue_tracking) %> - (<%= @issues.count %>) -

            + + <% @issues.each do |issue|%>
          • - [ + [ <%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value), :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - ] + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + ] <%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_project_issue) %> + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_project_issue) %> <%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value), - :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(issue.created_on) %>
          • @@ -202,29 +200,28 @@ <% unless @project_messages.first.nil? %> -
              -

              +
                + <%= l(:project_moule_boards_show) %> - (<%= @project_messages.count %>) -

              - + + <% @project_messages.each do |project_message|%>
            • - [ + [ <%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value), :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> ] <%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_send_course_messages) %> + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_send_course_messages) %> <%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value), :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(project_message.created_on) %>
            • @@ -236,28 +233,27 @@ <% unless @project_news.first.nil? %> -
                -

                +
                  + <%= l(:label_project_news) %> - (<%= @project_news.count %>) -

                + + <% @project_news.each do |project_new|%>
              • - [ + [ <%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value), :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - ] + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + ] <%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_project_notice) %> + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_project_notice) %> <%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value), :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" - %> + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(project_new.created_on) %>
              • <% end %> @@ -271,13 +267,13 @@ <% unless @user_journal_messages.first.nil? %>
                -

                <%= l(:label_activities) %>

                +

                <%= l(:label_activities) %>

                -
                  -

                  +
                    + <%= l(:label_user_message) %> - (<%= @user_journal_messages.count %>) -

                  + + <% @user_journal_messages.each do |user_journal_message|%>
                • @@ -285,12 +281,12 @@ <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= l(:label_show_your_message) %> + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <%= l(:label_show_your_message) %> <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value), :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(user_journal_message.created_on) %>
                • @@ -303,13 +299,13 @@ <% end %> <% if @forums.first || @memos.first %>
                  -

                  <%= l(:lable_bar_active) %>

                  +

                  <%= l(:lable_bar_active) %>

                  <% unless @forums.first.nil? %> -
                    -

                    +
                      + <%= l(:label_user_forum) %> - (<%= @forums.count %>) -

                    + (<%= @forums.count %>) + <% @forums.each do |forum|%>
                  • @@ -317,12 +313,12 @@ <%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= l(:label_forum_new) %> + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <%= l(:label_forum_new) %> <%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value), :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(forum.created_at) %>
                  • @@ -332,11 +328,11 @@
                  <% end %> <% unless @memos.first.nil? %> -
                    -

                    +
                      + <%= l(:label_user_message_forum) %> - (<%= @memos.count %>) -

                    + + <% @memos.each do |memo|%>
                  • @@ -344,12 +340,12 @@ <%= link_to memo.author, user_activities_url(memo.author,:token => @token.value), :class => "wmail_name", - :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %> + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %> <%= link_to truncate(memo.subject,length: 30,omission: '...'),forum_memo_url(memo.forum, (memo.parent_id.nil? ? memo : memo.parent_id)), :class => 'wmail_info', - :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(memo.created_at) %>
                  • @@ -361,6 +357,7 @@
                  <% end %>
                  +<%= l(:label_mail_policy) %>: <% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %> <% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7653a0c4e..b2160f7b0 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -736,6 +736,7 @@ zh: label_date_to: 到 label_language_based: 根据用户的语言 + label_mail_policy: 邮件策略 label_send_test_email: 发送测试邮件 label_feeds_access_key: RSS存取键 label_missing_feeds_access_key: 缺少RSS存取键 From 89f71ffa46df0a4f9fb92e4b2f4bf3bbf5f79b78 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 10 Jun 2015 15:19:59 +0800 Subject: [PATCH 060/130] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=90=8E=E7=9A=84=E4=B8=8B=E8=BD=BD=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E6=8C=89=E9=92=AE=E5=90=8E=E5=B0=B1=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E4=BA=86=EF=BC=8C=E4=B8=8D=E5=90=88=E9=80=82?= =?UTF-8?q?=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 6 +++--- app/views/files/_course_list.html.erb | 4 ++-- app/views/files/_project_file_list.html.erb | 4 ++-- app/views/stores/index.html.erb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index ec0480c19..c1e5af48a 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -79,9 +79,7 @@ class AttachmentsController < ApplicationController if candown || User.current.admin? || User.current.id == @attachment.author_id @attachment.increment_download if stale?(:etag => @attachment.digest) - if params[:force] == 'true' - direct_download - else + if params[:preview] == 'true' convered_file = @attachment.diskfile #如果本身不是pdf文件,则先寻找是不是已转换化,如果没有则转化 unless pdf?(convered_file) @@ -96,6 +94,8 @@ class AttachmentsController < ApplicationController else direct_download end + else + direct_download end end else diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 1d5684d31..7f3e426fc 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -25,7 +25,7 @@ <% if file.is_public? || User.current.member_of_course?(course) %>
                  - <%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s,:class => "c_dblue f_14 f_b f_l hiddent" %> + <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename, preview: true),:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> <% if User.current.logged? %> <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> @@ -40,7 +40,7 @@ <% else %> <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <% end %> - <%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %> + <%= link_to_attachment file, text: '下载', class: 'f_l re_open' %> <% else %> <% end %>
                  diff --git a/app/views/files/_project_file_list.html.erb b/app/views/files/_project_file_list.html.erb index a5152ecdc..81b69d754 100644 --- a/app/views/files/_project_file_list.html.erb +++ b/app/views/files/_project_file_list.html.erb @@ -18,7 +18,7 @@ <% project_attachments.each do |file| %>
                  - <%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> + <%= link_to truncate(file.filename,length: 35, omission: '...'), download_named_attachment_path(file.id, file.filename, preview: true),:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> <% if User.current.logged? %> <% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %> <%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> @@ -30,7 +30,7 @@ <% else %> <%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> <% end %> - <%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %> + <%= link_to_attachment file, text: '下载', class: 'f_l re_open' %> <% end %>
                  diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb index 6fab364b5..84116a561 100644 --- a/app/views/stores/index.html.erb +++ b/app/views/stores/index.html.erb @@ -35,7 +35,7 @@ <%= c1.downloads %>
                  - <%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%> + <%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%>c
                  <% end -%> From 56f522f56361b664f5460f1d8cee5937fb5c1c06 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 10 Jun 2015 15:36:11 +0800 Subject: [PATCH 061/130] =?UTF-8?q?=E8=A7=A3=E5=86=B3IE=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E4=B8=AD--=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=89=93=E5=8C=85=E4=B8=8B=E8=BD=BD=E7=9A=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E4=B9=B1=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/test_controller.rb | 2 +- app/controllers/zipdown_controller.rb | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/test_controller.rb b/app/controllers/test_controller.rb index 12fead4f2..71c445dc4 100644 --- a/app/controllers/test_controller.rb +++ b/app/controllers/test_controller.rb @@ -24,7 +24,7 @@ class TestController < ApplicationController end @paths = homeworks_attach_path zipfile = ziping homeworks_attach_path - send_file zipfile, :filename => bid.name, + send_file zipfile, :filename => filename_for_content_disposition(bid.name), :type => detect_content_type(zipfile) rescue Errno::ENOENT => e logger.error "[Errno::ENOENT] ===> #{e}" diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 7eb06d270..53b40942a 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -11,7 +11,7 @@ class ZipdownController < ApplicationController def download if User.current.logged? begin - send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => params[:filename], :type => detect_content_type(params[:file]) + send_file "#{OUTPUT_FOLDER}/#{params[:file]}", :filename => filename_for_content_disposition(params[:filename]), :type => detect_content_type(params[:file]) rescue => e render file: 'public/no_file_found.html' end @@ -59,9 +59,10 @@ class ZipdownController < ApplicationController if homework != nil unless homework.attachments.empty? zipfile = zip_homework_by_user homework - send_file zipfile.file_path, :filename => ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) + - "_" + homework.user.show_name + - "_" + homework.name + ".zip", :type => detect_content_type(zipfile.file_path) if(zipfile) + filename = ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) + + "_" + homework.user.show_name + + "_" + homework.name + ".zip" + send_file zipfile.file_path, :filename => filename_for_content_disposition(filename), :type => detect_content_type(zipfile.file_path) if(zipfile) else render file: 'public/no_file_found.html' end From 1c808464d58fb79e438649b0a5542f1cae08d8a5 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 10 Jun 2015 16:12:19 +0800 Subject: [PATCH 062/130] =?UTF-8?q?=E6=96=B0=E7=89=88=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E4=B8=8D=E5=8F=AF=E4=BB=A5=E6=8B=89=E5=AE=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vendor/assets/javascripts/kindeditor/kindeditor.js | 3 +-- public/assets/kindeditor/kindeditor.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/kindeditor.js b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/kindeditor.js index e58e4b2be..fe27e92c2 100644 --- a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/kindeditor.js +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/kindeditor.js @@ -5054,8 +5054,7 @@ KEditor.prototype = { } }); statusbar.removeClass('statusbar').addClass('ke-statusbar') - .append('') - .append(''); + .append(''); if (self._fullscreenResizeHandler) { K(window).unbind('resize', self._fullscreenResizeHandler); self._fullscreenResizeHandler = null; diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index b019bccf1..74228d3ea 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -5102,8 +5102,7 @@ KEditor.prototype = { } }); statusbar.removeClass('statusbar').addClass('ke-statusbar') - .append('') - .append(''); + .append(''); if (self._fullscreenResizeHandler) { K(window).unbind('resize', self._fullscreenResizeHandler); self._fullscreenResizeHandler = null; From ff159075aa743a7beeafa899cfa81cab6ae79c28 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 10 Jun 2015 16:16:23 +0800 Subject: [PATCH 063/130] =?UTF-8?q?=E6=96=B0header=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=9C=A8=E9=A1=B9=E7=9B=AE=E4=B8=8A=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_new_header.html.erb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/views/layouts/_new_header.html.erb b/app/views/layouts/_new_header.html.erb index 46a2eff63..f26317acd 100644 --- a/app/views/layouts/_new_header.html.erb +++ b/app/views/layouts/_new_header.html.erb @@ -20,19 +20,6 @@
                • <%= link_to "#{User.current.login}".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, target:"_blank", :class => "uses_name"%>
                • <%= l(:label_create_time)%>:<%= format_time(news.created_on)%> <%= link_to_attachments_course news %> +
                  + <%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %>
          diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 59431b3ad..4bfc1ef99 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -439,3 +439,4 @@ a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} img{max-width: 100%;} .attachments {clear: both;} .is_public_checkbox{margin-left: 15px;margin-right: 10px;} +.author_name{color: #3ca5c6 !important;} From 57804a118de3259a88ed1be82d38686581943568 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 10 Jun 2015 16:37:18 +0800 Subject: [PATCH 065/130] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=AD=E5=B1=95=E5=BC=80=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/index.html.erb | 6 +++--- config/locales/commons/zh.yml | 2 +- public/javascripts/course.js | 9 +++++++++ public/stylesheets/courses.css | 4 ---- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index 1e8189ddb..3208bb969 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -41,9 +41,9 @@ <%= homework.description.html_safe %>
      -
    - <% end %> diff --git a/config/locales/mailers/zh.yml b/config/locales/mailers/zh.yml index 8a6aa5168..46666ee25 100644 --- a/config/locales/mailers/zh.yml +++ b/config/locales/mailers/zh.yml @@ -20,4 +20,4 @@ zh: mail_issue_sent_from: "来源:" mail_issue_from_project: "项目问题跟踪" mail_issue_attachments: "附件:" - mail_issue_reply: "我要回复" \ No newline at end of file + mail_issue_reply: "我要回复" diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index e01e2992c..42eea8dcc 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -395,7 +395,8 @@ zh: label_issue_score: issue得分 label_issue_number: issue的数量 - label_issue_journal_number: issue的留言数量 + label_issue_journal_number: issue的留言数量 + label_project_mail_feedback: 项目留言 label_news_score: 新闻得分 label_new_number: 新闻的数量 From 7bf4cfd2187c9267e30e93117d3bdc6282aa3d11 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 11 Jun 2015 10:40:55 +0800 Subject: [PATCH 070/130] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E7=95=99=E8=A8=80=E5=9C=A8=E6=8C=89=E5=A4=A9=E5=8F=91=E9=80=81?= =?UTF-8?q?=E4=B8=AD=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 7 +++---- app/views/mailer/send_for_user_activities.html.erb | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 887542018..610f2b4c6 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -165,12 +165,11 @@ class Mailer < ActionMailer::Base # 查询user在课程及个人中留言 @course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT * from journals_for_messages where jour_type='Course' and user_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") - @user_journal_messages = user.journals_for_messages.where("m_parent_id IS NULL and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC') + @user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC') # 查询user在项目中留言(用户反馈) - @project_journal_messages = JournalsForMessage.find_by_sql("select jfm.* from journals_for_messages jfm, members m, projects p - where m.user_id = '#{user.id}' and p.id = m.project_id and jfm.jour_id = p.id and jfm.user_id = m.user_id and jfm.jour_type='Project' - and (jfm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + @project_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT * from journals_for_messages where + jour_type='Project' and user_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") # 查询user新建贴吧或发布帖子 @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 4059c88b6..7776a420d 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -93,7 +93,7 @@ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_send_course_journals_for_messages) %> - <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value), + <%= link_to truncate(course_journal_message.notes.html_safe,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value), :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> @@ -311,15 +311,15 @@ :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> ] - <%= link_to project_journal_message.project.user, user_activities_url(project_journal_message.project.user,:token => @token.value), :class => "wmail_name", + <%= link_to project_journal_message.user, user_activities_url(project_journal_message.user,:token => @token.value), :class => "wmail_name", :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_send_course_journals_for_messages) %> - <%= link_to truncate(project_journal_message.project.notes,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value), + <%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value), :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(project_journal_message.project.created_on) %> + <%= format_time(project_journal_message.created_on) %> <% end %>
    From f956b2795384bc690d095486af4d99d334aa3033 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 11 Jun 2015 15:31:22 +0800 Subject: [PATCH 071/130] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=B9=B3=E5=9D=87=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 4 ++-- app/models/member.rb | 18 ++++++++++-------- app/views/courses/_show_member_score.html.erb | 6 +++--- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index e89f621c8..518cc01c4 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -836,7 +836,7 @@ class CoursesController < ApplicationController sql_select = "" if groupid == 0 sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT AVG(student_works.final_score) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} @@ -848,7 +848,7 @@ class CoursesController < ApplicationController WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}" else sql_select = "SELECT members.*,( - SELECT SUM(student_works.final_score) + SELECT AVG(student_works.final_score) FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{@course.id} diff --git a/app/models/member.rb b/app/models/member.rb index 2936392ab..7bde36287 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -116,21 +116,23 @@ class Member < ActiveRecord::Base # 查找每个学生每个作业的评分 def student_homework_score - score_count = 0 homework_score = StudentWork.find_by_sql("SELECT homework_commons.name,student_works.final_score as score FROM student_works,homework_commons WHERE student_works.homework_common_id = homework_commons.id AND homework_commons.course_id = #{self.course_id} AND student_works.user_id = #{self.user_id}") - homework_score.each do |homework| - mem_score = 0 - if homework[:score] - mem_score = homework[:score] - end - score_count = score_count + mem_score - end + score_count = StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f [homework_score, format("%0.2f", score_count)] end + + def student_work_score + StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}") + end + + def student_work_score_avg + StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f + end + protected def validate_role diff --git a/app/views/courses/_show_member_score.html.erb b/app/views/courses/_show_member_score.html.erb index 0d250cf14..0fd1248c6 100644 --- a/app/views/courses/_show_member_score.html.erb +++ b/app/views/courses/_show_member_score.html.erb @@ -17,17 +17,17 @@

    <%= @member_score.user.name %> 历次作业积分

    • 作业名称得分
    • - <% @member_score.student_homework_score[0].each do |homework_score| %> + <% @member_score.student_work_score.each do |homework_score| %>
    • <%= homework_score.name %> - <%= format("%0.2f",homework_score[:score].nil? ? 0 : homework_score[:score]) %> + <%= format("%0.2f",homework_score.final_score.nil? ? 0 : homework_score.final_score) %>
    • <% end %> -
    • 作业积分(总得分)<%= @member_score.student_homework_score[1] %>
    • +
    • 作业积分(平均分)<%= @member_score.student_work_score_avg %>
    From b44f5ef522aec88cd617d4904f408b5bdeeb9529 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 11 Jun 2015 15:47:55 +0800 Subject: [PATCH 072/130] =?UTF-8?q?=E5=BC=B9=E5=87=BA=E6=A1=86=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=BA=E4=BD=9C=E4=B8=9A=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/member.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/member.rb b/app/models/member.rb index 7bde36287..5b1e277d7 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -126,7 +126,7 @@ class Member < ActiveRecord::Base end def student_work_score - StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}") + StudentWork.select("homework_commons.name, student_works.final_score").joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}") end def student_work_score_avg From de3bb64fd9ffd39bfc41508dc1a638f67d764d9e Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Thu, 11 Jun 2015 16:24:09 +0800 Subject: [PATCH 073/130] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E6=8D=A2=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/show.html.erb | 4 +- app/views/courses/_courses_jours.html.erb | 201 ++++++++++++++++-- app/views/courses/_history.html.erb | 3 +- app/views/words/_journal_reply_items.html.erb | 2 +- app/views/words/_new_respond_course.html.erb | 4 +- 5 files changed, 192 insertions(+), 22 deletions(-) diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 2a280fe03..d7a02e326 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -104,8 +104,8 @@ function nh_check_field(params){ result=false; } if(params.content.html()!=params.textarea.html() || params.issubmit==true){ -// params.textarea.html(params.content.html()); //用这个ie11提交到服务器居然木有值 真特么旧梦已尘风 - params.content.sync(); //但是这个貌似编辑器没内容时不会同步到textarea中 新愁不言中... + params.textarea.html(params.content.html()); + params.content.sync(); //用上面那句ie11提交到服务器居然木有值 if(params.content.isEmpty()){ params.contentmsg.html('内容不能为空'); params.contentmsg.css({color:'#ff0000'}); diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index adbbf4780..07d065901 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -1,25 +1,41 @@ + <%= javascript_include_tag "/assets/kindeditor/kindeditor" %> -
    +
    <%# reply_allow = JournalsForMessage.create_by_user? User.current %>

    <%= l(:label_leave_message) %>

    <% if !User.current.logged?%> -
    - <%= l(:label_user_login_tips) %> - <%= link_to l(:label_user_login_new), signin_path %> -
    -
    +
    + <%= l(:label_user_login_tips) %> + <%= link_to l(:label_user_login_new), signin_path %> +
    +
    <% else %> - <%= form_for('new_form', :method => :post, - :url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%> - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;", + <%= form_for('new_form', :method => :post, + :url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%> + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%#= f.kindeditor 'course_message',:height => '140px;',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;", :placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%> - 取  消 - - <%= l(:button_leave_meassge)%> - - <% end %> + +

    +
    + 取  消 + + <%= l(:button_leave_meassge)%> + + <% end %> <% end %>
    @@ -28,4 +44,157 @@
    \ No newline at end of file + +
    + + \ No newline at end of file diff --git a/app/views/courses/_history.html.erb b/app/views/courses/_history.html.erb index e7c5a7c5e..3dc9aeba5 100644 --- a/app/views/courses/_history.html.erb +++ b/app/views/courses/_history.html.erb @@ -30,8 +30,7 @@ <% end %> <% if reply_allow %> <%= link_to l(:label_bid_respond_quote),'', - {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %> - + {:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %> <% end %>
    diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index d52f7cfe1..9d4eebd6f 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -34,7 +34,7 @@ <% end %> <% if reply_allow %> <%= link_to l(:button_reply),'', - {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %> + {:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{id}'), $('##{id} textarea'), ''); return false;"} %> <% end %>
    diff --git a/app/views/words/_new_respond_course.html.erb b/app/views/words/_new_respond_course.html.erb index e705b7fd3..5b27fd21f 100644 --- a/app/views/words/_new_respond_course.html.erb +++ b/app/views/words/_new_respond_course.html.erb @@ -4,12 +4,14 @@ :placeholder => l(:label_feedback_respond_content), :maxlength => 250 %> +

    <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> <%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %> +
    <%= submit_tag l(:button_feedback_respond), :name => nil , :class => "reply_btn"%> - + <% end %> \ No newline at end of file From a4f1edcdeeb5967f7ab6be84ba9eec94226e1644 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 11 Jun 2015 16:30:14 +0800 Subject: [PATCH 074/130] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=9Awiki?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=85=B6=E5=AE=83=E6=88=90=E5=91=98=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E6=94=B6=E5=88=B0=EF=BC=9B=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E3=80=81=E8=AF=BE=E7=A8=8B=E7=95=99=E8=A8=80=E5=85=B6=E5=AE=83?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=8F=AF=E4=BB=A5=E6=94=B6=E5=88=B0=20?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=98=BE=E7=A4=BA=E9=A1=B5=E9=9D=A2=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 15 ++-- .../mailer/send_for_user_activities.html.erb | 30 +++---- .../mailer/send_for_user_activities.text.erb | 82 ++++++++++++++++--- config/locales/zh.yml | 2 + 4 files changed, 98 insertions(+), 31 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 610f2b4c6..8488fc1d0 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -103,7 +103,7 @@ class Mailer < ActionMailer::Base course_ids = courses.map {|course| course.id}.join(",") # 查询user的缺陷,项目中成员都能收到 - sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}' + sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}' and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc" @issues = Issue.find_by_sql(sql) @@ -127,7 +127,7 @@ class Mailer < ActionMailer::Base # 查询user所在项目添加wiki @wiki_contents = WikiContent.find_by_sql("select DISTINCT wc.* from wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where - m.user_id = '#{user.id}' and p.user_id = m.user_id and m.project_id=p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0 + m.user_id = '#{user.id}' and m.project_id = p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0 and (wc.updated_on between '#{date_from}' and '#{date_to}') order by updated_on desc") # 查询user在课程中发布的讨论帖子 @@ -163,13 +163,16 @@ class Mailer < ActionMailer::Base and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] # 查询user在课程及个人中留言 - @course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT * from journals_for_messages where - jour_type='Course' and user_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + @course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c + where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id + and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + @user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC') # 查询user在项目中留言(用户反馈) - @project_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT * from journals_for_messages where - jour_type='Project' and user_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + @project_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, projects p + where m.user_id = '#{user.id}' and p.id = m.project_id and jfm.jour_id = p.id + and jfm.jour_type='Project' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") # 查询user新建贴吧或发布帖子 @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 7776a420d..f30c770da 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -29,7 +29,7 @@ :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(course_new.created_on) %> + <%= format_time(course_new.created_on) %> <% end %>
    @@ -62,7 +62,7 @@ :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(bid.created_at) %> + <%= format_time(bid.created_at) %> <% end %> <% end %> @@ -97,7 +97,7 @@ :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(course_journal_message.created_on) %> + <%= format_time(course_journal_message.created_on) %> <% end %>
    @@ -125,7 +125,7 @@ <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value), :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(course_message.created_on) %> + <%= format_time(course_message.created_on) %> <% end %>
    @@ -157,7 +157,7 @@ :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(attachment.created_on) %> + <%= format_time(attachment.created_on) %> <% end %>
    @@ -190,7 +190,7 @@ <%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value), :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(issue.created_on) %> + <%= format_time(issue.created_on) %> <% end %> @@ -223,7 +223,7 @@ :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(project_message.created_on) %> + <%= format_time(project_message.created_on) %> <% end %> @@ -250,13 +250,13 @@ ] <%= link_to wikicontent.author, user_activities_url(wikicontent.author,:token => @token.value), :class => "wmail_name", :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_project_notice) %> + <%= l(:label_wiki_mail_notification) %> <% unless wikicontent.page.nil? %> <%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value), :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <% end %> - <%= format_time(wikicontent.updated_on) %> + <%= format_time(wikicontent.updated_on) %> <% end %>
    @@ -281,12 +281,12 @@ ] <%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value), :class => "wmail_name", :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_project_notice) %> + <%= l(:label_project_mail_notice) %> <%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value), :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(project_new.created_on) %> + <%= format_time(project_new.created_on) %> <% end %>
    @@ -319,7 +319,7 @@ :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(project_journal_message.created_on) %> + <%= format_time(project_journal_message.created_on) %> <% end %>
    @@ -352,7 +352,7 @@ :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(user_journal_message.created_on) %> + <%= format_time(user_journal_message.created_on) %> <% end %> @@ -384,7 +384,7 @@ :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(forum.created_at) %> + <%= format_time(forum.created_at) %> <% end %> @@ -411,7 +411,7 @@ :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <%= format_time(memo.created_at) %> + <%= format_time(memo.created_at) %> <% end %> diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb index 1bfbca4a1..f09dcb299 100644 --- a/app/views/mailer/send_for_user_activities.text.erb +++ b/app/views/mailer/send_for_user_activities.text.erb @@ -4,7 +4,7 @@ <%= l(:label_course_overview)%> <% unless @course_news.first.nil? %> <%= l(:label_course_news) %> - (<%= @course_news.count %>) + <% @course_news.each do |course_new|%> @@ -28,7 +28,7 @@ <% end %> <% unless @bids.empty? %> - <%= l(:label_homework_overview) %><%= @bids.count %> + <%= l(:label_homework_overview) %> <% unless @bids.first.nil?%> <% @bids.each do |bid| %> ▪ @@ -58,7 +58,7 @@ <% unless @course_journal_messages.first.nil? %> - <%= l(:view_course_journals_for_messages) %> (<%= @course_journal_messages.count %>) + <%= l(:view_course_journals_for_messages) %> <% @course_journal_messages.each do |course_journal_message|%> @@ -88,7 +88,7 @@ <% unless @course_messages.first.nil? %> <%= l(:view_borad_course) %> - (<%= @course_messages.count %>) + <% @course_messages.each do |course_message|%> @@ -119,7 +119,7 @@ <% unless @attachments.first.nil? %> <%= l(:label_course_attendingcontestwork_download) %> - (<%= @attachments.count %>) + <% @attachments.each do |attachment|%> @@ -146,12 +146,12 @@ <% end %> <% end %> -<% @issues.first || @project_messages.first %> +<% @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first %> <%= l(:label_project_overview_new)%> <% unless @issues.first.nil? %> <%= l(:label_issue_tracking) %> - (<%= @issues.count %>) + <% @issues.each do |issue|%> ▪ @@ -179,7 +179,7 @@ <% unless @project_messages.first.nil? %> <%= l(:project_moule_boards_show) %> - (<%= @project_messages.count %>) + <% @project_messages.each do |project_message|%> ▪[ @@ -200,6 +200,68 @@ <%= format_time(project_message.created_on) %> <% end %> + <% unless @wiki_contents.first.nil? %> + + <%= l(:label_wiki) %> + + <% @wiki_contents.each do |wikicontent|%> + ▪[ + <% unless wikicontent.page.nil? %> + <%= link_to truncate(wikicontent.page.wiki.project.name,length: 30,omission: '...'), project_url(wikicontent.page.wiki.project, :token => @token.value) + %> + <% end %> + ] + <%= link_to wikicontent.author, user_activities_url(wikicontent.author,:token => @token.value) %> + <%= l(:label_project_notice) %> + <% unless wikicontent.page.nil? %> + <%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value) %> + <% end %> + <%= format_time(wikicontent.updated_on) %> + + <% end %> + <% end %> + + + <% unless @project_news.first.nil? %> + + <%= l(:label_project_news) %> + + <% @project_news.each do |project_new|%> + ▪[ + + <%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value) + %> + ] + <%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value) + %> + <%= l(:label_project_notice) %> + + <%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value) + %> + <%= format_time(project_new.created_on) %> + + <% end %> + <% end %> + + + <% unless @project_journal_messages.first.nil? %> + <%= l(:label_project_mail_feedback) %> + + <% @project_journal_messages.each do |project_journal_message|%> + ▪[ + + <%= link_to truncate(project_journal_message.project.name,length: 30,omission: '...'), project_url(project_journal_message.project, :token => @token.value) + %> + ] + + <%= link_to project_journal_message.user, user_activities_url(project_journal_message.user,:token => @token.value) %> + <%= l(:label_send_course_journals_for_messages) %> + + <%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value) + %> + <%= format_time(project_journal_message.created_on) %> + <% end %> + <% end %> <% end %> @@ -234,7 +296,7 @@ <% unless @forums.first.nil? %> <%= l(:label_user_forum) %> - (<%= @forums.count %>) + <% @forums.each do |forum|%> ▪ @@ -253,7 +315,7 @@ <% unless @memos.first.nil? %> <%= l(:label_user_message_forum) %> - (<%= @memos.count %>) + <% @memos.each do |memo|%> ▪ diff --git a/config/locales/zh.yml b/config/locales/zh.yml index b2160f7b0..fc0a0e6c6 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -783,6 +783,7 @@ zh: label_project_newother: "查看其他评论" label_project_newshare: "分享了" label_project_notice: "发布了通知:" + label_project_mail_notice: "发布了新闻:" label_project_issue: "发布了问题:" label_project_newadd: "添加了" label_project_unadd: "暂无项目,赶快去创建吧!" @@ -1505,6 +1506,7 @@ zh: label_news_number: 新闻的数量 label_wiki_number: wiki的数量 + label_wiki_mail_notification: 发布了wiki From 2a74509fd9ba54e946a2746c9ff98220f0934103 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 11 Jun 2015 16:33:33 +0800 Subject: [PATCH 075/130] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=A1=B9=E7=9B=AE=E6=8B=AC=E5=8F=B7=E9=A2=9C?= =?UTF-8?q?=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/send_for_user_activities.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index f30c770da..1b4e2c255 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -213,7 +213,7 @@ <%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value), :class=> "wmail_column", :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - ] + ] <%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name", :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> From e99206ff4a0a0213f860be92c70bad5a89e8a423 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Thu, 11 Jun 2015 17:31:47 +0800 Subject: [PATCH 076/130] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=95=99=E8=A8=80?= =?UTF-8?q?=E6=8D=A2=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_history.html.erb | 2 +- app/views/projects/_project_jours.html.erb | 174 +++++++++++++++++- app/views/words/_new_respond_course.html.erb | 5 +- app/views/words/_new_respond_project.html.erb | 9 +- 4 files changed, 181 insertions(+), 9 deletions(-) diff --git a/app/views/projects/_history.html.erb b/app/views/projects/_history.html.erb index 3633ed7b5..4c29552e9 100644 --- a/app/views/projects/_history.html.erb +++ b/app/views/projects/_history.html.erb @@ -21,7 +21,7 @@ <% end %> <% if reply_allow %> <%= link_to l(:label_bid_respond_quote),'', - {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %> + {:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %> <% end %> diff --git a/app/views/projects/_project_jours.html.erb b/app/views/projects/_project_jours.html.erb index 5b1e3c065..e7aebac43 100644 --- a/app/views/projects/_project_jours.html.erb +++ b/app/views/projects/_project_jours.html.erb @@ -1,4 +1,18 @@ -
    + +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +
    <% reply_allow = JournalsForMessage.create_by_user? User.current %>

    <%= l(:label_user_response) %>

    <% if !User.current.logged?%> @@ -12,8 +26,10 @@ <%= form_for('new_form', :method => :post, :url => {:controller => 'words', :action => 'leave_project_message'}) do |f|%> <%= f.text_area 'project_message', :rows => 3, :cols => 65, - :placeholder => "#{l(:label_welcome_my_respond)}" %> - <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr" %> + :placeholder => "#{l(:label_welcome_my_respond)}",:nhname=>'new_message_textarea' %> +

    +
    + <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "blue_btn fr mt10 mb10" %> <% end %> <% end %> @@ -24,3 +40,155 @@
      <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
    +
    + \ No newline at end of file diff --git a/app/views/words/_new_respond_course.html.erb b/app/views/words/_new_respond_course.html.erb index 5b27fd21f..a939a55d4 100644 --- a/app/views/words/_new_respond_course.html.erb +++ b/app/views/words/_new_respond_course.html.erb @@ -1,9 +1,10 @@ <%= form_tag(words_create_reply_path, :remote => true) do %> <%= text_area_tag 'user_notes', "", :class => 'w520 h50 mb5', :style => "resize: none;overflow: hidden;",:rows => 4, - :placeholder => l(:label_feedback_respond_content), + :placeholder => l(:label_feedback_respond_content)#, - :maxlength => 250 %> + #:maxlength => 250 + %>

    <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> diff --git a/app/views/words/_new_respond_project.html.erb b/app/views/words/_new_respond_project.html.erb index e705b7fd3..c3ff241b3 100644 --- a/app/views/words/_new_respond_project.html.erb +++ b/app/views/words/_new_respond_project.html.erb @@ -1,15 +1,18 @@ <%= form_tag(words_create_reply_path, :remote => true) do %> <%= text_area_tag 'user_notes', "", :class => 'w520 h50 mb5', :style => "resize: none;overflow: hidden;",:rows => 4, - :placeholder => l(:label_feedback_respond_content), - - :maxlength => 250 %> + :placeholder => l(:label_feedback_respond_content) + #,:maxlength => 250 + %> +

    <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> <%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %> +
    <%= submit_tag l(:button_feedback_respond), :name => nil , :class => "reply_btn"%> + <% end %> \ No newline at end of file From 6929694fb403e38f24dd2f400999a09b5464bedd Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Thu, 11 Jun 2015 18:16:23 +0800 Subject: [PATCH 077/130] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=95=99=E8=A8=80=E6=8D=A2=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_history.html.erb | 2 +- app/views/users/_user_jours.html.erb | 171 ++++++++++++++++++++++++++ app/views/words/_new.html.erb | 8 +- app/views/words/_new_respond.html.erb | 8 +- 4 files changed, 183 insertions(+), 6 deletions(-) diff --git a/app/views/users/_history.html.erb b/app/views/users/_history.html.erb index 9b5744251..3daa6cc7d 100644 --- a/app/views/users/_history.html.erb +++ b/app/views/users/_history.html.erb @@ -24,7 +24,7 @@ <% end %> <% if reply_allow %> <%= link_to l(:label_bid_respond_quote),'', - {:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %> + {:focus => 'project_respond',:nhname=>'reply_btn', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %> <% end %> diff --git a/app/views/users/_user_jours.html.erb b/app/views/users/_user_jours.html.erb index b5badf60c..061632194 100644 --- a/app/views/users/_user_jours.html.erb +++ b/app/views/users/_user_jours.html.erb @@ -1,3 +1,17 @@ + +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
    <% reply_allow = JournalsForMessage.create_by_user? User.current %> @@ -49,3 +63,160 @@ } + +
    + diff --git a/app/views/words/_new.html.erb b/app/views/words/_new.html.erb index 561c6a953..e81368c1f 100644 --- a/app/views/words/_new.html.erb +++ b/app/views/words/_new.html.erb @@ -35,7 +35,7 @@ border: #d5dee9 1px solid; } -
    +
    <%= form_for('new_form', :remote => true, :method => :post, :url => {:controller => 'words', :action => 'create', @@ -51,10 +51,12 @@ <%= f.text_area 'user_message', :rows => 3, :cols => 65, :placeholder => "#{l(:label_leave_a_message)}", :style => "resize: none; width: 98%", - :class => 'noline'%> + :class => 'noline',:nhname=>'new_message_textarea'%> <%# end %> <%= f.text_field :reference_user_id, :style=>"display:none"%> - <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-right: 1%; margin-top: 1px;"%> +

    +
    + <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-top: 5px;"%> <%else %>
    <%= l(:label_user_login_tips) %> diff --git a/app/views/words/_new_respond.html.erb b/app/views/words/_new_respond.html.erb index 33c523c33..f140030a7 100644 --- a/app/views/words/_new_respond.html.erb +++ b/app/views/words/_new_respond.html.erb @@ -1,15 +1,19 @@ <%= form_tag(words_create_reply_path, :remote => true) do %> <%= text_area_tag 'user_notes', "", :class => 'noline', :style => "resize: none;", :rows => 4, - :placeholder => l(:label_feedback_respond_content), - :maxlength => 250 %> + :placeholder => l(:label_feedback_respond_content)#, + #:maxlength => 250 + %> +

    <%= hidden_field_tag 'reference_id', params[:reference_id], :value => journal.id %> <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => m_reply_id.user.id %> <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => m_reply_id.id %> <%= hidden_field_tag 'show_name',params[:show_name],:value => show_name.nil? ? true : show_name %> +
    <%= submit_tag l(:button_feedback_respond), :name => nil , :class => "enterprise", :style => "float: right; margin-top: 1px; margin-right: 4px;margin-bottom: 5px;"%> + <% end %> \ No newline at end of file From f7e0ad9fc36fd001546dfeb03c0f7b870877e30d Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 12 Jun 2015 10:09:47 +0800 Subject: [PATCH 078/130] ... --- app/views/boards/_course_show.html.erb | 2 +- app/views/boards/_form_project.html.erb | 1 + app/views/boards/_project_show.html.erb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 48e5a870d..5beee8601 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -253,7 +253,7 @@ }; params.get_ref_str_call=function(btn){ var div = btn.parent('div'); - var str = '
    '+$('a',div).filter(':first').html()+' 写到:
    '+$("input[nhname='nh_content_val']",div).val()+'
    '; + var str = '
    '+$('a',div).filter(':first').html()+' 写到:
    '+$("input[nhname='nh_content_val']",div).val()+'
    '; return str; } nh_init_board(params); diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb index f6b41b53f..525869901 100644 --- a/app/views/boards/_form_project.html.erb +++ b/app/views/boards/_form_project.html.erb @@ -47,6 +47,7 @@
  • +
    <% unless replying %> <% end %> diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index aed6b80e5..d5a5a7882 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -238,7 +238,7 @@ }; params.get_ref_str_call=function(btn){ var div = btn.parent('div'); - var str = '
    '+$('a',div).filter(':first').html()+' 写到:
    '+$("input[nhname='nh_content_val']",div).val()+'
    '; + var str = '
    '+$('a',div).filter(':first').html()+' 写到:
    '+$("input[nhname='nh_content_val']",div).val()+'
    '; return str; } nh_init_board(params); From 3c515dd07727e075baddf38eff08ef3e8a9410a1 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 12 Jun 2015 10:52:15 +0800 Subject: [PATCH 079/130] ... --- app/views/boards/show.html.erb | 7 +++++-- app/views/courses/_courses_jours.html.erb | 7 +++++-- app/views/projects/_project_jours.html.erb | 7 +++++-- app/views/users/_user_jours.html.erb | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index d7a02e326..196e7f097 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -185,8 +185,11 @@ function nh_init_board(params){ if(params.quote_input!=undefined)params.quote_input.empty(); }else{ if(params.type=='reply'){ - params.jumphref.attr('href','#'+params.form.attr('id')); - params.jumphref[0].click(); + params.textarea.show(); + params.textarea.focus(); + params.textarea.hide(); + //params.jumphref.attr('href','#'+params.form.attr('id')); + //params.jumphref[0].click(); }else params.inputsubject.focus(); } }); diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index 07d065901..a097a2286 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -168,8 +168,11 @@ params.cancel_btn.click(); setTimeout(function(){ if(!params.div_form.is(':hidden')){ - $("#nhjump").attr('href','#'+params.div_form.attr('id')); - $("#nhjump")[0].click(); + params.textarea.show(); + params.textarea.focus(); + params.textarea.hide(); +// $("#nhjump").attr('href','#'+params.div_form.attr('id')); +// $("#nhjump")[0].click(); } },300); params.textarea.data('init',1); diff --git a/app/views/projects/_project_jours.html.erb b/app/views/projects/_project_jours.html.erb index e7aebac43..d530a7199 100644 --- a/app/views/projects/_project_jours.html.erb +++ b/app/views/projects/_project_jours.html.erb @@ -162,8 +162,11 @@ params.cancel_btn.click(); setTimeout(function(){ if(!params.div_form.is(':hidden')){ - $("#nhjump").attr('href','#'+params.div_form.attr('id')); - $("#nhjump")[0].click(); + params.textarea.show(); + params.textarea.focus(); + params.textarea.hide(); +// $("#nhjump").attr('href','#'+params.div_form.attr('id')); +// $("#nhjump")[0].click(); } },300); params.textarea.data('init',1); diff --git a/app/views/users/_user_jours.html.erb b/app/views/users/_user_jours.html.erb index 061632194..56b9a883b 100644 --- a/app/views/users/_user_jours.html.erb +++ b/app/views/users/_user_jours.html.erb @@ -190,8 +190,11 @@ params.cancel_btn.click(); setTimeout(function(){ if(!params.div_form.is(':hidden')){ - $("#nhjump").attr('href','#'+params.div_form.attr('id')); - $("#nhjump")[0].click(); + params.textarea.show(); + params.textarea.focus(); + params.textarea.hide(); +// $("#nhjump").attr('href','#'+params.div_form.attr('id')); +// $("#nhjump")[0].click(); } },300); params.textarea.data('init',1); From dbb6c9f54cab48b30ebeedd1a487909777b94bf4 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 12 Jun 2015 11:21:49 +0800 Subject: [PATCH 080/130] ... --- public/assets/kindeditor/kindeditor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index 74228d3ea..5ebe96a32 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -5620,7 +5620,8 @@ _plugin('core', function(K) { afterUpload : function(data) { if (data.error === 0) { var url = K.formatUrl(data.url, 'absolute'); - self.exec('insertimage', url, 'image','','','1','left'); + //self.exec('insertimage', url, 'image','','','1','left'); + self.insertHtml(''); var asset_id = data.asset_id; if ( asset_id != "" && parent.document.getElementById('asset_id') != null ) { parent.document.getElementById('asset_id').value += asset_id.toString(); From 0ca913bc8353222a7babb346eeefa7710fdd590e Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 12 Jun 2015 11:55:29 +0800 Subject: [PATCH 081/130] ... --- app/helpers/activity_notifys_helper.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/helpers/activity_notifys_helper.rb b/app/helpers/activity_notifys_helper.rb index 15fc43b54..f2069a2d3 100644 --- a/app/helpers/activity_notifys_helper.rb +++ b/app/helpers/activity_notifys_helper.rb @@ -1,7 +1,6 @@ module ActivityNotifysHelper def get_new_notify_count(container,type) - logger.info('xxoo') - query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=?',container.id,type,User.current.id); + query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=? and is_read=0',container.id,type,User.current.id); return query.count() end end \ No newline at end of file From 9938c9f83abd91bbf04e448d8535a7fa45cb577b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 12 Jun 2015 14:41:02 +0800 Subject: [PATCH 082/130] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/courses/show.html.erb b/app/views/courses/show.html.erb index 4fbf3ad43..0d48dc8d2 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -49,7 +49,7 @@
    <%= l :label_activity_time %> : <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %>

    - <%= link_to_attachments_course(e) if e.is_a?(News) %> + <%= link_to_attachments_course(e) if e.class.to_s == "News" %>
  • From e8369b2f258e3c68c605fa55c954b9ed1398af5b Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 12 Jun 2015 14:49:50 +0800 Subject: [PATCH 083/130] ... --- app/views/boards/show.html.erb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 196e7f097..ba9583e7d 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -190,7 +190,12 @@ function nh_init_board(params){ params.textarea.hide(); //params.jumphref.attr('href','#'+params.form.attr('id')); //params.jumphref[0].click(); - }else params.inputsubject.focus(); + }else{ + params.textarea.show(); + params.textarea.focus(); + params.textarea.hide(); +// params.inputsubject.focus(); + } } }); params.textarea.data('init','1');//标记为已经初始化 From 881d66103b80578dee2101c0a259841e63b5b213 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 12 Jun 2015 14:59:06 +0800 Subject: [PATCH 084/130] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E6=8E=89=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mailer/send_for_user_activities.html.erb | 12 ----- .../mailer/send_for_user_activities.text.erb | 50 +++++++++---------- 2 files changed, 25 insertions(+), 37 deletions(-) diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 1b4e2c255..21549be21 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -10,7 +10,6 @@
      <%= l(:label_course_news) %> - <% @course_news.each do |course_new|%>
    • @@ -41,7 +40,6 @@
        <%= l(:label_homework_overview) %> - <% unless @bids.first.nil?%> <% @bids.each do |bid| %> @@ -76,7 +74,6 @@
          <%= l(:view_course_journals_for_messages) %> - <% @course_journal_messages.each do |course_journal_message|%> @@ -109,7 +106,6 @@
            <%= l(:view_borad_course) %> - <% @course_messages.each do |course_message|%>
          • @@ -137,7 +133,6 @@
              <%= l(:label_course_attendingcontestwork_download) %> - <% @attachments.each do |attachment|%>
            • @@ -174,7 +169,6 @@
                <%= l(:label_issue_tracking) %> - <% @issues.each do |issue|%>
              • @@ -203,7 +197,6 @@
                  <%= l(:project_moule_boards_show) %> - <% @project_messages.each do |project_message|%>
                • @@ -236,7 +229,6 @@
                    <%= l(:label_wiki) %> - <% @wiki_contents.each do |wikicontent|%>
                  • @@ -268,7 +260,6 @@
                      <%= l(:label_project_news) %> - <% @project_news.each do |project_new|%>
                    • @@ -298,7 +289,6 @@
                        <%= l(:label_project_mail_feedback) %> - <% @project_journal_messages.each do |project_journal_message|%> @@ -336,7 +326,6 @@
                          <%= l(:label_user_message) %> - <% @user_journal_messages.each do |user_journal_message|%> @@ -395,7 +384,6 @@
                            <%= l(:label_user_message_forum) %> - <% @memos.each do |memo|%> diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb index f09dcb299..c46e96f03 100644 --- a/app/views/mailer/send_for_user_activities.text.erb +++ b/app/views/mailer/send_for_user_activities.text.erb @@ -15,13 +15,13 @@ <%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value)%> ] - <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value) + <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value) %> <%= l(:label_project_notice) %> <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value) - - + + %> <%= format_time(course_new.created_on) %> <% end %> @@ -35,7 +35,7 @@ [ <%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value) - + %> ] @@ -44,8 +44,8 @@ <%= l(:label_course_homework) %> <%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value) - - + + %> <%= format_time(bid.created_at) %> @@ -66,17 +66,17 @@ [ <%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value) - + %> ] - <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value) + <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value) %> <%= l(:label_send_course_journals_for_messages) %> <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value) - - + + %> <%= format_time(course_journal_message.created_on) %> @@ -97,7 +97,7 @@ [ <%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course, :token => @token.value) - + %> ] @@ -106,8 +106,8 @@ <%= l(:label_send_course_messages) %> <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value) - - + + %> <%= format_time(course_message.created_on) %> @@ -126,7 +126,7 @@ ▪[ <%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value) - + %> ] @@ -135,8 +135,8 @@ <%= l(:label_course_file_upload) %> <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value) - - + + %> <%= format_time(attachment.created_on) %> @@ -158,7 +158,7 @@ [ <%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value) - + %> ] @@ -167,8 +167,8 @@ <%= l(:label_project_issue) %> <%= link_to truncate(issue. subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value) - - + + %> <%= format_time(issue.created_on) %> <% end %> @@ -185,7 +185,7 @@ ▪[ <%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value) - + %> ] @@ -194,8 +194,8 @@ <%= l(:label_send_course_messages) %> <%= link_to truncate(project_message. subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value) - - + + %> <%= format_time(project_message.created_on) %> <% end %> @@ -277,13 +277,13 @@ ▪ <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value) - + %> <%= l(:label_show_your_message) %> <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'), feedback_url(@user,:token => @token.value) - - + + %> <%= format_time(user_journal_message.created_on) %> From 46da84cd819fe4fbd39b8bf0f14da7c27dfa8c63 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 12 Jun 2015 15:56:28 +0800 Subject: [PATCH 085/130] ... --- app/views/courses/_courses_jours.html.erb | 4 ++-- app/views/projects/_project_jours.html.erb | 2 +- app/views/users/_user_jours.html.erb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index a097a2286..e3eba9151 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -155,8 +155,8 @@ params.div_form = $(">.respond-form",params.container); params.form = $("form",params.div_form); params.textarea = $("textarea[name='user_notes']",params.div_form); - params.contentmsg = $("p[nhname='contentmsg']",params.div_form), - params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); + params.contentmsg = $("p[nhname='contentmsg']",params.div_form); + params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form); if(params.textarea.data('init') == undefined){ params.editor = init_editor(params); diff --git a/app/views/projects/_project_jours.html.erb b/app/views/projects/_project_jours.html.erb index d530a7199..5692afcf5 100644 --- a/app/views/projects/_project_jours.html.erb +++ b/app/views/projects/_project_jours.html.erb @@ -149,7 +149,7 @@ params.div_form = $(">.respond-form",params.container); params.form = $("form",params.div_form); params.textarea = $("textarea[name='user_notes']",params.div_form); - params.contentmsg = $("p[nhname='contentmsg']",params.div_form), + params.contentmsg = $("p[nhname='contentmsg']",params.div_form); params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form); if(params.textarea.data('init') == undefined){ diff --git a/app/views/users/_user_jours.html.erb b/app/views/users/_user_jours.html.erb index 56b9a883b..a2f6f8cb4 100644 --- a/app/views/users/_user_jours.html.erb +++ b/app/views/users/_user_jours.html.erb @@ -177,8 +177,8 @@ params.div_form = $(">.respond-form",params.container); params.form = $("form",params.div_form); params.textarea = $("textarea[name='user_notes']",params.div_form); - params.contentmsg = $("p[nhname='contentmsg']",params.div_form), - params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); + params.contentmsg = $("p[nhname='contentmsg']",params.div_form); + params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form); if(params.textarea.data('init') == undefined){ params.editor = init_editor(params); From 6d8f0e728d49cd99aa8179ea0eae89cc80a4708d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 12 Jun 2015 16:26:24 +0800 Subject: [PATCH 086/130] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=20=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E3=80=81=E9=80=9A=E7=9F=A5=E6=A8=A1=E5=9D=97=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E7=89=88=E7=BC=96=E8=BE=91=E5=99=A8=E7=9B=B8=E5=85=B3BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homework_common/_homework_common_form.html.erb | 14 ++++++++------ app/views/news/_course_form.html.erb | 8 ++++++-- .../kindeditor/themes/default/default.css | 1 + .../assets/kindeditor/themes/default/default.css | 1 + public/stylesheets/public.css | 1 + 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/views/homework_common/_homework_common_form.html.erb b/app/views/homework_common/_homework_common_form.html.erb index e3ef0d237..28aa490de 100644 --- a/app/views/homework_common/_homework_common_form.html.erb +++ b/app/views/homework_common/_homework_common_form.html.erb @@ -11,12 +11,14 @@
                          • - <% if edit_mode %> - <%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %> - <% else %> - <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor' %> - <% end %> +
                            + <% if edit_mode %> + <%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %> + <% else %> + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :description,:editor_id => 'homework_description_editor' %> + <% end %> +
                          • diff --git a/app/views/news/_course_form.html.erb b/app/views/news/_course_form.html.erb index 32c8e368e..1769c98f3 100644 --- a/app/views/news/_course_form.html.erb +++ b/app/views/news/_course_form.html.erb @@ -8,11 +8,15 @@ <% if is_new %> <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> - <%= f.kindeditor :description,:width=>'91%',:editor_id=>'news_description_editor' %> +
                            + <%= f.kindeditor :description,:editor_id=>'news_description_editor' %> +

                            <% else %> - <%= f.kindeditor :description,:width=>'91%',:editor_id=>'news_description_editor',:owner_id => @news.id,:owner_type => OwnerTypeHelper::NEWS %> +
                            + <%= f.kindeditor :description,:editor_id=>'news_description_editor',:owner_id => @news.id,:owner_type => OwnerTypeHelper::NEWS %> +

                            <% end %> diff --git a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/default/default.css b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/default/default.css index 428b6c8b5..0d322283a 100644 --- a/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/default/default.css +++ b/lib/rails_kindeditor/vendor/assets/javascripts/kindeditor/themes/default/default.css @@ -421,6 +421,7 @@ overflow: hidden; margin: 0; padding: 0; + max-width: 100%; } /* toolbar */ .ke-toolbar { diff --git a/public/assets/kindeditor/themes/default/default.css b/public/assets/kindeditor/themes/default/default.css index 5de213f37..c5a84c186 100644 --- a/public/assets/kindeditor/themes/default/default.css +++ b/public/assets/kindeditor/themes/default/default.css @@ -432,6 +432,7 @@ } /* container */ .ke-container { + max-width: 100%; display: block; border: 1px solid #CCCCCC; background-color: #FFF; diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 4bfc1ef99..0ed497127 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -440,3 +440,4 @@ img{max-width: 100%;} .attachments {clear: both;} .is_public_checkbox{margin-left: 15px;margin-right: 10px;} .author_name{color: #3ca5c6 !important;} +.ke-container-default{max-width: 100%;} From e138292f2a9a01762a5b3b0647645a270fe0eaae Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 12 Jun 2015 16:31:29 +0800 Subject: [PATCH 087/130] ... --- app/views/courses/_courses_jours.html.erb | 6 ++++-- app/views/courses/_history.html.erb | 3 ++- app/views/projects/_history.html.erb | 3 ++- app/views/projects/_project_jours.html.erb | 6 ++++-- app/views/users/_history.html.erb | 3 ++- app/views/users/_user_jours.html.erb | 6 ++++-- app/views/words/_journal_reply_items.html.erb | 3 ++- 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/app/views/courses/_courses_jours.html.erb b/app/views/courses/_courses_jours.html.erb index e3eba9151..28dfbe786 100644 --- a/app/views/courses/_courses_jours.html.erb +++ b/app/views/courses/_courses_jours.html.erb @@ -49,6 +49,7 @@ -<%= error_messages_for 'bid' %> - -

                            <%= l(:label_bids_form_contest_new_description) %>

                            -

                            <%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Bid::NAME_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_name)}" %>

                            - -

                            <%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Bid::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %>

                            - -

                            <%= f.text_field :password, :size => 60, :style => "width:488px;margin-left: 10px;" %>

                            - -

                            - <%= f.text_field :budget, :required => true, :size => 60, :style => "width:350px;", :placeholder => l(:label_bids_reward_what) %> - - -

                            - -

                            <%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :readonly => true, :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('bid_deadline')%>

                            From 94877bb353d2cc8f818d7378c170f867c0834baa Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 12 Jun 2015 16:48:43 +0800 Subject: [PATCH 093/130] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_revisions.html.erb | 97 +++++++++--------- app/views/repositories/show.html.erb | 110 +++++++++++---------- 2 files changed, 104 insertions(+), 103 deletions(-) diff --git a/app/views/repositories/_revisions.html.erb b/app/views/repositories/_revisions.html.erb index a0a960b6c..891952559 100644 --- a/app/views/repositories/_revisions.html.erb +++ b/app/views/repositories/_revisions.html.erb @@ -1,54 +1,53 @@ <% show_revision_graph = ( @repository.supports_revision_graph? && path.blank? ) %> <%= if show_revision_graph && revisions && revisions.any? - indexed_commits, graph_space = index_commits(revisions, @repository.branches) do |scmid| - url_for( - :controller => 'repositories', - :action => 'revision', - :id => project, - :repository_id => @repository.identifier_param, - :rev => scmid) - end - render :partial => 'revision_graph', - :locals => { - :commits => indexed_commits, - :space => graph_space - } -end %> + indexed_commits, graph_space = index_commits(revisions, @repository.branches) do |scmid| + url_for( + :controller => 'repositories', + :action => 'revision', + :id => project, + :repository_id => @repository.identifier_param, + :rev => scmid) + end + render :partial => 'revision_graph', + :locals => { + :commits => indexed_commits, + :space => graph_space + } + end %> <%= form_tag( - {:controller => 'repositories', :action => 'diff', :id => project, - :repository_id => @repository.identifier_param, :path => to_path_param(path)}, - :method => :get - ) do %> - - - - - - - - - - -<% show_diff = revisions.size > 1 %> -<% line_num = 1 %> -<% revisions.each do |changeset| %> - -<% id_style = (show_revision_graph ? "padding-left:#{(graph_space + 1) * 20}px" : nil) %> -<%= content_tag(:td, :class => 'id', :style => id_style) do %> - <%= link_to_revision(changeset, @repository) %> -<% end %> - - - - - - -<% line_num += 1 %> -<% end %> - -
                            #<%= l(:label_date) %><%= l(:field_author) %><%= l(:field_comments) %>
                            <%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked',true);") if show_diff && (line_num < revisions.size) %><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %><%= format_time(changeset.committed_on) %><%= h truncate(changeset.author.to_s, :length => 30) %><%= textilizable(truncate_at_line_break(changeset.comments)) %>
                            -

                            + {:controller => 'repositories', :action => 'diff', :id => project, + :repository_id => @repository.identifier_param, :path => to_path_param(path)}, + :method => :get + ) do %> + + + + + + + + + + + <% show_diff = revisions.size > 1 %> + <% line_num = 1 %> + <% revisions.each do |changeset| %> + + <% id_style = (show_revision_graph ? "padding-left:#{(graph_space + 1) * 20}px" : nil) %> + <%= content_tag(:td, :class => 'id', :style => id_style) do %> + <%= link_to_revision(changeset, @repository) %> + <% end %> + + + + + + + <% line_num += 1 %> + <% end %> + +
                            #<%= l(:label_date) %><%= l(:field_author) %><%= l(:field_comments) %>
                            <%= radio_button_tag('rev', changeset.identifier, (line_num==1), :id => "cb-#{line_num}", :onclick => "$('#cbto-#{line_num+1}').attr('checked',true);") if show_diff && (line_num < revisions.size) %><%= radio_button_tag('rev_to', changeset.identifier, (line_num==2), :id => "cbto-#{line_num}", :onclick => "if ($('#cb-#{line_num}').attr('checked')) {$('#cb-#{line_num-1}').attr('checked',true);}") if show_diff && (line_num > 1) %><%= format_time(changeset.committed_on) %><%= h truncate(changeset.author.to_s, :length => 30) %><%= textilizable(truncate_at_line_break(changeset.comments)) %>
                            +

                            <%= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %> -

                            - +

                            <% end %> diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 1cb5942bf..a128f917a 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -5,9 +5,8 @@
                            <%= render :partial => 'breadcrumbs', - :locals => {:path => @path, :kind => 'dir', :revision => @rev} %> + :locals => {:path => @path, :kind => 'dir', :revision => @rev} %> <%= render :partial => 'navigation' %> -
                            @@ -25,8 +24,8 @@ link_to h(repo.name), {:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil}, - :class => 'repository' + (repo == @repository ? ' selected' : ''), - :class => "mb10 break_word c_orange" }.join(' | ').html_safe %>) + :class => 'repository' + (repo == @repository ? ' selected' : ''), + :class => "mb10 break_word c_orange" }.join(' | ').html_safe %>)

    @@ -36,7 +35,7 @@

    项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码。

    通过cmd命令提示符进入代码对应文件夹的根目录,假设当前用户的登录名为user,版本库名称为demo,需要操作的版本库分支为branch。 - 如果是首次提交代码,执行如下命令:

    + 如果是首次提交代码,执行如下命令:

    git init

    @@ -53,7 +52,7 @@

    git push -u origin branch:branch

    - +

    已经有本地库,还没有配置远程地址,打开命令行执行如下:

    @@ -68,7 +67,7 @@

    git push -u origin branch:branch

    - +

    已有远程地址,创建一个远程分支,并切换到该分支,打开命令行执行如下:

    @@ -81,7 +80,7 @@

    git push origin branch_name

    - +

    从网上获取别人的开源版本库,转交到trustie网站上,打开命令行执行如下:

    @@ -101,56 +100,59 @@

    李海提供

    - <% if !@entries.nil? && authorize_for('repositories', 'browse') %> - <%= render :partial => 'dir_list' %> - <% end %> - - <%= render_properties(@properties) %> - <% if authorize_for('repositories', 'revisions') %> - <% if @changesets && !@changesets.empty? %> -

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

    - <%= render :partial => 'revisions', - :locals => {:project => @project, :path => @path, - :revisions => @changesets, :entry => nil} %> + +<% if !@entries.nil? && authorize_for('repositories', 'browse') %> + <%= render :partial => 'dir_list' %> +<% end %> +<%= render_properties(@properties) %> + + +<% if authorize_for('repositories', 'revisions') %> + <%# if @changesets && !@changesets.empty? %> +

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

    + <%= render :partial => 'revisions', + :locals => {:project => @project, :path => @path, + :revisions => @changesets, :entry => nil} %> + <%# end %> + +

    + <% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0) + sep = '' %> + <% if @repository.supports_all_revisions? && @path.blank? %> + <%= link_to l(:label_view_all_revisions), {:action => 'revisions', :id => @project, + :repository_id => @repository.identifier_param}, + :class => "orange_u_btn" %> + <% sep = '|' %> <% end %> -

    - <% has_branches = (!@repository.branches.nil? && @repository.branches.length > 0) - sep = '' %> - <% if @repository.supports_all_revisions? && @path.blank? %> - <%= link_to l(:label_view_all_revisions), {:action => 'revisions', :id => @project, - :repository_id => @repository.identifier_param}, - :class => "orange_u_btn" %> - <% sep = '|' %> - <% end %> - <% if @repository.supports_directory_revisions? && (has_branches || !@path.blank? || !@rev.blank?) %> - <%= sep %> - <%= link_to l(:label_view_revisions), - {:action => 'changes', - :path => to_path_param(@path), - :id => @project, - :repository_id => @repository.identifier_param, - :rev => @rev}, - :class => "orange_u_btn" %> - <% end %> -

    - <% if @repository.supports_all_revisions? %> - <% content_for :header_tags do %> - <%= auto_discovery_link_tag( - :atom, params.merge( - {:format => 'atom', :action => 'revisions', - :id => @project, :page => nil, :key => User.current.rss_key})) %> - <% end %> + <% if @repository.supports_directory_revisions? && (has_branches || !@path.blank? || !@rev.blank?) %> + <%= sep %> + <%= link_to l(:label_view_revisions), + {:action => 'changes', + :path => to_path_param(@path), + :id => @project, + :repository_id => @repository.identifier_param, + :rev => @rev}, + :class => "orange_u_btn" %> <% end %> - <% end %> +

    + <% if @repository.supports_all_revisions? %> + <% content_for :header_tags do %> + <%= auto_discovery_link_tag( + :atom, params.merge( + {:format => 'atom', :action => 'revisions', + :id => @project, :page => nil, :key => User.current.rss_key})) %> + <% end %> + <% end %> +<% end %> - -

    查看如何提交代码: - <%= link_to(l(:label_how_commit_code_chinese), ch_usage_path, :class => "c_blue") %> - <%= link_to('English', en_usage_path, :class => "c_blue") %> + +

    查看如何提交代码: + <%= link_to(l(:label_how_commit_code_chinese), ch_usage_path, :class => "c_blue") %> + <%= link_to('English', en_usage_path, :class => "c_blue") %> -

    +
    <% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> From 482df88d70d3ff1f6fba15f17cc6d8b2fcce2829 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 12 Jun 2015 16:52:49 +0800 Subject: [PATCH 094/130] ... --- app/views/projects/_history.html.erb | 3 ++- app/views/users/_history.html.erb | 3 ++- app/views/words/_journal_reply_items.html.erb | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/projects/_history.html.erb b/app/views/projects/_history.html.erb index d85906a2c..54dda7b28 100644 --- a/app/views/projects/_history.html.erb +++ b/app/views/projects/_history.html.erb @@ -9,7 +9,8 @@ <%= link_to journal.user, user_path(journal.user), :class => 'c_blue fb fl mb10', :target => "_blank" %> <%= format_time(journal.created_on) %>
    -

    <%= textilizable journal.notes%>

    + +

    <%=journal.notes.html_safe%>

    <% ids = 'project_respond_form_'+ journal.id.to_s%> diff --git a/app/views/users/_history.html.erb b/app/views/users/_history.html.erb index 8902b7dfc..d69b6b25b 100644 --- a/app/views/users/_history.html.erb +++ b/app/views/users/_history.html.erb @@ -11,7 +11,8 @@ <%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%><%= format_time(journal.created_on) %>
    -

    <%= textilizable journal.notes%>

    + +

    <%=journal.notes.html_safe%>

    <% ids = 'project_respond_form_'+ journal.id.to_s%> diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index af8be7197..7c8dd7f64 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -22,7 +22,7 @@ <% end %>

    - <%= reply.notes %> + <%= reply.notes.html_safe %>

    <%= format_time reply.created_on %> From 2a2b93c97df190329af0e710ab0f3dea2d59d304 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 12 Jun 2015 16:58:43 +0800 Subject: [PATCH 095/130] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=A4=9A=E8=A1=8C=E4=B8=BB=E8=A7=82=E7=9A=84?= =?UTF-8?q?=E7=AD=94=E6=A1=88=E6=9C=89html=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 73650a782..a222314ab 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -464,7 +464,7 @@ class PollController < ApplicationController sheet1[count_row + 1,0] = l(:label_poll_subtotal) sheet1[count_row + 2,0] = l(:label_poll_proportion) poll_question.poll_answers.each_with_index do |poll_answer,i| - sheet1[count_row, i + 1] = poll_answer.answer_text + sheet1[count_row, i + 1] = poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/ /," ") sheet1[count_row + 1, i + 1] = poll_answer.poll_votes.count sheet1[count_row + 2, i + 1] = statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)).to_s + "%" end @@ -477,7 +477,7 @@ class PollController < ApplicationController sheet1[count_row,1] = poll_question.question_title count_row += 1 poll_question.poll_votes.each do |poll_vote| - sheet1[count_row,0] = poll_vote.vote_text + sheet1[count_row,0] = poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/ /," ") count_row += 1 end count_row += 1 From cd7bb85f2f777807576a1e6d4035080625aad22e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 12 Jun 2015 17:25:39 +0800 Subject: [PATCH 096/130] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=A4=9A=E4=BA=86=E4=B8=80=E4=B8=AAc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/stores/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb index 84116a561..6fab364b5 100644 --- a/app/views/stores/index.html.erb +++ b/app/views/stores/index.html.erb @@ -35,7 +35,7 @@ <%= c1.downloads %>
    - <%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%>c + <%= link_to_attachment c1, {:download => true, :text => image_tag("/images/button/download.png", width: "22px", alt: l(:button_download)) }%>
    <% end -%> From 5d88de3e6e87de3ca659a405ffddb5ad6593def6 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 12 Jun 2015 17:26:36 +0800 Subject: [PATCH 097/130] =?UTF-8?q?=E8=A7=A3=E5=86=B3bug=EF=BC=9A=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E9=A1=B9=E7=9B=AE=E5=AF=B9=E9=BD=90=E5=8F=8A=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../applied_project/applied_join_project.js.erb | 1 + app/views/projects/_join_project.html.erb | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/views/applied_project/applied_join_project.js.erb b/app/views/applied_project/applied_join_project.js.erb index ab5cdd484..491b8aa0f 100644 --- a/app/views/applied_project/applied_join_project.js.erb +++ b/app/views/applied_project/applied_join_project.js.erb @@ -1,3 +1,4 @@ +// @status: 0 该项目不存在;1 不重复加入;2 成功加入; 3 已是项目成员;其它 加入失败 <% if @status == 0%> alert("<%= l('project.join.tips.notexist') %>"); <% elsif @status == 1%> diff --git a/app/views/projects/_join_project.html.erb b/app/views/projects/_join_project.html.erb index 1498830c5..53c149f82 100644 --- a/app/views/projects/_join_project.html.erb +++ b/app/views/projects/_join_project.html.erb @@ -21,7 +21,7 @@ .C_form{ margin:20px 0 0 60px;} .C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; padding-left: 60px;} .C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; } - .C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:150px;} + .C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:140px;} .width190{ width:190px; height:26px; border-color:#e1e1e1;} .C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;} .C_form a:hover{ text-decoration:underline;} @@ -52,25 +52,25 @@
    <%= form_tag({:controller => 'applied_project', - :action => 'applied_join_project'}, - :remote => true, - :method => :post, - :id => 'new-watcher-form') do %> + :action => 'applied_join_project'}, + :remote => true, + :method => :post, + :id => 'new-watcher-form') do %> From ab64b38cee7fdc03f13aaf0082f3dfee9eda7af7 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 12 Jun 2015 17:26:40 +0800 Subject: [PATCH 098/130] =?UTF-8?q?=E7=95=99=E8=A8=80=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=B9=8B=E5=90=8E=E6=B8=85=E9=99=A4=E7=BC=96=E8=BE=91=E6=A1=86?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_jours.html.erb | 4 ++++ app/views/words/_new.html.erb | 1 + app/views/words/create.js.erb | 3 +++ 3 files changed, 8 insertions(+) diff --git a/app/views/users/_user_jours.html.erb b/app/views/users/_user_jours.html.erb index 3d7496fb2..ee8d14841 100644 --- a/app/views/users/_user_jours.html.erb +++ b/app/views/users/_user_jours.html.erb @@ -213,9 +213,13 @@ params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form); params.contentmsg = $("p[nhname='contentmsg']",params.div_form); params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); + params.cancel_btn = $("#new_message_cancel_btn"); if(params.textarea.data('init') == undefined){ params.editor = init_editor(params); init_form(params); + params.cancel_btn.click(function(){ + nh_reset_form(params); + }); // $("a[nhname='cancel_btn']",params.div_form).click(function(){ // nh_reset_form(params); // }); diff --git a/app/views/words/_new.html.erb b/app/views/words/_new.html.erb index e81368c1f..0c624ce3d 100644 --- a/app/views/words/_new.html.erb +++ b/app/views/words/_new.html.erb @@ -57,6 +57,7 @@

    <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "enterprise" , :style => "display: block; float: right; margin-top: 5px;"%> + <%else %>
    <%= l(:label_user_login_tips) %> diff --git a/app/views/words/create.js.erb b/app/views/words/create.js.erb index 4bf7fb244..16f26d5f7 100644 --- a/app/views/words/create.js.erb +++ b/app/views/words/create.js.erb @@ -3,4 +3,7 @@ $('#history').html('<%= escape_javascript(render(:partial => 'users/history',:lo $('#jour_count').html('<%= @obj_count%>') $('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>'); $('#new_form_user_message').val(""); +if($('#new_message_cancel_btn') != undefined && $('#new_message_cancel_btn').length!=0){ + $('#new_message_cancel_btn').click(); +} $('#new_form_reference_user_id').val(""); \ No newline at end of file From d9157965e9625c6075beed094b0008bfa584d8d8 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 12 Jun 2015 17:49:06 +0800 Subject: [PATCH 099/130] ... --- app/views/layouts/base_projects.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index faf73918d..044714a34 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -107,7 +107,7 @@