mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
Merge pull request #14664 from nextcloud/bugfix/noid/absolute-paths-of-images-for-linked-collaboration-resources
Replace the icon-class with an absolute link to an image
This commit is contained in:
commit
2fcb6ddc22
28 changed files with 696 additions and 201 deletions
4
.gitattributes
vendored
4
.gitattributes
vendored
|
|
@ -5,8 +5,8 @@
|
|||
/apps/accessibility/js/accessibility.js.map binary
|
||||
/apps/comments/js/*.js binary
|
||||
/apps/comments/js/*.js.map binary
|
||||
/apps/files_sharing/js/additionalScripts.js binary
|
||||
/apps/files_sharing/js/additionalScripts.js.map binary
|
||||
/apps/files_sharing/js/dist/*.js binary
|
||||
/apps/files_sharing/js/dist/*.js.map binary
|
||||
/apps/files_versions/js/files_versions.js binary
|
||||
/apps/files_versions/js/files_versions.js.map binary
|
||||
/apps/oauth2/js/oauth2.js binary
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
|
||||
*
|
||||
|
|
@ -27,24 +28,29 @@ use OCP\Collaboration\Resources\IResource;
|
|||
use OCP\Collaboration\Resources\ResourceException;
|
||||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Node;
|
||||
use OCP\IPreview;
|
||||
use OCP\IURLGenerator;
|
||||
use OCP\IUser;
|
||||
|
||||
class ResourceProvider implements IProvider {
|
||||
|
||||
const RESOURCE_TYPE = 'files';
|
||||
public const RESOURCE_TYPE = 'file';
|
||||
|
||||
/** @var IRootFolder */
|
||||
protected $rootFolder;
|
||||
|
||||
/** @var IPreview */
|
||||
private $preview;
|
||||
/** @var IURLGenerator */
|
||||
private $urlGenerator;
|
||||
|
||||
/** @var array */
|
||||
protected $nodes = [];
|
||||
|
||||
public function __construct(IRootFolder $rootFolder, IURLGenerator $urlGenerator) {
|
||||
public function __construct(IRootFolder $rootFolder,
|
||||
IPreview $preview,
|
||||
IURLGenerator $urlGenerator) {
|
||||
$this->rootFolder = $rootFolder;
|
||||
$this->preview = $preview;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
}
|
||||
|
||||
|
|
@ -61,21 +67,34 @@ class ResourceProvider implements IProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the display name of a resource
|
||||
*
|
||||
* @param IResource $resource
|
||||
* @return string
|
||||
* @since 15.0.0
|
||||
* @return array
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getName(IResource $resource): string {
|
||||
public function getResourceRichObject(IResource $resource): array {
|
||||
if (isset($this->nodes[(int) $resource->getId()])) {
|
||||
return $this->nodes[(int) $resource->getId()]->getPath();
|
||||
$node = $this->nodes[(int) $resource->getId()]->getPath();
|
||||
} else {
|
||||
$node = $this->getNode($resource);
|
||||
}
|
||||
$node = $this->getNode($resource);
|
||||
if ($node) {
|
||||
return $node->getName();
|
||||
|
||||
if ($node instanceof Node) {
|
||||
$link = $this->urlGenerator->linkToRouteAbsolute(
|
||||
'files.viewcontroller.showFile',
|
||||
['fileid' => $resource->getId()]
|
||||
);
|
||||
return [
|
||||
'type' => 'file',
|
||||
'id' => $resource->getId(),
|
||||
'name' => $node->getName(),
|
||||
'path' => $node->getInternalPath(),
|
||||
'link' => $link,
|
||||
'mimetype' => $node->getMimetype(),
|
||||
'preview-available' => $this->preview->isAvailable($node),
|
||||
];
|
||||
}
|
||||
return '';
|
||||
|
||||
throw new ResourceException('File not found');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -84,7 +103,7 @@ class ResourceProvider implements IProvider {
|
|||
* @param IResource $resource
|
||||
* @param IUser $user
|
||||
* @return bool
|
||||
* @since 15.0.0
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function canAccessResource(IResource $resource, IUser $user = null): bool {
|
||||
if (!$user instanceof IUser) {
|
||||
|
|
@ -102,39 +121,13 @@ class ResourceProvider implements IProvider {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the icon class of a resource
|
||||
*
|
||||
* @param IResource $resource
|
||||
* @return string
|
||||
* @since 15.0.0
|
||||
*/
|
||||
public function getIconClass(IResource $resource): string {
|
||||
$node = $this->getNode($resource);
|
||||
if ($node && $node->getMimetype() === 'httpd/unix-directory') {
|
||||
return 'icon-files-dark';
|
||||
}
|
||||
return 'icon-filetype-file';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resource type of the provider
|
||||
*
|
||||
* @return string
|
||||
* @since 15.0.0
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getType(): string {
|
||||
return self::RESOURCE_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the link to a resource
|
||||
*
|
||||
* @param IResource $resource
|
||||
* @return string
|
||||
* @since 15.0.0
|
||||
*/
|
||||
public function getLink(IResource $resource): string {
|
||||
return $this->urlGenerator->linkToRoute('files.viewcontroller.showFile', ['fileid' => $resource->getId()]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ $eventDispatcher->addListener(
|
|||
\OCP\Util::addScript('files_sharing', 'dist/additionalScripts');
|
||||
}
|
||||
);
|
||||
\OC::$server->getEventDispatcher()->addListener('\OCP\Collaboration\Resources::loadAdditionalScripts', function () {
|
||||
\OCP\Util::addScript('files_sharing', 'dist/collaboration');
|
||||
});
|
||||
|
||||
$config = \OC::$server->getConfig();
|
||||
$shareManager = \OC::$server->getShareManager();
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
apps/files_sharing/js/dist/collaboration.js
vendored
Normal file
2
apps/files_sharing/js/dist/collaboration.js
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="/js/",t(t.s=0)}([function(e,n,r){r.p=OC.linkTo("files_sharing","js/dist/"),r.nc=btoa(OC.requestToken),window.OCP.Collaboration.registerType("file",{action:function(){return new Promise(function(e,n){OC.dialogs.filepicker("Link to a file",function(t){OC.Files.getClient().getFileInfo(t).then(function(n,t){e(t.id)},function(){n()})},!1)})},typeString:t("files_sharing","file"),typeIconClass:"icon-files-dark"})}]);
|
||||
//# sourceMappingURL=collaboration.js.map
|
||||
1
apps/files_sharing/js/dist/collaboration.js.map
vendored
Normal file
1
apps/files_sharing/js/dist/collaboration.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
568
apps/files_sharing/js/dist/files_sharing.3.js
vendored
568
apps/files_sharing/js/dist/files_sharing.3.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
24
apps/files_sharing/js/dist/files_sharing.4.js
vendored
Normal file
24
apps/files_sharing/js/dist/files_sharing.4.js
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
(window.webpackJsonp=window.webpackJsonp||[]).push([[4],{14:function(e,o,i){"use strict";i.r(o);var n=i(17),l=i(25),r=i(26),s=i.n(r),a=i(27),u={name:"CollaborationView",computed:{fileId:function(){return this.$root.model&&this.$root.model.id?""+this.$root.model.id:null},filename:function(){return this.$root.model&&this.$root.model.name?""+this.$root.model.name:""}},components:{CollectionList:i(54).a}},c=i(53),d=Object(c.a)(u,function(){var t=this.$createElement,e=this._self._c||t;return this.fileId?e("collection-list",{attrs:{type:"file",id:this.fileId,name:this.filename}}):this._e()},[],!1,null,null,null).exports;i.d(o,"Vue",function(){return n.a}),i.d(o,"View",function(){return d}),
|
||||
/*
|
||||
* @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @author Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
n.a.prototype.t=t,n.a.component("PopoverMenu",l.PopoverMenu),n.a.directive("ClickOutside",s.a),n.a.directive("Tooltip",a.a)}}]);
|
||||
//# sourceMappingURL=files_sharing.4.js.map
|
||||
1
apps/files_sharing/js/dist/files_sharing.4.js.map
vendored
Normal file
1
apps/files_sharing/js/dist/files_sharing.4.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
2
apps/files_sharing/js/dist/files_sharing.js
vendored
2
apps/files_sharing/js/dist/files_sharing.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -33,5 +33,6 @@ $tmpl = new OCP\Template('files_sharing', 'list', '');
|
|||
$tmpl->assign('showgridview', $showgridview && !$isIE);
|
||||
|
||||
OCP\Util::addScript('files_sharing', 'dist/files_sharing');
|
||||
\OC::$server->getEventDispatcher()->dispatch('\OCP\Collaboration\Resources::loadAdditionalScripts');
|
||||
|
||||
$tmpl->printPage();
|
||||
|
|
|
|||
|
|
@ -8,22 +8,6 @@ import './sharebreadcrumbview'
|
|||
import './style/sharetabview.scss'
|
||||
import './style/sharebreadcrumb.scss'
|
||||
|
||||
window.OCP.Collaboration.registerType('files', {
|
||||
action: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
OC.dialogs.filepicker('Link to a file', function (f) {
|
||||
const client = OC.Files.getClient();
|
||||
client.getFileInfo(f).then((status, fileInfo) => {
|
||||
resolve(fileInfo.id);
|
||||
}, () => {
|
||||
reject();
|
||||
});
|
||||
}, false);
|
||||
});
|
||||
},
|
||||
/** used in "Link to a {typeString}" */
|
||||
typeString: t('files_sharing', 'file'),
|
||||
typeIconClass: 'icon-files-dark'
|
||||
});
|
||||
import './collaborationresourceshandler.js'
|
||||
|
||||
window.OCA.Sharing = OCA.Sharing;
|
||||
|
|
|
|||
20
apps/files_sharing/src/collaborationresourceshandler.js
Normal file
20
apps/files_sharing/src/collaborationresourceshandler.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/');
|
||||
__webpack_nonce__ = btoa(OC.requestToken);
|
||||
|
||||
window.OCP.Collaboration.registerType('file', {
|
||||
action: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
OC.dialogs.filepicker('Link to a file', function (f) {
|
||||
const client = OC.Files.getClient();
|
||||
client.getFileInfo(f).then((status, fileInfo) => {
|
||||
resolve(fileInfo.id);
|
||||
}, () => {
|
||||
reject();
|
||||
});
|
||||
}, false);
|
||||
});
|
||||
},
|
||||
/** used in "Link to a {typeString}" */
|
||||
typeString: t('files_sharing', 'file'),
|
||||
typeIconClass: 'icon-files-dark'
|
||||
});
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
-->
|
||||
|
||||
<template>
|
||||
<collection-list v-if="fileId" type="files" :id="fileId" :name="filename"></collection-list>
|
||||
<collection-list v-if="fileId" type="file" :id="fileId" :name="filename"></collection-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ module.exports = {
|
|||
entry: {
|
||||
'additionalScripts': path.join(__dirname, 'src', 'additionalScripts.js'),
|
||||
'files_sharing': path.join(__dirname, 'src', 'files_sharing.js'),
|
||||
'collaboration': path.join(__dirname, 'src', 'collaborationresourceshandler.js'),
|
||||
},
|
||||
output: {
|
||||
path: path.resolve(__dirname, './js/dist/'),
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ class CollaborationResourcesController extends OCSController {
|
|||
try {
|
||||
$resource = $this->manager->getResourceForUser($resourceType, $resourceId, $this->userSession->getUser());
|
||||
} catch (ResourceException $e) {
|
||||
return new DataResponse([], Http::STATUS_NOT_FOUND);
|
||||
$resource = $this->manager->createResource($resourceType, $resourceId);
|
||||
}
|
||||
|
||||
if (!$resource->canAccess($this->userSession->getUser())) {
|
||||
|
|
@ -241,12 +241,6 @@ class CollaborationResourcesController extends OCSController {
|
|||
return null;
|
||||
}
|
||||
|
||||
return [
|
||||
'type' => $resource->getType(),
|
||||
'id' => $resource->getId(),
|
||||
'name' => $resource->getName(),
|
||||
'iconClass' => $resource->getIconClass(),
|
||||
'link' => $resource->getLink(),
|
||||
];
|
||||
return $resource->getRichObject();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
core/js/dist/main.js
vendored
2
core/js/dist/main.js
vendored
|
|
@ -220,7 +220,7 @@ function i(e,t){var n=["B","KB","MB","GB","TB"],i=e>0?Math.floor(Math.log(e)/Mat
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/var g={},_={},v={loadScript:function(e,t){var n=e+t;return g.hasOwnProperty(n)?Promise.resolve():(g[n]=!0,new Promise(function(n,i){var r=OC.filePath(e,"js",t),s=document.createElement("script");s.src=r,s.setAttribute("nonce",btoa(OC.requestToken)),s.onload=function(){return n()},s.onerror=function(){return i("Failed to load script from ".concat(r))},document.head.appendChild(s)}))},loadStylesheet:function(e,t){var n=e+t;return _.hasOwnProperty(n)?Promise.resolve():(_[n]=!0,new Promise(function(n,i){var r=OC.filePath(e,"css",t),s=document.createElement("link");s.href=r,s.type="text/css",s.rel="stylesheet",s.onload=function(){return n()},s.onerror=function(){return i("Failed to load stylesheet from ".concat(r))},document.head.appendChild(s)}))}},y={},b={registerType:function(e,t){console.log("Type "+e+" registered"),y[e]=t},trigger:function(e){return y[e].action()},getTypes:function(){return Object.keys(y)},getIcon:function(e){return y[e].typeIconClass||""},getLabel:function(e){return t("files_sharing","Link to a {label}",{label:y[e].typeString||e},1)},getLink:function(e,t){return void 0!==y[e]?y[e].link(t):""}},w=i(3),k=i.n(w),M=i(8);function x(e){var n=(e=e||{}).dismiss||{};u.a.ajax({type:"GET",url:e.url||M.a.linkToOCS("core",2)+"whatsnew?format=json",success:e.success||function(e,i,r){!function(e,n,i,r){if(console.debug("querying Whats New data was successful: "+n),console.debug(e),200!==i.status)return;var s,o,a,l,u=document.createElement("div");u.classList.add("popovermenu","open","whatsNewPopover","menu-left");var c=document.createElement("ul");for(var d in s=document.createElement("li"),(o=document.createElement("span")).className="menuitem",(a=document.createElement("span")).innerText=t("core","New in")+" "+e.ocs.data.product,a.className="caption",o.appendChild(a),(l=document.createElement("span")).className="icon-close",l.onclick=function(){A(e.ocs.data.version,r)},o.appendChild(l),s.appendChild(o),c.appendChild(s),e.ocs.data.whatsNew.regular){var h=e.ocs.data.whatsNew.regular[d];s=document.createElement("li"),(o=document.createElement("span")).className="menuitem",(l=document.createElement("span")).className="icon-checkmark",o.appendChild(l),(a=document.createElement("p")).innerHTML=k.a.escape(h),o.appendChild(a),s.appendChild(o),c.appendChild(s)}k.a.isUndefined(e.ocs.data.changelogURL)||(s=document.createElement("li"),(o=document.createElement("a")).href=e.ocs.data.changelogURL,o.rel="noreferrer noopener",o.target="_blank",(l=document.createElement("span")).className="icon-link",o.appendChild(l),(a=document.createElement("span")).innerText=t("core","View changelog"),o.appendChild(a),s.appendChild(o),c.appendChild(s));u.appendChild(c),document.body.appendChild(u)}(e,i,r,n)},error:e.error||L})}function A(e,t){t=t||{},u.a.ajax({type:"POST",url:t.url||M.a.linkToOCS("core",2)+"whatsnew",data:{version:encodeURIComponent(e)},success:t.success||D,error:t.error||T}),u()(".whatsNewPopover").remove()}function L(e,t,n){console.debug("querying Whats New Data resulted in an error: "+t+n),console.debug(e)}function D(e){}function T(e){console.debug("dismissing Whats New data resulted in an error: "+e)}n.a={AppConfig:a,Comments:r,InitialState:s,Loader:v,WhatsNew:o,Collaboration:b}},function(e,t,n){
|
||||
*/var g={},_={},v={loadScript:function(e,t){var n=e+t;return g.hasOwnProperty(n)?Promise.resolve():(g[n]=!0,new Promise(function(n,i){var r=OC.filePath(e,"js",t),s=document.createElement("script");s.src=r,s.setAttribute("nonce",btoa(OC.requestToken)),s.onload=function(){return n()},s.onerror=function(){return i("Failed to load script from ".concat(r))},document.head.appendChild(s)}))},loadStylesheet:function(e,t){var n=e+t;return _.hasOwnProperty(n)?Promise.resolve():(_[n]=!0,new Promise(function(n,i){var r=OC.filePath(e,"css",t),s=document.createElement("link");s.href=r,s.type="text/css",s.rel="stylesheet",s.onload=function(){return n()},s.onerror=function(){return i("Failed to load stylesheet from ".concat(r))},document.head.appendChild(s)}))}},y={},b={registerType:function(e,t){y[e]=t},trigger:function(e){return y[e].action()},getTypes:function(){return Object.keys(y)},getIcon:function(e){return y[e].typeIconClass||""},getLabel:function(e){return t("files_sharing","Link to a {label}",{label:y[e].typeString||e},1)},getLink:function(e,t){return void 0!==y[e]?y[e].link(t):""}},w=i(3),k=i.n(w),M=i(8);function x(e){var n=(e=e||{}).dismiss||{};u.a.ajax({type:"GET",url:e.url||M.a.linkToOCS("core",2)+"whatsnew?format=json",success:e.success||function(e,i,r){!function(e,n,i,r){if(console.debug("querying Whats New data was successful: "+n),console.debug(e),200!==i.status)return;var s,o,a,l,u=document.createElement("div");u.classList.add("popovermenu","open","whatsNewPopover","menu-left");var c=document.createElement("ul");for(var d in s=document.createElement("li"),(o=document.createElement("span")).className="menuitem",(a=document.createElement("span")).innerText=t("core","New in")+" "+e.ocs.data.product,a.className="caption",o.appendChild(a),(l=document.createElement("span")).className="icon-close",l.onclick=function(){A(e.ocs.data.version,r)},o.appendChild(l),s.appendChild(o),c.appendChild(s),e.ocs.data.whatsNew.regular){var h=e.ocs.data.whatsNew.regular[d];s=document.createElement("li"),(o=document.createElement("span")).className="menuitem",(l=document.createElement("span")).className="icon-checkmark",o.appendChild(l),(a=document.createElement("p")).innerHTML=k.a.escape(h),o.appendChild(a),s.appendChild(o),c.appendChild(s)}k.a.isUndefined(e.ocs.data.changelogURL)||(s=document.createElement("li"),(o=document.createElement("a")).href=e.ocs.data.changelogURL,o.rel="noreferrer noopener",o.target="_blank",(l=document.createElement("span")).className="icon-link",o.appendChild(l),(a=document.createElement("span")).innerText=t("core","View changelog"),o.appendChild(a),s.appendChild(o),c.appendChild(s));u.appendChild(c),document.body.appendChild(u)}(e,i,r,n)},error:e.error||L})}function A(e,t){t=t||{},u.a.ajax({type:"POST",url:t.url||M.a.linkToOCS("core",2)+"whatsnew",data:{version:encodeURIComponent(e)},success:t.success||D,error:t.error||T}),u()(".whatsNewPopover").remove()}function L(e,t,n){console.debug("querying Whats New Data resulted in an error: "+t+n),console.debug(e)}function D(e){}function T(e){console.debug("dismissing Whats New data resulted in an error: "+e)}n.a={AppConfig:a,Comments:r,InitialState:s,Loader:v,WhatsNew:o,Collaboration:b}},function(e,t,n){
|
||||
/*!
|
||||
* clipboard.js v2.0.4
|
||||
* https://zenorocha.github.io/clipboard.js
|
||||
|
|
|
|||
2
core/js/dist/main.js.map
vendored
2
core/js/dist/main.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -39,7 +39,6 @@ export default {
|
|||
* @param {TypeDefinition} typeDefinition
|
||||
*/
|
||||
registerType(type, typeDefinition) {
|
||||
console.log('Type ' + type + ' registered')
|
||||
types[type] = typeDefinition;
|
||||
},
|
||||
trigger(type) {
|
||||
|
|
|
|||
|
|
@ -285,41 +285,23 @@ class Manager implements IManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the display name of a resource
|
||||
* Get the rich object data of a resource
|
||||
*
|
||||
* @param IResource $resource
|
||||
* @return string
|
||||
* @return array
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getName(IResource $resource): string {
|
||||
public function getResourceRichObject(IResource $resource): array {
|
||||
foreach ($this->getProviders() as $provider) {
|
||||
if ($provider->getType() === $resource->getType()) {
|
||||
try {
|
||||
return $provider->getName($resource);
|
||||
return $provider->getResourceRichObject($resource);
|
||||
} catch (ResourceException $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param IResource $resource
|
||||
* @return string
|
||||
*/
|
||||
public function getIconClass(IResource $resource): string {
|
||||
foreach ($this->getProviders() as $provider) {
|
||||
if ($provider->getType() === $resource->getType()) {
|
||||
try {
|
||||
return $provider->getIconClass($resource);
|
||||
} catch (ResourceException $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -541,24 +523,4 @@ class Manager implements IManager {
|
|||
public function getType(): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the link to a resource
|
||||
*
|
||||
* @param IResource $resource
|
||||
* @return string
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getLink(IResource $resource): string {
|
||||
foreach ($this->getProviders() as $provider) {
|
||||
if ($provider->getType() === $resource->getType()) {
|
||||
try {
|
||||
return $provider->getLink($resource);
|
||||
} catch (ResourceException $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,14 +49,8 @@ class Resource implements IResource {
|
|||
/** @var bool|null */
|
||||
protected $access;
|
||||
|
||||
/** @var string|null */
|
||||
protected $name;
|
||||
|
||||
/** @var string|null */
|
||||
protected $iconClass;
|
||||
|
||||
/** @var string|null */
|
||||
protected $link;
|
||||
/** @var array|null */
|
||||
protected $data;
|
||||
|
||||
public function __construct(
|
||||
IManager $manager,
|
||||
|
|
@ -91,35 +85,15 @@ class Resource implements IResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return array
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getName(): string {
|
||||
if ($this->name === null) {
|
||||
$this->name = $this->manager->getName($this);
|
||||
public function getRichObject(): array {
|
||||
if ($this->data === null) {
|
||||
$this->data = $this->manager->getResourceRichObject($this);
|
||||
}
|
||||
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getIconClass(): string {
|
||||
if ($this->iconClass === null) {
|
||||
$this->iconClass = $this->manager->getIconClass($this);
|
||||
}
|
||||
|
||||
return $this->iconClass;
|
||||
}
|
||||
|
||||
public function getLink(): string {
|
||||
if ($this->link === null) {
|
||||
$this->link = $this->manager->getLink($this);
|
||||
}
|
||||
|
||||
return $this->link;
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -38,31 +38,13 @@ interface IProvider {
|
|||
public function getType(): string;
|
||||
|
||||
/**
|
||||
* Get the display name of a resource
|
||||
* Get the rich object data of a resource
|
||||
*
|
||||
* @param IResource $resource
|
||||
* @return string
|
||||
* @return array
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getName(IResource $resource): string;
|
||||
|
||||
/**
|
||||
* Get the icon class of a resource
|
||||
*
|
||||
* @param IResource $resource
|
||||
* @return string
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getIconClass(IResource $resource): string;
|
||||
|
||||
/**
|
||||
* Get the link to a resource
|
||||
*
|
||||
* @param IResource $resource
|
||||
* @return string
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getLink(IResource $resource): string;
|
||||
public function getResourceRichObject(IResource $resource): array;
|
||||
|
||||
/**
|
||||
* Can a user/guest access the collection
|
||||
|
|
|
|||
|
|
@ -42,22 +42,10 @@ interface IResource {
|
|||
public function getId(): string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return array
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getName(): string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getIconClass(): string;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @since 16.0.0
|
||||
*/
|
||||
public function getLink(): string;
|
||||
public function getRichObject(): array;
|
||||
|
||||
/**
|
||||
* Can a user/guest access the resource
|
||||
|
|
|
|||
20
package-lock.json
generated
20
package-lock.json
generated
|
|
@ -4812,12 +4812,12 @@
|
|||
}
|
||||
},
|
||||
"nextcloud-vue-collections": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/nextcloud-vue-collections/-/nextcloud-vue-collections-0.1.2.tgz",
|
||||
"integrity": "sha512-GoGvQSbBQWJQCjIPQVyKXvY2C289rZnqOo6LhpI8c7J9SuviHrbfUe5nAUZoyY5L6nsUHy5BUXtP6ppa+oiwbw==",
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/nextcloud-vue-collections/-/nextcloud-vue-collections-0.2.0.tgz",
|
||||
"integrity": "sha512-LDbJyUZffu8ZIkkXAMXkfqkUK36GaUiuS4IdgoOLe/z9prV/Iic7uwrDME015FsCv9GmfheOs7cfiU6xBIidGA==",
|
||||
"requires": {
|
||||
"nextcloud-axios": "^0.1.2",
|
||||
"nextcloud-vue": "^0.7.0",
|
||||
"nextcloud-vue": "^0.9.0",
|
||||
"v-tooltip": "^2.0.0-rc.33",
|
||||
"vue": "^2.6.6",
|
||||
"vue-click-outside": "^1.0.7",
|
||||
|
|
@ -4825,9 +4825,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"nextcloud-vue": {
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/nextcloud-vue/-/nextcloud-vue-0.7.1.tgz",
|
||||
"integrity": "sha512-7KtOuZh2hGlppN8zyxGU+tg/8SxO/DYxed7NG4m6YpaCpFJXg/OKADlKTy44meHXnnCW/+TPeDTh+KvPKxU/Sw==",
|
||||
"version": "0.9.1",
|
||||
"resolved": "https://registry.npmjs.org/nextcloud-vue/-/nextcloud-vue-0.9.1.tgz",
|
||||
"integrity": "sha512-8Lmout8Y6+zNPHqZ8rV7GcuKRbFpM8EserkvhkXAJYymq9mblz2NkfmOzhOGxhRICfPHnZ/xFUTxUuaSus4p+Q==",
|
||||
"requires": {
|
||||
"hammerjs": "^2.0.8",
|
||||
"md5": "^2.2.1",
|
||||
|
|
@ -4836,6 +4836,7 @@
|
|||
"vue": "^2.6.7",
|
||||
"vue-click-outside": "^1.0.7",
|
||||
"vue-multiselect": "^2.1.3",
|
||||
"vue-visible": "^1.0.2",
|
||||
"vue2-datepicker": "^2.10.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -7190,6 +7191,11 @@
|
|||
"integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==",
|
||||
"dev": true
|
||||
},
|
||||
"vue-visible": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/vue-visible/-/vue-visible-1.0.2.tgz",
|
||||
"integrity": "sha512-yaX2its9XAJKGuQqf7LsiZHHSkxsIK8rmCOQOvEGEoF41blKRK8qr9my4qYoD6ikdLss4n8tKqYBecmaY0+WJg=="
|
||||
},
|
||||
"vue2-datepicker": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/vue2-datepicker/-/vue2-datepicker-2.10.0.tgz",
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
"nextcloud-axios": "^0.1.3",
|
||||
"nextcloud-password-confirmation": "^0.4.1",
|
||||
"nextcloud-vue": "^0.8.0",
|
||||
"nextcloud-vue-collections": "^0.1.2",
|
||||
"nextcloud-vue-collections": "^0.2.0",
|
||||
"snap.js": "^2.0.9",
|
||||
"strengthify": "git+https://github.com/MorrisJobke/strengthify.git",
|
||||
"underscore": "^1.9.1",
|
||||
|
|
|
|||
Loading…
Reference in a new issue