Add this toolbar, and nccu calendar fix

This commit is contained in:
Matthew K. Fu JuYuan 2012-06-04 16:51:29 +08:00
parent 2f500ff460
commit 8dd1ab32c1
13 changed files with 47 additions and 10 deletions

View File

@ -168,6 +168,7 @@ GEM
rdoc (~> 3.4) rdoc (~> 3.4)
thor (~> 0.14.6) thor (~> 0.14.6)
rake (0.9.2.2) rake (0.9.2.2)
rb-readline (0.4.2)
rdoc (3.12) rdoc (3.12)
json (~> 1.4) json (~> 1.4)
redis (2.2.2) redis (2.2.2)
@ -301,6 +302,7 @@ DEPENDENCIES
radius radius
rails (>= 3.1.0, < 3.2.0) rails (>= 3.1.0, < 3.2.0)
rake rake
rb-readline
resque resque
resque-restriction resque-restriction
resque-scheduler resque-scheduler

View File

@ -3,6 +3,10 @@ class BackupServer
def self.perform() def self.perform()
CronMail.time_check("Going to backup Orbit").deliver CronMail.time_check("Going to backup Orbit").deliver
dbhost = Mongoid.config.database.connection.primary.join ':'
dbname = Mongoid.config.database.name
dbdirectory = "#{Rails.root}/tmp/#{dbname}-"+Time.now.strftime("%Y-%m-%d-%H-%M")
%x[mongodump -h dbhost -d dbname -o dbdirectory ]
# %x[touch #{Rails.root}/tmp/restart] # %x[touch #{Rails.root}/tmp/restart]
end end
end end

View File

@ -5,11 +5,17 @@ class NccuCalendar
@queue = :high @queue = :high
def self.perform() def self.perform()
temp_file = Tempfile.new('new_cal') # temp_file = Tempfile.new('new_cal')
temp_file << open('http://events.nccu.edu.tw/Month').read # open('http://events.nccu.edu.tw/Month').read{|data|
# temp_file << data
# }
FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml')) open(File.join(Rails.root, 'public/static', 'nccu_calendar.xml'), 'wb') do |fo|
fo.print open('http://events.nccu.edu.tw/Month').read
end
puts "NccuCalendar Synced" # FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml'))
puts "NccuCalendar Synced4"
end end
end end

View File

@ -0,0 +1,14 @@
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a href="http://www.addthis.com/bookmark.php?v=250&amp;username=ra-4fc5b9b95a5e9034" class="addthis_button_compact"><%= t("addthis_tools.add_to_bookmark")%></a>
<span class="addthis_separator">|</span>
<a class="addthis_button_facebook" style="cursor:Pointer"></a>
<a class="addthis_button_twitter" style="cursor:Pointer"></a>
<a class="addthis_button_plurk" style="cursor:Pointer"></a>
<a class="addthis_button_email" style="cursor:Pointer"></a>
<!--<a href="<?php echo 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] ?>&print=friendly"><img src="../images/print.jpg" alt="友善列印"
></a>-->
</div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4fc5b9b95a5e9034"></script>
<!-- AddThis Button END -->

Binary file not shown.

View File

@ -46,7 +46,8 @@ en:
view: View view: View
view_count: View count view_count: View count
yes_: "Yes" yes_: "Yes"
addthis_tools:
add_to_bookmark: Add this to bookmark
all_content: All Content all_content: All Content
all_file: All File all_file: All File
all_member: All Member all_member: All Member

View File

@ -44,6 +44,8 @@ zh_tw:
view_count: 查看次數 view_count: 查看次數
yes_: "Yes" yes_: "Yes"
addthis_tools:
add_to_bookmark: 加入書籤
all_content: 全部內容有 all_content: 全部內容有
all_file: 全部檔案有 all_file: 全部檔案有
all_member: 成員總數 all_member: 成員總數

View File

@ -8,7 +8,7 @@ defaults: &defaults
development: development:
<<: *defaults <<: *defaults
database: prototype_r4_development database: prototype_r4_ldap0229
test: test:
<<: *defaults <<: *defaults
@ -22,4 +22,4 @@ production:
# password: <%= ENV['MONGOID_PASSWORD'] %> # password: <%= ENV['MONGOID_PASSWORD'] %>
# database: <%= ENV['MONGOID_DATABASE'] %> # database: <%= ENV['MONGOID_DATABASE'] %>
<<: *defaults <<: *defaults
database: prototype_r4_development database: prototype_r4_ldap0229

View File

@ -1,5 +1,5 @@
rails_env = 'development' #ENV['RAILS_ENV'] || "production" rails_env = 'development' #ENV['RAILS_ENV'] || "production"
rails_root = ENV['RAILS_ROOT'] || "/Users/kaito/Documents/MyWorkspeace/orbit/orbit" rails_root = ENV['RAILS_ROOT'] || "/Users/kaito/Documents/MyWorkspeace/NCCU"
num_workers = rails_env == 'production' ? 5 : 2 num_workers = rails_env == 'production' ? 5 : 2
num_workers.times do |num| num_workers.times do |num|

BIN
dump.rdb

Binary file not shown.

8
lib/resque_ext.rb Normal file
View File

@ -0,0 +1,8 @@
module ResqueExt
#
# ResqueExt.unregister_workers_for_host("ec210-250-192-51")
#
def self.unregister_workers_for_host(host)
Resque.workers.select{|worker| worker.id.split(':').first==host}.each(&:unregister_worker)
end
end

View File

@ -39,5 +39,5 @@
<% end %> <% end %>
</div> </div>
<div class="fb"> <div class="fb">
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35&amp;appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe> <%= render "shared/addthis_toolbox"%>
</div> </div>

View File

@ -40,5 +40,5 @@
</div> </div>
<div class="fb"> <div class="fb">
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.nccu.edu.tw&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=35&amp;appId=263319013700607" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe> <%= render "shared/addthis_toolbox"%>
</div> </div>