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 + # 锟斤拷锟斤拷锟斤拷囟锟教拷募锟铰糰dd 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 + # 锟斤拷锟斤拷锟斤拷囟锟教拷募锟铰糰dd 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:'浣犵‘瀹氳瀵规湰椤圭洰杩涜浠g爜缂洪櫡娴嬭瘯鍒嗘瀽鍚楋紵' } %> - <% 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 "浠g爜缂洪櫡娴嬭瘯宸ュ叿(DTS)" ,dts_dep_project_path(@project), data: { confirm:'浣犵‘瀹氳瀵规湰椤圭洰杩涜浠g爜缂洪櫡娴嬭瘯鍒嗘瀽鍚楋紵' } %> + <% 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/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