aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Dashboard
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Dashboard')
-rw-r--r--lib/public/Dashboard/Exceptions/DashboardAppNotAvailableException.php35
-rw-r--r--lib/public/Dashboard/IAPIWidget.php26
-rw-r--r--lib/public/Dashboard/IAPIWidgetV2.php24
-rw-r--r--lib/public/Dashboard/IButtonWidget.php26
-rw-r--r--lib/public/Dashboard/IConditionalWidget.php26
-rw-r--r--lib/public/Dashboard/IDashboardManager.php136
-rw-r--r--lib/public/Dashboard/IDashboardWidget.php148
-rw-r--r--lib/public/Dashboard/IIconWidget.php25
-rw-r--r--lib/public/Dashboard/IManager.php26
-rw-r--r--lib/public/Dashboard/IOptionWidget.php23
-rw-r--r--lib/public/Dashboard/IReloadableWidget.php22
-rw-r--r--lib/public/Dashboard/IWidget.php36
-rw-r--r--lib/public/Dashboard/Model/IWidgetConfig.php127
-rw-r--r--lib/public/Dashboard/Model/IWidgetRequest.php137
-rw-r--r--lib/public/Dashboard/Model/WidgetButton.php77
-rw-r--r--lib/public/Dashboard/Model/WidgetItem.php63
-rw-r--r--lib/public/Dashboard/Model/WidgetItems.php81
-rw-r--r--lib/public/Dashboard/Model/WidgetOptions.php46
-rw-r--r--lib/public/Dashboard/Model/WidgetSetting.php243
-rw-r--r--lib/public/Dashboard/Model/WidgetSetup.php274
-rw-r--r--lib/public/Dashboard/Model/WidgetTemplate.php326
-rw-r--r--lib/public/Dashboard/RegisterWidgetEvent.php57
-rw-r--r--lib/public/Dashboard/Service/IEventsService.php89
-rw-r--r--lib/public/Dashboard/Service/IWidgetsService.php56
24 files changed, 409 insertions, 1720 deletions
diff --git a/lib/public/Dashboard/Exceptions/DashboardAppNotAvailableException.php b/lib/public/Dashboard/Exceptions/DashboardAppNotAvailableException.php
deleted file mode 100644
index 854848da5b7..00000000000
--- a/lib/public/Dashboard/Exceptions/DashboardAppNotAvailableException.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
- *
- * @author Maxence Lange <maxence@artificial-owl.com>
- *
- * @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/>.
- *
- */
-namespace OCP\Dashboard\Exceptions;
-
-/**
- * @since 15.0.0
- *
- * Class DashboardAppNotAvailableException
- *
- */
-class DashboardAppNotAvailableException extends \Exception {
-}
diff --git a/lib/public/Dashboard/IAPIWidget.php b/lib/public/Dashboard/IAPIWidget.php
index 42ba9544d8a..c8f98290a0e 100644
--- a/lib/public/Dashboard/IAPIWidget.php
+++ b/lib/public/Dashboard/IAPIWidget.php
@@ -3,38 +3,22 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2021 Julien Veyssier <eneiluj@posteo.net>
- *
- * @author Julien Veyssier <eneiluj@posteo.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/>.
- *
+ * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Dashboard;
+use OCP\Dashboard\Model\WidgetItem;
+
/**
* interface IAPIWidget
*
* @since 22.0.0
*/
interface IAPIWidget extends IWidget {
-
/**
- * @return \OCP\Dashboard\Model\WidgetItem[] The widget items
+ * @return list<WidgetItem> The widget items
* @since 22.0.0
*/
public function getItems(string $userId, ?string $since = null, int $limit = 7): array;
diff --git a/lib/public/Dashboard/IAPIWidgetV2.php b/lib/public/Dashboard/IAPIWidgetV2.php
new file mode 100644
index 00000000000..3acd675202d
--- /dev/null
+++ b/lib/public/Dashboard/IAPIWidgetV2.php
@@ -0,0 +1,24 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Dashboard;
+
+use OCP\Dashboard\Model\WidgetItems;
+
+/**
+ * Interface IAPIWidgetV2
+ *
+ * @since 27.1.0
+ */
+interface IAPIWidgetV2 extends IWidget {
+ /**
+ * Items to render in the widget
+ *
+ * @since 27.1.0
+ */
+ public function getItemsV2(string $userId, ?string $since = null, int $limit = 7): WidgetItems;
+}
diff --git a/lib/public/Dashboard/IButtonWidget.php b/lib/public/Dashboard/IButtonWidget.php
new file mode 100644
index 00000000000..f4ebd9253c7
--- /dev/null
+++ b/lib/public/Dashboard/IButtonWidget.php
@@ -0,0 +1,26 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Dashboard;
+
+use OCP\Dashboard\Model\WidgetButton;
+
+/**
+ * Adds a button to the dashboard api representation
+ *
+ * @since 25.0.0
+ */
+interface IButtonWidget extends IWidget {
+ /**
+ * Get the buttons to show on the widget
+ *
+ * @param string $userId
+ * @return list<WidgetButton>
+ * @since 25.0.0
+ */
+ public function getWidgetButtons(string $userId): array;
+}
diff --git a/lib/public/Dashboard/IConditionalWidget.php b/lib/public/Dashboard/IConditionalWidget.php
new file mode 100644
index 00000000000..5c1445bbca8
--- /dev/null
+++ b/lib/public/Dashboard/IConditionalWidget.php
@@ -0,0 +1,26 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Dashboard;
+
+/**
+ * interface IConditionalWidget
+ *
+ * Allows an app to lazy-register a widget and in the lazy part of the code
+ * it can decide if the widget should really be registered.
+ *
+ * @since 26.0.0
+ */
+interface IConditionalWidget extends IWidget {
+ /**
+ * @return bool Whether the widget is enabled and should be registered
+ * @since 26.0.0
+ */
+ public function isEnabled(): bool;
+}
diff --git a/lib/public/Dashboard/IDashboardManager.php b/lib/public/Dashboard/IDashboardManager.php
deleted file mode 100644
index 46f31cd8ff4..00000000000
--- a/lib/public/Dashboard/IDashboardManager.php
+++ /dev/null
@@ -1,136 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Maxence Lange <maxence@artificial-owl.com>
- *
- * @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/>.
- *
- */
-namespace OCP\Dashboard;
-
-use OCP\Dashboard\Exceptions\DashboardAppNotAvailableException;
-use OCP\Dashboard\Model\IWidgetConfig;
-use OCP\Dashboard\Service\IEventsService;
-use OCP\Dashboard\Service\IWidgetsService;
-
-/**
- * Interface IDashboardManager
- *
- * IDashboardManager should be used to manage widget from the backend.
- * The call can be done from any Service.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- */
-interface IDashboardManager {
-
-
- /**
- * Register a IWidgetsService.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param IWidgetsService $widgetsService
- */
- public function registerWidgetsService(IWidgetsService $widgetsService);
-
-
- /**
- * Register a IEventsService.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param IEventsService $eventsService
- */
- public function registerEventsService(IEventsService $eventsService);
-
-
- /**
- * returns the OCP\Dashboard\Model\IWidgetConfig for a widgetId and userId.
- *
- * @see IWidgetConfig
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $widgetId
- * @param string $userId
- *
- * @throws DashboardAppNotAvailableException
- * @return IWidgetConfig
- */
- public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig;
-
-
- /**
- * Create push notifications for users.
- * $payload is an array that will be send to the Javascript method
- * called on push.
- * $uniqueId needs to be used if you send the push to multiples users
- * and multiples groups so that one user does not have duplicate
- * notifications.
- *
- * Push notifications are created in database and broadcast to user
- * that are running dashboard.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $widgetId
- * @param array $users
- * @param array $payload
- * @param string $uniqueId
- * @throws DashboardAppNotAvailableException
- */
- public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId = '');
-
-
- /**
- * Create push notifications for groups. (ie. createUsersEvent())
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $widgetId
- * @param array $groups
- * @param array $payload
- * @param string $uniqueId
- * @throws DashboardAppNotAvailableException
- */
- public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId = '');
-
-
- /**
- * Create push notifications for everyone. (ie. createUsersEvent())
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $widgetId
- * @param array $payload
- * @param string $uniqueId
- * @throws DashboardAppNotAvailableException
- */
- public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId = '');
-}
diff --git a/lib/public/Dashboard/IDashboardWidget.php b/lib/public/Dashboard/IDashboardWidget.php
deleted file mode 100644
index fc7de4dae98..00000000000
--- a/lib/public/Dashboard/IDashboardWidget.php
+++ /dev/null
@@ -1,148 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Maxence Lange <maxence@artificial-owl.com>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @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/>.
- *
- */
-namespace OCP\Dashboard;
-
-use OCP\Dashboard\Model\IWidgetConfig;
-use OCP\Dashboard\Model\IWidgetRequest;
-use OCP\Dashboard\Model\WidgetSetup;
-use OCP\Dashboard\Model\WidgetTemplate;
-
-/**
- * Interface IDashboardWidget
- *
- * This interface is used to create a widget: the widget must implement this
- * interface and be defined in appinfo/info.xml:
- *
- * <dashboard>
- * <widget>OCA\YourApp\YourWidget</widget>
- * </dashboard>
- *
- * Multiple widget can be defined in the same appinfo/info.xml.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- */
-interface IDashboardWidget {
-
- /**
- * Should returns the (unique) Id of the widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getId(): string;
-
-
- /**
- * Should returns the [display] name of the widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getName(): string;
-
-
- /**
- * Should returns some text describing the widget.
- * This description is displayed in the listing of the available widgets.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getDescription(): string;
-
-
- /**
- * Must generate and return a WidgetTemplate that define important stuff
- * about the Widget: icon, content, css or javascript.
- *
- * @see WidgetTemplate
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return WidgetTemplate
- */
- public function getWidgetTemplate(): WidgetTemplate;
-
-
- /**
- * Must create and return a WidgetSetup containing the general setup of
- * the widget
- *
- * @see WidgetSetup
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return WidgetSetup
- */
- public function getWidgetSetup(): WidgetSetup;
-
-
- /**
- * This method is called when a widget is loaded on the dashboard.
- * A widget is 'loaded on the dashboard' when one of these conditions
- * occurs:
- *
- * - the user is adding the widget on his dashboard,
- * - the user already added the widget on his dashboard and he is opening
- * the dashboard app.
- *
- * @see IWidgetConfig
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param IWidgetConfig $settings
- */
- public function loadWidget(IWidgetConfig $settings);
-
-
- /**
- * This method s executed when the widget call the net.requestWidget()
- * from the Javascript API.
- *
- * This is used by the frontend to communicate with the backend.
- *
- * @see IWidgetRequest
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param IWidgetRequest $request
- */
- public function requestWidget(IWidgetRequest $request);
-}
diff --git a/lib/public/Dashboard/IIconWidget.php b/lib/public/Dashboard/IIconWidget.php
new file mode 100644
index 00000000000..203a89279b0
--- /dev/null
+++ b/lib/public/Dashboard/IIconWidget.php
@@ -0,0 +1,25 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Dashboard;
+
+/**
+ * Allow getting the absolute icon url for a widget
+ *
+ * @since 25.0.0
+ */
+interface IIconWidget extends IWidget {
+ /**
+ * Get the absolute url for the widget icon (should be colored black or not have a color)
+ *
+ * The icon will be inverted automatically in mobile clients and when using dark mode
+ *
+ * @return string
+ * @since 25.0.0
+ */
+ public function getIconUrl(): string;
+}
diff --git a/lib/public/Dashboard/IManager.php b/lib/public/Dashboard/IManager.php
index 396624876ef..e69bf78225e 100644
--- a/lib/public/Dashboard/IManager.php
+++ b/lib/public/Dashboard/IManager.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2020 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/>.
- *
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Dashboard;
@@ -31,17 +14,16 @@ namespace OCP\Dashboard;
* @since 20.0.0
*/
interface IManager {
-
/**
* @param string $widgetClass
* @since 20.0.0
*/
- public function lazyRegisterWidget(string $widgetClass): void;
+ public function lazyRegisterWidget(string $widgetClass, string $appId): void;
/**
* @since 20.0.0
*
- * @return IWidget[]
+ * @return array<string, IWidget>
*/
public function getWidgets(): array;
}
diff --git a/lib/public/Dashboard/IOptionWidget.php b/lib/public/Dashboard/IOptionWidget.php
new file mode 100644
index 00000000000..3f4cd4dcd2e
--- /dev/null
+++ b/lib/public/Dashboard/IOptionWidget.php
@@ -0,0 +1,23 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Dashboard;
+
+use OCP\Dashboard\Model\WidgetOptions;
+
+/**
+ * Allow getting widget options
+ *
+ * @since 25.0.0
+ */
+interface IOptionWidget extends IWidget {
+ /**
+ * Get additional options for the widget
+ * @since 25.0.0
+ */
+ public function getWidgetOptions(): WidgetOptions;
+}
diff --git a/lib/public/Dashboard/IReloadableWidget.php b/lib/public/Dashboard/IReloadableWidget.php
new file mode 100644
index 00000000000..80f0181a33c
--- /dev/null
+++ b/lib/public/Dashboard/IReloadableWidget.php
@@ -0,0 +1,22 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Dashboard;
+
+/**
+ * Allow {@see IAPIWidgetV2} to reload their items
+ *
+ * @since 27.1.0
+ */
+interface IReloadableWidget extends IAPIWidgetV2 {
+ /**
+ * Periodic interval in seconds in which to reload the widget's items
+ *
+ * @since 27.1.0
+ */
+ public function getReloadInterval(): int;
+}
diff --git a/lib/public/Dashboard/IWidget.php b/lib/public/Dashboard/IWidget.php
index 6f3f795f958..c6bac98cae2 100644
--- a/lib/public/Dashboard/IWidget.php
+++ b/lib/public/Dashboard/IWidget.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright Copyright (c) 2020 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/>.
- *
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Dashboard;
@@ -31,9 +14,13 @@ namespace OCP\Dashboard;
* @since 20.0.0
*/
interface IWidget {
-
/**
- * @return string Unique id that identifies the widget, e.g. the app id
+ * Get a unique identifier for the widget
+ *
+ * To ensure uniqueness, it is recommended to user the app id or start with the
+ * app id followed by a dash.
+ *
+ * @return string Unique id that identifies the widget, e.g. the app id. Only use alphanumeric characters, dash and underscore
* @since 20.0.0
*/
public function getId(): string;
@@ -51,6 +38,13 @@ interface IWidget {
public function getOrder(): int;
/**
+ * CSS class that shows the widget icon (should be colored black or not have a color)
+ *
+ * The icon will be inverted automatically in mobile clients and when using dark mode.
+ * Therefore, it is NOT recommended to use a css class that sets the background with:
+ * `var(--icon-…)` as those will adapt to dark/bright mode in the web and still be inverted
+ * resulting in a dark icon on dark background.
+ *
* @return string css class that displays an icon next to the widget title
* @since 20.0.0
*/
diff --git a/lib/public/Dashboard/Model/IWidgetConfig.php b/lib/public/Dashboard/Model/IWidgetConfig.php
deleted file mode 100644
index b117660c441..00000000000
--- a/lib/public/Dashboard/Model/IWidgetConfig.php
+++ /dev/null
@@ -1,127 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Maxence Lange <maxence@artificial-owl.com>
- *
- * @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/>.
- *
- */
-namespace OCP\Dashboard\Model;
-
-use OCP\Dashboard\IDashboardWidget;
-
-/**
- * Interface IWidgetConfig
- *
- * This object contains the configuration of a widget for a userId
- *
- * @see IDashboardWidget::loadWidget
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- */
-interface IWidgetConfig {
-
-
- /**
- * Returns the userId
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getUserId(): string;
-
-
- /**
- * Returns the widgetId
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getWidgetId(): string;
-
-
- /**
- * Returns the current position and the current size of the widget as
- * displayed on the user's dashboard
- *
- * The returned value is an array:
- * [
- * 'x' => (int) position on the X axis,
- * 'y' => (int) position on the Y axis,
- * 'width' => (int) width of the widget,
- * 'height' => (int) height of the widget
- * ]
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return array
- */
- public function getPosition(): array;
-
-
- /**
- * Returns an array with the settings defined by the user for the widget.
- * The returned value is an array, with setting used as keys:
- *
- * [
- * 'setting1' => 'any value',
- * 'setting2' => 'other value'
- * ]
- *
- * Each setting that can be edited by a user should be defined in a
- * WidgetSetting.
- *
- * @see WidgetSetting
- *
- * Those WidgetSetting are in the WidgetTemplate defined during the setup
- * of the widget in the IDashboardWidget.
- *
- * @see IDashboardWidget::getWidgetTemplate
- * @see WidgetTemplate
- *
- * When using this framework, the settings interface is generated by the
- * Dashboard app.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return array
- */
- public function getSettings(): array;
-
-
- /**
- * Returns if the widget is enabled/displayed in this user's dashboard.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return bool
- */
- public function isEnabled(): bool;
-}
diff --git a/lib/public/Dashboard/Model/IWidgetRequest.php b/lib/public/Dashboard/Model/IWidgetRequest.php
deleted file mode 100644
index 73fe5fc5c2c..00000000000
--- a/lib/public/Dashboard/Model/IWidgetRequest.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Maxence Lange <maxence@artificial-owl.com>
- *
- * @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/>.
- *
- */
-namespace OCP\Dashboard\Model;
-
-use OCP\Dashboard\IDashboardWidget;
-
-/**
- * Interface IWidgetRequest
- *
- * WidgetRequest are created by the Dashboard App and used to communicate from
- * the frontend to the backend.
- * The object is send to the WidgetClass using IDashboardWidget::requestWidget
- *
- * @see IDashboardWidget::requestWidget
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- */
-interface IWidgetRequest {
-
- /**
- * Get the widgetId.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getWidgetId(): string;
-
-
- /**
- * Get the WidgetClass.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return IDashboardWidget
- */
- public function getWidget(): IDashboardWidget;
-
-
- /**
- * Get the 'request' string sent by the request from the front-end with
- * the format:
- *
- * net.requestWidget(
- * {
- * widget: widgetId,
- * request: request,
- * value: value
- * },
- * callback);
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getRequest(): string;
-
-
- /**
- * Get the 'value' string sent by the request from the front-end.
- *
- * @see getRequest
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getValue(): string;
-
-
- /**
- * Returns the result.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return array
- */
- public function getResult(): array;
-
-
- /**
- * add a result (as string)
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $key
- * @param string $result
- *
- * @return $this
- */
- public function addResult(string $key, string $result): IWidgetRequest;
-
- /**
- * add a result (as array)
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $key
- * @param array $result
- *
- * @return $this
- */
- public function addResultArray(string $key, array $result): IWidgetRequest;
-}
diff --git a/lib/public/Dashboard/Model/WidgetButton.php b/lib/public/Dashboard/Model/WidgetButton.php
new file mode 100644
index 00000000000..1c9ea6266a9
--- /dev/null
+++ b/lib/public/Dashboard/Model/WidgetButton.php
@@ -0,0 +1,77 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Dashboard\Model;
+
+/**
+ * Button for a dashboard widget
+ *
+ * @since 25.0.0
+ */
+class WidgetButton {
+ /**
+ * @since 25.0.0
+ */
+ public const TYPE_NEW = 'new';
+
+ /**
+ * @since 25.0.0
+ */
+ public const TYPE_MORE = 'more';
+
+ /**
+ * @since 25.0.0
+ */
+ public const TYPE_SETUP = 'setup';
+
+ private string $type;
+ private string $link;
+ private string $text;
+
+ /**
+ * @param string $type
+ * @param string $link
+ * @param string $text
+ * @since 25.0.0
+ */
+ public function __construct(string $type, string $link, string $text) {
+ $this->type = $type;
+ $this->link = $link;
+ $this->text = $text;
+ }
+
+ /**
+ * Get the button type, either "new", "more" or "setup"
+ *
+ * @return string
+ * @since 25.0.0
+ */
+ public function getType(): string {
+ return $this->type;
+ }
+
+ /**
+ * Get the absolute url the buttons links to
+ *
+ * @return string
+ * @since 25.0.0
+ */
+ public function getLink(): string {
+ return $this->link;
+ }
+
+ /**
+ * Get the translated text for the button
+ *
+ * @return string
+ * @since 25.0.0
+ */
+ public function getText(): string {
+ return $this->text;
+ }
+}
diff --git a/lib/public/Dashboard/Model/WidgetItem.php b/lib/public/Dashboard/Model/WidgetItem.php
index 2bea9b93226..680daf1b114 100644
--- a/lib/public/Dashboard/Model/WidgetItem.php
+++ b/lib/public/Dashboard/Model/WidgetItem.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright 2021, Julien Veyssier <eneiluj@posteo.net>
- *
- * @author Julien Veyssier <eneiluj@posteo.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/>.
- *
+ * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Dashboard\Model;
@@ -33,7 +16,7 @@ use JsonSerializable;
*
* This class is used by IAPIWidget interface.
* It represents an widget item data that can be provided to clients via the Dashboard API
- * @see IAPIWidget::getWidgetItems
+ * @see IAPIWidget::getItems
*
* @since 22.0.0
*
@@ -56,24 +39,30 @@ final class WidgetItem implements JsonSerializable {
*/
private $sinceId = '';
+ /**
+ * Overlay icon to show in the bottom right corner of {@see $iconUrl}
+ *
+ * @since 27.1.0
+ */
+ private string $overlayIconUrl = '';
/**
* WidgetItem constructor
*
* @since 22.0.0
- *
- * @param string $type
*/
public function __construct(string $title = '',
- string $subtitle = '',
- string $link = '',
- string $iconUrl = '',
- string $sinceId = '') {
+ string $subtitle = '',
+ string $link = '',
+ string $iconUrl = '',
+ string $sinceId = '',
+ string $overlayIconUrl = '') {
$this->title = $title;
$this->subtitle = $subtitle;
$this->iconUrl = $iconUrl;
$this->link = $link;
$this->sinceId = $sinceId;
+ $this->overlayIconUrl = $overlayIconUrl;
}
/**
@@ -133,9 +122,26 @@ final class WidgetItem implements JsonSerializable {
}
/**
- * @since 22.0.0
+ * Get the overlay icon url
+ *
+ * @since 27.1.0
*
- * @return array
+ * @return string
+ */
+ public function getOverlayIconUrl(): string {
+ return $this->overlayIconUrl;
+ }
+
+ /**
+ * @since 22.0.0
+ * @return array{
+ * subtitle: string,
+ * title: string,
+ * link: string,
+ * iconUrl: string,
+ * overlayIconUrl: string,
+ * sinceId: string,
+ * }
*/
public function jsonSerialize(): array {
return [
@@ -143,6 +149,7 @@ final class WidgetItem implements JsonSerializable {
'title' => $this->getTitle(),
'link' => $this->getLink(),
'iconUrl' => $this->getIconUrl(),
+ 'overlayIconUrl' => $this->getOverlayIconUrl(),
'sinceId' => $this->getSinceId(),
];
}
diff --git a/lib/public/Dashboard/Model/WidgetItems.php b/lib/public/Dashboard/Model/WidgetItems.php
new file mode 100644
index 00000000000..87491175964
--- /dev/null
+++ b/lib/public/Dashboard/Model/WidgetItems.php
@@ -0,0 +1,81 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+namespace OCP\Dashboard\Model;
+
+use JsonSerializable;
+use OCP\Dashboard\IAPIWidgetV2;
+
+/**
+ * Interface WidgetItems
+ *
+ * This class is used by {@see IAPIWidgetV2} interface.
+ * It represents an array of widget items and additional context information that can be provided to clients via the Dashboard API
+ *
+ * @see IAPIWidgetV2::getItemsV2
+ *
+ * @since 27.1.0
+ */
+class WidgetItems implements JsonSerializable {
+ /**
+ * @param $items WidgetItem[]
+ *
+ * @since 27.1.0
+ */
+ public function __construct(
+ private array $items = [],
+ private string $emptyContentMessage = '',
+ private string $halfEmptyContentMessage = '',
+ ) {
+ }
+
+ /**
+ * Items to render in the widgets
+ *
+ * @since 27.1.0
+ *
+ * @return WidgetItem[]
+ */
+ public function getItems(): array {
+ return $this->items;
+ }
+
+ /**
+ * The "half" empty content message to show above the list of items.
+ *
+ * A non-empty string enables this feature.
+ * An empty string hides the message and disables this feature.
+ *
+ * @since 27.1.0
+ */
+ public function getEmptyContentMessage(): string {
+ return $this->emptyContentMessage;
+ }
+
+ /**
+ * The empty content message to show in case of no items at all
+ *
+ * @since 27.1.0
+ */
+ public function getHalfEmptyContentMessage(): string {
+ return $this->halfEmptyContentMessage;
+ }
+
+ /**
+ * @since 27.1.0
+ */
+ public function jsonSerialize(): array {
+ $items = array_map(static function (WidgetItem $item) {
+ return $item->jsonSerialize();
+ }, $this->getItems());
+ return [
+ 'items' => $items,
+ 'emptyContentMessage' => $this->getEmptyContentMessage(),
+ 'halfEmptyContentMessage' => $this->getHalfEmptyContentMessage(),
+ ];
+ }
+}
diff --git a/lib/public/Dashboard/Model/WidgetOptions.php b/lib/public/Dashboard/Model/WidgetOptions.php
new file mode 100644
index 00000000000..7d0f567ca15
--- /dev/null
+++ b/lib/public/Dashboard/Model/WidgetOptions.php
@@ -0,0 +1,46 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Dashboard\Model;
+
+/**
+ * Option for displaying a widget
+ *
+ * @since 25.0.0
+ */
+class WidgetOptions {
+ private bool $roundItemIcons;
+
+ /**
+ * @param bool $roundItemIcons
+ * @since 25.0.0
+ */
+ public function __construct(bool $roundItemIcons) {
+ $this->roundItemIcons = $roundItemIcons;
+ }
+
+ /**
+ * Get the default set of options
+ *
+ * @return WidgetOptions
+ * @since 25.0.0
+ */
+ public static function getDefault(): WidgetOptions {
+ return new WidgetOptions(false);
+ }
+
+ /**
+ * Whether the clients should render icons for widget items as round icons
+ *
+ * @return bool
+ * @since 25.0.0
+ */
+ public function withRoundItemIcons(): bool {
+ return $this->roundItemIcons;
+ }
+}
diff --git a/lib/public/Dashboard/Model/WidgetSetting.php b/lib/public/Dashboard/Model/WidgetSetting.php
deleted file mode 100644
index fce59a4350b..00000000000
--- a/lib/public/Dashboard/Model/WidgetSetting.php
+++ /dev/null
@@ -1,243 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Maxence Lange <maxence@artificial-owl.com>
- *
- * @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/>.
- *
- */
-namespace OCP\Dashboard\Model;
-
-use JsonSerializable;
-
-/**
- * Interface WidgetSetting
- *
- * Each setting that can be edited by a user should be defined in a
- * WidgetSetting.
- *
- * When using this framework, the settings interface is generated by the
- * Dashboard app.
- *
- * Each WidgetSetting must be generated and declared in the WidgetTemplate
- * during the setup of the widget in the IDashboardWidget using addSetting().
- *
- * @see IDashboardWidget::getWidgetTemplate
- * @see WidgetTemplate::addSetting
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- */
-final class WidgetSetting implements JsonSerializable {
- public const TYPE_INPUT = 'input';
- public const TYPE_CHECKBOX = 'checkbox';
-
-
- /** @var string */
- private $name = '';
-
- /** @var string */
- private $title = '';
-
- /** @var string */
- private $type = '';
-
- /** @var string */
- private $placeholder = '';
-
- /** @var string */
- private $default = '';
-
-
- /**
- * WidgetSetting constructor.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $type
- */
- public function __construct(string $type = '') {
- $this->type = $type;
- }
-
-
- /**
- * Set the name of the setting (full string, no space)
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $name
- *
- * @return WidgetSetting
- */
- public function setName(string $name): WidgetSetting {
- $this->name = $name;
-
- return $this;
- }
-
- /**
- * Get the name of the setting
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getName(): string {
- return $this->name;
- }
-
-
- /**
- * Set the title/display name of the setting.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $title
- *
- * @return WidgetSetting
- */
- public function setTitle(string $title): WidgetSetting {
- $this->title = $title;
-
- return $this;
- }
-
- /**
- * Get the title of the setting
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getTitle(): string {
- return $this->title;
- }
-
-
- /**
- * Set the type of the setting (input, checkbox, ...)
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $type
- *
- * @return WidgetSetting
- */
- public function setType(string $type): WidgetSetting {
- $this->type = $type;
-
- return $this;
- }
-
- /**
- * Get the type of the setting.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getType(): string {
- return $this->type;
- }
-
-
- /**
- * Set the placeholder (in case of type=input)
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $text
- *
- * @return WidgetSetting
- */
- public function setPlaceholder(string $text): WidgetSetting {
- $this->placeholder = $text;
-
- return $this;
- }
-
- /**
- * Get the placeholder.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getPlaceholder(): string {
- return $this->placeholder;
- }
-
-
- /**
- * Set the default value of the setting.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $value
- *
- * @return WidgetSetting
- */
- public function setDefault(string $value): WidgetSetting {
- $this->default = $value;
-
- return $this;
- }
-
- /**
- * Get the default value.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getDefault(): string {
- return $this->default;
- }
-
-
- /**
- * @since 15.0.0
- * @deprecated 20.0.0
- */
- public function jsonSerialize(): array {
- return [
- 'name' => $this->getName(),
- 'title' => $this->getTitle(),
- 'type' => $this->getTitle(),
- 'default' => $this->getDefault(),
- 'placeholder' => $this->getPlaceholder()
- ];
- }
-}
diff --git a/lib/public/Dashboard/Model/WidgetSetup.php b/lib/public/Dashboard/Model/WidgetSetup.php
deleted file mode 100644
index f3e09dcc71b..00000000000
--- a/lib/public/Dashboard/Model/WidgetSetup.php
+++ /dev/null
@@ -1,274 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Maxence Lange <maxence@artificial-owl.com>
- *
- * @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/>.
- *
- */
-namespace OCP\Dashboard\Model;
-
-use JsonSerializable;
-
-/**
- * Interface WidgetSetup
- *
- * A widget must create an WidgetSetup object and returns it in the
- * IDashboardWidget::getWidgetSetup method.
- *
- * @see IDashboardWidget::getWidgetSetup
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- */
-final class WidgetSetup implements JsonSerializable {
- public const SIZE_TYPE_MIN = 'min';
- public const SIZE_TYPE_MAX = 'max';
- public const SIZE_TYPE_DEFAULT = 'default';
-
-
- /** @var array */
- private $sizes = [];
-
- /** @var array */
- private $menus = [];
-
- /** @var array */
- private $jobs = [];
-
- /** @var string */
- private $push = '';
-
- /** @var array */
- private $settings = [];
-
-
- /**
- * Get the defined size for a specific type (min, max, default)
- * Returns an array:
- * [
- * 'width' => width,
- * 'height' => height
- * ]
- *
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $type
- *
- * @return array
- */
- public function getSize(string $type): array {
- if (array_key_exists($type, $this->sizes)) {
- return $this->sizes[$type];
- }
-
- return [];
- }
-
- /**
- * Returns all sizes defined for the widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return array
- */
- public function getSizes(): array {
- return $this->sizes;
- }
-
- /**
- * Add a new size to the setup.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $type
- * @param int $width
- * @param int $height
- *
- * @return WidgetSetup
- */
- public function addSize(string $type, int $width, int $height): WidgetSetup {
- $this->sizes[$type] = [
- 'width' => $width,
- 'height' => $height
- ];
-
- return $this;
- }
-
- /**
- * Returns menu entries.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return array
- */
- public function getMenuEntries(): array {
- return $this->menus;
- }
-
- /**
- * Add a menu entry to the widget.
- * $function is the Javascript function to be called when clicking the
- * menu entry.
- * $icon is the css class of the icon.
- * $text is the display name of the menu entry.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $function
- * @param string $icon
- * @param string $text
- *
- * @return WidgetSetup
- */
- public function addMenuEntry(string $function, string $icon, string $text): WidgetSetup {
- $this->menus[] = [
- 'function' => $function,
- 'icon' => $icon,
- 'text' => $text
- ];
-
- return $this;
- }
-
-
- /**
- * Add a delayed job to the widget.
- *
- * $function is the Javascript function to be called.
- * $delay is the time in seconds between each call.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $function
- * @param int $delay
- *
- * @return WidgetSetup
- */
- public function addDelayedJob(string $function, int $delay): WidgetSetup {
- $this->jobs[] = [
- 'function' => $function,
- 'delay' => $delay
- ];
-
- return $this;
- }
-
- /**
- * Get delayed jobs.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return array
- */
- public function getDelayedJobs(): array {
- return $this->jobs;
- }
-
-
- /**
- * Get the push function, called when an event is send to the front-end
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getPush(): string {
- return $this->push;
- }
-
- /**
- * Set the Javascript function to be called when an event is pushed to the
- * frontend.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $function
- *
- * @return WidgetSetup
- */
- public function setPush(string $function): WidgetSetup {
- $this->push = $function;
-
- return $this;
- }
-
-
- /**
- * Returns the default settings for a widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return array
- */
- public function getDefaultSettings(): array {
- return $this->settings;
- }
-
- /**
- * Set the default settings for a widget.
- * This method is used by the Dashboard app, using the settings created
- * using WidgetSetting
- *
- * @see WidgetSetting
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param array $settings
- *
- * @return WidgetSetup
- */
- public function setDefaultSettings(array $settings): WidgetSetup {
- $this->settings = $settings;
-
- return $this;
- }
-
-
- /**
- * @since 15.0.0
- * @deprecated 20.0.0
- */
- public function jsonSerialize(): array {
- return [
- 'size' => $this->getSizes(),
- 'menu' => $this->getMenuEntries(),
- 'jobs' => $this->getDelayedJobs(),
- 'push' => $this->getPush(),
- 'settings' => $this->getDefaultSettings()
- ];
- }
-}
diff --git a/lib/public/Dashboard/Model/WidgetTemplate.php b/lib/public/Dashboard/Model/WidgetTemplate.php
deleted file mode 100644
index 3521960c303..00000000000
--- a/lib/public/Dashboard/Model/WidgetTemplate.php
+++ /dev/null
@@ -1,326 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Maxence Lange <maxence@artificial-owl.com>
- *
- * @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/>.
- *
- */
-namespace OCP\Dashboard\Model;
-
-use JsonSerializable;
-
-/**
- * Interface WidgetTemplate
- *
- * A widget must create an WidgetTemplate object and returns it in the
- * IDashboardWidget::getWidgetTemplate method.
- *
- * @see IDashboardWidget::getWidgetTemplate
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- */
-final class WidgetTemplate implements JsonSerializable {
-
-
- /** @var string */
- private $icon = '';
-
- /** @var array */
- private $css = [];
-
- /** @var array */
- private $js = [];
-
- /** @var string */
- private $content = '';
-
- /** @var string */
- private $function = '';
-
- /** @var WidgetSetting[] */
- private $settings = [];
-
-
- /**
- * Get the icon class of the widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getIcon(): string {
- return $this->icon;
- }
-
- /**
- * Set the icon class of the widget.
- * This class must be defined in one of the CSS file used by the widget.
- *
- * @see addCss
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $icon
- *
- * @return WidgetTemplate
- */
- public function setIcon(string $icon): WidgetTemplate {
- $this->icon = $icon;
-
- return $this;
- }
-
- /**
- * Get CSS files to be included when displaying a widget
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return array
- */
- public function getCss(): array {
- return $this->css;
- }
-
- /**
- * path and name of CSS files
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param array $css
- *
- * @return WidgetTemplate
- */
- public function setCss(array $css): WidgetTemplate {
- $this->css = $css;
-
- return $this;
- }
-
- /**
- * Add a CSS file to be included when displaying a widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $css
- *
- * @return WidgetTemplate
- */
- public function addCss(string $css): WidgetTemplate {
- $this->css[] = $css;
-
- return $this;
- }
-
- /**
- * Get JS files to be included when loading a widget
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return array
- */
- public function getJs(): array {
- return $this->js;
- }
-
- /**
- * Set an array of JS files to be included when loading a widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param array $js
- *
- * @return WidgetTemplate
- */
- public function setJs(array $js): WidgetTemplate {
- $this->js = $js;
-
- return $this;
- }
-
- /**
- * Add a JS file to be included when loading a widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $js
- *
- * @return WidgetTemplate
- */
- public function addJs(string $js): WidgetTemplate {
- $this->js[] = $js;
-
- return $this;
- }
-
- /**
- * Get the HTML file that contains the content of the widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getContent(): string {
- return $this->content;
- }
-
- /**
- * Set the HTML file that contains the content of the widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $content
- *
- * @return WidgetTemplate
- */
- public function setContent(string $content): WidgetTemplate {
- $this->content = $content;
-
- return $this;
- }
-
- /**
- * Get the JS function to be called when loading the widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return string
- */
- public function getInitFunction(): string {
- return $this->function;
- }
-
- /**
- * JavaScript function to be called when loading the widget on the
- * dashboard
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $function
- *
- * @return WidgetTemplate
- */
- public function setInitFunction(string $function): WidgetTemplate {
- $this->function = $function;
-
- return $this;
- }
-
- /**
- * Get all WidgetSetting defined for the widget.
- *
- * @see WidgetSetting
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @return WidgetSetting[]
- */
- public function getSettings(): array {
- return $this->settings;
- }
-
- /**
- * Define all WidgetSetting for the widget.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @see WidgetSetting
- *
- * @param WidgetSetting[] $settings
- *
- * @return WidgetTemplate
- */
- public function setSettings(array $settings): WidgetTemplate {
- $this->settings = $settings;
-
- return $this;
- }
-
- /**
- * Add a WidgetSetting.
- *
- * @see WidgetSetting
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param WidgetSetting $setting
- *
- * @return WidgetTemplate
- */
- public function addSetting(WidgetSetting $setting): WidgetTemplate {
- $this->settings[] = $setting;
-
- return $this;
- }
-
- /**
- * Get a WidgetSetting by its name
- *
- * @see WidgetSetting::setName
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $key
- *
- * @return WidgetSetting
- */
- public function getSetting(string $key): WidgetSetting {
- if (!array_key_exists($key, $this->settings)) {
- return null;
- }
-
- return $this->settings[$key];
- }
-
-
- /**
- * @since 15.0.0
- * @deprecated 20.0.0
- */
- public function jsonSerialize(): array {
- return [
- 'icon' => $this->getIcon(),
- 'css' => $this->getCss(),
- 'js' => $this->getJs(),
- 'content' => $this->getContent(),
- 'function' => $this->getInitFunction(),
- 'settings' => $this->getSettings()
- ];
- }
-}
diff --git a/lib/public/Dashboard/RegisterWidgetEvent.php b/lib/public/Dashboard/RegisterWidgetEvent.php
deleted file mode 100644
index 289de8e965d..00000000000
--- a/lib/public/Dashboard/RegisterWidgetEvent.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright Copyright (c) 2020 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/>.
- *
- */
-namespace OCP\Dashboard;
-
-use OCP\EventDispatcher\Event;
-
-/**
- * Class RegisterPanelEvent
- *
- * This event is dispatched to allow apps supporting older Nextcloud versions to
- * still register their dashboard panels so that they are only constructed when
- * they are needed. Deprecated right away so we can drop it again after 19 is EOL
- * and backward compatible apps can use OCP\AppFramework\Bootstrap\IBootstrap
- *
- * @since 20.0.0
- * @deprecated 20.0.0
- */
-class RegisterWidgetEvent extends Event {
- private $manager;
-
- public function __construct(IManager $manager) {
- parent::__construct();
-
- $this->manager = $manager;
- }
-
- /**
- * @param string $panelClass
- * @since 20.0.0
- */
- public function registerWidget(string $panelClass) {
- $this->manager->lazyRegisterWidget($panelClass);
- }
-}
diff --git a/lib/public/Dashboard/Service/IEventsService.php b/lib/public/Dashboard/Service/IEventsService.php
deleted file mode 100644
index a2a14e8c1c1..00000000000
--- a/lib/public/Dashboard/Service/IEventsService.php
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Maxence Lange <maxence@artificial-owl.com>
- *
- * @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/>.
- *
- */
-namespace OCP\Dashboard\Service;
-
-use OCP\Dashboard\IDashboardManager;
-
-/**
- * Interface IEventsService
- *
- * The Service is provided by the Dashboard app. The method in this interface
- * are used by the IDashboardManager when creating push event.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- */
-interface IEventsService {
-
-
- /**
- * Create an event for a widget and an array of users.
- *
- * @see IDashboardManager::createUsersEvent
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $widgetId
- * @param array $users
- * @param array $payload
- * @param string $uniqueId
- */
- public function createUsersEvent(string $widgetId, array $users, array $payload, string $uniqueId);
-
-
- /**
- * Create an event for a widget and an array of groups.
- *
- * @see IDashboardManager::createGroupsEvent
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $widgetId
- * @param array $groups
- * @param array $payload
- * @param string $uniqueId
- */
- public function createGroupsEvent(string $widgetId, array $groups, array $payload, string $uniqueId);
-
-
- /**
- * Create a global event for all users that use a specific widget.
- *
- * @see IDashboardManager::createGlobalEvent
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $widgetId
- * @param array $payload
- * @param string $uniqueId
- */
- public function createGlobalEvent(string $widgetId, array $payload, string $uniqueId);
-}
diff --git a/lib/public/Dashboard/Service/IWidgetsService.php b/lib/public/Dashboard/Service/IWidgetsService.php
deleted file mode 100644
index 9601a1a478e..00000000000
--- a/lib/public/Dashboard/Service/IWidgetsService.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/**
- * @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Maxence Lange <maxence@artificial-owl.com>
- *
- * @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/>.
- *
- */
-namespace OCP\Dashboard\Service;
-
-use OCP\Dashboard\Model\IWidgetConfig;
-
-/**
- * Interface IWidgetsService
- *
- * The Service is provided by the Dashboard app. The method in this interface
- * are used by the IDashboardManager when a widget needs to access the current
- * configuration of a widget for a user.
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- */
-interface IWidgetsService {
-
- /**
- * Returns the IWidgetConfig for a widgetId and userId
- *
- * @since 15.0.0
- * @deprecated 20.0.0
- *
- * @param string $widgetId
- * @param string $userId
- *
- * @return IWidgetConfig
- */
- public function getWidgetConfig(string $widgetId, string $userId): IWidgetConfig;
-}