Merge branch 'szzh' into develop

This commit is contained in:
sw 2015-07-22 10:20:45 +08:00
commit faeee62331
13 changed files with 148 additions and 139 deletions

View File

@ -73,8 +73,14 @@ class NewsController < ApplicationController
@news_count = scope.count @news_count = scope.count
#@news_pages = Paginator.new @news_count, @limit, params['page'] #@news_pages = Paginator.new @news_count, @limit, params['page']
#@offset ||= scope_page.offset #@offset ||= scope_page.offset
if params[:subject].nil?
scope_order = scope.all(:include => [:author, :course], scope_order = scope.all(:include => [:author, :course],
:order => "#{News.table_name}.created_on DESC") :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, # :offset => @offset,
# :limit => @limit) # :limit => @limit)
@newss = paginateHelper scope_order,10 @newss = paginateHelper scope_order,10
@ -83,6 +89,7 @@ class NewsController < ApplicationController
@news = News.new @news = News.new
render :layout => 'base_courses' render :layout => 'base_courses'
} }
format.js
format.api format.api
format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") } format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
end end
@ -141,7 +148,7 @@ class NewsController < ApplicationController
ids = params[:asset_id].split(',') ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
end end
# 与我相关动态的记录add start # <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD>ļ<EFBFBD>¼add start
teachers = searchTeacherAndAssistant(@course) teachers = searchTeacherAndAssistant(@course)
for teacher in teachers for teacher in teachers
if(teacher.user_id != User.current.id) if(teacher.user_id != User.current.id)
@ -155,7 +162,7 @@ class NewsController < ApplicationController
notify.save() notify.save()
end end
end end
# 与我相关动态的记录add end # <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD>ļ<EFBFBD>¼add end
render_attachment_warning_if_needed(@news) render_attachment_warning_if_needed(@news)
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
redirect_to course_news_index_url(@course) redirect_to course_news_index_url(@course)

View File

@ -157,7 +157,7 @@ class StudentWorkController < ApplicationController
end end
def edit def edit
if @homework.homework_type == 2 #编程作业不能修改作业 if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业
render_403 render_403
else else
respond_to do |format| respond_to do |format|
@ -396,6 +396,7 @@ class StudentWorkController < ApplicationController
if student_work_test.result == 0 if student_work_test.result == 0
student_score_count += 1 student_score_count += 1
end end
student_work_test.error_msg = params[:compile_error_msg]
student_work_test.save! student_work_test.save!
end end
end end
@ -444,7 +445,7 @@ class StudentWorkController < ApplicationController
#判断是不是当前作品的提交者 #判断是不是当前作品的提交者
#提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品 #提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品
def author_of_work 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 end
def teacher_of_course def teacher_of_course

View File

@ -1,6 +1,6 @@
# encoding: utf-8 # encoding: utf-8
class StudentWorkTest < ActiveRecord::Base 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 :homework_test
belongs_to :student_work belongs_to :student_work

View File

@ -2,10 +2,16 @@
btn_tips = l(:label_news_notice) btn_tips = l(:label_news_notice)
label_tips = l(:label_course_news) label_tips = l(:label_course_news)
%> %>
<script>
function remote_search(){
$("#news_query_form").submit();
}
</script>
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2"><%= label_tips %></h2> <h2 class="project_h2"><%= label_tips %></h2>
</div> </div>
<div class="talk_top"> <div class="talk_top">
<div class="fl">
<p class="fl"> <p class="fl">
<%= l(:label_total_news) %> <%= l(:label_total_news) %>
<span><%= @news_count %></span> <span><%= @news_count %></span>
@ -16,56 +22,19 @@
<div class="cl"></div> <div class="cl"></div>
<% end %> <% end %>
</div>
<div class="problem_search fr" >
<%= form_tag({:controller => 'news', :action => 'index', :course_id => @course },:remote=>'true', :method => :get,:id=>"news_query_form", :class => 'query_form') do %>
<input class="problem_search_input fl" id="v_subject" placeholder="通知主题" type="text" name="subject" value="" onkeypress="" onkeydown="">
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_search();" >搜索</a>
<% end %>
</div><!--problem_search end-->
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<div id="news_list">
<%= render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count} %>
<div> <div>
<% if @newss.empty? %>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% else %>
<% @newss.each do |news| %>
<div class="problem_main upload_img">
<%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5">
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
<span class="fl">
<%= l(:label_release_news) %>
</span>
<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
<%=link_to "<span class = 'pic_mes'>#{news.comments.all.count}</span>".html_safe, news_path(news.id), :class => "pro_mes_w" %>
<br />
<div class="cl mb5"></div>
<script>
$(function(){if($("#news_description_<%= news.id%>_content").height()>360){$("#news_foot_<%= news.id%>").show();}});
</script>
<div id="news_description_<%= news.id%>" class="news_description mt5">
<div id="news_description_<%= news.id%>_content" class="upload_img">
<%= news.description.html_safe %>
</div>
</div>
<div class="cl"></div>
<div class="news_foot currentDd fr" style="cursor:pointer;display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>">
[展开]
</div>
<div class="cl mb5"></div>
<span class="fl"><%= l(:label_create_time)%><%= format_time(news.created_on)%></span>
<%= link_to_attachments_course news %>
<div class="cl"></div>
<%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %>
</div>
<div class="cl"></div>
</div><!--problem_main end-->
<% end %>
<% end %>
</div>
<!--end-->
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<% content_for :header_tags do %> <% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<%= stylesheet_link_tag 'scm' %> <%= stylesheet_link_tag 'scm' %>

View File

@ -0,0 +1,47 @@
<div>
<% if newss.empty? %>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% else %>
<% newss.each do |news| %>
<div class="problem_main upload_img">
<%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5">
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
<span class="fl">
<%= l(:label_release_news) %>
</span>
<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
<%=link_to "<span class = 'pic_mes'>#{news.comments.all.count}</span>".html_safe, news_path(news.id), :class => "pro_mes_w" %>
<br />
<div class="cl mb5"></div>
<script>
$(function(){if($("#news_description_<%= news.id%>_content").height()>360){$("#news_foot_<%= news.id%>").show();}});
</script>
<div id="news_description_<%= news.id%>" class="news_description mt5">
<div id="news_description_<%= news.id%>_content" class="upload_img">
<%= news.description.html_safe %>
</div>
</div>
<div class="cl"></div>
<div class="news_foot currentDd fr" style="cursor:pointer;display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>">
[展开]
</div>
<div class="cl mb5"></div>
<span class="fl"><%= l(:label_create_time)%><%= format_time(news.created_on)%></span>
<%= link_to_attachments_course news %>
<div class="cl"></div>
<%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %>
</div>
<div class="cl"></div>
</div><!--problem_main end-->
<% end %>
<% end %>
</div>
<!--end-->
<ul class="wlist">
<%= pagination_links_full obj_pages, obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>

View File

@ -0,0 +1 @@
$("#news_list").html("<%= escape_javascript(render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count})%>");

View File

@ -43,97 +43,69 @@
</li> </li>
<li> <li>
<% if User.current.admin? %> <% if User.current.admin? %>
<a href="http://tsr.sei.pku.edu.cn/KnowledgeBaseDC/semantic-search.jsp?projectName=jena <a href="http://202.197.34.33:3005/wsManagement/" target="_Blank">QoS评估工具</a>
" target="_Blank">软件知识库</a>
<%#= link_to l(:label_project_soft_knowledge) ,soft_knowledge_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://tsr.sei.pku.edu.cn/home.action" target="_Blank">软件资源库</a>
<%#= link_to l(:label_project_soft_file) ,soft_file_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<%= link_to l(:label_project_dts_new) ,dts_dep_project_path(@project), data: { confirm:'你确定要对本项目进行代码缺陷测试分析吗?' } %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.seforge.org/pop-php/" target="_Blank">在线开发平台</a>
<%#= link_to l(:label_project_online_dev) ,online_dev_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.seforge.org/sase/" target="_Blank">软工服务平台</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %> <% end %>
</li> </li>
<li> <li>
<% if User.current.admin? %> <% if User.current.admin? %>
<a href="http://segdev.nju.edu.cn:8080/internetware/main.jsp" target="_Blank">形式验证工具</a> <a href="http://202.197.34.33:3005/wsManagement/" target="_Blank">QoS证据采集工具</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %> <% end %>
</li> </li>
<li> <li>
<% if User.current.admin? %> <% if User.current.admin? %>
<a href="http://202.197.34.33:3005/wsManagement/" target="_Blank">QoS 评估工具</a> <a href="http://202.197.34.33:3005/wsManagement/" target="_Blank">QoS证据评估统计分析工具</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> <%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %> <% end %>
</li> </li>
<li> <li>
<% if User.current.admin? %> <% if User.current.admin? %>
<a href="http://202.197.34.33:3005/wsManagement/" target="_Blank">QoS 证据采集工具</a> <%= link_to "代码缺陷测试工具(DTS)" ,dts_dep_project_path(@project), data: { confirm:'你确定要对本项目进行代码缺陷测试分析吗?' } %>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %> <% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.seforge.org/sase/" target="_Blank">软工服务平台(SASSP)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://tsr.sei.pku.edu.cn/home.action" target="_Blank">软件知识库(KnowledgeBase)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://segdev.nju.edu.cn:8080/internetware/main.jsp" target="_Blank">可信评估工具(Evaluator)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://segdev.nju.edu.cn:8080/internetware/main.jsp" target="_Blank">在线验证工具(BACH-Online)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://segdev.nju.edu.cn:8080/internetware/main.jsp" target="_Blank">软件测试工具(SSCC-Web)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.service4all.org.cn/servicexchange/" target="_Blank">服务资源共享平台(ServiceXchange)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.service4all.org.cn/repository/ServiceCloud/MyServiceContainer.jsp" target="_Blank">在线服务开发平台(ServiceFoundry)</a>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://www.service4all.org.cn" target="_Blank">组合开发和运行演化平台(Service4All)</a>
<% end %> <% end %>
</li> </li>
<li>
<% if User.current.admin? %>
<a href="http://segdev.nju.edu.cn:8080/internetware/main.jsp" target="_Blank">可信度评估工具 SAS
</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://segdev.nju.edu.cn:8080/internetware/main.jsp" target="_Blank">可信评估工具 Evaluator</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://segdev.nju.edu.cn:8080/internetware/main.jsp" target="_Blank">软件测试工具 SSCC-Web</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %>
</li>
<!--<li>-->
<!--<%# unless @project.enabled_modules.where("name = 'dts'").empty? %>-->
<!--<%#= link_to l(:project_module_dts) ,share_show_path(@project) %>-->
<!--<%# end %>-->
<!--</li>-->
<li>
<% if User.current.admin? %>
<a href="http://202.197.34.33:3005/wsManagement/" target="_Blank">QoS 证据评估统计分析工具</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %>
</li>
<li>
<% if User.current.admin? %>
<a href="http://segdev.nju.edu.cn:8080/internetware/main.jsp" target="_Blank">在线验证工具 BACH-Online</a>
<%#= link_to l(:label_project_soft_service) ,soft_service_project_path(@project) %>
<% end %>
</li>

View File

@ -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.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
</li> </li>
<li class=" hwork_tit"> <li class=" hwork_tit">
<%= 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"%>
</li> </li>
<li class=" hwork_time_c"> <li class=" hwork_time_c">
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %> <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>

View File

@ -18,7 +18,8 @@
<% end%> <% end%>
</li> </li>
<li class=" hwork_tit_e" style="width: 410px"> <li class=" hwork_tit_e" style="width: 410px">
<%= 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"%>
</li> </li>
<% my_score = student_work_score(student_work,User.current) %> <% my_score = student_work_score(student_work,User.current) %>
<li class=" hwork_code <%= my_score.nil? ? 'c_grey' : 'c_red'%>"> <li class=" hwork_code <%= my_score.nil? ? 'c_grey' : 'c_red'%>">

View File

@ -36,7 +36,7 @@
<li > <li >
<span class="tit_fb ">内容:</span> <span class="tit_fb ">内容:</span>
<div class="show_hwork_p break_word"> <div class="show_hwork_p break_word">
<%= text_format @work.description%> <%= text_format(@work.description) if @work.description%>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</li> </li>

View File

@ -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.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
</li> </li>
<li class=" hwork_tit_une"> <li class=" hwork_tit_une">
<%= 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"%>
</li> </li>
<li class=" hwork_time_c"> <li class=" hwork_time_c">
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %> <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>

View File

@ -92,7 +92,7 @@ zh:
label_project_dts_new: DTS缺陷测试 label_project_dts_new: DTS缺陷测试
label_project_dts_statics: DTS缺陷报告 label_project_dts_statics: DTS缺陷报告
label_project_dts_yun: 云化部署 label_project_dts_yun: 云化部署工具
label_project_soft_knowledge: 软件知识库 label_project_soft_knowledge: 软件知识库
label_project_soft_file: 软件资源库 label_project_soft_file: 软件资源库
label_project_online_dev: 在线开发平台 label_project_online_dev: 在线开发平台

View File

@ -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