diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index e71fd5e29..04a07e9a8 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -18,28 +18,28 @@ class HomeworkCommonController < ApplicationController end def new - # @homework_type = "1" - # - # @homework = HomeworkCommon.new - # @homework.safe_attributes = params[:homework_common] - # @homework.late_penalty = 0 - # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - # @homework.publish_time = Time.now.strftime('%Y-%m-%d') - # - # 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 + @homework_type = "1" + + @homework = HomeworkCommon.new + @homework.safe_attributes = params[:homework_common] + @homework.late_penalty = 0 + @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + @homework.publish_time = Time.now.strftime('%Y-%m-%d') + + 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 diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 56b4a30fc..9385c73ee 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -73,8 +73,14 @@ class NewsController < ApplicationController @news_count = scope.count #@news_pages = Paginator.new @news_count, @limit, params['page'] #@offset ||= scope_page.offset - scope_order = scope.all(:include => [:author, :course], - :order => "#{News.table_name}.created_on DESC") + if params[:subject].nil? + scope_order = scope.all(:include => [:author, :course], + :order => "#{News.table_name}.created_on DESC") + else + scope_order = scope.where("news.title like '#{'%' << params[:subject].to_s << '%'}'").all(:include => [:author, :course], + :order => "#{News.table_name}.created_on DESC") + end + # :offset => @offset, # :limit => @limit) @newss = paginateHelper scope_order,10 @@ -83,6 +89,7 @@ class NewsController < ApplicationController @news = News.new render :layout => 'base_courses' } + format.js format.api format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") } end @@ -141,7 +148,7 @@ class NewsController < ApplicationController ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS end - # ض̬ļ¼add start + # ������ض�̬�ļ�¼add start teachers = searchTeacherAndAssistant(@course) for teacher in teachers if(teacher.user_id != User.current.id) @@ -155,7 +162,7 @@ class NewsController < ApplicationController notify.save() end end - # ض̬ļ¼add end + # ������ض�̬�ļ�¼add end render_attachment_warning_if_needed(@news) flash[:notice] = l(:notice_successful_create) redirect_to course_news_index_url(@course) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 209fa7269..da2575456 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -157,7 +157,7 @@ class StudentWorkController < ApplicationController end def edit - if @homework.homework_type == 2 #编程作业不能修改作业 + if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业 render_403 else respond_to do |format| @@ -396,6 +396,7 @@ class StudentWorkController < ApplicationController if student_work_test.result == 0 student_score_count += 1 end + student_work_test.error_msg = params[:compile_error_msg] student_work_test.save! end end @@ -444,7 +445,7 @@ class StudentWorkController < ApplicationController #判断是不是当前作品的提交者 #提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品 def author_of_work - render_403 unless (User.current.id == @work.user_id || User.current.admin?) && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) + render_403 unless User.current.admin? || (User.current.id == @work.user_id && @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) end def teacher_of_course diff --git a/app/models/student_work_test.rb b/app/models/student_work_test.rb index 2e6efdf0a..413528b82 100644 --- a/app/models/student_work_test.rb +++ b/app/models/student_work_test.rb @@ -1,6 +1,6 @@ # encoding: utf-8 class StudentWorkTest < ActiveRecord::Base - attr_accessible :student_work_id, :homework_test_id, :result + attr_accessible :student_work_id, :homework_test_id, :result, :error_msg belongs_to :homework_test belongs_to :student_work diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index c89f0af26..f801aff87 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -2,70 +2,39 @@ btn_tips = l(:label_news_notice) label_tips = l(:label_course_news) %> +

<%= label_tips %>

-

- <%= l(:label_total_news) %> - <%= @news_count %> - <%= l(:label_course_news_count) %> -

- <% if @course && User.current.allowed_to?(:manage_news, @course) %> - <%= link_to(btn_tips,new_course_news_path(@course),:class => 'problem_new_btn fl c_dorange')%> -
+
+

+ <%= l(:label_total_news) %> + <%= @news_count %> + <%= l(:label_course_news_count) %> +

+ <% if @course && User.current.allowed_to?(:manage_news, @course) %> + <%= link_to(btn_tips,new_course_news_path(@course),:class => 'problem_new_btn fl c_dorange')%> +
- <% end %> + <% end %> +
+
+
+ <%= render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count} %>
- <% if @newss.empty? %> -

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

- <% else %> - <% @newss.each do |news| %> -
- <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> -
- <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> - - <%= l(:label_release_news) %>: - - <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> - <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w" %> -
-
- -
-
- <%= news.description.html_safe %> -
-
-
- -
- <%= l(:label_create_time)%>:<%= format_time(news.created_on)%> - <%= link_to_attachments_course news %> -
- <%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %> -
-
-
- - <% end %> - <% end %> -
- - - <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> <%= stylesheet_link_tag 'scm' %> diff --git a/app/views/news/_course_news_list.html.erb b/app/views/news/_course_news_list.html.erb new file mode 100644 index 000000000..da963b3cd --- /dev/null +++ b/app/views/news/_course_news_list.html.erb @@ -0,0 +1,47 @@ +
+<% if newss.empty? %> +

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

+<% else %> + <% newss.each do |news| %> +
+ <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> +
+ <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> + + <%= l(:label_release_news) %>: + + <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> + <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w" %> +
+
+ +
+
+ <%= news.description.html_safe %> +
+
+
+ +
+ <%= l(:label_create_time)%>:<%= format_time(news.created_on)%> + <%= link_to_attachments_course news %> +
+ <%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %> +
+
+
+ + <% end %> +<% end %> +
+ + + \ No newline at end of file diff --git a/app/views/news/index.js.erb b/app/views/news/index.js.erb new file mode 100644 index 000000000..04671917b --- /dev/null +++ b/app/views/news/index.js.erb @@ -0,0 +1 @@ +$("#news_list").html("<%= escape_javascript(render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count})%>"); \ No newline at end of file diff --git a/app/views/projects/_tools_expand.html.erb b/app/views/projects/_tools_expand.html.erb index 4cf7ebcab..85c8ca6b1 100644 --- a/app/views/projects/_tools_expand.html.erb +++ b/app/views/projects/_tools_expand.html.erb @@ -43,97 +43,69 @@
  • <% if User.current.admin? %> - 软件知识库 - <%#= link_to l(:label_project_soft_knowledge) ,soft_knowledge_project_path(@project) %> - <% end %> -
  • -
  • - <% if User.current.admin? %> - 软件资源库 - <%#= link_to l(:label_project_soft_file) ,soft_file_project_path(@project) %> - <% end %> -
  • - -
  • - <% if User.current.admin? %> - <%= link_to l(:label_project_dts_new) ,dts_dep_project_path(@project), data: { confirm:'你确定要对本项目进行代码缺陷测试分析吗?' } %> - <% end %> -
  • - -
  • - <% if User.current.admin? %> - 在线开发平台 - <%#= link_to l(:label_project_online_dev) ,online_dev_project_path(@project) %> - <% end %> -
  • -
  • - <% if User.current.admin? %> - 软工服务平台 + QoS评估工具 <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> <% end %>
  • -
  • <% if User.current.admin? %> - 形式验证工具 + QoS证据采集工具 <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> <% end %>
  • -
  • <% if User.current.admin? %> - QoS 评估工具 + QoS证据评估统计分析工具 <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> <% end %>
  • -
  • <% if User.current.admin? %> - QoS 证据采集工具 - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> + <%= link_to "代码缺陷测试工具(DTS)" ,dts_dep_project_path(@project), data: { confirm:'你确定要对本项目进行代码缺陷测试分析吗?' } %> + <% end %> +
  • +
  • + <% if User.current.admin? %> + 软工服务平台(SASSP) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 软件知识库(KnowledgeBase) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 可信评估工具(Evaluator) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 在线验证工具(BACH-Online) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 软件测试工具(SSCC-Web) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 服务资源共享平台(ServiceXchange) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 在线服务开发平台(ServiceFoundry) + <% end %> +
  • +
  • + <% if User.current.admin? %> + 组合开发和运行演化平台(Service4All) <% end %>
  • -
  • - <% if User.current.admin? %> - 可信度评估工具 SAS - - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> - <% end %> -
  • -
  • - <% if User.current.admin? %> - 可信评估工具 Evaluator - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> - <% end %> -
  • -
  • - <% if User.current.admin? %> - 软件测试工具 SSCC-Web - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> - <% end %> -
  • - - - - - - -
  • - <% if User.current.admin? %> - QoS 证据评估统计分析工具 - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> - <% end %> -
  • - -
  • - <% if User.current.admin? %> - 在线验证工具 BACH-Online - <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> - <% end %> -
  • diff --git a/app/views/projects/dts_dep.html.erb b/app/views/projects/dts_dep.html.erb index 099e7d6d6..a0a79740d 100644 --- a/app/views/projects/dts_dep.html.erb +++ b/app/views/projects/dts_dep.html.erb @@ -45,11 +45,11 @@
    + \ No newline at end of file diff --git a/app/views/student_work/_evaluation_student_work.html.erb b/app/views/student_work/_evaluation_student_work.html.erb index b5bdd6f55..9569718fb 100644 --- a/app/views/student_work/_evaluation_student_work.html.erb +++ b/app/views/student_work/_evaluation_student_work.html.erb @@ -9,7 +9,8 @@ <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
  • - <%= link_to student_work.name, student_work_path(student_work.id),:remote => true,:title => student_work.name, :class => "c_blue02"%> + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> + <%= link_to student_work_name, student_work_path(student_work.id),:remote => true,:title => student_work.name, :class => "c_blue02"%>
  • <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %> diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index 11ce7b080..be07269c3 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -18,7 +18,8 @@ <% end%>
  • - <%= link_to student_work.name, student_work_path(student_work),:remote => true, :title => student_work.name, :class => "c_blue02"%> + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? '匿名的作品' : student_work.name%> + <%= link_to student_work_name, student_work_path(student_work),:remote => true, :title => student_work.name, :class => "c_blue02"%>
  • <% my_score = student_work_score(student_work,User.current) %>
  • diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 2b7d49402..f6580659e 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -36,7 +36,7 @@
  • 内容:
    - <%= text_format @work.description%> + <%= text_format(@work.description) if @work.description%>
  • diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb index dd7ab7e2d..f7eb7514d 100644 --- a/app/views/student_work/_student_work.html.erb +++ b/app/views/student_work/_student_work.html.erb @@ -9,7 +9,8 @@ <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
  • - <%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%> + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> + <%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
  • <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %> diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index e1971cfb9..6c2646acf 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -92,7 +92,7 @@ zh: label_project_dts_new: DTS缺陷测试 label_project_dts_statics: DTS缺陷报告 - label_project_dts_yun: 云化部署 + label_project_dts_yun: 云化部署工具 label_project_soft_knowledge: 软件知识库 label_project_soft_file: 软件资源库 label_project_online_dev: 在线开发平台 diff --git a/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb new file mode 100644 index 000000000..e3f0611db --- /dev/null +++ b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb @@ -0,0 +1,9 @@ +class AddErrormsgToStudenWorkTest < ActiveRecord::Migration + def up + add_column :student_work_tests,:error_msg,:text + end + + def down + remove_column :student_work_tests,:error_msg, + end +end