Merge branch '2.2.x' into devel
Conflicts: airtime_mvc/application/controllers/LibraryController.php airtime_mvc/application/views/scripts/library/library.phtml airtime_mvc/public/js/airtime/showbuilder/builder.js airtime_mvc/public/js/airtime/showbuilder/main_builder.js
This commit is contained in:
commit
135aadf16b
|
@ -183,7 +183,8 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
}
|
||||
if ($isAdminOrPM) {
|
||||
|
||||
if ($isAdminOrPM || $file->getFileOwnerId() == $user->getId()) {
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $baseUrl."/library/delete");
|
||||
$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => $baseUrl."/library/edit-file-md/id/{$id}");
|
||||
}
|
||||
|
@ -279,6 +280,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$streams = array();
|
||||
|
||||
$message = null;
|
||||
$noPermissionMsg = "You don't have permission to delete selected items.";
|
||||
|
||||
foreach ($mediaItems as $media) {
|
||||
|
||||
|
@ -296,19 +298,21 @@ class LibraryController extends Zend_Controller_Action
|
|||
try {
|
||||
Application_Model_Playlist::deletePlaylists($playlists, $user->getId());
|
||||
} catch (PlaylistNoPermissionException $e) {
|
||||
$this->view->message = "You don't have permission to delete selected items.";
|
||||
|
||||
return;
|
||||
$message = $noPermissionMsg;
|
||||
}
|
||||
|
||||
try {
|
||||
Application_Model_Block::deleteBlocks($blocks, $user->getId());
|
||||
} catch (BlockNoPermissionException $e) {
|
||||
$message = $noPermissionMsg;
|
||||
} catch (Exception $e) {
|
||||
//TODO: warn user that not all blocks could be deleted.
|
||||
}
|
||||
|
||||
try {
|
||||
Application_Model_Webstream::deleteStreams($streams, $user->getId());
|
||||
} catch (WebstreamNoPermissionException $e) {
|
||||
$message = $noPermissionMsg;
|
||||
} catch (Exception $e) {
|
||||
//TODO: warn user that not all streams could be deleted.
|
||||
Logging::info($e);
|
||||
|
@ -321,6 +325,8 @@ class LibraryController extends Zend_Controller_Action
|
|||
if (isset($file)) {
|
||||
try {
|
||||
$res = $file->delete(true);
|
||||
} catch (FileNoPermissionException $e) {
|
||||
$message = $noPermissionMsg;
|
||||
} catch (Exception $e) {
|
||||
//could throw a scheduled in future exception.
|
||||
$message = "Could not delete some scheduled files.";
|
||||
|
@ -367,15 +373,17 @@ class LibraryController extends Zend_Controller_Action
|
|||
{
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
if (!$isAdminOrPM) {
|
||||
return;
|
||||
}
|
||||
|
||||
$request = $this->getRequest();
|
||||
$form = new Application_Form_EditAudioMD();
|
||||
|
||||
$file_id = $this->_getParam('id', null);
|
||||
$file = Application_Model_StoredFile::Recall($file_id);
|
||||
|
||||
if (!$isAdminOrPM && $file->getFileOwnerId() != $user->getId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$form = new Application_Form_EditAudioMD();
|
||||
$form->populate($file->getDbColMetadata());
|
||||
|
||||
if ($request->isPost()) {
|
||||
|
|
|
@ -513,6 +513,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
} catch (BlockNotFoundException $e) {
|
||||
$this->playlistNotFound('block', true);
|
||||
} catch (Exception $e) {
|
||||
//Logging::info($e);
|
||||
$this->playlistUnknownError($e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -212,6 +212,14 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
|||
|
||||
}//for
|
||||
|
||||
$repeatTracks = new Zend_Form_Element_Checkbox('sp_repeat_tracks');
|
||||
$repeatTracks->setDecorators(array('viewHelper'))
|
||||
->setLabel('Allow Repeat Tracks:');
|
||||
if (isset($storedCrit["repeat_tracks"])) {
|
||||
$repeatTracks->setChecked($storedCrit["repeat_tracks"]["value"] == 1?true:false);
|
||||
}
|
||||
$this->addElement($repeatTracks);
|
||||
|
||||
$limit = new Zend_Form_Element_Select('sp_limit_options');
|
||||
$limit->setAttrib('class', 'sp_input_select')
|
||||
->setDecorators(array('viewHelper'))
|
||||
|
|
|
@ -308,10 +308,11 @@ SQL;
|
|||
$length = $value." ".$modifier;
|
||||
} else {
|
||||
$hour = "00";
|
||||
$mins = "00";
|
||||
if ($modifier == "minutes") {
|
||||
if ($value >59) {
|
||||
$hour = intval($value/60);
|
||||
$value = $value%60;
|
||||
$mins = $value%60;
|
||||
|
||||
}
|
||||
} elseif ($modifier == "hours") {
|
||||
|
@ -1092,6 +1093,14 @@ SQL;
|
|||
->setDbValue($p_criteriaData['etc']['sp_limit_value'])
|
||||
->setDbBlockId($this->id)
|
||||
->save();
|
||||
|
||||
// insert repeate track option
|
||||
$qry = new CcBlockcriteria();
|
||||
$qry->setDbCriteria("repeat_tracks")
|
||||
->setDbModifier("N/A")
|
||||
->setDbValue($p_criteriaData['etc']['sp_repeat_tracks'])
|
||||
->setDbBlockId($this->id)
|
||||
->save();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1104,7 +1113,12 @@ SQL;
|
|||
$this->saveSmartBlockCriteria($p_criteria);
|
||||
$insertList = $this->getListOfFilesUnderLimit();
|
||||
$this->deleteAllFilesFromBlock();
|
||||
$this->addAudioClips(array_keys($insertList));
|
||||
// constrcut id array
|
||||
$ids = array();
|
||||
foreach ($insertList as $ele) {
|
||||
$ids[] = $ele['id'];
|
||||
}
|
||||
$this->addAudioClips(array_values($ids));
|
||||
// update length in playlist contents.
|
||||
$this->updateBlockLengthInAllPlaylist();
|
||||
|
||||
|
@ -1133,6 +1147,7 @@ SQL;
|
|||
$info = $this->getListofFilesMeetCriteria();
|
||||
$files = $info['files'];
|
||||
$limit = $info['limit'];
|
||||
$repeat = $info['repeat_tracks'];
|
||||
|
||||
$insertList = array();
|
||||
$totalTime = 0;
|
||||
|
@ -1141,20 +1156,38 @@ SQL;
|
|||
// this moves the pointer to the first element in the collection
|
||||
$files->getFirst();
|
||||
$iterator = $files->getIterator();
|
||||
while ($iterator->valid() && $totalTime < $limit['time']) {
|
||||
|
||||
$isBlockFull = false;
|
||||
|
||||
while ($iterator->valid()) {
|
||||
$id = $iterator->current()->getDbId();
|
||||
$length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength());
|
||||
$insertList[$id] = $length;
|
||||
$insertList[] = array('id'=>$id, 'length'=>$length);
|
||||
$totalTime += $length;
|
||||
$totalItems++;
|
||||
|
||||
if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500) {
|
||||
if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500 || $totalTime > $limit['time']) {
|
||||
$isBlockFull = true;
|
||||
break;
|
||||
}
|
||||
|
||||
$iterator->next();
|
||||
}
|
||||
|
||||
$sizeOfInsert = count($insertList);
|
||||
|
||||
// if block is not full and reapeat_track is check, fill up more
|
||||
while (!$isBlockFull && $repeat == 1) {
|
||||
$randomEleKey = array_rand(array_slice($insertList, 0, $sizeOfInsert));
|
||||
$insertList[] = $insertList[$randomEleKey];
|
||||
$totalTime += $insertList[$randomEleKey]['length'];
|
||||
$totalItems++;
|
||||
|
||||
if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500 || $totalTime > $limit['time']) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $insertList;
|
||||
}
|
||||
|
||||
|
@ -1201,6 +1234,8 @@ SQL;
|
|||
|
||||
if ($criteria == "limit") {
|
||||
$storedCrit["limit"] = array("value"=>$value, "modifier"=>$modifier);
|
||||
} else if($criteria == "repeat_tracks") {
|
||||
$storedCrit["repeat_tracks"] = array("value"=>$value);
|
||||
} else {
|
||||
$storedCrit["crit"][$criteria][] = array("criteria"=>$criteria, "value"=>$value, "modifier"=>$modifier, "extra"=>$extra, "display_name"=>$criteriaOptions[$criteria]);
|
||||
}
|
||||
|
@ -1316,6 +1351,7 @@ SQL;
|
|||
}
|
||||
// construct limit restriction
|
||||
$limits = array();
|
||||
|
||||
if (isset($storedCrit['limit'])) {
|
||||
if ($storedCrit['limit']['modifier'] == "items") {
|
||||
$limits['time'] = 1440 * 60;
|
||||
|
@ -1327,10 +1363,16 @@ SQL;
|
|||
$limits['items'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
$repeatTracks = 0;
|
||||
if (isset($storedCrit['repeat_tracks'])) {
|
||||
$repeatTracks = $storedCrit['repeat_tracks']['value'];
|
||||
}
|
||||
|
||||
try {
|
||||
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
|
||||
|
||||
return array("files"=>$out, "limit"=>$limits, "count"=>$out->count());
|
||||
return array("files"=>$out, "limit"=>$limits, "repeat_tracks"=> $repeatTracks, "count"=>$out->count());
|
||||
} catch (Exception $e) {
|
||||
Logging::info($e);
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@ class Application_Model_Datatables
|
|||
if ($dbname == 'utime' || $dbname == 'mtime') {
|
||||
$input1 = isset($info[0])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[0]):null;
|
||||
$input2 = isset($info[1])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[1]):null;
|
||||
} else if($dbname == 'bit_rate') {
|
||||
$input1 = isset($info[0])?intval($info[0]) * 1000:null;
|
||||
$input2 = isset($info[1])?intval($info[1]) * 1000:null;
|
||||
} else if($dbname == 'bit_rate' || $dbname == 'sample_rate') {
|
||||
$input1 = isset($info[0])?doubleval($info[0]) * 1000:null;
|
||||
$input2 = isset($info[1])?doubleval($info[1]) * 1000:null;
|
||||
} else {
|
||||
$input1 = isset($info[0])?$info[0]:null;
|
||||
$input2 = isset($info[1])?$info[1]:null;
|
||||
|
|
|
@ -292,7 +292,8 @@ SQL;
|
|||
ft.artist_name AS file_artist_name,
|
||||
ft.album_title AS file_album_title,
|
||||
ft.length AS file_length,
|
||||
ft.file_exists AS file_exists
|
||||
ft.file_exists AS file_exists,
|
||||
ft.mime AS file_mime
|
||||
SQL;
|
||||
$filesJoin = <<<SQL
|
||||
cc_schedule AS sched
|
||||
|
@ -319,7 +320,8 @@ SQL;
|
|||
sub.login AS file_artist_name,
|
||||
ws.description AS file_album_title,
|
||||
ws.length AS file_length,
|
||||
't'::BOOL AS file_exists
|
||||
't'::BOOL AS file_exists,
|
||||
NULL as file_mime
|
||||
SQL;
|
||||
$streamJoin = <<<SQL
|
||||
cc_schedule AS sched
|
||||
|
@ -661,6 +663,7 @@ SQL;
|
|||
$data["media"][$switch_start]['start'] = $switch_start;
|
||||
$data["media"][$switch_start]['end'] = $switch_start;
|
||||
$data["media"][$switch_start]['event_type'] = "switch_off";
|
||||
$data["media"][$switch_start]['type'] = "event";
|
||||
$data["media"][$switch_start]['independent_event'] = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,6 +270,13 @@ SQL;
|
|||
|
||||
try {
|
||||
//update the status flag in cc_schedule.
|
||||
|
||||
/* Since we didn't use a propel object when updating
|
||||
* cc_show_instances table we need to clear the instances
|
||||
* so the correct information is retrieved from the db
|
||||
*/
|
||||
CcShowInstancesPeer::clearInstancePool();
|
||||
|
||||
$instances = CcShowInstancesQuery::create()
|
||||
->filterByDbEnds($current_timestamp, Criteria::GREATER_THAN)
|
||||
->filterByDbShowId($this->_showId)
|
||||
|
@ -1254,6 +1261,7 @@ SQL;
|
|||
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||
$con->beginTransaction();
|
||||
|
||||
|
||||
//current timesamp in UTC.
|
||||
$current_timestamp = gmdate("Y-m-d H:i:s");
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ class Application_Model_ShowBuilder
|
|||
"fadein" => "",
|
||||
"fadeout" => "",
|
||||
"image" => false,
|
||||
"mime" => null,
|
||||
"color" => "", //in hex without the '#' sign.
|
||||
"backgroundColor" => "", //in hex without the '#' sign.
|
||||
);
|
||||
|
@ -277,6 +278,7 @@ class Application_Model_ShowBuilder
|
|||
$row["cueout"] = $p_item["cue_out"];
|
||||
$row["fadein"] = round(substr($p_item["fade_in"], 6), 6);
|
||||
$row["fadeout"] = round(substr($p_item["fade_out"], 6), 6);
|
||||
$row["mime"] = $p_item["file_mime"];
|
||||
|
||||
$row["pos"] = $this->pos++;
|
||||
|
||||
|
|
|
@ -344,6 +344,13 @@ SQL;
|
|||
throw new DeleteScheduledFileException();
|
||||
}
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
if (!$isAdminOrPM && $this->getFileOwnerId() != $user->getId()) {
|
||||
throw new FileNoPermissionException();
|
||||
}
|
||||
|
||||
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
|
||||
$type = $music_dir->getType();
|
||||
|
||||
|
@ -1163,6 +1170,10 @@ SQL;
|
|||
return $this->_file->getDbFileExists();
|
||||
}
|
||||
|
||||
public function getFileOwnerId()
|
||||
{
|
||||
return $this->_file->getDbOwnerId();
|
||||
}
|
||||
|
||||
// note: never call this method from controllers because it does a sleep
|
||||
public function uploadToSoundCloud()
|
||||
|
@ -1211,3 +1222,4 @@ SQL;
|
|||
|
||||
class DeleteScheduledFileException extends Exception {}
|
||||
class FileDoesNotExistException extends Exception {}
|
||||
class FileNoPermissionException extends Exception {}
|
||||
|
|
|
@ -92,7 +92,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
if (count($leftOver) == 0) {
|
||||
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
|
||||
} else {
|
||||
throw new Exception("Invalid user permissions");
|
||||
throw new WebstreamNoPermissionException;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
}
|
||||
$mediaUrl = self::getMediaUrl($url, $mime, $content_length_found);
|
||||
|
||||
if (preg_match("/(x-mpegurl)|(xspf\+xml)|(pls\+xml)/", $mime)) {
|
||||
if (preg_match("/(x-mpegurl)|(xspf\+xml)|(pls\+xml)|(x-scpls)/", $mime)) {
|
||||
list($mime, $content_length_found) = self::discoverStreamMime($mediaUrl);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
@ -307,7 +307,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
$media_url = self::getM3uUrl($url);
|
||||
} elseif (preg_match("/xspf\+xml/", $mime)) {
|
||||
$media_url = self::getXspfUrl($url);
|
||||
} elseif (preg_match("/pls\+xml/", $mime)) {
|
||||
} elseif (preg_match("/pls\+xml/", $mime) || preg_match("/x-scpls/", $mime)) {
|
||||
$media_url = self::getPlsUrl($url);
|
||||
} elseif (preg_match("/(mpeg|ogg)/", $mime)) {
|
||||
if ($content_length_found) {
|
||||
|
@ -370,3 +370,6 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
return $webstream->getDbId();
|
||||
}
|
||||
}
|
||||
|
||||
class WebstreamNoPermissionException extends Exception {}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class CcBlockTableMap extends TableMap {
|
|||
*/
|
||||
public function buildRelations()
|
||||
{
|
||||
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), null, null);
|
||||
$this->addRelation('CcSubjs', 'CcSubjs', RelationMap::MANY_TO_ONE, array('creator_id' => 'id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcPlaylistcontents', 'CcPlaylistcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcBlockcontents', 'CcBlockcontents', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcBlockcriteria', 'CcBlockcriteria', RelationMap::ONE_TO_MANY, array('id' => 'block_id', ), 'CASCADE', null);
|
||||
|
|
|
@ -64,7 +64,7 @@ class CcSubjsTableMap extends TableMap {
|
|||
$this->addRelation('CcPerms', 'CcPerms', RelationMap::ONE_TO_MANY, array('id' => 'subj', ), 'CASCADE', null);
|
||||
$this->addRelation('CcShowHosts', 'CcShowHosts', RelationMap::ONE_TO_MANY, array('id' => 'subjs_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcPlaylist', 'CcPlaylist', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), null, null);
|
||||
$this->addRelation('CcBlock', 'CcBlock', RelationMap::ONE_TO_MANY, array('id' => 'creator_id', ), 'CASCADE', null);
|
||||
$this->addRelation('CcPref', 'CcPref', RelationMap::ONE_TO_MANY, array('id' => 'subjid', ), 'CASCADE', null);
|
||||
$this->addRelation('CcSess', 'CcSess', RelationMap::ONE_TO_MANY, array('id' => 'userid', ), 'CASCADE', null);
|
||||
$this->addRelation('CcSubjsToken', 'CcSubjsToken', RelationMap::ONE_TO_MANY, array('id' => 'user_id', ), 'CASCADE', null);
|
||||
|
|
|
@ -407,6 +407,9 @@ abstract class BaseCcSubjsPeer {
|
|||
// Invalidate objects in CcPlaylistPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CcPlaylistPeer::clearInstancePool();
|
||||
// Invalidate objects in CcBlockPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CcBlockPeer::clearInstancePool();
|
||||
// Invalidate objects in CcPrefPeer instance pool,
|
||||
// since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
|
||||
CcPrefPeer::clearInstancePool();
|
||||
|
|
|
@ -30,8 +30,22 @@
|
|||
|
||||
<dd id='sp_criteria-element' class='criteria-element'>
|
||||
<?php for ($i = 0; $i < $this->criteriasLength; $i++) {?>
|
||||
<?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {?>
|
||||
<div <?php if (($i > 0) && ($this->element->getElement("sp_criteria_field_".$i."_".$j)->getAttrib('disabled') == 'disabled')) {
|
||||
<?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {
|
||||
if ($this->modRowMap[$i] > 1 && $j != $this->modRowMap[$i]-1) $logicLabel = 'or';
|
||||
else $logicLabel = 'and';
|
||||
$disabled = $this->element->getElement("sp_criteria_field_".$i."_".$j)->getAttrib('disabled') == 'disabled'?true:false;
|
||||
// determine if the next row is disabled and only display the logic label if it isn't
|
||||
if ($j == $this->modRowMap[$i]-1 && $i < 25) {
|
||||
$n = $i+1;
|
||||
$nextIndex = $n."_0";
|
||||
} elseif ($j+1 < $this->modRowMap[$i]-1) {
|
||||
$n = $j+1;
|
||||
$nextIndex = $i."_".$n;
|
||||
|
||||
}
|
||||
$nextDisabled = $this->element->getElement("sp_criteria_field_".$nextIndex)->getAttrib('disabled') == 'disabled'?true:false;
|
||||
?>
|
||||
<div <?php if (($i > 0) && $disabled) {
|
||||
echo 'style=display:none';
|
||||
} ?>>
|
||||
<?php echo $this->element->getElement("sp_criteria_field_".$i."_".$j) ?>
|
||||
|
@ -45,6 +59,9 @@
|
|||
<a style='margin-right:3px' class='btn btn-small btn-danger' id='criteria_remove_<?php echo $i ?>'>
|
||||
<i class='icon-white icon-remove'></i>
|
||||
</a>
|
||||
<span class='db-logic-label' <?php if ($nextDisabled) echo "style='display:none'"?>>
|
||||
<?php echo $logicLabel;?>
|
||||
</span>
|
||||
<?php if($this->element->getElement("sp_criteria_field_".$i."_".$j)->hasErrors()) : ?>
|
||||
<?php foreach($this->element->getElement("sp_criteria_field_".$i."_".$j)->getMessages() as $error): ?>
|
||||
<span class='errors sp-errors'>
|
||||
|
@ -59,6 +76,20 @@
|
|||
<br />
|
||||
</dd>
|
||||
|
||||
<dd id='sp_repeate_tracks-element'>
|
||||
<span class='sp_text_font'><?php echo $this->element->getElement('sp_repeat_tracks')->getLabel() ?></span>
|
||||
<span class='repeat_tracks_help_icon'></span>
|
||||
<?php echo $this->element->getElement('sp_repeat_tracks')?>
|
||||
<?php if($this->element->getElement("sp_repeat_tracks")->hasErrors()) : ?>
|
||||
<?php foreach($this->element->getElement("sp_repeat_tracks")->getMessages() as $error): ?>
|
||||
<span class='errors sp-errors'>
|
||||
<?php echo $error; ?>
|
||||
</span>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<br />
|
||||
</dd>
|
||||
|
||||
<dd id='sp_limit-element'>
|
||||
<span class='sp_text_font'><?php echo $this->element->getElement('sp_limit_value')->getLabel() ?></span>
|
||||
<?php echo $this->element->getElement('sp_limit_value')?>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong">
|
||||
<h2>Edit Metadata</h2>
|
||||
|
||||
<?php $this->form->setAction($this->url());
|
||||
<?php //$this->form->setAction($this->url());
|
||||
echo $this->form; ?>
|
||||
</div>
|
||||
|
|
|
@ -92,5 +92,13 @@ if ($item['type'] == 2) {
|
|||
<?php endforeach; ?>
|
||||
|
||||
<?php else : ?>
|
||||
<li class="spl_empty">Empty playlist</li>
|
||||
<li class="spl_empty">
|
||||
<?php
|
||||
if ($this->obj instanceof Application_Model_Block) {
|
||||
echo 'Empty smart block';
|
||||
} else {
|
||||
echo 'Empty playlist';
|
||||
}
|
||||
?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="wrapper">
|
||||
<div id="library_content" class="lib-content tabs ui-widget ui-widget-content block-shadow alpha-block padded">
|
||||
<div id="import_status" style="display:none">File import in progress...</div>
|
||||
<fieldset class="toggle" id="filter_options">
|
||||
<fieldset class="toggle closed" id="filter_options">
|
||||
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span>Advanced Search Options</legend>
|
||||
<div id="advanced_search" class="advanced_search form-horizontal"></div>
|
||||
</fieldset>
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
<li id='lib-new-ws'><a href="#">New Webstream</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="btn-group pull-right">
|
||||
<button class="btn btn-inverse" type="submit" id="webstream_save" name="submit">Save</button>
|
||||
</div>
|
||||
<?php if (isset($this->obj)) : ?>
|
||||
<div class="btn-group pull-right">
|
||||
<button id="ws_delete" class="btn" <?php if ($this->action == "new"): ?>style="display:none;"<?php endif; ?>aria-disabled="false">Delete</button>
|
||||
|
@ -37,6 +41,11 @@
|
|||
<dd id="description-element">
|
||||
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->obj->getDescription(); ?></textarea>
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
<dl class="zend_form">
|
||||
<dt id="submit-label" style="display: none;"> </dt>
|
||||
<div id="url-error" class="errors" style="display:none;"></div>
|
||||
<dt id="streamurl-label"><label for="streamurl">Stream URL:</label></dt>
|
||||
|
@ -48,13 +57,7 @@
|
|||
<dd id="streamlength-element">
|
||||
<input type="text" value="<?php echo $this->obj->getDefaultLength() ?>"/>
|
||||
</dd>
|
||||
<dd id="submit-element" class="buttons">
|
||||
<input class="btn btn-inverse" type="submit" value="Save" id="webstream_save" name="submit">
|
||||
</dd>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
<?php else : ?>
|
||||
<div>No webstream</div>
|
||||
|
|
|
@ -250,7 +250,7 @@
|
|||
<parameter name="foreign_table" value="cc_blockcontents" />
|
||||
<parameter name="expression" value="SUM(cliplength)" />
|
||||
</behavior>
|
||||
<foreign-key foreignTable="cc_subjs" name="cc_block_createdby_fkey">
|
||||
<foreign-key foreignTable="cc_subjs" name="cc_block_createdby_fkey" onDelete="CASCADE">
|
||||
<reference local="creator_id" foreign="id"/>
|
||||
</foreign-key>
|
||||
</table>
|
||||
|
|
|
@ -697,7 +697,7 @@ ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_block_id_f
|
|||
|
||||
ALTER TABLE "cc_playlistcontents" ADD CONSTRAINT "cc_playlistcontents_playlist_id_fkey" FOREIGN KEY ("playlist_id") REFERENCES "cc_playlist" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_block" ADD CONSTRAINT "cc_block_createdby_fkey" FOREIGN KEY ("creator_id") REFERENCES "cc_subjs" ("id");
|
||||
ALTER TABLE "cc_block" ADD CONSTRAINT "cc_block_createdby_fkey" FOREIGN KEY ("creator_id") REFERENCES "cc_subjs" ("id") ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE "cc_blockcontents" ADD CONSTRAINT "cc_blockcontents_file_id_fkey" FOREIGN KEY ("file_id") REFERENCES "cc_files" ("id") ON DELETE CASCADE;
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ select {
|
|||
}
|
||||
|
||||
.airtime_auth_help_icon, .custom_auth_help_icon, .stream_username_help_icon,
|
||||
.playlist_type_help_icon, .master_username_help_icon {
|
||||
.playlist_type_help_icon, .master_username_help_icon, .repeat_tracks_help_icon{
|
||||
cursor: help;
|
||||
position: relative;
|
||||
display:inline-block; zoom:1;
|
||||
|
@ -514,6 +514,9 @@ table.library-get-file-md.table-small{
|
|||
|
||||
|
||||
/***** SMART BLOCK SPECIFIC STYLES BEGIN *****/
|
||||
.db-logic-label{
|
||||
font-size:11px;
|
||||
}
|
||||
.sp-invisible{
|
||||
visibility: hidden;
|
||||
}
|
||||
|
|
|
@ -14,5 +14,6 @@ function isAudioSupported(mime){
|
|||
//Note that checking the navigator.mimeTypes value does not work for IE7, but the alternative
|
||||
//is adding a javascript library to do the work for you, which seems like overkill....
|
||||
return (!!audio.canPlayType && audio.canPlayType(bMime) != "") ||
|
||||
(mime.indexOf("mp3") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined);
|
||||
(mime.indexOf("mp3") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) ||
|
||||
(mime.indexOf("mp4") != -1 && navigator.mimeTypes ["application/x-shockwave-flash"] != undefined);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,11 @@ var AIRTIME = (function(AIRTIME) {
|
|||
var $nRow = $(nRow);
|
||||
if (aData.ftype === "audioclip") {
|
||||
$nRow.addClass("lib-audio");
|
||||
$image = $nRow.find('td.library_type');
|
||||
if (!isAudioSupported(aData.mime)) {
|
||||
$image.html('<span class="ui-icon ui-icon-locked"></span>');
|
||||
aData.image = '<span class="ui-icon ui-icon-locked"></span>';
|
||||
}
|
||||
} else if (aData.ftype === "stream") {
|
||||
$nRow.addClass("lib-stream");
|
||||
} else if (aData.ftype === "block") {
|
||||
|
@ -64,8 +69,9 @@ var AIRTIME = (function(AIRTIME) {
|
|||
helper : function() {
|
||||
|
||||
var $el = $(this), selected = mod
|
||||
.getChosenAudioFilesLength(), container, message, li = $("#side_playlist ul[id='spl_sortable'] li:first"), width = li
|
||||
.width(), height = 55;
|
||||
.getChosenAudioFilesLength(), container, message, li = $("#side_playlist ul[id='spl_sortable'] li:first"),
|
||||
width = li.width(), height = 55;
|
||||
if (width > 798) width = 798;
|
||||
|
||||
// dragging an element that has an unselected
|
||||
// checkbox.
|
||||
|
|
|
@ -29,6 +29,11 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
if (aData.ftype === "audioclip") {
|
||||
$nRow.addClass("lib-audio");
|
||||
$image = $nRow.find('td.library_type');
|
||||
if (!isAudioSupported(aData.mime)) {
|
||||
$image.html('<span class="ui-icon ui-icon-locked"></span>');
|
||||
aData.image = '<span class="ui-icon ui-icon-locked"></span>';
|
||||
}
|
||||
} else if (aData.ftype === "stream") {
|
||||
$nRow.addClass("lib-stream");
|
||||
} else {
|
||||
|
|
|
@ -252,11 +252,11 @@ var AIRTIME = (function(AIRTIME) {
|
|||
};
|
||||
|
||||
/*
|
||||
* selects all items which the user can currently see.
|
||||
* (behaviour taken from gmail)
|
||||
* selects all items which the user can currently see. (behaviour taken from
|
||||
* gmail)
|
||||
*
|
||||
* by default the items are selected in reverse order
|
||||
* so we need to reverse it back
|
||||
* by default the items are selected in reverse order so we need to reverse
|
||||
* it back
|
||||
*/
|
||||
mod.selectCurrentPage = function() {
|
||||
$.fn.reverse = [].reverse;
|
||||
|
@ -276,8 +276,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
};
|
||||
|
||||
/*
|
||||
* deselects all items that the user can currently see.
|
||||
* (behaviour taken from gmail)
|
||||
* deselects all items that the user can currently see. (behaviour taken
|
||||
* from gmail)
|
||||
*/
|
||||
mod.deselectCurrentPage = function() {
|
||||
var $inputs = $libTable.find("tbody input:checkbox"),
|
||||
|
@ -433,7 +433,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
oTable = $libTable.dataTable( {
|
||||
|
||||
//put hidden columns at the top to insure they can never be visible on the table through column reordering.
|
||||
// put hidden columns at the top to insure they can never be visible
|
||||
// on the table through column reordering.
|
||||
"aoColumns": [
|
||||
/* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false } ,
|
||||
/* Checkbox */ { "sTitle" : "" , "mDataProp" : "checkbox" , "bSortable" : false , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_checkbox" } ,
|
||||
|
@ -524,11 +525,12 @@ var AIRTIME = (function(AIRTIME) {
|
|||
"sAjaxDataProp": "files",
|
||||
|
||||
"fnServerData": function ( sSource, aoData, fnCallback ) {
|
||||
/* The real validation check is done in dataTables.columnFilter.js
|
||||
* We also need to check it here because datatable is redrawn everytime
|
||||
* an action is performed in the Library page.
|
||||
* In order for datatable to redraw the advanced search fields
|
||||
* MUST all be valid.
|
||||
/*
|
||||
* The real validation check is done in
|
||||
* dataTables.columnFilter.js We also need to check it here
|
||||
* because datatable is redrawn everytime an action is performed
|
||||
* in the Library page. In order for datatable to redraw the
|
||||
* advanced search fields MUST all be valid.
|
||||
*/
|
||||
var advSearchFields = $("div#advanced_search").children(':visible');
|
||||
var advSearchValid = validateAdvancedSearch(advSearchFields);
|
||||
|
@ -555,27 +557,36 @@ var AIRTIME = (function(AIRTIME) {
|
|||
// add the play function to the library_type td
|
||||
$(nRow).find('td.library_type').click(function(){
|
||||
if (aData.ftype === 'playlist' && aData.length !== '0.0'){
|
||||
playlistIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||
playlistIndex = $(this).parent().attr('id').substring(3); // remove
|
||||
// the
|
||||
// pl_
|
||||
open_playlist_preview(playlistIndex, 0);
|
||||
} else if (aData.ftype === 'audioclip') {
|
||||
if (isAudioSupported(aData.mime)) {
|
||||
open_audio_preview(aData.ftype, aData.audioFile, aData.track_title, aData.artist_name);
|
||||
}
|
||||
} else if (aData.ftype == 'stream') {
|
||||
open_audio_preview(aData.ftype, aData.audioFile, aData.track_title, aData.artist_name);
|
||||
} else if (aData.ftype == 'block' && aData.bl_type == 'static') {
|
||||
blockIndex = $(this).parent().attr('id').substring(3); //remove the bl_
|
||||
blockIndex = $(this).parent().attr('id').substring(3); // remove
|
||||
// the
|
||||
// bl_
|
||||
open_block_preview(blockIndex, 0);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
alreadyclicked=false;
|
||||
//call the context menu so we can prevent the event from propagating.
|
||||
// call the context menu so we can prevent the event from
|
||||
// propagating.
|
||||
$(nRow).find('td:not(.library_checkbox, .library_type)').click(function(e){
|
||||
var el=$(this);
|
||||
if (alreadyclicked)
|
||||
{
|
||||
alreadyclicked=false; // reset
|
||||
clearTimeout(alreadyclickedTimeout); // prevent this from happening
|
||||
clearTimeout(alreadyclickedTimeout); // prevent this
|
||||
// from
|
||||
// happening
|
||||
// do what needs to happen on double click.
|
||||
|
||||
$tr = $(el).parent();
|
||||
|
@ -596,7 +607,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
return false;
|
||||
});
|
||||
|
||||
//add a tool tip to appear when the user clicks on the type icon.
|
||||
// add a tool tip to appear when the user clicks on the type
|
||||
// icon.
|
||||
$(nRow).find("td:not(.library_checkbox, .library_type)").qtip({
|
||||
content: {
|
||||
text: "Loading...",
|
||||
|
@ -620,7 +632,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
},
|
||||
my: 'left center',
|
||||
at: 'right center',
|
||||
viewport: $(window), // Keep the tooltip on-screen at all times
|
||||
viewport: $(window), // Keep the tooltip on-screen at
|
||||
// all times
|
||||
effect: false // Disable positioning animation
|
||||
},
|
||||
style: {
|
||||
|
@ -641,7 +654,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
// remove any selected nodes before the draw.
|
||||
"fnPreDrawCallback": function( oSettings ) {
|
||||
|
||||
//make sure any dragging helpers are removed or else they'll be stranded on the screen.
|
||||
// make sure any dragging helpers are removed or else they'll be
|
||||
// stranded on the screen.
|
||||
$("#draggingContainer").remove();
|
||||
},
|
||||
"fnDrawCallback": AIRTIME.library.fnDrawCallback,
|
||||
|
@ -674,13 +688,31 @@ var AIRTIME = (function(AIRTIME) {
|
|||
setColumnFilter(oTable);
|
||||
oTable.fnSetFilteringDelay(350);
|
||||
|
||||
var simpleSearchText;
|
||||
|
||||
$libContent.on("click", "legend", function(){
|
||||
$simpleSearch = $libContent.find("#library_display_filter label");
|
||||
var $fs = $(this).parents("fieldset");
|
||||
|
||||
if ($fs.hasClass("closed")) {
|
||||
$fs.removeClass("closed");
|
||||
|
||||
//keep value of simple search for when user switches back to it
|
||||
simpleSearchText = $simpleSearch.find('input').val();
|
||||
|
||||
// clear the simple search text field and reset datatable
|
||||
$(".dataTables_filter input").val("").keyup();
|
||||
|
||||
$simpleSearch.addClass("sp-invisible");
|
||||
}
|
||||
else {
|
||||
//clear the advanced search fields and reset datatable
|
||||
$(".filter_column input").val("").keyup();
|
||||
|
||||
//reset datatable with previous simple search results (if any)
|
||||
$(".dataTables_filter input").val(simpleSearchText).keyup();
|
||||
|
||||
$simpleSearch.removeClass("sp-invisible");
|
||||
$fs.addClass("closed");
|
||||
}
|
||||
});
|
||||
|
@ -796,12 +828,16 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
callback = function() {
|
||||
if (data.ftype === 'playlist' && data.length !== '0.0'){
|
||||
playlistIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||
playlistIndex = $(this).parent().attr('id').substring(3); // remove
|
||||
// the
|
||||
// pl_
|
||||
open_playlist_preview(playlistIndex, 0);
|
||||
} else if (data.ftype === 'audioclip' || data.ftype === 'stream') {
|
||||
open_audio_preview(data.ftype, data.audioFile, data.track_title, data.artist_name);
|
||||
} else if (data.ftype === 'block') {
|
||||
blockIndex = $(this).parent().attr('id').substring(3); //remove the pl_
|
||||
blockIndex = $(this).parent().attr('id').substring(3); // remove
|
||||
// the
|
||||
// pl_
|
||||
open_block_preview(blockIndex, 0);
|
||||
}
|
||||
};
|
||||
|
@ -812,7 +848,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
if (oItems.del !== undefined) {
|
||||
|
||||
// delete through the playlist controller, will reset
|
||||
//playlist screen if this is the currently edited playlist.
|
||||
// playlist screen if this is the currently edited
|
||||
// playlist.
|
||||
if ((data.ftype === "playlist" || data.ftype === "block") && screen === "playlist") {
|
||||
callback = function() {
|
||||
aMedia = [];
|
||||
|
@ -985,7 +1022,8 @@ function addQtipToSCIcons(){
|
|||
viewport: $(window)
|
||||
},
|
||||
show: {
|
||||
ready: true // Needed to make it show on first mouseover event
|
||||
ready: true // Needed to make it show on first mouseover
|
||||
// event
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1012,7 +1050,8 @@ function addQtipToSCIcons(){
|
|||
viewport: $(window)
|
||||
},
|
||||
show: {
|
||||
ready: true // Needed to make it show on first mouseover event
|
||||
ready: true // Needed to make it show on first mouseover
|
||||
// event
|
||||
}
|
||||
});
|
||||
}else if($(this).hasClass("sc-error")){
|
||||
|
@ -1039,7 +1078,8 @@ function addQtipToSCIcons(){
|
|||
viewport: $(window)
|
||||
},
|
||||
show: {
|
||||
ready: true // Needed to make it show on first mouseover event
|
||||
ready: true // Needed to make it show on first mouseover
|
||||
// event
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1101,11 +1141,11 @@ function validateAdvancedSearch(divs) {
|
|||
|
||||
addRemoveValidationIcons(valid, $(field), searchTermType);
|
||||
|
||||
/* Empty fields should not have valid/invalid indicator
|
||||
* Range values are considered valid even if only the
|
||||
* 'From' value is provided. Therefore, if the 'To' value
|
||||
* is empty but the 'From' value is not empty we need to
|
||||
* keep the validation icon on screen.
|
||||
/*
|
||||
* Empty fields should not have valid/invalid indicator Range values
|
||||
* are considered valid even if only the 'From' value is provided.
|
||||
* Therefore, if the 'To' value is empty but the 'From' value is not
|
||||
* empty we need to keep the validation icon on screen.
|
||||
*/
|
||||
} else if (searchTerm[0] === "" && searchTerm[1] !== "" ||
|
||||
searchTerm[0] === "" && searchTerm[1] === ""){
|
||||
|
@ -1158,12 +1198,9 @@ function addRemoveValidationIcons(valid, field, searchTermType) {
|
|||
}
|
||||
}
|
||||
|
||||
/* Validation types:
|
||||
* s => string
|
||||
* i => integer
|
||||
* n => numeric (positive/negative, whole/decimals)
|
||||
* t => timestamp
|
||||
* l => length
|
||||
/*
|
||||
* Validation types: s => string i => integer n => numeric (positive/negative,
|
||||
* whole/decimals) t => timestamp l => length
|
||||
*/
|
||||
var validationTypes = {
|
||||
"album_title" : "s",
|
||||
|
@ -1192,7 +1229,7 @@ var validationTypes = {
|
|||
"owner_id" : "s",
|
||||
"rating" : "i",
|
||||
"replay_gain" : "n",
|
||||
"sample_rate" : "i",
|
||||
"sample_rate" : "n",
|
||||
"track_title" : "s",
|
||||
"track_number" : "i",
|
||||
"info_url" : "s",
|
||||
|
|
|
@ -8,14 +8,17 @@ function setSmartBlockEvents() {
|
|||
/********** ADD CRITERIA ROW **********/
|
||||
form.find('#criteria_add').live('click', function(){
|
||||
|
||||
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last').next();
|
||||
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last');
|
||||
|
||||
div.find('.db-logic-label').text('and').show();
|
||||
div = div.next().show();
|
||||
|
||||
div.show();
|
||||
div.children().removeAttr('disabled');
|
||||
div = div.next();
|
||||
if (div.length === 0) {
|
||||
$(this).hide();
|
||||
}
|
||||
|
||||
appendAddButton();
|
||||
appendModAddButton();
|
||||
removeButtonCheck();
|
||||
|
@ -285,6 +288,11 @@ function reindexElements() {
|
|||
var divs = $('#smart-block-form').find('div select[name^="sp_criteria_field"]').parent(),
|
||||
index = 0,
|
||||
modIndex = 0;
|
||||
/* Hide all logic labels
|
||||
* We will re-add them as each row gets indexed
|
||||
*/
|
||||
$('.db-logic-label').text('').hide();
|
||||
|
||||
$.each(divs, function(i, div){
|
||||
if (i > 0 && index < 26) {
|
||||
|
||||
|
@ -292,8 +300,14 @@ function reindexElements() {
|
|||
* a modifier row
|
||||
*/
|
||||
if ($(div).find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
||||
if ($(div).is(':visible')) {
|
||||
$(div).prev().find('.db-logic-label').text('or').show();
|
||||
}
|
||||
modIndex++;
|
||||
} else {
|
||||
if ($(div).is(':visible')) {
|
||||
$(div).prev().find('.db-logic-label').text('and').show();
|
||||
}
|
||||
index++;
|
||||
modIndex = 0;
|
||||
}
|
||||
|
@ -338,7 +352,7 @@ function setupUI() {
|
|||
var plContents = $('#spl_sortable').children();
|
||||
var shuffleButton = $('button[id="shuffle_button"]');
|
||||
|
||||
if (plContents.text() !== 'Empty playlist') {
|
||||
if (!plContents.hasClass('spl_empty')) {
|
||||
if (shuffleButton.hasClass('ui-state-disabled')) {
|
||||
shuffleButton.removeClass('ui-state-disabled');
|
||||
shuffleButton.removeAttr('disabled');
|
||||
|
@ -384,6 +398,28 @@ function setupUI() {
|
|||
at: "right center"
|
||||
},
|
||||
});
|
||||
|
||||
$(".repeat_tracks_help_icon").qtip({
|
||||
content: {
|
||||
text: "If your criteria is too strict, Airtime may not be able to fill up the desired smart block length." +
|
||||
" Hence, if you check this option, tracks will be used more than once."
|
||||
},
|
||||
hide: {
|
||||
delay: 500,
|
||||
fixed: true
|
||||
},
|
||||
style: {
|
||||
border: {
|
||||
width: 0,
|
||||
radius: 4
|
||||
},
|
||||
classes: "ui-tooltip-dark ui-tooltip-rounded"
|
||||
},
|
||||
position: {
|
||||
my: "left bottom",
|
||||
at: "right center"
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function enableAndShowExtraField(valEle, index) {
|
||||
|
|
|
@ -339,10 +339,22 @@ var AIRTIME = (function(AIRTIME){
|
|||
});
|
||||
};
|
||||
|
||||
mod.jumpToCurrentTrack = function() {
|
||||
var $scroll = $sbContent.find(".dataTables_scrolling");
|
||||
var scrolled = $scroll.scrollTop();
|
||||
var scrollingTop = $scroll.offset().top;
|
||||
var oTable = $('#show_builder_table').dataTable();
|
||||
var current = $sbTable.find("."+NOW_PLAYING_CLASS);
|
||||
var currentTop = current.offset().top;
|
||||
|
||||
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
|
||||
}
|
||||
|
||||
mod.builderDataTable = function() {
|
||||
$sbContent = $('#show_builder');
|
||||
$lib = $("#library_content"),
|
||||
$sbTable = $sbContent.find('table');
|
||||
var isInitialized = false;
|
||||
|
||||
oSchedTable = $sbTable.dataTable( {
|
||||
"aoColumns": [
|
||||
|
@ -357,7 +369,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
/* cue in */ {"mDataProp": "cuein", "sTitle": "Cue In", "bVisible": false, "sClass": "sb-cue-in"},
|
||||
/* cue out */ {"mDataProp": "cueout", "sTitle": "Cue Out", "bVisible": false, "sClass": "sb-cue-out"},
|
||||
/* fade in */ {"mDataProp": "fadein", "sTitle": "Fade In", "bVisible": false, "sClass": "sb-fade-in"},
|
||||
/* fade out */ {"mDataProp": "fadeout", "sTitle": "Fade Out", "bVisible": false, "sClass": "sb-fade-out"}
|
||||
/* fade out */ {"mDataProp": "fadeout", "sTitle": "Fade Out", "bVisible": false, "sClass": "sb-fade-out"},
|
||||
/* Mime */ {"mDataProp" : "mime", "sTitle" : "Mime", "bVisible": false, "sClass": "sb-mime"}
|
||||
],
|
||||
|
||||
"bJQueryUI": true,
|
||||
|
@ -537,12 +550,17 @@ var AIRTIME = (function(AIRTIME){
|
|||
$image = $nRow.find('td.sb-image');
|
||||
//check if the file exists.
|
||||
if (aData.image === true) {
|
||||
$nRow.addClass("lib-audio");
|
||||
if (!isAudioSupported(aData.mime)) {
|
||||
$image.html('<span class="ui-icon ui-icon-locked"></span>');
|
||||
} else {
|
||||
$image.html('<img title="Track preview" src="'+baseUrl+'/css/images/icon_audioclip.png"></img>')
|
||||
.click(function() {
|
||||
open_show_preview(aData.instance, aData.pos);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
$image.html('<span class="ui-icon ui-icon-alert"></span>');
|
||||
$image.find(".ui-icon-alert").qtip({
|
||||
|
@ -636,6 +654,17 @@ var AIRTIME = (function(AIRTIME){
|
|||
$("#draggingContainer").remove();
|
||||
},
|
||||
"fnDrawCallback": function fnBuilderDrawCallback(oSettings, json) {
|
||||
var isInitialized = false;
|
||||
|
||||
if (!isInitialized) {
|
||||
//when coming to 'Now Playing' page we want the page
|
||||
//to jump to the current track
|
||||
if ($(this).find("."+NOW_PLAYING_CLASS).length > 0) {
|
||||
mod.jumpToCurrentTrack();
|
||||
}
|
||||
}
|
||||
|
||||
isInitialized = true;
|
||||
var wrapperDiv,
|
||||
markerDiv,
|
||||
$td,
|
||||
|
@ -966,13 +995,18 @@ var AIRTIME = (function(AIRTIME){
|
|||
"<i class='icon-white icon-cut'></i></button></div>")
|
||||
.append("<div class='btn-group'>" +
|
||||
"<button title='Remove selected scheduled items' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
|
||||
"<i class='icon-white icon-trash'></i></button></div>")
|
||||
.append("<div class='btn-group'>" +
|
||||
"<i class='icon-white icon-trash'></i></button></div>");
|
||||
|
||||
//if 'Add/Remove content' was chosen from the context menu
|
||||
//in the Calendar do not append these buttons
|
||||
if ($(".ui-dialog-content").length === 0) {
|
||||
$menu.append("<div class='btn-group'>" +
|
||||
"<button title='Jump to the current playing track' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
|
||||
"<i class='icon-white icon-step-forward'></i></button></div>")
|
||||
.append("<div class='btn-group'>" +
|
||||
"<button title='Cancel current show' class='ui-state-disabled btn btn-small btn-danger' disabled='disabled'>" +
|
||||
"<i class='icon-white icon-ban-circle'></i></button></div>");
|
||||
}
|
||||
|
||||
$toolbar.append($menu);
|
||||
$menu = undefined;
|
||||
|
@ -1021,7 +1055,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
if (AIRTIME.button.isDisabled('icon-step-forward', true) === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
var $scroll = $sbContent.find(".dataTables_scrolling"),
|
||||
scrolled = $scroll.scrollTop(),
|
||||
scrollingTop = $scroll.offset().top,
|
||||
|
@ -1029,6 +1063,8 @@ var AIRTIME = (function(AIRTIME){
|
|||
currentTop = current.offset().top;
|
||||
|
||||
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
|
||||
*/
|
||||
mod.jumpToCurrentTrack();
|
||||
});
|
||||
|
||||
//delete overbooked tracks.
|
||||
|
|
|
@ -133,7 +133,8 @@ AIRTIME = (function(AIRTIME) {
|
|||
$builder.find(dateEndId).datepicker(oBaseDatePickerSettings);
|
||||
$builder.find(timeEndId).timepicker(oBaseTimePickerSettings);
|
||||
|
||||
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
|
||||
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId,
|
||||
dateEndId, timeEndId);
|
||||
AIRTIME.showbuilder.fnServerData.start = oRange.start;
|
||||
AIRTIME.showbuilder.fnServerData.end = oRange.end;
|
||||
|
||||
|
@ -144,10 +145,148 @@ AIRTIME = (function(AIRTIME) {
|
|||
$libWrapper = $lib.find("#library_display_wrapper");
|
||||
$libWrapper.prepend($libClose);
|
||||
|
||||
$builder.find('.dataTables_scrolling').css("max-height", widgetHeight - 95);
|
||||
$builder.find('.dataTables_scrolling').css("max-height",
|
||||
widgetHeight - 95);
|
||||
|
||||
$builder.on("click", "#sb_submit", showSearchSubmit);
|
||||
|
||||
$builder.on("click", "#sb_edit", function(ev) {
|
||||
var schedTable = $("#show_builder_table").dataTable();
|
||||
|
||||
// reset timestamp to redraw the cursors.
|
||||
AIRTIME.showbuilder.resetTimestamp();
|
||||
|
||||
$lib.show().width(Math.floor(screenWidth * 0.48));
|
||||
|
||||
$builder.width(Math.floor(screenWidth * 0.48)).find("#sb_edit")
|
||||
.remove().end().find("#sb_date_start")
|
||||
.css("margin-left", 0).end();
|
||||
|
||||
schedTable.fnDraw();
|
||||
|
||||
$.ajax( {
|
||||
url : "/usersettings/set-now-playing-screen-settings",
|
||||
type : "POST",
|
||||
data : {
|
||||
settings : {
|
||||
library : true
|
||||
},
|
||||
format : "json"
|
||||
},
|
||||
dataType : "json",
|
||||
success : function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$lib.on("click", "#sb_lib_close", function() {
|
||||
var schedTable = $("#show_builder_table").dataTable();
|
||||
|
||||
$lib.hide();
|
||||
$builder.width(screenWidth).find(".sb-timerange").prepend(
|
||||
$toggleLib).find("#sb_date_start").css("margin-left", 30)
|
||||
.end().end();
|
||||
|
||||
$toggleLib.removeClass("ui-state-hover");
|
||||
schedTable.fnDraw();
|
||||
|
||||
$.ajax( {
|
||||
url : "/usersettings/set-now-playing-screen-settings",
|
||||
type : "POST",
|
||||
data : {
|
||||
settings : {
|
||||
library : false
|
||||
},
|
||||
format : "json"
|
||||
},
|
||||
dataType : "json",
|
||||
success : function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$builder.find('legend').click(
|
||||
function(ev, item) {
|
||||
|
||||
if ($fs.hasClass("closed")) {
|
||||
|
||||
$fs.removeClass("closed");
|
||||
$builder.find('.dataTables_scrolling').css(
|
||||
"max-height", widgetHeight - 150);
|
||||
} else {
|
||||
$fs.addClass("closed");
|
||||
|
||||
// set defaults for the options.
|
||||
$fs.find('select').val(0);
|
||||
$fs.find('input[type="checkbox"]').attr("checked",
|
||||
false);
|
||||
$builder.find('.dataTables_scrolling').css(
|
||||
"max-height", widgetHeight - 110);
|
||||
}
|
||||
});
|
||||
|
||||
// set click event for all my shows checkbox.
|
||||
$builder.on("click", "#sb_my_shows", function(ev) {
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
$(ev.delegateTarget).find('#sb_show_filter').val(0);
|
||||
}
|
||||
|
||||
showSearchSubmit();
|
||||
});
|
||||
|
||||
//set select event for choosing a show.
|
||||
$builder.on("change", '#sb_show_filter', function(ev) {
|
||||
|
||||
if ($(this).val() !== 0) {
|
||||
$(ev.delegateTarget).find('#sb_my_shows')
|
||||
.attr("checked", false);
|
||||
}
|
||||
|
||||
showSearchSubmit();
|
||||
|
||||
});
|
||||
|
||||
function checkScheduleUpdates() {
|
||||
var data = {}, oTable = $('#show_builder_table').dataTable(), fn = oTable
|
||||
.fnSettings().fnServerData, start = fn.start, end = fn.end;
|
||||
|
||||
data["format"] = "json";
|
||||
data["start"] = start;
|
||||
data["end"] = end;
|
||||
data["timestamp"] = AIRTIME.showbuilder.getTimestamp();
|
||||
data["instances"] = AIRTIME.showbuilder.getShowInstances();
|
||||
|
||||
if (fn.hasOwnProperty("ops")) {
|
||||
data["myShows"] = fn.ops.myShows;
|
||||
data["showFilter"] = fn.ops.showFilter;
|
||||
}
|
||||
|
||||
$.ajax( {
|
||||
"dataType" : "json",
|
||||
"type" : "GET",
|
||||
"url" : "/showbuilder/check-builder-feed",
|
||||
"data" : data,
|
||||
"success" : function(json) {
|
||||
if (json.update === true) {
|
||||
oTable.fnDraw();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//check if the timeline view needs updating.
|
||||
setInterval(checkScheduleUpdates, 5 * 1000); //need refresh in milliseconds
|
||||
};
|
||||
|
||||
mod.onResize = function() {
|
||||
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(setWidgetSize, 100);
|
||||
};
|
||||
|
||||
return AIRTIME;
|
||||
|
||||
$builder.on("click","#sb_edit", function (ev){
|
||||
var schedTable = $("#show_builder_table").dataTable();
|
||||
|
||||
|
@ -280,7 +419,6 @@ AIRTIME = (function(AIRTIME) {
|
|||
};
|
||||
|
||||
return AIRTIME;
|
||||
|
||||
} (AIRTIME || {}));
|
||||
|
||||
$(document).ready(AIRTIME.builderMain.onReady);
|
||||
|
|
|
@ -574,7 +574,7 @@
|
|||
})
|
||||
|
||||
}(window.jQuery);/* ============================================================
|
||||
* bootstrap-dropdown.js v2.1.0
|
||||
* bootstrap-dropdown.js v2.2.1
|
||||
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
|
||||
* ============================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
|
@ -675,8 +675,9 @@
|
|||
}
|
||||
|
||||
function clearMenus() {
|
||||
getParent($(toggle))
|
||||
.removeClass('open')
|
||||
$(toggle).each(function () {
|
||||
getParent($(this)).removeClass('open')
|
||||
})
|
||||
}
|
||||
|
||||
function getParent($this) {
|
||||
|
@ -685,7 +686,7 @@
|
|||
|
||||
if (!selector) {
|
||||
selector = $this.attr('href')
|
||||
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
||||
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
|
||||
}
|
||||
|
||||
$parent = $(selector)
|
||||
|
@ -713,14 +714,11 @@
|
|||
/* APPLY TO STANDARD DROPDOWN ELEMENTS
|
||||
* =================================== */
|
||||
|
||||
$(function () {
|
||||
$('html')
|
||||
$(document)
|
||||
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
|
||||
$('body')
|
||||
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() })
|
||||
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
||||
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||
})
|
||||
|
||||
}(window.jQuery);/* =========================================================
|
||||
* bootstrap-modal.js v2.1.0
|
||||
|
|
|
@ -190,7 +190,7 @@
|
|||
} else if (th.attr('id') == "length") {
|
||||
label = " hh:mm:ss.t";
|
||||
} else if (th.attr('id') == "sample_rate") {
|
||||
label = " Hz";
|
||||
label = " kHz";
|
||||
}
|
||||
|
||||
th.html(_fnRangeLabelPart(0));
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
|
||||
<!-- b bs -->
|
|
@ -27,11 +27,11 @@ code=`lsb_release -cs`
|
|||
|
||||
if [ "$dist" = "Debian" ]; then
|
||||
set +e
|
||||
grep -E "deb +http://www.deb-multimedia.org/? squeeze +main +non-free" /etc/apt/sources.list
|
||||
grep -E "deb http://backports.debian.org/debian-backports squeeze-backports main" /etc/apt/sources.list
|
||||
returncode=$?
|
||||
set -e
|
||||
if [ "$returncode" -ne "0" ]; then
|
||||
echo "deb http://www.deb-multimedia.org squeeze main non-free" >> /etc/apt/sources.list
|
||||
echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ dist=`lsb_release -is`
|
|||
code=`lsb_release -cs`
|
||||
|
||||
if [ "$dist" -eq "Debian" ]; then
|
||||
grep "deb http://www.deb-multimedia.org squeeze main non-free" /etc/apt/sources.list
|
||||
grep "deb http://backports.debian.org/debian-backports squeeze-backports main" /etc/apt/sources.list
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "deb http://www.deb-multimedia.org squeeze main non-free" >> /etc/apt/sources.list
|
||||
echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -202,6 +202,12 @@ class Manager(Loggable):
|
|||
organize.
|
||||
"""
|
||||
store_paths = mmp.expand_storage(store)
|
||||
# First attempt to make sure that all paths exist before adding any
|
||||
# watches
|
||||
for path_type, path in store_paths.iteritems():
|
||||
try: mmp.create_dir(path)
|
||||
except mmp.FailedToCreateDir as e: self.unexpected_exception(e)
|
||||
|
||||
self.set_problem_files_path(store_paths['problem_files'])
|
||||
self.set_imported_path(store_paths['imported'])
|
||||
self.set_recorded_path(store_paths['recorded'])
|
||||
|
|
|
@ -105,6 +105,9 @@ def main(global_config, api_client_config, log_config,
|
|||
airtime_notifier = AirtimeNotifier(config, airtime_receiver)
|
||||
|
||||
store = apiclient.setup_media_monitor()
|
||||
|
||||
log.info("Initing with the following airtime response:%s" % str(store))
|
||||
|
||||
airtime_receiver.change_storage({ 'directory':store[u'stor'] })
|
||||
|
||||
for watch_dir in store[u'watched_dirs']:
|
||||
|
@ -116,6 +119,7 @@ def main(global_config, api_client_config, log_config,
|
|||
(given from the database)." % watch_dir)
|
||||
if os.path.exists(watch_dir):
|
||||
airtime_receiver.new_watch({ 'directory':watch_dir }, restart=True)
|
||||
else: log.info("Failed to add watch on %s" % str(watch_dir))
|
||||
|
||||
bs = Bootstrapper( db=sdb, watch_signal='watch' )
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
%ifdef input.gstreamer.video
|
||||
# Stream from a video4linux 2 input device, such as a webcam.
|
||||
# @category Source / Input
|
||||
# @param ~id Force the value of the source ID.
|
||||
# @param ~clock_safe Force the use of the dedicated v4l clock.
|
||||
# @param ~device V4L2 device to use.
|
||||
def input.v4l2(~id="",~clock_safe=true,~device="/dev/video0")
|
||||
pipeline = "v4l2src device=#{device}"
|
||||
input.gstreamer.video(id=id, clock_safe=clock_safe, pipeline=pipeline)
|
||||
end
|
||||
|
||||
# Stream from a video4linux 2 input device, such as a webcam.
|
||||
# @category Source / Input
|
||||
# @param ~id Force the value of the source ID.
|
||||
# @param ~clock_safe Force the use of the dedicated v4l clock.
|
||||
# @param ~device V4L2 device to use.
|
||||
def input.v4l2_with_audio(~id="",~clock_safe=true,~device="/dev/video0")
|
||||
audio_pipeline = "autoaudiosrc"
|
||||
video_pipeline = "v4l2src device=#{device}"
|
||||
input.gstreamer.audio_video(id=id, clock_safe=clock_safe, audio_pipeline=audio_pipeline, video_pipeline=video_pipeline)
|
||||
end
|
||||
|
||||
def gstreamer.encode_x264_avi(fname, source)
|
||||
output.gstreamer.video(pipeline="videoconvert ! x264enc ! avimux ! filesink location=\"#{fname}\"", source)
|
||||
end
|
||||
|
||||
def gstreamer.encode_jpeg_avi(fname, source)
|
||||
output.gstreamer.video(pipeline="videoconvert ! jpegenc ! avimux ! filesink location=\"#{fname}\"", source)
|
||||
end
|
||||
|
||||
def gstreamer.encode_mp3(fname, source)
|
||||
output.gstreamer.audio(pipeline="audioconvert ! lamemp3enc ! filesink location=\"#{fname}\"", source)
|
||||
end
|
||||
%endif
|
|
@ -201,9 +201,6 @@ def append_dj_inputs(master_harbor_input_port, master_harbor_input_mount_point,
|
|||
dj_live = mksafe(audio_to_stereo(input.harbor(id="live_dj_harbor", dj_harbor_input_mount_point, port=dj_harbor_input_port, auth=check_dj_client,
|
||||
max=40., on_connect=live_dj_connect, on_disconnect=live_dj_disconnect)))
|
||||
|
||||
master_dj = rewrite_metadata([("artist","Airtime"), ("title", "Master Dj")],master_dj)
|
||||
dj_live = rewrite_metadata([("artist","Airtime"), ("title", "Live Dj")],dj_live)
|
||||
|
||||
ignore(output.dummy(master_dj, fallible=true))
|
||||
ignore(output.dummy(dj_live, fallible=true))
|
||||
switch(id="master_dj_switch", track_sensitive=false, transitions=[transition, transition, transition], [({!master_dj_enabled},master_dj), ({!live_dj_enabled},dj_live), ({true}, s)])
|
||||
|
@ -211,14 +208,12 @@ def append_dj_inputs(master_harbor_input_port, master_harbor_input_mount_point,
|
|||
master_dj = mksafe(audio_to_stereo(input.harbor(id="master_harbor", master_harbor_input_mount_point, port=master_harbor_input_port, auth=check_master_dj_client,
|
||||
max=40., on_connect=master_dj_connect, on_disconnect=master_dj_disconnect)))
|
||||
ignore(output.dummy(master_dj, fallible=true))
|
||||
master_dj = rewrite_metadata([("artist","Airtime"), ("title", "Master Dj")],master_dj)
|
||||
|
||||
switch(id="master_dj_switch", track_sensitive=false, transitions=[transition, transition], [({!master_dj_enabled},master_dj), ({true}, s)])
|
||||
elsif dj_harbor_input_port != 0 and dj_harbor_input_mount_point != "" then
|
||||
dj_live = mksafe(audio_to_stereo(input.harbor(id="live_dj_harbor", dj_harbor_input_mount_point, port=dj_harbor_input_port, auth=check_dj_client,
|
||||
max=40., on_connect=live_dj_connect, on_disconnect=live_dj_disconnect)))
|
||||
|
||||
dj_live = rewrite_metadata([("artist","Airtime"), ("title", "Live Dj")],dj_live)
|
||||
|
||||
ignore(output.dummy(dj_live, fallible=true))
|
||||
switch(id="live_dj_switch", track_sensitive=false, transitions=[transition, transition], [({!live_dj_enabled},dj_live), ({true}, s)])
|
||||
else
|
||||
|
|
|
@ -159,6 +159,7 @@ def WatchAddAction(option, opt, value, parser):
|
|||
path = currentDir+path
|
||||
path = apc.encode_to(path, 'utf-8')
|
||||
if(os.path.isdir(path)):
|
||||
os.chmod(path, 0765)
|
||||
res = api_client.add_watched_dir(path)
|
||||
if(res is None):
|
||||
exit("Unable to connect to the server.")
|
||||
|
|
Loading…
Reference in New Issue