Skip to content

Commit

Permalink
Merge pull request #1542 from xibosignage/develop
Browse files Browse the repository at this point in the history
Release 3.3.2
  • Loading branch information
dasgarner authored Jan 10, 2023
2 parents 2ccc30f + a97db08 commit c073160
Show file tree
Hide file tree
Showing 128 changed files with 5,879 additions and 623 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
build:
name: Build Containers
if: github.repository == 'xibosignage/xibo-cms'
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
build:
name: Build
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
name: Build Containers
if: github.repository == 'xibosignage/xibo-cms'
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
test-suite:
name: Build Containers and Run Tests
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Introduction
Xibo - Digital Signage - https://xibo.org.uk
Copyright (C) 2006-2022 Xibo Signage Ltd and Contributors.
Copyright (C) 2006-2023 Xibo Signage Ltd and Contributors.



#### Branches

- develop: Work in progress toward 4.0
- master: Currently 3.2
- release33: Release preparation for 3.3.x
- master: Currently 3.3
- release32: Bug fixes for 3.2
- release31: Bug fixes for 3.1
- release30: Bug fixes 3.0
Expand Down
574 changes: 535 additions & 39 deletions lib/Connector/XiboAudienceReportingConnector.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/Connector/XiboSspConnector.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2022 Xibo Signage Ltd
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
Expand Down Expand Up @@ -429,7 +429,7 @@ public function activity(SanitizerInterface $params): array
'headers' => [
'X-API-KEY' => $this->getSetting('apiKey'),
],
'json' => [
'query' => [
'cmsUrl' => $this->getSetting('cmsUrl'),
'fromDt' => $fromDt->toAtomString(),
'toDt' => $toDt->toAtomString(),
Expand Down
17 changes: 14 additions & 3 deletions lib/Controller/Campaign.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2022 Xibo Signage Ltd
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
Expand Down Expand Up @@ -1313,7 +1313,7 @@ public function copy(Request $request, Response $response, $id)
$newCampaign->campaign = $sanitizedParams->getString('name');

// assign the same layouts to the new Campaign
foreach ($campaign->layouts as $layout) {
foreach ($campaign->loadLayouts() as $layout) {
$newCampaign->assignLayout(
$layout->layoutId,
$layout->displayOrder,
Expand All @@ -1323,6 +1323,12 @@ public function copy(Request $request, Response $response, $id)
);
}

// is the original campaign an ad campaign?
if ($campaign->type === 'ad') {
// assign the same displays to the new Campaign
$newCampaign->replaceDisplayGroupIds($campaign->loadDisplayGroupIds());
}

$newCampaign->save();

// Return
Expand Down Expand Up @@ -1446,7 +1452,12 @@ public function selectFolder(Request $request, Response $response, $id)
}

// Save
$campaign->save();
$campaign->save([
'validate' => false,
'notify' => false,
'collectNow' => false,
'saveTags' => false
]);

// Return
$this->getState()->hydrate([
Expand Down
11 changes: 11 additions & 0 deletions lib/Controller/DataSetColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ public function add(Request $request, Response $response, $id)
// Assign the column to set the column order if necessary
$dataSet->assignColumn($column);

// client side formula disable sort
if (substr($column->formula, 0, 1) === '$') {
$column->showSort = 0;
}

// Save the column
$column->save();

Expand Down Expand Up @@ -569,6 +574,12 @@ public function edit(Request $request, Response $response, $id, $colId)
$column->tooltip = $sanitizedParams->getString('tooltip');
$column->isRequired = $sanitizedParams->getCheckbox('isRequired');
$column->dateFormat = $sanitizedParams->getString('dateFormat', ['default' => null]);

// client side formula disable sort
if (substr($column->formula, 0, 1) === '$') {
$column->showSort = 0;
}

$column->save();

if ($column->dataSetColumnTypeId == 3 && $column->hasPropertyChanged('remoteField')) {
Expand Down
18 changes: 8 additions & 10 deletions lib/Controller/DataSetData.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (C) 2021 Xibo Signage Ltd
/*
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
Expand Down Expand Up @@ -258,21 +258,19 @@ public function add(Request $request, Response $response, $id)
foreach ($dataSet->getColumn() as $column) {
/* @var \Xibo\Entity\DataSetColumn $column */
if ($column->dataSetColumnTypeId == 1) {

// Sanitize accordingly
if ($column->dataTypeId == 2) {
// Number
$value = $sanitizedParams->getDouble('dataSetColumnId_' . $column->dataSetColumnId);
}
else if ($column->dataTypeId == 3) {
} else if ($column->dataTypeId == 3) {
// Date
$value = $sanitizedParams->getDate('dataSetColumnId_' . $column->dataSetColumnId)->format(DateFormatHelper::getSystemFormat());
}
else if ($column->dataTypeId == 5) {
$date = $sanitizedParams->getDate('dataSetColumnId_' . $column->dataSetColumnId);
// format only if we have the date provided.
$value = $date === null ? $date : $date->format(DateFormatHelper::getSystemFormat());
} else if ($column->dataTypeId == 5) {
// Media Id
$value = $sanitizedParams->getInt('dataSetColumnId_' . $column->dataSetColumnId);
}
else {
} else {
// String
$value = $sanitizedParams->getString('dataSetColumnId_' . $column->dataSetColumnId);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/Display.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2022 Xibo Signage Ltd
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
Expand Down Expand Up @@ -1486,7 +1486,7 @@ function deleteForm(Request $request, Response $response, $id)
* name="costPerPlay",
* in="formData",
* description="The Cost Per Play of this Display",
* type="double",
* type="number",
* required=false
* ),
* @SWG\Parameter(
Expand Down
3 changes: 2 additions & 1 deletion lib/Controller/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -3013,7 +3013,8 @@ public function addThumbnail(Request $request, Response $response, $id): Respons
foreach ($layout->regions as $region) {
try {
// Get widgets in this region
$widgets = $region->regionPlaylist->expandWidgets();
$playlist = $region->getPlaylist()->setModuleFactory($this->moduleFactory);
$widgets = $playlist->expandWidgets();

if (count($widgets) <= 0) {
// Render the region (draw a grey box)
Expand Down
37 changes: 33 additions & 4 deletions lib/Controller/Schedule.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2022 Xibo Signage Ltd
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
Expand Down Expand Up @@ -282,7 +282,13 @@ public function eventData(Request $request, Response $response)
];

if ($campaignId != null) {
$filter['campaignId'] = $campaignId;
// Is this an ad campaign?
$campaign = $this->campaignFactory->getById($campaignId);
if ($campaign->type === 'ad') {
$filter['parentCampaignId'] = $campaignId;
} else {
$filter['campaignId'] = $campaignId;
}
}

foreach ($this->scheduleFactory->query('FromDT', $filter) as $row) {
Expand Down Expand Up @@ -324,7 +330,7 @@ public function eventData(Request $request, Response $response)
$title = __('%s scheduled on %s', $row->command, $displayGroupList);
} else {
// Should we show the Layout name, or not (depending on permission)
// Make sure we only run the below code if we have to, its quite expensive
// Make sure we only run the below code if we have to, it's quite expensive
if (!$showLayoutName && !$this->getUser()->isSuperAdmin()) {
// Campaign
$campaign = $this->campaignFactory->getById($row->campaignId);
Expand All @@ -333,7 +339,12 @@ public function eventData(Request $request, Response $response)
$row->campaign = __('Private Item');
}
}
$title = __('%s scheduled on %s', $row->campaign, $displayGroupList);

$title = sprintf(
__('%s scheduled on %s'),
$row->getUnmatchedProperty('parentCampaignName', $row->campaign),
$displayGroupList
);

if ($row->eventTypeId === \Xibo\Entity\Schedule::$INTERRUPT_EVENT) {
$title .= __(' with Share of Voice %d seconds per hour', $row->shareOfVoice);
Expand Down Expand Up @@ -989,6 +1000,15 @@ public function add(Request $request, Response $response)
// Set the parentCampaignId for campaign events
if ($schedule->eventTypeId === \Xibo\Entity\Schedule::$CAMPAIGN_EVENT) {
$schedule->parentCampaignId = $schedule->campaignId;

// Make sure we're not directly scheduling an ad campaign
$campaign = $this->campaignFactory->getById($schedule->campaignId);
if ($campaign->type === 'ad') {
throw new InvalidArgumentException(
__('Direct scheduling of an Ad Campaign is not allowed'),
'campaignId'
);
}
}

// Fields only collected for interrupt events
Expand Down Expand Up @@ -1550,6 +1570,15 @@ public function edit(Request $request, Response $response, $id)
// Set the parentCampaignId for campaign events
if ($schedule->eventTypeId === \Xibo\Entity\Schedule::$CAMPAIGN_EVENT) {
$schedule->parentCampaignId = $schedule->campaignId;

// Make sure we're not directly scheduling an ad campaign
$campaign = $this->campaignFactory->getById($schedule->campaignId);
if ($campaign->type === 'ad') {
throw new InvalidArgumentException(
__('Direct scheduling of an Ad Campaign is not allowed'),
'campaignId'
);
}
}

// Fields only collected for interrupt events
Expand Down
9 changes: 8 additions & 1 deletion lib/Controller/Stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Carbon\Carbon;
use Slim\Http\Response as Response;
use Slim\Http\ServerRequest as Request;
use Xibo\Event\ConnectorReportEvent;
use Xibo\Factory\DisplayFactory;
use Xibo\Factory\DisplayGroupFactory;
use Xibo\Factory\LayoutFactory;
Expand Down Expand Up @@ -90,13 +91,19 @@ public function __construct($store, $timeSeriesStore, $reportService, $displayFa
*/
function displayReportPage(Request $request, Response $response)
{
// ------------
// Dispatch an event to get connector reports
$event = new ConnectorReportEvent();
$this->getDispatcher()->dispatch($event, ConnectorReportEvent::$NAME);

$data = [
// List of Displays this user has permission for
'defaults' => [
'fromDate' => Carbon::now()->subSeconds(86400 * 35)->format(DateFormatHelper::getSystemFormat()),
'fromDateOneDay' => Carbon::now()->subSeconds(86400)->format(DateFormatHelper::getSystemFormat()),
'toDate' => Carbon::now()->format(DateFormatHelper::getSystemFormat()),
'availableReports' => $this->reportService->listReports()
'availableReports' => $this->reportService->listReports(),
'connectorReports' => $event->getReports()
]
];

Expand Down
22 changes: 22 additions & 0 deletions lib/Entity/Campaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -1086,4 +1086,26 @@ public function saveIncrementPlays(): Campaign
]);
return $this;
}

/**
* Overwrite the number of plays/spend and impressions
* @return $this
*/
public function overwritePlays(): Campaign
{

$this->getStore()->update('
UPDATE `campaign`
SET `plays` = :plays,
`spend` = :spend,
`impressions` = :impressions
WHERE campaignId = :campaignId
', [
'plays' => $this->plays,
'spend' => $this->spend,
'impressions' => $this->impressions,
'campaignId' => $this->campaignId,
]);
return $this;
}
}
Loading

0 comments on commit c073160

Please sign in to comment.