Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c12214f30f | ||
|
|
2490668d06 | ||
|
|
17597668a4 | ||
|
|
764c557794 | ||
|
|
665c01c8b8 | ||
|
|
74fe25ab28 | ||
|
|
a21c5c6d5c | ||
|
|
b180ef41f7 | ||
|
|
b92e533698 | ||
|
|
27db216d0c | ||
|
|
c5935f7104 | ||
|
|
f1a96505ef | ||
|
|
93c5e863bf | ||
|
|
414208d95d | ||
|
|
85e780b039 | ||
|
|
8398c9f829 | ||
|
|
bf1060d1eb | ||
|
|
51efaa6d6b |
No files matched your search
@@ -1,6 +1,8 @@
|
|||||||
source 'http://rubygems.org'
|
source 'http://rubygems.org'
|
||||||
gem 'rails', "~> 3.2.9"
|
gem 'rails', "~> 3.2.9"
|
||||||
|
|
||||||
|
gem 'savon', '~> 2.2.0'
|
||||||
|
|
||||||
gem "brakeman"
|
gem "brakeman"
|
||||||
gem 'mime-types'
|
gem 'mime-types'
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 34 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -8,9 +8,7 @@ window.SocialShareButton =
|
|||||||
title = encodeURIComponent($(el).parent().data('title'))
|
title = encodeURIComponent($(el).parent().data('title'))
|
||||||
img = encodeURIComponent($(el).parent().data("img"))
|
img = encodeURIComponent($(el).parent().data("img"))
|
||||||
fb_url = encodeURIComponent($(el).parent().data("fb_url"))
|
fb_url = encodeURIComponent($(el).parent().data("fb_url"))
|
||||||
summary = encodeURIComponent($(el).parent().data("summary"))
|
|
||||||
url = encodeURIComponent(location.href)
|
url = encodeURIComponent(location.href)
|
||||||
console.log($(el).parent().data())
|
|
||||||
switch site
|
switch site
|
||||||
when "weibo"
|
when "weibo"
|
||||||
SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8")
|
SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8")
|
||||||
@@ -19,7 +17,7 @@ window.SocialShareButton =
|
|||||||
when "douban"
|
when "douban"
|
||||||
SocialShareButton.openUrl("http://www.douban.com/recommend/?url=#{url}&title=#{title}&image=#{img}")
|
SocialShareButton.openUrl("http://www.douban.com/recommend/?url=#{url}&title=#{title}&image=#{img}")
|
||||||
when "facebook"
|
when "facebook"
|
||||||
SocialShareButton.openUrl("http://www.facebook.com/sharer.php?s=100&p[title]=#{title}&p[url]=#{fb_url}&p[images][0]=#{img}")
|
SocialShareButton.openUrl("http://www.facebook.com/sharer.php?t=#{title}&u=#{fb_url}")
|
||||||
when "qq"
|
when "qq"
|
||||||
SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}&title=#{title}&pics=#{img}")
|
SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}&title=#{title}&pics=#{img}")
|
||||||
when "tqq"
|
when "tqq"
|
||||||
|
|||||||
@@ -15,11 +15,6 @@ function load_tinymce() {
|
|||||||
theme_advanced_statusbar_location : "bottom",
|
theme_advanced_statusbar_location : "bottom",
|
||||||
theme_advanced_resizing : true,
|
theme_advanced_resizing : true,
|
||||||
|
|
||||||
// Domain Absolute URLs
|
|
||||||
relative_urls : false,
|
|
||||||
remove_script_host : false,
|
|
||||||
document_base_url: window.location.protocol + '//' + window.location.host,
|
|
||||||
|
|
||||||
// Skin options
|
// Skin options
|
||||||
skin : "o2k7",
|
skin : "o2k7",
|
||||||
skin_variant : "silver",
|
skin_variant : "silver",
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ div[data-role="page"] {
|
|||||||
border: none;
|
border: none;
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
/*background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c));*/
|
/*background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c));*/
|
||||||
background-image: -webkit-linear-gradient(top, #A02C5E, #300E1D);
|
background-image: -webkit-linear-gradient(top, #F7F1E0, #E0C77E);
|
||||||
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset;
|
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8),inset 0 1px 0 #F6EAA5,0 -1px 0 #F7F1E0 inset;
|
||||||
}
|
}
|
||||||
.header h1.ui-title {
|
.header h1.ui-title {
|
||||||
margin: 8px 30%;
|
margin: 8px 30%;
|
||||||
@@ -116,13 +116,14 @@ div[data-role="page"] {
|
|||||||
margin-left: -15px;
|
margin-left: -15px;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
/*color: #727272;*/
|
/*color: #727272;*/
|
||||||
color: #C57CB3;
|
color: #FCF2D2;
|
||||||
/*background-color: #252525;*/
|
/*background-color: #252525;*/
|
||||||
background-color: #421528;
|
background-color: #E4CF91;
|
||||||
border-radius: 0 0 5px 5px;
|
border-radius: 0 0 5px 5px;
|
||||||
height: 15px;
|
height: 15px;
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
box-shadow: 1px 2px 2px rgba(0, 0, 0, .5);
|
box-shadow: 1px 2px 2px rgba(0, 0, 0, .5);
|
||||||
|
text-shadow: 0 -1px 1px #6D6C6C;
|
||||||
}
|
}
|
||||||
.header .language .ui-btn-text {
|
.header .language .ui-btn-text {
|
||||||
left: 0;
|
left: 0;
|
||||||
@@ -135,14 +136,14 @@ div[data-role="page"] {
|
|||||||
background-image: none;
|
background-image: none;
|
||||||
}
|
}
|
||||||
.header .ui-btn-up-a {
|
.header .ui-btn-up-a {
|
||||||
border: 1px solid #471334;
|
border: 1px solid #949494;
|
||||||
background-color: #600C64;
|
background-color: #0C4C64;
|
||||||
background-image: -webkit-gradient(linear, left top, left bottom, from( #910D86 ), to( #490E4B ));
|
background-image: -webkit-gradient(linear, left top, left bottom, from( #ECE0BC ), to( #BD9932 ));
|
||||||
background-image: -webkit-linear-gradient( #910D86 , #490E4B );
|
background-image: -webkit-linear-gradient( #ECE0BC , #BD9932 );
|
||||||
background-image: -moz-linear-gradient( #910D86 , #490E4B );
|
background-image: -moz-linear-gradient( #ECE0BC , #BD9932 );
|
||||||
background-image: -ms-linear-gradient( #910D86 , #490E4B );
|
background-image: -ms-linear-gradient( #ECE0BC , #BD9932 );
|
||||||
background-image: -o-linear-gradient( #910D86 , #490E4B );
|
background-image: -o-linear-gradient( #ECE0BC , #BD9932 );
|
||||||
background-image: linear-gradient( #910D86 , #490E4B );
|
background-image: linear-gradient( #ECE0BC , #BD9932 );
|
||||||
}
|
}
|
||||||
.header h1 img {
|
.header h1 img {
|
||||||
height: 30px;
|
height: 30px;
|
||||||
|
|||||||
@@ -3,16 +3,19 @@
|
|||||||
class SessionsController < Devise::SessionsController
|
class SessionsController < Devise::SessionsController
|
||||||
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
||||||
|
|
||||||
require 'net/http'
|
require 'savon'
|
||||||
require 'uri'
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
|
||||||
@user_id = params[:user][:user_id]
|
|
||||||
|
|
||||||
if @user_id == 'rulingcom'
|
@SYS_USER = "rulingcom"
|
||||||
|
@SYS_PASS = "pxm87912tkx"
|
||||||
|
@LDAP_USER = params[:user][:user_id]
|
||||||
|
@LDAP_PASS = params[:user][:password]
|
||||||
|
|
||||||
resource = User.first(conditions:{user_id: @user_id})
|
if @LDAP_USER == 'rulingcom'
|
||||||
|
|
||||||
|
resource = User.first(conditions:{user_id: @LDAP_USER})
|
||||||
|
|
||||||
if !resource.blank?
|
if !resource.blank?
|
||||||
|
|
||||||
@@ -29,23 +32,72 @@ class SessionsController < Devise::SessionsController
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
uri = URI('http://www.fgu.edu.tw/cgi-bin/check_intrant.pl')
|
client = Savon.client(wsdl: 'http://ap.ydu.edu.tw/LDAP_WS/RulingcomDataService.asmx?wsdl',filters: [:SYS_USER, :SYS_PASS, :LDAP_USER, :LDAP_PASS])
|
||||||
response = Net::HTTP.post_form(uri, 'username' => @user_id, 'password' => params[:user][:password])
|
|
||||||
@response = response.body
|
|
||||||
|
|
||||||
if @response.include?("username=#{@user_id}")
|
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
|
||||||
|
})
|
||||||
|
|
||||||
resource = User.first(conditions:{user_id: @user_id})
|
@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?
|
if !resource.blank?
|
||||||
resource_name = resource.class.to_s.downcase
|
|
||||||
sign_in(resource_name, resource)
|
resource_name = resource.class.to_s.downcase
|
||||||
redirect_to after_sign_in_path_for(resource)
|
sign_in(resource_name, resource)
|
||||||
else
|
redirect_to after_sign_in_path_for(resource)
|
||||||
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
|
||||||
redirect_to :root
|
else #認證通過無帳號要新增
|
||||||
|
|
||||||
|
@new_user = User.new
|
||||||
|
|
||||||
|
@new_user.user_id = @LDAP_USER
|
||||||
|
@new_user.admin = false
|
||||||
|
@new_user.email = "#{@LDAP_USER}@ydu.edu.tw"
|
||||||
|
@new_user.password = "#{@LDAP_USER}@ydu.edu.tw"
|
||||||
|
@new_user.created_at = DateTime.now
|
||||||
|
@new_user.updated_at = DateTime.now
|
||||||
|
|
||||||
|
@new_user.cache_dept = { "zh_tw" => ( @datas[1] ? @datas[1] : nil ), "en" => ( @datas[1] ? @datas[1] : nil ) }
|
||||||
|
|
||||||
|
@new_user.first_name_translations = {}
|
||||||
|
|
||||||
|
@new_user.first_name_translations["zh_tw"] = ( @datas[1] ? @datas[1] : nil )
|
||||||
|
|
||||||
|
@new_user.first_name_translations["en"] = ( @datas[1] ? @datas[1] : nil )
|
||||||
|
|
||||||
|
# @new_user.first_name = ( @datas[1] ? @datas[1] : nil )
|
||||||
|
|
||||||
|
if @datas[0] == 'P'
|
||||||
|
|
||||||
|
@new_user.last_name_translations = {}
|
||||||
|
|
||||||
|
@new_user.last_name_translations["zh_tw"] = ( @datas[2] ? @datas[2] : nil )
|
||||||
|
|
||||||
|
@new_user.last_name_translations["en"] = ( @datas[2] ? @datas[2] : nil )
|
||||||
|
|
||||||
|
# @new_user.last_name = ( @datas[2] ? @datas[2] : nil )
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
@new_user.save
|
||||||
|
|
||||||
|
resource_name = @new_user.class.to_s.downcase
|
||||||
|
sign_in(resource_name, @new_user)
|
||||||
|
redirect_to after_sign_in_path_for(@new_user)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
||||||
redirect_to :root
|
redirect_to :root
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ module ApplicationHelper
|
|||||||
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
|
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
|
||||||
end
|
end
|
||||||
javascripts << "<script type='text/javascript' src='/assets/lib/jquery.preload-min.js'></script>\n"
|
javascripts << "<script type='text/javascript' src='/assets/lib/jquery.preload-min.js'></script>\n"
|
||||||
# javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
|
javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n"
|
||||||
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
|
javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n"
|
||||||
# javascripts << "<script type='text/javascript' src='/assets/social-share-button.js'></script>\n"
|
# javascripts << "<script type='text/javascript' src='/assets/social-share-button.js'></script>\n"
|
||||||
javascripts << "<script type='text/javascript' src='/assets/lib/social-share-button.js'></script>\n"
|
javascripts << "<script type='text/javascript' src='/assets/lib/social-share-button.js'></script>\n"
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
class GetRemoteAnnouncement
|
|
||||||
@queue = :high
|
|
||||||
|
|
||||||
def self.perform()
|
|
||||||
%x(ruby "#{Rails.root}/lib/remote_announcement.rb")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class='slideshow'>
|
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class='slideshow'>
|
||||||
<% (images = @ad_banner.ad_images).shuffle.each do |ad_image| %>
|
<% (images = @ad_banner.ad_images).shuffle.each do |ad_image| %>
|
||||||
<% if ad_image.display? %>
|
<% if ad_image.display? %>
|
||||||
<img src='<%= ad_image.file %>' alt='<%= ad_image.title || ' ' %>' title='<%= ad_image.title || ' ' %>' time_to_next='<%= @ad_banner.transition_msec %>' link_open='<%= ad_image.link_open %>' link_url='<%= ad_image_link(ad_image) %>' style=' <%= 'cursor:pointer;' if !ad_image_link(ad_image).blank? %>'/>
|
<img src='<%= ad_image.file %><%= "?update=".to_s << Time.now().to_i.to_s %>' alt='<%= ad_image.title || ' ' %>' title='<%= ad_image.title || ' ' %>' time_to_next='<%= @ad_banner.transition_msec %>' link_open='<%= ad_image.link_open %>' link_url='<%= ad_image_link(ad_image) %>' style=' <%= 'cursor:pointer;' if !ad_image_link(ad_image).blank? %>'/>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -13,10 +13,7 @@
|
|||||||
"banner_fx":"<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>",
|
"banner_fx":"<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>",
|
||||||
"banner_pager":".banner_nav-<%= @ad_banner.title.dehumanize %>",
|
"banner_pager":".banner_nav-<%= @ad_banner.title.dehumanize %>",
|
||||||
"image_count":"<%= @ad_banner.ad_images.length %>",
|
"image_count":"<%= @ad_banner.ad_images.length %>",
|
||||||
"image_loaded":0,
|
"image_loaded":0
|
||||||
"time_to_next":<%= @ad_banner.transition_msec %>,
|
|
||||||
"current":0,
|
|
||||||
"best_size": "<%= @ad_banner.best_size %>"
|
|
||||||
};
|
};
|
||||||
banners.push(banner);
|
banners.push(banner);
|
||||||
</script>
|
</script>
|
||||||
@@ -11,8 +11,7 @@ backup_server:
|
|||||||
description: BackupServer and remove old backups
|
description: BackupServer and remove old backups
|
||||||
|
|
||||||
update_tag_cloud:
|
update_tag_cloud:
|
||||||
# cron: 0 0 [0,12] * * *
|
cron: 0 0 [0,12] * * *
|
||||||
cron: 0 0 0 * * *
|
|
||||||
class: UpdateTagCloud
|
class: UpdateTagCloud
|
||||||
args:
|
args:
|
||||||
description: UpdateTagCloud
|
description: UpdateTagCloud
|
||||||
@@ -24,14 +23,7 @@ generate_system_summary:
|
|||||||
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:
|
email_cron:
|
||||||
# cron: 0 0 [10,16,22] * * *
|
cron: 0 0 [10,16,22] * * *
|
||||||
cron: 0 0 10 * * *
|
|
||||||
class: EmailCron
|
class: EmailCron
|
||||||
args:
|
args:
|
||||||
description: EmailCron
|
description: EmailCron
|
||||||
|
|
||||||
get_remote_announcement:
|
|
||||||
cron: */5 * * * * *
|
|
||||||
class: GetRemoteAnnouncement
|
|
||||||
args:
|
|
||||||
description: GetRemoteAnnouncement
|
|
||||||
+1
-2
@@ -2,9 +2,8 @@ Orbit::Application.routes.draw do
|
|||||||
# get "robots.txt" => 'robots#index'
|
# get "robots.txt" => 'robots#index'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
devise_for :users,:controllers => {:sessions => 'sessions'}
|
devise_for :users,:controllers => {:sessions => 'sessions'}
|
||||||
|
|
||||||
devise_for :users do
|
devise_for :users 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
|
||||||
|
|||||||
@@ -1,150 +0,0 @@
|
|||||||
require 'mongo'
|
|
||||||
require 'open-uri'
|
|
||||||
require 'json'
|
|
||||||
require 'date'
|
|
||||||
|
|
||||||
@db = Mongo::Connection.new("localhost", 27017).db("fgu_orbit")
|
|
||||||
@coll_bulletin = @db["bulletins"]
|
|
||||||
@bulletin_links = @db["bulletin_links"]
|
|
||||||
@coll_cat = @db["bulletin_categories"]
|
|
||||||
@updated_bulletins = Array.new
|
|
||||||
|
|
||||||
@categories = @coll_cat.find().to_a.inject({}) do |categories, category|
|
|
||||||
categories[category['key']] = category['_id']
|
|
||||||
categories
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def save_bulletin_links bulletin_id, title, url, c_time
|
|
||||||
|
|
||||||
title = "Link" if title == ''
|
|
||||||
|
|
||||||
bulletin_link = {
|
|
||||||
title: {"zh_tw" => title, "en" => title },
|
|
||||||
url: url,
|
|
||||||
bulletin_id: bulletin_id,
|
|
||||||
created_at: c_time,
|
|
||||||
updated_at: c_time
|
|
||||||
}
|
|
||||||
@bulletin_links.save(bulletin_link)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_remote_bulletins_json(url)
|
|
||||||
data = ""
|
|
||||||
open(url){|f| f.each_line {|line| data << line} }
|
|
||||||
|
|
||||||
bulletins = JSON.parse data
|
|
||||||
|
|
||||||
bulletins.each do |b|
|
|
||||||
|
|
||||||
lang = b[1]=='zh-tw' ? "zh_tw".to_sym : "en".to_sym
|
|
||||||
|
|
||||||
next if b[2]==""
|
|
||||||
next if @categories["#{b[7]}"].nil?
|
|
||||||
|
|
||||||
if b[5]=="" and b[4]!=""
|
|
||||||
b[5]=b[4]
|
|
||||||
b[4]=""
|
|
||||||
end
|
|
||||||
|
|
||||||
bulletin = { _type: "Bulletin",
|
|
||||||
postdate: Time.parse(b[8]),
|
|
||||||
created_at: Time.parse(b[8]),
|
|
||||||
updated_at: Time.parse(b[8]),
|
|
||||||
is_checked: true,
|
|
||||||
is_pending: false,
|
|
||||||
is_rejected: false,
|
|
||||||
bulletin_category_id: @categories["#{b[7]}"],
|
|
||||||
title: {lang => b[2]},
|
|
||||||
subtitle: {lang => b[4]},
|
|
||||||
text: {lang => b[5]},
|
|
||||||
available_for_zh_tw: true,
|
|
||||||
available_for_en: true,
|
|
||||||
create_user_id: "",
|
|
||||||
public: true,
|
|
||||||
sn: b[0],
|
|
||||||
site: b[9],
|
|
||||||
site_id: b[10],
|
|
||||||
is_top: false,
|
|
||||||
is_hot: false,
|
|
||||||
is_hidden: false }
|
|
||||||
|
|
||||||
this_bulletin = @coll_bulletin.find_one(:$and => [{ :sn => bulletin[:sn]},{ :site => bulletin[:site]}])
|
|
||||||
@updated_bulletins.push({:sn => bulletin[:sn],:site => bulletin[:site] })
|
|
||||||
# p bulletin
|
|
||||||
|
|
||||||
unless this_bulletin
|
|
||||||
@coll_bulletin.save(bulletin)
|
|
||||||
|
|
||||||
|
|
||||||
#files
|
|
||||||
(10..14).each do |i|
|
|
||||||
ta = i + 5
|
|
||||||
save_bulletin_links( bulletin[:_id], b[ta], b[i], bulletin[:created_at] ) if b[i] != ''
|
|
||||||
end
|
|
||||||
|
|
||||||
#url
|
|
||||||
save_bulletin_links( bulletin[:_id], '', b[20], bulletin[:created_at] ) if b[20] != ''
|
|
||||||
|
|
||||||
# puts "Inserted "+lang.to_s+" "+bulletin[:title][lang]
|
|
||||||
# p bulletin
|
|
||||||
else
|
|
||||||
@coll_bulletin.update(
|
|
||||||
{"_id"=>this_bulletin["_id"]},
|
|
||||||
{
|
|
||||||
:_type => "Bulletin",
|
|
||||||
:postdate => bulletin[:postdate],
|
|
||||||
:created_at => bulletin[:created_at],
|
|
||||||
:updated_at => bulletin[:updated_at],
|
|
||||||
:is_checked => this_bulletin["is_checked"],
|
|
||||||
:is_pending => this_bulletin["is_pending"],
|
|
||||||
:is_rejected => this_bulletin["is_rejected"],
|
|
||||||
:bulletin_category_id => bulletin[:bulletin_category_id],
|
|
||||||
:title => bulletin[:title],
|
|
||||||
:subtitle => bulletin[:subtitle],
|
|
||||||
:text => bulletin[:text],
|
|
||||||
:available_for_zh_tw => this_bulletin["available_for_zh_tw"],
|
|
||||||
:available_for_en => this_bulletin["available_for_en"],
|
|
||||||
:create_user_id => "",
|
|
||||||
:public => this_bulletin["public"],
|
|
||||||
:sn => bulletin[:sn],
|
|
||||||
:site => bulletin[:site],
|
|
||||||
:site_id => bulletin[:site_id],
|
|
||||||
:is_top => this_bulletin["is_top"],
|
|
||||||
:is_hot => this_bulletin["is_hot"],
|
|
||||||
:is_hidden => this_bulletin["is_hidden"]
|
|
||||||
})
|
|
||||||
|
|
||||||
@bulletin_links.remove(bulletin_id: BSON::ObjectId(this_bulletin["_id"].to_s) )
|
|
||||||
|
|
||||||
#files
|
|
||||||
(10..14).each do |i|
|
|
||||||
ta = i + 5
|
|
||||||
save_bulletin_links( this_bulletin["_id"], b[ta], b[i], this_bulletin["created_at"] ) if b[i] != ''
|
|
||||||
end
|
|
||||||
|
|
||||||
#url
|
|
||||||
save_bulletin_links( this_bulletin["_id"], '', b[20], bulletin[:created_at] ) if b[20] != ''
|
|
||||||
|
|
||||||
# puts "Updated "+lang.to_s+" "+bulletin[:title][lang]
|
|
||||||
# p this_bulletin["_id"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
get_remote_bulletins_json("http://president.fgu.edu.tw/remote_annoucement/get_news2.php")
|
|
||||||
get_remote_bulletins_json("http://car.fgu.edu.tw/remote_annoucement/get_news2.php")
|
|
||||||
|
|
||||||
# Delete bulletins that had been removed form remote sites
|
|
||||||
# Find all remote bulletins on server
|
|
||||||
local_bulletins = @coll_bulletin.find({ site: { :$exists => true } })
|
|
||||||
|
|
||||||
# Check if each remote bulletins on server exist in the updated bulletins
|
|
||||||
local_bulletins.each do |local_bulletin|
|
|
||||||
result = @updated_bulletins.select {|remote_bulletin| remote_bulletin[:sn] == local_bulletin["sn"] and remote_bulletin[:site] == local_bulletin["site"]}
|
|
||||||
if result.length == 0
|
|
||||||
@coll_bulletin.remove(:$and => [{ :sn => local_bulletin["sn"]},{ :site => local_bulletin["site"]}])
|
|
||||||
p "Delete: "+local_bulletin["site"]+"-"+local_bulletin["sn"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
+7
-45
@@ -1,7 +1,5 @@
|
|||||||
var banners = [];
|
var banners = [];
|
||||||
var banner_index = 0;
|
var banner_index = 0;
|
||||||
$q = jQuery;
|
|
||||||
$q.getScript('/static/jquery.cycle.all.latest.js');
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$.each($(".dymanic_load"),function(){
|
$.each($(".dymanic_load"),function(){
|
||||||
@@ -38,58 +36,22 @@ function ajax_load_proc(wapper,url,isBanner){
|
|||||||
|
|
||||||
function BannerCycle(banner_index){
|
function BannerCycle(banner_index){
|
||||||
var banner = banners[banner_index];
|
var banner = banners[banner_index];
|
||||||
if (banner.image_loaded==$(banner.banner_name+" img").length){
|
if (!!$.prototype.cycle && (banner.image_loaded==$(banner.banner_name+" img").length)){
|
||||||
if(banner.banner_name=="#slideshow-banner"){
|
$(banner.banner_name).ready(function() {
|
||||||
$q(banner.banner_name).cycle({
|
$(banner.banner_name).cycle({
|
||||||
delay: -1000,
|
delay: -1000,
|
||||||
fx: banner.banner_fx,
|
fx: banner.banner_fx,
|
||||||
timeout: banner.time_to_next,
|
timeoutFn: getTimeout,
|
||||||
pager: banner.banner_pager,
|
pager: banner.banner_pager,
|
||||||
pagerAnchorBuilder: function(idx, slide) { return "<li><a href='#'></a></li>"; }
|
pagerAnchorBuilder: function(idx, slide) { return "<li><a href='#'></a></li>"; }
|
||||||
});
|
});
|
||||||
}else{
|
});
|
||||||
var width = banner.best_size.split(" x ")[0];
|
|
||||||
var height = banner.best_size.split(" x ")[1];
|
|
||||||
$(banner.banner_name).css( "width", width);
|
|
||||||
$(banner.banner_name).css( "height", height);
|
|
||||||
$(banner.banner_name).css( "display", "block");
|
|
||||||
$(banner.banner_name).css( "overflow", "hidden");
|
|
||||||
$(banner.banner_name+" > img").each(function(){
|
|
||||||
$( this ).css( "position", "absolute" );
|
|
||||||
$( this ).css( "top", "0" );
|
|
||||||
$( this ).css( "left", "0" );
|
|
||||||
$( this ).css( "display", "block" );
|
|
||||||
});
|
|
||||||
if($(banner.banner_name+" > img").length>1) OrbitCycle(banner_index);
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
|
if(!$.prototype.cycle) $.getScript('/static/jquery.cycle.all.latest.js');
|
||||||
setTimeout("BannerCycle("+banner_index+")",500);
|
setTimeout("BannerCycle("+banner_index+")",500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function OrbitCycle(banner_index){
|
|
||||||
var banner = banners[banner_index];
|
|
||||||
var index = 0;
|
|
||||||
|
|
||||||
$(banner.banner_name+" > img").each(function(){
|
|
||||||
if(index==banner.current){
|
|
||||||
$( this ).css( "z-index", $(banner.banner_name+" img").length+1);
|
|
||||||
$(this).fadeTo( "slow" , 1);
|
|
||||||
}else{
|
|
||||||
$( this ).css( "z-index", index);
|
|
||||||
$(this).fadeTo( "slow" , 0);
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
});
|
|
||||||
if((banner.current+1)<$(banner.banner_name+" img").length){
|
|
||||||
banner.current++;
|
|
||||||
}else{
|
|
||||||
banner.current=0;
|
|
||||||
}
|
|
||||||
// console.log("OrbitCycle: "+banner_index);
|
|
||||||
setTimeout("OrbitCycle("+banner_index+")",banner.time_to_next);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ad Banner FX code [start]
|
// Ad Banner FX code [start]
|
||||||
function getTimeout() {
|
function getTimeout() {
|
||||||
return $(this).attr('time_to_next');
|
return $(this).attr('time_to_next');
|
||||||
@@ -111,4 +73,4 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
// Ad Banner FX code [end]
|
// Ad Banner FX code [end]
|
||||||
+10
-5
@@ -95,7 +95,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
# GET /bulletins/1/edit
|
# GET /bulletins/1/edit
|
||||||
def edit
|
def edit
|
||||||
@bulletin = Bulletin.find(params[:id])
|
@bulletin = Bulletin.find(params[:id])
|
||||||
if !current_user.admin? && (@bulletin.is_rejected? || @bulletin.is_checked?)
|
# if !current_user.admin? && (@bulletin.is_rejected? || @bulletin.is_checked?)
|
||||||
|
if (@bulletin.create_user_id != current_or_guest_user.id) and !is_manager?
|
||||||
redirect_to :action => :index
|
redirect_to :action => :index
|
||||||
else
|
else
|
||||||
# @summary_variable = @bulletin.summary_variable
|
# @summary_variable = @bulletin.summary_variable
|
||||||
@@ -137,11 +138,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
|
|
||||||
@bulletin.create_user_id = current_user.id
|
@bulletin.create_user_id = current_user.id
|
||||||
@bulletin.update_user_id = current_user.id
|
@bulletin.update_user_id = current_user.id
|
||||||
if(is_manager? || is_admin?)
|
# if(is_manager? || is_admin?)
|
||||||
@bulletin.is_checked = true
|
@bulletin.is_checked = true
|
||||||
@bulletin.is_rejected = false
|
@bulletin.is_rejected = false
|
||||||
@bulletin.de_pending
|
@bulletin.de_pending
|
||||||
end
|
# end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @bulletin.save
|
if @bulletin.save
|
||||||
@@ -221,11 +222,11 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
||||||
if @bulletin.update_attributes(params[:bulletin])
|
if @bulletin.update_attributes(params[:bulletin])
|
||||||
if(is_manager? || is_admin?)
|
# if(is_manager? || is_admin?)
|
||||||
@bulletin.is_checked = true
|
@bulletin.is_checked = true
|
||||||
@bulletin.is_rejected = false
|
@bulletin.is_rejected = false
|
||||||
@bulletin.de_pending!
|
@bulletin.de_pending!
|
||||||
end
|
# end
|
||||||
# if (params[:bulletin][:is_checked] == "false")
|
# if (params[:bulletin][:is_checked] == "false")
|
||||||
# @bulletin.is_rejected = true
|
# @bulletin.is_rejected = true
|
||||||
# @bulletin.save!
|
# @bulletin.save!
|
||||||
@@ -251,7 +252,9 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
# DELETE /bulletins/1
|
# DELETE /bulletins/1
|
||||||
# DELETE /bulletins/1.xml
|
# DELETE /bulletins/1.xml
|
||||||
def destroy
|
def destroy
|
||||||
|
|
||||||
@bulletin = Bulletin.find(params[:id])
|
@bulletin = Bulletin.find(params[:id])
|
||||||
|
|
||||||
# @bulletin.bulletin_files.destroy
|
# @bulletin.bulletin_files.destroy
|
||||||
@bulletin.destroy
|
@bulletin.destroy
|
||||||
|
|
||||||
@@ -261,6 +264,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||||||
# format.xml { head :ok }
|
# format.xml { head :ok }
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# def top_edit
|
# def top_edit
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class Bulletin
|
|||||||
end
|
end
|
||||||
|
|
||||||
def share_item
|
def share_item
|
||||||
Item.first(conditions:{name: 'news'})
|
Item.first(conditions:{name: 'announcement'})
|
||||||
end
|
end
|
||||||
|
|
||||||
def proc_check(check,not_pass_info = "")
|
def proc_check(check,not_pass_info = "")
|
||||||
|
|||||||
+2
-2
@@ -34,7 +34,7 @@
|
|||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills hide">
|
<ul class="nav nav-pills hide">
|
||||||
<% if (bulletin.create_user_id == current_or_guest_user.id) || is_manager? %>
|
<% if (bulletin.create_user_id == current_or_guest_user.id) || is_manager? %>
|
||||||
<% if current_or_guest_user.admin? || (!bulletin.is_rejected? && !bulletin.is_checked?) %>
|
<%# if current_or_guest_user.admin? || (!bulletin.is_rejected? && !bulletin.is_checked?) %>
|
||||||
<li><%= link_to t(:edit), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li>
|
<li><%= link_to t(:edit), edit_panel_announcement_back_end_bulletin_path(bulletin) %></li>
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a>
|
<a href="#" data-toggle="dropdown" class="dropdown-toggle"><%= t(:quick_edit) %><b class="caret"></b></a>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
<li><%#= link_to t(:file_), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li>
|
<li><%#= link_to t(:file_), load_quick_edit_panel_announcement_back_end_bulletin_path(bulletin, :type => 'files'), :remote => true %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<%# end %>
|
||||||
|
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% if show_delete_link(bulletin) %>
|
<% if show_delete_link(bulletin) %>
|
||||||
|
|||||||
Vendored
+1
-2
@@ -3,7 +3,6 @@
|
|||||||
<div class="info">
|
<div class="info">
|
||||||
<div class="info1">
|
<div class="info1">
|
||||||
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
|
<span class="pull-right"><%= dislpay_view_count(@bulletin) %></span>
|
||||||
<span class="pull-right"><%= share_links(@bulletin, 'announcement') %></span>
|
|
||||||
<span class="date"><%= display_date_time(@bulletin.postdate) %></span>
|
<span class="date"><%= display_date_time(@bulletin.postdate) %></span>
|
||||||
<% unit = @bulletin.cache_dept[I18n.locale.to_s] rescue nil %>
|
<% unit = @bulletin.cache_dept[I18n.locale.to_s] rescue nil %>
|
||||||
<span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></span>
|
<span><%= link_to unit,panel_announcement_front_end_index_bulletins_by_unit_path(:name=>unit) unless unit.blank? %></span>
|
||||||
@@ -39,4 +38,4 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%= share_links(@bulletin, 'announcement') %>
|
||||||
Vendored
+11
-8
@@ -3,9 +3,10 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
|||||||
|
|
||||||
# before_filter :force_order_for_user, :except => [:index,:get_album_json,:get_imgs_json]
|
# before_filter :force_order_for_user, :except => [:index,:get_album_json,:get_imgs_json]
|
||||||
|
|
||||||
before_filter :force_order_for_visitor,:only=>[:index,:show,:get_album_json,:get_imgs_json,:get_albums,:imgs]
|
before_filter :force_order_for_visitor,:only=>[:index,:show,:get_imgs_json,:get_albums,:imgs]
|
||||||
before_filter :force_order_for_user,:except => [:index,:show,:get_album_json,:get_imgs_json,:get_albums,:imgs]
|
before_filter :force_order_for_user,:except => [:index,:show,:get_album_json,:get_albums,:imgs,:get_image_json]
|
||||||
before_filter :for_app_sub_manager,:except => [:index,:show,:get_album_json,:get_imgs_json,:get_albums,:imgs]
|
before_filter :for_app_sub_manager,:except => [:index,:show,:get_album_json,:get_albums,:imgs,:get_image_json]
|
||||||
|
|
||||||
# before_filter lambda
|
# before_filter lambda
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@@ -126,17 +127,18 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
|||||||
album_cover_file: "http://#{request.host_with_port}#{album.cover_path}",
|
album_cover_file: "http://#{request.host_with_port}#{album.cover_path}",
|
||||||
album_name: album.name,
|
album_name: album.name,
|
||||||
album_tag_names: tag_names,
|
album_tag_names: tag_names,
|
||||||
album_link:"http://#{request.host_with_port}#{panel_gallery_back_end_album_get_imgs_json_path(album)}"
|
album_link:"http://#{request.host_with_port}/panel/gallery/back_end/albums/get_image_json?album_id=#{album.id}"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
render :json=>JSON.pretty_generate(output)
|
render :json=>JSON.pretty_generate(output)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_imgs_json
|
def get_image_json
|
||||||
album = GalleryAlbum.find(params[:album_id])
|
album = GalleryAlbum.where(:_id => params[:album_id])
|
||||||
images = album.gallery_images.all
|
if album.first.present?
|
||||||
output = Array.new
|
images = album.first.gallery_images.all
|
||||||
|
output = Array.new
|
||||||
|
|
||||||
images.each do |image|
|
images.each do |image|
|
||||||
tags = Tag.find(image.tagged_ids).map{|t| t.name}
|
tags = Tag.find(image.tagged_ids).map{|t| t.name}
|
||||||
@@ -150,6 +152,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
|||||||
end
|
end
|
||||||
|
|
||||||
render :json=>JSON.pretty_generate(output)
|
render :json=>JSON.pretty_generate(output)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def imgs
|
def imgs
|
||||||
|
|||||||
+2
-1
@@ -7,13 +7,14 @@ Rails.application.routes.draw do
|
|||||||
match "upload_image" => "albums#upload_image"
|
match "upload_image" => "albums#upload_image"
|
||||||
match "save_tags" => "tags#save_tags"
|
match "save_tags" => "tags#save_tags"
|
||||||
match "albums/save_tags" => "tags#save_tags"
|
match "albums/save_tags" => "tags#save_tags"
|
||||||
|
|
||||||
|
match "albums/get_image_json" => "albums#get_image_json"
|
||||||
|
|
||||||
resources :albums do
|
resources :albums do
|
||||||
match "set_cover" => "albums#set_cover"
|
match "set_cover" => "albums#set_cover"
|
||||||
match "imgs" => "albums#imgs"
|
match "imgs" => "albums#imgs"
|
||||||
match "upload_panel" => "albums#upload_panel"
|
match "upload_panel" => "albums#upload_panel"
|
||||||
match "images_tags" => "albums#images_tags"
|
match "images_tags" => "albums#images_tags"
|
||||||
match "get_imgs_json" => "albums#get_imgs_json"
|
|
||||||
|
|
||||||
collection do
|
collection do
|
||||||
get "get_album_json"
|
get "get_album_json"
|
||||||
|
|||||||
Reference in new issue
Block a user