member plugin edit

This commit is contained in:
unknown committed 2013-02-20 17:25:20 +08:00
commit bc44d38948
319 files changed
+5405 -2763

No files matched your search

@@ -9,32 +9,6 @@ class Admin::ModuleAppsController < ApplicationController
end
def reload_frontend_pages
@categories =[]
@module_app = ModuleApp.find(params[:id])
@frontend_path = @module_app.widgets.keys[0] if ( !@module_app.widgets.blank? && @module_app.widgets[0].blank? )
@frontend_style = @module_app.widgets[@frontend_path] if ( !@frontend_path.blank? )
case @module_app.key
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'news'
@categories = NewsBulletinCategory.all
@tags = NewsTag.all
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
when 'archive'
@categories = ArchiveFileCategory.all
@tags = ArchiveTag.all
end
respond_to do |format|
format.js {}
end
end
def module_auth_proc
@module_app = ModuleApp.find(params[:id])
@@ -136,7 +110,6 @@ class Admin::ModuleAppsController < ApplicationController
end
#user is not permited to do that
flash[:notice] = t('app_auth.operation_not_permitted')
render :nothing => true, :status => 403
end
render :nothing => true,:status => 403
end
end
@@ -1,5 +1,5 @@
class Admin::ObjectAuthsController < ApplicationController
include OrbitCoreLib::PermissionUnility
include OrbitCoreLib::PermissionUtility
layout "new_admin"
before_filter :force_order
# before_filter :is_admin? ,:only => :index
@@ -1,7 +1,11 @@
class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
include OrbitCoreLib::PermissionUnility
include OrbitCoreLib::PermissionUtility
before_filter :force_order
def set_module_app
@module_app = ModuleApp.where(:title=>'Announcement').first
end
def setting
@sys_users = User.all(conditions: {admin: false}).includes(:avatar).not_guest_user
@@ -59,6 +63,7 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController
def force_order
authenticate_user!
set_module_app
setup_vars
check_if_user_can_do_object_auth
end
+33 -47
View File
@@ -25,31 +25,28 @@ class Admin::PagePartsController < ApplicationController
def edit
@part = PagePart.find(params[:id])
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@module_app = @part.module_app ? @part.module_app : @module_apps[0]
@module_app = @part.module_app ? @part.module_app : nil
@user_choose = @part.widget_path
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
@tag_objects = @r_tag.classify.constantize.all rescue nil
if @module_app
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
@widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil? or @module_app.nil?
end
unless @module_app.nil?
@categories = @module_app.get_categories
@tags = @module_app.get_tags
end
@widget_path = @part.widget_path ? @part.widget_path : (@module_app.widgets.keys[0] rescue nil)
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
if @module_app.widgets.any?{|b| b.class == Array}
if @module_app && @module_app.widgets.any?{|b| b.class == Array}
@widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
end
case @module_app.key
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'gallery'
@albums = GalleryAlbum.all
@tags = []
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
when 'archive'
@categories = ArchiveFileCategory.all
@tags = ArchiveTag.all
end
end
def create
@@ -59,9 +56,12 @@ class Admin::PagePartsController < ApplicationController
def update
@part = PagePart.find(params[:id])
params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] ) if params[:page_part][:widget_field]
params[:page_part][:widget_field_type] = nil
params[:page_part][:widget_field] = params[:page_part][:widget_field].zip( params[:page_part][:widget_field_type] ) if params[:page_part][:widget_field]
params[:page_part][:widget_field_type] = nil
if params[:page_part][:module_app].blank?
params[:page_part][:module_app] = nil
end
if @part.update_attributes(params[:page_part])
set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu')
flash.now[:notice] = t('update.success.content')
@@ -91,30 +91,14 @@ class Admin::PagePartsController < ApplicationController
end
def reload_widgets
@part = PagePart.find params[:part_id]
@categories =[]
@module_app = ModuleApp.find(params[:id])
@widget_path = @module_app.widgets.keys[0] if ( @module_app.widgets[0].blank? )
@part = PagePart.find params[:id]
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@categories =@module_app ? @module_app.get_categories : []
@tags =@module_app ? @module_app.get_tags : []
@widget_path = @module_app.widgets.keys[0] if (@module_app && @module_app.widgets[0].blank? )
@widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? )
case @module_app.key
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'gallery'
@albums = GalleryAlbum.all
@tags = []
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
when 'archive'
@categories = ArchiveFileCategory.all
@tags = ArchiveTag.all
end
@part.widget_path = @module_app.widgets.first if @module_app.needs_to_widget_option?
@part.widget_path = @module_app.widgets.first if( @module_app)
respond_to do |format|
format.js {}
end
@@ -122,9 +106,11 @@ class Admin::PagePartsController < ApplicationController
def reload_widget_styles
@module_app = ModuleApp.find(params[:module_app_id])
@part = PagePart.find params[:part_id]
@user_choose =@widget_path= params[:id]
@widget_style = @module_app.widgets[params[:id]]
@part = PagePart.find params[:id]
@user_choose =@widget_path= params[:frontend]
@widget_style = @module_app.widgets[@widget_path]
respond_to do |format|
format.js {}
+51 -10
View File
@@ -19,15 +19,21 @@ helper Admin::PagePartsHelper
end
def edit
@item = Page.find(params[:id])
@item = @page =Page.find(params[:id])
@user_choose = @item.app_frontend_url
@apps = ModuleApp.excludes(app_pages: nil).entries
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@designs = Design.all.entries
@design = @item.design ? @item.design : @designs.first
@app_frontend_urls = @item.module_app.app_pages if @item.module_app
if @item.module_app
@app_frontend_urls = @item.module_app.app_pages.map{|t| [I18n.t(t[0]),t[1]]}
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if @item.module_app.has_default_widget?
end
if @item.module_app
@module_app = @item.module_app
@@ -84,13 +90,13 @@ helper Admin::PagePartsHelper
def update
@item = Page.find(params[:id])
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
end
params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] ) if params[:page][:frontend_field]
params[:page][:frontend_field_type] = nil
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
end
params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type] ) if params[:page][:frontend_field]
params[:page][:frontend_field_type] = nil
if @item.update_attributes(params[:page])
flash[:notice] = t('update.success.page')
respond_to do |format|
@@ -123,7 +129,42 @@ helper Admin::PagePartsHelper
format.js { @item = @item.parent }
end
end
def reload_front_end_setting
@page = Page.find params[:id]
@module_app = ModuleApp.find params[:module_app_id]
@chosen_frontend = @user_choose = params[:frontend]
end
def reload_frontend_pages
@page = Page.find params[:id] rescue nil
# @categories =[]
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages.map{|t| [I18n.t(t[0]),t[1]]}
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if(@module_app && @module_app.has_default_widget?)
case (@module_app.nil? ? nil : @module_app.key )
when 'announcement'
@categories = BulletinCategory.all
@tags = AnnouncementTag.all
when 'news'
@categories = NewsBulletinCategory.all
@tags = NewsTag.all
when 'web_resource'
@categories = WebLinkCategory.all
@tags = WebResourceTag.all
when 'archive'
@categories = ArchiveFileCategory.all
@tags = ArchiveTag.all
else
@categories = []
@tags = []
end
respond_to do |format|
format.js {}
end
end
def reload_themes
@design = Design.find(params[:id])
@themes = @design.themes
+1 -1
View File
@@ -4,7 +4,7 @@ class Admin::PluginsController < ApplicationController
def index
@plugins = OrbitApp::Module::Registration.all
@plugins = OrbitApp::Plugin::Registration.all
if(!params[:show_plugin_profile].nil?)
@@ -36,7 +36,7 @@ class Admin::UsersNewInterfaceController < OrbitBackendController
def show
@user = User.find(params[:id])
@plugins = OrbitApp::Module::Registration.all
@plugins = OrbitApp::Plugin::Registration.all
@profile_data = []
@teacher_data = []
+17 -15
View File
@@ -1,7 +1,12 @@
class DefaultWidgetController< OrbitWidgetController
def front_end_available(var)
@page_part = PagePart.find params[:part_id]
@page_part = case params[:item_type]
when "page"
Page.find params[:page_id]
when "page_part"
PagePart.find params[:part_id]
end
@page_part.module_app.enable_frontend?
end
@@ -9,11 +14,17 @@ class DefaultWidgetController< OrbitWidgetController
@tag_class = nil
@default_widget = @page_part.module_app.get_default_widget
@widget_image_field = @default_widget[:image]
data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
@widget_image_field = @default_widget["image"] || @default_widget[:image]
data_limit = case @page_part
when Page
@fields = @page_part.frontend_field
@page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
when PagePart
@fields = @page_part.widget_field
@page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
end
@data = eval(@default_widget["query"]).limit(data_limit).includes(@widget_image_field)
@fields = @page_part.widget_field
case params[:type]
when "typeA"
@tag_class = 'default_widget_typeA'
@@ -26,15 +37,6 @@ class DefaultWidgetController< OrbitWidgetController
render "typeC"
end
# {"inner"=>"true",
# "category_id"=>"false",
# "tag_id"=>"",
# "page"=>"",
# "search_query"=>"",
# "part_title"=>"",
# "part_id"=>"50ac426f83e75219d20000a7",
# "controller"=>"default_widget",
# "action"=>"default_widget",
# "type"=>"typeA"}
end
end
@@ -1,75 +0,0 @@
class DesktopPublicationsController< ApplicationController
def journal_p
render "desktop/journal_p", :layout => false
end
def journal_p_list
render "desktop/journal_pages/list", :layout => false
end
def journal_p_add
debugger
render "desktop/journal_pages/add", :layout => false
end
def books
render "desktop/books", :layout => false
end
def books_list
render "desktop/books/list", :layout => false
end
def books_add
render "desktop/books/add", :layout => false
end
def seminar_p
render "desktop/seminar_p", :layout => false
end
def seminar_p_list
render "desktop/seminar_pages/list", :layout => false
end
def seminar_p_add
render "desktop/seminar_pages/add", :layout => false
end
def create_journal
Journal.create(user_id: current_user.id, title: "Ice Cream Sandwich")
b = Array.new
b << {"success"=>"true"}
render :json=>b.to_json
end
def getjournals
@journals = current_user.journals
data = Array.new
@journals.each do |journal|
@papers = journal.papers.all
data << {"title" => journal.title, "papers" => @papers}
end
render :json=>data.to_json
end
def delete_journal
@journals = Journal.find("")
@journals.delete
b = Array.new
b << {"success"=>"true"}
render :json=>b.to_json
end
def update_journal
@journal = Journal.find("4ff2d6ebbd98eb02b9000017")
@papers = @journal.papers
@papers.each do |paper|
paper.update_attributes(:user_id => current_user.id)
end
b = Array.new
b << {"success"=>"true"}
render :json=>b.to_json
end
end
@@ -1,10 +1,6 @@
require 'mime/types'
class DesktopPublicationsController< ApplicationController
#def journal_p
# render "desktop/journal_p", :layout => false
#end
def books
render "desktop/books", :layout => false
end
@@ -16,44 +12,4 @@ class DesktopPublicationsController< ApplicationController
def books_add
render "desktop/books/add", :layout => false
end
def seminar_p
render "desktop/seminar_p", :layout => false
end
def seminar_p_list
render "desktop/seminar_pages/list", :layout => false
end
def seminar_p_add
render "desktop/seminar_pages/add", :layout => false
end
# def create_journal
# Journal.create(user_id: current_user.id, title: "Ice Cream Sandwich")
# b = Array.new
# b << {"success"=>"true"}
# render :json=>b.to_json
# end
#
#
# def delete_journal
# @journals = Journal.find("")
# @journals.delete
# b = Array.new
# b << {"success"=>"true"}
# render :json=>b.to_json
# end
#
# def update_journal
# @journal = Journal.find("4ff2d6ebbd98eb02b9000017")
# @papers = @journal.papers
# @papers.each do |paper|
# paper.update_attributes(:user_id => current_user.id)
# end
# b = Array.new
#
# b << {"success"=>"true"}
# render :json=>b.to_json
# end
end
+2 -6
View File
@@ -1,10 +1,6 @@
class OrbitBackendController < ApplicationController
#before_filter :setup_vars
#before_filter :set_current_user
# before_filter {|c| c.front_end_available(@app_title)}
# before_filter :check_user_can_use
include OrbitCoreLib::PermissionUnility
include OrbitCoreLib::AppBackendUtility
include OrbitCoreLib::PermissionUtility
include AdminHelper
include ApplicationHelper
@@ -1,3 +1,4 @@
class OrbitFrontendController< OrbitFrontendComponentController
end
@@ -1,3 +1,4 @@
class OrbitWidgetController< OrbitFrontendComponentController
end