Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Rudi Grinberg 2012-08-16 17:27:54 -04:00
commit 8fe8668802
5 changed files with 25 additions and 40 deletions

View file

@ -488,7 +488,7 @@ class PlaylistController extends Zend_Controller_Action
$obj = $this->getPlaylist($type); $obj = $this->getPlaylist($type);
$obj->setName($name); $obj->setName($name);
$obj->setDescription($description); $obj->setDescription($description);
$this->view->description = $obj->getDescription(); $this->view->description = $description;
$this->view->playlistName = $name; $this->view->playlistName = $name;
$this->view->modified = $obj->getLastModified("U"); $this->view->modified = $obj->getLastModified("U");
} catch (PlaylistOutDatedException $e) { } catch (PlaylistOutDatedException $e) {
@ -499,27 +499,6 @@ class PlaylistController extends Zend_Controller_Action
$this->playlistUnknownError($e); $this->playlistUnknownError($e);
} }
} }
/*
public function setPlaylistDescriptionAction()
{
$description = $this->_getParam('description', "");
$type = $this->_getParam('type');
try {
$obj = $this->getPlaylist($type);
$obj->setDescription($description);
$this->view->description = $obj->getDescription();
$this->view->modified = $obj->getLastModified("U");
} catch (PlaylistOutDatedException $e) {
$this->playlistOutdated($e);
} catch (PlaylistNotFoundException $e) {
$this->playlistNotFound($type);
} catch (Exception $e) {
$this->playlistUnknownError($e);
}
}
*/
public function saveAction() public function saveAction()
{ {
@ -534,7 +513,7 @@ class PlaylistController extends Zend_Controller_Action
$form->startForm($params['obj_id']); $form->startForm($params['obj_id']);
$bl = new Application_Model_Block($params['obj_id']); $bl = new Application_Model_Block($params['obj_id']);
if ($form->isValid($params)) { if ($form->isValid($params)) {
$result = $bl->saveSmartBlockCriteria($params['data']); $bl->saveSmartBlockCriteria($params['data']);
$result['html'] = $this->createFullResponse($bl, true); $result['html'] = $this->createFullResponse($bl, true);
$result['result'] = 0; $result['result'] = 0;
} else { } else {

View file

@ -215,6 +215,11 @@ EOT;
$formatter = new LengthFormatter($offset_cliplength); $formatter = new LengthFormatter($offset_cliplength);
$row['offset'] = $formatter->format(); $row['offset'] = $formatter->format();
//format the fades in format 00(.000000)
$fades = $this->getFadeInfo($row['position']);
$row['fadein'] = $fades[0];
$row['fadeout'] = $fades[1];
} }
return $rows; return $rows;
@ -643,7 +648,7 @@ EOT;
return array("fadeIn" => $fadeIn, "fadeOut" => $fadeOut); return array("fadeIn" => $fadeIn, "fadeOut" => $fadeOut);
} }
public function setBlockfades($fadein, $fadeout) public function setfades($fadein, $fadeout)
{ {
if (isset($fadein)) { if (isset($fadein)) {
Logging::log("Setting block fade in {$fadein}"); Logging::log("Setting block fade in {$fadein}");
@ -942,7 +947,6 @@ EOT;
$this->storeCriteriaIntoDb($data); $this->storeCriteriaIntoDb($data);
//get number of files that meet the criteria //get number of files that meet the criteria
$files = $this->getListofFilesMeetCriteria(); $files = $this->getListofFilesMeetCriteria();
//$output['poolCount'] = $files["count"];
// if the block is dynamic, put null to the length // if the block is dynamic, put null to the length
// as it cannot be calculated // as it cannot be calculated
if ($blockType == 'dynamic') { if ($blockType == 'dynamic') {
@ -958,10 +962,8 @@ EOT;
} }
$this->setLength($length); $this->setLength($length);
} }
//$output['blockLength'] = $this->getFormattedLength();
$this->updateBlockLengthInAllPlaylist(); $this->updateBlockLengthInAllPlaylist();
return $output;
} }
public function hasItemLimit() public function hasItemLimit()
@ -1013,17 +1015,13 @@ EOT;
*/ */
public function generateSmartBlock($p_criteria, $returnList=false) public function generateSmartBlock($p_criteria, $returnList=false)
{ {
$result = $this->saveSmartBlockCriteria($p_criteria); $this->saveSmartBlockCriteria($p_criteria);
/*if ($result['result'] != 0) { $insertList = $this->getListOfFilesUnderLimit();
return $result; $this->deleteAllFilesFromBlock();
} else {*/ $this->addAudioClips(array_keys($insertList));
$insertList = $this->getListOfFilesUnderLimit(); // update length in playlist contents.
$this->deleteAllFilesFromBlock(); $this->updateBlockLengthInAllPlaylist();
$this->addAudioClips(array_keys($insertList)); return array("result"=>0);
// update length in playlist contents.
$this->updateBlockLengthInAllPlaylist();
return array("result"=>0);
//}
} }
public function updateBlockLengthInAllPlaylist() public function updateBlockLengthInAllPlaylist()

View file

@ -235,6 +235,11 @@ SQL;
$formatter = new LengthFormatter($offset_cliplength); $formatter = new LengthFormatter($offset_cliplength);
$row['offset'] = $formatter->format(); $row['offset'] = $formatter->format();
//format the fades in format 00(.000000)
$fades = $this->getFadeInfo($row['position']);
$row['fadein'] = $fades[0];
$row['fadeout'] = $fades[1];
} }
return $rows; return $rows;

View file

@ -17,7 +17,8 @@ var AIRTIME = (function(AIRTIME){
width; width;
function isTimeValid(time) { function isTimeValid(time) {
var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$"); //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})?$");
return regExpr.test(time); return regExpr.test(time);
} }
@ -337,6 +338,8 @@ var AIRTIME = (function(AIRTIME){
.append(json.html); .append(json.html);
setUpPlaylist(); setUpPlaylist();
setCueEvents();
setFadeEvents();
// functions in smart_playlistbuilder.js // functions in smart_playlistbuilder.js
setupUI(); setupUI();

View file

@ -335,7 +335,7 @@ function setupUI() {
var plContents = $('#spl_sortable').children(); var plContents = $('#spl_sortable').children();
var shuffleButton = $('button[id="shuffle_button"]'); var shuffleButton = $('button[id="shuffle_button"]');
if (plContents.length > 1) { if (plContents.text() !== 'Empty playlist') {
if (shuffleButton.hasClass('ui-state-disabled')) { if (shuffleButton.hasClass('ui-state-disabled')) {
shuffleButton.removeClass('ui-state-disabled'); shuffleButton.removeClass('ui-state-disabled');
} }