From ca2a535b24a5641538c277c4427364b83b9d1517 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 14 Oct 2011 14:25:28 +0200 Subject: [PATCH 1/8] CC-2908: Add "Live Stream" title to live stream popup window -fixed logo size being too big. --- .../application/views/scripts/dashboard/stream-player.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml b/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml index 21e9d9a30..7b9d6a796 100644 --- a/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml +++ b/airtime_mvc/application/views/scripts/dashboard/stream-player.phtml @@ -42,7 +42,7 @@ $(document).ready(function(){ ?> }); - +
From e3093b98a53cd9caf3d04ea3d1decaf4a062972f Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Fri, 14 Oct 2011 14:26:10 +0200 Subject: [PATCH 2/8] CC-2870: Create testing infrastructure for testing upgrades -shuffle and rename some functions --- dev_tools/fabric/fab_setup.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dev_tools/fabric/fab_setup.py b/dev_tools/fabric/fab_setup.py index 8dbe87bda..45b428f5a 100644 --- a/dev_tools/fabric/fab_setup.py +++ b/dev_tools/fabric/fab_setup.py @@ -126,7 +126,12 @@ def airtime_182_tar(): reboot(45) sudo('airtime-check-system') -def airtime_182_deb(): +def airtime_194_tar(): + run('wget http://downloads.sourceforge.net/project/airtime/1.9.4/airtime-1.9.4.tar.gz') + run('tar xfz airtime-1.9.4.tar.gz') + sudo('cd ~/airtime-1.9.4/install_full/ubuntu && ./airtime-full-install') + +def airtime_latest_deb(): append('/etc/apt/sources.list', "deb http://apt.sourcefabric.org/ lucid main", use_sudo=True) append('/etc/apt/sources.list', "deb http://archive.ubuntu.com/ubuntu/ lucid multiverse", use_sudo=True) sudo('apt-get update') @@ -135,11 +140,6 @@ def airtime_182_deb(): sudo('apt-get install -y icecast2') sudo('apt-get purge -y pulseaudio') sudo('apt-get install -y --force-yes airtime') - -def airtime_194_tar(): - run('wget http://downloads.sourceforge.net/project/airtime/1.9.4/airtime-1.9.4.tar.gz') - run('tar xfz airtime-1.9.4.tar.gz') - sudo('cd ~/airtime-1.9.4/install_full/ubuntu && ./airtime-full-install') def airtime_devel(): sudo('apt-get update') From 7548abc1b1a79dcedc641664cb95bf4cb93d9c6f Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 17 Oct 2011 13:36:16 +0200 Subject: [PATCH 3/8] -fix undefined function error --- airtime_mvc/application/models/StoredFile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 238fdd69e..caa6abc52 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -443,7 +443,7 @@ class StoredFile { $serverName = $_SERVER['SERVER_NAME']; $serverPort = $_SERVER['SERVER_PORT']; - return constructGetFileUrl($serverName, $serverPort); + return $this->constructGetFileUrl($serverName, $serverPort); } /** @@ -456,7 +456,7 @@ class StoredFile { $serverName = $CC_CONFIG['baseUrl']; $serverPort = $CC_CONFIG['basePort']; - return constructGetFileUrl($serverName, $serverPort); + return $this->constructGetFileUrl($serverName, $serverPort); } private function constructGetFileUrl($p_serverName, $p_serverPort){ From 8d3c6192d7261d780342e9b62d1d4b0c875a4028 Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Mon, 17 Oct 2011 14:24:33 -0400 Subject: [PATCH 4/8] CC2646: Set a calendar view default (Day/week/month) that's remembered In my last commit, left out the "var" keyword in a piece of code --- airtime_mvc/public/js/airtime/schedule/schedule.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index 5ac30358b..61a6e085c 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -347,7 +347,7 @@ function createFullCalendar(data){ //Update time scale preference when day/week/month button is clicked $(".fc-button-content").click(function() { - url = '/Schedule/set-time-scale/format/json'; + var url = '/Schedule/set-time-scale/format/json'; $.post(url, {timeScale: $(this).text()}, function(json){ if(json.error) { From d2fe46baf0e5a45e3a93f65248a372883afb9418 Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Tue, 18 Oct 2011 10:10:35 -0400 Subject: [PATCH 5/8] CC-2436: Save pulldown settings For week and day views under Calendar page, save the change to pref db table when user updates the interval dropdown. Same thing goes for the "show XXX entries" dropdown found under Playlist Builder page. When visiting these pages, we retrieves the entry from database for current user and use those values. Defaults to 30m for interval and 10 entries for "show xxx entries" if values were never set. --- .../application/controllers/ApiController.php | 28 +++++++++++-- .../controllers/LibraryController.php | 11 +++++ .../controllers/ScheduleController.php | 9 ++++ airtime_mvc/application/models/Preference.php | 32 +++++++++++++++ .../public/js/airtime/library/library.js | 41 ++++++++++++++++--- .../public/js/airtime/schedule/schedule.js | 23 +++++++++++ 6 files changed, 135 insertions(+), 9 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 74c324ee9..82602021f 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -25,6 +25,7 @@ class ApiController extends Zend_Controller_Action ->addActionContext('register-component', 'json') ->addActionContext('update-liquidsoap-error', 'json') ->addActionContext('update-liquidsoap-connection', 'json') + ->addActionContext('library-init', 'json') ->initContext(); } @@ -77,9 +78,10 @@ class ApiController extends Zend_Controller_Action } $this->view->calendarInit = array( - "timestamp"=>time(), - "timezoneOffset"=> date("Z"), - "timeScale"=>Application_Model_Preference::GetCalendarTimeScale() + "timestamp" => time(), + "timezoneOffset" => date("Z"), + "timeScale" => Application_Model_Preference::GetCalendarTimeScale(), + "timeInterval" => Application_Model_Preference::GetCalendarTimeInterval() ); } @@ -731,5 +733,25 @@ class ApiController extends Zend_Controller_Action // setting error_msg as "" when there is no error_msg Application_Model_StreamSetting::setLiquidsoapError($stream_id, ""); } + + /** + * Sets up and send init values used in the Library. + * This is being used by library.js + */ + public function libraryInitAction(){ + $this->view->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + + if(is_null(Zend_Auth::getInstance()->getStorage()->read())) { + header('HTTP/1.0 401 Unauthorized'); + print 'You are not allowed to access this resource.'; + return; + } + + $this->view->libraryInit = array( + "numEntries"=>Application_Model_Preference::GetLibraryNumEntries() + ); + + } } diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index c959c66f5..0f61c406f 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -15,6 +15,7 @@ class LibraryController extends Zend_Controller_Action ->addActionContext('get-file-meta-data', 'html') ->addActionContext('upload-file-soundcloud', 'json') ->addActionContext('get-upload-to-soundcloud-status', 'json') + ->addActionContext('set-num-entries', 'json') ->initContext(); $this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME); @@ -269,4 +270,14 @@ class LibraryController extends Zend_Controller_Action $this->view->error_msg = $file->getSoundCloudErrorMsg(); } } + + /** + * Stores the number of entries user chose to show in the Library + * to the pref db + */ + public function setNumEntriesAction() { + $request = $this->getRequest(); + $numEntries = $request->getParam('numEntries'); + Application_Model_Preference::SetLibraryNumEntries($numEntries); + } } diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 716051390..6e8e445fa 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -29,6 +29,7 @@ class ScheduleController extends Zend_Controller_Action ->addActionContext('upload-to-sound-cloud', 'json') ->addActionContext('content-context-menu', 'json') ->addActionContext('set-time-scale', 'json') + ->addActionContext('set-time-interval', 'json') ->initContext(); $this->sched_sess = new Zend_Session_Namespace("schedule"); @@ -737,6 +738,14 @@ class ScheduleController extends Zend_Controller_Action public function setTimeScaleAction() { Application_Model_Preference::SetCalendarTimeScale($this->_getParam('timeScale')); } + +/** + * Sets the user specific preference for which time interval to use in Calendar. + * This is only being used by schedule.js at the moment. + */ + public function setTimeIntervalAction() { + Application_Model_Preference::SetCalendarTimeInterval($this->_getParam('timeInterval')); + } } diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index e58dafb5f..7e7ab9334 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -501,5 +501,37 @@ class Application_Model_Preference public static function GetCalendarTimeScale() { return self::GetValue("calendar_time_scale", true /* user specific */); } + + /** + * Sets the number of entries to show preference in library under Playlist Builder. + * + * @param $numEntries new number of entries to show + */ + public static function SetLibraryNumEntries($numEntries) { + return self::SetValue("library_num_entries", $numEntries, true /* user specific */); + } + + /** + * Retrieves the number of entries to show preference in library under Playlist Builder. + */ + public static function GetLibraryNumEntries() { + return self::GetValue("library_num_entries", true /* user specific */); + } + + /** + * Sets the time interval preference in Calendar. + * + * @param $timeInterval new time interval + */ + public static function SetCalendarTimeInterval($timeInterval) { + return self::SetValue("calendar_time_interval", $timeInterval, true /* user specific */); + } + + /** + * Retrieves the time interval preference for the current user. + */ + public static function GetCalendarTimeInterval() { + return self::GetValue("calendar_time_interval", true /* user specific */); + } } diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 6408e5c97..b63d3bf19 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -275,11 +275,20 @@ function addMetadataQtip(){ }) } -$(document).ready(function() { +/** + * Use user preference for number of entries to show; + * defaults to 10 if preference was never set + */ +function getNumEntriesPreference(data) { + var numEntries = data.libraryInit.numEntries; + if(numEntries == '') { + numEntries = '10'; + } + return parseInt(numEntries); +} - $('.tabs').tabs(); - - $('#library_display').dataTable( { +function createDataTable(data) { + var dTable = $('#library_display').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": "/Library/contents/format/json", @@ -309,8 +318,28 @@ $(document).ready(function() { "bAutoWidth": false, "oLanguage": { "sSearch": "" - } - }).fnSetFilteringDelay(350); + }, + "iDisplayLength": getNumEntriesPreference(data) + }); + dTable.fnSetFilteringDelay(350); + + // Updates pref db when user changes the # of entries to show + $('select[name=library_display_length]').change(function() { + var url = '/Library/set-num-entries/format/json'; + $.post(url, {numEntries: $(this).val()}, + function(json){ + if(json.error) { + alert(json.error); + } + }); + }); +} + +$(document).ready(function() { + $('.tabs').tabs(); + + $.ajax({ url: "/Api/library-init/format/json", dataType:"json", success:createDataTable + , error:function(jqXHR, textStatus, errorThrown){}}); checkImportStatus() setInterval( "checkImportStatus()", 5000 ); diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index 61a6e085c..3f3445b52 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -308,6 +308,17 @@ function getTimeScalePreference(data) { return timeScale; } +/** + * Use user preference for time interval; defaults to 30m if preference was never set + */ +function getTimeIntervalPreference(data) { + var timeInterval = data.calendarInit.timeInterval; + if(timeInterval == '') { + timeInterval = '30'; + } + return parseInt(timeInterval); +} + function createFullCalendar(data){ serverTimezoneOffset = data.calendarInit.timezoneOffset; @@ -321,6 +332,7 @@ function createFullCalendar(data){ right: 'agendaDay, agendaWeek, month' }, defaultView: getTimeScalePreference(data), + slotMinutes: getTimeIntervalPreference(data), editable: false, allDaySlot: false, axisFormat: 'H:mm', @@ -355,6 +367,17 @@ function createFullCalendar(data){ } }); }); + + //Update time interval preference when dropdown is updated + $(".schedule_change_slots.input_select").change(function() { + var url = '/Schedule/set-time-interval/format/json'; + $.post(url, {timeInterval: $(this).val()}, + function(json){ + if(json.error) { + alert(json.error); + } + }); + }); } $(window).load(function() { From 0989a1c13f3c83ffc01b24be0f480f880bb84eed Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Tue, 18 Oct 2011 10:24:01 -0400 Subject: [PATCH 6/8] CC-2073: Select Days checkboxes are confusing Increased the space between a checkbox and the label to its right. Should make it better to tell which checkbox belongs to which label. --- airtime_mvc/public/css/add-show.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/public/css/add-show.css b/airtime_mvc/public/css/add-show.css index fbd1c6be5..0dd479a3c 100644 --- a/airtime_mvc/public/css/add-show.css +++ b/airtime_mvc/public/css/add-show.css @@ -75,7 +75,7 @@ } label.wrapp-label input[type="checkbox"] { float:left; - margin:-1px 4px 0 0; + margin:-1px 2px 0 0; } #schedule-add-show fieldset:last-child { @@ -91,7 +91,7 @@ label.wrapp-label input[type="checkbox"] { #add_show_day_check-element.block-display label.wrapp-label { font-size:12px; float:left; - margin-right:5px; + margin-right:10px; } #add_show_name-element .input_text { /*width:99%;*/ From d9186a3bf230754e424ff58f6529ad4ae3c57c9f Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Wed, 19 Oct 2011 12:42:22 -0400 Subject: [PATCH 7/8] CC-2951: Allow users to select the starting day of the week Added system preference in Preference page for user to select the start day of a week (defaults to Sunday). Calendar will utilize this information and update the calendar UI accordingly. --- .../application/controllers/ApiController.php | 3 +- .../controllers/PreferenceController.php | 1 + .../application/forms/GeneralPreferences.php | 22 +++++++++++++- airtime_mvc/application/models/Preference.php | 17 +++++++++++ .../scripts/form/preferences_general.phtml | 29 ++++++++++++++++++- .../public/js/airtime/schedule/schedule.js | 1 + 6 files changed, 70 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 82602021f..b25ba74fb 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -81,7 +81,8 @@ class ApiController extends Zend_Controller_Action "timestamp" => time(), "timezoneOffset" => date("Z"), "timeScale" => Application_Model_Preference::GetCalendarTimeScale(), - "timeInterval" => Application_Model_Preference::GetCalendarTimeInterval() + "timeInterval" => Application_Model_Preference::GetCalendarTimeInterval(), + "weekStartDay" => Application_Model_Preference::GetWeekStartDay() ); } diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index cc9080e53..ece06790e 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -36,6 +36,7 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]); Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]); Application_Model_Preference::SetTimezone($values["preferences_general"]["timezone"]); + Application_Model_Preference::SetWeekStartDay($values["preferences_general"]["weekStartDay"]); Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]); Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]); diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index 7b0da1400..61b79dbc8 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -65,6 +65,14 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm $timezone->setValue(Application_Model_Preference::GetTimezone()); $timezone->setDecorators(array('ViewHelper')); $this->addElement($timezone); + + /* Form Element for setting which day is the start of the week */ + $week_start_day = new Zend_Form_Element_Select("weekStartDay"); + $week_start_day->setLabel("Week Starts On"); + $week_start_day->setMultiOptions($this->getWeekStartDays()); + $week_start_day->setValue(Application_Model_Preference::GetWeekStartDay()); + $week_start_day->setDecorators(array('ViewHelper')); + $this->addElement($week_start_day); } private function getTimezones(){ @@ -90,7 +98,19 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm return $tzlist; } + - + private function getWeekStartDays() { + $days = array( + 'Sunday', + 'Monday', + 'Tuesday', + 'Wednesday', + 'Thursday', + 'Friday', + 'Saturday' + ); + return $days; + } } diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 7e7ab9334..200b4448f 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -485,6 +485,21 @@ class Application_Model_Preference public static function GetSoundCloudDownloadbleOption() { return self::GetValue("soundcloud_downloadable"); } + + public static function SetWeekStartDay($day) { + self::SetValue("week_start_day", $day); + } + + public static function GetWeekStartDay() { + $val = self::GetValue("week_start_day"); + if (strlen($val) == 0){ + return "0"; + } else { + return $val; + } + } + + /* User specific preferences start */ /** * Sets the time scale preference (day/week/month) in Calendar. @@ -533,5 +548,7 @@ class Application_Model_Preference public static function GetCalendarTimeInterval() { return self::GetValue("calendar_time_interval", true /* user specific */); } + + /* User specific preferences end */ } diff --git a/airtime_mvc/application/views/scripts/form/preferences_general.phtml b/airtime_mvc/application/views/scripts/form/preferences_general.phtml index 3c11ced5b..f8d7b23f7 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_general.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_general.phtml @@ -72,7 +72,7 @@ - +
+ +
+
+ element->getElement('weekStartDay')->getValue(); + ?> + + + element->getElement('weekStartDay')->hasErrors()) : ?> +
    + element->getElement('weekStartDay')->getMessages() as $error): ?> +
  • + +
+ +
diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index 3f3445b52..5c7ee99f0 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -333,6 +333,7 @@ function createFullCalendar(data){ }, defaultView: getTimeScalePreference(data), slotMinutes: getTimeIntervalPreference(data), + firstDay: data.calendarInit.weekStartDay, editable: false, allDaySlot: false, axisFormat: 'H:mm', From 6237a199af2ac7791583722da8f7f3b6472e3ca9 Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Wed, 19 Oct 2011 14:01:51 -0400 Subject: [PATCH 8/8] CC-2968: Folder icons missing when choosing Import Folder Changed the path to the img resource. Icon shows up fine now. --- airtime_mvc/public/js/airtime/preferences/musicdirs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/public/js/airtime/preferences/musicdirs.js b/airtime_mvc/public/js/airtime/preferences/musicdirs.js index 44974d483..796baec96 100644 --- a/airtime_mvc/public/js/airtime/preferences/musicdirs.js +++ b/airtime_mvc/public/js/airtime/preferences/musicdirs.js @@ -13,7 +13,7 @@ function setWatchedDirEvents() { //knownPaths: [{text:'Desktop', image:'desktop.png', path:'/home'}], knownPaths: [], imageUrl: 'img/icons/', - systemImageUrl: 'img/browser/', + systemImageUrl: '/css/img/', handlerUrl: '/Preference/server-browse/format/json', title: 'Choose Storage Folder', basePath: '',