merge with november_presentation

This commit is contained in:
chris2tof committed 2011-12-20 16:47:17 +08:00
1 parent afbffe37d5
commit a09f8e4551
101 files changed
+891 -10632

No files matched your search

@@ -0,0 +1,17 @@
class Admin::AppAuthsController < ApplicationController
layout "admin"
before_filter :authenticate_user!
before_filter :is_admin?
def index
@roles = Role.all.entries
apps = Purchase.where(:type =>"App")
@app_auth_data = apps.entries.map do |app|
app_c = eval(app.app_controller)
obj = app_c.new
obj_auth = obj.send "auth"
[:app_obj => app,:auth_field => obj_auth]
end
end
end
@@ -0,0 +1,9 @@
class Admin::ModuleAppsController < ApplicationController
def reload_frontend_pages
@module_app = ModuleApp.find(params[:id])
respond_to do |format|
format.js {}
end
end
end
@@ -19,6 +19,7 @@ class Admin::PagesController < ApplicationController
def new
@item = Page.new
@apps = ModuleApp.all
@item.is_published = true
@item.parent_id = @parent_item.id rescue nil
@designs = Design.all.entries
@@ -27,6 +28,7 @@ class Admin::PagesController < ApplicationController
def edit
@item = Page.find(params[:id])
@apps = ModuleApp.all
@i18n_variable = @item.i18n_variable
@designs = Design.all.entries
@design = @item.design
+2 -2
View File
@@ -36,9 +36,9 @@ class ApplicationController < ActionController::Base
end
# Render the page
def render_page
def render_page(url = nil)
if @item
render :text => parse_page(@item)
render :text => parse_page(@item,url)
else
render :text => '404 Not Found'
end
+22 -13
View File
@@ -9,19 +9,28 @@ class PagesController < ApplicationController
end
end
def show
begin
item = Item.first(:conditions => {:full_name => params[:page_name]})
case item._type
when 'Page'
@item = item
render_page
when 'Link'
redirect_to "http://#{item[:url]}"
end
rescue
render :file => "#{Rails.root}/public/404.html", :status => :not_found
end
def appfront
pre_uri = URI.split request.env['HTTP_REFERER']
pre_item_fullname = pre_uri[5][1..-1]
@item = Item.first(:conditions => {:full_name => pre_item_fullname})
redirect_to (request.env['HTTP_REFERER'].partition("?")[0]+"?app_url=#{request.fullpath}")
end
def show
begin
item = Item.first(:conditions => {:full_name => params[:page_name]})
case item._type
when 'Page'
@item = item
render_page ((params[:app_url]+'?inner='+"true" if params[:app_url]))
when 'Link'
redirect_to "http://#{item[:url]}"
end
rescue
render :file => "#{Rails.root}/public/404.html", :status => :not_found
end
end
end