From db52f1cfcf28fa187ce434e5cd99848f1e7e8f63 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 17 Sep 2012 17:47:32 -0400 Subject: [PATCH 1/8] CC-4383: Fatal error in phone_home_stat script (2.2.0 dev) - fixed --- utils/phone_home_stat.php | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/utils/phone_home_stat.php b/utils/phone_home_stat.php index d01a736c1..47929f5f7 100644 --- a/utils/phone_home_stat.php +++ b/utils/phone_home_stat.php @@ -35,23 +35,21 @@ get_include_path(), realpath($CC_CONFIG['phpDir'] . '/library') ))); -function __autoload($classname){ +function my_autoload($classname){ global $CC_CONFIG; $info = explode('_', $classname); - if (isset($info[2])) { + if (isset($info[1]) && isset($info[2])) { $filename = $info[2].".php"; - require_once($CC_CONFIG['phpDir'].'/application/models/'.$filename); + if ($info[1] == "Model") { + $folderName = "models"; + } else if ($info[1] == "Common") { + $folderName = "common"; + } + require_once($CC_CONFIG['phpDir'].'/application/'.$folderName.'/'.$filename); } } -require_once($CC_CONFIG['phpDir'].'/application/models/User.php'); -require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php'); -require_once($CC_CONFIG['phpDir'].'/application/models/Playlist.php'); -require_once($CC_CONFIG['phpDir'].'/application/models/Schedule.php'); -require_once($CC_CONFIG['phpDir'].'/application/models/Show.php'); -require_once($CC_CONFIG['phpDir'].'/application/models/ShowInstance.php'); -require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php'); -require_once($CC_CONFIG['phpDir'].'/application/models/StreamSetting.php'); -require_once($CC_CONFIG['phpDir'].'/application/models/LiveLog.php'); + +spl_autoload_register('my_autoload'); require_once 'propel/runtime/lib/Propel.php'; Propel::init($CC_CONFIG['phpDir']."/application/configs/airtime-conf-production.php"); @@ -64,20 +62,7 @@ if (file_exists('/usr/share/php/libzend-framework-php')){ require_once('Zend/Loader/Autoloader.php'); $autoloader = Zend_Loader_Autoloader::getInstance(); -try { - $opts = new Zend_Console_Getopt( - array( - 'test|t' => "Keep broadcast log data\n" - ) - ); - $opts->parse(); -} -catch (Zend_Console_Getopt_Exception $e) { - print $e->getMessage() .PHP_EOL; - exit(1); -} - -$infoArray = Application_Model_Preference::GetSystemInfo(true, isset($opts->t)); +$infoArray = Application_Model_Preference::GetSystemInfo(true); if(Application_Model_Preference::GetSupportFeedback() == '1'){ $url = 'http://stat.sourcefabric.org/index.php?p=airtime'; From ff22b80dfc2bfa4cb8cdf474ec66cd21d51e67c5 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 17 Sep 2012 17:49:16 -0400 Subject: [PATCH 2/8] formatting --- .../application/models/ShowBuilder.php | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index d708681ca..80a5329a0 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -23,26 +23,26 @@ class Application_Model_ShowBuilder private $showInstances = array(); private $defaultRowArray = array( - "header" => false, - "footer" => false, - "empty" => false, - "allowed" => false, - "id" => 0, - "instance" => "", - "starts" => "", - "ends" => "", - "runtime" => "", - "title" => "", - "creator" => "", - "album" => "", - "timestamp" => null, - "cuein" => "", - "cueout" => "", - "fadein" => "", - "fadeout" => "", - "image" => false, - "color" => "", //in hex without the '#' sign. - "backgroundColor"=> "", //in hex without the '#' sign. + "header" => false, + "footer" => false, + "empty" => false, + "allowed" => false, + "id" => 0, + "instance" => "", + "starts" => "", + "ends" => "", + "runtime" => "", + "title" => "", + "creator" => "", + "album" => "", + "timestamp" => null, + "cuein" => "", + "cueout" => "", + "fadein" => "", + "fadeout" => "", + "image" => false, + "color" => "", //in hex without the '#' sign. + "backgroundColor" => "", //in hex without the '#' sign. ); /* From 69756f60ca10290395aa6af4f2911baf3dabca41 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 17 Sep 2012 17:49:25 -0400 Subject: [PATCH 3/8] formatting --- airtime_mvc/application/models/ShowBuilder.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index 80a5329a0..184b58cad 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -51,12 +51,12 @@ class Application_Model_ShowBuilder */ public function __construct($p_startDT, $p_endDT, $p_opts) { - $this->startDT = $p_startDT; - $this->endDT = $p_endDT; - $this->timezone = date_default_timezone_get(); - $this->user = Application_Model_User::getCurrentUser(); - $this->opts = $p_opts; - $this->epoch_now = floatval(microtime(true)); + $this->startDT = $p_startDT; + $this->endDT = $p_endDT; + $this->timezone = date_default_timezone_get(); + $this->user = Application_Model_User::getCurrentUser(); + $this->opts = $p_opts; + $this->epoch_now = floatval(microtime(true)); $this->currentShow = false; } From 095a5cce4f6bc9ed3a9332a139a872089ec43031 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 17 Sep 2012 17:51:50 -0400 Subject: [PATCH 4/8] Added better debugging --- airtime_mvc/application/models/ShowBuilder.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index 184b58cad..178533199 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -129,6 +129,7 @@ class Application_Model_ShowBuilder * 0 = past * 1 = current * 2 = future + * TODO : change all of the above to real constants -- RG */ private function getScheduledStatus($p_epochItemStart, $p_epochItemEnd, &$row) { @@ -157,6 +158,14 @@ class Application_Model_ShowBuilder //item is in the future. else if ($this->epoch_now < $p_epochItemStart) { $row["scheduled"] = 2; + } else { + Logging::warn("No-op? is this what should happen...printing + debug just in case"); + $d = array( + '$p_epochItemStart' => $p_epochItemStart, + '$p_epochItemEnd' => $p_epochItemEnd, + '$row' => $row); + Logging::warn($d); } } From 53c6d77821e0ff45cca229927c5dbc52eaff3db3 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 17 Sep 2012 17:52:56 -0400 Subject: [PATCH 5/8] Formatting --- .../application/models/ShowBuilder.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index 178533199..924aad2cd 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -250,32 +250,32 @@ class Application_Model_ShowBuilder $this->getItemStatus($p_item, $row); - $startsEpoch = floatval($schedStartDT->format("U.u")); - $endsEpoch = floatval($schedEndDT->format("U.u")); + $startsEpoch = floatval($schedStartDT->format("U.u")); + $endsEpoch = floatval($schedEndDT->format("U.u")); $showEndEpoch = floatval($showEndDT->format("U.u")); //don't want an overbooked item to stay marked as current. $this->getScheduledStatus($startsEpoch, min($endsEpoch, $showEndEpoch), $row); - $row["id"] = intval($p_item["sched_id"]); - $row["image"] = $p_item["file_exists"]; + $row["id"] = intval($p_item["sched_id"]); + $row["image"] = $p_item["file_exists"]; $row["instance"] = intval($p_item["si_id"]); - $row["starts"] = $schedStartDT->format("H:i:s"); - $row["ends"] = $schedEndDT->format("H:i:s"); + $row["starts"] = $schedStartDT->format("H:i:s"); + $row["ends"] = $schedEndDT->format("H:i:s"); - $formatter = new LengthFormatter($p_item['file_length']); - $row['runtime'] = $formatter->format(); + $formatter = new LengthFormatter($p_item['file_length']); + $row['runtime'] = $formatter->format(); - $row["title"] = $p_item["file_track_title"]; - $row["creator"] = $p_item["file_artist_name"]; - $row["album"] = $p_item["file_album_title"]; + $row["title"] = $p_item["file_track_title"]; + $row["creator"] = $p_item["file_artist_name"]; + $row["album"] = $p_item["file_album_title"]; - $row["cuein"] = $p_item["cue_in"]; - $row["cueout"] = $p_item["cue_out"]; - $row["fadein"] = round(substr($p_item["fade_in"], 6), 6); - $row["fadeout"] = round(substr($p_item["fade_out"], 6), 6); + $row["cuein"] = $p_item["cue_in"]; + $row["cueout"] = $p_item["cue_out"]; + $row["fadein"] = round(substr($p_item["fade_in"], 6), 6); + $row["fadeout"] = round(substr($p_item["fade_out"], 6), 6); - $row["pos"] = $this->pos++; + $row["pos"] = $this->pos++; $this->contentDT = $schedEndDT; } From 542c5c857f8092d04c72aa13b0d25cb865a2b461 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 17 Sep 2012 17:54:10 -0400 Subject: [PATCH 6/8] alignment --- airtime_mvc/application/models/ShowBuilder.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index 924aad2cd..869e3f2d8 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -91,7 +91,7 @@ class Application_Model_ShowBuilder private function getItemColor($p_item, &$row) { - $defaultColor = "ffffff"; + $defaultColor = "ffffff"; $defaultBackground = "3366cc"; $color = $p_item["show_color"]; @@ -103,7 +103,7 @@ class Application_Model_ShowBuilder $backgroundColor = $defaultBackground; } - $row["color"] = $color; + $row["color"] = $color; $row["backgroundColor"] = $backgroundColor; } @@ -281,19 +281,19 @@ class Application_Model_ShowBuilder } //show is empty or is a special kind of show (recording etc) else if (intval($p_item["si_record"]) === 1) { - $row["record"] = true; + $row["record"] = true; $row["instance"] = intval($p_item["si_id"]); - $showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC")); - $showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC")); + $showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC")); + $showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC")); - $startsEpoch = floatval($showStartDT->format("U.u")); - $endsEpoch = floatval($showEndDT->format("U.u")); + $startsEpoch = floatval($showStartDT->format("U.u")); + $endsEpoch = floatval($showEndDT->format("U.u")); $this->getScheduledStatus($startsEpoch, $endsEpoch, $row); } else { - $row["empty"] = true; - $row["id"] = 0 ; + $row["empty"] = true; + $row["id"] = 0 ; $row["instance"] = intval($p_item["si_id"]); } From 81a015dfac8250cab91a00fc2cf5075058e55915 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 17 Sep 2012 17:56:33 -0400 Subject: [PATCH 7/8] CC-4460: Differences between upgraded and fresh installed Airtime database - done --- install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql b/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql index 3b6bfbec6..4f5cc398f 100644 --- a/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql +++ b/install_minimal/upgrades/airtime-2.2.0/data/upgrade.sql @@ -101,6 +101,7 @@ CREATE TABLE cc_webstream ( creator_id integer NOT NULL, mtime timestamp(6) without time zone NOT NULL, utime timestamp(6) without time zone NOT NULL, + lptime timestamp(6) without time zone, mime character varying(255) ); @@ -113,10 +114,13 @@ CREATE TABLE cc_webstream_metadata ( ALTER TABLE cc_files DROP COLUMN gunid, - ADD COLUMN replay_gain character varying(16), + ADD COLUMN replay_gain numeric, ADD COLUMN owner_id integer, ALTER COLUMN bpm TYPE integer using airtime_to_int(bpm) /* TYPE change - table: cc_files original: character varying(8) new: integer */; +ALTER TABLE cc_files + ADD CONSTRAINT cc_files_owner_fkey FOREIGN KEY (owner_id) REFERENCES cc_subjs(id); + ALTER TABLE cc_playlistcontents ADD COLUMN block_id integer, ADD COLUMN stream_id integer, From bb3ffce071772baba8a45c39e3882970d0bd8385 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Mon, 17 Sep 2012 16:28:28 -0700 Subject: [PATCH 8/8] CC-3944 : Now Playing -> Time Line view: Cannot cancel record show, cancel button is disabled --- .../application/models/ShowBuilder.php | 4 ++++ .../public/js/airtime/showbuilder/builder.js | 19 ++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php index b73a341d0..d77fbf823 100644 --- a/airtime_mvc/application/models/ShowBuilder.php +++ b/airtime_mvc/application/models/ShowBuilder.php @@ -332,6 +332,10 @@ class Application_Model_ShowBuilder $this->getScheduledStatus($startsEpoch, $endsEpoch, $row); $this->isAllowed($p_item, $row); + if (intval($p_item["si_record"]) === 1) { + $row["record"] = true; + } + return $row; } diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js index 26c472ec0..1282e6ca5 100644 --- a/airtime_mvc/public/js/airtime/showbuilder/builder.js +++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js @@ -112,16 +112,25 @@ var AIRTIME = (function(AIRTIME){ }; mod.checkCancelButton = function() { - var $current = $sbTable.find(".sb-current-show.sb-allowed"), + + var $current = $sbTable.find(".sb-current-show"), //this user type should be refactored into a separate users module later //when there's more time and more JS will need to know user data. - userType = localStorage.getItem('user-type'); + userType = localStorage.getItem('user-type'), + canCancel = false; - if ($current.length !== 0 && (userType === 'A' || userType === 'P')) { - AIRTIME.button.enableButton("icon-ban-circle", true); + if ($current.length !== 0 && $current.hasClass("sb-allowed")) { + canCancel = true; + } + else if ($current.length !== 0 && (userType === 'A' || userType === 'P')) { + canCancel = true; + } + + if (canCancel === true) { + AIRTIME.button.enableButton("icon-ban-circle", true); } else { - AIRTIME.button.disableButton("icon-ban-circle", true); + AIRTIME.button.disableButton("icon-ban-circle", true); } };