From bd4ea6a19902b9b248d235247333263cecbf08b8 Mon Sep 17 00:00:00 2001 From: "Gan Yi.ang" Date: Thu, 26 Nov 2015 09:13:41 +0800 Subject: [PATCH 01/57] just test tag1 --- tag1.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 tag1.txt diff --git a/tag1.txt b/tag1.txt new file mode 100644 index 000000000..391fb7fb3 --- /dev/null +++ b/tag1.txt @@ -0,0 +1 @@ +just test \ No newline at end of file From 580cc6b8d8160b969103859078617139de5075b1 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 27 Nov 2015 16:14:42 +0800 Subject: [PATCH 02/57] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/schema.rb b/db/schema.rb index 8e2082b37..504052365 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1151,6 +1151,7 @@ ActiveRecord::Schema.define(:version => 20151127011351) do create_table "org_members", :force => true do |t| t.integer "user_id" t.integer "organization_id" + t.string "role" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end From 3516cde5553c138c43f5e376e6f3f0602eaf1404 Mon Sep 17 00:00:00 2001 From: "Gan Yi.ang" Date: Sat, 28 Nov 2015 10:25:53 +0800 Subject: [PATCH 03/57] =?UTF-8?q?sync=5Fgitlab=5Fuser=E5=8A=A0=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_gitlab_user.rake | 39 ++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/lib/tasks/sync_gitlab_user.rake b/lib/tasks/sync_gitlab_user.rake index fb84f5f08..9259353c0 100644 --- a/lib/tasks/sync_gitlab_user.rake +++ b/lib/tasks/sync_gitlab_user.rake @@ -6,32 +6,55 @@ namespace :gitlab do users = User.find_by_sql("select * from users where gid is null") s = Trustie::Gitlab::Sync.new g = Gitlab.client - logger = Logger.new('./log/add_gid.log', 'daily') #按天生成 + logger_i = Logger.new('./log/task_add_gid.log', 'daily') + logger_e = Logger.new('./log/task_add_gid_error.log', 'daily') + NAMESPACE_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])'.freeze + MAIL_REGEX_STR ='^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$'.freeze + error_cnt=0 + success_cnt=0 + p "同步Gitlab用户开始..." users.each do |user| + info="userid=#{user.id},mail=#{user.mail},login(username)=#{user.login},name=#{user.show_name}" + # username不能有特殊字符,不能有保留字符,邮箱特殊字符(比如‘>’)导致search失败的,name不能为空串 + if !(user.login =~ /\A#{NAMESPACE_REGEX_STR}\Z/.freeze) + logger_e.error("#{info},error=校验失败:username特殊字符") + error_cnt+=1 + next + elsif !(user.mail.downcase =~ /#{MAIL_REGEX_STR}/) + logger_e.error("#{info},error=校验失败:邮箱特殊字符") + error_cnt+=1 + next + elsif user.show_name.lstrip.rstrip.blank? + logger_e.error("#{info},error=校验失败:name不正常") + error_cnt+=1 + next + end begin us = g.get("/users?search=#{user.mail}") - puts user.mail if us.blank? - puts "55555555555555555" s.sync_user(user) + logger_i.info("sync_remote_user:id=#{user.id},mail=#{user.mail}") + success_cnt+=1 else - # 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com - puts "66666666666666666666" - puts user.id if Array === us us.each do |u| if u.email == user.mail user.gid = u.id - user.save + # !爆炸方法抛出异常 + user.save! + logger_i.info("sync_local_user:#{info}") + success_cnt+=1 end end end end rescue => e - logger.error("userid=#{user.id},mail=#{user.mail},login=#{user.login},error=#{e}") + logger_e.error("#{info},error=#{e}") puts e end end + p "同步Gitlab用户结束..." + p "同步成功#{success_cnt},未完成#{error_cnt}" end task :sync_members => :environment do From b91c65798d5a576e3e89fe0b20cdd75324be7d12 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 3 Dec 2015 20:44:29 +0800 Subject: [PATCH 04/57] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=88=90=E5=91=98?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/member.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index ce336373b..08cf27f17 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,5 +1,8 @@
-

<%= @subPage_title%>

+

<%= @subPage_title%>

+
+ <%= link_to "修改角色", url_for(:controller => 'courses', :action => 'settings', :id => @course.id) %> +
<% if @subPage_title == l(:label_student_list)%> <%= render :partial => 'course_student', :locals => {:members => @members} %> From 8d891a9faa93c5ccbdd04e7773e7560cb93b9dd6 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 3 Dec 2015 20:57:09 +0800 Subject: [PATCH 05/57] =?UTF-8?q?fork=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 9601e5188..7cd93f5b0 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -25,7 +25,10 @@ -
Fork 0
+ <%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %> + <% if User.current.id != @project.user_id || User.current.projects.count !=0 %> +
Fork 0
+ <% end %>
<% if @changesets && !@changesets.empty? %> From 057d9a33371de1decdf7edf48d4beb869d652969 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 00:15:47 +0800 Subject: [PATCH 06/57] 0 --- app/controllers/courses_controller.rb | 76 +++++++++++++-------------- app/views/courses/settings.html.erb | 24 ++++----- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index cd1de16fc..6c275850b 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -55,11 +55,11 @@ class CoursesController < ApplicationController def join if User.current.logged? - cs = CoursesService.new - @user = User.current - join = cs.join_course params,@user - @state = join[:state] - @course = join[:course] + cs = CoursesService.new + @user = User.current + join = cs.join_course params,@user + @state = join[:state] + @course = join[:course] # else # @course = Course.find_by_id params[:object_id] # CourseMessage.create(:user_id => @course.tea_id, :course_id => @course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest') @@ -70,7 +70,7 @@ class CoursesController < ApplicationController end @object_id = params[:object_id] respond_to do |format| - format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} } + format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} } end end @@ -85,7 +85,7 @@ class CoursesController < ApplicationController end end - + def join_private_courses respond_to do |format| format.js @@ -98,14 +98,14 @@ class CoursesController < ApplicationController c = cs.edit_course params,@course,User.current @course = c[:course] if @course.errors.full_messages.count <= 0 - respond_to do |format| - format.html { - # render :layout => 'base_courses' - flash[:notice] = l(:notice_successful_update) - redirect_to settings_course_url(@course) - } - format.api { render_api_ok } - end + respond_to do |format| + format.html { + # render :layout => 'base_courses' + flash[:notice] = l(:notice_successful_update) + redirect_to settings_course_url(@course) + } + format.api { render_api_ok } + end else respond_to do |format| format.html { @@ -134,8 +134,8 @@ class CoursesController < ApplicationController courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'").order("time desc, created_at desc") @courses = paginateHelper courses,10 end - @name = params[:name] - @type = 'courses' + @name = params[:name] + @type = 'courses' respond_to do |format| format.html { render :layout => 'course_base' @@ -277,7 +277,7 @@ class CoursesController < ApplicationController def member ## 有角色参数的才是课程,没有的就是项目 if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) - + @render_file = 'new_member_list' @score_sort_by = "desc" @canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1' @@ -312,7 +312,7 @@ class CoursesController < ApplicationController def export_course_member_excel @all_members = student_homework_score(0,0,0,"desc") filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}"; - + respond_to do |format| format.xls { send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", @@ -426,7 +426,7 @@ class CoursesController < ApplicationController end def course - @school_id = params[:school_id] + @school_id = params[:school_id] per_page_option = 10 if @school_id == "0" or @school_id.nil? @courses_all = Course.active.visible. @@ -514,8 +514,8 @@ class CoursesController < ApplicationController def index if !User.current.admin? - render_404 - return + render_404 + return end @course_type = params[:course_type] @school_id = params[:school_id] @@ -564,7 +564,7 @@ class CoursesController < ApplicationController respond_to do |format| format.html { - render :layout => 'base' + render :layout => 'base' } format.atom { courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all @@ -683,10 +683,10 @@ class CoursesController < ApplicationController end def feedback - @course.journals_for_messages.each do |messages| - query = messages.course_messages.where("user_id = ?", User.current.id) - query.update_all(:viewed => true); - end + @course.journals_for_messages.each do |messages| + query = messages.course_messages.where("user_id = ?", User.current.id) + query.update_all(:viewed => true); + end if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) page = params[:page] @@ -737,20 +737,20 @@ class CoursesController < ApplicationController #从课程创建的老师那里选择课程大纲 def course_outline - @teacher = User.find(@course.tea_id) - @blog_articles = @teacher.blog.articles - @is_in_show_outline_page = params[:is_in_show_outline_page] - respond_to do |format| - format.js - end + @teacher = User.find(@course.tea_id) + @blog_articles = @teacher.blog.articles + @is_in_show_outline_page = params[:is_in_show_outline_page] + respond_to do |format| + format.js + end end #根据关键字搜索,查找方法一样的,但返回内容不一样 def search_course_outline - @article_title = params[:title] - @teacher = User.find(@course.tea_id) - @blog_articles = @teacher.blog.articles.like(@article_title) - render :json=>@blog_articles.to_json + @article_title = params[:title] + @teacher = User.find(@course.tea_id) + @blog_articles = @teacher.blog.articles.like(@article_title) + render :json=>@blog_articles.to_json end #设置或者更改课程的大纲 @@ -796,7 +796,7 @@ class CoursesController < ApplicationController def can_show_course @first_page = FirstPage.find_by_page_type('project') if @first_page.try(:show_course) == 2 - render_404 + render_404 end end diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 5c3918f00..ce56537c1 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -107,15 +107,15 @@
+ function select() { + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/term_select') %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); + } + $("#time_selected").click(select); + $("#term_selected").click(select); + From 76db95aa0339b85ad7fd168e9d89c45ed3996162 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 7 Dec 2015 15:52:13 +0800 Subject: [PATCH 07/57] =?UTF-8?q?1.=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E9=80=80=E5=87=BA=E5=90=8E=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2=EF=BC=9B=202.=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E9=A1=B5=E9=9D=A2=E4=B8=AD=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E2=80=9C=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=E2=80=9D=EF=BC=8C?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=96=B0=E7=9A=84=E9=A1=B5=E9=9D=A2=EF=BC=9B?= =?UTF-8?q?=203.=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2=E9=A1=B5=E9=A6=96?= =?UTF-8?q?=E9=83=A8=E5=88=86=EF=BC=8C=E7=94=A8=E6=88=B7=E5=90=8D=E4=B8=8D?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E7=94=A8=E6=88=B7=E9=A1=B5=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 7 +++++++ app/views/layouts/base_org.html.erb | 7 ++++--- config/routes.rb | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 85f57917b..d182640ed 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -239,6 +239,13 @@ class OrganizationsController < ApplicationController end end + def logout + logout_user + respond_to do |format| + format.html {redirect_to organization_path(params[:id])} + end + end + def search_projects @organization = Organization.find(params[:id]) condition = '%%' diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 5af5c9ad0..4c33dcca5 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -46,12 +46,13 @@ - + <% else %> diff --git a/config/routes.rb b/config/routes.rb index 4e64ca505..15e41955d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -46,6 +46,7 @@ RedmineApp::Application.routes.draw do get 'search_projects' post 'join_project_menu' post 'join_projects' + post 'logout' end collection do get 'check_uniq' From 91fa3f6fab2c9f9c183e0c0a5c8add562a4daad8 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 7 Dec 2015 16:52:23 +0800 Subject: [PATCH 08/57] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 1d68c9fa0..9e9bd688f 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -12,7 +12,7 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'public', 'pleft', 'project','courses','prettify','jquery/jquery-ui-1.9.2','header','repository' %> + <%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header','repository' %> <%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %> <%= call_hook :view_layouts_base_html_head %> From a8b7d1b81f427b91c90ea0ac7d6843ace32712ea Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 7 Dec 2015 17:11:30 +0800 Subject: [PATCH 09/57] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E9=87=8C=E7=9A=84message,=E4=B8=8D=E5=A2=9E=E5=8A=A0=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=8A=A8=E6=80=81=E5=8F=8A=E7=BB=84=E7=BB=87=E5=8A=A8?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/forge_activity.rb | 26 +++++++++++++++----------- app/models/message.rb | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb index 115575289..c98c5475b 100644 --- a/app/models/forge_activity.rb +++ b/app/models/forge_activity.rb @@ -46,20 +46,24 @@ class ForgeActivity < ActiveRecord::Base end def add_org_activity - if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil? - org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first - if org_activity + org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first + if org_activity + org_activity.created_at = self.created_at + org_activity.save + else + if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil? + org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first org_activity.created_at = self.created_at org_activity.save + else + OrgActivity.create(:user_id => self.user_id, + :org_act_id => self.forge_act_id, + :org_act_type => self.forge_act_type, + :container_id => self.project_id, + :container_type => 'Project', + :created_at => self.created_at, + :updated_at => self.updated_at) end - else - OrgActivity.create(:user_id => self.user_id, - :org_act_id => self.forge_act_id, - :org_act_type => self.forge_act_type, - :container_id => self.project_id, - :container_type => 'Project', - :created_at => self.created_at, - :updated_at => self.updated_at) end end diff --git a/app/models/message.rb b/app/models/message.rb index 92ec0235e..d8f62171a 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -186,7 +186,7 @@ class Message < ActiveRecord::Base # Description def act_as_forge_activity # 如果project为空,那么就是课程相关的消息 - if !self.board.project.nil? + if !self.board.project.nil? && self.parent_id.nil? self.forge_acts << ForgeActivity.new(:user_id => self.author_id, :project_id => self.board.project.id) end From 5f6d9f2425796d6afc10943595aa9cd98d4d6a85 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 7 Dec 2015 17:14:13 +0800 Subject: [PATCH 10/57] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=96=B0=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/project.css | 109 +++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 3dedf1396..54dbe81a7 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -907,3 +907,112 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} border: 1px solid #e4e4e4; } +/*项目动态新样式*/ +.homepageRight { + width: 750px; + float: left; + margin-top: 15px; + margin-bottom: 10px; +} +.homepageRightBanner { + width: 718px; + margin: 0px auto; + float: right; + background-color: #FFF; + padding: 10px 15px; + border: 1px solid #DDD; +} +.resources { + width: 718px; + background-color: #FFF; + padding: 15px; + border: 1px solid #DDD; + float: right; +} +.homepagePostBrief { + width: 720px; + margin: 0px auto; + position: relative; +} +.homepagePostPortrait { + float: left; + width: 50px; +} +.homepagePostDes { + float: left; + width: 655px; + margin-left: 15px; +} +.homepagePostTo { + font-size: 14px; + color: #484848; + margin-bottom: 5px; +} +.m_w600 { + max-width: 600px; +} +.hidden { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} +.homepagePostTitle { + font-size: 14px; + color: #484848; + margin-bottom: 5px; + font-weight: bold; +} +.maxh360 { + max-height: 360px; +} +.lh18 { + line-height: 18px; +} +.homepagePostIntro { + font-size: 14px; + color: #484848; + overflow: hidden; +} +.homepagePostReply { + width: 710px; + margin: 10px auto 0px; + background-color: #F1F1F1; +} +.topBorder { + border-top: 1px solid #E4E4E4; +} +.homepagePostReplyBanner { + width: 708px; + height: 33px; + border: 1px solid #E4E4E4; + line-height: 33px; + vertical-align: middle; + font-size: 12px; + color: #888; +} +.homepagePostReplyBannerCount { + width: 255px; + display: inline-block; + margin-left: 15px; +} +.homepagePostReplyBannerTime { + width: 85px; + display: inline-block; +} +.homepagePostReplyContainer { + border-bottom: 1px solid #E3E3E3; + width: 680px; + margin: 15px auto 0px; + min-height: 60px; +} +.borderBottomNone { + border-bottom: medium none !important; +} +.homepagePostReplyPortrait { + float: left; + width: 33px; +} +.homepagePostReplyInputContainer { + width: 630px; + float: left; +} \ No newline at end of file From 9d6b4783df41c2088176fda622b4e92a5887b1c1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 7 Dec 2015 17:18:46 +0800 Subject: [PATCH 11/57] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=A0=8F=E7=9B=AE=E7=9A=84=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_subfield_list.html.erb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index a0f6dc60f..6ba60245a 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -4,11 +4,6 @@
  • 状态
  • -
      -
    • 组织首页
    • -
    • 默认
    • -
      -
    • 动态
    • 默认
    • From 3459164e647924e8b8bd5ef36c02a4745b354768 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 7 Dec 2015 17:25:32 +0800 Subject: [PATCH 12/57] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/project.css | 50 +++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 54dbe81a7..32ee5a7c6 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1015,4 +1015,52 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} .homepagePostReplyInputContainer { width: 630px; float: left; -} \ No newline at end of file +} +.homepagePostType { + width: 90px; + background-color: #FFF; + float: left; + list-style: outside none none; + position: absolute; + border: 1px solid #EAEAEA; + border-radius: 5px; + top: 15px; + padding: 5px 10px; + left: -80px; + font-size: 12px; + color: #4B4B4B; + line-height: 2; + z-index: 9999; + display: none; +} +.homepagePostTypeHomework { + width: 90px; +} +a.homepagePostTypeAll { + background: transparent url("../images/homepage_icon.png") no-repeat scroll -189px -308px; + padding-left: 23px; +} +a.homepagePostTypeAssignment { + background: transparent url("../images/homepage_icon.png") no-repeat scroll -93px -318px; + padding-left: 23px; +} +a.homepagePostTypeNotice { + background: transparent url("../images/homepage_icon.png") no-repeat scroll -87px -280px; + padding-left: 23px; +} +a.homepagePostTypeResource { + background: transparent url("images/homepage_icon.png") no-repeat scroll -86px -517px; + padding-left: 23px; +} +a.homepagePostTypeForum { + background: transparent url("../images/homepage_icon.png") no-repeat scroll -10px -310px; + padding-left: 23px; +} +a.homepagePostTypeMessage { + background: transparent url("images/homepage_icon.png") no-repeat scroll -3px -518px; + padding-left: 23px; +} +a.homepagePostTypeQuiz { + background: transparent url("../images/homepage_icon.png") no-repeat scroll -90px -124px; + padding-left: 23px; + } \ No newline at end of file From 7c34122ff6ef4ccf001d273b63055f52d2bce3b4 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 8 Dec 2015 09:46:29 +0800 Subject: [PATCH 13/57] =?UTF-8?q?fork=E7=9A=84=E6=97=B6=E5=80=99=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E7=94=A8=E6=88=B7=E6=B2=A1=E6=9C=89=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E8=87=AA=E5=8A=A8=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 3 +++ app/views/repositories/show.html.erb | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index ca07dccdc..7c12ff8ab 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -75,6 +75,9 @@ class RepositoriesController < ApplicationController redirect_to repository_url(@repository) else g = Gitlab.client + if User.current.gid.nil? + g.sync_user(User.current) + end gproject = g.fork(@project.gpid, User.current.gid) if gproject copy_project(@project, gproject) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 00d79cd54..9464cc97b 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -25,14 +25,12 @@ -<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %> - <% if User.current.id != @project.user_id || User.current.projects.count !=0 %> - <% unless User.current.id == @project.user_id %> + <%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %> + <% if User.current.id != @project.user_id %>
      <%= link_to "".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn"%> <%= @project.forked_count.to_i %>
      <% end %> - <% end %>
      <% if @changesets && !@changesets.empty? %> From 42f5b86d95dd0f2cdc6d72e9fb4d637990dcb159 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 8 Dec 2015 10:32:10 +0800 Subject: [PATCH 14/57] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 3 ++- db/migrate/20151208015409_add_is_delete_to_courses.rb | 5 +++++ db/schema.rb | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20151208015409_add_is_delete_to_courses.rb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 8e61ad525..ffe22a29d 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -771,8 +771,9 @@ class CoursesController < ApplicationController format.html {render :layout => 'base_courses'} end end + #删除课程 - #删除课程只是将课程的is_delete状态改为false,is_delete为false状态的课程只有管理员可以看到 + #删除课程只是将课程的is_deleted状态改为false,is_deleted为false状态的课程只有管理员可以看到 def destroy end diff --git a/db/migrate/20151208015409_add_is_delete_to_courses.rb b/db/migrate/20151208015409_add_is_delete_to_courses.rb new file mode 100644 index 000000000..d974fb4d9 --- /dev/null +++ b/db/migrate/20151208015409_add_is_delete_to_courses.rb @@ -0,0 +1,5 @@ +class AddIsDeleteToCourses < ActiveRecord::Migration + def change + add_column :courses, :is_delete, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 125d7495f..5b58e3385 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 => 20151204062220) do +ActiveRecord::Schema.define(:version => 20151208015409) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -459,6 +459,7 @@ ActiveRecord::Schema.define(:version => 20151204062220) do t.integer "open_student", :default => 0 t.integer "outline", :default => 0 t.integer "publish_resource", :default => 0 + t.integer "is_delete" end create_table "custom_fields", :force => true do |t| @@ -1160,7 +1161,6 @@ ActiveRecord::Schema.define(:version => 20151204062220) do create_table "org_members", :force => true do |t| t.integer "user_id" t.integer "organization_id" - t.string "role" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end From bb7bcf46a9771ee1f7f0cbbc4239d67220c1d50f Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 8 Dec 2015 15:30:58 +0800 Subject: [PATCH 15/57] =?UTF-8?q?1.=E8=AE=BE=E7=BD=AE=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E8=B7=B3=E8=BD=AC=E8=87=B3=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_show_org_document.html.erb | 2 +- app/views/organizations/set_homepage.js.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 7588c7f6f..f2c635e90 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -27,7 +27,7 @@
      • - <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => document.organization_id, :home_id => document.id}, :method => "put", :remote => true) do |f| %> + <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => document.organization_id, :home_id => document.id, :show_homepage => 1}, :method => "put", :remote => true) do |f| %> 设为首页 <% end %>
      • diff --git a/app/views/organizations/set_homepage.js.erb b/app/views/organizations/set_homepage.js.erb index b25c4c4d4..5b56d57b3 100644 --- a/app/views/organizations/set_homepage.js.erb +++ b/app/views/organizations/set_homepage.js.erb @@ -1,2 +1,2 @@ //location.reload(); -window.location.href ='<%= organization_path(@org)%>' \ No newline at end of file +window.location.href ='<%= organization_path(@org, :show_homepage => params[:show_homepage])%>'; \ No newline at end of file From 56cb83ffba1a1d24c5dac8ac2d86ea64e3f126cc Mon Sep 17 00:00:00 2001 From: houxiang Date: Tue, 8 Dec 2015 15:56:31 +0800 Subject: [PATCH 16/57] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E6=B2=A1=E6=9C=89=E7=BB=9F=E8=AE=A1commit=5Fcount?= =?UTF-8?q?=EF=BC=8C=E5=85=B7=E4=BD=93=E7=9A=84=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E5=9C=A8=E5=BC=80=E5=A7=8B=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 42 +++++++++++--------- app/views/repositories/show.html.erb | 3 +- db/schema.rb | 45 +++++++++------------- 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index c1e124063..dd3f4ede9 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -347,27 +347,13 @@ update # end - #add by hx - if g.commits(@project.gpid , :page=>25).count==0 - count = count_commits(@project.gpid , 0 , 25) - elsif g.commits(@project.gpid , :page=>50).count ==0 - count = count_commits(@project.gpid , 25 , 50)+ 25 * 20 - elsif g.commits(@project.gpid , :page=>75).count ==0 - count = count_commits(@project.gpid , 50 , 75)+ 50 * 20 - elsif g.commits(@project.gpid , :page=>100).count== 0 - count = count_commits(@project.gpid , 75 , 100) + 75 * 20 - elsif g.commits(@project.gpid , :page=>125).count==0 - count = count_commits(@project.gpid , 100 , 125) + 100 * 20 - elsif g.commits(@project.gpid , :page=>150).count==0 - count = count_commits(@project.gpid , 125 , 150) + 125 * 20 - else - count = count_commits(@project.gpid , 150 ,200) + 150 * 20 - end + + @changesets = g.commits(@project.gpid) # @changesets = @repository.latest_changesets(@path, @rev) # @changesets_count = @repository.latest_changesets(@path, @rev).count - @changesets_all_count = count + @changesets_all_count = 0 @changesets_latest_coimmit = @changesets[0] @properties = @repository.properties(@path, @rev) @repositories = @project.repositories @@ -410,8 +396,28 @@ update limit = 20 #每次页面的换回值从1开始,但是gitlab的页面查询是从0开始,所以先改变page的类型减一在改回来 @commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s) + + #add by hx + if g.commits(@project.gpid , :page=>200).count > 0 + count = 4020 + elsif g.commits(@project.gpid , :page=>25).count==0 + count = count_commits(@project.gpid , 0 , 25) + elsif g.commits(@project.gpid , :page=>50).count ==0 + count = count_commits(@project.gpid , 25 , 50)+ 25 * 20 + elsif g.commits(@project.gpid , :page=>75).count ==0 + count = count_commits(@project.gpid , 50 , 75)+ 50 * 20 + elsif g.commits(@project.gpid , :page=>100).count== 0 + count = count_commits(@project.gpid , 75 , 100) + 75 * 20 + elsif g.commits(@project.gpid , :page=>125).count==0 + count = count_commits(@project.gpid , 100 , 125) + 100 * 20 + elsif g.commits(@project.gpid , :page=>150).count==0 + count = count_commits(@project.gpid , 125 , 150) + 125 * 20 + else + count = count_commits(@project.gpid , 150 ,200) + 150 * 20 + end + #页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化 - @commits_count = params[:commit_count].to_i + @commits_count = count @commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page] @commit = g.commit(@project.gpid,@rev) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index ca62b9664..ee6d23bf7 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -52,7 +52,8 @@ - <%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %> 提交 + + <%=link_to"全部提交次数", {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %>
    • diff --git a/db/schema.rb b/db/schema.rb index 6cc6b90c4..96dcae227 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -543,23 +543,26 @@ ActiveRecord::Schema.define(:version => 20151204062220) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :force => true do |t| - t.string "IPLineCode" - t.string "Description" - t.string "Num" - t.string "Variable" - t.string "TraceInfo" - t.string "Method" + create_table "dts", :primary_key => "Num", :force => true do |t| + t.string "Defect", :limit => 50 + t.string "Category", :limit => 50 t.string "File" - t.string "IPLine" - t.string "Review" - t.string "Category" - t.string "Defect" - t.string "PreConditions" - t.string "StartLine" + t.string "Method" + t.string "Module", :limit => 20 + t.string "Variable", :limit => 50 + t.integer "StartLine" + t.integer "IPLine" + t.string "IPLineCode", :limit => 200 + t.string "Judge", :limit => 15 + t.integer "Review", :limit => 1 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false end create_table "enabled_modules", :force => true do |t| @@ -891,16 +894,6 @@ ActiveRecord::Schema.define(:version => 20151204062220) 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" @@ -970,7 +963,6 @@ ActiveRecord::Schema.define(:version => 20151204062220) do t.integer "course_group_id", :default => 0 end - add_index "members", ["course_id"], :name => "index_members_on_course_id" add_index "members", ["project_id"], :name => "index_members_on_project_id" add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true add_index "members", ["user_id"], :name => "index_members_on_user_id" @@ -1519,6 +1511,7 @@ ActiveRecord::Schema.define(:version => 20151204062220) do end add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" + add_index "student_works", ["homework_common_id"], :name => "index" create_table "student_works_evaluation_distributions", :force => true do |t| t.integer "student_work_id" From 916d99be82516cc1aaa86c59f281457fa4a9ca84 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 8 Dec 2015 16:45:26 +0800 Subject: [PATCH 17/57] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 11 +++++++++++ app/models/course.rb | 7 ++++--- app/views/admin/courses.html.erb | 3 +++ db/migrate/20151208015409_add_is_delete_to_courses.rb | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index ffe22a29d..5109e15f4 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -775,7 +775,18 @@ class CoursesController < ApplicationController #删除课程 #删除课程只是将课程的is_deleted状态改为false,is_deleted为false状态的课程只有管理员可以看到 def destroy + @course.update_attributes(:is_delete => true) + @course = nil + redirect_to user_url(User.current) + end + # 恢复已删除的课程 + def recovery + if User.current.admin? + @course.update_attributes(:is_delete => false) + else + return 403 + end end private diff --git a/app/models/course.rb b/app/models/course.rb index 1c1bedb3b..cef05de73 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -20,7 +20,7 @@ class Course < ActiveRecord::Base end end - attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name + attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete #belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表 @@ -86,7 +86,8 @@ class Course < ActiveRecord::Base 'is_public', 'description', 'class_period', - 'open_student' + 'open_student', + 'is_delete' acts_as_customizable @@ -94,7 +95,7 @@ class Course < ActiveRecord::Base scope :active, lambda { where(:status => STATUS_ACTIVE) } scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) } scope :all_public, lambda { where(:is_public => true) } - scope :visible, lambda {|*args| where(Course.visible_condition(args.shift || User.current, *args)) } + scope :visible, lambda {|*args| where(Course.where("is_delete =?", 0).visible_condition(args.shift || User.current, *args)) } scope :allowed_to, lambda {|*args| user = User.current permission = nil diff --git a/app/views/admin/courses.html.erb b/app/views/admin/courses.html.erb index 1615bccbc..0bd4fb509 100644 --- a/app/views/admin/courses.html.erb +++ b/app/views/admin/courses.html.erb @@ -67,6 +67,9 @@ <%= format_date(course.created_at) %> + + <%= link_to(l(:button_delete), course_path(course), :method => :delete, :class => 'icon icon-del', :onClick=>"delcfm()" ) %> + <% end %> diff --git a/db/migrate/20151208015409_add_is_delete_to_courses.rb b/db/migrate/20151208015409_add_is_delete_to_courses.rb index d974fb4d9..cf037e010 100644 --- a/db/migrate/20151208015409_add_is_delete_to_courses.rb +++ b/db/migrate/20151208015409_add_is_delete_to_courses.rb @@ -1,5 +1,5 @@ class AddIsDeleteToCourses < ActiveRecord::Migration def change - add_column :courses, :is_delete, :integer + add_column :courses, :is_delete, :integer, :default => 0 end end From 09f0d0201eb731462daca693fa28eef04abf503d Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 9 Dec 2015 09:23:22 +0800 Subject: [PATCH 18/57] =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E5=8F=91=E5=B8=96=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org_document_comments_controller.rb | 9 +++- app/models/org_subfield.rb | 1 + app/views/org_document_comments/new.html.erb | 45 +++++++++++++------ .../_org_left_subfield_list.html.erb | 2 +- .../organizations/_show_org_document.html.erb | 2 +- ...20151208073241_add_subfield_to_document.rb | 5 +++ 6 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 db/migrate/20151208073241_add_subfield_to_document.rb diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index 29b728268..e9f3d47fb 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -11,10 +11,17 @@ class OrgDocumentCommentsController < ApplicationController @org_document_comment = OrgDocumentComment.new(:organization_id => @organization.id, :creator_id => User.current.id) @org_document_comment.title = params[:org_document_comment][:title] @org_document_comment.content = params[:org_document_comment][:content] + if params[:field_id] + @org_document_comment.org_subfield_id = params[:field_id].to_i + end if @org_document_comment.save flash.keep[:notice] = l(:notice_successful_create) EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document_comment.id, :created_at => @org_document_comment.updated_at) - redirect_to organization_org_document_comments_path(@organization) + if params[:field_id] + redirect_to organization_path(@organization) + else + redirect_to organization_org_document_comments_path(@organization) + end else redirect_to new_org_document_comment_path(:organization_id => @organization.id) end diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index 1660310f8..087120b69 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -1,3 +1,4 @@ class OrgSubfield < ActiveRecord::Base belongs_to :organization, :foreign_key => :organization_id + has_many :org_document_comments end \ No newline at end of file diff --git a/app/views/org_document_comments/new.html.erb b/app/views/org_document_comments/new.html.erb index 11a7e9359..9150be608 100644 --- a/app/views/org_document_comments/new.html.erb +++ b/app/views/org_document_comments/new.html.erb @@ -1,24 +1,41 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%> -<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %> +<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %>
      -
    保存 <% end %> +<% if User.current.member_of?(@project) && Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") %> +
    + + <%= link_to(l(:button_delete_project), { :controller => 'projects', :action => 'archive', :id => @project, :status => params[:status], :type =>"project" }, + :data => {:confirm => l(:text_are_you_sure)}, :method => :post) unless @project.archived? %> + <%#=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %> + (友情提示:删除该项目后如果您想恢复该项目,请联系系统管理员!) +
    +<% end %>
    diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7ccbb8410..81b20a67e 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -921,6 +921,7 @@ zh: button_rollback: 恢复到这个版本 button_reply: 回复 button_archive: 存档 + button_delete_project: 删除项目 button_unarchive: 取消存档 button_reset: 重置 button_rename: 重命名/重定向 From fed989753a73e0dd91060ced4dfa9d2655fed5fe Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Dec 2015 13:46:23 +0800 Subject: [PATCH 42/57] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9E=97=E5=A4=84?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E4=B8=8D=E8=83=BD=E6=9F=A5=E7=9C=8B=E6=B6=88?= =?UTF-8?q?=E6=81=AF=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/views/users/_user_message_forge.html.erb | 4 +++- db/schema.rb | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 94890a368..4e42cd5ae 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -22,6 +22,7 @@ <% end %> <% if ma.forge_message_type == "JoinProject" %> + <% unless ma.project.nil? %> + <% end %> <% end %> - + <% if ma.forge_message_type == "RemoveFromProject" %>
    • diff --git a/db/schema.rb b/db/schema.rb index 9ce76c447..91a9fbb5d 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 => 20151210110210) do +ActiveRecord::Schema.define(:version => 20151209085942) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -459,7 +459,7 @@ ActiveRecord::Schema.define(:version => 20151210110210) do t.integer "open_student", :default => 0 t.integer "outline", :default => 0 t.integer "publish_resource", :default => 0 - t.integer "is_delete" + t.integer "is_delete", :default => 0 end create_table "custom_fields", :force => true do |t| @@ -970,7 +970,6 @@ ActiveRecord::Schema.define(:version => 20151210110210) do t.integer "course_group_id", :default => 0 end - add_index "members", ["course_id"], :name => "index_members_on_course_id" add_index "members", ["project_id"], :name => "index_members_on_project_id" add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true add_index "members", ["user_id"], :name => "index_members_on_user_id" From f2b8335912c918facd7e47bd11064a8dc704ab80 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Dec 2015 13:48:52 +0800 Subject: [PATCH 43/57] =?UTF-8?q?=E7=A7=BB=E5=87=BA=E6=88=90=E5=91=98?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=88=A0=E9=99=A4=E9=A1=B9=E7=9B=AE=E5=90=8E?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=85=B3=E8=81=94=E5=88=A0=E9=99=A4=E8=80=8C?= =?UTF-8?q?=E5=BC=95=E8=B5=B7=E7=9A=84400=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_forge.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 4e42cd5ae..967941a88 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -57,6 +57,7 @@ <% end %> <% if ma.forge_message_type == "RemoveFromProject" %> + <% unless ma.project.nil? %> + <% end %> <% end %> <% if ma.forge_message_type == "ProjectInvite" %> From c6470bc69b2b9abbb39b32bd4239fd7d24ad506c Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 15:31:15 +0800 Subject: [PATCH 44/57] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=88=86=E7=BB=84=E6=88=90=E5=91=98=E6=97=B6?= =?UTF-8?q?=E8=8B=A5=E6=9F=90=E4=B8=80=E4=B8=AA=E5=AD=A6=E7=94=9F=E5=B7=B2?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=88=B0=E5=85=B6=E4=BB=96=E5=88=86=E7=BB=84?= =?UTF-8?q?=E5=88=99=E4=B8=8D=E5=8F=AF=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 1 + app/views/student_work/search_course_students.js.erb | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index f79646ade..86e521b55 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -687,6 +687,7 @@ class StudentWorkController < ApplicationController end all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")" all_students = User.where("id in #{all_student_ids}") + @commit_student_ids = @homework.student_work_projects.map{|student| student.user_id} @users = searchstudent_by_name all_students,name respond_to do |format| format.js diff --git a/app/views/student_work/search_course_students.js.erb b/app/views/student_work/search_course_students.js.erb index fb595e51f..1cea9f27e 100644 --- a/app/views/student_work/search_course_students.js.erb +++ b/app/views/student_work/search_course_students.js.erb @@ -18,7 +18,7 @@ $("#all_students_list").empty(); } } } - <% if user.id.to_i != User.current.id.to_i %> + <% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %> if (str.indexOf(<%=user.id.to_s %>) < 0) { $("#student_<%=user.id %>").one("click",function choose_student() { var li = "
    • + if (str.indexOf(<%=user.id.to_s %>) < 0) { + $("#student_<%=user.id %>").attr("title","该学生已加入其它分组"); + } <% end %> <% end %> \ No newline at end of file From b981f3dcea5d203595baf07d4ec1aab38d339588 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Dec 2015 15:39:38 +0800 Subject: [PATCH 45/57] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=A0=E9=99=A4403=E9=97=AE=E9=A2=98=20=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E7=9A=84=E6=97=B6=E5=80=99=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 +- app/views/courses/settings.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 88aae0f8b..ab2cfa2ba 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -30,7 +30,7 @@ class ProjectsController < ApplicationController before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project] before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] - before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] + before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar] before_filter :file, :statistics #:watcherlist # 除非项目内人员,不可查看成员, TODO: 完了写报表里去 # before_filter :memberAccess, only: :member diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 650127aef..634f26495 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -89,7 +89,7 @@ <% end %>
    <% if @course.is_delete == 1 %> -
    <%=link_to "恢复该课程", renew_course_path(@course) %>
    +
    <%=link_to "恢复该课程", renew_course_path(@course) %>
    <% else %>
    <%=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %> From d4bde8e73c6b4bdec0a4b5ff199190b8d38fb33a Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 16:05:18 +0800 Subject: [PATCH 46/57] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_evaluation_un_title.html.erb | 2 +- app/views/student_work/_evaluation_work.html.erb | 4 ++-- public/stylesheets/courses.css | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/student_work/_evaluation_un_title.html.erb b/app/views/student_work/_evaluation_un_title.html.erb index 9988bd6e0..66b96431e 100644 --- a/app/views/student_work/_evaluation_un_title.html.erb +++ b/app/views/student_work/_evaluation_un_title.html.erb @@ -1,6 +1,6 @@
    • - 作品名称 + 作品名称 <% if @homework.homework_type != 3 %> 姓名 学号 diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index 58f611b55..db680cbec 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -12,7 +12,7 @@
    • <%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40") %>
    • -
    • +
    • <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
      <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%> @@ -40,7 +40,7 @@
    • <%= image_tag(url_to_avatar(""),width:"40", height: "40") %>
    • -
    • +
    • <%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%>
      diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index f13e6ef84..484d99344 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -83,6 +83,7 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re .width180{width: 180px;} .width525{width: 525px;} .width285{width: 285px;} +.width255{width: 255px;} .width530{width: 530px;} .mr95{margin-right: 95px;} .mr140 {margin-right: 140px;} From e98338bf22579e2a87c4f61be1178edd3e41f85e Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 11 Dec 2015 16:30:50 +0800 Subject: [PATCH 47/57] =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=B1=BB=E5=9E=8B=EF=BC=8C=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6=E3=80=81=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E3=80=81=E6=98=BE=E7=A4=BA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 + app/controllers/attachments_controller.rb | 2 + app/controllers/files_controller.rb | 37 ++++++- app/controllers/org_subfields_controller.rb | 4 + app/helpers/files_helper.rb | 3 +- app/models/attachment.rb | 1 + app/models/org_subfield.rb | 5 + app/views/files/_attachement_list.html.erb | 19 ++++ app/views/files/_org_subfield_list.html.erb | 56 +++++++++++ app/views/files/_subfield_files.html.erb | 97 +++++++++++++++++++ app/views/files/_subfield_files_list.html.erb | 55 +++++++++++ .../files/_upload_subfield_file.html.erb | 31 ++++++ app/views/files/create.js.erb | 11 +++ app/views/files/index.html.erb | 6 +- app/views/org_subfields/_resource.html.erb | 96 ++++++++++++++++++ .../_org_left_subfield_list.html.erb | 2 +- config/routes.rb | 12 ++- public/stylesheets/courses.css | 6 +- public/stylesheets/org.css | 15 ++- 19 files changed, 452 insertions(+), 8 deletions(-) create mode 100644 app/views/files/_org_subfield_list.html.erb create mode 100644 app/views/files/_subfield_files.html.erb create mode 100644 app/views/files/_subfield_files_list.html.erb create mode 100644 app/views/files/_upload_subfield_file.html.erb create mode 100644 app/views/org_subfields/_resource.html.erb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6387a97a4..cbf2c30bb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -418,6 +418,8 @@ class ApplicationController < ActionController::Base @project = Project.find(params[:project_id]) elsif params[:course_id] @course = Course.find(params[:course_id]) + elsif params[:org_subfield_id] + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) end rescue ActiveRecord::RecordNotFound render_404 diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 37182dbcf..d371ed4cb 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -240,6 +240,8 @@ class AttachmentsController < ApplicationController format.html { redirect_to_referer_or respond_path(@attachment.container) } elsif !@attachment.container.nil? && @attachment.container.is_a?(PhoneAppVersion) format.html { redirect_to_referer_or mobile_version_path } + elsif !@attachment.container.nil? && @attachment.container.is_a?(OrgSubfield) + format.html {redirect_to_referer_or org_subfield_files_path(@attachment.container)} else if @project.nil? format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) } diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index c894680a6..328446fbb 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -299,6 +299,10 @@ class FilesController < ApplicationController render :layout => 'base_courses' elsif params[:org_subfield_id] @container_type = 2 + @organization = Organization.find(params[:organization_id]) + @containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)] + show_attachments @containers + render :layout => 'base_org' # @subfield = params[:org_subfield_id] end @@ -424,8 +428,39 @@ class FilesController < ApplicationController redirect_to course_files_url(@course) } end - end + elsif @org_subfield + @addTag=false + # if params[:in_org_subfield_toolbar] + # @in_org_subfield_toolbar = params[:in_org_subfield_toolbar] + # end + attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type]) + # if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') + # Mailer.run.attachments_added(attachments[:files]) + # end + + # TODO: 临时用 nyan + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", + 'filename' => "#{Attachment.table_name}.filename", + 'size' => "#{Attachment.table_name}.filesize", + 'downloads' => "#{Attachment.table_name}.downloads" + + @containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] #modify by Long Jun + # @containers += @org_subfield.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort + + show_attachments @containers + + @attachtype = 0 + @contenttype = 0 + + respond_to do |format| + format.js + format.html { + redirect_to org_subfield_files_url(@org_subfield) + } + end + end end end diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 00b88fdaa..1dc7885fe 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -17,4 +17,8 @@ class OrgSubfieldsController < ApplicationController @organization = Organization.find(@subfield.organization_id) @subfield.update_attributes(:name => params[:name]) end + + def show + + end end diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 9a1765ddc..cf9cbcc32 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -113,7 +113,8 @@ module FilesHelper if attachment.is_public? || (attachment.container_type == "Project" && User.current.member_of?(attachment.project)) || (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))|| - attachment.author_id == User.current.id + attachment.author_id == User.current.id || + attachment.container_type == "OrgSubfield" result << attachment end end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 999cefdaa..57b6af0ce 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -22,6 +22,7 @@ class Attachment < ActiveRecord::Base belongs_to :container, :polymorphic => true belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'" belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'" + belongs_to :org_subfield, foreign_key: 'container_id', conditions: "attachements.container_type = 'OrgSubfield'" belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'" belongs_to :author, :class_name => "User", :foreign_key => "author_id" belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb index efe9699c3..f95bb3eba 100644 --- a/app/models/org_subfield.rb +++ b/app/models/org_subfield.rb @@ -1,4 +1,9 @@ class OrgSubfield < ActiveRecord::Base belongs_to :organization, :foreign_key => :organization_id has_many :org_document_comments, :dependent => :destroy + has_many :files + acts_as_attachable + + def project + end end \ No newline at end of file diff --git a/app/views/files/_attachement_list.html.erb b/app/views/files/_attachement_list.html.erb index 25cc7f68a..a9d399511 100644 --- a/app/views/files/_attachement_list.html.erb +++ b/app/views/files/_attachement_list.html.erb @@ -20,6 +20,25 @@ :lebel_file_uploding => l(:lebel_file_uploding), :delete_all_files => l(:text_are_you_sure_all) } %> +<% elsif @project %> + <%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => ie8? ? '':'file_selector', + :multiple => true, + :onchange => 'addInputFiles(this);', + :style => ie8? ? '': 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all) + } %> <% else %> <%= file_field_tag 'attachments[dummy][file]', :id => '_file', diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb new file mode 100644 index 000000000..a8aa13458 --- /dev/null +++ b/app/views/files/_org_subfield_list.html.erb @@ -0,0 +1,56 @@ +<% delete_allowed = User.current.admin? %> +
      +

      共有 <%= all_attachments.count%> 个资源

      +

      + <% if order == "asc" %> + 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 + <% else %> + 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>  /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 + <% end %> +

      +
      +
      + + + + +
      + +
      + <% org_subfield_attachments.each do |file| %> + <% if 1 %> +
      +
      + <%= link_to truncate(file.filename,length: 35, omission: '...'), + download_named_attachment_path(file.id, file.filename), + :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? %> + <%= file_preview_tag(file, class: 'f_l re_open', style:'text-align: center;') %> + <% end %> +
      +
      +
      +

      文件大小:<%= 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 (delete_allowed || User.current.id == file.author_id) && file.container_id == @org_subfield.id && file.container_type == "OrgSubfield"%> +

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

      +
      +
      + + + + + +
      +
      + <% end %> + <% end %> +
      +
        + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%> +
      +
      diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb new file mode 100644 index 000000000..ea408c7a6 --- /dev/null +++ b/app/views/files/_subfield_files.html.erb @@ -0,0 +1,97 @@ +<%= stylesheet_link_tag 'courses' %> + + +
      +
      +
      + <%= form_tag( search_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %> + <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> + <%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %> + <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> + <% end %> + <%# if is_org_subfield_teacher(User.current,@org_subfield) || (@org_subfield.publish_resource==1 && User.current.member_of_org_subfield?(@org_subfield) ) %> + +

      + 上传: + 课件 |  + 软件 |  + 媒体 |  + 代码 |  + 论文 |  + 其他 +

      + <%# end %> +
      +
      + +
      + <%= render :partial => 'org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments} %> +
      + +
      +
      +<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_subfield_files_list.html.erb b/app/views/files/_subfield_files_list.html.erb new file mode 100644 index 000000000..d762743ad --- /dev/null +++ b/app/views/files/_subfield_files_list.html.erb @@ -0,0 +1,55 @@ +<% delete_allowed = User.current.admin? %> +
      +

      共有 <%= all_attachments.count%> 个资源

      +

      + <% if order == "asc" %> + 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 + <% else %> + 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /  + <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>  /  + <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 + <% end %> +

      +
      +
      + +
      + <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%> +
      +
      + +
      + <% curse_attachments.each do |file| %> + <% if file.is_public? || User.current.admin? %> +
      +
      + <%= link_to truncate(file.filename,length: 35, omission: '...'), + download_named_attachment_path(file.id, file.filename), + :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" %> +
      +
      +
      +

      文件大小:<%= 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 (delete_allowed || User.current.id == file.author_id) && file.container_id == @org_subfield.id && file.container_type == "OrgSubfield"%> +

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

      +
      +
      +
      + + <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> + <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> +
      +
      +
      + <% else %> +
      <%= file.filename %>是私有资源
      + <% end %> + <% end %> +
      +
        + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%> +
      +
      diff --git a/app/views/files/_upload_subfield_file.html.erb b/app/views/files/_upload_subfield_file.html.erb new file mode 100644 index 000000000..c3ca72ecd --- /dev/null +++ b/app/views/files/_upload_subfield_file.html.erb @@ -0,0 +1,31 @@ + +
      +
      +

      <%= l(:label_upload_files)%>

      +
      + <%= error_messages_for 'attachment' %> + + + <%= form_tag(org_subfield_files_path(org_subfield), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %> + + + + <%= render :partial => 'files/attachement_list',:locals => {:org_subfield => org_subfield} %> +
      + <%= l(:button_cancel)%> + <%= l(:button_confirm)%> + <% end %> +
      + +
      + <% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> + <% end %> +
      + + \ No newline at end of file diff --git a/app/views/files/create.js.erb b/app/views/files/create.js.erb index 9de7aa042..4d8bb26ca 100644 --- a/app/views/files/create.js.erb +++ b/app/views/files/create.js.erb @@ -52,6 +52,17 @@ $('#upload_file_div').slideToggle('slow'); setTimeout( function(){div.remove();},3000) <% end %> <%end%> + <% elsif @org_subfield %> + hideModal(); + $("#resource_list").html('<%= j(render partial: "subfield_files" ,locals: {org_subfield: @org_subfield}) %>'); +// $("#courses_files_count_info").html("<%#= @all_attachments.count%>"); +// $("#courses_files_count_nav").html("(<%#= @all_attachments.count%>)") + // 添加文件上传成功提示, + <% unless params[:attachments].nil? %> + var div = $('
      文件上传成功!
      '); + $("#org_subfield_list").prepend(div); + setTimeout( function(){div.remove();},3000) + <% end %> <% end %> <% end %> $(document).ready(img_thumbnails); diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 3dad88868..d442b9112 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,8 +1,10 @@
      - <% if @isproject %> + <% if @container_type == 0 %> <%= render :partial => 'project_file_new', locals: {project: @project} %> - <% else %> + <% elsif @container_type == 1 %> <%= render :partial => 'course_file', locals: {course: @course} %> + <% elsif @container_type == 2 %> + <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %> <% end %>
      diff --git a/app/views/org_subfields/_resource.html.erb b/app/views/org_subfields/_resource.html.erb new file mode 100644 index 000000000..3cce9748f --- /dev/null +++ b/app/views/org_subfields/_resource.html.erb @@ -0,0 +1,96 @@ + + +
      +
      +
      + <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %> + <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> + <%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %> + <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> + <% end %> + <% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> + +

      + 上传: + 课件 |  + 软件 |  + 媒体 |  + 代码 |  + 论文 |  + 其他 +

      + <% end %> +
      +
      + +
      + <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> +
      + +
      +
      +<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 57ea46658..dbeaa6117 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -29,7 +29,7 @@ <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%> <% else %> - <%#= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %> + <%= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %> <% end %>
    diff --git a/app/views/organizations/set_homepage.js.erb b/app/views/organizations/set_homepage.js.erb index 5b56d57b3..97824bb3a 100644 --- a/app/views/organizations/set_homepage.js.erb +++ b/app/views/organizations/set_homepage.js.erb @@ -1,2 +1,2 @@ //location.reload(); -window.location.href ='<%= organization_path(@org, :show_homepage => params[:show_homepage])%>'; \ No newline at end of file +window.location.href ='<%= organization_path(@org, :show_homepage => 1)%>'; \ No newline at end of file From e5192c7b1a1e8f1539b47474468e9e2c5e04e970 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 17:02:34 +0800 Subject: [PATCH 51/57] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E7=9A=84=E6=8F=90=E4=BA=A4=E5=92=8C=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 5 +++++ app/models/course_message.rb | 4 ++-- app/views/exercise/_student_exercise.html.erb | 8 -------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 355743dd7..1fe798328 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -270,6 +270,9 @@ class StudentWorkController < ApplicationController user_activity.updated_at = Time.now user_activity.save end + course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"new",:course_message_id=>student_work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 + course_message.save + @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first respond_to do |format| format.js @@ -302,6 +305,8 @@ class StudentWorkController < ApplicationController @work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@work) if @work.save + course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 + course_message.save =begin respond_to do |format| format.html { diff --git a/app/models/course_message.rb b/app/models/course_message.rb index 11b0165c5..79d27f3c5 100644 --- a/app/models/course_message.rb +++ b/app/models/course_message.rb @@ -1,5 +1,5 @@ class CourseMessage < ActiveRecord::Base - # status说明: status在课程不同的类型,区分不同的功能 + # status说明: status在课程不同的类型,区分不同的功能 status = 9 作品的提交记录 # HomeworkCommon:status: # nil:发布了作业; 1:作业截止时间到了提醒!;2:开启匿评; 3:关闭匿评; 4:匿评开始失败 attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status @@ -19,7 +19,7 @@ class CourseMessage < ActiveRecord::Base def add_user_message #unless self.course_message_type == 'JoinCourseRequest' - if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? && self.status != 9 self.message_alls << MessageAll.new(:user_id => self.user_id) end #end diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 3983fb0c4..9c9916e60 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -53,19 +53,11 @@
  • <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
  • - <%# end_time = Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
    • <%=exercise.user.show_name %> - <%# name = exercise.user.show_name %> - <%# if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %> - <%#= link_to name,show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %> - <%# else %> - - <%#= link_to name,'',:title=>"截止日期未到,暂不能查看学生答题结果。" %> - <%# end %>
    • <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%> From c2d21b5a6bcffa8a3778cb050ed1914c2a2fe25a Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 11 Dec 2015 17:11:11 +0800 Subject: [PATCH 52/57] =?UTF-8?q?=E9=9A=90=E8=97=8F=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_left_subfield_list.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index dbeaa6117..367c23843 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -29,7 +29,8 @@ <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%> <% else %> - <%= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %> + <%#= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %> + <%= field.name %> <% end %>