From df4cdfb07ebd5f5429f9d8773e05d0a12bc7fb48 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Mon, 7 May 2012 17:48:56 +0200 Subject: [PATCH] CC-3687 : Remove context menus from recorded shows since they are blank. --- .../application/controllers/ScheduleController.php | 9 +++++++++ airtime_mvc/application/models/ShowInstance.php | 8 ++------ airtime_mvc/public/js/airtime/schedule/schedule.js | 9 +++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 9df1ddca2..a83970ac6 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -226,6 +226,15 @@ class ScheduleController extends Zend_Controller_Action $showStartLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceStart()); $showEndLocalDT = Application_Common_DateHelper::ConvertToLocalDateTime($instance->getShowInstanceEnd()); + + if ($instance->isRecorded() && $epochNow > $showEndLocalDT->getTimestamp()) { + + $file = $instance->getRecordedFile(); + $fileId = $file->getId(); + + $menu["view_recorded"] = array("name" => "View Recorded File Metadata", "icon" => "overview", + "url" => "/library/edit-file-md/id/".$fileId); + } if ($epochNow < $showStartLocalDT->getTimestamp()) { if ( ($isAdminOrPM || $isDJ) diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index aaa0aa87e..024a4faa5 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -120,14 +120,10 @@ class Application_Model_ShowInstance { { $file_id = $this->_showInstance->getDbRecordedFile(); - if(isset($file_id)) { + if (isset($file_id)) { $file = Application_Model_StoredFile::Recall($file_id); - if (PEAR::isError($file)) { - return null; - } - - if(file_exists($file->getFilePath())) { + if (isset($file) && file_exists($file->getFilePath())) { return $file; } } diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index b8ece01ef..2b5d91113 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -354,6 +354,15 @@ $(document).ready(function() { oItems.cancel_recorded.callback = callback; } + //define a view recorded callback. + if (oItems.view_recorded !== undefined) { + + callback = function() { + document.location.href = oItems.view_recorded.url; + }; + oItems.view_recorded.callback = callback; + } + //define a cancel callback. if (oItems.cancel !== undefined) {