|
|
|
|
@ -18,6 +18,7 @@ use OCP\AppFramework\Http\Attribute\NoCSRFRequired; |
|
|
|
|
use OCP\AppFramework\Http\DataResponse; |
|
|
|
|
use OCP\AppFramework\OCSController; |
|
|
|
|
use OCP\AppFramework\Services\IAppConfig; |
|
|
|
|
use OCP\Config\IUserConfig; |
|
|
|
|
use OCP\Dashboard\IAPIWidget; |
|
|
|
|
use OCP\Dashboard\IAPIWidgetV2; |
|
|
|
|
use OCP\Dashboard\IButtonWidget; |
|
|
|
|
@ -30,7 +31,6 @@ use OCP\Dashboard\Model\WidgetButton; |
|
|
|
|
use OCP\Dashboard\Model\WidgetItem; |
|
|
|
|
|
|
|
|
|
use OCP\Dashboard\Model\WidgetOptions; |
|
|
|
|
use OCP\IConfig; |
|
|
|
|
use OCP\IRequest; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -45,7 +45,7 @@ class DashboardApiController extends OCSController { |
|
|
|
|
IRequest $request, |
|
|
|
|
private IManager $dashboardManager, |
|
|
|
|
private IAppConfig $appConfig, |
|
|
|
|
private IConfig $config, |
|
|
|
|
private IUserConfig $userConfig, |
|
|
|
|
private ?string $userId, |
|
|
|
|
private DashboardService $service, |
|
|
|
|
) { |
|
|
|
|
@ -59,7 +59,7 @@ class DashboardApiController extends OCSController { |
|
|
|
|
private function getShownWidgets(array $widgetIds): array { |
|
|
|
|
if (empty($widgetIds)) { |
|
|
|
|
$systemDefault = $this->appConfig->getAppValueString('layout', 'recommendations,spreed,mail,calendar'); |
|
|
|
|
$widgetIds = explode(',', $this->config->getUserValue($this->userId, 'dashboard', 'layout', $systemDefault)); |
|
|
|
|
$widgetIds = explode(',', $this->userConfig->getValueString($this->userId, 'dashboard', 'layout', $systemDefault)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return array_filter( |
|
|
|
|
@ -202,7 +202,7 @@ class DashboardApiController extends OCSController { |
|
|
|
|
#[NoAdminRequired] |
|
|
|
|
#[ApiRoute(verb: 'POST', url: '/api/v3/layout')] |
|
|
|
|
public function updateLayout(array $layout): DataResponse { |
|
|
|
|
$this->config->setUserValue($this->userId, 'dashboard', 'layout', implode(',', $layout)); |
|
|
|
|
$this->userConfig->setValueString($this->userId, 'dashboard', 'layout', implode(',', $layout)); |
|
|
|
|
return new DataResponse(['layout' => $layout]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -230,7 +230,7 @@ class DashboardApiController extends OCSController { |
|
|
|
|
#[NoAdminRequired] |
|
|
|
|
#[ApiRoute(verb: 'POST', url: '/api/v3/statuses')] |
|
|
|
|
public function updateStatuses(array $statuses): DataResponse { |
|
|
|
|
$this->config->setUserValue($this->userId, 'dashboard', 'statuses', implode(',', $statuses)); |
|
|
|
|
$this->userConfig->setValueString($this->userId, 'dashboard', 'statuses', implode(',', $statuses)); |
|
|
|
|
return new DataResponse(['statuses' => $statuses]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|