This commit is contained in:
z9hang 2014-09-11 17:31:44 +08:00
commit d1a84305da
13 changed files with 74 additions and 41 deletions

View File

@ -44,15 +44,14 @@ class ZipdownController < ApplicationController
zipfile = zip_homework_by_user homework zipfile = zip_homework_by_user homework
send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile) send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile)
else else
render_403 :message => :no_file_dowmload ,:layout => "course_base" render file: 'public/no_file_found.html' , :layout => 'course_base'
end end
else else
render_403 :message =>:notice_file_not_found ,:layout => "course_base" render file: 'public/file_not_found.html' , :layout => 'course_base'
end end
else else
render_403 :message => :notice_not_authorized ,:layout => "course_base" render_403 :message => :notice_not_authorized ,:layout => "course_base"
end end
rescue => e rescue => e
render file: 'public/file_not_found.html' , :layout => 'course_base' render file: 'public/file_not_found.html' , :layout => 'course_base'
end end
@ -76,13 +75,19 @@ class ZipdownController < ApplicationController
# Todo: User Access Controll # Todo: User Access Controll
homeattaches = bid.homeworks homeattaches = bid.homeworks
#记录所有作业是不是有附件有一个附件就改为true
has_file = false
# 得到每一个人所有文件打包的zip文件 # 得到每一个人所有文件打包的zip文件
# 并将每一个人的zip打包为一个并返回路径 # 并将每一个人的zip打包为一个并返回路径
user_zip_paths = homeattaches.map do |homeattach| user_zip_paths = homeattaches.map do |homeattach|
if homeattach.attachments.count > 0 if homeattach.attachments.count > 0
zip_homework_by_user homeattach zip_homework_by_user homeattach
has_file = true if has_file == false
end end
end end
if has_file == false
render file: 'public/no_file_fond.html.erb' , :layout => 'course_base'
end
zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER
#@paths = homeworks_attach_path #@paths = homeworks_attach_path

View File

@ -9,8 +9,8 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px"><a href="http://contest.trustie.net/">contest.trustie.net</td> <td style="padding-left: 8px"><a href="http://contest.trustie.net/">contest.trustie.net</a></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_contest_innovate), :controller => 'welcome', :action => 'contest' %> > 详情</td> <td ><%=link_to l(:field_homepage), home_path %> > <%#=link_to l(:label_contest_innovate), :controller => 'welcome', :action => 'contest' %> 详情</td>
</tr> </tr>
</table> </table>
</div> </div>

View File

@ -10,7 +10,7 @@
</div> </div>
<div class="forums-index-content"> <div class="forums-index-content">
<p ><%= link_to h(forum.name), forum_path(forum) %></p> <p ><%= link_to h(forum.name), forum_path(forum) %></p>
<p ><%= forum.description%></p> <p ><%= textAreailizable forum.description%></p>
<p ><%= authoring forum.created_at, forum.creator %></p></div> <p ><%= authoring forum.created_at, forum.creator %></p></div>
<div class="forums-index-count"> <div class="forums-index-count">
<table class="forums-count-color"><tr class="forums-count-color" align="center"><td><%= link_to (forum.memo_count), forum_path(forum) %></td><td><%= link_to (forum.topic_count), forum_path(forum) %></td></tr> <table class="forums-count-color"><tr class="forums-count-color" align="center"><td><%= link_to (forum.memo_count), forum_path(forum) %></td><td><%= link_to (forum.topic_count), forum_path(forum) %></td></tr>

View File

@ -3,24 +3,12 @@
<h3><%=l(:label_memo_new)%></h3> <h3><%=l(:label_memo_new)%></h3>
<% if User.current.logged? %> <% if User.current.logged? %>
<%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %> <%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %>
<!--<#% if @memo.errors.any? %>
<div id="error_explanation">
<h2><#%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:</h2>
<ul>
<#% @memo.errors.full_messages.each do |msg| %>
<li><#%= msg %></li>
<#% end %>
</ul>
</div>
<#% end %> -->
<div class="actions" style="max-width:680px"> <div class="actions" style="max-width:680px">
<p><%= f.text_field :subject, :required => true%></p> <p><%= f.text_field :subject, :required => true%></p>
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p> <p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script> <script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script>
<p style="color: #ff0000">(<%= l(:label_memos_max_length) %>)</p> <p style="color: #ff0000">(<%= l(:label_memos_max_length) %>)</p>
<p> <p>
<%= l(:label_attachment_plural) %><br /> <%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %> <%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p> </p>

View File

@ -52,7 +52,7 @@
<div class="sidebar-forums"> <div class="sidebar-forums">
<div class="forums-line"> <div class="forums-line">
<div class="forums-title"><%= @forum.name %></div> <div class="forums-title"><%= @forum.name %></div>
<div class="forums-description"><%= textilizable @forum.description %></div> <div class="forums-description"><%= textAreailizable @forum.description %></div>
</div> </div>
<!--informations--> <!--informations-->
<div class="formus-first-title" >创建人信息</div> <div class="formus-first-title" >创建人信息</div>

View File

@ -1,7 +1,7 @@
<% @nav_dispaly_project_label = 1 <% @nav_dispaly_project_label = 1
@nav_dispaly_forum_label = 1 %> @nav_dispaly_forum_label = 1 %>
<% #@nav_dispaly_project_label = 1 %> <%#@nav_dispaly_project_label = 1 %>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -48,9 +48,6 @@
</tr> </tr>
</table> </table>
</div> </div>
<div id="sidebar"> <div id="sidebar">
<div class="spaceleft"> <div class="spaceleft">
<div class="inf_user_image"> <div class="inf_user_image">
@ -67,10 +64,10 @@
<% if @project.project_type == 0 %> <% if @project.project_type == 0 %>
<%= l(:label_project_grade)%> : <%= l(:label_project_grade)%> :
<%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', <%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects',
:action => 'show_projects_score', :action => 'show_projects_score',
:remote => true, :remote => true,
:id => @project.id :id => @project.id
}, :style => "color: #EC6300;")%> }, :style => "color: #EC6300;")%>
<% end %> <% end %>
<!-- end --> <!-- end -->
</div> </div>
@ -89,13 +86,11 @@
<% @project.versions.each do |version| %> <% @project.versions.each do |version| %>
<% files_count += version.attachments.count %> <% files_count += version.attachments.count %>
<% end %> <% end %>
<td class="font_index"><%=link_to "#{@project.members.count}", project_member_path(@project) %></td> <td class="font_index"><%=link_to "#{@project.members.count}", project_member_path(@project) %></td>
<td class="font_index"><%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist", :id => @project %></td> <td class="font_index"><%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist", :id => @project %></td>
<td class="font_index"><%=link_to "#{@project.issues.count}", project_issues_path(@project) %></td> <td class="font_index"><%=link_to "#{@project.issues.count}", project_issues_path(@project) %></td>
<!-- <td class="font_index"><%=link_to files_count, project_files_path(@project) %></td> --> <!-- <td class="font_index"><%=link_to files_count, project_files_path(@project) %></td> -->
</tr> </tr>
<tr class="font_aram"> <tr class="font_aram">
<td align="center" width="70px"> <%= l(:label_member) %></td> <td align="center" width="70px"> <%= l(:label_member) %></td>
<td align="center" width="100px"><%= l(:label_user_watchered) %></td> <td align="center" width="100px"><%= l(:label_user_watchered) %></td>
@ -105,12 +100,10 @@
</table> </table>
<div class="user_underline"></div> <div class="user_underline"></div>
</div> </div>
<div class="inf_user_context"> <div class="inf_user_context">
<div class="font_title_left"> <div class="font_title_left">
<%= l(:label_project_overview) %> <%= l(:label_project_overview) %>
</div> </div>
<div style="padding-bottom: 8px"> <div style="padding-bottom: 8px">
<div class="font_lighter_sidebar" style="word-break:break-all;word-wrap: break-word;"> <div class="font_lighter_sidebar" style="word-break:break-all;word-wrap: break-word;">
<%= textilizable @project.description %> <%= textilizable @project.description %>
@ -121,8 +114,7 @@
</div> </div>
<div class="user_underline"></div> <div class="user_underline"></div>
</div> </div>
<!--tags--> <!--tags-->
<div class="user_fans"> <div class="user_fans">
<!-- added by william -for tag --> <!-- added by william -for tag -->
<div class="user_tags"> <div class="user_tags">
@ -131,7 +123,6 @@
</div> </div>
</div> </div>
</div> </div>
<!--tool--> <!--tool-->
<div class="user_underline"></div> <div class="user_underline"></div>
<div class="tool"> <div class="tool">

View File

@ -69,7 +69,6 @@
<% else %> <% else %>
<!-- 竖排 --> <!-- 竖排 -->
<div id="praise_tread_<%= obj.id %>" style="float:right;"> <div id="praise_tread_<%= obj.id %>" style="float:right;">
<% @is_valuate = is_praise_or_tread(obj,user_id)%> <% @is_valuate = is_praise_or_tread(obj,user_id)%>
<% if @is_valuate.size > 0 %> <!-- 评价过 1代表赞 0代表踩 --> <% if @is_valuate.size > 0 %> <!-- 评价过 1代表赞 0代表踩 -->
<% @flag = @is_valuate.first.praise_or_tread %> <% @flag = @is_valuate.first.praise_or_tread %>

View File

@ -118,6 +118,7 @@
<div id="principals_for_new_member"> <div id="principals_for_new_member">
<%= render_principals_for_new_members(@project) %> <%= render_principals_for_new_members(@project) %>
</div> </div>
<br />
<!--show the roles which will select--> <!--show the roles which will select-->
<p style="padding-top: 5px"><%= l(:label_role_plural) %>: <p style="padding-top: 5px"><%= l(:label_role_plural) %>:
<% roles.each do |role| %> <% roles.each do |role| %>

View File

@ -0,0 +1,8 @@
<% if User.current.logged?%>
<% if User.current.user_extensions.identity == 0 %>
<%= link_to(l(:label_course_new), {:controller => 'courses', :action => 'new'},
:class => 'icon icon-add') if User.current.allowed_to?(:add_course,nil, :global => true) %>
<% end %>
<% end %>
&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => school_id} %>

View File

@ -85,7 +85,7 @@
<%school_course=[]%> <%school_course=[]%>
<% end %> <% end %>
<% if (school_course.count == 0) %> <% if (school_course.count == 0) %>
<span><%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => nil} %></span> <span><%= render :partial => 'more_course', :locals => {:school_id => nil}%></span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
@ -103,11 +103,11 @@
<% else %> <% else %>
<% if school_course.count < 10 %> <% if school_course.count < 10 %>
<span> <span>
<%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => nil} %> <%= render :partial => 'more_course', :locals => {:school_id => nil}%>
</span> </span>
<% else %> <% else %>
<span> <span>
<%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => @school_id} %> <%= render :partial => 'more_course', :locals => {:school_id => @school_id}%>
</span> </span>
<% end %> <% end %>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">

View File

@ -2109,7 +2109,7 @@ zh:
label_school_no_course: 该学校未开设任何课程,您可以查看其他学校课程 label_school_no_course: 该学校未开设任何课程,您可以查看其他学校课程
label_school_less_course: 该学校开设课程较少,您可以查看其他学校课程 label_school_less_course: 该学校开设课程较少,您可以查看其他学校课程
label_file_not_found: 对不起,该文件现在不能下载! label_file_not_found: 对不起,该文件现在不能下载
label_goto_homepage: 返回主页 label_goto_homepage: 返回主页
label_trustie_team: Trustie开发团队 label_trustie_team: Trustie开发团队

42
public/no_file_found.html Normal file
View File

@ -0,0 +1,42 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File not found</title>
<style>
body{
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
color:#303030;
}
div.container{
margin: 0 auto;
width: 80%;
}
h1{
font-size:1.5em;
}
p{
font-size:0.8em;
}
.hidden{
display: none;
}
</style>
</head>
<body>
<div class="container" >
<!--<h1>Sorry, this file can not be downloaded now. </h1>-->
<h1>该作业没有任何的附件可以下载</h1>
<h3> <a href="http://forge.trustie.net" style="">返回主页</a> </h3>
<div class="container" style="">
<div style="position: relative; right:0;text-align: right;">
<h4>Trustie开发团队.</h4>
</div>
</div>
<p class="hidden" >
<a href="javascript:history.back()">Back</a>
</p>
</div>
</body>
</html>

View File

@ -741,8 +741,7 @@ ul.user_course_sort li{list-style-type:none;
color:#919294; color:#919294;
font-size:13px; font-size:13px;
padding-left: 12px; padding-left: 12px;
padding-right: 8px; padding-right: 8px;
line-height: 1.5em;
} }
.created_on_project{ .created_on_project{
padding-left: 12px; padding-left: 12px;