Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
sw 2014-05-19 16:53:47 +08:00
commit 0de77bdc44
13 changed files with 58 additions and 99 deletions

View File

@ -22,7 +22,6 @@ class AttachmentsController < ApplicationController
before_filter :authorize_global, :only => :upload
before_filter :login_without_softapplication, only: [:download]
accept_api_auth :show, :download, :upload
def show
@ -125,7 +124,7 @@ class AttachmentsController < ApplicationController
end
respond_to do |format|
format.html { redirect_to_referer_or project_path(@project) }
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum,@attachment.container) }
format.js
end
end

View File

@ -15,9 +15,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class ProjectsController < ApplicationController
# if @project.project_type == 1
# layout 'base_projects'# by young
layout :select_project_layout
menu_item :overview
menu_item :roadmap, :only => :roadmap
menu_item :settings, :only => :settings
@ -32,18 +31,7 @@ class ProjectsController < ApplicationController
menu_item :feedback, :only => :feedback
menu_item l(:label_course_file), :only => :index
menu_item l(:label_course_news), :only => :index
# end
# layout 'base_courses'# by young
# menu_item :overview
# menu_item l(:label_homework), :only => :homework
# menu_item :files, :only => :files
#
# layout 'base_courses'
# menu_item l(:label_homework), :only => homework
# menu_item l(:label_course_file), :only => files
# menu_item l(:label_settings), :only => settings
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise]
# before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
@ -52,11 +40,11 @@ class ProjectsController < ApplicationController
before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen]
before_filter :authorize_global, :only => [:new, :create]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
#by young
# before_filter :member, :file, :statistics, :watcherlist
# modified by fq
before_filter :file, :statistics, :watcherlist
#
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
before_filter :memberAccess, only: :member
accept_rss_auth :index
accept_api_auth :index, :show, :create, :update, :destroy
@ -89,27 +77,6 @@ class ProjectsController < ApplicationController
### added by william
include ActsAsTaggableOn::TagsHelper
# Lists visible projects
# def index
# respond_to do |format|
# format.html {
# scope = Project
# unless params[:closed]
# scope = scope.active
# end
# @projects = scope.visible.order('lft').all
# }
# format.api {
# @offset, @limit = api_offset_and_limit
# @project_count = Project.visible.count
# @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
# }
# format.atom {
# projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
# render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
# }
# end
# end
def enterprise_course
session[:enterprise_college] = 2
respond_to do |format|
@ -384,36 +351,6 @@ class ProjectsController < ApplicationController
end
#gcmend
# def search
# #modified by nie
# project_type = params[:project_type].to_i
# projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities
# @projects = projects_all.visible
# @projects = @projects.visible.like(params[:name]) if params[:name].present?
# @offset, @limit = api_offset_and_limit({:limit => 10})
# @project_count = @projects.visible.count
# @project_pages = Paginator.new @project_count, @limit, params['page']
# @offset ||= @project_pages.offset
# @projects = @projects.visible.offset(@offset).limit(@limit).all
# respond_to do |format|
# format.html {
# render :layout => 'base'
# scope = Project
# unless params[:closed]
# scope = scope.active
# end
# }
# format.api {
# # @offset, @limit = api_offset_and_limit
# # @project_count = Project.visible.count
# # @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
# }
# format.atom {
# projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
# render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
# }
# end
# end
# added by fq
def new_join
@ -861,22 +798,7 @@ class ProjectsController < ApplicationController
memberlist
end
# def news
# if @project.project_type == 1
# render :layout => 'base_courses'
# end
# end
def file
# if @project.project_type == 1
# render :layout => 'base_courses'
# end
# @course_tag = params[:course]
# if @course_tag == '1'
# render :layout => 'base_courses'
# end
# User.current
end
def statistics
@ -999,12 +921,8 @@ class ProjectsController < ApplicationController
# end
before_filter :toggleCourse, only: [:finishcourse, :restartcourse]
# TODO:#finishcourse and #restartcourse 没有设置权限也就是说任何人的调用都会关闭or重启课程。
# 最好通过用户与项目的权限解决这种事情。还没写
def finishcourse
#course_prefs = Course.find_by_extra(@project.identifier)
# setup_time = Time.parse(course_prefs.setup_time)
# end_time = Time.parse(course_prefs.endup_time)
yesterday = Date.today.prev_day.to_time
@course_prefs.endup_time = yesterday
@ -1016,7 +934,6 @@ class ProjectsController < ApplicationController
end
def restartcourse
#course_prefs = Course.find_by_extra(@project.identifier)
day = Time.parse("3000-01-01")
@course_prefs.endup_time = day
@ -1030,6 +947,14 @@ class ProjectsController < ApplicationController
end
private
def memberAccess
# 是课程,则判断当前用户是否参加了课程
return 0 if @project.project_type == Project::ProjectType_project
currentUser = User.current
render_403 unless currentUser.member_of?(@project)
end
def toggleCourse
@course_prefs = Course.find_by_extra(@project.identifier)
unless (@course_prefs.teacher == User.current || User.current.admin?)

View File

@ -37,5 +37,5 @@
<p><%= hidden_field_tag 'course_id', @project_id %>
</p>
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
<p><%= render :partial => 'attachments/form', :locals => {:container => @bid} %></p>
<div class="tabDiv"><%= render :partial => 'attachments/form', :locals => {:container => @bid} %></div>
</fieldset>

View File

@ -66,7 +66,7 @@
<%= link_to(l(:label_user_edit), my_account_path(@user)) if User.current %>
<% end %></td>
</tr>
<!-- added by bai 增加个人得分 -->
<% messages_count = @user.messages.count %>
<% messages_score = messages_count * 0.05%>
@ -158,9 +158,12 @@
<tr>
<td style="padding-left: 5px"><%= l(:label_user_login) %></td><td class="font_lighter_sidebar" style="padding-left: 0px"><%= format_time(@user.last_login_on) %></td>
</tr>
<!--
<tr>
<td valign="top" style="padding-left: 5px;"><%= l(:label_user_mail) %></td><td class="font_lighter_sidebar" style="padding-left: 0px; word-wrap: break-word; word-break: break-all"><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></td>
</tr>
-->
<!-- added by bai 在个人主页里显示“工作单位”“地区”"教师的职称"-->
<!-- modified by linchun 在个人主页里显示“加入时间”,“最后登录”,“邮件地址”后面添加冒号-->
<% unless @user.user_extensions.nil? %>

View File

@ -1,4 +1,4 @@
<em>尊敬的用户,<%= @user %>(<%= @user.mail%>)给你留言了:</em>
<em>尊敬的用户,<%= @user %>给你留言了:</em>
<div><%= @message %></div>
<h1>点击链接查看最新回复<%= link_to(@url, @url) %></h1>

View File

@ -1,3 +1,3 @@
尊敬的用户,<%= @user %>(<%= @user.mail%>)给你留言了:
尊敬的用户,<%= @user %>给你留言了:
<%= @message %>
点击链接查看最新回复<%= link_to(@url, @url) %>

View File

@ -6,7 +6,7 @@
<div class="splitcontentleft">
<ul>
<% unless @user.pref.hide_mail %>
<% unless @user.pref.hide_mail && @user == User.current %>
<li><%=l(:field_mail)%>: <%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></li>
<% end %>
<% @user.visible_custom_field_values.each do |custom_value| %>
@ -107,9 +107,11 @@
<li style="line-break: 10px">
<h1><%= h @user.name %></h1>
</li>
<% if @user == User.current %>
<li style="line-break: 10px">
<h3><%= mail_to(h(@user.mail), nil, :encode => 'javascript') %></h3>
</li>
<% end %>
<li style="line-break: 10px">
<td class="last_active"><%= l(:field_last_login_on)%>: <%= format_date(@user.last_login_on) %></td>
</li>

View File

@ -0,0 +1,6 @@
<div class="clearfix"></div>
<div class="linkother">
<a href="http://forge.trustie.net" class="link_other_item">项目托管平台</a>
<a href="http://course.trustie.net" class="link_other_item">课程实践平台</a>
<a href="http://contest.trustie.net" class="link_other_item">竞赛托管平台</a>
</div>

View File

@ -256,7 +256,7 @@
</div>
<div class="clearfix"></div>
<%= render partial: 'link_to_another' %>

View File

@ -109,7 +109,7 @@
<div class='desc_item text_nowrap' style="width: 310px;">
[<%= get_course_term project %>]
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
(<%= "#{studentCount(project)}人" %><%#= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
</div>
@ -267,4 +267,5 @@
</tr>
</table>
</div>
</div>
</div>
<%= render partial: 'link_to_another' %>

View File

@ -149,3 +149,4 @@
</table>
</div>
</div>
<%= render partial: 'link_to_another' %>

View File

@ -1769,6 +1769,14 @@ p.pagination {margin-top:8px; font-size: 90%}
clear:left;
}
.tabular .tabDiv{
margin: 0;
padding: 3px 0 3px 0;
padding-left: 100px; /* width of left column containing the label elements *//*by young*/
/*min-height: 1.8em;*/
clear:left;
}
html>body .tabular p {overflow:hidden;}
.tabular label{
@ -1830,7 +1838,7 @@ span.required {color: #bb0000;}
.summary {font-style: italic;}
#attachments_fields input.description {margin-left:4px; width:100px; }
#attachments_fields span {display:block; white-space:nowrap; font-family:'微软雅黑';}
#attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';}
#attachments_fields input.filename {border:0; height:1.8em; width:150px; color:#555; background-color:inherit; background:url(../images/attachment.png) no-repeat 1px 50%; padding-left:18px;}/*Modified by young*/
#attachments_fields .ajax-waiting input.filename {background:url(../images/hourglass.png) no-repeat 0px 50%;}
#attachments_fields .ajax-loading input.filename {background:url(../images/loading.gif) no-repeat 0px 50%;}

View File

@ -3,6 +3,20 @@
*/
/************************** 某部分开始 *****************************/
/************************** 某部分结束 *****************************/
/************************** 页脚 footer 开始 *****************************/
.linkother{
width: 460px;
margin: 70px auto -35px ;
}
.link_other_item{
width: 150px;
text-align: center;
display: inline-block;
font-size: 14px;
}
/************************** 页脚 footer 结束 *****************************/
.top_bar{
height: auto;
}