CC-84: Smart Playlists
- audio preview on playlist - cleaning up some code
This commit is contained in:
parent
3b5a3e6713
commit
0d2d8218bf
|
@ -152,6 +152,11 @@ class Application_Common_DateHelper
|
||||||
{
|
{
|
||||||
return strtotime($time2) - strtotime($time1);
|
return strtotime($time2) - strtotime($time1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function TimeAdd($time1, $time2)
|
||||||
|
{
|
||||||
|
return strtotime($time2) + strtotime($time1);
|
||||||
|
}
|
||||||
|
|
||||||
public static function ConvertMSToHHMMSSmm($time)
|
public static function ConvertMSToHHMMSSmm($time)
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,6 +81,53 @@ class AudiopreviewController extends Zend_Controller_Action
|
||||||
$this->_helper->viewRenderer->setRender('audio-preview');
|
$this->_helper->viewRenderer->setRender('audio-preview');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function blockPreviewAction()
|
||||||
|
{
|
||||||
|
global $CC_CONFIG;
|
||||||
|
|
||||||
|
$blockIndex = $this->_getParam('blockIndex');
|
||||||
|
$blockId = $this->_getParam('blockId');
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$baseUrl = $request->getBaseUrl();
|
||||||
|
|
||||||
|
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
|
||||||
|
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/audiopreview/preview_jplayer.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'/js/jplayer/jplayer.playlist.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
$this->view->headLink()->appendStylesheet($baseUrl.'/js/jplayer/skin/jplayer.airtime.audio.preview.css?'.$CC_CONFIG['airtime_version']);
|
||||||
|
$this->_helper->layout->setLayout('audioPlayer');
|
||||||
|
|
||||||
|
$logo = Application_Model_Preference::GetStationLogo();
|
||||||
|
if ($logo) {
|
||||||
|
$this->view->logo = "data:image/png;base64,$logo";
|
||||||
|
} else {
|
||||||
|
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
|
||||||
|
}
|
||||||
|
$this->view->blockIndex= $blockIndex;
|
||||||
|
$this->view->blockId = $blockId;
|
||||||
|
|
||||||
|
$this->_helper->viewRenderer->setRender('audio-preview');
|
||||||
|
}
|
||||||
|
public function getBlockAction()
|
||||||
|
{
|
||||||
|
// disable the view and the layout
|
||||||
|
$this->view->layout()->disableLayout();
|
||||||
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
|
$blockId = $this->_getParam('blockId');
|
||||||
|
|
||||||
|
if (!isset($blockId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$bl = new Application_Model_Block($blockId);
|
||||||
|
$result = array();
|
||||||
|
foreach ($bl->getContents(true) as $ele) {
|
||||||
|
$result[] = $this->createElementMap($ele);
|
||||||
|
}
|
||||||
|
$this->_helper->json($result);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*Function will load and return the contents of the requested playlist.
|
*Function will load and return the contents of the requested playlist.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -76,6 +76,9 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$obj = new Application_Model_Playlist($id);
|
$obj = new Application_Model_Playlist($id);
|
||||||
} else {
|
} else {
|
||||||
$obj = new Application_Model_Block($id);
|
$obj = new Application_Model_Block($id);
|
||||||
|
if (!$obj->isStatic()){
|
||||||
|
unset($menu["play"]);
|
||||||
|
}
|
||||||
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
|
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
|
||||||
if ($this->obj_sess->type === "playlist") {
|
if ($this->obj_sess->type === "playlist") {
|
||||||
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
|
$menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy");
|
||||||
|
@ -312,21 +315,22 @@ class LibraryController extends Zend_Controller_Action
|
||||||
$this->view->md = $md;
|
$this->view->md = $md;
|
||||||
$this->view->contents = $file->getContents();
|
$this->view->contents = $file->getContents();
|
||||||
} else if ($type == "block") {
|
} else if ($type == "block") {
|
||||||
$file = new Application_Model_Block($id);
|
$block = new Application_Model_Block($id);
|
||||||
$this->view->type = $type;
|
$this->view->type = $type;
|
||||||
$md = $file->getAllPLMetaData();
|
$md = $block->getAllPLMetaData();
|
||||||
|
|
||||||
$formatter = new LengthFormatter($md["dcterms:extent"]);
|
$formatter = new LengthFormatter($md["dcterms:extent"]);
|
||||||
$md["dcterms:extent"] = $formatter->format();
|
$md["dcterms:extent"] = $formatter->format();
|
||||||
|
|
||||||
$this->view->md = $md;
|
$this->view->md = $md;
|
||||||
if ($file->isStatic()) {
|
if ($block->isStatic()) {
|
||||||
$this->view->blType = 'Static';
|
$this->view->blType = 'Static';
|
||||||
$this->view->contents = $file->getContents();
|
$this->view->contents = $block->getContents();
|
||||||
} else {
|
} else {
|
||||||
$this->view->blType = 'Dynamic';
|
$this->view->blType = 'Dynamic';
|
||||||
$this->view->contents = $file->getCriteria();
|
$this->view->contents = $block->getCriteria();
|
||||||
}
|
}
|
||||||
|
$this->view->block = $block;
|
||||||
} else if ($type == "stream") {
|
} else if ($type == "stream") {
|
||||||
$file = new Application_Model_Webstream($id);
|
$file = new Application_Model_Webstream($id);
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,6 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$this->view->length = $formatter->format();
|
$this->view->length = $formatter->format();
|
||||||
|
|
||||||
$this->view->obj = $obj;
|
$this->view->obj = $obj;
|
||||||
Logging::log($obj->getContents());
|
|
||||||
$this->view->html = $this->view->render('playlist/update.phtml');
|
$this->view->html = $this->view->render('playlist/update.phtml');
|
||||||
$this->view->name = $obj->getName();
|
$this->view->name = $obj->getName();
|
||||||
$this->view->description = $obj->getDescription();
|
$this->view->description = $obj->getDescription();
|
||||||
|
|
|
@ -250,30 +250,50 @@ EOT;
|
||||||
} else {
|
} else {
|
||||||
$length = $this->getDynamicBlockLength();
|
$length = $this->getDynamicBlockLength();
|
||||||
}
|
}
|
||||||
$length = $length == null ? "N/A" : $length;
|
|
||||||
return $length;
|
return $length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFormattedLength()
|
||||||
|
{
|
||||||
|
$prepend = "";
|
||||||
|
if ($this->isStatic()){
|
||||||
|
$length = $this->block->getDbLength();
|
||||||
|
} else {
|
||||||
|
$length = $this->getDynamicBlockLength();
|
||||||
|
if (!$this->hasItemLimit()) {
|
||||||
|
$prepend = "~";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$formatter = new LengthFormatter($length);
|
||||||
|
$length = $prepend.$formatter->format();
|
||||||
|
return $length;
|
||||||
|
}
|
||||||
|
|
||||||
public function getDynamicBlockLength()
|
public function getDynamicBlockLength()
|
||||||
{
|
{
|
||||||
$result = CcBlockcriteriaQuery::create()->filterByDbBlockId($this->id)
|
list($value, $modifier) = $this->getLimitValueAndModifier();
|
||||||
->filterByDbCriteria('limit')->findOne();
|
|
||||||
$modifier = $result->getDbModifier();
|
|
||||||
$value = $result->getDbValue();
|
|
||||||
if ($modifier == "items") {
|
if ($modifier == "items") {
|
||||||
$length = $value." ".$modifier;
|
$length = $value." ".$modifier;
|
||||||
} else {
|
} else {
|
||||||
|
$value = str_pad($value, 2, "0", STR_PAD_LEFT);
|
||||||
if ($modifier == "minutes") {
|
if ($modifier == "minutes") {
|
||||||
$timestamp = "00:".$value.":00";
|
$length = "00:".$value.":00";
|
||||||
} else if ($modifier == "hours") {
|
} else if ($modifier == "hours") {
|
||||||
$timestamp = $value."00:00";
|
$length = $value."00:00";
|
||||||
}
|
}
|
||||||
$formatter = new LengthFormatter($timestamp);
|
|
||||||
$length = "~".$formatter->format();
|
|
||||||
}
|
}
|
||||||
return $length;
|
return $length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLimitValueAndModifier()
|
||||||
|
{
|
||||||
|
$result = CcBlockcriteriaQuery::create()->filterByDbBlockId($this->id)
|
||||||
|
->filterByDbCriteria('limit')->findOne();
|
||||||
|
$modifier = $result->getDbModifier();
|
||||||
|
$value = $result->getDbValue();
|
||||||
|
return array($value, $modifier);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
public function getStaticLength(){
|
public function getStaticLength(){
|
||||||
$sql = "SELECT SUM(cliplength) as length FROM cc_blockcontents WHERE block_id={$this->id}";
|
$sql = "SELECT SUM(cliplength) as length FROM cc_blockcontents WHERE block_id={$this->id}";
|
||||||
|
@ -886,6 +906,7 @@ EOT;
|
||||||
public function setLength($value){
|
public function setLength($value){
|
||||||
$this->block->setDbLength($value);
|
$this->block->setDbLength($value);
|
||||||
$this->block->save($this->con);
|
$this->block->save($this->con);
|
||||||
|
$this->updateBlockLengthInAllPlaylist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1056,18 +1077,31 @@ EOT;
|
||||||
// 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') {
|
||||||
$this->setLength(null);
|
if ($this->hasItemLimit()) {
|
||||||
$output['blockLength'] = $this->getDynamicBlockLength();
|
$this->setLength(null);
|
||||||
|
} else {
|
||||||
|
$this->setLength($this->getDynamicBlockLength());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$length = $this->getStaticLength();
|
$length = $this->getStaticLength();
|
||||||
$this->setLength($length);
|
$this->setLength($length);
|
||||||
$formatter = new LengthFormatter($length);
|
|
||||||
$output['blockLength'] = $formatter->format();
|
|
||||||
}
|
}
|
||||||
|
$output['blockLength'] = $this->getFormattedLength();
|
||||||
}
|
}
|
||||||
|
$this->updateBlockLengthInAllPlaylist();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasItemLimit()
|
||||||
|
{
|
||||||
|
list($value, $modifier) = $this->getLimitValueAndModifier();
|
||||||
|
if ($modifier == 'items') {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function storeCriteriaIntoDb($p_criteriaData){
|
public function storeCriteriaIntoDb($p_criteriaData){
|
||||||
// delete criteria under $p_blockId
|
// delete criteria under $p_blockId
|
||||||
CcBlockcriteriaQuery::create()->findByDbBlockId($this->id)->delete();
|
CcBlockcriteriaQuery::create()->findByDbBlockId($this->id)->delete();
|
||||||
|
@ -1128,18 +1162,28 @@ EOT;
|
||||||
$this->deleteAllFilesFromBlock();
|
$this->deleteAllFilesFromBlock();
|
||||||
$this->addAudioClips(array_keys($insertList));
|
$this->addAudioClips(array_keys($insertList));
|
||||||
// update length in playlist contents.
|
// update length in playlist contents.
|
||||||
$blocks = CcPlaylistcontentsQuery::create()->filterByDbBlockId($this->id)->find();
|
$this->updateBlockLengthInAllPlaylist();
|
||||||
$blocks->getFirst();
|
|
||||||
$iterator = $blocks->getIterator();
|
|
||||||
while ($iterator->valid()) {
|
|
||||||
$iterator->current()->setDbClipLength($this->getLength());
|
|
||||||
$iterator->current()->save();
|
|
||||||
$iterator->next();
|
|
||||||
}
|
|
||||||
return array("result"=>0);
|
return array("result"=>0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateBlockLengthInAllPlaylist()
|
||||||
|
{
|
||||||
|
$blocks = CcPlaylistcontentsQuery::create()->filterByDbBlockId($this->id)->find();
|
||||||
|
$blocks->getFirst();
|
||||||
|
$iterator = $blocks->getIterator();
|
||||||
|
while ($iterator->valid()) {
|
||||||
|
$length = $this->getLength();
|
||||||
|
if (!preg_match("/^[0-9]{2}:[0-9]{2}:[0-9]{2}/", $length)) {
|
||||||
|
$iterator->current()->setDbClipLength(null);
|
||||||
|
} else {
|
||||||
|
$iterator->current()->setDbClipLength($length);
|
||||||
|
}
|
||||||
|
$iterator->current()->save();
|
||||||
|
$iterator->next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getListOfFilesUnderLimit()
|
public function getListOfFilesUnderLimit()
|
||||||
{
|
{
|
||||||
$info = $this->getListofFilesMeetCriteria();
|
$info = $this->getListofFilesMeetCriteria();
|
||||||
|
|
|
@ -94,8 +94,8 @@ class Application_Model_Datatables
|
||||||
$pl = new Application_Model_Playlist($r['id']);
|
$pl = new Application_Model_Playlist($r['id']);
|
||||||
$r['length'] = $pl->getLength();
|
$r['length'] = $pl->getLength();
|
||||||
} else if ($r['ftype'] == "block") {
|
} else if ($r['ftype'] == "block") {
|
||||||
$bl = new Application_Model_Block($r['id']);
|
$bl = new Application_Model_Block($r['id']);
|
||||||
$r['length'] = $bl->getLength();
|
$r['length'] = $bl->getFormattedLength();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|
|
@ -198,7 +198,7 @@ EOT;
|
||||||
//format the length for UI.
|
//format the length for UI.
|
||||||
if ($row['type'] == 2){
|
if ($row['type'] == 2){
|
||||||
$bl = new Application_Model_Block($row['item_id']);
|
$bl = new Application_Model_Block($row['item_id']);
|
||||||
$formatter = new LengthFormatter($bl->getLength());
|
$formatter = new LengthFormatter($bl->getFormattedLength());
|
||||||
} else {
|
} else {
|
||||||
$formatter = new LengthFormatter($row['length']);
|
$formatter = new LengthFormatter($row['length']);
|
||||||
}
|
}
|
||||||
|
@ -257,24 +257,39 @@ EOT;
|
||||||
return $fade;
|
return $fade;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasDynamicBlockOrWebStream(){
|
// returns true/false and ids of dynamic blocks
|
||||||
$sql = "SELECT count(*) as count FROM cc_playlistcontents as pc
|
public function hasDynamicBlock(){
|
||||||
JOIN cc_block as bl ON pc.type=2 AND pc.block_id=bl.id AND bl.type='dynamic'
|
$ids = $this->getIdsOfDynamicBlocks();
|
||||||
WHERE playlist_id={$this->id} AND (pc.type=2 OR pc.type=1)";
|
if (count($ids) > 0) {
|
||||||
$r = $this->con->query($sql);
|
|
||||||
$result = $r->fetchAll(PDO::FETCH_NUM);
|
|
||||||
if (intval($result[0][0]) > 0) {
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getIdsOfDynamicBlocks() {
|
||||||
|
$sql = "SELECT bl.id FROM cc_playlistcontents as pc
|
||||||
|
JOIN cc_block as bl ON pc.type=2 AND pc.block_id=bl.id AND bl.type='dynamic'
|
||||||
|
WHERE playlist_id={$this->id} AND pc.type=2";
|
||||||
|
$r = $this->con->query($sql);
|
||||||
|
$result = $r->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
//aggregate column on playlistcontents cliplength column.
|
//aggregate column on playlistcontents cliplength column.
|
||||||
public function getLength()
|
public function getLength()
|
||||||
{
|
{
|
||||||
if ($this->hasDynamicBlockOrWebStream()){
|
if ($this->hasDynamicBlock()){
|
||||||
return "N/A";
|
$ids = $this->getIdsOfDynamicBlocks();
|
||||||
|
$length = $this->pl->getDbLength();
|
||||||
|
foreach ($ids as $id){
|
||||||
|
$bl = new Application_Model_Block($id['id']);
|
||||||
|
if ($bl->hasItemLimit()) {
|
||||||
|
return "N/A";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$formatter = new LengthFormatter($length);
|
||||||
|
return "~".$formatter->format();
|
||||||
} else {
|
} else {
|
||||||
return $this->pl->getDbLength();
|
return $this->pl->getDbLength();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
<?php if (isset($this->playlistID)): ?>
|
<?php if (isset($this->playlistID)): ?>
|
||||||
<span class='playlistID'><?php echo "$this->playlistID" ?></span>
|
<span class='playlistID'><?php echo "$this->playlistID" ?></span>
|
||||||
<span class='playlistIndex'><?php echo "$this->playlistIndex" ?></span>
|
<span class='playlistIndex'><?php echo "$this->playlistIndex" ?></span>
|
||||||
|
<?php elseif (isset($this->blockId)): ?>
|
||||||
|
<span class='blockId'><?php echo "$this->blockId" ?></span>
|
||||||
|
<span class='blockIndex'><?php echo "$this->blockIndex" ?></span>
|
||||||
<?php elseif (isset($this->audioFileID)): ?>
|
<?php elseif (isset($this->audioFileID)): ?>
|
||||||
<span class='audioFileID'><?php echo "$this->audioFileID" ?></span>
|
<span class='audioFileID'><?php echo "$this->audioFileID" ?></span>
|
||||||
<span class='audioFileTitle'><?php echo "$this->audioFileTitle" ?></span>
|
<span class='audioFileTitle'><?php echo "$this->audioFileTitle" ?></span>
|
||||||
|
|
|
@ -26,23 +26,7 @@
|
||||||
<div><span>Name:</span><span><?php echo ($this->md["dc:title"]);?></span></div>
|
<div><span>Name:</span><span><?php echo ($this->md["dc:title"]);?></span></div>
|
||||||
<div><span>Creator:</span><span><?php echo ($this->md["dc:creator"]);?></span></div>
|
<div><span>Creator:</span><span><?php echo ($this->md["dc:creator"]);?></span></div>
|
||||||
<?php if ($this->type == "block" && $this->blType == "Dynamic") { ?>
|
<?php if ($this->type == "block" && $this->blType == "Dynamic") { ?>
|
||||||
<?php if ($this->contents["limit"]["modifier"] == "items") { ?>
|
<div><span>Length:</span><span><?php echo $this->block->getFormattedLength();?></span></div>
|
||||||
<?php $len = $this->contents["limit"]["value"]." tracks"; ?>
|
|
||||||
<?php } elseif ($this->contents["limit"]["modifier"] == "minutes") { ?>
|
|
||||||
<?php
|
|
||||||
$mins = $this->contents["limit"]["value"];
|
|
||||||
if ($mins > 59) {
|
|
||||||
$hours = intval($mins / 60);
|
|
||||||
$minutes = $mins % 60;
|
|
||||||
$len = $hours.":".str_pad($minutes, 2, "0", STR_PAD_LEFT).":00.0";
|
|
||||||
} else {
|
|
||||||
$len = $this->contents["limit"]["value"].":00.0";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<?php } else {?>
|
|
||||||
<?php $len = $this->contents["limit"]["value"].":00:00.0"; ?>
|
|
||||||
<?php } ?>
|
|
||||||
<div><span>Length:</span><span><?php echo $len;?></span></div>
|
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<div><span>Length:</span><span><?php echo ($this->md["dcterms:extent"]);?></span></div>
|
<div><span>Length:</span><span><?php echo ($this->md["dcterms:extent"]);?></span></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
@ -74,13 +58,7 @@
|
||||||
<tr class='file-md-qtip-playlist <?php if ($isStatic) echo 'static'; else echo 'dynamic';?>'>
|
<tr class='file-md-qtip-playlist <?php if ($isStatic) echo 'static'; else echo 'dynamic';?>'>
|
||||||
<td class='file-md-qtip-row-width-title'><?php echo $row["track_title"] ?></td>
|
<td class='file-md-qtip-row-width-title'><?php echo $row["track_title"] ?></td>
|
||||||
<td class='file-md-qtip-row-width-artist'><?php echo $row["creator"] ?></td>
|
<td class='file-md-qtip-row-width-artist'><?php echo $row["creator"] ?></td>
|
||||||
<?php if (!$isStatic) { ?>
|
<td class='file-md-qtip-row-width-small'><?php echo $bl->getFormattedLength(); ?></td>
|
||||||
<?php $criteria = $bl->getCriteria();?>
|
|
||||||
<?php $len = $bl->getLength();?>
|
|
||||||
<td class='file-md-qtip-row-width-small'><?php echo $len ?></td>
|
|
||||||
<?php } else { ?>
|
|
||||||
<td class='file-md-qtip-row-width-small'><?php echo $row["length"] ?></td>
|
|
||||||
<?php } ?>
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -17,7 +17,7 @@ if ($item['type'] == 2) {
|
||||||
<span class="ui-icon ui-icon-play"></span>
|
<span class="ui-icon ui-icon-play"></span>
|
||||||
</div>
|
</div>
|
||||||
<?php elseif ($item['type'] == 2 && $item['exists']): ?>
|
<?php elseif ($item['type'] == 2 && $item['exists']): ?>
|
||||||
<div class="big_play ui-state-hover">
|
<div class="big_play ui-state-hover" blockId="<?php echo $item["item_id"]; ?>">
|
||||||
<span class="ui-icon ui-icon-alert"></span>
|
<span class="ui-icon ui-icon-alert"></span>
|
||||||
</div>
|
</div>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
@ -31,9 +31,9 @@ if ($item['type'] == 2) {
|
||||||
<span class="spl_cue ui-state-default"></span>
|
<span class="spl_cue ui-state-default"></span>
|
||||||
<?php } else if ($item['type'] == 2) {
|
<?php } else if ($item['type'] == 2) {
|
||||||
if ($staticBlock) {?>
|
if ($staticBlock) {?>
|
||||||
<span class="spl_block_expand close" id="expand_block_<?php echo $item['item_id']?>">Static Block Expand</span>
|
<span class="spl_block_expand close" blockId="<?php echo $item["item_id"]; ?>" id="expand_block_<?php echo $item["id"]?>">Static Block Expand</span>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<span class="spl_block_expand close" id="expand_block_<?php echo $item['item_id']?>">Dynamic Block</span>
|
<span class="spl_block_expand close" blockId="<?php echo $item["item_id"]; ?>" id="expand_block_<?php echo $item["id"]?>">Dynamic Block</span>
|
||||||
<?php }
|
<?php }
|
||||||
} ?>
|
} ?>
|
||||||
<span class="spl_title"><?php echo $item['track_title'] ?></span>
|
<span class="spl_title"><?php echo $item['track_title'] ?></span>
|
||||||
|
@ -75,7 +75,7 @@ if ($item['type'] == 2) {
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($item['type'] == 2) {?>
|
<?php if ($item['type'] == 2) {?>
|
||||||
<div id="block_<?php echo $item['item_id']?>_info"></div>
|
<div id="block_<?php echo $item["id"]?>_info"></div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</li>
|
</li>
|
||||||
<?php $i = $i+1; ?>
|
<?php $i = $i+1; ?>
|
||||||
|
|
|
@ -40,6 +40,8 @@ $(document).ready(function(){
|
||||||
var playlistIndex = $('.playlistIndex').text();
|
var playlistIndex = $('.playlistIndex').text();
|
||||||
var showID = $('.showID').text();
|
var showID = $('.showID').text();
|
||||||
var showIndex = $('.showIndex').text();
|
var showIndex = $('.showIndex').text();
|
||||||
|
var blockId = $('.blockId').text();
|
||||||
|
var blockIndex = $('.blockIndex').text();
|
||||||
|
|
||||||
var numOfItems = 0;
|
var numOfItems = 0;
|
||||||
|
|
||||||
|
@ -49,6 +51,8 @@ $(document).ready(function(){
|
||||||
playOne(audioFileID);
|
playOne(audioFileID);
|
||||||
}else if (showID != "") {
|
}else if (showID != "") {
|
||||||
playAllShow(showID, showIndex);
|
playAllShow(showID, showIndex);
|
||||||
|
}else if(blockId != "" && blockIndex != ""){
|
||||||
|
playBlock(blockId, blockIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#jp_container_1").on("mouseenter", "ul.jp-controls li", function(ev) {
|
$("#jp_container_1").on("mouseenter", "ul.jp-controls li", function(ev) {
|
||||||
|
@ -76,6 +80,17 @@ function playAllPlaylist(p_playlistID, p_playlistIndex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function playBlock(p_blockId, p_blockIndex)
|
||||||
|
{
|
||||||
|
var viewsBlockId = $('.blockId').text();
|
||||||
|
|
||||||
|
if ( _idToPostionLookUp !== undefined && viewsBlockId == p_blockId ) {
|
||||||
|
play(p_blockIndex);
|
||||||
|
}else {
|
||||||
|
buildplaylist("/audiopreview/get-block/blockId/"+p_blockId, p_blockIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets up the show to play.
|
* Sets up the show to play.
|
||||||
* checks with the show id given to the show id on the page/view
|
* checks with the show id given to the show id on the page/view
|
||||||
|
|
|
@ -31,11 +31,16 @@ function openAudioPreview(p_event) {
|
||||||
p_event.stopPropagation();
|
p_event.stopPropagation();
|
||||||
|
|
||||||
var audioFileID = $(this).attr('audioFile');
|
var audioFileID = $(this).attr('audioFile');
|
||||||
var playlistID = $('#pl_id:first').attr('value');
|
var objId = $('#obj_id:first').attr('value');
|
||||||
var playlistIndex = $(this).parent().parent().attr('id');
|
var objType = $('#obj_type:first').attr('value');
|
||||||
playlistIndex = playlistIndex.substring(4); //remove the spl_
|
var playIndex = $(this).parent().parent().attr('id');
|
||||||
|
playIndex = playIndex.substring(4); //remove the spl_
|
||||||
|
|
||||||
open_playlist_preview(playlistID, playlistIndex);
|
if (objType == "playlist") {
|
||||||
|
open_playlist_preview(objId, playIndex);
|
||||||
|
} else if (objType == "block") {
|
||||||
|
open_block_preview(objId, playIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function open_audio_preview(audioFileID, audioFileTitle, audioFileArtist) {
|
function open_audio_preview(audioFileID, audioFileTitle, audioFileArtist) {
|
||||||
|
@ -65,6 +70,17 @@ function open_playlist_preview(p_playlistID, p_playlistIndex) {
|
||||||
_preview_window.focus();
|
_preview_window.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function open_block_preview(p_blockId, p_blockIndex) {
|
||||||
|
if (p_blockIndex == undefined) //Use a resonable default.
|
||||||
|
p_blockIndex = 0;
|
||||||
|
|
||||||
|
if (_preview_window != null && !_preview_window.closed)
|
||||||
|
_preview_window.playBlock(p_blockId, p_blockIndex);
|
||||||
|
else
|
||||||
|
openPreviewWindow('audiopreview/block-preview/blockIndex/'+p_blockIndex+'/blockId/'+p_blockId);
|
||||||
|
_preview_window.focus();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Opens a jPlayer window for the specified info, for either an audio file or playlist.
|
*Opens a jPlayer window for the specified info, for either an audio file or playlist.
|
||||||
*If audioFile, audioFileTitle, audioFileArtist is supplied the jplayer opens for one file
|
*If audioFile, audioFileTitle, audioFileArtist is supplied the jplayer opens for one file
|
||||||
|
|
|
@ -629,6 +629,9 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
open_playlist_preview(playlistIndex, 0);
|
open_playlist_preview(playlistIndex, 0);
|
||||||
} else if (data.ftype === 'audioclip') {
|
} else if (data.ftype === 'audioclip') {
|
||||||
open_audio_preview(data.audioFile, data.track_title, data.artist_name);
|
open_audio_preview(data.audioFile, data.track_title, data.artist_name);
|
||||||
|
} else if (data.ftype === 'block') {
|
||||||
|
blockIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||||
|
open_block_preview(blockIndex, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
oItems.play.callback = callback;
|
oItems.play.callback = callback;
|
||||||
|
|
|
@ -356,10 +356,11 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$pl.delegate(".spl_block_expand",
|
$pl.delegate(".spl_block_expand",
|
||||||
{"click": function(ev){
|
{"click": function(ev){
|
||||||
var id = parseInt($(this).attr("id").split("_").pop(), 10);
|
var id = parseInt($(this).attr("id").split("_").pop(), 10);
|
||||||
|
var blockId = parseInt($(this).attr("blockId"), 10);
|
||||||
if ($(this).hasClass('close')) {
|
if ($(this).hasClass('close')) {
|
||||||
var sUrl = "/playlist/get-block-info";
|
var sUrl = "/playlist/get-block-info";
|
||||||
mod.disableUI();
|
mod.disableUI();
|
||||||
$.post(sUrl, {format:"json", id:id}, function(json){
|
$.post(sUrl, {format:"json", id:blockId}, function(json){
|
||||||
$html = "";
|
$html = "";
|
||||||
var data = $.parseJSON(json);
|
var data = $.parseJSON(json);
|
||||||
var isStatic = data.isStatic;
|
var isStatic = data.isStatic;
|
||||||
|
|
Loading…
Reference in New Issue