diff --git a/lib/Controller/Applications.php b/lib/Controller/Applications.php index 48364a77ef..81ba2b2ef4 100644 --- a/lib/Controller/Applications.php +++ b/lib/Controller/Applications.php @@ -394,7 +394,6 @@ public function editForm(Request $request, Response $response, $id) $this->getState()->setData([ 'client' => $client, 'scopes' => $scopes, - 'users' => $this->userFactory->query(), ]); return $this->render($request, $response); diff --git a/lib/Controller/DataSet.php b/lib/Controller/DataSet.php index 735ee520ab..c97bb2c91e 100644 --- a/lib/Controller/DataSet.php +++ b/lib/Controller/DataSet.php @@ -88,9 +88,6 @@ public function getDataSetFactory() public function displayPage(Request $request, Response $response) { $this->getState()->template = 'dataset-page'; - $this->getState()->setData([ - 'users' => $this->userFactory->query(), - ]); return $this->render($request, $response); } diff --git a/lib/Controller/Display.php b/lib/Controller/Display.php index 5911c5c8cf..f8dbcec68b 100644 --- a/lib/Controller/Display.php +++ b/lib/Controller/Display.php @@ -256,7 +256,6 @@ function displayPage(Request $request, Response $response) $this->getState()->setData([ 'mapConfig' => $mapConfig, - 'displayGroups' => $this->displayGroupFactory->query(), 'displayProfiles' => $displayProfiles ]); diff --git a/lib/Controller/Layout.php b/lib/Controller/Layout.php index af2a789962..b55e07c54d 100644 --- a/lib/Controller/Layout.php +++ b/lib/Controller/Layout.php @@ -202,11 +202,6 @@ function displayPage(Request $request, Response $response) { // Call to render the template $this->getState()->template = 'layout-page'; - $this->getState()->setData([ - 'users' => $this->userFactory->query(), - 'groups' => $this->userGroupFactory->query(), - 'displayGroups' => $this->displayGroupFactory->query(null, ['isDisplaySpecific' => -1]) - ]); return $this->render($request, $response); } diff --git a/lib/Controller/Library.php b/lib/Controller/Library.php index c5a4fa994c..c772cbd474 100644 --- a/lib/Controller/Library.php +++ b/lib/Controller/Library.php @@ -296,9 +296,7 @@ public function displayPage(Request $request, Response $response) // Users we have permission to see $this->getState()->template = 'library-page'; $this->getState()->setData([ - 'users' => $this->userFactory->query(), 'modules' => $this->moduleFactory->getLibraryModules(), - 'groups' => $this->userGroupFactory->query(), 'validExt' => implode('|', $this->moduleFactory->getValidExtensions([])) ]); } diff --git a/lib/Controller/Logging.php b/lib/Controller/Logging.php index 94232f459e..488e132b11 100644 --- a/lib/Controller/Logging.php +++ b/lib/Controller/Logging.php @@ -70,9 +70,6 @@ public function __construct($store, $logFactory, $userFactory) public function displayPage(Request $request, Response $response) { $this->getState()->template = 'log-page'; - $this->getState()->setData([ - 'users' => $this->userFactory->query() - ]); return $this->render($request, $response); } diff --git a/lib/Controller/MenuBoard.php b/lib/Controller/MenuBoard.php index 18a06c0707..fbc491a53b 100644 --- a/lib/Controller/MenuBoard.php +++ b/lib/Controller/MenuBoard.php @@ -77,9 +77,7 @@ public function displayPage(Request $request, Response $response) { // Call to render the template $this->getState()->template = 'menuboard-page'; - $this->getState()->setData([ - 'users' => $this->userFactory->query() - ]); + return $this->render($request, $response); } diff --git a/lib/Controller/Playlist.php b/lib/Controller/Playlist.php index ee10b7471d..9b4b1b3c27 100644 --- a/lib/Controller/Playlist.php +++ b/lib/Controller/Playlist.php @@ -141,8 +141,6 @@ public function displayPage(Request $request, Response $response) // Call to render the template $this->getState()->template = 'playlist-page'; $this->getState()->setData([ - 'users' => $this->userFactory->query(), - 'groups' => $this->userGroupFactory->query(), 'modules' => $moduleFactory->getAssignableModules() ]); diff --git a/lib/Controller/SavedReport.php b/lib/Controller/SavedReport.php index 35b1dc4955..68f36330b0 100644 --- a/lib/Controller/SavedReport.php +++ b/lib/Controller/SavedReport.php @@ -2,7 +2,7 @@ /* * Copyright (C) 2023 Xibo Signage Ltd * - * Xibo - Digital Signage - http://www.xibo.org.uk + * Xibo - Digital Signage - https://xibosignage.com * * This file is part of Xibo. * @@ -24,7 +24,6 @@ use Slim\Http\Response as Response; use Slim\Http\ServerRequest as Request; -use Xibo\Entity\Media; use Xibo\Entity\ReportResult; use Xibo\Factory\MediaFactory; use Xibo\Factory\ReportScheduleFactory; @@ -218,7 +217,6 @@ public function displaySavedReportPage(Request $request, Response $response) // Call to render the template $this->getState()->template = 'saved-report-page'; $this->getState()->setData([ - 'users' => $this->userFactory->query(), 'availableReports' => $availableReports ]); diff --git a/lib/Controller/ScheduleReport.php b/lib/Controller/ScheduleReport.php index 2f04fd95d6..a285b12550 100644 --- a/lib/Controller/ScheduleReport.php +++ b/lib/Controller/ScheduleReport.php @@ -26,7 +26,6 @@ use Slim\Http\Response as Response; use Slim\Http\ServerRequest as Request; use Slim\Views\Twig; -use Xibo\Entity\Media; use Xibo\Entity\ReportSchedule; use Xibo\Factory\MediaFactory; use Xibo\Factory\ReportScheduleFactory; @@ -37,8 +36,6 @@ use Xibo\Service\ConfigServiceInterface; use Xibo\Service\LogServiceInterface; use Xibo\Service\ReportServiceInterface; -use Xibo\Storage\StorageServiceInterface; -use Xibo\Storage\TimeSeriesStoreInterface; use Xibo\Support\Exception\AccessDeniedException; use Xibo\Support\Exception\GeneralException; use Xibo\Support\Exception\InvalidArgumentException; @@ -582,7 +579,6 @@ public function displayReportSchedulePage(Request $request, Response $response) // Call to render the template $this->getState()->template = 'report-schedule-page'; $this->getState()->setData([ - 'users' => $this->userFactory->query(), 'availableReports' => $availableReports ]); diff --git a/lib/Controller/User.php b/lib/Controller/User.php index 434522b86e..86af788f4e 100644 --- a/lib/Controller/User.php +++ b/lib/Controller/User.php @@ -1759,7 +1759,6 @@ public function permissionsForm(Request $request, Response $response, $entity, $ 'objectId' => $id, 'permissions' => $currentPermissions, 'canSetOwner' => $object->canChangeOwner(), - 'owners' => $this->userFactory->query(), 'object' => $object, 'objectNameOverride' => $this->getSanitizer($request->getParams())->getString('nameOverride'), ]; diff --git a/ui/src/core/xibo-cms.js b/ui/src/core/xibo-cms.js index 74d98c54e6..c48584e7ee 100644 --- a/ui/src/core/xibo-cms.js +++ b/ui/src/core/xibo-cms.js @@ -132,6 +132,12 @@ function XiboInitialise(scope, options) { } else if (field.length > 0) { field.val(element.value); } + + // if we have pagedSelect as inline filter for the grid + // set the initial value here, to ensure the correct option gets selected. + if (field.parent().hasClass('pagedSelect')) { + field.data('initial-value', element.value) + } } catch (e) { console.log("Error populating form saved value with selector input[name=" + element.name + "], select[name=" + element.name + "]"); } @@ -3309,10 +3315,15 @@ function makePagedSelect(element, parent) { ) { var initialValue = element.data("initialValue"); var initialKey = element.data("initialKey"); - var dataObj = {}; dataObj[initialKey] = initialValue; + // if we have any filter options, add them here as well + // for example isDisplaySpecific filter is important for displayGroup.search + if (element.data("filterOptions") !== undefined) { + dataObj = $.extend({}, dataObj, element.data("filterOptions")); + } + $.ajax({ url: element.data("searchUrl"), type: 'GET', diff --git a/views/applications-form-edit.twig b/views/applications-form-edit.twig index 0bfbf0a4ba..096bc127cc 100644 --- a/views/applications-form-edit.twig +++ b/views/applications-form-edit.twig @@ -132,9 +132,20 @@ {% endfor %} {% set title %}{% trans "Owner" %}{% endset %} - {% set helpText %}{% trans "Set the owner of this Application. If you are not an admin you will not be able to reverse this action." %}{% endset %} - {% set users = [{userId: null, user: ""}]|merge(users) %} - {{ forms.dropdown("userId", "single", title, "", users, "userId", "userName", helpText) }} + {% set helpText %}{% trans "Set the owner of this Application. Leave empty to keep the current owner. If you are not an admin you will not be able to reverse this action" %}{% endset %} + {% set attributes = [ + { name: "data-width", value: "100%" }, + { name: "data-allow-clear", value: "true" }, + { name: "data-placeholder--id", value: null }, + { name: "data-placeholder--value", value: "" }, + { name: "data-search-url", value: url_for("user.search") }, + { name: "data-search-term", value: "userName" }, + { name: "data-search-term-tags", value: "tags" }, + { name: "data-id-property", value: "userId" }, + { name: "data-text-property", value: "userName" }, + { name: "data-anchor-element", value: "#applicationFormSubmit"} + ] %} + {{ forms.dropdown("userId", "single", title, "", null, "userId", "userName", helpText, "pagedSelect", "", "", "", attributes) }} diff --git a/views/dataset-page.twig b/views/dataset-page.twig index 3df53553f4..decf019367 100644 --- a/views/dataset-page.twig +++ b/views/dataset-page.twig @@ -51,7 +51,19 @@ {% set title %}{% trans "Owner" %}{% endset %} {% set helpText %}{% trans "Show items owned by the selected User." %}{% endset %} - {{ inline.dropdown("userId", "single", title, "", [{userId:null, userName:""}]|merge(users), "userId", "userName", helpText, "selectPicker", "", "", "", attributes) }} + {% set attributes = [ + { name: "data-width", value: "200px" }, + { name: "data-allow-clear", value: "true" }, + { name: "data-placeholder--id", value: null }, + { name: "data-placeholder--value", value: "" }, + { name: "data-search-url", value: url_for("user.search") }, + { name: "data-search-term", value: "userName" }, + { name: "data-search-term-tags", value: "tags" }, + { name: "data-id-property", value: "userId" }, + { name: "data-text-property", value: "userName" }, + { name: "data-initial-key", value: "userId" }, + ] %} + {{ inline.dropdown("userId", "single", title, "", null, "userId", "userName", helpText, "pagedSelect", "", "", "", attributes) }} {{ inline.hidden("folderId") }} diff --git a/views/display-page.twig b/views/display-page.twig index 377e0d2bf1..00108a0f87 100644 --- a/views/display-page.twig +++ b/views/display-page.twig @@ -106,7 +106,19 @@ {% if currentUser.featureEnabled("displaygroup.view") %} {% set title %}{% trans "Display Group" %}{% endset %} - {{ inline.dropdown("displayGroupId", "single", title, "", [{displayGroupId:null, displayGroup:""}]|merge(displayGroups), "displayGroupId", "displayGroup") }} + {% set attributes = [ + { name: "data-width", value: "200px" }, + { name: "data-allow-clear", value: "true" }, + { name: "data-placeholder--id", value: null }, + { name: "data-placeholder--value", value: "" }, + { name: "data-search-url", value: url_for("displayGroup.search") }, + { name: "data-filter-options", value: '{"isDisplaySpecific":0}' }, + { name: "data-search-term", value: "displayGroup" }, + { name: "data-id-property", value: "displayGroupId" }, + { name: "data-text-property", value: "displayGroup" }, + { name: "data-initial-key", value: "displayGroupId" }, + ] %} + {{ inline.dropdown("displayGroupId", "single", title, "", null, "displayGroupId", "displayGroup", helpText, "pagedSelect", "", "", "", attributes) }} {% endif %} {% if currentUser.featureEnabled("displayprofile.view") %} diff --git a/views/layout-page.twig b/views/layout-page.twig index 38f1aea02d..ec4786e65d 100644 --- a/views/layout-page.twig +++ b/views/layout-page.twig @@ -47,25 +47,54 @@ {% set title %}{% trans "Code" %}{% endset %} {{ inline.input('codeLike', title) }} - {% set attributes = [ - { name: "data-allow-clear", value: "true" }, - { name: "data-placeholder--id", value: null }, - { name: "data-placeholder--value", value: "" } - ] %} - {% if currentUser.featureEnabled("displaygroup.view") %} {% set title %}{% trans "Display Group" %}{% endset %} {% set helpText %}{% trans "Show Layouts active on the selected Display / Display Group" %}{% endset %} - {{ inline.dropdown("activeDisplayGroupId", "single", title, "", [{displayGroupId:null, displayGroup:""}]|merge(displayGroups), "displayGroupId", "displayGroup", helpText, "selectPicker", "", "", "", attributes) }} + {% set attributes = [ + { name: "data-width", value: "200px" }, + { name: "data-allow-clear", value: "true" }, + { name: "data-placeholder--id", value: null }, + { name: "data-placeholder--value", value: "" }, + { name: "data-search-url", value: url_for("displayGroup.search") }, + { name: "data-filter-options", value: '{"isDisplaySpecific":-1}' }, + { name: "data-search-term", value: "displayGroup" }, + { name: "data-id-property", value: "displayGroupId" }, + { name: "data-text-property", value: "displayGroup" }, + { name: "data-initial-key", value: "displayGroupId" }, + ] %} + {{ inline.dropdown("activeDisplayGroupId", "single", title, "", null, "displayGroupId", "displayGroup", helpText, "pagedSelect", "", "", "", attributes) }} {% endif %} {% set title %}{% trans "Owner" %}{% endset %} {% set helpText %}{% trans "Show items owned by the selected User." %}{% endset %} - {{ inline.dropdown("userId", "single", title, "", [{userId:null, userName:""}]|merge(users), "userId", "userName", helpText, "selectPicker", "", "", "", attributes) }} + {% set attributes = [ + { name: "data-width", value: "200px" }, + { name: "data-allow-clear", value: "true" }, + { name: "data-placeholder--id", value: null }, + { name: "data-placeholder--value", value: "" }, + { name: "data-search-url", value: url_for("user.search") }, + { name: "data-search-term", value: "userName" }, + { name: "data-search-term-tags", value: "tags" }, + { name: "data-id-property", value: "userId" }, + { name: "data-text-property", value: "userName" }, + { name: "data-initial-key", value: "userId" }, + ] %} + {{ inline.dropdown("userId", "single", title, "", null, "userId", "userName", helpText, "pagedSelect", "", "", "", attributes) }} {% set title %}{% trans "Owner User Group" %}{% endset %} {% set helpText %}{% trans "Show items owned by users in the selected User Group." %}{% endset %} - {{ inline.dropdown("ownerUserGroupId", "single", title, "", [{groupId:null, group:""}]|merge(groups), "groupId", "group", helpText, "selectPicker", "", "", "", attributes) }} + {% set attributes = [ + { name: "data-width", value: "200px" }, + { name: "data-allow-clear", value: "true" }, + { name: "data-placeholder--id", value: null }, + { name: "data-placeholder--value", value: "" }, + { name: "data-search-url", value: url_for("group.search") }, + { name: "data-search-term", value: "group" }, + { name: "data-id-property", value: "groupId" }, + { name: "data-text-property", value: "group" }, + { name: "data-initial-key", value: "userGroupId" }, + ] %} + {{ inline.dropdown("ownerUserGroupId", "single", title, "", null, "groupId", "group", helpText, "pagedSelect", "", "", "", attributes) }} {% set title %}{% trans "Orientation" %}{% endset %} {% set option1 = "All"|trans %} diff --git a/views/library-page.twig b/views/library-page.twig index 653ab01241..e67bffa1ff 100644 --- a/views/library-page.twig +++ b/views/library-page.twig @@ -69,12 +69,35 @@ ] %} {% set title %}{% trans "Owner" %}{% endset %} - {% set users = [{userId: null, userName: ""}]|merge(users) %} - {{ inline.dropdown("ownerId", "single", title, null, users, "userId", "userName", "", "selectPicker", "", "", "", attributes) }} + {% set helpText %}{% trans "Show items owned by the selected User." %}{% endset %} + {% set attributes = [ + { name: "data-width", value: "200px" }, + { name: "data-allow-clear", value: "true" }, + { name: "data-placeholder--id", value: null }, + { name: "data-placeholder--value", value: "" }, + { name: "data-search-url", value: url_for("user.search") }, + { name: "data-search-term", value: "userName" }, + { name: "data-search-term-tags", value: "tags" }, + { name: "data-id-property", value: "userId" }, + { name: "data-text-property", value: "userName" }, + { name: "data-initial-key", value: "userId" }, + ] %} + {{ inline.dropdown("ownerId", "single", title, "", null, "userId", "userName", helpText, "pagedSelect", "", "", "", attributes) }} {% set title %}{% trans "Owner User Group" %}{% endset %} {% set helpText %}{% trans "Show items owned by users in the selected User Group." %}{% endset %} - {{ inline.dropdown("ownerUserGroupId", "single", title, "", [{groupId:null, group:""}]|merge(groups), "groupId", "group", helpText, "selectPicker", "", "", "", attributes) }} + {% set attributes = [ + { name: "data-width", value: "200px" }, + { name: "data-allow-clear", value: "true" }, + { name: "data-placeholder--id", value: null }, + { name: "data-placeholder--value", value: "" }, + { name: "data-search-url", value: url_for("group.search") }, + { name: "data-search-term", value: "group" }, + { name: "data-id-property", value: "groupId" }, + { name: "data-text-property", value: "group" }, + { name: "data-initial-key", value: "userGroupId" }, + ] %} + {{ inline.dropdown("ownerUserGroupId", "single", title, "", null, "groupId", "group", helpText, "pagedSelect", "", "", "", attributes) }} {% set title %}{% trans "Type" %}{% endset %} {{ inline.dropdown("type", "single", title, "", [{"type": none, "name": ""}]|merge(modules), "type", "name") }} diff --git a/views/log-page.twig b/views/log-page.twig index 4020c18bf4..f14687885b 100644 --- a/views/log-page.twig +++ b/views/log-page.twig @@ -68,7 +68,19 @@ {{ inline.input("runNo", title) }} {% set title %}{% trans "User" %}{% endset %} - {{ inline.dropdown("userId", "single", title, "", [{userId: null, userName: ""}]|merge(users), "userId", "userName") }} + {% set attributes = [ + { name: "data-width", value: "200px" }, + { name: "data-allow-clear", value: "true" }, + { name: "data-placeholder--id", value: null }, + { name: "data-placeholder--value", value: "" }, + { name: "data-search-url", value: url_for("user.search") }, + { name: "data-search-term", value: "userName" }, + { name: "data-search-term-tags", value: "tags" }, + { name: "data-id-property", value: "userId" }, + { name: "data-text-property", value: "userName" }, + { name: "data-initial-key", value: "userId" }, + ] %} + {{ inline.dropdown("userId", "single", title, "", null, "userId", "userName", helpText, "pagedSelect", "", "", "", attributes) }}