From f6959dd18b5b863a4390fd053b20cf508f78b62d Mon Sep 17 00:00:00 2001 From: tuscanhobbit Date: Tue, 24 Jun 2014 00:04:13 +0200 Subject: Dav file browser on a single page --- include/reddav.php | 105 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 78 insertions(+), 27 deletions(-) (limited to 'include/reddav.php') diff --git a/include/reddav.php b/include/reddav.php index 3c2801e89..141c73ffe 100644 --- a/include/reddav.php +++ b/include/reddav.php @@ -890,11 +890,18 @@ class RedBrowser extends DAV\Browser\Plugin { $html = profile_tabs(get_app(),(($this->auth->owner_id == local_user()) ? true : false),$this->auth->owner_nick); $html .= " - -

Index for " . $this->escapeHTML($path) . "/

- - - "; + +

".t('Files').": ".$this->escapeHTML($path) . "/

+
NameTypeSizeLast modified

+ + + + + + + + + "; $files = $this->server->getPropertiesForPath($path,array( '{DAV:}displayname', @@ -913,13 +920,15 @@ class RedBrowser extends DAV\Browser\Plugin { $fullPath = DAV\URLUtil::encodePath($this->server->getBaseUri() . $parentUri); $icon = $this->enableAssets?'Parent':''; - $html.= " - - - - - - "; + $html.= " + + + + + + + "; } @@ -1005,18 +1014,34 @@ class RedBrowser extends DAV\Browser\Plugin { } } - - $html.= " - - - - - - "; + + $parentHash=""; + $owner=$this->auth->owner_id; + $splitPath = split("/",$fullPath); + if (count($splitPath) > 3) { + for ($i=3; $ifindAttachHash($owner,$parentHash,$attachName); + $parentHash = $attachHash; + } + } + $attachId = $this->findAttachIdByHash($attachHash); + $fileStorageUrl = str_replace("cloud/","filestorage/",$path); + $attachIcon = ""; + $html.= " + + + + + + + + + "; } - $html.= ""; + $html.= ""; $output = ''; @@ -1039,12 +1064,13 @@ class RedBrowser extends DAV\Browser\Plugin { public function htmlActionsPanel(DAV\INode $node, &$output) { - if($this->auth->owner_id && $this->auth->owner_id == $this->auth->channel_id) { - $channel = get_app()->get_channel(); - if($channel) { - $output .= ''; - } - } + //Removed link to filestorage page + //if($this->auth->owner_id && $this->auth->owner_id == $this->auth->channel_id) { + // $channel = get_app()->get_channel(); + // if($channel) { + // $output .= ''; + // } + //} if (!$node instanceof DAV\ICollection) return; @@ -1083,4 +1109,29 @@ class RedBrowser extends DAV\Browser\Plugin { return z_root() .'/cloud/?sabreAction=asset&assetName=' . urlencode($assetName); } + protected function findAttachHash($owner, $parentHash, $attachName) { + $r = q("select * from attach where uid = %d and folder = '%s' and filename = '%s' order by edited desc limit 1", + intval($owner), dbesc($parentHash), dbesc($attachName) + ); + $hash = ""; + if($r) { + foreach($r as $rr) { + $hash = $rr['hash']; + } + } + return $hash; + } + + protected function findAttachIdByHash($attachHash) { + $r = q("select * from attach where hash = '%s' order by edited desc limit 1", + dbesc($attachHash) + ); + $id = ""; + if($r) { + foreach($r as $rr) { + $id = $rr['id']; + } + } + return $id; + } } -- cgit v1.2.3
".t('Name')."TypeSizeLast modified

$icon..[parent]
$icon.. + [parent]
$icon{$displayName}{$type}{$size}" . (($lastmodified) ? datetime_convert('UTC', date_default_timezone_get(),$lastmodified) : '') . "
$icon{$displayName}" . (($size) ? $attachIcon : '') . "{$type}". $size ."" . (($lastmodified) ? datetime_convert('UTC', date_default_timezone_get(),$lastmodified) : '') . "


' . t('Edit File properties') . '
 
' . t('Edit File properties') . '