This commit is contained in:
sw 2014-06-18 08:35:11 +08:00
commit 872357cdf4
11 changed files with 54 additions and 13 deletions

View File

@ -59,6 +59,8 @@ class AttachmentsController < ApplicationController
:type => detect_content_type(@attachment),
:disposition => (@attachment.image? ? 'inline' : 'attachment')
end
rescue => e
redirect_to "http://forge.trustie.net/file_not_found.html"
end
#更新资源文件类型

View File

@ -801,6 +801,11 @@ class UsersController < ApplicationController
else
@user = User.find(params[:id])
end
if @user.user_score.nil?
us = UserScore.new
us.user_id = @user.id
us.save
end
rescue ActiveRecord::RecordNotFound
render_404
end

View File

@ -27,7 +27,7 @@ class ZipdownController < ApplicationController
else
logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!"
end
send_file zipfile, :filename => obj.name, :type => detect_content_type(zipfile) if zipfile
send_file zipfile, :filename => obj.name+".zip", :type => detect_content_type(zipfile) if zipfile
#rescue NameError, ActiveRecord::RecordNotFound => e
#logger.error "[ZipDown] ===> #{e}"
@ -39,7 +39,7 @@ class ZipdownController < ApplicationController
homework = HomeworkAttach.find params[:homework]
if homework != nil && (User.current.admin? || User.current.member_of?(homework.bid.courses.first))
zipfile = zip_homework_by_user homework
send_file zipfile, :filename => homework.name, :type => detect_content_type(zipfile) if zipfile
send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if zipfile
else
render_403 :message => :notice_not_authorized
end
@ -88,7 +88,7 @@ class ZipdownController < ApplicationController
#length = attach.storage_path.length
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
end
zipping "#{homeattach.user.name.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true
zipping "#{homeattach.user.name.to_s}_#{Time.now.to_i}.zip", homeworks_attach_path, OUTPUT_FOLDER, true
#user_attaches_paths
end

View File

@ -27,7 +27,7 @@
(Member.where('user_id = ? and project_id = ?', User.current.id,
@bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) && cur_user_homework_for_bid(@bid).count == 0 %>
<div class='icon icon-add'>
<!-- <%= link_to l(:label_commit_homework), new_submit_homework_path, :onclick => "$('#put-bid-form').slideToggle(); this.blur(); return false;" %> -->
<%#= link_to l(:label_commit_homework), new_submit_homework_path, :onclick => "$('#put-bid-form').slideToggle(); this.blur(); return false;" %>
<%= link_to l(:label_course_new_homework),new_homework_attach_path %>
</div>
<% end %>

View File

@ -8,7 +8,7 @@
<table width="100%" valign="center">
<tr>
<td ><span style="margin-left:0px"><%= l(:label_task_plural)%>(<%= @homework_list.count%>)</span>
<%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if(
<%#= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if(
User.current.admin? ||
!(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) ||
(Rails.env.development?) %>

View File

@ -73,7 +73,8 @@
<td>
<table>
<tr>
<td class="info-course"><%= @project.name %></td>
<!-- modified by zjc 课程名称添加超链接 -->
<td class="info-course"><%= link_to @project.name,project_path(@project) %></td>
</tr>
<tr>
<td align="center">
@ -180,7 +181,8 @@
<% unless @course.teacher.user_extensions.nil? %>
<tr>
<td valign="top" style="padding-left: 8px;"><%= l(:label_teacher_work_unit) %> :</td>
<td class="font_lighter_sidebar"><%= @course.teacher.user_extensions.school %></td>
<!-- modified by zjc 教师单位添加超链接 -->
<td class="font_lighter_sidebar"><%= link_to @course.teacher.user_extensions.school,options={:controller => 'welcome',:action => 'course',:school_id => @course.teacher.user_extensions.school.id}, html_options={:method => 'get'} %></td>
</tr>
<% else %>
<tr>

View File

@ -62,7 +62,7 @@
<td>
<table>
<tr>
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @contest.name %></td>
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= link_to @contest.name, show_contest_contest_path(@contest) %></td>
</tr>
<% if User.current.login? %>
<tr colspan='3'>

View File

@ -57,7 +57,7 @@
<td><%= image_tag(url_to_avatar(@project), :class => 'avatar2') %></td>
<td>
<div class="info-course">
<%= @project.name %>
<%= link_to @project.name, project_path(@project)%>
</div>
<div>
<!-- added by bai 增加项目得分 -->

View File

@ -56,7 +56,9 @@
<td>
<table>
<tr>
<td class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><%= h (@user.name) %> <!-- added by bai -->
<!-- added by bai -->
<!-- modified by zjc 姓名添加超链接 -->
<td class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><%= link_to h (@user.name) %>
<%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%></td>
</tr>
<tr>
@ -92,7 +94,8 @@
<% comments_score = comments_count * 0.1 %>
<% finall_influence_score = news_score + wiki_contents_score + comments_score %>
<% finall_user_score = finall_messages_score + finall_user_project_score + finall_activity_score + finall_influence_score %>
<!-- modified by zjc 新得分显示 -->
<tr><td class="score">
<%= l(:label_user_grade)%>:
<%= link_to(format("%.2f" , @user.user_score.total_score).to_f, {:controller => 'users',
@ -102,6 +105,7 @@
}, :style => 'color :#E8770D;') %>
</td>
</tr>
<!-- end -->
<tr><td class="score">
<%= l(:label_user_grade)%>:
<%= link_to(format("%.2f" , finall_user_score).to_f, {:controller => 'users',
@ -174,12 +178,13 @@
-->
<!-- added by bai 在个人主页里显示“工作单位”“地区”"教师的职称"-->
<!-- modified by linchun 在个人主页里显示“加入时间”,“最后登录”,“邮件地址”后面添加冒号-->
<!-- modified by zjc 高校添加超链接 -->
<% unless @user.user_extensions.nil? %>
<% unless @user.user_extensions.identity == 2 %>
<tr>
<td style="padding-left: 5px" width="70px"><%= l(:field_occupation) %></td><td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<% unless @user.user_extensions.school.nil? %>
<%= @user.user_extensions.school.name %>
<%= link_to @user.user_extensions.school.name, options={:controller => 'welcome',:action => 'course',:school_id => @user.user_extensions.school.id}, html_options={:method => 'get'} %>
<% end %>
</td>
</tr>

View File

@ -18,7 +18,11 @@
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
<!-- <%= @admin.first.user.user_extensions.occupation %> -->
<%# unless @project.course_extra.school.nil? %>
<%= @project.course_extra.teacher.user_extensions.school.try(:name) %>
<!-- modified by zjc 单位名称添加超链接 -->
<% unless @project.course_extra.teacher.user_extensions.school.nil? %>
<%= link_to @project.course_extra.teacher.user_extensions.school.try(:name),options={:controller => 'welcome',:action => 'course',:school_id => @project.course_extra.teacher.user_extensions.school.id}, html_options={:method => 'get'}%>
<% end %>
<%# end %>
<% end %>
</p>

View File

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<title>文件未找到</title>
<style>
body{
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
color:#303030;
margin:10px;
}
h1{
font-size:1.5em;
}
p{
font-size:0.8em;
}
</style>
<body>
<h1>文件已经损坏</h1>
<p>抱歉,因文件已经损坏,请重新上传此文件.</p>
<p><a href="javascript:history.back()">Back</a></p>
</body>
</html>