The Red Matrix
 All Classes Namespaces Files Functions Variables Pages
RedMatrix\RedDAV\RedBrowser Class Reference

Provides a DAV frontend for the webbrowser. More...

Inheritance diagram for RedMatrix\RedDAV\RedBrowser:

Public Member Functions

 __construct (&$auth)
 Constructor for RedBrowser class. More...
 
 set_writeable ()
 
 generateDirectoryIndex ($path)
 Creates the directory listing for the given path. More...
 
 userReadableSize ($size)
 Returns a human readable formatted string for filesizes. More...
 
 htmlActionsPanel (DAV\INode $node, &$output)
 Creates a form to add new folders and upload files. More...
 

Protected Member Functions

 getAssetUrl ($assetName)
 
 findAttachHash ($owner, $parentHash, $attachName)
 Return the hash of an attachment. More...
 
 findAttachIdByHash ($attachHash)
 Returns an attachment's id for a given hash. More...
 

Private Attributes

 $auth
 

Detailed Description

Provides a DAV frontend for the webbrowser.

RedBrowser is a SabreDAV server-plugin to provide a view to the DAV storage for the webbrowser.

http://opensource.org/licenses/mit-license.php The MIT License (MIT)

Constructor & Destructor Documentation

RedMatrix\RedDAV\RedBrowser::__construct ( $auth)

Constructor for RedBrowser class.

$enablePost will be activated through set_writeable() in a later stage. At the moment the write_storage permission is only valid for the whole folder. No file specific permissions yet.

Todo:
disable enablePost by default and only activate if permissions grant edit rights.

Disable assets with $enableAssets = false. Should get some thumbnail views anyway.

Parameters
RedBasicAuth&$auth

Member Function Documentation

RedMatrix\RedDAV\RedBrowser::findAttachHash (   $owner,
  $parentHash,
  $attachName 
)
protected

Return the hash of an attachment.

Given the owner, the parent folder and and attach name get the attachment hash.

Parameters
int$ownerThe owner_id
string$hashThe parent's folder hash
string$attachNameThe name of the attachment
Returns
string

Referenced by RedMatrix\RedDAV\RedBrowser\generateDirectoryIndex().

RedMatrix\RedDAV\RedBrowser::findAttachIdByHash (   $attachHash)
protected

Returns an attachment's id for a given hash.

This id is used to access the attachment in filestorage/

Parameters
string$attachHashThe hash of an attachment
Returns
string

Referenced by RedMatrix\RedDAV\RedBrowser\generateDirectoryIndex().

RedMatrix\RedDAV\RedBrowser::generateDirectoryIndex (   $path)

Creates the directory listing for the given path.

Parameters
string$pathwhich should be displayed
RedMatrix\RedDAV\RedBrowser::getAssetUrl (   $assetName)
protected

This method takes a path/name of an asset and turns it into url suiteable for http access.

Parameters
string$assetName
Returns
string

Referenced by RedMatrix\RedDAV\RedBrowser\generateDirectoryIndex().

RedMatrix\RedDAV\RedBrowser::htmlActionsPanel ( DAV\INode  $node,
$output 
)

Creates a form to add new folders and upload files.

Parameters
\Sabre\DAV\INode$node
string&$output
RedMatrix\RedDAV\RedBrowser::set_writeable ( )

The DAV browser is instantiated after the auth module and directory classes but before we know the current directory and who the owner and observer are. So we add a pointer to the browser into the auth module and vice versa. Then when we've figured out what directory is actually being accessed, we call the following function to decide whether or not to show web elements which include writeable objects.

It only disable/enable the visible parts. Not the POST handler which handels the actual requests when uploading files or creating folders.

Todo:
Maybe this whole way of doing this can be solved with some $server->subscribeEvent().
RedMatrix\RedDAV\RedBrowser::userReadableSize (   $size)

Returns a human readable formatted string for filesizes.

Don't we need such a functionality in other places, too?

Parameters
int$sizefilesize in bytes
Returns
string

Referenced by RedMatrix\RedDAV\RedBrowser\generateDirectoryIndex().

Member Data Documentation

RedMatrix\RedDAV\RedBrowser::$auth
private

The documentation for this class was generated from the following file: