diff --git a/airtime_mvc/application/common/UsabilityHints.php b/airtime_mvc/application/common/UsabilityHints.php index 38f09356d..594170cc5 100644 --- a/airtime_mvc/application/common/UsabilityHints.php +++ b/airtime_mvc/application/common/UsabilityHints.php @@ -67,12 +67,22 @@ class Application_Common_UsabilityHints ""); } } else if (self::isCurrentShowEmpty()) { - if ($userIsOnCalendarPage) { - return _("To start broadcasting, click on the current show and select 'Add / Remove Content'"); + // If the current show is linked users cannot add content to it so we have to provide a different message. + if (self::isCurrentShowLinked()) { + if ($userIsOnCalendarPage) { + return _("To start broadcasting, first you need to cancel the current linked show by clicking on it and selecting 'Cancel Current Show'."); + } else { + return sprintf(_("Linked shows need to be filled with tracks before it starts. To start broadcasting cancel the current linked show and schedule an unlinked show. + %sCreate an unlinked show now.%s"), "", ""); + } } else { - return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now.%s"), - "", - ""); + if ($userIsOnCalendarPage) { + return _("To start broadcasting, click on the current show and select 'Add / Remove Content'"); + } else { + return sprintf(_("It looks like the current show needs more tracks. %sAdd tracks to your show now.%s"), + "", + ""); + } } } else if (!self::getCurrentShow() && self::isNextShowEmpty()) { if ($userIsOnCalendarPage) { @@ -181,4 +191,21 @@ class Application_Common_UsabilityHints ->orderByDbStarts() ->findOne(); } + + private static function isCurrentShowLinked() + { + $currentShow = self::getCurrentShow(); + if (!is_null($currentShow)) { + $show = CcShowQuery::create() + ->filterByDbId($currentShow->getDbShowId()) + ->findOne(); + if ($show->isLinked()) { + return true; + } else { + return false; + } + } else { + return false; + } + } } \ No newline at end of file diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 07e72136b..811b90bd7 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -288,6 +288,7 @@ SQL; ->orderByDbStarts(Criteria::ASC) ->findOne(); if (isset($nextMedia)) { + $nextMediaName = ""; $nextMediaFileId = $nextMedia->getDbFileId(); $nextMediaStreamId = $nextMedia->getDbStreamId(); if (isset($nextMediaFileId)) { diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index 36910bdd5..3e3ceec0b 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -48,7 +48,6 @@ function toggleAddShowButton(){ } function setupStartTimeWidgets() { - if ($('input[name=add_show_start_now]:checked').val() == 'now') { $('#add_show_start_date').prop('disabled', 'true'); $('#add_show_start_time').prop('disabled', 'true'); @@ -65,9 +64,17 @@ function setupStartTimeWidgets() { $('#add_show_end_date_no_repeat').val(nowShowEnd.format('YYYY-MM-DD')); $('#add_show_end_time').val(nowShowEnd.format('HH:mm')); + //Disabled linked show option since user won't be able to schedule + //content + $('#add_show_linked').prop('disabled', 'true'); + } else { - $('#add_show_start_date').removeProp('disabled'); - $('#add_show_start_time').removeProp('disabled'); + //Do not enable start date and time option when a show has already started + if (!$('#add_show_start_now-now').prop('disabled')) { + $('#add_show_start_date').removeProp('disabled'); + $('#add_show_start_time').removeProp('disabled'); + } + } } @@ -241,6 +248,10 @@ function setAddShowEvents(form) { form.find('input:radio[name=add_show_start_now]').click(function() { setupStartTimeWidgets(); + + if ($(this).val() == "future") { + $('#add_show_linked').removeProp('disabled'); + } });