From 71e0e55b0b5bc1746cb481056b027e76c1821ef7 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 30 Oct 2017 18:49:18 -0700 Subject: provide a 'tile' view (view only) mode to mod_cloud --- Zotlabs/Module/Cloud_tiles.php | 17 +++++++++++++++++ Zotlabs/Storage/Browser.php | 20 ++++++++++++++++++++ view/tpl/cloud_directory.tpl | 35 +++++++++++++++++++++++++++++++++++ view/tpl/cloud_header.tpl | 1 + 4 files changed, 73 insertions(+) create mode 100644 Zotlabs/Module/Cloud_tiles.php diff --git a/Zotlabs/Module/Cloud_tiles.php b/Zotlabs/Module/Cloud_tiles.php new file mode 100644 index 000000000..45124cdfa --- /dev/null +++ b/Zotlabs/Module/Cloud_tiles.php @@ -0,0 +1,17 @@ +escapeHTML($displayName); $type = $this->escapeHTML($type); + $icon = ''; if ($this->enableAssets) { @@ -196,12 +197,28 @@ class Browser extends DAV\Browser\Plugin { } } + $photo_icon = ''; + + if(strpos($type,'image/') === 0 && $attachHash) { + $r = q("select resource_id, imgscale from photo where resource_id = '%s' and imgscale in ( %d, %d ) order by imgscale asc limit 1", + dbesc($attachHash), + intval(PHOTO_RES_320), + intval(PHOTO_RES_PROFILE_80) + ); + if($r) { + $photo_icon = $r[0]['resource_id'] . '-' . $r[0]['imgscale']; + } + } + + + $attachIcon = ""; // ""; // put the array for this file together $ft['attachId'] = $this->findAttachIdByHash($attachHash); $ft['fileStorageUrl'] = substr($fullPath, 0, strpos($fullPath, "cloud/")) . "filestorage/" . $this->auth->getCurrentUser(); $ft['icon'] = $icon; + $ft['photo_icon'] = $photo_icon; $ft['attachIcon'] = (($size) ? $attachIcon : ''); // @todo Should this be an item value, not a global one? $ft['is_owner'] = $is_owner; @@ -221,6 +238,7 @@ class Browser extends DAV\Browser\Plugin { $this->server->emit('onHTMLActionsPanel', array($parent, &$output, $path)); } + $html .= replace_macros(get_markup_template('cloud.tpl'), array( '$header' => t('Files') . ": " . $this->escapeHTML($path) . "/", '$total' => t('Total'), @@ -230,6 +248,8 @@ class Browser extends DAV\Browser\Plugin { '$upload' => t('Upload'), '$is_owner' => $is_owner, '$parentpath' => $parentpath, + '$cpath' => bin2hex(\App::$query_string), + '$tiles' => intval($_SESSION['cloud_tiles']), '$entries' => $f, '$name' => t('Name'), '$type' => t('Type'), diff --git a/view/tpl/cloud_directory.tpl b/view/tpl/cloud_directory.tpl index e8ae6a590..3beeb4f8a 100644 --- a/view/tpl/cloud_directory.tpl +++ b/view/tpl/cloud_directory.tpl @@ -1,4 +1,38 @@
+ {{if $tiles}} + + {{if $parentpath}} +
+ +
.. +
+
+ {{/if}} + + {{foreach $entries as $item}} + + {{/foreach}} +
+ {{else}} @@ -42,4 +76,5 @@ {{/foreach}}
+ {{/if}}
diff --git a/view/tpl/cloud_header.tpl b/view/tpl/cloud_header.tpl index c1e589341..468f2febc 100644 --- a/view/tpl/cloud_header.tpl +++ b/view/tpl/cloud_header.tpl @@ -1,6 +1,7 @@
{{if $actionspanel}}
+ {{if $is_owner}}  {{$shared}} {{/if}} -- cgit v1.2.3