mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-16 04:53:18 +01:00
Allow apps to implement their own Sharing
This commit is contained in:
parent
23394e9e76
commit
c3b642a39a
@ -233,8 +233,7 @@ class Sharing
|
||||
), __LINE__, __FILE__);
|
||||
|
||||
// store sharing object in egw object and therefore in session
|
||||
$class = self::get_share_class($share);
|
||||
$GLOBALS['egw']->sharing = new $class($share);
|
||||
$GLOBALS['egw']->sharing = static::factory($share);
|
||||
|
||||
// we have a session we want to keep, but share owner is different from current user and we need filemanager UI, or no session
|
||||
// --> create a new anon session
|
||||
@ -274,6 +273,20 @@ class Sharing
|
||||
return $sessionid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to instanciate a share
|
||||
*
|
||||
* @param array $share
|
||||
*
|
||||
* @return Sharing
|
||||
*/
|
||||
public static function factory($share)
|
||||
{
|
||||
$class = static::get_share_class($share);
|
||||
|
||||
return new $class($share);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the namespaced class for the given share
|
||||
*
|
||||
@ -283,11 +296,19 @@ class Sharing
|
||||
{
|
||||
try
|
||||
{
|
||||
if(self::is_entry($share) && class_exists('\EGroupware\Stylite\Link\Sharing'))
|
||||
if(self::is_entry($share))
|
||||
{
|
||||
list($app, $id) = explode('::', $share['share_path']);
|
||||
if($app && class_exists('\EGroupware\\'. ucfirst($app) . '\Sharing'))
|
||||
{
|
||||
return '\EGroupware\\'. ucfirst($app) . '\Sharing';
|
||||
}
|
||||
else if(class_exists('\EGroupware\Stylite\Link\Sharing'))
|
||||
{
|
||||
return '\\EGroupware\\Stylite\\Link\\Sharing';
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception $e){throw $e;}
|
||||
return '\\'.__NAMESPACE__ . '\\'. (self::is_entry($share) ? 'Link' : 'Vfs'). '\\Sharing';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user