Class: ClientFileService

Source Location: /class/fileHandling.php.inc

Class Overview

Node
   |
   --ClientFileService

Client filesystem service

This class is used to access the client filesystem, to read and write to directories and files, to run executables and to monitor files. All operations are asynchronous, meaning that the call will not block the script. A handler object and method can be given to handle the result of the operation.




Variables

Methods

Inherited Variables

Class: Node

Node::$behavior
Node::$eventHandler
Node::$eventType
Node::$eventYielder
Node::$handlerFor
Node::$id
Node::$isChild
Node::$isRegistered
Node::$observerTopics
Node::$parent
Node::$rootApplication
Node::$rootWindow
Node::$yielderFor

Inherited Methods

Class: Node

Node::__construct()
Dynamic Constructor
Node::accessKey()
Set the accessKey attribute for this element
Node::addBehavior()
Add a behavior class
Node::addObserver()
Add an observer to this Node
Node::align()
Set the align attribute for this element
Node::attach()
[INTERNAL FUNCTION] Default attach method
Node::attributeMethod()
Convenient attribute setter
Node::backgroundColor()
Set the background color for the element
Node::backgroundImage()
Set the background of a node using CSS background-image property
Node::BehaviorCreateClass()
Constructs a Behavior class from a string classname and a settings array.
Node::BehaviorSetClassSettings()
Automatically initializes Behavior object
Node::blur()
Make this node loose focus
Node::callMethod()
Call a JavaScript method on the client-side node
Node::callMethodDelayed()
Call a JavaScript method on the client-side node in a delayed fashion
Node::className()
Set the CSS classname for the element
Node::commandHandler()
[INTERNAL FUNCTION] Handles an incoming event for this node
Node::context()
Set a contextmenu to show when clicking the context (right) mouse or keyboard button on this element
Node::createClientEvent()
Creates a new event on the client side
Node::createRemoteObject()
[INTERNAL FUNCTION] Calls the remote constructor of this class
Node::crop()
Set the crop attribute for this element
Node::detach()
[INTERNAL FUNCTION] Default detach method
Node::disableBehavior()
Disable behavior
Node::disabled()
Set the disabled attribute for this element
Node::enableBehavior()
Enable behavior
Node::equalsize()
Set the equalsize attribute for this element
Node::extractNode()
Extracts this node and its childnodes
Node::findAncestor()
Return the first ancestor of a certain class of this node
Node::fireClientEvent()
Fires a remote (client) event
Node::fireLocalEvent()
Fires a local (server) event
Node::flex()
Set the flex attribute for this element
Node::focus()
Give this node focus
Node::getBehavior()
Get a behavior class.
Node::height()
Set the height of the element
Node::hidden()
Set the hidden attribute for this element
Node::initNodeLayout()
[INTERNAL FUNCTION] Initializes the attributes of a node when it is registered
Node::insertElement()
[INTERNAL FUNCTION] Inserts the newly constructed node's element into the DOM tree on the client side
Node::label()
Set the label attribute for this element
Node::margin()
Set the margin of the element
Node::marginBottom()
Set the bottom margin of the element
Node::marginLeft()
Set the left margin of the element
Node::marginRight()
Set the right margin of the element
Node::marginTop()
Set the top margin of the element
Node::mousethrough()
Indicate whether mouse events should pass through this node onto its parent
Node::orient()
Set the orient attribute for this element
Node::pack()
Set the pack attribute for this element
Node::padding()
Set the padding of the element
Node::paddingBottom()
Set the bottom padding of the element
Node::paddingLeft()
Set the left padding of the element
Node::paddingRight()
Set the right padding of the element
Node::paddingTop()
Set the top padding of the element
Node::popup()
Set a popup menu to show when clicking on this element
Node::removeAttribute()
Remove an attribute on the client-side XUL node
Node::removeBehavior()
Delete behavior
Node::removeElement()
[INTERNAL FUNCTION] Removes the node's element from the client DOM tree
Node::removeEventHandler()
Removes an event handler
Node::removeEventReflex()
Removes a previously set reflex for a certain event
Node::removeEventYielder()
Removed a node this is yielded when an event on this node fires
Node::removeNode()
Removes and unregisters this node and its childnodes
Node::removeObserver()
Remove an observer from this Node
Node::removeObservers()
Remove all observers from this Node
Node::setAttribute()
Set an attribute on the client-side XUL node
Node::setDraggable()
Set this element as draggable
Node::setDroppable()
Set this element as a dropzone
Node::setEvent()
Shorthand version for setEventType, setEventHandler and setEventYielder
Node::setEventBlocking()
Sets whether the event should block (be synchronous)
Node::setEventHandler()
Sets an event handler
Node::setEventReflex()
Sets a reflex for a certain event
Node::setEventType()
Sets the event type for a certain event
Node::setEventYielder()
Sets a node to yield when an event on this node fires
Node::setMethod()
Set a JavaScript method on the client-side node
Node::setProperty()
Set a JavaScript property on the client-side node
Node::setStyle()
Set a CSS style property on the client-side XUL node
Node::size()
Set the size of the element
Node::textColor()
Set the text color for the element
Node::textSize()
Set the text size for the element
Node::textStyle()
Set the text style for the element
Node::tooltip()
Set a tooltip to show when hovering over this element
Node::tooltiptext()
Set the tooltiptext attribute for this element
Node::unbind()
[INTERNAL FUNCTION] Removes links to child and parent nodes
Node::unlink()
[INTERNAL FUNCTION] Removes event handler and yielder links to other nodes
Node::unRegister()
[INTERNAL FUNCTION] Removes this node from the client registry
Node::value()
Set the value attribute for this element
Node::width()
Set the width of the element
Node::yield()
Manually yield this node
Node::_dropHandler()
Node::__call()
PHP Magic function: Behavior pattern handler.

Class Variables

$remoteConstructor =  'FileService'

access:  public
Type:   mixed



Class Methods


method attach() [line 989]

void attach( )

access:  public

Overrides Node::attach() ([INTERNAL FUNCTION] Default attach method)

[ Top ]

method cancelAllMonitors() [line 1332]

void cancelAllMonitors( )

Cancel all file monitors

access:  public

[ Top ]

method cancelMonitorFile() [line 1322]

void cancelMonitorFile( string $clientPath)

Cancel monitoring the file

access:  public

Parameters:

string   $clientPath   The path on the client side to stop monitoring monitor

[ Top ]

method createDirectory() [line 1053]

void createDirectory( string $path, [object|string $handlerObj = NULL], [string $handlerMethod = NULL])

Creates the directory

The handler receives these parameters:

  • ClientFileService $fileService - this object
  • bool $status: indicates whether the operation was successful
  • ClientDirectory $dirFile: if successful, a file object referring to the new remote directory


access:  public

Parameters:

string   $path   The path on the client side to create
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]

method detach() [line 994]

void detach( )

access:  public

Overrides Node::detach() ([INTERNAL FUNCTION] Default detach method)

[ Top ]

method executeFile() [line 1352]

void executeFile( string $clientPath, [array $args = array()], [bool $async = TRUE], [object|string $handlerObj = NULL], [string $handlerMethod = NULL])

Executes the file

The handler receives these parameters:

  • ClientFileService $fileService - this object
  • bool $status: indicates whether the operation was successful
  • string $path: the remote path


access:  public

Parameters:

string   $clientPath   The path on the client side to execute
array   $args   Arguments for the executable
bool   $async   If TRUE, the file is executed in the background. If FALSE, the application blocks until the executable ends
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]

method fileFromResult() [line 1467]

void fileFromResult( $path, $file)

access:  public

Parameters:

   $path  
   $file  

[ Top ]

method getDirectory() [line 1013]

void getDirectory( string $path, object|string $handlerObj, string $handlerMethod)

Gets the contents of a directory

The handler receives these parameters:

  • ClientFileService $fileService - this object
  • bool $status: indicates whether the operation was successful
  • ClientDirectory $dirFile: if successful, a file object referring to the remote directory with the directory contents in the ClientFile::$entries array


access:  public

Parameters:

string   $path   The path on the client side to read
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]

method getDirSeparator() [line 1483]

void getDirSeparator( )

access:  public

[ Top ]

method getSpecialDirectory() [line 1034]

void getSpecialDirectory( string $id, object|string $handlerObj, string $handlerMethod, [bool $retrieveContents = TRUE])

Gets the contents of a special directory

The handler receives these parameters:

  • ClientFileService $fileService: this object
  • bool $status: indicates whether the operation was successful
  • ClientDirectory $dirFile: if successful, a file object referring to the remote directory with the directory contents in the ClientFile::$entries array


link:  https://developer.mozilla.org/en/Code_snippets/File_I%2F%2FO#Getting_special_files
access:  public

Parameters:

string   $id   ID of the special folder, see link
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object
bool   $retrieveContents   Retrieve the properties of the files in the specialDir

[ Top ]

method monitorFile() [line 1308]

void monitorFile( string $clientPath, object|string $handlerObj, string $handlerMethod)

Starts monitoring the file

The handler receives these parameters when the file is created, removed or changed:

  • ClientFileService $fileService - this object
  • string $path: the remote path
  • bool $exists: whether the file exists
  • int $modificationTime: the modification time of the file
  • int $size: file size


access:  public

Parameters:

string   $clientPath   The path on the client side to monitor
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]

method onDownloaderFinished() [line 1152]

void onDownloaderFinished( $event)

[INTERNAL FUNCTION] Event handler

access:  public

Parameters:

   $event  

[ Top ]

method onResult() [line 1389]

void onResult( )

[INTERNAL FUNCTION] Event handler

access:  public

[ Top ]

method onUploaderFinished() [line 1248]

void onUploaderFinished( $event)

[INTERNAL FUNCTION] Event handler

access:  public

Parameters:

   $event  

[ Top ]

method openFileWithNativeProtocolHandler() [line 1367]

void openFileWithNativeProtocolHandler( string $clientPath)

Open the file with the native protocol handler for given file

The handler receives these parameters:

  • ClientFileService $fileService - this object
  • string $path: the remote path


access:  public

Parameters:

string   $clientPath   The path on the client side to execute

[ Top ]

method openURIWithNativeProtocolHandler() [line 1381]

void openURIWithNativeProtocolHandler( string $uri)

Open the file with the native protocol handler for given file

The handler receives these parameters:

  • ClientFileService $fileService - this object
  • string $path: the remote path


access:  public

Parameters:

string   $uri   The URI to open using a native protocol handler

[ Top ]

method readFile() [line 1171]

FileUploader readFile( string $clientPath, string $localPath, [object|string $handlerObj = NULL], [string $handlerMethod = NULL])

Copies a file from client to server

Returns the FileUploader object to allow progress checking. The handler is attached to the 'finished', 'failed' and 'cancelled' events of the FileUploader.


return:  The transfer object keeping track of transfer progress
access:  public

Parameters:

string   $clientPath   The path on the client side
string   $localPath   The path on the server side
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]

method readFileToStream() [line 1228]

FileToStreamUploader readFileToStream( string $clientPath, resource $stream, [object|string $handlerObj = NULL], [string $handlerMethod = NULL])

Reads a file on the client side and writes it to a stream resource on the server

Returns the FileToStreamUploader object to allow progress checking. The handler is attached to the 'finished', 'failed' and 'cancelled' events of the FileToStreamUploader.


return:  The transfer object keeping track of transfer progress
access:  public

Parameters:

string   $clientPath   The path on the client side
resource   $stream   Stream to write to
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]

method readFileToString() [line 1199]

FileToStringUploader readFileToString( string $clientPath, [object|string $handlerObj = NULL], [string $handlerMethod = NULL])

Reads a file on the client side to a string

Returns the FileToStringUploader object to allow progress checking. The handler is attached to the 'finished', 'failed' and 'cancelled' events of the FileToStringUploader. The file contents are put in the FileToStringUploader::$data property


return:  The transfer object keeping track of transfer progress
access:  public

Parameters:

string   $clientPath   The path on the client side
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]

method removeDirectory() [line 1268]

void removeDirectory( string $clientPath, bool $recursive, [object|string $handlerObj = NULL], [string $handlerMethod = NULL])

Removes the directory

The handler receives these parameters:

  • ClientFileService $fileService - this object
  • bool $status: indicates whether the operation was successful
  • string $path: the remote path


access:  public

Parameters:

string   $clientPath   The path on the client side to remove
bool   $recursive   If TRUE, all underlying contents are removed as well. If FALSE, the directory needs to be empty
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]

method removeFile() [line 1287]

void removeFile( string $clientPath, [object|string $handlerObj = NULL], [string $handlerMethod = NULL])

Removes the file

The handler receives these parameters:

  • ClientFileService $fileService - this object
  • bool $status: indicates whether the operation was successful
  • string $path: the remote path


access:  public

Parameters:

string   $clientPath   The path on the client side to remove
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]

method writeFile() [line 1072]

FileDownloader writeFile( string $localPath, string $clientPath, [object|string $handlerObj = NULL], [string $handlerMethod = NULL])

Copies a file from server to client

Returns the FileDownloader object to allow progress checking. The handler is attached to the 'finished', 'failed' and 'cancelled' events of the FileDownloader.


return:  The transfer object keeping track of transfer progress
access:  public

Parameters:

string   $localPath   The path on the server side
string   $clientPath   The path on the client side
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]

method writeFileFromStream() [line 1132]

FileFromStringDownloader writeFileFromStream( string $clientPath, resource $stream, int $length, [object|string $handlerObj = NULL], [string $handlerMethod = NULL])

Stores data read from a stream in a file on the client side

Returns the FileFromStreamDownloader object to allow progress checking. The handler is attached to the 'finished', 'failed' and 'cancelled' events of the FileFromStringDownloader.


return:  The transfer object keeping track of transfer progress
access:  public

Parameters:

string   $clientPath   The path on the client side
resource   $stream   Stream to read from
int   $length   Amount of bytes to read from the stream and write to the file
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]

method writeFileFromString() [line 1102]

FileFromStringDownloader writeFileFromString( string $clientPath, string $data, [object|string $handlerObj = NULL], [string $handlerMethod = NULL])

Stores a string in a file on the client side

Returns the FileFromStringDownloader object to allow progress checking. The handler is attached to the 'finished', 'failed' and 'cancelled' events of the FileFromStringDownloader.


return:  The transfer object keeping track of transfer progress
access:  public

Parameters:

string   $clientPath   The path on the client side
string   $data   Data to write to the file
object|string   $handlerObj   The object or classname to call the handler on when the operation finishes
string   $handlerMethod   The method to call on the handler object

[ Top ]


Documentation generated on Mon, 07 Apr 2014 00:51:15 +0200 by phpDocumentor 1.4.3