ntue
This commit is contained in:
parent
112958ac18
commit
bcb6a46a74
|
@ -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?
|
||||||
|
@ -6,6 +7,7 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle
|
||||||
|
|
||||||
|
|
||||||
def preview_and_approve
|
def preview_and_approve
|
||||||
|
email_group_data
|
||||||
@bulletin = Bulletin.find params[:bulletin_id]
|
@bulletin = Bulletin.find params[:bulletin_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -15,6 +17,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,4 +72,67 @@ 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 == 'e_0' or egroup == 'e_1' or egroup == 'e_2' or egroup == 'e_3')
|
||||||
|
|
||||||
|
@group_mail << @email_group_data[egroup]["email"]
|
||||||
|
|
||||||
|
elsif @email_group_data.include?(egroup) and egroup == 'e_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.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,
|
||||||
|
:mail_sentdate => DateTime.now,
|
||||||
|
:create_user_id => bulletin.create_user_id,
|
||||||
|
:update_user_id => bulletin.create_user_id
|
||||||
|
}
|
||||||
|
|
||||||
|
@mail_cron = MailCron.new(@mail_cron)
|
||||||
|
|
||||||
|
@mail_cron.save
|
||||||
|
|
||||||
|
MailCron.send_mail_now(@mail_cron.id)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def email_group_data
|
||||||
|
|
||||||
|
@email_group_data = Bulletin.email_group_data
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
# include OrbitControllerLib::DivisionForDisable
|
# include OrbitControllerLib::DivisionForDisable
|
||||||
|
|
||||||
|
@ -19,6 +21,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
email_group_data
|
||||||
|
|
||||||
@tags = get_tags
|
@tags = get_tags
|
||||||
@categories = get_categories_for_index
|
@categories = get_categories_for_index
|
||||||
@statuses = get_statuses
|
@statuses = get_statuses
|
||||||
|
@ -47,6 +51,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
# GET /bulletins/new
|
# GET /bulletins/new
|
||||||
# GET /bulletins/new.xml
|
# GET /bulletins/new.xml
|
||||||
def new
|
def new
|
||||||
|
|
||||||
|
email_group_data
|
||||||
|
|
||||||
if(session[:in_validate_object].blank?)
|
if(session[:in_validate_object].blank?)
|
||||||
@bulletin = Bulletin.new(:postdate => DateTime.now)
|
@bulletin = Bulletin.new(:postdate => DateTime.now)
|
||||||
else
|
else
|
||||||
|
@ -64,6 +71,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
|
|
||||||
# GET /bulletins/1/edit
|
# GET /bulletins/1/edit
|
||||||
def edit
|
def edit
|
||||||
|
|
||||||
|
email_group_data
|
||||||
|
|
||||||
@bulletin = Bulletin.find(params[:id])
|
@bulletin = Bulletin.find(params[:id])
|
||||||
@tags = get_tags
|
@tags = get_tags
|
||||||
is_authorized_sub_manager = @bulletin.category.auth_sub_manager.authorized_user_ids rescue nil
|
is_authorized_sub_manager = @bulletin.category.auth_sub_manager.authorized_user_ids rescue nil
|
||||||
|
@ -82,21 +92,31 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
# POST /bulletins
|
# POST /bulletins
|
||||||
# POST /bulletins.xml
|
# POST /bulletins.xml
|
||||||
def create
|
def create
|
||||||
|
|
||||||
|
email_group_data
|
||||||
|
|
||||||
@tags = get_tags
|
@tags = get_tags
|
||||||
@bulletin = Bulletin.new(params[:bulletin])
|
@bulletin = Bulletin.new(params[:bulletin])
|
||||||
@bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil)
|
@bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil)
|
||||||
|
|
||||||
@bulletin.create_user_id = current_user.id
|
@bulletin.create_user_id = current_user.id
|
||||||
@bulletin.update_user_id = current_user.id
|
@bulletin.update_user_id = current_user.id
|
||||||
# if(is_manager? || is_admin?)
|
if(is_manager? || is_admin?)
|
||||||
# @bulletin.is_checked = true
|
@bulletin.is_checked = true
|
||||||
# @bulletin.is_rejected = false
|
@bulletin.is_rejected = false
|
||||||
# @bulletin.de_pending
|
@bulletin.de_pending
|
||||||
# end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
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
|
||||||
|
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) }
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) }
|
||||||
format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin }
|
||||||
# format.js
|
# format.js
|
||||||
|
@ -121,11 +141,33 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
# PUT /bulletins/1.xml
|
# PUT /bulletins/1.xml
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
||||||
|
email_group_data
|
||||||
|
|
||||||
@bulletin = Bulletin.find(params[:id])
|
@bulletin = Bulletin.find(params[:id])
|
||||||
|
|
||||||
delete_out_invalid_date_from_params
|
delete_out_invalid_date_from_params
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @bulletin.update_attributes(params[:bulletin])
|
if @bulletin.update_attributes(params[:bulletin])
|
||||||
|
if(is_manager? || is_admin?)
|
||||||
|
@bulletin.is_checked = true
|
||||||
|
@bulletin.is_rejected = false
|
||||||
|
@bulletin.de_pending!
|
||||||
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) }
|
||||||
|
format.js { render 'toggle_enable' }
|
||||||
|
format.xml { head :ok }
|
||||||
|
else
|
||||||
|
@tags = get_tags
|
||||||
|
format.html { render :action => "edit" }
|
||||||
|
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||||
|
end
|
||||||
|
|
||||||
|
if @bulletin.email_sent == true && @bulletin.is_checked == true && !@bulletin.is_rejected
|
||||||
|
send_email_data(@bulletin)
|
||||||
|
|
||||||
|
@bulletin.email_sent = false
|
||||||
|
@bulletin.save
|
||||||
|
end
|
||||||
|
|
||||||
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) }
|
format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) }
|
||||||
format.js { render 'toggle_enable' }
|
format.js { render 'toggle_enable' }
|
||||||
|
@ -135,6 +177,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
format.html { render :action => "edit" }
|
format.html { render :action => "edit" }
|
||||||
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -164,6 +207,70 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
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 == 'e_0' or egroup == 'e_1' or egroup == 'e_2' or egroup == 'e_3')
|
||||||
|
|
||||||
|
@group_mail << @email_group_data[egroup]["email"]
|
||||||
|
|
||||||
|
elsif @email_group_data.include?(egroup) and egroup == 'e_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.category.id)}"
|
||||||
|
}
|
||||||
|
|
||||||
|
@mail_cron = {
|
||||||
|
:mail_from_app => 'announcement',
|
||||||
|
:mail_from => @user.email,
|
||||||
|
:mail_reply_to => @user.email,
|
||||||
|
:mail_subject => "#{t("announcement.mail_subject")}:",
|
||||||
|
: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,
|
||||||
|
:mail_sentdate => DateTime.now,
|
||||||
|
:create_user_id => bulletin.create_user_id,
|
||||||
|
:update_user_id => bulletin.create_user_id
|
||||||
|
}
|
||||||
|
|
||||||
|
@mail_cron = MailCron.new(@mail_cron)
|
||||||
|
|
||||||
|
@mail_cron.save
|
||||||
|
|
||||||
|
MailCron.send_mail_now(@mail_cron.id)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def email_group_data
|
||||||
|
|
||||||
|
@email_group_data = Bulletin.email_group_data
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def delete_out_invalid_date_from_params
|
def delete_out_invalid_date_from_params
|
||||||
if((params[:bulletin]["deadline(1i)"] && params[:bulletin]["deadline(1i)"].blank?) or (params[:bulletin]["deadline(2i)"] && params[:bulletin]["deadline(2i)"].blank?) or (params[:bulletin]["deadline(3i)"] && params[:bulletin]["deadline(3i)"].blank?))
|
if((params[:bulletin]["deadline(1i)"] && params[:bulletin]["deadline(1i)"].blank?) or (params[:bulletin]["deadline(2i)"] && params[:bulletin]["deadline(2i)"].blank?) or (params[:bulletin]["deadline(3i)"] && params[:bulletin]["deadline(3i)"].blank?))
|
||||||
params[:bulletin].delete("deadline(1i)")
|
params[:bulletin].delete("deadline(1i)")
|
||||||
|
|
|
@ -25,10 +25,23 @@ class Bulletin
|
||||||
field :create_user_id
|
field :create_user_id
|
||||||
field :update_user_id, :class_name => "User"
|
field :update_user_id, :class_name => "User"
|
||||||
|
|
||||||
|
field :is_top, :type => Boolean, :default => false
|
||||||
|
field :is_hot, :type => Boolean, :default => false
|
||||||
|
field :is_hidden, :type => Boolean, :default => false
|
||||||
|
field :is_checked, :type => Boolean, :default => false
|
||||||
|
field :is_pending, :type => Boolean, :default => true
|
||||||
|
field :is_rejected, :type => Boolean, :default => false
|
||||||
field :view_count, :type => Integer, :default => 0
|
field :view_count, :type => Integer, :default => 0
|
||||||
|
|
||||||
|
field :not_checked_reason
|
||||||
|
|
||||||
field :public, :type => Boolean, :default => true
|
field :public, :type => Boolean, :default => true
|
||||||
|
|
||||||
|
field :email_sent, :type => Boolean, :default => false
|
||||||
|
field :email_sentdate , :type => DateTime
|
||||||
|
field :email_group, :type => Array
|
||||||
|
field :other_mailaddress
|
||||||
|
|
||||||
mount_uploader :image, ImageUploader
|
mount_uploader :image, ImageUploader
|
||||||
|
|
||||||
has_many :bulletin_links, :autosave => true, :dependent => :destroy
|
has_many :bulletin_links, :autosave => true, :dependent => :destroy
|
||||||
|
@ -109,6 +122,37 @@ class Bulletin
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def proc_check(check,not_pass_info = "")
|
||||||
|
self.is_checked = true
|
||||||
|
if check =="true"
|
||||||
|
self.is_rejected = false
|
||||||
|
elsif check == "false"
|
||||||
|
self.is_rejected = true
|
||||||
|
self.not_checked_reason = not_pass_info
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def de_pending
|
||||||
|
self.is_pending = false
|
||||||
|
end
|
||||||
|
|
||||||
|
def de_pending!
|
||||||
|
de_pending
|
||||||
|
self.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_checked?
|
||||||
|
!self.is_pending && self.is_checked && (self.is_rejected == false)
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_pending?
|
||||||
|
self.is_pending
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_rejected?
|
||||||
|
!self.is_pending && self.is_rejected && (self.is_rejected == true)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def save_bulletin_links
|
def save_bulletin_links
|
||||||
self.bulletin_links.each do |t|
|
self.bulletin_links.each do |t|
|
||||||
|
@ -149,9 +193,47 @@ class Bulletin
|
||||||
preview_object
|
preview_object
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_email_group_data(email_group_data)
|
||||||
|
|
||||||
|
group_mail = Array.new
|
||||||
|
|
||||||
|
self.email_group.each do |egroup|
|
||||||
|
|
||||||
|
if email_group_data.include?(egroup) and (egroup == 'e_0' or egroup == 'e_1' or egroup == 'e_2' or egroup == 'e_3')
|
||||||
|
|
||||||
|
group_mail << "#{email_group_data[egroup]["email"]}(#{email_group_data[egroup]["name"]})"
|
||||||
|
|
||||||
|
elsif email_group_data.include?(egroup) and egroup == 'e_4'
|
||||||
|
|
||||||
|
self.other_mailaddress.split(",").each do |otmail|
|
||||||
|
|
||||||
|
group_mail << "#{otmail}(#{email_group_data[egroup]["name"]})"
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
group_mail.join("<br />").html_safe
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
|
def self.email_group_data
|
||||||
|
|
||||||
|
@email_group_data = {
|
||||||
|
'e_0'=> {"name"=>I18n.t('announcement.email_group_data_0'), "email"=>"alluser@tea.ntue.edu.tw"},
|
||||||
|
'e_1'=> {"name"=>I18n.t('announcement.email_group_data_1'), "email"=>"allstu@tea.ntue.edu.tw"},
|
||||||
|
'e_2'=> {"name"=>I18n.t('announcement.email_group_data_2'), "email"=>"allgrad@tea.ntue.edu.tw"},
|
||||||
|
'e_3'=> {"name"=>I18n.t('announcement.email_group_data_3'), "email"=>"allad@tea.ntue.edu.tw"},
|
||||||
|
'e_4'=> {"name"=>I18n.t('announcement.email_group_data_4')}
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
# def clean_values
|
# def clean_values
|
||||||
# self.bulletin_links.each do |link|
|
# self.bulletin_links.each do |link|
|
||||||
# link.delete if link.url.blank? && link.title.blank?
|
# link.delete if link.url.blank? && link.title.blank?
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<% # encoding: utf-8 %>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
|
||||||
|
</head>
|
||||||
|
<body bgcolor="#FFFFFF">
|
||||||
|
<div style="text-ident:20px">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= t('announcement.mail_hi') %> <br /><br />
|
||||||
|
<%= t('announcement.mail_url_view') %> <br /><br />
|
||||||
|
<a href="<%= @data.mail_content["url"] %>" target="_blank"> <%= @data.mail_content["title"] %> </a> <br /><br />
|
||||||
|
</div>
|
||||||
|
<span style="color:#555">--<br />
|
||||||
|
<%= t('announcement.mail_source') %> :<a href="http://<%= @data.mail_content["host"] %>" target="_blank"> <%= @data.mail_content["site_title"] %> </a><br />
|
||||||
|
<%= t('announcement.mail_time') %> <%= DateTime.now %>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,19 @@
|
||||||
<a class="close" data-dismiss="modal">×</a>
|
<a class="close" data-dismiss="modal">×</a>
|
||||||
<h3><%= t(:preview) %></h3>
|
<h3><%= t(:preview) %></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body clearfix">
|
||||||
|
<div class="modal-left">
|
||||||
|
|
||||||
|
<% if !@bulletin.email_group.blank? %>
|
||||||
|
<%= label_tag 'group_mail' %>
|
||||||
|
<%= @bulletin.get_email_group_data(@email_group_data) %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-right">
|
||||||
<iframe src=<%= panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.category.id ,:preview=>true) %>></iframe>
|
<iframe src=<%= panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.category.id ,:preview=>true) %>></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
||||||
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_approve_path(bulletin),:method => :post, :html => {:class => 'form-horizontal'} do |f| %>
|
<%= form_for bulletin, :url => panel_announcement_back_end_bulletin_approve_path(bulletin),:method => :post, :html => {:class => 'form-horizontal'} do |f| %>
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
<li>
|
<li>
|
||||||
<a href="#imageupload" data-toggle="tab"><%= t(:image) %></a>
|
<a href="#imageupload" data-toggle="tab"><%= t(:image) %></a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="#mail-group" data-toggle="tab"><%= t('announcement.email_reminder')%></a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!-- Module -->
|
<!-- Module -->
|
||||||
|
@ -120,7 +123,7 @@
|
||||||
<% if @bulletin.image.file %>
|
<% if @bulletin.image.file %>
|
||||||
<%= image_tag @bulletin.image %>
|
<%= image_tag @bulletin.image %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" />
|
<img src="http://www.placehold.it/290x230/EFEFEF/AAAAAA" />
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
<div class="fileupload-preview fileupload-exists thumbnail pull-left"></div>
|
||||||
|
@ -135,6 +138,50 @@
|
||||||
<%= f.check_box :remove_image %><%= t(:remove) %>
|
<%= f.check_box :remove_image %><%= t(:remove) %>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<br />
|
||||||
|
<span>
|
||||||
|
<%= t("ad.widget_info_for_ad_image_size", :best_size=> "290px(w) x 230px(h)") %>
|
||||||
|
<br />
|
||||||
|
<%= t("announcement.image_upload_size_note", :image_upload_size =>'900kb') %>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Mail Group Module -->
|
||||||
|
<div class="tab-pane fade" id="mail-group">
|
||||||
|
|
||||||
|
<!-- Mail Group -->
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"><%= t("announcement.email_group") %></label>
|
||||||
|
<div class="controls">
|
||||||
|
|
||||||
|
<label class="checkbox inline">
|
||||||
|
<%= check_box_tag('bulletin[email_sent]', '1', (!@bulletin.email_sent.blank? ? true : false), :id=>'remind-check') %><%= t('announcement.activate_email_eminder')%>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="content-box">
|
||||||
|
|
||||||
|
<% @email_group_data.collect do |k,v| %>
|
||||||
|
|
||||||
|
<label class="checkbox inline">
|
||||||
|
<%= check_box_tag 'bulletin[email_group][]', k, (@bulletin.email_group.nil? ? false : @bulletin.email_group.include?(k)), :id => "field-#{k}" %> <%= v["name"] %>
|
||||||
|
<%= hidden_field_tag 'bulletin[email_group][]', '' %>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<% end if !@email_group_data.blank? %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label muted"></label>
|
||||||
|
<div class="controls">
|
||||||
|
<div class="content-box">
|
||||||
|
<span class="help-block"><%= "#{t("announcement.other_mailaddress")}(#{t("announcement.other_mailaddress_note")})"%> </span>
|
||||||
|
<%= f.text_area :other_mailaddress, :class=>"span12", :cols=>"25", :rows=>"10" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -302,6 +349,11 @@
|
||||||
$(this).parents('.start-line').hide();
|
$(this).parents('.start-line').hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#remind-check').prop('checked') ? '':$('.content-box').addClass('hide')
|
||||||
|
$('#remind-check').on('change', function() {
|
||||||
|
$(this).prop('checked') ? $('.content-box').removeClass('hide'):$('.content-box').addClass('hide')
|
||||||
|
})
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
quick_edit_link type: 'delete',
|
quick_edit_link type: 'delete',
|
||||||
link: 'panel_announcement_back_end_bulletin_path'
|
link: 'panel_announcement_back_end_bulletin_path'
|
||||||
# can have: title, warning, cancel and submit values
|
# can have: title, warning, cancel and submit values
|
||||||
# quick_edit_link type: 'approval',
|
quick_edit_link type: 'approval',
|
||||||
# link: 'panel_announcement_back_end_bulletin_approval_preview_path'
|
link: 'panel_announcement_back_end_bulletin_approval_preview_path'
|
||||||
# quick_edit_link type: 'reject_reason'
|
quick_edit_link type: 'reject_reason'
|
||||||
field type: 'status',
|
field type: 'status',
|
||||||
db_field: @statuses,
|
db_field: @statuses,
|
||||||
translation: 'status',
|
translation: 'status',
|
||||||
|
|
|
@ -4,8 +4,11 @@
|
||||||
<div class="info1">
|
<div class="info1">
|
||||||
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
|
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
|
||||||
<span class="date"><%= display_date_time(@bulletin.postdate) %></span>
|
<span class="date"><%= display_date_time(@bulletin.postdate) %></span>
|
||||||
<% unit = @bulletin.cache_dept[I18n.locale.to_s] rescue nil %>
|
<%
|
||||||
<span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></span>
|
unit_field = User.get_member_list_attribute_field("staff","Unit")
|
||||||
|
unit = User.get_member_list_attribute_value(@bulletin.create_user_id,unit_field.id).get_value_by_locale(I18n.locale) rescue nil
|
||||||
|
%>
|
||||||
|
<span><%= t('announcement.default_widget.bulletin_create_dept') + ": " + unit unless unit.blank? %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="news_image">
|
<div class="news_image">
|
||||||
|
|
|
@ -17,6 +17,7 @@ en:
|
||||||
postdate: Post Date
|
postdate: Post Date
|
||||||
subtitle: Subtitle
|
subtitle: Subtitle
|
||||||
title: Title
|
title: Title
|
||||||
|
bulletin_create_dept: Unit
|
||||||
editing_announcement: Edit Announcement
|
editing_announcement: Edit Announcement
|
||||||
editing_announcement_category: Edit Category
|
editing_announcement_category: Edit Category
|
||||||
file: Attachment
|
file: Attachment
|
||||||
|
@ -36,3 +37,21 @@ en:
|
||||||
bulletins_and_web_links: Differential Nav.
|
bulletins_and_web_links: Differential Nav.
|
||||||
index: Index
|
index: Index
|
||||||
search: Search
|
search: Search
|
||||||
|
email_reminder: Email Reminder
|
||||||
|
activate_email_eminder: Activate Email Reminder
|
||||||
|
email_sentdate: Email Time
|
||||||
|
email_group: Email Group
|
||||||
|
email_group_data_0: All Faculty
|
||||||
|
email_group_data_1: Undergraduates
|
||||||
|
email_group_data_2: Postgraduates
|
||||||
|
email_group_data_3: Continuing Ed. Postgraduates
|
||||||
|
email_group_data_4: Other
|
||||||
|
# mail_subject: this is an announcement reminder from【%{site_title}】
|
||||||
|
mail_subject: 【北教大公告提醒】
|
||||||
|
other_mailaddress: Other Email
|
||||||
|
other_mailaddress_note: Divide different email accounts with ","
|
||||||
|
mail_hi: Hi
|
||||||
|
mail_url_view: This email is the reminder of an announcement, please click the link for the details
|
||||||
|
mail_source: Source
|
||||||
|
mail_time: Time
|
||||||
|
image_upload_size_note: The following recommendations %{image_upload_size} upload size
|
|
@ -17,6 +17,7 @@ zh_tw:
|
||||||
postdate: 張貼日期
|
postdate: 張貼日期
|
||||||
subtitle: 副標題
|
subtitle: 副標題
|
||||||
title: 標題
|
title: 標題
|
||||||
|
bulletin_create_dept: 單位
|
||||||
editing_announcement: 編輯類別
|
editing_announcement: 編輯類別
|
||||||
editing_announcement_category: 編輯類別
|
editing_announcement_category: 編輯類別
|
||||||
error:
|
error:
|
||||||
|
@ -39,3 +40,21 @@ zh_tw:
|
||||||
index: 索引
|
index: 索引
|
||||||
search: 搜尋
|
search: 搜尋
|
||||||
more: 更多+
|
more: 更多+
|
||||||
|
email_reminder: 寄送提醒
|
||||||
|
activate_email_eminder: 開啟寄送提醒
|
||||||
|
email_sentdate: 寄送時間
|
||||||
|
email_group: 寄送群組
|
||||||
|
other_mailaddress: 其他Mail
|
||||||
|
other_mailaddress_note: 輸入多組mail時,請用","逗號隔開
|
||||||
|
email_group_data_0: 全校教職員
|
||||||
|
email_group_data_1: 大學部學生
|
||||||
|
email_group_data_2: 日間部研究生
|
||||||
|
email_group_data_3: 進修部研究生
|
||||||
|
email_group_data_4: 其他
|
||||||
|
# mail_subject: 來自【%{site_title}】的公告事件提醒
|
||||||
|
mail_subject: 【北教大公告提醒】
|
||||||
|
mail_hi: 您好
|
||||||
|
mail_url_view: 此封信件為公告事件提醒,請點選以下連結詳細觀看
|
||||||
|
mail_source: 來源
|
||||||
|
mail_time: 時間
|
||||||
|
image_upload_size_note: 建議檔案小於%{image_upload_size}
|
Loading…
Reference in New Issue