From 1873022a132fd66c8cee530ea3a17fb02f91dd6d Mon Sep 17 00:00:00 2001
From: denise <denise@denise-DX4860sourcefabric.org>
Date: Fri, 25 Jan 2013 11:21:34 -0500
Subject: [PATCH 1/3] CC-4876: Default interface language setting does not
 appear to affect text or drop-down menu on login page?

-fixed
---
 airtime_mvc/application/controllers/LocaleController.php   | 6 +-----
 airtime_mvc/application/controllers/plugins/Acl_plugin.php | 2 +-
 airtime_mvc/public/js/airtime/login/login.js               | 2 +-
 airtime_mvc/public/js/airtime/preferences/preferences.js   | 1 +
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/airtime_mvc/application/controllers/LocaleController.php b/airtime_mvc/application/controllers/LocaleController.php
index d689417be..efdecff80 100644
--- a/airtime_mvc/application/controllers/LocaleController.php
+++ b/airtime_mvc/application/controllers/LocaleController.php
@@ -4,10 +4,6 @@ class LocaleController extends Zend_Controller_Action
 {
     public function init()
     {
-        $ajaxContext = $this->_helper->getHelper("AjaxContext");
-        $ajaxContext->addActionContext("general-translation-table", "json")
-                    ->addActionContext("datatables-translation-table", "json")
-                    ->initContext();
     }
 
     public function datatablesTranslationTableAction()
@@ -26,7 +22,7 @@ class LocaleController extends Zend_Controller_Action
                 $locale.".txt")
             );
     }
-    
+
     public function generalTranslationTableAction()
     {
         $translations = array (
diff --git a/airtime_mvc/application/controllers/plugins/Acl_plugin.php b/airtime_mvc/application/controllers/plugins/Acl_plugin.php
index 4cadba9db..44555e533 100644
--- a/airtime_mvc/application/controllers/plugins/Acl_plugin.php
+++ b/airtime_mvc/application/controllers/plugins/Acl_plugin.php
@@ -110,7 +110,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
     {
         $controller = strtolower($request->getControllerName());
 
-        if (in_array($controller, array("api", "auth"))) {
+        if (in_array($controller, array("api", "auth", "locale"))) {
 
             $this->setRoleName("G");
         } elseif (!Zend_Auth::getInstance()->hasIdentity()) {
diff --git a/airtime_mvc/public/js/airtime/login/login.js b/airtime_mvc/public/js/airtime/login/login.js
index a37210b35..f21043c31 100644
--- a/airtime_mvc/public/js/airtime/login/login.js
+++ b/airtime_mvc/public/js/airtime/login/login.js
@@ -1,6 +1,6 @@
 $(window).load(function(){
     $("#username").focus();
-    $("#locale").val($.cookie("airtime_locale")!== null?$.cookie("airtime_locale"):'en_CA');
+    $("#locale").val($.cookie("airtime_locale")!== null?$.cookie("airtime_locale"):$.cookie("default_airtime_locale"));
 });
 
 $(document).ready(function() {
diff --git a/airtime_mvc/public/js/airtime/preferences/preferences.js b/airtime_mvc/public/js/airtime/preferences/preferences.js
index 1d529617d..eec5e1c7e 100644
--- a/airtime_mvc/public/js/airtime/preferences/preferences.js
+++ b/airtime_mvc/public/js/airtime/preferences/preferences.js
@@ -111,6 +111,7 @@ $(document).ready(function() {
         $.post(url, {format: "json", data: data}, function(data){
             var json = $.parseJSON(data);
             $('#content').empty().append(json.html);
+            $.cookie("default_airtime_locale", $('#locale').val(), {path: '/'});
             setTimeout(removeSuccessMsg, 5000);
             showErrorSections();
         });

From 0cf8526f87df1d9b3d2dc0b98d559ae233cee1b9 Mon Sep 17 00:00:00 2001
From: denise <denise@denise-DX4860sourcefabric.org>
Date: Fri, 25 Jan 2013 11:51:56 -0500
Subject: [PATCH 2/3] CC-4878"Send support feedback" button at initial login
 tries to load "http://showbuilder" and was missing the local host IP.

-fixed
---
 airtime_mvc/application/forms/RegisterAirtime.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/airtime_mvc/application/forms/RegisterAirtime.php b/airtime_mvc/application/forms/RegisterAirtime.php
index d1557612a..2da7083c8 100644
--- a/airtime_mvc/application/forms/RegisterAirtime.php
+++ b/airtime_mvc/application/forms/RegisterAirtime.php
@@ -7,7 +7,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
 
     public function init()
     {
-        $this->setAction(Application_Common_OsPath::getBaseDir().'/Showbuilder');
+        $this->setAction(Application_Common_OsPath::getBaseDir().'Showbuilder');
         $this->setMethod('post');
 
         $country_list = Application_Model_Preference::GetCountryList();

From 21a04803e576fa5dc746dc635c239636a911aff5 Mon Sep 17 00:00:00 2001
From: Martin Konecny <martin.konecny@gmail.com>
Date: Fri, 25 Jan 2013 12:11:50 -0500
Subject: [PATCH 3/3] Fix Pypo giving up too early on attempting to receive
 schedule

---
 python_apps/pypo/pypofetch.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py
index ec3ef11ce..b690ace04 100644
--- a/python_apps/pypo/pypofetch.py
+++ b/python_apps/pypo/pypofetch.py
@@ -217,7 +217,7 @@ class PypoFetch(Thread):
             self.set_bootstrap_variables()
             #get the most up to date schedule, which will #initiate the process
             #of making sure Liquidsoap is playing the schedule
-            self.manual_schedule_fetch()
+            self.persistent_manual_schedule_fetch(max_attempts=5)
         except Exception, e:
             self.logger.error(str(e))
 
@@ -488,10 +488,20 @@ class PypoFetch(Thread):
             self.process_schedule(self.schedule_data)
         return success
 
+    def persistent_manual_schedule_fetch(self, max_attempts=1):
+        success = False
+        num_attempts = 0
+        while not success and num_attempts < max_attempts:
+            success = self.manual_schedule_fetch()
+            num_attempts += 1
+
+        return success
+
+
     def main(self):
         # Bootstrap: since we are just starting up, we need to grab the
         # most recent schedule.  After that we can just wait for updates.
-        success = self.manual_schedule_fetch()
+        success = self.persistent_manual_schedule_fetch(max_attempts=5)
         if success:
             self.logger.info("Bootstrap schedule received: %s", self.schedule_data)
             self.set_bootstrap_variables()
@@ -519,7 +529,7 @@ class PypoFetch(Thread):
                 self.handle_message(message)
             except Empty, e:
                 self.logger.info("Queue timeout. Fetching schedule manually")
-                self.manual_schedule_fetch()
+                self.persistent_manual_schedule_fetch(max_attempts=5)
             except Exception, e:
                 import traceback
                 top = traceback.format_exc()