Commit 319bd513 authored by Mario's avatar Mario
Browse files

fix issue in mod dav and change the way we get the parent path

parent 25c29eb4
Pipeline #370672 passed with stage
in 8 minutes and 46 seconds
......@@ -99,7 +99,7 @@ class Dav extends \Zotlabs\Web\Controller {
$auth->setRealm(ucfirst(\Zotlabs\Lib\System::get_platform_name()) . ' ' . 'WebDAV');
$rootDirectory = new \Zotlabs\Storage\Directory('/', $auth);
$rootDirectory = new \Zotlabs\Storage\Directory('/', [], $auth);
// A SabreDAV server-object
$server = new SDAV\Server($rootDirectory);
......
......@@ -81,18 +81,19 @@ class Browser extends DAV\Browser\Plugin {
require_once('include/conversation.php');
require_once('include/text.php');
// (owner_id = channel_id) is visitor owner of this directory?
$is_owner = ((local_channel() && $this->auth->owner_id == local_channel()) ? true : false);
$cat = ((x($_REQUEST,'cat')) ? $cat : '');
$nick = $this->auth->owner_nick;
$channel_id = $this->auth->owner_id;
hz_syslog(print_r('browser nick: '. $nick,true),LOGGER_DEBUG);
// Is visitor owner of this directory?
$is_owner = ((local_channel() && $channel_id == local_channel()) ? true : false);
$cat = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : '');
if ($this->auth->getTimezone()) {
date_default_timezone_set($this->auth->getTimezone());
}
if ($this->auth->owner_nick) {
$html = '';
}
$files = $this->server->getPropertiesForPath($path, [], 1);
$parent = $this->server->tree->getNodeForPath($path);
......@@ -100,23 +101,17 @@ class Browser extends DAV\Browser\Plugin {
end($arr);
$folder_parent = isset($arr[1]) ? prev($arr) : '';
$parent_path = [];
$folder_list = attach_folder_select_list($channel_id);
// only show parent if not leaving /cloud/; TODO how to improve this?
if ($path && $path !== 'cloud') {
list($parent_uri) = \Sabre\Uri\split($path);
$full_path = \Sabre\HTTP\encodePath($this->server->getBaseUri() . $parent_uri);
$parent_path = '';
$parent_path['icon'] = $this->enableAssets ? '<a href="' . $full_path . '"><img src="' . $this->getAssetUrl('icons/parent' . $this->iconExtension) . '" width="24" alt="' . t('parent') . '"></a>' : '';
$parent_path['path'] = $full_path;
// Hide parent folder if in /cloud or category view
if ($channel_id && ! $cat) {
list($parent_uri) = \Sabre\Uri\split($path);
$parent_path = \Sabre\HTTP\encodePath($this->server->getBaseUri() . $parent_uri);
}
$folder_list = attach_folder_select_list($this->auth->owner_id);
$nick = $this->auth->owner_nick;
$channel_id = $this->auth->owner_id;
$is_root_folder = ((basename($path) === $nick) ? true : false);
$is_root_folder = (($path === 'cloud/' . $nick) ? true : false);
$f = [];
......@@ -319,7 +314,7 @@ class Browser extends DAV\Browser\Plugin {
$header = (($cat) ? t('File category') . ": " . $this->escapeHTML($cat) : t('Files') . ": " . $this->escapeHTML($path) . "/");
$html .= replace_macros(get_markup_template('cloud.tpl'), array(
$html = replace_macros(get_markup_template('cloud.tpl'), array(
'$header' => $header,
'$total' => t('Total'),
'$actionspanel' => $output,
......
......@@ -522,6 +522,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
$file = trim($file, '/');
$path_arr = explode('/', $file);
if (! $path_arr)
return;
......
......@@ -7,14 +7,14 @@
{{if $parentpath}}
<div class="cloud-container" >
<div class="cloud-icon tiles">
<a href="{{$parentpath.path}}">
<a href="{{$parentpath}}">
<div class="cloud-icon-container">
<i class="fa fa-fw fa-level-up" ></i>
</div>
</a>
</div>
<div class="cloud-title">
<a href="{{$parentpath.path}}">..</a>
<a href="{{$parentpath}}">..</a>
</div>
</div>
{{/if}}
......@@ -55,8 +55,8 @@
</tr>
{{if $parentpath}}
<tr id="cloud-index-up" class="cloud-index{{if ! $is_root_folder}} attach-drop{{/if}}"{{if ! $is_root_folder}} data-folder="{{$folder_parent}}"/{{/if}}>
<td><i class="fa fa-level-up"></i>{{*$parentpath.icon*}}</td>
<td colspan="7"><a href="{{$parentpath.path}}" title="{{$parent}}" draggable="false">..</a></td>
<td><i class="fa fa-level-up"></i></td>
<td colspan="7"><a href="{{$parentpath}}" title="{{$parent}}" draggable="false">..</a></td>
</tr>
{{/if}}
<tr id="new-upload-progress-bar-1"></tr> {{* this is needed to append the upload files in the right order *}}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment