Merge branch '2.1.x' of dev.sourcefabric.org:airtime into 2.1.x

This commit is contained in:
James 2012-06-08 14:58:48 -04:00
commit 67c90ae3d6
9 changed files with 224 additions and 40 deletions

View File

@ -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()

View File

@ -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;
}

View File

@ -13,7 +13,7 @@
<?php echo $this->layout()->content ?>
</div>
<div class="footer">
Airtime&nbsp;<?php echo $this->airtimeVersion ?>&nbsp;Copyright &copy; Sourcefabric o.p.s <?php echo $this->airtimeCopyright ?>. All rights reserved.<br/>
Airtime&nbsp;Copyright &copy; Sourcefabric o.p.s. All rights reserved.<br/>
Maintained and distributed under GNU GPL v.3 by <a href="http://www.sourcefabric.org"> Sourcefabric o.p.s </a>
</div>

View File

@ -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;
}
}

View File

@ -56,6 +56,9 @@ function setWatchedDirEvents() {
setWatchedDirEvents();
});
}
else {
$('#storageFolder').val("");
}
});
$('#watchedFolder-ok').click(function(){

View File

@ -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 || {}));
}(AIRTIME || {}));

View File

@ -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<colCnt; i++) {
date = colDate(i);
headCell = dayHeadCells.eq(i);
@@ -5158,6 +5166,7 @@
function mouse(ev) {
+ _fixUIEvent(ev); // see below
var newCell = coordinateGrid.cell(ev.pageX, ev.pageY);
if (!newCell != !cell || newCell && (newCell.row != cell.row || newCell.col != cell.col)) {
if (newCell) {
@@ -5181,6 +5190,19 @@
}
+
+
+// this fix was only necessary for jQuery UI 1.8.16 (and jQuery 1.7 or 1.7.1)
+// upgrading to jQuery UI 1.8.17 (and using either jQuery 1.7 or 1.7.1) fixed the problem
+// but keep this in here for 1.8.16 users
+// and maybe remove it down the line
+
+function _fixUIEvent(event) { // for issue 1168
+ if (event.pageX === undefined) {
+ event.pageX = event.originalEvent.pageX;
+ event.pageY = event.originalEvent.pageY;
+ }
+}
function HorizontalPositionCache(getElement) {
var t = this,

View File

@ -0,0 +1,2 @@
User-agent: *
Disallow: /login

View File

@ -51,7 +51,7 @@ args=("/var/log/airtime/pypo/notify.log", 'a', 1000000, 5,)
class=logging.handlers.RotatingFileHandler
level=DEBUG
formatter=simpleFormatter
args=("/var/log/airtime/pypo/pypo.log", 'a', 1000000, 5,)
args=("/var/log/airtime/pypo/pypo.log", 'a', 5000000, 10,)
[handler_recorder]
class=logging.handlers.RotatingFileHandler