Compare commits

..
Author SHA1 Message Date
Manson Wang ff533c8fde Fix Peg_content,Annoucement authorization bug 2013-11-13 17:07:57 +08:00
harrybomrah 410fa0392a gallery all bugs fixed.. 2013-11-13 16:37:33 +08:00
rulingcom 93b7018a4a Delete Archive 2013-11-13 16:34:57 +08:00
Spen 42dd23ffe4 fix new ui announcement init data count 2013-10-29 15:01:27 +08:00
Manson Wang 1c2e455129 Fix filemanager delete url path 2013-10-23 10:45:21 +08:00
Spen 3a9ca6c63d Fix new ui [app_name]_category_with_title and change announcement & faq init 2013-10-22 16:00:11 +08:00
chris 795e135ac7 Fix tag to remove ['0', '1'] from the form 2013-10-22 15:25:19 +08:00
saurabhbhatia e4594fb343 Merge branch 'ntu_mb_sso_server' of https://github.com/Rulingcom/orbit into HEAD 2013-10-01 18:09:03 +08:00
saurabhbhatia 40e1ee751e Updated filename of writing seminars to writing conferences 2013-10-01 18:06:01 +08:00
Spen 69cf567944 sso server for ntu mb server site 2013-10-01 18:05:59 +08:00
saurabhbhatia 49f1cfd251 Merge branch 'ntu_mb_sso_server' of https://github.com/Rulingcom/orbit into ntu_mb_sso_server 2013-09-27 16:24:10 +08:00
saurabhbhatia e33ab01b53 Updated filename of writing seminars to writing conferences 2013-09-27 16:23:38 +08:00
Spen 5bb0f2c991 sso server for ntu mb server site 2013-09-27 16:23:37 +08:00
saurabhbhatia 3825ab0264 Updated filename of writing seminars to writing conferences 2013-09-27 15:12:30 +08:00
saurabhbhatia c457735c2f Updated file name in writing conferences front end 2013-09-27 15:12:21 +08:00
saurabhbhatia b55d3d9475 Updated order for zh_tw translation 2013-09-27 14:33:19 +08:00
saurabhbhatia e7c77b55d9 Merge branch 'ntu_mb_sso_server' of https://github.com/Rulingcom/orbit into ntu_mb_sso_server 2013-09-27 12:50:11 +08:00
Spen b415b23db2 sso server for ntu mb server site 2013-09-27 12:49:52 +08:00
saurabhbhatia 035ce03821 Merge branch 'ntu_mb_sso_server' of https://github.com/Rulingcom/orbit into ntu_mb_sso_server 2013-09-27 12:43:29 +08:00
Spen 9fb8c18bf5 sso server for ntu mb server site 2013-09-27 12:35:41 +08:00
saurabhbhatia ac86496721 Merge branch 'ntu_mb_sso_server' of https://github.com/Rulingcom/orbit into ntu_mb_sso_server 2013-09-27 11:14:27 +08:00
Spen 52baa91234 sso server for ntu mb server site 2013-09-27 11:13:27 +08:00
saurabhbhatia c3d8ed5c0c Merge branch 'ntu_mb_sso_server' of https://github.com/Rulingcom/orbit into ntu_mb_sso_server 2013-09-26 22:44:19 +08:00
Spen 7dc8250a73 sso server for ntu mb server site 2013-09-26 22:43:12 +08:00
Spen ab492076cb sso server for ntu mb server site 2013-09-26 15:31:31 +08:00
17 changed files with 314 additions and 356 deletions

No files matched your search

-1
View File
@@ -18,7 +18,6 @@ gem 'kaminari'
gem 'time_difference' gem 'time_difference'
gem "acts_as_unvlogable" gem "acts_as_unvlogable"
gem 'youtube_it' gem 'youtube_it'
gem 'whenever', :require => false
# gem "memcached", "~> 1.4.3" # gem "memcached", "~> 1.4.3"
# gem "memcache-client" # gem "memcache-client"
+64 -255
View File
@@ -4,8 +4,8 @@ require 'net/http'
require 'open-uri' require 'open-uri'
class Admin::ImportDataController < OrbitBackendController class Admin::ImportDataController < OrbitBackendController
# helper Admin::PagePartsHelper helper Admin::PagePartsHelper
# include Admin::FrontendWidgetInterface include Admin::FrontendWidgetInterface
def get_teacher_data def get_teacher_data
uri = URI("https://localhost:8000/teachers.xml") uri = URI("https://localhost:8000/teachers.xml")
@@ -258,7 +258,7 @@ class Admin::ImportDataController < OrbitBackendController
end end
end end
def sync_conference_data def sync_conference_data
@conference_data = WritingConference.where(create_user_id: "#{params[:user_id]}") @conference_data = WritingConference.where(create_user_id: "#{params[:user_id]}")
@conference_data.delete_all @conference_data.delete_all
@user = User.find("#{params[:user_id]}") @user = User.find("#{params[:user_id]}")
@@ -455,200 +455,9 @@ def sync_book_data
format.json { render json: {"success"=>true}.to_json} format.json { render json: {"success"=>true}.to_json}
end end
end
def sync_conference_data_auto
@user = User.all
@user.each do |user|
@conference_data = WritingConference.where(create_user_id: "#{user.id}")
@conference_data.delete_all
# @user = User.find("#{params[:user_id]}")
# teachers.each do |hash|
if user.sid.present?
ntu_seq = user.sid
conference_xml = Nokogiri::XML( \
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=C"))
#open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
@conference_papers = conference_xml.xpath("//Paper").map do |cp_node|
{
author: (cp_node>"Authors").text,
year: (cp_node>"PublishYear").text,
title: (cp_node>"PaperTitle").text,
conference: (cp_node>"PublishOn").text,
date: Date::MONTHNAMES[(cp_node>"PublishMonth").text.to_i],
location: "#{(cp_node>"Country").text} #{(cp_node>"location").text}",
conference_title: (cp_node>"PublishOn").text,
remarks: (cp_node>"Remarks").text
}
end
if @conference_papers.present?
@conference_papers.each do |b|
@conference_paper = WritingConference.new
I18n.locale = :zh_tw
@conference_paper.authors = b[:author]
if b[:title].blank?
@conference_paper.paper_title = "No Title Present"
else
@conference_paper.paper_title = b[:title]
end
if b[:conference_title].blank?
@conference_paper.conference_title = "No Title Present"
else
@conference_paper.conference_title = b[:conference_title]
end
@conference_paper.note = b[:remarks]
I18n.locale = :en
@conference_paper.authors = b[:author]
if b[:title].blank?
@conference_paper.paper_title = "No Title Present"
else
@conference_paper.paper_title = b[:title]
end
if b[:conference_title].blank?
@conference_paper.conference_title = "No Title Present"
else
@conference_paper.conference_title = b[:conference_title]
end
@conference_paper.note = b[:remarks]
@conference_paper.location = b[:location]
@conference_paper.year = b[:year]
@conference_paper.create_user_id = user.id
@conference_paper.save!
end
else
puts "No conference by Teacher"
end
end
end
end end
def sync_journal_paper_data_auto
@user = User.all
@user.each do |user|
@journal_data = WritingJournal.where(create_user_id: "#{user_id}")
@journal_data.delete_all
# @user = User.find("#{params[:user_id]}")
# teachers.each do |hash|
if user.sid.present?
ntu_seq = user.sid
paper_xml = Nokogiri::XML( \
#open("http://versatile.management.ntu.edu.tw/publication1/journal/#{ntuseq}.xml"))
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=J"))
@journal_papers = paper_xml.xpath("//Paper").map do |paper_node|
{
author: (paper_node>"Authors").text,
year: (paper_node>"PublishYear").text,
title: (paper_node>"PaperTitle").text,
journal: (paper_node>"PublishOn").text,
volume:(paper_node>"Volume").text,
volumeno:(paper_node>"VolumeNo").text,
beginpage:(paper_node>"BeginPage").text,
endpage:(paper_node>"EndPage").text,
subgroup:(paper_node>"subgroup").text,
remarks: (paper_node>"Remarks").text,
cate: ((paper_node>"subgroup")>"Group").text
}
end
if @journal_papers.present?
@journal_papers.each do |b|
@journal_paper = WritingJournal.new
I18n.locale = :zh_tw
@journal_paper.authors = b[:author]
if b[:title].blank?
@journal_paper.paper_title = "No Title Present"
else
@journal_paper.paper_title = b[:title]
end
@journal_paper.journal_title = b[:journal]
@journal_paper.note = b[:remarks]
I18n.locale = :en
@journal_paper.authors = b[:author]
if b[:title].blank?
@journal_paper.paper_title = "No Title Present"
else
@journal_paper.paper_title = b[:title]
end
@journal_paper.journal_title = b[:journal]
@journal_paper.note = b[:remarks]
@journal_paper.year = b[:year]
@journal_paper.vol_no = b[:volumeno]
@journal_paper.form_to_start = b[:beginpage]
@journal_paper.form_to_end = b[:endpage]
if !b[:cate].blank?
@level_type = JournalLevelType.where(:key => b[:cate])
if @level_type.present?
@journal_paper.journal_level_type_ids = ["#{@level_type.first.id}"]
end
end
@journal_paper.create_user_id = user.id
@journal_paper.save!
end
end
end
end
end
def sync_book_data_auto
@user = User.all
@user.each do |user|
@books_data = WritingBook.where(create_user_id: "#{user_id}")
@books_data.delete_all
# @user = User.find("#{params[:user_id]}")
# teachers.each do |hash|
if user.sid.present?
ntu_seq = user.sid
books_xml = Nokogiri::XML( \
open("http://ann.cc.ntu.edu.tw/Achv/xmlBook.asp?Seq=#{ntu_seq}"))
@books = books_xml.xpath("//Book").map do |book_node|
{
author: (book_node>"Authors").text,
year: (book_node>"PublishYear").text,
title: (book_node>"DocTitle").text,
remarks: (book_node>"Remarks").text,
publisher: (book_node>"Publisher").text,
book_title: (book_node>"BookTitle").text
}
end
if @books.present?
@books.each do |b|
@book = WritingBook.new
I18n.locale = :zh_tw
@book.authors = b[:author]
@book.paper_title = b[:title]
@book.book_title = b[:book_title]
@book.note = b[:remarks]
@book.publisher = b[:publisher]
I18n.locale = :en
@book.authors = b[:author]
@book.paper_title = b[:title]
@book.book_title = b[:book_title]
@book.note = b[:remarks]
@book.publisher = b[:publisher]
@book.year = b[:year]
@book.create_user_id = user.id
@book.save
end
end
end
end
end
def get_announcement_data def get_announcement_data
uri = URI("https://localhost:8000/announcements.xml") uri = URI("https://localhost:8000/announcements.xml")
@@ -693,72 +502,72 @@ end
end end
end end
# def get_page_data def get_page_data
# f = File.open("/home/rwub/orbit-db/ntu_mb/pages/management_pages.xml") f = File.open("/home/rwub/orbit-db/ntu_mb/pages/management_pages.xml")
# page_xml = Nokogiri::XML(f) page_xml = Nokogiri::XML(f)
# #open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml")) #open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
# @pages = page_xml.xpath("//management-page").map do |cp_node| @pages = page_xml.xpath("//management-page").map do |cp_node|
# { {
# menu_title: (cp_node>"menu-title").text, menu_title: (cp_node>"menu-title").text,
# content: (cp_node>"content").text content: (cp_node>"content").text
# } }
# end end
# if @pages.present? if @pages.present?
# @i=0 @i=0
# @pages.each do |b| @pages.each do |b|
# get_variables_for_new get_variables_for_new
# @page = Page.new @page = Page.new
# @page.parent = "4f45f3b9e9d02c5db900005d" @page.parent = "4f45f3b9e9d02c5db900005d"
# @page.design = "50ac424983e75219d2000021" @page.design = "50ac424983e75219d2000021"
# @page.theme_id = "50ac424a83e75219d2000025" @page.theme_id = "50ac424a83e75219d2000025"
# @page.menu_enabled_for= ["en", "zh_tw", ""] @page.menu_enabled_for= ["en", "zh_tw", ""]
# @page.enabled_for= ["en", "zh_tw", ""] @page.enabled_for= ["en", "zh_tw", ""]
# @page.is_published = false @page.is_published = false
# if b[:menu_title].blank? if b[:menu_title].blank?
# @page.title = 'No Title Present' @page.title = 'No Title Present'
# @i += 1 @i += 1
# @page.name = "#{@i}Page" @page.name = "#{@i}Page"
# else else
# @i += 1 @i += 1
# @page.title = b[:menu_title] @page.title = b[:menu_title]
# @page.name = "#{@i}Page" @page.name = "#{@i}Page"
# end end
# if b[:content].blank? if b[:content].blank?
# @page.content = "No Content Present" @page.content = "No Content Present"
# else else
# @page.content = b[:content] @page.content = b[:content]
# end end
# @page.save! @page.save!
# end end
# else else
# puts "No Page Data" puts "No Page Data"
# end end
# end end
# def get_variables_for_new def get_variables_for_new
# @designs = Design.all.entries @designs = Design.all.entries
# @themes = Design.first.themes @themes = Design.first.themes
# @module_apps = ModuleApp.for_frontend_select @module_apps = ModuleApp.for_frontend_select
# @app_frontend_urls = nil @app_frontend_urls = nil
# @categories = nil @categories = nil
# @tags = nil @tags = nil
# @page_frontend_data_counts = nil @page_frontend_data_counts = nil
# @frontend_styles = nil @frontend_styles = nil
# @selected={ @selected={
# :design => @designs.first, :design => @designs.first,
# :theme=> @themes.first, :theme=> @themes.first,
# :module_app=>nil,#@module_apps.first :module_app=>nil,#@module_apps.first
# :app_frontend_url=> nil, #@module_apps.first :app_frontend_url=> nil, #@module_apps.first
# :category=>nil, :category=>nil,
# :tag=>nil, :tag=>nil,
# :page_frontend_data_count=>nil, :page_frontend_data_count=>nil,
# :frontend_style => nil :frontend_style => nil
# } }
# end end
end end
+34
View File
@@ -0,0 +1,34 @@
class SamlLoginsController < ApplicationController
require "net/http"
require "uri"
require 'rexml/document'
include REXML
def index
if params[:wa] == "wsignoutcleanup1.0" #logout
redirect_to :root
else #login
@wresult = params[:wresult]
@wctx = params[:wctx]
@main_url = LIST[:sites][@wctx]['url']
@main_public_key = LIST[:sites][@wctx]['key']
@doc = REXML::Document.new @wresult
public_key = OpenSSL::PKey::RSA.new(@main_public_key)
encrypted_data = public_key.public_encrypt(@doc.elements["//saml:AttributeValue"].text)
redirect_to "http://#{@main_url}/user_login?" + { :wresult => encrypted_data }.to_param
end
end
end
@@ -25,12 +25,12 @@
<ul class="nav nav-pills filter-nav pull-right"> <ul class="nav nav-pills filter-nav pull-right">
<li class="accordion-group"> <li class="accordion-group">
<div class="accordion-heading"> <div class="accordion-heading">
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a> <a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
</div> </div>
</li> </li>
</ul> </ul>
<div class="filter-group accordion-group"> <div class="filter-group accordion-group">
<div class="accordion-body collapse" id="collapse-role"> <div class="accordion-body collapse" id="collapse-status">
<%= render :partial => "filter"%> <%= render :partial => "filter"%>
@@ -25,12 +25,12 @@
<ul class="nav nav-pills filter-nav pull-right"> <ul class="nav nav-pills filter-nav pull-right">
<li class="accordion-group"> <li class="accordion-group">
<div class="accordion-heading"> <div class="accordion-heading">
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a> <a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
</div> </div>
</li> </li>
</ul> </ul>
<div class="filter-group accordion-group"> <div class="filter-group accordion-group">
<div class="accordion-body collapse" id="collapse-role"> <div class="accordion-body collapse" id="collapse-status">
<%= render :partial => "filter"%> <%= render :partial => "filter"%>
+29
View File
@@ -79,3 +79,32 @@ default_widget_style:
- style3 - style3
- style4 - style4
- style5 - style5
sites:
www:
url: www.management.ntu.edu.tw
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmUuz5i/f9PCacIiTADln\na5xpbNh3tMwNSpnMZDa9FsGlw6/pKCkb5VuiusI7on8eZJGyneOrJ2L5tFael4pG\n0xmRMJnPm0FCaFjVO43Ktclehy5zIY7YJqqZo04j95oJrUBwAcB1xESpCx7atdpD\naFGdCtGQia+q/2cRSMic6JSALUtR3l1Xc5FCpC8n9DeYVOsOc4uO3MNuPvZ3MWPe\njULW4kojYcPL/2aHypi0iQKNm3Kss7mTW6/rsKNyhpds1YvdSqkak+QjqgR7hRDA\nFbYPNx4RL/o5RsxW12po7DdttsMHru0btrt+3Uw6TyqU+5cPcM6WJf2CV1/Fh1zm\njwIDAQAB\n-----END PUBLIC KEY-----\n"
ba:
url: ba.management.ntu.edu.tw
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsiVjWXc2OmyxK1O/N7R2\nsbhop1o4XStsxwcGm9AQNekoq7F8HEk2ZrSz5+hRln8FK4fT4YajALRQDS0nGUpe\nGmII0bvjQaiUvVvg7qMdUhdw88543VfPZShXZYjVaa/9JFEdw/+d5gHe5N8gTsde\nYY3KcIz6cECx56L2o5l4SNXYgCJt8aEtKOcsOM2ZDdoxTGJGWPxZaYvyKH9euTdC\nd8N/QGr6fzWcFEsefb1Ftxx417RRfJBFbqDsFIHGSGOPRKXwxL8/4qMDSZhtxHrK\nOdSvQhfF1YAr210TQxgdj/8Pl0PbuY0g8TM+S1izGjanT8vepuye7vUQ2vKRZ36z\nHwIDAQAB\n-----END PUBLIC KEY-----\n"
acc:
url: acc.management.ntu.edu.tw
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmhhNwvOI7hBu0qZfO8rU\nFg2lNw8Fmm5OUXm2Y/cElGaNWFVpRhJJGPQUV3tu9dMECi2n6yMvvgpXXeqYD/hV\nrlApoBb23o7HPg94cBckEO5vWVnZ4ylPS+GodOe+bFdSe4S/tjFY1KOcKN5rGNQQ\nFQ6JkWoQPBXcIoI4TqJVVAkjd8/x9jMRtK9ZzGGiRFhsbcP/A67kvz0fUsdMt4t1\nHmQJbCa2ONzJ8AGX1oTeHwXGz9ZPVstenci4o8lhwu1Jzim1UryW/XaPcYFH6wKm\nKwRAKJvn8awEvW4fzwD5fwI3u7cu19niT+KQAvDjV3HFuqnqu7LETCkr36hy30Hm\nIwIDAQAB\n-----END PUBLIC KEY-----\n"
finance:
url: finance.management.ntu.edu.tw
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxvRR2ay3HNjq/5rcGlBc\n2nFbQwCQK4nR/GqOUFAwdgWEIivwMALYWPQsNuU90RJqm0HkwxvdLXy/XRZfLSVC\nA5D3JtGmpstJKK7A1jOkP5sj54zs8NMnm2zrm9/YDrUmxUr58OOmsCIjiDXQ0PW+\nIR34FOde6yXgwriPUq2DjTo2UgujNPoNeICGmtTTV+YzVdOZmNqfRVnCpfUUnMsN\nDxzL8K2VzGa7KGJeCe5NEwCdJZ8FApMKUJORpCao9jR62dhZ0GKQpMqvO3c/aHxI\nWY+wnuzMWAZl96hIQc4ksnl7hcd2y5WSQZZS7OBdeSxumqJBqgCd6ITBhrzC5gSv\nCQIDAQAB\n-----END PUBLIC KEY-----\n"
ib:
url: ib.management.ntu.edu.tw
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzfoOcLyW3q7bYXArXEBC\nl62pLW7Yg0zyj5blWjU/DnIwxX6B8q48HfubDWQRGgHJsxCsGVrPwhUNEcmfS20q\nUlTBhx4Qt6qHXQYX0jBZbNg7fr2rbwNlbYovMUxF28dcik8K+eKz0fP2NH1lV4BS\ngDb9Nd/gNXozO67/MSrTCXXBKx8andlmVxhJSC8zQcQ4WXPpDhmTB0AvqUcRm/z7\nbLeIntibt6ke3/BVeixgu1Cf4u1y01+EsJ1sAnJzD+cSrq2tu5ccstbRfY5crY3v\n9YFQ3M9LrYV0fi91LhNt6xPNEvvQuZ21/Wwd9DL4D/7Hg55upcolfTxB3J83cTDg\niwIDAQAB\n-----END PUBLIC KEY-----\n"
im:
url: im.management.ntu.edu.tw
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy1o15uvdBKra9LQsjnRL\nyaJ2ZTOLlaS0ICu/RkDWNTz4gbwKhAvxvS2Om9O85MiZKaOtS+TgrMePk/zTztZA\nnxrVcVZStzj5//zKuOLAg2DOUH0Bd/uBTjvOkfc6CQrJuu50B1S+GgN08KeZSxw4\nYgKn6I3Dnm8NZfl9foZRnGgpgJSUrv2oN2RWTBqkwey9LbWtZ0yoRdZHZpVDKq50\n4PpqgAibNXy4er06yd9qqWA0wIoPPQIsYhBkDmqkBe+AxTV4hqX8W/M+j3ftA+T9\nsKAhMYJD/sWvXA1LbKwiYn2f2GNo6zECCPdbYVwbwVeRHslt6lL11ZejW7jaXVaA\nAwIDAQAB\n-----END PUBLIC KEY-----\n"
emba:
url: emba.management.ntu.edu.tw
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzky+srC6d21nBP54Xtv+\nC6VJgjRolToLaaJKR6+qXW6lTU6/kYexfMiVTahcBtSooCDj137L/qn4NJpl/2UF\nXrx45n7FWWrXWJhlec6bh4Lg+wGcJrSDGF3GXhLD6T/0o++ep51zt5a6R3LW+WCg\nAUYzc6lWqSpKF/5Z3GfI4/jvNqrZLEoRtTR19WCjdO5J819XxUv3fW7TDx+XJ3kK\n9OsZWT81R7oushb2HFnGj0HJjwm5yCTFdWTzk6X/R0dAmg8lLcSDpeH1aq0YO/RB\nWycZEgIuV42eTaEg9aYbVnS7F2y8gIQjoVjlJF3VCsntzsaFpAEgXysla826Pna+\njQIDAQAB\n-----END PUBLIC KEY-----\n"
ntugmba:
url: ntugmba.management.ntu.edu.tw
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs4WtrGLgj2FEZx+NnHzb\nK1HJ+V3qCJ7jIFH7mboeAjEPrAMLeFIdV4MvoasPALxuoo34oZl1NK6vYnfic5xk\nhV956QIzhB3vd4KDu1zbuYQO3ojlBSP3mbJPyHT6fKSkjLjKy0R5HEeT1+yLizC1\nMCPVBiP7mpaYIKPwfmMXFLA8GQxwBO2VpWpQD7jzd/+UWEXjKoK5t2uoMDL0k0w0\naffMcZKNntENXTRgnTq4iK39ayT95iXw81FH+LyEo5XtiHYsO2mhOPc9j5tU3GCO\nKwFmXPlh2+B1YwV+lkfCqpdT37Z3lLNFmw7sYidMvD3xIiFBsPKspoa1qlURmnuH\nvQIDAQAB\n-----END PUBLIC KEY-----\n"
ia:
url: ia.management.ntu.edu.tw
key: "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvlVvwFF+k6/UI9+hhTEi\n032nTnEG/8l3ARfpSsTPwijsyk+e8Utjq3sslHVGlWzmT74KYHoMwNDYXiAH2wpS\n4k+vUugOPYNkY46smDG5oCGVVbmCORzzpZsccpXhFGft378NhNiTRNhk4DBMrFwb\nlALdd9sUDbqcc+PBJIW3KXD66+rcyImHpkEaa8t0rkAd1ZIkfLbXyQWikvOMWYvJ\n3K2+N/vVInAbVOmBwZgK0iP7ZvwvwR/li0nAkdD12jgvgrR6gP2pC+qyH15J2zib\nEz8aLweNBYq/BXGxtWxioFHif22v9LUj1fkAFqEoTwVCIGDdXn2/R9febBkSSPuL\ngQIDAQAB\n-----END PUBLIC KEY-----\n"
+1 -3
View File
@@ -218,9 +218,7 @@ Orbit::Application.routes.draw do
get "import_data/sync_book_data" get "import_data/sync_book_data"
get "import_data/sync_journal_paper_data" get "import_data/sync_journal_paper_data"
get "import_data/sync_conference_data" get "import_data/sync_conference_data"
get "import_data/sync_book_data_auto"
get "import_data/sync_journal_paper_data_auto"
get "import_data/sync_conference_data_auto"
resources :tags do resources :tags do
collection do collection do
-20
View File
@@ -1,20 +0,0 @@
# Use this file to easily define all of your cron jobs.
#
# It's helpful, but not entirely necessary to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
# Example:
#
# set :output, "/path/to/my/cron_log.log"
#
every 1.day, :at => '11:00 pm' do
# command "/usr/bin/some_great_command"
# runner "MyModel.some_method"
rake "rake synchronize:data"
end
#
# every 4.days do
# runner "AnotherModel.prune_old_records"
# end
# Learn more: http://github.com/javan/whenever
-12
View File
@@ -1,12 +0,0 @@
# encoding: utf-8
namespace :synchronize do
desc "synchronize tasks"
task :data => :environment do
p Admin::ImportDataController.new.sync_book_data_auto
puts "Book Data Synchronization Complete"
p Admin::ImportDataController.new.sync_journal_paper_data_auto
puts "Journal Paper Data Synchronization Complete"
p Admin::ImportDataController.new.sync_conference_data_auto
puts "Conference Data Synchronization Complete"
end
end
@@ -32,8 +32,73 @@ var galleryAPI = function(){
} }
} }
} $(document).ready(function(){
//bindHandlers();
})
var bindHandlers = function(){
}
}
this.loadAlbums = function(id){
g.albumArea.find(".rghead .rgfn a").click(function(){g.makeNewAlbum($(this).attr("href"))});
g.albumArea.addClass('o_gallery');
g.albumArea.find("#imgholder").empty();
if(id!="all"){
var cids = [];
var tids = [];
var href = null;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
if(hash[0]=="cat"){
cids.push(hash[1]);
href = "cat="+hash[1];
}else if(hash[0]=="tag"){
tids.push(hash[1]);
href = "tag="+hash[1];
}
$("#filter .filter_btns a[href='"+href+"']").addClass("active");
}
if(cids.length == 0)
cids = "all";
}else{
var cids = "all";
}
$.getJSON("/panel/gallery/front_end/get_albums",{"cid":cids,"tid":tids,"inner":true},function(categories){
$.each(categories,function(x,category){
$.each(category,function(i,album){
album.description = (album.description?album.description:"<%= I18n.t('gallery.no_description') %>")
if(album.cover == "default")
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><img src='../../../assets/gallery/default.jpg'/></a><span class='albumname'><a title='"+album.description+"' href='?album="+album._id+"'>"+album.name+"</a></span><span class='categoryname'><i class='icon-folder-close'></i> "+album.category_name+"</span><span class='tagnames'></span></div>");
else
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><img src='"+album.cover_path+"'/></a><span class='albumname'><a title='"+album.description+"' href='?album="+album._id+"'>"+album.name+"</a></span><span class='categoryname'><i class='icon-folder-close'></i> "+album.category_name+"</span><span class='tagnames'></span></div>");
var tag_string = "";
for(tag in album.tag_names){
if(tag == album.tag_names.length-1)
tag_string+= '<span class="tags">' + album.tag_names[tag] + '</span>';
else
tag_string+= '<span class="tags">' + album.tag_names[tag] + ', </span>';
}
$img.find(".tagnames").html(tag_string);
g.albumArea.find("#imgholder").append($img);
})
})
})
}
this.loadImages = function(id){
g.albumArea.addClass('o_album');
g.albumArea.find("#imgholder").empty();
$.getJSON("panel/gallery/front_end/albums/"+id+"/imgs",{inner:true},function(album){
$.each(album.images,function(i,image){
var thumb = image.file.thumb.url;
image.description = (image.description?image.description:"<%= I18n.t('gallery.no_description') %>")
var $img = $("<div class='rgphoto'><a title='"+image.description+"' href='"+image.theater_link+"'><img src='"+thumb+"'/></a></div>");
g.albumArea.find("#imgholder").append($img);
})
})
}
this.loadTheater = function(id){ this.loadTheater = function(id){
var imageArray; var imageArray;
var imagecount = 0; var imagecount = 0;
@@ -1,15 +1,55 @@
class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
def index def index
if params[:category_id].blank?
@albums = GalleryAlbum.where()
else
@albums = GalleryAlbum.where(:category_id.in => params[:category_id])
end
end end
def show def show
@album = GalleryAlbum.find(params[:id]) @album = GalleryAlbum.find(params[:id])
@images = @album.gallery_images @tags = Tag.find(@album.tagged_ids).map{|t| t.name}
end
def get_albums
@categoryids = params["cid"]
@tags = params["tid"]
@albums = Array.new
if @categoryids == "all"
if @tags
if @tags.kind_of?(Array)
@tags.each do |tag|
@albums << GalleryAlbum.where(tagged_ids: tag)
end
else
@albums << GalleryAlbum.where(tagged_ids: @tags)
end
else
@albums << GalleryAlbum.all
end
else
@categoryids.each do |id|
category = GalleryCategory.find(id)
if @tags
if @tags.kind_of?(Array)
@tags.each do |tag|
@albums << category.gallery_albums.where(tagged_ids: tag)
end
else
@albums << category.gallery_albums.where(tagged_ids: @tags)
end
else
@albums << category.gallery_albums.all
end
end
end
@output = Array.new
@albums.each do |album|
@albs = Array.new
album.each do |values|
tags = Tag.find(values.tagged_ids).map{|t| t.name}
category = GalleryCategory.find(values.gallery_category_id).name
@albs << {"_id"=>values.id,"show_path"=>panel_gallery_front_end_album_path(values),"cover"=>values.cover,"cover_path"=>values.cover_path,"description"=>values.description,"category_name"=>category,"gallery_category_id" => values.gallery_category_id,"name"=>values.name,"tag_ids"=>values.tag_ids,"tag_names"=>tags}
end
@output << @albs
end
render :json=>@output.to_json
end end
def imgs def imgs
@@ -46,8 +86,7 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
@album = GalleryAlbum.find(@albumid) @album = GalleryAlbum.find(@albumid)
@images = @album.gallery_images.all @images = @album.gallery_images.all
tags = @album.tag_ids tags = @album.tag_ids
@tagnames = [] if tags.blank? @tagnames = Tag.find(tags.tagged_ids).map{|t| t.name}
@tagnames = Tag.find(tags.tagged_ids).map{|t| t.name} if !tags.blank?
@back_link = panel_gallery_front_end_album_path(@albumid) @back_link = panel_gallery_front_end_album_path(@albumid)
end end
end end
@@ -1,14 +0,0 @@
<div class='rgalbum'>
<a title='<%= album.name %>' href='<%= panel_gallery_front_end_album_path(album) %>'>
<% if album.cover == "default" %>
<%= image_tag "gallery/default.jpg" %>
<% else %>
<img src="<%= album.cover_path %>">
<% end %>
</a>
<span class='albumname'>
<a title='<%= album.description %>' href='<%= panel_gallery_front_end_album_path(album) %>'><%= album.name %></a>
</span>
<span class='categoryname'><i class='icon-folder-close'></i><%= Category.find(album.category_id).title %></span>
<span class='tagnames'></span>
</div>
@@ -1,5 +0,0 @@
<div class='rgphoto'>
<a title='<%= image.description %>' href='<%= theater_panel_gallery_front_end_album_path(image) %>'>
<img src='<%= image.file.thumb.url %>'/>
</a>
</div>
@@ -1,14 +1,42 @@
<%= stylesheet_link_tag "gallery_frontend" %> <%= stylesheet_link_tag "gallery_frontend" %>
<%#= stylesheet_link_tag "gallery" %>
<div id="orbit_gallery" class="rg"> <div id="orbit_gallery" class="rg">
<div class="rgbody"> <div class="rgbody">
<div id="imgholder"> <div id="imgholder">
<% @albums.each do |album| %>
<%= render :partial => "album", :object => album %>
<% end %>
</div> </div>
</div> </div>
<div class="rghead">
<div class="rgfn">
</div>
</div> </div>
</div>
<script type="text/javascript">
</script>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "galleryAPI_frontend" %>
<%= javascript_include_tag "jquery.tinyscrollbar" %>
<%= javascript_include_tag "rss" %>
<% end %>
<script type="text/javascript">
galleryAPI.prototype.locale = "<%= I18n.locale %>";
var gallery = new galleryAPI();
gallery.initialize();
if(typeof gallery.urlVars['cat']!= "undefined"){
gallery.loadArea = "albums";
gallery.loadAlbums(gallery.urlVars['cat']);
}else if(typeof gallery.urlVars['tag']!= "undefined"){
gallery.loadArea = "albums";
gallery.loadAlbums(gallery.urlVars['tag']);
}else{
gallery.loadArea = "albums";
gallery.loadAlbums("all");
}
</script>
@@ -1,12 +1,45 @@
<%= stylesheet_link_tag "gallery_frontend" %> <%= stylesheet_link_tag "gallery_frontend" %>
<div id="orbit_gallery" class="rg"> <div id="orbit_gallery" class="rg">
<div class="rgbody"> <div class="rgbody">
<div id="imgholder"> <div id="imgholder">
<% @images.each do |image| %>
<%= render :partial => "image", :object => image %>
<% end %>
</div> </div>
</div> </div>
<!-- tag part -->
<!-- add "album_tags" or "photo_tags" class to .taglist -->
<div class="taglist">
<h3 class="taglist_title"><%= t('gallery.album_tag') %></h3>
<ul>
<% @tags.each do |tag|%>
<li><%= tag %></li>
<% end %>
</ul>
</div>
<!-- tag end -->
<div class="form-actions form-fixed pagination-right rghead">
<div class="rgfn">
<a class="bt-back rgbt" title="<%= I18n.t("gallery.back_to_albums") %>" href="<%= panel_gallery_front_end_albums_path %>"><i class="icon-arrow-left"></i> <%= I18n.t("gallery.back_to_albums") %></a>
</div>
</div>
</div> </div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "galleryAPI_frontend" %>
<%= javascript_include_tag "jquery.tinyscrollbar" %>
<%= javascript_include_tag "rss" %>
<% end %>
<script type="text/javascript">
galleryAPI.prototype.locale = "<%= I18n.locale %>";
var gallery = new galleryAPI();
gallery.initialize();
gallery.loadArea = "images";
gallery.loadImages("<%= params[:id] %>");
</script>
@@ -1,26 +0,0 @@
class Panel::PersonalConference::FrontEnd::WritingConferencesController < OrbitWidgetController
def initialize
super
@app_title = 'personal_conference'
end
def index
@writing_conferences = WritingConference.desc(:year).page(params[:page]).per(10)
end
# GET /writing_conferences/1
# GET /writing_conferences/1.xml
def show
@writing_conference = WritingConference.find(params[:id])
@conference_paper_types = ( !@writing_conference.conference_paper_types.blank? ? @writing_conference.conference_paper_types.collect{|x| x.title}.join(', ') : nil)
@conference_author_types = ( !@writing_conference.conference_author_types.blank? ? @writing_conference.conference_author_types.collect{|x| x.title}.join(', ') : nil)
end
end
@@ -91,6 +91,7 @@ class WritingConference
title << "#{period_start_date}-#{period_end_date}" if (self.period_start_date.present? && self.period_end_date.present?) title << "#{period_start_date}-#{period_end_date}" if (self.period_start_date.present? && self.period_end_date.present?)
# title << "(#{self.conference_paper_types.collect{|x| x.title}.join(', ')})" # title << "(#{self.conference_paper_types.collect{|x| x.title}.join(', ')})"
title.join(', ') title.join(', ')
end end
protected protected