Compare commits

..
28 Commits
Author SHA1 Message Date
Manson Wang da874c582a Change annoucement share button position 2013-11-21 17:30:08 +08:00
Manson Wang 9837dd8f69 Fix FB share button link 2013-11-19 15:21:14 +08:00
Manson Wang b5d1809523 Revert "Fix FB share button link"
This reverts commit 91022f6010.
2013-11-19 11:49:40 +08:00
Manson Wang 5437848ac4 Revert "Fix FB share button link"
This reverts commit 320c6f6736.
2013-11-19 11:49:24 +08:00
Manson Wang 320c6f6736 Fix FB share button link 2013-11-14 14:58:46 +08:00
Manson Wang 91022f6010 Fix FB share button link 2013-11-14 13:57:46 +08:00
Manson Wang 70c3afed01 Fix annoucement FB share link 2013-11-14 11:40:28 +08:00
Manson Wang 946dc0621b Update Remote annoucement, annoucement will be deleted when remote site disabled or deleted it 2013-10-18 17:51:15 +08:00
Manson Wang 47894ab6f3 Fix Ad_Banner z-index 2013-10-18 15:54:50 +08:00
chris befb511492 Domain absolute url for tinymce files 2013-10-17 17:46:28 +08:00
Manson Wang 56ef57cdd8 Ad_Banner fix for FGU 2013-10-14 19:07:32 +08:00
Manson Wang 3b0dc9cd50 Fix Ad_Banner Image loading bug 2013-10-14 09:52:14 +08:00
Spen 35733da7ba FGU remote_annoucement url and files fix 2013-10-04 10:59:51 +08:00
Manson Wang 42decd3ff4 Ad_banner fixed 2013-10-02 15:55:52 +08:00
Manson Wang 8200baddbb Fix bugs for FGU remote_annoucement
Added Subtitle support
Handle when there is content in subtitle but no content in text field
2013-10-02 11:12:00 +08:00
Manson Wang f715924929 Fix bugs for FGU remote_annoucement
Handle exception when category is missing
2013-10-02 10:27:15 +08:00
Manson Wang f851ad0e27 Fix bugs for FGU remote_annoucement
Added english support
Skip data with blank title
2013-10-02 09:45:48 +08:00
Manson Wang e2d09c7379 Fix Ad_Banner Loading Problem (Not complete) 2013-10-01 09:25:38 +08:00
harrybomrah e5ea34d088 fixed external links opening in different window 2013-09-30 13:40:19 +08:00
Manson Wang 5944a7fcb6 FGU Logo 2013-09-30 13:39:58 +08:00
Manson Wang 341dc67a5f Fix path of jquery.cycle.all.latest.js 2013-09-26 15:58:06 +08:00
Manson Wang 25c1f191b2 Added read rss2 annoucement feature 2013-09-26 13:40:35 +08:00
Manson Wang 926102bf72 Fix module web_resource front_end display skip blank title 2013-09-25 19:21:42 +08:00
harrybomrah 1b5f6a79c7 widget link fixed on homepage 2013-09-25 17:50:37 +08:00
harrybomrah eb8495bcbd widget code rewritten for gallery master branch 2013-09-25 16:39:00 +08:00
harrybomrah 5899a0f0d9 ad_banner banner load fixed for test site 2013-09-25 16:38:48 +08:00
chris 042acadbdb Fix parser_front_end.rb for page content 2013-09-17 18:00:30 +08:00
Spen f6a1070b78 fgu login sso 2013-09-13 16:40:28 +08:00
20 changed files with 276 additions and 125 deletions

No files matched your search

-2
View File
@@ -1,8 +1,6 @@
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: 34 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

@@ -8,7 +8,9 @@ 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")
@@ -17,7 +19,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?t=#{title}&u=#{fb_url}") SocialShareButton.openUrl("http://www.facebook.com/sharer.php?s=100&p[title]=#{title}&p[url]=#{fb_url}&p[images][0]=#{img}")
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,6 +15,11 @@ 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, #F7F1E0, #E0C77E); background-image: -webkit-linear-gradient(top, #A02C5E, #300E1D);
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8),inset 0 1px 0 #F6EAA5,0 -1px 0 #F7F1E0 inset; -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;
} }
.header h1.ui-title { .header h1.ui-title {
margin: 8px 30%; margin: 8px 30%;
@@ -116,14 +116,13 @@ div[data-role="page"] {
margin-left: -15px; margin-left: -15px;
font-size: 20px; font-size: 20px;
/*color: #727272;*/ /*color: #727272;*/
color: #FCF2D2; color: #C57CB3;
/*background-color: #252525;*/ /*background-color: #252525;*/
background-color: #E4CF91; background-color: #421528;
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;
@@ -136,14 +135,14 @@ div[data-role="page"] {
background-image: none; background-image: none;
} }
.header .ui-btn-up-a { .header .ui-btn-up-a {
border: 1px solid #949494; border: 1px solid #471334;
background-color: #0C4C64; background-color: #600C64;
background-image: -webkit-gradient(linear, left top, left bottom, from( #ECE0BC ), to( #BD9932 )); background-image: -webkit-gradient(linear, left top, left bottom, from( #910D86 ), to( #490E4B ));
background-image: -webkit-linear-gradient( #ECE0BC , #BD9932 ); background-image: -webkit-linear-gradient( #910D86 , #490E4B );
background-image: -moz-linear-gradient( #ECE0BC , #BD9932 ); background-image: -moz-linear-gradient( #910D86 , #490E4B );
background-image: -ms-linear-gradient( #ECE0BC , #BD9932 ); background-image: -ms-linear-gradient( #910D86 , #490E4B );
background-image: -o-linear-gradient( #ECE0BC , #BD9932 ); background-image: -o-linear-gradient( #910D86 , #490E4B );
background-image: linear-gradient( #ECE0BC , #BD9932 ); background-image: linear-gradient( #910D86 , #490E4B );
} }
.header h1 img { .header h1 img {
height: 30px; height: 30px;
+16 -68
View File
@@ -3,19 +3,16 @@
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 'savon' require 'net/http'
require 'uri'
def create def create
@user_id = params[:user][:user_id]
@SYS_USER = "rulingcom" if @user_id == '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: @user_id})
resource = User.first(conditions:{user_id: @LDAP_USER})
if !resource.blank? if !resource.blank?
@@ -32,72 +29,23 @@ class SessionsController < Devise::SessionsController
else else
client = Savon.client(wsdl: 'http://ap.ydu.edu.tw/LDAP_WS/RulingcomDataService.asmx?wsdl',filters: [:SYS_USER, :SYS_PASS, :LDAP_USER, :LDAP_PASS]) uri = URI('http://www.fgu.edu.tw/cgi-bin/check_intrant.pl')
response = Net::HTTP.post_form(uri, 'username' => @user_id, 'password' => params[:user][:password])
@response = response.body
client.operations if @response.include?("username=#{@user_id}")
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] resource = User.first(conditions:{user_id: @user_id})
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
resource_name = resource.class.to_s.downcase sign_in(resource_name, resource)
sign_in(resource_name, resource) redirect_to after_sign_in_path_for(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."
else #認證通過無帳號要新增 redirect_to :root
@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
+1 -1
View File
@@ -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"
+7
View File
@@ -0,0 +1,7 @@
class GetRemoteAnnouncement
@queue = :high
def self.perform()
%x(ruby "#{Rails.root}/lib/remote_announcement.rb")
end
end
+6 -3
View File
@@ -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 %><%= "?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? %>'/> <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? %>'/>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
@@ -13,7 +13,10 @@
"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>
+10 -2
View File
@@ -11,7 +11,8 @@ 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
@@ -23,7 +24,14 @@ 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
+2 -1
View File
@@ -2,8 +2,9 @@ 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
+150
View File
@@ -0,0 +1,150 @@
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
+45 -7
View File
@@ -1,5 +1,7 @@
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(){
@@ -36,22 +38,58 @@ 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 (!!$.prototype.cycle && (banner.image_loaded==$(banner.banner_name+" img").length)){ if (banner.image_loaded==$(banner.banner_name+" img").length){
$(banner.banner_name).ready(function() { if(banner.banner_name=="#slideshow-banner"){
$(banner.banner_name).cycle({ $q(banner.banner_name).cycle({
delay: -1000, delay: -1000,
fx: banner.banner_fx, fx: banner.banner_fx,
timeoutFn: getTimeout, timeout: banner.time_to_next,
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');
@@ -73,4 +111,4 @@ $(document).ready(function() {
} }
}) })
}); });
// Ad Banner FX code [end] // Ad Banner FX code [end]
@@ -95,8 +95,7 @@ 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
@@ -138,11 +137,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
@@ -222,11 +221,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!
@@ -252,9 +251,7 @@ 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
@@ -264,8 +261,6 @@ 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: 'announcement'}) Item.first(conditions:{name: 'news'})
end end
def proc_check(check,not_pass_info = "") def proc_check(check,not_pass_info = "")
@@ -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) %>
@@ -3,6 +3,7 @@
<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>
@@ -38,4 +39,4 @@
<% end %> <% end %>
</div> </div>
<%= share_links(@bulletin, 'announcement') %>
@@ -3,10 +3,9 @@ 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_imgs_json,:get_albums,:imgs] before_filter :force_order_for_visitor,:only=>[: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 :force_order_for_user,: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 :for_app_sub_manager,:except => [:index,:show,:get_album_json,:get_imgs_json,:get_albums,:imgs]
# before_filter lambda # before_filter lambda
def index def index
@@ -127,18 +126,17 @@ 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/albums/get_image_json?album_id=#{album.id}" album_link:"http://#{request.host_with_port}#{panel_gallery_back_end_album_get_imgs_json_path(album)}"
} }
end end
render :json=>JSON.pretty_generate(output) render :json=>JSON.pretty_generate(output)
end end
def get_image_json def get_imgs_json
album = GalleryAlbum.where(:_id => params[:album_id]) album = GalleryAlbum.find(params[:album_id])
if album.first.present? images = album.gallery_images.all
images = album.first.gallery_images.all output = Array.new
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}
@@ -152,7 +150,6 @@ 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
+1 -2
View File
@@ -7,14 +7,13 @@ 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"