<%= child.title %>
diff --git a/app/views/kaminari/_first_page.mobile.erb b/app/views/kaminari/_first_page.mobile.erb
new file mode 100644
index 00000000..d6509d9e
--- /dev/null
+++ b/app/views/kaminari/_first_page.mobile.erb
@@ -0,0 +1,11 @@
+<%# Link to the "First" page
+ - available local variables
+ url: url to the first page
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+-%>
+
diff --git a/app/views/kaminari/_gap.mobile.erb b/app/views/kaminari/_gap.mobile.erb
new file mode 100644
index 00000000..c680799d
--- /dev/null
+++ b/app/views/kaminari/_gap.mobile.erb
@@ -0,0 +1,8 @@
+<%# Non-link tag that stands for skipped pages...
+ - available local variables
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+-%>
+
diff --git a/app/views/kaminari/_last_page.mobile.erb b/app/views/kaminari/_last_page.mobile.erb
new file mode 100644
index 00000000..fab90b65
--- /dev/null
+++ b/app/views/kaminari/_last_page.mobile.erb
@@ -0,0 +1,11 @@
+<%# Link to the "Last" page
+ - available local variables
+ url: url to the last page
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+-%>
+
diff --git a/app/views/kaminari/_next_page.mobile.erb b/app/views/kaminari/_next_page.mobile.erb
new file mode 100644
index 00000000..1af41ec0
--- /dev/null
+++ b/app/views/kaminari/_next_page.mobile.erb
@@ -0,0 +1,11 @@
+<%# Link to the "Next" page
+ - available local variables
+ url: url to the next page
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+-%>
+
diff --git a/app/views/kaminari/_page.mobile.erb b/app/views/kaminari/_page.mobile.erb
new file mode 100644
index 00000000..38f9533f
--- /dev/null
+++ b/app/views/kaminari/_page.mobile.erb
@@ -0,0 +1,16 @@
+<%# Link showing page number
+ - available local variables
+ page: a page object for "this" page
+ url: url to this page
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+-%>
+
diff --git a/app/views/kaminari/_paginator.mobile.erb b/app/views/kaminari/_paginator.mobile.erb
new file mode 100644
index 00000000..8871496f
--- /dev/null
+++ b/app/views/kaminari/_paginator.mobile.erb
@@ -0,0 +1,25 @@
+<%# The container tag
+ - available local variables
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+ paginator: the paginator that renders the pagination tags inside
+-%>
+<%= paginator.render do -%>
+
+<% end -%>
diff --git a/app/views/kaminari/_prev_page.mobile.erb b/app/views/kaminari/_prev_page.mobile.erb
new file mode 100644
index 00000000..d39b7618
--- /dev/null
+++ b/app/views/kaminari/_prev_page.mobile.erb
@@ -0,0 +1,11 @@
+<%# Link to the "Previous" page
+ - available local variables
+ url: url to the previous page
+ current_page: a page object for the currently displayed page
+ num_pages: total number of pages
+ per_page: number of items to fetch per page
+ remote: data-remote
+-%>
+
+
+
\ No newline at end of file
diff --git a/app/views/mobile/_footer.mobile.erb b/app/views/mobile/_footer.mobile.erb
new file mode 100644
index 00000000..fcee1e0d
--- /dev/null
+++ b/app/views/mobile/_footer.mobile.erb
@@ -0,0 +1,24 @@
+
\ No newline at end of file
diff --git a/app/views/mobile/_header.mobile.erb b/app/views/mobile/_header.mobile.erb
new file mode 100644
index 00000000..23f415cf
--- /dev/null
+++ b/app/views/mobile/_header.mobile.erb
@@ -0,0 +1,9 @@
+
+
+
+ <%= link_to mobile_dialog_language_path, {:class => "ui-btn-right language", "data-iconpos" => "notext", "data-icon" => "search", "data-rel" => "dialog"} do %>
+
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/mobile/_header_dialog_contact.mobile.erb b/app/views/mobile/_header_dialog_contact.mobile.erb
new file mode 100644
index 00000000..bb512814
--- /dev/null
+++ b/app/views/mobile/_header_dialog_contact.mobile.erb
@@ -0,0 +1,3 @@
+
+
<%= t('mobile.contact') %>
+
\ No newline at end of file
diff --git a/app/views/mobile/_header_dialog_copyright.mobile.erb b/app/views/mobile/_header_dialog_copyright.mobile.erb
new file mode 100644
index 00000000..99dbd8c3
--- /dev/null
+++ b/app/views/mobile/_header_dialog_copyright.mobile.erb
@@ -0,0 +1,3 @@
+
+
<%= t('mobile.copyright') %>
+
\ No newline at end of file
diff --git a/app/views/mobile/_header_dialog_language.mobile.erb b/app/views/mobile/_header_dialog_language.mobile.erb
new file mode 100644
index 00000000..cfb754b7
--- /dev/null
+++ b/app/views/mobile/_header_dialog_language.mobile.erb
@@ -0,0 +1,3 @@
+
+
<%= t('mobile.language') %>
+
\ No newline at end of file
diff --git a/app/views/mobile/_header_map.mobile.erb b/app/views/mobile/_header_map.mobile.erb
new file mode 100644
index 00000000..4911cf01
--- /dev/null
+++ b/app/views/mobile/_header_map.mobile.erb
@@ -0,0 +1,3 @@
+
+
<%= t('mobile.location') %>
+
\ No newline at end of file
diff --git a/app/views/mobile/_language_select.mobile.erb b/app/views/mobile/_language_select.mobile.erb
new file mode 100644
index 00000000..8e897dbd
--- /dev/null
+++ b/app/views/mobile/_language_select.mobile.erb
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/app/views/mobile/_menu.mobile.erb b/app/views/mobile/_menu.mobile.erb
new file mode 100644
index 00000000..3dabb424
--- /dev/null
+++ b/app/views/mobile/_menu.mobile.erb
@@ -0,0 +1,7 @@
+
+
+
\ No newline at end of file
diff --git a/app/views/mobile/announcement.mobile.erb b/app/views/mobile/announcement.mobile.erb
new file mode 100644
index 00000000..247ca214
--- /dev/null
+++ b/app/views/mobile/announcement.mobile.erb
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/app/views/mobile/map.mobile.erb b/app/views/mobile/map.mobile.erb
new file mode 100644
index 00000000..ba969acb
--- /dev/null
+++ b/app/views/mobile/map.mobile.erb
@@ -0,0 +1,5 @@
+<%= content_for :header do %>
+ <%= render 'header_map' %>
+<% end %>
+
+
\ No newline at end of file
diff --git a/app/views/mobile/page.mobile.erb b/app/views/mobile/page.mobile.erb
new file mode 100644
index 00000000..91c8ab71
--- /dev/null
+++ b/app/views/mobile/page.mobile.erb
@@ -0,0 +1,10 @@
+
+ <% @page_contexts.each do |page_context| %>
+
+ <%= link_to mobile_page_content_path(page_context) do %>
+
<%= page_context.page.title %>
+ <% end %>
+
+ <% end %>
+
+<%= paginate @page_contexts, :param_name => :page_main, :window => 2 %>
\ No newline at end of file
diff --git a/app/views/mobile/page_content.mobile.erb b/app/views/mobile/page_content.mobile.erb
new file mode 100644
index 00000000..bea0ab95
--- /dev/null
+++ b/app/views/mobile/page_content.mobile.erb
@@ -0,0 +1,2 @@
+
<%= @page_context.page.title %>
+
<%= @page_context.context.html_safe rescue '' %>
\ No newline at end of file
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 1a997c5f..8ab419a1 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -80,7 +80,7 @@ Devise.setup do |config|
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again.
# config.timeout_in = 10.minutes
- config.timeout_in = 10.minutes
+ config.timeout_in = 5.days
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
index 72aca7e4..087fb2ca 100644
--- a/config/initializers/mime_types.rb
+++ b/config/initializers/mime_types.rb
@@ -3,3 +3,5 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
+
+Mime::Type.register_alias "text/html", :mobile
diff --git a/config/initializers/nccu_ldap_connection.rb b/config/initializers/nccu_ldap_connection.rb
deleted file mode 100644
index 00e03367..00000000
--- a/config/initializers/nccu_ldap_connection.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-#encoding: utf-8
-require 'mysql2'
-
-$nccu_ldap_connection
-
-module NccuLdapConnection
- BASE = 'ou=People,dc=nccu,dc=edu,dc=tw'
-
- def self.establish
- $nccu_ldap_connection = Net::LDAP.new
- $nccu_ldap_connection.port =LDAP_CONFIG["port"]
- $nccu_ldap_connection.host = LDAP_CONFIG["host"]
- $nccu_ldap_connection.authenticate(LDAP_CONFIG["authenticate_info"],LDAP_CONFIG["authenticate_pwd"])
- end
-
-end
\ No newline at end of file
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 8dea5eb3..b499353e 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -284,7 +284,9 @@ en:
text: Text Area
passed: Approved
password: Password
- password_confirmation: Password Confirmation
+ password_change: Change password
+ password_confirmation: Password confirmation
+ password_current: Current password
pending: Pending
picture: Picture
placeholder: Placeholder
@@ -327,11 +329,13 @@ en:
description: Site description
description_help: ''
footer: Site footer
+ header: Site header
footer_help: ''
info: Site information
keywords: Site keywords
keywords_help: ''
language: Site language
+ mobile_version: Mobile version
search: Site Search
search_help: Please Enter the search argument for Google search.
settings: Site setting
diff --git a/config/locales/mobile.en.yml b/config/locales/mobile.en.yml
new file mode 100644
index 00000000..b72ca7c0
--- /dev/null
+++ b/config/locales/mobile.en.yml
@@ -0,0 +1,11 @@
+en:
+
+ mobile:
+ bulletin: Bulletin
+ contact: Contact
+ copyright: Copyright
+ home: Home
+ language: Language
+ location: Location
+ location_description: '
國立政治大學
11605 臺北市文山區指南路二段64號'
+ page: Page
\ No newline at end of file
diff --git a/config/locales/mobile.zh_tw.yml b/config/locales/mobile.zh_tw.yml
new file mode 100644
index 00000000..75dea668
--- /dev/null
+++ b/config/locales/mobile.zh_tw.yml
@@ -0,0 +1,11 @@
+zh_tw:
+
+ mobile:
+ bulletin: 公告
+ contact: 聯絡資訊
+ copyright: 版權宣告
+ home: 首頁
+ language: 語言
+ location: 地理位置
+ location_description: '
國立政治大學
11605 臺北市文山區指南路二段64號'
+ page: 頁面
\ No newline at end of file
diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml
index c8075b24..9de7cc63 100644
--- a/config/locales/zh_tw.yml
+++ b/config/locales/zh_tw.yml
@@ -284,7 +284,9 @@ zh_tw:
text: 文字區域
passed: 通過審核
password: 密碼
+ password_change: 更改密碼
password_confirmation: 確認密碼
+ password_current: 目前的密碼
pending: 待審核
picture: 圖片
placeholder: Placeholder
@@ -327,11 +329,13 @@ zh_tw:
description: 網站描述
description_help: ''
footer: 網站頁尾
+ header: 網站頁首
footer_help: ''
info: 網站資訊
keywords: 搜尋關鍵字
keywords_help: ''
language: 網站語言
+ mobile_version: 手機版
search: 網站搜尋
search_help: 請輸入送交Google搜尋的參數
settings: 基本設定
@@ -389,6 +393,7 @@ zh_tw:
paper: Paper was successfully updated.
user: User was successfully updated.
success_: S使用者已更新成功
+ update_: 更新
update_at: 最後更新時間
url: 網址
use_status: ''
diff --git a/config/routes.rb b/config/routes.rb
index 2c52f6ec..e9947768 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -241,6 +241,21 @@ Orbit::Application.routes.draw do
match 'show_sitemap' => 'front#show_sitemap', :as => :front_show_sitemap
end
+ scope '/mobile' do
+ match 'announcement' => 'mobile#announcement', :as => 'mobile_announcement'
+ match 'announcement_content/:id' => 'mobile#announcement_content', :as => 'mobile_announcement_content'
+ match 'dialog_contact' => 'mobile#dialog_contact', :as => 'mobile_dialog_contact'
+ match 'dialog_copyright' => 'mobile#dialog_copyright', :as => 'mobile_dialog_copyright'
+ match 'dialog_language' => 'mobile#dialog_language', :as => 'mobile_dialog_language'
+ match 'map' => 'mobile#map', :as => 'mobile_map'
+ match 'page' => 'mobile#page', :as => 'mobile_page'
+ match 'page_content/:id' => 'mobile#page_content', :as => 'mobile_page_content'
+ root :to => 'mobile#index', :as => 'mobile'
+ end
+
+
+ match '/panel/orbit_app/widget/:type' => 'default_widget#default_widget'
+
match '/panel/:app_name/front_end/:app_action/:id(/:controller_action)' => 'pages#show_from_link', :constraints => lambda { |request|
!request.query_string.include?("inner=true")
diff --git a/lib/orbit_app/error_handlers/applications_error_handler.rb b/lib/orbit_app/error_handlers/applications_error_handler.rb
new file mode 100644
index 00000000..2748f8c4
--- /dev/null
+++ b/lib/orbit_app/error_handlers/applications_error_handler.rb
@@ -0,0 +1,14 @@
+
+# require "#{File.dirname(__FILE__)}/module_app_error_handler.rb"
+# require "#{File.dirname(__FILE__)}/object_auth_error_handler.rb"
+# require "#{File.dirname(__FILE__)}/module_app_error_handler.rb"
+# require "#{File.dirname(__FILE__)}/page_error_handler.rb"
+
+
+# module OrbitApp
+# module ErrorHandlers
+# module ApplicationsErrorHandler
+
+# end
+# end
+# end
diff --git a/lib/orbit_app/error_handlers/module_app_error_handler.rb b/lib/orbit_app/error_handlers/module_app_error_handler.rb
new file mode 100644
index 00000000..74001d02
--- /dev/null
+++ b/lib/orbit_app/error_handlers/module_app_error_handler.rb
@@ -0,0 +1,16 @@
+module OrbitApp
+ module ErrorHandlers
+ module ModuleAppErrorHandler
+
+
+ def render_module_app_error(exception = nil)
+ default_message = 'ModuleAppErrorHandler'
+ meaasge = ''
+ if exception
+ meaasge = default_message + exception.message
+ end
+ render :text=>meaasge
+ end
+ end
+ end
+end
diff --git a/lib/orbit_app/error_handlers/object_auth_error_handler.rb b/lib/orbit_app/error_handlers/object_auth_error_handler.rb
new file mode 100644
index 00000000..8d65b4bc
--- /dev/null
+++ b/lib/orbit_app/error_handlers/object_auth_error_handler.rb
@@ -0,0 +1,16 @@
+module OrbitApp
+ module ErrorHandlers
+ module ObjectAuthErrorHandler
+
+
+ def render_object_auth_error(exception = nil)
+ default_message = 'This is a render_object_auth_error'
+ meaasge = ''
+ if exception
+ meaasge = default_message + exception.message
+ end
+ render :text=>meaasge
+ end
+ end
+ end
+end
diff --git a/lib/orbit_app/error_handlers/page_error_handler.rb b/lib/orbit_app/error_handlers/page_error_handler.rb
new file mode 100644
index 00000000..5bf76ba6
--- /dev/null
+++ b/lib/orbit_app/error_handlers/page_error_handler.rb
@@ -0,0 +1,16 @@
+module OrbitApp
+ module ErrorHandlers
+ module PageErrorHandler
+
+
+ def render_page_error(exception = nil)
+ default_message = 'ModuleAppErrorHandler'
+ meaasge = ''
+ if exception
+ meaasge = default_message + exception.message
+ end
+ render :text=>meaasge
+ end
+ end
+ end
+end
diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb
index 3abeeddd..4f1e6fd2 100644
--- a/lib/orbit_core_lib.rb
+++ b/lib/orbit_core_lib.rb
@@ -140,7 +140,7 @@ module OrbitCoreLib
protected
def generate_token
- self.s_token = ActiveSupport::SecureRandom.hex(16)
+ self.s_token = SecureRandom.hex(16)
self.save!
end
end
diff --git a/lib/parsers/parser_back_end.rb b/lib/parsers/parser_back_end.rb
index c3c43fe8..d0c1eab6 100644
--- a/lib/parsers/parser_back_end.rb
+++ b/lib/parsers/parser_back_end.rb
@@ -30,6 +30,7 @@ module ParserBackEnd
parse_images_edit(body, page)
parse_footer_edit(body, page)
parse_sub_menu_edit(body, page)
+ parse_counter_edit(body)
public_r_tags.each do |tag|
send("parse_#{tag}s_edit", body, page, true)
end
diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb
index 6dbec1e2..1f996cec 100644
--- a/lib/parsers/parser_common.rb
+++ b/lib/parsers/parser_common.rb
@@ -9,7 +9,7 @@ module ParserCommon
res << "'>"
i = nil
i = 1 if menu.values["li_incremental_#{current}"]
- children = current == 1 ? page.visible_children.reverse : page.visible_children
+ children = current == 1 ? page.visible_children : page.visible_children
children.each do |child|
res << menu_li(child, current_page, current, menu, i, edit)
i += 1 if i
@@ -206,8 +206,13 @@ module ParserCommon
when 'text'
ret << part.content rescue ''
when 'module_widget'
- url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true"
- options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}"
+ url = case part.widget_path
+ when 'default_widget'
+ "/panel/orbit_app/widget/#{part.widget_style}?inner=true"
+ else
+ "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true"
+ end
+ options = "&part_id=#{part.id}&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}"
ret << ""
when 'public_r_tag'
ret << ""
@@ -228,7 +233,7 @@ module ParserCommon
end
# page_counter
- def parse_counter(body = nil, page = nil, edit=nil)
+ def parse_counter_edit(body = nil)
body.css('.page_counter').each do |counter|
res = ''
case counter['option']
@@ -243,7 +248,7 @@ module ParserCommon
when 'this_year'
res << display_visitors_this_year.to_s
end
- fragment = Nokogiri::HTML::DocumentFragment.new(body, res)
+ fragment = Nokogiri::HTML::DocumentFragment.new(body, "
#{res}
")
counter.swap(fragment)
end
end
diff --git a/lib/parsers/parser_front_end.rb b/lib/parsers/parser_front_end.rb
index 11fe5934..246e6c20 100644
--- a/lib/parsers/parser_front_end.rb
+++ b/lib/parsers/parser_front_end.rb
@@ -11,6 +11,7 @@ module ParserFrontEnd
parse_images(body, page)
parse_menu(body, page)
parse_sub_menu(body, page, site)
+ parse_counter(body)
i18n.merge!({locale => body.to_html})
end
i18n
@@ -21,10 +22,14 @@ module ParserFrontEnd
tag = params[:tag_id].blank? ? page[:tag] : params[:tag_id]
body = Nokogiri::HTML(page.content)
body.css('orbit_front').each do |front|
- ret = ''
- part = PagePart.find(front['part_id']) if front['part_id']
- ret << eval("\"#{front['path']}\"") rescue ''
- fragment = Nokogiri::HTML::DocumentFragment.new(body, "")
+ if front['value']
+ fragment = Nokogiri::HTML::DocumentFragment.new(body, "
#{eval(front['value']).to_s}
")
+ else
+ ret = ''
+ part = PagePart.find(front['part_id']) if front['part_id']
+ ret << eval("\"#{front['path']}\"") rescue ''
+ fragment = Nokogiri::HTML::DocumentFragment.new(body, "")
+ end
front.swap(fragment)
end
body.to_html
@@ -102,9 +107,18 @@ module ParserFrontEnd
when 'text'
ret << part.content_translations[locale.to_s] rescue ''
when 'module_widget'
- url = "/panel/\#{part.module_app.key}/widget/\#{part.widget_path}?inner=true"
- options = "&category_id=\#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=\#{!part[:tag].blank? ? part[:tag] : tag}&page=\#{params[:page]}&search_query=\#{params[:search_query]}&part_title=\#{Rack::Utils.escape(part_title).gsub(\"\+\", \"\%20\") rescue nil}"
- ret << "
\ No newline at end of file
diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.js.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.js.erb
new file mode 100644
index 00000000..4ca2c879
--- /dev/null
+++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.js.erb
@@ -0,0 +1 @@
+$('#web_link_widget').html("<%= j render 'index' %>")
\ No newline at end of file