From 1698aae251809b6fc55eb4808c2002da34794c25 Mon Sep 17 00:00:00 2001 From: denise Date: Tue, 18 Sep 2012 10:53:19 -0400 Subject: [PATCH 01/15] CC-4466: Buttons on Now Playing page are clickable even though they are disabled -fixed --- .../public/js/airtime/buttons/buttons.js | 7 ++++++- .../library/events/library_playlistbuilder.js | 4 ++-- .../library/events/library_showbuilder.js | 4 ++-- .../public/js/airtime/library/library.js | 4 ++-- .../public/js/airtime/showbuilder/builder.js | 18 +++++++++--------- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/airtime_mvc/public/js/airtime/buttons/buttons.js b/airtime_mvc/public/js/airtime/buttons/buttons.js index 23a904001..a8db230b1 100644 --- a/airtime_mvc/public/js/airtime/buttons/buttons.js +++ b/airtime_mvc/public/js/airtime/buttons/buttons.js @@ -6,8 +6,11 @@ var AIRTIME = (function(AIRTIME) { } mod = AIRTIME.button; - mod.isDisabled = function(c) { + mod.isDisabled = function(c, useParent) { var button = $("." + c); + if (useParent) { + button = button.parent(); + } if (button.hasClass(DISABLED_CLASS)) { return true; @@ -25,6 +28,7 @@ var AIRTIME = (function(AIRTIME) { if (button.hasClass(DISABLED_CLASS)) { button.removeClass(DISABLED_CLASS); + button.removeAttr('disabled'); } }; @@ -37,6 +41,7 @@ var AIRTIME = (function(AIRTIME) { if (!button.hasClass(DISABLED_CLASS)) { button.addClass(DISABLED_CLASS); + button.attr('disabled', 'disabled'); } }; diff --git a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js index 17aa3bb4e..92f0bcdbd 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js @@ -16,9 +16,9 @@ var AIRTIME = (function(AIRTIME) { } if (check === true) { - AIRTIME.button.enableButton("btn-group #library-plus", true); + AIRTIME.button.enableButton("btn-group #library-plus", false); } else { - AIRTIME.button.disableButton("btn-group #library-plus", true); + AIRTIME.button.disableButton("btn-group #library-plus", false); } }; diff --git a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js index 7bddd8049..cf67419cd 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js @@ -16,9 +16,9 @@ var AIRTIME = (function(AIRTIME) { } if (check === true) { - AIRTIME.button.enableButton("btn-group #library-plus", true); + AIRTIME.button.enableButton("btn-group #library-plus", false); } else { - AIRTIME.button.disableButton("btn-group #library-plus", true); + AIRTIME.button.disableButton("btn-group #library-plus", false); } }; diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 3fea72940..70bf2744b 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -138,10 +138,10 @@ var AIRTIME = (function(AIRTIME) { } if (check === true) { - AIRTIME.button.enableButton("btn-group #sb-trash", true); + AIRTIME.button.enableButton("btn-group #sb-trash", false); } else { - AIRTIME.button.disableButton("btn-group #sb-trash", true); + AIRTIME.button.disableButton("btn-group #sb-trash", false); } }; diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index 1282e6ca5..b280460bd 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -962,16 +962,16 @@ var AIRTIME = (function(AIRTIME){ "" + "") .append("
" + - "
") .append("
" + - "
") .append("
" + - "
") .append("
" + - "
"); $toolbar.append($menu); @@ -987,7 +987,7 @@ var AIRTIME = (function(AIRTIME){ data, msg = 'Cancel Current Show?'; - if (AIRTIME.button.isDisabled('icon-ban-circle') === true) { + if (AIRTIME.button.isDisabled('icon-ban-circle', true) === true) { return; } @@ -1018,7 +1018,7 @@ var AIRTIME = (function(AIRTIME){ $toolbar.find('.icon-step-forward').parent() .click(function() { - if (AIRTIME.button.isDisabled('icon-step-forward') === true) { + if (AIRTIME.button.isDisabled('icon-step-forward', true) === true) { return; } @@ -1032,10 +1032,10 @@ var AIRTIME = (function(AIRTIME){ }); //delete overbooked tracks. - $toolbar.find('.icon-cut').parent() + $toolbar.find('.icon-cut', true).parent() .click(function() { - if (AIRTIME.button.isDisabled('icon-cut') === true) { + if (AIRTIME.button.isDisabled('icon-cut', true) === true) { return; } @@ -1055,7 +1055,7 @@ var AIRTIME = (function(AIRTIME){ $toolbar.find('.icon-trash').parent() .click(function() { - if (AIRTIME.button.isDisabled('icon-trash') === true) { + if (AIRTIME.button.isDisabled('icon-trash', true) === true) { return; } From 9249bf8cd03f859a792ca1b915950a2fbbd2a432 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 10:55:42 -0400 Subject: [PATCH 02/15] Big formatting changes. --- .../application/models/ShowBuilder.php | 46 +++++++++++-------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index 869e3f2d8..cdd7b14c1 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -179,7 +179,7 @@ class Application_Model_ShowBuilder $showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC")); $showStartDT->setTimezone(new DateTimeZone($this->timezone)); $startsEpoch = floatval($showStartDT->format("U.u")); - $showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC")); + $showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC")); $showEndDT->setTimezone(new DateTimeZone($this->timezone)); $endsEpoch = floatval($showEndDT->format("U.u")); @@ -188,8 +188,8 @@ class Application_Model_ShowBuilder $row["rebroadcast"] = true; $parentInstance = CcShowInstancesQuery::create()->findPk($p_item["parent_show"]); - $name = $parentInstance->getCcShow()->getDbName(); - $dt = $parentInstance->getDbStarts(null); + $name = $parentInstance->getCcShow()->getDbName(); + $dt = $parentInstance->getDbStarts(null); $dt->setTimezone(new DateTimeZone($this->timezone)); $time = $dt->format("Y-m-d H:i"); @@ -198,8 +198,6 @@ class Application_Model_ShowBuilder $row["record"] = true; if (Application_Model_Preference::GetUploadToSoundcloudOption()) { - Logging::info('$p_item contains:'); - Logging::info($p_item); $file = Application_Model_StoredFile::Recall( $p_item['si_file_id']); if (isset($file)) { @@ -242,9 +240,11 @@ class Application_Model_ShowBuilder if (isset($p_item["sched_starts"])) { - $schedStartDT = new DateTime($p_item["sched_starts"], new DateTimeZone("UTC")); + $schedStartDT = new DateTime($p_item["sched_starts"], + new DateTimeZone("UTC")); $schedStartDT->setTimezone(new DateTimeZone($this->timezone)); - $schedEndDT = new DateTime($p_item["sched_ends"], new DateTimeZone("UTC")); + $schedEndDT = new DateTime($p_item["sched_ends"], + new DateTimeZone("UTC")); $schedEndDT->setTimezone(new DateTimeZone($this->timezone)); $showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC")); @@ -350,7 +350,8 @@ class Application_Model_ShowBuilder /* * @param int $timestamp Unix timestamp in seconds. * - * @return boolean whether the schedule in the show builder's range has been updated. + * @return boolean whether the schedule in the show builder's range has + * been updated. * */ public function hasBeenUpdatedSince($timestamp, $instances) @@ -374,23 +375,26 @@ class Application_Model_ShowBuilder $currentInstances[] = $show["instance_id"]; if (isset($show["last_scheduled"])) { - $dt = new DateTime($show["last_scheduled"], new DateTimeZone("UTC")); + $dt = new DateTime($show["last_scheduled"], + new DateTimeZone("UTC")); } else { - $dt = new DateTime($show["created"], new DateTimeZone("UTC")); + $dt = new DateTime($show["created"], + new DateTimeZone("UTC")); } //check if any of the shows have a more recent timestamp. $showTimeStamp = intval($dt->format("U")); if ($timestamp < $showTimeStamp) { - Logging::debug("timestamp is {$timestamp} show timestamp is {$showTimeStamp}"); $outdated = true; break; } } } - //see if the displayed show instances have changed. (deleted, empty schedule etc) - if ($outdated === false && count($instances) !== count($currentInstances)) { + //see if the displayed show instances have changed. (deleted, + //empty schedule etc) + if ($outdated === false && count($instances) + !== count($currentInstances)) { Logging::debug("show instances have changed."); $outdated = true; } @@ -411,14 +415,17 @@ class Application_Model_ShowBuilder $shows[] = $this->opts["showFilter"]; } - $scheduled_items = Application_Model_Schedule::GetScheduleDetailItems($this->startDT->format("Y-m-d H:i:s"), $this->endDT->format("Y-m-d H:i:s"), $shows); + $scheduled_items = Application_Model_Schedule::GetScheduleDetailItems( + $this->startDT->format("Y-m-d H:i:s"), $this->endDT->format( + "Y-m-d H:i:s"), $shows); for ($i = 0, $rows = count($scheduled_items); $i < $rows; $i++) { $item = $scheduled_items[$i]; //don't send back data for filler rows. - if (isset($item["playout_status"]) && $item["playout_status"] < 0) { + if (isset($item["playout_status"]) && + $item["playout_status"] < 0) { continue; } @@ -427,8 +434,10 @@ class Application_Model_ShowBuilder //make a footer row. if ($current_id !== -1) { - //pass in the previous row as it's the last row for the previous show. - $display_items[] = $this->makeFooterRow($scheduled_items[$i-1]); + // pass in the previous row as it's the last row for + // the previous show. + $display_items[] = $this->makeFooterRow( + $scheduled_items[$i-1]); } $display_items[] = $this->makeHeaderRow($item); @@ -445,7 +454,8 @@ class Application_Model_ShowBuilder $display_items[] = $row; } - if ($current_id !== -1 && !in_array($current_id, $this->showInstances)) { + if ($current_id !== -1 && + !in_array($current_id, $this->showInstances)) { $this->showInstances[] = $current_id; } } From d90559fdf8c01394b71d9395ead176a1824e1ce7 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 11:02:41 -0400 Subject: [PATCH 03/15] Cleaned up ShowbuilderController --- .../controllers/ShowbuilderController.php | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index 413afbb70..fedebf7e2 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -229,35 +229,32 @@ class ShowbuilderController extends Zend_Controller_Action public function checkBuilderFeedAction() { - $request = $this->getRequest(); + $request = $this->getRequest(); $current_time = time(); $starts_epoch = $request->getParam("start", $current_time); //default ends is 24 hours after starts. - $ends_epoch = $request->getParam("end", $current_time + (60*60*24)); + $ends_epoch = $request->getParam("end", $current_time + (60*60*24)); $show_filter = intval($request->getParam("showFilter", 0)); - $my_shows = intval($request->getParam("myShows", 0)); - $timestamp = intval($request->getParam("timestamp", -1)); - $instances = $request->getParam("instances", array()); + $my_shows = intval($request->getParam("myShows", 0)); + $timestamp = intval($request->getParam("timestamp", -1)); + $instances = $request->getParam("instances", array()); $startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC")); - $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC")); + $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC")); - $opts = array("myShows" => $my_shows, "showFilter" => $show_filter); + $opts = array("myShows" => $my_shows, "showFilter" => $show_filter); $showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT, $opts); //only send the schedule back if updates have been made. // -1 default will always call the schedule to be sent back if no timestamp is defined. - if ($showBuilder->hasBeenUpdatedSince($timestamp, $instances)) { - $this->view->update = true; - } else { - $this->view->update = false; - } + $this->view->update = $showBuilder->hasBeenUpdatedSince( + $timestamp, $instances); } public function builderFeedAction() { - $request = $this->getRequest(); + $request = $this->getRequest(); $current_time = time(); $starts_epoch = $request->getParam("start", $current_time); From 2e0e0849c5655252005841623a5feea721d2c0f8 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 11:03:34 -0400 Subject: [PATCH 04/15] More clean up --- .../application/controllers/ShowbuilderController.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index fedebf7e2..23c3fd55b 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -259,12 +259,12 @@ class ShowbuilderController extends Zend_Controller_Action $starts_epoch = $request->getParam("start", $current_time); //default ends is 24 hours after starts. - $ends_epoch = $request->getParam("end", $current_time + (60*60*24)); + $ends_epoch = $request->getParam("end", $current_time + (60*60*24)); $show_filter = intval($request->getParam("showFilter", 0)); - $my_shows = intval($request->getParam("myShows", 0)); + $my_shows = intval($request->getParam("myShows", 0)); $startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC")); - $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC")); + $endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC")); $opts = array("myShows" => $my_shows, "showFilter" => $show_filter); $showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT, $opts); @@ -287,13 +287,9 @@ class ShowbuilderController extends Zend_Controller_Action } catch (OutDatedScheduleException $e) { $this->view->error = $e->getMessage(); Logging::info($e->getMessage()); - Logging::info("{$e->getFile()}"); - Logging::info("{$e->getLine()}"); } catch (Exception $e) { $this->view->error = $e->getMessage(); Logging::info($e->getMessage()); - Logging::info("{$e->getFile()}"); - Logging::info("{$e->getLine()}"); } } From 49e1b29bc973ff3c8bb54a83ca02e9acc96c9c5c Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 11:04:33 -0400 Subject: [PATCH 05/15] Removed instances of getLine and getFile --- airtime_mvc/application/controllers/ScheduleController.php | 2 -- airtime_mvc/application/models/ShowInstance.php | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 41e1b5125..d78ae2719 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -872,8 +872,6 @@ class ScheduleController extends Zend_Controller_Action } catch (Exception $e) { $this->view->error = $e->getMessage(); Logging::info($e->getMessage()); - Logging::info("{$e->getFile()}"); - Logging::info("{$e->getLine()}"); } } } diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php index f88a1d63a..f782ae076 100644 --- a/airtime_mvc/application/models/ShowInstance.php +++ b/airtime_mvc/application/models/ShowInstance.php @@ -590,9 +590,7 @@ SQL; $rebroad = new Application_Model_ShowInstance($rebroadcast->getDbId()); $rebroad->addFileToShow($file_id, false); } catch (Exception $e) { - Logging::info("{$e->getFile()}"); - Logging::info("{$e->getLine()}"); - Logging::info("{$e->getMessage()}"); + Logging::info($e->getMessage()); } } } From 9c721f202fcc8430cd704dd744ec2a7a56f76940 Mon Sep 17 00:00:00 2001 From: denise Date: Tue, 18 Sep 2012 11:05:13 -0400 Subject: [PATCH 06/15] -small UI improvement --- .../public/js/airtime/showbuilder/builder.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index b280460bd..9839df06c 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -66,10 +66,10 @@ var AIRTIME = (function(AIRTIME){ var $selectable = $sbTable.find("tbody").find("input:checkbox"); if ($selectable.length !== 0) { - AIRTIME.button.enableButton("btn-group #timeline-select", true); + AIRTIME.button.enableButton("btn-group #timeline-select", false); } else { - AIRTIME.button.disableButton("btn-group #timeline-select", true); + AIRTIME.button.disableButton("btn-group #timeline-select", false); } //need to check if the 'Select' button is disabled @@ -1083,17 +1083,18 @@ var AIRTIME = (function(AIRTIME){ }); /* - * Icon hover states in the toolbar. + * Select button dropdown state in the toolbar. + * The button has to be disabled to prevent the dropdown + * from opening */ $sbContent.on("mouseenter", ".btn-group #timeline-select", function(ev) { - $el = $(this).parent(), - $ch = $el.children('#timeline-select'); + $el = $(this); if ($el.hasClass("ui-state-disabled")) { - $ch.attr("disabled", "disabled"); + $el.attr("disabled", "disabled"); } else { - $ch.removeAttr("disabled"); + $el.removeAttr("disabled"); } }); From 6481556f9b4dbac85fe8dc69bec8bc7e56b5b559 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 11:07:32 -0400 Subject: [PATCH 07/15] Showbuilder formatting --- airtime_mvc/application/models/ShowBuilder.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index 738b2f9cc..bc1cdccbb 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -314,18 +314,18 @@ class Application_Model_ShowBuilder private function makeFooterRow($p_item) { - $row = $this->defaultRowArray; - $row["footer"] = true; + $row = $this->defaultRowArray; + $row["footer"] = true; $row["instance"] = intval($p_item["si_id"]); $this->getRowTimestamp($p_item, $row); - $showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC")); - $contentDT = $this->contentDT; + $showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC")); + $contentDT = $this->contentDT; - $runtime = bcsub($contentDT->format("U.u"), $showEndDT->format("U.u"), 6); - $row["runtime"] = $runtime; + $runtime = bcsub($contentDT->format("U.u"), $showEndDT->format("U.u"), 6); + $row["runtime"] = $runtime; - $timeFilled = new TimeFilledFormatter($runtime); + $timeFilled = new TimeFilledFormatter($runtime); $row["fRuntime"] = $timeFilled->format(); $showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC")); From 0a83b33a5a80fb4fe58fce8ebcfbd4e3f019bedb Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 11:10:54 -0400 Subject: [PATCH 08/15] Removed extra logging statements --- airtime_mvc/application/controllers/ScheduleController.php | 2 -- airtime_mvc/application/models/ShowBuilder.php | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index d78ae2719..e061d3d5d 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -825,13 +825,11 @@ class ScheduleController extends Zend_Controller_Action $this->view->newForm = $this->view->render( 'schedule/add-show-form.phtml'); Logging::debug("Show creation succeeded"); - Logging::debug_sparse( $data ); } else { $this->view->addNewShow = true; $this->view->form = $this->view->render( 'schedule/add-show-form.phtml'); Logging::debug("Show creation failed"); - Logging::debug_sparse( $data ); } } diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index bc1cdccbb..e1e2382aa 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -133,7 +133,8 @@ class Application_Model_ShowBuilder */ private function getScheduledStatus($p_epochItemStart, $p_epochItemEnd, &$row) { - if ($row["footer"] === true && $this->epoch_now > $p_epochItemStart && $this->epoch_now > $p_epochItemEnd) { + if ($row["footer"] === true && $this->epoch_now > $p_epochItemStart && + $this->epoch_now > $p_epochItemEnd) { $row["scheduled"] = 0; } elseif ($row["footer"] === true && $this->epoch_now < $p_epochItemEnd) { $row["scheduled"] = 2; From e00ff6367d3cb2b260f01a6436b68e0066504f98 Mon Sep 17 00:00:00 2001 From: denise Date: Tue, 18 Sep 2012 11:22:37 -0400 Subject: [PATCH 09/15] CC-4458: Now Playing -> "+ Add to current playlist text" might be replaced by something more appropriate -fixed --- .../airtime/library/events/library_playlistbuilder.js | 11 +++++++++++ .../js/airtime/library/events/library_showbuilder.js | 2 ++ airtime_mvc/public/js/airtime/library/library.js | 7 ++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js index 92f0bcdbd..751024e24 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_playlistbuilder.js @@ -20,6 +20,17 @@ var AIRTIME = (function(AIRTIME) { } else { AIRTIME.button.disableButton("btn-group #library-plus", false); } + + var objType = $('#obj_type').val(), + btnText; + if (objType === 'playlist') { + btnText = ' Add to current playlist'; + } else if (objType === 'block') { + btnText = ' Add to current smart block'; + } else { + btnText = ' Add to current playlist'; + } + AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), btnText); }; mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) { diff --git a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js index cf67419cd..67151e869 100644 --- a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js +++ b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js @@ -20,6 +20,8 @@ var AIRTIME = (function(AIRTIME) { } else { AIRTIME.button.disableButton("btn-group #library-plus", false); } + + AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), ' Add to selected show'); }; mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) { diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 70bf2744b..e5cae78e0 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -98,6 +98,10 @@ var AIRTIME = (function(AIRTIME) { return count; }; + mod.changeAddButtonText = function($button, btnText) { + $button.text(btnText); + } + mod.createToolbarButtons = function() { $menu = $("
"); $menu @@ -113,7 +117,8 @@ var AIRTIME = (function(AIRTIME) { "
") .append("
" + "" + "
") .append("
" + From 81887b291a837eecd804fb993b066df0bf69795d Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 11:39:28 -0400 Subject: [PATCH 10/15] cc-4129: Changed unused organization to label --- python_apps/media-monitor2/media/monitor/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/media-monitor2/media/monitor/metadata.py b/python_apps/media-monitor2/media/monitor/metadata.py index 0fc278e9e..8a56d51e1 100644 --- a/python_apps/media-monitor2/media/monitor/metadata.py +++ b/python_apps/media-monitor2/media/monitor/metadata.py @@ -32,7 +32,7 @@ airtime2mutagen = { "MDATA_KEY_MOOD" : "mood", "MDATA_KEY_TRACKNUMBER" : "tracknumber", "MDATA_KEY_BPM" : "bpm", - "MDATA_KEY_LABEL" : "organization", + "MDATA_KEY_LABEL" : "label", "MDATA_KEY_COMPOSER" : "composer", "MDATA_KEY_ENCODER" : "encodedby", "MDATA_KEY_CONDUCTOR" : "conductor", From 018b50d316125903c03b8551265df517de87eb8d Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 11:45:10 -0400 Subject: [PATCH 11/15] added better logging --- airtime_mvc/application/controllers/AudiopreviewController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/AudiopreviewController.php b/airtime_mvc/application/controllers/AudiopreviewController.php index c66539c37..d81e00030 100644 --- a/airtime_mvc/application/controllers/AudiopreviewController.php +++ b/airtime_mvc/application/controllers/AudiopreviewController.php @@ -55,7 +55,7 @@ class AudiopreviewController extends Zend_Controller_Action $uri = $webstream->getDbUrl(); $mime = $webstream->getDbMime(); } else { - throw new Exception("Unknown type for audio preview!"); + throw new Exception("Unknown type for audio preview!.Type=$type"); } $this->view->uri = $uri; From 6fc0d50c9fd5cb50162975821e6bcc61615f1bff Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 11:46:35 -0400 Subject: [PATCH 12/15] lined up --- .../controllers/AudiopreviewController.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/airtime_mvc/application/controllers/AudiopreviewController.php b/airtime_mvc/application/controllers/AudiopreviewController.php index d81e00030..bd7505595 100644 --- a/airtime_mvc/application/controllers/AudiopreviewController.php +++ b/airtime_mvc/application/controllers/AudiopreviewController.php @@ -21,9 +21,9 @@ class AudiopreviewController extends Zend_Controller_Action { global $CC_CONFIG; - $audioFileID = $this->_getParam('audioFileID'); + $audioFileID = $this->_getParam('audioFileID'); $audioFileArtist = $this->_getParam('audioFileArtist'); - $audioFileTitle = $this->_getParam('audioFileTitle'); + $audioFileTitle = $this->_getParam('audioFileTitle'); $type = $this->_getParam('type'); $request = $this->getRequest(); @@ -47,23 +47,23 @@ class AudiopreviewController extends Zend_Controller_Action } if ($type == "audioclip") { - $uri = "/api/get-media/file/".$audioFileID; + $uri = "/api/get-media/file/".$audioFileID; $media = Application_Model_StoredFile::Recall($audioFileID); - $mime = $media->getPropelOrm()->getDbMime(); + $mime = $media->getPropelOrm()->getDbMime(); } elseif ($type == "stream") { $webstream = CcWebstreamQuery::create()->findPk($audioFileID); - $uri = $webstream->getDbUrl(); - $mime = $webstream->getDbMime(); + $uri = $webstream->getDbUrl(); + $mime = $webstream->getDbMime(); } else { throw new Exception("Unknown type for audio preview!.Type=$type"); } - $this->view->uri = $uri; - $this->view->mime = $mime; - $this->view->audioFileID = $audioFileID; + $this->view->uri = $uri; + $this->view->mime = $mime; + $this->view->audioFileID = $audioFileID; $this->view->audioFileArtist = $audioFileArtist; - $this->view->audioFileTitle = $audioFileTitle; - $this->view->type = $type; + $this->view->audioFileTitle = $audioFileTitle; + $this->view->type = $type; $this->_helper->viewRenderer->setRender('audio-preview'); } From 8657a804595b826d0664f60cc2647369319cad3e Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 11:51:13 -0400 Subject: [PATCH 13/15] removed return '' --- airtime_mvc/application/models/StoredFile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 420510953..6c8c5d992 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -407,7 +407,7 @@ SQL; */ public function getFileExtension() { - return ""; + //return ""; // TODO : what's the point of having this function? Can we not just use // the extension from the file_path column from cc_files? $mime = $this->_file->getDbMime(); From bc873a3ece825fc36c45ed5bccd1e993d7af4bb6 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 12:04:54 -0400 Subject: [PATCH 14/15] Added extension handling for file path --- airtime_mvc/application/models/StoredFile.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 6c8c5d992..e31e6fd4e 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -399,6 +399,17 @@ SQL; $this->_file->save(); } + + public function getRealFileExtension() { + $path = $this->_file->getDbFilepath(); + $path_elements = explode('.', $path); + if (count($path_elements) < 2) { + return ""; + } else { + return $path_elements[count($path_elements) - 1]; + } + } + /** * Return suitable extension. * @@ -407,9 +418,13 @@ SQL; */ public function getFileExtension() { - //return ""; // TODO : what's the point of having this function? Can we not just use // the extension from the file_path column from cc_files? + $possible_ext = $this->getRealFileExtension(); + if ($possible_ext !== "") { + return $possible_ext; + } + $mime = $this->_file->getDbMime(); if ($mime == "audio/ogg" || $mime == "application/ogg") { From f9319b869afd8711222108d3973cb8c0856c4df9 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 18 Sep 2012 12:08:30 -0400 Subject: [PATCH 15/15] Corrected comments --- airtime_mvc/application/models/StoredFile.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index e31e6fd4e..dd945d328 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -418,13 +418,15 @@ SQL; */ public function getFileExtension() { - // TODO : what's the point of having this function? Can we not just use - // the extension from the file_path column from cc_files? $possible_ext = $this->getRealFileExtension(); if ($possible_ext !== "") { return $possible_ext; } + + // We fallback to guessing the extension from the mimetype if we + // cannot extract it from the file name + $mime = $this->_file->getDbMime(); if ($mime == "audio/ogg" || $mime == "application/ogg") {