diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index fa305a90a..4d62b8329 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -229,10 +229,17 @@ SQL; $formatter = new LengthFormatter($offset_cliplength); $row['offset'] = $formatter->format(); - //format the fades in format 00(.000000) + //format the fades in format 00(.0) $fades = $this->getFadeInfo($row['position']); $row['fadein'] = $fades[0]; $row['fadeout'] = $fades[1]; + + // format the cues in format 00:00:00(.0) + // we need to add the '.0' for cues and not fades + // because propel takes care of this for us + // (we use propel to fetch the fades) + $row['cuein'] = str_pad(substr($row['cuein'], 0, 10), 10, '.0'); + $row['cueout'] = str_pad(substr($row['cueout'], 0, 10), 10, '.0'); //format original length $formatter = new LengthFormatter($row['orig_length']); @@ -611,9 +618,10 @@ SQL; - #Propel returns values in form 00.000000 format which is for only seconds. - $fadeIn = $row->getDbFadein(); - $fadeOut = $row->getDbFadeout(); + //Propel returns values in form 00.000000 format which is for only seconds. + //We only want to display 1 decimal + $fadeIn = substr($row->getDbFadein(), 0, 4); + $fadeOut = substr($row->getDbFadeout(), 0, 4); return array($fadeIn, $fadeOut); } diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index 021783c49..c99fbb019 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -244,6 +244,13 @@ SQL; $fades = $this->getFadeInfo($row['position']); $row['fadein'] = $fades[0]; $row['fadeout'] = $fades[1]; + + // format the cues in format 00:00:00(.0) + // we need to add the '.0' for cues and not fades + // because propel takes care of this for us + // (we use propel to fetch the fades) + $row['cuein'] = str_pad(substr($row['cuein'], 0, 10), 10, '.0'); + $row['cueout'] = str_pad(substr($row['cueout'], 0, 10), 10, '.0'); //format original length $formatter = new LengthFormatter($row['orig_length']); @@ -585,9 +592,10 @@ SQL; if (!$row) { return NULL; } - #Propel returns values in form 00.000000 format which is for only seconds. - $fadeIn = $row->getDbFadein(); - $fadeOut = $row->getDbFadeout(); + //Propel returns values in form 00.000000 format which is for only seconds. + //We only want to display 1 decimal + $fadeIn = substr($row->getDbFadein(), 0, 4); + $fadeOut = substr($row->getDbFadeout(), 0, 4); return array($fadeIn, $fadeOut); } diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index 2513f97d9..a5937820d 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -18,13 +18,13 @@ var AIRTIME = (function(AIRTIME){ function isTimeValid(time) { //var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$"); - var regExpr = new RegExp("^\\d{2}[:]([0-5]){1}([0-9]){1}[:]([0-5]){1}([0-9]){1}([.]\\d{1,6})?$"); + var regExpr = new RegExp("^\\d{2}[:]([0-5]){1}([0-9]){1}[:]([0-5]){1}([0-9]){1}([.]\\d{1})?$"); return regExpr.test(time); } function isFadeValid(fade) { - var regExpr = new RegExp("^\\d{1}(\\d{1})?([.]\\d{1,6})?$"); + var regExpr = new RegExp("^\\d{1}(\\d{1})?([.]\\d{1})?$"); return regExpr.test(fade); } @@ -74,7 +74,7 @@ var AIRTIME = (function(AIRTIME){ type = $('#obj_type').val(); if (!isTimeValid(cueIn)){ - showError(span, "please put in a time '00:00:00 (.000000)'"); + showError(span, "please put in a time '00:00:00 (.0)'"); return; } $.post(url, @@ -111,7 +111,7 @@ var AIRTIME = (function(AIRTIME){ type = $('#obj_type').val(); if (!isTimeValid(cueOut)){ - showError(span, "please put in a time '00:00:00 (.000000)'"); + showError(span, "please put in a time '00:00:00 (.0)'"); return; } @@ -150,7 +150,7 @@ var AIRTIME = (function(AIRTIME){ type = $('#obj_type').val(); if (!isFadeValid(fadeIn)){ - showError(span, "please put in a time in seconds '00 (.000000)'"); + showError(span, "please put in a time in seconds '00 (.0)'"); return; } @@ -188,7 +188,7 @@ var AIRTIME = (function(AIRTIME){ type = $('#obj_type').val(); if (!isFadeValid(fadeOut)){ - showError(span, "please put in a time in seconds '00 (.000000)'"); + showError(span, "please put in a time in seconds '00 (.0)'"); return; } @@ -545,7 +545,7 @@ var AIRTIME = (function(AIRTIME){ type = $('#obj_type').val(); if (!isFadeValid(fadeIn)){ - showError(span, "please put in a time in seconds '00 (.000000)'"); + showError(span, "please put in a time in seconds '00 (.0)'"); return; } @@ -569,7 +569,7 @@ var AIRTIME = (function(AIRTIME){ type = $('#obj_type').val(); if (!isFadeValid(fadeOut)){ - showError(span, "please put in a time in seconds '00 (.000000)'"); + showError(span, "please put in a time in seconds '00 (.0)'"); return; }