From 52f7c66ff0fccd0bdadc1c3c66d8792cf13f1a89 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 8 Jun 2015 14:32:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E4=B8=AD=E9=82=AE=E4=BB=B6=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E9=87=8D=E5=A4=8D=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ec46917d9..b6a2bfa32 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -107,6 +107,7 @@ class Mailer < ActionMailer::Base and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc" @issues = Issue.find_by_sql(sql) + # @bids 查询课程作业,包括老师发布的作业,以及user提交作业 # @attachments查询课程课件更新 @attachments ||= [] @@ -125,21 +126,29 @@ class Mailer < ActionMailer::Base # user 提交的作业 # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") - # 查询user在课程。项目中发布的讨论帖子 - messages = Message.find_by_sql("select me.* from messages me, boards b, members m where - b.id = me.board_id and b.project_id = m.project_id and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + # 查询user在课程中发布的讨论帖子 + course_mesages = Message.find_by_sql("select me.* from messages me, boards b, members m where + b.id = me.board_id and b.course_id = m.course_id + and b.course_id is not Null and m.user_id = '#{user.id}' + and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") + # 查询user在项目中发布的讨论帖子 + project_messages = Message.find_by_sql("select me.* from messages me, boards b, members m where + b.id = me.board_id and b.project_id = m.project_id + and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") # messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") @course_messages ||= [] @project_messages ||= [] - unless messages.first.nil? - messages.each do |msg| - if msg.project - @project_messages << msg - elsif msg.course - @course_messages << msg - end + unless course_mesages.first.nil? + course_mesages.each do |msg| + @course_messages << msg end end + unless project_messages.first.nil? + project_messages.each do |msg| + @project_messages << msg + end + end + # wiki # 查询user在课程中发布的通知,项目中发的新闻 @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n @@ -157,7 +166,7 @@ class Mailer < ActionMailer::Base @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") @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") - + puts @attachments has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news, @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?} mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" From 29edf5ece7d753a4df27f1d07a76d8c97fd3feab Mon Sep 17 00:00:00 2001 From: yutao <283765470@qq.com> Date: Mon, 8 Jun 2015 14:46:25 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3kindeditor=E5=A4=9A?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/kindeditor.js | 19 ++++++++++++++----- public/assets/kindeditor/plugins/less/less.js | 17 ++++++++++------- public/assets/kindeditor/plugins/more/more.js | 17 ++++++++++------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index d97f1cd2e..176e00ec8 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -3909,14 +3909,22 @@ _extend(KToolbar, KWidget, { }); }, get : function(name) { + //if(this._itemMap[name])return this._itemMap[name]; + //return this._itemMap[name]=K("span.ke-icon-"+name,this.div).parent() // if (this._itemMap[name]) { // return this._itemMap[name]; // } - if($("#define").css('display') == 'block'){ - pdiv = $("#define") - }else if($("#full").css('display') == 'block'){ - pdiv = $("#full") - } +// if($("#define").css('display') == 'block'){ +// pdiv = $("#define") +// }else if($("#full").css('display') == 'block'){ +// pdiv = $("#full") +// } + var container = this.div; + if(!$("#define",container).is(':hidden')){ + pdiv = $("#define",container); + }else if(!$("#full",container).is(':hidden')){ + pdiv = $("#full",container); + } return (this._itemMap[name] = K('span.ke-icon-' + name, pdiv).parent()); }, select : function(name) { @@ -4865,6 +4873,7 @@ KEditor.prototype = { }); return self; } + //if(name=='more')alert(fn); return self.handler(key, fn); }, updateState : function() { diff --git a/public/assets/kindeditor/plugins/less/less.js b/public/assets/kindeditor/plugins/less/less.js index b24d31723..12e8436bc 100644 --- a/public/assets/kindeditor/plugins/less/less.js +++ b/public/assets/kindeditor/plugins/less/less.js @@ -2,13 +2,16 @@ KindEditor.plugin('less', function(K) { var self = this, name = 'less'; self.plugin.less = { click : function(){ - if($("#define").css('display') == 'block'){ - $("#define").css('display','none') - $("#full").css('display','block') - }else if($("#full").css('display') == 'block'){ - $("#full").css('display','none') - $("#define").css('display','block') - } + var container = self.toolbar.div; + $("#full",container).hide(); + $("#define",container).show(); + //if($("#define").css('display') == 'block'){ + // $("#define").css('display','none') + // $("#full").css('display','block') + //}else if($("#full").css('display') == 'block'){ + // $("#full").css('display','none') + // $("#define").css('display','block') + //} } } self.clickToolbar(name,self.plugin.less.click) diff --git a/public/assets/kindeditor/plugins/more/more.js b/public/assets/kindeditor/plugins/more/more.js index 31eb8567f..03d7640ec 100644 --- a/public/assets/kindeditor/plugins/more/more.js +++ b/public/assets/kindeditor/plugins/more/more.js @@ -2,13 +2,16 @@ KindEditor.plugin('more', function(K) { var self = this, name = 'more'; self.plugin.more = { click : function(){ - if($("#define").css('display') == 'block'){ - $("#define").css('display','none') - $("#full").css('display','block') - }else if($("#full").css('display') == 'block'){ - $("#full").css('display','none') - $("#define").css('display','block') - } + var container = self.toolbar.div; + $("#define",container).hide(); + $("#full",container).show(); + //if($("#define").css('display') == 'block'){ + // $("#define").css('display','none') + // $("#full").css('display','block') + //}else if($("#full").css('display') == 'block'){ + // $("#full").css('display','none') + // $("#define").css('display','block') + //} } } self.clickToolbar(name,self.plugin.more.click) From 999e96a85763a755bbd49533680497e0f1330f91 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 8 Jun 2015 15:45:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=8E=89=E6=89=93?= =?UTF-8?q?=E5=8D=B0attachment?= 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 b6a2bfa32..204aa109a 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -166,7 +166,7 @@ class Mailer < ActionMailer::Base @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") @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") - puts @attachments + has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news, @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?} mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"