From 59fbb860f1ab6d56279ce86fcf455790293c8557 Mon Sep 17 00:00:00 2001 From: Ronak Date: Wed, 19 Jul 2023 23:45:44 -0700 Subject: [PATCH 1/2] position issue --- lib/Service/AppsService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 5142743..1ea1f2a 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -23,7 +23,7 @@ class AppsService { private IURLGenerator $urlGenerator; private IRootFolder $rootFolder; - private const DEFAULT_ORDER = array("/apps/snappymail/", "/apps/calendar/", "/apps/files/" , "/apps/photos/", "/apps/memories/", "/apps/contacts/", "/apps/onlyoffice/ajax/new?id=onlyoffice_docx", "/apps/onlyoffice/ajax/new?id=onlyoffice_xlsx", "/apps/onlyoffice/ajax/new?id=onlyoffice_pptx", "/apps/notes/", "/apps/tasks/", "https://spot.murena.io" , "https://murena.com" ); + private const DEFAULT_ORDER = array("/apps/snappymail/", "/apps/calendar/", "/apps/files/" , "/apps/photos/", "/apps/memories/", "/apps/contacts/", "/apps/onlyoffice/new?id=onlyoffice_docx", "/apps/onlyoffice/new?id=onlyoffice_xlsx", "/apps/onlyoffice/new?id=onlyoffice_pptx", "/apps/notes/", "/apps/tasks/", "https://spot.murena.io" , "https://murena.com" ); public function __construct( $appName, IConfig $config, -- GitLab From 7f86135eb99017598a318bb7ff16520cccfd5199 Mon Sep 17 00:00:00 2001 From: Ronak Date: Thu, 20 Jul 2023 07:58:17 -0700 Subject: [PATCH 2/2] removed name,dir from ordering --- lib/Service/AppsService.php | 38 +++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 1ea1f2a..78ddd5a 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -11,7 +11,8 @@ use OCP\IURLGenerator; use OCP\L10N\IFactory; use OCP\Files\IRootFolder; -class AppsService { +class AppsService +{ private string $appName; private ?string $userId; private IConfig $config; @@ -23,7 +24,7 @@ class AppsService { private IURLGenerator $urlGenerator; private IRootFolder $rootFolder; - private const DEFAULT_ORDER = array("/apps/snappymail/", "/apps/calendar/", "/apps/files/" , "/apps/photos/", "/apps/memories/", "/apps/contacts/", "/apps/onlyoffice/new?id=onlyoffice_docx", "/apps/onlyoffice/new?id=onlyoffice_xlsx", "/apps/onlyoffice/new?id=onlyoffice_pptx", "/apps/notes/", "/apps/tasks/", "https://spot.murena.io" , "https://murena.com" ); + private const DEFAULT_ORDER = array("/apps/snappymail/", "/apps/calendar/", "/apps/files/", "/apps/photos/", "/apps/memories/", "/apps/contacts/", "/apps/onlyoffice/new?id=onlyoffice_docx", "/apps/onlyoffice/new?id=onlyoffice_xlsx", "/apps/onlyoffice/new?id=onlyoffice_pptx", "/apps/notes/", "/apps/tasks/", "https://spot.murena.io", "https://murena.com"); public function __construct( $appName, IConfig $config, @@ -48,7 +49,8 @@ class AppsService { $this->rootFolder = $rootFolder; } - public function getOnlyOfficeEntries() { + public function getOnlyOfficeEntries() + { $l = $this->l10nFac->get("onlyoffice"); $l10nDashboard = $this->l10nFac->get("murena-dashboard"); $untitled = $l10nDashboard->t("untitled"); @@ -60,7 +62,7 @@ class AppsService { "name" => $l->t("Document"), "type" => "link", "active" => false, - "href" => "/apps/onlyoffice/new?id=onlyoffice_docx&name=" . $untitled.".docx&dir=" . $baseDirectory + "href" => "/apps/onlyoffice/new?id=onlyoffice_docx&name=" . $untitled . ".docx&dir=" . $baseDirectory ), array( "id" => "onlyoffice_xlsx", @@ -68,7 +70,7 @@ class AppsService { "name" => $l->t("Spreadsheet"), "type" => "link", "active" => false, - "href" => "/apps/onlyoffice/new?id=onlyoffice_xlsx&name=" . $untitled.".xlsx&dir=" . $baseDirectory + "href" => "/apps/onlyoffice/new?id=onlyoffice_xlsx&name=" . $untitled . ".xlsx&dir=" . $baseDirectory ), array( "id" => "onlyoffice_pptx", @@ -76,13 +78,14 @@ class AppsService { "name" => $l->t("Presentation"), "type" => "link", "active" => false, - "href" => "/apps/onlyoffice/new?id=onlyoffice_pptx&name=" . $untitled.".pptx&dir=" . $baseDirectory + "href" => "/apps/onlyoffice/new?id=onlyoffice_pptx&name=" . $untitled . ".pptx&dir=" . $baseDirectory ), ); return $onlyOfficeEntries; } - public function getAppOrder() { + public function getAppOrder() + { $order_raw = $this->config->getUserValue($this->userId, 'murena_launcher', 'order'); // If order raw empty try to get from 'apporder' app config $order_raw = !$order_raw ? $this->config->getUserValue($this->userId, 'apporder', 'order') : $order_raw; @@ -93,7 +96,8 @@ class AppsService { return json_decode($order_raw); } - public function getAppEntries() { + public function getAppEntries() + { $entries = array_values($this->navigationManager->getAll()); $order = $this->getAppOrder(); $entriesByHref = array(); @@ -136,7 +140,14 @@ class AppsService { $order = array_reverse($order); foreach ($order as $href) { if (!empty($entriesByHref[$href])) { - $entriesByHref = array($href => $entriesByHref[$href]) + $entriesByHref; + + list($file, $parameters) = explode('?', $entriesByHref[$href]); + parse_str($parameters, $output); + unset($output['name']); + unset($output['dir']); + + $result = $file . '?' . http_build_query($output); + $entriesByHref = array($href => $result) + $entriesByHref; } } } @@ -147,16 +158,19 @@ class AppsService { return array_values($entriesByHref); } - public function updateOrder(string $order) { + public function updateOrder(string $order) + { $this->config->setUserValue($this->userId, $this->appName, 'order', $order); } - private function isBetaUser() { + private function isBetaUser() + { $uid = $this->userSession->getUser()->getUID(); $gid = $this->config->getSystemValue("beta_group_name"); return $this->groupManager->isInGroup($uid, $gid); } - public function getDocumentsFolder() { + public function getDocumentsFolder() + { $folderName = 'Documents'; $userId = $this->userSession->getUser()->getUID(); $userPath = $this->rootFolder->getUserFolder($userId)->getPath(); -- GitLab