Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18b36df573 | ||
|
|
09bb318d6a | ||
|
|
d766eea9f4 |
No files matched your search
@@ -4,6 +4,8 @@
|
||||
.rvmrc
|
||||
|
||||
Gemfile.lock
|
||||
Procfile
|
||||
log/*
|
||||
|
||||
db/*.sqlite3
|
||||
log/*.log
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 3.6 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'))
|
||||
img = encodeURIComponent($(el).parent().data("img"))
|
||||
fb_url = encodeURIComponent($(el).parent().data("fb_url"))
|
||||
summary = encodeURIComponent($(el).parent().data("summary"))
|
||||
url = encodeURIComponent(location.href)
|
||||
console.log($(el).parent().data())
|
||||
switch site
|
||||
when "weibo"
|
||||
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"
|
||||
SocialShareButton.openUrl("http://www.douban.com/recommend/?url=#{url}&title=#{title}&image=#{img}")
|
||||
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"
|
||||
SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}&title=#{title}&pics=#{img}")
|
||||
when "tqq"
|
||||
|
||||
@@ -15,11 +15,6 @@ function load_tinymce() {
|
||||
theme_advanced_statusbar_location : "bottom",
|
||||
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 : "o2k7",
|
||||
skin_variant : "silver",
|
||||
|
||||
+13
-16
@@ -100,9 +100,8 @@ div[data-role="page"] {
|
||||
padding: 0;
|
||||
border: none;
|
||||
z-index: 50;
|
||||
/*background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c));*/
|
||||
background-image: -webkit-linear-gradient(top, #A02C5E, #300E1D);
|
||||
-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;
|
||||
background-image: -webkit-linear-gradient(top, #e35479, #cb2d56);
|
||||
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.8),inset 0 1px 0 #7f95a5,0 -1px 0 #1f2024 inset;
|
||||
}
|
||||
.header h1.ui-title {
|
||||
margin: 8px 30%;
|
||||
@@ -115,14 +114,12 @@ div[data-role="page"] {
|
||||
left: 50%;
|
||||
margin-left: -15px;
|
||||
font-size: 20px;
|
||||
/*color: #727272;*/
|
||||
color: #C57CB3;
|
||||
/*background-color: #252525;*/
|
||||
background-color: #421528;
|
||||
color: #ffc8e7;
|
||||
background-color: #cb2d56;
|
||||
border-radius: 0 0 5px 5px;
|
||||
height: 15px;
|
||||
line-height: 16px;
|
||||
box-shadow: 1px 2px 2px rgba(0, 0, 0, .5);
|
||||
box-shadow: 1px 2px 2px rgba(0,0,0,0.5);
|
||||
}
|
||||
.header .language .ui-btn-text {
|
||||
left: 0;
|
||||
@@ -135,14 +132,14 @@ div[data-role="page"] {
|
||||
background-image: none;
|
||||
}
|
||||
.header .ui-btn-up-a {
|
||||
border: 1px solid #471334;
|
||||
background-color: #600C64;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from( #910D86 ), to( #490E4B ));
|
||||
background-image: -webkit-linear-gradient( #910D86 , #490E4B );
|
||||
background-image: -moz-linear-gradient( #910D86 , #490E4B );
|
||||
background-image: -ms-linear-gradient( #910D86 , #490E4B );
|
||||
background-image: -o-linear-gradient( #910D86 , #490E4B );
|
||||
background-image: linear-gradient( #910D86 , #490E4B );
|
||||
border: 1px solid #a21050;
|
||||
background-color: #cb2d56;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#e35479), to(#cb2d56));
|
||||
background-image: -webkit-linear-gradient(#e35479, #cb2d56);
|
||||
background-image: -moz-linear-gradient(#e35479, #cb2d56);
|
||||
background-image: -ms-linear-gradient(#e35479, #cb2d56);
|
||||
background-image: -o-linear-gradient(#e35479, #cb2d56);
|
||||
background-image: linear-gradient(#e35479, #cb2d56);
|
||||
}
|
||||
.header h1 img {
|
||||
height: 30px;
|
||||
@@ -73,7 +73,7 @@ class FrontController < ApplicationController
|
||||
res << " active" if (current_page.id.eql?(page.id) || current_page.descendant_of?(page))
|
||||
res << "'>"
|
||||
root = "/"
|
||||
res << "<a href='#{(page.class.to_s.eql?('Page') ? root + page.path : page.url)}' target=#{(page.class.to_s.eql?('Page') ? '_self' : '_blank')} ><span>#{page.title}</span></a>"
|
||||
res << "<a href='#{(page.class.to_s.eql?('Page') ? root + page.path : page.url)}'><span>#{page.title}</span></a>"
|
||||
if page.visible_children.size > 0 && current < menu.levels
|
||||
res << "<span class='dot'></span>"
|
||||
res << menu_level(page, current_page, current + 1, menu)
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
# encoding: utf-8
|
||||
|
||||
class SessionsController < Devise::SessionsController
|
||||
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
||||
|
||||
require 'net/http'
|
||||
require 'uri'
|
||||
|
||||
def create
|
||||
|
||||
@user_id = params[:user][:user_id]
|
||||
|
||||
if @user_id == 'rulingcom'
|
||||
|
||||
resource = User.first(conditions:{user_id: @user_id})
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
if @response.include?("username=#{@user_id}")
|
||||
|
||||
resource = User.first(conditions:{user_id: @user_id})
|
||||
|
||||
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
|
||||
@@ -220,7 +220,7 @@ module ApplicationHelper
|
||||
javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n"
|
||||
end
|
||||
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='/assets/social-share-button.js'></script>\n"
|
||||
javascripts << "<script type='text/javascript' src='/assets/lib/social-share-button.js'></script>\n"
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class GetAnnouncementFromRss
|
||||
@queue = :high
|
||||
|
||||
def self.perform()
|
||||
%x(ruby "#{Rails.root}/lib/rss_ntu_job.rb")
|
||||
end
|
||||
end
|
||||
@@ -1,7 +0,0 @@
|
||||
class GetRemoteAnnouncement
|
||||
@queue = :high
|
||||
|
||||
def self.perform()
|
||||
%x(ruby "#{Rails.root}/lib/remote_announcement.rb")
|
||||
end
|
||||
end
|
||||
@@ -17,4 +17,4 @@
|
||||
<%= render :partial=> "widget_ext_options" %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -1,3 +1,19 @@
|
||||
<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>
|
||||
<script type='text/javascript'>
|
||||
jQuery(function( $ ){
|
||||
|
||||
$('#slideshow-<%= @ad_banner.title.dehumanize %>').cycle({
|
||||
delay: -1000,
|
||||
fx: "<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>",
|
||||
timeoutFn: getTimeout,
|
||||
pager: '.banner_nav-<%= @ad_banner.title.dehumanize %>',
|
||||
pagerAnchorBuilder: function(idx, slide) {
|
||||
return "<li><a href='#'></a></li>";
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div style='position:relative'>
|
||||
<ul id='banner_nav' class='clear banner_nav-<%= @ad_banner.title.dehumanize %>'></ul>
|
||||
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class='slideshow'>
|
||||
@@ -7,16 +23,4 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type='text/javascript'>
|
||||
var banner = {"banner_name":"#slideshow-<%= @ad_banner.title.dehumanize %>",
|
||||
"banner_fx":"<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>",
|
||||
"banner_pager":".banner_nav-<%= @ad_banner.title.dehumanize %>",
|
||||
"image_count":"<%= @ad_banner.ad_images.length %>",
|
||||
"image_loaded":0,
|
||||
"time_to_next":<%= @ad_banner.transition_msec %>,
|
||||
"current":0,
|
||||
"best_size": "<%= @ad_banner.best_size %>"
|
||||
};
|
||||
banners.push(banner);
|
||||
</script>
|
||||
</div>
|
||||
@@ -1,6 +1,17 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html class="<%= I18n.locale.to_s %>">
|
||||
<head>
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-39393439-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
<meta charset="utf-8">
|
||||
<%= page_title(@item).html_safe %>
|
||||
<link rel="shortcut icon" href="<%= asset_path "ncculogo.ico" %>">
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
<% end %>
|
||||
|
||||
<ul>
|
||||
<li>總機電話:<a href="tel:+886229393091">02-29393091</a></li>
|
||||
<li>傳真:02-29379611</li>
|
||||
<li>緊急重大事件通聯窗口:校內分機 66119、66110</li>
|
||||
<li>總值日室:<a href="tel:+88229387132">02-29387132</a></li>
|
||||
<li>駐警衛室:<a href="tel:+88229387129">02-29387129</a></li>
|
||||
<li>學務處電話:<a href="tel:+886-2-3366-2995~2997">+886-2-3366-2995~2997</a></li>
|
||||
<li>學務處傳真:+886-2-2391-9095</li>
|
||||
</ul>
|
||||
@@ -5,6 +5,6 @@
|
||||
<div id='map_canvas'></div>
|
||||
|
||||
<script type='text/javascript'>
|
||||
var $map_center = "24.987449, 121.576117"
|
||||
var $map_center = "25.015205, 121.535491"
|
||||
var $map_zoom = 17
|
||||
</script>
|
||||
@@ -4,10 +4,10 @@ en:
|
||||
bulletin: Bulletin
|
||||
contact: Contact
|
||||
copyright: Copyright
|
||||
copyright_text: Thisi University © All RIGHTS RESERVED.
|
||||
copyright_text: Copyright© 2008 National Taiwan University ALL RIGHTS RESERVED
|
||||
copyright_orbit: Powered by RulingDigital
|
||||
home: Home
|
||||
language: Language
|
||||
location: Location
|
||||
location_description: '<h3>This University</h3>No.101,Sec. 2, Jiafeng S Road, Zhubei City, Hsinchu County 302, Taiwan'
|
||||
location_description: '<h3>National Taiwan University</h3>No. 1, Sec. 4, Roosevelt Road, Taipei, 10617 Taiwan (R.O.C)'
|
||||
page: Page
|
||||
@@ -4,10 +4,10 @@ zh_tw:
|
||||
bulletin: 公告
|
||||
contact: 聯絡資訊
|
||||
copyright: 著作權宣告
|
||||
copyright_text: 本網站著作權屬於本大學。
|
||||
copyright_text: 本網站著作權屬於國立臺灣大學 學生事務處
|
||||
copyright_orbit: 銳綸數位建置
|
||||
home: 首頁
|
||||
language: 語言
|
||||
location: 地理位置
|
||||
location_description: '<h3>本大學</h3>302新竹縣竹北市嘉豐南路二段101號'
|
||||
location_description: '<h3>臺灣大學總務處 版權所有</h3>10617 臺北市大安區羅斯福路四段一號'
|
||||
page: 頁面
|
||||
@@ -0,0 +1,4 @@
|
||||
en:
|
||||
|
||||
ntu:
|
||||
rss_origin: Back to NTU Announcements
|
||||
@@ -0,0 +1,4 @@
|
||||
zh_tw:
|
||||
|
||||
ntu:
|
||||
rss_origin: 回臺大校園公佈欄
|
||||
@@ -11,8 +11,7 @@ backup_server:
|
||||
description: BackupServer and remove old backups
|
||||
|
||||
update_tag_cloud:
|
||||
# cron: 0 0 [0,12] * * *
|
||||
cron: 0 0 0 * * *
|
||||
cron: 0 30 2 * * *
|
||||
class: UpdateTagCloud
|
||||
args:
|
||||
description: UpdateTagCloud
|
||||
@@ -24,14 +23,13 @@ generate_system_summary:
|
||||
description: Generate the system status such as disk free space,package version list for showing at site tab
|
||||
|
||||
email_cron:
|
||||
# cron: 0 0 [10,16,22] * * *
|
||||
cron: 0 0 10 * * *
|
||||
cron: 0 0 [10,16,22] * * *
|
||||
class: EmailCron
|
||||
args:
|
||||
description: EmailCron
|
||||
|
||||
get_remote_announcement:
|
||||
cron: */5 * * * * *
|
||||
class: GetRemoteAnnouncement
|
||||
get_announcement_from_rss:
|
||||
cron: 0 0 [2,12] * * *
|
||||
class: GetAnnouncementFromRss
|
||||
args:
|
||||
description: GetRemoteAnnouncement
|
||||
description: Loop through the announcement RSS until 24h ago
|
||||
@@ -3,8 +3,6 @@ Orbit::Application.routes.draw do
|
||||
|
||||
|
||||
|
||||
devise_for :users,:controllers => {:sessions => 'sessions'}
|
||||
|
||||
devise_for :users do
|
||||
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
|
||||
end
|
||||
|
||||
@@ -32,7 +32,13 @@ module ParserFrontEnd
|
||||
ret = ''
|
||||
part = PagePart.find(front['part_id']) if front['part_id']
|
||||
ret << eval("\"#{front['path']}\"") rescue ''
|
||||
ret << (ret.include?("?") ? "&#{args.to_param}" : "?#{args.to_param}") if args
|
||||
args.each do |index,arg|
|
||||
if index=="tag_id" || index=="category_id"
|
||||
ret << (ret.include?("?") ? "&#{index}[]=#{arg}": "?#{index}[]=#{arg}" )
|
||||
else
|
||||
ret << (ret.include?("?") ? "&#{index}=#{arg}": "?#{index}=#{arg}" )
|
||||
end
|
||||
end if args
|
||||
fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
|
||||
end
|
||||
front.swap(fragment)
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,99 @@
|
||||
# encoding: utf-8
|
||||
|
||||
# encoding: utf-8
|
||||
|
||||
require 'rss'
|
||||
require 'mongo'
|
||||
|
||||
AUTHORS = %w[ 學生事務處-學生住宿服務組
|
||||
學生事務處-學生職業生涯發展中心
|
||||
學生事務處-衛生保健及醫療中心
|
||||
學生事務處-課外活動指導組
|
||||
學生事務處-學生活動中心管理組
|
||||
學生事務處-僑生及陸生輔導組
|
||||
學生事務處-生活輔導組
|
||||
學生事務處-軍訓組
|
||||
學生事務處-學生心理輔導中心
|
||||
學生事務處-學生事務處]
|
||||
|
||||
DB_BASE_NAME = "site"
|
||||
|
||||
all = []
|
||||
continue = true
|
||||
i = 1
|
||||
yesterday = Time.now - 86400
|
||||
|
||||
while continue do
|
||||
open("http://ann.cc.ntu.edu.tw/asp/rss.asp?page=#{i}") do |rss|
|
||||
feed = RSS::Parser.parse(rss.read.encode('utf-8', 'big5', invalid: :replace, undef: :replace, replace: '').gsub('<pubDate>Wes,', '<pubDate>Wed,').gsub(/(encoding=\"big5\")/, 'encoding="utf-8"'))
|
||||
feed.items.each do |item|
|
||||
if item.pubDate > yesterday
|
||||
if AUTHORS.include?(item.author)
|
||||
author = item.author.strip
|
||||
category = item.category.to_s.gsub(/\<(\/)*category\>/, '')
|
||||
all << {title: item.title.strip, author: author, link: item.link.strip, date: item.pubDate, category: category, description: item.description.gsub("\r\n", '<br/>').strip}
|
||||
end
|
||||
else
|
||||
continue = false
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
|
||||
# Get corresponding category_id or create a new one
|
||||
def get_category_id(category, categories, coll_cat)
|
||||
if categories.keys.include? "rss_#{category}"
|
||||
[categories["rss_#{category}"], categories]
|
||||
else
|
||||
cat = {
|
||||
_type: "BulletinCategory",
|
||||
key: "rss_#{category}",
|
||||
disable: false,
|
||||
title: {:zh_tw => category},
|
||||
created_at: Time.now,
|
||||
updated_at: Time.now
|
||||
}
|
||||
categories["rss_#{category}"] = result = coll_cat.save(cat)
|
||||
[result, categories]
|
||||
end
|
||||
end
|
||||
|
||||
# Get categories and id based on a given site number
|
||||
def get_mongo_and_categories(site_number="0")
|
||||
db = Mongo::Connection.new("localhost", 27017).db("#{DB_BASE_NAME}_#{site_number}")
|
||||
coll_bulletin = db["bulletins"]
|
||||
coll_cat = db["bulletin_categories"]
|
||||
|
||||
categories = coll_cat.find().to_a.inject({}) do |categories, category|
|
||||
categories[category['key']] = category['_id']
|
||||
categories
|
||||
end
|
||||
[categories, coll_bulletin, coll_cat]
|
||||
end
|
||||
|
||||
# Get categories
|
||||
categories, coll_bulletin, coll_cat = get_mongo_and_categories
|
||||
|
||||
all.each do |bul| # Loop through all the items
|
||||
category_id, categories = get_category_id(bul[:category], categories, coll_cat)
|
||||
unless coll_bulletin.find_one(rss_link: bul[:link])
|
||||
bulletin = { _type: "Bulletin",
|
||||
postdate: bul[:date],
|
||||
created_at: bul[:date],
|
||||
updated_at: bul[:date],
|
||||
is_checked: true,
|
||||
is_pending: false,
|
||||
is_rejected: false,
|
||||
bulletin_category_id: category_id,
|
||||
title: {:zh_tw => bul[:title]},
|
||||
text: {:zh_tw => bul[:description]},
|
||||
available_for_zh_tw: true,
|
||||
rss_link: bul[:link] }
|
||||
coll_bulletin.save(bulletin)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
# encoding: utf-8
|
||||
|
||||
require 'rss'
|
||||
require 'mongo'
|
||||
|
||||
AUTHORS = %w[ 學生事務處-學生住宿服務組
|
||||
學生事務處-學生職業生涯發展中心
|
||||
學生事務處-衛生保健及醫療中心
|
||||
學生事務處-課外活動指導組
|
||||
學生事務處-學生活動中心管理組
|
||||
學生事務處-僑生及陸生輔導組
|
||||
學生事務處-生活輔導組
|
||||
學生事務處-軍訓組
|
||||
學生事務處-學生心理輔導中心
|
||||
學生事務處-學生事務處]
|
||||
|
||||
DB_BASE_NAME = "site"
|
||||
|
||||
all = []
|
||||
continue = true
|
||||
i = 1
|
||||
while continue do
|
||||
open("http://ann.cc.ntu.edu.tw/asp/rss.asp?page=#{i}") do |rss|
|
||||
feed = RSS::Parser.parse(rss.read.encode('utf-8', 'big5', invalid: :replace, undef: :replace, replace: '').gsub('<pubDate>Wes,', '<pubDate>Wed,').gsub(/(encoding=\"big5\")/, 'encoding="utf-8"'))
|
||||
feed.items.size
|
||||
feed.items.each do |item|
|
||||
if AUTHORS.include?(item.author)
|
||||
author = item.author.strip
|
||||
category = item.category.to_s.gsub(/\<(\/)*category\>/, '')
|
||||
all << {title: item.title.strip, author: author, link: item.link.strip, date: item.pubDate, category: category, description: item.description.gsub("\r\n", '<br/>').strip}
|
||||
end
|
||||
end
|
||||
continue = false if feed.items.size < 100
|
||||
end
|
||||
i += 1
|
||||
end
|
||||
|
||||
# Get corresponding category_id or create a new one
|
||||
def get_category_id(category, categories, coll_cat)
|
||||
if categories.keys.include? "rss_#{category}"
|
||||
[categories["rss_#{category}"], categories]
|
||||
else
|
||||
cat = {
|
||||
_type: "BulletinCategory",
|
||||
key: "rss_#{category}",
|
||||
disable: false,
|
||||
title: {:zh_tw => category},
|
||||
created_at: Time.now,
|
||||
updated_at: Time.now
|
||||
}
|
||||
categories["rss_#{category}"] = result = coll_cat.save(cat)
|
||||
[result, categories]
|
||||
end
|
||||
end
|
||||
|
||||
# Get categories and id based on a given site number
|
||||
def get_mongo_and_categories(site_number="0")
|
||||
db = Mongo::Connection.new("localhost", 27017).db("#{DB_BASE_NAME}_#{site_number}")
|
||||
coll_bulletin = db["bulletins"]
|
||||
coll_cat = db["bulletin_categories"]
|
||||
|
||||
categories = coll_cat.find().to_a.inject({}) do |categories, category|
|
||||
categories[category['key']] = category['_id']
|
||||
categories
|
||||
end
|
||||
[categories, coll_bulletin, coll_cat]
|
||||
end
|
||||
|
||||
# Get categories
|
||||
categories, coll_bulletin, coll_cat = get_mongo_and_categories
|
||||
|
||||
all.each do |bul| # Loop through all the items
|
||||
category_id, categories = get_category_id(bul[:category], categories, coll_cat)
|
||||
unless coll_bulletin.find_one(rss_link: bul[:link])
|
||||
bulletin = { _type: "Bulletin",
|
||||
postdate: bul[:date],
|
||||
created_at: bul[:date],
|
||||
updated_at: bul[:date],
|
||||
is_checked: true,
|
||||
is_pending: false,
|
||||
is_rejected: false,
|
||||
bulletin_category_id: category_id,
|
||||
title: {:zh_tw => bul[:title]},
|
||||
text: {:zh_tw => bul[:description]},
|
||||
available_for_zh_tw: true,
|
||||
rss_link: bul[:link] }
|
||||
coll_bulletin.save(bulletin)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -310,6 +310,34 @@ namespace :migrate do
|
||||
Rake::Task["web_link_url:web_link_url_i18n"].execute
|
||||
end
|
||||
|
||||
task :save_users => :environment do
|
||||
User.where(:email.not => /guest/).each{|s|s.save}
|
||||
end
|
||||
|
||||
task :fix_bulletin_rss_available_lang => :environment do
|
||||
Bulletin.all.each do |bull|
|
||||
if bull.create_user_id.nil?
|
||||
bull.update_attribute(:available_for_zh_tw, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :fix_imported_rss => :environment do
|
||||
categories = BulletinCategory.where(key: /rss_/).entries
|
||||
unless categories.blank?
|
||||
categories.each do |category|
|
||||
bulletins = category.bulletins
|
||||
unless bulletins.blank?
|
||||
bulletins.each do |bulletin|
|
||||
bulletin.update_attribute(:is_top, false) unless bulletin.is_top?
|
||||
bulletin.update_attribute(:is_hot, false) unless bulletin.is_hot?
|
||||
bulletin.update_attribute(:is_hidden, false) unless bulletin.is_hidden?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :fix_tagged_ids => :environment do
|
||||
Tag.all.each do |tag|
|
||||
tag.taggings.each do |tagging|
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
# encoding: utf-8
|
||||
|
||||
namespace :mongo_files do
|
||||
|
||||
MODELS = { 'ad_image' => 'file',
|
||||
'archive_file_multiple' => 'file',
|
||||
'asset' => 'data',
|
||||
'bulletin' => 'image',
|
||||
'bulletin_file' => 'file',
|
||||
'design' => 'zip_file',
|
||||
'design_file' => 'file',
|
||||
'gallery_image' => 'file',
|
||||
'image' => 'file',
|
||||
'lab_file' => 'file',
|
||||
'location_info' => 'file',
|
||||
'preview_file' => 'file',
|
||||
'project_file' => 'file',
|
||||
'research_file' => 'file',
|
||||
'site' => 'default_image',
|
||||
'stylesheet' => 'file_orig',
|
||||
'user' => 'avatar',
|
||||
'writing_book_file' => 'file',
|
||||
'writing_conference_file' => 'file',
|
||||
'writing_journal_file' => 'file',
|
||||
'writing_patent_file' => 'file' }
|
||||
|
||||
IMAGE_UPLOADER_MODELS = %w[ad_image bulletin image site]
|
||||
|
||||
task :clean => :environment do
|
||||
@files = Mongoid.database['fs.files']
|
||||
@chunks = Mongoid.database['fs.chunks']
|
||||
clean_duplicates
|
||||
clean_unused
|
||||
remove_objects
|
||||
end
|
||||
|
||||
# Remove unused files from db
|
||||
def clean_unused
|
||||
db_array = @files.find().inject([]) do |db_files, file|
|
||||
db_files << file['filename']
|
||||
db_files
|
||||
end
|
||||
|
||||
p "# of files in db: #{db_array.size}"
|
||||
|
||||
name_array = MODELS.inject([]) do |model_files, (model, type)|
|
||||
model.classify.constantize.all.each do |item|
|
||||
url = item.send(type).url
|
||||
thumb_url = item.send(type).thumb.url rescue nil
|
||||
if url && !url.eql?('sign-in-logo.png')
|
||||
url = url.gsub('/gridfs/', '')
|
||||
model_files << url
|
||||
end
|
||||
if thumb_url && !thumb_url.eql?('sign-in-logo.png')
|
||||
thumb_url = thumb_url.gsub('/gridfs/', '')
|
||||
model_files << thumb_url
|
||||
end
|
||||
end
|
||||
model_files
|
||||
end
|
||||
|
||||
p "# of files from uploaders: #{name_array.size}"
|
||||
useless_files = db_array - name_array
|
||||
p "# of unmatched files: #{useless_files.size}"
|
||||
|
||||
useless_files.each do |file|
|
||||
id = @files.find_one('filename' => file)['_id']
|
||||
@files.remove('_id' => id)
|
||||
@chunks.remove('files_id' => id)
|
||||
end
|
||||
# p files.remove('filename' => { "$in" => useless_files})
|
||||
end
|
||||
|
||||
|
||||
# Remove duplicate files from db
|
||||
def clean_duplicates
|
||||
p "# of files in db: #{@files.count}"
|
||||
file_hash = @files.find().sort({uploadDate: -1}).inject({}) do |db_files, file|
|
||||
name = file['filename']
|
||||
if db_files[name]
|
||||
db_files[name] += [file['_id']]
|
||||
else
|
||||
db_files[name] = [file['_id']]
|
||||
end
|
||||
db_files
|
||||
end
|
||||
file_array = file_hash.inject([]) do |files, (key, value)|
|
||||
files += value.drop(1) if value.size > 1
|
||||
files
|
||||
end
|
||||
p "# of duplicate ids to delete: #{file_array.size}"
|
||||
file_array.each do |id|
|
||||
@files.remove('_id' => id)
|
||||
@chunks.remove('files_id' => id)
|
||||
end
|
||||
end
|
||||
|
||||
task :file_size => :environment do
|
||||
files = Mongoid.database['fs.files']
|
||||
size_array = files.find().inject([]) do |size, file|
|
||||
# size << [file['length'], file['filename']]
|
||||
size << [file['filename'], file['length']]
|
||||
size
|
||||
end
|
||||
size_array.sort.each do |pair|
|
||||
p "#{pair[0]} - #{pair[1]}"
|
||||
end
|
||||
p size_array.size
|
||||
end
|
||||
|
||||
def remove_objects
|
||||
# Destroy writing_journals and writing_journal_files
|
||||
Mongoid.database['writing_journals'].remove()
|
||||
Mongoid.database['writing_journal_files'].remove()
|
||||
|
||||
db_array = @files.find().inject([]) do |db_files, file|
|
||||
db_files << file['filename'] if file['filename'] =~ /writing_journal_file|news_bulletin_file|image\/image/
|
||||
db_files
|
||||
end
|
||||
p db_array.size
|
||||
db_array.each do |file|
|
||||
id = @files.find_one('filename' => file)['_id']
|
||||
@files.remove('_id' => id)
|
||||
@chunks.remove('files_id' => id)
|
||||
end
|
||||
end
|
||||
|
||||
def remove_unlinked
|
||||
# name_array = AdBanner.all.inject([]) do |files, banner|
|
||||
# banner.ad_images.inject(files) do |image_files, image|
|
||||
# url = image.file.url
|
||||
# thumb_url = image.file.thumb.url rescue nil
|
||||
# if url && !url.eql?('sign-in-logo.png')
|
||||
# url = url.gsub('/gridfs/', '')
|
||||
# image_files << url
|
||||
# end
|
||||
# if thumb_url && !thumb_url.eql?('sign-in-logo.png')
|
||||
# thumb_url = thumb_url.gsub('/gridfs/', '')
|
||||
# image_files << thumb_url
|
||||
# end
|
||||
# image_files
|
||||
# end
|
||||
# files
|
||||
# end
|
||||
name_array = Design.all.inject([]) do |files, design|
|
||||
files += design.images.inject(files) do |image_files, image|
|
||||
p image_files += get_url_and_thumb(image.file)
|
||||
image_files
|
||||
end
|
||||
files
|
||||
end
|
||||
p name_array.size
|
||||
end
|
||||
|
||||
def get_url_and_thumb(file)
|
||||
url = file.url
|
||||
thumb_url = file.thumb.url rescue nil
|
||||
files = [url, thumb_url].inject([]) do |urls, current|
|
||||
urls << current.gsub('/gridfs/', '') if current && !current.eql?('sign-in-logo.png')
|
||||
urls
|
||||
end
|
||||
files
|
||||
end
|
||||
|
||||
task :delete_rss_ann => :environment do
|
||||
Bulletin.where(create_user_id: nil).destroy
|
||||
end
|
||||
end
|
||||
+10
-10
@@ -9,17 +9,17 @@ namespace :web_link_url do
|
||||
|
||||
@weblinks.each do |wl|
|
||||
|
||||
if wl.url.nil?
|
||||
if wl.url_translations.is_a?(String)
|
||||
|
||||
@wlurl = wl.url_translations
|
||||
|
||||
wl.url_translations = {}
|
||||
|
||||
wl.url_translations["zh_tw"] = @wlurl
|
||||
|
||||
wl.url_translations["en"] = @wlurl
|
||||
|
||||
@wlurl = wl.url_translations
|
||||
|
||||
wl.url_translations = {}
|
||||
|
||||
wl.url_translations["zh_tw"] = @wlurl
|
||||
|
||||
wl.url_translations["en"] = @wlurl
|
||||
|
||||
wl.save
|
||||
wl.save
|
||||
|
||||
else
|
||||
puts 'no data'
|
||||
|
||||
+13
-82
@@ -1,95 +1,26 @@
|
||||
var banners = [];
|
||||
var banner_index = 0;
|
||||
$q = jQuery;
|
||||
$q.getScript('/static/jquery.cycle.all.latest.js');
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$.each($(".dymanic_load"),function(){
|
||||
if($(this).attr("path")==''){$(this).html("App setting Failed");}
|
||||
|
||||
if($(this).attr("path")!=''){
|
||||
if($(this).attr("path").indexOf("show_banner")>0){
|
||||
ajax_load_proc($(this),$(this).attr("path"),"true");
|
||||
}else{
|
||||
ajax_load_proc($(this),$(this).attr("path"),$(this).attr("path"));
|
||||
ajax_load_proc($(this),$(this).attr("path"));
|
||||
}
|
||||
}
|
||||
}});
|
||||
);
|
||||
$("#main_content").addClass("module");
|
||||
});
|
||||
});
|
||||
|
||||
function ajax_load_proc(wapper,url,isBanner){
|
||||
function ajax_load_proc(wapper,url){
|
||||
$.get(encodeURI(url), {}, function(respText,textSta,XML){
|
||||
if (textSta == 'success') {
|
||||
if(isBanner=="true"){
|
||||
wapper.html(respText);
|
||||
var banner = banners[banner_index];
|
||||
$(banner.banner_name+" > img").each(function(){
|
||||
$(this).load(function(){ banner.image_loaded++; });
|
||||
});
|
||||
BannerCycle(banner_index);
|
||||
banner_index++;
|
||||
}else{
|
||||
wapper.html(respText);
|
||||
}
|
||||
};
|
||||
if(textSta == 'error')
|
||||
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>");
|
||||
if (textSta == 'success') {
|
||||
wapper.html(respText);
|
||||
};
|
||||
if(textSta == 'error')
|
||||
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>");
|
||||
});
|
||||
}
|
||||
|
||||
function BannerCycle(banner_index){
|
||||
var banner = banners[banner_index];
|
||||
if (banner.image_loaded==$(banner.banner_name+" img").length){
|
||||
if(banner.banner_name=="#slideshow-banner"){
|
||||
$q(banner.banner_name).cycle({
|
||||
delay: -1000,
|
||||
fx: banner.banner_fx,
|
||||
timeout: banner.time_to_next,
|
||||
pager: banner.banner_pager,
|
||||
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{
|
||||
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]
|
||||
function getTimeout() {
|
||||
return $(this).attr('time_to_next');
|
||||
@@ -111,4 +42,4 @@ $(document).ready(function() {
|
||||
}
|
||||
})
|
||||
});
|
||||
// Ad Banner FX code [end]
|
||||
// Ad Banner FX code [end]
|
||||
@@ -40,6 +40,7 @@ class Bulletin
|
||||
field :not_checked_reason
|
||||
|
||||
field :public, :type => Boolean, :default => true
|
||||
field :rss_link
|
||||
|
||||
scope :can_display, where(is_checked: true, is_rejected: false, is_pending: false)
|
||||
scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) }
|
||||
@@ -85,7 +86,7 @@ class Bulletin
|
||||
end
|
||||
|
||||
def share_item
|
||||
Item.first(conditions:{name: 'news'})
|
||||
Item.first(conditions:{name: 'announcement'})
|
||||
end
|
||||
|
||||
def proc_check(check,not_pass_info = "")
|
||||
|
||||
Vendored
+6
-2
@@ -3,7 +3,6 @@
|
||||
<div class="info">
|
||||
<div class="info1">
|
||||
<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>
|
||||
<% 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>
|
||||
@@ -37,6 +36,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless @bulletin.rss_link.blank? %>
|
||||
<div>
|
||||
<%= link_to t('ntu.rss_origin'), @bulletin.rss_link %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<%= share_links(@bulletin, 'announcement') %>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
+4
-27
@@ -9,38 +9,15 @@ class Panel::Gallery::Widget::AlbumsController < OrbitWidgetController
|
||||
@album = GalleryAlbum.find(@part.widget_options['album_id']) rescue nil
|
||||
@album_images = @album.gallery_images if @album
|
||||
|
||||
|
||||
@settings = {"vertical"=>vertical,"horizontal"=>horizontal} #[note] horizontal has it's limitation from 2 to 6
|
||||
@class = "c" + @settings["horizontal"].to_s
|
||||
@total = @settings["vertical"] * @settings["horizontal"]
|
||||
@rnd = Random.new
|
||||
@images = []
|
||||
|
||||
if @album_images.count > @total
|
||||
@randoms = []
|
||||
until @randoms.count == @total do
|
||||
r = @rnd.rand(0...@album_images.count)
|
||||
if !@randoms.include?r
|
||||
@randoms << r
|
||||
image = @album_images[r]
|
||||
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url}
|
||||
@images << values
|
||||
end
|
||||
end
|
||||
elsif @album_images.count == @total
|
||||
@album_images.each do |image|
|
||||
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url}
|
||||
@images << values
|
||||
end
|
||||
else
|
||||
@album_images.each do |image|
|
||||
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url}
|
||||
@images << values
|
||||
end
|
||||
until @images.count == @total do
|
||||
values = {"show_link"=>"javascript:void(0);","thumb"=>"assets/gallery/nodata.jpg"}
|
||||
@images << values
|
||||
end
|
||||
for i in 0..@total-1
|
||||
image = @album_images[@rnd.rand(0...@album_images.count)]
|
||||
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url}
|
||||
@images << values
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.html.erb
Vendored
+4
-6
@@ -10,12 +10,10 @@
|
||||
<div class="o-links-list">
|
||||
<ul>
|
||||
<% web_links.page(params[:page_main]).per(@page_num).each do |web_link| %>
|
||||
<% if !web_link.title.empty? %>
|
||||
<li>
|
||||
<%= link_to web_link.title, web_link.url, {:target => '_blank', :title => web_link.title, :class=>"o-links-title"} %>
|
||||
<div class="o-links-description"><%= web_link.context %></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to web_link.title, web_link.url, {:target => '_blank', :title => web_link.title, :class=>"o-links-title"} %>
|
||||
<div class="o-links-description"><%= web_link.context %></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Vendored
+4
-6
@@ -8,12 +8,10 @@
|
||||
<div class="o-links-list">
|
||||
<ul>
|
||||
<% web_links.page(params[:page_main]).per(@page_num).each do |web_link| %>
|
||||
<% if !web_link.title.empty? %>
|
||||
<li>
|
||||
<%= link_to web_link.title, web_link.url, {:target => '_blank', :title => web_link.title, :class=>"o-links-title"} %>
|
||||
<div class="o-links-description"><%= web_link.context %></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to web_link.title, web_link.url, {:target => '_blank', :title => web_link.title, :class=>"o-links-title"} %>
|
||||
<div class="o-links-description"><%= web_link.context %></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<ul>
|
||||
<% @web_links.each do |widget| -%>
|
||||
<li><%= link_to widget.title, widget.url, {:target => '_blank', :title => widget.title} %></li>
|
||||
<li><%= link_to widget.title, widget.url, {:target => '_blank', :title => widget.title} %></li>
|
||||
<% end -%>
|
||||
</ul>
|
||||
|
||||
|
||||
Reference in new issue
Block a user