Sha256: d49eecf02002d0bc3613b9c64c68dec9c061ef9f8d6b750e3c6b3dca4136337e

Contents?: true

Size: 1.29 KB

Versions: 10

Compression:

Stored size: 1.29 KB

Contents

module Optimacms
  class Admin::MediafilesController < Admin::AdminBaseController
    skip_before_filter :verify_authenticity_token, :only => ['elfinder']

    #layout 'optimacms/admin/layouts/blank'
    layout 'optimacms/admin/layouts/basic'
    #layout 'optimacms/admin/layouts/elfinder'

    def index
      #render :layout => false
    end

    def elfinder
      dirpath = Optimacms.files_dir_path
      rootpath = File.join(Rails.public_path, dirpath)
      rooturl = '/'+dirpath

      h, r = ElFinder::Connector.new(
          :root => rootpath,
          :url => rooturl,
          :perms => {
              #/^(Welcome|README)$/ => {:read => true, :write => false, :rm => false},
              '.' => {:read => true, :write => true, :rm => true}, # '.' is the proper way to specify the home/root directory.
              #/^test$/ => {:read => true, :write => true, :rm => false},
              #'logo.png' => {:read => true},
              #/\.png$/ => {:read => false} # This will cause 'logo.png' to be unreadable.
              # Permissions err on the safe side. Once false, always false.
          },
          :thumbs => true
      ).run(params)

      headers.merge!(h)

      if r.empty?
        (render :nothing => true) and return
      end

      render :json => r, :layout => false
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
optimacms-0.1.44 app/controllers/optimacms/admin/mediafiles_controller.rb
optimacms-0.1.43 app/controllers/optimacms/admin/mediafiles_controller.rb
optimacms-0.1.41 app/controllers/optimacms/admin/mediafiles_controller.rb
optimacms-0.1.40 app/controllers/optimacms/admin/mediafiles_controller.rb
optimacms-0.1.39 app/controllers/optimacms/admin/mediafiles_controller.rb
optimacms-0.1.38 app/controllers/optimacms/admin/mediafiles_controller.rb
optimacms-0.1.36 app/controllers/optimacms/admin/mediafiles_controller.rb
optimacms-0.1.34 app/controllers/optimacms/admin/mediafiles_controller.rb
optimacms-0.1.32 app/controllers/optimacms/admin/mediafiles_controller.rb
optimacms-0.1.31 app/controllers/optimacms/admin/mediafiles_controller.rb