ntue announcement email reminder fix and gemfile tinymce fix

This commit is contained in:
Spen 2013-07-02 14:33:41 +08:00
parent 77c0fdffd2
commit 1cc1c6856e
5 changed files with 82 additions and 13 deletions

View File

@ -48,7 +48,7 @@ gem 'sinatra'
gem 'sprockets' gem 'sprockets'
gem 'social-share-button' gem 'social-share-button'
gem 'tinymce-rails' gem 'tinymce-rails', "~> 3.5.8"
gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux") gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")
gem 'libv8', '~> 3.11.8' if RUBY_PLATFORM.downcase.include?("linux") gem 'libv8', '~> 3.11.8' if RUBY_PLATFORM.downcase.include?("linux")
gem 'mongoid-encryptor', :require => 'mongoid/encryptor' gem 'mongoid-encryptor', :require => 'mongoid/encryptor'

View File

@ -34,15 +34,15 @@ Orbit::Application.configure do
# :sender_address => %{"notifier" <redmine@rulingcom.com>}, # :sender_address => %{"notifier" <redmine@rulingcom.com>},
# :exception_recipients => %w{chris@rulingcom.com} # :exception_recipients => %w{chris@rulingcom.com}
config.action_mailer.delivery_method = :smtp # config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { # config.action_mailer.smtp_settings = {
:enable_starttls_auto => true, # :enable_starttls_auto => true,
:address => "smtp.gmail.com", # :address => "smtp.gmail.com",
:port => '587', # :port => '587',
:domain => "smtp.gmail.com", # :domain => "smtp.gmail.com",
:authentication => "plain", # :authentication => "plain",
:user_name => "redmine@rulingcom.com", # :user_name => "redmine@rulingcom.com",
:password => "rulingredmine" } # :password => "rulingredmine" }
end end

View File

@ -1,3 +1,4 @@
# encoding: utf-8
class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendController
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :is_admin? before_filter :is_admin?
@ -15,6 +16,14 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
@bulletin.proc_check(params[:bulletin][:is_checked],params[:bulletin][:not_checked_reason]) @bulletin.proc_check(params[:bulletin][:is_checked],params[:bulletin][:not_checked_reason])
@bulletin.de_pending @bulletin.de_pending
if @bulletin.save if @bulletin.save
if @bulletin.email_sent == true && @bulletin.is_checked == true && !@bulletin.is_rejected
send_email_data(@bulletin)
@bulletin.email_sent = false
@bulletin.save
end
notice = t('announcement.approve_bulletin_success') notice = t('announcement.approve_bulletin_success')
else else
notice = t('announcement.approve_bulletin_fail') notice = t('announcement.approve_bulletin_fail')
@ -62,6 +71,66 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
object_auth object_auth
end end
def send_email_data(bulletin)
@site = Site.first
@user = User.find(bulletin.create_user_id)
@host = request.host_with_port
email_group_data
@group_mail = Array.new
bulletin.email_group.each do |egroup|
if @email_group_data.include?(egroup) and (egroup == '0' or egroup == '1' or egroup == '2' or egroup == '3')
@group_mail << @email_group_data[egroup]["email"]
elsif @email_group_data.include?(egroup) and egroup == '4'
@group_mail << bulletin.other_mailaddress
end
end
if !@group_mail.join.blank?
@mail_content = {
"host" => @host,
"site_title" => @site.title,
"title" => bulletin.title,
"template" => 'announcement_mailer/cron_mail',
"url" => "http://#{@host}#{panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id)}"
}
@mail_cron = {
:mail_from_app => 'announcement',
:mail_from => @user.email,
:mail_reply_to => @user.email,
:mail_subject => "#{t("announcement.mail_subject",:site_title => @site.title)}#{bulletin.title}",
:mail_to => @group_mail.join(','),
:mail_content => @mail_content ,
:mail_sentdate => bulletin.email_sentdate,
:create_user_id => bulletin.create_user_id,
:update_user_id => bulletin.create_user_id
}
@mail_cron = MailCron.new(@mail_cron)
@mail_cron.save
end
end
def email_group_data
@email_group_data = Bulletin.email_group_data
end
# def get_categorys(id = nil) # def get_categorys(id = nil)
# @bulletin_categorys = [] # @bulletin_categorys = []
# if(is_manager? || is_admin?) # if(is_manager? || is_admin?)

View File

@ -153,7 +153,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
respond_to do |format| respond_to do |format|
if @bulletin.save if @bulletin.save
if @bulletin.email_sent == true && @bulletin.is_checked == true if @bulletin.email_sent == true && @bulletin.is_checked == true && !@bulletin.is_rejected
send_email_data(@bulletin) send_email_data(@bulletin)
@bulletin.email_sent = false @bulletin.email_sent = false
@ -241,7 +241,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
@bulletin.de_pending! @bulletin.de_pending!
end end
if @bulletin.email_sent == true && @bulletin.is_checked == true if @bulletin.email_sent == true && @bulletin.is_checked == true && !@bulletin.is_rejected
send_email_data(@bulletin) send_email_data(@bulletin)
@bulletin.email_sent = false @bulletin.email_sent = false

View File

@ -287,7 +287,7 @@
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<% @email_group_data.collect do |k,v| %> <% @email_group_data.collect do |k,v| %>
<li class="pull-left"> <li class="pull-left">
<%= check_box_tag 'bulletin[email_group][]', k, @bulletin.email_group.include?(k), :id => "field-#{k}" %> <%= check_box_tag 'bulletin[email_group][]', k, (@bulletin.email_group.nil? ? false : @bulletin.email_group.include?(k)), :id => "field-#{k}" %>
<label for="field-<%= k %>"><%= v["name"] %></label> <label for="field-<%= k %>"><%= v["name"] %></label>
<%= hidden_field_tag 'bulletin[email_group][]', '' %> <%= hidden_field_tag 'bulletin[email_group][]', '' %>
</li> </li>