From 96220a014762e0d54ed910e819c62b6998f5371d Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 15 Jun 2015 10:08:05 +0800 Subject: [PATCH 001/301] schema.rb --- db/schema.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/db/schema.rb b/db/schema.rb index 68f00c1cd..32e8cd7a8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -721,6 +721,16 @@ ActiveRecord::Schema.define(:version => 20150604153000) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_details_copy", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" From 44e3daa0d2ea1512534e84b24c41d4bbede1c761 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 16 Jun 2015 10:39:42 +0800 Subject: [PATCH 002/301] =?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 003/301] =?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 004/301] =?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 005/301] =?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 006/301] =?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 007/301] =?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 008/301] =?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 009/301] =?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 010/301] =?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 011/301] =?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 012/301] =?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 d73a2c100336f9f24e488cbfe9513e81ed2e7d8a Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 19 Jun 2015 15:05:25 +0800 Subject: [PATCH 013/301] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=96=B0=E7=89=88api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 2 +- app/api/mobile/entities/attachment.rb | 8 +- app/api/mobile/entities/course_dynamic.rb | 103 ++++++++++++++++++++++ app/api/mobile/entities/homework.rb | 10 ++- app/services/courses_service.rb | 95 +++++++++++++++++++- 5 files changed, 214 insertions(+), 4 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 73d1e357c..c325639f9 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -247,7 +247,7 @@ module Mobile end get "course_dynamic/:id" do cs = CoursesService.new - count = cs.course_dynamic(params,current_user) + count = cs.all_course_dynamics(params,current_user) present :data, count, with: Mobile::Entities::CourseDynamic present :status, 0 end diff --git a/app/api/mobile/entities/attachment.rb b/app/api/mobile/entities/attachment.rb index 080b24558..b7424fac9 100644 --- a/app/api/mobile/entities/attachment.rb +++ b/app/api/mobile/entities/attachment.rb @@ -1,13 +1,18 @@ module Mobile module Entities class Attachment < Grape::Entity + include Redmine::I18n def self.attachment_expose(field) expose field do |f,opt| if f.is_a?(Hash) && f.key?(field) f[field] elsif f.is_a?(::Attachment) if f.respond_to?(field) - f.send(field) + if field == :created_on + format_time(f.send(field)) + else + f.send(field) + end else #case field # when "" @@ -21,6 +26,7 @@ module Mobile attachment_expose :description attachment_expose :downloads attachment_expose :quotes + attachment_expose :created_on end end end \ No newline at end of file diff --git a/app/api/mobile/entities/course_dynamic.rb b/app/api/mobile/entities/course_dynamic.rb index b6e4630e4..56b83d513 100644 --- a/app/api/mobile/entities/course_dynamic.rb +++ b/app/api/mobile/entities/course_dynamic.rb @@ -6,6 +6,62 @@ module Mobile expose field do |c,opt| if field == :update_time (format_time(c[field]) if (c.is_a?(Hash) && c.key?(field))) + elsif field == :news_count + obj = nil + c[:dynamics].each do |d| + if d[:type] == 1 + obj = d[:count] + end + end + obj + elsif field == :document_count + obj = nil + c[:dynamics].each do |d| + if d[:type] == 3 + obj = d[:count] + end + end + obj + elsif field == :jour_message_count + obj = nil + c[:dynamics].each do |d| + if d[:type] == 2 + obj = d[:count] + end + end + obj + elsif field == :homework_count + obj = nil + c[:dynamics].each do |d| + if d[:type] == 4 + obj = d[:count] + end + end + obj + elsif field == :homework_submit_num + obj = nil + c[:dynamics].each do |d| + if d[:type] == 4 + obj = d[:submit_count] + end + end + obj + elsif field == :homework_submit_students + obj = nil + c[:dynamics].each do |d| + if d[:type] == 4 + obj = d[:studentlist] + end + end + obj + elsif field == :homework_status + obj = nil + c[:dynamics].each do |d| + if d[:type] == 4 + obj = d[:homework_status] + end + end + obj else c[field] if (c.is_a?(Hash) && c.key?(field)) end @@ -21,6 +77,53 @@ module Mobile course_dynamic_expose :course_img_url course_dynamic_expose :message course_dynamic_expose :update_time + course_dynamic_expose :count + course_dynamic_expose :news_count + course_dynamic_expose :document_count + course_dynamic_expose :jour_message_count + course_dynamic_expose :homework_count + course_dynamic_expose :homework_submit_students + course_dynamic_expose :homework_submit_num + course_dynamic_expose :homework_status + #在dynamics里解析出四种动态 + expose :document,using:Mobile::Entities::Attachment do |f,opt| + obj = nil + f[:dynamics].each do |d| + if d[:type] == 3 + obj = d[:documents] + end + end + obj + end + expose :jour_message,using:Mobile::Entities::Jours do |f,opt| + obj = nil + f[:dynamics].each do |d| + if d[:type] == 2 + obj = d[:jour_message] + end + end + obj + end + expose :homework,using:Mobile::Entities::Homework do |f,opt| + obj = nil + f[:dynamics].each do |d| + if d[:type] == 4 + obj = d[:homework] + end + end + obj + end + + expose :news,using:Mobile::Entities::News do |f,opt| + obj = nil + f[:dynamics].each do |d| + if d[:type] == 1 + obj = d + end + end + obj + end + end end end \ No newline at end of file diff --git a/app/api/mobile/entities/homework.rb b/app/api/mobile/entities/homework.rb index ee623d9ff..18dbe0d3b 100644 --- a/app/api/mobile/entities/homework.rb +++ b/app/api/mobile/entities/homework.rb @@ -1,3 +1,4 @@ +# 这个模块由于作业模块的改变,里边的注释以及属性不可信 module Mobile module Entities class Homework < Grape::Entity @@ -14,7 +15,12 @@ module Mobile if f.respond_to?(field) f.send(field) else - + case field + when :homework_name + f.send(:name) + when :homework_notsubmit_num + f.course.members.count - f.student_works.count + end end end end @@ -60,6 +66,8 @@ module Mobile f[:homework_for_anonymous_comments] if f.is_a?(Hash) && f.key?(:homework_for_anonymous_comments) end + homework_expose :homework_notsubmit_num + end end end \ No newline at end of file diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index d4a197aff..3856a7642 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -615,9 +615,102 @@ class CoursesService homework_scores end + #app新版api + # + # + #课程动态 + public + def all_course_dynamics params, current_user + #获取当前用户的所有课程 + @user = User.find(params[:id]) + if current_user.nil? && !current_user.admin? && !@user.active? + raise '404' + return + end + if current_user == @user || current_user.admin? + membership = @user.coursememberships.all + else + membership = @user.coursememberships.all(:conditions => Course.visible_condition(current_user)) + end + if membership.nil? || membership.count == 0 + raise l(:label_no_courses, :locale => get_user_language(current_user)) + end + membership.sort! { |older, newer| newer.created_on <=> older.created_on } + + #定义一个数组集合,存放hash数组,该hash数组包括课程的信息,并包含课程的最新发布的资源,最新的讨论区留言,最新的作业,最新的通知 + result = [] + #对用户所有的课程进行循环,找到每个课程最新发布的资源,最新的讨论区留言,最新的作业,最新的通知,并存进数组 + membership.each do |mp| + course = mp.course + latest_course_dynamics = [] + dynamics_count = 0 + # 课程通知 + latest_news = course.news.order("created_on desc").first + unless latest_news.nil? + latest_course_dynamics << {:type => 1, :time => latest_news.created_on,:count=>course.news.count, + :news => latest_news} + dynamics_count += 1 + end + # 课程讨论区 + latest_message = course.journals_for_messages.where("m_parent_id is null").order("created_on desc").first + unless latest_message.nil? + latest_course_dynamics << {:type => 2, :time => latest_message.created_on, :count =>course.journals_for_messages.where('m_parent_id is null').count, :jour_message => latest_message} + dynamics_count += 1 + end + # 课程资源 + latest_attachment = course.attachments.order("created_on desc").first + unless latest_attachment.nil? + latest_course_dynamics << {:type => 3, :time => latest_attachment.created_on,:count =>course.attachments.count , :documents=>latest_attachment} + dynamics_count += 1 + end + #课程作业 已经交的学生列表(暂定显示6人),未交的学生列表,作业的状态 + homework = course.homework_commons.order('created_at desc').first + homework_status = ""; + # 判断作业所处的状态,如果是刚发布,就获取剩余时间 + #如果是匿评状态,显示正在匿评 + #如果是匿评结束,显示匿评结束 + #获取作业提交的前6个人,不足6个显示所有 + studentlist = [] + if !homework.nil? + if homework.homework_type == 1 && homework.homework_detail_manual + case homework.homework_detail_manual.comment_status + when 1 + homework_status = show_homework_deadline homework + when 2 + homework_status = "正在匿评中" + when 3 + homework_status = "匿评已结束" + end + elsif homework.homework_type == 0 + homework_status = "未启用匿评" + elsif homework.homework_type == 2 + homework_status = "编程作业" + else + end + # 获取提交作业的前六个学生的名字 和 头像路径 + homework.student_works.order("created_at desc").page(1).per(6).each do |work| + studentlist << {:image_url=> url_to_avatar(work.user),:user_name=>work.user.realname} + end + latest_course_dynamics << {:type => 4, :time => homework.updated_at, :count=>course.homework_commons.count,:submit_count => homework.student_works.count , :homework => homework, :homework_status => homework_status, :studentlist => studentlist} + dynamics_count += 1 + end + latest_course_dynamics.sort! { |order, newer| newer[:time] <=> order[:time] } + latest_course_dynamic = latest_course_dynamics.first + unless latest_course_dynamic.nil? + result << {:course_name => course.name, :course_id => course.id, :course_img_url => url_to_avatar(course), :course_time => course.time, :course_term => course.term,:message => dynamics_count, :dynamics => latest_course_dynamics, :count => dynamics_count} + end + end + #返回数组集合 + result.sort! { |order, newer| newer[:update_time] <=> order[:update_time] } + result + end + #计算作业的截止日期,剩余日期 + def show_homework_deadline homework + "截止日期:" << homework.end_time.to_s << ",剩余时间:" << (Date.parse(Time.now.to_s) - Date.parse(homework.end_time.to_s)).to_i.to_s << "天" + end + end -end \ No newline at end of file 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 014/301] 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 5d9c730fd14a3e9614025c943f86220af2c678c2 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 19 Jun 2015 16:17:29 +0800 Subject: [PATCH 015/301] =?UTF-8?q?=E6=9C=AA=E5=BC=80=E5=90=AF=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E4=BD=9C=E4=B8=9A=E4=B8=8D=E7=8E=B0=E5=AE=9E=E7=BC=BA?= =?UTF-8?q?=E8=AF=84=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 6325abc09..0c5983a36 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -36,7 +36,7 @@ <% if @show_all%> 搜索 - <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher%> + <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher && @homework.homework_type == 1%> <% end%> <% if @is_teacher%>
    From 95ab6dd6c0bcd276c823aa57d42069e22571a40b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 19 Jun 2015 16:20:18 +0800 Subject: [PATCH 016/301] =?UTF-8?q?=E6=9C=AA=E5=BC=80=E5=90=AF=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E4=BD=9C=E4=B8=9A=E4=B8=8D=E5=8F=AF=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E7=BC=BA=E8=AF=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 0c5983a36..38fcb78c9 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -36,7 +36,7 @@ <% if @show_all%> 搜索 - <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher && @homework.homework_type == 1%> + <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher && @homework.homework_type == 1 && @homework.homework_detail_manual.comment_status != 1 %> <% end%> <% if @is_teacher%>
    From a9ff9f96bdf3fee15afd7fa376fd85b3c3046a27 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 19 Jun 2015 16:23:28 +0800 Subject: [PATCH 017/301] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6=E7=BC=BA=E8=AF=84=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 3ca836773..2693eea82 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -245,15 +245,19 @@ class StudentWorkController < ApplicationController def student_work_absence_penalty render_403 unless User.current.allowed_to?(:as_teacher,@course) order = params[:order] || "desc" - work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" - @stundet_works = StudentWork.find_by_sql("SELECT *,(all_count - has_count) AS absence FROM( + if @homework.student_works.empty? + @stundet_works = [] + else + work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" + @stundet_works = StudentWork.find_by_sql("SELECT *,(all_count - has_count) AS absence FROM( SELECT * , (SELECT COUNT(*) FROM `student_works_evaluation_distributions` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS all_count, (SELECT COUNT(*) FROM `student_works_scores` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS has_count FROM `student_works` WHERE homework_common_id = #{@homework.id} - ) AS table_1 - ORDER BY absence #{order}") + ) AS table_1 + ORDER BY absence #{order}") + end @order = order == "desc" ? "asc" : "desc" respond_to do |format| format.html From 5d1b157cd76f90b1245921e9b8f806451a7ccb95 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 23 Jun 2015 15:49:39 +0800 Subject: [PATCH 018/301] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=EF=BC=88=E7=89=B9=E6=AE=8A=E6=83=85=E5=86=B5=EF=BC=89=EF=BC=9A?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E7=95=99=E8=A8=80=E4=B8=BA=E7=A9=BA=EF=BC=8C?= =?UTF-8?q?=E5=8F=AA=E6=9B=B4=E6=96=B0=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/send_for_user_activities.html.erb | 12 ++++++------ config/configuration.yml | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 98abc00f7..724d59e6f 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -57,7 +57,7 @@ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_project_notice) %> - <%= link_to truncate(course_news_comment.comments,length: 30,omission: '...'), news_url(course_news_comment.commented,:token => @token.value), + <%= link_to truncate(course_news_comment.comments.html_safe,length: 30,omission: '...'), news_url(course_news_comment.commented,:token => @token.value), :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> @@ -89,7 +89,7 @@ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_course_homework) %> - <%= link_to truncate(bid.name,length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value), + <%= link_to truncate(bid.name.html_safe,length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value), :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> @@ -150,7 +150,7 @@ <%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name", :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_send_course_messages) %> - <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value), + <%= link_to truncate(course_message.subject.html_safe,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value), :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= format_time(course_message.created_on) %> @@ -244,11 +244,11 @@ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_project_issue) %> <% if issues_journal.notes.blank? || issues_journal.notes.nil? %> - <%= l(:label_isuue_mail_status) %> + <%= link_to truncate(l(:label_isuue_mail_status),length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <% else %> <%= link_to truncate(issues_journal.notes.html_safe,length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), - :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" - %> + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <% end %> <%= format_time(issues_journal.created_on) %>
  • diff --git a/config/configuration.yml b/config/configuration.yml index 390754a87..111efc8b4 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -103,7 +103,7 @@ default: # autologin_cookie_name: the name of the cookie (default: autologin) # autologin_cookie_path: the cookie path (default: /) # autologin_cookie_secure: true sets the cookie secure flag (default: false) - autologin_cookie_name: "autologin_trustie" + autologin_cookie_name: autologin_cookie_path: autologin_cookie_secure: @@ -200,7 +200,7 @@ default: # specific configuration options for production environment # that overrides the default ones production: - cookie_domain: ".trustie.net" + # CJK support rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf email_delivery: delivery_method: :smtp @@ -218,9 +218,9 @@ development: email_delivery: delivery_method: :smtp smtp_settings: - address: mail.trustie.net + address: smtp.163.com port: 25 - domain: mail.trustie.net - authentication: :login - user_name: "mail@trustie.net" - password: "loong2010" + domain: smtp.163.com + authentication: :plain + user_name: huang.jingquan@163.com + password: 'xinhu1ji2qu366' From f65f2dc926a852d186f9f5b06a66c29e737642bc Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 24 Jun 2015 09:31:52 +0800 Subject: [PATCH 019/301] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E3=80=81=E5=9B=9E=E5=A4=8D=E3=80=81=E5=8F=91=E5=B8=83=E7=BC=BA?= =?UTF-8?q?=E9=99=B7=E3=80=81=E5=9B=9E=E5=A4=8D=E5=90=88=E4=BA=8C=E4=B8=BA?= =?UTF-8?q?=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mailer/send_for_user_activities.html.erb | 97 +++++++------------ config/locales/courses/zh.yml | 2 +- 2 files changed, 35 insertions(+), 64 deletions(-) diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 724d59e6f..6ff436fc8 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -7,7 +7,7 @@

    <%= l(:label_course_overview)%>

    - <% unless @course_news.first.nil? %> + <% unless @course_news.first.nil? || @course_news_comments.first.nil? %>
      <%= l(:label_course_news) %> @@ -33,23 +33,15 @@ <% end %>
      -
    - <% end %> - - - <% unless @course_news_comments.first.nil? %> -
      - - <%= l(:label_course_mail_news_reply) %> - + <% @course_news_comments.each do |course_news_comment|%>
    • [ <% unless course_news_comment.commented.nil? %> - <%= link_to truncate(course_news_comment.commented.course.name,length: 30,omission: '...'), course_url(course_news_comment.commented.course, :token => @token.value), - :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <%= link_to truncate(course_news_comment.commented.course.name,length: 30,omission: '...'), course_url(course_news_comment.commented.course, :token => @token.value), + :class=> "wmail_column", + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <% end %> ] @@ -65,7 +57,7 @@
    • <% end %>
      -
    + <% end %> @@ -198,7 +190,7 @@ @project_news_comments.first %>

    <%= l(:label_project_overview_new)%>

    - <% unless @issues.first.nil? %> + <% unless @issues.first.nil? || @issues_journals.first.nil? %>
      <%= l(:label_issue_tracking) %> @@ -220,44 +212,32 @@ <%= format_time(issue.created_on) %> <% end %> - +
      + <% @issues_journals.each do |issues_journal| %> +
    • + + [ + <%= link_to truncate(issues_journal.issue.project.name,length: 30,omission: '...'), project_url(issues_journal.issue.project, :token => @token.value), + :class=> "wmail_column", + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + ] + <%= link_to issues_journal.user, user_activities_url(issues_journal.user,:token => @token.value), :class => "wmail_name", + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_project_issue) %> + <% if issues_journal.notes.blank? || issues_journal.notes.nil? %> + <%= link_to truncate(l(:label_isuue_mail_status),length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <% else %> + <%= link_to truncate(issues_journal.notes.html_safe,length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <% end %> + <%= format_time(issues_journal.created_on) %> +
    • + <% end %>
    <% end %> - - - <% unless @issues_journals.first.nil? %> -
      - - <%= l(:label_issue_tracking) %> - - <% @issues_journals.each do |issues_journal| %> -
    • - - [ - <%= link_to truncate(issues_journal.issue.project.name,length: 30,omission: '...'), project_url(issues_journal.issue.project, :token => @token.value), - :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - ] - <%= link_to issues_journal.user, user_activities_url(issues_journal.user,:token => @token.value), :class => "wmail_name", - :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> - <%= l(:label_project_issue) %> - <% if issues_journal.notes.blank? || issues_journal.notes.nil? %> - <%= link_to truncate(l(:label_isuue_mail_status),length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), - :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <% else %> - <%= link_to truncate(issues_journal.notes.html_safe,length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), - :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> - <% end %> - <%= format_time(issues_journal.created_on) %> -
    • - <% end %> - -
      -
    - <% end %> - <% unless @project_messages.first.nil? %>
      @@ -322,7 +302,7 @@ <% end %> - <% unless @project_news.first.nil? %> + <% unless @project_news.first.nil? || @project_news_comments.first.nil? %>
        <%= l(:label_project_news) %> @@ -347,23 +327,14 @@ <% end %>
        -
      - <% end %> - - - <% unless @project_news_comments.first.nil? %> -
        - - <%= l(:label_project_news) %> - <% @project_news_comments.each do |project_news_comment|%>
      • [ <% unless project_news_comment.commented.nil? %> - <%= link_to truncate(project_news_comment.commented.project.name,length: 30,omission: '...'), project_url(project_news_comment.commented.project, :token => @token.value), - :class=> "wmail_column", - :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <%= link_to truncate(project_news_comment.commented.project.name,length: 30,omission: '...'), project_url(project_news_comment.commented.project, :token => @token.value), + :class=> "wmail_column", + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <% end %> ] <%= link_to project_news_comment.author, user_activities_url(project_news_comment.author,:token => @token.value), :class => "wmail_name", @@ -377,7 +348,7 @@
      • <% end %>
        -
      +
    <% end %> diff --git a/config/locales/courses/zh.yml b/config/locales/courses/zh.yml index 772d6bb52..498388cfc 100644 --- a/config/locales/courses/zh.yml +++ b/config/locales/courses/zh.yml @@ -20,7 +20,7 @@ zh: label_course_mail_news_reply: 课程通知回复 label_main_teacher: 主讲教师 label_course_term: 开课学期 - label_isuue_mail_status: 更新了issue状态 + label_isuue_mail_status: 更新了issue状态! label_join_course: 加入 label_exit_course: 退出 From 5b2202de75123a89aa950ece982471e79d5a6712 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 24 Jun 2015 09:41:33 +0800 Subject: [PATCH 020/301] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/configuration.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/config/configuration.yml b/config/configuration.yml index 111efc8b4..390754a87 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -103,7 +103,7 @@ default: # autologin_cookie_name: the name of the cookie (default: autologin) # autologin_cookie_path: the cookie path (default: /) # autologin_cookie_secure: true sets the cookie secure flag (default: false) - autologin_cookie_name: + autologin_cookie_name: "autologin_trustie" autologin_cookie_path: autologin_cookie_secure: @@ -200,7 +200,7 @@ default: # specific configuration options for production environment # that overrides the default ones production: - # CJK support + cookie_domain: ".trustie.net" rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf email_delivery: delivery_method: :smtp @@ -218,9 +218,9 @@ development: email_delivery: delivery_method: :smtp smtp_settings: - address: smtp.163.com + address: mail.trustie.net port: 25 - domain: smtp.163.com - authentication: :plain - user_name: huang.jingquan@163.com - password: 'xinhu1ji2qu366' + domain: mail.trustie.net + authentication: :login + user_name: "mail@trustie.net" + password: "loong2010" From c92bd138bb3423bf7c6e97caf98fb130f73a7b4b Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Wed, 24 Jun 2015 16:12:45 +0800 Subject: [PATCH 021/301] =?UTF-8?q?bug#2915:=E6=AD=A3=E5=BC=8F=E7=89=88?= =?UTF-8?q?=E2=80=94=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA=EF=BC=9A?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=86=85=E5=AE=B9=E8=BF=87=E5=A4=9A=E4=B8=94?= =?UTF-8?q?=E5=B8=A6=E6=9C=89=E8=A1=A8=E6=83=85=E6=97=B6=EF=BC=8C=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=AE=8C=E6=95=B4=EF=BC=8C=E4=B9=9F=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=B1=95=E5=BC=80=E6=8F=90=E7=A4=BA=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_show.html.erb | 27 ++++++++++++++++--------- app/views/boards/_project_show.html.erb | 27 ++++++++++++++++--------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 7eed593d9..417a5a8ba 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -70,26 +70,35 @@ //解决由于图片加载慢造成div高度不够 以至于展开按钮不显示的bug $(function(){ function nh_show_btn(){ - if($("#contentmessage<%=topic.id %>").height()>182){ - $("#project_show_<%= topic.id%>").show(); + if($("#project_show_<%= topic.id%>").is(':hidden')){ + if($("#contentmessage<%=topic.id %>").height()>182){ + $("#project_show_<%= topic.id%>").show(); + } } } var div = $("#contentmessage<%=topic.id %>"); var imgs = $('img',div); var lens = imgs.length; function nh_load_img_end(){ - lens--; - if(lens <= 0){ - nh_show_btn(); - } - } - if(lens <= 0){ nh_show_btn(); - }else{ +// lens--; +// if(lens <= 0){ +// nh_show_btn(); +// } + } + if(lens > 0){ $('img',div).load(function(){ nh_load_img_end(); }); } + nh_show_btn(); +// if(lens <= 0){ +// nh_show_btn(); +// }else{ +// $('img',div).load(function(){ +// nh_load_img_end(); +// }); +// } });
    diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index bb36c6f19..03d283031 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -62,26 +62,35 @@ //解决由于图片加载慢造成div高度不够 以至于展开按钮不显示的bug $(function(){ function nh_show_btn(){ - if($("#contentmessage<%=topic.id %>").height()>182){ - $("#project_show_<%= topic.id%>").show(); + if($("#project_show_<%= topic.id%>").is(':hidden')){ + if($("#contentmessage<%=topic.id %>").height()>182){ + $("#project_show_<%= topic.id%>").show(); + } } } var div = $("#contentmessage<%=topic.id %>"); var imgs = $('img',div); var lens = imgs.length; function nh_load_img_end(){ - lens--; - if(lens <= 0){ - nh_show_btn(); - } - } - if(lens <= 0){ nh_show_btn(); - }else{ +// lens--; +// if(lens <= 0){ +// nh_show_btn(); +// } + } + if(lens > 0){ $('img',div).load(function(){ nh_load_img_end(); }); } + nh_show_btn(); +// if(lens <= 0){ +// nh_show_btn(); +// }else{ +// $('img',div).load(function(){ +// nh_load_img_end(); +// }); +// } });
    From 251c08e431c2cb96bc6ae71adf88fa1e9e7cec62 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 24 Jun 2015 16:15:44 +0800 Subject: [PATCH 022/301] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=89=93=E5=8C=85?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=90=8D=E5=B8=A6+=E5=8F=B7=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/application.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index b90011a4f..aca077d91 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -911,8 +911,10 @@ $(function(){ else { if(res.length==1){ - location.href = '/zipdown/download?file='+res[0].file;return; + var file = encodeURI(res[0].file).replace(/\+/g, '%2B'); + location.href = '/zipdown/download?file='+file;return; } + document.getElementById('light').style.display='block'; $container = $('#light .upload_box_ul'); $container.empty(); From 777e3f6fad6f684b6964ff12e0556f213e414a48 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 25 Jun 2015 10:11:01 +0800 Subject: [PATCH 023/301] =?UTF-8?q?1=E3=80=81=E8=A7=A3=E5=86=B3=E9=9D=9E?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=88=90=E5=91=98=E8=AE=BF=E9=97=AE=E5=85=AC?= =?UTF-8?q?=E5=BC=80=E9=A1=B9=E7=9B=AE403=E9=97=AE=E9=A2=98=202=E3=80=81?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=BB=A5=E5=89=8D=E6=97=A0=E7=94=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=AF=B9=E5=BA=94=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/git_usage_controller.rb | 2 +- app/controllers/issue_categories_controller.rb | 2 +- app/controllers/organization_controller.rb | 2 +- app/controllers/projects_controller.rb | 16 ++++++++-------- .../app/controllers/code_review_controller.rb | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/controllers/git_usage_controller.rb b/app/controllers/git_usage_controller.rb index 4f9a96d6f..0b97fd523 100644 --- a/app/controllers/git_usage_controller.rb +++ b/app/controllers/git_usage_controller.rb @@ -1,6 +1,6 @@ #added by baiyu class GitUsageController < ApplicationController - layout "project_base" + layout "base_projects" def ch_usage end diff --git a/app/controllers/issue_categories_controller.rb b/app/controllers/issue_categories_controller.rb index fb62821d8..68713aa43 100644 --- a/app/controllers/issue_categories_controller.rb +++ b/app/controllers/issue_categories_controller.rb @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class IssueCategoriesController < ApplicationController - layout "project_base" + layout "base_projects" menu_item :settings model_object IssueCategory before_filter :find_model_object, :except => [:index, :new, :create] diff --git a/app/controllers/organization_controller.rb b/app/controllers/organization_controller.rb index db8295e44..62e6b85f6 100644 --- a/app/controllers/organization_controller.rb +++ b/app/controllers/organization_controller.rb @@ -1,5 +1,5 @@ class OrganizationController < ApplicationController - layout 'project_base' + layout 'base_projects' before_filter :require_admin, :except => [:index] def index diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6ad450315..e6e93947c 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -438,9 +438,9 @@ class ProjectsController < ApplicationController case params[:role] when '1' @subPage_title = l :label_teacher_list - @members = searchTeacherAndAssistant(@project) + @members = searchTeacherAndAssistant(@project) when '2' - @subPage_title = l :label_student_list + @subPage_title = l :label_student_list @members = searchStudent(@project) else @subPage_title = '' @@ -578,7 +578,7 @@ class ProjectsController < ApplicationController format.api { render_api_ok } end else - render :layout => "project_base" + render :layout => "base_projects" end # hide project in layout @project = nil @@ -586,7 +586,7 @@ class ProjectsController < ApplicationController def show_projects_score respond_to do |format| - format.html { render :layout => "project_base"} + format.html { render :layout => "base_projects"} format.js end end @@ -674,10 +674,10 @@ class ProjectsController < ApplicationController private def memberAccess - # 是课程,则判断当前用户是否参加了课程 - # return 0 if @project.project_type == Project::ProjectType_project - # currentUser = User.current - render_403 unless User.current.member_of?(@project) + # 如果是私有项目,项目成员不对外公开,公开项目成员列表对外公开。 + unless @project.is_public? + render_403 unless User.current.member_of?(@project) + end end def toggleCourse diff --git a/plugins/redmine_code_review/app/controllers/code_review_controller.rb b/plugins/redmine_code_review/app/controllers/code_review_controller.rb index 14c702e1e..421599525 100644 --- a/plugins/redmine_code_review/app/controllers/code_review_controller.rb +++ b/plugins/redmine_code_review/app/controllers/code_review_controller.rb @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class CodeReviewController < ApplicationController - layout "project_base" + layout "base_projects" unloadable before_filter :find_project, :authorize, :find_user, :find_setting, :find_repository From 3924bdf3381ece767232cefaaeca2f06cf3d24e9 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 25 Jun 2015 14:28:44 +0800 Subject: [PATCH 024/301] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E6=9F=A5=E7=9C=8B=E5=B7=AE=E5=88=AB=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/issues_helper.rb | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index e4f9a7a81..aae150728 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -361,16 +361,15 @@ module IssuesHelper end end - # 之所以注释是因为该功能冗余了 if detail.property == 'attr' && detail.prop_key == 'description' s = l(:text_journal_changed_no_detail, :label => label) - # unless no_html - # diff_link = link_to l(:label_diff), - # {:controller => 'journals', :action => 'diff', :id => detail.journal_id, - # :detail_id => detail.id, :only_path => options[:only_path]}, - # :title => l(:label_view_diff) - # s << " (#{ diff_link })" - # end + unless no_html + diff_link = link_to l(:label_diff), + {:controller => 'journals', :action => 'diff', :id => detail.journal_id, + :detail_id => detail.id, :only_path => options[:only_path]}, + :title => l(:label_view_diff) + s << " (#{ diff_link })" + end s.html_safe elsif detail.value.present? case detail.property From 046a593f42473861b09c7293f239d64932b412c9 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Thu, 25 Jun 2015 14:51:29 +0800 Subject: [PATCH 025/301] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E6=9C=89?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=9C=89=E8=BF=99=E7=A7=8D=E8=BE=93=E5=85=A5?= =?UTF-8?q?:=20=E5=8A=A0?= =?UTF-8?q?=E4=B8=AA=E5=85=88=E5=B0=86=E5=B0=B1=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_show.html.erb | 6 +++++- app/views/boards/_project_show.html.erb | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 417a5a8ba..3e1530e3f 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -104,6 +104,7 @@
    <%= topic.content.html_safe %> +
    @@ -166,7 +167,10 @@
    <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
    -
    <%= textAreailizable message,:content,:attachments => message.attachments %>
    +
    + <%= textAreailizable message,:content,:attachments => message.attachments %> + +

    <%= format_time(message.created_on) %> diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 03d283031..e7071d2a1 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -98,6 +98,7 @@
    <%= topic.content.html_safe %> +
    <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
    -
    <%= textAreailizable message,:content,:attachments => message.attachments %>
    +
    + <%= textAreailizable message,:content,:attachments => message.attachments %> + +

    <%= format_time(message.created_on) %> From 088854f7df3e8b2164ae66799b7e79339c33461d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 25 Jun 2015 14:53:33 +0800 Subject: [PATCH 026/301] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=AF=E8=AE=BF=E9=97=AE=E5=85=AC=E5=BC=80=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index d5e62127d..5cd55e23b 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -206,7 +206,7 @@ class HomeworkCommonController < ApplicationController #当前用户是不是课程的成员 def member_of_course - render_403 unless User.current.member_of_course?(@course) || User.current.admin? + render_403 unless @course.is_public || User.current.member_of_course?(@course) || User.current.admin? end def get_assigned_homeworks(student_works, n, index) From 7efe628e73cc1eb4b6ec9c488d7ab6cf7ef5fc39 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 25 Jun 2015 14:56:53 +0800 Subject: [PATCH 027/301] =?UTF-8?q?admin=E5=8F=AF=E4=BB=A5=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 2693eea82..e695a6fb0 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -284,7 +284,7 @@ class StudentWorkController < ApplicationController #是不是当前课程的成员 #当前课程成员才可以看到作品列表 def member_of_course - render_403 unless User.current.member_of_course? @course || User.current.admin? + render_403 unless User.current.member_of_course?(@course) || User.current.admin? end #判断是不是当前作品的提交者 From ebeeb9cf2892201da3cd5952dfb8bdf88cf21ba6 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 25 Jun 2015 15:55:57 +0800 Subject: [PATCH 028/301] =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E5=90=8E=E5=AD=A6=E7=94=9F=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=EF=BC=8C=E5=BC=80=E5=90=AF=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E6=97=B6=E5=AF=B9=E8=80=81=E5=B8=88=E7=9A=84=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=20=E7=95=8C=E9=9D=A2css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/_alert_anonyoms.html.erb | 4 +++- .../student_work/_new_student_work_alert.html.erb | 14 ++++++++++++++ app/views/student_work/_praise_alert.html.erb | 9 +++++++++ app/views/student_work/new.html.erb | 14 ++++++++++++++ public/javascripts/course.js | 2 ++ public/stylesheets/courses.css | 7 +++---- 6 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 app/views/student_work/_new_student_work_alert.html.erb create mode 100644 app/views/student_work/_praise_alert.html.erb diff --git a/app/views/homework_common/_alert_anonyoms.html.erb b/app/views/homework_common/_alert_anonyoms.html.erb index 3b199e0d8..13fcf6469 100644 --- a/app/views/homework_common/_alert_anonyoms.html.erb +++ b/app/views/homework_common/_alert_anonyoms.html.erb @@ -5,7 +5,9 @@

    开启匿评后学生将不能对作品进行 修改、删除 - 等操作,目前有 + 等操作,开启匿评后的提交作品,该学生及该学生提交的作业 + 不能参与匿评。 + 目前有 <%= @totle_size%>个 学生,共提交了 <%= @cur_size %> diff --git a/app/views/student_work/_new_student_work_alert.html.erb b/app/views/student_work/_new_student_work_alert.html.erb new file mode 100644 index 000000000..8e0c8a954 --- /dev/null +++ b/app/views/student_work/_new_student_work_alert.html.erb @@ -0,0 +1,14 @@ +

    +
    +

    + 当前作业 + 已开启匿评 + 您提交作品后将 + 不会收到任何匿评作品, + 您的作品也 + 不会被其他用户匿评. + 如需获得最终成绩,请您联系主讲老师对您的作品单独进行评分 +

    + 确定 +
    +
    diff --git a/app/views/student_work/_praise_alert.html.erb b/app/views/student_work/_praise_alert.html.erb new file mode 100644 index 000000000..293bcab13 --- /dev/null +++ b/app/views/student_work/_praise_alert.html.erb @@ -0,0 +1,9 @@ +
    +
    +

    匿名评价

    +

        据说雷锋做完好事是从来不留名的呢,我们这次评分也不留名!!!但是,但是,您给的分数一定要公正哦,老天爷看不到,我们的系统可是清楚得很!

    +

        别怪我没告诉你,系统分配给你的作品不评价可是要扣分的哈!

    + 匿名评分 + 冒着扣分的危险残忍拒绝 +
    +
    diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 7d685131f..1b82ac31b 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -1,3 +1,17 @@ +

    创建作品

    diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 8f87767ed..50dc89de8 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -671,6 +671,8 @@ function edit_student_work(id) {$("#edit_student_work_" + id).submit();} } +// + //滑动打分 $.fn.peSlider = function(settings){ //configurable options (none so far) diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index bb5baedd6..0bd28bea7 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -278,14 +278,11 @@ a:hover.member_btn{ background:#329cbd;} /* 匿名评分弹框 */ /*.popbox02{width:480px;height:200px;position:absolute;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}*/ .alert .close02{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-490px;background:url(images/close.png) no-repeat;cursor:pointer;} -.ni_con { width:425px; margin:25px 30px;} -.ni_con h2{ display:block; height:40px; width:188px; margin:0 auto;} -.ni_con p{ color:#808181;} -.ni_con a:hover{ text-decoration:none;} a.xls{ margin-left:5px; color:#136b3b;} /* 开启匿评弹框 */ .anonymos{width:480px;height:180px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} +.anonymos_work {position:fixed !important;left:60%;top:60%;margin:-215px 0 0 -300px; box-shadow:0px 0px 8px #194a81; overflow:auto;} .ni_con { width:425px; margin:25px 30px;} .ni_con h2{ display:block; height:40px; width:425px; text-align:center; color:#3a3a3a;} .ni_con p{ color:#808181; } @@ -294,6 +291,8 @@ a.xls{ margin-left:5px; color:#136b3b;} a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#15bccf; text-align:center; padding-top:4px; float:left; margin-right:15px;} a:hover.tijiao{ background:#0f99a9;} .c_pink{ color:#e65d5e;} +.ni_con_work { width:300px; margin:25px 20px;} +.ni_con_work p{ color:#808181; } /* 学生列表*/ .st_list{ width:670px;} From 620fd4230ea88cfd1d6484adf91bf3ae323e37c0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 25 Jun 2015 16:06:32 +0800 Subject: [PATCH 029/301] =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E5=90=8E=E5=AF=B9=E5=B7=B2=E5=88=86=E9=85=8D=E5=88=B0=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E4=BD=9C=E5=93=81=E7=9A=84=E5=AD=A6=E7=94=9F=E7=9A=84?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/_alert_anonyoms.html.erb | 8 +++++--- app/views/student_work/index.html.erb | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/views/homework_common/_alert_anonyoms.html.erb b/app/views/homework_common/_alert_anonyoms.html.erb index 13fcf6469..73f240b02 100644 --- a/app/views/homework_common/_alert_anonyoms.html.erb +++ b/app/views/homework_common/_alert_anonyoms.html.erb @@ -5,9 +5,11 @@

    开启匿评后学生将不能对作品进行 修改、删除 - 等操作,开启匿评后的提交作品,该学生及该学生提交的作业 - 不能参与匿评。 - 目前有 + 等操作,开启匿评后的提交作品,将 + 不能参与匿评, + 匿评评分将被记为 + 0分 + 。目前有 <%= @totle_size%>个 学生,共提交了 <%= @cur_size %> diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 38fcb78c9..015fb8e48 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -1,3 +1,17 @@ + +

    \ 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 %> - + +<%= 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 %> + 加入项目 <% 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 %> - + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 + <% else %> + + 加入课程 + <% end %> +
    + +<% end %> - - - - - - - - - <% 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 %> - -
    -
    -
    +
    +
    + <%= @center_flag ? '我的课程' : 'TA的课程' %> + <% if @center_flag %> + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 + <% else %> + 加入课程 + <% end %> + <% end %> +
    +
    +
    +
    + +
    +
    +
    +

    课程动态

    +
    + +
    - <% end %> - <% end %> - <% end %> -
    - - <% else %> - <% if @user == User.current %> - <%= l(:label_user_activities_no) %> +
    +
    + <%= @center_flag ? '我的项目' : 'TA的项目' %> + <% if @center_flag %> + <% if @user.allowed_to?(:add_project, nil, :global => true) %> + 新建项目 <% 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) %> + <% end %> + +
    +
    +
    + +
    + - <% 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 %> -
    +
    +

    项目动态

    +
    + +
    - +
    - <% else %> -

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

    - <% 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 @@ - - - -
    <% id = 'project_respond_form_'+ reply.id.to_s %> - <%= link_to "#{reply.user.show_name}(#{reply.user.login})", user_path(reply.user) %> - <%= l(:label_reply_to)%> - <% if show_name %> - <%= link_to "#{parent_jour.user.show_name}(#{parent_jour.user.login})", user_path(parent_jour.user) %> + <% if User.current.member_of_course?(@course) %> + <%= link_to User.current.member_of_course?(@course)? "#{reply.user.show_name}(#{reply.user.login})" : "#{reply.user.login}" , user_path(reply.user) %> + <%= l(:label_reply_to)%> + <% if show_name %> + <%= link_to "#{parent_jour.user.show_name}(#{parent_jour.user.login})", user_path(parent_jour.user) %> + <% else %> + <%#= 之所以改成这样是因为觉得没有真实姓名的用“匿名用户”替换不合理 %> + <%= link_to "#{parent_jour.user}", user_path(parent_jour.user) %> + <% end %> <% else %> - <%= l(:label_anonymous) %> + <%= link_to "#{reply.user}", user_path(reply.user) %> + <%= l(:label_reply_to)%> + <%= link_to "#{parent_jour.user}", user_path(parent_jour.user) %> <% end %> -

    <%= reply.notes.html_safe %>

    From 57f6f72c6410956bff6a4148aa21fbced4ed7cd9 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 10 Jul 2015 13:09:09 +0800 Subject: [PATCH 177/301] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E4=B8=8B=E9=9D=A2=E5=A4=9A=E4=BD=99=E7=9A=84=E9=BB=91?= =?UTF-8?q?=E8=89=B2=E6=A1=86=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/themes/default/default.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/assets/kindeditor/themes/default/default.css b/public/assets/kindeditor/themes/default/default.css index c5a84c186..986263903 100644 --- a/public/assets/kindeditor/themes/default/default.css +++ b/public/assets/kindeditor/themes/default/default.css @@ -522,8 +522,7 @@ /* statusbar */ .ke-statusbar { position: relative; - background-color: #F0F0EE; - border-top: 1px solid #CCCCCC; + font-size: 0; line-height: 0; *height: 12px; From e39fe372efb6168d49def122992aa6d00815354f Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 10 Jul 2015 13:32:56 +0800 Subject: [PATCH 178/301] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=8A=B6=E6=80=81=20?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E6=94=B9=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/api_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index 96966150c..fa231607a 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -93,7 +93,7 @@ module ApiHelper def homework_status_desc homework if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业 if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") - link = "截止日期之前不可启动匿评" + link = show_homework_deadline homework elsif homework.student_works.count >= 2 #作业份数大于2 case homework.homework_detail_manual.comment_status when 1 @@ -104,10 +104,10 @@ module ApiHelper link = " 匿评结束" end else - link = "提交作业数大于2才可启动匿评" + link = "提交作业数过少" end else - link = "未开启匿评作业不可启动匿评" + link = "未开启匿评作业" end link 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 179/301] =?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 %>
    -
    -
    - -

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

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