Merge branch 'szzh' into develop

This commit is contained in:
sw 2014-09-11 17:30:16 +08:00
commit 0c550073c1
19 changed files with 110 additions and 67 deletions

View File

@ -468,8 +468,8 @@ class ProjectsController < ApplicationController
def new
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@project = Project.new
@trackers = Tracker.sorted.all
@project = Project.new
@project.safe_attributes = params[:project]
render :layout => 'base'
end

View File

@ -791,7 +791,7 @@ class UsersController < ApplicationController
# 必填自己的工作单位,其实就是学校
def auth_user_extension
if @user == User.current && @user.user_extensions.school.nil?
if @user == User.current && (@user.user_extensions.nil? || @user.user_extensions.school.nil?)
flash[:error] = l(:error_complete_occupation)
redirect_to my_account_path
end

View File

@ -64,7 +64,7 @@ class WelcomeController < ApplicationController
@course_page = FirstPage.where("page_type = 'course'").first
if params[:school_id]
@school_id = params[:school_id]
elsif User.current.logged? && User.current.user_extensions.school
elsif User.current.logged? && User.current.user_extensions.try(:school)
@school_id = User.current.user_extensions.school.try(:id)
end
@logoLink ||= logolink()

View File

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

View File

@ -123,7 +123,8 @@ class Project < ActiveRecord::Base
# reserved words
validates_exclusion_of :identifier, :in => %w( new )
after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?}
#此代码功能为原redmine中项目的树形结构按名称首字母排序本系统项目非树形结构且项目排序方式无按首字母排序另该代码执行会使空数据库时创建项目时出异常故注释掉
#after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?}
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
# 创建project之后默认创建一个board之后的board去掉了board的概念
after_create :create_board_sync

View File

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

View File

@ -10,7 +10,7 @@
</div>
<div class="forums-index-content">
<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>
<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>

View File

@ -3,24 +3,12 @@
<h3><%=l(:label_memo_new)%></h3>
<% if User.current.logged? %>
<%= 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">
<p><%= f.text_field :subject, :required => true%></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>
<p style="color: #ff0000">(<%= l(:label_memos_max_length) %>)</p>
<p>
<%= l(:label_attachment_plural) %><br />
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
</p>

View File

@ -52,7 +52,7 @@
<div class="sidebar-forums">
<div class="forums-line">
<div class="forums-title"><%= @forum.name %></div>
<div class="forums-description"><%= textilizable @forum.description %></div>
<div class="forums-description"><%= textAreailizable @forum.description %></div>
</div>
<!--informations-->
<div class="formus-first-title" >创建人信息</div>
@ -60,11 +60,13 @@
<div style="padding-top: 20px" >
<span class="forums-avatar-left"><%= image_tag(url_to_avatar(@forum.creator), :class =>'vatar-size') %></span>
<span class="forums-avatar-right">
<% unless @forum.creator.nil? %>
<%=link_to @forum.creator.name, user_path(@forum.creator) %>
<div>
<%= link_to l(:label_user_watcher)+"("+User.watched_by(@forum.creator.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist", :id => @forum.creator.id %>
<%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@forum.creator.watcher_users(@forum.creator.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist", :id => @forum.creator.id %>
</div>
<% end %>
</span>
</div>
</div>

View File

@ -63,11 +63,16 @@
<div class="forums-info">
<div style="padding-top: 20px" >
<span class="forums-avatar-left"><%= image_tag(url_to_avatar(@forum.creator), :class => 'vatar-size') %></span>
<span class="forums-avatar-right"><%=link_to @forum.creator.name, user_path(@forum.creator) %>
<div>
<%= link_to l(:label_user_watcher)+"("+User.watched_by(@forum.creator.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist", :id => @forum.creator.id %>
<%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@forum.creator.watcher_users(@forum.creator.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist", :id => @forum.creator.id %></div></span>
</div>
<span class="forums-avatar-right">
<% unless @forum.creator.nil? %>
<%=link_to @forum.creator.name, user_path(@forum.creator) %>
<div>
<%= link_to l(:label_user_watcher)+"("+User.watched_by(@forum.creator.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist", :id => @forum.creator.id %>
<%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@forum.creator.watcher_users(@forum.creator.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist", :id => @forum.creator.id %>
</div>
</span>
<% end %>
</div>
</div>
<!--tags-->
<% if User.current.logged? || User.current.admin? %>

View File

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

View File

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

View File

@ -118,6 +118,7 @@
<div id="principals_for_new_member">
<%= render_principals_for_new_members(@project) %>
</div>
<br />
<!--show the roles which will select-->
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
<% 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=[]%>
<% end %>
<% 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">
<ul class="d-p-projectlist">
@ -103,11 +103,11 @@
<% else %>
<% if school_course.count < 10 %>
<span>
<%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => nil} %>
<%= render :partial => 'more_course', :locals => {:school_id => nil}%>
</span>
<% else %>
<span>
<%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => @school_id} %>
<%= render :partial => 'more_course', :locals => {:school_id => @school_id}%>
</span>
<% end %>
<div class="d-p-projectlist-box">

View File

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

View File

@ -441,10 +441,10 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "sort_type"
t.integer "show_course", :default => 1
t.integer "show_contest", :default => 1
t.integer "image_width", :default => 107
t.integer "image_height", :default => 63
t.integer "show_course", :default => 1
t.integer "show_contest", :default => 1
end
create_table "forums", :force => true do |t|
@ -878,18 +878,18 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
create_table "relative_memos", :force => true do |t|
t.integer "osp_id"
t.integer "parent_id"
t.string "subject", :null => false
t.text "content", :limit => 16777215, :null => false
t.string "subject", :null => false
t.text "content", :null => false
t.integer "author_id"
t.integer "replies_count", :default => 0
t.integer "replies_count", :default => 0
t.integer "last_reply_id"
t.boolean "lock", :default => false
t.boolean "sticky", :default => false
t.boolean "is_quote", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "viewed_count_crawl", :default => 0
t.integer "viewed_count_local", :default => 0
t.boolean "lock", :default => false
t.boolean "sticky", :default => false
t.boolean "is_quote", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "viewed_count_crawl", :default => 0
t.integer "viewed_count_local", :default => 0
t.string "url"
t.string "username"
t.string "userhomeurl"
@ -976,11 +976,10 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
t.string "url"
t.string "title"
t.integer "share_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "project_id"
t.integer "user_id"
t.string "description"
end
create_table "softapplications", :force => true do |t|
@ -1086,8 +1085,8 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
t.integer "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "technical_title"
t.integer "identity"
t.string "technical_title"
t.string "student_id"
t.string "teacher_realname"
t.string "student_realname"
@ -1145,6 +1144,9 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
t.integer "active"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "level"
t.integer "file"
t.integer "issue"
end
create_table "user_statuses", :force => true do |t|

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

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