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

This commit is contained in:
nwb 2014-07-25 14:06:59 +08:00
commit 1257e67380
21 changed files with 2183 additions and 2105 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@
/db/schema.rb
/Gemfile.lock
/lib/plugins/acts_as_versioned/test/debug.log
/config/configuration.yml

View File

@ -54,13 +54,13 @@ class AttachmentsController < ApplicationController
# modify by nwb
# 下载添加权限设置
candown = false
if @attachment.container.has_attribute?(:project) && @attachment.container.project
if (@attachment.container.has_attribute?(:project) || @attachment.container.has_attribute?(:project_id)) && @attachment.container.project
project = @attachment.container.project
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
elsif @attachment.container.is_a?(Project)
project = @attachment.container
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
elsif @attachment.container.has_attribute?(:course) && @attachment.container.course
elsif (@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) && @attachment.container.course
course = @attachment.container.course
candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
elsif @attachment.container.is_a?(Course)

View File

@ -16,7 +16,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class ProjectsController < ApplicationController
layout :select_project_layout
menu_item :overview
menu_item :roadmap, :only => :roadmap
menu_item :settings, :only => :settings

View File

@ -107,6 +107,7 @@ class WelcomeController < ApplicationController
def contest
@contest_page = FirstPage.where("page_type = 'contest'").first
@contestNotification = ContestNotification.all.first
end
def search

View File

@ -339,4 +339,12 @@ module ProjectsHelper
return true
end
end
def find_project_repository project
unless project.repositories.nil?
project.repositories.each do |repository|
repository.fetch_changesets if Setting.autofetch_changesets?
end
end
end
end

View File

@ -165,6 +165,31 @@ class Mailer < ActionMailer::Base
:subject => l(:mail_subject_reminder, :count => issues.size, :days => days)
end
#缺陷到期邮件通知
def issue_expire issue
#@issues = issues
#s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
#puts s + "////" + issue.assigned_to.mail
#@issues_url = url_for(:controller => 'issues', :action => 'show',:id => issue.id)
#mail :to => issue.assigned_to.mail,
# :subject => s
issue_id = issue.project_index
redmine_headers 'Project' => issue.project.identifier,
'Issue-Id' => issue_id,
'Issue-Author' => issue.author.login
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id issue
@author = issue.author
@issue = issue
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue)
recipients = issue.recipients
cc = issue.watcher_recipients - recipients
mail :to => recipients,
:cc => cc,
:subject => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
end
# Builds a Mail::Message object used to email users belonging to the added document's project.
#
# Example:
@ -541,6 +566,35 @@ class Mailer < ActionMailer::Base
end
end
#缺陷到期后发送邮件提示
def mail_issue
threads = []
issues = Issue.where("done_ratio <> 100 && closed_on is null && due_date is not null")
issues.each do |issue|
thread = Thread.start do
while true
cur_issue = Issue.find issue.id
if cur_issue.done_ratio == 100 || cur_issue.closed_on != nil
break
end
if Time.now < Time.parse(cur_issue.due_date.to_s)
#休眠一个小时。。。
sleep 3600
else
#发邮件
puts issue.id.to_s
Mailer.issue_expire(issue).deliver
#Mailer.issue_add(issue).deliver
break
end
end
end
threads << thread
end
puts threads.count.to_s
threads
end
private
# Appends a Redmine header field (name is prepended with 'X-Redmine-')
@ -571,4 +625,6 @@ class Mailer < ActionMailer::Base
def mylogger
Rails.logger
end
end

View File

@ -106,7 +106,7 @@
<td>
<strong>提交文件:&nbsp;
<% if is_evaluation || is_teacher%>
<%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework%>
<%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework, :remote => true%>
<% else %>
<span class="required">未开启互评功能作业不允许下载</span>
<% end %>

View File

@ -35,6 +35,10 @@
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
<strong style="vertical-align: top">描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述&nbsp;&nbsp;</strong>
<span style="margin-left:-10px;padding-right: 20px;">
<!--<script src="/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
<%#= f.text_area :description, :rows => 15, :class => 'wiki-edit', :id => 'editor01' %></p>
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>-->
<%= f.text_area "description", :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
</span>
</p>

View File

@ -93,30 +93,30 @@
</tr>
<!-- added by bai 增加个人得分 -->
<% messages_count = @user.messages.count %>
<% messages_score = messages_count * 0.05%>
<% finall_messages_score = messages_score %>
<%# messages_count = @user.messages.count %>
<%# messages_score = messages_count * 0.05%>
<%# finall_messages_score = messages_score %>
<% journals_count = @user.journals.count %>
<% journals_score = journals_count * 0.1 %>
<% user_changesets_count = @user.changesets.count %>
<% user_changesets_score = user_changesets_count * 0.3 %>
<% finall_user_project_score = journals_score + user_changesets_score %>
<%# journals_count = @user.journals.count %>
<%# journals_score = journals_count * 0.1 %>
<%# user_changesets_count = @user.changesets.count %>
<%# user_changesets_score = user_changesets_count * 0.3 %>
<%# finall_user_project_score = journals_score + user_changesets_score %>
<% journals_for_messages_count = @user.journals_messages.count %>
<% activities_count = @user.activities.count %>
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
<% activities_score = activities_count * 0.2 %>
<% finall_activity_score = journals_for_messages_score + activities_score %>
<%# journals_for_messages_count = @user.journals_messages.count %>
<%# activities_count = @user.activities.count %>
<%# journals_for_messages_score = journals_for_messages_count * 0.05 %>
<%# activities_score = activities_count * 0.2 %>
<%# finall_activity_score = journals_for_messages_score + activities_score %>
<% news_count = @user.news.count %>
<% news_score = news_count * 0.1 %>
<% wiki_contents_count = @user.wiki_contents.count %>
<% wiki_contents_score = wiki_contents_count * 0.1 %>
<% comments_count = @user.comments.count %>
<% 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 %>
<%# news_count = @user.news.count %>
<%# news_score = news_count * 0.1 %>
<%# wiki_contents_count = @user.wiki_contents.count %>
<%# wiki_contents_score = wiki_contents_count * 0.1 %>
<%# comments_count = @user.comments.count %>
<%# 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">

View File

@ -7,7 +7,7 @@
</div>
<div class="memo-section">
<div class="contextual-borad">
<!-- <%= link_to(
<!-- <%#= link_to(
image_tag('comment.png'),
{:action => 'quote', :id => @memo},
:remote => true,
@ -28,7 +28,7 @@
:method => 'get',
:title => l(:button_edit)
) if @memo.editable_by?(User.current) %>
<!-- <%= link_to(
<!-- <%#= link_to(
image_tag('delete.png'),
{:action => 'destroy', :id => @memo},
:method => :delete,
@ -68,9 +68,9 @@
<% pages_count = @reply_pages.offset %>
<% @replies.each do |reply| %>
<div class="reply" id="<%= "reply-#{reply.id}" %>">
<p class="font_lighter"><!--<span style="display: inline"><%= pages_count += 1 %>楼 :</span>--></p>
<p class="font_lighter"><!--<span style="display: inline"><%#= pages_count += 1 %>楼 :</span>--></p>
<div class="contextual-borad">
<!-- <%= link_to(
<!-- <%#= link_to(
image_tag('comment.png'),
{:action => 'quote', :id => reply},
:remote => true,
@ -90,7 +90,7 @@
{:action => 'edit', :id => reply},
:title => l(:button_edit)
) if reply.editable_by?(User.current) %>
<!-- <%= link_to(
<!-- <%#= link_to(
image_tag('delete.png'),
{:action => 'destroy', :id => reply},
:method => :delete,

View File

@ -45,6 +45,7 @@
</tr>
<tr>
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<% find_project_repository @project %>
<strong><%= content_tag('span', "#{@project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count }", :class => "info") %></strong>
</td>
<td style="width: 60%;text-align: left">

View File

@ -1,33 +1,33 @@
<!-- added by bai -->
<% messages_count = @user.messages.count %>
<% messages_score = messages_count * 0.05%>
<% finall_messages_score = messages_score %>
<%# messages_count = @user.messages.count %>
<%# messages_score = messages_count * 0.05%>
<%# finall_messages_score = messages_score %>
<% journals_count = @user.journals.count %>
<% journals_score = journals_count * 0.1 %>
<% user_changesets_count = @user.changesets.count %>
<% user_changesets_score = user_changesets_count * 0.3 %>
<% finall_user_project_score = journals_score + user_changesets_score %>
<%# journals_count = @user.journals.count %>
<%# journals_score = journals_count * 0.1 %>
<%# user_changesets_count = @user.changesets.count %>
<%# user_changesets_score = user_changesets_count * 0.3 %>
<%# finall_user_project_score = journals_score + user_changesets_score %>
<% journals_for_messages_count = @user.journals_messages.count %>
<% activities_count = @user.activities.count %>
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
<% activities_score = activities_count * 0.2 %>
<% finall_activity_score = journals_for_messages_score + activities_score %>
<%# journals_for_messages_count = @user.journals_messages.count %>
<%# activities_count = @user.activities.count %>
<%# journals_for_messages_score = journals_for_messages_count * 0.05 %>
<%# activities_score = activities_count * 0.2 %>
<%# finall_activity_score = journals_for_messages_score + activities_score %>
<% news_count = @user.news.count %>
<% news_score = news_count * 0.1 %>
<% wiki_contents_count = @user.wiki_contents.count %>
<% wiki_contents_score = wiki_contents_count * 0.1 %>
<% comments_count = @user.comments.count %>
<% 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 %>
<%# news_count = @user.news.count %>
<%# news_score = news_count * 0.1 %>
<%# wiki_contents_count = @user.wiki_contents.count %>
<%# wiki_contents_score = wiki_contents_count * 0.1 %>
<%# comments_count = @user.comments.count %>
<%# 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 %>
<div><%= l(:label_user_score) %></div>
<div> = <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> +
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
<!-- <div>&nbsp;&nbsp;&nbsp;+ <%= l(:label_user_score_of_influence) %></div> -->
<!-- <div>&nbsp;&nbsp;&nbsp;+ <%#= l(:label_user_score_of_influence) %></div> -->
<div> = <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_i %>
+ <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %></div>
<div> = <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_i %></div>

View File

@ -1,28 +1,28 @@
<!-- added by bai -->
<% messages_count = @user.messages.count %>
<% messages_score = messages_count * 0.05%>
<% finall_messages_score = messages_score %>
<%# messages_count = @user.messages.count %>
<%# messages_score = messages_count * 0.05%>
<%# finall_messages_score = messages_score %>
<% journals_count = @user.journals.count %>
<% journals_score = journals_count * 0.1 %>
<% user_changesets_count = @user.changesets.count %>
<% user_changesets_score = user_changesets_count * 0.3 %>
<% finall_user_project_score = journals_score + user_changesets_score %>
<%# journals_count = @user.journals.count %>
<%# journals_score = journals_count * 0.1 %>
<%# user_changesets_count = @user.changesets.count %>
<%# user_changesets_score = user_changesets_count * 0.3 %>
<%# finall_user_project_score = journals_score + user_changesets_score %>
<% journals_for_messages_count = @user.journals_messages.count %>
<% activities_count = @user.activities.count %>
<% journals_for_messages_score = journals_for_messages_count * 0.05 %>
<% activities_score = activities_count * 0.2 %>
<% finall_activity_score = journals_for_messages_score + activities_score %>
<%# journals_for_messages_count = @user.journals_messages.count %>
<%# activities_count = @user.activities.count %>
<%# journals_for_messages_score = journals_for_messages_count * 0.05 %>
<%# activities_score = activities_count * 0.2 %>
<%# finall_activity_score = journals_for_messages_score + activities_score %>
<% news_count = @user.news.count %>
<% news_score = news_count * 0.1 %>
<% wiki_contents_count = @user.wiki_contents.count %>
<% wiki_contents_score = wiki_contents_count * 0.1 %>
<% comments_count = @user.comments.count %>
<% 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 %>
<%# news_count = @user.news.count %>
<%# news_score = news_count * 0.1 %>
<%# wiki_contents_count = @user.wiki_contents.count %>
<%# wiki_contents_score = wiki_contents_count * 0.1 %>
<%# comments_count = @user.comments.count %>
<%# 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 %>
<h3 class="title"><%= l(:label_user_score) %></h3>
<div class="inf_user_image">

View File

@ -197,18 +197,19 @@
<span style="margin-top: -20px;float: right; display: block;"><%#= link_to l(:label_more_information), forums_path %></span>
<div style="height: 167px; padding-top:6px;">
<fieldset style="padding-left: 36px; margin-left: 13px; height: 150px; width:380px; border-radius:10px;">
<div style="font-size:14px; color: #1166AD; padding-left:52px; "><strong>2014年Android程序设计大赛获奖名单</strong></div>
<div style="font-size:14px; color: #1166AD; padding-left:52px; "><strong><%= @contestNotification.title %></strong></div>
<div class="underline-contests_four"></div>
<div id="up_zzjs">
<div id="marqueebox">
<div><span style="color: red">一等奖:</span>&nbsp<span style="color: #1166AD">消灭那怪兽</span></div>
<!-- <div><span style="color: red">一等奖:</span>&nbsp<span style="color: #1166AD">消灭那怪兽</span></div>
<div><span style="color: red">二等奖:</span>&nbsp<span style="color: #1166AD">兄弟向前冲 </span></div>
<div><span style="color: red">二等奖:</span>&nbsp<span style="color: #1166AD">鸟鸟文件管理器(银河之光版)</span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">疯狂猜图</span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">愉快的定向越野 </span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">体能训练助手 </span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">迷你日记本 </span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">永齐飞机大战</span></div>
<div><span style="color: red">三等奖:</span>&nbsp<span style="color: #1166AD">永齐飞机大战</span></div> -->
<%= @contestNotification.content.html_safe %>
</div>
</div>
<!-- 火狐 onmouseover、onmouseout无效 <marquee scrollamount=3 direction=up height=100 onmouseover=stop() onmouseout= start() >

View File

@ -34,12 +34,12 @@
<div class="weixin-content">微信扫码</div>
</div>
<div class="main-content-bar" id="main-content-bar">
<div style="float: left">
<div style="float: left;padding-left:15px ">
<!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> -->
<% if get_avatar?(@first_page) %>
<%= image_tag(url_to_avatar(@first_page), size: "75x75") %>
<%= image_tag(url_to_avatar(@first_page), size: "107x63") %>
<% else %>
<%= image_tag '/images/transparent.png', size: "75x75" %>
<%= image_tag '/images/transparent.png', size: "107x63" %>
<% end %>
</div>

View File

@ -0,0 +1 @@
alert("对不起,这个文件暂时不能下载。 ");

View File

@ -0,0 +1 @@
alert('<%=l(:no_file_dowmload)%>');

View File

@ -0,0 +1,4 @@
#Mailer.mail_issue.each do |t|
# t.join
#end

View File

@ -1134,6 +1134,7 @@ zh:
text_zoom_in: 放大
text_zoom_out: 缩小
text_applied_project: "用户 %{id} 申请加入项目 %{project}"
text_issue_expire: "分配给您的任务%{issue}即将到期"
default_role_manager: 管理人员
default_role_developer: 开发人员

File diff suppressed because it is too large Load Diff