commit
b2e25e8afc
|
@ -386,6 +386,7 @@ class IssuesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_journal
|
def add_journal
|
||||||
|
if User.current.logged?
|
||||||
jour = Journal.new
|
jour = Journal.new
|
||||||
jour.user_id = User.current.id
|
jour.user_id = User.current.id
|
||||||
jour.notes = params[:notes]
|
jour.notes = params[:notes]
|
||||||
|
@ -396,6 +397,7 @@ class IssuesController < ApplicationController
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -102,22 +102,22 @@ class UsersController < ApplicationController
|
||||||
# issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment)
|
# issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment)
|
||||||
def user_messages
|
def user_messages
|
||||||
unless User.current.logged?
|
unless User.current.logged?
|
||||||
render_403
|
redirect_to signin_url
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
# 当前用户查看消息,则设置消息为已读
|
# 当前用户查看消息,则设置消息为已读
|
||||||
#if params[:viewed] == "all"
|
if params[:viewed] == "all"
|
||||||
# course_querys = @user.course_messages
|
course_querys = @user.course_messages
|
||||||
# forge_querys = @user.forge_messages
|
forge_querys = @user.forge_messages
|
||||||
# user_querys = @user.user_feedback_messages
|
user_querys = @user.user_feedback_messages
|
||||||
# forum_querys = @user.memo_messages
|
forum_querys = @user.memo_messages
|
||||||
# if User.current.id == @user.id
|
if User.current.id == @user.id
|
||||||
# course_querys.update_all(:viewed => true)
|
course_querys.update_all(:viewed => true)
|
||||||
# forge_querys.update_all(:viewed => true)
|
forge_querys.update_all(:viewed => true)
|
||||||
# user_querys.update_all(:viewed => true)
|
user_querys.update_all(:viewed => true)
|
||||||
# forum_querys.update_all(:viewed => true)
|
forum_querys.update_all(:viewed => true)
|
||||||
# end
|
end
|
||||||
#end
|
end
|
||||||
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
|
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
|
||||||
case params[:type]
|
case params[:type]
|
||||||
when nil
|
when nil
|
||||||
|
@ -296,6 +296,7 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
#用户作业列表
|
#用户作业列表
|
||||||
def user_homeworks
|
def user_homeworks
|
||||||
|
if User.current == @user
|
||||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||||
user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
|
user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
|
||||||
@homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10)
|
@homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10)
|
||||||
|
@ -303,6 +304,9 @@ class UsersController < ApplicationController
|
||||||
format.js
|
format.js
|
||||||
format.html {render :layout => 'new_base_user'}
|
format.html {render :layout => 'new_base_user'}
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#导入作业
|
#导入作业
|
||||||
|
@ -345,6 +349,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def new_user_commit_homework
|
def new_user_commit_homework
|
||||||
|
if User.current.logged?
|
||||||
@user = User.current
|
@user = User.current
|
||||||
@homework = HomeworkCommon.find(params[:homework_id])
|
@homework = HomeworkCommon.find(params[:homework_id])
|
||||||
@is_test = params[:is_test] == 'true'
|
@is_test = params[:is_test] == 'true'
|
||||||
|
@ -356,6 +361,9 @@ class UsersController < ApplicationController
|
||||||
format.js
|
format.js
|
||||||
format.html {render :layout => 'new_base_user'}
|
format.html {render :layout => 'new_base_user'}
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_commit_homework
|
def user_commit_homework
|
||||||
|
@ -364,6 +372,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_new_homework
|
def user_new_homework
|
||||||
|
if User.current.logged?
|
||||||
if params[:homework_common]
|
if params[:homework_common]
|
||||||
homework = HomeworkCommon.new
|
homework = HomeworkCommon.new
|
||||||
homework.name = params[:homework_common][:name]
|
homework.name = params[:homework_common][:name]
|
||||||
|
@ -412,6 +421,9 @@ class UsersController < ApplicationController
|
||||||
redirect_to user_homeworks_user_path(User.current.id)
|
redirect_to user_homeworks_user_path(User.current.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
render_403
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#用户从资源库导入资源到作业
|
#用户从资源库导入资源到作业
|
||||||
|
@ -507,6 +519,7 @@ class UsersController < ApplicationController
|
||||||
att_copy = atta.copy
|
att_copy = atta.copy
|
||||||
att_copy.container_id = nil
|
att_copy.container_id = nil
|
||||||
att_copy.container_type = nil
|
att_copy.container_type = nil
|
||||||
|
att_copy.author_id = User.current.id
|
||||||
att_copy.copy_from = atta.id
|
att_copy.copy_from = atta.id
|
||||||
att_copy.save
|
att_copy.save
|
||||||
@attachments << att_copy
|
@attachments << att_copy
|
||||||
|
@ -540,6 +553,10 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# modified by fq
|
# modified by fq
|
||||||
def user_newfeedback
|
def user_newfeedback
|
||||||
|
unless User.current.logged?
|
||||||
|
redirect_to signin_url
|
||||||
|
return
|
||||||
|
end
|
||||||
# 更新用户留言消息状态
|
# 更新用户留言消息状态
|
||||||
@user.journals_for_messages.each do |jour_message|
|
@user.journals_for_messages.each do |jour_message|
|
||||||
jour_message.user_feedback_messages.each do |userfeedback_message|
|
jour_message.user_feedback_messages.each do |userfeedback_message|
|
||||||
|
@ -767,7 +784,7 @@ class UsersController < ApplicationController
|
||||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||||
user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")"
|
user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")"
|
||||||
user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
|
user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
|
||||||
course_types = "('Message','News','HomeworkCommon','poll')"
|
course_types = "('Message','News','HomeworkCommon','Poll')"
|
||||||
project_types = "('Message','Issue')"
|
project_types = "('Message','Issue')"
|
||||||
if params[:type].present?
|
if params[:type].present?
|
||||||
case params[:type]
|
case params[:type]
|
||||||
|
|
|
@ -423,7 +423,7 @@ module UserScoreHelper
|
||||||
|
|
||||||
#更新分数
|
#更新分数
|
||||||
def update_score(option_number)
|
def update_score(option_number)
|
||||||
option_number.total_score = collaboration(option_number) + influence(option_number) + skill(option_number) + active(option_number)
|
option_number.total_score = collaboration(option_number) + influence(option_number) + skill(option_number) + project_active(option_number)
|
||||||
if option_number.total_score < 0
|
if option_number.total_score < 0
|
||||||
option_number.total_score = 0
|
option_number.total_score = 0
|
||||||
end
|
end
|
||||||
|
@ -444,7 +444,7 @@ module UserScoreHelper
|
||||||
option_number.praise_by_one * 4 + option_number.praise_by_two * 6 + option_number.praise_by_three * 8 - option_number.tread * 2 - option_number.tread_by_one * 2 - option_number.tread_by_two * 4 - option_number.tread_by_three * 6
|
option_number.praise_by_one * 4 + option_number.praise_by_two * 6 + option_number.praise_by_three * 8 - option_number.tread * 2 - option_number.tread_by_one * 2 - option_number.tread_by_two * 4 - option_number.tread_by_three * 6
|
||||||
end
|
end
|
||||||
#项目贡献得分
|
#项目贡献得分
|
||||||
def active(option_number)
|
def project_active(option_number)
|
||||||
option_number.changeset * 4 + option_number.document * 4 + option_number.attachment * 4 + option_number.issue_done_ratio * 2 + option_number.post_issue * 4
|
option_number.changeset * 4 + option_number.document * 4 + option_number.attachment * 4 + option_number.issue_done_ratio * 2 + option_number.post_issue * 4
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -493,24 +493,25 @@ class Query < ActiveRecord::Base
|
||||||
def project_statement
|
def project_statement
|
||||||
project_clauses = []
|
project_clauses = []
|
||||||
# unless project.descendants.blank?
|
# unless project.descendants.blank?
|
||||||
if project && project.descendants && project.descendants.active && !project.descendants.active.empty?
|
# if project && project.descendants && project.descendants.active && !project.descendants.active.empty?
|
||||||
ids = [project.id]
|
# ids = [project.id]
|
||||||
if has_filter?("subproject_id")
|
# if has_filter?("subproject_id")
|
||||||
case operator_for("subproject_id")
|
# case operator_for("subproject_id")
|
||||||
when '='
|
# when '='
|
||||||
# include the selected subprojects
|
# # include the selected subprojects
|
||||||
ids += values_for("subproject_id").each(&:to_i)
|
# ids += values_for("subproject_id").each(&:to_i)
|
||||||
when '!*'
|
# when '!*'
|
||||||
# main project only
|
# # main project only
|
||||||
else
|
# else
|
||||||
# all subprojects
|
# # all subprojects
|
||||||
ids += project.descendants.collect(&:id)
|
# ids += project.descendants.collect(&:id)
|
||||||
end
|
# end
|
||||||
elsif Setting.display_subprojects_issues?
|
# elsif Setting.display_subprojects_issues?
|
||||||
ids += project.descendants.collect(&:id)
|
# ids += project.descendants.collect(&:id)
|
||||||
end
|
# end
|
||||||
project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',')
|
# project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',')
|
||||||
elsif project
|
# elsif project
|
||||||
|
if project
|
||||||
project_clauses << "#{Project.table_name}.id = %d" % project.id
|
project_clauses << "#{Project.table_name}.id = %d" % project.id
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
|
|
|
@ -19,12 +19,23 @@
|
||||||
<%= call_hook :view_layouts_base_html_head %>
|
<%= call_hook :view_layouts_base_html_head %>
|
||||||
<!-- page specific tags -->
|
<!-- page specific tags -->
|
||||||
<%= yield :header_tags -%>
|
<%= yield :header_tags -%>
|
||||||
|
<%= stylesheet_link_tag 'base','header', :media => 'all'%>
|
||||||
</head>
|
</head>
|
||||||
<body class="<%=h body_css_classes %>">
|
<body class="<%=h body_css_classes %>">
|
||||||
|
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="navContainer mb10">
|
||||||
|
<% if User.current.logged? %>
|
||||||
|
<%= render :partial => 'layouts/logined_header',:locals=>{:name=>@name,:type=>@type} %>
|
||||||
|
<% else%>
|
||||||
|
<%= render :partial => 'layouts/unlogin_header',:locals=>{:name=>@name,:type=>@type} %>
|
||||||
|
<% end%>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<div id="wrapper2">
|
<div id="wrapper2">
|
||||||
<div id="wrapper3">
|
<div id="wrapper3">
|
||||||
<%= render :partial => 'layouts/base_header'%>
|
|
||||||
|
|
||||||
<div id="main" class="">
|
<div id="main" class="">
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
|
@ -38,7 +49,6 @@
|
||||||
<%= call_hook :view_layouts_base_content %>
|
<%= call_hook :view_layouts_base_content %>
|
||||||
<div style="clear:both;"></div>
|
<div style="clear:both;"></div>
|
||||||
</div>
|
</div>
|
||||||
<%= render :partial => 'layouts/base_footer'%>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -47,6 +57,11 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="cl"></div>
|
||||||
|
<%= render :partial => 'layouts/footer' %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
<%= call_hook :view_layouts_base_body_bottom %>
|
<%= call_hook :view_layouts_base_body_bottom %>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
|
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
|
||||||
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
|
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
|
||||||
|
<% if has_commit || activity.user_id == User.current %>
|
||||||
<div class="resources mt10">
|
<div class="resources mt10">
|
||||||
<div class="homepagePostBrief">
|
<div class="homepagePostBrief">
|
||||||
<div class="homepagePostPortrait">
|
<div class="homepagePostPortrait">
|
||||||
|
@ -44,3 +45,4 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
|
@ -5,4 +5,4 @@
|
||||||
<div> <%= l('userscore.active.update_issues')%> * 2 = <%= option_num.issue_done_ratio %> * 2 = <%= option_num.issue_done_ratio * 2 %></div>
|
<div> <%= l('userscore.active.update_issues')%> * 2 = <%= option_num.issue_done_ratio %> * 2 = <%= option_num.issue_done_ratio * 2 %></div>
|
||||||
<div> <%= l('userscore.active.release_issues')%> * 4 = <%= option_num.post_issue %> * 4 = <%= option_num.post_issue * 4 %></div>
|
<div> <%= l('userscore.active.release_issues')%> * 4 = <%= option_num.post_issue %> * 4 = <%= option_num.post_issue * 4 %></div>
|
||||||
<div> <%= l('userscore.active.release_messages')%> * 1 = <%= option_num.memo %> * 2 = <%= option_num.memo * 2 %></div>
|
<div> <%= l('userscore.active.release_messages')%> * 1 = <%= option_num.memo %> * 2 = <%= option_num.memo * 2 %></div>
|
||||||
<div> <%= l(:label_user_score_of_active)%> = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> + <%= option_num.memo * 2 %> = <%= active(option_num) %> </div>
|
<div> <%= l(:label_user_score_of_active)%> = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> + <%= option_num.memo * 2 %> = <%= project_active(option_num) %> </div>
|
|
@ -5,8 +5,8 @@
|
||||||
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
|
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
|
||||||
<!-- <div> + <%#= l(:label_user_score_of_influence) %></div> -->
|
<!-- <div> + <%#= l(:label_user_score_of_influence) %></div> -->
|
||||||
<div> = <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %>
|
<div> = <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %>
|
||||||
+ <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" , active(option_num)).to_i %></div>
|
+ <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" ,project_active(option_num)).to_i %></div>
|
||||||
<% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , active(option_num)).to_i) < 0 %>
|
<% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , project_active(option_num)).to_i) < 0 %>
|
||||||
<div><%= l(:label_score_less_than_zero) %></div>
|
<div><%= l(:label_score_less_than_zero) %></div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div> = <%= format("%.2f" ,option_num.total_score).to_i %></div>
|
<div> = <%= format("%.2f" ,option_num.total_score).to_i %></div>
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to l(:label_user_score_of_active), "javascript:void(0)", :onclick => "show_div('influence_new_score_index')" %> :
|
<%= link_to l(:label_user_score_of_active), "javascript:void(0)", :onclick => "show_div('influence_new_score_index')" %> :
|
||||||
<%= format("%.2f" , active(option_num)).to_i %>
|
<%= format("%.2f" , project_active(option_num)).to_i %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
target.show();
|
target.show();
|
||||||
}else{
|
}else{
|
||||||
btn.data('init',0);
|
btn.data('init',0);
|
||||||
btn.html('点击展开更多回复('+btn.data('count')+')');
|
btn.html('展开更多('+btn.data('count')+')');
|
||||||
target.hide();
|
target.hide();
|
||||||
target.eq(0).show();
|
target.eq(0).show();
|
||||||
target.eq(1).show();
|
target.eq(1).show();
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
|
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
|
||||||
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
|
||||||
$("#res_all_count").html(<%= @atta_count%>);
|
$("#res_all_count").html(<%= @atta_count%>);
|
||||||
|
$("#res_count").html(0);
|
||||||
|
$("#checkboxAll").attr('checked',false);
|
|
@ -29,7 +29,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="resources mt10" id="users_setting">
|
<div class="resources mt10" id="users_setting">
|
||||||
<div>
|
<div>
|
||||||
|
<% if params[:type].nil? %>
|
||||||
|
<div class="newsReadSetting">
|
||||||
|
有 <span class="c_red"><%= User.current.count_new_message %></span> 条未读<a href="javascript:void(0);" class="ml15"><%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %></a>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
<% if @message_alls.count >0 %>
|
<% if @message_alls.count >0 %>
|
||||||
<%# 课程消息 %>
|
<%# 课程消息 %>
|
||||||
<% unless @message_alls.nil? %>
|
<% unless @message_alls.nil? %>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
class DeleteAnonymousJour < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
jour_count = Journal.all.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... jour_count do i
|
||||||
|
Journal.page(i).per(30).each do |jour|
|
||||||
|
jour.destroy if jour.user_id == 2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20150906065702) do
|
ActiveRecord::Schema.define(:version => 20150906083453) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
|
Loading…
Reference in New Issue