Add ability to specify a server vs. client kolab_files_url (Bifrost#T31444)
... by additional kolab_files_server_url option.
This commit is contained in:
parent
ad40d615b1
commit
e5d2934e31
3 changed files with 16 additions and 6 deletions
|
@ -3,6 +3,12 @@
|
||||||
// URL of kolab-chwala installation
|
// URL of kolab-chwala installation
|
||||||
$config['kolab_files_url'] = '/chwala/';
|
$config['kolab_files_url'] = '/chwala/';
|
||||||
|
|
||||||
|
// Optional URL of kolab-chwala installation for connections
|
||||||
|
// made by the Roundcube host. Useful when the chwala host name does not
|
||||||
|
// resolve on the server to the same IP as on the client.
|
||||||
|
// By default kolab_files_url will be used.
|
||||||
|
$config['kolab_files_server_url'] = '';
|
||||||
|
|
||||||
// List of files list columns. Available are: name, size, mtime, type
|
// List of files list columns. Available are: name, size, mtime, type
|
||||||
$config['kolab_files_list_cols'] = array('name', 'mtime', 'size');
|
$config['kolab_files_list_cols'] = array('name', 'mtime', 'size');
|
||||||
|
|
||||||
|
|
|
@ -72,15 +72,16 @@ class kolab_files extends rcube_plugin
|
||||||
|
|
||||||
$this->load_config();
|
$this->load_config();
|
||||||
|
|
||||||
$url = $this->rc->config->get('kolab_files_url');
|
$client_url = $this->rc->config->get('kolab_files_url');
|
||||||
|
$server_url = $this->rc->config->get('kolab_files_server_url');
|
||||||
|
|
||||||
if (!$url) {
|
if (!$client_url) {
|
||||||
return $this->engine = false;
|
return $this->engine = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once $this->home . '/lib/kolab_files_engine.php';
|
require_once $this->home . '/lib/kolab_files_engine.php';
|
||||||
|
|
||||||
$this->engine = new kolab_files_engine($this, $url);
|
$this->engine = new kolab_files_engine($this, $client_url, $server_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->engine;
|
return $this->engine;
|
||||||
|
|
|
@ -26,6 +26,8 @@ class kolab_files_engine
|
||||||
{
|
{
|
||||||
private $plugin;
|
private $plugin;
|
||||||
private $rc;
|
private $rc;
|
||||||
|
private $url;
|
||||||
|
private $url_srv;
|
||||||
private $timeout = 600;
|
private $timeout = 600;
|
||||||
private $files_sort_cols = array('name', 'mtime', 'size');
|
private $files_sort_cols = array('name', 'mtime', 'size');
|
||||||
private $sessions_sort_cols = array('name');
|
private $sessions_sort_cols = array('name');
|
||||||
|
@ -36,9 +38,10 @@ class kolab_files_engine
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
*/
|
*/
|
||||||
public function __construct($plugin, $url)
|
public function __construct($plugin, $client_url, $server_url = null)
|
||||||
{
|
{
|
||||||
$this->url = rcube_utils::resolve_url($url);
|
$this->url = rcube_utils::resolve_url($client_url);
|
||||||
|
$this->url_srv = $server_url ? rcube_utils::resolve_url($server_url) : $this->url;
|
||||||
$this->plugin = $plugin;
|
$this->plugin = $plugin;
|
||||||
$this->rc = $plugin->rc;
|
$this->rc = $plugin->rc;
|
||||||
$this->timeout = $this->rc->config->get('session_lifetime') * 60;
|
$this->timeout = $this->rc->config->get('session_lifetime') * 60;
|
||||||
|
@ -901,7 +904,7 @@ class kolab_files_engine
|
||||||
*/
|
*/
|
||||||
protected function get_request($get = null, $token = null)
|
protected function get_request($get = null, $token = null)
|
||||||
{
|
{
|
||||||
$url = $this->url . '/api/';
|
$url = $this->url_srv . '/api/';
|
||||||
|
|
||||||
if (!$this->request) {
|
if (!$this->request) {
|
||||||
$config = array(
|
$config = array(
|
||||||
|
|
Loading…
Add table
Reference in a new issue