+ <% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/desktop/co_authors/index.html.erb b/app/views/desktop/co_authors/index.html.erb
index 9881e2bd6..4c8e297e4 100644
--- a/app/views/desktop/co_authors/index.html.erb
+++ b/app/views/desktop/co_authors/index.html.erb
@@ -1,7 +1,7 @@
- <%= link_to "New Co-Author", new_desktop_co_author_path, :class=>"bt-co-author fn_btn hp hh2 thmc2 thmtxt" %>
- <%= link_to "New Type", desktop_co_author_relations_path, :class=>"bt-new-type fn_btn hp hh2 thmc2 thmtxt" %>
+ <%= link_to "New Co-Author", new_desktop_co_author_path, :class=>"bt-co-author fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %>
+ <%= link_to "New Type", desktop_co_author_relations_path, :class=>"bt-new-type fn_btn hp hh2 thmc2 thmtxt", "ajax-remote"=>"get" %>
<%= 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 000000000..d6509d9e5
--- /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 000000000..c680799dd
--- /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 000000000..fab90b659
--- /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 000000000..1af41ec00
--- /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 000000000..38f9533ff
--- /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 000000000..8871496fe
--- /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 000000000..d39b7618e
--- /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 000000000..fcee1e0d9
--- /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 000000000..23f415cf6
--- /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 000000000..bb512814d
--- /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 000000000..99dbd8c35
--- /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 000000000..cfb754b76
--- /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 000000000..4911cf014
--- /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 000000000..8e897dbdb
--- /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 000000000..3dabb424b
--- /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 000000000..247ca2148
--- /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 000000000..ba969acb6
--- /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 000000000..91c8ab71f
--- /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 000000000..bea0ab95a
--- /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/environments/development.rb b/config/environments/development.rb
index 1ae657f60..ed5dc3a6a 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -10,7 +10,7 @@ Orbit::Application.configure do
config.whiny_nils = true
# Show full error reports and disable caching
- config.consider_all_requests_local = false
+ config.consider_all_requests_local = true
#config.action_view.debug_rjs = true
config.action_controller.perform_caching = true
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 1a997c5f0..8ab419a15 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 72aca7e44..087fb2caf 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 00e033670..000000000
--- 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 8dea5eb3b..b499353ee 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 000000000..b72ca7c0a
--- /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 000000000..75dea668d
--- /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 9c087807b..291f5264f 100644
--- a/config/locales/zh_tw.yml
+++ b/config/locales/zh_tw.yml
@@ -234,6 +234,9 @@ zh_tw:
text: 文字區域
passed: 通過審核
password: 密碼
+ password_change: 更改密碼
+ password_confirmation: 確認密碼
+ password_current: 目前的密碼
pending: 待審核
picture: 圖片
postdate: 張貼日期
@@ -270,11 +273,13 @@ zh_tw:
description: 網站描述
description_help: ''
footer: 網站頁尾
+ header: 網站頁首
footer_help: ''
info: 網站資訊
keywords: 搜尋關鍵字
keywords_help: ''
language: 網站語言
+ mobile_version: 手機版
search: 網站搜尋
search_help: 請輸入送交Google搜尋的參數
settings: 基本設定
@@ -327,6 +332,9 @@ zh_tw:
page: 頁面已更新成功
user: 使用者已更新成功
success_: 更新成功
+ paper: Paper was successfully updated.
+ user: User was successfully updated.
+ success_: S使用者已更新成功
update_: 更新
update_at: 最後更新時間
url: 網址
diff --git a/config/routes.rb b/config/routes.rb
index f0ead88e2..20ddb31ff 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -164,25 +164,25 @@ Orbit::Application.routes.draw do
end
match "desktop" => "desktop#index"
- namespace :desktop do
- match "desktop" => "desktop#desktop"
- match '/journal_pages/get_journals_json' => 'journal_pages#get_journals_json'
- match '/desktop'=>'desktop#desktop'
- match '/app_manager'=>'desktop#app_manager'
- match '/allsections'=>'desktop#allsections'
- match '/settings'=>'desktop#settings'
- match '/get_desktop_settings/'=>'desktop#get_desktop_settings'
- match '/save_desktop_settings/'=>'desktop#save_desktop_settings'
- match '/getgroups/'=>'desktop#getgroups'
- match '/getsectionlist/'=>'desktop#getsectionlist'
- match '/themes/'=>'desktop#themes'
- match '/sections/'=>'desktop#sections'
- match '/getapplist/'=>'desktop#getapplist'
- match '/newpositions/'=>'desktop#newpositions'
- match '/connections/'=>'desktop#connections'
- match '/widget_layout' => 'desktop#widget_layout'
- match '/temp_func/'=>'desktop#temp_func'
+ match "/desktop/desktop" => "desktop#desktop"
+ match '/desktop/desktop'=>'desktop#desktop'
+ match '/desktop/app_manager'=>'desktop#app_manager'
+ match '/desktop/allsections'=>'desktop#allsections'
+ match '/desktop/settings'=>'desktop#settings'
+ match '/desktop/get_desktop_settings/'=>'desktop#get_desktop_settings'
+ match '/desktop/save_desktop_settings/'=>'desktop#save_desktop_settings'
+ match '/desktop/getgroups/'=>'desktop#getgroups'
+ match '/desktop/getsectionlist/'=>'desktop#getsectionlist'
+ match '/desktop/themes/'=>'desktop#themes'
+ match '/desktop/sections/'=>'desktop#sections'
+ match '/desktop/getapplist/'=>'desktop#getapplist'
+ match '/desktop/newpositions/'=>'desktop#newpositions'
+ match '/desktop/connections/'=>'desktop#connections'
+ match '/desktop/widget_layout' => 'desktop#widget_layout'
+ match '/desktop/temp_func/'=>'desktop#temp_func'
+ namespace :desktop do
+ match '/journal_pages/get_journals_json' => 'journal_pages#get_journals_json'
resources :journal_pages, except: :show
resources :journal_lists, only: :index
resources :co_authors, except: :show
@@ -241,8 +241,22 @@ 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 000000000..2748f8c46
--- /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 000000000..8cf5decd1
--- /dev/null
+++ b/lib/orbit_app/error_handlers/module_app_error_handler.rb
@@ -0,0 +1,17 @@
+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 000000000..62eb137cf
--- /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 000000000..44ecda1f6
--- /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 5be4de3bf..9820615bc 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 c3c43fe8d..d0c1eab6d 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 f7fb5598b..1075fe757 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
@@ -207,13 +207,13 @@ module ParserCommon
ret << part.content rescue ''
when 'module_widget'
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 = "&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}&part_id=#{part.id}"
+ when 'default_widget'
+ "/panel/orbit_app/widget/#{part.widget_style}?inner=true"
+ else
+ raise ModuleAppError,"PagePart can't find ModuleApp" if part.module_app.nil?
+ "/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 << ""
@@ -234,7 +234,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']
@@ -249,7 +249,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 119c27061..29328174f 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
@@ -111,7 +116,7 @@ module ParserFrontEnd
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 << ""
@@ -131,6 +136,26 @@ module ParserFrontEnd
end
end
+ def parse_counter(body = nil)
+ body.css('.page_counter').each do |counter|
+ ret = ''
+ case counter['option']
+ when 'all'
+ ret << "display_visitors"
+ when 'today'
+ ret << "display_visitors_today"
+ when 'this_week'
+ ret << "display_visitors_this_week"
+ when 'this_month'
+ ret << "display_visitors_this_month"
+ when 'this_year'
+ ret << "display_visitors_this_year"
+ end
+ fragment = Nokogiri::HTML::DocumentFragment.new(body, "")
+ counter.swap(fragment)
+ end
+ end
+
# ad_banners
def generate_ad_banners(*args)
""
diff --git a/lib/tasks/migrate.rake b/lib/tasks/migrate.rake
index da07e20ad..639943888 100644
--- a/lib/tasks/migrate.rake
+++ b/lib/tasks/migrate.rake
@@ -312,4 +312,76 @@ namespace :migrate do
end
end
+ task :recreate_page_parts => :environment do
+ Page.all.each do |page|
+ page.create_parts
+ page.save
+ end
+ end
+
+
+ task :add_widget_options_to_gallery => :environment do
+ a = ModuleApp.where(:key=>'gallery').first
+ a.widget_options = {"widget1"=>{"vertical"=>[1, 2], "horizontal"=>[1, 2, 3, 4, 5, 6]}}
+ a.widget_options_fields_i18n = {"widget1"=>{"vertical"=>"gallery.widget_option.vertical", "horizontal"=>"gallery.widget_option.horizontal"}}
+ a.save
+
+ end
+
+ task :clean_object_auth => :environment do
+ ObjectAuth.destroy_all
+ end
+
+ task :correct_gallery_widget => :environment do
+ @module_app = ModuleApp.where(:key=>'gallery').first
+ @module_app.widgets=["widget1"]
+ @module_app.save
+ end
+
+ task :reinstall_calendar => :environment do
+ old_calendar = ModuleApp.where(key: "calendar")
+ old_calendar.destroy_all unless old_calendar.empty?
+ ModuleApp.new.from_json(File.open("#{Rails.root}/vendor/built_in_modules/calendar/calendar.json").read).save
+ end
+
+ task :reinstall_gallery => :environment do
+ old_gallery = ModuleApp.where(key: "gallery")
+ old_gallery.destroy_all unless old_gallery.empty?
+ ModuleApp.new.from_json(File.open("#{Rails.root}/vendor/built_in_modules/gallery/gallery.json").read).save
+ end
+
+
+ task :make_default_widget_work_config => :environment do
+ a = ModuleApp.where(:key=>'announcement').first
+ a.widgets[:default_widget] = ['typeA','typeC','typeB_style2','typeB_style3','typeB_style4']
+ a.widget_fields = [
+ ["title","announcement.default_widget.title"],
+ ["bulletin_category_with_title","announcement.default_widget.bulletin_category_with_title"],
+ ["postdate","announcement.default_widget.postdate"]
+ ]
+ a.get_default_widget = {:query=>'Bulletin.all',:image=> 'image'}
+ a.widget_fields_link_method = {
+ "title"=>{:method => 'panel_announcement_front_end_bulletin_path',
+ :args=>:self},
+ "bulletin_category_with_title"=>{
+ :method => 'panel_announcement_front_end_bulletins_path',
+ :args=>{:category_id => [:bulletin_category,:id]}}
+ }
+ a.save
+ end
+
+
+ task :reorder_items => :environment do
+ reorder_children(Item.root)
+ end
+
+ def reorder_children(parent)
+ parent.children.each_with_index do |child, i|
+ child.position = i
+ child.save
+ reorder_children(child) if child.children
+ end
+ end
+
+
end
diff --git a/public/static/kernel.js b/public/static/kernel.js
index f8f95e61d..cef6f0661 100644
--- a/public/static/kernel.js
+++ b/public/static/kernel.js
@@ -27,7 +27,7 @@ function getTimeout() {
}
$(document).ready(function() {
- $('.slideshow').children('img').click(function()
+ $(document).on('click', '.slideshow img', function()
{
if($(this).attr('link_url')!='')
{
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb
index fcd5f205f..9457bb5b3 100644
--- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb
@@ -207,31 +207,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
# PUT /bulletins/1.xml
def update
- if params[:bulletin_link]
-
- @bulletin_link = BulletinLink.find(params[:id])
- @link_url = panel_announcement_back_end_bulletin_path(@bulletin_link)
-
- respond_to do |format|
- if @bulletin_link.update_attributes(params[:bulletin_link])
- # format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
- format.js { render 'update_bulletin_link' }
- end
- end
-
- elsif params[:bulletin_file]
-
- @bulletin_file = BulletinFile.find(params[:id])
- @file_url = panel_announcement_back_end_bulletin_path(@bulletin_file)
- respond_to do |format|
-
- if @bulletin_file.update_attributes(params[:bulletin_file])
- # format.html { redirect_to(panel_announcement_back_end_bulletins_url) }
- format.js { render 'update_bulletin_file' }
- end
- end
-
- else
@bulletin = Bulletin.find(params[:id])
@@ -273,7 +248,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
end
end
- end
# DELETE /bulletins/1
# DELETE /bulletins/1.xml
@@ -362,10 +336,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
def clean_values
if params[:bulletin]
params[:bulletin][:bulletin_links_attributes].each_with_index do |link, index|
- params[:bulletin][:bulletin_links_attributes].delete(index.to_s) if link[1]['url'].blank? and link[1]['title'].blank?
+ params[:bulletin][:bulletin_links_attributes].delete(index.to_s) if link[1]['url'].blank? and link[1]['title_translations'].blank?
end rescue nil
params[:bulletin][:bulletin_files_attributes].each_with_index do |link, index|
- params[:bulletin][:bulletin_files_attributes].delete(index.to_s) if link[1]['file'].blank? and link[1]['title'].blank?
+ params[:bulletin][:bulletin_files_attributes].delete(index.to_s) if link[1]['file'].blank? and link[1]['title_translations'].blank?
end rescue nil
end
end
diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
index 456d57d96..2fe0f711d 100644
--- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
+++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb
@@ -64,7 +64,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController
preview_content
else
@bulletin = Bulletin.all.can_display.where(_id: params[:id]).first
- if !@bulletin.disable? and !@bulletin.is_rejected
+ if @bulletin and !@bulletin.disable? and !@bulletin.is_rejected
if @bulletin.enabled_for_lang(I18n.locale.to_s)
impressionist(@bulletin)
get_categorys
diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb
index 7b145bd2a..7cb16a3b7 100644
--- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb
+++ b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb
@@ -37,21 +37,22 @@ module Panel::Announcement::BackEnd::BulletinsHelper
end
def file_picture_preview_setting(file_path)
- res= ""
- ext = File.extname(file_path)
+ ext = File.extname(file_path)[1..-1].downcase
unless file_path.nil?
case ext
- when ".jpg",".jpeg",".png",".gif"
- #res = '
\ 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 000000000..4ca2c879c
--- /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