Skip to content

Commit

Permalink
Merge pull request #322 from xibosignage/develop
Browse files Browse the repository at this point in the history
1.8.6 release
  • Loading branch information
dasgarner authored Feb 21, 2018
2 parents 5416f3a + 41001ed commit 7a044d1
Show file tree
Hide file tree
Showing 52 changed files with 980 additions and 325 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ RUN apk update && apk upgrade && apk add tar \
php7-simplexml \
php7-mbstring \
php7-memcached \
php7-zlib \
mysql-client \
ssmtp \
apache2 \
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ RUN apk update && apk upgrade && apk add tar \
php7-simplexml \
php7-mbstring \
php7-memcached \
php7-zlib \
mysql-client \
ssmtp \
apache2 \
Expand Down
4 changes: 4 additions & 0 deletions install/master/constraints.sql
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,7 @@ CREATE INDEX requiredfile_displayId_type_index ON requiredfile (displayId, type)

CREATE INDEX idx_lkregionplaylist_playlistId ON lkregionplaylist (playlistId);

CREATE INDEX lkdgdg_parentId_childId_depth_index ON lkdgdg (parentId, childId, depth);

CREATE INDEX lkdgdg_childId_parentId_depth_index ON lkdgdg (childId, parentId, depth);

12 changes: 9 additions & 3 deletions install/master/data.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
INSERT INTO `version` (`app_ver`, `XmdsVersion`, `XlfVersion`, `DBVersion`) VALUES
('1.8.5', 5, 2, 136);
('1.8.6', 5, 2, 137);

INSERT INTO `group` (`groupID`, `group`, `IsUserSpecific`, `IsEveryone`, `isSystemNotification`) VALUES
(1, 'Users', 0, 0, 0),
Expand Down Expand Up @@ -236,7 +236,8 @@ INSERT INTO `setting` (`settingid`, `setting`, `value`, `fieldType`, `helptext`,
(97, 'DISPLAY_PROFILE_SCREENSHOT_INTERVAL_ENABLED', '1', 'checkbox', NULL, NULL, 'displays', 1, 'Enable the option to set the screenshot interval?', '', 90, '0', 1, 'checkbox'),
(98, 'DISPLAY_PROFILE_SCREENSHOT_SIZE_DEFAULT', '200', 'number', 'The default size in pixels for the Display Screenshots', NULL, 'displays', 1, 'Display Screenshot Default Size', '', 100, '200', 1, 'int'),
(99, 'LATEST_NEWS_URL', 'http://xibo.org.uk/feed', 'text', 'RSS/Atom Feed to be displayed on the Status Dashboard', '', 'general', 0, 'Latest News URL', '', 111, '', 0, 'string'),
(100, 'DISPLAY_LOCK_NAME_TO_DEVICENAME', '0', 'checkbox', NULL, NULL, 'displays', 1, 'Lock the Display Name to the device name provided by the Player?', '', 80, '0', 1, 'checkbox');
(100, 'DISPLAY_LOCK_NAME_TO_DEVICENAME', '0', 'checkbox', NULL, NULL, 'displays', 1, 'Lock the Display Name to the device name provided by the Player?', '', 80, '0', 1, 'checkbox'),
(101, 'mail_from_name', '', 'text', 'Mail will be sent under this name', null, 'maintenance', 1, 'Sending email name', '', 45, '', 1, 'string');

INSERT INTO `usertype` (`usertypeid`, `usertype`) VALUES
(1, 'Super Admin'),
Expand Down Expand Up @@ -322,4 +323,9 @@ INSERT INTO task (taskId, name, class, status, options, schedule, isActive, conf
(3, 'Email Notifications', '\\Xibo\\XTR\\EmailNotificationsTask', 2, '[]', '*/5 * * * * *', 1, '/tasks/email-notifications.task'),
(4, 'Stats Archive', '\\Xibo\\XTR\\StatsArchiveTask', 2, '{"periodSizeInDays":"7","maxPeriods":"4"}', '0 0 * * Mon', 0, '/tasks/stats-archiver.task'),
(5, 'Remove old Notifications', '\\Xibo\\XTR\\NotificationTidyTask', 2, '{"maxAgeDays":"7","systemOnly":"1","readOnly":"0"}', '15 0 * * *', 1, '/tasks/notification-tidy.task'),
(6, 'Fetch Remote DataSets', '\\Xibo\\XTR\\RemoteDataSetFetchTask', 2, '[]', '30 * * * * *', 1, '/tasks/remote-dataset.task');
(6, 'Fetch Remote DataSets', '\\Xibo\\XTR\\RemoteDataSetFetchTask', 2, '[]', '30 * * * * *', 1, '/tasks/remote-dataset.task');


INSERT INTO daypart (name, description, isRetired, userid, startTime, endTime, exceptions, isAlways, isCustom) VALUES
('Custom', 'User specifies the from/to date', 0, 1, '', '', '', 0, 1),
('Always', 'Event runs always', 0, 1, '', '', '', 1, 0);
8 changes: 4 additions & 4 deletions install/master/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1032,9 +1032,7 @@ CREATE TABLE IF NOT EXISTS `useroption` (
CREATE TABLE IF NOT EXISTS `lkdgdg` (
`parentId` int(11) NOT NULL,
`childId` int(11) NOT NULL,
`depth` int(11) NOT NULL,
UNIQUE KEY `parentId` (`parentId`,`childId`,`depth`),
UNIQUE KEY `childId` (`childId`,`parentId`,`depth`)
`depth` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
Expand Down Expand Up @@ -1127,8 +1125,10 @@ CREATE TABLE `daypart` (
`startTime` VARCHAR(8) DEFAULT '00:00:00',
`endTime` VARCHAR(8) DEFAULT '00:00:00',
`exceptions` TEXT NULL,
`isAlways` TINYINT(4) DEFAULT 0 NOT NULL,
`isCustom` TINYINT(4) DEFAULT 0 NOT NULL,
PRIMARY KEY (`dayPartId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=2;
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;

CREATE TABLE `task` (
`taskId` INT(11) NOT NULL AUTO_INCREMENT,
Expand Down
38 changes: 38 additions & 0 deletions install/steps/137.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"dbVersion": 137,
"appVersion": "1.8.6",
"steps": [
{
"step": "DayPart columns to indicate always and custom",
"action": "ALTER TABLE daypart ADD isAlways TINYINT DEFAULT 0 NOT NULL, ADD isCustom TINYINT DEFAULT 0 NOT NULL;"
},
{
"step": "Insert the always/custom day parts",
"action": "INSERT INTO daypart (name, description, isRetired, userid, startTime, endTime, exceptions, isAlways, isCustom) VALUES ('Custom', 'User specifies the from/to date', 0, 1, '', '', '', 0, 1),('Always', 'Event runs always', 0, 1, '', '', '', 1, 0);"
},
{
"step": "Back fill the existing schedules with the correct day parts - custom",
"action": "UPDATE `schedule` SET dayPartId = (SELECT dayPartId FROM daypart WHERE isCustom = 1) WHERE dayPartId = 0;"
},
{
"step": "Back fill the existing schedules with the correct day parts - always",
"action": "UPDATE `schedule` SET dayPartId = (SELECT dayPartId FROM daypart WHERE isAlways = 1) WHERE dayPartId = 1;"
},
{
"step": "Add email from setting",
"action": "INSERT INTO setting (setting, value, fieldType, helptext, options, cat, userChange, title, validation, ordering, `default`, userSee, type) VALUES ('mail_from_name', '', 'text', 'Mail will be sent under this name', null, 'maintenance', 1, 'Sending email name', '', 45, '', 1, 'string');"
},
{
"step": "Drop parent/child/depth unique keys on Display Group closure",
"action": "DROP INDEX parentId ON lkdgdg; DROP INDEX childId ON lkdgdg;"
},
{
"step": "Create parent/child/depth index on Display Group closure",
"action": "CREATE INDEX lkdgdg_parentId_childId_depth_index ON lkdgdg (parentId, childId, depth);"
},
{
"step": "Create parent/child/depth index on Display Group closure",
"action": "CREATE INDEX lkdgdg_childId_parentId_depth_index ON lkdgdg (childId, parentId, depth);"
}
]
}
25 changes: 21 additions & 4 deletions lib/Controller/Campaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,25 @@ public function layoutsForm($campaignId)
if (!$this->getUser()->checkEditable($campaign))
throw new AccessDeniedException();

$layouts = [];
foreach ($this->layoutFactory->getByCampaignId($campaignId, false) as $layout) {
if (!$this->getUser()->checkViewable($layout)) {
// Hide all layout details from the user
$emptyLayout = $this->layoutFactory->createEmpty();
$emptyLayout->layoutId = $layout->layoutId;
$emptyLayout->layout = __('Layout');
$emptyLayout->locked = true;

$layouts[] = $emptyLayout;
} else {
$layouts[] = $layout;
}
}

$this->getState()->template = 'campaign-form-layouts';
$this->getState()->setData([
'campaign' => $campaign,
'layouts' => $this->layoutFactory->getByCampaignId($campaignId),
'layouts' => $layouts,
'help' => $this->getHelp()->link('Campaign', 'Layouts')
]);
}
Expand Down Expand Up @@ -540,7 +555,9 @@ public function assignLayout($campaignId)

$layout = $this->layoutFactory->getById($this->getSanitizer()->getInt('layoutId', $object));

if (!$this->getUser()->checkViewable($layout))
// Check to see if this layout is already assigned
// if it is, then we have permission to move it around
if (!$this->getUser()->checkViewable($layout) && !$campaign->isLayoutAssigned($layout))
throw new AccessDeniedException(__('You do not have permission to assign the provided Layout'));

// Set the Display Order
Expand All @@ -562,7 +579,7 @@ public function assignLayout($campaignId)

$layout = $this->layoutFactory->getById($this->getSanitizer()->getInt('layoutId', $object));

if (!$this->getUser()->checkViewable($layout))
if (!$this->getUser()->checkViewable($layout) && !$campaign->isLayoutAssigned($layout))
throw new AccessDeniedException(__('You do not have permission to assign the provided Layout'));

// Set the Display Order
Expand Down Expand Up @@ -644,7 +661,7 @@ public function unassignLayout($campaignId)
foreach ($layouts as $object) {
$layout = $this->layoutFactory->getById($this->getSanitizer()->getInt('layoutId', $object));

if (!$this->getUser()->checkViewable($layout))
if (!$this->getUser()->checkViewable($layout) && !$campaign->isLayoutAssigned($layout))
throw new AccessDeniedException(__('You do not have permission to assign the provided Layout'));

// Set the Display Order
Expand Down
20 changes: 14 additions & 6 deletions lib/Controller/Clock.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,23 @@ public function __construct($log, $sanitizerService, $state, $user, $help, $date
* )
* )
* )
*
* @throws \Exception
*/
function clock()
public function clock()
{
$output = $this->getDate()->getLocalDate(null, 'H:i T');
$this->session->refreshExpiry = false;

$this->getState()->setData(array('time' => $output));
$this->getState()->html = $output;
$this->getState()->clockUpdate = true;
$this->getState()->success = true;
if ($this->getApp()->request()->isAjax() || $this->isApi()) {
$output = $this->getDate()->getLocalDate(null, 'H:i T');

$this->getState()->setData(array('time' => $output));
$this->getState()->html = $output;
$this->getState()->clockUpdate = true;
$this->getState()->success = true;
} else {
$this->setNoOutput(true);
echo $this->getDate()->getLocalDate(null, 'c');
}
}
}
31 changes: 27 additions & 4 deletions lib/Controller/DayPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
namespace Xibo\Controller;

use Xibo\Exception\AccessDeniedException;
use Xibo\Exception\XiboException;
use Xibo\Factory\DayPartFactory;
use Xibo\Factory\DisplayFactory;
use Xibo\Factory\DisplayGroupFactory;
Expand Down Expand Up @@ -99,7 +100,9 @@ public function grid()
{
$filter = [
'dayPartId' => $this->getSanitizer()->getInt('dayPartId'),
'name' => $this->getSanitizer()->getString('name')
'name' => $this->getSanitizer()->getString('name'),
'isAlways' => 0,
'isCustom' => 0
];

$dayParts = $this->dayPartFactory->query($this->gridRenderSort(), $this->gridRenderFilter($filter));
Expand Down Expand Up @@ -177,6 +180,9 @@ public function editForm($dayPartId)
if (!$this->getUser()->checkEditable($dayPart))
throw new AccessDeniedException();

if ($dayPart->isAlways === 1 || $dayPart->isCustom === 1)
throw new AccessDeniedException();

$this->getState()->template = 'daypart-form-edit';
$this->getState()->setData([
'dayPart' => $dayPart,
Expand All @@ -197,6 +203,9 @@ public function deleteForm($dayPartId)
if (!$this->getUser()->checkDeleteable($dayPart))
throw new AccessDeniedException();

if ($dayPart->isAlways === 1 || $dayPart->isCustom === 1)
throw new AccessDeniedException();

// Get a count of schedules for this day part
$schedules = $this->scheduleFactory->getByDayPartId($dayPartId);

Expand Down Expand Up @@ -284,7 +293,9 @@ public function add()
$dayPart = $this->dayPartFactory->createEmpty();
$this->handleCommonInputs($dayPart);

$dayPart->save();
$dayPart
->setScheduleFactory($this->scheduleFactory)
->save();

// Return
$this->getState()->hydrate([
Expand Down Expand Up @@ -370,6 +381,8 @@ public function add()
* @SWG\Schema(ref="#/definitions/DayPart")
* )
* )
*
* @throws XiboException
*/
public function edit($dayPartId)
{
Expand All @@ -381,8 +394,13 @@ public function edit($dayPartId)
if (!$this->getUser()->checkEditable($dayPart))
throw new AccessDeniedException();

if ($dayPart->isAlways === 1 || $dayPart->isCustom === 1)
throw new AccessDeniedException();

$this->handleCommonInputs($dayPart);
$dayPart->save();
$dayPart
->setScheduleFactory($this->scheduleFactory)
->save();

// Return
$this->getState()->hydrate([
Expand Down Expand Up @@ -471,6 +489,8 @@ private function handleCommonInputs($dayPart)
* description="successful operation"
* )
* )
*
* @throws XiboException
*/
public function delete($dayPartId)
{
Expand All @@ -479,7 +499,10 @@ public function delete($dayPartId)
if (!$this->getUser()->checkDeleteable($dayPart))
throw new AccessDeniedException();

$dayPart->setDateService($this->getDate())->delete();
$dayPart
->setDateService($this->getDate())
->setScheduleFactory($this->scheduleFactory)
->delete();

// Return
$this->getState()->hydrate([
Expand Down
Loading

0 comments on commit 7a044d1

Please sign in to comment.