Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
4009ae741f
|
@ -272,13 +272,21 @@ class AudiopreviewController extends Zend_Controller_Action
|
|||
'element_id' => ++$position,
|
||||
);
|
||||
|
||||
$fileExtension = pathinfo($track['filepath'], PATHINFO_EXTENSION);
|
||||
if (strtolower($fileExtension) === 'mp3') {
|
||||
$elementMap['element_mp3'] = $track['item_id'];
|
||||
} elseif (strtolower($fileExtension) === 'ogg') {
|
||||
$elementMap['element_oga'] = $track['item_id'];
|
||||
$elementMap['type'] = $track['type'];
|
||||
if ($track['type'] == 0) {
|
||||
$fileExtension = pathinfo($track['filepath'], PATHINFO_EXTENSION);
|
||||
if (strtolower($fileExtension) === 'mp3') {
|
||||
$elementMap['element_mp3'] = $track['item_id'];
|
||||
} elseif (strtolower($fileExtension) === 'ogg') {
|
||||
$elementMap['element_oga'] = $track['item_id'];
|
||||
} else {
|
||||
//the media was neither mp3 or ogg
|
||||
throw new Exception("Unknown file type");
|
||||
}
|
||||
|
||||
$elementMap['uri'] = "/api/get-media/file/".$track['item_id'];
|
||||
} else {
|
||||
//the media was neither mp3 or ogg
|
||||
$elementMap['uri'] = $track['filepath'];
|
||||
}
|
||||
$result[] = $elementMap;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
->addActionContext('set-playlist-description', 'json')
|
||||
->addActionContext('playlist-preview', 'json')
|
||||
->addActionContext('get-playlist', 'json')
|
||||
->addActionContext('smart-block-criteria-save', 'json')
|
||||
->addActionContext('save', 'json')
|
||||
->addActionContext('smart-block-generate', 'json')
|
||||
->addActionContext('smart-block-shuffle', 'json')
|
||||
->addActionContext('get-block-info', 'json')
|
||||
|
@ -195,9 +195,9 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
$this->view->obj = $obj;
|
||||
|
||||
if($isAdminOrPM || $obj->getCreatorId() == $userInfo->id){
|
||||
$this->view->obj = $obj;
|
||||
if($this->obj_sess->type == "block"){
|
||||
$form = new Application_Form_SmartBlockCriteria();
|
||||
$form->startForm($this->obj_sess->id);
|
||||
|
@ -480,14 +480,17 @@ class PlaylistController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
public function setPlaylistNameAction()
|
||||
public function setPlaylistNameDescAction()
|
||||
{
|
||||
$name = $this->_getParam('name', 'Unknown Playlist');
|
||||
$description = $this->_getParam('description', "");
|
||||
$type = $this->_getParam('type');
|
||||
|
||||
try {
|
||||
$obj = $this->getPlaylist($type);
|
||||
$obj->setName($name);
|
||||
$obj->setDescription($description);
|
||||
$this->view->description = $obj->getDescription();
|
||||
$this->view->playlistName = $name;
|
||||
$this->view->modified = $obj->getLastModified("U");
|
||||
} catch (PlaylistOutDatedException $e) {
|
||||
|
@ -499,6 +502,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public function setPlaylistDescriptionAction()
|
||||
{
|
||||
$description = $this->_getParam('description', "");
|
||||
|
@ -517,13 +521,22 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public function smartBlockCriteriaSaveAction()
|
||||
public function saveAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
$result = $bl->saveSmartBlockCriteria($params['data']);
|
||||
$result = array();
|
||||
|
||||
$this->setPlaylistNameDescAction();
|
||||
|
||||
if ($params['type'] == 'block') {
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
$result = $bl->saveSmartBlockCriteria($params['criteria']);
|
||||
}
|
||||
|
||||
$result["modified"] = $this->view->modified;
|
||||
die(json_encode($result));
|
||||
}
|
||||
|
||||
|
@ -552,8 +565,15 @@ class PlaylistController extends Zend_Controller_Action
|
|||
{
|
||||
$request = $this->getRequest();
|
||||
$params = $request->getPost();
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
$result = $bl->shuffleSmartBlock();
|
||||
$bl = new Application_Model_Block($params['obj_id']);
|
||||
|
||||
//we need to save criteria in case user hasn't clicked Save or Generate yet
|
||||
$result = $bl->saveSmartBlockCriteria($params['data']);
|
||||
|
||||
//only shuffle if there are no criteria errors
|
||||
if ($result['result'] == 0) {
|
||||
$result = $bl->shuffleSmartBlock();
|
||||
}
|
||||
if ($result['result'] == 0) {
|
||||
try {
|
||||
die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true))));
|
||||
|
|
|
@ -276,8 +276,8 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
$files = $bl->getListofFilesMeetCriteria();
|
||||
|
||||
$save = new Zend_Form_Element_Button('save_button');
|
||||
$save->setAttrib('class', 'ui-button ui-state-default sp-button');
|
||||
$save->setAttrib('title', 'Save criteria only');
|
||||
$save->setAttrib('class', 'ui-button ui-state-default sp-save');
|
||||
$save->setAttrib('title', 'Save playlist');
|
||||
$save->setIgnore(true);
|
||||
$save->setLabel('Save');
|
||||
$save->setDecorators(array('viewHelper'));
|
||||
|
@ -285,7 +285,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
|
||||
$generate = new Zend_Form_Element_Button('generate_button');
|
||||
$generate->setAttrib('class', 'ui-button ui-state-default sp-button');
|
||||
$generate->setAttrib('title', 'Save criteria and generate block content');
|
||||
$generate->setAttrib('title', 'Generate playlist content');
|
||||
$generate->setIgnore(true);
|
||||
$generate->setLabel('Generate');
|
||||
$generate->setDecorators(array('viewHelper'));
|
||||
|
@ -293,7 +293,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
|
||||
$shuffle = new Zend_Form_Element_Button('shuffle_button');
|
||||
$shuffle->setAttrib('class', 'ui-button ui-state-default sp-button');
|
||||
$shuffle->setAttrib('title', 'Shuffle block content');
|
||||
$shuffle->setAttrib('title', 'Shuffle playlist content');
|
||||
$shuffle->setIgnore(true);
|
||||
$shuffle->setLabel('Shuffle');
|
||||
$shuffle->setDecorators(array('viewHelper'));
|
||||
|
|
|
@ -944,7 +944,7 @@ EOT;
|
|||
if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
|
||||
$error[] = "Limit cannot be empty or smaller than 0";
|
||||
} else {
|
||||
$mins = $data['etc']['sp_limit_value'] * $multiplier;
|
||||
$mins = floatval($data['etc']['sp_limit_value']) * $multiplier;
|
||||
if ($mins > 1440) {
|
||||
$error[] = "Limit cannot be more than 24 hrs";
|
||||
}
|
||||
|
@ -1335,7 +1335,7 @@ EOT;
|
|||
$limits['time'] = 1440 * 60;
|
||||
$limits['items'] = $storedCrit['limit']['value'];
|
||||
} else {
|
||||
$limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval($storedCrit['limit']['value']) * 60 * 60 : intval($storedCrit['limit']['value'] * 60);
|
||||
$limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval(floatval($storedCrit['limit']['value']) * 60 * 60) : intval($storedCrit['limit']['value'] * 60);
|
||||
$limits['items'] = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,40 +154,67 @@ class Application_Model_Playlist
|
|||
public function getContents($filterFiles=false)
|
||||
{
|
||||
Logging::log("Getting contents for playlist {$this->id}");
|
||||
|
||||
$files = array();
|
||||
/*
|
||||
$query = CcPlaylistcontentsQuery::create()
|
||||
->filterByDbPlaylistId($this->id);
|
||||
|
||||
if ($filterFiles) {
|
||||
$query->useCcFilesQuery()
|
||||
->filterByDbFileExists(true)
|
||||
->endUse();
|
||||
}
|
||||
$query->orderByDbPosition()
|
||||
->filterByDbType(0)
|
||||
->leftJoinWith('CcFiles');
|
||||
$rows = $query->find($this->con);
|
||||
*/
|
||||
$sql = <<<"EOT"
|
||||
(SELECT * FROM
|
||||
((SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
|
||||
f.id as item_id, f.track_title, f.artist_name as creator, f.file_exists as exists, f.filepath as path FROM cc_playlistcontents AS pc
|
||||
JOIN cc_files AS f ON pc.file_id=f.id WHERE pc.playlist_id = {$this->id} AND type = 0)
|
||||
UNION ALL
|
||||
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
|
||||
ws.id as item_id, (ws.name || ': ' || ws.url) as title, sub.login as creator, 't'::boolean as exists, ws.url as path FROM cc_playlistcontents AS pc
|
||||
JOIN cc_webstream AS ws on pc.stream_id=ws.id
|
||||
LEFT JOIN cc_subjs as sub on sub.id = ws.creator_id
|
||||
WHERE pc.playlist_id = {$this->id} AND pc.type = 1)
|
||||
UNION ALL
|
||||
(SELECT pc.id as id, pc.type, pc.position, pc.cliplength as length, pc.cuein, pc.cueout, pc.fadein, pc.fadeout,
|
||||
bl.id as item_id, bl.name as title, sbj.login as creator, 't'::boolean as exists, NULL::text as path FROM cc_playlistcontents AS pc
|
||||
JOIN cc_block AS bl on pc.block_id=bl.id
|
||||
JOIN cc_subjs as sbj ON bl.creator_id=sbj.id WHERE pc.playlist_id = {$this->id} AND pc.type = 2)) as temp
|
||||
ORDER BY temp.position);
|
||||
EOT;
|
||||
$sql = <<<SQL
|
||||
(SELECT *
|
||||
FROM (
|
||||
(SELECT pc.id AS id,
|
||||
pc.type,
|
||||
pc.position,
|
||||
pc.cliplength AS LENGTH,
|
||||
pc.cuein,
|
||||
pc.cueout,
|
||||
pc.fadein,
|
||||
pc.fadeout,
|
||||
f.id AS item_id,
|
||||
f.track_title,
|
||||
f.artist_name AS creator,
|
||||
f.file_exists AS EXISTS,
|
||||
f.filepath AS path
|
||||
FROM cc_playlistcontents AS pc
|
||||
JOIN cc_files AS f ON pc.file_id=f.id
|
||||
WHERE pc.playlist_id = {$this->id}
|
||||
AND TYPE = 0)
|
||||
UNION ALL
|
||||
(SELECT pc.id AS id,
|
||||
pc.TYPE, pc.position,
|
||||
pc.cliplength AS LENGTH,
|
||||
pc.cuein,
|
||||
pc.cueout,
|
||||
pc.fadein,
|
||||
pc.fadeout,
|
||||
ws.id AS item_id,
|
||||
(ws.name || ': ' || ws.url) AS title,
|
||||
sub.login AS creator,
|
||||
't'::boolean AS EXISTS,
|
||||
ws.url AS path
|
||||
FROM cc_playlistcontents AS pc
|
||||
JOIN cc_webstream AS ws ON pc.stream_id=ws.id
|
||||
LEFT JOIN cc_subjs AS sub ON sub.id = ws.creator_id
|
||||
WHERE pc.playlist_id = {$this->id}
|
||||
AND pc.TYPE = 1)
|
||||
UNION ALL
|
||||
(SELECT pc.id AS id,
|
||||
pc.TYPE, pc.position,
|
||||
pc.cliplength AS LENGTH,
|
||||
pc.cuein,
|
||||
pc.cueout,
|
||||
pc.fadein,
|
||||
pc.fadeout,
|
||||
bl.id AS item_id,
|
||||
bl.name AS title,
|
||||
sbj.login AS creator,
|
||||
't'::boolean AS EXISTS,
|
||||
NULL::text AS path
|
||||
FROM cc_playlistcontents AS pc
|
||||
JOIN cc_block AS bl ON pc.block_id=bl.id
|
||||
JOIN cc_subjs AS sbj ON bl.creator_id=sbj.id
|
||||
WHERE pc.playlist_id = {$this->id}
|
||||
AND pc.TYPE = 2)) AS temp
|
||||
ORDER BY temp.position);
|
||||
SQL;
|
||||
|
||||
$con = Propel::getConnection();
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
|
||||
|
@ -198,7 +225,7 @@ EOT;
|
|||
$offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset);
|
||||
|
||||
//format the length for UI.
|
||||
if ($row['type'] == 2){
|
||||
if ($row['type'] == 2) {
|
||||
$bl = new Application_Model_Block($row['item_id']);
|
||||
$formatter = new LengthFormatter($bl->getFormattedLength());
|
||||
} else {
|
||||
|
@ -210,28 +237,6 @@ EOT;
|
|||
$row['offset'] = $formatter->format();
|
||||
}
|
||||
|
||||
/*
|
||||
$i = 0;
|
||||
$offset = 0;
|
||||
foreach ($rows as $row) {
|
||||
Logging::log($row);
|
||||
$files[$i] = $row->toArray(BasePeer::TYPE_FIELDNAME, true, true);
|
||||
|
||||
$clipSec = Application_Common_DateHelper::playlistTimeToSeconds($files[$i]['cliplength']);
|
||||
$offset += $clipSec;
|
||||
$offset_cliplength = Application_Common_DateHelper::secondsToPlaylistTime($offset);
|
||||
|
||||
//format the length for UI.
|
||||
$formatter = new LengthFormatter($files[$i]['cliplength']);
|
||||
$files[$i]['cliplength'] = $formatter->format();
|
||||
|
||||
$formatter = new LengthFormatter($offset_cliplength);
|
||||
$files[$i]['offset'] = $formatter->format();
|
||||
|
||||
$i++;
|
||||
}
|
||||
*/
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
|
|
@ -648,14 +648,39 @@ class Application_Model_ShowInstance
|
|||
{
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM (cc_schedule AS s LEFT JOIN cc_files AS f ON f.id = s.file_id)
|
||||
WHERE s.instance_id = '{$this->_instanceId}' AND s.playout_status >= 0
|
||||
ORDER BY starts";
|
||||
$sql = <<<SQL
|
||||
SELECT *
|
||||
FROM (
|
||||
(SELECT s.starts,
|
||||
0::INTEGER as type ,
|
||||
f.id AS item_id,
|
||||
f.track_title,
|
||||
f.artist_name AS creator,
|
||||
f.file_exists AS EXISTS,
|
||||
f.filepath AS filepath
|
||||
FROM cc_schedule AS s
|
||||
LEFT JOIN cc_files AS f ON f.id = s.file_id
|
||||
WHERE s.instance_id = '{$this->_instanceId}'
|
||||
AND s.playout_status >= 0
|
||||
AND s.file_id IS NOT NULL)
|
||||
UNION
|
||||
(SELECT s.starts,
|
||||
1::INTEGER as type,
|
||||
ws.id AS item_id,
|
||||
(ws.name || ': ' || ws.url) AS title,
|
||||
sub.login AS creator,
|
||||
't'::boolean AS EXISTS,
|
||||
ws.url AS filepath
|
||||
FROM cc_schedule AS s
|
||||
LEFT JOIN cc_webstream AS ws ON ws.id = s.stream_id
|
||||
LEFT JOIN cc_subjs AS sub ON ws.creator_id = sub.id
|
||||
WHERE s.instance_id = '{$this->_instanceId}'
|
||||
AND s.playout_status >= 0
|
||||
AND s.stream_id IS NOT NULL)) AS temp
|
||||
ORDER BY starts;
|
||||
SQL;
|
||||
|
||||
//Logging::log($sql);
|
||||
|
||||
$results = $con->query($sql)->fetchAll();
|
||||
$results = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
foreach ($results as &$row) {
|
||||
|
||||
|
@ -682,7 +707,7 @@ class Application_Model_ShowInstance
|
|||
|
||||
$query = $con->query($sql)->fetchColumn(0);
|
||||
|
||||
return ($query !== false) ? $query : NULL;
|
||||
return ($query !== false) ? $query : null;
|
||||
}
|
||||
|
||||
public function getShowEndGapTime()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<form id="smart-playlist-form" method="post" action="">
|
||||
<fieldset class='sp-scrollable toggle <?php echo $this->openOption ? "" : "closed"?>' id='smart_playlist_options'>
|
||||
<fieldset class='toggle <?php echo $this->openOption ? "" : "closed"?>' id='smart_playlist_options'>
|
||||
<legend style='cursor: pointer;'><span class='ui-icon ui-icon-triangle-2-n-s'></span>Smart Playlist Options</legend>
|
||||
<dl class='zend_form'>
|
||||
<div id='sp-success' class='success' style='display:none'></div>
|
||||
|
@ -18,7 +18,6 @@
|
|||
<?php $i = $i + 1; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php echo $this->element->getElement('save_button') ?>
|
||||
<?php echo $this->element->getElement('generate_button') ?>
|
||||
<?php echo $this->element->getElement('shuffle_button') ?>
|
||||
</dd>
|
||||
|
@ -96,10 +95,5 @@
|
|||
|
||||
|
||||
</dl>
|
||||
<?php /*
|
||||
for($i=0; $i<$this->numOfSubForm; $i++){
|
||||
echo $this->parent_form->getSubform('sp_set_'.$i);
|
||||
}*/
|
||||
?>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<?php foreach($this->contents as $row) : ?>
|
||||
<?php
|
||||
$titleMaxStrLen = 35;
|
||||
if (strlen($row["track_title"]) > $titleMaxStrLen) {
|
||||
if (mb_strlen($row["track_title"], 'UTF-8') > $titleMaxStrLen) {
|
||||
$row["track_title"] = substr($row["track_title"], 0, 34)."...";
|
||||
}
|
||||
$artistMaxStrLen = 22;
|
||||
|
|
|
@ -13,6 +13,7 @@ if (isset($this->obj)) {
|
|||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($this->obj)) : ?>
|
||||
<button class="ui-button ui-state-default sp-save" type="button" id="save_button">Save</button>
|
||||
<input id="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"></input>
|
||||
<input id="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"></input>
|
||||
<input id='obj_type' type='hidden' value='playlist'></input>
|
||||
|
@ -22,6 +23,7 @@ if (isset($this->obj)) {
|
|||
</h3>
|
||||
<h4 id="obj_length"><?php echo $this->length; ?></h4>
|
||||
</div>
|
||||
<div id='sp-success' class='success' style='display:none'></div>
|
||||
|
||||
<fieldset class="toggle closed" id="fieldset-metadate_change">
|
||||
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>View / edit description</legend>
|
||||
|
@ -30,11 +32,6 @@ if (isset($this->obj)) {
|
|||
<dd id="description-element">
|
||||
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->obj->getDescription(); ?></textarea>
|
||||
</dd>
|
||||
<dt id="submit-label" style="display: none;"> </dt>
|
||||
<dd id="submit-element" class="buttons">
|
||||
<input class="ui-button ui-state-default" type="submit" value="Cancel" id="description_cancel" name="cancel">
|
||||
<input class="ui-button ui-state-default" type="submit" value="Save" id="description_save" name="submit">
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -12,6 +12,12 @@ if (isset($this->obj)) {
|
|||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if (isset($this->form)) {
|
||||
echo $this->form->getElement('save_button');
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if (isset($this->obj)) : ?>
|
||||
<input id="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"></input>
|
||||
<input id="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"></input>
|
||||
|
@ -22,6 +28,7 @@ if (isset($this->obj)) {
|
|||
</h3>
|
||||
<h4 id="obj_length"><?php echo $this->length; ?></h4>
|
||||
</div>
|
||||
<div id='sp-success-saved' class='success' style='display:none'></div>
|
||||
|
||||
<fieldset class="toggle closed" id="fieldset-metadate_change">
|
||||
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>View / edit description</legend>
|
||||
|
@ -30,11 +37,6 @@ if (isset($this->obj)) {
|
|||
<dd id="description-element">
|
||||
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->obj->getDescription(); ?></textarea>
|
||||
</dd>
|
||||
<dt id="submit-label" style="display: none;"> </dt>
|
||||
<dd id="submit-element" class="buttons">
|
||||
<input class="ui-button ui-state-default" type="submit" value="Cancel" id="description_cancel" name="cancel">
|
||||
<input class="ui-button ui-state-default" type="submit" value="Save" id="description_save" name="submit">
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -500,11 +500,6 @@ table.library-get-file-md.table-small{
|
|||
|
||||
|
||||
/***** SMART PLAYLIST SPECIFIC STYLES BEGIN *****/
|
||||
.sp-scrollable{
|
||||
overflow-x: auto;
|
||||
width: 781px;
|
||||
}
|
||||
|
||||
.sp-invisible{
|
||||
visibility: hidden;
|
||||
}
|
||||
|
@ -559,6 +554,10 @@ input.input_text.sp_extra_input_text{
|
|||
margin-left: 10px !important;
|
||||
}
|
||||
|
||||
.sp-save{
|
||||
margin-left: 7px !important;
|
||||
}
|
||||
|
||||
.sp-checked-icon{
|
||||
width: 16px !important;
|
||||
display: inline-block !important;
|
||||
|
|
|
@ -111,8 +111,9 @@ function playAllShow(p_showID, p_index) {
|
|||
}
|
||||
|
||||
/**
|
||||
* This function will call the AudiopreviewController to get the contents of either a show or playlist
|
||||
* Looping throught the returned contents and creating media for each track.
|
||||
* This function will call the AudiopreviewController to get the contents of
|
||||
* either a show or playlist Looping throught the returned contents and
|
||||
* creating media for each track.
|
||||
*
|
||||
* Then trigger the jplayer to play the list.
|
||||
*/
|
||||
|
@ -123,8 +124,7 @@ function buildplaylist(p_url, p_playIndex) {
|
|||
var media;
|
||||
var index;
|
||||
var total = 0;
|
||||
for(index in data){
|
||||
|
||||
for(index in data) {
|
||||
if (data[index]['type'] == 0) {
|
||||
if (data[index]['element_mp3'] != undefined){
|
||||
media = {title: data[index]['element_title'],
|
||||
|
@ -146,8 +146,8 @@ function buildplaylist(p_url, p_playIndex) {
|
|||
if (media) {
|
||||
myPlaylist[index] = media;
|
||||
}
|
||||
// we should create a map according to the new position in the player itself
|
||||
// total is the index on the player
|
||||
// we should create a map according to the new position in the
|
||||
// player itself total is the index on the player
|
||||
_idToPostionLookUp[data[index]['element_id']] = total;
|
||||
total++;
|
||||
}
|
||||
|
|
|
@ -590,41 +590,39 @@ var AIRTIME = (function(AIRTIME){
|
|||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
)
|
||||
$pl.on("click", "#description_save", function(){
|
||||
var textarea = $pl.find("#fieldset-metadate_change textarea"),
|
||||
description = textarea.val(),
|
||||
url,
|
||||
lastMod = getModified(),
|
||||
type = $('#obj_type').val();
|
||||
|
||||
url = '/Playlist/set-playlist-description';
|
||||
|
||||
$.post(url,
|
||||
{format: "json", description: description, modified: lastMod, type: type},
|
||||
function(json){
|
||||
if (json.error !== undefined){
|
||||
playlistError(json);
|
||||
}
|
||||
else{
|
||||
setModified(json.modified);
|
||||
textarea.val(json.description);
|
||||
$pl.find("#fieldset-metadate_change").addClass("closed");
|
||||
redrawLib();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$pl.on("click", "#description_cancel", function(){
|
||||
var textarea = $pl.find("#fieldset-metadate_change textarea");
|
||||
|
||||
textarea.val(cachedDescription);
|
||||
$pl.find("#fieldset-metadate_change").addClass("closed");
|
||||
});
|
||||
//end edit playlist description events.
|
||||
});
|
||||
|
||||
$('#save_button').live("click", function(event){
|
||||
/* Smart blocks: get name, description, and criteria
|
||||
* Playlists: get name, description
|
||||
*/
|
||||
var criteria = $('form').serializeArray(),
|
||||
block_name = $('#playlist_name_display').text(),
|
||||
block_desc = $('textarea[name="description"]').val(),
|
||||
save_action = 'Playlist/save',
|
||||
obj_id = $('input[id="obj_id"]').val(),
|
||||
obj_type = $('#obj_type').val(),
|
||||
lastMod = getModified(),
|
||||
dt = $('table[id="library_display"]').dataTable();
|
||||
enableLoadingIcon();
|
||||
$.post(save_action,
|
||||
{format: "json", criteria: criteria, name: block_name, description: block_desc, obj_id: obj_id, type: obj_type, modified: lastMod},
|
||||
function(data){
|
||||
var json = $.parseJSON(data);
|
||||
setModified(json.modified);
|
||||
if (obj_type == "block") {
|
||||
callback(data, "save");
|
||||
} else {
|
||||
$('.success').text('Playlist saved');
|
||||
$('.success').show();
|
||||
setTimeout(removeSuccessMsg, 5000);
|
||||
dt.fnStandingRedraw();
|
||||
}
|
||||
setFadeIcon();
|
||||
disableLoadingIcon();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function setUpPlaylist() {
|
||||
|
|
|
@ -23,9 +23,7 @@ function setSmartPlaylistEvents() {
|
|||
|
||||
/********** ADD MODIFIER ROW **********/
|
||||
form.find('a[id^="modifier_add"]').live('click', function(){
|
||||
var id = $(this).attr('id'),
|
||||
row_index = id.charAt(id.length-1),
|
||||
criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
||||
var criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
||||
|
||||
//make new modifier row
|
||||
var newRow = $(this).parent().clone(),
|
||||
|
@ -186,17 +184,21 @@ function setSmartPlaylistEvents() {
|
|||
});
|
||||
|
||||
/********** SAVE ACTION **********/
|
||||
form.find('button[id="save_button"]').live("click", function(event){
|
||||
var data = $('form').serializeArray(),
|
||||
save_action = 'Playlist/smart-block-criteria-save',
|
||||
/* moved to spl.js
|
||||
$('#save_button').live("click", function(event){
|
||||
var criteria = $('form').serializeArray(),
|
||||
block_name = $('#playlist_name_display').text(),
|
||||
block_desc = $('textarea[name="description"]').val(),
|
||||
save_action = 'Playlist/save',
|
||||
obj_id = $('input[id="obj_id"]').val();
|
||||
enableLoadingIcon();
|
||||
$.post(save_action, {format: "json", data: data, obj_id: obj_id}, function(data){
|
||||
$.post(save_action, {format: "json", criteria: criteria, name: block_name, desc: block_desc, obj_id: obj_id}, function(data){
|
||||
callback(data, "save");
|
||||
setFadeIcon();
|
||||
disableLoadingIcon();
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
/********** GENERATE ACTION **********/
|
||||
form.find('button[id="generate_button"]').live("click", function(event){
|
||||
|
@ -240,11 +242,7 @@ function setSmartPlaylistEvents() {
|
|||
/********** MODIFIER CHANGE **********/
|
||||
form.find('select[id^="sp_criteria_modifier"]').live("change", function(){
|
||||
var criteria_value = $(this).next(),
|
||||
index_name = criteria_value.attr('id'),
|
||||
delimiter = '_',
|
||||
start = 3,
|
||||
tokens = index_name.split(delimiter).slice(start),
|
||||
index_num = tokens.join(delimiter);
|
||||
index_num = getRowIndex($(this).parent());
|
||||
|
||||
if ($(this).val() == 'is in the range') {
|
||||
enableAndShowExtraField(criteria_value, index_num);
|
||||
|
@ -260,7 +258,7 @@ function setSmartPlaylistEvents() {
|
|||
}
|
||||
|
||||
function getRowIndex(ele) {
|
||||
var id = ele.find('[name^="sp_criteria"]').attr('id'),
|
||||
var id = ele.find('[name^="sp_criteria_field"]').attr('id'),
|
||||
delimiter = '_',
|
||||
start = 3,
|
||||
tokens = id.split(delimiter).slice(start),
|
||||
|
@ -461,6 +459,9 @@ function callback(data, type) {
|
|||
|
||||
if (json.result == "1") {
|
||||
form.find('.success').hide();
|
||||
if ($('#smart_playlist_options').hasClass('closed')) {
|
||||
$('#smart_playlist_options').removeClass('closed');
|
||||
}
|
||||
$.each(json.errors, function(index, error){
|
||||
$.each(error.msg, function(index, message){
|
||||
$('#'+error.element).parent().append("<span class='errors sp-errors'>"+message+"</span>");
|
||||
|
@ -471,7 +472,7 @@ function callback(data, type) {
|
|||
AIRTIME.playlist.fnOpenPlaylist(json);
|
||||
form = $('#smart-playlist-form');
|
||||
if (type == 'shuffle') {
|
||||
form.find('.success').text('Playlist shuffled');
|
||||
form.find('.success').text('Smart playlist shuffled');
|
||||
} else if (type == 'generate') {
|
||||
form.find('.success').text('Smart playlist generated and saved');
|
||||
//redraw library table so the length gets updated
|
||||
|
@ -480,10 +481,8 @@ function callback(data, type) {
|
|||
form.find('.success').show();
|
||||
form.find('#smart_playlist_options').removeClass("closed");
|
||||
} else {
|
||||
form.find('.success').text('Criteria saved');
|
||||
form.find('.success').show();
|
||||
//redraw library table incase block changed from static to dynamic or vice versa
|
||||
dt.fnStandingRedraw();
|
||||
$('#sp-success-saved').text('Smart playlist saved');
|
||||
$('#sp-success-saved').show();
|
||||
|
||||
/* Update number of files that meet criteria and change icon to success/warning
|
||||
* as appropriate. This is also done in the form but we do not pass the form
|
||||
|
@ -515,7 +514,7 @@ function callback(data, type) {
|
|||
}
|
||||
|
||||
function removeSuccessMsg() {
|
||||
var $status = $('#smart-playlist-form').find('.success');
|
||||
var $status = $('.success');
|
||||
|
||||
$status.fadeOut("slow", function(){$status.empty()});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue