Class: ElFinder2::Command::Open

Inherits:
Base
  • Object
show all
Defined in:
lib/el_finder2/command/open.rb

Overview

Returns information about requested directory and its content, optionally can return directory tree as files, and options for the current volume.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from HashUtils

#from_base64url, #to_base64url, #to_path

Constructor Details

This class inherits a constructor from ElFinder2::Command::Base

Instance Method Details

#execute ⇒ Object

Response:

api: (Number) The version number of the protocol, must be >= 2, ATTENTION - return api ONLY for init request! cwd: (Object) Current Working Directory - information about the current directory. Information about File/Directory files: (Array) array of objects - files and directories in current directory. If parameter tree == true, then added to the folder of the directory tree to a given depth. The order of files is not important. Note you must include the top-level volume objects here as well (i.e. cwd is repeated here, in addition to other volumes) Information about File/Directory netDrivers: (Array) Network protocols list which can be mounted on the fly (using netmount command). Now only ftp supported.

Optional

uplMaxSize: (String) Allowed upload max size. For example "32M"

options: (Object) Further information about the folder and its volume { options: { // (String) Current folder path path: "files/folder42", // (String) Current folder URL url: "http://localhost/elfinder/files/folder42/", // (String) Thumbnails folder URL tmbURL: "http://localhost/elfinder/files/folder42/.tmb/", // (String) Разделитель пути для текущего тома separator: "/", // (Array) List of commands not allowed (disabled) on this volume disabled: [], // (Number) Whether or not to overwrite files with the same name on // the current volume copyOverwrite: 1, // (Object) Archive settings archivers: { // (Array) List of the mime type of archives which can be created create: [ 0: "application/x-tar", 1: "application/x-gzip" ], // (Array) List of the mime types that can be extracted / unpacked extract: [ 0: "application/x-tar", 1: "application/x-gzip" ] } } }

debug: (Object) Debug information, if you specify the corresponding connector option. { debug: { // (String) Connector type connector: "php", // (String) php version phpver: "5.3.6", // (Number) Execution time time: 0.0749430656433, // (String) Used / Free / Available Memory memory: "3348Kb / 2507Kb / 128M", // (Array) Debugging by volume volumes: [ { // (String) ID of the Volume id: "l1_", // (String) Driver type (class name) driver: "localfilesystem", // (String) Method for determining mime type mimeDetect: "internal", // (String) Library for working with images imgLib: "gd" } ], // (Array) List of errors for not mounted volumes mountErrors: [ 0: "Root folder has not read and write permissions." ] } }



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/el_finder2/command/open.rb', line 88

def execute
  files = @folder.self_and_descendants
  files = files.where('parent_id = :id OR id = :id', id: @folder.id) unless @tree

  response = {
    cwd: ElFinder2::FolderSerializer.new(@folder).as_json,
    files: ActiveModel::ArraySerializer.new(files).as_json,
    options: {}
  }

  response.merge!(
    api: ElFinder2::API_VERSION
  ) if @init

  render json: response
end