Skip to content

Commit

Permalink
Merge pull request #2724 from xibosignage/feature/kopff_merge_410
Browse files Browse the repository at this point in the history
Merge 4.1.0 into kopff
  • Loading branch information
dasgarner authored Aug 30, 2024
2 parents 95c75c9 + 2576ed5 commit fb0ccea
Show file tree
Hide file tree
Showing 140 changed files with 5,507 additions and 6,862 deletions.
2 changes: 1 addition & 1 deletion lib/Connector/XiboExchangeConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function onTemplateProvider(TemplateProviderEvent $event)
$this->getLogger()->debug('XiboExchangeConnector: onTemplateProvider');

// Get a cache of the layouts.json file, or request one from download.
$uri = 'https://download.xibosignage.com/layouts_v4.json';
$uri = 'https://download.xibosignage.com/layouts_v4_1.json';
$key = md5($uri);
$cache = $this->getPool()->getItem($key);
$body = $cache->get();
Expand Down
3 changes: 3 additions & 0 deletions lib/Controller/DataSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,9 @@ public function editForm(Request $request, Response $response, $id)
// Retrieve data sources from the event
$dataConnectorSources = $event->getDataConnectorSources();

// retrieve the columns of the selected dataset
$dataSet->getColumn();

// Set the form
$this->getState()->template = 'dataset-form-edit';
$this->getState()->setData([
Expand Down
11 changes: 4 additions & 7 deletions lib/Controller/Developer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
use Xibo\Factory\ModuleFactory;
use Xibo\Factory\ModuleTemplateFactory;
use Xibo\Helper\SendFile;
use Xibo\Helper\UploadHandler;
use Xibo\Service\MediaService;
use Xibo\Service\UploadService;
use Xibo\Support\Exception\AccessDeniedException;
Expand Down Expand Up @@ -335,6 +334,7 @@ public function templateEdit(Request $request, Response $response, $id): Respons
);
}]);

$template->dataType = $dataType;
$template->isEnabled = $params->getCheckbox('enabled');

// TODO: validate?
Expand Down Expand Up @@ -530,28 +530,25 @@ public function templateImport(Request $request, Response $response): Response|R

$options = [
'upload_dir' => $libraryFolder . 'temp/',
'script_url' => $this->urlFor($request, 'developer.templates.import'),
'upload_url' => $this->urlFor($request, 'developer.templates.import'),
'accept_file_types' => '/\.xml/i',
'libraryQuotaFull' => false,
];

$this->getLog()->debug('Hand off to Upload Handler with options: ' . json_encode($options));

// Hand off to the Upload Handler provided by jquery-file-upload
$uploadService = new UploadService($options, $this->getLog(), $this->getState());
$uploadService = new UploadService($libraryFolder . 'temp/', $options, $this->getLog(), $this->getState());
$uploadHandler = $uploadService->createUploadHandler();

$uploadHandler->setPostProcessor(function ($file, $uploadHandler) {
$uploadHandler->setPostProcessor(function ($file, $uploadHandler) use ($libraryFolder) {
// Return right away if the file already has an error.
if (!empty($file->error)) {
return $file;
}

$this->getUser()->isQuotaFullByUser(true);

/** @var UploadHandler $uploadHandler */
$filePath = $uploadHandler->getUploadPath() . $file->fileName;
$filePath = $libraryFolder . 'temp/' . $file->fileName;

// load the xml from uploaded file
$xml = new \DOMDocument();
Expand Down
130 changes: 69 additions & 61 deletions lib/Controller/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -1005,33 +1005,36 @@ public function grid(Request $request, Response $response)
);
}

if ($this->getUser()->featureEnabled('displays.modify')
&& $this->getUser()->checkEditable($display)
// Check if limited view access is allowed
if (($this->getUser()->featureEnabled('displays.modify') && $this->getUser()->checkEditable($display))
|| $this->getUser()->featureEnabled('displays.limitedView')
) {
if ($this->getUser()->featureEnabled('layout.view')) {
$display->buttons[] = [
'id' => 'display_button_layouts_jump',
'linkType' => '_self',
'external' => true,
'url' => $this->urlFor($request, 'layout.view')
. '?activeDisplayGroupId=' . $display->displayGroupId,
'text' => __('Jump to Scheduled Layouts')
];
}
if ($this->getUser()->checkEditable($display)) {
if ($this->getUser()->featureEnabled('layout.view')) {
$display->buttons[] = [
'id' => 'display_button_layouts_jump',
'linkType' => '_self',
'external' => true,
'url' => $this->urlFor($request, 'layout.view')
. '?activeDisplayGroupId=' . $display->displayGroupId,
'text' => __('Jump to Scheduled Layouts')
];
}

// File Associations
$display->buttons[] = array(
'id' => 'displaygroup_button_fileassociations',
'url' => $this->urlFor($request, 'displayGroup.media.form', ['id' => $display->displayGroupId]),
'text' => __('Assign Files')
);
// File Associations
$display->buttons[] = array(
'id' => 'displaygroup_button_fileassociations',
'url' => $this->urlFor($request, 'displayGroup.media.form', ['id' => $display->displayGroupId]),
'text' => __('Assign Files')
);

// Layout Assignments
$display->buttons[] = array(
'id' => 'displaygroup_button_layout_associations',
'url' => $this->urlFor($request, 'displayGroup.layout.form', ['id' => $display->displayGroupId]),
'text' => __('Assign Layouts')
);
// Layout Assignments
$display->buttons[] = array(
'id' => 'displaygroup_button_layout_associations',
'url' => $this->urlFor($request, 'displayGroup.layout.form', ['id' => $display->displayGroupId]),
'text' => __('Assign Layouts')
);
}

// Screen Shot
$display->buttons[] = [
Expand Down Expand Up @@ -1085,43 +1088,45 @@ public function grid(Request $request, Response $response)
]
];

// Trigger webhook
$display->buttons[] = [
'id' => 'display_button_trigger_webhook',
'url' => $this->urlFor(
$request,
'displayGroup.trigger.webhook.form',
['id' => $display->displayGroupId]
),
'text' => __('Trigger a web hook'),
'multi-select' => true,
'dataAttributes' => [
[
'name' => 'commit-url',
'value' => $this->urlFor(
$request,
'displayGroup.action.trigger.webhook',
['id' => $display->displayGroupId]
)
],
['name' => 'commit-method', 'value' => 'post'],
['name' => 'id', 'value' => 'display_button_trigger_webhook'],
['name' => 'sort-group', 'value' => 3],
['name' => 'text', 'value' => __('Trigger a web hook')],
['name' => 'rowtitle', 'value' => $display->display],
['name' => 'form-callback', 'value' => 'triggerWebhookMultiSelectFormOpen']
]
];

if ($this->getUser()->isSuperAdmin()) {
if ($this->getUser()->checkEditable($display)) {
// Trigger webhook
$display->buttons[] = [
'id' => 'display_button_purgeAll',
'url' => $this->urlFor($request, 'display.purge.all.form', ['id' => $display->displayId]),
'text' => __('Purge All')
'id' => 'display_button_trigger_webhook',
'url' => $this->urlFor(
$request,
'displayGroup.trigger.webhook.form',
['id' => $display->displayGroupId]
),
'text' => __('Trigger a web hook'),
'multi-select' => true,
'dataAttributes' => [
[
'name' => 'commit-url',
'value' => $this->urlFor(
$request,
'displayGroup.action.trigger.webhook',
['id' => $display->displayGroupId]
)
],
['name' => 'commit-method', 'value' => 'post'],
['name' => 'id', 'value' => 'display_button_trigger_webhook'],
['name' => 'sort-group', 'value' => 3],
['name' => 'text', 'value' => __('Trigger a web hook')],
['name' => 'rowtitle', 'value' => $display->display],
['name' => 'form-callback', 'value' => 'triggerWebhookMultiSelectFormOpen']
]
];
}

$display->buttons[] = ['divider' => true];
if ($this->getUser()->isSuperAdmin()) {
$display->buttons[] = [
'id' => 'display_button_purgeAll',
'url' => $this->urlFor($request, 'display.purge.all.form', ['id' => $display->displayId]),
'text' => __('Purge All')
];
}

$display->buttons[] = ['divider' => true];
}
}

if ($this->getUser()->featureEnabled('displays.modify')
Expand Down Expand Up @@ -2187,7 +2192,8 @@ public function screenShot(Request $request, Response $response, $id)
{
$display = $this->displayFactory->getById($id);

if (!$this->getUser()->checkViewable($display)) {
// Allow limited view access
if (!$this->getUser()->checkViewable($display) && !$this->getUser()->featureEnabled('displays.limitedView')) {
throw new AccessDeniedException();
}

Expand Down Expand Up @@ -2247,7 +2253,8 @@ public function requestScreenShotForm(Request $request, Response $response, $id)
{
$display = $this->displayFactory->getById($id);

if (!$this->getUser()->checkViewable($display)) {
// Allow limited view access
if (!$this->getUser()->checkViewable($display) && !$this->getUser()->featureEnabled('displays.limitedView')) {
throw new AccessDeniedException();
}

Expand Down Expand Up @@ -2305,7 +2312,8 @@ public function requestScreenShot(Request $request, Response $response, $id)
{
$display = $this->displayFactory->getById($id);

if (!$this->getUser()->checkViewable($display)) {
// Allow limited view access
if (!$this->getUser()->checkViewable($display) && !$this->getUser()->featureEnabled('displays.limitedView')) {
throw new AccessDeniedException();
}

Expand Down
Loading

0 comments on commit fb0ccea

Please sign in to comment.