mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:55:19 +00:00
provide a 'tile' view (view only) mode to mod_cloud
This commit is contained in:
parent
4fef29e61c
commit
71e0e55b0b
4 changed files with 73 additions and 0 deletions
17
Zotlabs/Module/Cloud_tiles.php
Normal file
17
Zotlabs/Module/Cloud_tiles.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Zotlabs\Module;
|
||||
|
||||
class Cloud_tiles extends \Zotlabs\Web\Controller {
|
||||
|
||||
function init() {
|
||||
|
||||
if(intval($_SESSION['cloud_tiles']))
|
||||
$_SESSION['cloud_tiles'] = 0;
|
||||
else
|
||||
$_SESSION['cloud_tiles'] = 1;
|
||||
|
||||
goaway(z_root() . '/' . hex2bin(argv(1)));
|
||||
|
||||
}
|
||||
}
|
|
@ -173,6 +173,7 @@ class Browser extends DAV\Browser\Plugin {
|
|||
$displayName = $this->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 = ""; // "<a href=\"attach/".$attachHash."\" title=\"".$displayName."\"><i class=\"fa fa-arrow-circle-o-down\"></i></a>";
|
||||
|
||||
// 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'),
|
||||
|
|
|
@ -1,4 +1,38 @@
|
|||
<div id="cloud-drag-area" class="section-content-wrapper-np">
|
||||
{{if $tiles}}
|
||||
|
||||
{{if $parentpath}}
|
||||
<div class="cloud-container" style="float: left; width: 80px; height: 80px; margin: 5px;">
|
||||
<div class="cloud-icon"><a href="{{$parentpath.path}}">
|
||||
<i class="fa fa-level-up" style="font-size: 48px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="cloud-title" style="width: 78px; height: 36px; overflow: hidden;"><a href="{{$parentpath.path}}">..</a>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{foreach $entries as $item}}
|
||||
<div class="cloud-container" style="float: left; width: 80px; height: 80px; margin: 5px;">
|
||||
<div class="cloud-icon"><a href="{{$item.fullPath}}">
|
||||
{{if $item.photo_icon}}
|
||||
<img src="photo/{{$item.photo_icon}}" style="width: 48px; height: 48px;">
|
||||
{{else}}
|
||||
<i class="fa {{$item.iconFromType}}" title="{{$item.type}}" style="font-size: 48px;"></i>
|
||||
{{/if}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="cloud-title" style="width: 78px; height: 36px; overflow: hidden;"><a href="{{$item.fullPath}}">
|
||||
{{$item.displayName}}
|
||||
</a>
|
||||
</div>
|
||||
{{if $item.is_owner}}
|
||||
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/foreach}}
|
||||
<div class="clear"></div>
|
||||
{{else}}
|
||||
<table id="cloud-index">
|
||||
<tr>
|
||||
<th width="1%"></th>
|
||||
|
@ -42,4 +76,5 @@
|
|||
|
||||
{{/foreach}}
|
||||
</table>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<div class="section-title-wrapper">
|
||||
{{if $actionspanel}}
|
||||
<div class="pull-right">
|
||||
<a href="cloud_tiles/{{$cpath}}" class="btn btn-sm btn-outline-secondary"><i class="fa fa-fw {{if $tiles}}fa-list-ul{{else}}fa-table{{/if}}"></i></a>
|
||||
{{if $is_owner}}
|
||||
<a href="/sharedwithme" class="btn btn-sm btn-outline-secondary"><i class="fa fa-cloud-download"></i> {{$shared}}</a>
|
||||
{{/if}}
|
||||
|
|
Loading…
Reference in a new issue