added email cron and email log
This commit is contained in:
parent
a3d060710a
commit
a308171f31
|
@ -1,7 +1,7 @@
|
|||
$(document).ready(function() {
|
||||
$(".select_user_modal").on('click', function(){
|
||||
var ids = [];
|
||||
var users = $('.selected_user');
|
||||
var users = $(this).siblings('.selected_users').children('span.selected_user');
|
||||
users.each(function(i) {
|
||||
ids.push(users.eq(i).attr('id'));
|
||||
});
|
||||
|
@ -10,16 +10,20 @@ $(document).ready(function() {
|
|||
type: 'GET',
|
||||
url: $(this).attr("rel"),
|
||||
dataType: 'script',
|
||||
data: {ids: ids},
|
||||
data: {field: $(this).attr("field"), ids: ids},
|
||||
success: function (msg) {
|
||||
$("#member-filter").modal('show'); },
|
||||
error: function(){
|
||||
// TODO: i18n in javascript
|
||||
alert("ERROR");
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('click', ".remove_user", function(){
|
||||
$(this).parent().remove();
|
||||
});
|
||||
|
||||
$("#remove_users").on('click', function(){
|
||||
var ids = [];
|
||||
var users = $('.selected_user input[type="checkbox"]:checked');
|
||||
|
|
|
@ -549,11 +549,30 @@ legend {
|
|||
margin-left: -45%;
|
||||
}
|
||||
#show_preview .modal-body {
|
||||
background-color: #fff;
|
||||
padding: 0;
|
||||
max-height: none;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
#show_preview .modal-body > div {
|
||||
height: 100%;
|
||||
}
|
||||
#show_preview .modal-body .modal-left {
|
||||
overflow: auto;
|
||||
float: left;
|
||||
width: 19.8%;
|
||||
border-right: 1px solid #DFDFDF;
|
||||
}
|
||||
#show_preview .modal-body .modal-left > * {
|
||||
padding: 1em;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
#show_preview .modal-body .modal-right {
|
||||
float: right;
|
||||
width: 80%;
|
||||
}
|
||||
#show_preview iframe {
|
||||
border: 0;
|
||||
outline: none;
|
||||
|
|
|
@ -0,0 +1,237 @@
|
|||
/* Member Filter */
|
||||
#select_user #select_user_modal.modal {
|
||||
width: 80%;
|
||||
margin-left: -40%;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body {
|
||||
max-height: 425px;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body form {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body form fieldset {
|
||||
min-height: 360px;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body .radio.inline,
|
||||
#select_user #select_user_modal .modal-body .checkbox.inline {
|
||||
display: inline-block;
|
||||
padding-top: 5px;
|
||||
margin-bottom: 0;
|
||||
vertical-align: middle;
|
||||
min-width: 100px;
|
||||
margin-left: 0;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body .form-actions {
|
||||
margin: 20px 0 0;
|
||||
padding: 10px 0 0;
|
||||
background-color: transparent;
|
||||
text-align: right;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body .tabs-left > .nano {
|
||||
width: 160px;
|
||||
min-height: 425px;
|
||||
float: left;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body .tabs-left > .nano .pane {
|
||||
right: 6px;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs {
|
||||
width: 140px;
|
||||
float: left;
|
||||
margin-bottom: 0;
|
||||
margin-right: 0;
|
||||
border-right: 1px solid #ddd;
|
||||
border-bottom: none;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li {
|
||||
float: none;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li > a {
|
||||
min-width: 74px;
|
||||
margin-right: 0;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li > a {
|
||||
margin-right: -1px;
|
||||
-webkit-border-radius: 4px 0 0 4px;
|
||||
-moz-border-radius: 4px 0 0 4px;
|
||||
border-radius: 4px 0 0 4px;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs > li > a:hover {
|
||||
border-color: #eeeeee #dddddd #eeeeee #eeeeee;
|
||||
}
|
||||
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs .active > a,
|
||||
#select_user #select_user_modal .modal-body .tabs-left > .nano > .content > .nav-tabs .active > a:hover {
|
||||
border-color: #ddd transparent #ddd #ddd;
|
||||
*border-right-color: #ffffff;
|
||||
}
|
||||
#select_user #select_user_modal .member-filter-options {
|
||||
float: left;
|
||||
display: inline-block;
|
||||
width: 175px;
|
||||
min-height: 425px;
|
||||
margin-right: 10px;
|
||||
padding: 0 10px 0 0;
|
||||
}
|
||||
#select_user #select_user_modal .member-filter-options select {
|
||||
width: 165px;
|
||||
}
|
||||
#select_user #select_user_modal .member-filter-options .btn {
|
||||
display: block;
|
||||
}
|
||||
#select_user #select_user_modal .member-filter-result {
|
||||
padding-left: 15px;
|
||||
min-height: 360px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
|
||||
/* Check Box Card */
|
||||
.checkbox-card {
|
||||
margin: 0;
|
||||
}
|
||||
.checkbox-card li {
|
||||
position: relative;
|
||||
list-style: none;
|
||||
color: #FFFFFF;
|
||||
width: 180px;
|
||||
height: 40px;
|
||||
margin: 0 10px 10px 0;
|
||||
float: left;
|
||||
display: inline-block;
|
||||
background-color: #cccccc;
|
||||
overflow: hidden;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
-webkit-transition: all .2s linear;
|
||||
-moz-transition: all .2s linear;
|
||||
-o-transition: all .2s linear;
|
||||
transition: all .2s linear;
|
||||
}
|
||||
.checkbox-card li.mark {
|
||||
width: 0;
|
||||
height: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
||||
filter: alpha(opacity=0);
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
.checkbox-card li:hover {
|
||||
background-color: #0088cc;
|
||||
}
|
||||
.checkbox-card li:after {
|
||||
content: "";
|
||||
display: block;
|
||||
clear: both;
|
||||
height: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
.checkbox-card li.active:before {
|
||||
-webkit-text-size-adjust : none;
|
||||
font-family: FontAwesome;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
color: #FFF;
|
||||
text-decoration: inherit;
|
||||
content: "\f00c";
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
line-height: 14px;
|
||||
text-indent: 10px;
|
||||
font-size: 10px;
|
||||
width: 0px;
|
||||
height: 0px;
|
||||
border-style: solid;
|
||||
border-width: 0 22px 22px 0;
|
||||
border-color: transparent #51a351 transparent transparent;
|
||||
}
|
||||
.checkbox-card li.active label {
|
||||
}
|
||||
.checkbox-card li label {
|
||||
margin-bottom: 0px;
|
||||
overflow: hidden;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.checkbox-card li input {
|
||||
opacity: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
.checkbox-card li label span {
|
||||
-webkit-text-size-adjust : none;
|
||||
font-size: 10px;
|
||||
display: block;
|
||||
width: 130px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #666666;
|
||||
margin-top: -3px;
|
||||
}
|
||||
.checkbox-card li:hover label span,
|
||||
.checkbox-card li:hover label span.user-name {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.checkbox-card li label span.user-name {
|
||||
font-size: 12px;
|
||||
color: #363636;
|
||||
padding: 2px 0 0;
|
||||
margin-top: 0;
|
||||
}
|
||||
.checkbox-card li .user-pic {
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
#selected_users .selected_user {
|
||||
display: inline-block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
#selected_users .selected_user .remove_user {
|
||||
font-size: 15px;
|
||||
}
|
||||
#selected_email_users .selected_user {
|
||||
display: inline-block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
#selected_email_users .selected_user .remove_user {
|
||||
font-size: 15px;
|
||||
}
|
||||
/*
|
||||
.promoter {
|
||||
border-color: #CCCCCC;
|
||||
border-style: solid;
|
||||
border-width: 0 1px;
|
||||
padding: 0 10px 5px 10px;
|
||||
}
|
||||
.promoter > div {
|
||||
border-bottom: 1px solid #CCCCCC;
|
||||
}
|
||||
.promoter > div:after {
|
||||
content: "";
|
||||
clear: both;
|
||||
display: block;
|
||||
visibility: hidden;
|
||||
}
|
||||
.promoter > div > span {
|
||||
display: block;
|
||||
margin-left: 70px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.promoter p {
|
||||
width: 70px;
|
||||
float: left;
|
||||
text-align:right;
|
||||
}*/
|
|
@ -0,0 +1,43 @@
|
|||
class Admin::MailCronLogsController < OrbitBackendController
|
||||
|
||||
# layout "new_admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
||||
def index
|
||||
|
||||
# @mail_cron_logs = MailCronLog.all.desc(:created_at).page(params[:page_main] ).per('20')
|
||||
@mail_cron_logs = (params[:sort]) ? get_sorted_and_filtered("mail_cron_log") : get_viewable("mail_cron_log")
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @mail_crons }
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
@mail_cron_log = MailCronLog.find(params[:id])
|
||||
@mail_cron_log.destroy
|
||||
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to(admin_mail_cron_logs_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js { render :layout => false }
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
if params[:ids]
|
||||
# @mail_cron_logs = MailCronLog.any_in(:_id => params[:ids]).destroy_all
|
||||
@mail_cron_logs = MailCronLog.any_in(:_id => params[:ids])
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render :layout => false }
|
||||
end
|
||||
# redirect_to admin_mail_cron_logs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,130 @@
|
|||
class Admin::MailCronsController < OrbitBackendController
|
||||
|
||||
# layout "new_admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
||||
def index
|
||||
|
||||
# @mail_crons = MailCron.all.asc(:mail_sentdate).page(params[:page_main] ).per('20')
|
||||
@mail_crons = (params[:sort]) ? get_sorted_and_filtered("mail_cron") : get_viewable("mail_cron")
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.xml { render :xml => @mail_crons }
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
@mail_cron = MailCron.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.xml { render :xml => @mail_cron }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@mail_cron = MailCron.new(params[:mail_cron])
|
||||
|
||||
@mail_cron.create_user_id = current_user.id
|
||||
@mail_cron.update_user_id = current_user.id
|
||||
|
||||
respond_to do |format|
|
||||
if @mail_cron.save
|
||||
format.html { redirect_to(admin_mail_crons_url) }
|
||||
format.xml { render :xml => @mail_cron, :status => :created, :location => @mail_cron }
|
||||
else
|
||||
format.html { render :action => "new" }
|
||||
format.xml { render :xml => @mail_cron.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@mail_cron = MailCron.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
|
||||
|
||||
@datas = MailCron.where(:mail_sentdate.lte => Time.now, :mail_sent => false)
|
||||
|
||||
@datas.each do |mail_data|
|
||||
|
||||
@mail_j = 0
|
||||
@read_mails = Array.new
|
||||
|
||||
@mails = mail_data.mail_to.split(",")
|
||||
|
||||
@mails.each do |send_mail|
|
||||
|
||||
@read_mails << send_mail
|
||||
|
||||
@mail_j += 1
|
||||
|
||||
if 0 == @mail_j % 30
|
||||
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||
@read_mails = Array.new
|
||||
|
||||
sleep 10
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if !@read_mails.join(',').blank?
|
||||
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||
@read_mails = Array.new
|
||||
|
||||
sleep 10
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@mail_cron = MailCron.find(params[:id])
|
||||
|
||||
@mail_cron.update_user_id = current_user.id
|
||||
|
||||
respond_to do |format|
|
||||
if @mail_cron.update_attributes(params[:mail_cron])
|
||||
format.html { redirect_to(admin_mail_crons_url) }
|
||||
format.js { render 'toggle_enable' }
|
||||
format.xml { head :ok }
|
||||
else
|
||||
format.html { render :action => "edit" }
|
||||
format.xml { render :xml => @mail_cron.errors, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@mail_cron = MailCron.find(params[:id])
|
||||
@mail_cron.destroy
|
||||
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to(admin_mail_crons_url) }
|
||||
# format.xml { head :ok }
|
||||
format.js { render :layout => false }
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
if params[:ids]
|
||||
# mail_crons = MailCron.any_in(:_id => params[:ids]).destroy_all
|
||||
@mail_crons = MailCron.any_in(:_id => params[:ids])
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js { render :layout => false }
|
||||
end
|
||||
# redirect_to admin_mail_crons_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
end
|
|
@ -1,4 +1,6 @@
|
|||
class Admin::MemberSelectsController < OrbitBackendController
|
||||
|
||||
open_for_visitor :only => [:select_members, :set_roles, :set_users, :select_email_members, :set_email_roles, :set_email_users]
|
||||
|
||||
def index
|
||||
|
||||
|
@ -96,4 +98,32 @@ class Admin::MemberSelectsController < OrbitBackendController
|
|||
render 'admin/member_selects/update_selected_users'
|
||||
end
|
||||
|
||||
def select_email_members
|
||||
selected_users = User.find(params[:ids]) rescue []
|
||||
@field = params[:field]
|
||||
roles = Role.all
|
||||
@sorted_users = roles.inject({}) do |users, role|
|
||||
# users[role] = role.users.where(:email.not => /guest|rulingcom/) - selected_users
|
||||
users[role] = role.users.where(:email.not => /guest/) - selected_users
|
||||
users
|
||||
end
|
||||
end
|
||||
|
||||
def set_email_roles
|
||||
roles = Role.find(params[:email_role_ids]) rescue []
|
||||
@field = params[:field]
|
||||
@users = roles.inject([]) do |users, role|
|
||||
# users += role.users.where(:email.not => /guest|rulingcom/).entries
|
||||
users += role.users.where(:email.not => /guest/).entries
|
||||
users
|
||||
end
|
||||
render 'admin/member_selects/update_selected_email_users'
|
||||
end
|
||||
|
||||
def set_email_users
|
||||
@users = User.find(params[:email_user_ids]) rescue []
|
||||
@field = params[:field]
|
||||
render 'admin/member_selects/update_selected_email_users'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -76,6 +76,18 @@ class Admin::SitesController < OrbitBackendController
|
|||
@nginx_version = %x[/opt/nginx/sbin/nginx -v 2>&1].gsub("\n","<br/> ").html_safe
|
||||
@mongo_version = `mongod --version`.split("\n")[0].html_safe
|
||||
@linux_version = `lsb_release -d`.split(":")[1].html_safe
|
||||
|
||||
@user_actions = UserAction.all.desc(:created_at).page(params[:page]).per(100)
|
||||
|
||||
@mail_crons = MailCron.desc(:created_at)
|
||||
|
||||
@mail_cron_logs = MailCronLog.desc(:created_at).page(params[:page]).per(100)
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def search_engine
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
class EmailCron
|
||||
@queue = :mail
|
||||
|
||||
def self.perform
|
||||
|
||||
@datas = MailCron.where(:mail_sentdate.lte => Time.now)
|
||||
|
||||
@datas.each do |mail_data|
|
||||
|
||||
@mail_j = 0
|
||||
@read_mails = Array.new
|
||||
|
||||
@mails = mail_data.mail_to.split(",")
|
||||
|
||||
@mails.each do |send_mail|
|
||||
|
||||
@read_mails << send_mail
|
||||
|
||||
@mail_j += 1
|
||||
|
||||
if 0 == @mail_j % 30
|
||||
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||
@read_mails = Array.new
|
||||
|
||||
sleep 10
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if !@read_mails.join(',').blank?
|
||||
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||
@read_mails = Array.new
|
||||
|
||||
sleep 10
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,86 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class MailCronMailer < ActionMailer::Base
|
||||
default :from => "orbit_test@rulingcom.com"
|
||||
|
||||
def get_settings
|
||||
|
||||
@site = Site.first
|
||||
|
||||
@smtp_settings = {
|
||||
:address => @site['site_settings']['address'],
|
||||
:port => @site['site_settings']['port'],
|
||||
:domain => @site['site_settings']['domain'],
|
||||
:authentication => @site['site_settings']['authentication'],
|
||||
:enable_starttls_auto => @site['site_settings']['enable_starttls_auto']
|
||||
}
|
||||
|
||||
if !@site['site_settings']['user_name'].blank?
|
||||
@smtp_settings[:user_name] = @site['site_settings']['user_name']
|
||||
end
|
||||
|
||||
if !@site['site_settings']['password'].blank?
|
||||
@smtp_settings[:password] = @site['site_settings']['password']
|
||||
end
|
||||
|
||||
|
||||
ActionMailer::Base.smtp_settings = @smtp_settings
|
||||
|
||||
end
|
||||
|
||||
|
||||
def cron_mail( data_id, group_mail )
|
||||
|
||||
get_settings
|
||||
|
||||
@data = MailCron.find(data_id)
|
||||
|
||||
if @data
|
||||
|
||||
I18n.locale = @data.mail_content["lang"] if !@data.mail_content["lang"].blank?
|
||||
|
||||
@mail_from = !@data.mail_from.blank? ? @data.mail_from : @site['site_settings']['service_email']
|
||||
|
||||
@mail_reply_to = !@data.mail_reply_to.blank? ? @data.mail_reply_to : @site['site_settings']['reply_email']
|
||||
|
||||
@user = User.find(@data.create_user_id)
|
||||
|
||||
if !@data.mail_cron_files.blank?
|
||||
@data.mail_cron_files.each_with_index do |mail_cron_file, i|
|
||||
file_type = File.extname(mail_cron_file.file.to_s)
|
||||
file_content = Mongo::GridFileSystem.new(Mongoid.database).open(mail_cron_file.file.url.gsub("/gridfs/", "").force_encoding("UTF-8"), 'r')
|
||||
attachments["#{mail_cron_file.title}#{file_type}"] = file_content.read
|
||||
end
|
||||
end
|
||||
|
||||
if !@data.mail_content["text"].blank?
|
||||
mail( :from => "\"#{@site.title}\" <#{@mail_from}>", :reply_to => @mail_reply_to, :bcc => group_mail, :subject => @data.mail_subject ) do |format|
|
||||
format.html { render :text => @data.mail_content["text"] }
|
||||
end
|
||||
elsif !@data.mail_content["template"].blank?
|
||||
mail( :from => "\"#{@site.title}\" <#{@mail_from}>", :reply_to => @mail_reply_to, :bcc => group_mail, :subject => @data.mail_subject ) do |format|
|
||||
format.html { render :template => @data.mail_content["template"], :collection => @data.mail_content }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@mail_cron_log = {
|
||||
:mail_subject => @data.mail_subject,
|
||||
:mail_to => group_mail,
|
||||
:mail_user => "#{@user.name} <#{@user.email}>",
|
||||
:mailer_count => group_mail.split(",").size,
|
||||
:mail_from_app => @data.mail_from_app
|
||||
}
|
||||
|
||||
@mail_cron_log = MailCronLog.new(@mail_cron_log)
|
||||
|
||||
|
||||
@mail_cron_log.save
|
||||
|
||||
@data.destroy
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,94 @@
|
|||
class MailCron
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
|
||||
field :mail_from_app
|
||||
field :mail_from
|
||||
field :mail_to
|
||||
field :mail_reply_to
|
||||
field :mail_subject
|
||||
field :mail_content, :type => Hash
|
||||
field :mail_sentdate , :type => DateTime
|
||||
|
||||
field :create_user_id
|
||||
field :update_user_id
|
||||
|
||||
has_many :mail_cron_files, :autosave => true, :dependent => :destroy
|
||||
|
||||
accepts_nested_attributes_for :mail_cron_files, :allow_destroy => true
|
||||
|
||||
after_save :save_mail_cron_files
|
||||
|
||||
|
||||
def save_mail_cron_files
|
||||
self.mail_cron_files.each do |t|
|
||||
if t.should_destroy
|
||||
t.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_send_group_mail(send_mails, other_send_mails = '')
|
||||
|
||||
@group_mail = Array.new
|
||||
|
||||
send_mails.each do |email_user_id|
|
||||
|
||||
if !email_user_id.blank?
|
||||
|
||||
@user = User.find(email_user_id)
|
||||
|
||||
@group_mail << @user.email if !@user.blank?
|
||||
|
||||
end
|
||||
|
||||
end if !send_mails.blank?
|
||||
|
||||
other_send_mails.split(",").collect do |oa|
|
||||
@group_mail << oa
|
||||
end if !other_send_mails.blank?
|
||||
|
||||
@group_mail.uniq
|
||||
|
||||
end
|
||||
|
||||
def self.send_mail_now(mail_cron_id)
|
||||
|
||||
mail_data = MailCron.find(mail_cron_id)
|
||||
|
||||
if !mail_data.blank?
|
||||
|
||||
@mail_j = 0
|
||||
@read_mails = Array.new
|
||||
|
||||
@mails = mail_data.mail_to.split(",")
|
||||
|
||||
@mails.each do |send_mail|
|
||||
|
||||
@read_mails << send_mail
|
||||
|
||||
@mail_j += 1
|
||||
|
||||
if 0 == @mail_j % 30
|
||||
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||
@read_mails = Array.new
|
||||
|
||||
sleep 10
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if !@read_mails.join(',').blank?
|
||||
MailCronMailer.cron_mail( mail_data.id, @read_mails.join(',') ).deliver
|
||||
@read_mails = Array.new
|
||||
|
||||
sleep 10
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class MailCronFile
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
mount_uploader :file, AssetUploader
|
||||
|
||||
field :should_destroy, :type => Boolean
|
||||
field :title
|
||||
|
||||
belongs_to :mail_cron
|
||||
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class MailCronLog
|
||||
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
|
||||
field :mail_subject
|
||||
field :mail_to
|
||||
field :mail_user
|
||||
field :mailer_count
|
||||
field :mail_from_app
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
<div class="filter-clear">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icons-cycle') + t(:clear), admin_mail_crons_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn btn-small js_history" %>
|
||||
</div>
|
|
@ -0,0 +1,11 @@
|
|||
<div id="filter" class="subnav">
|
||||
<div class="filters">
|
||||
<div id="sort_headers" class="table-label">
|
||||
<%= render 'sort_headers' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "sort_header" %>
|
||||
<% end %>
|
|
@ -0,0 +1,29 @@
|
|||
<tr id="<%= dom_id mail_cron_log %>" class="with_action">
|
||||
<td class="span1">
|
||||
<% if is_manager? %>
|
||||
<%= check_box_tag 'to_delete[]', mail_cron_log.id, false, :class => "checkbox_in_list" %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<td class="span1-2">
|
||||
<%= mail_cron_log.mail_subject %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<%if at_least_module_manager %>
|
||||
<li><%= link_to t(:delete_), admin_mail_cron_log_path(mail_cron_log), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
|
||||
<% end -%>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td class="span2">
|
||||
<%= mail_cron_log.mail_to.gsub(/,/, "<br />").html_safe %>
|
||||
</td>
|
||||
<td class="span2">
|
||||
<%= mail_cron_log.mail_user %>
|
||||
</td>
|
||||
<td class="span2">
|
||||
<%= mail_cron_log.mail_from_app %>
|
||||
</td>
|
||||
<td class="span2">
|
||||
<%= display_date_time(mail_cron_log.created_at) %>
|
||||
</td>
|
||||
</tr>
|
|
@ -0,0 +1,6 @@
|
|||
<%= render_sort_bar(true, delete_admin_mail_cron_logs_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
|
||||
['subject', 'mail_subject','span2', :subject] ,
|
||||
['mail_to', 'mail_to','span2', :mail_to] ,
|
||||
['mail_user', 'mail_user','span2', :mail_user] ,
|
||||
['mail_from_app', 'mail_from_app','span2', :mail_from_app] ,
|
||||
['sentdate', 'created_at','span2', :sentdate] ).html_safe %>
|
|
@ -0,0 +1,5 @@
|
|||
<% @mail_cron_logs.collect do |mail_cron_log| %>
|
||||
$("#<%= dom_id mail_cron_log %>").remove();
|
||||
<% end %>
|
||||
|
||||
<% MailCronLog.any_in(:_id => params[:ids]).destroy_all %>
|
|
@ -0,0 +1 @@
|
|||
$("#<%= dom_id @mail_cron_log %>").remove();
|
|
@ -0,0 +1,28 @@
|
|||
<% content_for :side_bar do %>
|
||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
|
||||
<% end %>
|
||||
|
||||
<%= render 'filter' %>
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"></th>
|
||||
<th class="span2"></th>
|
||||
<th class="span2"></th>
|
||||
<th class="span2"></th>
|
||||
<th class="span2"></th>
|
||||
<th class="span2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_mail_cron_logs" class="sort-holder">
|
||||
<%= render :partial => "mail_cron_log",:collection=> @mail_cron_logs%>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<div id="web_link_pagination" class="paginationFixed">
|
||||
<%= paginate @mail_cron_logs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
$("#delete_all").attr("action", "<%= delete_admin_mail_cron_logs_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]) %>");
|
||||
$("#sort_headers").html("<%= j render 'sort_headers' %>");
|
||||
$("#tbody_mail_cron_logs").html("<%= j render :partial => 'mail_cron_log', :collection => @mail_cron_logs %>");
|
||||
$("#mail_cron_log_pagination").html("<%= j paginate @mail_cron_logs, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");
|
|
@ -0,0 +1,3 @@
|
|||
<div class="filter-clear">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icons-cycle') + t(:clear), admin_mail_crons_path(:filter => @filter, :sort => params[:sort], :direction => params[:direction], :clear => true, :type => type), :class => "btn btn-small js_history" %>
|
||||
</div>
|
|
@ -0,0 +1,11 @@
|
|||
<div id="filter" class="subnav">
|
||||
<div class="filters">
|
||||
<div id="sort_headers" class="table-label">
|
||||
<%= render 'sort_headers' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "sort_header" %>
|
||||
<% end %>
|
|
@ -0,0 +1,122 @@
|
|||
<div id= "poststuff">
|
||||
<% # encoding: utf-8 %>
|
||||
|
||||
<%= f.error_messages %>
|
||||
|
||||
<!--Widget start-->
|
||||
|
||||
<div id="sub-wiget">
|
||||
|
||||
<div id="widget-date" class="widget-box widget-size-300">
|
||||
<h3 class="widget-title"><i class="icons-calendar"></i><%= t(:date_) %></h3>
|
||||
<div class="widget-content clear">
|
||||
<div class="control-group">
|
||||
<%= f.datetime_picker :mail_sentdate, :picker_type => 'separated', :label => t(:start) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--Wiget End-->
|
||||
<!--Post Start-->
|
||||
|
||||
<div id="post-body">
|
||||
<div id="post-body-content" class="clear">
|
||||
|
||||
<%= f.label :mail_subject ,t(:mail_subject)%>
|
||||
<%= f.text_field :mail_subject %>
|
||||
|
||||
<%= f.label :mail_from ,t(:mail_from)%>
|
||||
<%= f.text_field :mail_from %>
|
||||
|
||||
<%= f.label :mail_reply_to ,t(:mail_reply_to)%>
|
||||
<%= f.text_field :mail_reply_to %>
|
||||
|
||||
<%= f.label :mail_to ,t(:mail_to)%>
|
||||
<%= f.text_field :mail_to %>
|
||||
|
||||
<%= f.label :mail_content ,t(:mail_content)%>
|
||||
<%= f.text_area :mail_content, :class=>"span12", :cols=>"25", :rows=>"10" %>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
<div id='plugin_files' class="plugin_files_block">
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>File</th>
|
||||
<th>File Name</th>
|
||||
<th class="span1"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td style="text-align:center" colspan="3">
|
||||
<div id='add_plugin_file' class="info_input plugin_files_block">
|
||||
<%= hidden_field_tag 'plugin_file_field_count', @mail_cron.mail_cron_files.count %>
|
||||
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i> ADD/新增</span></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tfoot>
|
||||
<tbody>
|
||||
|
||||
<% @mail_cron.mail_cron_files.each_with_index do |mail_cron_file, i| %>
|
||||
<%= f.fields_for :mail_cron_files, mail_cron_file do |f| %>
|
||||
<%= render :partial => 'form_file', :object => mail_cron_file, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!--Post End-->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "archive_plugin_form" %>
|
||||
<script>
|
||||
$('#add_plugin_file a.add').live('click', function(){
|
||||
var new_id = $(this).prev().attr('value');
|
||||
var old_id = new RegExp("new_add_plugin_files", "g");
|
||||
$(this).prev().attr('value', parseInt(new_id) + 1);
|
||||
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_file', f, :mail_cron_files) %>").replace(old_id, new_id));
|
||||
});
|
||||
|
||||
$('.add_plugin_files_block a.delete').live('click', function(){
|
||||
$(this).parents('.list_item').remove();
|
||||
});
|
||||
|
||||
$('.action a.remove_existing_record').live('click', function(){
|
||||
$(this).next('.should_destroy').attr('value', 1);
|
||||
$("tr#add_plugin_file_" + $(this).prev().attr('value')).hide();
|
||||
});
|
||||
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
|
||||
</div>
|
|
@ -0,0 +1,35 @@
|
|||
<% # encoding: utf-8 %>
|
||||
|
||||
<tr id="<%= "plugin_file_#{form_file.id}" if !form_file.new_record? %>" class='list_item'>
|
||||
<td>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<%= f.file_field :file %>
|
||||
<%= form_file.file.file ? ( link_to t(:view), form_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<%= f.text_field :title %>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<span class="action">
|
||||
<% if form_file.new_record? %>
|
||||
<a class="delete"><i class="icon-remove"></i></a>
|
||||
<% else %>
|
||||
<%= f.hidden_field :id %>
|
||||
<a class="remove_existing_record"><i class="icon-remove"></i></a>
|
||||
<%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %>
|
||||
<% end %>
|
||||
</span>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<tr id="<%= dom_id mail_cron %>" class="with_action">
|
||||
<td class="span1">
|
||||
<% if is_manager? %>
|
||||
<%= check_box_tag 'to_delete[]', mail_cron.id, false, :class => "checkbox_in_list" %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<td class="span1-2">
|
||||
<%= mail_cron.mail_subject %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<%if at_least_module_manager %>
|
||||
<li><%= link_to t(:delete_), admin_mail_cron_path(mail_cron), :confirm => t('sure?'), :method => :delete, :remote => true %></li>
|
||||
<% end -%>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td class="span2">
|
||||
<%= mail_cron.mail_to.gsub(/,/, "<br />").html_safe %>
|
||||
</td>
|
||||
<td class="span2">
|
||||
<%= mail_cron.mail_from_app %>
|
||||
</td>
|
||||
<td class="span2">
|
||||
<%= display_date_time(mail_cron.mail_sentdate) %>
|
||||
</td>
|
||||
</tr>
|
|
@ -0,0 +1,5 @@
|
|||
<%= render_sort_bar(true, delete_admin_mail_crons_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]),
|
||||
['subject', 'mail_subject','span2', :mail_subject] ,
|
||||
['mail_to', 'mail_to','span2', :mail_to] ,
|
||||
['mail_from_app', 'mail_from_app','span2', :mail_from_app] ,
|
||||
['sentdate', 'mail_sentdate','span2', :mail_sentdate] ).html_safe %>
|
|
@ -0,0 +1,5 @@
|
|||
<% @mail_crons.collect do |mail_cron| %>
|
||||
$("#<%= dom_id mail_cron %>").remove();
|
||||
<% end %>
|
||||
|
||||
<% MailCron.any_in(:_id => params[:ids]).destroy_all %>
|
|
@ -0,0 +1 @@
|
|||
$("#<%= dom_id @mail_cron %>").remove();
|
|
@ -0,0 +1,9 @@
|
|||
<% content_for :side_bar do %>
|
||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
|
||||
<% end %>
|
||||
|
||||
<h1><%= t('mail_cron.editing_mail_cron') %></h1>
|
||||
|
||||
<%= form_for @mail_cron, :url => admin_mail_cron_path(@mail_cron), :html => {:class => 'clear'} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
|
@ -0,0 +1,27 @@
|
|||
<% content_for :side_bar do %>
|
||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
|
||||
<% end %>
|
||||
|
||||
<%= render 'filter' %>
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"></th>
|
||||
<th class="span2"></th>
|
||||
<th class="span2"></th>
|
||||
<th class="span2"></th>
|
||||
<th class="span2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_mail_crons" class="sort-holder">
|
||||
<%= render :partial => "mail_cron",:collection=> @mail_crons%>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<div class="form-actions form-fixed pagination-right">
|
||||
<div id="web_link_pagination" class="paginationFixed">
|
||||
<%= paginate @mail_crons, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
$("#delete_all").attr("action", "<%= delete_admin_mail_crons_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]) %>");
|
||||
$("#sort_headers").html("<%= j render 'sort_headers' %>");
|
||||
$("#tbody_mail_crons").html("<%= j render :partial => 'mail_cron', :collection => @mail_crons %>");
|
||||
$("#mail_cron_pagination").html("<%= j paginate @mail_crons, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>");
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
<% content_for :side_bar do %>
|
||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
|
||||
<% end %>
|
||||
|
||||
<div id="poststuff">
|
||||
<h1><%= t('mail_cron.new_mail_cron') %></h1>
|
||||
<%= form_for @mail_cron, :url => admin_mail_crons_path, :html => {:class => 'clear'} do |f| %>
|
||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<% content_for :page_specific_javascript do -%>
|
||||
<%= javascript_include_tag "lib/jquery.nanoscroller" %>
|
||||
<%= javascript_include_tag "lib/checkbox.card" %>
|
||||
<% end -%>
|
||||
<% content_for :page_specific_css do -%>
|
||||
<%= stylesheet_link_tag "member_select" %>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<div id="selected_email_users" class="selected_users">
|
||||
<%= render partial: 'admin/member_selects/email_user', collection: users, locals: {field: field} %>
|
||||
<%= hidden_field_tag field %>
|
||||
</div>
|
||||
<%= link_to t(:add), '#', class: 'btn btn-primary btn-small select_user_modal', rel: select_email_members_admin_member_selects_path, field: field %>
|
||||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
<span class="alert alert-info selected_user" id="<%= email_user.id %>">
|
||||
<%= content_tag :span, '×', class: 'close remove_user' %>
|
||||
<%= email_user.name %>
|
||||
<%= hidden_field_tag field, email_user.id %>
|
||||
</span>
|
|
@ -28,6 +28,7 @@
|
|||
<div class="form-actions">
|
||||
<button type="button" class="btn" data-dismiss="modal"><%= t(:cancel) %></button>
|
||||
<%= submit_tag t(:submit), class: "btn btn-primary" %>
|
||||
<%= hidden_field_tag field, @field %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -53,6 +54,7 @@
|
|||
<div class="form-actions condition">
|
||||
<button type="button" class="btn" data-dismiss="modal"><%= t(:cancel) %></button>
|
||||
<%= submit_tag t(:submit), class: "btn btn-primary" %>
|
||||
<%= hidden_field_tag field, @field %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<div id="member-filter" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h3><%= t('list.user') %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="tabbable tabs-left">
|
||||
<div class="nano">
|
||||
<div class="content">
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="active"><a href="#all" data-toggle="tab"><%= t('list.role') %></a></li>
|
||||
<% @sorted_users.each_key do |role| %>
|
||||
<li class=""><a href="#r_<%= role.id %>" data-toggle="tab"><%= role.title %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade in active" id="all">
|
||||
<%= form_tag role_form_url, remote: true do %>
|
||||
<fieldset>
|
||||
<% @sorted_users.each_key do |role| %>
|
||||
<label class="checkbox inline">
|
||||
<%= check_box_tag 'email_role_ids[]', role.id , false %> <%= role.title %>
|
||||
</label>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<div class="form-actions">
|
||||
<button type="button" class="btn" data-dismiss="modal"><%= t(:cancel) %></button>
|
||||
<%= submit_tag t(:submit), class: "btn btn-primary" %>
|
||||
<%= hidden_field_tag field, @field %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% @sorted_users.each do |role, users| %>
|
||||
<div class="tab-pane fade" id="r_<%= role.id %>">
|
||||
<%= form_tag user_form_url, remote: true do %>
|
||||
<fieldset class="clearfix">
|
||||
<div class="member-filter-result nano">
|
||||
<div class="content">
|
||||
<ul class="checkbox-card clearfix">
|
||||
<% users.each do |user| %>
|
||||
<li class="check-item">
|
||||
<label>
|
||||
<%= image_tag (user.avatar.file ? user.avatar : "menber-pic.png"), class: "user-pic" %>
|
||||
<span class="user-name"><%= user.name %></span>
|
||||
</label>
|
||||
<%= check_box_tag 'email_user_ids[]', user.id , false %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions condition">
|
||||
<button type="button" class="btn" data-dismiss="modal"><%= t(:cancel) %></button>
|
||||
<%= submit_tag t(:submit), class: "btn btn-primary" %>
|
||||
<%= hidden_field_tag field, @field %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(".modal").on("hidden", function () {
|
||||
$("#select_email_user").remove();
|
||||
});
|
||||
$('#member-filter').on('shown', function() {
|
||||
$('#member-filter').off('shown')
|
||||
$(this).find('.nano').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
|
||||
$(this).find('.checkbox-card').cardCheck();
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<% content_for :page_specific_javascript do -%>
|
||||
<%= javascript_include_tag "lib/jquery.nanoscroller" %>
|
||||
<%= javascript_include_tag "lib/checkbox.card" %>
|
||||
<% end -%>
|
||||
<% content_for :page_specific_css do -%>
|
||||
<%= stylesheet_link_tag "member_select" %>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<div id="selected_users" class="selected_users">
|
||||
<%= render partial: 'admin/member_selects/user', collection: users, locals: {field: field} %>
|
||||
<%= hidden_field_tag field %>
|
||||
</div>
|
||||
<%= link_to t(:add), '#', class: 'btn btn-primary btn-small select_user_modal', rel: select_members_admin_member_selects_path, field: field %>
|
||||
</div>
|
|
@ -1,5 +1,5 @@
|
|||
<span class="alert alert-info selected_user" user_id="<%= user.id %>">
|
||||
<span class="alert alert-info selected_user" id="<%= user.id %>">
|
||||
<%= content_tag :span, '×', class: 'close remove_user' %>
|
||||
<%= user.name %>
|
||||
<%= hidden_field_tag field, user.id %>
|
||||
<%= content_tag :span, '×', class: 'close remove_user' %>
|
||||
</span>
|
|
@ -0,0 +1,2 @@
|
|||
$("#select_user").html("<%= j render partial: 'admin/member_selects/modal_select_email', locals: {role_form_url: set_email_roles_admin_member_selects_path(field: @field), user_form_url: set_email_users_admin_member_selects_path(field: @field)} %>");
|
||||
$("#member-filter").modal();
|
|
@ -0,0 +1,2 @@
|
|||
$("#selected_email_users").append("<%= j render partial: 'email_user', collection: @users, locals: {field: @field} %>");
|
||||
$("#member-filter").modal('hide');
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
<tr id="<%= dom_id mail_cron %>">
|
||||
<td>
|
||||
<% if is_manager? %>
|
||||
<%= check_box_tag 'to_delete[]', mail_cron.id, false, :class => "list-check" %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<td><%= display_date_time(mail_cron.mail_sentdate) %></td>
|
||||
<td><%= mail_cron.mail_subject %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<%= content_tag(:li, link_to(t(:detail), '#', class: ("detail-row"))) if at_least_module_manager %>
|
||||
<%if at_least_module_manager %>
|
||||
<li><%= link_to t(:delete_), admin_mail_cron_path(mail_cron), :class=>"text-error", :confirm => t('sure?'), :method => :delete, :remote => true %></li>
|
||||
<% end -%>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><p><%= mail_cron.mail_to.gsub(/,/, ", ").html_safe %></p></td>
|
||||
<td><%= mail_cron.mail_from_app %></td>
|
||||
</tr>
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
<tr id="<%= dom_id mail_cron_log %>">
|
||||
<td>
|
||||
<% if is_manager? %>
|
||||
<%= check_box_tag 'to_delete[]', mail_cron_log.id, false, :class => "list-check" %>
|
||||
<% end -%>
|
||||
</td>
|
||||
<td><%= display_date_time(mail_cron_log.created_at) %></td>
|
||||
<td><%= mail_cron_log.mail_subject %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills">
|
||||
<%= content_tag(:li, link_to(t(:detail), '#', class: ("detail-row"))) if at_least_module_manager %>
|
||||
<%= content_tag(:li, link_to(t(:delete_),admin_mail_cron_log_path(mail_cron_log), :confirm => t(:sure?), :method => :delete, :class=>"text-error", :remote => true)) if at_least_module_manager %>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><p><%= mail_cron_log.mail_to.gsub(/,/, ", ").html_safe %></p> </td>
|
||||
<td><%= mail_cron_log.mail_user %> </td>
|
||||
<td><%= mail_cron_log.mail_from_app %> </td>
|
||||
</tr>
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
<tr>
|
||||
<td><%= user_action.created_at %></td>
|
||||
<td><%= user_action.user.name %></td>
|
||||
<td><%= user_action.page %></td>
|
||||
</tr>
|
|
@ -56,6 +56,18 @@
|
|||
|
||||
<div id="system-email" class="tab-pane fade">
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t 'mail.service_email' %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :service_email, :value => (@site['site_settings']['service_email'] rescue nil), :class=>"input-large", :placeholder=>"Administrator Mail" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t 'mail.reply_email' %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :reply_email, :value => (@site['site_settings']['reply_email'] rescue nil), :class=>"input-large", :placeholder=>"Reply Mail" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t 'mail.address' %></label>
|
||||
<div class="controls">
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<div class="nav-name"><strong><%= t("preferences.classification") %></strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<li class="active"><a href="#overview" data-toggle="tab"><%= t("site.system_preference_.tab_summary") %></a></li>
|
||||
<li><a href="#user-actions" data-toggle="tab"><%= t("user_actions") %></a></li>
|
||||
<li><a href="#mail-cron-logs" data-toggle="tab"><%= t("site.system_preference_.tab_send_reminders_log") %></a></li>
|
||||
</ul>
|
||||
|
||||
|
@ -52,6 +53,23 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<!-- User Actions -->
|
||||
<div id="user-actions" class="tab-pane fade">
|
||||
<h3 class="muted"><%= t("user_actions") %></h3>
|
||||
<table class="table" id="user_actions">
|
||||
<tr>
|
||||
<th><%= I18n.t 'user_action.time' %></th>
|
||||
<th><%= I18n.t 'user_action.name' %></th>
|
||||
<th><%= I18n.t 'user_action.page' %></th>
|
||||
</tr>
|
||||
<%= render :partial => "user_action", :collection=> @user_actions%>
|
||||
</table>
|
||||
|
||||
<div class="user-paginate text-center" style="display:none">
|
||||
<%= paginate @user_actions, :remote => true %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Email Log -->
|
||||
<div id="mail-cron-logs" class="tab-pane fade">
|
||||
<ul class="nav nav-pills">
|
||||
|
@ -65,9 +83,9 @@
|
|||
<div class="tab-content">
|
||||
<div class="tab-pane fade in active list-check" id="send-log">
|
||||
<p class="">
|
||||
<a href="#" class="btn list-active-btn disabled" data-check-action="list-be-remove" rel="/panel/announcement/back_end/bulletins/delete"><i class="icons-trash"></i></a>
|
||||
<%= link_to(content_tag(:i, nil, :class => "icons-trash"), '#', :class => "btn list-active-btn disabled", :rel => delete_admin_mail_cron_logs_path) if at_least_module_manager %>
|
||||
</p>
|
||||
<table class="table main-list table-striped">
|
||||
<table id="mail_cron_logs" class="table main-list table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
|
@ -75,18 +93,24 @@
|
|||
</th>
|
||||
<th><%= t(:sent_date) %></th>
|
||||
<th><%= t(:subject) %></th>
|
||||
<th><%= t(:mail_to) %></th>
|
||||
<th data-hide="all"><%= t(:mail_to) %></th>
|
||||
<th><%= t(:mail_user) %></th>
|
||||
<th><%= t(:mail_from_app) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= render :partial => "mail_cron_log", :collection=> @mail_cron_logs%>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="paginate text-center" style="display:none">
|
||||
<%= paginate @mail_cron_logs, :remote => true %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="tab-pane fade in list-check" id="waiting-sent">
|
||||
<p class="">
|
||||
<a href="#" class="btn list-active-btn disabled" data-check-action="list-be-remove" rel="/panel/announcement/back_end/bulletins/delete"><i class="icons-trash"></i></a>
|
||||
<%= link_to(content_tag(:i, nil, :class => "icons-trash"), '#', :class => "btn list-active-btn disabled", :rel => delete_admin_mail_crons_path) if at_least_module_manager %>
|
||||
</p>
|
||||
<table class="table main-list table-striped">
|
||||
<thead>
|
||||
|
@ -96,11 +120,12 @@
|
|||
</th>
|
||||
<th><%= t(:sent_date) %></th>
|
||||
<th><%= t(:subject) %></th>
|
||||
<th><%= t(:mail_to) %></th>
|
||||
<th data-hide="all"><%= t(:mail_to) %></th>
|
||||
<th><%= t(:mail_from_app) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<%= render :partial => "mail_cron",:collection=> @mail_crons%>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -123,4 +148,35 @@
|
|||
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
|
||||
<button class="delete-item btn btn-danger"><%= t(:delete_) %></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function checkScroll() {
|
||||
if (nearBottomOfPage()) {
|
||||
if($(".next a").length != 0){
|
||||
$.rails.handleRemote($(".next a"));
|
||||
}
|
||||
} else {
|
||||
setTimeout("checkScroll()", 250);
|
||||
}
|
||||
}
|
||||
|
||||
function nearBottomOfPage() {
|
||||
return scrollDistanceFromBottom() < 150;
|
||||
}
|
||||
|
||||
function scrollDistanceFromBottom(argument) {
|
||||
return pageHeight() - (window.pageYOffset + self.innerHeight);
|
||||
}
|
||||
|
||||
function pageHeight() {
|
||||
return Math.max(document.body.scrollHeight, document.body.offsetHeight);
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
checkScroll();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
$("<%= j(render :partial => 'user_action', :collection => @user_actions) %>").appendTo($("#user_actions"));
|
||||
$(".user-paginate").html("<%= j(paginate @user_actions, :remote => true) %>");
|
||||
|
||||
$("<%= j(render :partial => 'mail_cron_log', :collection => @mail_cron_logs) %>").appendTo($("#mail_cron_logs"));
|
||||
$(".paginate").html("<%= j(paginate @mail_cron_logs, :remote => true) %>");
|
||||
|
||||
checkScroll();
|
||||
$('.list-check').listCheck();
|
|
@ -2,7 +2,7 @@
|
|||
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class="orbit-cycle-slideshow" data-cycle-timeout="<%= @ad_banner.timeout_millisecond %>" data-cycle-fx="<%= @ad_banner.ad_fx %>" data-cycle-pager=".banner_nav_<%= @ad_banner.title.dehumanize %>" data-cycle-pager-template="<li class='needed'><a href='#'></a></li>" data-cycle-pager-active-class="activeSlide" data-cycle-random='true' style="z-index: 0">
|
||||
<% @ad_banner.ad_images.can_display.each do |ad_image| %>
|
||||
<% link = ad_image_link(ad_image) %>
|
||||
<%= image_tag ad_image.file, width: @ad_banner.width, height: @ad_banner.height, link_open: ad_image.link_open, link_url: link, style: "display:none; #{'cursor:pointer;' if link.present?}" %>
|
||||
<%= image_tag ad_image.file, alt: ad_image.title, title: ad_image.title, width: @ad_banner.width, height: @ad_banner.height, link_open: ad_image.link_open, link_url: link, style: "display:none; #{'cursor:pointer;' if link.present?}" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<ul class='clear banner_nav banner_nav_<%= @ad_banner.title.dehumanize %>'></ul>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<!-- menu -->
|
||||
<li id="orbit-start" class="dropdown">
|
||||
<a class="orbitlogo" href="#" role="button" class="dropdown-toggle" data-toggle="dropdown"></a>
|
||||
<a class="orbitlogo" href="#" role="button" class="dropdown-toggle" data-toggle="dropdown" title="<%= t('dashboard_')%>"></a>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="orbit-start">
|
||||
<li><%= link_to content_tag(:i, nil, :class => 'icons-gauge') + ' ' + t(:dashboard_), admin_dashboards_path, tabindex: '-1' %></li>
|
||||
<li><%= link_to content_tag(:i, nil, :class => 'icons-users') + ' ' + t(:member_), admin_users_new_interface_index_path, tabindex: '-1' %></li>
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
<!-- home -->
|
||||
<li id="orbit-home">
|
||||
<a href="<%= root_path %>" role="button">
|
||||
<a href="<%= root_path %>" role="button" title="<%= t('homepage')%>">
|
||||
<i class="icons-house"></i> <span class="hide"><%= t(:homepage) %></span>
|
||||
</a>
|
||||
</li>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<!-- Desktop -->
|
||||
<% if @site.desktop_closed%>
|
||||
<li id="orbit-desktop">
|
||||
<a href="<%= desktop_path %>" role="button">
|
||||
<a href="<%= desktop_path %>" role="button" title="<%= t('desktop')%>">
|
||||
<i class="icons-screen"></i> <span class="hide"><%= t(:desktop) %></span>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<!-- Language -->
|
||||
<li id="orbit-language" class="dropdown">
|
||||
<a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown"><%= t(:_locale, :locale => I18n.locale) %></a>
|
||||
<a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown" title="<%= t('site.language')%>"><%= t(:_locale, :locale => I18n.locale) %></a>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="orbit-language">
|
||||
<% @site_in_use_locales.each do |locale| %>
|
||||
<%= content_tag :li, (link_to t(:_locale, :locale => locale), add_locale(remove_locale((@referer || request.fullpath)), locale)), :class => (I18n.locale.eql?(locale.to_sym) ? 'active' : nil), tabindex: "-1" %>
|
||||
|
@ -44,7 +44,7 @@
|
|||
<% else %>
|
||||
<!-- login -->
|
||||
<li id="orbit-login">
|
||||
<a href="#login" role="button" data-toggle="modal">
|
||||
<a href="#login" role="button" data-toggle="modal" title="<%= t('login')%>">
|
||||
<i class="icons-login"></i> <span class="hide"><%= t(:login) %></span>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -274,6 +274,8 @@ en:
|
|||
login: Login
|
||||
logout: Logout
|
||||
mail:
|
||||
service_email: Administrator Mail
|
||||
reply_email: Reply Mail
|
||||
address: Address
|
||||
authentication: Authentication
|
||||
domain: Domain
|
||||
|
|
|
@ -274,6 +274,8 @@ zh_tw:
|
|||
login: 登入
|
||||
logout: 登出
|
||||
mail:
|
||||
service_email: 網站管理員信箱
|
||||
reply_email: 回信用信箱
|
||||
address: 電子郵件地址
|
||||
authentication: 電子郵件認證
|
||||
domain: 電子郵件網域名稱
|
||||
|
|
|
@ -8,4 +8,10 @@ generate_system_summary:
|
|||
cron: 0 0 12 * * *
|
||||
class: GenerateSystemSummary
|
||||
args:
|
||||
description: Generate the system status such as disk free space,package version list for showing at site tab
|
||||
description: Generate the system status such as disk free space,package version list for showing at site tab
|
||||
|
||||
email_cron:
|
||||
cron: 0 0 [10,14,17,20] * * *
|
||||
class: EmailCron
|
||||
args:
|
||||
description: EmailCron
|
||||
|
|
|
@ -37,6 +37,19 @@ Orbit::Application.routes.draw do
|
|||
post 'delete_files'
|
||||
end
|
||||
end
|
||||
|
||||
resources :mail_crons do
|
||||
collection do
|
||||
get 'delete'
|
||||
end
|
||||
end
|
||||
|
||||
resources :mail_cron_logs do
|
||||
collection do
|
||||
get 'delete'
|
||||
end
|
||||
end
|
||||
|
||||
resources :asset_categories
|
||||
resources :asset_tags
|
||||
resources :app_auths
|
||||
|
@ -260,6 +273,9 @@ Orbit::Application.routes.draw do
|
|||
get 'select_members'
|
||||
post 'set_roles'
|
||||
post 'set_users'
|
||||
get 'select_email_members'
|
||||
post 'set_email_roles'
|
||||
post 'set_email_users'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue