From b9bc484325b179542dffdf1a76bf57dd8d64436f Mon Sep 17 00:00:00 2001 From: Ronak Date: Thu, 20 Jul 2023 08:00:04 -0700 Subject: [PATCH 1/8] Reorder issue --- lib/Service/AppsService.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 1ea1f2a..1b87bcd 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -137,6 +137,14 @@ class AppsService { 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; } } } -- GitLab From 860741aee9822c8bdfa14bd00352ffea1d17e0cb Mon Sep 17 00:00:00 2001 From: Akhil Date: Thu, 20 Jul 2023 20:43:05 +0530 Subject: [PATCH 2/8] Take href without params --- lib/Service/AppsService.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 1b87bcd..7ab9bfc 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -124,7 +124,11 @@ class AppsService { if ($isBeta && str_contains($appEnabledGroups, $betaGroupName)) { $entry["is_beta"] = 1; } - $entriesByHref[$entry["href"]] = $entry; + + // We take href without params as that is what is stored in the user defined order + // Also params can be dynamic, makes no sense to include them in the indexing attribute + $hrefWithoutParams = parse_url($entry["href"], PHP_URL_PATH); + $entriesByHref[$hrefWithoutParams] = $entry; } /* Sort apps according to order @@ -137,14 +141,6 @@ class AppsService { 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; } } } -- GitLab From 5dc7a5675148cc2106ce57c31a84d6be19a47487 Mon Sep 17 00:00:00 2001 From: Ronak Date: Thu, 20 Jul 2023 08:40:13 -0700 Subject: [PATCH 3/8] id added --- lib/Service/AppsService.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 7ab9bfc..21567a3 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -124,11 +124,16 @@ class AppsService { if ($isBeta && str_contains($appEnabledGroups, $betaGroupName)) { $entry["is_beta"] = 1; } - + // We take href without params as that is what is stored in the user defined order // Also params can be dynamic, makes no sense to include them in the indexing attribute $hrefWithoutParams = parse_url($entry["href"], PHP_URL_PATH); - $entriesByHref[$hrefWithoutParams] = $entry; + $hrefQuery = parse_url($entry["href"], PHP_URL_QUERY); + parse_str($hrefQuery, $params); + $id = (isset($params['id'])) ? '?id=' . $params['id'] : ''; + $hrefWithId = $hrefWithoutParams . $id; + + $entriesByHref[$hrefWithId] = $entry; } /* Sort apps according to order -- GitLab From 7bb611faa4bd29b91ce0b1ea3eef2fb255777b3b Mon Sep 17 00:00:00 2001 From: Ronak Date: Fri, 21 Jul 2023 01:57:17 -0700 Subject: [PATCH 4/8] intialstate added --- lib/Controller/PageController.php | 3 +++ lib/Service/AppsService.php | 9 +++------ src/components/AllApps.vue | 21 +++++++++++++++++++-- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 7248821..4574374 100755 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -43,6 +43,9 @@ class PageController extends Controller { $this->initialState->provideInitialState('increaseStorageUrl', $storageUrl); $this->initialState->provideInitialState('entries', $entries); $this->initialState->provideInitialState('displayName', $displayName); + + $baseDirectory = $this->appsService->getDocumentsFolder(); + $this->initialState->provideInitialState('baseDirectory', $baseDirectory); return new TemplateResponse($this->appName, 'dashboard'); } } diff --git a/lib/Service/AppsService.php b/lib/Service/AppsService.php index 21567a3..9c6c155 100644 --- a/lib/Service/AppsService.php +++ b/lib/Service/AppsService.php @@ -50,9 +50,6 @@ class AppsService { public function getOnlyOfficeEntries() { $l = $this->l10nFac->get("onlyoffice"); - $l10nDashboard = $this->l10nFac->get("murena-dashboard"); - $untitled = $l10nDashboard->t("untitled"); - $baseDirectory = $this->getDocumentsFolder(); $onlyOfficeEntries = array( array( "id" => "onlyoffice_docx", @@ -60,7 +57,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" ), array( "id" => "onlyoffice_xlsx", @@ -68,7 +65,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" ), array( "id" => "onlyoffice_pptx", @@ -76,7 +73,7 @@ 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" ), ); return $onlyOfficeEntries; diff --git a/src/components/AllApps.vue b/src/components/AllApps.vue index 43ae78b..2679938 100755 --- a/src/components/AllApps.vue +++ b/src/components/AllApps.vue @@ -36,7 +36,7 @@