From aacd3af1fe5f216c058233260caee22aa6df55ca Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 15 Jun 2015 10:53:57 +0800 Subject: [PATCH 01/26] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=8E=EF=BC=8C=E6=8C=89=E5=A4=A9=E5=8F=91?= =?UTF-8?q?=E9=80=81=E9=82=AE=E4=BB=B6=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 8488fc1d0..e6b091dd4 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -104,7 +104,7 @@ class Mailer < ActionMailer::Base # 查询user的缺陷,项目中成员都能收到 sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}' - and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc" + and (i.updated_on between '#{date_from}' and '#{date_to}') order by i.updated_on desc" @issues = Issue.find_by_sql(sql) # @bids 查询课程作业,包括老师发布的作业,以及user提交作业 From 761840e0a4341fbcfbf81fa91d77f6836cbc1002 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 15 Jun 2015 13:11:35 +0800 Subject: [PATCH 02/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E6=8F=8F=E8=BF=B0=E6=9F=A5=E7=9C=8B=E5=B7=AE?= =?UTF-8?q?=E5=88=AB=E6=97=B6404=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/journals_controller.rb | 2 +- app/helpers/issues_helper.rb | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index f6e17593f..aa3a7e0ea 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -56,7 +56,7 @@ class JournalsController < ApplicationController @diff = Redmine::Helpers::Diff.new(@detail.value, @detail.old_value) respond_to do |format| format.html { - render :layout => 'project_base' + render :layout => 'new_base' } end end diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index aae150728..e4f9a7a81 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -361,15 +361,16 @@ module IssuesHelper end end + # 之所以注释是因为该功能冗余了 if detail.property == 'attr' && detail.prop_key == 'description' s = l(:text_journal_changed_no_detail, :label => label) - unless no_html - diff_link = link_to l(:label_diff), - {:controller => 'journals', :action => 'diff', :id => detail.journal_id, - :detail_id => detail.id, :only_path => options[:only_path]}, - :title => l(:label_view_diff) - s << " (#{ diff_link })" - end + # unless no_html + # diff_link = link_to l(:label_diff), + # {:controller => 'journals', :action => 'diff', :id => detail.journal_id, + # :detail_id => detail.id, :only_path => options[:only_path]}, + # :title => l(:label_view_diff) + # s << " (#{ diff_link })" + # end s.html_safe elsif detail.value.present? case detail.property From 014f830b1dd16254a7d8f10a95f56761b455605c Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 15 Jun 2015 14:51:10 +0800 Subject: [PATCH 03/26] =?UTF-8?q?=E6=B7=BB=E5=8A=A0issue=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E5=8F=91=E9=80=81=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 5 +++++ app/views/journals/diff.html.erb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index e6b091dd4..20cf91aa4 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -107,6 +107,11 @@ class Mailer < ActionMailer::Base and (i.updated_on between '#{date_from}' and '#{date_to}') order by i.updated_on desc" @issues = Issue.find_by_sql(sql) + # issue回复 + @issues_journals = Journal.find_by_sql("select j.* from journals j, members m, projects p, issues i + where m.user_id = '#{user.id}' and p.id = m.project_id and i.project_id = p.id and j.journalized_id = i.id + and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by updated_on desc") + # @bids 查询课程作业,包括老师发布的作业,以及user提交作业 # @attachments查询课程课件更新 @attachments ||= [] diff --git a/app/views/journals/diff.html.erb b/app/views/journals/diff.html.erb index d3dfa7d34..5bc823c76 100644 --- a/app/views/journals/diff.html.erb +++ b/app/views/journals/diff.html.erb @@ -2,7 +2,7 @@

<%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %>

-<%= simple_format_without_paragraph @diff.to_html %> + <%= simple_format_without_paragraph @diff.to_html %>

<%= link_to l(:button_back), issue_path(@issue), :onclick => 'history.back(); return false;' %>

From 4bb674bcae928008096fb11cef4c407177db51c9 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 15 Jun 2015 15:43:28 +0800 Subject: [PATCH 04/26] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E3=80=81=E9=A1=B9=E7=9B=AE=E6=96=B0=E9=97=BB=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=20=E9=82=AE=E4=BB=B6=E6=9F=A5=E8=AF=A2=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 20cf91aa4..352c1b41a 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -160,13 +160,23 @@ class Mailer < ActionMailer::Base end # wiki - # 查询user在课程中发布的通知,项目中发的新闻 + # 查询user在课程中发布的通知和回复通知 @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.course_id in (#{course_ids}) and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] + + @course_news_comments = Comment.find_by_sql("select cm.* from comments cm, members m, courses c, news n + where m.user_id = '#{user.id}' and c.id = m.course_id and n.course_id = c.id and cm.commented_id = n.id + and cm.commented_type ='News' and (cm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + + # 查询user在项目中添加新闻和回复新闻 @project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids}) and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] + @project_news_comments = Comment.find_by_sql("select c.* from comments c, members m, projects p, news n + where m.user_id = '#{user.id}' and p.id = m.project_id and n.project_id = p.id and c.commented_id = n.id + and c.commented_type ='News' and (c.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + # 查询user在课程及个人中留言 @course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id From 59dcfcbb1a136f095806d2a02af71738dd188153 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 15 Jun 2015 17:44:53 +0800 Subject: [PATCH 05/26] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=EF=BC=88=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E3=80=81=E9=A1=B9=E7=9B=AE=E6=96=B0=E9=97=BB=E3=80=81=E7=BC=BA?= =?UTF-8?q?=E9=99=B7=E6=9B=B4=E6=96=B0=E5=9B=9E=E5=A4=8D=EF=BC=89=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 4 +- .../mailer/send_for_user_activities.html.erb | 100 +++++++++++++++++- 2 files changed, 101 insertions(+), 3 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 352c1b41a..e19f58e47 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -110,7 +110,7 @@ class Mailer < ActionMailer::Base # issue回复 @issues_journals = Journal.find_by_sql("select j.* from journals j, members m, projects p, issues i where m.user_id = '#{user.id}' and p.id = m.project_id and i.project_id = p.id and j.journalized_id = i.id - and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by updated_on desc") + and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") # @bids 查询课程作业,包括老师发布的作业,以及user提交作业 # @attachments查询课程课件更新 @@ -194,7 +194,7 @@ class Mailer < ActionMailer::Base @memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id})) and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc") - has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news, + has_content = [@issues,@issues_journals,@course_messages,@project_messages,@course_news,@course_news_comments,@project_news,@project_news_comments, @course_journal_messages,@user_journal_messages,@project_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?} mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" #有内容才发,没有不发 diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 21549be21..5c89be1b8 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -6,6 +6,7 @@ @course_journal_messages.first|| @course_messages.first || @attachments.first %>

<%= l(:label_course_overview)%>

+ <% unless @course_news.first.nil? %>
    @@ -35,6 +36,38 @@
<% end %> + + <% unless @course_news_comments.first.nil? %> +
    + + <%= l(:label_course_news) %> + + <% @course_news_comments.each do |course_news_comment|%> +
  • + + [ + <% unless course_news_comment.commented.nil? %> + <%= link_to truncate(course_news_comment.commented.course.name,length: 30,omission: '...'), course_url(course_news_comment.commented.course, :token => @token.value), + :class=> "wmail_column", + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <% end %> + ] + + <%= link_to course_news_comment.author, user_activities_url(course_news_comment.author,:token => @token.value), :class => "wmail_name", + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_project_notice) %> + + <%= link_to truncate(course_news_comment.comments,length: 30,omission: '...'), news_url(course_news_comment.commented,:token => @token.value), + :class => 'wmail_info', + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + %> + <%= format_time(course_news_comment.created_on) %> +
  • + <% end %> +
    +
+ <% end %> + <% unless @bids.empty? %>
    @@ -162,7 +195,7 @@ <% end %> -<% if @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first %> +<% if @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first || @project_news_comments.first %>

    <%= l(:label_project_overview_new)%>

    <% unless @issues.first.nil? %> @@ -192,6 +225,41 @@
<% end %> + + + <% unless @issues_journals.first.nil? %> +
    + + <%= l(:label_issue_tracking) %> + + <% @issues_journals.each do |issues_journal| %> +
  • + + [ + <%= link_to truncate(issues_journal.issue.project.name,length: 30,omission: '...'), project_url(issues_journal.issue.project, :token => @token.value), + :class=> "wmail_column", + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + ] + <%= link_to issues_journal.user, user_activities_url(issues_journal.user,:token => @token.value), :class => "wmail_name", + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_project_issue) %> + <% if issues_journal.notes.nil? %> + <%= link_to truncate(issues_journal.issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value), + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + %> + <% else %> + <%= link_to truncate(issues_journal.notes,length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + %> + <% end %> + <%= format_time(issues_journal.created_on) %> +
  • + <% end %> + +
    +
+ <% end %> + <% unless @project_messages.first.nil? %>
    @@ -284,6 +352,36 @@
<% end %> + + <% unless @project_news_comments.first.nil? %> +
    + + <%= l(:label_project_news) %> + + <% @project_news_comments.each do |project_news_comment|%> +
  • + + [ + <% unless project_news_comment.commented.nil? %> + <%= link_to truncate(project_news_comment.commented.project.name,length: 30,omission: '...'), project_url(project_news_comment.commented.project, :token => @token.value), + :class=> "wmail_column", + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <% end %> + ] + <%= link_to project_news_comment.author, user_activities_url(project_news_comment.author,:token => @token.value), :class => "wmail_name", + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_project_mail_notice) %> + + <%= link_to truncate(project_news_comment.comments.html_safe,length: 30,omission: '...'), news_url(project_news_comment.commented,:token => @token.value), + :class => 'wmail_info', + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <%= format_time(project_news_comment.created_on) %> +
  • + <% end %> +
    +
+ <% end %> + <% unless @project_journal_messages.first.nil? %>
    From 04d4fee17ec8735603583b8b8c0a2957760b2c79 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 16 Jun 2015 09:32:51 +0800 Subject: [PATCH 06/26] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E5=8F=91=E9=80=81=EF=BC=9A=E6=96=B0=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=9C=A8=E9=82=AE=E4=BB=B6=E4=B8=AD=E4=BD=93?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/_issue.html.erb | 31 +++++++++---------- .../mailer/send_for_user_activities.html.erb | 1 - 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/app/views/mailer/_issue.html.erb b/app/views/mailer/_issue.html.erb index 5145dbb2c..49f137df5 100644 --- a/app/views/mailer/_issue.html.erb +++ b/app/views/mailer/_issue.html.erb @@ -1,46 +1,43 @@

    - - + <%= link_to(h("#{@author.login}(#{@author.show_name})"), @issue_author_url , :style=>'color:#1b55a7; font-weight:bold;') %> - <%= l(:mail_issue_title_userin)%> - <%= link_to(h("#{@issue.project.name}"), @project_url, :style=>'color:#1b55a7; font-weight:bold;') %><%= l(:mail_issue_title_active)%>

    + <%= l(:mail_issue_title_userin)%> + <%= link_to(h("#{@issue.project.name}"), @project_url, :style=>'color:#1b55a7; font-weight:bold;') %><%= l(:mail_issue_title_active)%> +

    -
      -
    • <%= l(:mail_issue_subject)%><%= link_to(issue.subject, issue_url, :style=>'color:#1b55a7; font-weight:bold;') %>
    • -
    • <%= l(:mail_issue_sent_from)%><%= issue.project.name %><%= l(:mail_issue_from_project)%>
    • -
    • <%= l(:mail_issue_content)%> +
        +
      • <%= l(:mail_issue_subject)%><%= link_to(issue.subject, issue_url, :style=>'color:#1b55a7; font-weight:bold;') %>
      • +
      • <%= l(:mail_issue_sent_from)%><%= issue.project.name %><%= l(:mail_issue_from_project)%>
      • +
      • <%= l(:mail_issue_content)%> <% if @journal.nil? %> - <%= issue.description=='' ? l(:label_none) : issue.description %> + <%= issue.description=='' ? l(:label_none) : issue.description.html_safe %> <% else %> - <%= @journal.notes=='' ? l(:label_none) : @journal.notes %> + <%= @journal.notes=='' ? l(:label_none) : @journal.notes.html_safe %> <% end%>
      • <%= l(:mail_issue_attachments)%> <% if @issue.attachments.count == 0 %> - <%= l(:label_none)%> + <%= l(:label_none)%> <% else %> <% @issue.attachments.each do |attach| %>

        <%= link_to_attachment(attach, :download => true, :token => @token.value, :only_path => false, :style=>'color:#1b55a7; font-weight:bold;')%>

        <% end %>
        <% end %> - -
      • -
      +
    + <%= link_to( l(:mail_issue_reply), issue_url, :class => "mail_reply", :style =>'display:block; float:right; width:80px; text-align:center; height:30px; background:#15bccf; color:#fff; font-weight:normal; font-size:14px; line-height: 30px;') %> +
    <% end %> From c8884c6fd4dcd80b9f418ca4cb11ef52110af3b7 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 16 Jun 2015 11:11:59 +0800 Subject: [PATCH 07/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E7=94=A8=E6=88=B7url=EF=BC=8C=E9=9A=90=E8=97=8Fuserid=E9=98=B2?= =?UTF-8?q?=E6=AD=A2=E6=B3=A8=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 7 ++++--- app/models/mailer.rb | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index efe5a52ee..6510d65aa 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -413,10 +413,11 @@ class ProjectsController < ApplicationController # 2、加入项目、创建角色 # 3、用户得分 if params[:mail] - user = User.find(params[:user_id]) + userid = Token.find_by_value(params[:token]).user_id + user = User.find(userid) user.activate! - Member.create(:role_ids => [4], :user_id => params[:user_id],:project_id => params[:id]) - UserGrade.create(:user_id => params[:user_id], :project_id => params[:id]) + Member.create(:role_ids => [4], :user_id => userid, :project_id => params[:id]) + UserGrade.create(:user_id => userid, :project_id => params[:id]) token = Token.get_token_from_user(user, 'autologin') #user = User.try_to_autologin(token.value) if user diff --git a/app/models/mailer.rb b/app/models/mailer.rb index e19f58e47..8b8ed7d73 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -61,8 +61,8 @@ class Mailer < ActionMailer::Base InviteList.create(:user_id => user.id, :project_id => project.id) User.current = user unless User.current.nil? @user = user - - @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true) + @token = Token.get_token_from_user(user, 'autologin') + @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :mail => true, :token => @token.value) mail :to => email, :subject => @subject end From f3f0a9847f7b20418800739685c762b0735bba69 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 16 Jun 2015 11:45:30 +0800 Subject: [PATCH 08/26] =?UTF-8?q?=E9=82=AE=E4=BB=B6text=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=B9=B6=E4=B8=8D=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mailer/send_for_user_activities.html.erb | 7 +- .../mailer/send_for_user_activities.text.erb | 469 +++++++----------- 2 files changed, 182 insertions(+), 294 deletions(-) diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 9c64af22e..70dab08f0 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -2,7 +2,7 @@

    <%= @subject %>

    -<% if @attachments.first || @course_news.first || @bids.first || +<% if @attachments.first || @course_news.first || @course_news_comments.first || @bids.first || @course_journal_messages.first|| @course_messages.first || @attachments.first %>

    <%= l(:label_course_overview)%>

    @@ -65,7 +65,7 @@ <% end %>
    -
+ <% end %> @@ -194,7 +194,8 @@ <% end %> -<% if @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first || @project_news_comments.first %> +<% if @issues.first || @project_messages.first || @issues_journals.first || @wiki_contents.first || @project_news.first || @project_news_comments.first || @project_journal_messages.first || + @project_news_comments.first %>

<%= l(:label_project_overview_new)%>

<% unless @issues.first.nil? %> diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb index c46e96f03..43a4dbe9e 100644 --- a/app/views/mailer/send_for_user_activities.text.erb +++ b/app/views/mailer/send_for_user_activities.text.erb @@ -1,344 +1,231 @@ <%= @subject %> -<% if @attachments.first || @course_news.first || @bids.first || - @course_journal_messages.first|| @course_messages.first %> -<%= l(:label_course_overview)%> - <% unless @course_news.first.nil? %> - <%= l(:label_course_news) %> - - - +<% if @attachments.first || @course_news.first || @course_news_comments.first || @bids.first || + @course_journal_messages.first|| @course_messages.first || @attachments.first %> + <%= l(:label_course_overview)%> + <% unless @course_news.first.nil? %> + <%= l(:label_course_news) %> <% @course_news.each do |course_new|%> - ▪ - [ - - <%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value)%> - ] - - <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value) - %> - <%= l(:label_project_notice) %> + ▪[<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value)%> ] - <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value) - - - %> <%= format_time(course_new.created_on) %> + <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value) %> + <%= l(:label_project_notice) %> + <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value) %> + <%= format_time(course_new.created_on) %> + <% end %> + <% end %> + <% unless @course_news_comments.first.nil? %> + <%= l(:label_course_news) %> + <% @course_news_comments.each do |course_news_comment|%> + ▪[ <% unless course_news_comment.commented.nil? %> + <%= link_to truncate(course_news_comment.commented.course.name,length: 30,omission: '...'), course_url(course_news_comment.commented.course, :token => @token.value) %> + <% end %> + ] + <%= link_to course_news_comment.author, user_activities_url(course_news_comment.author,:token => @token.value) %> + <%= l(:label_project_notice) %> + <%= link_to truncate(course_news_comment.comments,length: 30,omission: '...'), news_url(course_news_comment.commented,:token => @token.value) %> + <%= format_time(course_news_comment.created_on) %> <% end %> + <% end %> - <% end %> - <% unless @bids.empty? %> - <%= l(:label_homework_overview) %> + <% unless @bids.empty? %> + <%= l(:label_homework_overview) %> <% unless @bids.first.nil?%> <% @bids.each do |bid| %> - ▪ - [ - - <%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value) - - %> - ] - - <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value) - %> - <%= l(:label_course_homework) %> - - <%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value) - - - %> - <%= format_time(bid.created_at) %> - + ▪[<%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value) %>] + <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value) %> + <%= l(:label_course_homework) %> + <%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value) %> + <%= format_time(bid.created_at) %> <% end %> <% end %> + + <% end %> - - - <% end %> - - <% unless @course_journal_messages.first.nil? %> - - <%= l(:view_course_journals_for_messages) %> - - + <% unless @course_journal_messages.first.nil? %> + <%= l(:view_course_journals_for_messages) %> <% @course_journal_messages.each do |course_journal_message|%> - - [ - - <%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value) - - %> - ] - - <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value) - %> + [ <%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value) %>] + <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value) %> <%= l(:label_send_course_journals_for_messages) %> - - <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value) - - - %> - <%= format_time(course_journal_message.created_on) %> - + <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value) %> + <%= format_time(course_journal_message.created_on) %> <% end %> + <% end %> - - <% end %> - - <% unless @course_messages.first.nil? %> - - <%= l(:view_borad_course) %> - - - + <% unless @course_messages.first.nil? %> + <%= l(:view_borad_course) %> <% @course_messages.each do |course_message|%> - - ▪ - [ - - <%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course, :token => @token.value) - - %> - ] - - <%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value) - %> - <%= l(:label_send_course_messages) %> - - <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value) - - - %> - <%= format_time(course_message.created_on) %> - + ▪[<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course, :token => @token.value)%>] + <%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value) %> + <%= l(:label_send_course_messages) %> + <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value) %> + <%= format_time(course_message.created_on) %> <% end %> + <% end %> - - <% end %> - - <% unless @attachments.first.nil? %> - - <%= l(:label_course_attendingcontestwork_download) %> - - - + <% unless @attachments.first.nil? %> + <%= l(:label_course_attendingcontestwork_download) %> <% @attachments.each do |attachment|%> - ▪[ - - <%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value) - - %> - ] - - <%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value) - %> - <%= l(:label_course_file_upload) %> - - <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value) - - - %> - <%= format_time(attachment.created_on) %> - + ▪[<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value) %>] + <%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value) %> + <%= l(:label_course_file_upload) %> + <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value) %> + <%= format_time(attachment.created_on) %> <% end %> - - - <% end %> + + <% end %> <% end %> -<% @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first %> -<%= l(:label_project_overview_new)%> - <% unless @issues.first.nil? %> - - <%= l(:label_issue_tracking) %> - - + + +<% if @issues.first || @project_messages.first || @issues_journals.first || @wiki_contents.first || @project_news.first || @project_news_comments.first || @project_journal_messages.first || + @project_news_comments.first %> + <%= l(:label_project_overview_new)%> + <% unless @issues.first.nil? %> + <%= l(:label_issue_tracking) %> <% @issues.each do |issue|%> - ▪ - [ - - <%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value) - - %> - ] - - <%= link_to issue.author, user_activities_url(issue.author,:token => @token.value) - %> - <%= l(:label_project_issue) %> - - <%= link_to truncate(issue. subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value) - - - %> - <%= format_time(issue.created_on) %> + ▪[<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value) %>] + <%= link_to issue.author, user_activities_url(issue.author,:token => @token.value) %> + <%= l(:label_project_issue) %> + <%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value) %> + <%= format_time(issue.created_on) %> <% end %> + + <% end %> + + <% unless @issues_journals.first.nil? %> + <%= l(:label_issue_tracking) %> + <% @issues_journals.each do |issues_journal| %> + ▪[<%= link_to truncate(issues_journal.issue.project.name,length: 30,omission: '...'), project_url(issues_journal.issue.project, :token => @token.value) %>] + <%= link_to issues_journal.user, user_activities_url(issues_journal.user,:token => @token.value) %> + <%= l(:label_project_issue) %> + <% if issues_journal.notes.nil? %> + <%= link_to truncate(issues_journal.issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value) %> + <% else %> + <%= link_to truncate(issues_journal.notes,length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value) %> + <% end %> + <%= format_time(issues_journal.created_on) %> + <% end %> + <% end %> - <% end %> - - <% unless @project_messages.first.nil? %> - - <%= l(:project_moule_boards_show) %> - - + + <% unless @project_messages.first.nil? %> + <%= l(:project_moule_boards_show) %> <% @project_messages.each do |project_message|%> - ▪[ - - <%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value) - - %> - ] - - <%= link_to project_message.author, board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value) - %> - <%= l(:label_send_course_messages) %> - - <%= link_to truncate(project_message. subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value) - - - %> - <%= format_time(project_message.created_on) %> + ▪[<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value) %>] + <%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value) %> + <%= l(:label_send_course_messages) %> + <%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value) %> + <%= format_time(project_message.created_on) %> <% end %> + + <% end %> + <% unless @wiki_contents.first.nil? %> - - <%= l(:label_wiki) %> - - <% @wiki_contents.each do |wikicontent|%> - ▪[ - <% unless wikicontent.page.nil? %> - <%= link_to truncate(wikicontent.page.wiki.project.name,length: 30,omission: '...'), project_url(wikicontent.page.wiki.project, :token => @token.value) - %> - <% end %> - ] - <%= link_to wikicontent.author, user_activities_url(wikicontent.author,:token => @token.value) %> - <%= l(:label_project_notice) %> - <% unless wikicontent.page.nil? %> - <%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value) %> - <% end %> - <%= format_time(wikicontent.updated_on) %> - - <% end %> + <%= l(:label_wiki) %> + <% @wiki_contents.each do |wikicontent|%> + ▪[<% unless wikicontent.page.nil? %> + <%= link_to truncate(wikicontent.page.wiki.project.name,length: 30,omission: '...'), project_url(wikicontent.page.wiki.project, :token => @token.value) %> + <% end %> + ] + <%= link_to wikicontent.author, user_activities_url(wikicontent.author,:token => @token.value) %> + <%= l(:label_wiki_mail_notification) %> + <% unless wikicontent.page.nil? %> + <%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value) %> + <% end %> + <%= format_time(wikicontent.updated_on) %> + <% end %> <% end %> <% unless @project_news.first.nil? %> + <%= l(:label_project_news) %> + <% @project_news.each do |project_new|%> + ▪[<%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value) %> ] + <%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value) %> + <%= l(:label_project_mail_notice) %> + <%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value) %> + <%= format_time(project_new.created_on) %> + <% end %> + <% end %> - <%= l(:label_project_news) %> - - <% @project_news.each do |project_new|%> - ▪[ - - <%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value) - %> - ] - <%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value) - %> - <%= l(:label_project_notice) %> - - <%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value) - %> - <%= format_time(project_new.created_on) %> - - <% end %> + + <% unless @project_news_comments.first.nil? %> + <%= l(:label_project_news) %> + <% @project_news_comments.each do |project_news_comment|%> + ▪[ <% unless project_news_comment.commented.nil? %> + <%= link_to truncate(project_news_comment.commented.project.name,length: 30,omission: '...'), project_url(project_news_comment.commented.project, :token => @token.value) %> + <% end %>] + <%= link_to project_news_comment.author, user_activities_url(project_news_comment.author,:token => @token.value) %> + <%= l(:label_project_mail_notice) %> + <%= link_to truncate(project_news_comment.comments.html_safe,length: 30,omission: '...'), news_url(project_news_comment.commented,:token => @token.value) %> + <%= format_time(project_news_comment.created_on) %> + <% end %> + <% end %> <% unless @project_journal_messages.first.nil? %> - <%= l(:label_project_mail_feedback) %> - - <% @project_journal_messages.each do |project_journal_message|%> - ▪[ - - <%= link_to truncate(project_journal_message.project.name,length: 30,omission: '...'), project_url(project_journal_message.project, :token => @token.value) - %> - ] - - <%= link_to project_journal_message.user, user_activities_url(project_journal_message.user,:token => @token.value) %> - <%= l(:label_send_course_journals_for_messages) %> - - <%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value) - %> - <%= format_time(project_journal_message.created_on) %> - <% end %> + <%= l(:label_project_mail_feedback) %> + <% @project_journal_messages.each do |project_journal_message|%> + ▪[<%= link_to truncate(project_journal_message.project.name,length: 30,omission: '...'), project_url(project_journal_message.project, :token => @token.value) %> ] + <%= link_to project_journal_message.user, user_activities_url(project_journal_message.user,:token => @token.value) %> + <%= l(:label_send_course_journals_for_messages) %> + <%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value) %> + <%= format_time(project_journal_message.created_on) %> + <% end %> + <% end %> +
+<% end %> - <% end %> <% unless @user_journal_messages.first.nil? %> -<%= l(:label_activities) %> - - - <%= l(:label_user_message) %> - (<%= @user_journal_messages.count %>) - - <% @user_journal_messages.each do |user_journal_message|%> - ▪ - - <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value) - - %> - <%= l(:label_show_your_message) %> - - <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'), feedback_url(@user,:token => @token.value) - - - %> - <%= format_time(user_journal_message.created_on) %> - - <% end %> - - + <%= l(:label_activities) %> + <%= l(:label_user_message) %> + (<%= @user_journal_messages.count %>) + <% @user_journal_messages.each do |user_journal_message|%> + ▪ <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value)%> + <%= l(:label_show_your_message) %> + <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'), feedback_url(@user,:token => @token.value) %> + <%= format_time(user_journal_message.created_on) %> + <% end %> <% end %> + <% if @forums.first || @memos.first %> <%= l(:lable_bar_active) %> - <% unless @forums.first.nil? %> - - <%= l(:label_user_forum) %> - - - <% @forums.each do |forum|%> - ▪ - - <%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value) %> - <%= l(:label_forum_new) %> - - <%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value) - %> - <%= format_time(forum.created_at) %> - - <% end %> - - - <% end %> - <% unless @memos.first.nil? %> - - <%= l(:label_user_message_forum) %> - - - <% @memos.each do |memo|%> - ▪ - - <%= link_to memo.author, user_activities_url(memo.author,:token => @token.value)%> - <%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %> - - <%= link_to truncate(memo.subject,length: 30,omission: '...'),forum_memo_url(memo.forum, (memo.parent_id.nil? ? memo : memo.parent_id)) - %> - <%= format_time(memo.created_at) %> - - <% end %> - - - - <% end %> + <% unless @forums.first.nil? %> + <%= l(:label_user_forum) %> + <% @forums.each do |forum|%> + ▪<%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value) %> + <%= l(:label_forum_new) %> + <%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value) %> + <%= format_time(forum.created_at) %> + <% end %> + + <% end %> + <% unless @memos.first.nil? %> + <%= l(:label_user_message_forum) %> + <% @memos.each do |memo|%> + ▪<%= link_to memo.author, user_activities_url(memo.author,:token => @token.value)%> + <%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %> + <%= link_to truncate(memo.subject,length: 30,omission: '...'),forum_memo_url(memo.forum, (memo.parent_id.nil? ? memo : memo.parent_id))%> + <%= format_time(memo.created_at) %> + <% end %> + + <% end %> <% end %> <% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %> - <% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %> - <%= l(mail_option) %> - <% else %> - <%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %> - <% end %> + <% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %> + <%= l(mail_option) %> + <% else %> + <%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %> + <% end %> <% end %> From e1b059b3d26722bbf5b3fcbaccd9f11ac71b6391 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 16 Jun 2015 14:57:35 +0800 Subject: [PATCH 09/26] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=B7=BB=E5=8A=A0=E5=88=B0=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E6=8C=89=E5=A4=A9=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 7 ++++- .../mailer/send_for_user_activities.html.erb | 31 +++++++++++++++++++ .../mailer/send_for_user_activities.text.erb | 12 +++++++ config/locales/projects/en.yml | 4 ++- config/locales/projects/zh.yml | 4 ++- 5 files changed, 55 insertions(+), 3 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 8b8ed7d73..729da17c3 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -127,6 +127,11 @@ class Mailer < ActionMailer::Base end end + + # 项目附件 + @project_attachments = Attachment.find_by_sql("select DISTINCT a.* from members m, attachments a + where a.container_id = m.project_id and m.user_id='#{user.id}' and container_type = 'Project' and (a.created_on between '#{date_from}' and '#{date_to}') order by a.created_on desc") + # user 提交的作业 # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") @@ -194,7 +199,7 @@ class Mailer < ActionMailer::Base @memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id})) and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc") - has_content = [@issues,@issues_journals,@course_messages,@project_messages,@course_news,@course_news_comments,@project_news,@project_news_comments, + has_content = [@issues,@issues_journals,@course_messages,@project_messages,@course_news,@course_news_comments,@project_news,@project_news_comments,@project_attachments, @course_journal_messages,@user_journal_messages,@project_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?} mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" #有内容才发,没有不发 diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 70dab08f0..324e20cb3 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -382,6 +382,37 @@ <% end %> + + <% unless @project_attachments.first.nil? %> +
    + + <%= l(:label_project_mail_attachments) %> + + <% @project_attachments.each do |project_attachment|%> +
  • + + [ + + <%= link_to truncate(project_attachment.project.name,length: 30,omission: '...'), project_url(project_attachment.project, :token => @token.value), + :class=> "wmail_column", + :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + ] + + <%= link_to project_attachment.author, user_activities_url(project_attachment.author,:token => @token.value), :class => "wmail_name", + :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_project_mail_upload) %> + + <%= link_to truncate(project_attachment.filename,length: 30,omission: '...'),project_files_url(project_attachment.project,:token => @token.value), + :class => 'wmail_info', + :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + %> + <%= format_time(project_attachment.created_on) %> +
  • + <% end %> +
    +
+ <% end %> + <% unless @project_journal_messages.first.nil? %>
    diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb index 43a4dbe9e..bcafb896f 100644 --- a/app/views/mailer/send_for_user_activities.text.erb +++ b/app/views/mailer/send_for_user_activities.text.erb @@ -168,6 +168,18 @@ <% end %> + + <% unless @project_attachments.first.nil? %> + <%= l(:label_project_mail_attachments) %> + <% @project_attachments.each do |project_attachment|%> + ▪[<%= link_to truncate(project_attachment.project.name,length: 30,omission: '...'), project_url(project_attachment.project, :token => @token.value) %>] + <%= link_to project_attachment.author, user_activities_url(project_attachment.author,:token => @token.value) %> + <%= l(:label_project_mail_upload) %> + <%= link_to truncate(project_attachment.filename,length: 30,omission: '...'),project_files_url(project_attachment.project,:token => @token.value) %> + <%= format_time(project_attachment.created_on) %> + <% end %> + <% end %> + <% unless @project_journal_messages.first.nil? %> <%= l(:label_project_mail_feedback) %> diff --git a/config/locales/projects/en.yml b/config/locales/projects/en.yml index 57ef221b0..b142c6ca8 100644 --- a/config/locales/projects/en.yml +++ b/config/locales/projects/en.yml @@ -41,7 +41,9 @@ en: lable_sure_exit_project: "Are you sure exit from the projcet" label_member: "Members" - project_module_attachments: "Resources" + project_module_attachments: "Resources" + label_project_mail_attachments: Project Resources + label_project_mail_upload: had uploaded project resources label_invite: Invitation label_invite_new_user: "Send email to invite new user" diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 42eea8dcc..5bf8957bf 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -62,7 +62,9 @@ zh: label_development_team: 开发模式 label_member: 成员 - project_module_attachments: 资源 + project_module_attachments: 资源 + label_project_mail_attachments: 项目资源 + label_project_mail_upload: 上传了资源 label_invite: 邀请 From 41fb1255a91b63546243ec1ab85e2220988b22b2 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 16 Jun 2015 15:36:03 +0800 Subject: [PATCH 10/26] =?UTF-8?q?=E6=89=80=E6=9C=89=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E9=80=9A=E7=9F=A5=E9=82=AE=E4=BB=B6=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/attachments_added.html.erb | 15 ++++++++++++--- app/views/mailer/attachments_added.text.erb | 12 +++++++++++- .../mailer/send_for_user_activities.html.erb | 2 +- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/views/mailer/attachments_added.html.erb b/app/views/mailer/attachments_added.html.erb index 11d1cf54c..32d0ab0ea 100644 --- a/app/views/mailer/attachments_added.html.erb +++ b/app/views/mailer/attachments_added.html.erb @@ -1,5 +1,14 @@ <%= link_to h(@added_to), @added_to_url %>
    -
      <% @attachments.each do |attachment | %> -
    • <%=h attachment.filename %>
    • -<% end %>
    +
      + <% @attachments.each do |attachment | %> +
    • + <%= link_to attachment.author, user_activities_url(attachment.author), + :style => "color:#1B55A7; float:left;display:block; margin-right:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> + <%= l(:label_project_mail_upload) %> + <%= link_to truncate(attachment.filename,length: 30,omission: '...'), project_files_url(attachment.project), + :style => "color:#1B55A7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + %> +
    • + <% end %> +
    diff --git a/app/views/mailer/attachments_added.text.erb b/app/views/mailer/attachments_added.text.erb index 28cb8285e..c271c0024 100644 --- a/app/views/mailer/attachments_added.text.erb +++ b/app/views/mailer/attachments_added.text.erb @@ -1,4 +1,14 @@ <%= @added_to %><% @attachments.each do |attachment | %> -- <%= attachment.filename %><% end %> +- <%= attachment.author %> <%= l(:label_project_mail_upload) %> <%=h attachment.filename %><% end %> <%= @added_to_url %> + + +<%= link_to h(@added_to), @added_to_url %> + +<% @attachments.each do |attachment | %> + <%= link_to attachment.author, user_activities_url(attachment.author) %> + <%= l(:label_project_mail_upload) %> + <%= link_to truncate(attachment.filename,length: 30,omission: '...'), project_files_url(attachment.project) %> +<% end %> + diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 324e20cb3..63b256421 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -402,7 +402,7 @@ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_project_mail_upload) %> - <%= link_to truncate(project_attachment.filename,length: 30,omission: '...'),project_files_url(project_attachment.project,:token => @token.value), + <%= link_to truncate(project_attachment.filename,length: 30,omission: '...'), project_files_url(project_attachment.project,:token => @token.value), :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> From ed8a134a011332b8c54927c32c9167d0946a0408 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 16 Jun 2015 15:47:50 +0800 Subject: [PATCH 11/26] =?UTF-8?q?text=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/attachments_added.text.erb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/views/mailer/attachments_added.text.erb b/app/views/mailer/attachments_added.text.erb index c271c0024..ce62c6341 100644 --- a/app/views/mailer/attachments_added.text.erb +++ b/app/views/mailer/attachments_added.text.erb @@ -1,9 +1,3 @@ -<%= @added_to %><% @attachments.each do |attachment | %> -- <%= attachment.author %> <%= l(:label_project_mail_upload) %> <%=h attachment.filename %><% end %> - -<%= @added_to_url %> - - <%= link_to h(@added_to), @added_to_url %> <% @attachments.each do |attachment | %> From cf9455e465545034b87ffa8b5e8323e869c2483f Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 17 Jun 2015 16:25:30 +0800 Subject: [PATCH 12/26] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=B7=BB=E5=8A=A0=E5=88=B0=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 5 +++++ app/models/mailer.rb | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 06bc1fd38..648108e47 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -3,6 +3,7 @@ class HomeworkCommonController < ApplicationController before_filter :find_course, :only => [:index,:new,:create] before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy] before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] + after_create :send_mail def index homeworks = @course.homework_commons.order("created_at desc") @@ -183,6 +184,10 @@ class HomeworkCommonController < ApplicationController end end + def send_mail + Mailer.run.homework_added(self) + end + private #获取课程 def find_course diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 729da17c3..8d027da12 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -517,6 +517,15 @@ class Mailer < ActionMailer::Base end end + # Builds a Mail::Message object used to email recipients of a course when an homework are posted. + # + # Example: + # attachments_added(attachments) => Mail::Message object + # Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients + def homework_added + + end + # Builds a Mail::Message object used to email recipients of a news' project when a news item is added. # # Example: From 2f8f07aa31d3b663874259c86a683ee64d1b69b3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 18 Jun 2015 09:24:19 +0800 Subject: [PATCH 13/26] =?UTF-8?q?403=E5=90=8E=E9=80=80=E4=B8=80=E6=AD=A5?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E8=B7=AF=E7=94=B1=E6=97=B6=E7=BD=AE=E7=81=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/common/403.html | 46 +++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/app/views/common/403.html b/app/views/common/403.html index a89be932d..d063b315e 100644 --- a/app/views/common/403.html +++ b/app/views/common/403.html @@ -1,25 +1,33 @@ - -没有访问权限 - + .error_content{ width:550px; height:200px; margin:0 auto; padding:10px 0;} + .error_left{color:#15bccf; font-size:100px; font-weight:bold; font-style:oblique; width:200px; height:120px; padding-right:30px; float:left;} + .error_right{ width:240px; height:120px; float:left;color:#15bccf; font-size: 17px; font-weight:bold; padding-left:30px; margin-top:40px; border-left:1px dashed #CCC; } + .error_link{ margin-top:8px;} + .error_link a{ display:block; width:80px; height:28px; font-size:14px; font-weight:bold; color:#fff; text-align:center; background:#15bccf; float:left; margin-right:10px;} + .error_link a:hover{ background:#ff8417;} + + @@ -31,7 +39,7 @@ a:hover{ } 没有访问权限!建议您

From d76aa7cab2c5ae6b87c400f5315ff12a93e77851 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 18 Jun 2015 09:31:31 +0800 Subject: [PATCH 14/26] =?UTF-8?q?=E9=9D=9E=E8=AF=BE=E7=A8=8B=E6=88=90?= =?UTF-8?q?=E5=91=98=E4=B8=8D=E5=8F=AF=E8=AE=BF=E9=97=AE=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 06bc1fd38..d5e62127d 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -3,6 +3,7 @@ class HomeworkCommonController < ApplicationController before_filter :find_course, :only => [:index,:new,:create] before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy] before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] + before_filter :member_of_course, :only => [:index] def index homeworks = @course.homework_commons.order("created_at desc") @@ -203,6 +204,11 @@ class HomeworkCommonController < ApplicationController render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin? end + #当前用户是不是课程的成员 + def member_of_course + render_403 unless User.current.member_of_course?(@course) || User.current.admin? + end + def get_assigned_homeworks(student_works, n, index) student_works += student_works student_works[index + 1 .. index + n] From 9a4e0d6be75b83b1515a499cf4082708d86dc75a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 18 Jun 2015 10:11:04 +0800 Subject: [PATCH 15/26] =?UTF-8?q?=E6=89=B9=E9=98=85=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E6=98=BE=E7=A4=BA=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/courses.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 769136f2d..f4e72019f 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -666,7 +666,7 @@ input#score{ width:40px;} .ui-slider .ui-slider-handle:active{background-image:none;} .ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;top:0;height:100%;background:#64bdd9;left:0;} -.filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px;} +.filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} .evaluation{position: relative;} .evaluation_submit{position: absolute;right: 0px;bottom: 5px;} .student_work_search{background-color: #64bdd9;color: white !important;padding: 2px 7px;margin-left: 10px;cursor: pointer; } From 28e9c090ec563adea8eccc856ccc669b2b146f1c Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 18 Jun 2015 10:23:51 +0800 Subject: [PATCH 16/26] =?UTF-8?q?=E5=AE=9E=E6=97=B6=E5=8F=91=E9=80=81?= =?UTF-8?q?=EF=BC=9A=E5=8F=91=E5=B8=83=E4=BD=9C=E4=B8=9A=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 5 --- app/models/document.rb | 2 +- app/models/homework_common.rb | 7 +++- app/models/mailer.rb | 37 ++++++++++++++++++- app/views/mailer/forum_message_added.html.erb | 22 +++++------ app/views/mailer/homework_added.html.erb | 30 +++++++++++++++ app/views/mailer/homework_added.text.erb | 17 +++++++++ config/locales/mailers/zh.yml | 3 ++ 8 files changed, 103 insertions(+), 20 deletions(-) create mode 100644 app/views/mailer/homework_added.html.erb create mode 100644 app/views/mailer/homework_added.text.erb diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 648108e47..06bc1fd38 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -3,7 +3,6 @@ class HomeworkCommonController < ApplicationController before_filter :find_course, :only => [:index,:new,:create] before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy] before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] - after_create :send_mail def index homeworks = @course.homework_commons.order("created_at desc") @@ -184,10 +183,6 @@ class HomeworkCommonController < ApplicationController end end - def send_mail - Mailer.run.homework_added(self) - end - private #获取课程 def find_course diff --git a/app/models/document.rb b/app/models/document.rb index 6bfb4b8ff..37983d6d4 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -85,7 +85,7 @@ class Document < ActiveRecord::Base # Description 新创建的document要在公共表ForgeActivity中记录 def act_as_forge_activity self.forge_acts << ForgeActivity.new(:user_id => self.user_id, - :project_id => self.project_id) + :project_id => self.project_id) end def send_mail diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index ac10b2516..291c14563 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -18,7 +18,7 @@ class HomeworkCommon < ActiveRecord::Base :description => :description, :author => :author, :url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}} - after_create :act_as_activity + after_create :act_as_activity, :send_mail after_destroy :delete_kindeditor_assets def act_as_activity @@ -28,4 +28,9 @@ class HomeworkCommon < ActiveRecord::Base def delete_kindeditor_assets delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON end + + def send_mail + Mailer.run.homework_added(self) + end + end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 8d027da12..164e2b2ae 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -517,13 +517,46 @@ class Mailer < ActionMailer::Base end end + + + def forum_message_added(memo) + @memo = memo + redmine_headers 'Memo' => memo.id + @forum = memo.forum + @author = memo.author + @forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id) + @issue_author_url = url_for(user_activities_url(@author)) + recipients ||= [] + #将帖子创建者邮箱地址加入数组 + recipients << @forum.creator.mail + #回复人邮箱地址加入数组 + recipients << @author.mail + # cc = wiki_content.page.wiki.watcher_recipients - recipients + + @memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))) + mail :to => recipients, + :subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]", + :filter => true + end + # Builds a Mail::Message object used to email recipients of a course when an homework are posted. # # Example: # attachments_added(attachments) => Mail::Message object # Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients - def homework_added - + def homework_added(homework_common) + @homework_common = homework_common + @author = homework_common.user + @homework_common_url = url_for(:controller => "homework_common", :action =>"index", :homework => @homework_common.id) + @homework_author_url = url_for(user_activities_url(@author)) + recipients ||= [] + #将帖子创建者邮箱地址加入数组 + @homework_common.course.members.each do |member| + recipients << member.user.mail + end + mail :to => recipients, + :subject => "[ #{l(:label_user_homework)} : #{homework_common.name} #{l(:label_memo_create_succ)}]", + :filter => true end # Builds a Mail::Message object used to email recipients of a news' project when a news item is added. diff --git a/app/views/mailer/forum_message_added.html.erb b/app/views/mailer/forum_message_added.html.erb index 58657d46b..ddd93c5b5 100644 --- a/app/views/mailer/forum_message_added.html.erb +++ b/app/views/mailer/forum_message_added.html.erb @@ -1,25 +1,25 @@ -

- - <%= link_to(h("#{@author.login}(#{@author.show_name})"), @issue_author_url , :style=>'color:#1b55a7; font-weight:bold;') %> - <%= l(:mail_issue_title_userin)%> - <%= link_to(h(@forum.name), @forum_url,:style=>'color:#1b55a7; font-weight:bold;') %> - - <%= l(:mail_issue_title_active)%>

+ <%= link_to(h("#{@author.login}(#{@author.show_name})"), @issue_author_url , :style=>'color:#1b55a7; font-weight:bold;') %> + + <%= l(:mail_issue_title_userin)%> + + <%= link_to(h(@forum.name), @forum_url,:style=>'color:#1b55a7; font-weight:bold;') %> + + <%= l(:mail_issue_title_active) %> +

    -
  • <%= l(:mail_issue_subject)%> +
  • <%= l(:mail_issue_subject) %> <%= link_to(h(@memo.subject), @memo_url,:style=>'color:#1b55a7; font-weight:bold;') %>
  • -
  • <%= l(:mail_issue_sent_from)%> +
  • <%= l(:mail_issue_sent_from) %> <%= link_to(h(@forum.name), @forum_url,:style=>'color:#1b55a7; font-weight:bold;') %>
  • -
  • <%= l(:mail_issue_content)%> +
  • <%= l(:mail_issue_content) %> <%= @memo.content.html_safe %>
  • -
-
    @@ -37,6 +36,7 @@ <% if @show_all%> 搜索 + <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank"%> <% end%> <% if @is_teacher%>
    diff --git a/app/views/student_work/student_work_absence_penalty.html.erb b/app/views/student_work/student_work_absence_penalty.html.erb new file mode 100644 index 000000000..a0d6cdc04 --- /dev/null +++ b/app/views/student_work/student_work_absence_penalty.html.erb @@ -0,0 +1,54 @@ +
    +

    + 缺评情况 +

    +
    +
    + +
    + +
    + + <% @stundet_works.each do |student_work|%> +
      " id="student_work_<%= student_work.id%>"> +
    • + + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> + +
    • +
    • + <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%> +
    • + <% + all_count = all_evaluation_count student_work.user,@homework + has_count = has_evaluation_count student_work.user,@homework + absence = all_count - has_count + %> +
    • + <%= all_count%> +
    • +
    • + <%= has_count%> +
    • +
    • + <%= absence%> +
    • +
    + <% end%> +
    \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index c92c732d2..b5a244345 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -97,6 +97,7 @@ RedmineApp::Application.routes.draw do collection do post 'add_score_reply' get 'destroy_score_reply' + get 'student_work_absence_penalty' end end diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index f4e72019f..b2e68085a 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -635,6 +635,8 @@ a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;} .mr18{ margin-right:18px;} a.hwork_center{ display:block; width:60px; margin-right:5px;overflow: hidden; white-space: nowrap; text-overflow:ellipsis;} .hwork_name{ display:block;width:80px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;} +.absence_penalty{ display:block;width:45px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;} +.border_ce {border: 1px solid #e4e4e4;} .show_hwork{ border:2px solid #64bdd9; width:646px; padding:10px; color:#666666; padding-bottom:0px; } .show_hwork ul li{ margin-bottom:5px;} .show_hwork_arrow{ position:relative; top:2px; left:25px;background:url(../images/course/arrow_up.jpg) 0 0 no-repeat; width:20px; height:11px;} @@ -657,7 +659,9 @@ a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;} .info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;} /*返回顶部*/ .to_top{width: 19px;height: 74px;position: fixed;top: 50px;right: 1px;color: white;background: #15bccf; line-height: 1.2; padding-top: 10px;padding-left: 5px;font-size: 14px;cursor: pointer;} - +.hwork_num_ab{ width:120px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;min-height: 1px;} +.hwork_name_ab{ display:block;width:340px; overflow: hidden;white-space: nowrap; text-overflow:ellipsis;min-height: 1px;} +.absence{width: 50px;text-align: center;} /* 评分插件 */ input#score{ width:40px;} .ui-slider{position:relative;width:200px;float:left;margin-right:10px;height:14px; margin-top:2px;background:#e2e2e2; } diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 0ed497127..cdcde2559 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -69,6 +69,7 @@ h4{ font-size:14px; color:#3b3b3b;} .ml90{ margin-left:90px;} .ml100{ margin-left:100px;} .ml110{ margin-left:110px;} +.ml320{ margin-left:320px;} .mr5{ margin-right:5px;} .mr10{ margin-right:10px;} .mr20{ margin-right:20px;} From 64da95e900c59818c7069675161de33834645227 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 19 Jun 2015 09:23:36 +0800 Subject: [PATCH 19/26] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=86=97=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 164e2b2ae..d0ee99421 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -517,28 +517,6 @@ class Mailer < ActionMailer::Base end end - - - def forum_message_added(memo) - @memo = memo - redmine_headers 'Memo' => memo.id - @forum = memo.forum - @author = memo.author - @forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id) - @issue_author_url = url_for(user_activities_url(@author)) - recipients ||= [] - #将帖子创建者邮箱地址加入数组 - recipients << @forum.creator.mail - #回复人邮箱地址加入数组 - recipients << @author.mail - # cc = wiki_content.page.wiki.watcher_recipients - recipients - - @memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))) - mail :to => recipients, - :subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]", - :filter => true - end - # Builds a Mail::Message object used to email recipients of a course when an homework are posted. # # Example: From c64b761f46dba724f713c636afde9da4a0532e6d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 19 Jun 2015 09:56:39 +0800 Subject: [PATCH 20/26] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=BA=E8=AF=84?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=EF=BC=8C=E4=BC=98=E5=8C=96=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=B7=B2=E8=AF=84=E3=80=81=E6=9C=AA=E8=AF=84=E3=80=81=E7=BC=BA?= =?UTF-8?q?=E8=AF=84=E7=9A=84=E6=95=B0=E9=87=8F=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 12 +++++++++++- .../student_work_absence_penalty.html.erb | 16 ++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 3dd5e9890..c8cbde626 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -236,7 +236,17 @@ class StudentWorkController < ApplicationController #评价列表显示 def student_work_absence_penalty render_403 unless User.current.allowed_to?(:as_teacher,@course) - @stundet_works = @homework.student_works + order = params[:order] || "desc" + work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" + @stundet_works = StudentWork.find_by_sql("SELECT *,(all_count - has_count) AS absence FROM( + SELECT * , + (SELECT COUNT(*) FROM `student_works_evaluation_distributions` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS all_count, + (SELECT COUNT(*) FROM `student_works_scores` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS has_count + FROM `student_works` + WHERE homework_common_id = 213 + ) AS table_1 + ORDER BY absence #{order}") + @order = order == "desc" ? "asc" : "desc" respond_to do |format| format.html end diff --git a/app/views/student_work/student_work_absence_penalty.html.erb b/app/views/student_work/student_work_absence_penalty.html.erb index a0d6cdc04..e9054561f 100644 --- a/app/views/student_work/student_work_absence_penalty.html.erb +++ b/app/views/student_work/student_work_absence_penalty.html.erb @@ -20,7 +20,8 @@ 实评
  • - 缺评 + <%= link_to "缺评",student_work_absence_penalty_student_work_index_path(:homework => @homework.id,:order => @order)%> +
@@ -35,19 +36,14 @@
  • <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
  • - <% - all_count = all_evaluation_count student_work.user,@homework - has_count = has_evaluation_count student_work.user,@homework - absence = all_count - has_count - %>
  • - <%= all_count%> + <%= student_work.all_count%>
  • - <%= has_count%> + <%= student_work.has_count%>
  • -
  • - <%= absence%> +
  • + <%= student_work.absence%>
  • <% end%> From 1f4f1b4eb65915d9fb20fabc627d0d956318f10a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 19 Jun 2015 09:59:06 +0800 Subject: [PATCH 21/26] =?UTF-8?q?=E8=80=81=E5=B8=88=E6=89=8D=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E6=9F=A5=E7=9C=8B=E7=BC=BA=E8=AF=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 09d1c8f60..6325abc09 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -36,7 +36,7 @@ <% if @show_all%> 搜索 - <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank"%> + <%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher%> <% end%> <% if @is_teacher%>
    From 7f0da03fea166f86125ea8ad266864e275b9fc37 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 19 Jun 2015 10:21:42 +0800 Subject: [PATCH 22/26] =?UTF-8?q?=E9=9D=9E=E9=A1=B9=E7=9B=AE=E6=88=90?= =?UTF-8?q?=E5=91=98URL=E8=AE=BF=E9=97=AE=E7=A7=81=E6=9C=89=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6510d65aa..6ad450315 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -457,7 +457,6 @@ class ProjectsController < ApplicationController end end @members = paginateHelper @members - render :layout => 'base_courses' if @project.project_type == 1 end #判断指定用户是否为课程教师 @@ -676,9 +675,9 @@ class ProjectsController < ApplicationController def memberAccess # 是课程,则判断当前用户是否参加了课程 - return 0 if @project.project_type == Project::ProjectType_project - currentUser = User.current - render_403 unless currentUser.member_of?(@project) + # return 0 if @project.project_type == Project::ProjectType_project + # currentUser = User.current + render_403 unless User.current.member_of?(@project) end def toggleCourse From 3092121a7a05fd89ac2b3b00f28f07f2026c470a Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 19 Jun 2015 11:42:07 +0800 Subject: [PATCH 23/26] =?UTF-8?q?bug#2878:=E5=85=AC=E5=85=B1=E8=B4=B4?= =?UTF-8?q?=E5=90=A7=EF=BC=9A=E7=BC=96=E8=BE=91=E5=B8=96=E5=AD=90=E3=80=81?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=9B=9E=E5=B8=96=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E5=BB=BA=E8=AE=AE=E4=B8=8D=E8=A6=81=E6=98=BE=E7=A4=BA=E4=B8=BB?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/memos_controller.rb | 2 +- app/views/memos/edit.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 54bcc0496..68f6f6473 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -157,7 +157,7 @@ class MemosController < ApplicationController def update respond_to do |format| - if( @memo.update_column(:subject, params[:memo][:subject]) && + if( #@memo.update_column(:subject, params[:memo][:subject]) && @memo.update_column(:content, params[:memo][:content]) && @memo.update_column(:sticky, params[:memo][:sticky]) && @memo.update_column(:lock, params[:memo][:lock])) diff --git a/app/views/memos/edit.html.erb b/app/views/memos/edit.html.erb index b7aa08abd..6328edcac 100644 --- a/app/views/memos/edit.html.erb +++ b/app/views/memos/edit.html.erb @@ -21,9 +21,9 @@

    <% if @memo.parent.nil? && @memo.children.first.nil? %> - <%= f.text_field :subject, :required => true, :size => 96 ,:readonly => false, :maxlength => 50%> + <%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => false, :maxlength => 50%> <% else %> - <%= f.text_field :subject, :required => true, :size => 96 ,:readonly => true, :style => "border: 1px solid gray", :maxlength => 50%> + <%#= f.text_field :subject, :required => true, :size => 96 ,:readonly => true, :style => "border: 1px solid gray", :maxlength => 50%> <% end %>

    <% if User.current.admin?%> From 0a7a834ebe765b6ce43410a301d487cd523a744a Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 19 Jun 2015 13:59:02 +0800 Subject: [PATCH 24/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E9=85=8D=E7=BD=AE--=E7=89=88=E6=9C=AC=E5=BA=93--=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=88=97=E8=A1=A8=20404=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- .../settings/_new_repositories.html.erb | 3 +-- .../projects/settings/_repositories.html.erb | 26 ++++++------------- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index d0af82c8c..ffa3fb4aa 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -227,7 +227,7 @@ update elsif request.get? respond_to do |format| format.html{ - render :layout => "project_base" + render :layout => "base_projects" } end diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb index 6e0d74849..ca771a487 100644 --- a/app/views/projects/settings/_new_repositories.html.erb +++ b/app/views/projects/settings/_new_repositories.html.erb @@ -33,8 +33,7 @@ <% if repository.scm_name=="Git"%> <%if User.current.allowed_to?(:manage_repository, @project) %> - <%= link_to(l(:label_user_plural), committers_repository_path(repository) - ) %> + <%= link_to(l(:label_user_plural), committers_repository_path(repository)) %> <% end %> <% end %> diff --git a/app/views/projects/settings/_repositories.html.erb b/app/views/projects/settings/_repositories.html.erb index 3d9d71a56..6c340f47c 100644 --- a/app/views/projects/settings/_repositories.html.erb +++ b/app/views/projects/settings/_repositories.html.erb @@ -27,25 +27,15 @@ <% end %> - <% if repository.scm_name=="Subversion"%> - <%if User.current.allowed_to?(:manage_repository, @project) %> - <%= link_to(l(:label_user_plural), committers_repository_path(repository), - :class => 'icon icon-user') %> - <%= link_to(l(:button_edit), edit_repository_path(repository), - :class => 'icon icon-edit') %> - <%= delete_link repository_path(repository) %> - <% end %> - <% elsif repository.scm_name=="Git"%> - <%if User.current.allowed_to?(:manage_repository, @project) %> - - <%= link_to(l(:label_user_plural), committers_repository_path(repository), - :class => 'icon icon-user') %> - <% if repository.login.to_s==User.current.login.to_s %> - <%= delete_link repository_path(repository) %> - <% end %> - <% end %> - <% end %> + <%= link_to(l(:label_user_plural), committers_repository_path(repository), :class => 'icon icon-user') %> + <% if repository.login.to_s==User.current.login.to_s %> + <%= delete_link repository_path(repository) %> + <% end %> + <% end %> <% end %> From fa3b216e0f1ad020e0f1384523fe7f15e5cfeed4 Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Fri, 19 Jun 2015 14:02:58 +0800 Subject: [PATCH 25/26] =?UTF-8?q?=E8=B2=8C=E4=BC=BC=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E4=B8=8D=E4=BC=9A=E6=9B=B4=E6=96=B0=E7=BC=93?= =?UTF-8?q?=E5=AD=98=20=E8=BF=98=E6=98=AF=E5=85=88=E4=B8=8D=E7=94=A8?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 524bde9d7..210ac8f3d 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -695,12 +695,13 @@ class CoursesController < ApplicationController # 显示老师和助教的活动 # @authors = searchTeacherAndAssistant(@course) @authors = course_all_member(@course) - Dir.glob("#{Rails.root}/app/models/*.rb").sort.each { |file| require file } + #TODO 貌似删除操作不会更新缓存 还是先不用缓存吧 + # Dir.glob("#{Rails.root}/app/models/*.rb").sort.each { |file| require file } events = [] - key = "course_events_#{@course.id}".to_sym - if Rails.env.production? && Setting.course_cahce_enabled? - events = Rails.cache.read(key) || [] - end + # key = "course_events_#{@course.id}".to_sym + # if Rails.env.production? && Setting.course_cahce_enabled? + # events = Rails.cache.read(key) || [] + # end if events.empty? @authors.each do |author| @activity = Redmine::Activity::Fetcher.new(User.current, :course => @course, @@ -716,7 +717,7 @@ class CoursesController < ApplicationController events += @activity.events(@days, @course.created_at, :is_public => 1) end end - Rails.cache.write(key, events) if Rails.env.production? && Setting.course_cahce_enabled? + # Rails.cache.write(key, events) if Rails.env.production? && Setting.course_cahce_enabled? end else # @author = @course.teacher From e05a66e8fdd29abc39e93bf84a28bd811449408f Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 19 Jun 2015 14:10:08 +0800 Subject: [PATCH 26/26] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=BA=93=E6=9F=A5=E7=9C=8B=E4=BF=AE=E8=AE=A2404=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index ffa3fb4aa..607c9b5db 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -376,7 +376,7 @@ update def revision respond_to do |format| - format.html{render :layout => 'project_base'} + format.html{render :layout => 'base_projects'} format.js {render :layout => false} end end