From 46081905294d033b5e6834d435d0fe221912f063 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 5 Nov 2015 14:31:43 +0800 Subject: [PATCH 01/14] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=8E=86=E5=8F=B2=E7=89=88=E6=9C=AC=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../settings/_new_repositories.html.erb | 5 ++++- db/schema.rb | 18 ++++++++++++++---- public/javascripts/project.js | 5 +++-- public/stylesheets/repository.css | 2 ++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index 5196fd8e8..4ac5424f9 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -72,10 +72,13 @@ <%= repository.identifier %> <%=h repository.scm_name %> <%if repository.scm_name=="Git"%> + <% rep_url = "http://" + repository.login.to_s + '_'+ repository.identifier.to_s + "@" + ip.to_s + h( repository.url.slice(project_path_cut, repository.url.length)) %> - <%=truncate( 'http://' << repository.login.to_s << '_'<< repository.identifier.to_s << '@'<< ip.to_s << h( repository.url.slice(project_path_cut, repository.url.length)),:length=>60) %> + + + <%#= rep_url %> <%else %> diff --git a/db/schema.rb b/db/schema.rb index 63b09498e..b7e1bfa1c 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 => 20151102085318) do +ActiveRecord::Schema.define(:version => 20151102090519) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1038,11 +1038,21 @@ ActiveRecord::Schema.define(:version => 20151102085318) do t.integer "project_id" end + create_table "org_members", :force => true do |t| + t.integer "user_id" + t.integer "organization_id" + t.string "role" + end + create_table "organizations", :force => true do |t| t.string "name" - t.string "logo_link" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.text "description" + t.integer "creator_id" + t.integer "home_id" + t.string "domain" + t.boolean "is_public" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "phone_app_versions", :force => true do |t| diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 9344434eb..a31ae2356 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -517,8 +517,9 @@ function jsCopy(){ e.select(); document.execCommand("Copy"); } -function jsCopy2(){ - var e=document.getElementById("copy_rep_content2"); +function jsCopy2(id){ + //alert("copy_rep_content2_" + id); + var e=document.getElementById("copy_rep_content2_" + id); e.select(); document.execCommand("Copy"); } diff --git a/public/stylesheets/repository.css b/public/stylesheets/repository.css index e2d636e2e..27941cb9e 100644 --- a/public/stylesheets/repository.css +++ b/public/stylesheets/repository.css @@ -207,11 +207,13 @@ } .cloneUrl {width:235px; height:21px; border:1px solid #dddddd; outline:none; overflow:hidden; line-height:21px; resize:none;white-space:nowrap;} +.cloneUrl2 {width:328px; height:21px; border:1px solid #dddddd; outline:none; overflow:hidden; line-height:21px; resize:none;white-space:nowrap;} .clone_btn {width:30px; height:21px; border-top:1px solid #dddddd; border-bottom:1px solid #dddddd; border-right:1px solid #dddddd; outline:none; float:left; background-image:linear-gradient(#FCFCFC, #EEE); text-align:center;} .vl_btn {height:21px; padding:0px 5px; vertical-align:middle; border:1px solid #dddddd; float:left; line-height:21px; background-image:linear-gradient(#FCFCFC, #EEE);} .vl_btn_2 {height:21px; padding:0px 5px; vertical-align:middle; border-top:1px solid #dddddd; border-bottom:1px solid #dddddd; border-right:1px solid #dddddd; float:left; line-height:21px;} .recordBanner {width:670px; height:30px; background-color:#f1f1f1; color:#666666; line-height:30px; vertical-align:middle;} .vl_copy {background:url(../images/vlicon/clone_url.png) 0px 0px no-repeat; padding-left:22px;} +.vl_copy2 {background:url(../images/vlicon/clone_url.png) 0px 0px no-repeat; padding-left:22px;} .vl_zip {background:url(../images/vlicon/download_icon.png) 0px 0px no-repeat; padding-left:22px;} .vl_fork {background:url(../images/vlicon/fork_icon.png) 0px -2px no-repeat; padding-left:22px;} .vl_commit {background:url(../images/vlicon/commit_icon.png) 0px -2px no-repeat; padding-left:22px;weight:20px;height: 24px;} From 061b7b88eca03cab177e9d2ff515447c698d3e31 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 5 Nov 2015 15:01:07 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E5=8C=BF=E8=AF=84=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E6=97=B6=E5=8F=AF=E4=BB=A5=E5=85=B3=E9=97=AD=E5=8C=BF=E8=AF=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_homework_detail.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 1947c8ce8..9ca50c019 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -98,7 +98,7 @@ <%= link_to("匿评设置", start_evaluation_set_homework_common_path(homework_common),:class => "postOptionLink", :remote => true)%> <% end %> - <% if homework_common.anonymous_comment == 0 &&(comment_status == 0 || comment_status == 1)%> + <% if homework_common.anonymous_comment == 0%>
  • <%= homework_anonymous_comment homework_common %>
  • From 7edb4db99d0560f11306d23782c4c9e18565e67b Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 5 Nov 2015 15:05:01 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E5=8C=BF=E8=AF=84=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E9=9C=80=E8=A6=81=E9=BB=98=E8=AE=A4=E6=89=93?= =?UTF-8?q?=E5=BC=80=E6=9C=AC=E4=BA=BA=E7=9A=84=E4=BD=9C=E5=93=81=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_student_work_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index eeda41858..d834bc845 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -36,7 +36,7 @@ <% end%>
    - <% if student_work.user == User.current %> + <% if student_work.user == User.current && !@is_evaluation %> <% if @homework.homework_type == 2%> <%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> <% else %> From 019e4e0630debffa944e1a7365819ec93b90b599 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 5 Nov 2015 15:16:42 +0800 Subject: [PATCH 04/14] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=92=8C=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=91=E5=B8=83=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/index.html.erb | 3 +++ app/views/users/_user_homework_detail.html.erb | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 8f1f0033e..b0e70c9b0 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -162,6 +162,9 @@
    截止时间:<%= @homework.end_time %> 23:59
    + <% if @homework.homework_detail_manual.comment_status == 0 %> +
    发布时间:<%= @homework.publish_time %> 00:00
    + <% end %> <% if @homework.homework_detail_manual%> <% if @homework.homework_detail_manual.comment_status == 1%> <% end_time = @homework.end_time.to_time.to_i + 24*60*60 - 1 %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 9ca50c019..e920cf409 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -56,14 +56,14 @@ <%= homework_common.language_name%>
    <% end %> - <% if homework_common.homework_detail_manual.comment_status == 0 %> -
    - <%= l(:label_publish_time)%>:<%= homework_common.publish_time%> -
    - <% end %>
    <%= l(:label_end_time)%>:<%= homework_common.end_time%> 23:59
    + <% if homework_common.homework_detail_manual.comment_status == 0 %> +
    + <%= l(:label_publish_time)%>:<%= homework_common.publish_time%> 00:00 +
    + <% end %>
    From 8dd9c834433da870a342a8ed19b0d1f72209939c Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 5 Nov 2015 15:39:52 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_dir_list_content.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb index abee097c5..81706c25e 100644 --- a/app/views/repositories/_dir_list_content.html.erb +++ b/app/views/repositories/_dir_list_content.html.erb @@ -21,7 +21,7 @@ {:action => (entry.is_dir? ? 'show' : 'entry'), :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(ent_path), :rev => @rev}, :class => (entry.is_dir? ? 'icon icon-folder' : "icon icon-file #{Redmine::MimeType.css_class_of(ent_name)}")%> -<%= (entry.size ? number_to_human_size(entry.size) : "?") unless entry.is_dir? %> + <% if @repository.report_last_commit %> <%= link_to_revision(entry.changeset, @repository) if entry.changeset %> From 9be1fe63b4cdfbda6afc1dcce17b44785fa67485 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 5 Nov 2015 15:45:21 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E7=9A=84=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/course.js | 2 +- public/javascripts/new_user.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 90d085ea3..b015af857 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -663,7 +663,7 @@ function regex_homework_end_publish_time() var myDate = new Date(); if($.trim($("#homework_publish_time").val()) == "") { - $("#homework_publish_time").val(myDate.toLocaleDateString()); + $("#homework_publish_time").val(myDate.getFullYear()+'-'+(myDate.getMonth()+1)+'-'+myDate.getDate()); } var publish_time = Date.parse($("#homework_publish_time").val()); var end_time = Date.parse($("#homework_end_time").val()); diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index e99abd4f1..4cf380523 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -97,7 +97,7 @@ function regex_homework_end_publish_time() var myDate = new Date(); if($.trim($("#homework_publish_time").val()) == "") { - $("#homework_publish_time").val(myDate.toLocaleDateString()); + $("#homework_publish_time").val(myDate.getFullYear()+'-'+(myDate.getMonth()+1)+'-'+myDate.getDate()); } var end_time = Date.parse($("#homework_end_time").val()); var publish_time = Date.parse($("#homework_publish_time").val()); From 41f53ad4e069d90769934c48510b1f691fd673d2 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 5 Nov 2015 16:25:40 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=88=AA=E6=AD=A2?= =?UTF-8?q?=E5=90=8E=E4=B8=8D=E5=8F=AF=E5=86=8D=E4=BF=AE=E6=94=B9=E4=BD=9C?= =?UTF-8?q?=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 8 +++++--- app/views/student_work/_programing_work_show.html.erb | 2 +- app/views/student_work/_show.html.erb | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b6c4ec91b..5abbddaa1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2372,10 +2372,12 @@ module ApplicationHelper link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 link_to "匿评结束", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束" - elsif homework.homework_type == 2 #编程作业不能修改作品 - link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品 + link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") + link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue' else - link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue' + link_to "查看作品", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品" end end end diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index dbf7291cb..fd541c643 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -6,7 +6,7 @@ <%=format_time work.created_at %> - <% if work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %> + <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
  • <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 1f3d44258..286d5eb39 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -6,7 +6,7 @@ <%=format_time work.created_at %>
  • - <% if work.user == User.current && @homework.homework_detail_manual.comment_status == 1 %> + <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
  • <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> From 8e3b04f9e3e76e326766580bc3d6905c0471769a Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 5 Nov 2015 16:43:12 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E7=A6=81=E7=94=A8=E5=8C=BF=E8=AF=84&&?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=88=AA=E6=AD=A2&&=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=B7=B2=E6=8F=90=E4=BA=A4=20=E5=AD=A6=E7=94=9F=E5=8F=AF?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=89=80=E6=9C=89=E4=BD=9C=E5=93=81=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 6 ++++-- app/helpers/application_helper.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 8d50b91f1..6a2fa84bc 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -89,7 +89,9 @@ class StudentWorkController < ApplicationController else student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')' end - if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 + #老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? || + (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 @@ -110,7 +112,7 @@ class StudentWorkController < ApplicationController end @student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count else - if @is_teacher || @homework.homework_detail_manual.nil? #老师 || 超级管理员 显示所有列表 + if @is_teacher || @homework.homework_detail_manual.nil? || (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) #老师 || 超级管理员 显示所有列表 @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5abbddaa1..795147446 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2377,7 +2377,7 @@ module ApplicationHelper elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue' else - link_to "查看作品", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品" + link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品" end end end From 5e9cc27c11b5ad66775403c6dfcf62d8bf7c9abf Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 6 Nov 2015 09:56:37 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E5=8F=91=E5=B8=83=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E5=8F=91=E5=B8=83=E6=97=A5=E6=9C=9F=E8=8B=A5?= =?UTF-8?q?=E6=9C=AA=E9=80=89=E6=8B=A9=E5=88=99=E9=BB=98=E8=AE=A4=E4=B8=BA?= =?UTF-8?q?=E5=BD=93=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/course.js | 17 ++++++++++++++++- public/javascripts/new_user.js | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/public/javascripts/course.js b/public/javascripts/course.js index b015af857..0c7f4156f 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -663,7 +663,7 @@ function regex_homework_end_publish_time() var myDate = new Date(); if($.trim($("#homework_publish_time").val()) == "") { - $("#homework_publish_time").val(myDate.getFullYear()+'-'+(myDate.getMonth()+1)+'-'+myDate.getDate()); + $("#homework_publish_time").val(formate_date(myDate)); } var publish_time = Date.parse($("#homework_publish_time").val()); var end_time = Date.parse($("#homework_end_time").val()); @@ -695,6 +695,21 @@ function regex_homework_end_time() } } +function formate_date(date){ + var str = ""; + var year = date.getFullYear(); + var month = date.getMonth() + 1; + var day = date.getDate(); + if(month < 10) { + month = '0' + month; + } + if(day < 10) { + day = '0' + day; + } + str = year + '-' + month + '-' + day; + return str; +} + //验证发送到课程 function regex_course_id(){ var course_id = $("#course_id").val(); diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index 4cf380523..ca7b28ee7 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -97,7 +97,7 @@ function regex_homework_end_publish_time() var myDate = new Date(); if($.trim($("#homework_publish_time").val()) == "") { - $("#homework_publish_time").val(myDate.getFullYear()+'-'+(myDate.getMonth()+1)+'-'+myDate.getDate()); + $("#homework_publish_time").val(formate_date(myDate)); } var end_time = Date.parse($("#homework_end_time").val()); var publish_time = Date.parse($("#homework_publish_time").val()); @@ -129,6 +129,21 @@ function regex_homework_end_time() } } +function formate_date(date){ + var str = ""; + var year = date.getFullYear(); + var month = date.getMonth() + 1; + var day = date.getDate(); + if(month < 10) { + month = '0' + month; + } + if(day < 10) { + day = '0' + day; + } + str = year + '-' + month + '-' + day; + return str; +} + //验证发送到课程 function regex_course_id(){ var course_id = $("#course_id").val(); From cab8c021134733cff04b7433fd789bfbfff0b7bd Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 6 Nov 2015 10:24:29 +0800 Subject: [PATCH 10/14] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=90=8E=E5=BC=B9=E5=87=BA=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E7=A1=AE=E8=AE=A4=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 14 +++-------- .../student_work/_work_information.html.erb | 14 +++++++---- app/views/student_work/create.js.erb | 23 +++++++++++++------ 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 6a2fa84bc..c36877092 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -168,6 +168,7 @@ class StudentWorkController < ApplicationController def create if params[:student_work] + @submit_result = true student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id] student_work ||= StudentWork.new student_work.name = params[:student_work][:name] @@ -183,7 +184,6 @@ class StudentWorkController < ApplicationController else student_work.late_penalty = 0 end - if student_work.save course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework.id}").first if course_activity @@ -198,21 +198,13 @@ class StudentWorkController < ApplicationController @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first respond_to do |format| format.js -=begin - format.html { - flash[:notice] = l(:notice_successful_create) - redirect_to student_work_index_url(:homework => @homework.id) - } -=end end return end end + @submit_result = false respond_to do |format| - format.html { - flash[:notice] = l(:notice_failed_create) - redirect_to new_student_work_url(:homework => @homework.id) - } + format.js end end diff --git a/app/views/student_work/_work_information.html.erb b/app/views/student_work/_work_information.html.erb index 151661b0e..2b5e3b67a 100644 --- a/app/views/student_work/_work_information.html.erb +++ b/app/views/student_work/_work_information.html.erb @@ -1,6 +1,6 @@
    - 您上传的作品信息 + 请您确认刚刚上传的作品信息

    作品名称:<%=@student_work.name%>

    @@ -10,7 +10,7 @@

    件: <% if @student_work.attachments.count == 0%> - <%= "无附件"%> + <%= "无附件"%> <% else %>

    <% @student_work.attachments.each do |attachment| %> @@ -21,9 +21,15 @@

    -
    \ No newline at end of file +
    + + \ No newline at end of file diff --git a/app/views/student_work/create.js.erb b/app/views/student_work/create.js.erb index 69dd8364d..42b1db8b8 100644 --- a/app/views/student_work/create.js.erb +++ b/app/views/student_work/create.js.erb @@ -1,7 +1,16 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); -showModal('ajax-modal', '500px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before("" + - ""); -$('#ajax-modal').parent().css("top","").css("left",""); -$('#ajax-modal').parent().addClass("anonymos"); \ No newline at end of file +<% if @submit_result%> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); +<% else %> + window.location.href = '<%= new_student_work_url(:homework => @homework.id)%>'; +<% end %> + +function clickCanel() { + hideModal('#popbox02'); + window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>'; +} \ No newline at end of file From c08c327f7333bf9d9a2fc3335c24f990a124883b Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 6 Nov 2015 11:26:37 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E7=81=AB=E7=8B=90=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E4=B8=8B=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A=E7=9A=84?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=97=A0=E6=B3=95=E8=87=AA=E5=8A=A8=E5=88=B7?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/words_controller.rb | 1 + app/views/users/_course_homework.html.erb | 1 + app/views/words/leave_homework_message.js.erb | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index 6ad1a66b4..8590b836a 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -272,6 +272,7 @@ class WordsController < ApplicationController format.js{ @user_activity_id = params[:user_activity_id] @is_in_course = params[:is_in_course] + @course_activity = params[:course_activity] @homework_common_id = params[:homework_common_id] } end diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f442e34e4..f77dd13bf 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -167,6 +167,7 @@
    <%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_homework_message', :id => activity.id},:method => "post", :remote => true) do |f|%> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> + <%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
    diff --git a/app/views/words/leave_homework_message.js.erb b/app/views/words/leave_homework_message.js.erb index 91525c889..08fed725c 100644 --- a/app/views/words/leave_homework_message.js.erb +++ b/app/views/words/leave_homework_message.js.erb @@ -1,5 +1,5 @@ <% if @user_activity_id %> - $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id}) %>"); + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>"); init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); <% elsif @homework_common_id && @is_in_course %> $("#homework_common_<%= @homework_common_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework_common,:is_in_course => @is_in_course}) %>"); From 71728a15e42e0cc18f6ac4bd042689ec5732f7c3 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 6 Nov 2015 14:39:15 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=BAGit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/gitlab_to_git.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/gitlab_to_git.rake b/lib/tasks/gitlab_to_git.rake index 3c7d119f2..8b7f7279e 100644 --- a/lib/tasks/gitlab_to_git.rake +++ b/lib/tasks/gitlab_to_git.rake @@ -4,7 +4,7 @@ namespace :rep_fault do desc "set ossean's type value" task :rep_update => :environment do rep = Repository.find(400) - rep.type = "Repository::Gitlab" + rep.type = "Repository::Git" rep.save end From 334de6444afe03f65770b7aa25f140ac9a3c8fc5 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 6 Nov 2015 14:57:16 +0800 Subject: [PATCH 13/14] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=A4=8D=E5=88=B6title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/settings/_new_repositories.html.erb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index 4ac5424f9..43535153d 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -73,8 +73,7 @@ <%=h repository.scm_name %> <%if repository.scm_name=="Git"%> <% rep_url = "http://" + repository.login.to_s + '_'+ repository.identifier.to_s + "@" + ip.to_s + h( repository.url.slice(project_path_cut, repository.url.length)) %> - + From 5d03a27170714fc59f376d01ada6096609ac2ad0 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 6 Nov 2015 14:57:39 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E5=92=8C=E5=85=B3=E9=97=AD=E5=8C=BF=E8=AF=84=E6=97=B6=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=88=B7=E6=96=B0=E8=AF=A5=E5=8A=A8=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 9 +++++++++ app/helpers/application_helper.rb | 6 +++--- app/helpers/homework_common_helper.rb | 6 +++--- .../homework_common/_alert_anonyoms.html.erb | 2 +- .../start_anonymous_comment.js.erb | 19 +++++++++++++------ .../stop_anonymous_comment.js.erb | 12 ++++++++++-- app/views/users/_course_homework.html.erb | 2 +- .../users/_user_homework_detail.html.erb | 2 +- 8 files changed, 41 insertions(+), 17 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 1e68ed2ed..687ef9503 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -147,6 +147,9 @@ class HomeworkCommonController < ApplicationController else @statue = 3 end + @user_activity_id = params[:user_activity_id].to_i + @is_in_course = params[:is_in_course].to_i + @course_activity = params[:course_activity].to_i end #关闭匿评 @@ -162,6 +165,9 @@ class HomeworkCommonController < ApplicationController # 匿评关闭消息邮件通知 send_message_anonymous_comment(@homework, m_status = 3) Mailer.send_mail_anonymous_comment_close(@homework).deliver + @user_activity_id = params[:user_activity_id].to_i + @is_in_course = params[:is_in_course].to_i + @course_activity = params[:course_activity].to_i respond_to do |format| format.js end @@ -188,6 +194,9 @@ class HomeworkCommonController < ApplicationController @homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count} end @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100) + @user_activity_id = params[:user_activity_id].to_i + @is_in_course = params[:is_in_course].to_i + @course_activity = params[:course_activity].to_i respond_to do |format| format.js end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 795147446..e5cd9b52b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2307,15 +2307,15 @@ module ApplicationHelper end #获取匿评相关连接代码 - def homework_anonymous_comment homework + def homework_anonymous_comment (homework, is_in_course, user_activity_id = -1, course_activity = -1) if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评" elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2 case homework.homework_detail_manual.comment_status when 1 - link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink' + link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink' when 2 - link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink' + link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink' when 3 # link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" end diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index a03c4ccd7..2d3c72c20 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -57,12 +57,12 @@ module HomeworkCommonHelper end #根据传入作业确定跳转到开启匿评还是关闭匿评功能 - def alert_anonyoms_path homework,homework_detail_manual + def alert_anonyoms_path homework,homework_detail_manual,user_activity_id,is_in_course,course_activity link = "" if homework_detail_manual.comment_status == 1 - link = start_anonymous_comment_homework_common_url homework.id + link = start_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity elsif homework_detail_manual.comment_status == 2 - link = stop_anonymous_comment_homework_common_url homework.id + link = stop_anonymous_comment_homework_common_url homework.id,:user_activity_id=>user_activity_id,:is_in_course=>is_in_course,:course_activity=>course_activity end link end diff --git a/app/views/homework_common/_alert_anonyoms.html.erb b/app/views/homework_common/_alert_anonyoms.html.erb index 73f240b02..3b1f6f692 100644 --- a/app/views/homework_common/_alert_anonyoms.html.erb +++ b/app/views/homework_common/_alert_anonyoms.html.erb @@ -34,7 +34,7 @@

    <% end %>
    - + 确  定 diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb index b0424bf7a..ea63ea12c 100644 --- a/app/views/homework_common/start_anonymous_comment.js.erb +++ b/app/views/homework_common/start_anonymous_comment.js.erb @@ -1,12 +1,19 @@ <% if @statue == 1%> -alert('启动成功'); -$("#<%= @homework.id %>_start_anonymous_comment").replaceWith('<%= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>'); + alert('启动成功'); + <% if @user_activity_id == -1 %> + $("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); + init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); + <% else %> + $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); + init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); + <% end %> +/*$("#<%#= @homework.id %>_start_anonymous_comment").replaceWith('<%#= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');*/ <% elsif @statue == 2 %> -alert('启动失败\n作业总数大于等于2份时才能启动匿评'); + alert('启动失败\n作业总数大于等于2份时才能启动匿评'); <% elsif @statue == 3%> -alert("已开启匿评,请务重复开启"); + alert("已开启匿评,请务重复开启"); <% elsif @statue == 4%> -alert("您没有权限开启匿评"); + alert("您没有权限开启匿评"); <% elsif @statue == 5%> -alert("作业提交截止之后才能启动匿评"); + alert("作业提交截止之后才能启动匿评"); <% end %> \ No newline at end of file diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb index 4725d5731..214a157dc 100644 --- a/app/views/homework_common/stop_anonymous_comment.js.erb +++ b/app/views/homework_common/stop_anonymous_comment.js.erb @@ -1,2 +1,10 @@ -$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith(''); -alert('关闭成功'); \ No newline at end of file +alert('关闭成功'); +<% if @user_activity_id == -1 %> +$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>"); +init_activity_KindEditor_data(<%= @homework.id%>,"","87%"); +<% else %> +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>"); +init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%"); +<% end %> +/* +$("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/ diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index f77dd13bf..38a4d6edd 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -93,7 +93,7 @@ <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
  • - <%= homework_anonymous_comment activity %> + <%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
  • <% end %> <% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index e920cf409..0c2a28e5c 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -100,7 +100,7 @@ <% end %> <% if homework_common.anonymous_comment == 0%>
  • - <%= homework_anonymous_comment homework_common %> + <%= homework_anonymous_comment(homework_common, is_in_course) %>
  • <% end %> <% if homework_common.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>