This commit is contained in:
Manson Wang 2014-02-19 11:26:02 +08:00
parent 2f87ce09a4
commit 214d24f928
43 changed files with 979 additions and 240 deletions

View File

@ -1,6 +1,8 @@
source 'http://rubygems.org' source 'http://rubygems.org'
gem 'rails', "~> 3.2.16" gem 'rails', "~> 3.2.16"
gem 'savon', '~> 2.2.0'
gem "brakeman" gem "brakeman"
gem 'mime-types' gem 'mime-types'

View File

@ -549,11 +549,30 @@ legend {
margin-left: -45%; margin-left: -45%;
} }
#show_preview .modal-body { #show_preview .modal-body {
background-color: #fff;
padding: 0; padding: 0;
max-height: none; max-height: none;
height: 100%; height: 100%;
overflow: hidden; 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 { #show_preview iframe {
border: 0; border: 0;
outline: none; outline: none;

View File

@ -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

View File

@ -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

View File

@ -76,6 +76,18 @@ class Admin::SitesController < OrbitBackendController
@nginx_version = %x[/opt/nginx/sbin/nginx -v 2>&1].gsub("\n","<br/> ").html_safe @nginx_version = %x[/opt/nginx/sbin/nginx -v 2>&1].gsub("\n","<br/> ").html_safe
@mongo_version = `mongod --version`.split("\n")[0].html_safe @mongo_version = `mongod --version`.split("\n")[0].html_safe
@linux_version = `lsb_release -d`.split(":")[1].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 end
def search_engine def search_engine
@ -139,6 +151,7 @@ class Admin::SitesController < OrbitBackendController
result = "success" result = "success"
Bundler.with_clean_env { `cd #{Rails.root} && bundle install && touch tmp/restart.txt` } Bundler.with_clean_env { `cd #{Rails.root} && bundle install && touch tmp/restart.txt` }
end end
%x(git stash pop) unless need_stash
render :text => result render :text => result
end end

View File

@ -0,0 +1,35 @@
# encoding: utf-8
class SessionsController < Devise::SessionsController
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
require 'savon'
def create
@sys_id = params["sys_id"]
client = Savon.client(wsdl: 'http://sso.ntue.edu.tw/soap/soapserver.php?wsdl')
client.operations
response = client.call(:chkidno, message: { sys_id: @sys_id })
@id = response.body[:chkidno_response][:return][:id]
login_uid = @id
resource = User.first(conditions:{user_id: login_uid})
if !resource.blank?
resource_name = resource.class.to_s.downcase
sign_in(resource_name, resource)
redirect_to after_sign_in_path_for(resource)
else
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
redirect_to :root
end
end
end

42
app/jobs/email_cron.rb Normal file
View File

@ -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

View File

@ -0,0 +1,85 @@
# 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
@user = User.find(@data.create_user_id)
unit_field = User.get_member_list_attribute_field("staff","Unit")
unit = User.get_member_list_attribute_value(@data.create_user_id,unit_field.id).get_value_by_locale(I18n.locale) rescue nil
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 => "\"#{unit}\" <#{@data.mail_from}>", :reply_to => @data.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 => "\"#{unit}\" <#{@data.mail_from}>", :reply_to => @data.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 => "#{!unit.blank? ? unit : @user.name} <#{@data.mail_from}>",
# :mail_user => @user.name,
: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

70
app/models/mail_cron.rb Normal file
View File

@ -0,0 +1,70 @@
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.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

View File

@ -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

View File

@ -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

View File

@ -35,6 +35,6 @@
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="action pull-right"> <div class="action pull-right">
<%= link_to content_tag(:i, nil, class: "icons-plus") + ' ' + t(:add), '#', class: 'btn btn-primary select_user_modal', rel: admin_modal_select_authorizations_path(@module_app.key, @type, @object) %> <%= link_to content_tag(:i, nil, class: "icons-plus") + ' ' + t(:add), '#', class: 'btn btn-primary select_user_modal', rel: admin_modal_select_authorizations_path(@module_app.key, @type, @object) %>
<%= link_to content_tag(:i, nil, class: "icon-trash") + ' ' + t(:delete_), '#', id: 'remove_users', class: 'btn btn-danger', rel: admin_remove_users_authorizations_path(@module_app.key, @type, @object) %> <%= link_to content_tag(:i, nil, class: "icon-trash") + ' ' + t(:delete), '#', id: 'remove_users', class: 'btn btn-danger', rel: admin_remove_users_authorizations_path(@module_app.key, @type, @object) %>
</div> </div>
</div> </div>

View File

@ -1,20 +1,15 @@
<tr> <tr class="with_action">
<td class="detail-row"> <td class="span1"><%= check_box_tag 'to_delete[]', design.id, false, :class => "checkbox_in_list" %></td>
<h5 class="mt_title"> <td class="span2">
<span><%= design.title %></span> <%= design.title %>
</h5> <div class="quick-edit">
<ul class="nav nav-pills hide">
</td>
<td>
<p class="mt_dev"><%= design.author %></p>
</td>
<td>
<div class="quick-edit">
<ul class="nav nav-pills">
<li><%= link_to t(:edit), edit_admin_design_path(design), :class => 'edit' %></li> <li><%= link_to t(:edit), edit_admin_design_path(design), :class => 'edit' %></li>
<li class="dropdown"><%= link_to t(:delete_), admin_design_path(design), :confirm => t('sure?'), :method => :delete, :class => 'delete' %></li> <li class="dropdown"><%= link_to t(:delete_), admin_design_path(design), :confirm => t('sure?'), :method => :delete, :class => 'delete' %></li>
</ul> </ul>
</div> </div>
</td> </td>
<td class="active"><%= radio_button_tag 'design_default', design.id, (@site.design && @site.design.id.to_s.eql?(design.id.to_s) ? true : false), :class => 'design_default toggle-check', :rel => admin_sites_path %></td> <td class="span7"><%= design.intro %></td>
<td class="span2"><%= design.author %></td>
<td class="span1 active"><%= radio_button_tag 'design_default', design.id, (@site.design && @site.design.id.to_s.eql?(design.id.to_s) ? true : false), :class => 'design_default toggle-check', :rel => admin_sites_path %></td>
</tr> </tr>

View File

@ -1,12 +1,25 @@
<thead> <thead>
<tr class="sort-header"> <tr class="sort-header">
<th class="first span2"><a href="#">Templates Title</a></th> <th></th>
<th class="active span3">Designer</th> <th class="first span3"><a href="#">Templates Title</a></th>
<th class="span3">Actions</th> <th data-hide="phone" class="active span3">Active</th>
<th class="span1">Status</th> <th data-hide="phone" class="active span3">Date of purchase</th>
<th data-hide="phone" class="active span3">Designer</th>
<th class="span1"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tbody id="tbody_designs" class="sort-holder"> <tbody id="tbody_designs" class="sort-holder">
<%= render :partial => 'design', :collection => @designs %> <%= render :partial => 'design', :collection => @designs %>
</tbody> </tbody>
<% content_for :page_specific_javascript do %>
<script>
$(document).ready(function(){
$(document).on('change', '.design_default', function(){
$(this).attr('value');
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/change_design');
});
});
</script>
<% end %>

View File

@ -11,226 +11,17 @@
<%= javascript_include_tag 'lib/footable-0.1' %> <%= javascript_include_tag 'lib/footable-0.1' %>
<%= javascript_include_tag 'lib/all-list' %> <%= javascript_include_tag 'lib/all-list' %>
<%= javascript_include_tag 'lib/retina' %> <%= javascript_include_tag 'lib/retina' %>
<style type="text/css"> <%= javascript_include_tag 'lib/mudole_templates_status' %>
.container{
/*max-width: 600px;*/
}
.panel{
border-radius: 5px;
overflow: hidden;
border: 1px solid #DFDFDF;
background: #FFF;
box-shadow: 0px 0px 10px #CCC;
}
.break{
border-left: 1px solid #FCFCFC;
border-right: 1px solid #DDD;
padding: 10px 0;
margin: 0 15px;
}
.panel-heading{
font-size: 16px;
color: #666;
padding: 10px 20px;
height: 20px;
background-color: #fafafa;
background-image: -moz-linear-gradient(top, #ffffff, #f2f2f2);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#f2f2f2));
background-image: -webkit-linear-gradient(top, #ffffff, #f2f2f2);
background-image: -o-linear-gradient(top, #ffffff, #f2f2f2);
background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0);
*zoom: 1;
border-bottom: 1px solid #DDD;
}
.table{
margin: 0;
-webkit-border-radius: 5px;
border-radius: 5px;
}
/* .table td, .table th, .table .quick-edit{
vertical-align: middle;
text-align: center;
}
*/
/*.table td img{
background: #666;
border: 3px solid #AAA;
padding: 2px;
border-radius: 5px;
box-shadow: 0px 0px 10px #000 inset;
}
*/
.pannel-body{
min-height: 400px;
overflow: scroll;
overflow-x: hidden;
overflow-y: hidden;
padding: 15px;
}
.pannel-footer{
background: #f2f2f2; /* Old browsers */
background: -moz-linear-gradient(top, #f2f2f2 0%, #ffffff 76%, #ededed 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f2f2f2), color-stop(76%,#ffffff), color-stop(100%,#ededed)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f2f2f2 0%,#ffffff 76%,#ededed 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f2f2f2 0%,#ffffff 76%,#ededed 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #f2f2f2 0%,#ffffff 76%,#ededed 100%); /* IE10+ */
background: linear-gradient(to bottom, #f2f2f2 0%,#ffffff 76%,#ededed 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f2f2f2', endColorstr='#ededed',GradientType=0 ); /* IE6-9 */
border: 1px solid #EEE;
border-top: 1px solid #CCC;
padding: 10px;
height: 30px;
}
#apply_change_btn{
display: none;
}
#alert_wrap{
display: none;
position: absolute;
width: 93%;
top: 30%;
z-index: 1045;
}
.alert{
width: 400px;
text-align: center;
z-index: 1050;
margin: 0 auto;
padding: 10px 0;
}
.modal-backdrop{
display: none;
}
.icons-faq:before{ content: "\e086"; }
.icons-ask:before { content: "\e062"; }
</style>
</head> </head>
<%#= render 'filter' %> <%= render 'filter' %>
<%#= flash[:notice] rescue nil%> <table class="table main-list">
<div id="alert_wrap"> <%= render 'designs' %>
<div class="alert alert-success">
<h4><span id="module_msg_title">Please wait...</span></h4><br/>
<span id="module_msg_content">Theme changes taking effect</span><br/>
<img src="http://ridepal.com/images/homeimg/preloader_transparent.gif" width="50">
</div>
</div>
<div class="container row-fluid">
<div class="span4">
<div class="panel">
<div class="panel-heading"><i class="icons-download"></i><span class="break"></span><%= t(:installed_templates) %></div>
<div class="pannel-body">
<table class="table table-striped">
<tbody id="extensions_table">
<%= render 'designs' %>
</tbody>
</table>
</div>
<div class="pannel-footer">
<button id="apply_change_btn" onclick="apply_change();" class="btn btn-primary btn-small pull-right">Appy Change</button>
</div>
</div>
</div>
<div class="span8 pull-right">
<div class="panel">
<div class="panel-heading"><i class="icon-shopping-cart"></i><span class="break"></span><%= t(:template_store) %></div>
<div class="pannel-body">
<table id="mt-list" class="table main-list">
<tbody>
<tr id="loading">
<td>
<img src="http://ridepal.com/images/homeimg/preloader_transparent.gif" width="50">
<span>Loading template store...</span>
<td>
</tr>
</tbody>
</table>
</div>
<div class="pannel-footer">
</div>
</div>
</div>
</div>
<div class="modal-backdrop"></div>
</table> </table>
<div class="form-actions form-fixed pagination-right"> <div class="form-actions form-fixed pagination-right">
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:upload), upload_package_admin_designs_path, :class => 'btn btn-primary pull-right' %> <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:upload), upload_package_admin_designs_path, :class => 'btn btn-primary pull-right' %>
</div> </div>
<script type="text/javascript">
$.ajax({
url : "<%= admin_template_store_path %>",
type : "get",
datatType : "html"
}).done(function(data){
$("#loading").addClass('hide');
$("#mt-list").html(data);
bindHandlers();
}).fail(function(){
$("#loading").addClass('hide');
$("#mt-list").html("<tr><td>Error loading template store</td></tr>");
})
$(document).on('change', '.design_default', function(){
$("#alert_wrap").show();
$(".modal-backdrop").show();
$(this).attr('value');
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/change_design',function(){
$("#alert_wrap").hide();
$(".modal-backdrop").hide();
});
});
var bindHandlers = function(){
$("a.download-link").on(clickEvent,function(){
if($(this).attr("disabled") == "disabled")return false;
var el = $(this);
el.removeClass("btn-primary").addClass("btn-info").text("Installing").attr('disabled',"disabled");
$.ajax({
url : "<%= admin_template_store_download_theme_path %>",
data : el.data(),
dataType : "json",
type : "post"
}).done(function(data){
if(data.success){
el.removeClass('btn-info').addClass('btn-success').text("Installed");
$.ajax({
url: '<%= admin_design_list_path %>',
type: 'get',
dataType: 'html'
})
.done(function(data) {
$("#tbody_designs").html(data);
$(".toggle-check").togglebox();
});
}
}).fail(function(){
el.removeClass('btn-info').addClass('btn-danger').text("Error, please try again.").removeAttr('disabled');
})
})
}
</script>

View File

@ -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>

View File

@ -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 %>

View File

@ -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>

View File

@ -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 %>

View File

@ -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 %>

View File

@ -0,0 +1 @@
$("#<%= dom_id @mail_cron_log %>").remove();

View File

@ -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>

View File

@ -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} %>");

View File

@ -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>

View File

@ -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 %>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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 %>

View File

@ -0,0 +1,5 @@
<% @mail_crons.collect do |mail_cron| %>
$("#<%= dom_id mail_cron %>").remove();
<% end %>
<% MailCron.any_in(:_id => params[:ids]).destroy_all %>

View File

@ -0,0 +1 @@
$("#<%= dom_id @mail_cron %>").remove();

View File

@ -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 %>

View File

@ -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>

View File

@ -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} %>");

View File

@ -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>

View File

@ -0,0 +1,20 @@
<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">
<%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><%= mail_cron.mail_to.gsub(/,/, "<br />").html_safe %></td>
<td><%= mail_cron.mail_from_app %></td>
</tr>

View File

@ -0,0 +1,19 @@
<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(: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><%= mail_cron_log.mail_to.gsub(/,/, "<br />").html_safe %> </td>
<td><%= mail_cron_log.mail_user %> </td>
<td><%= mail_cron_log.mail_from_app %> </td>
</tr>

View File

@ -0,0 +1,6 @@
<tr>
<td><%= user_action.created_at %></td>
<td><%= user_action.user.name %></td>
<td><%= user_action.page %></td>
</tr>

View File

@ -18,6 +18,7 @@
<div class="nav-name"><strong><%= t("preferences.classification") %></strong></div> <div class="nav-name"><strong><%= t("preferences.classification") %></strong></div>
<ul class="nav nav-pills language-nav"> <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 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> <li><a href="#mail-cron-logs" data-toggle="tab"><%= t("site.system_preference_.tab_send_reminders_log") %></a></li>
</ul> </ul>
@ -52,6 +53,23 @@
</span> </span>
</div> </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 --> <!-- Email Log -->
<div id="mail-cron-logs" class="tab-pane fade"> <div id="mail-cron-logs" class="tab-pane fade">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
@ -65,9 +83,9 @@
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane fade in active list-check" id="send-log"> <div class="tab-pane fade in active list-check" id="send-log">
<p class=""> <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> </p>
<table class="table main-list table-striped"> <table id="mail_cron_logs" class="table main-list table-striped">
<thead> <thead>
<tr> <tr>
<th> <th>
@ -81,12 +99,18 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<%= render :partial => "mail_cron_log", :collection=> @mail_cron_logs%>
</tbody> </tbody>
</table> </table>
<div class="paginate text-center" style="display:none">
<%= paginate @mail_cron_logs, :remote => true %>
</div>
</div> </div>
<div class="tab-pane fade in list-check" id="waiting-sent"> <div class="tab-pane fade in list-check" id="waiting-sent">
<p class=""> <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> </p>
<table class="table main-list table-striped"> <table class="table main-list table-striped">
<thead> <thead>
@ -101,6 +125,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<%= render :partial => "mail_cron",:collection=> @mail_crons%>
</tbody> </tbody>
</table> </table>
</div> </div>
@ -123,4 +148,35 @@
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button> <button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
<button class="delete-item btn btn-danger"><%= t(:delete_) %></button> <button class="delete-item btn btn-danger"><%= t(:delete_) %></button>
</div> </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>

View File

@ -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();

View File

@ -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"> <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| %> <% @ad_banner.ad_images.can_display.each do |ad_image| %>
<% link = ad_image_link(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 %> <% end %>
</div> </div>
<ul class='clear banner_nav banner_nav_<%= @ad_banner.title.dehumanize %>'></ul> <ul class='clear banner_nav banner_nav_<%= @ad_banner.title.dehumanize %>'></ul>

View File

@ -1,5 +1,6 @@
#built-in-modules #built-in-modules
gem 'announcement', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-announcement.git' gem 'announcement', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-announcement.git', :branch => 'ntue'
gem 'er_email', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-eremail.git', :branch => 'ntue'
gem 'gallery', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-gallery.git' gem 'gallery', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-gallery.git'
gem 'member', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-member.git' gem 'member', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-member.git'
gem 'member_staff', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-memberstaff.git' gem 'member_staff', '0.0.1', :git => 'git@gitlab.tp.rulingcom.com:root/orbit-memberstaff.git'

View File

@ -8,6 +8,10 @@ Orbit::Application.routes.draw do
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
end end
devise_scope :user do
get 'soap_login' => 'sessions#create'
end
mount Resque::Server, :at => "/admin/resque" mount Resque::Server, :at => "/admin/resque"
mount Rack::GridFS::Endpoint.new(:db => Mongoid.database,:lookup=>:path), :at => "gridfs" mount Rack::GridFS::Endpoint.new(:db => Mongoid.database,:lookup=>:path), :at => "gridfs"
@ -37,6 +41,19 @@ Orbit::Application.routes.draw do
post 'delete_files' post 'delete_files'
end end
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_categories
resources :asset_tags resources :asset_tags
resources :app_auths resources :app_auths