Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc fixes 10 #2011

Merged
merged 10 commits into from
Aug 25, 2023
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ RUN mkdir /var/www/cms/openooh \
&& curl -o /var/www/cms/openooh/specification.json https://raw.githubusercontent.com/openooh/venue-taxonomy/main/specification.json

# Help Links
RUN curl -o help_links.yaml https://raw.githubusercontent.com/xibosignage/xibo-manual/develop/help_links.yaml || true
RUN curl -o help-links.yaml https://raw.githubusercontent.com/xibosignage/xibo-manual/develop/help-links.yaml || true

# Git commit fallback
RUN echo $GIT_COMMIT > /var/www/cms/commit.sha
Expand Down
4 changes: 3 additions & 1 deletion lib/Controller/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,13 @@ public function grid(Request $request, Response $response)
// Instantiate and decorate the entity
try {
$connector->decorate($this->connectorFactory->create($connector));
} catch (NotFoundException $ignored) {
} catch (NotFoundException) {
$this->getLog()->info('Connector installed which is not found in this CMS. ' . $connector->className);
$connector->setUnmatchedProperty('isHidden', 1);
} catch (\Exception $e) {
$this->getLog()->error('Incorrectly configured connector '
. $connector->className . '. e=' . $e->getMessage());
$connector->setUnmatchedProperty('isHidden', 1);
}
}

Expand Down
1 change: 1 addition & 0 deletions lib/Controller/PlaylistDashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ public function show(Request $request, Response $response, $id)
$module = $this->moduleFactory->getByType($widget->type);
$widget->setUnmatchedProperty('name', $widget->getOptionValue('name', $module->name));
$widget->setUnmatchedProperty('regionSpecific', $module->regionSpecific);
$widget->setUnmatchedProperty('moduleIcon', $module->icon);

// Check my permissions
if ($module->regionSpecific == 0) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/Region.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function add(Request $request, Response $response, $id)
$region = $this->regionFactory->create(
$sanitizedParams->getString('type', ['default' => 'frame']),
$this->getUser()->userId,
$layout->layout . '-' . (count($layout->regions) + 1),
'',
$sanitizedParams->getInt('width', ['default' => 250]),
$sanitizedParams->getInt('height', ['default' => 250]),
$sanitizedParams->getInt('top', ['default' => 50]),
Expand Down
6 changes: 6 additions & 0 deletions lib/Entity/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ class Module implements \JsonSerializable
*/
public $description;

/**
* @SWG\Property(description="An icon to use in the toolbar")
* @var string
*/
public $icon;

/**
* @SWG\Property(description="The type code for this module")
* @var string
Expand Down
6 changes: 6 additions & 0 deletions lib/Entity/ModuleTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ class ModuleTemplate implements \JsonSerializable
/** @var string The title */
public $title;

/**
* Icon
* @var string
*/
public $icon;

/**
* Thumbnail
* this is the location to a module template's thumbnail, which should be added to the installation
Expand Down
1 change: 1 addition & 0 deletions lib/Factory/ModuleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ private function createFromXml(string $file, array $modulesWithSettings): Module
$module->name = __($this->getFirstValueOrDefaultFromXmlNode($xml, 'name'));
$module->author = $this->getFirstValueOrDefaultFromXmlNode($xml, 'author');
$module->description = __($this->getFirstValueOrDefaultFromXmlNode($xml, 'description'));
$module->icon = $this->getFirstValueOrDefaultFromXmlNode($xml, 'icon');
$module->class = $this->getFirstValueOrDefaultFromXmlNode($xml, 'class');
$module->type = $this->getFirstValueOrDefaultFromXmlNode($xml, 'type');
$module->thumbnail = $this->getFirstValueOrDefaultFromXmlNode($xml, 'thumbnail');
Expand Down
1 change: 1 addition & 0 deletions lib/Factory/ModuleTemplateFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ private function createFromXml(\DOMElement $xml): ModuleTemplate
$template->dataType = $this->getFirstValueOrDefaultFromXmlNode($xml, 'dataType');
$template->title = __($this->getFirstValueOrDefaultFromXmlNode($xml, 'title'));
$template->thumbnail = $this->getFirstValueOrDefaultFromXmlNode($xml, 'thumbnail');
$template->icon = $this->getFirstValueOrDefaultFromXmlNode($xml, 'icon');
$template->isVisible = $this->getFirstValueOrDefaultFromXmlNode($xml, 'isVisible') !== 'false';
$template->startWidth = intval($this->getFirstValueOrDefaultFromXmlNode($xml, 'startWidth'));
$template->startHeight = intval($this->getFirstValueOrDefaultFromXmlNode($xml, 'startHeight'));
Expand Down
8 changes: 6 additions & 2 deletions lib/Service/HelpService.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ private function loadLinks(): void
if (file_exists(PROJECT_ROOT . '/custom/help-links.yaml')) {
$links = (array)Yaml::parseFile(PROJECT_ROOT . '/custom/help-links.yaml');
} else if (file_exists(PROJECT_ROOT . '/help-links.yaml')) {
// TODO: pull these in from the manual on build.
$links = (array)Yaml::parseFile(PROJECT_ROOT . '/help-links.yaml');
} else {
$this->links = [];
Expand All @@ -76,11 +75,16 @@ private function loadLinks(): void
}

// Parse links.
$this->links = [];

foreach ($links as $pageName => $page) {
// New page
$this->links[$pageName] = [];

foreach ($page as $link) {
$helpLink = new HelpLink($link);
if (!Str::startsWith($helpLink->url, ['http://', 'https://'])) {
$helpLink->url = $this->helpBase .= $helpLink->url;
$helpLink->url = $this->helpBase . $helpLink->url;
}
if (!empty($helpLink->summary)) {
$helpLink->summary = \Parsedown::instance()->line($helpLink->summary);
Expand Down
3 changes: 2 additions & 1 deletion lib/Widget/Render/WidgetHtmlRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ public function preview(
// Render an icon.
return $this->twig->fetch('module-icon-preview.twig', [
'moduleName' => $module->name,
'moduleType' => $module->type
'moduleType' => $module->type,
'moduleIcon' => $module->icon,
]);
}

Expand Down
27 changes: 20 additions & 7 deletions lib/XTR/WidgetSyncTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function run()
// Track the total time we've spent caching
$timeCaching = 0.0;
$countWidgets = 0;
$cutOff = Carbon::now()->subHours(2);

// Update for widgets which are active on displays, or for displays which have been active recently.
$sql = '
Expand All @@ -84,7 +85,7 @@ public function run()
';

$smt = $this->store->getConnection()->prepare($sql);
$smt->execute(['lastAccessed' => Carbon::now()->subHours(2)]);
$smt->execute(['lastAccessed' => $cutOff->unix()]);

$row = true;
while ($row) {
Expand Down Expand Up @@ -166,7 +167,7 @@ public function run()
}

// Remove display_media records which have not been touched for a defined period of time.
$this->removeOldDisplayLinks();
$this->removeOldDisplayLinks($cutOff);

$this->log->info('Total time spent caching is ' . $timeCaching . ', synced ' . $countWidgets . ' widgets');

Expand Down Expand Up @@ -337,15 +338,27 @@ private function linkDisplays(array $displays, array $mediaIds): void
}

/**
* Remove any display/media links which are older than $days days
* @param int $days
* Remove any display/media links which have expired.
* @param Carbon $cutOff
* @return void
*/
private function removeOldDisplayLinks(int $days = 5): void
private function removeOldDisplayLinks(Carbon $cutOff): void
{
$sql = 'DELETE FROM `display_media` WHERE `modifiedAt` < :modifiedAt';
$sql = '
DELETE
FROM `display_media`
WHERE `modifiedAt` < :modifiedAt
AND `display_media`.`displayId` IN (
SELECT `displayId`
FROM `display`
WHERE `display`.`loggedIn` = 1
OR `display`.`lastAccessed` > :lastAccessed
)
';

$this->store->update($sql, [
'modifiedAt' => Carbon::now()->subDays($days)->format(DateFormatHelper::getSystemFormat()),
'modifiedAt' => Carbon::now()->subDay()->format(DateFormatHelper::getSystemFormat()),
'lastAccessed' => $cutOff->unix(),
]);
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file modified modules/assets/template-thumbnails/social-media/fulltime-np.png
Binary file modified modules/assets/template-thumbnails/social-media/fulltime.png
Binary file modified modules/assets/template-thumbnails/social-media/profileleft.png
Binary file modified modules/assets/template-thumbnails/social-media/profileright.png
Binary file modified modules/assets/template-thumbnails/social-media/twitter1.png
Binary file modified modules/assets/template-thumbnails/social-media/twitter2.png
Binary file modified modules/assets/template-thumbnails/social-media/twitter4.png
Binary file modified modules/assets/template-thumbnails/social-media/twitter6np.png
Binary file modified modules/assets/template-thumbnails/social-media/twitter6pl.png
Binary file modified modules/assets/template-thumbnails/social-media/twitter7.png
Binary file modified modules/assets/template-thumbnails/social-media/twitter8.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed modules/assets/twitter_blue.png
Diff not rendered.
Binary file removed modules/assets/twitter_content_photo.jpg
Diff not rendered.
Binary file removed modules/assets/twitter_profile_photo.jpg
Diff not rendered.
Binary file removed modules/assets/twitter_profile_photo_bigger.jpg
Diff not rendered.
Binary file removed modules/assets/twitter_profile_photo_mini.jpg
Diff not rendered.
Binary file removed modules/assets/twitter_white.png
Diff not rendered.
5 changes: 3 additions & 2 deletions modules/audio.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
~ Copyright (C) 2022 Xibo Signage Ltd
~ 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.
~
Expand All @@ -23,6 +23,7 @@
<name>Audio</name>
<author>Core</author>
<description>Upload Audio files to assign to Layouts</description>
<icon>fa fa-file-audio</icon>
<class>\Xibo\Widget\AudioProvider</class>
<type>audio</type>
<dataType></dataType>
Expand Down
1 change: 1 addition & 0 deletions modules/calendar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<name>Calendar</name>
<author>Core</author>
<description>A module for displaying a calendar based on an iCal feed</description>
<icon>fa fa-calendar-alt</icon>
<class>Xibo\Widget\IcsProvider</class>
<type>ics-calendar</type>
<legacyType>calendaradvanced</legacyType>
Expand Down
3 changes: 2 additions & 1 deletion modules/clock-analogue.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
<name>Clock - Analogue</name>
<author>Core</author>
<description>Analogue Clock</description>
<icon>fa fa-clock-o</icon>
<class></class>
<compatibilityClass>\Xibo\Widget\Compatibility\ClockWidgetCompatibility</compatibilityClass>
<type>clock-analogue</type>
<group id="clock" icon="clock">Clock</group>
<group id="clock" icon="fa fa-clock">Clock</group>
<legacyType condition="clockTypeId==1">clock</legacyType>
<dataType></dataType>
<schemaVersion>2</schemaVersion>
Expand Down
3 changes: 2 additions & 1 deletion modules/clock-digital.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
<name>Clock - Digital</name>
<author>Core</author>
<description>Digital Clock</description>
<icon>fa fa-clock-o</icon>
<class></class>
<compatibilityClass>\Xibo\Widget\Compatibility\ClockWidgetCompatibility</compatibilityClass>
<type>clock-digital</type>
<group id="clock" icon="clock">Clock</group>
<group id="clock" icon="fa fa-clock">Clock</group>
<legacyType condition="clockTypeId==2">clock</legacyType>
<dataType></dataType>
<schemaVersion>2</schemaVersion>
Expand Down
3 changes: 2 additions & 1 deletion modules/clock-flip.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
<name>Clock - Flip</name>
<author>Core</author>
<description>Flip Clock</description>
<icon>fa fa-clock-o</icon>
<class></class>
<compatibilityClass>\Xibo\Widget\Compatibility\ClockWidgetCompatibility</compatibilityClass>
<type>clock-flip</type>
<group id="clock" icon="clock">Clock</group>
<group id="clock" icon="fa fa-clock">Clock</group>
<legacyType condition="clockTypeId==3">clock</legacyType>
<dataType></dataType>
<schemaVersion>2</schemaVersion>
Expand Down
3 changes: 2 additions & 1 deletion modules/countdown-clock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
<name>Countdown - Clock</name>
<author>Core</author>
<description>A module for displaying a Countdown timer as a clock</description>
<icon>fa fa-hourglass-o</icon>
<class></class>
<compatibilityClass>\Xibo\Widget\Compatibility\CountDownWidgetCompatibility</compatibilityClass>
<type>countdown-clock</type>
<group id="countdown" icon="countdown">Countdown</group>
<group id="countdown" icon="fa fa-hourglass-o">Countdown</group>
<legacyType condition="templateId==countdown2">countdown</legacyType>
<dataType></dataType>
<schemaVersion>2</schemaVersion>
Expand Down
3 changes: 2 additions & 1 deletion modules/countdown-custom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
<name>Countdown - Custom</name>
<author>Core</author>
<description>A module for displaying a custom Countdown timer</description>
<icon>fa fa-hourglass-o</icon>
<class></class>
<showIn>none</showIn>
<type>countdown-custom</type>
<group id="countdown" icon="countdown">Countdown</group>
<group id="countdown" icon="fa fa-hourglass-o">Countdown</group>
<dataType></dataType>
<schemaVersion>2</schemaVersion>
<assignable>1</assignable>
Expand Down
3 changes: 2 additions & 1 deletion modules/countdown-days.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
<name>Countdown - Days</name>
<author>Core</author>
<description>A module for displaying a Countdown timer for days</description>
<icon>fa fa-hourglass-o</icon>
<class></class>
<compatibilityClass>\Xibo\Widget\Compatibility\CountDownWidgetCompatibility</compatibilityClass>
<type>countdown-days</type>
<group id="countdown" icon="countdown">Countdown</group>
<group id="countdown" icon="fa fa-hourglass-o">Countdown</group>
<legacyType condition="templateId==countdown4">countdown</legacyType>
<dataType></dataType>
<schemaVersion>2</schemaVersion>
Expand Down
3 changes: 2 additions & 1 deletion modules/countdown-table.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
<name>Countdown - Table</name>
<author>Core</author>
<description>A module for displaying a Countdown timer in a table</description>
<icon>fa fa-hourglass-o</icon>
<class></class>
<compatibilityClass>\Xibo\Widget\Compatibility\CountDownWidgetCompatibility</compatibilityClass>
<type>countdown-table</type>
<group id="countdown" icon="countdown">Countdown</group>
<group id="countdown" icon="fa fa-hourglass-o">Countdown</group>
<legacyType condition="templateId==countdown3">countdown</legacyType>
<dataType></dataType>
<schemaVersion>2</schemaVersion>
Expand Down
3 changes: 2 additions & 1 deletion modules/countdown-text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
<name>Countdown - Simple Text</name>
<author>Core</author>
<description>A module for displaying a Countdown timer with Simple Text</description>
<icon>fa fa-hourglass-o</icon>
<class></class>
<compatibilityClass>\Xibo\Widget\Compatibility\CountDownWidgetCompatibility</compatibilityClass>
<type>countdown-text</type>
<group id="countdown" icon="countdown">Countdown</group>
<group id="countdown" icon="fa fa-hourglass-o">Countdown</group>
<legacyType condition="templateId==countdown1">countdown</legacyType>
<dataType></dataType>
<schemaVersion>2</schemaVersion>
Expand Down
1 change: 1 addition & 0 deletions modules/currencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<name>Currencies</name>
<author>Core</author>
<description>A module for showing Currency pairs and exchange rates</description>
<icon>fa fa-line-chart</icon>
<class></class>
<compatibilityClass>\Xibo\Widget\Compatibility\CurrenciesWidgetCompatibility</compatibilityClass>
<type>currencies</type>
Expand Down
1 change: 1 addition & 0 deletions modules/dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<name>Dashboards</name>
<author>Core</author>
<description>Securely connect to services like Microsoft PowerBI and display dashboards</description>
<icon>fa fa-file-image</icon>
<class>\Xibo\Widget\DashboardProvider</class>
<dataCacheKey>%widgetId%_%displayId%</dataCacheKey>
<type>dashboard</type>
Expand Down
1 change: 1 addition & 0 deletions modules/dataset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<name>Dataset</name>
<author>Core</author>
<description>Display DataSet content</description>
<icon>fa fa-table</icon>
<class>\Xibo\Widget\DataSetProvider</class>
<compatibilityClass>\Xibo\Widget\Compatibility\DatasetWidgetCompatibility</compatibilityClass>
<dataCacheKey>%dataSetId%_%lowerLimit%_%lowerLimit%_%numItems%_%orderClauses%_%useOrderingClause%_%ordering%_%filterClauses%_%useFilteringClause%_%filter%</dataCacheKey>
Expand Down
1 change: 1 addition & 0 deletions modules/embedded.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<name>Embedded</name>
<author>Core</author>
<description>Embed HTML and JavaScript</description>
<icon>fa fa-code</icon>
<class></class>
<type>embedded</type>
<dataType></dataType>
Expand Down
5 changes: 3 additions & 2 deletions modules/flash.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
~ Copyright (C) 2022 Xibo Signage Ltd
~ 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.
~
Expand All @@ -23,6 +23,7 @@
<name>Flash</name>
<author>Core</author>
<description>Upload SWF files to assign to Layouts</description>
<icon>fa fa-flash</icon>
<class></class>
<type>flash</type>
<dataType></dataType>
Expand Down
1 change: 1 addition & 0 deletions modules/forecastio.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<name>Weather</name>
<author>Core</author>
<description>A module for displaying weather information. Uses the Forecast API</description>
<icon>fa fa-cloud</icon>
<class></class>
<compatibilityClass>\Xibo\Widget\Compatibility\WeatherWidgetCompatibility</compatibilityClass>
<validatorClass>\Xibo\Widget\Validator\DisplayOrGeoValidator</validatorClass>
Expand Down
1 change: 1 addition & 0 deletions modules/googletraffic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<name>Google Traffic</name>
<author>Core</author>
<description>A module for displaying traffic information using Google Maps</description>
<icon>fa fa-car</icon>
<class></class>
<type>googletraffic</type>
<dataType></dataType>
Expand Down
1 change: 1 addition & 0 deletions modules/hls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<name>HLS</name>
<author>Core</author>
<description>A module for displaying HLS video streams</description>
<icon>fa fa-video-camera</icon>
<class></class>
<type>hls</type>
<dataType></dataType>
Expand Down
1 change: 1 addition & 0 deletions modules/htmlpackage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<name>HTML Package</name>
<author>Core</author>
<description>Upload a complete package to distribute to Players</description>
<icon>fa fa-file-code-o</icon>
<class></class>
<type>htmlpackage</type>
<dataType></dataType>
Expand Down
1 change: 1 addition & 0 deletions modules/image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<name>Image</name>
<author>Core</author>
<description>Upload Image files to assign to Layouts</description>
<icon>fa fa-file-image-o</icon>
<class></class>
<type>image</type>
<dataType></dataType>
Expand Down
Loading
Loading