Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
spen | d65a6abbe8 | |
spen | 752a525778 | |
rulingcom | 2ea19aa230 | |
spen | 0db4afe643 | |
spen | e591499de5 |
4
Gemfile
4
Gemfile
|
@ -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'
|
||||||
|
|
||||||
|
@ -109,7 +111,7 @@ group :test, :development do
|
||||||
gem "spork"
|
gem "spork"
|
||||||
gem "capybara"
|
gem "capybara"
|
||||||
#gem 'rack-mini-profiler'
|
#gem 'rack-mini-profiler'
|
||||||
gem "better_errors", "1.1.0"
|
gem "better_errors"
|
||||||
# gem 'yard'
|
# gem 'yard'
|
||||||
# gem "bluecloth"
|
# gem "bluecloth"
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,8 +19,8 @@ $(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
// Initialize the jQuery File Upload widget:
|
// Initialize the jQuery File Upload widget:
|
||||||
$('#fileupload').fileupload({
|
$('#fileupload').fileupload({
|
||||||
maxFileSize: 50000000000,
|
maxFileSize: 5000000,
|
||||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|pdf|doc|docx|ppt|pptx|xls|xlsx|csv|txt|zip|rar|tar|gz|odt|tiff|key|page)$/i,
|
acceptFileTypes: /(\.|\/)(gif|jpe?g|png|pdf|doc|docx|ppt|pptx|xls|xlsx)$/i,
|
||||||
dropZone: $('#dropzone'),
|
dropZone: $('#dropzone'),
|
||||||
headers:{
|
headers:{
|
||||||
'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content")
|
'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content")
|
||||||
|
|
|
@ -28,8 +28,6 @@ CKEDITOR.editorConfig = function( config ) {
|
||||||
{ name: 'about' }
|
{ name: 'about' }
|
||||||
];
|
];
|
||||||
|
|
||||||
config.allowedContent = true;
|
|
||||||
|
|
||||||
config.skin = 'moono';
|
config.skin = 'moono';
|
||||||
|
|
||||||
config.filebrowserBrowseUrl = "<%= Rails.application.routes.url_helpers.admin_assets_path(:module_app_id=>ModuleApp.where(:key=>'asset').first.id) %>";
|
config.filebrowserBrowseUrl = "<%= Rails.application.routes.url_helpers.admin_assets_path(:module_app_id=>ModuleApp.where(:key=>'asset').first.id) %>";
|
||||||
|
@ -37,10 +35,6 @@ CKEDITOR.editorConfig = function( config ) {
|
||||||
|
|
||||||
//Font Config
|
//Font Config
|
||||||
config.font_names = 'Arial;Comic Sans MS;Courier New;Georgia;Helvetica;Lucida Sans Unicode;Tahoma;Times New Roman;Trebuchet MS;Verdana;微軟正黑體';
|
config.font_names = 'Arial;Comic Sans MS;Courier New;Georgia;Helvetica;Lucida Sans Unicode;Tahoma;Times New Roman;Trebuchet MS;Verdana;微軟正黑體';
|
||||||
|
|
||||||
config.enterMode = CKEDITOR.ENTER_BR;
|
|
||||||
config.shiftEnterMode = CKEDITOR.ENTER_BR;
|
|
||||||
config.pasteFromWordPromptCleanup = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CKEDITOR.on('instanceReady',function(){
|
CKEDITOR.on('instanceReady',function(){
|
||||||
|
|
|
@ -32,6 +32,7 @@ function preview() {
|
||||||
var resize = 500/bannerW
|
var resize = 500/bannerW
|
||||||
bannerW = Math.floor(bannerW*resize);
|
bannerW = Math.floor(bannerW*resize);
|
||||||
bannerH = Math.floor(bannerH*resize);
|
bannerH = Math.floor(bannerH*resize);
|
||||||
|
console.log(bannerW)
|
||||||
};
|
};
|
||||||
if(bannerH > 300) {
|
if(bannerH > 300) {
|
||||||
var resize = 300/bannerH
|
var resize = 300/bannerH
|
||||||
|
|
|
@ -7,12 +7,7 @@ $(function() {
|
||||||
for ( instance in CKEDITOR.instances )
|
for ( instance in CKEDITOR.instances )
|
||||||
CKEDITOR.instances[instance].updateElement();
|
CKEDITOR.instances[instance].updateElement();
|
||||||
|
|
||||||
var formData;
|
var formData = new FormData( $('form.previewable')[0] );
|
||||||
if(typeof(FormData) == "function"){
|
|
||||||
formData = new FormData( $('form.previewable')[0] );
|
|
||||||
}else{
|
|
||||||
formData = $('form.previewable').serialize()
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Admin::AdBannersController < OrbitBackendController
|
||||||
open_for_sub_manager
|
open_for_sub_manager
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@ad_banners = get_sorted_and_filtered("ad_banner")
|
@ad_banners = AdBanner.all.page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Admin::AdImagesController < Admin::AdBannersController
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@ad_images = get_sorted_and_filtered("ad_image")
|
@ad_images = AdImage.all.page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Admin::DashboardsController < OrbitBackendController
|
||||||
check_backend_openness
|
check_backend_openness
|
||||||
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
|
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
|
||||||
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
|
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
|
||||||
@most_visited = get_most_visited('bulletin', 'page_context')
|
@most_visited = get_most_visited('bulletin', 'page_context','page')
|
||||||
end
|
end
|
||||||
|
|
||||||
def reload_all_content
|
def reload_all_content
|
||||||
|
@ -22,7 +22,7 @@ class Admin::DashboardsController < OrbitBackendController
|
||||||
end
|
end
|
||||||
|
|
||||||
def reload_most_visited
|
def reload_most_visited
|
||||||
@most_visited = get_most_visited('bulletin', 'page_context')
|
@most_visited = get_most_visited('bulletin', 'page_context','page')
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js { render 'reload', locals: {div_id: 'most_visited'} }
|
format.js { render 'reload', locals: {div_id: 'most_visited'} }
|
||||||
end
|
end
|
||||||
|
|
|
@ -321,8 +321,6 @@ class ApplicationController < ActionController::Base
|
||||||
sorted_objects.flatten!
|
sorted_objects.flatten!
|
||||||
sorted_objects.uniq!
|
sorted_objects.uniq!
|
||||||
objects = get_with_nil(objects, option, sorted_objects)
|
objects = get_with_nil(objects, option, sorted_objects)
|
||||||
elsif option.eql?('size')
|
|
||||||
objects = objects.order_by([ [:width, params[:direction]], [:height, params[:direction]] ])
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -363,12 +361,7 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
if pagination
|
if pagination
|
||||||
filtered_objects = filter_authorized_objects(objects)
|
Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10)
|
||||||
if filtered_objects.is_a?(Array)
|
|
||||||
Kaminari.paginate_array(filtered_objects).page(params[:page]).per(10)
|
|
||||||
else
|
|
||||||
filter_authorized_objects(objects).page(params[:page]).per(10)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
filter_authorized_objects(objects)
|
filter_authorized_objects(objects)
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
class SessionsController < Devise::SessionsController
|
||||||
|
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
||||||
|
|
||||||
|
require 'savon'
|
||||||
|
|
||||||
|
def create
|
||||||
|
|
||||||
|
|
||||||
|
@SYS_USER = "rulingcom"
|
||||||
|
@SYS_PASS = "pxm87912tkx"
|
||||||
|
@LDAP_USER = params[:user][:user_id]
|
||||||
|
@LDAP_PASS = params[:user][:password]
|
||||||
|
|
||||||
|
if @LDAP_USER == 'rulingcom'
|
||||||
|
|
||||||
|
resource = User.first(conditions:{user_id: @LDAP_USER})
|
||||||
|
|
||||||
|
if !resource.blank? and resource.valid_password?(@LDAP_PASS)
|
||||||
|
|
||||||
|
resource_name = resource.class.to_s.downcase
|
||||||
|
sign_in(resource_name, resource)
|
||||||
|
redirect_to after_sign_in_path_for(resource)
|
||||||
|
|
||||||
|
elsif !resource.valid_password?(@LDAP_PASS)
|
||||||
|
|
||||||
|
flash[:error] = "密碼錯誤<br />password Local fail"
|
||||||
|
redirect_to :root
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
||||||
|
redirect_to :root
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
client = Savon.client(wsdl: 'http://ap.ydu.edu.tw/LDAP_WS/RulingcomDataService.asmx?wsdl',filters: [:SYS_USER, :SYS_PASS, :LDAP_USER, :LDAP_PASS])
|
||||||
|
|
||||||
|
client.operations
|
||||||
|
|
||||||
|
response = client.call(:login_chk, message: {
|
||||||
|
"SYS_USER" => @SYS_USER,
|
||||||
|
"SYS_PASS" => @SYS_PASS,
|
||||||
|
"LDAP_USER" => @LDAP_USER,
|
||||||
|
"LDAP_PASS" => @LDAP_PASS,
|
||||||
|
"User_IP" => request.remote_ip
|
||||||
|
})
|
||||||
|
|
||||||
|
@datas = response.body[:login_chk_response][:login_chk_result][:string]
|
||||||
|
|
||||||
|
if !@datas[0].blank? and ( @datas[0] == 'P' or @datas[0] == 'U' ) #使用者帳號回傳P,單位帳號回傳U
|
||||||
|
|
||||||
|
resource = User.first(conditions:{user_id: @LDAP_USER})
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
end
|
|
@ -248,24 +248,15 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_month_traffic
|
def get_month_traffic
|
||||||
site = Site.first
|
result = []
|
||||||
if site.month_traffic_cache.blank? or (site.month_traffic_cache['updated_at'] < (Time.now-1.day) rescue true)
|
(0..30).each do |i|
|
||||||
site.month_traffic_cache = {}
|
visits = Impression.where( created_at: {
|
||||||
|
'$gte' => Time.now.beginning_of_day-i.days,
|
||||||
site.month_traffic_cache['result'] = []
|
'$lte' => Time.now.end_of_day-i.days}
|
||||||
(1..30).each do |i|
|
).count
|
||||||
visits = Impression.where( created_at: {
|
result.push([ Time.now.beginning_of_day-i.days, visits])
|
||||||
'$gte' => Time.now.beginning_of_day-i.days,
|
|
||||||
'$lte' => Time.now.end_of_day-i.days}
|
|
||||||
).count
|
|
||||||
site.month_traffic_cache['result'].push([ Time.now.beginning_of_day-i.days, visits])
|
|
||||||
end
|
|
||||||
|
|
||||||
site.month_traffic_cache['updated_at'] = Time.now
|
|
||||||
site.save
|
|
||||||
end
|
end
|
||||||
|
[:name=> t(:visitors_count),:data=>result]
|
||||||
[:name=> t(:visitors_count),:data=>site.month_traffic_cache['result']]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# def get_today_traffic
|
# def get_today_traffic
|
||||||
|
|
|
@ -63,6 +63,7 @@ class MailCronMailer < ActionMailer::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@mail_cron_log = {
|
@mail_cron_log = {
|
||||||
:mail_subject => @data.mail_subject,
|
:mail_subject => @data.mail_subject,
|
||||||
:mail_to => group_mail,
|
:mail_to => group_mail,
|
||||||
|
@ -73,16 +74,10 @@ class MailCronMailer < ActionMailer::Base
|
||||||
|
|
||||||
@mail_cron_log = MailCronLog.new(@mail_cron_log)
|
@mail_cron_log = MailCronLog.new(@mail_cron_log)
|
||||||
|
|
||||||
|
|
||||||
@mail_cron_log.save
|
@mail_cron_log.save
|
||||||
|
|
||||||
@mail_to_count = @data.mail_to.split(',') - group_mail.split(',')
|
@data.destroy
|
||||||
|
|
||||||
if @mail_to_count.count == 0
|
|
||||||
@data.destroy
|
|
||||||
else
|
|
||||||
@data.mail_to = @mail_to_count.join(',')
|
|
||||||
@data.save
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class MailCron
|
||||||
|
|
||||||
if !email_user_id.blank?
|
if !email_user_id.blank?
|
||||||
|
|
||||||
@user = User.find(email_user_id) rescue nil
|
@user = User.find(email_user_id)
|
||||||
|
|
||||||
@group_mail << @user.email if !@user.blank?
|
@group_mail << @user.email if !@user.blank?
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,6 @@ class Site
|
||||||
field :store_confirmation, :type => Boolean, :default => false
|
field :store_confirmation, :type => Boolean, :default => false
|
||||||
field :meta_viewport, :type => Boolean, :default => false
|
field :meta_viewport, :type => Boolean, :default => false
|
||||||
|
|
||||||
field :month_traffic_cache
|
|
||||||
|
|
||||||
belongs_to :design
|
belongs_to :design
|
||||||
has_many :site_metas, :autosave => true, :dependent => :destroy
|
has_many :site_metas, :autosave => true, :dependent => :destroy
|
||||||
validate :in_use_locales, :minimum_enabled_locales
|
validate :in_use_locales, :minimum_enabled_locales
|
||||||
|
|
|
@ -89,7 +89,7 @@ class User
|
||||||
|
|
||||||
validates :user_id,
|
validates :user_id,
|
||||||
:presence => { :message => I18n.t("users.user_id_not_null") } ,
|
:presence => { :message => I18n.t("users.user_id_not_null") } ,
|
||||||
:length => {:minimum => 3, :maximum => 50, :message => I18n.t("users.user_id_length") },
|
:length => {:minimum => 2, :maximum => 50, :message => I18n.t("users.user_id_length") },
|
||||||
:uniqueness => true
|
:uniqueness => true
|
||||||
|
|
||||||
scope :approval_pending, where(:approved => false)
|
scope :approval_pending, where(:approved => false)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#built-in-modules
|
#built-in-modules
|
||||||
gem 'archive', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-archive.git'
|
gem 'archive', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-archive.git'
|
||||||
gem 'announcement', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-announcement.git'
|
gem 'announcement', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-announcement.git', :branch => 'ydu'
|
||||||
gem 'gallery', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-gallery.git'
|
gem 'gallery', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-gallery.git'
|
||||||
gem 'member', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-member.git'
|
gem 'member', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-member.git'
|
||||||
gem 'member_staff', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-memberstaff.git'
|
gem 'member_staff', '0.0.1', :git => 'http://gitlab.tp.rulingcom.com/root/orbit-memberstaff.git'
|
||||||
|
|
|
@ -56,7 +56,6 @@ module Orbit
|
||||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||||
# config.i18n.default_locale = :de
|
# config.i18n.default_locale = :de
|
||||||
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', 'modules', '*.{rb,yml}').to_s]
|
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', 'modules', '*.{rb,yml}').to_s]
|
||||||
config.i18n.enforce_available_locales = false
|
|
||||||
config.i18n.default_locale = :zh_tw
|
config.i18n.default_locale = :zh_tw
|
||||||
|
|
||||||
# JavaScript files you want as :defaults (application.js is always included).
|
# JavaScript files you want as :defaults (application.js is always included).
|
||||||
|
|
|
@ -600,7 +600,7 @@ en:
|
||||||
user_id: User Account
|
user_id: User Account
|
||||||
user_id_note: Should be more than 3 characters and less than 50 characters
|
user_id_note: Should be more than 3 characters and less than 50 characters
|
||||||
user_id_not_null: User account cannot be null
|
user_id_not_null: User account cannot be null
|
||||||
user_id_length: User account should be more than 3 characters
|
user_id_length: User account should be more than 2 characters
|
||||||
user_id_error: Someone already use that user account
|
user_id_error: Someone already use that user account
|
||||||
user_basic_id_form: Account Info.
|
user_basic_id_form: Account Info.
|
||||||
user_basic_data: Personal Profile
|
user_basic_data: Personal Profile
|
||||||
|
|
|
@ -600,7 +600,7 @@ zh_tw:
|
||||||
user_id: 使用者帳號
|
user_id: 使用者帳號
|
||||||
user_id_note: 需介於3個字元至50個字元之間
|
user_id_note: 需介於3個字元至50個字元之間
|
||||||
user_id_not_null: 使用者帳號不能是空值
|
user_id_not_null: 使用者帳號不能是空值
|
||||||
user_id_length: 使用者帳號至少需要3個字元
|
user_id_length: 使用者帳號至少需要2個字元
|
||||||
user_id_error: 該使用者帳號已被使用
|
user_id_error: 該使用者帳號已被使用
|
||||||
user_basic_id_form: 帳號資料
|
user_basic_id_form: 帳號資料
|
||||||
user_basic_data: 個人資料
|
user_basic_data: 個人資料
|
||||||
|
|
|
@ -4,7 +4,7 @@ Orbit::Application.routes.draw do
|
||||||
|
|
||||||
# get "robots.txt" => 'robots#index'
|
# get "robots.txt" => 'robots#index'
|
||||||
|
|
||||||
devise_for :users, :controllers => { :registrations => "registrations", :passwords => 'passwords', :confirmations => 'confirmations' } do
|
devise_for :users, :controllers => {:sessions => 'sessions', :registrations => "registrations", :passwords => 'passwords', :confirmations => 'confirmations' } do
|
||||||
resources :passwords, :except => [:index, :show, :destroy]
|
resources :passwords, :except => [:index, :show, :destroy]
|
||||||
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
|
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue