Compare commits

..

5 Commits

8 changed files with 50 additions and 69 deletions

View File

@ -15,6 +15,11 @@ function load_tinymce() {
theme_advanced_statusbar_location : "bottom", theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true, 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 options
skin : "o2k7", skin : "o2k7",
skin_variant : "silver", skin_variant : "silver",

View File

@ -43,7 +43,7 @@ class MobileController < ApplicationController
def page def page
@page_title = t('mobile.page') @page_title = t('mobile.page')
@page_contexts = PageContext.where(:archived => false).page(params[:page_main]).per(15) @page_contexts = get_sorted_page_from_structure
end end
def page_content def page_content
@ -57,4 +57,12 @@ class MobileController < ApplicationController
@no_footer = true if request.path =~ /app/ @no_footer = true if request.path =~ /app/
end end
def get_sorted_page_from_structure
page_contexts = Item.structure_ordered_items.inject([]){ |pages, page|
pages << page.page_contexts.where(archived: false).limit(1)[0] if page.is_a?(Page) && !page.page_contexts.blank?
pages
}
Kaminari.paginate_array(page_contexts).page(params[:page]).per(15)
end
end end

View File

@ -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

View File

@ -3,8 +3,6 @@ Orbit::Application.routes.draw do
devise_for :users,:controllers => {:sessions => 'sessions'}
devise_for :users do devise_for :users do
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
end end

View File

@ -32,7 +32,13 @@ module ParserFrontEnd
ret = '' ret = ''
part = PagePart.find(front['part_id']) if front['part_id'] part = PagePart.find(front['part_id']) if front['part_id']
ret << eval("\"#{front['path']}\"") rescue '' 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>") fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load widget' path='#{ret}'></div>")
end end
front.swap(fragment) front.swap(fragment)

View File

@ -29,8 +29,8 @@ module Announcement
widgets do widgets do
default_widget do default_widget do
sorting 'desc(:postdate)' sorting 'desc(:is_top, :postdate)'
query 'Bulletin.available_for_lang(I18n.locale).any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now,:postdate.lte => Time.now} )' query 'Bulletin.can_display.available_for_lang(I18n.locale).any_of( {deadline: nil,:postdate.lte => Time.now} , {:deadline.gte => Time.now,:postdate.lte => Time.now} )'
enable ["typeA","typeB_style3","typeC"] enable ["typeA","typeB_style3","typeC"]
image :image image :image
field :postdate field :postdate

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -9,15 +9,38 @@ class Panel::Gallery::Widget::AlbumsController < OrbitWidgetController
@album = GalleryAlbum.find(@part.widget_options['album_id']) rescue nil @album = GalleryAlbum.find(@part.widget_options['album_id']) rescue nil
@album_images = @album.gallery_images if @album @album_images = @album.gallery_images if @album
@settings = {"vertical"=>vertical,"horizontal"=>horizontal} #[note] horizontal has it's limitation from 2 to 6 @settings = {"vertical"=>vertical,"horizontal"=>horizontal} #[note] horizontal has it's limitation from 2 to 6
@class = "c" + @settings["horizontal"].to_s @class = "c" + @settings["horizontal"].to_s
@total = @settings["vertical"] * @settings["horizontal"] @total = @settings["vertical"] * @settings["horizontal"]
@rnd = Random.new @rnd = Random.new
@images = [] @images = []
for i in 0..@total-1
image = @album_images[@rnd.rand(0...@album_images.count)] if @album_images.count > @total
values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url} @randoms = []
@images << values 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
end end
end end