From 44e3daa0d2ea1512534e84b24c41d4bbede1c761 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 16 Jun 2015 10:39:42 +0800 Subject: [PATCH 001/100] =?UTF-8?q?1=E3=80=81=E8=80=81=E5=B8=88=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E4=BD=9C=E4=B8=9A=EF=BC=8C=E4=B8=A4=E7=B1=BB=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E7=9A=84=E9=80=89=E6=8B=A9=202=E3=80=81=E7=BC=96?= =?UTF-8?q?=E7=A8=8B=E4=BD=9C=E4=B8=9A=E9=9D=99=E6=80=81=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/new.html.erb | 118 +++++++++++++++++++++++-- public/javascripts/course.js | 21 +++++ public/stylesheets/public.css | 1 + 3 files changed, 132 insertions(+), 8 deletions(-) diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index b0fdc5299..4fd52c8a0 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -6,12 +6,114 @@ <%= l(:label_course_homework_new)%> -
- <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> - <%= hidden_field_tag "course",@course.id%> - <%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> - 提交 - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> - <% end%> +
+

请选择将要发布的作业类型 +

+ 人工评分的作业(支持匿名互评、灵活设置评分比例) +
+ 自动评测的编程作业(支持C++程序的自动评分) +
+ 下一步
-
\ No newline at end of file +
+ +
+
+ <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> + <%= hidden_field_tag "course",@course.id%> + <%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> + 提交 + 上一步 + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <% end%> +
+
+
+
+
+
    +
  • + + +
  • +
    +
  • + + +
  • +
    +
  • + +     -文件不超过200MB +
  • +
    +
  • + + + +
    +
  • +
  • + + + +
    +
  • +
    +
  • + + +  分 +
    +
  • +
+
+

编程评测设置

+
+
    +
  • + + +
    +
  • +
  • + + +
    +
  • +
  • + + +
  • +
  • + + +
  • +
  • OK !
  • +
    +
  • + + +
  • +
  • + + +
  • +
  • 测试
  • +
    +
+
+ 提交 + 上一步 + 取消 +
+
+
\ No newline at end of file diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 8f87767ed..b493277fd 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -394,6 +394,27 @@ function show_bid_dead_line(year,month,day,divname) + "" + "

作品提交还剩:

"); } + +//新建作业,下一步按钮 +function select_homework_common_type() +{ + if($("#homework_detail_manual_radio").attr("checked") == "checked"){ + $("#homework_detail_manual").show(); + } + else if($("#homework_detail_programing_radio").attr("checked") == "checked"){ + $("#homework_detail_programing").show(); + } + $("#hwork_new").hide(); +} + +//新建作业,上一步按钮 +function return_homework_common_type() +{ + $("#homework_detail_manual").hide(); + $("#homework_detail_programing").hide(); + $("#hwork_new").show(); +} + //验证新建作业的名字 function regex_homework_name() { diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 0ed497127..5b00dbd57 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -161,6 +161,7 @@ a.green_btn{background:#28be6c;color:#fff;font-size:14px; font-weight:normal; pa a:hover.green_btn{ background:#14ad5a;} .blue_btn{ background:#64bdd9; color:#fff; font-size:14px; font-weight:normal;padding:2px 10px; text-align:center;} a.blue_btn{background:#64bdd9;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;} +a.orange_btn_homework{background:#d63502;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;} a:hover.blue_btn{ background:#329cbd;cursor: pointer;} a.orange_btn{ background:#ff5722;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center; } a:hover.orange_btn{ background:#d63502;} From 9423f4b45ab4b5b242a22d40e283f78560a78965 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 16 Jun 2015 10:50:27 +0800 Subject: [PATCH 002/100] =?UTF-8?q?1=E3=80=81=E5=8C=BF=E8=AF=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=94=B9=E5=90=8D=202=E3=80=81=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=9D=99=E6=80=81=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... => _homework_detail_manual_form.html.erb} | 0 .../_homework_detail_programing_form.html.erb | 80 ++++++++++++++++ app/views/homework_common/edit.html.erb | 2 +- app/views/homework_common/new.html.erb | 92 ++----------------- 4 files changed, 89 insertions(+), 85 deletions(-) rename app/views/homework_common/{_homework_common_form.html.erb => _homework_detail_manual_form.html.erb} (100%) create mode 100644 app/views/homework_common/_homework_detail_programing_form.html.erb diff --git a/app/views/homework_common/_homework_common_form.html.erb b/app/views/homework_common/_homework_detail_manual_form.html.erb similarity index 100% rename from app/views/homework_common/_homework_common_form.html.erb rename to app/views/homework_common/_homework_detail_manual_form.html.erb diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb new file mode 100644 index 000000000..d0556745b --- /dev/null +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -0,0 +1,80 @@ + +
+

编程评测设置

+
+ +
\ No newline at end of file diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index f9d3f8b70..87977c6a9 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -8,7 +8,7 @@
<%= form_for @homework do |f| %> - <%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> + <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> 提交 <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> <% end%> diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index 4fd52c8a0..0c4780133 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -21,7 +21,7 @@
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> <%= hidden_field_tag "course",@course.id%> - <%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> + <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> 提交 上一步 <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> @@ -31,89 +31,13 @@
-
    -
  • - - -
  • -
    -
  • - - -
  • -
    -
  • - -     -文件不超过200MB -
  • -
    -
  • - - - -
    -
  • -
  • - - - -
    -
  • -
    -
  • - - -  分 -
    -
  • -
-
-

编程评测设置

-
-
    -
  • - - -
    -
  • -
  • - - -
    -
  • -
  • - - -
  • -
  • - - -
  • -
  • OK !
  • -
    -
  • - - -
  • -
  • - - -
  • -
  • 测试
  • -
    -
-
- 提交 - 上一步 - 取消 + <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> + <%= hidden_field_tag "course",@course.id%> + <%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> + 提交 + 上一步 + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <% end%>
\ No newline at end of file From df96ece903c4b190410ee4b48fa706e0335eafa0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 16 Jun 2015 10:51:58 +0800 Subject: [PATCH 003/100] =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A=EF=BC=9F=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/new.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index 0c4780133..239987035 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -21,6 +21,7 @@
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> <%= hidden_field_tag "course",@course.id%> + <%= hidden_field_tag "homework_common_tyle","homework_detail_manual"%> <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> 提交 上一步 @@ -33,6 +34,7 @@
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> <%= hidden_field_tag "course",@course.id%> + <%= hidden_field_tag "homework_common_tyle","homework_detail_programing"%> <%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> 提交 上一步 From 8f645f840cfe0139d5796fdb6094fcd47b9470b0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 16 Jun 2015 11:20:17 +0800 Subject: [PATCH 004/100] =?UTF-8?q?=E4=B8=8A=E4=B8=80=E6=AD=A5=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=A0=B7=E5=BC=8F=20=E7=BC=96=E7=A8=8B=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_homework_detail_manual_form.html.erb | 1 - .../_homework_detail_programing_form.html.erb | 49 +++++++++++-------- app/views/homework_common/new.html.erb | 4 +- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/app/views/homework_common/_homework_detail_manual_form.html.erb b/app/views/homework_common/_homework_detail_manual_form.html.erb index fa45397f0..f70ec6017 100644 --- a/app/views/homework_common/_homework_detail_manual_form.html.erb +++ b/app/views/homework_common/_homework_detail_manual_form.html.erb @@ -10,7 +10,6 @@
  • -
    <% if edit_mode %> <%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %> diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index d0556745b..12e6b7074 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -1,41 +1,50 @@
    • - - + + +

    • - - + +
      + <% if edit_mode %> + <%= f.kindeditor :description,:editor_id => 'homework_description_editor_1',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %> + <% else %> + <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %> + <%= f.kindeditor :description,:editor_id => 'homework_description_editor_1' %> + <% end %> +
    • -
    • +
    • -     -文件不超过200MB + <%= render :partial => 'attachments/new_form', :locals => {:container => homework} %>
    • - - - + + + <%= calendar_for('homework_end_time')%>
    • -
    • +
    • -
    • + +
    • - + <%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>  分
    • diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index 239987035..6a67c17d1 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -24,7 +24,7 @@ <%= hidden_field_tag "homework_common_tyle","homework_detail_manual"%> <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> 提交 - 上一步 + 上一步 <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> <% end%>
    @@ -37,7 +37,7 @@ <%= hidden_field_tag "homework_common_tyle","homework_detail_programing"%> <%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> 提交 - 上一步 + 上一步 <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> <% end%>
  • From 61eb3ecc621e90a26bd9398a4fc1a501f1275e63 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 16 Jun 2015 14:45:57 +0800 Subject: [PATCH 005/100] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=BB=BA=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E4=B8=8A=E4=B8=80=E6=AD=A5=E4=B8=8B=E4=B8=80=E6=AD=A5?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E9=A1=B5=E9=9D=A2=E5=88=B7=E6=96=B0=202?= =?UTF-8?q?=E3=80=81=E4=B8=8B=E4=B8=80=E6=AD=A5=E8=B7=AF=E7=94=B1=E6=94=B9?= =?UTF-8?q?=E4=B8=BApost?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 11 +++- app/views/homework_common/new.html.erb | 56 +++++++------------ app/views/homework_common/next_step.html.erb | 31 ++++++++++ config/routes.rb | 2 +- public/javascripts/course.js | 21 +++++-- 5 files changed, 79 insertions(+), 42 deletions(-) create mode 100644 app/views/homework_common/next_step.html.erb diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 06bc1fd38..351feb979 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -1,6 +1,6 @@ class HomeworkCommonController < ApplicationController layout "base_courses" - before_filter :find_course, :only => [:index,:new,:create] + before_filter :find_course, :only => [:index,:new,:create,:next_step] before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy] before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] @@ -15,6 +15,15 @@ class HomeworkCommonController < ApplicationController end def new + respond_to do |format| + format.html + end + end + + #新建作业下一步 + def next_step + @homework_type = params[:homework_common_type] + @homework = HomeworkCommon.new @homework.safe_attributes = params[:homework_common] @homework.late_penalty = 0 diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index 6a67c17d1..bace02de9 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -1,45 +1,29 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor" %> <%= error_messages_for 'homework_common' %> -

    <%= l(:label_course_homework_new)%>

    -

    请选择将要发布的作业类型 -

    - 人工评分的作业(支持匿名互评、灵活设置评分比例) -
    - 自动评测的编程作业(支持C++程序的自动评分) -
    - 下一步 + <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%> + +

    + 请选择将要发布的作业类型 +

    + + + 人工评分的作业(支持匿名互评、灵活设置评分比例) + +
    + + + 自动评测的编程作业(支持C++程序的自动评分) + +
    + + 下一步 + + <% end%>
    -
    - -
    -
    - <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> - <%= hidden_field_tag "course",@course.id%> - <%= hidden_field_tag "homework_common_tyle","homework_detail_manual"%> - <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> - 提交 - 上一步 - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> - <% end%> -
    -
    -
    -
    -
    - <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> - <%= hidden_field_tag "course",@course.id%> - <%= hidden_field_tag "homework_common_tyle","homework_detail_programing"%> - <%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> - 提交 - 上一步 - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> - <% end%> -
    -
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/app/views/homework_common/next_step.html.erb b/app/views/homework_common/next_step.html.erb new file mode 100644 index 000000000..148379f9e --- /dev/null +++ b/app/views/homework_common/next_step.html.erb @@ -0,0 +1,31 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +<%= error_messages_for 'homework_common' %> +
    +

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

    +
    +<% if @homework_type == "1"%> +
    + <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> + <%= hidden_field_tag "course",@course.id%> + <%= hidden_field_tag "homework_common_tyle","homework_detail_manual"%> + <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> + 提交 + <%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <% end%> +
    +<% elsif @homework_type == "2"%> +
    + <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> + <%= hidden_field_tag "course",@course.id%> + <%= hidden_field_tag "homework_common_tyle","homework_detail_programing"%> + <%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> + 提交 + <%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <% end%> +
    +
    +<% end%> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index c92c732d2..dcdca73d4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -85,7 +85,7 @@ RedmineApp::Application.routes.draw do get 'alert_anonymous_comment' end collection do - + post 'next_step' end end diff --git a/public/javascripts/course.js b/public/javascripts/course.js index b493277fd..62769f2f5 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -396,15 +396,28 @@ function show_bid_dead_line(year,month,day,divname) } //新建作业,下一步按钮 -function select_homework_common_type() +function select_homework_common_type(url,course_id) { + var homework_common_type = ""; if($("#homework_detail_manual_radio").attr("checked") == "checked"){ - $("#homework_detail_manual").show(); + homework_common_type = "homework_detail_manual"; } else if($("#homework_detail_programing_radio").attr("checked") == "checked"){ - $("#homework_detail_programing").show(); + homework_common_type = "homework_detail_programing"; } - $("#hwork_new").hide(); + else{ + alert("未知错误,请联系管理员"); + return; + } + $.get( + url, + { + course: course_id, + homework_common_type: homework_common_type + }, + function (data) { + } + ); } //新建作业,上一步按钮 From dd8e8e38acdf202b6aa0e3b3b180626ba9670dd9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 16 Jun 2015 14:46:18 +0800 Subject: [PATCH 006/100] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/course.js | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 62769f2f5..85f718d31 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -395,39 +395,6 @@ function show_bid_dead_line(year,month,day,divname) + "

    作品提交还剩:

    "); } -//新建作业,下一步按钮 -function select_homework_common_type(url,course_id) -{ - var homework_common_type = ""; - if($("#homework_detail_manual_radio").attr("checked") == "checked"){ - homework_common_type = "homework_detail_manual"; - } - else if($("#homework_detail_programing_radio").attr("checked") == "checked"){ - homework_common_type = "homework_detail_programing"; - } - else{ - alert("未知错误,请联系管理员"); - return; - } - $.get( - url, - { - course: course_id, - homework_common_type: homework_common_type - }, - function (data) { - } - ); -} - -//新建作业,上一步按钮 -function return_homework_common_type() -{ - $("#homework_detail_manual").hide(); - $("#homework_detail_programing").hide(); - $("#hwork_new").show(); -} - //验证新建作业的名字 function regex_homework_name() { From ab88156d2f09ddfef1e00a833cdbde40e4a844ea Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 16 Jun 2015 17:55:07 +0800 Subject: [PATCH 007/100] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=83=A8=E5=88=86=E5=80=BC=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E3=80=81=E5=88=A0=E9=99=A4=E7=BC=96?= =?UTF-8?q?=E7=A8=8B=E4=BD=9C=E4=B8=9A=E6=B5=8B=E8=AF=95=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=20=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 58 +++++++++++++------ .../_homework_detail_programing_form.html.erb | 49 ++++++++-------- app/views/homework_common/new.html.erb | 2 - app/views/homework_common/next_step.html.erb | 3 +- public/javascripts/course.js | 20 +++++++ public/stylesheets/courses.css | 18 ++---- public/stylesheets/public.css | 1 + 7 files changed, 93 insertions(+), 58 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 351feb979..d4a5cab24 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -30,14 +30,22 @@ class HomeworkCommonController < ApplicationController @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') @homework.publish_time = Time.now.strftime('%Y-%m-%d') - #匿评作业相关属性 - @homework_detail_manual = HomeworkDetailManual.new - @homework_detail_manual.ta_proportion = 0.6 - @homework_detail_manual.absence_penalty = 0 - @homework_detail_manual.evaluation_num = 3 - @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') - @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - @homework.homework_detail_manual = @homework_detail_manual + if @homework_type == "1" + #匿评作业相关属性 + @homework_detail_manual = HomeworkDetailManual.new + @homework_detail_manual.ta_proportion = 0.6 + @homework_detail_manual.absence_penalty = 0 + @homework_detail_manual.evaluation_num = 3 + @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') + @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + @homework.homework_detail_manual = @homework_detail_manual + elsif @homework_type == "2" + #编程作业相关属性 + @homework_detail_programing = HomeworkDetailPrograming.new + @homework.homework_detail_programing = @homework_detail_programing + end + + respond_to do |format| format.html end @@ -58,15 +66,31 @@ class HomeworkCommonController < ApplicationController homework.save_attachments(params[:attachments]) render_attachment_warning_if_needed(homework) - #匿评作业相关属性 - homework_detail_manual = HomeworkDetailManual.new - homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 - homework_detail_manual.comment_status = 1 - homework_detail_manual.evaluation_start = params[:evaluation_start] - homework_detail_manual.evaluation_end = params[:evaluation_end] - homework_detail_manual.evaluation_num = params[:evaluation_num] - homework_detail_manual.absence_penalty = params[:absence_penalty] - homework.homework_detail_manual = homework_detail_manual + if homework.homework_type == 2 + homework_detail_programing = HomeworkDetailPrograming.new + homework_detail_programing.language = "C++" + homework_detail_programing.standard_code = params[:standard_code] + + if params[:input] && params[:output] + params[:input].each do |k,v| + if params[:output][k] + + end + end + end + + homework.homework_detail_programing = homework_detail_programing + else + #匿评作业相关属性 + homework_detail_manual = HomeworkDetailManual.new + homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 + homework_detail_manual.comment_status = 1 + homework_detail_manual.evaluation_start = params[:evaluation_start] + homework_detail_manual.evaluation_end = params[:evaluation_end] + homework_detail_manual.evaluation_num = params[:evaluation_num] + homework_detail_manual.absence_penalty = params[:absence_penalty] + homework.homework_detail_manual = homework_detail_manual + end if homework.save respond_to do |format| diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index 12e6b7074..1a1804275 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -1,6 +1,6 @@
    \ No newline at end of file diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index bace02de9..ece4af158 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -1,5 +1,3 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> -<%= error_messages_for 'homework_common' %>

    <%= l(:label_course_homework_new)%> diff --git a/app/views/homework_common/next_step.html.erb b/app/views/homework_common/next_step.html.erb index 148379f9e..75e9f4c0a 100644 --- a/app/views/homework_common/next_step.html.erb +++ b/app/views/homework_common/next_step.html.erb @@ -9,7 +9,6 @@
    <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> <%= hidden_field_tag "course",@course.id%> - <%= hidden_field_tag "homework_common_tyle","homework_detail_manual"%> <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> 提交 <%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> @@ -20,7 +19,7 @@
    <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> <%= hidden_field_tag "course",@course.id%> - <%= hidden_field_tag "homework_common_tyle","homework_detail_programing"%> + <%= hidden_field_tag "homework_common[homework_type]","2"%> <%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> 提交 <%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 85f718d31..0b3d78fc4 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -415,6 +415,7 @@ function regex_homework_name() //验证匿评数量 function regex_evaluation_num() { + if($("#evaluation_num").length == 0){ return true;} var evaluation_num = $.trim($("#evaluation_num").val()); var regex = /^\d+$/; if(evaluation_num=="") @@ -502,6 +503,25 @@ function submit_homework(id) } } +//增加测试结果 +function add_programing_test(obj) { + var now = new Date().getTime(); + obj.after("
  • " + + "
  • " + + "
  • " + + "" + + "测试
  • "); +} +//删除测试结果 +function remove_programing_test(obj) { + if(obj.siblings("div").length == 0){ + alert("至少需要一组测试"); + } + else{ + obj.remove(); + } +} + function show_window (id1,id2,top,left) { $('#'+ id1).css('top',top); $('#'+ id1).css('left',left); diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 769136f2d..3835559fa 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -551,19 +551,7 @@ a.wzan_visited{background:url(../images/new_project/public_icon.png) 0px -503px a.files_tag_icon{ background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px; } a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #64bdd9; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px;} -/* 20150423作业评分*/ -.ml14{ margin-left:14px;} -.w548{ width:552px;} -.w547{ width:544px;} -.w196{ width:182px;} -.w459{ width:459px;} -.hwork_new_set{border:1px dashed #CCC; background:#f5f5f5; text-align:center; padding:10px 0; margin-bottom:10px;} -.hwork_new_grey{background:#dbdbdb; width:610px; padding:10px 20px; margin:0 auto; text-align:left; margin-bottom:5px;} -.hwork_new_left{ width:220px; float:left; } -.hwork_new_right{ width:350px; float:left; margin-left:40px;} -.w305{ width:305px;} -.icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;} -a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;} + /* 20150505讨论区*/ .w664{ width:664px;} @@ -599,10 +587,12 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} /*.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;}*/ #about_newtalk{ display:none;} +/* 20150423作业评分*/ .ml14{ margin-left:14px;} .w548{ width:552px;} .w547{ width:544px;} .w196{ width:196px;} +.w186{ width:186px;} .w459{ width:459px;} .hwork_new_set{border:1px dashed #CCC; background:#f5f5f5; text-align:center; padding:10px 0; margin-bottom:10px;} .hwork_new_grey{background:#dbdbdb; width:610px; padding:10px 20px; margin:0 auto; text-align:left; margin-bottom:5px;} @@ -611,6 +601,8 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} .w305{ width:305px;} .icon_add{background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;} a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;} +.icon_remove{background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:left;} +a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;} /* 20150506上传头像*/ .uppicBox{ width:265px; height:265px; background:#f2f2f5; float:left; color:#666; text-align:center;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 5b00dbd57..62f169126 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -77,6 +77,7 @@ h4{ font-size:14px; color:#3b3b3b;} .mr50{margin-right: 50px;} .mr55{margin-right: 55px;} .mr70{margin-right: 70px;} +.mt1{margin-top: 1px;} .mt3{ margin-top:3px;} .mt5{ margin-top:5px;} .mt8{ margin-top:8px;} From 24970ce580a9f7de35d16a760bb10b118f11ac56 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 17 Jun 2015 09:58:01 +0800 Subject: [PATCH 008/100] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index d4a5cab24..bfac1432f 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -73,8 +73,11 @@ class HomeworkCommonController < ApplicationController if params[:input] && params[:output] params[:input].each do |k,v| - if params[:output][k] - + if params[:output].include? k + homework_test = HomeworkTest.new + homework_test.input = v + homework_test.output = params[:output][k] + homework.homework_tests << homework_test end end end From 02d7215f6f51d9cd73977193afed1183a3cd65d0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 17 Jun 2015 10:03:00 +0800 Subject: [PATCH 009/100] =?UTF-8?q?=E7=BC=96=E8=BE=91=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_homework_detail_programing_form.html.erb | 19 ++++++++++++++++++- app/views/homework_common/edit.html.erb | 16 ++++++++++++---- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index 1a1804275..7b732d7c3 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -67,7 +67,24 @@ <% if edit_mode %> - + <% homework.homework_tests.each_with_index do |homework_test,i|%> +
    +
  • + + +
  • +
  • + + +
  • +
  • + + + 测试 +
  • +
    +
    + <% end%> <% else %>
  • diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index 87977c6a9..fc5596437 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -7,10 +7,18 @@
  • - <%= form_for @homework do |f| %> - <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> - 提交 - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <%if @homework.homework_type == 2%> + <%= form_for @homework do |f| %> + <%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> + 提交 + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <% end%> + <% else %> + <%= form_for @homework do |f| %> + <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> + 提交 + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <% end%> <% end%>
    \ No newline at end of file From d23189b93374baa453b7586ef0125c0ea0f41d23 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 17 Jun 2015 10:05:10 +0800 Subject: [PATCH 010/100] =?UTF-8?q?=E5=B7=B2=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E8=BE=93=E5=87=BA=E6=B5=8B=E8=AF=95=E7=9A=84?= =?UTF-8?q?name=E6=94=B9=E4=B8=BA=E6=B5=8B=E8=AF=95=E7=9A=84id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_homework_detail_programing_form.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index 7b732d7c3..6808f8cfe 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -67,15 +67,15 @@ <% if edit_mode %> - <% homework.homework_tests.each_with_index do |homework_test,i|%> + <% homework.homework_tests.each do |homework_test|%>
  • - +
  • - +
  • From b95259566019f548e724602d8b65d584db6a24c0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 17 Jun 2015 10:29:41 +0800 Subject: [PATCH 011/100] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index bfac1432f..dad01c79f 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -125,22 +125,54 @@ class HomeworkCommonController < ApplicationController @homework.description = params[:homework_common][:description] @homework.end_time = params[:homework_common][:end_time] @homework.publish_time = params[:homework_common][:publish_time] - @homework.homework_type = params[:homework_common][:homework_type] @homework.late_penalty = params[:late_penalty] @homework.user_id = User.current.id @homework.course_id = @course.id - #匿评作业相关属性 - @homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 - @homework_detail_manual.evaluation_start = params[:evaluation_start] - @homework_detail_manual.evaluation_end = params[:evaluation_end] - @homework_detail_manual.evaluation_num = params[:evaluation_num] - @homework_detail_manual.absence_penalty = params[:absence_penalty] + @homework_detail_programing = @homework.homework_detail_programing + if @homework.homework_type == 2 #编程作业 + @homework_detail_programing.language = "C++" + @homework_detail_programing.standard_code = params[:standard_code] + homework_tests = @homework.homework_tests + #需要删除的测试 + ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i) + ids.each do |id| + homework_test = HomeworkTest.find id + homework_test.destroy if homework_test + end + + if params[:input] && params[:output] + params[:input].each do |k,v| + if params[:output].include? k + homework_test = HomeworkTest.find_by_id k + if homework_test #已存在的测试,修改 + homework_test.input = v + homework_test.output = params[:output][k] + else #不存在的测试,增加 + homework_test = HomeworkTest.new + homework_test.input = v + homework_test.output = params[:output][k] + homework_test.homework_common = @homework + end + homework_test.save + end + end + end + else + #匿评作业相关属性 + @homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 + @homework_detail_manual.evaluation_start = params[:evaluation_start] + @homework_detail_manual.evaluation_end = params[:evaluation_end] + @homework_detail_manual.evaluation_num = params[:evaluation_num] + @homework_detail_manual.absence_penalty = params[:absence_penalty] + end @homework.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@homework) - if @homework.save && @homework_detail_manual.save + if @homework.save + @homework_detail_manual.save if @homework_detail_manual + @homework_detail_programing.save if @homework_detail_programing respond_to do |format| format.html { flash[:notice] = l(:notice_successful_edit) From 71ab5ed74f0c1a304285608c785650f30fac2e1c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 19 Jun 2015 15:08:00 +0800 Subject: [PATCH 012/100] 111 --- app/views/bids/new_contest.html.erb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/bids/new_contest.html.erb b/app/views/bids/new_contest.html.erb index 216816bd1..899aea1e7 100644 --- a/app/views/bids/new_contest.html.erb +++ b/app/views/bids/new_contest.html.erb @@ -1,10 +1,10 @@ - -

    <%=l(:label_newtype_contest)%>

    + + -<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_contest'} do |f| %> -
    - <%= render :partial => 'form_contest', :locals => { :f => f } %> - <%= submit_tag l(:button_create) %> - <%= javascript_tag "$('#bid_name').focus();" %> - <% end %> -
    \ No newline at end of file + + + + + + + \ No newline at end of file From e734abe613c2962d453566ccefce1b94756835d3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 6 Jul 2015 10:44:27 +0800 Subject: [PATCH 013/100] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E6=A2=B3=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 6b92e8198..3c3a42b69 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -133,19 +133,8 @@ class HomeworkCommonController < ApplicationController end @homework.late_penalty = params[:late_penalty] end - @homework.course_id = @course.id + # @homework.course_id = @course.id - @homework_detail_programing = @homework.homework_detail_programing - if @homework.homework_type == 2 #编程作业 - @homework_detail_programing.language = "C++" - @homework_detail_programing.standard_code = params[:standard_code] - homework_tests = @homework.homework_tests - #需要删除的测试 - ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i) - ids.each do |id| - homework_test = HomeworkTest.find id - homework_test.destroy if homework_test - end #匿评作业相关属性 if @homework.homework_type == 1 @homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 @@ -171,6 +160,16 @@ class HomeworkCommonController < ApplicationController @homework_detail_manual.absence_penalty = 0 end + if @homework.homework_type == 2 #编程作业 + @homework_detail_programing.language = "C++" + @homework_detail_programing.standard_code = params[:standard_code] + homework_tests = @homework.homework_tests + #需要删除的测试 + ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i) + ids.each do |id| + homework_test = HomeworkTest.find id + homework_test.destroy if homework_test + end if params[:input] && params[:output] params[:input].each do |k,v| if params[:output].include? k @@ -188,13 +187,6 @@ class HomeworkCommonController < ApplicationController end end end - else - #匿评作业相关属性 - @homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 - @homework_detail_manual.evaluation_start = params[:evaluation_start] - @homework_detail_manual.evaluation_end = params[:evaluation_end] - @homework_detail_manual.evaluation_num = params[:evaluation_num] - @homework_detail_manual.absence_penalty = params[:absence_penalty] end @homework.save_attachments(params[:attachments]) From 23f6941001a6a2f1b9839a312d777d0571d8dcb1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 6 Jul 2015 16:28:33 +0800 Subject: [PATCH 014/100] =?UTF-8?q?1=E3=80=81=E7=BC=96=E7=A8=8B=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E8=BF=9F=E4=BA=A4=E6=89=A3=E5=88=86=E7=9A=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=202=E3=80=81=E4=BF=AE=E6=94=B9=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=97=B6=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 9 +++++---- .../_homework_detail_programing_form.html.erb | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 3c3a42b69..7a3b2b6c2 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -136,7 +136,7 @@ class HomeworkCommonController < ApplicationController # @homework.course_id = @course.id #匿评作业相关属性 - if @homework.homework_type == 1 + if @homework.homework_type == 1 && @homework_detail_manual @homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 @homework_detail_manual.evaluation_start = params[:evaluation_start] @homework_detail_manual.evaluation_end = params[:evaluation_end] @@ -152,15 +152,15 @@ class HomeworkCommonController < ApplicationController end @homework_detail_manual.absence_penalty = params[:absence_penalty] end - else #不是匿评作业,缺评扣分为0分,每个作品的缺评扣分改为0分,防止某些作业在结束匿评之后改为普通作业 + elsif @homework.homework_type == 0 #普通作业,缺评扣分为0分,每个作品的缺评扣分改为0分,防止某些作业在结束匿评之后改为普通作业 @homework.student_works.where("absence_penalty != 0").each do |student_work| student_work.late_penalty = 0 student_work.save end - @homework_detail_manual.absence_penalty = 0 + @homework_detail_manual.absence_penalty = 0 if @homework_detail_manual end - if @homework.homework_type == 2 #编程作业 + if @homework.homework_type == 2 && @homework_detail_programing #编程作业 @homework_detail_programing.language = "C++" @homework_detail_programing.standard_code = params[:standard_code] homework_tests = @homework.homework_tests @@ -293,6 +293,7 @@ class HomeworkCommonController < ApplicationController def find_homework @homework = HomeworkCommon.find params[:id] @homework_detail_manual = @homework.homework_detail_manual + @homework_detail_programing = @homework.homework_detail_programing @course = @homework.course rescue render_404 diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index 6808f8cfe..399e8355e 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -40,15 +40,16 @@ <%= calendar_for('homework_publish_time')%>
  • -
    -
  • +
  • <%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>  分
  • + +

    编程评测设置

    From ec051ef929f16e694b13ffbce7e8c2057e7fee44 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 7 Jul 2015 15:47:48 +0800 Subject: [PATCH 015/100] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E8=80=81=E5=B8=88=E3=80=81=E5=AD=A6=E7=94=9F=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 4 +++- app/views/homework_common/index.html.erb | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a31bd6189..c4762e8cc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2292,6 +2292,8 @@ module ApplicationHelper else link = "启动匿评".html_safe end + elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业作业 + link = "编程作业".html_safe else link = "启动匿评".html_safe end @@ -2324,7 +2326,7 @@ module ApplicationHelper elsif homework.homework_type == 0 "未启用匿评".html_safe elsif homework.homework_type == 2 - "编程作业".html_safe + " 编程作业  ".html_safe end end diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index 870edbfe4..d9a93fe8f 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -68,8 +68,6 @@ ,缺评一个作品扣 <%= homework.homework_detail_manual.absence_penalty%> 分 - <% else%> - 。 <% end%>
    From 515c854f0f702df2e8afc455bc65c459b3e9a499 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Jul 2015 09:49:24 +0800 Subject: [PATCH 016/100] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81=E6=97=B6=E4=B8=8D=E7=8E=B0?= =?UTF-8?q?=E5=AE=9E=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE=E3=80=81=E9=99=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/new.html.erb | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index b4162c4da..500a0ccd3 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -33,9 +33,12 @@

    <%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %> - 项目信息 - - + <% if @homework.homework_type != 2%> + + 项目信息 + + + <% end%>

    @@ -52,11 +55,13 @@

    -

    - - <%= render :partial => 'attachments/new_form' %> -

    -
    + <% if @homework.homework_type != 2%> +

    + + <%= render :partial => 'attachments/new_form' %> +

    +
    + <% end%>

    提交作品 <%= link_to "返  回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%> From 17a9a1023a9a239ac489a325bf6fa2efb393649b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Jul 2015 10:58:03 +0800 Subject: [PATCH 017/100] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=96=E7=A8=8B?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E4=B8=AD=E6=95=99=E8=BE=85=E6=AF=94=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20150708025533_add_proportion_to_programing.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrate/20150708025533_add_proportion_to_programing.rb diff --git a/db/migrate/20150708025533_add_proportion_to_programing.rb b/db/migrate/20150708025533_add_proportion_to_programing.rb new file mode 100644 index 000000000..b3da59c25 --- /dev/null +++ b/db/migrate/20150708025533_add_proportion_to_programing.rb @@ -0,0 +1,9 @@ +class AddProportionToPrograming < ActiveRecord::Migration + def up + add_column :homework_detail_programings, :ta_proportion, :float, :default => 0.1 + end + + def down + remove_column :homework_detail_programings, :ta_proportion + end +end From 9a2cb324ab6dc9a909b57cd34dd64527d8de4c21 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Jul 2015 11:17:36 +0800 Subject: [PATCH 018/100] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E7=94=B1=E5=8C=BF=E8=AF=84=E4=BD=9C=E4=B8=9A=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=99=AE=E9=80=9A=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 7a3b2b6c2..4ea590d54 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -126,6 +126,7 @@ class HomeworkCommonController < ApplicationController @homework.description = params[:homework_common][:description] @homework.end_time = params[:homework_common][:end_time] @homework.publish_time = params[:homework_common][:publish_time] + @homework.homework_type = params[:homework_common][:homework_type] unless @homework.late_penalty == params[:late_penalty] @homework.student_works.where("created_at > '#{@homework.end_time} 23:59:59'").each do |student_work| student_work.late_penalty = params[:late_penalty] From 6af6fdd5a396f76cdd1e4b3c890c444b4bb0620d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Jul 2015 11:17:59 +0800 Subject: [PATCH 019/100] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=88=86=E9=85=8D=E6=AF=94=E4=BE=8B=E6=B7=BB=E5=8A=A0=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E7=95=8C=E9=9D=A2=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_homework_detail_programing_form.html.erb | 17 +++++++++++++++++ db/schema.rb | 7 ++++--- public/javascripts/course.js | 19 +++++++++++-------- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index 399e8355e..008f88138 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -61,6 +61,23 @@

    + +
  • + + <%= select_tag :ta_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "fl mb10 h26 w70"} %> + × 教辅评分 +   +   + + × 系统评分 + = 学生得分 +
    +
  • +
  • + + 如果教师对学生作品进行了评分,则教师评分为学生最终得分。 +
    +
  • +
  • diff --git a/db/schema.rb b/db/schema.rb index 988d5649a..4016cd6a9 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 => 20150702073308) do +ActiveRecord::Schema.define(:version => 20150708025533) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -586,8 +586,9 @@ ActiveRecord::Schema.define(:version => 20150702073308) do t.string "language" t.text "standard_code", :limit => 2147483647 t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "ta_proportion", :default => 0.1 end create_table "homework_evaluations", :force => true do |t| diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 3dc30404d..8db456cbf 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -473,15 +473,18 @@ $(function(){ }); //第一次加载时,如果未开启匿评作业,隐藏显示匿评配置信息 $(function(){ - if($("#homework_common_homework_type").attr("checked") == "checked") + if($("#homework_common_homework_type").attr("id") != null && $("#homework_common_homework_type").val() != 2) { - $("#evaluation_setting").show(); - $("#ta_proportion").removeAttr("disabled"); - } - else - { - $("#evaluation_setting").hide(); - $("#ta_proportion").attr("disabled","disabled"); + if($("#homework_common_homework_type").attr("checked") == "checked") + { + $("#evaluation_setting").show(); + $("#ta_proportion").removeAttr("disabled"); + } + else + { + $("#evaluation_setting").hide(); + $("#ta_proportion").attr("disabled","disabled"); + } } }); From 7ada5db28e38a85b578f95ec27bfb955546d5335 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Jul 2015 16:14:54 +0800 Subject: [PATCH 020/100] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E6=97=B6=EF=BC=8C=E7=BC=96=E7=A8=8B=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=EF=BC=8C=E7=B3=BB=E7=BB=9F=E8=AF=84=E5=88=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E9=A2=84=E7=95=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index cc858cc19..429f787e5 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -42,7 +42,6 @@ class StudentWorkController < ApplicationController end end @homework_commons = @course.homework_commons.order("created_at desc") - @homework_commons = @course.homework_commons.order("created_at desc") @score = @b_sort == "desc" ? "asc" : "desc" respond_to do |format| format.html @@ -80,6 +79,11 @@ class StudentWorkController < ApplicationController stundet_work.late_penalty = 0 end render_attachment_warning_if_needed(stundet_work) + + if @homework.homework_type == 2 #编程作业,学生提交作品后计算系统得分 + + end + if stundet_work.save respond_to do |format| format.html { From dc01b90dbdcdc1003b3b7be20a6ddf2797cd1ea8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Jul 2015 16:24:47 +0800 Subject: [PATCH 021/100] =?UTF-8?q?=E5=8C=BF=E8=AF=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student_work/_evaluation_student_work_title.html.erb | 8 ++++++-- app/views/student_work/index.html.erb | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/student_work/_evaluation_student_work_title.html.erb b/app/views/student_work/_evaluation_student_work_title.html.erb index 0e4151065..a95106a48 100644 --- a/app/views/student_work/_evaluation_student_work_title.html.erb +++ b/app/views/student_work/_evaluation_student_work_title.html.erb @@ -29,8 +29,12 @@ <% end%>
  • -
  • - <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> +
  • + <% if @homework.homework_type == 1%> + <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <% elsif @homework.homework_type == 2%> + <%= link_to "系统",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <% end %> <% if @show_all && @order == "student_score"%> <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%> diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 76ae71459..70f7c08f4 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -89,7 +89,7 @@
    <% end%> <% else %> - <% if @homework.homework_type == 1%> + <% if @homework.homework_type == 1 || @homework.homework_type == 2%> From 2fb76458b6016e1effb16b3fd928489cac945fa2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Jul 2015 16:33:18 +0800 Subject: [PATCH 022/100] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=9D=99=E6=80=81=E9=A1=B5=E9=9D=A2=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_programing_work_show.html.erb | 72 +++++++++++++++++++ app/views/student_work/show.js.erb | 6 +- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 app/views/student_work/_programing_work_show.html.erb diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb new file mode 100644 index 000000000..c231ab94b --- /dev/null +++ b/app/views/student_work/_programing_work_show.html.erb @@ -0,0 +1,72 @@ +
    +
    +
      +
    • 上交时间:2015-05-07
    • +
    • 赞(10)
    • +
      +
    • 参与人员:程梦雯  王强
    • +
    • 关联项目:Trustie Forge
    • +
    • 编程代码:

      编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码

    • +
    • 测试结果: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      测试结果一错误0
      测试结果二正确20
      测试结果三正确20
      测试结果四正确20
      测试结果五正确20
      最后得分 80
      +
      +
    • +
    • 评价:
    • + +
    • 评分:
    • +
    • 批阅结果:    -文件不超过200MB提交
    • +
    +
    + + + +
    + 收起 +
    +
    \ No newline at end of file diff --git a/app/views/student_work/show.js.erb b/app/views/student_work/show.js.erb index fa12e097d..1c8874c2f 100644 --- a/app/views/student_work/show.js.erb +++ b/app/views/student_work/show.js.erb @@ -2,6 +2,10 @@ if($("#about_hwork_<%= @work.id%>").children().length > 0) {$("#about_hwork_<%= @work.id%>").html("");} else { - $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>"); + <% if @homework.homework_type == 2%> + $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show') %>"); + <% else%> + $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>"); + <% end%> $('#score_<%= @work.id%>').peSlider({range: 'min'}); } \ No newline at end of file From 2eff8cce6a9fe43ec8dfc3750edd55c5c9a05fe3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Jul 2015 16:38:34 +0800 Subject: [PATCH 023/100] =?UTF-8?q?=E6=9B=B4=E6=96=B0css=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/courses.css | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 5f7e7eebd..a6d8ff0a2 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -30,6 +30,10 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} .box_h3{ color:#15bccf; text-align:center; font-size:16px;} .box_p{ color:#404040; margin-bottom:5px;} .fb_item{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:10px; padding-left:5px; width:290px;} +a.icon_addm{ background:url(../images/img_floatbox.png) 0 -33px no-repeat; width:16px; height:16px; display:block; margin:5px 0 0 5px;} +a:hover.icon_addm{background:url(../images/img_floatbox.png) 0 -61px no-repeat; } +a.icon_removem{ background:url(../images/img_floatbox.png) -22px -33px no-repeat;width:16px; height:16px; display:block; margin:5px 0 0 5px} +a:hover.icon_removem{background:url(../images/img_floatbox.png) -22px -61px no-repeat;} a.btn_free{ background:#ff5722; display:block; width:80px; text-align:center; color:#fff; height:26px; padding-top:3px; margin-bottom:10px;} a:hover.btn_free{ background:#d63502;} /*成员邀请*/ @@ -338,7 +342,6 @@ a:hover.st_add{ color:#ff8e15;} .upbtn{ margin:40px 0 0 15px; display:block; padding:2px 5px; border:1px solid #eaeaea;} .upbtn:hover{border:1px solid #64bdd9; color:#64bdd9;cursor: pointer;} .upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer} - /* 功能倒计时*/ .w_img{ float:left; margin:10px 10px 15px 0px;} .w_p{ float:left; color:#15bccf; font-size:16px; font-weight:bold; margin-top:70px; } @@ -349,7 +352,9 @@ a:hover.st_add{ color:#ff8e15;} .upload_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; margin-top:25px; padding-left:20px; padding-top:5px;} .upload_box{ width:430px; margin:15px auto;} +a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; } a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;} +.r_txt_tit{width:510px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;} blockquote {background: #eeeeee;padding: 10px;margin-bottom: 10px;word-break: break-all;word-wrap: break-word;} .respond-form{display: none;margin: auto;clear: both;} @@ -550,7 +555,19 @@ a.wzan_visited{background:url(../images/new_project/public_icon.png) 0px -503px a.files_tag_icon{ background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px; } a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #64bdd9; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px;} - +/* 20150423作业评分*/ +.ml14{ margin-left:14px;} +.w548{ width:552px;} +.w547{ width:544px;} +.w196{ width:182px;} +.w459{ width:459px;} +.hwork_new_set{border:1px dashed #CCC; background:#f5f5f5; text-align:center; padding:10px 0; margin-bottom:10px;} +.hwork_new_grey{background:#dbdbdb; width:610px; padding:10px 20px; margin:0 auto; text-align:left; margin-bottom:5px;} +.hwork_new_left{ width:220px; float:left; } +.hwork_new_right{ width:350px; float:left; margin-left:40px;} +.w305{ width:305px;} +.icon_add{ background:url(../stylesheets/images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;} +a:hover.icon_add{background:url(../stylesheets/images/icons.png) -20px -310px no-repeat;} /* 20150505讨论区*/ .w664{ width:664px;} @@ -648,6 +665,7 @@ a:hover.ping_pic{border:1px solid #64bdd9;} a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; text-align:center; display:block;} a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;} .fr{ float:right;} +.min_search{ width:200px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/public_icon.png) 185px -193px no-repeat; cursor:pointer;} .li_min_search{ float:right; margin-right:-10px;} .info_ni_download{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 200px;margin-top: 10px;} .info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 50px;margin-top: -5px;} @@ -666,6 +684,12 @@ input#score{ width:40px;} .ui-slider .ui-slider-handle:hover,.ui-slider .ui-slider-handle:focus{background:#64bdd9;} .ui-slider .ui-slider-handle:active{background-image:none;} .ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;top:0;height:100%;background:#64bdd9;left:0;} +/* 编程作品 */ +.border_ce{ border:1px solid #e4e4e4; } +.border_ce tr td{ height:26px; } +.td_tit{width:155px; text-align:center;} +.td_50{width:50px; text-align:center;} +a.work_list_tit{width:610px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} .filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} .evaluation{position: relative;} From 2ed2ba97fa48633bfd2f61aa4104749ed20d420d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Jul 2015 16:54:27 +0800 Subject: [PATCH 024/100] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E5=93=81sho?= =?UTF-8?q?w=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_programing_work_show.html.erb | 103 ++++++++---------- 1 file changed, 46 insertions(+), 57 deletions(-) diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index c231ab94b..80284dac0 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -1,72 +1,61 @@
      -
    • 上交时间:2015-05-07
    • -
    • 赞(10)
    • +
    • + + 上交时间: + + <%=format_time @work.created_at %> +
    • + <% if @work.user != User.current%> + +
    • + <%= render :partial => 'student_work_praise' %> +
    • + <% end%>
      -
    • 参与人员:程梦雯  王强
    • -
    • 关联项目:Trustie Forge
    • -
    • 编程代码:

      编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码编程作品代码

    • +
    • + + 编程代码: + +
      + <%= textilizable @work.description%> +
      +
      +
    • 测试结果: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + <%@homework.homework_tests.each do |test|%> + "> + + + + + + <% end%>
      测试结果一错误0
      测试结果二正确20
      测试结果三正确20
      测试结果四正确20
      测试结果五正确20
      最后得分 80
      + <%= test.input%> + + <%= test.output%> + 错误0
    • -
    • 评价:
    • - -
    • 评分:
    • -
    • 批阅结果:    -文件不超过200MB提交
    • + <% if @is_teacher%> + +
      + <%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%> +
      + <% end%>
    -
    - - +
    + <%@work.student_works_scores.order("updated_at desc").each do |score|%> +
    + <%= render :partial => 'student_work_score',:locals => {:score => score}%> +
    + <% end%>
    - 收起 -
    + 收起
    \ No newline at end of file From 8f3ac85fec83888be61bd797919b2540fddb87f9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 8 Jul 2015 17:19:11 +0800 Subject: [PATCH 025/100] =?UTF-8?q?1=E3=80=81=E4=BD=9C=E4=B8=9A=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=E3=80=81=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=AD=97=E6=AE=B5=E6=94=B9=E4=B8=BAlongtext=202?= =?UTF-8?q?=E3=80=81=E6=8F=90=E4=BA=A4=E4=BD=9C=E4=B8=9A=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BF=AE=E6=94=B9=203=E3=80=81=E7=BC=96?= =?UTF-8?q?=E7=A8=8B=E4=BD=9C=E4=B8=9A=E4=B8=8D=E5=8F=AF=E4=BB=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=92=8C=E5=88=A0=E9=99=A4control=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 12 +++++++++--- app/views/student_work/edit.html.erb | 8 -------- app/views/student_work/new.html.erb | 8 ++++++-- .../20150708085629_change_studen_work_desc.rb | 9 +++++++++ db/schema.rb | 14 +++++++------- 5 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 db/migrate/20150708085629_change_studen_work_desc.rb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 429f787e5..0efa0aa66 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -103,8 +103,12 @@ class StudentWorkController < ApplicationController end def edit - respond_to do |format| - format.html + if @homework.homework_type == 2 #编程作业不能修改作业 + render_403 + else + respond_to do |format| + format.html + end end end @@ -139,7 +143,9 @@ class StudentWorkController < ApplicationController end def destroy - if @work.destroy + if @homework.homework_type == 2 #编程作业,作品提交后不可以删除 + render_403 + elsif @work.destroy respond_to do |format| format.html { redirect_to student_work_index_url(:homework => @homework.id) diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index dfa995f47..6e36447d2 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -2,14 +2,6 @@

    编辑作品

    - - - - - - - -
    <%= labelled_form_for @work,:html => { :multipart => true } do |f|%> diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 500a0ccd3..eda09114e 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -49,8 +49,12 @@

    - - <%= f.text_area "description", :class => "w620 hwork_txt ", :maxlength => 3000, :placeholder => "最多3000个汉字", :onkeyup => "regexStudentWorkDescription();"%> + + <%= f.text_area "description", :class => "w620 hwork_txt ", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>

    diff --git a/db/migrate/20150708085629_change_studen_work_desc.rb b/db/migrate/20150708085629_change_studen_work_desc.rb new file mode 100644 index 000000000..af3c25671 --- /dev/null +++ b/db/migrate/20150708085629_change_studen_work_desc.rb @@ -0,0 +1,9 @@ +class ChangeStudenWorkDesc < ActiveRecord::Migration + def up + change_column :student_works,:description,:text,:limit => 4294967295 + end + + def down + change_column :student_works,:description,:text + end +end diff --git a/db/schema.rb b/db/schema.rb index 4016cd6a9..539dd95d3 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 => 20150708025533) do +ActiveRecord::Schema.define(:version => 20150708085629) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1222,18 +1222,18 @@ ActiveRecord::Schema.define(:version => 20150708025533) do create_table "student_works", :force => true do |t| t.string "name" - t.text "description" + t.text "description", :limit => 2147483647 t.integer "homework_common_id" t.integer "user_id" t.float "final_score" t.float "teacher_score" t.float "student_score" t.float "teaching_asistant_score" - t.integer "project_id", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "late_penalty", :default => 0 - t.integer "absence_penalty", :default => 0 + t.integer "project_id", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "late_penalty", :default => 0 + t.integer "absence_penalty", :default => 0 end create_table "student_works_evaluation_distributions", :force => true do |t| From eb1976efbbeb5adaafe9a6154ef32659ef86562a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 9 Jul 2015 10:38:44 +0800 Subject: [PATCH 026/100] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=EF=BC=8C=E6=9C=80=E7=BB=88=E8=AF=84=E5=88=86=E7=9A=84=E8=AE=A1?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 0efa0aa66..b6f69a4da 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -190,8 +190,10 @@ class StudentWorkController < ApplicationController if @work.student_score.nil? @work.final_score = @work.teaching_asistant_score else - final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}") - final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}")) + ta_proportion = @homework.homework_detail_manual.ta_proportion if @homework.homework_detail_manual + ta_proportion = @homework.homework_detail_programing.ta_proportion if @homework.homework_detail_programing + final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}") + final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) final_score = final_ta_score + final_s_score @work.final_score = format("%.2f",final_score.to_f) end From 24d6c8e17e83b80d552864490b4dc9527a009831 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 9 Jul 2015 15:20:59 +0800 Subject: [PATCH 027/100] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E8=A1=A8=E5=A2=9E=E5=8A=A0question=5Fid=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20150709071731_add_question_id_to_homework.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 db/migrate/20150709071731_add_question_id_to_homework.rb diff --git a/db/migrate/20150709071731_add_question_id_to_homework.rb b/db/migrate/20150709071731_add_question_id_to_homework.rb new file mode 100644 index 000000000..d1be59431 --- /dev/null +++ b/db/migrate/20150709071731_add_question_id_to_homework.rb @@ -0,0 +1,9 @@ +class AddQuestionIdToHomework < ActiveRecord::Migration + def up + add_column :homework_detail_programings, :question_id, :integer + end + + def down + remove_column :homework_detail_programings, :question_id + end +end From 5c011fd3429b6df35f1ee4178bf1e9291e7247ba Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Thu, 9 Jul 2015 15:27:49 +0800 Subject: [PATCH 028/100] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/my_controller.rb | 24 + app/controllers/users_controller.rb | 283 +++- app/controllers/watchers_controller.rb | 7 +- app/helpers/users_helper.rb | 155 +++ app/views/avatar/upload.js.erb | 6 +- app/views/courses/finishcourse.js.erb | 10 +- app/views/layouts/_base_footer_new.html.erb | 13 + app/views/layouts/_base_header_new.html.erb | 76 + app/views/layouts/_user_fans_list.html.erb | 12 + app/views/layouts/_user_watch_btn.html.erb | 8 + app/views/layouts/_user_watch_list.html.erb | 11 + app/views/layouts/base_users_new.html.erb | 337 +++++ app/views/my/account.html.erb | 1227 +++++++---------- app/views/my/clear_user_avatar_temp.js.erb | 7 + app/views/my/save_user_avatar.js.erb | 2 + app/views/users/_course_form.html.erb | 118 +- app/views/users/_user_fans_item.html.erb | 50 + app/views/users/show.html.erb | 968 +++++-------- .../users/user_course_activities.html.erb | 12 + app/views/users/user_courses.html.erb | 62 +- app/views/users/user_courses4show.html.erb | 14 + app/views/users/user_fanslist.html.erb | 74 +- app/views/users/user_feedback4show.html.erb | 22 + app/views/users/user_projects.html.erb | 118 +- app/views/users/user_projects4show.html.erb | 14 + app/views/watchers/_set_watcher.js.erb | 63 +- app/views/words/destroy.js.erb | 6 + config/routes.rb | 7 + public/images/pic_uersall.png | Bin 0 -> 9946 bytes public/stylesheets/leftside_new.css | 66 + public/stylesheets/public_new.css | 430 ++++++ public/stylesheets/users.css | 127 ++ 32 files changed, 2673 insertions(+), 1656 deletions(-) create mode 100644 app/views/layouts/_base_footer_new.html.erb create mode 100644 app/views/layouts/_base_header_new.html.erb create mode 100644 app/views/layouts/_user_fans_list.html.erb create mode 100644 app/views/layouts/_user_watch_btn.html.erb create mode 100644 app/views/layouts/_user_watch_list.html.erb create mode 100644 app/views/layouts/base_users_new.html.erb create mode 100644 app/views/my/clear_user_avatar_temp.js.erb create mode 100644 app/views/my/save_user_avatar.js.erb create mode 100644 app/views/users/_user_fans_item.html.erb create mode 100644 app/views/users/user_course_activities.html.erb create mode 100644 app/views/users/user_courses4show.html.erb create mode 100644 app/views/users/user_feedback4show.html.erb create mode 100644 app/views/users/user_projects4show.html.erb create mode 100644 public/images/pic_uersall.png create mode 100644 public/stylesheets/leftside_new.css create mode 100644 public/stylesheets/public_new.css create mode 100644 public/stylesheets/users.css diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 69d8bc3a6..84e2e7d35 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -25,6 +25,7 @@ class MyController < ApplicationController helper :issues helper :users helper :custom_fields + helper :user_score BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues, 'issuesreportedbyme' => :label_reported_issues, @@ -88,6 +89,23 @@ class MyController < ApplicationController end end + def clear_user_avatar_temp + @user = User.current + diskfile = disk_filename('User', @user.id) + diskfile1 = diskfile + 'temp' + File.delete(diskfile1) if File.exist?(diskfile1) + end + def save_user_avatar + @user = User.current + diskfile = disk_filename('User', @user.id) + diskfile1 = diskfile + 'temp' + begin + FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1 + ensure + File.delete(diskfile1) if File.exist?(diskfile1) + end + end + # Edit user's account def account @user = User.current @@ -119,6 +137,8 @@ class MyController < ApplicationController @se.identity = params[:identity].to_i if params[:identity] @se.technical_title = params[:technical_title] if params[:technical_title] @se.student_id = params[:no] if params[:no] + @se.brief_introduction = params[:brief_introduction] + @se.description = params[:description] if @user.save && @se.save # 头像保存 @@ -137,6 +157,7 @@ class MyController < ApplicationController File.delete(diskfile1) if File.exist?(diskfile1) end + render :layout=>'base_users_new' end # Destroys user's account @@ -159,6 +180,7 @@ class MyController < ApplicationController # Manage user's password def password + @act='password' @user = User.current unless @user.change_password_allowed? flash.now[:error] = l(:notice_can_t_change_password) @@ -178,12 +200,14 @@ class MyController < ApplicationController flash.now[:error] = l(:notice_account_wrong_password) end end + render :template => 'my/account',:layout=>'base_users_new' rescue Exception => e if e.message == 'wrong password' flash.now[:error] = l(:notice_account_wrong_password) else flash.now[:error] = e.message end + render :template => 'my/account',:layout=>'base_users_new' end # Create a new feeds key diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 23053a48e..b02ebd7e5 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -39,13 +39,15 @@ class UsersController < ApplicationController before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_contests, :info, :user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, - :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index] + :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index, + :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show] #edit has been deleted by huang, 2013-9-23 before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, - :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index] + :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index, + :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show] before_filter :auth_user_extension, only: :show #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects @@ -76,6 +78,8 @@ class UsersController < ApplicationController # fq helper :words + helper :project_score + include UsersHelper def refresh_changests if !(@user.nil?) && !(@user.memberships.nil?) @@ -104,27 +108,41 @@ class UsersController < ApplicationController #added by young def user_projects - - if User.current.admin? - @memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}") - else - cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" - @memberships = @user.memberships.all(:conditions => cond) - end - #events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) - #@events_by_day = events.group_by(&:event_date) - @state = 0 - #add by huang + + #add by huang unless User.current.admin? if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) render_404 - return + return end end - #end - + #end + # if User.current.admin? + # @memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}") + # else + # cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" + # @memberships = @user.memberships.all(:conditions => cond) + # end + #events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) + #@events_by_day = events.group_by(&:event_date) + # @state = 0 + + limit = 10; + query = Project.joins("join members m on #{Project.table_name}.id=m.project_id") + query = query.where("m.user_id = ?",@user.id) + if(params[:status] == '1') + query = query.where("#{Project.table_name}.user_id = ?",@user.id); + elsif(params[:status] == '2') + query = query.where("#{Project.table_name}.user_id <> ?",@user.id); + end + @obj_count = query.count(); + + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Project.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + @params = params + respond_to do |format| - format.html + format.html{render :layout=>'base_users_new'} format.api end end @@ -237,44 +255,59 @@ class UsersController < ApplicationController include CoursesHelper - def user_courses + def user_courses unless User.current.admin? if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) render_404 - return + return end end - + #@user.coursememberships.all(:conditions => Course.visible_condition(User.current)) - if User.current == @user || User.current.admin? - membership = @user.coursememberships.all - else - membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + limit = 10; + query = Course.joins("join members m on #{Course.table_name}.id=m.course_id") + query = query.where("m.user_id = ?",@user.id) + if(params[:status] == '1') + query = query.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now); + elsif(params[:status] == '2') + query = query.where("endup_time < ?",Time.now); end + @obj_count = query.count(); - membership.sort! {|older, newer| newer.created_on <=> older.created_on } - @memberships = [] - membership.collect { |e| - @memberships.push(e) - } - ## 判断课程是否过期 [需封装] - @memberships_doing = [] - @memberships_done = [] - #now_time = Time.now.year - @memberships.map { |e| - #end_time = e.course.get_time.year - isDone = course_endTime_timeout?(e.course) - if isDone - @memberships_done.push e - else - @memberships_doing.push e - end - } + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Course.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + @params = params + render :layout=>'base_users_new' + + # if User.current == @user || User.current.admin? + # membership = @user.coursememberships.all + # else + # membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + # end + # + # membership.sort! {|older, newer| newer.created_on <=> older.created_on } + # @memberships = [] + # membership.collect { |e| + # @memberships.push(e) + # } + # ## 判断课程是否过期 [需封装] + # @memberships_doing = [] + # @memberships_done = [] + # #now_time = Time.now.year + # @memberships.map { |e| + # #end_time = e.course.get_time.year + # isDone = course_endTime_timeout?(e.course) + # if isDone + # @memberships_done.push e + # else + # @memberships_doing.push e + # end + # } # respond_to do |format| - # format.html - # format.api + # format.html + # format.api # end end @@ -408,8 +441,149 @@ class UsersController < ApplicationController format.api end end - + + def user_courses4show + query = Course.joins("join members m on #{Course.table_name}.id=m.course_id") + query = query.where("m.user_id = ?",@user.id) + if User.current == @user #看自己 + else + if @user.user_extensions!=nil && @user.user_extensions.identity == 0 #看老师 + query = query.joins("join member_roles r on m.id = r.member_id") + query = query.where("r.role_id in(7,9)") + end + query = query.where(Course.table_name+".is_public = 1") + # TODO or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id) + end + + if params[:lastid]!=nil && !params[:lastid].empty? + query = query.where("#{Course.table_name}.id < ?",params[:lastid]) + end + @list = query.order("#{Course.table_name}.id desc").limit(8).all + + render :layout=>nil + end + def user_projects4show + + query = Project.joins("join members m on #{Project.table_name}.id=m.project_id") + query = query.where("m.user_id = ?",@user.id) + if User.current == @user #看自己 + else + query = query.where(Project.table_name+".is_public = 1") + # TODO or exists (select 1 from project c2,members m2 where c2.id=m2.course_id and c2.id=#{Project.table_name}.id and m2.user_id= User.current.id) + end + + if params[:lastid]!=nil && !params[:lastid].empty? + query = query.where("#{Project.table_name}.id < ?",params[:lastid]) + end + @list = query.order("#{Project.table_name}.id desc").limit(8).all + + render :layout=>nil + end + + def user_course_activities + @list = [] + lastid = nil + if params[:lastid]!=nil && !params[:lastid].empty? + lastid = params[:lastid]; + end + + user_ids = [] + if @user == User.current + watcher = User.watched_by(@user) + watcher.push(User.current) + user_ids = watcher.map{|x| x.id} + else + user_ids << @user.id + end + + query_rec_count = 8 + query_times = 10 #query_times次没查到query_rec_count条记录就不查了 + query_i = 0; + while( true ) + query_i = query_i+1 + if(query_i>query_times) + break + end + query = Activity.where(user_id: user_ids) + if(lastid != nil) + query = query.where("id < ?",lastid) + end + lastid,item_list = query_activities(query,'course'); + for item in item_list + @list << item + if @list.count() >= query_rec_count + break + end + end + if @list.count() >= query_rec_count + break + end + if lastid == nil + break + end + end + render :layout=>nil + end + + def user_project_activities + @list = [] + lastid = nil + if params[:lastid]!=nil && !params[:lastid].empty? + lastid = params[:lastid]; + end + + user_ids = [] + if @user == User.current + watcher = User.watched_by(@user) + watcher.push(User.current) + user_ids = watcher.map{|x| x.id} + else + user_ids << @user.id + end + + query_rec_count = 8 + query_times = 10 #query_times次没查到query_rec_count条记录就不查了 + query_i = 0; + while( true ) + query_i = query_i+1 + if(query_i>query_times) + break + end + query = Activity.where(user_id: user_ids) + if(lastid != nil) + query = query.where("id < ?",lastid) + end + lastid,item_list = query_activities(query,'project'); + for item in item_list + @list << item + if @list.count() >= query_rec_count + break + end + end + if @list.count() >= query_rec_count + break + end + if lastid == nil + break + end + end + render :action=>'user_course_activities',:layout=>nil + end + + def user_feedback4show + query = @user.journals_for_messages + if params[:lastid]!=nil && !params[:lastid].empty? + query = query.where("#{JournalsForMessage.table_name}.id < ?",params[:lastid]) + end + @list = query.order("#{JournalsForMessage.table_name}.id desc").limit(3).all + render :layout=>nil + end + def show + render :layout=>'base_users_new' + end + + def show_old pre_count = 10 #limit # Time 2015-02-04 11:46:34 # Author lizanle @@ -830,11 +1004,24 @@ class UsersController < ApplicationController end end ###add by huang - def user_watchlist + def user_watchlist + limit = 10; + query = User.watched_by(@user.id); + @obj_count = query.count(); + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + + render :template=>'users/user_fanslist',:layout=>'base_users_new' end ###add by huang - def user_fanslist - + def user_fanslist + limit = 10; + query = @user.watcher_users; + @obj_count = query.count(); + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + @action = 'fans' + render :layout=>'base_users_new' end #william diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index f6d01a03d..3727a974e 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -16,12 +16,15 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class WatchersController < ApplicationController before_filter :require_login#, :find_watchables, :only => [:watch, :unwatch] + + helper :users + def watch s = WatchesService.new watchables = s.watch params.merge(:current_user_id => User.current.id) respond_to do |format| format.html { redirect_to_referer_or {render :text => (true ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} - format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables} } + format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'add'} } end rescue Exception => e if e.message == "404" @@ -37,7 +40,7 @@ class WatchersController < ApplicationController watchables = s.unwatch params.merge(:current_user_id => User.current.id) respond_to do |format| format.html { redirect_to_referer_or {render :text => (false ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} - format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables} } + format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'add'} } end rescue Exception => e if e.message == "404" diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index af2d5abc4..8a373edab 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -303,4 +303,159 @@ module UsersHelper end end end + + def get_watcher_users(obj) + count = User.watched_by(obj.id).count + if count == 0 + return [0,[]] + end + list = User.watched_by(obj.id).order("#{Watcher.table_name}.id desc").limit(10).all + return [count,list]; + end + + def get_fans_users(obj) + count = obj.watcher_users.count + if count == 0 + return [0,[]] + end + list = obj.watcher_users.order("#{Watcher.table_name}.id desc").limit(10).all + return [count,list]; + end + + def query_activities(query,type) + query_rec_count = 50 + #query = query.where("act_type not in ('Contest','Contestnotifications','Principal')") + query = query.where("act_type='JournalsForMessage'") + #query = query.where("act_type not in (?)", ['JournalsForMessage','Message','HomeworkCommon','News','Issue','Journal','Poll']) + list = query.order("id desc").limit(query_rec_count).all + if( list == nil || list.count() < query_rec_count ) + lastid = nil + else + lastid = list.last.id + end + + result = []; + for item in list + container = get_activity_container(item,type) + if( activity_is_show(item,container) ) + result << { :item=>item,:e=>container } + end + end + return [lastid,result] + end + def get_activity_container activity,type + e = nil; + if type == 'project' + if activity.act_type == 'Poll' + # 项目没有问卷 + # e = Project.find_by_id(activity.act.polls_group_id) + else + e = activity.act.project if activity.act.respond_to?('project') + end + end + if type == 'course' + if activity.act_type == 'Poll' + e = Course.find_by_id(activity.act.polls_group_id) + else + e = activity.act.course if activity.act.respond_to?('course') + end + end + + return e; + end + def activity_is_show(activity,e) + if(!e) + return false + end + + if activity.user_id == User.current.id + return true + end + if( e.visible? ) + return true + end + return false + end + def get_activity_act_showname(activity) + case activity.act_type + when "HomeworkCommon" + return activity.act.name + when "Issue" + return activity.act.subject + when "Journal" + return activity.act.notes + when "JournalsForMessage" + return activity.act.notes + when "Message" + return activity.act.subject + when "News" + return activity.act.title + when "Poll" + return activity.act.polls_name + when "Contest" + return '' + when "Contestnotification" + return '' + when "Principal" + return '' + else + return activity.act_type + end + end + def get_activity_act_createtime(activity) + case activity.act_type + when "HomeworkCommon" + return activity.act.created_at + when "Poll" + return activity.act.created_at + else + return activity.act.created_on + end + end + def get_activity_url(activity,e) + case activity.act_type + # when "Contest" + # when "Contestnotification" + # when "Principal" + when "HomeworkCommon" + return homework_common_index_path( :course=>e.id ) + when "Issue" + return issue_path(activity.act.id) + when "Journal" + return issue_path( activity.act.journalized_id ) + when "JournalsForMessage" + return e.class.to_s == 'Course' ? course_feedback_path(e) : project_feedback_path(e) + when "Message" + return e.class.to_s == 'Course' ? course_boards_path(e) : project_boards_path(e) + when "News" + return news_path(activity.act) + #return e.class.to_s == 'Course' ? course_news_index_path(e) : project_news_index_path(e) + when "Poll" + return poll_index_path( :polls_group_id=>activity.act.polls_group_id, :polls_type=>e.class.to_s ) + else + return 'javascript:;' + end + end + def get_activity_opt(activity,e) + case activity.act_type + when "HomeworkCommon" + return '创建了作业' + when "News" + return e.class.to_s == 'Course' ? '发布了通知' : '添加了新闻' + when "Issue" + return '发表了问题' + when "Journal" + return '回复了问题' + when "JournalsForMessage" + return e.class.to_s == 'Course' ? '发表了留言' : '提交了反馈' + #return ( activity.act.reply_id == nil || activity.act.reply_id == 0 ) ? '' : '' + when "Message" + return ( activity.act.parent_id == nil || activity.act.parent_id == '' ) ? '发布了帖子' : '回复了帖子' + when "Poll" + return '发布了问卷' + else + return '有了新动态' + end + end + end diff --git a/app/views/avatar/upload.js.erb b/app/views/avatar/upload.js.erb index 1fa90c5a3..41cf3ab77 100644 --- a/app/views/avatar/upload.js.erb +++ b/app/views/avatar/upload.js.erb @@ -1,4 +1,8 @@ +<% if @source_type=='User' %> +var imgSpan = $("img[nhname='avatar_image']"); +imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); +<% else %> var imgSpan = jQuery('#avatar_image'); imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); - +<% end %> \ No newline at end of file diff --git a/app/views/courses/finishcourse.js.erb b/app/views/courses/finishcourse.js.erb index 2399062fd..0ca89aa19 100644 --- a/app/views/courses/finishcourse.js.erb +++ b/app/views/courses/finishcourse.js.erb @@ -1,8 +1,8 @@ <% if @save_flag %> - $('#finish_course_<%=@course.id%>').replaceWith("<%= escape_javascript(set_course_time(@course_prefs))%>"); +$('#finish_course_<%=@course.id%>').replaceWith("<%= escape_javascript(set_course_time(@course_prefs))%>"); +var html = "<%= escape_javascript( render( :partial => 'users/course_form', :locals => {:item => @course_prefs} ) )%>"; +$('#nh_course_<%=@course.id%>').replaceWith(html); // alert("关闭成功"); <% else %> - alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); -<% end %> - - +alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); +<% end %> \ No newline at end of file diff --git a/app/views/layouts/_base_footer_new.html.erb b/app/views/layouts/_base_footer_new.html.erb new file mode 100644 index 000000000..b4856d2af --- /dev/null +++ b/app/views/layouts/_base_footer_new.html.erb @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/app/views/layouts/_base_header_new.html.erb b/app/views/layouts/_base_header_new.html.erb new file mode 100644 index 000000000..63e221cca --- /dev/null +++ b/app/views/layouts/_base_header_new.html.erb @@ -0,0 +1,76 @@ + +
    \ No newline at end of file diff --git a/app/views/layouts/_user_fans_list.html.erb b/app/views/layouts/_user_fans_list.html.erb new file mode 100644 index 000000000..8c39c528c --- /dev/null +++ b/app/views/layouts/_user_fans_list.html.erb @@ -0,0 +1,12 @@ + <% fans_count,fans_list = get_fans_users(user) %> +
    +

    粉丝

    更多 +
    +
    + <% for fans in fans_list %> + <%= link_to image_tag(url_to_avatar(fans), :style => "width:38px;height:38px;"), user_path(fans), :class => "pic_members", :title => "#{fans.name}" %> + <% end %> +
    +
    +
    + \ No newline at end of file diff --git a/app/views/layouts/_user_watch_btn.html.erb b/app/views/layouts/_user_watch_btn.html.erb new file mode 100644 index 000000000..71eea7166 --- /dev/null +++ b/app/views/layouts/_user_watch_btn.html.erb @@ -0,0 +1,8 @@ +<% if(User.current.logged? && User.current!=target)%> + <%if(target.watched_by?(User.current))%> + 取消 + <% else %> + 关注 + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/layouts/_user_watch_list.html.erb b/app/views/layouts/_user_watch_list.html.erb new file mode 100644 index 000000000..00c0cdc40 --- /dev/null +++ b/app/views/layouts/_user_watch_list.html.erb @@ -0,0 +1,11 @@ + <% watcher_count,watcher_list = get_watcher_users(user) %> +
    +

    关注

    更多 +
    +
    + <% for watcher in watcher_list %> + <%= link_to image_tag(url_to_avatar(watcher), :style => "width:38px;height:38px;"), user_path(watcher), :class => "pic_members", :title => "#{watcher.name}" %> + <% end %> +
    +
    +
    \ No newline at end of file diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb new file mode 100644 index 000000000..8911df5ce --- /dev/null +++ b/app/views/layouts/base_users_new.html.erb @@ -0,0 +1,337 @@ +<% @nav_dispaly_home_path_label = 1 + @nav_dispaly_main_course_label = 1 + @nav_dispaly_main_project_label = 1 + @nav_dispaly_main_contest_label = 1 %> +<% @nav_dispaly_forum_label = 1%> +<% @nav_dispaly_user_label = show_item_on_navbar(params) %> +<% @center_flag = (User.current == @user) %> + + + + +<%= h html_title %> + + +<%= csrf_meta_tag %> +<%= favicon %> +<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new','users', :media => 'all' %> +<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> +<%= javascript_heads %> +<%= heads_for_theme %> +<%= call_hook :view_layouts_base_html_head %> + +<%= yield :header_tags -%> + + + + + + + +
    + <%= render :partial => 'layouts/base_header_new'%> + +
    + +
    +
    +
    + +
    + <%=link_to @user.name, user_path(@user),:class=>"fl c_dark fb f14" %> + <% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %> + + <% end %> + + <%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %> +
    +
    + +
    + <%=l(:label_user_watcher)%>(<%= link_to User.watched_by(@user.id).count.to_s, {:controller=>"users", :action=>"user_watchlist",:id=>@user.id},:class=>"c_blue",:nh_name=>"watcher_count" %>) + + <%=l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)%>(<%= link_to @user.watcher_users.count.to_s, {:controller=>"users", :action=>"user_fanslist",:id=>@user.id},:class=>"c_blue",:nh_name=>"fans_count"%>) + 积分(<%= link_to(format("%.2f" ,get_option_number(@user,1).total_score ).to_i, + {:controller => 'users', :action => 'show_new_score', :remote => true, :id => @user.id }, :class => 'c_blue',:id => 'user_score') %>) +
    +
    + <% if (@user.user_extensions) %> +
    <%= @user.user_extensions.brief_introduction %>
    + <% end %> +
    + +
    +
      +
    • 加入时间 :
    • + <% if @user.user_extensions!=nil && @user.user_extensions.identity == 2 %> +
    • <%= l(:label_company_name) %> :
    • + <% elsif !@user.firstname.empty? || !@user.lastname.empty? %> +
    • 真实姓名 :
    • + <% end %> + <% unless @user.user_extensions.nil? %> + <% if @user.user_extensions.identity == 0 %> +
    • 职称 :
    • + <% end %> + <% if @user.user_extensions && @user.user_extensions.location && !@user.user_extensions.location.empty?%> +
    • 地区 :
    • + <% end %> + <% if (@user.user_extensions.identity == 0 || @user.user_extensions.identity == 1) && !@user.user_extensions.school.nil? %> +
    • 工作单位 :
    • + <% elsif @user.user_extensions.identity == 3 && !@user.user_extensions.occupation.nil? && !@user.user_extensions.occupation.empty? %> +
    • 工作单位 :
    • + <% elsif @user.user_extensions.identity == 2 %> +
    • 工作单位 :
    • + <% end %> + <% if (!@user.user_extensions.description.nil? && !@user.user_extensions.description.empty?) %> +
    • 个人简介 :
    • + <% end %> + <% end %> +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% if @center_flag %> + + <% end %> +
    + + <%= render :partial => 'layouts/user_watch_list', :locals => {:user => @user} %> + <%= render :partial => 'layouts/user_fans_list', :locals => {:user => @user} %> + + + + + + + + + + + + + + + + + +
    + + <%= yield %> + +
    +
    + + <%= render :partial => 'layouts/base_footer_new'%> +
    +
    + +<%= render :partial => 'layouts/new_feedback' %> + + +<%= javascript_include_tag '/javascripts/avatars.js' %> + + + + diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 6c0c3a78a..377844a33 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -1,743 +1,524 @@ -<% @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - @nav_dispaly_main_contest_label = 1 %> -<% @nav_dispaly_forum_label = 1%> +
    + <%= render_flash_messages %> +
    +
    +
      +
    • 基本资料
    • +
    • 账号管理
    • +
    +
    +
    +
    + <%= labelled_form_for :user, @user, :url => {:action => "account"}, :html => {:id => 'my_account_form', :method => :post} do |f| %> +
    +
      +
    • 登录名 : 
    • +
    • 邮箱 : 
    • +
    • 身份 : 
    • +
    • 姓氏 : 
    • +
    • 名字 : 
    • +
    • 组织名 : 
    • +
    • 性别 : 
    • +
    • 工作单位 : 
    • +
    • 地区 : 
    • +
    • 邮件通知 : 
    • +
    • 个人签名 : 
    • +
    • 个人简介 : 
    • +
    •   
    • +
    +
      +
    • <%= f.text_field :login,:no_label=>true, :required => true, :name => "login",:class=>"w210"%>
    • +
    • <%= f.text_field :mail,:no_label=>true, :required => true,:class=>"w210"%>
    • - - - -
      - <%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %> - <%= call_hook(:view_my_account_contextual, :user => @user) %>
      -

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

      -<%= error_messages_for 'user' %> -
      -<%= labelled_form_for :user, @user, - :url => {:action => "account"}, - :html => {:id => 'my_account_form', +
      + +

      <%= l(:lable_school_list)%>

      +    +
      +
        + <% @ss = School.find_by_sql("select distinct province from schools") %> + <% @ss.each do |s| %> +
      • + <%= s.province %> + +
      • + <% end %> +
      +
      - :method => :post} do |f| %> - -
      -
      - -

      - <%= f.text_field :login, :required => true, :size => 25, :name => "login", :style => 'border:1px solid #d3d3d3;'%> - <%= l(:label_max_number) %> -
      -

      - -

      - - - - - <% end %> - - - -

      - - - - - - - - - - - - - - - -
      - -

      <%= l(:lable_school_list)%>

      -    -
      -
        - <% @ss = School.find_by_sql("select distinct province from schools") %> - <% @ss.each do |s| %> -
      • - <%= s.province %> - -
      • - <% end %> -
      -
      - -
      -
        - -
      -
      -
      - - - - - - - -

      - <%= f.text_field :mail, :required => true %> -

      - -

      - <%= f.select :language, :Chinese => :zh, :English => :en %> -

      - - - <% if !User.current.user_extensions.nil? %> - <% province = User.current.user_extensions.location %> - <% city = User.current.user_extensions.location_city %> - <% identity = User.current.user_extensions.identity %> - <% occupation1 = User.current.user_extensions.occupation %> - <% occupation = User.current.user_extensions.occupation %> - <% title = User.current.user_extensions.technical_title %> - <% language = User.current.language %> - <% else %> - <% province = "湖南省" %> - <% city = "长沙"%> - <% identity = ""%> - <% occupation1 = ""%> - <% title = "" %> - <% language = ""%> - <% end %> - - -

      - - -

      - - - - -
      - - - <% if Setting.openid? %> -

      - <%= f.text_field :identity_url %> -

      - <% end %> - - <% @user.custom_field_values.select(&:editable?).each do |value| %> -

      <%= custom_field_tag_with_label :user, value %>

      - <% end %> - <%= call_hook(:view_my_account, :user => @user, :form => f) %> -
      - - - - - - - - +<%= stylesheet_link_tag 'nyan' %> +<%= javascript_include_tag '/javascripts/jquery.leanModal.min.js' %> +<% if !User.current.user_extensions.nil? %> + <% province = User.current.user_extensions.location %> + <% city = User.current.user_extensions.location_city %> + <% identity = User.current.user_extensions.identity %> + <% occupation1 = User.current.user_extensions.occupation %> + <% occupation = User.current.user_extensions.occupation %> + <% title = User.current.user_extensions.technical_title %> + <% language = User.current.language %> +<% else %> + <% province = "湖南省" %> + <% city = "长沙"%> + <% identity = ""%> + <% occupation1 = ""%> + <% title = "" %> + <% language = ""%> <% end %> -<% html_title(l(:label_my_account)) -%> - + \ No newline at end of file diff --git a/app/views/my/clear_user_avatar_temp.js.erb b/app/views/my/clear_user_avatar_temp.js.erb new file mode 100644 index 000000000..39ff71f6c --- /dev/null +++ b/app/views/my/clear_user_avatar_temp.js.erb @@ -0,0 +1,7 @@ + $("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src')); + $('#ajax-modal').html($("#nh_tx_dialog_html").html()); + showModal('ajax-modal','460px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').parent().removeClass("alert_praise"); + //$('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("alert_box"); \ No newline at end of file diff --git a/app/views/my/save_user_avatar.js.erb b/app/views/my/save_user_avatar.js.erb new file mode 100644 index 000000000..ce4bae501 --- /dev/null +++ b/app/views/my/save_user_avatar.js.erb @@ -0,0 +1,2 @@ +$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:216px;height:216px;",:alt=>"头像") %>'); +hideModal(); \ No newline at end of file diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb index 82b69ab63..a417c463f 100644 --- a/app/views/users/_course_form.html.erb +++ b/app/views/users/_course_form.html.erb @@ -1,74 +1,46 @@ -
      -
        - <% for membership in memberships %> -
      • - - - - - -
        - <%= image_tag(url_to_avatar(membership.course), :class => 'avatar') %> - - - - - - - - - - - -
        - - <%= link_to_course(membership.course) %> - - - <%= render :partial => 'courses/set_course_time', :locals => {:course => membership.course} %> - <% if (User.current == @user && (!@user.allowed_to?(:as_teacher,membership.course)))%> - <%= join_in_course(membership.course, User.current) %> - <% end %> - -      - <%= l(:label_x_base_courses_member, :count => membership.course.members.count) %> - (<%= "#{membership.course.members.count}" %>) -    - <%= l(:label_homework) %> - ( - - <%= link_to (membership.course.homework_commons.count), homework_common_index_path(:course => membership.course.id) %> - - ) -    - <%= l(:label_course_news) %> - ( - - <%= link_to (membership.course.news.count), {:controller => 'news', :action => 'index', :course_id => membership.course.id} %> - ) - -
        -

        - <%= textilizable membership.course.short_description %> -

        -
        - - <% @course = Course.find_by_extra(membership.course.extra) %> - <% unless (@course.nil? || @course.teacher.nil? || @course.teacher.name.nil?) %> - - <%= l(:label_main_teacher) %> - : <%= link_to(@course.teacher.realname, user_path(@course.teacher)) %> - - - <%= l(:label_course_term) %> - : <%= @course.time %><%= get_course_term_locales @course %> - - <% end %> -
        -
        -
      • - +<% can_edit_flag = User.current.allowed_to?(:as_teacher,item) || User.current.admin? %> +<% course_end_flag = course_endTime_timeout?(item) %> +
      -
      -<%= call_hook :view_account_left_bottom, :user => @user %> \ No newline at end of file +
      +
      + + + + + + + + + + + + + +
      主讲老师: + <%= item.teacher.show_name %> + 课程作业:<%= item.homework_commons.count %>
      成员人数:<%= item.members.count %>开课学期:<%= item.time %><%= get_course_term_locales item %>
      +
      +
    + <% if(course_end_flag) %> + 课程结束 + <% elsif(can_edit_flag) %> + 发布作业 + <% else %> + 提交作品 + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/users/_user_fans_item.html.erb b/app/views/users/_user_fans_item.html.erb new file mode 100644 index 000000000..66181d23b --- /dev/null +++ b/app/views/users/_user_fans_item.html.erb @@ -0,0 +1,50 @@ +
    + +
    + <%= item.show_name %> +
    +
    + <% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %> +

    个性签名:<%= item.user_extensions.brief_introduction %>

    + <% end %> + + + + <% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %> + + + <% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %> + + + <% elsif item.user_extensions.identity == 2 %> + + + <% end %> +
    加入时间:<%= format_date(item.created_on) %>工作单位: +
  • + <%= item.user_extensions.school.name %> +
  • +
    工作单位: +
  • + <%= item.user_extensions.occupation %> +
  • +
    工作单位: +
  • + <%= item.show_name %> +
  • +
    +
    +
    + <% if(User.current.logged? && User.current != item )%> + <%if(item.watched_by?(User.current))%> + 取消关注 + <% else %> + 添加关注 + <% end %> + <% end %> +
    +
    diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 496211e82..bb0ce28d7 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,661 +1,321 @@ -<% if User.current.id == @user.id %> - -
    - <%= form_tag(:controller => 'users', :action => "show") do %> - - <% end %> -<% end %> - -<%= render_flash_messages %> -<% unless @state == 2 %> - <% unless @activity.empty? %> -
    - <% @activity.each do |e| %> - <%# 以下一行代码解决有未知的活动无法转换成Model报错%> - <% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next;) if e.act_type.safe_constantize.nil? %> - <% act = e.act %> - <% unless act.nil? %> - <% if e.act_type == 'JournalsForMessage' || e.act_type == 'HomeworkCommon' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest' %> - - - - - - -
    - <%= image_tag(url_to_avatar(e.user), :class => "avatar") %> - - - <% case e.act_type %> - <% when 'JournalsForMessage' %> - - - - - - - - - - <% when 'HomeworkCommon' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Journal' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - <% if act.notes.nil? %> - <% desStr = '' %> - <% else %> - <% desStr= textAreailizable(act, :notes) %> - <% end %> - - - - - - <% when 'Changeset' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Message' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Principal' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'News' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Issue' %> - <% if e.user == User.current %> - - - - - - - - - - - <% else %> - - - - - - - - - - <% end %> - - <% when 'Contest' %> - - <% if e.user == User.current && @show_contest == 1 %> - - <% else %> - - <% end %> - - - - - - - <% else %> - <% end %> -
    - <% if User.current.login == e.user.try(:login) %> - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - <% if User.current.language == "zh" %> - - <%= l(:label_i_have_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - <%= l(:label_of_feedback) + l(:label_layouts_feedback) %> - - <% else %> - - <%= l(:label_i_have_feedback) %> - <%= l(:label_layouts_feedback) + l(:label_of_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - - <% end %> - <% else %> - - <%= link_to("#{e.user.name}", user_path(e.user_id)) %> - - <% if User.current.language == "zh" %> - - <%= l(:label_have_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - <%= l(:label_of_feedback) + l(:label_layouts_feedback) %> - - <% else %> - - <%= l(:label_have_feedback) %> - <%= l(:label_layouts_feedback) + l(:label_of_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - - <% end %> - <% end %> -
    -

    - <%= textAreailizable act.notes %> -

    - -
    - - <%= user_jour_feed_back_url e %> - -
    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - - - <%= l(:label_i_new_activity) %> - - <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> -   - - <%= l(:label_new_activity) %> -   - <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %> -
    -

    - <%= textAreailizable act, :description %> -

    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_at)).to_s %> - -
    - - - - - - - - -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to(l(:label_activity_project)+":"+act.issue.project.name, project_path(act.issue.project.id)) %> - <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), - {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to(l(:label_activity_project)+":"+act.issue.project.name, project_path(act.issue.project.id)) %> - <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), - {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> -
    -

    - <%= desStr %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title(act.title), - {:controller => 'repositories', - :action => 'revision', - :id => act.repository.project, - :repository_id => act.repository.identifier_param, - :rev => act.identifier} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title(act.title), - {:controller => 'repositories', - :action => 'revision', - :id => act.repository.project, - :repository_id => act.repository.identifier_param, - :rev => act.identifier} %> -
    -

    - <%= textAreailizable act, :long_comments %> -

    -
    -
    - - <%= format_time(e.act.committed_on) %> - -
    -
    - <%= link_to l(:label_find_all_comments), - {:controller => 'repositories', - :action => 'revision', - :id => act.repository.project, - :repository_id => act.repository.identifier_param, - :rev => act.identifier} if e.act.count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.count) %> - -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - act.board.project ? project_boards_path(act.board.project,:topic_id => act.id) : course_boards_path(act.board.course,:topic_id => act.id), - :class => "problem_tit fl fb " %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - {:controller => 'messages', - :action => 'show', - :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %> -
    -

    - <%= textAreailizable(act, :content) %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_new_user) %> - - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_user) %> - -
    -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title(" #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> -
    -

    - <%= textAreailizable act, :description %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    - - <%= link_to l(:label_find_all_comments), {:controller => 'news', :action => 'show', :id => act.id} if e.act.comments_count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.comments_count) %> - -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> -   - <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), - {:controller => 'issues', - :action => 'show', - :id => act.id} %> -
    - <%= textAreailizable act, :description %> -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    - - <%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} if e.act.journals.count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.journals.count) %> - -
    -
    - - <%= link_to(h(e.user), user_path(e.user_id)) %> -   - - <%= l(:label_new_activity) %> -   - <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), - {:controller => 'issues', - :action => 'show', - :id => act.id} %> -
    - <%= textAreailizable act, :description %> -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    - - <%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} if e.act.journals.count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.journals.count) %> - -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %> -
    -

    - <%= textAreailizable act, :description %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - - <% end %> - <% end %> - <% end %> -
    - - <% else %> - <% if @user == User.current %> - <%= l(:label_user_activities_no) %> - <% else %> -

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

    - <% end %> - <% end %> - -<% else %> - <% unless @message.empty? %> -
    - <% @message.each do |e| -%> - - - - - -
    <%= image_tag(url_to_avatar(e.user), :class => "avatar") %> - - - - - - - - - - - -
    - <%= link_to(h(e.user), user_path(e.user)) %> - <% if e.instance_of?(JournalsForMessage) %> - <% if e.reply_id == User.current.id %> - <% if e.jour_type == 'Bid' %> - <%= l(:label_in_bids) %><%= link_to(e.jour.name, respond_path(e.jour)) %> <%= l(:label_quote_my_words) %> - <% elsif e.jour_type == 'User' %> - <%= l(:label_in_users) %><%= link_to(e.jour.firstname, feedback_path(e.jour)) %> <%= l(:label_quote_my_words) %> - <% elsif e.jour_type == 'Project' %> - <%= l(:label_in_projects) %><%= link_to(e.jour.name, feedback_path(e.jour)) %> <%= l(:label_reply_plural) %> - <% end %> - <% else %> - <%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id)) %> <%= l(:label_have_respond) %> - <% end %> - <% else %> - <% if e.journal_reply.nil? || e.journal_reply.reply_id != User.current.id %> - <%= l(:label_about_issue) %><%= link_to(e.issue.subject, issue_path(e.journalized_id)) %><%= l(:label_have_respond) %> - - <% else %> - <%= l(:label_in_issues) %><%= link_to(e.issue.subject, issue_path(e.issue)) %><%= l(:label_quote_my_words) %> - <% end %> - <% end %> -
    -

    - <%= textAreailizable e.notes %> -

    -
    - - <%= format_time e.created_on %> - -
    -
    - <% end %> -
    - - - + +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<% @center_flag = (User.current == @user) %> +<% if @center_flag %> +
    + + <% if @user.allowed_to?(:add_project, nil, :global => true) %> + 新建项目 <% else %> -

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

    + 加入项目 <% end %> - + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 + <% else %> + + 加入课程 + <% end %> +
    +
    <% end %> - -<% html_title(l(:label_activity)) -%> + \ No newline at end of file diff --git a/app/views/users/user_course_activities.html.erb b/app/views/users/user_course_activities.html.erb new file mode 100644 index 000000000..8a9996c41 --- /dev/null +++ b/app/views/users/user_course_activities.html.erb @@ -0,0 +1,12 @@ +<% for rec in @list %> +
    + <%= rec[:e].name %> + <%= rec[:item].user.show_name %> + <%= get_activity_opt(rec[:item],rec[:e]) %> + + <%= get_activity_act_showname(rec[:item]).html_safe %> + + <%= time_tag(get_activity_act_createtime(rec[:item])).html_safe %>前 +
    +<% end %> \ No newline at end of file diff --git a/app/views/users/user_courses.html.erb b/app/views/users/user_courses.html.erb index 6e0a1ca17..228d2af90 100644 --- a/app/views/users/user_courses.html.erb +++ b/app/views/users/user_courses.html.erb @@ -1,33 +1,31 @@ -<% if @user.user_extensions.identity == UserExtensions::TEACHER %> - <%= render :partial => 'my_course' %> -<% else %> - <%= render :partial => 'my_joinedcourse' %> -<% end %> - +
    + + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 + <% else %> + 加入课程 + <% end %> +
    +
    - -<% html_title(l(:label_user_course)) -%> \ No newline at end of file +
    +
    +
    +

    所有课程

    + +
    +
    + <% for item in @list %> + <%= render :partial => 'course_form', :locals => {:item => item} %> + <% end %> +

    <%= l(:label_no_data) %>

    +
    +
      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> +
    +
    +
    \ No newline at end of file diff --git a/app/views/users/user_courses4show.html.erb b/app/views/users/user_courses4show.html.erb new file mode 100644 index 000000000..a95c90f18 --- /dev/null +++ b/app/views/users/user_courses4show.html.erb @@ -0,0 +1,14 @@ +<% for item in @list %> + + +<% end %> diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb index 92cc1cfb7..a952bc89d 100644 --- a/app/views/users/user_fanslist.html.erb +++ b/app/views/users/user_fanslist.html.erb @@ -1,52 +1,22 @@ - -

    <%= l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count) %>

    -
    - <% for user in @user.watcher_users %> -
      -
    • - - - - - -
      - <%= link_to image_tag(url_to_avatar(user), :class => "avatar"),user_path(user),:title => "#{user.name}" %> - - - - - - - - - - - - - - -
      - <%= content_tag "div", link_to(user.name, user_path(user)), :class => "project_avatar_name" %> -

      - <% cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" %> - <% memberships = user.memberships.all(:conditions => cond) %> - <%= l(:label_x_contribute_to, :count => memberships.count) %> - <% for member in memberships %> - <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> - <% end %> - -

      - <% user_courses = user_courses_list(user) %> - <%= l(:label_x_course_contribute_to, :count => user_courses.count) %> - <%= ":" unless user_courses.empty? %> - <% for course in user_courses %> - <%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.host_course} %><%= (user_courses.last == course) ? '' : ',' %> - <% end %> -

      -
      <%= l(:label_user_joinin) %><%= format_date(user.created_on) %> -
      -
      -
    • -
    - <% end %> -
    \ No newline at end of file +
    +
    +
    + <% if @action == 'fans'%> +

    粉丝

    +
    共有<%=@obj_count%>名粉丝
    + <% else %> +

    关注

    +
    一共关注<%=@obj_count%>
    + <% end %> +
    +
    + <% for item in @list %> + <%= render :partial => 'users/user_fans_item', :locals => {:item => item,:target=>@user} %> + <% end %> +

    <%= l(:label_no_data) %>

    +
    +
      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> +
    +
    +
    diff --git a/app/views/users/user_feedback4show.html.erb b/app/views/users/user_feedback4show.html.erb new file mode 100644 index 000000000..d57d4ca5a --- /dev/null +++ b/app/views/users/user_feedback4show.html.erb @@ -0,0 +1,22 @@ +<% for item in @list %> +
    + + <%= image_tag url_to_avatar(item.user),:width => '27',:height => '27' %> + + <%= item.user.show_name %> + <% if item.at_user %> +  回复 + <%= item.at_user.show_name %> + <% end %> +  :  +

    <%=item.notes.html_safe%>

    + <% if JournalsForMessage.create_by_user? User.current %> + 回复 + <% end %> + <% if User.current.admin? || item.user.id == User.current.id %> + item.id,:user_id=>item.user.id) %>" data-confirm="您确定要删除吗?" data-remote="true" data-method="delete" class="fl mt5 c_purple ml5">删除 + <% end %> + <%= time_tag(item.created_on).html_safe %>前 +
    +
    +<% end %> diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index 69dda693e..9fe948838 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -1,66 +1,56 @@ - +
    + + <% if @user.allowed_to?(:add_project, nil, :global => true) %> + 新建项目 + <% else %> + 加入项目 + <% end %> +
    +
    - - \ No newline at end of file diff --git a/app/views/users/user_projects4show.html.erb b/app/views/users/user_projects4show.html.erb new file mode 100644 index 000000000..d68089741 --- /dev/null +++ b/app/views/users/user_projects4show.html.erb @@ -0,0 +1,14 @@ +<% for item in @list %> + +<% end %> diff --git a/app/views/watchers/_set_watcher.js.erb b/app/views/watchers/_set_watcher.js.erb index 3f469f5c6..da794d18b 100644 --- a/app/views/watchers/_set_watcher.js.erb +++ b/app/views/watchers/_set_watcher.js.erb @@ -1,11 +1,70 @@ +<% if( params[:object_type] == 'user') %> + <% if( params[:target_id] == params[:object_id] ) %> + <% target = User.find_by_id(params[:target_id]) %> + //btn + var btn_html = "<%= escape_javascript( render( :partial => 'layouts/user_watch_btn', :locals => {:target => target} ) )%>"; + $('#user_watch_id').replaceWith(btn_html); + //count + $("*[nh_name='fans_count']").html("<%= target.watcher_users.count.to_s %>"); + //left list + var list_left_html = "<%= escape_javascript( render( :partial => 'layouts/user_fans_list', :locals => {:user => target} ) )%>"; + $('#fans_nav_list').replaceWith(list_left_html); + //list + if( $("#nh_fans_list") != undefined && $("#nh_fans_list").length != 0 ){ + <% if( opt == 'add') %> + var list_html = "<%= escape_javascript( render( :partial => 'users/user_fans_item', :locals => {:item=>User.current,:target => target} ) )%>"; + $("#nh_fans_list").after(list_html); + $("#nodata").hide(); + <% else %> + $("#fans_item_<%= User.current.id %>",$("#nh_fans_list").parent('div')).remove(); + if( $('>div',$("#nh_fans_list").parent('div')).length == 1 ){ + $("#nodata").show(); + } + <% end %> + } + + <% elsif( params[:target_id] == User.current.id.to_s )%> + <% target = User.find_by_id(params[:target_id]) %> + <% item = User.find_by_id(params[:object_id]) %> + //count + $("*[nh_name='watcher_count']").html("<%= User.watched_by(target.id).count.to_s %>"); + //left list + var list_left_html = "<%= escape_javascript( render( :partial => 'layouts/user_watch_list', :locals => {:user => target} ) )%>"; + $('#watcher_nav_list').replaceWith(list_left_html); + //list + if( $("#nh_wacth_list") != undefined && $("#nh_wacth_list").length != 0 ){ + <% if( opt == 'delete') %> + $("#fans_item_<%= item.id %>",$("#nh_wacth_list").parent('div')).remove(); + if( $('>div',$("#nh_wacth_list").parent('div')).length == 1 ){ + $("#nodata").show(); + } + <% end %> + }else if($("#nh_fans_list") != undefined && $("#nh_fans_list").length != 0){ + var list_html = "<%= escape_javascript( render( :partial => 'users/user_fans_item', :locals => {:item=>item,:target => target} ) )%>"; + $('#fans_item_<%= item.id %>').replaceWith(list_html); + } + + <% else %> + <% target = User.find_by_id(params[:target_id]) %> + <% item = User.find_by_id(params[:object_id]) %> + //list + var list_html = "<%= escape_javascript( render( :partial => 'users/user_fans_item', :locals => {:item=>item,:target => target} ) )%>"; + $('#fans_item_<%= item.id %>').replaceWith(list_html); + <% end %> + +<% else %> + <% selector = ".#{watcher_css(watched)}" %> <% id_selector = "#{watcher_css(watched)}" %> if($("<%= selector %>").get(0) == undefined) { - $("#<%= id_selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link_for_project(watched, user) %>")}); + $("#<%= id_selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link_for_project(watched, user) %>")}); } else { - $("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link(watched, user) %>")}); + $("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link(watched, user) %>")}); } +<% end %> + + diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index dabd3a8c7..04d102d2e 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -1,6 +1,10 @@ <% if @journal_destroyed.nil? %> alert('<%=l(:notice_failed_delete)%>'); <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%> + <% if @user && @jours_count%> + $("#nh_jours_<%= @journal_destroyed.id %>").remove(); + <% else %> + <% if @bid && @jours_count %> $('#jours_count').html("<%= @jours_count %>"); <% elsif @course && @jours_count%> @@ -12,6 +16,8 @@ destroyedItem.fadeOut(600,function(){ destroyedItem.remove(); }); + + <% end %> <% else %> $('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>'); $('#new_form_reference_user_id').val(""); diff --git a/config/routes.rb b/config/routes.rb index 0132b8fc6..0705f3c05 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -297,6 +297,11 @@ RedmineApp::Application.routes.draw do match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang match 'user_courses', :to => 'users#user_courses', :via => :get + match 'user_courses4show', :to => 'users#user_courses4show', :via => :get + match 'user_projects4show', :to => 'users#user_projects4show', :via => :get + match 'user_course_activities', :to => 'users#user_course_activities', :via => :get + match 'user_project_activities', :to => 'users#user_project_activities', :via => :get + match 'user_feedback4show', :to => 'users#user_feedback4show', :via => :get match 'user_homeworks', :to => 'users#user_homeworks', :via => :get match 'watch_projects', :to => 'users#watch_projects', :via => :get # added by bai @@ -340,6 +345,8 @@ RedmineApp::Application.routes.draw do match 'my/remove_block', :via => :post match 'my/order_blocks', :via => :post match 'my/change_mail_notification', via: :get + match 'my/save_user_avatar', :to => 'my#save_user_avatar', :via => [:get, :post] + match 'my/clear_user_avatar_temp', :to => 'my#clear_user_avatar_temp', :via => [:get, :post] get 'my/page2', :to => 'my#page2', :as => "my_page2" diff --git a/public/images/pic_uersall.png b/public/images/pic_uersall.png new file mode 100644 index 0000000000000000000000000000000000000000..6f94640e38d1a7a52460e2db16f664235ca0fa41 GIT binary patch literal 9946 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 j|I_z>1{}_NWCUic4qM`sn(ul { left: -2px;} +div#menu a {position: relative;z-index: 10; height: 41px; display: block; float: left;line-height: 41px; text-decoration: none; font-size:14px; } +div#menu a:hover, div#menu a:hover span { color: #a1ebff; } +div#menu li.current a {} +div#menu {display: block; cursor: pointer; background-repeat: no-repeat;background-position: 95% 0;padding-right: 15px; _padding-right: 20px;} +div#menu ul a.parent {background: url(../images/item.png) -20px -30px no-repeat; width:60px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +div#menu ul a.parent:hover {background: url(../images/item.png) -20px -60px no-repeat;} +div#menu ul ul a.parent {background: url(../images/item.png) -20px 6px no-repeat;} +div#menu ul ul a.parent:hover {background: url(../images/item.png) -20px -11px no-repeat;} +/* menu::level1 */ +div#menu a { padding: 5px 12px 0 10px;line-height: 30px; color: #fff;} +div#menu li { background: url(images/main-delimiter.png) 98% 4px no-repeat; } +div#menu li.last { background: none; } +/* menu::level2 */ +div#menu ul ul li { background: none; } +div#menu ul ul { position: absolute;top: 38px; left: -999em; width: 90px; padding: 5px 0 0 0; background:#fff; border:1px solid #15bccf; margin-top:1px;} +div#menu ul ul a {padding: 0 0 0 15px; height: auto; float: none;display: block; line-height: 24px; font-size:12px; font-weight:normal;color:#15bccf;} +div#menu ul ul a:hover { color:#ff9900;} +div#menu ul ul li.last { margin-left:15px; } +div#menu ul ul li {width: 100%;} +/* menu::level3 */ +div#menu ul ul ul {padding: 0;margin: -38px 0 0 92px !important; width:140px; } +div#menu ul ul ul li a{ width:125px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf;} + +/*主类容*/ +#Main{ background:#fff; margin-bottom:10px;} +#content{} +#content02{ background:#fff; padding:10px; margin-bottom:10px;} +/*主类容搜索*/ +#TopBar{ height:60px; margin-bottom:10px; background:#fff;} +.topbar_info02{ margin:5px 10px;width:480px; } +.topbar_info02 p{color: #7f7f7f;} +.search{ margin-top:8px; margin-left:71px;} +.search_form{margin-top:8px;margin-left:72px;} +.topbar_info{ width:350px; color:#5c5c5c; font-size:16px; margin-right:50px; line-height:1.3; padding-left:100px;} +a.search_btn{ display:block; background:#15bccf; color:#fff; width:60px; height:24px; text-align:center; padding-top:3px;} +a:hover.search_btn{ background: #0fa9bb;} +.search_text{ border:1px solid #15bccf; background:#fff; width:220px; height:25px; padding-left:5px; } +/*主类容左右分栏*/ +#LSide{ width:240px; } +#RSide{ width:730px; margin-left:10px; background:#fff; padding:10px; margin-bottom:10px;} + + +/*底部*/ +#Footer{ padding-top:10px; background:#fff; margin-bottom:10px;} +.copyright{ width:780px; margin:0 auto;height:30px; } +.footlogo{ width:580px; margin:0 auto;height:50px; } +/*意见反馈*/ +html{ overflow-x:hidden;} +.scrollsidebar{ position: fixed; bottom:1px; right:1px; background:none; } +.side_content{width:154px; height:auto; overflow:hidden; float:left; } +.side_content .side_list {width:154px;overflow:hidden;} +.show_btn{ width:0; height:112px; overflow:hidden; float:left; margin-top:190px;cursor:pointer;} +.show_btn span { display:none;} +.close_btn{width:24px;height:24px;cursor:pointer;} +.side_title,.side_bottom,.close_btn,.show_btn {background:url(../images/sidebar_bg.png) no-repeat; } +.side_title {height:35px;} +.side_bottom { height:8px;} +.side_center {font-family:Verdana, Geneva, sans-serif; padding:0px 12px; font-size:12px;} +.close_btn { float:right; display:block; width:21px; height:16px; margin:9px 10px 0 0; _margin:16px 5px 0 0;} +.close_btn span { display:none;} +.side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;} +.msgserver { margin-top:5px;} +/*.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; }*/ +.msgserver a { height:21px; display:block; } +.opnionText{box-shadow:none; width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;overflow:auto; background-attachment:fixed;border-style:solid;} +a.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;} +a:hover.opnionButton{background: #0fa9bb; } +/* blue skin as the default skin */ +.side_title {background-position:-195px 0;} +.side_center {background:url(../images/blue_line.png) repeat-y center; } +.side_bottom {background-position:-195px -50px;} +a.close_btn {background-position:-44px 0;} +a:hover.close_btn {background-position:-66px 0;} +.show_btn {background-position:-119px 0;} +.msgserver a {color:#15bccf; } +.msgserver a:hover { text-decoration:underline; } + + +/***** Ajax indicator ******/ +#ajax-indicator { + position: absolute; /* fixed not supported by IE */ + background-color:#eee; + border: 1px solid #bbb; + top:35%; + left:40%; + width:20%; + font-weight:bold; + text-align:center; + padding:0.6em; + z-index:100000; + opacity: 0.5; +} + +html>body #ajax-indicator { position: fixed; } + +#ajax-indicator span { + background-position: 0% 40%; + background-repeat: no-repeat; + background-image: url(../images/loading.gif); + padding-left: 26px; + vertical-align: bottom; +} + +div.modal { + border-radius: 5px; + background: #fff; + z-index: 50; + padding: 4px; +} +.ui-widget-content { + border: 1px solid #ddd; + color: #333; +} +.ui-widget { + font-family: Verdana, sans-serif; + font-size: 1.1em; +} +.ui-dialog .ui-dialog-content { + position: relative; + border: 0; + padding: .5em 1em; + background: none; + overflow: auto; + zoom: 1; +} +.ui-widget-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} +.ui-widget-overlay { + background: #666 url(http://forge.trustie.net/stylesheets/jquery/images/xui-bg_diagonals-thick_20_666666_40x40.png.pagespeed.ic.9mfuw_R0z1.png) 50% 50% repeat; + opacity: .5; + filter: Alpha(Opacity=50); +} +/***** end Ajax indicator ******/ + +/***** Flash & error messages ****/ +#errorExplanation, div.flash, .nodata, .warning, .conflict { + padding: 4px 4px 4px 30px; + margin-bottom: 12px; + font-size: 1.1em; + border: 2px solid; +} + +div.flash {margin-top: 8px;} + +div.flash.error, #errorExplanation { + background: url(../images/exclamation.png) 8px 50% no-repeat; + background-color: #ffe3e3; + border-color: #dd0000; + color: #880000; +} + +div.flash.notice { + background: url(../images/true.png) 8px 5px no-repeat; + background-color: #dfffdf; + border-color: #9fcf9f; + color: #005f00; +} + +div.flash.warning, .conflict { + background: url(../images/warning.png) 8px 5px no-repeat; + background-color: #FFEBC1; + border-color: #FDBF3B; + color: #A6750C; + text-align: left; +} + +.nodata, .warning { + text-align: center; + background-color: #FFEBC1; + border-color: #FDBF3B; + color: #A6750C; +} + +#errorExplanation ul { font-size: 0.9em;} +#errorExplanation h2, #errorExplanation p { display: none; } + +.conflict-details {font-size:80%;} +/***** end Flash & error messages ****/ + + +/*弹出框*/ +.black_overlay{display:none;position:fixed;top:0px;left:0px;width:100%;height:100%;background-color:black;z-index:1001;-moz-opacity:0.8;opacity:.80;filter:alpha(opacity=80);} +.white_content{display:none;position:fixed;top:15%;left:30%;width:420px;height: auto; margin-bottom:20px;padding:16px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} +.white_content02{display:none;position:fixed;top:15%;left:30%;width:200px;height: auto; margin-bottom:20px;padding:10px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} +.newhwork_content{ display:none;position:fixed;top:15%;left:30%;width:600px;height: auto; margin-bottom:20px;padding:16px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} +.floatbox{ width:420px; border:3px solid #15bccf; background:#fff; padding:5px;} +a.box_close{ display:block; float:right; width:16px; height:16px; background:url(../images/img_floatbox.png) 0 0 no-repeat;} +a:hover.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} diff --git a/public/stylesheets/users.css b/public/stylesheets/users.css new file mode 100644 index 000000000..f57e1f7cc --- /dev/null +++ b/public/stylesheets/users.css @@ -0,0 +1,127 @@ +#RSide{ min-height:860px;} +/* 左侧信息*/ +.users_info{background:#fff; padding:10px; width:230px; padding-right:0px; margin-bottom:10px; } +.pic_head{ width:214px; height:214px; border:1px solid #cbcbcb; padding:2px; position:relative;} +.pic_head:hover{border:1px solid #64bdd9;} +.usersphoto_edit{ position:absolute; left:198px; top:200px;} +.icon_male{ background:url(../images/pic_uersall.png) 0 0 no-repeat; width:15px; height:15px;} +.icon_female{ background:url(../images/pic_uersall.png) 0 -24px no-repeat; width:15px; height:15px;} +.pf_intro{ width:222px; margin-top:5px; color:#696969; } +.leftbox{ width:230px; padding:10px; padding-right:0px; padding-bottom:5px;background:#fff; margin-bottom:10px; margin-right:10px;} +.pic_members{ background:url(../images/pic_users.jpg) 0 0 no-repeat; display:block; width:38px; height:38px; border:1px solid #e9edf0; margin-right:5px; margin-bottom:5px;float:left;} +.pic_members:hover{border:1px solid #c9c9c9;} +/*新建*/ +.top_new{ height:26px; border-bottom:10px solid #eaebed; padding:10px; background:#fff; float:left; margin-left:10px; width:730px; } +.top_new_bg{ background:url(../images/pic_uersall.png) -43px 3px no-repeat; height:26px; width:260px;} +.top_newcourses_bg{ background:url(../images/pic_uersall.png) -43px -29px no-repeat; height:28px; width:260px;} +.top_newproject_bg{ background:url(../images/pic_uersall.png) -43px -56px no-repeat; height:26px; width:260px;} +.newbtn{ height:24px; background:#18ca74; color:#fff; font-size:14px; padding:2px 12px 0 12px;} +.newbtn:hover{background: #14ad5a;} +a.newbtn_add{ display:block; background:url(../images/pic_uersall.png) -265px 3px no-repeat; height:20px; width:15px;} +a.newbtn_t{ font-size:14px; font-weight:bold; color:#fff;} +/*留言*/ +a.icon_face{background:url(../images/public_icon.png) 0px -671px no-repeat; display:block; height:25px; width:40px; padding-left:25px; padding-top:3px; } +a:hover.icon_face{background:url(../images/public_icon.png) -79px -671px no-repeat; } +.inputUsers_message{ border:1px solid #d2d2d2; width:718px; height:48px; color:#666; padding:5px; margin-bottom:5px;} +.inputUsers_message02{ border:1px solid #d2d2d2; width:618px; height:26px; color:#666; padding:5px; margin-bottom:5px; } +.message_list_box{ background:#f5f5f5; padding:10px;} +.users_pic{ width:27px; height:27px; border:1px solid #e3e3e3;} +.users_pic:hover{ border:1px solid #a5a5a5;} +.massage_txt{ max-width:360px; color: #666;} +.massage_time{ color:#8d8d8d; margin-top:5px;} +.message_list{ border-bottom:1px dashed #c9c9c9; padding-bottom:10px; margin-bottom:10px;} +.message_list_more{ text-align:center; width:720px;} +/*课程动态*/ +.line_box{ width:728px; border:1px solid #d9d9d9; padding-bottom:10px;} +.users_courses_list{ height:24px; border-bottom:1px dashed #CCC; margin-bottom:10px;} +.users_coursename{width:180px; font-weight:bold; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; margin-right:5px; } +.course_name{max-width:60px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.c_grey{ color:#8d8d8d;} +.users_courses_txt{width:330px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.users_top{ height:39px; border-bottom:1px solid #d9d9d9; margin-bottom:10px;} +.users_h4{border-bottom:1px solid #d9d9d9; height:29px; padding:10px 0 0 10px; margin-bottom:10px; } +/*弹框*/ +.white_content_users{display:none;position:fixed;top:45%;left:45%;width:210px;height: auto; margin-bottom:20px;padding:10px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} +a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} +/*我的课程*/ +.courses_top{ height:27px; border-bottom:3px solid #ebebeb;} +.courses_h2{ font-size:16px; font-weight:bold; color:#64bddb; border-bottom:3px solid #64bddb; padding-bottom:3px; padding-right:3px;} +.courses_select{} +a.select_btn{ border:1px solid #acacac; padding:0px 10px; color:#989898; display:block;} +a.select_btn:hover{ background:#64bddb; color:#fff;} +a.select_btn_select{ background:#64bddb; color:#fff;} +.courses_list_pic{ border:1px solid #ede7e9; width:64px; height:64px; padding:1px;} +.courses_list_pic:hover{border:1px solid #64bdd9;} +.courses_list_title{ max-width:500px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.pic_eye_blue{display:block; background:url(../images/pic_uersall.png) -372px 3px no-repeat; width:16px; height:15px; } +.pic_eye_grey{display:block; background:url(../images/pic_uersall.png) -372px -10px no-repeat; width:16px; height:15px; } +.td_w70{ width:70px;} +.td_w60{ width:60px;} +.td_w110{ width:110px;} +.mt20{ margin-top:20px;} +.courses_list{ padding-bottom:10px; } +.courses_list_table{ color:#6e6e6e;} +/****翻页***/ +.wlist{float:right;} +.wlist li{float:left;} +.wlist a{ float:left; border:1px solid #64bdd9; padding:0 5px; margin-left:3px; color:#64bdd9;} +.wlist a:hover{border:1px solid #64bdd9; background-color:#64bdd9; color:#fff; text-decoration:none;} +.wlist_select a { background-color:#48aac9; color:#fff;} +/* 设置 */ +#users_setting{clear:both;width:730px;/*滑动门的宽度*/} +/* TAB 切换效果 */ +.users_tb_{ border-bottom:3px solid #CCC; height:26px; } +.users_tb_ ul{height:26px; } +.users_tb_ li{float:left;height:26px;width: 90px;cursor:pointer; font-size:14px; text-align:center; } +/* 控制显示与隐藏css类 */ +.users_normaltab { color:#666; } +.users_hovertab { color:#64bdd9; border-bottom:3px solid #64bdd9; font-weight:bold;} +.users_normaltab a { color:#64bdd9 ; } +.users_hovertab a{color:#fff; background-color:#64bdd9; text-decoration:none;} +.users_dis{display:block; } +.users_undis{display:none;} +.users_ctt{ font-size:14px; color:#666; margin-top:10px;} +.setting_left{ width:85px; text-align:right; float:left;} +.setting_left li{ height:28px;line-height:28px;} +.setting_right{width:500px; text-align:left; float:left; margin-left:8px;} +.setting_right li{ height:28px;line-height:28px;} +.users_ctt ul li{ margin-bottom:10px;} +.users_ctt input,.users_ctt select,.users_ctt textarea{ border:1px solid #CCC;} +.users_ctt input,.users_ctt select,.users_ctt option{ height:26px;} +.users_ctt input,.users_ctt textarea{ margin-left:2px;} +.users_ctt textarea{ margin-bottom:none;} +.w450{ width:450px;} +.w210{ width:200px;} +.w70{ width:70px;} +.h200{ height:200px;} +/* 个人主页*/ +a.gz_btn{display:block; background:url(../images/pic_uersall.png) -318px -25px no-repeat; width:33px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} +a:hover.gz_btn{ color:#ff5722;} +a.qx_btn{display:block; background:url(../images/pic_uersall.png) -318px -47px no-repeat; width:33px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} +a:hover.qx_btn{color:#64bdd9;} +a.c_lgrey{ color:#CCC;} +a:hover.c_lgrey{ color:#3ca5c6;} +.leftbox_ul_left{ width:60px; float:left; text-align:right; } +.leftbox_ul_right{ width:155px; float:left; margin-left:10px; } +.leftbox_ul_left li,.leftbox_ul_right li{ margin-bottom:5px;} +.c_dgrey{ color:#696969;} +.home_courses_list{ width:364px; margin-bottom:10px; } +.home_list_title{ width:260px; font-size:14px; font-weight:bold;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.users_list{ } +.users_course_intro{ width:530px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} + +/* 20150506上传头像*/ +.uppicBox{ width:265px; height:265px; background:#f2f2f5; float:left; color:#666; text-align:center;} +.showpicBox{width:133px; height:250px; background:#f2f2f5; float:left; margin-left:20px; text-align:center; padding-top:15px; color:#666;} +.mr2{ margin-right:2px;} +.uppic_btn{border:none; width:150px; background:none; margin-bottom:5px; color:#666; margin-top:105px;} +/* 新建作品*/ +.mr8{ margin-right:8px;} +.mt2{ margin-top:2px;} +.fans_sign{ width:560px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.newhwork_div ul li{ margin-bottom:10px; font-size:14px; color:#666;} +.newhwork_div input,.newhwork_div select{ height:26px;border:1px solid #CCC; } +.newhwork_div textarea{border:1px solid #CCC;} +.w460{ width:460px;} + +a.hidepic>img{display:none;} \ No newline at end of file From 11191f6743f958342d6888d3d1b3716459d6b90b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 9 Jul 2015 15:50:04 +0800 Subject: [PATCH 029/100] =?UTF-8?q?=E4=B8=8E=E7=BC=96=E7=A8=8B=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E6=9C=8D=E5=8A=A1=E5=99=A8=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 7 +++++++ app/controllers/student_work_controller.rb | 10 ++++++++-- db/schema.rb | 3 ++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 4ea590d54..8109a7e62 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -1,4 +1,5 @@ class HomeworkCommonController < ApplicationController + require 'net/http' layout "base_courses" before_filter :find_course, :only => [:index,:new,:create,:next_step] before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy] @@ -72,6 +73,8 @@ class HomeworkCommonController < ApplicationController homework_detail_programing.language = "C++" homework_detail_programing.standard_code = params[:standard_code] + question = {title:homework.name,content:homework.description} + uri = URI('http://fast.forge.trustie.net/api/questions.json') if params[:input] && params[:output] params[:input].each do |k,v| if params[:output].include? k @@ -79,6 +82,10 @@ class HomeworkCommonController < ApplicationController homework_test.input = v homework_test.output = params[:output][k] homework.homework_tests << homework_test + question[:input] = homework_test.input + question[:output] = homework_test.output + + res = Net::HTTP.post_form(uri, question) end end end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index b6f69a4da..d6b79cece 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -80,8 +80,14 @@ class StudentWorkController < ApplicationController end render_attachment_warning_if_needed(stundet_work) - if @homework.homework_type == 2 #编程作业,学生提交作品后计算系统得分 - + if @homework.homework_type == 2 && @homework.homework_detail_programing #编程作业,学生提交作品后计算系统得分 + url = "http://fast.forge.trustie.net/api/questions/#{@homework.homework_detail_programing.question_id}/solutions.json" + uri = URI(url) + solutions = { + src:stundet_work.description, + language:1 + } + Net::HTTP.post_form(uri, solutions) end if stundet_work.save diff --git a/db/schema.rb b/db/schema.rb index 539dd95d3..fcb925c50 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 => 20150708085629) do +ActiveRecord::Schema.define(:version => 20150709071731) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -589,6 +589,7 @@ ActiveRecord::Schema.define(:version => 20150708085629) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.float "ta_proportion", :default => 0.1 + t.integer "question_id" end create_table "homework_evaluations", :force => true do |t| From 851b468e8d875c29e344e6e2ea9aeda955042fb8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 10 Jul 2015 10:05:28 +0800 Subject: [PATCH 030/100] =?UTF-8?q?admin=E8=83=BD=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E9=97=AE=E5=8D=B7=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index d8a9d88c3..758747e02 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -23,7 +23,7 @@ class PollController < ApplicationController def show @poll = Poll.find params[:id] - if @poll.polls_status != 2 && !User.current.allowed_to?(:as_teacher,@course) + if @poll.polls_status != 2 && (!User.current.allowed_to?(:as_teacher,@course) || User.current.admin?) render_403 return end @@ -393,7 +393,7 @@ class PollController < ApplicationController end def is_member_of_course - render_403 unless(@course && User.current.member_of_course?(@course)) + render_403 unless(@course && (User.current.member_of_course?(@course) || User.current.admin?)) end def is_course_teacher From 4b275bcbdf11e4d1eb0795fafe25bb80b28e7ae8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 10 Jul 2015 11:36:44 +0800 Subject: [PATCH 031/100] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=EF=BC=8C=E4=BD=9C=E4=B8=9A=E8=8E=B7=E5=8F=96question?= =?UTF-8?q?=E7=9A=84id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 2 ++ config/routes.rb | 1 + 2 files changed, 3 insertions(+) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 8109a7e62..017d22de0 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -86,6 +86,8 @@ class HomeworkCommonController < ApplicationController question[:output] = homework_test.output res = Net::HTTP.post_form(uri, question) + result = JSON.parse(res.body) + homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0 end end end diff --git a/config/routes.rb b/config/routes.rb index f31ec9859..de8a92b66 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -86,6 +86,7 @@ RedmineApp::Application.routes.draw do end collection do post 'next_step' + post 'set_program_score' end end From 02d09c84b42f3a31f8e6729e2a58db131bf4eec6 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 10 Jul 2015 14:17:19 +0800 Subject: [PATCH 032/100] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5->?= =?UTF-8?q?=E7=95=99=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 +- app/controllers/words_controller.rb | 11 +- app/helpers/users_helper.rb | 4 +- app/views/layouts/base_users_new.html.erb | 4 +- app/views/users/show.html.erb | 219 +++++++++++--------- app/views/users/user_feedback4show.html.erb | 18 +- app/views/words/create.js.erb | 13 +- app/views/words/create_reply.js.erb | 13 +- app/views/words/destroy.js.erb | 4 +- public/stylesheets/users.css | 2 +- 10 files changed, 173 insertions(+), 119 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b02ebd7e5..c83afd397 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -575,8 +575,10 @@ class UsersController < ApplicationController if params[:lastid]!=nil && !params[:lastid].empty? query = query.where("#{JournalsForMessage.table_name}.id < ?",params[:lastid]) end + logger.info('xxoo') @list = query.order("#{JournalsForMessage.table_name}.id desc").limit(3).all - render :layout=>nil + logger.info('aavv') + render :layout=>nil,:locals => {:feed_list=>@list} end def show diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index cc6c4f47e..4ff01d36c 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -13,11 +13,12 @@ class WordsController < ApplicationController end refer_user_id = params[:new_form][:reference_user_id].to_i - @user.add_jour(User.current, message, refer_user_id) + list = @user.add_jour(User.current, message, refer_user_id) unless refer_user_id == 0 || refer_user_id == User.current.id - User.find(refer_user_id).add_jour(User.current, message, refer_user_id) + list = User.find(refer_user_id).add_jour(User.current, message, refer_user_id) end - @user.count_new_jour + @jour = list.last + # @user.count_new_jour # if a_message.size > 5 # @message = a_message[-5, 5] # else @@ -26,8 +27,8 @@ class WordsController < ApplicationController # @message_count = a_message.count end end - @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse - @jour = paginateHelper @jours,10 + # @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse + # @jour = paginateHelper @jours,10 respond_to do |format| # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 8a373edab..b1f71f40f 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -324,8 +324,8 @@ module UsersHelper def query_activities(query,type) query_rec_count = 50 - #query = query.where("act_type not in ('Contest','Contestnotifications','Principal')") - query = query.where("act_type='JournalsForMessage'") + query = query.where("act_type not in ('Contest','Contestnotifications','Principal')") + # query = query.where("act_type='JournalsForMessage'") #query = query.where("act_type not in (?)", ['JournalsForMessage','Message','HomeworkCommon','News','Issue','Journal','Poll']) list = query.order("id desc").limit(query_rec_count).all if( list == nil || list.count() < query_rec_count ) diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index 8911df5ce..4da9ae3a3 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -183,14 +183,14 @@ $(".subNav").click(function(){ <% end %> <% if (@user.user_extensions.identity == 0 || @user.user_extensions.identity == 1) && !@user.user_extensions.school.nil? %> -
  • <%= @user.user_extensions.school.name %>
  • +
  • <%= @user.user_extensions.school.name %>
  • <% elsif @user.user_extensions.identity == 3 && !@user.user_extensions.occupation.nil? && !@user.user_extensions.occupation.empty? %>
  • <%= @user.user_extensions.occupation %>
  • <% elsif @user.user_extensions.identity == 2 %>
  • <%= @user.show_name %>
  • <% end %> <% if (!@user.user_extensions.description.nil? && !@user.user_extensions.description.empty?) %> -
  • <%= @user.user_extensions.description %>
  • +
  • <%= @user.user_extensions.description %>
  • <% end %> <% end %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index bb0ce28d7..2b54b6d5c 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -29,18 +29,20 @@ <% end %>
    -
    -
    - -

    -
    - 取消 - 发布 -
    +
    +
    +
    + +

    +
    + 取消 + 发布 +
    +
    -
    -
    + -
    +