diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index 043983ede..bb39d2978 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -14,7 +14,7 @@ class LoginController extends Zend_Controller_Action if (Zend_Auth::getInstance()->hasIdentity()) { - $this->_redirect('Showbuilder'); + $this->_redirect('Showbuilder'); } //uses separate layout without a navigation. @@ -99,30 +99,35 @@ class LoginController extends Zend_Controller_Action } public function passwordRestoreAction() - { - //uses separate layout without a navigation. - $this->_helper->layout->setLayout('login'); - - $form = new Application_Form_PasswordRestore(); - - $request = $this->getRequest(); - if ($request->isPost() && $form->isValid($request->getPost())) { - $user = CcSubjsQuery::create() - ->filterByDbEmail($form->email->getValue()) - ->findOne(); - - if (!empty($user)) { - $auth = new Application_Model_Auth(); - - $auth->sendPasswordRestoreLink($user, $this->view); - $this->_helper->redirector('password-restore-after', 'login'); - } - else { - $form->email->addError($this->view->translate("Given email not found.")); - } + { + if (!Application_Model_Preference::GetEnableSystemEmail()) { + $this->_redirect('login'); } + else { + //uses separate layout without a navigation. + $this->_helper->layout->setLayout('login'); + + $form = new Application_Form_PasswordRestore(); - $this->view->form = $form; + $request = $this->getRequest(); + if ($request->isPost() && $form->isValid($request->getPost())) { + $user = CcSubjsQuery::create() + ->filterByDbEmail($form->email->getValue()) + ->findOne(); + + if (!empty($user)) { + $auth = new Application_Model_Auth(); + + $auth->sendPasswordRestoreLink($user, $this->view); + $this->_helper->redirector('password-restore-after', 'login'); + } + else { + $form->email->addError($this->view->translate("Given email not found.")); + } + } + + $this->view->form = $form; + } } public function passwordRestoreAfterAction() diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index 73405e5a1..ba0a4df26 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -117,19 +117,24 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm } $pattern = '/([0-9][0-9])h ([0-9][0-9])m/'; - preg_match($pattern, $formData['add_show_duration'], $matches); - $hours = $matches[1]; - $minutes = $matches[2]; - if( $formData["add_show_duration"] == "00h 00m" ) { - $this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00h 00m')); - $valid = false; - }elseif(strpos($formData["add_show_duration"], 'h') !== false && $hours >= 24) { - if ($hours > 24 || ($hours == 24 && $minutes > 0)) { - $this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h')); + + if (preg_match($pattern, $formData['add_show_duration'], $matches) && count($matches) == 3) { + $hours = $matches[1]; + $minutes = $matches[2]; + if( $formData["add_show_duration"] == "00h 00m" ) { + $this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00h 00m')); + $valid = false; + }elseif(strpos($formData["add_show_duration"], 'h') !== false && $hours >= 24) { + if ($hours > 24 || ($hours == 24 && $minutes > 0)) { + $this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h')); + $valid = false; + } + }elseif( strstr($formData["add_show_duration"], '-') ){ + $this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m')); $valid = false; } - }elseif( strstr($formData["add_show_duration"], '-') ){ - $this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m')); + } + else { $valid = false; } diff --git a/airtime_mvc/application/layouts/scripts/login.phtml b/airtime_mvc/application/layouts/scripts/login.phtml index 56a71bfcc..42389f11a 100644 --- a/airtime_mvc/application/layouts/scripts/login.phtml +++ b/airtime_mvc/application/layouts/scripts/login.phtml @@ -13,7 +13,7 @@ layout()->content ?>
diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 248442af5..d1b821488 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -66,7 +66,7 @@ class Application_Model_Preference } catch (Exception $e){ header('HTTP/1.0 503 Service Unavailable'); - Logging::log("Could not connect to database."); + Logging::log("Could not connect to database: ".$e->getMessage()); exit; } @@ -104,7 +104,7 @@ class Application_Model_Preference } } catch (Exception $e) { header('HTTP/1.0 503 Service Unavailable'); - Logging::log("Could not connect to database."); + Logging::log("Could not connect to database: ".$e->getMessage()); exit; } } diff --git a/airtime_mvc/public/js/airtime/preferences/musicdirs.js b/airtime_mvc/public/js/airtime/preferences/musicdirs.js index 7e70b8650..8edb019c8 100644 --- a/airtime_mvc/public/js/airtime/preferences/musicdirs.js +++ b/airtime_mvc/public/js/airtime/preferences/musicdirs.js @@ -56,6 +56,9 @@ function setWatchedDirEvents() { setWatchedDirEvents(); }); } + else { + $('#storageFolder').val(""); + } }); $('#watchedFolder-ok').click(function(){ diff --git a/airtime_mvc/public/js/airtime/utilities/utilities.js b/airtime_mvc/public/js/airtime/utilities/utilities.js index 54475a580..844f91e66 100644 --- a/airtime_mvc/public/js/airtime/utilities/utilities.js +++ b/airtime_mvc/public/js/airtime/utilities/utilities.js @@ -96,7 +96,7 @@ var AIRTIME = (function(AIRTIME){ iRange = iEnd - iStart; - if (iRange === 0 || iEnd < iStart) { + if (iEnd < iStart) { iEnd = iStart + DEFAULT_RANGE; iRange = DEFAULT_RANGE; } @@ -110,4 +110,4 @@ var AIRTIME = (function(AIRTIME){ return AIRTIME; -}(AIRTIME || {})); \ No newline at end of file +}(AIRTIME || {})); diff --git a/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README_June_7_2012 b/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README_June_7_2012 new file mode 100644 index 000000000..1caa62b9e --- /dev/null +++ b/airtime_mvc/public/js/fullcalendar/AIRTIME_DEV_README_June_7_2012 @@ -0,0 +1,169 @@ +Before you overwrite fullcalendar.js, note that we have changed a few lines +in this file. + +Running a diff between the original (fullcalendarMKchanged.js) and our modified one (fullcalendar.js): + +denise@denise-DX4860:~/airtime/airtime_mvc/public/js/fullcalendar$ diff -u fullcalendarMKchanged.js fullcalendar.js +--- fullcalendarMKchanged.js 2012-04-11 17:39:06.734126350 -0400 ++++ fullcalendar.js 2012-06-07 16:08:56.426248827 -0400 +@@ -1,6 +1,6 @@ + /** + * @preserve +- * FullCalendar v1.5.1-CUSTOM (Changes by Martin Konecny -added primitive support for timezones) ++ * FullCalendar v1.5.3 + * http://arshaw.com/fullcalendar/ + * + * Use fullcalendar.css for basic styling. +@@ -11,7 +11,7 @@ + * Dual licensed under the MIT and GPL licenses, located in + * MIT-LICENSE.txt and GPL-LICENSE.txt respectively. + * +- * Date: Sat Apr 9 14:09:51 2011 -0700 ++ * Date: Mon Feb 6 22:40:40 2012 -0800 + * + */ + +@@ -111,7 +111,7 @@ + + + +-var fc = $.fullCalendar = { version: "1.5.1" }; ++var fc = $.fullCalendar = { version: "1.5.3" }; + var fcViews = fc.views = {}; + + +@@ -227,7 +227,7 @@ + var absoluteViewElement; + var resizeUID = 0; + var ignoreWindowResize = 0; +- var date = adjustDateToServerDate(new Date(), options["serverTimezoneOffset"]); ++ var date = new Date(); + var events = []; + var _dragElement; + +@@ -399,9 +399,7 @@ + elementOuterWidth = element.outerWidth(); + + header.updateTitle(currentView.title); +- //adjusting this date ensures that the "today" button is greyed out on the +- //correct day. +- var today = adjustDateToServerDate(new Date(), options["serverTimezoneOffset"]); ++ var today = new Date(); + if (today >= currentView.start && today < currentView.end) { + header.disableButton('today'); + }else{ +@@ -583,8 +581,7 @@ + + + function today() { +- //adjusting this date ensures that clicking "today" takes us to the correct date. +- date = adjustDateToServerDate(new Date(), options["serverTimezoneOffset"]); ++ date = new Date(); + renderView(); + } + +@@ -1398,7 +1395,7 @@ + return null; + } + var date = new Date(m[1], 0, 1); +- if (ignoreTimezone || !m[14]) { ++ if (ignoreTimezone || !m[13]) { + var check = new Date(m[1], 0, 1, 9, 0); + if (m[3]) { + date.setMonth(m[3] - 1); +@@ -1434,9 +1431,11 @@ + m[10] || 0, + m[12] ? Number("0." + m[12]) * 1000 : 0 + ); +- var offset = Number(m[16]) * 60 + (m[18] ? Number(m[18]) : 0); +- offset *= m[15] == '-' ? 1 : -1; +- date = new Date(+date + (offset * 60 * 1000)); ++ if (m[14]) { ++ var offset = Number(m[16]) * 60 + (m[18] ? Number(m[18]) : 0); ++ offset *= m[15] == '-' ? 1 : -1; ++ date = new Date(+date + (offset * 60 * 1000)); ++ } + } + return date; + } +@@ -2188,11 +2187,18 @@ + }else{ + clearEvents(); + } +- updateCells(firstTime); ++ getOffset(); + } + +- +- ++ function getOffset() { ++ var timezoneOffset; ++ $.ajax({ url: "/Api/calendar-init/format/json", dataType:"json", success:function(data) { ++ timezoneOffset = data.calendarInit.timezoneOffset*1000; ++ var firstTime = !body; ++ updateCells(firstTime, timezoneOffset); ++ }, error:function(jqXHR, textStatus, errorThrown){}}); ++ } ++ + function updateOptions() { + rtl = opt('isRTL'); + if (rtl) { +@@ -2273,15 +2279,17 @@ + .appendTo(element); + } + +- +- +- function updateCells(firstTime) { ++ function updateCells(firstTime, timezoneOffset) { + var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating? + var month = t.start.getMonth(); +- var today = clearTime(adjustDateToServerDate(new Date(), opt("serverTimezoneOffset"))); + var cell; + var date; + var row; ++ ++ var today = new Date(); ++ var utc = today.getTime() + (today.getTimezoneOffset()*60000); ++ var userTime = new Date(utc + timezoneOffset); ++ today = clearTime(userTime); + + if (dowDirty) { + headCells.each(function(i, _cell) { +@@ -3111,7 +3119,7 @@ + var headCell; + var bodyCell; + var date; +- var today = clearTime(adjustDateToServerDate(new Date(), opt("serverTimezoneOffset"))); ++ var today = clearTime(new Date()); + for (i=0; i