aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Storage/Browser.php36
-rw-r--r--Zotlabs/Storage/Directory.php4
-rw-r--r--view/tpl/cloud_directory.tpl14
3 files changed, 48 insertions, 6 deletions
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index 21190d1bd..7b20e9ddb 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -111,6 +111,19 @@ class Browser extends DAV\Browser\Plugin {
$parent_path = \Sabre\HTTP\encodePath($this->server->getBaseUri() . $parent_uri);
}
+ $embedable_video_types = [
+ 'video/mp4',
+ 'video/ogg',
+ 'video/webm'
+ ];
+
+ $embedable_audio_types = [
+ 'audio/mpeg',
+ 'audio/wav',
+ 'audio/ogg',
+ 'audio/webm'
+ ];
+
$f = [];
foreach ($files as $file) {
@@ -292,6 +305,29 @@ class Browser extends DAV\Browser\Plugin {
$ft['recurse'] = ['recurse_' . $id, t('Set permissions for all files and sub folders'), 0, '', [t('No'), t('Yes')]];
$ft['notify'] = ['notify_edit_' . $id, t('Notify your contacts about this file'), 0, '', [t('No'), t('Yes')]];
+ $embed_bbcode = '';
+ $link_bbcode = '';
+ $attach_bbcode = '';
+
+ if($data['is_photo']) {
+ $embed_bbcode = '[zmg]' . $ft['full_path'] . '[/zmg]';
+ }
+ elseif(strpos($type, 'video') === 0 && in_array($type, $embedable_video_types)) {
+ $embed_bbcode = '[zvideo]' . $ft['full_path'] . '[/zvideo]';
+ }
+ elseif(strpos($type, 'audio') === 0 && in_array($type, $embedable_audio_types)) {
+ $embed_bbcode = '[zaudio]' . $ft['full_path'] . '[/zaudio]';
+ }
+ $ft['embed_bbcode'] = $embed_bbcode;
+
+ if(! $data['is_dir']) {
+ $attach_bbcode = '[attachment]' . $data['hash'] . ',' . $data['revision'] . '[/attachment]';
+ }
+ $ft['attach_bbcode'] = $attach_bbcode;
+
+ $link_bbcode = '[zrl]' . $ft['full_path'] . '[/zrl]';
+ $ft['link_bbcode'] = $link_bbcode;
+
$f[] = $ft;
}
diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php
index f2a3a603d..c56ffcbbb 100644
--- a/Zotlabs/Storage/Directory.php
+++ b/Zotlabs/Storage/Directory.php
@@ -704,7 +704,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
}
if ($cat) {
- $r = q("select $prefix attach.id, attach.uid, attach.hash, attach.filename,
+ $r = q("select $prefix attach.id, attach.uid, attach.hash, attach.filename, attach.is_photo,
attach.filetype, attach.filesize, attach.revision, attach.folder, attach.creator,
attach.flags, attach.is_dir, attach.created, attach.edited, attach.display_path,
attach.allow_cid, attach.allow_gid, attach.deny_cid, attach.deny_gid from attach
@@ -715,7 +715,7 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
);
}
else {
- $r = q("select $prefix attach.id, attach.uid, attach.hash, attach.filename,
+ $r = q("select $prefix attach.id, attach.uid, attach.hash, attach.filename, attach.is_photo,
attach.filetype, attach.filesize, attach.revision, attach.folder, attach.creator,
attach.flags, attach.is_dir, attach.created, attach.edited, attach.display_path,
attach.allow_cid, attach.allow_gid, attach.deny_cid, attach.deny_gid from attach
diff --git a/view/tpl/cloud_directory.tpl b/view/tpl/cloud_directory.tpl
index 8fe31767c..a6993fe97 100644
--- a/view/tpl/cloud_directory.tpl
+++ b/view/tpl/cloud_directory.tpl
@@ -214,13 +214,19 @@
<div id="cloud-tool-info-{{$item.attach_id}}" class="cloud-tool">
{{if ! $item.collection}}
<div class="form-group">
- <label for="attach-code-input-{{$item.attach_id}}">Attachment code</label>
- <input type="text" class="form-control" id="attach-code-input-{{$item.attach_id}}" name="attach-code-input-{{$item.attach_id}}" value="[attachment]{{$item.resource}},{{$item.revision}}[/attachment]" onclick="this.select();" />
+ <label for="attach-code-input-{{$item.attach_id}}">Attachment BBcode</label>
+ <input type="text" class="form-control" id="attach-code-input-{{$item.attach_id}}" name="attach-code-input-{{$item.attach_id}}" value="{{$item.attach_bbcode}}" onclick="this.select();" />
</div>
+ {{if $item.embed_bbcode}}
+ <div class="form-group">
+ <label for="embed-code-input-{{$item.attach_id}}">Embed BBcode</label>
+ <input type="text" class="form-control" id="embed-code-input-{{$item.attach_id}}" name="embed-code-input-{{$item.attach_id}}" value="{{$item.embed_bbcode}}" onclick="this.select();" />
+ </div>
+ {{/if}}
{{/if}}
<div class="form-group">
- <label for="link-code-input-{{$item.attach_id}}">Link code</label>
- <input type="text" class="form-control" id="link-code-input-{{$item.attach_id}}" name="link-code-input-{{$item.attach_id}}" value="[zrl={{$item.full_path}}]{{$item.full_path}}[/zrl]" onclick="this.select();" />
+ <label for="link-code-input-{{$item.attach_id}}">Link BBcode</label>
+ <input type="text" class="form-control" id="link-code-input-{{$item.attach_id}}" name="link-code-input-{{$item.attach_id}}" value="{{$item.link_bbcode}}" onclick="this.select();" />
</div>
<div class="form-group">
<button id="cloud-tool-close-btn-{{$item.attach_id}}" class="btn btn-outline-secondary btn-sm cloud-tool-cancel-btn" type="button" data-id="{{$item.attach_id}}">