This commit is contained in:
z9hang 2014-07-25 13:38:20 +08:00
commit d6a425849a
14 changed files with 2164 additions and 2096 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

@ -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

@ -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

@ -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