CC-6079 - merge and remove underscore files
This commit is contained in:
parent
5ab0850d9a
commit
3f25ab2647
38 changed files with 2131 additions and 9600 deletions
|
@ -16,7 +16,6 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
|
||||||
->add(new Zend_Acl_Resource('error'))
|
->add(new Zend_Acl_Resource('error'))
|
||||||
->add(new Zend_Acl_Resource('login'))
|
->add(new Zend_Acl_Resource('login'))
|
||||||
->add(new Zend_Acl_Resource('whmcs-login'))
|
->add(new Zend_Acl_Resource('whmcs-login'))
|
||||||
->add(new Zend_Acl_Resource('new-playlist'))
|
|
||||||
->add(new Zend_Acl_Resource('playlist'))
|
->add(new Zend_Acl_Resource('playlist'))
|
||||||
->add(new Zend_Acl_Resource('plupload'))
|
->add(new Zend_Acl_Resource('plupload'))
|
||||||
->add(new Zend_Acl_Resource('schedule'))
|
->add(new Zend_Acl_Resource('schedule'))
|
||||||
|
@ -25,13 +24,11 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
|
||||||
->add(new Zend_Acl_Resource('dashboard'))
|
->add(new Zend_Acl_Resource('dashboard'))
|
||||||
->add(new Zend_Acl_Resource('preference'))
|
->add(new Zend_Acl_Resource('preference'))
|
||||||
->add(new Zend_Acl_Resource('showbuilder'))
|
->add(new Zend_Acl_Resource('showbuilder'))
|
||||||
->add(new Zend_Acl_Resource('show-builder'))
|
|
||||||
->add(new Zend_Acl_Resource('playouthistory'))
|
->add(new Zend_Acl_Resource('playouthistory'))
|
||||||
->add(new Zend_Acl_Resource('playouthistorytemplate'))
|
->add(new Zend_Acl_Resource('playouthistorytemplate'))
|
||||||
->add(new Zend_Acl_Resource('listenerstat'))
|
->add(new Zend_Acl_Resource('listenerstat'))
|
||||||
->add(new Zend_Acl_Resource('usersettings'))
|
->add(new Zend_Acl_Resource('usersettings'))
|
||||||
->add(new Zend_Acl_Resource('audiopreview'))
|
->add(new Zend_Acl_Resource('audiopreview'))
|
||||||
->add(new Zend_Acl_Resource('new-webstream'))
|
|
||||||
->add(new Zend_Acl_Resource('webstream'))
|
->add(new Zend_Acl_Resource('webstream'))
|
||||||
->add(new Zend_Acl_Resource('locale'))
|
->add(new Zend_Acl_Resource('locale'))
|
||||||
->add(new Zend_Acl_Resource('upgrade'))
|
->add(new Zend_Acl_Resource('upgrade'))
|
||||||
|
@ -53,12 +50,10 @@ $ccAcl->allow('G', 'index')
|
||||||
->allow('G', 'error')
|
->allow('G', 'error')
|
||||||
->allow('G', 'user', 'edit-user')
|
->allow('G', 'user', 'edit-user')
|
||||||
->allow('G', 'showbuilder')
|
->allow('G', 'showbuilder')
|
||||||
->allow('G', 'show-builder')
|
|
||||||
->allow('G', 'api')
|
->allow('G', 'api')
|
||||||
->allow('G', 'schedule')
|
->allow('G', 'schedule')
|
||||||
->allow('G', 'dashboard')
|
->allow('G', 'dashboard')
|
||||||
->allow('G', 'audiopreview')
|
->allow('G', 'audiopreview')
|
||||||
->allow('G', 'new-webstream')
|
|
||||||
->allow('G', 'webstream')
|
->allow('G', 'webstream')
|
||||||
->allow('G', 'locale')
|
->allow('G', 'locale')
|
||||||
->allow('G', 'upgrade')
|
->allow('G', 'upgrade')
|
||||||
|
@ -74,7 +69,6 @@ $ccAcl->allow('G', 'index')
|
||||||
->allow('H', 'usersettings')
|
->allow('H', 'usersettings')
|
||||||
->allow('H', 'plupload')
|
->allow('H', 'plupload')
|
||||||
->allow('H', 'library')
|
->allow('H', 'library')
|
||||||
->allow('H', 'new-playlist')
|
|
||||||
->allow('H', 'playlist')
|
->allow('H', 'playlist')
|
||||||
->allow('H', 'playouthistory')
|
->allow('H', 'playouthistory')
|
||||||
->allow('A', 'playouthistorytemplate')
|
->allow('A', 'playouthistorytemplate')
|
||||||
|
|
|
@ -1,648 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class NewPlaylistController extends Zend_Controller_Action
|
|
||||||
{
|
|
||||||
|
|
||||||
public function init()
|
|
||||||
{
|
|
||||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
|
||||||
$ajaxContext->addActionContext('add-items', 'json')
|
|
||||||
->addActionContext('move-items', 'json')
|
|
||||||
->addActionContext('delete-items', 'json')
|
|
||||||
->addActionContext('set-fade', 'json')
|
|
||||||
->addActionContext('set-crossfade', 'json')
|
|
||||||
->addActionContext('set-cue', 'json')
|
|
||||||
->addActionContext('new', 'json')
|
|
||||||
->addActionContext('edit', 'json')
|
|
||||||
->addActionContext('delete', 'json')
|
|
||||||
->addActionContext('close-playlist', 'json')
|
|
||||||
->addActionContext('play', 'json')
|
|
||||||
->addActionContext('set-playlist-fades', 'json')
|
|
||||||
->addActionContext('get-playlist-fades', 'json')
|
|
||||||
->addActionContext('set-playlist-name', 'json')
|
|
||||||
->addActionContext('set-playlist-description', 'json')
|
|
||||||
->addActionContext('playlist-preview', 'json')
|
|
||||||
->addActionContext('get-playlist', 'json')
|
|
||||||
->addActionContext('save', 'json')
|
|
||||||
->addActionContext('smart-block-generate', 'json')
|
|
||||||
->addActionContext('smart-block-shuffle', 'json')
|
|
||||||
->addActionContext('get-block-info', 'json')
|
|
||||||
->addActionContext('shuffle', 'json')
|
|
||||||
->addActionContext('empty-content', 'json')
|
|
||||||
->initContext();
|
|
||||||
|
|
||||||
//This controller writes to the session all over the place, so we're going to reopen it for writing here.
|
|
||||||
session_start(); //Reopen the session for writing
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getPlaylist($p_type)
|
|
||||||
{
|
|
||||||
$obj = null;
|
|
||||||
$objInfo = Application_Model_Library::getObjInfo($p_type);
|
|
||||||
|
|
||||||
$obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
|
|
||||||
|
|
||||||
if (isset($obj_sess->id)) {
|
|
||||||
$obj = new $objInfo['className']($obj_sess->id);
|
|
||||||
|
|
||||||
$modified = $this->_getParam('modified', null);
|
|
||||||
if ($obj->getLastModified("U") !== $modified) {
|
|
||||||
$this->createFullResponse($obj);
|
|
||||||
throw new PlaylistOutDatedException(sprintf(_("You are viewing an older version of %s"), $obj->getName()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function createUpdateResponse($obj)
|
|
||||||
{
|
|
||||||
$formatter = new LengthFormatter($obj->getLength());
|
|
||||||
$this->view->length = $formatter->format();
|
|
||||||
|
|
||||||
$this->view->obj = $obj;
|
|
||||||
$this->view->contents = $obj->getContents();
|
|
||||||
$this->view->html = $this->view->render('playlist/update.phtml');
|
|
||||||
$this->view->name = $obj->getName();
|
|
||||||
$this->view->description = $obj->getDescription();
|
|
||||||
$this->view->modified = $obj->getLastModified("U");
|
|
||||||
|
|
||||||
unset($this->view->obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function createFullResponse($obj = null, $isJson = false,
|
|
||||||
$formIsValid = false)
|
|
||||||
{
|
|
||||||
$isBlock = false;
|
|
||||||
$viewPath = 'playlist/_playlist.phtml';
|
|
||||||
if ($obj instanceof Application_Model_Block) {
|
|
||||||
$isBlock = true;
|
|
||||||
$viewPath = 'playlist/_smart-block.phtml';
|
|
||||||
}
|
|
||||||
if (isset($obj)) {
|
|
||||||
$formatter = new LengthFormatter($obj->getLength());
|
|
||||||
$this->view->length = $formatter->format();
|
|
||||||
|
|
||||||
if ($isBlock) {
|
|
||||||
$form = new Application_Form_SmartBlockCriteriaNew();
|
|
||||||
$form->removeDecorator('DtDdWrapper');
|
|
||||||
$form->startForm($obj->getId(), $formIsValid);
|
|
||||||
|
|
||||||
$this->view->form = $form;
|
|
||||||
$this->view->obj = $obj;
|
|
||||||
$this->view->type = "sb";
|
|
||||||
$this->view->id = $obj->getId();
|
|
||||||
|
|
||||||
if ($isJson) {
|
|
||||||
return $this->view->render($viewPath);
|
|
||||||
} else {
|
|
||||||
$this->view->html = $this->view->render($viewPath);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$this->view->obj = $obj;
|
|
||||||
$this->view->type = "pl";
|
|
||||||
$this->view->id = $obj->getId();
|
|
||||||
if ($isJson) {
|
|
||||||
return $this->view->html = $this->view->render($viewPath);
|
|
||||||
} else {
|
|
||||||
$this->view->html = $this->view->render($viewPath);
|
|
||||||
}
|
|
||||||
unset($this->view->obj);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($isJson) {
|
|
||||||
return $this->view->render($viewPath);
|
|
||||||
} else {
|
|
||||||
$this->view->html = $this->view->render($viewPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function playlistOutdated($e)
|
|
||||||
{
|
|
||||||
$this->view->error = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function blockDynamic($obj)
|
|
||||||
{
|
|
||||||
$this->view->error = _("You cannot add tracks to dynamic blocks.");
|
|
||||||
$this->createFullResponse($obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function playlistNotFound($p_type, $p_isJson = false)
|
|
||||||
{
|
|
||||||
$p_type = ucfirst($p_type);
|
|
||||||
$this->view->error = sprintf(_("%s not found"), $p_type);
|
|
||||||
|
|
||||||
Logging::info("{$p_type} not found");
|
|
||||||
Application_Model_Library::changePlaylist(null, $p_type);
|
|
||||||
|
|
||||||
if (!$p_isJson) {
|
|
||||||
$this->createFullResponse(null);
|
|
||||||
} else {
|
|
||||||
$this->_helper->json->sendJson(array("error"=>$this->view->error, "result"=>1, "html"=>$this->createFullResponse(null, $p_isJson)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function playlistNoPermission($p_type)
|
|
||||||
{
|
|
||||||
$this->view->error = sprintf(_("You don't have permission to delete selected %s(s)."), $p_type);
|
|
||||||
$this->changePlaylist(null, $p_type);
|
|
||||||
$this->createFullResponse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function playlistUnknownError($e)
|
|
||||||
{
|
|
||||||
$this->view->error = _("Something went wrong.");
|
|
||||||
Logging::info($e->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
private function wrongTypeToBlock($obj)
|
|
||||||
{
|
|
||||||
$this->view->error = _("You can only add tracks to smart block.");
|
|
||||||
$this->createFullResponse($obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function wrongTypeToPlaylist($obj)
|
|
||||||
{
|
|
||||||
$this->view->error = _("You can only add tracks, smart blocks, and webstreams to playlists.");
|
|
||||||
$this->createFullResponse($obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function newAction()
|
|
||||||
{
|
|
||||||
//$pl_sess = $this->pl_sess;
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
|
||||||
$type = $this->_getParam('type');
|
|
||||||
|
|
||||||
$objInfo = Application_Model_Library::getObjInfo($type);
|
|
||||||
|
|
||||||
$name = _('Untitled Playlist');
|
|
||||||
if ($type == 'block') {
|
|
||||||
$name = _('Untitled Smart Block');
|
|
||||||
}
|
|
||||||
|
|
||||||
$obj = new $objInfo['className']();
|
|
||||||
$obj->setName($name);
|
|
||||||
$obj->setMetadata('dc:creator', $userInfo->id);
|
|
||||||
|
|
||||||
Application_Model_Library::changePlaylist($obj->getId(), $type);
|
|
||||||
$this->createFullResponse($obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function editAction()
|
|
||||||
{
|
|
||||||
$id = $this->_getParam('id', null);
|
|
||||||
$type = $this->_getParam('type');
|
|
||||||
$objInfo = Application_Model_Library::getObjInfo($type);
|
|
||||||
Logging::info("editing {$type} {$id}");
|
|
||||||
|
|
||||||
// if (!is_null($id)) {
|
|
||||||
Application_Model_Library::changePlaylist($id, $type);
|
|
||||||
// }
|
|
||||||
|
|
||||||
try {
|
|
||||||
$obj = new $objInfo['className']($id);
|
|
||||||
$this->createFullResponse($obj);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound();
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function deleteAction()
|
|
||||||
{
|
|
||||||
$ids = $this->_getParam('ids');
|
|
||||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
|
||||||
$type = $this->_getParam('type');
|
|
||||||
|
|
||||||
$obj = null;
|
|
||||||
|
|
||||||
$objInfo = Application_Model_Library::getObjInfo($type);
|
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
|
||||||
|
|
||||||
$obj_sess = new Zend_Session_Namespace(
|
|
||||||
UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Logging::info("Currently active {$type} {$obj_sess->id}");
|
|
||||||
if (in_array($obj_sess->id, $ids)) {
|
|
||||||
Logging::info("Deleting currently active {$type}");
|
|
||||||
Application_Model_Library::changePlaylist(null, $type);
|
|
||||||
} else {
|
|
||||||
Logging::info("Not deleting currently active {$type}");
|
|
||||||
$obj = new $objInfo['className']($obj_sess->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp($objInfo['className'], 'Application_Model_Playlist')==0) {
|
|
||||||
Application_Model_Playlist::deletePlaylists($ids, $userInfo->id);
|
|
||||||
} else {
|
|
||||||
Application_Model_Block::deleteBlocks($ids, $userInfo->id);
|
|
||||||
}
|
|
||||||
$this->createFullResponse($obj);
|
|
||||||
} catch (PlaylistNoPermissionException $e) {
|
|
||||||
$this->playlistNoPermission($type);
|
|
||||||
} catch (BlockNoPermissionException $e) {
|
|
||||||
$this->playlistNoPermission($type);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($type);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function closePlaylistAction() {
|
|
||||||
$type = $this->_getParam('type');
|
|
||||||
$obj = null;
|
|
||||||
Application_Model_Library::changePlaylist($obj, $type);
|
|
||||||
$this->createFullResponse($obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addItemsAction()
|
|
||||||
{
|
|
||||||
$ids = $this->_getParam('aItems', array());
|
|
||||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
|
||||||
$afterItem = $this->_getParam('afterItem', null);
|
|
||||||
$addType = $this->_getParam('type', 'after');
|
|
||||||
// this is the obj type of destination
|
|
||||||
$obj_type = $this->_getParam('obj_type');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$obj = $this->getPlaylist($obj_type);
|
|
||||||
if ($obj_type == 'playlist') {
|
|
||||||
foreach ($ids as $id) {
|
|
||||||
if (is_array($id) && isset($id[1])) {
|
|
||||||
if ($id[1] == 'playlist') {
|
|
||||||
throw new WrongTypeToPlaylistException;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$obj->addAudioClips($ids, $afterItem, $addType);
|
|
||||||
} elseif ($obj->isStatic()) {
|
|
||||||
// if the dest is a block object
|
|
||||||
//check if any items are playlists
|
|
||||||
foreach ($ids as $id) {
|
|
||||||
if (is_array($id) && isset($id[1])) {
|
|
||||||
if ($id[1] != 'audioclip') {
|
|
||||||
throw new WrongTypeToBlockException;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$obj->addAudioClips($ids, $afterItem, $addType);
|
|
||||||
} else {
|
|
||||||
throw new BlockDynamicException;
|
|
||||||
}
|
|
||||||
$this->createUpdateResponse($obj);
|
|
||||||
} catch (PlaylistOutDatedException $e) {
|
|
||||||
$this->playlistOutdated($e);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($obj_type);
|
|
||||||
} catch (WrongTypeToBlockException $e) {
|
|
||||||
$this->wrongTypeToBlock($obj);
|
|
||||||
} catch (WrongTypeToPlaylistException $e) {
|
|
||||||
$this->wrongTypeToPlaylist($obj);
|
|
||||||
} catch (BlockDynamicException $e) {
|
|
||||||
$this->blockDynamic($obj);
|
|
||||||
} catch (BlockNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($obj_type);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function moveItemsAction()
|
|
||||||
{
|
|
||||||
$ids = $this->_getParam('ids');
|
|
||||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
|
||||||
$afterItem = $this->_getParam('afterItem', null);
|
|
||||||
$type = $this->_getParam('obj_type');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$obj = $this->getPlaylist($type);
|
|
||||||
$obj->moveAudioClips($ids, $afterItem);
|
|
||||||
$this->createUpdateResponse($obj);
|
|
||||||
} catch (PlaylistOutDatedException $e) {
|
|
||||||
$this->playlistOutdated($e);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($type);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function deleteItemsAction()
|
|
||||||
{
|
|
||||||
$ids = $this->_getParam('ids');
|
|
||||||
$ids = (!is_array($ids)) ? array($ids) : $ids;
|
|
||||||
$modified = $this->_getParam('modified');
|
|
||||||
$type = $this->_getParam('obj_type');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$obj = $this->getPlaylist($type);
|
|
||||||
$obj->delAudioClips($ids);
|
|
||||||
$this->createUpdateResponse($obj);
|
|
||||||
} catch (PlaylistOutDatedException $e) {
|
|
||||||
$this->playlistOutdated($e);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($type);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function emptyContentAction()
|
|
||||||
{
|
|
||||||
$type = $this->_getParam('obj_type');
|
|
||||||
try {
|
|
||||||
$obj = $this->getPlaylist($type);
|
|
||||||
if ($type == 'playlist') {
|
|
||||||
$obj->deleteAllFilesFromPlaylist();
|
|
||||||
} else {
|
|
||||||
$obj->deleteAllFilesFromBlock();
|
|
||||||
}
|
|
||||||
$this->createUpdateResponse($obj);
|
|
||||||
} catch (PlaylistOutDatedException $e) {
|
|
||||||
$this->playlistOutdated($e);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($type);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCueAction()
|
|
||||||
{
|
|
||||||
$id = $this->_getParam('id');
|
|
||||||
$cueIn = $this->_getParam('cueIn', null);
|
|
||||||
$cueOut = $this->_getParam('cueOut', null);
|
|
||||||
$type = $this->_getParam('type');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$obj = $this->getPlaylist($type);
|
|
||||||
$response = $obj->changeClipLength($id, $cueIn, $cueOut);
|
|
||||||
|
|
||||||
if (!isset($response["error"])) {
|
|
||||||
$this->view->response = $response;
|
|
||||||
$this->createUpdateResponse($obj);
|
|
||||||
} else {
|
|
||||||
$this->view->cue_error = $response["error"];
|
|
||||||
$this->view->code = $response["type"];
|
|
||||||
}
|
|
||||||
} catch (PlaylistOutDatedException $e) {
|
|
||||||
$this->playlistOutdated($e);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($type);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setFadeAction()
|
|
||||||
{
|
|
||||||
$id = $this->_getParam('id');
|
|
||||||
$fadeIn = $this->_getParam('fadeIn', null);
|
|
||||||
$fadeOut = $this->_getParam('fadeOut', null);
|
|
||||||
$type = $this->_getParam('type');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$obj = $this->getPlaylist($type);
|
|
||||||
$response = $obj->changeFadeInfo($id, $fadeIn, $fadeOut);
|
|
||||||
|
|
||||||
if (!isset($response["error"])) {
|
|
||||||
$this->createUpdateResponse($obj);
|
|
||||||
$this->view->response = $response;
|
|
||||||
} else {
|
|
||||||
$this->view->fade_error = $response["error"];
|
|
||||||
}
|
|
||||||
} catch (PlaylistOutDatedException $e) {
|
|
||||||
$this->playlistOutdated($e);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($type);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setCrossfadeAction()
|
|
||||||
{
|
|
||||||
$id1 = $this->_getParam('id1', null);
|
|
||||||
$id2 = $this->_getParam('id2', null);
|
|
||||||
$type = $this->_getParam('type');
|
|
||||||
$fadeIn = $this->_getParam('fadeIn', 0);
|
|
||||||
$fadeOut = $this->_getParam('fadeOut', 0);
|
|
||||||
$offset = $this->_getParam('offset', 0);
|
|
||||||
|
|
||||||
try {
|
|
||||||
$obj = $this->getPlaylist($type);
|
|
||||||
$response = $obj->createCrossfade($id1, $fadeOut, $id2, $fadeIn, $offset);
|
|
||||||
|
|
||||||
if (!isset($response["error"])) {
|
|
||||||
$this->createUpdateResponse($obj);
|
|
||||||
} else {
|
|
||||||
$this->view->error = $response["error"];
|
|
||||||
}
|
|
||||||
} catch (PlaylistOutDatedException $e) {
|
|
||||||
$this->playlistOutdated($e);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($type);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPlaylistFadesAction()
|
|
||||||
{
|
|
||||||
$type = $this->_getParam('type');
|
|
||||||
try {
|
|
||||||
$obj = $this->getPlaylist($type);
|
|
||||||
$fades = $obj->getFadeInfo(0);
|
|
||||||
$this->view->fadeIn = $fades[0];
|
|
||||||
|
|
||||||
$fades = $obj->getFadeInfo($obj->getSize()-1);
|
|
||||||
$this->view->fadeOut = $fades[1];
|
|
||||||
} catch (PlaylistOutDatedException $e) {
|
|
||||||
$this->playlistOutdated($e);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($type);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The playlist fades are stored in the elements themselves.
|
|
||||||
* The fade in is set to the first elements fade in and
|
|
||||||
* the fade out is set to the last elements fade out.
|
|
||||||
**/
|
|
||||||
public function setPlaylistFadesAction()
|
|
||||||
{
|
|
||||||
$fadeIn = $this->_getParam('fadeIn', null);
|
|
||||||
$fadeOut = $this->_getParam('fadeOut', null);
|
|
||||||
$type = $this->_getParam('type');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$obj = $this->getPlaylist($type);
|
|
||||||
$obj->setfades($fadeIn, $fadeOut);
|
|
||||||
$this->view->modified = $obj->getLastModified("U");
|
|
||||||
} catch (PlaylistOutDatedException $e) {
|
|
||||||
$this->playlistOutdated($e);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($type);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setPlaylistNameDescAction()
|
|
||||||
{
|
|
||||||
$name = $this->_getParam('name', _('Unknown Playlist'));
|
|
||||||
$description = $this->_getParam('description', "");
|
|
||||||
$type = $this->_getParam('type');
|
|
||||||
|
|
||||||
try {
|
|
||||||
$obj = $this->getPlaylist($type);
|
|
||||||
$obj->setName(trim($name));
|
|
||||||
$obj->setDescription($description);
|
|
||||||
$this->view->description = $description;
|
|
||||||
$this->view->playlistName = $name;
|
|
||||||
$this->view->modified = $obj->getLastModified("U");
|
|
||||||
} catch (PlaylistOutDatedException $e) {
|
|
||||||
$this->playlistOutdated($e);
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound($type, true);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function saveAction()
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$params = $request->getPost();
|
|
||||||
$result = array();
|
|
||||||
|
|
||||||
if ($params['type'] == 'block') {
|
|
||||||
try {
|
|
||||||
$bl = new Application_Model_Block($params['obj_id']);
|
|
||||||
} catch (BlockNotFoundException $e) {
|
|
||||||
$this->playlistNotFound('block', true);
|
|
||||||
}
|
|
||||||
$form = new Application_Form_SmartBlockCriteriaNew();
|
|
||||||
$form->startForm($params['obj_id']);
|
|
||||||
if ($form->isValid($params)) {
|
|
||||||
$this->setPlaylistNameDescAction();
|
|
||||||
$bl->saveSmartBlockCriteria($params['data']);
|
|
||||||
$result['html'] = $this->createFullResponse($bl, true, true);
|
|
||||||
$result['result'] = 0;
|
|
||||||
} else {
|
|
||||||
$this->view->form = $form;
|
|
||||||
$this->view->unsavedName = $params['name'];
|
|
||||||
$this->view->unsavedDesc = $params['description'];
|
|
||||||
$viewPath = 'playlist/_smart-block.phtml';
|
|
||||||
$this->view->obj = $bl;
|
|
||||||
$this->view->id = $bl->getId();
|
|
||||||
$result['html'] = $this->view->render($viewPath);
|
|
||||||
$result['result'] = 1;
|
|
||||||
}
|
|
||||||
$result['type'] = "sb";
|
|
||||||
$result['id'] = $bl->getId();
|
|
||||||
$result["modified"] = $bl->getLastModified("U");
|
|
||||||
} else if ($params['type'] == 'playlist') {
|
|
||||||
$this->setPlaylistNameDescAction();
|
|
||||||
$result["modified"] = $this->view->modified;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_helper->json->sendJson($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function smartBlockGenerateAction()
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$params = $request->getPost();
|
|
||||||
|
|
||||||
//make sure block exists
|
|
||||||
try {
|
|
||||||
$bl = new Application_Model_Block($params['obj_id']);
|
|
||||||
|
|
||||||
$form = new Application_Form_SmartBlockCriteriaNew();
|
|
||||||
$form->startForm($params['obj_id']);
|
|
||||||
if ($form->isValid($params)) {
|
|
||||||
$result = $bl->generateSmartBlock($params['data']);
|
|
||||||
$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true)));
|
|
||||||
} else {
|
|
||||||
$this->view->obj = $bl;
|
|
||||||
$this->view->id = $bl->getId();
|
|
||||||
$this->view->form = $form;
|
|
||||||
$viewPath = 'playlist/_smart-block.phtml';
|
|
||||||
$result['html'] = $this->view->render($viewPath);
|
|
||||||
$result['result'] = 1;
|
|
||||||
$this->_helper->json->sendJson($result);
|
|
||||||
}
|
|
||||||
} catch (BlockNotFoundException $e) {
|
|
||||||
$this->playlistNotFound('block', true);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Logging::info($e);
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function smartBlockShuffleAction()
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$params = $request->getPost();
|
|
||||||
try {
|
|
||||||
$bl = new Application_Model_Block($params['obj_id']);
|
|
||||||
$result = $bl->shuffleSmartBlock();
|
|
||||||
|
|
||||||
if ($result['result'] == 0) {
|
|
||||||
$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true)));
|
|
||||||
} else {
|
|
||||||
$this->_helper->json->sendJson($result);
|
|
||||||
}
|
|
||||||
} catch (BlockNotFoundException $e) {
|
|
||||||
$this->playlistNotFound('block', true);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function shuffleAction()
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$params = $request->getPost();
|
|
||||||
try {
|
|
||||||
$pl = new Application_Model_Playlist($params['obj_id']);
|
|
||||||
$result = $pl->shuffle();
|
|
||||||
|
|
||||||
if ($result['result'] == 0) {
|
|
||||||
$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($pl, true)));
|
|
||||||
} else {
|
|
||||||
$this->_helper->json->sendJson($result);
|
|
||||||
}
|
|
||||||
} catch (PlaylistNotFoundException $e) {
|
|
||||||
$this->playlistNotFound('block', true);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->playlistUnknownError($e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBlockInfoAction()
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$params = $request->getPost();
|
|
||||||
$bl = new Application_Model_Block($params['id']);
|
|
||||||
if ($bl->isStatic()) {
|
|
||||||
$out = $bl->getContents();
|
|
||||||
$out['isStatic'] = true;
|
|
||||||
} else {
|
|
||||||
$out = $bl->getCriteria();
|
|
||||||
$out['isStatic'] = false;
|
|
||||||
}
|
|
||||||
$this->_helper->json->sendJson($out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
class WrongTypeToBlockException extends Exception {}
|
|
||||||
class WrongTypeToPlaylistException extends Exception {}
|
|
||||||
class BlockDynamicException extends Exception {}
|
|
|
@ -1,150 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class NewWebstreamController extends Zend_Controller_Action
|
|
||||||
{
|
|
||||||
public function init()
|
|
||||||
{
|
|
||||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
|
||||||
$ajaxContext->addActionContext('new', 'json')
|
|
||||||
->addActionContext('save', 'json')
|
|
||||||
->addActionContext('edit', 'json')
|
|
||||||
->addActionContext('delete', 'json')
|
|
||||||
->initContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function newAction()
|
|
||||||
{
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
|
||||||
if (!$this->isAuthorized(-1)) {
|
|
||||||
// TODO: this header call does not actually print any error message
|
|
||||||
header("Status: 401 Not Authorized");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$webstream = new CcWebstream();
|
|
||||||
|
|
||||||
//we're not saving this primary key in the DB so it's OK to be -1
|
|
||||||
$webstream->setDbId(-1);
|
|
||||||
$webstream->setDbName(_("Untitled Webstream"));
|
|
||||||
$webstream->setDbDescription("");
|
|
||||||
$webstream->setDbUrl("http://");
|
|
||||||
$webstream->setDbLength("00:30:00");
|
|
||||||
$webstream->setDbName(_("Untitled Webstream"));
|
|
||||||
$webstream->setDbCreatorId($userInfo->id);
|
|
||||||
$webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC')));
|
|
||||||
$webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC')));
|
|
||||||
|
|
||||||
//clear the session in case an old playlist was open: CC-4196
|
|
||||||
Application_Model_Library::changePlaylist(null, null);
|
|
||||||
|
|
||||||
$this->view->obj = new Application_Model_Webstream($webstream);
|
|
||||||
$this->view->action = "new";
|
|
||||||
$this->view->html = $this->view->render('webstream/_webstream.phtml');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function editAction()
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
$id = $request->getParam("id");
|
|
||||||
if (is_null($id)) {
|
|
||||||
throw new Exception("Missing parameter 'id'");
|
|
||||||
}
|
|
||||||
|
|
||||||
$webstream = CcWebstreamQuery::create()->findPK($id);
|
|
||||||
if ($webstream) {
|
|
||||||
Application_Model_Library::changePlaylist($id, "stream");
|
|
||||||
}
|
|
||||||
$this->view->obj = new Application_Model_Webstream($webstream);
|
|
||||||
$this->view->action = "edit";
|
|
||||||
$this->view->html = $this->view->render('webstream/_webstream.phtml');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function deleteAction()
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$id = $request->getParam("ids");
|
|
||||||
|
|
||||||
if (!$this->isAuthorized($id)) {
|
|
||||||
header("Status: 401 Not Authorized");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$type = "stream";
|
|
||||||
Application_Model_Library::changePlaylist(null, $type);
|
|
||||||
|
|
||||||
$webstream = CcWebstreamQuery::create()->findPK($id)->delete();
|
|
||||||
|
|
||||||
$this->view->obj = null;
|
|
||||||
$this->view->action = "delete";
|
|
||||||
$this->view->html = $this->view->render('webstream/_webstream.phtml');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*TODO : make a user object be passed a parameter into this function so
|
|
||||||
that it does not have to be fetched multiple times.*/
|
|
||||||
public function isAuthorized($webstream_id)
|
|
||||||
{
|
|
||||||
$user = Application_Model_User::getCurrentUser();
|
|
||||||
if ($user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->isHost()) {
|
|
||||||
// not creating a webstream
|
|
||||||
if ($webstream_id != -1) {
|
|
||||||
$webstream = CcWebstreamQuery::create()->findPK($webstream_id);
|
|
||||||
/*we are updating a playlist. Ensure that if the user is a
|
|
||||||
host/dj, that he has the correct permission.*/
|
|
||||||
$user = Application_Model_User::getCurrentUser();
|
|
||||||
//only allow when webstream belongs to the DJ
|
|
||||||
return $webstream->getDbCreatorId() == $user->getId();
|
|
||||||
}
|
|
||||||
/*we are creating a new stream. Don't need to check whether the
|
|
||||||
DJ/Host owns the stream*/
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
Logging::info( $user );
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function saveAction()
|
|
||||||
{
|
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
$id = $request->getParam("id");
|
|
||||||
|
|
||||||
$parameters = array();
|
|
||||||
foreach (array('id','length','name','description','url') as $p) {
|
|
||||||
$parameters[$p] = trim($request->getParam($p));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->isAuthorized($id)) {
|
|
||||||
header("Status: 401 Not Authorized");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
list($analysis, $mime, $mediaUrl, $di) = Application_Model_Webstream::analyzeFormData($parameters);
|
|
||||||
try {
|
|
||||||
if (Application_Model_Webstream::isValid($analysis)) {
|
|
||||||
$streamId = Application_Model_Webstream::save($parameters, $mime, $mediaUrl, $di);
|
|
||||||
|
|
||||||
Application_Model_Library::changePlaylist($streamId, "stream");
|
|
||||||
|
|
||||||
$this->view->statusMessage = "<div class='success'>"._("Webstream saved.")."</div>";
|
|
||||||
$this->view->streamId = $streamId;
|
|
||||||
$this->view->length = $di->format("%Hh %Im");
|
|
||||||
} else {
|
|
||||||
throw new Exception("isValid returned false");
|
|
||||||
}
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Logging::debug($e->getMessage());
|
|
||||||
$this->view->statusMessage = "<div class='errors'>"._("Invalid form values.")."</div>";
|
|
||||||
$this->view->streamId = -1;
|
|
||||||
$this->view->analysis = $analysis;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -41,6 +41,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$objInfo = Application_Model_Library::getObjInfo($p_type);
|
$objInfo = Application_Model_Library::getObjInfo($p_type);
|
||||||
|
|
||||||
$obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
|
$obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
|
||||||
|
|
||||||
if (isset($obj_sess->id)) {
|
if (isset($obj_sess->id)) {
|
||||||
$obj = new $objInfo['className']($obj_sess->id);
|
$obj = new $objInfo['className']($obj_sess->id);
|
||||||
|
|
||||||
|
@ -89,6 +90,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->obj = $obj;
|
$this->view->obj = $obj;
|
||||||
|
$this->view->type = "sb";
|
||||||
$this->view->id = $obj->getId();
|
$this->view->id = $obj->getId();
|
||||||
|
|
||||||
if ($isJson) {
|
if ($isJson) {
|
||||||
|
@ -98,6 +100,7 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->view->obj = $obj;
|
$this->view->obj = $obj;
|
||||||
|
$this->view->type = "pl";
|
||||||
$this->view->id = $obj->getId();
|
$this->view->id = $obj->getId();
|
||||||
if ($isJson) {
|
if ($isJson) {
|
||||||
return $this->view->html = $this->view->render($viewPath);
|
return $this->view->html = $this->view->render($viewPath);
|
||||||
|
@ -194,9 +197,9 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$objInfo = Application_Model_Library::getObjInfo($type);
|
$objInfo = Application_Model_Library::getObjInfo($type);
|
||||||
Logging::info("editing {$type} {$id}");
|
Logging::info("editing {$type} {$id}");
|
||||||
|
|
||||||
if (!is_null($id)) {
|
// if (!is_null($id)) {
|
||||||
Application_Model_Library::changePlaylist($id, $type);
|
Application_Model_Library::changePlaylist($id, $type);
|
||||||
}
|
// }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$obj = new $objInfo['className']($id);
|
$obj = new $objInfo['className']($id);
|
||||||
|
@ -534,20 +537,23 @@ class PlaylistController extends Zend_Controller_Action
|
||||||
$result['html'] = $this->createFullResponse($bl, true, true);
|
$result['html'] = $this->createFullResponse($bl, true, true);
|
||||||
$result['result'] = 0;
|
$result['result'] = 0;
|
||||||
} else {
|
} else {
|
||||||
$this->view->obj = $bl;
|
|
||||||
$this->view->id = $bl->getId();
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->unsavedName = $params['name'];
|
$this->view->unsavedName = $params['name'];
|
||||||
$this->view->unsavedDesc = $params['description'];
|
$this->view->unsavedDesc = $params['description'];
|
||||||
$viewPath = 'playlist/smart-block.phtml';
|
$viewPath = 'playlist/smart-block.phtml';
|
||||||
|
$this->view->obj = $bl;
|
||||||
|
$this->view->id = $bl->getId();
|
||||||
$result['html'] = $this->view->render($viewPath);
|
$result['html'] = $this->view->render($viewPath);
|
||||||
$result['result'] = 1;
|
$result['result'] = 1;
|
||||||
}
|
}
|
||||||
|
$result['type'] = "sb";
|
||||||
|
$result['id'] = $bl->getId();
|
||||||
|
$result["modified"] = $bl->getLastModified("U");
|
||||||
} else if ($params['type'] == 'playlist') {
|
} else if ($params['type'] == 'playlist') {
|
||||||
$this->setPlaylistNameDescAction();
|
$this->setPlaylistNameDescAction();
|
||||||
|
$result["modified"] = $this->view->modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result["modified"] = $this->view->modified;
|
|
||||||
$this->_helper->json->sendJson($result);
|
$this->_helper->json->sendJson($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class ShowBuilderController extends Zend_Controller_Action {
|
|
||||||
|
|
||||||
public function init() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function indexAction() {
|
|
||||||
$CC_CONFIG = Config::getConfig();
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
|
||||||
$userType = Application_Model_User::GetCurrentUser()->getType();
|
|
||||||
|
|
||||||
//$this->_helper->layout->setLayout("showbuilder");
|
|
||||||
|
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
|
|
||||||
$this->view->headScript()->appendScript(Application_Common_GoogleAnalytics::generateGoogleTagManagerDataLayerJavaScript());
|
|
||||||
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl . 'css/redmond/jquery-ui-1.8.8.custom.css?' . $CC_CONFIG['airtime_version']);
|
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.colReorder.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']);
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/dataTables.colReorder.min.css?'.$CC_CONFIG['airtime_version']);
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/_library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/_library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
|
|
||||||
// PLUPLOAD
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/libs/dropzone.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/_builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/_main_builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
|
|
||||||
// MEDIA BUILDER
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/_spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/_smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
|
||||||
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/_showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
|
||||||
|
|
||||||
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
|
|
||||||
$csrf_element = new Zend_Form_Element_Hidden('csrf');
|
|
||||||
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
|
|
||||||
$this->view->csrf = $csrf_element;
|
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
//populate date range form for show builder.
|
|
||||||
$now = time();
|
|
||||||
$from = $request->getParam("from", $now);
|
|
||||||
$to = $request->getParam("to", $now + (3*60*60));
|
|
||||||
|
|
||||||
$utcTimezone = new DateTimeZone("UTC");
|
|
||||||
$displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone());
|
|
||||||
|
|
||||||
$start = DateTime::createFromFormat("U", $from, $utcTimezone);
|
|
||||||
$start->setTimezone($displayTimeZone);
|
|
||||||
$end = DateTime::createFromFormat("U", $to, $utcTimezone);
|
|
||||||
$end->setTimezone($displayTimeZone);
|
|
||||||
|
|
||||||
$form = new Application_Form_ShowBuilderNew();
|
|
||||||
$form->populate(array(
|
|
||||||
'sb_date_start' => $start->format("Y-m-d"),
|
|
||||||
'sb_time_start' => $start->format("H:i"),
|
|
||||||
'sb_date_end' => $end->format("Y-m-d"),
|
|
||||||
'sb_time_end' => $end->format("H:i")
|
|
||||||
));
|
|
||||||
|
|
||||||
$this->view->sb_form = $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -20,32 +20,25 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
|
|
||||||
$CC_CONFIG = Config::getConfig();
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$response = $this->getResponse();
|
|
||||||
|
|
||||||
//Enable AJAX requests from www.airtime.pro because the autologin during the seamless sign-up follows
|
|
||||||
//a redirect here.
|
|
||||||
CORSHelper::enableATProCrossOriginRequests($request, $response);
|
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
$userType = Application_Model_User::GetCurrentUser()->getType();
|
||||||
|
|
||||||
|
//$this->_helper->layout->setLayout("showbuilder");
|
||||||
|
|
||||||
$user = Application_Model_User::GetCurrentUser();
|
|
||||||
$userType = $user->getType();
|
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
|
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
|
||||||
$this->view->headScript()->appendScript(Application_Common_GoogleAnalytics::generateGoogleTagManagerDataLayerJavaScript());
|
$this->view->headScript()->appendScript(Application_Common_GoogleAnalytics::generateGoogleTagManagerDataLayerJavaScript());
|
||||||
|
|
||||||
|
$this->view->headLink()->appendStylesheet($baseUrl . 'css/redmond/jquery-ui-1.8.8.custom.css?' . $CC_CONFIG['airtime_version']);
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.fnSetFilteringDelay.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColVis.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
//$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.colReorder.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/js-timezone-detect/jstz-1.0.4.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
@ -54,50 +47,32 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/media_library.css?'.$CC_CONFIG['airtime_version']);
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.contextMenu.css?'.$CC_CONFIG['airtime_version']);
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/dataTables.colReorder.min.css?'.$CC_CONFIG['airtime_version']);
|
||||||
|
|
||||||
//Show the timezone and language setup popup, if needed.
|
|
||||||
$this->checkAndShowSetupPopup($request);
|
|
||||||
|
|
||||||
//determine whether to remove/hide/display the library.
|
|
||||||
$showLib = false;
|
|
||||||
if (!$user->isGuest()) {
|
|
||||||
$disableLib = false;
|
|
||||||
|
|
||||||
$data = Application_Model_Preference::getNowPlayingScreenSettings();
|
|
||||||
if (!is_null($data)) {
|
|
||||||
if ($data["library"] == "true") {
|
|
||||||
$showLib = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$disableLib = true;
|
|
||||||
}
|
|
||||||
$this->view->disableLib = $disableLib;
|
|
||||||
$this->view->showLib = $showLib;
|
|
||||||
|
|
||||||
//only include library things on the page if the user can see it.
|
|
||||||
if (!$disableLib) {
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/library.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
|
||||||
$data = Application_Model_Preference::getCurrentLibraryTableSetting();
|
// PLUPLOAD
|
||||||
if (!is_null($data)) {
|
$this->view->headScript()->appendFile($baseUrl.'js/libs/dropzone.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$libraryTable = json_encode($data);
|
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', JSON.stringify($libraryTable) );");
|
|
||||||
} else {
|
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-library', '' );");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$data = Application_Model_Preference::getTimelineDatatableSetting();
|
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
if (!is_null($data)) {
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$timelineTable = json_encode($data);
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/main_builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', JSON.stringify($timelineTable) );");
|
|
||||||
} else {
|
|
||||||
$this->view->headScript()->appendScript("localStorage.setItem( 'datatables-timeline', '' );");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// MEDIA BUILDER
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
||||||
|
|
||||||
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
|
||||||
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
||||||
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/_showbuilder.css?'.$CC_CONFIG['airtime_version']); // TODO
|
||||||
|
|
||||||
|
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
|
||||||
|
$csrf_element = new Zend_Form_Element_Hidden('csrf');
|
||||||
|
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
|
||||||
|
$this->view->csrf = $csrf_element;
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
//populate date range form for show builder.
|
//populate date range form for show builder.
|
||||||
$now = time();
|
$now = time();
|
||||||
$from = $request->getParam("from", $now);
|
$from = $request->getParam("from", $now);
|
||||||
|
@ -120,13 +95,6 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->view->sb_form = $form;
|
$this->view->sb_form = $form;
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/timepicker/jquery.ui.timepicker.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/main_builder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
|
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check if we need to show the timezone/language setup popup and display it. (eg. on first run) */
|
/** Check if we need to show the timezone/language setup popup and display it. (eg. on first run) */
|
||||||
|
@ -331,8 +299,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function scheduleReorderAction()
|
public function scheduleReorderAction()
|
||||||
{
|
{
|
||||||
throw new Exception("this controller is/was a no-op please fix your
|
throw new Exception("this controller is/was a no-op please fix your code");
|
||||||
code");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ class WebstreamController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function newAction()
|
public function newAction()
|
||||||
{
|
{
|
||||||
|
|
||||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
if (!$this->isAuthorized(-1)) {
|
if (!$this->isAuthorized(-1)) {
|
||||||
// TODO: this header call does not actually print any error message
|
// TODO: this header call does not actually print any error message
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
|
||||||
|
|
||||||
// add a select to choose a show.
|
// add a select to choose a show.
|
||||||
$showSelect = new Zend_Form_Element_Select("sb_show_filter");
|
$showSelect = new Zend_Form_Element_Select("sb_show_filter");
|
||||||
$showSelect->setLabel(_("Show:"));
|
$showSelect->setLabel(_("Filter by Show"));
|
||||||
$showSelect->setMultiOptions($this->getShowNames());
|
$showSelect->setMultiOptions($this->getShowNames());
|
||||||
$showSelect->setValue(null);
|
$showSelect->setValue(null);
|
||||||
$showSelect->setDecorators(array('ViewHelper'));
|
$showSelect->setDecorators(array('ViewHelper'));
|
||||||
|
@ -85,7 +85,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
|
||||||
|
|
||||||
private function getShowNames()
|
private function getShowNames()
|
||||||
{
|
{
|
||||||
$showNames = array("0" => "-------------------------");
|
$showNames = array("0" => _("Filter by Show"));
|
||||||
|
|
||||||
$shows = CcShowQuery::create()
|
$shows = CcShowQuery::create()
|
||||||
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
||||||
|
|
|
@ -1,103 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Application_Form_ShowBuilderNew extends Zend_Form_SubForm
|
|
||||||
{
|
|
||||||
|
|
||||||
public function init()
|
|
||||||
{
|
|
||||||
$user = Application_Model_User::getCurrentUser();
|
|
||||||
|
|
||||||
$this->setDecorators(array(
|
|
||||||
array('ViewScript', array('viewScript' => 'form/show-builder.phtml'))
|
|
||||||
));
|
|
||||||
|
|
||||||
// Add start date element
|
|
||||||
$startDate = new Zend_Form_Element_Text('sb_date_start');
|
|
||||||
$startDate->class = 'input_text';
|
|
||||||
$startDate->setRequired(true)
|
|
||||||
->setLabel(_('Date Start:'))
|
|
||||||
->setValue(date("Y-m-d"))
|
|
||||||
->setFilters(array('StringTrim'))
|
|
||||||
->setValidators(array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('date', false, array('YYYY-MM-DD'))))
|
|
||||||
->setDecorators(array('ViewHelper'));
|
|
||||||
$startDate->setAttrib('alt', 'date');
|
|
||||||
$this->addElement($startDate);
|
|
||||||
|
|
||||||
// Add start time element
|
|
||||||
$startTime = new Zend_Form_Element_Text('sb_time_start');
|
|
||||||
$startTime->class = 'input_text';
|
|
||||||
$startTime->setRequired(true)
|
|
||||||
->setValue('00:00')
|
|
||||||
->setFilters(array('StringTrim'))
|
|
||||||
->setValidators(array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
|
|
||||||
->setDecorators(array('ViewHelper'));
|
|
||||||
$startTime->setAttrib('alt', 'time');
|
|
||||||
$this->addElement($startTime);
|
|
||||||
|
|
||||||
// Add end date element
|
|
||||||
$endDate = new Zend_Form_Element_Text('sb_date_end');
|
|
||||||
$endDate->class = 'input_text';
|
|
||||||
$endDate->setRequired(true)
|
|
||||||
->setLabel(_('Date End:'))
|
|
||||||
->setValue(date("Y-m-d"))
|
|
||||||
->setFilters(array('StringTrim'))
|
|
||||||
->setValidators(array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('date', false, array('YYYY-MM-DD'))))
|
|
||||||
->setDecorators(array('ViewHelper'));
|
|
||||||
$endDate->setAttrib('alt', 'date');
|
|
||||||
$this->addElement($endDate);
|
|
||||||
|
|
||||||
// Add end time element
|
|
||||||
$endTime = new Zend_Form_Element_Text('sb_time_end');
|
|
||||||
$endTime->class = 'input_text';
|
|
||||||
$endTime->setRequired(true)
|
|
||||||
->setValue('01:00')
|
|
||||||
->setFilters(array('StringTrim'))
|
|
||||||
->setValidators(array(
|
|
||||||
'NotEmpty',
|
|
||||||
array('date', false, array('HH:mm')),
|
|
||||||
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
|
|
||||||
->setDecorators(array('ViewHelper'));
|
|
||||||
$endTime->setAttrib('alt', 'time');
|
|
||||||
$this->addElement($endTime);
|
|
||||||
|
|
||||||
// add a select to choose a show.
|
|
||||||
$showSelect = new Zend_Form_Element_Select("sb_show_filter");
|
|
||||||
$showSelect->setLabel(_("Filter by Show"));
|
|
||||||
$showSelect->setMultiOptions($this->getShowNames());
|
|
||||||
$showSelect->setValue(null);
|
|
||||||
$showSelect->setDecorators(array('ViewHelper'));
|
|
||||||
$this->addElement($showSelect);
|
|
||||||
|
|
||||||
if ($user->getType() === 'H') {
|
|
||||||
$myShows = new Zend_Form_Element_Checkbox('sb_my_shows');
|
|
||||||
$myShows->setLabel(_('All My Shows:'))
|
|
||||||
->setDecorators(array('ViewHelper'));
|
|
||||||
$this->addElement($myShows);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getShowNames()
|
|
||||||
{
|
|
||||||
$showNames = array("0" => _("Filter by Show"));
|
|
||||||
|
|
||||||
$shows = CcShowQuery::create()
|
|
||||||
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
|
|
||||||
->orderByDbName()
|
|
||||||
->find();
|
|
||||||
|
|
||||||
foreach ($shows as $show) {
|
|
||||||
|
|
||||||
$showNames[$show->getDbId()] = $show->getDbName();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $showNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -341,7 +341,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
|
|
||||||
$generate = new Zend_Form_Element_Button('generate_button');
|
$generate = new Zend_Form_Element_Button('generate_button');
|
||||||
$generate->setAttrib('class', 'btn btn-small');
|
$generate->setAttrib('class', 'sp-button btn');
|
||||||
$generate->setAttrib('title', _('Generate playlist content and save criteria'));
|
$generate->setAttrib('title', _('Generate playlist content and save criteria'));
|
||||||
$generate->setIgnore(true);
|
$generate->setIgnore(true);
|
||||||
$generate->setLabel(_('Generate'));
|
$generate->setLabel(_('Generate'));
|
||||||
|
@ -349,7 +349,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
|
||||||
$this->addElement($generate);
|
$this->addElement($generate);
|
||||||
|
|
||||||
$shuffle = new Zend_Form_Element_Button('shuffle_button');
|
$shuffle = new Zend_Form_Element_Button('shuffle_button');
|
||||||
$shuffle->setAttrib('class', 'btn btn-small');
|
$shuffle->setAttrib('class', 'sp-button btn');
|
||||||
$shuffle->setAttrib('title', _('Shuffle playlist content'));
|
$shuffle->setAttrib('title', _('Shuffle playlist content'));
|
||||||
$shuffle->setIgnore(true);
|
$shuffle->setIgnore(true);
|
||||||
$shuffle->setLabel(_('Shuffle'));
|
$shuffle->setLabel(_('Shuffle'));
|
||||||
|
|
|
@ -1,615 +0,0 @@
|
||||||
<?php
|
|
||||||
class Application_Form_SmartBlockCriteriaNew extends Zend_Form_SubForm
|
|
||||||
{
|
|
||||||
private $criteriaOptions;
|
|
||||||
private $stringCriteriaOptions;
|
|
||||||
private $numericCriteriaOptions;
|
|
||||||
private $sortOptions;
|
|
||||||
private $limitOptions;
|
|
||||||
|
|
||||||
/* We need to know if the criteria value will be a string
|
|
||||||
* or numeric value in order to populate the modifier
|
|
||||||
* select list
|
|
||||||
*/
|
|
||||||
private $criteriaTypes = array(
|
|
||||||
0 => "",
|
|
||||||
"album_title" => "s",
|
|
||||||
"bit_rate" => "n",
|
|
||||||
"bpm" => "n",
|
|
||||||
"composer" => "s",
|
|
||||||
"conductor" => "s",
|
|
||||||
"copyright" => "s",
|
|
||||||
"cuein" => "n",
|
|
||||||
"cueout" => "n",
|
|
||||||
"artist_name" => "s",
|
|
||||||
"encoded_by" => "s",
|
|
||||||
"utime" => "n",
|
|
||||||
"mtime" => "n",
|
|
||||||
"lptime" => "n",
|
|
||||||
"genre" => "s",
|
|
||||||
"isrc_number" => "s",
|
|
||||||
"label" => "s",
|
|
||||||
"language" => "s",
|
|
||||||
"length" => "n",
|
|
||||||
"mime" => "s",
|
|
||||||
"mood" => "s",
|
|
||||||
"owner_id" => "s",
|
|
||||||
"replay_gain" => "n",
|
|
||||||
"sample_rate" => "n",
|
|
||||||
"track_title" => "s",
|
|
||||||
"track_number" => "n",
|
|
||||||
"info_url" => "s",
|
|
||||||
"year" => "n"
|
|
||||||
);
|
|
||||||
|
|
||||||
private function getCriteriaOptions($option = null)
|
|
||||||
{
|
|
||||||
if (!isset($this->criteriaOptions)) {
|
|
||||||
$this->criteriaOptions = array(
|
|
||||||
0 => _("Select criteria"),
|
|
||||||
"album_title" => _("Album"),
|
|
||||||
"bit_rate" => _("Bit Rate (Kbps)"),
|
|
||||||
"bpm" => _("BPM"),
|
|
||||||
"composer" => _("Composer"),
|
|
||||||
"conductor" => _("Conductor"),
|
|
||||||
"copyright" => _("Copyright"),
|
|
||||||
"cuein" => _("Cue In"),
|
|
||||||
"cueout" => _("Cue Out"),
|
|
||||||
"artist_name" => _("Creator"),
|
|
||||||
"encoded_by" => _("Encoded By"),
|
|
||||||
"genre" => _("Genre"),
|
|
||||||
"isrc_number" => _("ISRC"),
|
|
||||||
"label" => _("Label"),
|
|
||||||
"language" => _("Language"),
|
|
||||||
"mtime" => _("Last Modified"),
|
|
||||||
"lptime" => _("Last Played"),
|
|
||||||
"length" => _("Length"),
|
|
||||||
"mime" => _("Mime"),
|
|
||||||
"mood" => _("Mood"),
|
|
||||||
"owner_id" => _("Owner"),
|
|
||||||
"replay_gain" => _("Replay Gain"),
|
|
||||||
"sample_rate" => _("Sample Rate (kHz)"),
|
|
||||||
"track_title" => _("Title"),
|
|
||||||
"track_number" => _("Track Number"),
|
|
||||||
"utime" => _("Uploaded"),
|
|
||||||
"info_url" => _("Website"),
|
|
||||||
"year" => _("Year")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_null($option)) return $this->criteriaOptions;
|
|
||||||
else return $this->criteriaOptions[$option];
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getStringCriteriaOptions()
|
|
||||||
{
|
|
||||||
if (!isset($this->stringCriteriaOptions)) {
|
|
||||||
$this->stringCriteriaOptions = array(
|
|
||||||
"0" => _("Select modifier"),
|
|
||||||
"contains" => _("contains"),
|
|
||||||
"does not contain" => _("does not contain"),
|
|
||||||
"is" => _("is"),
|
|
||||||
"is not" => _("is not"),
|
|
||||||
"starts with" => _("starts with"),
|
|
||||||
"ends with" => _("ends with")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return $this->stringCriteriaOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getNumericCriteriaOptions()
|
|
||||||
{
|
|
||||||
if (!isset($this->numericCriteriaOptions)) {
|
|
||||||
$this->numericCriteriaOptions = array(
|
|
||||||
"0" => _("Select modifier"),
|
|
||||||
"is" => _("is"),
|
|
||||||
"is not" => _("is not"),
|
|
||||||
"is greater than" => _("is greater than"),
|
|
||||||
"is less than" => _("is less than"),
|
|
||||||
"is in the range" => _("is in the range")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return $this->numericCriteriaOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getLimitOptions()
|
|
||||||
{
|
|
||||||
if (!isset($this->limitOptions)) {
|
|
||||||
$this->limitOptions = array(
|
|
||||||
"hours" => _("hours"),
|
|
||||||
"minutes" => _("minutes"),
|
|
||||||
"items" => _("items")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return $this->limitOptions;
|
|
||||||
}
|
|
||||||
private function getSortOptions()
|
|
||||||
{
|
|
||||||
if (!isset($this->sortOptions)) {
|
|
||||||
$this->sortOptions = array(
|
|
||||||
"random" => _("random"),
|
|
||||||
"newest" => _("newest"),
|
|
||||||
"oldest" => _("oldest")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return $this->sortOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function init()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* converts UTC timestamp citeria into user timezone strings.
|
|
||||||
*/
|
|
||||||
private function convertTimestamps(&$criteria)
|
|
||||||
{
|
|
||||||
$columns = array("utime", "mtime", "lptime");
|
|
||||||
|
|
||||||
foreach ($columns as $column) {
|
|
||||||
|
|
||||||
if (isset($criteria[$column])) {
|
|
||||||
|
|
||||||
foreach ($criteria[$column] as &$constraint) {
|
|
||||||
|
|
||||||
$constraint['value'] =
|
|
||||||
Application_Common_DateHelper::UTCStringToUserTimezoneString($constraint['value']);
|
|
||||||
|
|
||||||
if (isset($constraint['extra'])) {
|
|
||||||
$constraint['extra'] =
|
|
||||||
Application_Common_DateHelper::UTCStringToUserTimezoneString($constraint['extra']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function startForm($p_blockId, $p_isValid = false)
|
|
||||||
{
|
|
||||||
// load type
|
|
||||||
$out = CcBlockQuery::create()->findPk($p_blockId);
|
|
||||||
if ($out->getDbType() == "static") {
|
|
||||||
$blockType = 0;
|
|
||||||
} else {
|
|
||||||
$blockType = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$spType = new Zend_Form_Element_Radio('sp_type');
|
|
||||||
$spType->setLabel(_('Set smart block type:'))
|
|
||||||
->setDecorators(array('viewHelper'))
|
|
||||||
->setMultiOptions(array(
|
|
||||||
'static' => _('Static'),
|
|
||||||
'dynamic' => _('Dynamic')
|
|
||||||
))
|
|
||||||
->setValue($blockType);
|
|
||||||
$this->addElement($spType);
|
|
||||||
|
|
||||||
$bl = new Application_Model_Block($p_blockId);
|
|
||||||
$storedCrit = $bl->getCriteria();
|
|
||||||
|
|
||||||
//need to convert criteria to be displayed in the user's timezone if there's some timestamp type.
|
|
||||||
self::convertTimestamps($storedCrit["crit"]);
|
|
||||||
|
|
||||||
/* $modRoadMap stores the number of same criteria
|
|
||||||
* Ex: 3 Album titles, and 2 Track titles
|
|
||||||
* We need to know this so we display the form elements properly
|
|
||||||
*/
|
|
||||||
$modRowMap = array();
|
|
||||||
|
|
||||||
$openSmartBlockOption = false;
|
|
||||||
if (!empty($storedCrit)) {
|
|
||||||
$openSmartBlockOption = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$criteriaKeys = array();
|
|
||||||
if (isset($storedCrit["crit"])) {
|
|
||||||
$criteriaKeys = array_keys($storedCrit["crit"]);
|
|
||||||
}
|
|
||||||
$numElements = count($this->getCriteriaOptions());
|
|
||||||
for ($i = 0; $i < $numElements; $i++) {
|
|
||||||
$criteriaType = "";
|
|
||||||
|
|
||||||
if (isset($criteriaKeys[$i])) {
|
|
||||||
$critCount = count($storedCrit["crit"][$criteriaKeys[$i]]);
|
|
||||||
} else {
|
|
||||||
$critCount = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$modRowMap[$i] = $critCount;
|
|
||||||
|
|
||||||
/* Loop through all criteria with the same field
|
|
||||||
* Ex: all criteria for 'Album'
|
|
||||||
*/
|
|
||||||
for ($j = 0; $j < $critCount; $j++) {
|
|
||||||
/****************** CRITERIA ***********/
|
|
||||||
if ($j > 0) {
|
|
||||||
$invisible = ' sp-invisible';
|
|
||||||
} else {
|
|
||||||
$invisible = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$criteria = new Zend_Form_Element_Select("sp_criteria_field_".$i."_".$j);
|
|
||||||
$criteria->setAttrib('class', 'input_select sp_input_select'.$invisible)
|
|
||||||
->setValue('Select criteria')
|
|
||||||
->setDecorators(array('viewHelper'))
|
|
||||||
->setMultiOptions($this->getCriteriaOptions());
|
|
||||||
if ($i != 0 && !isset($criteriaKeys[$i])) {
|
|
||||||
$criteria->setAttrib('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($criteriaKeys[$i])) {
|
|
||||||
$criteriaType = $this->criteriaTypes[$storedCrit["crit"][$criteriaKeys[$i]][$j]["criteria"]];
|
|
||||||
$criteria->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["criteria"]);
|
|
||||||
}
|
|
||||||
$this->addElement($criteria);
|
|
||||||
|
|
||||||
/****************** MODIFIER ***********/
|
|
||||||
$criteriaModifers = new Zend_Form_Element_Select("sp_criteria_modifier_".$i."_".$j);
|
|
||||||
$criteriaModifers->setValue('Select modifier')
|
|
||||||
->setAttrib('class', 'input_select sp_input_select')
|
|
||||||
->setDecorators(array('viewHelper'));
|
|
||||||
if ($i != 0 && !isset($criteriaKeys[$i])) {
|
|
||||||
$criteriaModifers->setAttrib('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
if (isset($criteriaKeys[$i])) {
|
|
||||||
if ($criteriaType == "s") {
|
|
||||||
$criteriaModifers->setMultiOptions($this->getStringCriteriaOptions());
|
|
||||||
} else {
|
|
||||||
$criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions());
|
|
||||||
}
|
|
||||||
$criteriaModifers->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["modifier"]);
|
|
||||||
} else {
|
|
||||||
$criteriaModifers->setMultiOptions(array('0' => _('Select modifier')));
|
|
||||||
}
|
|
||||||
$this->addElement($criteriaModifers);
|
|
||||||
|
|
||||||
/****************** VALUE ***********/
|
|
||||||
$criteriaValue = new Zend_Form_Element_Text("sp_criteria_value_".$i."_".$j);
|
|
||||||
$criteriaValue->setAttrib('class', 'input_text sp_input_text')
|
|
||||||
->setDecorators(array('viewHelper'));
|
|
||||||
if ($i != 0 && !isset($criteriaKeys[$i])) {
|
|
||||||
$criteriaValue->setAttrib('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
if (isset($criteriaKeys[$i])) {
|
|
||||||
$criteriaValue->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["value"]);
|
|
||||||
}
|
|
||||||
$this->addElement($criteriaValue);
|
|
||||||
|
|
||||||
/****************** EXTRA ***********/
|
|
||||||
$criteriaExtra = new Zend_Form_Element_Text("sp_criteria_extra_".$i."_".$j);
|
|
||||||
$criteriaExtra->setAttrib('class', 'input_text sp_extra_input_text')
|
|
||||||
->setDecorators(array('viewHelper'));
|
|
||||||
if (isset($criteriaKeys[$i]) && isset($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"])) {
|
|
||||||
$criteriaExtra->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["extra"]);
|
|
||||||
$criteriaValue->setAttrib('class', 'input_text sp_extra_input_text');
|
|
||||||
} else {
|
|
||||||
$criteriaExtra->setAttrib('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
$this->addElement($criteriaExtra);
|
|
||||||
|
|
||||||
}//for
|
|
||||||
|
|
||||||
}//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);
|
|
||||||
|
|
||||||
$sort = new Zend_Form_Element_Select('sp_sort_options');
|
|
||||||
$sort->setAttrib('class', 'sp_input_select')
|
|
||||||
->setDecorators(array('viewHelper'))
|
|
||||||
->setMultiOptions($this->getSortOptions());
|
|
||||||
if (isset($storedCrit["sort"])) {
|
|
||||||
$sort->setValue($storedCrit["sort"]["value"]);
|
|
||||||
}
|
|
||||||
$this->addElement($sort);
|
|
||||||
|
|
||||||
$limit = new Zend_Form_Element_Select('sp_limit_options');
|
|
||||||
$limit->setAttrib('class', 'sp_input_select')
|
|
||||||
->setDecorators(array('viewHelper'))
|
|
||||||
->setMultiOptions($this->getLimitOptions());
|
|
||||||
if (isset($storedCrit["limit"])) {
|
|
||||||
$limit->setValue($storedCrit["limit"]["modifier"]);
|
|
||||||
}
|
|
||||||
$this->addElement($limit);
|
|
||||||
|
|
||||||
$limitValue = new Zend_Form_Element_Text('sp_limit_value');
|
|
||||||
$limitValue->setAttrib('class', 'sp_input_text_limit')
|
|
||||||
->setLabel(_('Limit to'))
|
|
||||||
->setDecorators(array('viewHelper'));
|
|
||||||
$this->addElement($limitValue);
|
|
||||||
if (isset($storedCrit["limit"])) {
|
|
||||||
$limitValue->setValue($storedCrit["limit"]["value"]);
|
|
||||||
} else {
|
|
||||||
// setting default to 1 hour
|
|
||||||
$limitValue->setValue(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//getting block content candidate count that meets criteria
|
|
||||||
$bl = new Application_Model_Block($p_blockId);
|
|
||||||
if ($p_isValid) {
|
|
||||||
$files = $bl->getListofFilesMeetCriteria();
|
|
||||||
$showPoolCount = true;
|
|
||||||
} else {
|
|
||||||
$files = null;
|
|
||||||
$showPoolCount = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$generate = new Zend_Form_Element_Button('generate_button');
|
|
||||||
$generate->setAttrib('class', 'sp-button btn');
|
|
||||||
$generate->setAttrib('title', _('Generate playlist content and save criteria'));
|
|
||||||
$generate->setIgnore(true);
|
|
||||||
$generate->setLabel(_('Generate'));
|
|
||||||
$generate->setDecorators(array('viewHelper'));
|
|
||||||
$this->addElement($generate);
|
|
||||||
|
|
||||||
$shuffle = new Zend_Form_Element_Button('shuffle_button');
|
|
||||||
$shuffle->setAttrib('class', 'sp-button btn');
|
|
||||||
$shuffle->setAttrib('title', _('Shuffle playlist content'));
|
|
||||||
$shuffle->setIgnore(true);
|
|
||||||
$shuffle->setLabel(_('Shuffle'));
|
|
||||||
$shuffle->setDecorators(array('viewHelper'));
|
|
||||||
$this->addElement($shuffle);
|
|
||||||
|
|
||||||
$this->setDecorators(array(
|
|
||||||
array('ViewScript', array('viewScript' => 'form/_smart-block-criteria.phtml', "openOption"=> $openSmartBlockOption,
|
|
||||||
'criteriasLength' => count($this->getCriteriaOptions()), 'poolCount' => $files['count'], 'modRowMap' => $modRowMap,
|
|
||||||
'showPoolCount' => $showPoolCount))
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function preValidation($params)
|
|
||||||
{
|
|
||||||
$data = Application_Model_Block::organizeSmartPlaylistCriteria($params['data']);
|
|
||||||
// add elelments that needs to be added
|
|
||||||
// set multioption for modifier according to criteria_field
|
|
||||||
$modRowMap = array();
|
|
||||||
foreach ($data['criteria'] as $critKey=>$d) {
|
|
||||||
$count = 1;
|
|
||||||
foreach ($d as $modKey=>$modInfo) {
|
|
||||||
if ($modKey == 0) {
|
|
||||||
$eleCrit = $this->getElement("sp_criteria_field_".$critKey."_".$modKey);
|
|
||||||
$eleCrit->setValue($this->getCriteriaOptions($modInfo['sp_criteria_field']));
|
|
||||||
$eleCrit->setAttrib("disabled", null);
|
|
||||||
|
|
||||||
$eleMod = $this->getElement("sp_criteria_modifier_".$critKey."_".$modKey);
|
|
||||||
$criteriaType = $this->criteriaTypes[$modInfo['sp_criteria_field']];
|
|
||||||
if ($criteriaType == "s") {
|
|
||||||
$eleMod->setMultiOptions($this->getStringCriteriaOptions());
|
|
||||||
} elseif ($criteriaType == "n") {
|
|
||||||
$eleMod->setMultiOptions($this->getNumericCriteriaOptions());
|
|
||||||
} else {
|
|
||||||
$eleMod->setMultiOptions(array('0' => _('Select modifier')));
|
|
||||||
}
|
|
||||||
$eleMod->setValue($modInfo['sp_criteria_modifier']);
|
|
||||||
$eleMod->setAttrib("disabled", null);
|
|
||||||
|
|
||||||
$eleValue = $this->getElement("sp_criteria_value_".$critKey."_".$modKey);
|
|
||||||
$eleValue->setValue($modInfo['sp_criteria_value']);
|
|
||||||
$eleValue->setAttrib("disabled", null);
|
|
||||||
|
|
||||||
if (isset($modInfo['sp_criteria_extra'])) {
|
|
||||||
$eleExtra = $this->getElement("sp_criteria_extra_".$critKey."_".$modKey);
|
|
||||||
$eleExtra->setValue($modInfo['sp_criteria_extra']);
|
|
||||||
$eleValue->setAttrib('class', 'input_text sp_extra_input_text');
|
|
||||||
$eleExtra->setAttrib("disabled", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$criteria = new Zend_Form_Element_Select("sp_criteria_field_".$critKey."_".$modKey);
|
|
||||||
$criteria->setAttrib('class', 'input_select sp_input_select sp-invisible')
|
|
||||||
->setValue('Select criteria')
|
|
||||||
->setDecorators(array('viewHelper'))
|
|
||||||
->setMultiOptions($this->getCriteriaOptions());
|
|
||||||
|
|
||||||
$criteriaType = $this->criteriaTypes[$modInfo['sp_criteria_field']];
|
|
||||||
$criteria->setValue($this->getCriteriaOptions($modInfo['sp_criteria_field']));
|
|
||||||
$this->addElement($criteria);
|
|
||||||
|
|
||||||
/****************** MODIFIER ***********/
|
|
||||||
$criteriaModifers = new Zend_Form_Element_Select("sp_criteria_modifier_".$critKey."_".$modKey);
|
|
||||||
$criteriaModifers->setValue('Select modifier')
|
|
||||||
->setAttrib('class', 'input_select sp_input_select')
|
|
||||||
->setDecorators(array('viewHelper'));
|
|
||||||
|
|
||||||
if ($criteriaType == "s") {
|
|
||||||
$criteriaModifers->setMultiOptions($this->getStringCriteriaOptions());
|
|
||||||
} elseif ($criteriaType == "n") {
|
|
||||||
$criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions());
|
|
||||||
} else {
|
|
||||||
$criteriaModifers->setMultiOptions(array('0' => _('Select modifier')));
|
|
||||||
}
|
|
||||||
$criteriaModifers->setValue($modInfo['sp_criteria_modifier']);
|
|
||||||
$this->addElement($criteriaModifers);
|
|
||||||
|
|
||||||
/****************** VALUE ***********/
|
|
||||||
$criteriaValue = new Zend_Form_Element_Text("sp_criteria_value_".$critKey."_".$modKey);
|
|
||||||
$criteriaValue->setAttrib('class', 'input_text sp_input_text')
|
|
||||||
->setDecorators(array('viewHelper'));
|
|
||||||
$criteriaValue->setValue($modInfo['sp_criteria_value']);
|
|
||||||
$this->addElement($criteriaValue);
|
|
||||||
|
|
||||||
/****************** EXTRA ***********/
|
|
||||||
$criteriaExtra = new Zend_Form_Element_Text("sp_criteria_extra_".$critKey."_".$modKey);
|
|
||||||
$criteriaExtra->setAttrib('class', 'input_text sp_extra_input_text')
|
|
||||||
->setDecorators(array('viewHelper'));
|
|
||||||
if (isset($modInfo['sp_criteria_extra'])) {
|
|
||||||
$criteriaExtra->setValue($modInfo['sp_criteria_extra']);
|
|
||||||
$criteriaValue->setAttrib('class', 'input_text sp_extra_input_text');
|
|
||||||
} else {
|
|
||||||
$criteriaExtra->setAttrib('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
$this->addElement($criteriaExtra);
|
|
||||||
$count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$modRowMap[$critKey] = $count;
|
|
||||||
}
|
|
||||||
|
|
||||||
$decorator = $this->getDecorator("ViewScript");
|
|
||||||
$existingModRow = $decorator->getOption("modRowMap");
|
|
||||||
foreach ($modRowMap as $key=>$v) {
|
|
||||||
$existingModRow[$key] = $v;
|
|
||||||
}
|
|
||||||
$decorator->setOption("modRowMap", $existingModRow);
|
|
||||||
|
|
||||||
// reconstruct the params['criteria'] so we can populate the form
|
|
||||||
$formData = array();
|
|
||||||
foreach ($params['data'] as $ele) {
|
|
||||||
$formData[$ele['name']] = $ele['value'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->populate($formData);
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isValid($params)
|
|
||||||
{
|
|
||||||
$isValid = true;
|
|
||||||
$data = $this->preValidation($params);
|
|
||||||
$criteria2PeerMap = array(
|
|
||||||
0 => "Select criteria",
|
|
||||||
"album_title" => "DbAlbumTitle",
|
|
||||||
"artist_name" => "DbArtistName",
|
|
||||||
"bit_rate" => "DbBitRate",
|
|
||||||
"bpm" => "DbBpm",
|
|
||||||
"composer" => "DbComposer",
|
|
||||||
"conductor" => "DbConductor",
|
|
||||||
"copyright" => "DbCopyright",
|
|
||||||
"cuein" => "DbCuein",
|
|
||||||
"cueout" => "DbCueout",
|
|
||||||
"encoded_by" => "DbEncodedBy",
|
|
||||||
"utime" => "DbUtime",
|
|
||||||
"mtime" => "DbMtime",
|
|
||||||
"lptime" => "DbLPtime",
|
|
||||||
"genre" => "DbGenre",
|
|
||||||
"info_url" => "DbInfoUrl",
|
|
||||||
"isrc_number" => "DbIsrcNumber",
|
|
||||||
"label" => "DbLabel",
|
|
||||||
"language" => "DbLanguage",
|
|
||||||
"length" => "DbLength",
|
|
||||||
"mime" => "DbMime",
|
|
||||||
"mood" => "DbMood",
|
|
||||||
"owner_id" => "DbOwnerId",
|
|
||||||
"replay_gain" => "DbReplayGain",
|
|
||||||
"sample_rate" => "DbSampleRate",
|
|
||||||
"track_title" => "DbTrackTitle",
|
|
||||||
"track_number" => "DbTrackNumber",
|
|
||||||
"year" => "DbYear"
|
|
||||||
);
|
|
||||||
|
|
||||||
// things we need to check
|
|
||||||
// 1. limit value shouldn't be empty and has upperbound of 24 hrs
|
|
||||||
// 2. sp_criteria or sp_criteria_modifier shouldn't be 0
|
|
||||||
// 3. validate formate according to DB column type
|
|
||||||
$multiplier = 1;
|
|
||||||
$result = 0;
|
|
||||||
|
|
||||||
// validation start
|
|
||||||
if ($data['etc']['sp_limit_options'] == 'hours') {
|
|
||||||
$multiplier = 60;
|
|
||||||
}
|
|
||||||
if ($data['etc']['sp_limit_options'] == 'hours' || $data['etc']['sp_limit_options'] == 'mins') {
|
|
||||||
$element = $this->getElement("sp_limit_value");
|
|
||||||
if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
|
|
||||||
$element->addError(_("Limit cannot be empty or smaller than 0"));
|
|
||||||
$isValid = false;
|
|
||||||
} else {
|
|
||||||
$mins = floatval($data['etc']['sp_limit_value']) * $multiplier;
|
|
||||||
if ($mins > 1440) {
|
|
||||||
$element->addError(_("Limit cannot be more than 24 hrs"));
|
|
||||||
$isValid = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$element = $this->getElement("sp_limit_value");
|
|
||||||
if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
|
|
||||||
$element->addError(_("Limit cannot be empty or smaller than 0"));
|
|
||||||
$isValid = false;
|
|
||||||
} elseif (!ctype_digit($data['etc']['sp_limit_value'])) {
|
|
||||||
$element->addError(_("The value should be an integer"));
|
|
||||||
$isValid = false;
|
|
||||||
} elseif (intval($data['etc']['sp_limit_value']) > 500) {
|
|
||||||
$element->addError(_("500 is the max item limit value you can set"));
|
|
||||||
$isValid = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($data['criteria'])) {
|
|
||||||
foreach ($data['criteria'] as $rowKey=>$row) {
|
|
||||||
foreach ($row as $key=>$d) {
|
|
||||||
$element = $this->getElement("sp_criteria_field_".$rowKey."_".$key);
|
|
||||||
// check for not selected select box
|
|
||||||
if ($d['sp_criteria_field'] == "0" || $d['sp_criteria_modifier'] == "0") {
|
|
||||||
$element->addError(_("You must select Criteria and Modifier"));
|
|
||||||
$isValid = false;
|
|
||||||
} else {
|
|
||||||
$column = CcFilesPeer::getTableMap()->getColumnByPhpName($criteria2PeerMap[$d['sp_criteria_field']]);
|
|
||||||
// validation on type of column
|
|
||||||
if (in_array($d['sp_criteria_field'], array('length', 'cuein', 'cueout'))) {
|
|
||||||
if (!preg_match("/^(\d{2}):(\d{2}):(\d{2})/", $d['sp_criteria_value'])) {
|
|
||||||
$element->addError(_("'Length' should be in '00:00:00' format"));
|
|
||||||
$isValid = false;
|
|
||||||
}
|
|
||||||
} elseif ($column->getType() == PropelColumnTypes::TIMESTAMP) {
|
|
||||||
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_value'])) {
|
|
||||||
$element->addError(_("The value should be in timestamp format (e.g. 0000-00-00 or 0000-00-00 00:00:00)"));
|
|
||||||
$isValid = false;
|
|
||||||
} else {
|
|
||||||
$result = Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_value']);
|
|
||||||
if (!$result["success"]) {
|
|
||||||
// check for if it is in valid range( 1753-01-01 ~ 12/31/9999 )
|
|
||||||
$element->addError($result["errMsg"]);
|
|
||||||
$isValid = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($d['sp_criteria_extra'])) {
|
|
||||||
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_extra'])) {
|
|
||||||
$element->addError(_("The value should be in timestamp format (e.g. 0000-00-00 or 0000-00-00 00:00:00)"));
|
|
||||||
$isValid = false;
|
|
||||||
} else {
|
|
||||||
$result = Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_extra']);
|
|
||||||
if (!$result["success"]) {
|
|
||||||
// check for if it is in valid range( 1753-01-01 ~ 12/31/9999 )
|
|
||||||
$element->addError($result["errMsg"]);
|
|
||||||
$isValid = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif ($column->getType() == PropelColumnTypes::INTEGER &&
|
|
||||||
$d['sp_criteria_field'] != 'owner_id') {
|
|
||||||
if (!is_numeric($d['sp_criteria_value'])) {
|
|
||||||
$element->addError(_("The value has to be numeric"));
|
|
||||||
$isValid = false;
|
|
||||||
}
|
|
||||||
// length check
|
|
||||||
if ($d['sp_criteria_value'] >= pow(2,31)) {
|
|
||||||
$element->addError(_("The value should be less then 2147483648"));
|
|
||||||
$isValid = false;
|
|
||||||
}
|
|
||||||
} elseif ($column->getType() == PropelColumnTypes::VARCHAR) {
|
|
||||||
if (strlen($d['sp_criteria_value']) > $column->getSize()) {
|
|
||||||
$element->addError(sprintf(_("The value should be less than %s characters"), $column->getSize()));
|
|
||||||
$isValid = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($d['sp_criteria_value'] == "") {
|
|
||||||
$element->addError(_("Value cannot be empty"));
|
|
||||||
$isValid = false;
|
|
||||||
}
|
|
||||||
}//end foreach
|
|
||||||
}//for loop
|
|
||||||
}//if
|
|
||||||
|
|
||||||
return $isValid;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -98,15 +98,15 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="media_type_selector" selection_id="1">
|
<div class="media_type_selector" selection_id="1">
|
||||||
<a href="/show-builder#"><?php echo _("Dashboard") ?></a></div>
|
<a href="/showbuilder#"><?php echo _("Dashboard") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="1">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="1">
|
||||||
<a href="/show-builder#files"><?php echo _("Files") ?></a></div>
|
<a href="/showbuilder#files"><?php echo _("Files") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="2">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="2">
|
||||||
<a href="/show-builder#playlists"><?php echo _("Playlists") ?></a></div>
|
<a href="/showbuilder#playlists"><?php echo _("Playlists") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="3">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="3">
|
||||||
<a href="/show-builder#smart-blocks"><?php echo _("Smart Blocks") ?></a></div>
|
<a href="/showbuilder#smart-blocks"><?php echo _("Smart Blocks") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="4">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="4">
|
||||||
<a href="/show-builder#webstreams"><?php echo _("Webstreams") ?></a></div>
|
<a href="/showbuilder#webstreams"><?php echo _("Webstreams") ?></a></div>
|
||||||
<hr style="margin-left: 5px; margin-right: 5px">
|
<hr style="margin-left: 5px; margin-right: 5px">
|
||||||
<div id="nav">
|
<div id="nav">
|
||||||
<?php echo $this->navigation()->menu(); ?>
|
<?php echo $this->navigation()->menu(); ?>
|
||||||
|
|
|
@ -98,15 +98,15 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="media_type_selector" selection_id="1">
|
<div class="media_type_selector" selection_id="1">
|
||||||
<a href="/show-builder"><?php echo _("Dashboard") ?></a></div>
|
<a href="/showbuilder"><?php echo _("Dashboard") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="1">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="1">
|
||||||
<a href="/show-builder#files"><?php echo _("Files") ?></a></div>
|
<a href="/showbuilder#files"><?php echo _("Files") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="2">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="2">
|
||||||
<a href="/show-builder#playlists"><?php echo _("Playlists") ?></a></div>
|
<a href="/showbuilder#playlists"><?php echo _("Playlists") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="3">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="3">
|
||||||
<a href="/show-builder#smart-blocks"><?php echo _("Smart Blocks") ?></a></div>
|
<a href="/showbuilder#smart-blocks"><?php echo _("Smart Blocks") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="4">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="4">
|
||||||
<a href="/show-builder#webstreams"><?php echo _("Webstreams") ?></a></div>
|
<a href="/showbuilder#webstreams"><?php echo _("Webstreams") ?></a></div>
|
||||||
<hr style="margin-left: 5px; margin-right: 5px">
|
<hr style="margin-left: 5px; margin-right: 5px">
|
||||||
<div id="nav">
|
<div id="nav">
|
||||||
<?php echo $this->navigation()->menu(); ?>
|
<?php echo $this->navigation()->menu(); ?>
|
||||||
|
|
|
@ -104,15 +104,15 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="media_type_selector" selection_id="1">
|
<div class="media_type_selector" selection_id="1">
|
||||||
<a href="/show-builder"><?php echo _("Dashboard") ?></a></div>
|
<a href="/showbuilder"><?php echo _("Dashboard") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="1">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="1">
|
||||||
<a href="/show-builder#files"><?php echo _("Files") ?></a></div>
|
<a href="/showbuilder#files"><?php echo _("Files") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="2">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="2">
|
||||||
<a href="/show-builder#playlists"><?php echo _("Playlists") ?></a></div>
|
<a href="/showbuilder#playlists"><?php echo _("Playlists") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="3">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="3">
|
||||||
<a href="/show-builder#smart-blocks"><?php echo _("Smart Blocks") ?></a></div>
|
<a href="/showbuilder#smart-blocks"><?php echo _("Smart Blocks") ?></a></div>
|
||||||
<div class="media_type_selector dashboard_sub_nav" selection_id="4">
|
<div class="media_type_selector dashboard_sub_nav" selection_id="4">
|
||||||
<a href="/show-builder#webstreams"><?php echo _("Webstreams") ?></a></div>
|
<a href="/showbuilder#webstreams"><?php echo _("Webstreams") ?></a></div>
|
||||||
<div id="nav">
|
<div id="nav">
|
||||||
<?php echo $this->navigation()->menu() ?>
|
<?php echo $this->navigation()->menu() ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,148 +0,0 @@
|
||||||
<form class="smart-block-form" method="post" action="">
|
|
||||||
<dl class='zend_form search-criteria'>
|
|
||||||
<div id='sp-success' class='success' style='display:none'></div>
|
|
||||||
<dd id='sp_type-element'>
|
|
||||||
<label class='sp-label'>
|
|
||||||
<?php echo $this->element->getElement('sp_type')->getLabel() ?>
|
|
||||||
</label>
|
|
||||||
<?php $i=0;
|
|
||||||
$value = $this->element->getElement('sp_type')->getValue();
|
|
||||||
foreach ($this->element->getElement('sp_type')->getMultiOptions() as $radio) : ?>
|
|
||||||
|
|
||||||
<label class='sp-label' for='sp_type-<?php echo $i?>'>
|
|
||||||
<input type="radio" value="<?php echo $i ?>" id="sp_type-<?php echo $i ?>" name="sp_type" <?php if($i == $value){echo 'checked="checked"';}?> ><?php echo $radio ?>
|
|
||||||
</label>
|
|
||||||
<?php $i = $i + 1; ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<span class='playlist_type_help_icon'></span>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dd id='sp_criteria-element' class='criteria-element'>
|
|
||||||
<?php for ($i = 0; $i < $this->criteriasLength; $i++) {
|
|
||||||
// modRowMap holds the number of modifier rows for each criteria element
|
|
||||||
// i.e. if we have 'Album contains 1' and 'Album contains 2' the modRowMap
|
|
||||||
// for Album is 2
|
|
||||||
?>
|
|
||||||
<?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {
|
|
||||||
// determine if logic label should be 'and' or 'or'
|
|
||||||
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) ?>
|
|
||||||
<a class='btn btn-small' id='modifier_add_<?php echo $i ?>'>
|
|
||||||
<i class='icon-white icon-plus'></i>
|
|
||||||
</a>
|
|
||||||
<?php echo $this->element->getElement("sp_criteria_modifier_".$i."_".$j) ?>
|
|
||||||
<?php echo $this->element->getElement("sp_criteria_value_".$i."_".$j) ?>
|
|
||||||
<span class='sp_text_font' id="extra_criteria" <?php echo $this->element->getElement("sp_criteria_extra_".$i."_".$j)->getAttrib("disabled") == "disabled"?'style="display:none;"':""?>><?php echo _(" to "); ?><?php echo $this->element->getElement('sp_criteria_extra_'.$i."_".$j) ?></span>
|
|
||||||
|
|
||||||
<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'>
|
|
||||||
<?php echo $error; ?>
|
|
||||||
</span>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<dd id='sp_repeat_tracks-element'>
|
|
||||||
<span class='sp_text_font'><?php echo $this->element->getElement('sp_repeat_tracks')->getLabel() ?></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; ?>
|
|
||||||
<span class='repeat_tracks_help_icon'></span>
|
|
||||||
</dd>
|
|
||||||
<dd id='sp_sort-element'>
|
|
||||||
<span class='sp_text_font'>Sort tracks by</span>
|
|
||||||
<?php echo $this->element->getElement('sp_sort_options') ?>
|
|
||||||
<?php if($this->element->getElement("sp_sort_options")->hasErrors()) : ?>
|
|
||||||
<?php foreach($this->element->getElement("sp_sort_options")->getMessages() as $error): ?>
|
|
||||||
<span class='errors sp-errors'>
|
|
||||||
<?php echo $error; ?>
|
|
||||||
</span>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</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')?>
|
|
||||||
<?php echo $this->element->getElement('sp_limit_options') ?>
|
|
||||||
<?php if($this->element->getElement("sp_limit_value")->hasErrors()) : ?>
|
|
||||||
<?php foreach($this->element->getElement("sp_limit_value")->getMessages() as $error): ?>
|
|
||||||
<span class='errors sp-errors'>
|
|
||||||
<?php echo $error; ?>
|
|
||||||
</span>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
<?php endif; ?>
|
|
||||||
</dd>
|
|
||||||
|
|
||||||
<?php if ($this->showPoolCount) { ?>
|
|
||||||
<div class='sp_text_font sp_text_font_bold'>
|
|
||||||
<span id='sp_pool_count' class='sp_text_font sp_text_font_bold'>
|
|
||||||
<?php
|
|
||||||
if ($this->poolCount > 1) {
|
|
||||||
echo $this->poolCount;
|
|
||||||
?>
|
|
||||||
<?php echo _("files meet the criteria")?>
|
|
||||||
</span>
|
|
||||||
<span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
|
|
||||||
<?php
|
|
||||||
} else if ($this->poolCount == 1) {
|
|
||||||
echo $this->poolCount;
|
|
||||||
?>
|
|
||||||
<?php echo _("file meets the criteria")?>
|
|
||||||
</span>
|
|
||||||
<span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
|
|
||||||
<?php
|
|
||||||
} else {
|
|
||||||
?>
|
|
||||||
0 <?php echo " "._("files meet the criteria")?>
|
|
||||||
</span>
|
|
||||||
<span class='sp-warning-icon' id='sp_pool_count_icon'></span>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
<?php } ?>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class='btn-toolbar left-floated'>
|
|
||||||
<div class='btn-group sp-button'>
|
|
||||||
<?php echo $this->element->getElement('generate_button');?>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group sp-button'>
|
|
||||||
<?php echo $this->element->getElement('shuffle_button');?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,16 +0,0 @@
|
||||||
<div class="sb-options-form">
|
|
||||||
<?php echo $this->element->getElement('sb_date_start'); ?>
|
|
||||||
<?php echo $this->element->getElement('sb_time_start'); ?>
|
|
||||||
<?php echo $this->element->getElement('sb_date_end'); ?>
|
|
||||||
<?php echo $this->element->getElement('sb_time_end'); ?>
|
|
||||||
<a id="sb_submit" class="btn btn-small" href="#" title="Display shows in the specified date and time range">
|
|
||||||
<i class="icon-white icon-search"></i><?php echo " "._("Find Shows") ?>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<?php echo $this->element->getElement('sb_show_filter') ?>
|
|
||||||
|
|
||||||
<?php if ($this->element->getElement('sb_my_shows')):?>
|
|
||||||
<label><?php echo $this->element->getElement('sb_my_shows')->getLabel(); ?></label>
|
|
||||||
<?php echo $this->element->getElement('sb_my_shows'); ?>
|
|
||||||
<?php endif;?>
|
|
||||||
</div>
|
|
|
@ -1,19 +1,12 @@
|
||||||
|
<div class="sb-options-form">
|
||||||
<?php echo $this->element->getElement('sb_date_start'); ?>
|
<?php echo $this->element->getElement('sb_date_start'); ?>
|
||||||
<?php echo $this->element->getElement('sb_time_start'); ?>
|
<?php echo $this->element->getElement('sb_time_start'); ?>
|
||||||
<?php echo $this->element->getElement('sb_date_end'); ?>
|
<?php echo $this->element->getElement('sb_date_end'); ?>
|
||||||
<?php echo $this->element->getElement('sb_time_end'); ?>
|
<?php echo $this->element->getElement('sb_time_end'); ?>
|
||||||
|
|
||||||
<a id="sb_submit" class="btn btn-small" href="#" title="Display shows in the specified date and time range">
|
<a id="sb_submit" class="btn btn-small" href="#" title="Display shows in the specified date and time range">
|
||||||
<i class="icon-white icon-search"></i><?php echo " "._("Find Shows") ?></a>
|
<i class="icon-white icon-search"></i><?php echo " "._("Find Shows") ?>
|
||||||
<div class="sb-advanced-options">
|
</a>
|
||||||
<fieldset class="padded display_field push-down-8 closed">
|
|
||||||
<legend style="cursor: pointer;">
|
|
||||||
<span class="ui-icon ui-icon-triangle-2-n-s"></span>
|
|
||||||
<?php echo _("Filter By Show:")?>
|
|
||||||
</legend>
|
|
||||||
|
|
||||||
<div class="sb-options-form">
|
|
||||||
<label><?php echo $this->element->getElement('sb_show_filter')->getLabel() ?></label>
|
|
||||||
<?php echo $this->element->getElement('sb_show_filter') ?>
|
<?php echo $this->element->getElement('sb_show_filter') ?>
|
||||||
|
|
||||||
<?php if ($this->element->getElement('sb_my_shows')):?>
|
<?php if ($this->element->getElement('sb_my_shows')):?>
|
||||||
|
@ -21,5 +14,3 @@
|
||||||
<?php echo $this->element->getElement('sb_my_shows'); ?>
|
<?php echo $this->element->getElement('sb_my_shows'); ?>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,21 +1,9 @@
|
||||||
<form id="smart-block-form" method="post" action="">
|
<form class="smart-block-form" method="post" action="">
|
||||||
<fieldset class='toggle <?php echo $this->openOption ? "" : "closed"?> sb-criteria-fieldset' id='smart_block_options'>
|
|
||||||
<legend style='cursor: pointer;'><span class='ui-icon ui-icon-triangle-2-n-s'></span><?php echo _("Smart Block Options") ?></legend>
|
|
||||||
|
|
||||||
<dl class='zend_form search-criteria'>
|
<dl class='zend_form search-criteria'>
|
||||||
<div class='btn-toolbar clearfix'>
|
|
||||||
<div class='btn-group sp-button'>
|
|
||||||
<?php echo $this->element->getElement('generate_button') ?>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group sp-button'>
|
|
||||||
<?php echo $this->element->getElement('shuffle_button') ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id='sp-success' class='success' style='display:none'></div>
|
<div id='sp-success' class='success' style='display:none'></div>
|
||||||
<dd id='sp_type-element'>
|
<dd id='sp_type-element'>
|
||||||
<label class='sp-label'>
|
<label class='sp-label'>
|
||||||
<?php echo $this->element->getElement('sp_type')->getLabel() ?>
|
<?php echo $this->element->getElement('sp_type')->getLabel() ?>
|
||||||
<span class='playlist_type_help_icon'></span>
|
|
||||||
</label>
|
</label>
|
||||||
<?php $i=0;
|
<?php $i=0;
|
||||||
$value = $this->element->getElement('sp_type')->getValue();
|
$value = $this->element->getElement('sp_type')->getValue();
|
||||||
|
@ -26,6 +14,7 @@
|
||||||
</label>
|
</label>
|
||||||
<?php $i = $i + 1; ?>
|
<?php $i = $i + 1; ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
<span class='playlist_type_help_icon'></span>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dd id='sp_criteria-element' class='criteria-element'>
|
<dd id='sp_criteria-element' class='criteria-element'>
|
||||||
|
@ -79,12 +68,10 @@
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<br />
|
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<dd id='sp_repeate_tracks-element'>
|
<dd id='sp_repeat_tracks-element'>
|
||||||
<span class='sp_text_font'><?php echo $this->element->getElement('sp_repeat_tracks')->getLabel() ?></span>
|
<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 echo $this->element->getElement('sp_repeat_tracks')?>
|
||||||
<?php if($this->element->getElement("sp_repeat_tracks")->hasErrors()) : ?>
|
<?php if($this->element->getElement("sp_repeat_tracks")->hasErrors()) : ?>
|
||||||
<?php foreach($this->element->getElement("sp_repeat_tracks")->getMessages() as $error): ?>
|
<?php foreach($this->element->getElement("sp_repeat_tracks")->getMessages() as $error): ?>
|
||||||
|
@ -93,7 +80,7 @@
|
||||||
</span>
|
</span>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<br />
|
<span class='repeat_tracks_help_icon'></span>
|
||||||
</dd>
|
</dd>
|
||||||
<dd id='sp_sort-element'>
|
<dd id='sp_sort-element'>
|
||||||
<span class='sp_text_font'>Sort tracks by</span>
|
<span class='sp_text_font'>Sort tracks by</span>
|
||||||
|
@ -105,7 +92,6 @@
|
||||||
</span>
|
</span>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<br />
|
|
||||||
</dd>
|
</dd>
|
||||||
<dd id='sp_limit-element'>
|
<dd id='sp_limit-element'>
|
||||||
<span class='sp_text_font'><?php echo $this->element->getElement('sp_limit_value')->getLabel() ?></span>
|
<span class='sp_text_font'><?php echo $this->element->getElement('sp_limit_value')->getLabel() ?></span>
|
||||||
|
@ -118,7 +104,6 @@
|
||||||
</span>
|
</span>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<br />
|
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
<?php if ($this->showPoolCount) { ?>
|
<?php if ($this->showPoolCount) { ?>
|
||||||
|
@ -135,7 +120,7 @@
|
||||||
} else if ($this->poolCount == 1) {
|
} else if ($this->poolCount == 1) {
|
||||||
echo $this->poolCount;
|
echo $this->poolCount;
|
||||||
?>
|
?>
|
||||||
<?php echo _("file meet the criteria")?>
|
<?php echo _("file meets the criteria")?>
|
||||||
</span>
|
</span>
|
||||||
<span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
|
<span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
|
||||||
<?php
|
<?php
|
||||||
|
@ -149,8 +134,15 @@
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<div class='btn-toolbar left-floated'>
|
||||||
|
<div class='btn-group sp-button'>
|
||||||
|
<?php echo $this->element->getElement('generate_button');?>
|
||||||
|
</div>
|
||||||
|
<div class='btn-group sp-button'>
|
||||||
|
<?php echo $this->element->getElement('shuffle_button');?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
<?php
|
|
||||||
if (isset($this->obj)) {
|
|
||||||
$contents = $this->obj->getContents();
|
|
||||||
$count = count($contents);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php if (isset($this->obj)) : ?>
|
|
||||||
<div class="inner_editor_wrapper">
|
|
||||||
<input class="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"/>
|
|
||||||
<input class="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"/>
|
|
||||||
<input class='obj_type' type='hidden' value='playlist'/>
|
|
||||||
<div class="playlist_title">
|
|
||||||
<h3 class="obj_name">
|
|
||||||
<a class="playlist_name_display" contenteditable="true"><?php echo $this->escape($this->obj->getName()); ?></a>
|
|
||||||
</h3>
|
|
||||||
<h4 class="obj_length"><?php echo $this->length; ?></h4>
|
|
||||||
</div>
|
|
||||||
<div id='sp-success' class='success' style='display:none'></div>
|
|
||||||
|
|
||||||
<dl class="zend_form">
|
|
||||||
<dt id="description-label"><label for="description"><?php echo _("Description") ?></label></dt>
|
|
||||||
<dd id="description-element">
|
|
||||||
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->escape($this->obj->getDescription()); ?></textarea>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<div class="btn-toolbar spl-no-margin clearfix left-floated">
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button class="btn btn-danger" title='<?php echo _("Empty playlist content") ?>' type="button" id="pl-bl-clear-content"><?php echo _("Clear") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button class="btn" title='<?php echo _("Shuffle playlist") ?>' type="button" id="playlist_shuffle_button"><?php echo _("Shuffle") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<a href="#" id="spl_crossfade" class="btn crossfade-main-button" style="display:<?php echo $count > 0 ?"block;":"none;"?>">
|
|
||||||
<i class='crossfade-main-icon'></i><span class="ui-button-text"><?php echo _("Playlist crossfade") ?></span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php //echo $this->form; ?>
|
|
||||||
|
|
||||||
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
|
|
||||||
<span class="ui-icon ui-icon-closethick sp-closethick-center"></span>
|
|
||||||
<dl id="spl_editor-main" class="inline-list">
|
|
||||||
<dt><?php echo _("Fade in: "); ?><span class='spl_cue_hint'>(ss.t)</span></dt>
|
|
||||||
<dd><span contenteditable="true" class="spl_text_input spl_main_fade_in">00</span></dd>
|
|
||||||
<dd class="edit-error"></dd>
|
|
||||||
<dt><?php echo _("Fade out: "); ?><span class='spl_cue_hint'>(ss.t)</span></dt>
|
|
||||||
<dd><span contenteditable="true" class="spl_text_input spl_main_fade_out">00</span></dd>
|
|
||||||
<dd class="edit-error"></dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<ul class="spl_sortable">
|
|
||||||
<?php $this->contents = $contents;
|
|
||||||
echo $this->render('playlist/update.phtml') ?>
|
|
||||||
</ul>
|
|
||||||
<div class="btn-toolbar spl-no-margin clearfix">
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button class="btn" type="button" id="cancel_button" name="submit"><?php echo _("Cancel") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button class="btn" title='<?php echo _("Save playlist") ?>' type="button" id="save_button"><?php echo _("Save") ?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php else : ?>
|
|
||||||
<div><?php echo _("No open playlist") ?></div>
|
|
||||||
<?php endif; ?>
|
|
|
@ -1,72 +0,0 @@
|
||||||
<?php
|
|
||||||
if (isset($this->obj)) {
|
|
||||||
$contents = $this->obj->getContents();
|
|
||||||
$count = count($contents);
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php if (isset($this->obj)) : ?>
|
|
||||||
<div class="inner_editor_wrapper">
|
|
||||||
<input class="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"/>
|
|
||||||
<input class="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"/>
|
|
||||||
<input class='obj_type' type='hidden' value='block'/>
|
|
||||||
<div class="playlist_title">
|
|
||||||
<h3 class="obj_name">
|
|
||||||
<a class="playlist_name_display" contenteditable="true">
|
|
||||||
<?php
|
|
||||||
if (isset($this->unsavedName)) echo $this->unsavedName;
|
|
||||||
else echo $this->escape($this->obj->getName());
|
|
||||||
?>
|
|
||||||
</a>
|
|
||||||
</h3>
|
|
||||||
<h4 class="obj_length"><?php echo $this->length; ?></h4>
|
|
||||||
</div>
|
|
||||||
<div id='sp-success-saved' class='success' style='display:none'></div>
|
|
||||||
|
|
||||||
<dl class="zend_form">
|
|
||||||
<dt id="description-label"><label for="description"><?php echo _("Description") ?></label></dt>
|
|
||||||
<dd id="description-element">
|
|
||||||
<textarea cols="80" rows="24" id="description" name="description"><?php if (isset($this->unsavedDesc)) echo $this->unsavedDesc; else echo $this->obj->getDescription();?></textarea>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<?php echo $this->form; ?>
|
|
||||||
<div class="btn-toolbar spl-no-margin clearfix left-floated">
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button class="btn btn-danger" title='<?php echo _("Empty smart block content") ?>' type="button" id="pl-bl-clear-content"><?php echo _("Clear") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<a href="#" id="spl_crossfade" class="btn crossfade-main-button" style="display:<?php echo ($this->obj->isStatic() && $count > 0) ?"block;":"none;"?>">
|
|
||||||
<i class='crossfade-main-icon'></i><span class="ui-button-text"><?php echo _("Playlist crossfade") ?></span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
|
|
||||||
<span class="ui-icon ui-icon-closethick"></span>
|
|
||||||
<dl id="spl_editor-main" class="inline-list">
|
|
||||||
<dt><?php echo _("Fade in: "); ?><span class='spl_cue_hint'><?php echo _("(ss.t)")?></span></dt>
|
|
||||||
<dd><span contenteditable="true" class="spl_text_input spl_main_fade_in">00</span></dd>
|
|
||||||
<dd class="edit-error"></dd>
|
|
||||||
<dt><?php echo _("Fade out: "); ?><span class='spl_cue_hint'><?php echo _("(ss.t)")?></span></dt>
|
|
||||||
<dd><span contenteditable="true" class="spl_text_input spl_main_fade_out">00</span></dd>
|
|
||||||
<dd class="edit-error"></dd>
|
|
||||||
</dl>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<ul class="spl_sortable">
|
|
||||||
<?php $this->contents = $contents;
|
|
||||||
echo $this->render('playlist/update.phtml') ?>
|
|
||||||
</ul>
|
|
||||||
<div class="btn-toolbar spl-no-margin clearfix">
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button class="btn" type="button" id="cancel_button" name="submit"><?php echo _("Cancel") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button class="btn" title='Save smart block's title, description, and criteria' type="button" id="save_button"><?php echo _("Save") ?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php else : ?>
|
|
||||||
<div><?php echo _("No open smart block") ?></div>
|
|
||||||
<?php endif; ?>
|
|
|
@ -4,43 +4,12 @@ if (isset($this->obj)) {
|
||||||
$count = count($contents);
|
$count = count($contents);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<a href="#" class="close-round" id="lib_pl_close"></a>
|
|
||||||
<div class="btn-toolbar spl-no-top-margin clearfix">
|
|
||||||
<div class="btn-group pull-left">
|
|
||||||
<button id="spl_new" class="btn dropdown-toggle" data-toggle="dropdown" aria-disabled="false">
|
|
||||||
<?php echo _("New")?> <span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<li id='lib-new-pl'><a href="#"><?php echo _("New Playlist") ?></a></li>
|
|
||||||
<li id='lib-new-bl'><a href="#"><?php echo _("New Smart Block") ?></a></li>
|
|
||||||
<li id='lib-new-ws'><a href="#"><?php echo _("New Webstream") ?></a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<?php if (isset($this->obj)) : ?>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button class="btn btn-inverse" title='<?php echo _("Empty playlist content") ?>' type="button" id="pl-bl-clear-content"><?php echo _("Clear") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button class="btn btn-inverse" title='<?php echo _("Shuffle playlist") ?>' type="button" id="playlist_shuffle_button"><?php echo _("Shuffle") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button class="btn btn-inverse" title='<?php echo _("Save playlist") ?>' type="button" id="save_button"><?php echo _("Save") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button id="spl_delete" class="btn" role="button" aria-disabled="false"><?php echo _("Delete") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<a href="#" id="spl_crossfade" class="btn crossfade-main-button" style="display:<?php echo $count > 0 ?"block;":"none;"?>">
|
|
||||||
<i class='crossfade-main-icon'></i><span class="ui-button-text"><?php echo _("Playlist crossfade") ?></span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if (isset($this->obj)) : ?>
|
<?php if (isset($this->obj)) : ?>
|
||||||
<input class="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"></input>
|
<div class="inner_editor_wrapper">
|
||||||
<input class="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"></input>
|
<input class="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"/>
|
||||||
<input class='obj_type' type='hidden' value='playlist'></input>
|
<input class="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"/>
|
||||||
|
<input class='obj_type' type='hidden' value='playlist'/>
|
||||||
<div class="playlist_title">
|
<div class="playlist_title">
|
||||||
<h3 class="obj_name">
|
<h3 class="obj_name">
|
||||||
<a class="playlist_name_display" contenteditable="true"><?php echo $this->escape($this->obj->getName()); ?></a>
|
<a class="playlist_name_display" contenteditable="true"><?php echo $this->escape($this->obj->getName()); ?></a>
|
||||||
|
@ -49,15 +18,26 @@ if (isset($this->obj)) {
|
||||||
</div>
|
</div>
|
||||||
<div id='sp-success' class='success' style='display:none'></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><?php echo _("View / edit description"); ?></legend>
|
|
||||||
<dl class="zend_form">
|
<dl class="zend_form">
|
||||||
<dt id="description-label"><label for="description"><?php echo _("Description") ?></label></dt>
|
<dt id="description-label"><label for="description"><?php echo _("Description") ?></label></dt>
|
||||||
<dd id="description-element">
|
<dd id="description-element">
|
||||||
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->escape($this->obj->getDescription()); ?></textarea>
|
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->escape($this->obj->getDescription()); ?></textarea>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
|
||||||
|
<div class="btn-toolbar spl-no-margin clearfix left-floated">
|
||||||
|
<div class='btn-group pull-right'>
|
||||||
|
<button class="btn btn-danger" title='<?php echo _("Empty playlist content") ?>' type="button" id="pl-bl-clear-content"><?php echo _("Clear") ?></button>
|
||||||
|
</div>
|
||||||
|
<div class='btn-group pull-right'>
|
||||||
|
<button class="btn" title='<?php echo _("Shuffle playlist") ?>' type="button" id="playlist_shuffle_button"><?php echo _("Shuffle") ?></button>
|
||||||
|
</div>
|
||||||
|
<div class='btn-group pull-right'>
|
||||||
|
<a href="#" id="spl_crossfade" class="btn crossfade-main-button" style="display:<?php echo $count > 0 ?"block;":"none;"?>">
|
||||||
|
<i class='crossfade-main-icon'></i><span class="ui-button-text"><?php echo _("Playlist crossfade") ?></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php //echo $this->form; ?>
|
<?php //echo $this->form; ?>
|
||||||
|
|
||||||
|
@ -72,13 +52,18 @@ if (isset($this->obj)) {
|
||||||
<dd class="edit-error"></dd>
|
<dd class="edit-error"></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="clear"></div>
|
|
||||||
<div class="" style="clear:both; float:none; width:100%;">
|
|
||||||
<ul class="spl_sortable">
|
<ul class="spl_sortable">
|
||||||
<?php $this->contents = $contents;
|
<?php $this->contents = $contents;
|
||||||
echo $this->render('playlist/update.phtml') ?>
|
echo $this->render('playlist/update.phtml') ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div class="btn-toolbar spl-no-margin clearfix">
|
||||||
|
<div class="btn-group pull-right">
|
||||||
|
<button class="btn" type="button" id="cancel_button" name="submit"><?php echo _("Cancel") ?></button>
|
||||||
|
</div>
|
||||||
|
<div class='btn-group pull-right'>
|
||||||
|
<button class="btn" title='<?php echo _("Save playlist") ?>' type="button" id="save_button"><?php echo _("Save") ?></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
|
|
|
@ -4,43 +4,15 @@ if (isset($this->obj)) {
|
||||||
$count = count($contents);
|
$count = count($contents);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<a href="#" class="close-round" id="lib_pl_close"></a>
|
|
||||||
<div class="btn-toolbar spl-no-top-margin clearfix">
|
|
||||||
<div class="btn-group pull-left">
|
|
||||||
<button id="spl_new" class="btn dropdown-toggle" data-toggle='dropdown' aria-disabled="false">
|
|
||||||
<?php echo _("New")?> <span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<li id='lib-new-pl'><a href="#"><?php echo _("New Playlist") ?></a></li>
|
|
||||||
<li id='lib-new-bl'><a href="#"><?php echo _("New Smart Block") ?></a></li>
|
|
||||||
<li id='lib-new-ws'><a href="#"><?php echo _("New Webstream") ?></a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<?php if (isset($this->obj)) : ?>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button class="btn btn-inverse" title='<?php echo _("Empty smart block content") ?>' type="button" id="pl-bl-clear-content"><?php echo _("Clear") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button class="btn btn-inverse" title='Save smart block's title, description, and criteria' type="button" id="save_button"><?php echo _("Save") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<button id="spl_delete" class="btn" role="button" aria-disabled="false"><?php echo _("Delete") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class='btn-group pull-right'>
|
|
||||||
<a href="#" id="spl_crossfade" class="btn crossfade-main-button" style="display:<?php echo ($this->obj->isStatic() && $count > 0) ?"block;":"none;"?>">
|
|
||||||
<i class='crossfade-main-icon'></i><span class="ui-button-text"><?php echo _("Playlist crossfade") ?></span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if (isset($this->obj)) : ?>
|
<?php if (isset($this->obj)) : ?>
|
||||||
<input class="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"></input>
|
<div class="inner_editor_wrapper">
|
||||||
<input class="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"></input>
|
<input class="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"/>
|
||||||
<input class='obj_type' type='hidden' value='block'></input>
|
<input class="obj_lastMod" type="hidden" value="<?php echo $this->obj->getLastModified('U'); ?>"/>
|
||||||
|
<input class='obj_type' type='hidden' value='block'/>
|
||||||
<div class="playlist_title">
|
<div class="playlist_title">
|
||||||
<h3 class="obj_name">
|
<h3 class="obj_name">
|
||||||
<a id="playlist_name_display" contenteditable="true">
|
<a class="playlist_name_display" contenteditable="true">
|
||||||
<?php
|
<?php
|
||||||
if (isset($this->unsavedName)) echo $this->unsavedName;
|
if (isset($this->unsavedName)) echo $this->unsavedName;
|
||||||
else echo $this->escape($this->obj->getName());
|
else echo $this->escape($this->obj->getName());
|
||||||
|
@ -51,20 +23,24 @@ if (isset($this->obj)) {
|
||||||
</div>
|
</div>
|
||||||
<div id='sp-success-saved' class='success' style='display:none'></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><?php echo _("View / edit description"); ?></legend>
|
|
||||||
<dl class="zend_form">
|
<dl class="zend_form">
|
||||||
<dt id="description-label"><label for="description"><?php echo _("Description") ?></label></dt>
|
<dt id="description-label"><label for="description"><?php echo _("Description") ?></label></dt>
|
||||||
<dd id="description-element">
|
<dd id="description-element">
|
||||||
<textarea cols="80" rows="24" id="description" name="description"><?php
|
<textarea cols="80" rows="24" id="description" name="description"><?php if (isset($this->unsavedDesc)) echo $this->unsavedDesc; else echo $this->obj->getDescription();?></textarea>
|
||||||
if (isset($this->unsavedDesc)) echo $this->unsavedDesc;
|
|
||||||
else echo $this->obj->getDescription();?>
|
|
||||||
</textarea>
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<?php echo $this->form; ?>
|
<?php echo $this->form; ?>
|
||||||
|
<div class="btn-toolbar spl-no-margin clearfix left-floated">
|
||||||
|
<div class='btn-group pull-right'>
|
||||||
|
<button class="btn btn-danger" title='<?php echo _("Empty smart block content") ?>' type="button" id="pl-bl-clear-content"><?php echo _("Clear") ?></button>
|
||||||
|
</div>
|
||||||
|
<div class='btn-group pull-right'>
|
||||||
|
<a href="#" id="spl_crossfade" class="btn crossfade-main-button" style="display:<?php echo ($this->obj->isStatic() && $count > 0) ?"block;":"none;"?>">
|
||||||
|
<i class='crossfade-main-icon'></i><span class="ui-button-text"><?php echo _("Playlist crossfade") ?></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
|
<div id="crossfade_main" class="crossfade-main clearfix" style="display:none;">
|
||||||
<span class="ui-icon ui-icon-closethick"></span>
|
<span class="ui-icon ui-icon-closethick"></span>
|
||||||
|
@ -77,13 +53,18 @@ if (isset($this->obj)) {
|
||||||
<dd class="edit-error"></dd>
|
<dd class="edit-error"></dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="clear"></div>
|
|
||||||
<div class="" style="clear:both; float:none; width:100%;">
|
|
||||||
<ul class="spl_sortable">
|
<ul class="spl_sortable">
|
||||||
<?php $this->contents = $contents;
|
<?php $this->contents = $contents;
|
||||||
echo $this->render('playlist/update.phtml') ?>
|
echo $this->render('playlist/update.phtml') ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div class="btn-toolbar spl-no-margin clearfix">
|
||||||
|
<div class="btn-group pull-right">
|
||||||
|
<button class="btn" type="button" id="cancel_button" name="submit"><?php echo _("Cancel") ?></button>
|
||||||
|
</div>
|
||||||
|
<div class='btn-group pull-right'>
|
||||||
|
<button class="btn" title='Save smart block's title, description, and criteria' type="button" id="save_button"><?php echo _("Save") ?></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
<!--<form action="/rest/media" method="post" id="upload_form" class="dropzone dz-clickable" --><?php //if ($this->quotaLimitReached) { ?><!-- class="hidden" --><?php //} ?>
|
|
||||||
<!-- --><?php //echo $this->csrf ?>
|
|
||||||
<!-- <div class="dz-message">-->
|
|
||||||
<!-- --><?php //echo _("Drop files here or click to upload") ?>
|
|
||||||
<!-- </div>-->
|
|
||||||
<!--</form>-->
|
|
||||||
|
|
||||||
<?php echo $this->csrf ?>
|
|
||||||
|
|
||||||
<div id="library_content" class="lib-content tabs content-pane wide-panel">
|
|
||||||
<div>
|
|
||||||
<h2 id="library_title">Library</h2>
|
|
||||||
</div>
|
|
||||||
<div class="panel-header">
|
|
||||||
<div id="advanced-options" class="btn-group">
|
|
||||||
<button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
|
|
||||||
<span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<div id="advanced_search" class="advanced_search form-horizontal dropdown-menu"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="outer-datatable-wrapper">
|
|
||||||
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable"></table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="show_builder" class="sb-content content-pane wide-panel">
|
|
||||||
<div class="panel-header">
|
|
||||||
<ul class="nav nav-tabs">
|
|
||||||
<li id="schedule-tab" role="presentation" class="active"><a href="#">Scheduled Shows</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="outer-datatable-wrapper active-tab">
|
|
||||||
<table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
|
|
||||||
<div class="sb-timerange">
|
|
||||||
<?php echo $this->sb_form; ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php echo $this->dialog ?>
|
|
|
@ -1,23 +1,41 @@
|
||||||
<?php if (!$this->disableLib): ?>
|
<!--<form action="/rest/media" method="post" id="upload_form" class="dropzone dz-clickable" --><?php //if ($this->quotaLimitReached) { ?><!-- class="hidden" --><?php //} ?>
|
||||||
<div id="library_content" class="lib-content tabs ui-widget ui-widget-content block-shadow alpha-block padded"
|
<!-- --><?php //echo $this->csrf ?>
|
||||||
<?php if (!$this->showLib): ?>
|
<!-- <div class="dz-message">-->
|
||||||
style="display:none"
|
<!-- --><?php //echo _("Drop files here or click to upload") ?>
|
||||||
<?php endif; ?>
|
<!-- </div>-->
|
||||||
>
|
<!--</form>-->
|
||||||
<?php echo $this->render('library/library.phtml') ?>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<div id="show_builder" class="sb-content ui-widget ui-widget-content block-shadow omega-block padded">
|
<?php echo $this->csrf ?>
|
||||||
|
|
||||||
|
<div id="library_content" class="lib-content tabs content-pane wide-panel">
|
||||||
|
<div>
|
||||||
|
<h2 id="library_title">Library</h2>
|
||||||
|
</div>
|
||||||
|
<div class="panel-header">
|
||||||
|
<div id="advanced-options" class="btn-group">
|
||||||
|
<button class="btn btn-small dropdown-toggle" data-toggle="dropdown">
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<div id="advanced_search" class="advanced_search form-horizontal dropdown-menu"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="outer-datatable-wrapper">
|
||||||
|
<table id="library_display" cellpadding="0" cellspacing="0" class="datatable"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="show_builder" class="sb-content content-pane wide-panel">
|
||||||
|
<div class="panel-header">
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li id="schedule-tab" role="presentation" class="active"><a href="#">Scheduled Shows</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="outer-datatable-wrapper active-tab">
|
||||||
|
<table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
|
||||||
<div class="sb-timerange">
|
<div class="sb-timerange">
|
||||||
<?php if(!$this->disableLib && !$this->showLib):?>
|
|
||||||
<a id="sb_edit" class="btn btn-small" href="#" title="Open library to add or remove content">
|
|
||||||
<?php echo _("Add / Remove Content")?>
|
|
||||||
</a>
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php echo $this->sb_form; ?>
|
<?php echo $this->sb_form; ?>
|
||||||
</div>
|
</div>
|
||||||
<table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php echo $this->lang_tz_popup_form; ?>
|
<?php echo $this->dialog ?>
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
<?php if (isset($this->obj)) : ?>
|
|
||||||
<input class="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"/>
|
|
||||||
<input class="obj_lastMod" type="hidden" value="<?php echo "1";//$this->obj->getLastModified('U'); ?>"/>
|
|
||||||
<input class="obj_type" type="hidden" value="webstream"/>
|
|
||||||
<div class="status" style="display:none;"></div>
|
|
||||||
|
|
||||||
<div class="playlist_title">
|
|
||||||
<div id="name-error" class="errors" style="display:none;"></div>
|
|
||||||
<h3 class="ws_name">
|
|
||||||
<a class="playlist_name_display" contenteditable="true"><?php echo $this->escape($this->obj->getName()); ?></a>
|
|
||||||
</h3>
|
|
||||||
<h4 class="ws_length"><?php echo $this->obj->getDefaultLength(); ?></h4>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<dl class="zend_form">
|
|
||||||
<dt id="description-label"><label for="description"><?php echo _("Description") ?></label></dt>
|
|
||||||
<dd id="description-element">
|
|
||||||
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->obj->getDescription(); ?></textarea>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<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"><?php echo _("Stream URL:"); ?></label></dt>
|
|
||||||
<dd id="streamurl-element">
|
|
||||||
<input type="text" value="<?php echo $this->obj->getUrl(); ?>" size="40"/>
|
|
||||||
</dd>
|
|
||||||
<div id="length-error" class="errors" style="display:none;"></div>
|
|
||||||
<dt id="streamlength-label"><label for="streamlength"><?php echo _("Default Length:"); ?></label></dt>
|
|
||||||
<dd id="streamlength-element">
|
|
||||||
<input type="text" value="<?php echo $this->obj->getDefaultLength() ?>"/>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
|
||||||
|
|
||||||
<div class="btn-toolbar spl-no-margin clearfix">
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button class="btn" type="button" id="webstream_cancel" name="submit"><?php echo _("Cancel") ?></button>
|
|
||||||
</div>
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button class="btn" type="submit" id="webstream_save" name="submit"><?php echo _("Save") ?></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php else : ?>
|
|
||||||
<div><?php echo _("No webstream") ?></div>
|
|
||||||
<?php endif; ?>
|
|
|
@ -1,26 +1,3 @@
|
||||||
<a href="#" class="close-round" id="lib_pl_close"></a>
|
|
||||||
<div class="btn-toolbar spl-no-top-margin clearfix">
|
|
||||||
<div class="btn-group pull-left">
|
|
||||||
<button id="ws_new" class="btn dropdown-toggle" data-toggle="dropdown" aria-disabled="false">
|
|
||||||
<?php echo _("New")?> <span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<li id='lib-new-pl'><a href="#"><?php echo _("New Playlist") ?></a></li>
|
|
||||||
<li id='lib-new-bl'><a href="#"><?php echo _("New Smart Block") ?></a></li>
|
|
||||||
<li id='lib-new-ws'><a href="#"><?php echo _("New Webstream") ?></a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if (isset($this->obj)) : ?>
|
|
||||||
<div class="btn-group pull-right">
|
|
||||||
<button class="btn btn-inverse" type="submit" id="webstream_save" name="submit"><?php echo _("Save") ?></button>
|
|
||||||
</div>
|
|
||||||
<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"><?php echo _("Delete") ?></button>
|
|
||||||
</div>
|
|
||||||
<?php endif; ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if (isset($this->obj)) : ?>
|
<?php if (isset($this->obj)) : ?>
|
||||||
<input class="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"/>
|
<input class="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"/>
|
||||||
<input class="obj_lastMod" type="hidden" value="<?php echo "1";//$this->obj->getLastModified('U'); ?>"/>
|
<input class="obj_lastMod" type="hidden" value="<?php echo "1";//$this->obj->getLastModified('U'); ?>"/>
|
||||||
|
@ -35,16 +12,12 @@
|
||||||
<h4 class="ws_length"><?php echo $this->obj->getDefaultLength(); ?></h4>
|
<h4 class="ws_length"><?php echo $this->obj->getDefaultLength(); ?></h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<fieldset class="toggle" id="fieldset-metadate_change">
|
|
||||||
<legend style="cursor: pointer;"><span class="ui-icon ui-icon-triangle-2-n-s"></span><?php echo _("View / edit description"); ?></legend>
|
|
||||||
<dl class="zend_form">
|
<dl class="zend_form">
|
||||||
<dt id="description-label"><label for="description"><?php echo _("Description") ?></label></dt>
|
<dt id="description-label"><label for="description"><?php echo _("Description") ?></label></dt>
|
||||||
<dd id="description-element">
|
<dd id="description-element">
|
||||||
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->obj->getDescription(); ?></textarea>
|
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->obj->getDescription(); ?></textarea>
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<dl class="zend_form">
|
<dl class="zend_form">
|
||||||
<dt id="submit-label" style="display: none;"> </dt>
|
<dt id="submit-label" style="display: none;"> </dt>
|
||||||
|
@ -60,6 +33,15 @@
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<div class="btn-toolbar spl-no-margin clearfix">
|
||||||
|
<div class="btn-group pull-right">
|
||||||
|
<button class="btn" type="button" id="webstream_cancel" name="submit"><?php echo _("Cancel") ?></button>
|
||||||
|
</div>
|
||||||
|
<div class="btn-group pull-right">
|
||||||
|
<button class="btn" type="submit" id="webstream_save" name="submit"><?php echo _("Save") ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<div><?php echo _("No webstream") ?></div>
|
<div><?php echo _("No webstream") ?></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,350 +0,0 @@
|
||||||
var AIRTIME = (function(AIRTIME) {
|
|
||||||
var mod;
|
|
||||||
|
|
||||||
if (AIRTIME.library === undefined) {
|
|
||||||
AIRTIME.library = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
mod = AIRTIME.library;
|
|
||||||
|
|
||||||
mod.checkAddButton = function() {
|
|
||||||
var selected = mod.getChosenItemsLength(), $cursor = $('tr.sb-selected'), check = false,
|
|
||||||
shows = $('tr.sb-header'), current = $('tr.sb-current-show'),
|
|
||||||
// TODO: this is an ugly way of doing this... we should find a more robust way of checking which view we're in.
|
|
||||||
btnText = (window.location.href.toLowerCase().indexOf("schedule") > -1) ? $.i18n._('Add to show') : $.i18n._('Add to next show');
|
|
||||||
|
|
||||||
// make sure library items are selected and a cursor is selected.
|
|
||||||
if (selected !== 0) {
|
|
||||||
check = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shows.length === 0) {
|
|
||||||
check = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check) {
|
|
||||||
AIRTIME.button.enableButton("btn-group #library-plus", false);
|
|
||||||
} else {
|
|
||||||
AIRTIME.button.disableButton("btn-group #library-plus", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($("#show_builder_table").is(":visible")) {
|
|
||||||
if ($cursor.length !== 0) {
|
|
||||||
btnText = $.i18n._('Add after selected items');
|
|
||||||
} else if (current.length !== 0) {
|
|
||||||
btnText = $.i18n._('Add to current show');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var objType = $('.active-tab .obj_type').val();
|
|
||||||
if (objType === 'block') {
|
|
||||||
btnText = $.i18n._('Add to current smart block');
|
|
||||||
} else {
|
|
||||||
btnText = $.i18n._('Add to current playlist');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), btnText);
|
|
||||||
};
|
|
||||||
|
|
||||||
mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
|
|
||||||
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 {
|
|
||||||
$nRow.addClass("lib-pl");
|
|
||||||
}
|
|
||||||
|
|
||||||
$nRow.attr("id", aData["tr_id"]).data("aData", aData).data("screen",
|
|
||||||
"timeline");
|
|
||||||
};
|
|
||||||
|
|
||||||
mod.fnDrawCallback = function fnLibDrawCallback() {
|
|
||||||
|
|
||||||
mod.redrawChosen();
|
|
||||||
mod.checkToolBarIcons();
|
|
||||||
|
|
||||||
var cb = $('th.library_checkbox');
|
|
||||||
if (cb.find("input").length == 0) {
|
|
||||||
cb.append("<input id='super-checkbox' type='checkbox'>");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($("#show_builder_table").is(":visible")) {
|
|
||||||
$('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream')
|
|
||||||
.draggable(
|
|
||||||
{
|
|
||||||
helper: function () {
|
|
||||||
|
|
||||||
var $el = $(this), selected = mod
|
|
||||||
.getChosenItemsLength(), container, thead = $("#show_builder_table thead"), colspan = thead
|
|
||||||
.find("th").length, width = $el.width(), message;
|
|
||||||
|
|
||||||
// dragging an element that has an unselected
|
|
||||||
// checkbox.
|
|
||||||
if (mod.isChosenItem($el) === false) {
|
|
||||||
selected++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selected === 1) {
|
|
||||||
message = $.i18n._("Adding 1 Item");
|
|
||||||
} else {
|
|
||||||
message = sprintf($.i18n._("Adding %s Items"), selected);
|
|
||||||
}
|
|
||||||
|
|
||||||
container = $('<div/>').attr('id',
|
|
||||||
'draggingContainer').append('<tr/>')
|
|
||||||
.find("tr").append('<td/>').find("td")
|
|
||||||
.attr("colspan", colspan).width(width)
|
|
||||||
.addClass("ui-state-highlight").append(
|
|
||||||
message).end().end();
|
|
||||||
|
|
||||||
return container;
|
|
||||||
},
|
|
||||||
cursor: 'pointer',
|
|
||||||
//cursorAt: {
|
|
||||||
// top: 30,
|
|
||||||
// right: 10
|
|
||||||
//},
|
|
||||||
distance: 25, // min-distance for dragging
|
|
||||||
connectToSortable: '#show_builder_table'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$('#library_display tr.lib-audio, tr.lib-stream, tr.lib-pl, tr.lib-block')
|
|
||||||
.draggable(
|
|
||||||
{
|
|
||||||
helper: function () {
|
|
||||||
|
|
||||||
var $el = $(this), selected = mod
|
|
||||||
.getChosenAudioFilesLength(), container, message,
|
|
||||||
width = $(this).width(), height = 55;
|
|
||||||
|
|
||||||
// dragging an element that has an unselected
|
|
||||||
// checkbox.
|
|
||||||
if (mod.isChosenItem($el) === false) {
|
|
||||||
selected++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selected === 1) {
|
|
||||||
message = $.i18n._("Adding 1 Item");
|
|
||||||
} else {
|
|
||||||
message = sprintf($.i18n._("Adding %s Items"), selected);
|
|
||||||
}
|
|
||||||
|
|
||||||
container = $('<div class="helper"/>').append(
|
|
||||||
"<li/>").find("li").addClass(
|
|
||||||
"ui-state-default").append("<div/>")
|
|
||||||
.find("div").addClass(
|
|
||||||
"list-item-container").append(
|
|
||||||
message).end().width(width)
|
|
||||||
.height(height).end();
|
|
||||||
|
|
||||||
return container;
|
|
||||||
},
|
|
||||||
cursor: 'pointer',
|
|
||||||
//cursorAt: {
|
|
||||||
// top: 30,
|
|
||||||
// right: 10
|
|
||||||
//},
|
|
||||||
distance: 25, // min-distance for dragging
|
|
||||||
connectToSortable: '.active-tab .spl_sortable'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
mod.dblClickAdd = function(data, type) {
|
|
||||||
var i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
|
|
||||||
|
|
||||||
if ($("#show_builder_table").is(":visible")) {
|
|
||||||
// process selected files/playlists.
|
|
||||||
aMediaIds.push({
|
|
||||||
"id": data.id,
|
|
||||||
"type": type
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#show_builder_table tr.sb-selected").each(function (i, el) {
|
|
||||||
aData.push($(el).data("aData"));
|
|
||||||
});
|
|
||||||
|
|
||||||
// process selected schedule rows to add media after.
|
|
||||||
for (i = 0, length = aData.length; i < length; i++) {
|
|
||||||
temp = aData[i];
|
|
||||||
aSchedIds.push({
|
|
||||||
"id": temp.id,
|
|
||||||
"instance": temp.instance,
|
|
||||||
"timestamp": temp.timestamp
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aSchedIds.length == 0) {
|
|
||||||
if (!addToCurrentOrNext(aSchedIds)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
|
||||||
} else {
|
|
||||||
// process selected files/playlists.
|
|
||||||
aMediaIds.push(new Array(data.id, data.ftype));
|
|
||||||
|
|
||||||
// check if a playlist/block is open before adding items
|
|
||||||
if ($('.active-tab .obj_type').val() == 'playlist'
|
|
||||||
|| $('.active-tab .obj_type').val() == 'block') {
|
|
||||||
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function addToCurrentOrNext(arr) {
|
|
||||||
var el;
|
|
||||||
// Add to the end of the current or next show by getting the footer
|
|
||||||
el = $(".sb-footer.sb-future:first");
|
|
||||||
var data = el.prev().data("aData");
|
|
||||||
|
|
||||||
if (data === undefined) {
|
|
||||||
alert($.i18n._("Cannot schedule outside a show.\nTry creating a show first."));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
arr.push({
|
|
||||||
"id" : data.id,
|
|
||||||
"instance" : data.instance,
|
|
||||||
"timestamp" : data.timestamp
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!isInView(el)) {
|
|
||||||
$('.dataTables_scrolling.sb-padded').animate({
|
|
||||||
scrollTop: el.offset().top
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
mod.setupLibraryToolbar = function() {
|
|
||||||
var $toolbar = $(".lib-content .fg-toolbar:first");
|
|
||||||
|
|
||||||
mod.createToolbarButtons();
|
|
||||||
mod.moveSearchBarToHeader();
|
|
||||||
|
|
||||||
$toolbar.append($menu);
|
|
||||||
// add to timeline button
|
|
||||||
$toolbar
|
|
||||||
.find('#library-plus')
|
|
||||||
.click(
|
|
||||||
function() {
|
|
||||||
|
|
||||||
if (AIRTIME.button.isDisabled('btn-group #library-plus') === true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var selected = AIRTIME.library.getSelectedData(), data, i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
|
|
||||||
|
|
||||||
if ($("#show_builder_table").is(":visible")) {
|
|
||||||
for (i = 0, length = selected.length; i < length; i++) {
|
|
||||||
data = selected[i];
|
|
||||||
aMediaIds.push( {
|
|
||||||
"id" : data.id,
|
|
||||||
"type" : data.ftype
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// process selected files/playlists.
|
|
||||||
$("#show_builder_table tr.sb-selected").each(function(i, el) {
|
|
||||||
aData.push($(el).data("aData"));
|
|
||||||
});
|
|
||||||
|
|
||||||
// process selected schedule rows to add media
|
|
||||||
// after.
|
|
||||||
for (i = 0, length = aData.length; i < length; i++) {
|
|
||||||
temp = aData[i];
|
|
||||||
aSchedIds.push( {
|
|
||||||
"id" : temp.id,
|
|
||||||
"instance" : temp.instance,
|
|
||||||
"timestamp" : temp.timestamp
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aSchedIds.length == 0) {
|
|
||||||
if (!addToCurrentOrNext(aSchedIds)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
|
||||||
} else {
|
|
||||||
for (i = 0, length = selected.length; i < length; i++) {
|
|
||||||
data = selected[i];
|
|
||||||
aMediaIds.push([data.id, data.ftype]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if a playlist/block is open before adding items
|
|
||||||
if ($('.active-tab .obj_type').val() == 'playlist'
|
|
||||||
|| $('.active-tab .obj_type').val() == 'block') {
|
|
||||||
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// delete from library.
|
|
||||||
$toolbar.find('.icon-trash').parent().click(function() {
|
|
||||||
|
|
||||||
if (AIRTIME.button.isDisabled('icon-trash') === true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AIRTIME.library.fnDeleteSelectedItems();
|
|
||||||
});
|
|
||||||
|
|
||||||
$toolbar.find('#sb-new').click(function() {
|
|
||||||
if (AIRTIME.button.isDisabled('btn-group #sb-new') === true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var selection = $(".media_type_selector.selected").attr("selection_id");
|
|
||||||
|
|
||||||
if (selection == 2) {
|
|
||||||
AIRTIME.playlist.fnNew();
|
|
||||||
} else if (selection == 3) {
|
|
||||||
AIRTIME.playlist.fnNewBlock();
|
|
||||||
} else if (selection == 4) {
|
|
||||||
AIRTIME.playlist.fnWsNew();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$toolbar.find('#sb-edit').click(function() {
|
|
||||||
if (AIRTIME.button.isDisabled('btn-group #sb-edit') === true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var selected = $(".lib-selected");
|
|
||||||
|
|
||||||
selected.each(function(i, el) {
|
|
||||||
var data = $(el).data("aData");
|
|
||||||
|
|
||||||
if (data.ftype === "audioclip") {
|
|
||||||
$.get(baseUrl + "library/edit-file-md/id/" + data.id, {format: "json"}, function(json){
|
|
||||||
AIRTIME.playlist.fileMdEdit(json);
|
|
||||||
//buildEditMetadataDialog(json);
|
|
||||||
});
|
|
||||||
} else if (data.ftype === "playlist" || data.ftype === "block") {
|
|
||||||
AIRTIME.playlist.fnEdit(data.id, data.ftype, baseUrl+'new-playlist/edit');
|
|
||||||
AIRTIME.playlist.validatePlaylistElements();
|
|
||||||
} else if (data.ftype === "stream") {
|
|
||||||
AIRTIME.playlist.fnEdit(data.id, data.ftype, baseUrl + 'new-webstream/edit');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
mod.createToolbarDropDown();
|
|
||||||
};
|
|
||||||
|
|
||||||
return AIRTIME;
|
|
||||||
|
|
||||||
}(AIRTIME || {}));
|
|
|
@ -11,7 +11,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
var selected = mod.getChosenItemsLength(), $cursor = $('tr.sb-selected'), check = false,
|
var selected = mod.getChosenItemsLength(), $cursor = $('tr.sb-selected'), check = false,
|
||||||
shows = $('tr.sb-header'), current = $('tr.sb-current-show'),
|
shows = $('tr.sb-header'), current = $('tr.sb-current-show'),
|
||||||
// TODO: this is an ugly way of doing this... we should find a more robust way of checking which view we're in.
|
// TODO: this is an ugly way of doing this... we should find a more robust way of checking which view we're in.
|
||||||
cursorText = (window.location.href.toLowerCase().indexOf("schedule") > -1) ? $.i18n._('Add to show') : $.i18n._('Add to next show');
|
btnText = (window.location.href.toLowerCase().indexOf("schedule") > -1) ? $.i18n._('Add to show') : $.i18n._('Add to next show');
|
||||||
|
|
||||||
// make sure library items are selected and a cursor is selected.
|
// make sure library items are selected and a cursor is selected.
|
||||||
if (selected !== 0) {
|
if (selected !== 0) {
|
||||||
|
@ -22,18 +22,27 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
check = false;
|
check = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check === true) {
|
if (check) {
|
||||||
AIRTIME.button.enableButton("btn-group #library-plus", false);
|
AIRTIME.button.enableButton("btn-group #library-plus", false);
|
||||||
} else {
|
} else {
|
||||||
AIRTIME.button.disableButton("btn-group #library-plus", false);
|
AIRTIME.button.disableButton("btn-group #library-plus", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($("#show_builder_table").is(":visible")) {
|
||||||
if ($cursor.length !== 0) {
|
if ($cursor.length !== 0) {
|
||||||
cursorText = $.i18n._('Add before selected items');
|
btnText = $.i18n._('Add after selected items');
|
||||||
} else if (current.length !== 0) {
|
} else if (current.length !== 0) {
|
||||||
cursorText = $.i18n._('Add to current show');
|
btnText = $.i18n._('Add to current show');
|
||||||
}
|
}
|
||||||
AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), ' '+ cursorText);
|
} else {
|
||||||
|
var objType = $('.active-tab .obj_type').val();
|
||||||
|
if (objType === 'block') {
|
||||||
|
btnText = $.i18n._('Add to current smart block');
|
||||||
|
} else {
|
||||||
|
btnText = $.i18n._('Add to current playlist');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AIRTIME.library.changeAddButtonText($('.btn-group #library-plus #lib-plus-text'), btnText);
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
|
mod.fnRowCallback = function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
|
||||||
|
@ -61,6 +70,12 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
mod.redrawChosen();
|
mod.redrawChosen();
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
|
|
||||||
|
var cb = $('th.library_checkbox');
|
||||||
|
if (cb.find("input").length == 0) {
|
||||||
|
cb.append("<input id='super-checkbox' type='checkbox'>");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($("#show_builder_table").is(":visible")) {
|
||||||
$('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream')
|
$('#library_display tr.lib-audio, tr.lib-pl, tr.lib-stream')
|
||||||
.draggable(
|
.draggable(
|
||||||
{
|
{
|
||||||
|
@ -68,8 +83,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
var $el = $(this), selected = mod
|
var $el = $(this), selected = mod
|
||||||
.getChosenItemsLength(), container, thead = $("#show_builder_table thead"), colspan = thead
|
.getChosenItemsLength(), container, thead = $("#show_builder_table thead"), colspan = thead
|
||||||
.find("th").length, width = thead.find(
|
.find("th").length, width = $el.width(), message;
|
||||||
"tr:first").width(), message;
|
|
||||||
|
|
||||||
// dragging an element that has an unselected
|
// dragging an element that has an unselected
|
||||||
// checkbox.
|
// checkbox.
|
||||||
|
@ -93,17 +107,60 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
return container;
|
return container;
|
||||||
},
|
},
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
cursorAt: {
|
//cursorAt: {
|
||||||
top: 30,
|
// top: 30,
|
||||||
left: 100
|
// right: 10
|
||||||
},
|
//},
|
||||||
|
distance: 25, // min-distance for dragging
|
||||||
connectToSortable: '#show_builder_table'
|
connectToSortable: '#show_builder_table'
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
$('#library_display tr.lib-audio, tr.lib-stream, tr.lib-pl, tr.lib-block')
|
||||||
|
.draggable(
|
||||||
|
{
|
||||||
|
helper: function () {
|
||||||
|
|
||||||
|
var $el = $(this), selected = mod
|
||||||
|
.getChosenAudioFilesLength(), container, message,
|
||||||
|
width = $(this).width(), height = 55;
|
||||||
|
|
||||||
|
// dragging an element that has an unselected
|
||||||
|
// checkbox.
|
||||||
|
if (mod.isChosenItem($el) === false) {
|
||||||
|
selected++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selected === 1) {
|
||||||
|
message = $.i18n._("Adding 1 Item");
|
||||||
|
} else {
|
||||||
|
message = sprintf($.i18n._("Adding %s Items"), selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
container = $('<div class="helper"/>').append(
|
||||||
|
"<li/>").find("li").addClass(
|
||||||
|
"ui-state-default").append("<div/>")
|
||||||
|
.find("div").addClass(
|
||||||
|
"list-item-container").append(
|
||||||
|
message).end().width(width)
|
||||||
|
.height(height).end();
|
||||||
|
|
||||||
|
return container;
|
||||||
|
},
|
||||||
|
cursor: 'pointer',
|
||||||
|
//cursorAt: {
|
||||||
|
// top: 30,
|
||||||
|
// right: 10
|
||||||
|
//},
|
||||||
|
distance: 25, // min-distance for dragging
|
||||||
|
connectToSortable: '.active-tab .spl_sortable'
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.dblClickAdd = function(data, type) {
|
mod.dblClickAdd = function(data, type) {
|
||||||
var i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
|
var i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
|
||||||
|
|
||||||
|
if ($("#show_builder_table").is(":visible")) {
|
||||||
// process selected files/playlists.
|
// process selected files/playlists.
|
||||||
aMediaIds.push({
|
aMediaIds.push({
|
||||||
"id": data.id,
|
"id": data.id,
|
||||||
|
@ -111,7 +168,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#show_builder_table tr.sb-selected").each(function (i, el) {
|
$("#show_builder_table tr.sb-selected").each(function (i, el) {
|
||||||
aData.push($(el).prev().data("aData"));
|
aData.push($(el).data("aData"));
|
||||||
});
|
});
|
||||||
|
|
||||||
// process selected schedule rows to add media after.
|
// process selected schedule rows to add media after.
|
||||||
|
@ -131,26 +188,33 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||||
|
} else {
|
||||||
|
// process selected files/playlists.
|
||||||
|
aMediaIds.push(new Array(data.id, data.ftype));
|
||||||
|
|
||||||
|
// check if a playlist/block is open before adding items
|
||||||
|
if ($('.active-tab .obj_type').val() == 'playlist'
|
||||||
|
|| $('.active-tab .obj_type').val() == 'block') {
|
||||||
|
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function addToCurrentOrNext(arr) {
|
function addToCurrentOrNext(arr) {
|
||||||
var el;
|
var el;
|
||||||
// Get the show instance id of the first non-data row (id = 0)
|
// Add to the end of the current or next show by getting the footer
|
||||||
// The second last row in the table with that instance id is the
|
el = $(".sb-footer.sb-future:first");
|
||||||
// last schedule item for the first show. (This is important for
|
var data = el.prev().data("aData");
|
||||||
// the Now Playing screen if multiple shows are in view).
|
|
||||||
el = $("[si_id="+$("#0").attr("si_id")+"]");
|
|
||||||
var temp = el.eq(-2).data("aData");
|
|
||||||
|
|
||||||
if (temp === undefined) {
|
if (data === undefined) {
|
||||||
alert($.i18n._("Cannot schedule outside a show."));
|
alert($.i18n._("Cannot schedule outside a show.\nTry creating a show first."));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
arr.push({
|
arr.push({
|
||||||
"id" : temp.id,
|
"id" : data.id,
|
||||||
"instance" : temp.instance,
|
"instance" : data.instance,
|
||||||
"timestamp" : temp.timestamp
|
"timestamp" : data.timestamp
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!isInView(el)) {
|
if (!isInView(el)) {
|
||||||
|
@ -159,18 +223,19 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return arr;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mod.setupLibraryToolbar = function() {
|
mod.setupLibraryToolbar = function() {
|
||||||
var $toolbar = $(".lib-content .fg-toolbar:first");
|
var $toolbar = $(".lib-content .fg-toolbar:first");
|
||||||
|
|
||||||
mod.createToolbarButtons();
|
mod.createToolbarButtons();
|
||||||
|
mod.moveSearchBarToHeader();
|
||||||
|
|
||||||
$toolbar.append($menu);
|
$toolbar.append($menu);
|
||||||
// add to timeline button
|
// add to timeline button
|
||||||
$toolbar
|
$toolbar
|
||||||
.find('.icon-plus').parent()
|
.find('#library-plus')
|
||||||
.click(
|
.click(
|
||||||
function() {
|
function() {
|
||||||
|
|
||||||
|
@ -180,7 +245,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
var selected = AIRTIME.library.getSelectedData(), data, i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
|
var selected = AIRTIME.library.getSelectedData(), data, i, length, temp, aMediaIds = [], aSchedIds = [], aData = [];
|
||||||
|
|
||||||
// process selected files/playlists.
|
if ($("#show_builder_table").is(":visible")) {
|
||||||
for (i = 0, length = selected.length; i < length; i++) {
|
for (i = 0, length = selected.length; i < length; i++) {
|
||||||
data = selected[i];
|
data = selected[i];
|
||||||
aMediaIds.push( {
|
aMediaIds.push( {
|
||||||
|
@ -189,9 +254,9 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#show_builder_table tr.sb-selected")
|
// process selected files/playlists.
|
||||||
.each(function(i, el) {
|
$("#show_builder_table tr.sb-selected").each(function(i, el) {
|
||||||
aData.push($(el).prev().data("aData"));
|
aData.push($(el).data("aData"));
|
||||||
});
|
});
|
||||||
|
|
||||||
// process selected schedule rows to add media
|
// process selected schedule rows to add media
|
||||||
|
@ -206,10 +271,24 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aSchedIds.length == 0) {
|
if (aSchedIds.length == 0) {
|
||||||
addToCurrentOrNext(aSchedIds);
|
if (!addToCurrentOrNext(aSchedIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
AIRTIME.showbuilder.fnAdd(aMediaIds, aSchedIds);
|
||||||
|
} else {
|
||||||
|
for (i = 0, length = selected.length; i < length; i++) {
|
||||||
|
data = selected[i];
|
||||||
|
aMediaIds.push([data.id, data.ftype]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if a playlist/block is open before adding items
|
||||||
|
if ($('.active-tab .obj_type').val() == 'playlist'
|
||||||
|
|| $('.active-tab .obj_type').val() == 'block') {
|
||||||
|
AIRTIME.playlist.fnAddItems(aMediaIds, undefined, 'after');
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// delete from library.
|
// delete from library.
|
||||||
|
@ -222,6 +301,47 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
AIRTIME.library.fnDeleteSelectedItems();
|
AIRTIME.library.fnDeleteSelectedItems();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$toolbar.find('#sb-new').click(function() {
|
||||||
|
if (AIRTIME.button.isDisabled('btn-group #sb-new') === true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var selection = $(".media_type_selector.selected").attr("selection_id");
|
||||||
|
|
||||||
|
if (selection == 2) {
|
||||||
|
AIRTIME.playlist.fnNew();
|
||||||
|
} else if (selection == 3) {
|
||||||
|
AIRTIME.playlist.fnNewBlock();
|
||||||
|
} else if (selection == 4) {
|
||||||
|
AIRTIME.playlist.fnWsNew();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$toolbar.find('#sb-edit').click(function() {
|
||||||
|
if (AIRTIME.button.isDisabled('btn-group #sb-edit') === true) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var selected = $(".lib-selected");
|
||||||
|
|
||||||
|
selected.each(function(i, el) {
|
||||||
|
var data = $(el).data("aData");
|
||||||
|
|
||||||
|
if (data.ftype === "audioclip") {
|
||||||
|
$.get(baseUrl + "library/edit-file-md/id/" + data.id, {format: "json"}, function(json){
|
||||||
|
AIRTIME.playlist.fileMdEdit(json);
|
||||||
|
//buildEditMetadataDialog(json);
|
||||||
|
});
|
||||||
|
} else if (data.ftype === "playlist" || data.ftype === "block") {
|
||||||
|
AIRTIME.playlist.fnEdit(data.id, data.ftype, baseUrl+'playlist/edit');
|
||||||
|
AIRTIME.playlist.validatePlaylistElements();
|
||||||
|
} else if (data.ftype === "stream") {
|
||||||
|
AIRTIME.playlist.fnEdit(data.id, data.ftype, baseUrl + 'webstream/edit');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
mod.createToolbarDropDown();
|
mod.createToolbarDropDown();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
LIB_SELECTED_CLASS = "lib-selected",
|
LIB_SELECTED_CLASS = "lib-selected",
|
||||||
chosenItems = {},
|
chosenItems = {},
|
||||||
visibleChosenItems = {},
|
visibleChosenItems = {},
|
||||||
$previouslySelected;
|
$previouslySelected,
|
||||||
|
flagForDeselection = false;
|
||||||
|
|
||||||
|
|
||||||
// we need to know whether the criteria value is string or
|
// we need to know whether the criteria value is string or
|
||||||
|
@ -62,9 +63,8 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
selected,
|
selected,
|
||||||
$trs;
|
$trs;
|
||||||
|
|
||||||
|
|
||||||
// Get visible items and check if any chosenItems are visible
|
// Get visible items and check if any chosenItems are visible
|
||||||
$trs = $libTable.find("tbody input:checkbox").parents("tr");
|
$trs = $libTable.find("tr");
|
||||||
$trs.each(function(i){
|
$trs.each(function(i){
|
||||||
for (cItem in chosenItems) {
|
for (cItem in chosenItems) {
|
||||||
if (cItem === $(this).attr("id")) {
|
if (cItem === $(this).attr("id")) {
|
||||||
|
@ -88,7 +88,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
reAudio=/^(au|st|pl|bl)/ ;
|
reAudio=/^(au|st|pl|bl)/ ;
|
||||||
|
|
||||||
// Get visible items and check if any chosenItems are visible
|
// Get visible items and check if any chosenItems are visible
|
||||||
$trs = $libTable.find("tbody input:checkbox").parents("tr");
|
$trs = $libTable.find("tr");
|
||||||
$trs.each(function(i){
|
$trs.each(function(i){
|
||||||
for (cItem in chosenItems) {
|
for (cItem in chosenItems) {
|
||||||
if (cItem === $(this).attr("id")) {
|
if (cItem === $(this).attr("id")) {
|
||||||
|
@ -116,6 +116,31 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
mod.createToolbarButtons = function () {
|
mod.createToolbarButtons = function () {
|
||||||
$menu = $("<div class='btn-toolbar' />");
|
$menu = $("<div class='btn-toolbar' />");
|
||||||
$menu
|
$menu
|
||||||
|
.append("<div class='btn-group' title=" + $.i18n._('New') + ">" +
|
||||||
|
"<button class='btn btn-small' id='sb-new'>" +
|
||||||
|
"<i class='icon-white icon-plus'></i>" +
|
||||||
|
"<span>" + $.i18n._('New') + "</span>" +
|
||||||
|
"</button>" +
|
||||||
|
"</div>")
|
||||||
|
.append("<div class='btn-group' title=" + $.i18n._('Edit') + ">" +
|
||||||
|
"<button class='btn btn-small' id='sb-edit'>" +
|
||||||
|
"<i class='icon-white icon-pencil'></i>" +
|
||||||
|
"<span>" + $.i18n._('Edit') + "</span>" +
|
||||||
|
"</button>" +
|
||||||
|
"</div>")
|
||||||
|
|
||||||
|
.append("<div class='btn-group'>" +
|
||||||
|
"<button class='btn btn-small' id='library-plus'>" +
|
||||||
|
"<i class='icon-white icon-plus'></i>" +
|
||||||
|
"<span id='lib-plus-text'></span>" +
|
||||||
|
"</button>" +
|
||||||
|
"</div>")
|
||||||
|
.append("<div class='btn-group' title=" + $.i18n._('Delete') + ">" +
|
||||||
|
"<button class='btn btn-small btn-danger' id='sb-trash'>" +
|
||||||
|
"<i class='icon-white icon-trash'></i>" +
|
||||||
|
"<span>" + $.i18n._('Delete') + "</span>" +
|
||||||
|
"</button>" +
|
||||||
|
"</div>")
|
||||||
.append("<div class='btn-group'>" +
|
.append("<div class='btn-group'>" +
|
||||||
"<button class='btn btn-small dropdown-toggle' data-toggle='dropdown'>" +
|
"<button class='btn btn-small dropdown-toggle' data-toggle='dropdown'>" +
|
||||||
$.i18n._("Select") + " <span class='caret'></span>" +
|
$.i18n._("Select") + " <span class='caret'></span>" +
|
||||||
|
@ -125,20 +150,16 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
"<li id='sb-dselect-page'><a href='#'>" + $.i18n._("Deselect this page") + "</a></li>" +
|
"<li id='sb-dselect-page'><a href='#'>" + $.i18n._("Deselect this page") + "</a></li>" +
|
||||||
"<li id='sb-dselect-all'><a href='#'>" + $.i18n._("Deselect all") + "</a></li>" +
|
"<li id='sb-dselect-all'><a href='#'>" + $.i18n._("Deselect all") + "</a></li>" +
|
||||||
"</ul>" +
|
"</ul>" +
|
||||||
"</div>")
|
|
||||||
.append("<div class='btn-group'>" +
|
|
||||||
"<button class='btn btn-small' id='library-plus'>" +
|
|
||||||
"<i class='icon-white icon-plus'></i>" +
|
|
||||||
"<span id='lib-plus-text'></span>" +
|
|
||||||
"</button>" +
|
|
||||||
"</div>")
|
|
||||||
.append("<div class='btn-group'>" +
|
|
||||||
"<button class='btn btn-small' id='sb-trash'>" +
|
|
||||||
"<i class='icon-white icon-trash'></i>" +
|
|
||||||
"</button>" +
|
|
||||||
"</div>");
|
"</div>");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod.moveSearchBarToHeader = function() {
|
||||||
|
$("#library_display_filter").appendTo("#library_content > .panel-header");
|
||||||
|
$("#advanced_search").click(function(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
mod.createToolbarDropDown = function() {
|
mod.createToolbarDropDown = function() {
|
||||||
$('#sb-select-page').click(function(){mod.selectCurrentPage();});
|
$('#sb-select-page').click(function(){mod.selectCurrentPage();});
|
||||||
$('#sb-dselect-page').click(function(){mod.deselectCurrentPage();});
|
$('#sb-dselect-page').click(function(){mod.deselectCurrentPage();});
|
||||||
|
@ -161,10 +182,43 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.checkToolBarIcons = function() {
|
mod.checkEditButton = function() {
|
||||||
|
var selected = mod.getChosenItemsLength(),
|
||||||
|
check = false;
|
||||||
|
|
||||||
|
if (selected >= 1) {
|
||||||
|
check = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (check === true) {
|
||||||
|
AIRTIME.button.enableButton("btn-group #sb-edit", false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
AIRTIME.button.disableButton("btn-group #sb-edit", false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mod.checkNewButton = function() {
|
||||||
|
var selected = $(".media_type_selector.selected").attr("selection_id"),
|
||||||
|
check = false;
|
||||||
|
|
||||||
|
if (selected != 1) {
|
||||||
|
check = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (check === true) {
|
||||||
|
AIRTIME.button.enableButton("btn-group #sb-new", false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
AIRTIME.button.disableButton("btn-group #sb-new", false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mod.checkToolBarIcons = function() {
|
||||||
AIRTIME.library.checkAddButton();
|
AIRTIME.library.checkAddButton();
|
||||||
AIRTIME.library.checkDeleteButton();
|
AIRTIME.library.checkDeleteButton();
|
||||||
|
AIRTIME.library.checkEditButton();
|
||||||
|
AIRTIME.library.checkNewButton();
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.getSelectedData = function() {
|
mod.getSelectedData = function() {
|
||||||
|
@ -176,7 +230,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
$.fn.reverse = [].reverse;
|
$.fn.reverse = [].reverse;
|
||||||
|
|
||||||
// Get visible items and check if any chosenItems are visible
|
// Get visible items and check if any chosenItems are visible
|
||||||
$trs = $libTable.find("tbody input:checkbox").parents("tr").reverse();
|
$trs = $libTable.find("tr").reverse();
|
||||||
$trs.each(function(i){
|
$trs.each(function(i){
|
||||||
for (cItem in chosenItems) {
|
for (cItem in chosenItems) {
|
||||||
if (cItem === $(this).attr("id")) {
|
if (cItem === $(this).attr("id")) {
|
||||||
|
@ -204,6 +258,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
if ($el.length !== 0) {
|
if ($el.length !== 0) {
|
||||||
mod.highlightItem($el);
|
mod.highlightItem($el);
|
||||||
|
mod.checkItem($el);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -212,7 +267,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
var id = $el.attr("id"),
|
var id = $el.attr("id"),
|
||||||
item = chosenItems[id];
|
item = chosenItems[id];
|
||||||
|
|
||||||
return item !== undefined ? true : false;
|
return item !== undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.addToChosen = function($el) {
|
mod.addToChosen = function($el) {
|
||||||
|
@ -230,33 +285,38 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.highlightItem = function($el) {
|
mod.checkItem = function($el) {
|
||||||
var $input = $el.find("input");
|
$el.find(".library_checkbox > input").prop('checked', true);
|
||||||
|
$("#super-checkbox").prop("checked", true);
|
||||||
|
};
|
||||||
|
|
||||||
$input.attr("checked", true);
|
mod.uncheckItem = function($el) {
|
||||||
|
$el.find(".library_checkbox > input").prop('checked', false);
|
||||||
|
if ($("." + LIB_SELECTED_CLASS.length == 0)) {
|
||||||
|
$("#super-checkbox").prop("checked", false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mod.highlightItem = function($el) {
|
||||||
$el.addClass(LIB_SELECTED_CLASS);
|
$el.addClass(LIB_SELECTED_CLASS);
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.unHighlightItem = function($el) {
|
mod.unHighlightItem = function($el) {
|
||||||
var $input = $el.find("input");
|
|
||||||
|
|
||||||
$input.attr("checked", false);
|
|
||||||
$el.removeClass(LIB_SELECTED_CLASS);
|
$el.removeClass(LIB_SELECTED_CLASS);
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.selectItem = function($el) {
|
mod.selectItem = function($el) {
|
||||||
|
|
||||||
mod.highlightItem($el);
|
mod.highlightItem($el);
|
||||||
mod.addToChosen($el);
|
mod.addToChosen($el);
|
||||||
|
// Remember this row so we can properly multiselect
|
||||||
|
$previouslySelected = $el;
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.deselectItem = function($el) {
|
mod.deselectItem = function($el) {
|
||||||
|
|
||||||
mod.unHighlightItem($el);
|
mod.unHighlightItem($el);
|
||||||
mod.removeFromChosen($el);
|
mod.removeFromChosen($el);
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -269,15 +329,11 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
*/
|
*/
|
||||||
mod.selectCurrentPage = function() {
|
mod.selectCurrentPage = function() {
|
||||||
$.fn.reverse = [].reverse;
|
$.fn.reverse = [].reverse;
|
||||||
var $inputs = $libTable.find("tbody input:checkbox"),
|
var $trs = $libTable.find("tbody").find("tr").reverse();
|
||||||
$trs = $inputs.parents("tr").reverse();
|
|
||||||
|
|
||||||
$inputs.attr("checked", true);
|
|
||||||
$trs.addClass(LIB_SELECTED_CLASS);
|
|
||||||
|
|
||||||
$trs.each(function(i, el){
|
$trs.each(function(i, el){
|
||||||
$el = $(this);
|
mod.selectItem($(el));
|
||||||
mod.addToChosen($el);
|
mod.checkItem($(el));
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
|
@ -289,40 +345,48 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
* from gmail)
|
* from gmail)
|
||||||
*/
|
*/
|
||||||
mod.deselectCurrentPage = function() {
|
mod.deselectCurrentPage = function() {
|
||||||
var $inputs = $libTable.find("tbody input:checkbox"),
|
var $trs = $libTable.find("tr");
|
||||||
$trs = $inputs.parents("tr"),
|
|
||||||
id;
|
|
||||||
|
|
||||||
$inputs.attr("checked", false);
|
|
||||||
$trs.removeClass(LIB_SELECTED_CLASS);
|
|
||||||
|
|
||||||
$trs.each(function(i, el){
|
$trs.each(function(i, el){
|
||||||
$el = $(this);
|
mod.deselectItem($(el));
|
||||||
id = $el.attr("id");
|
mod.uncheckItem($(el));
|
||||||
delete chosenItems[id];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.selectNone = function() {
|
mod.selectNone = function() {
|
||||||
var $inputs = $libTable.find("tbody input:checkbox"),
|
var $trs = $libTable.find("tr");
|
||||||
$trs = $inputs.parents("tr");
|
$trs.each(function(i, el){
|
||||||
|
mod.deselectItem($(el));
|
||||||
$inputs.attr("checked", false);
|
mod.uncheckItem($(el));
|
||||||
$trs.removeClass(LIB_SELECTED_CLASS);
|
});
|
||||||
|
$previouslySelected = undefined;
|
||||||
|
|
||||||
chosenItems = {};
|
chosenItems = {};
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.fnDeleteItems = function(aMedia) {
|
mod.fnRedraw = function() {
|
||||||
|
oTable.fnStandingRedraw();
|
||||||
|
};
|
||||||
|
|
||||||
|
mod.fnDeleteItems = function(aMedia) {
|
||||||
//Prevent the user from spamming the delete button while the AJAX request is in progress
|
//Prevent the user from spamming the delete button while the AJAX request is in progress
|
||||||
AIRTIME.button.disableButton("btn-group #sb-trash", false);
|
AIRTIME.button.disableButton("btn-group #sb-trash", false);
|
||||||
//Hack to immediately show the "Processing" div in DataTables to give the user some sort of feedback.
|
var openTabObjectIds = $(".obj_id"),
|
||||||
$(".dataTables_processing").css('visibility','visible');
|
mediaIds = [];
|
||||||
|
for (var i in aMedia) {
|
||||||
|
mediaIds.push(parseInt(aMedia[i].id));
|
||||||
|
}
|
||||||
|
|
||||||
|
openTabObjectIds.each(function(i, el) {
|
||||||
|
var v = parseInt($(el).val());
|
||||||
|
if ($.inArray(v, mediaIds) > -1) {
|
||||||
|
AIRTIME.playlist.closeTab($(el).closest(".pl-content").attr("tab-id"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.post(baseUrl+"library/delete",
|
$.post(baseUrl+"library/delete",
|
||||||
{"format": "json", "media": aMedia},
|
{"format": "json", "media": aMedia},
|
||||||
|
@ -345,8 +409,8 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
item,
|
item,
|
||||||
temp,
|
temp,
|
||||||
aMedia = [],
|
aMedia = [],
|
||||||
currentObjId = $(".side_playlist").find(".obj_id").val(),
|
currentObjId = $(".side_playlist.active-tab").find(".obj_id").val(),
|
||||||
currentObjType = $(".side_playlist").find(".obj_type").val(),
|
currentObjType = $(".side_playlist.active-tab").find(".obj_type").val(),
|
||||||
closeObj = false;
|
closeObj = false;
|
||||||
|
|
||||||
// process selected files/playlists.
|
// process selected files/playlists.
|
||||||
|
@ -370,7 +434,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
$.post(baseUrl+"playlist/close-playlist",
|
$.post(baseUrl+"playlist/close-playlist",
|
||||||
{"format": "json", "type": currentObjType},
|
{"format": "json", "type": currentObjType},
|
||||||
function(json) {
|
function(json) {
|
||||||
$(".side_playlist").empty().append(json.html);
|
$("#editor_pane_wrapper").empty().append(json.html);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,7 +491,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
if (ele.bVisible) {
|
if (ele.bVisible) {
|
||||||
advanceSearchDiv.append(
|
advanceSearchDiv.append(
|
||||||
"<div id='advanced_search_col_"+currentColId+"' class='control-group'>" +
|
"<div id='advanced_search_col_"+currentColId+"' class='control-group'>" +
|
||||||
"<label class='control-label'"+labelStyle+">"+ele.sTitle+" : </label>" +
|
"<label class='control-label'"+labelStyle+">"+ele.sTitle+"</label>" +
|
||||||
"<div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div>" +
|
"<div id='"+ele.mDataProp+"' class='controls "+inputClass+"'></div>" +
|
||||||
"</div>");
|
"</div>");
|
||||||
} else {
|
} else {
|
||||||
|
@ -467,13 +531,42 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
} else {
|
} else {
|
||||||
$el.hide();
|
$el.hide();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//resize to prevent double scroll bars.
|
function getLibraryDatatableStrings() {
|
||||||
var $fs = $el.parents("fieldset"),
|
//Set up the datatables string translation table with different strings depending on
|
||||||
tableHeight = getTableHeight(),
|
//whether you're viewing files, playlists, smart blocks, etc.
|
||||||
searchHeight = $fs.height();
|
var type = parseInt($(".media_type_selector.selected").attr("selection_id"));
|
||||||
|
type = (type === undefined) ? 1 : type;
|
||||||
|
|
||||||
|
//FIXME: The code that calls this function doesn't work as intended because you can't
|
||||||
|
// change the oLanguage property of a datatable dynamically. :(
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
/*
|
||||||
|
case 0:
|
||||||
|
return getDatatablesStrings({
|
||||||
|
"sEmptyTable": $.i18n._("No files found"),
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
return getDatatablesStrings({
|
||||||
|
"sEmptyTable": $.i18n._("No playlists found"),
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return getDatatablesStrings({
|
||||||
|
"sEmptyTable": $.i18n._("No smart blocks found"),
|
||||||
|
});
|
||||||
|
break;*/
|
||||||
|
default:
|
||||||
|
return getDatatablesStrings({
|
||||||
|
"sEmptyTable": $.i18n._(""),
|
||||||
|
"sZeroRecords": $.i18n._("No matching results found.")
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
$libContent.find(".dataTables_scrolling").css("max-height", tableHeight - searchHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oTable = $libTable.dataTable( {
|
oTable = $libTable.dataTable( {
|
||||||
|
@ -485,10 +578,10 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
// https://wiki.sourcefabric.org/display/CC/Adding+a+new+library+datatable+column
|
// https://wiki.sourcefabric.org/display/CC/Adding+a+new+library+datatable+column
|
||||||
"aoColumns": [
|
"aoColumns": [
|
||||||
/* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false },
|
/* ftype */ { "sTitle" : "" , "mDataProp" : "ftype" , "bSearchable" : false , "bVisible" : false },
|
||||||
/* Checkbox */ { "sTitle" : "" , "mDataProp" : "checkbox" , "bSortable" : false , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_checkbox" } ,
|
/* Checkbox */ { "sTitle" : "" , "mDataProp" : "checkbox" , "bSortable" : false , "bSearchable" : false , "sWidth" : "16px" , "sClass" : "library_checkbox" },
|
||||||
/* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSearchable" : false , "sWidth" : "25px" , "sClass" : "library_type" , "iDataSort" : 0 } ,
|
/* Type */ { "sTitle" : "" , "mDataProp" : "image" , "bSortable" : false , "bSearchable" : false , "sWidth" : "16px" , "sClass" : "library_type" , "iDataSort" : 0 },
|
||||||
/* Is Scheduled */ { "sTitle" : $.i18n._("Scheduled") , "mDataProp" : "is_scheduled" , "bSearchable" : false , "sWidth" : "90px" , "sClass" : "library_is_scheduled"} ,
|
/* Is Scheduled */ { "sTitle" : $.i18n._("Scheduled") , "mDataProp" : "is_scheduled" , "bVisible" : false , "bSearchable" : false , "sWidth" : "90px" , "sClass" : "library_is_scheduled" },
|
||||||
/* Is Playlist */ { "sTitle" : $.i18n._("Playlist / Block") , "mDataProp" : "is_playlist" , "bSearchable" : false , "sWidth" : "110px" , "sClass" : "library_is_playlist"} ,
|
///* Is Playlist */ { "sTitle" : $.i18n._("Playlist / Block") , "mDataProp" : "is_playlist" , "bSearchable" : false , "sWidth" : "110px" , "sClass" : "library_is_playlist"} ,
|
||||||
/* Title */ { "sTitle" : $.i18n._("Title") , "mDataProp" : "track_title" , "sClass" : "library_title" , "sWidth" : "170px" },
|
/* Title */ { "sTitle" : $.i18n._("Title") , "mDataProp" : "track_title" , "sClass" : "library_title" , "sWidth" : "170px" },
|
||||||
/* Creator */ { "sTitle" : $.i18n._("Creator") , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" },
|
/* Creator */ { "sTitle" : $.i18n._("Creator") , "mDataProp" : "artist_name" , "sClass" : "library_creator" , "sWidth" : "160px" },
|
||||||
/* Album */ { "sTitle" : $.i18n._("Album") , "mDataProp" : "album_title" , "sClass" : "library_album" , "sWidth" : "150px" },
|
/* Album */ { "sTitle" : $.i18n._("Album") , "mDataProp" : "album_title" , "sClass" : "library_album" , "sWidth" : "150px" },
|
||||||
|
@ -504,25 +597,25 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
/* ISRC Number */ { "sTitle" : $.i18n._("ISRC") , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" },
|
/* ISRC Number */ { "sTitle" : $.i18n._("ISRC") , "mDataProp" : "isrc_number" , "bVisible" : false , "sClass" : "library_isrc" , "sWidth" : "150px" },
|
||||||
/* Label */ { "sTitle" : $.i18n._("Label") , "mDataProp" : "label" , "bVisible" : false , "sClass" : "library_label" , "sWidth" : "125px" },
|
/* Label */ { "sTitle" : $.i18n._("Label") , "mDataProp" : "label" , "bVisible" : false , "sClass" : "library_label" , "sWidth" : "125px" },
|
||||||
/* Language */ { "sTitle" : $.i18n._("Language") , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" },
|
/* Language */ { "sTitle" : $.i18n._("Language") , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" },
|
||||||
/* Last Modified */ { "sTitle" : $.i18n._("Last Modified") , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" },
|
/* Last Modified */ { "sTitle" : $.i18n._("Last Modified") , "mDataProp" : "mtime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "155px" },
|
||||||
/* Last Played */ { "sTitle" : $.i18n._("Last Played") , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "125px" },
|
/* Last Played */ { "sTitle" : $.i18n._("Last Played") , "mDataProp" : "lptime" , "bVisible" : false , "sClass" : "library_modified_time" , "sWidth" : "155px" },
|
||||||
/* Length */ { "sTitle" : $.i18n._("Length") , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" },
|
/* Length */ { "sTitle" : $.i18n._("Length") , "mDataProp" : "length" , "sClass" : "library_length" , "sWidth" : "80px" },
|
||||||
/* Mime */ { "sTitle" : $.i18n._("Mime") , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" },
|
/* Mime */ { "sTitle" : $.i18n._("Mime") , "mDataProp" : "mime" , "bVisible" : false , "sClass" : "library_mime" , "sWidth" : "80px" },
|
||||||
/* Mood */ { "sTitle" : $.i18n._("Mood") , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" },
|
/* Mood */ { "sTitle" : $.i18n._("Mood") , "mDataProp" : "mood" , "bVisible" : false , "sClass" : "library_mood" , "sWidth" : "70px" },
|
||||||
/* Owner */ { "sTitle" : $.i18n._("Owner") , "mDataProp" : "owner_id" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" },
|
/* Owner */ { "sTitle" : $.i18n._("Owner") , "mDataProp" : "owner_id" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" },
|
||||||
/* Replay Gain */ { "sTitle" : $.i18n._("Replay Gain") , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_replay_gain" , "sWidth" : "80px" },
|
/* Replay Gain */ { "sTitle" : $.i18n._("Replay Gain") , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_replay_gain" , "sWidth" : "125px" },
|
||||||
/* Sample Rate */ { "sTitle" : $.i18n._("Sample Rate") , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "80px" },
|
/* Sample Rate */ { "sTitle" : $.i18n._("Sample Rate") , "mDataProp" : "sample_rate" , "bVisible" : false , "sClass" : "library_sr" , "sWidth" : "125px" },
|
||||||
/* Track Number */ { "sTitle" : $.i18n._("Track Number") , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "65px" },
|
/* Track Number */ { "sTitle" : $.i18n._("Track Number") , "mDataProp" : "track_number" , "bVisible" : false , "sClass" : "library_track" , "sWidth" : "125px" },
|
||||||
/* Upload Time */ { "sTitle" : $.i18n._("Uploaded") , "mDataProp" : "utime" , "sClass" : "library_upload_time" , "sWidth" : "125px" } ,
|
/* Upload Time */ { "sTitle" : $.i18n._("Uploaded") , "mDataProp" : "utime" , "bVisible" : false , "sClass" : "library_upload_time" , "sWidth" : "155px" },
|
||||||
/* Website */ { "sTitle" : $.i18n._("Website") , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" },
|
/* Website */ { "sTitle" : $.i18n._("Website") , "mDataProp" : "info_url" , "bVisible" : false , "sClass" : "library_url" , "sWidth" : "150px" },
|
||||||
/* Year */ { "sTitle" : $.i18n._("Year") , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" }
|
/* Year */ { "sTitle" : $.i18n._("Year") , "mDataProp" : "year" , "bVisible" : false , "sClass" : "library_year" , "sWidth" : "60px" },
|
||||||
|
/* Context Menu */ { "sTitle" : "" , "mData" : null , "bSortable" : false , "sClass" : "library_actions" , "bSearchable" : false , "sWidth" : "16px" }
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
"bProcessing": true,
|
"bProcessing": true,
|
||||||
"bServerSide": true,
|
"bServerSide": true,
|
||||||
|
|
||||||
"aLengthMenu": [[5, 10, 15, 20, 25, 50, 100], [5, 10, 15, 20, 25, 50, 100]],
|
"aLengthMenu": [5, 10, 15, 20, 25, 50, 100],
|
||||||
|
|
||||||
"bStateSave": true,
|
"bStateSave": true,
|
||||||
"fnStateSaveParams": function (oSettings, oData) {
|
"fnStateSaveParams": function (oSettings, oData) {
|
||||||
|
@ -562,7 +655,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
// sure everything works properly.
|
// sure everything works properly.
|
||||||
for (i = 0, length = a.length; i < length; i++) {
|
for (i = 0, length = a.length; i < length; i++) {
|
||||||
if (typeof(a[i]) === "string") {
|
if (typeof(a[i]) === "string") {
|
||||||
a[i] = (a[i] === "true") ? true : false;
|
a[i] = (a[i] === "true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -600,8 +693,8 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
aoData.push( { name: "advSearch", value: advSearchValid} );
|
aoData.push( { name: "advSearch", value: advSearchValid} );
|
||||||
|
|
||||||
// push whether to search files/playlists or all.
|
// push whether to search files/playlists or all.
|
||||||
type = $("#library_display_type").find("select").val();
|
type = $(".media_type_selector.selected").attr("selection_id");
|
||||||
type = (type === undefined) ? 0 : type;
|
type = (type === undefined) ? 1 : type;
|
||||||
aoData.push( { name: "type", value: type} );
|
aoData.push( { name: "type", value: type} );
|
||||||
|
|
||||||
getUsabilityHint();
|
getUsabilityHint();
|
||||||
|
@ -619,6 +712,12 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
// add checkbox
|
// add checkbox
|
||||||
$(nRow).find('td.library_checkbox').html("<input type='checkbox' name='cb_"+aData.id+"'>");
|
$(nRow).find('td.library_checkbox').html("<input type='checkbox' name='cb_"+aData.id+"'>");
|
||||||
|
|
||||||
|
$(nRow).find('td.library_actions')
|
||||||
|
.text("...")
|
||||||
|
.on('click', function(e) {
|
||||||
|
$(this).contextMenu({x: $(e.target).offset().left, y: $(e.target).offset().top})
|
||||||
|
}).html("<div class='library_actions_btn'>...</div>");
|
||||||
|
|
||||||
// add audio preview image/button
|
// add audio preview image/button
|
||||||
if (aData.ftype === "audioclip") {
|
if (aData.ftype === "audioclip") {
|
||||||
$(nRow).find('td.library_type').html('<img title="'+$.i18n._("Track preview")+'" src="'+baseUrl+'css/images/icon_audioclip.png">');
|
$(nRow).find('td.library_type').html('<img title="'+$.i18n._("Track preview")+'" src="'+baseUrl+'css/images/icon_audioclip.png">');
|
||||||
|
@ -658,104 +757,6 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
alreadyclicked=false;
|
|
||||||
// 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
|
|
||||||
// do what needs to happen on double click.
|
|
||||||
|
|
||||||
$tr = $(el).parent();
|
|
||||||
data = $tr.data("aData");
|
|
||||||
AIRTIME.library.dblClickAdd(data, data.ftype);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
alreadyclicked=true;
|
|
||||||
alreadyclickedTimeout=setTimeout(function(){
|
|
||||||
alreadyclicked=false; // reset when it happens
|
|
||||||
// do what needs to happen on single click.
|
|
||||||
// use el instead of $(this) because $(this) is
|
|
||||||
// no longer the element
|
|
||||||
el.contextMenu({x: e.pageX, y: e.pageY});
|
|
||||||
},300); // <-- dblclick tolerance here
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
/*$(nRow).find(".media-item-in-use").qtip({
|
|
||||||
content: {
|
|
||||||
text: aData.status_msg
|
|
||||||
},
|
|
||||||
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"
|
|
||||||
},
|
|
||||||
});*/
|
|
||||||
|
|
||||||
// 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: function(event, api) {
|
|
||||||
$.get(baseUrl+"library/get-file-metadata",
|
|
||||||
({format: "html", id : aData.id, type: aData.ftype}),
|
|
||||||
function (html) {
|
|
||||||
api.set('content.text', html);
|
|
||||||
}, "html")
|
|
||||||
.fail(function (xhr, status, error) {
|
|
||||||
api.set('content.text', status + ': ' + error)
|
|
||||||
});
|
|
||||||
return 'Loading...';
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
text: aData.track_title
|
|
||||||
}
|
|
||||||
},
|
|
||||||
position: {
|
|
||||||
target: 'event',
|
|
||||||
adjust: {
|
|
||||||
resize: true,
|
|
||||||
method: "flip flip"
|
|
||||||
},
|
|
||||||
my: 'left center',
|
|
||||||
at: 'right center',
|
|
||||||
viewport: $(window), // Keep the tooltip on-screen at
|
|
||||||
// all times
|
|
||||||
effect: false // Disable positioning animation
|
|
||||||
},
|
|
||||||
style: {
|
|
||||||
classes: "ui-tooltip-dark file-md-long"
|
|
||||||
},
|
|
||||||
show: 'mousedown',
|
|
||||||
events: {
|
|
||||||
show: function(event, api) {
|
|
||||||
// Only show the tooltip if it was a right-click
|
|
||||||
if(event.originalEvent.button !== 2) {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hide: {event:'mouseout', delay: 50, fixed:true}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
// remove any selected nodes before the draw.
|
// remove any selected nodes before the draw.
|
||||||
"fnPreDrawCallback": function( oSettings ) {
|
"fnPreDrawCallback": function( oSettings ) {
|
||||||
|
@ -770,24 +771,25 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
"sPaginationType": "full_numbers",
|
"sPaginationType": "full_numbers",
|
||||||
"bJQueryUI": true,
|
"bJQueryUI": true,
|
||||||
"bAutoWidth": false,
|
"bAutoWidth": false,
|
||||||
"oLanguage": getDatatablesStrings({
|
"oLanguage": getLibraryDatatableStrings(),
|
||||||
"sZeroRecords": $.i18n._("No matching records found."),
|
|
||||||
}),
|
|
||||||
|
|
||||||
// R = ColReorder, C = ColVis
|
// R = ColReorder, C = ColVis
|
||||||
"sDom": 'Rl<"#library_display_type">f<"dt-process-rel"r><"H"<"library_toolbar"C>><"dataTables_scrolling"t><"F"ip>',
|
"sDom": 'Rf<"dt-process-rel"r><"H"<"library_toolbar"C>><"dataTables_scrolling"t><"F"ilp>>',
|
||||||
|
|
||||||
"oColVis": {
|
"oColVis": {
|
||||||
"sAlign": "right",
|
"sAlign": "right",
|
||||||
"aiExclude": [0, 1, 2],
|
"aiExclude": [0, 1, 2, 31],
|
||||||
"sSize": "css",
|
"sSize": "css",
|
||||||
"fnStateChange": setFilterElement,
|
"fnStateChange": setFilterElement,
|
||||||
"buttonText": $.i18n._("Show / hide columns")
|
"buttonText": $.i18n._("Columns")
|
||||||
},
|
},
|
||||||
|
|
||||||
"oColReorder": {
|
"oColReorder": {
|
||||||
|
"iFixedColumnsRight": 1,
|
||||||
"iFixedColumns": 3
|
"iFixedColumns": 3
|
||||||
}
|
},
|
||||||
|
|
||||||
|
"bScrollCollapse": false
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -814,10 +816,6 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
$(".dataTables_filter input").val("").keyup();
|
$(".dataTables_filter input").val("").keyup();
|
||||||
|
|
||||||
$simpleSearch.addClass("sp-invisible");
|
$simpleSearch.addClass("sp-invisible");
|
||||||
|
|
||||||
//resize the library table to avoid a double scroll bar. CC-4504
|
|
||||||
height = tableHeight - searchHeight;
|
|
||||||
$libContent.find(".dataTables_scrolling").css("max-height", height);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// clear the advanced search fields
|
// clear the advanced search fields
|
||||||
|
@ -839,73 +837,126 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
$simpleSearch.removeClass("sp-invisible");
|
$simpleSearch.removeClass("sp-invisible");
|
||||||
$fs.addClass("closed");
|
$fs.addClass("closed");
|
||||||
|
|
||||||
//resize the library table to avoid a double scroll bar. CC-4504
|
|
||||||
$libContent.find(".dataTables_scrolling").css("max-height", tableHeight);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var tableHeight = getTableHeight();
|
|
||||||
$libContent.find(".dataTables_scrolling").css("max-height", tableHeight);
|
|
||||||
|
|
||||||
AIRTIME.library.setupLibraryToolbar(oTable);
|
AIRTIME.library.setupLibraryToolbar(oTable);
|
||||||
|
|
||||||
$("#library_display_type")
|
$libTable.find("tbody").on("dblclick", "tr", function(ev) {
|
||||||
.addClass("dataTables_type")
|
var data = $(this).data("aData");
|
||||||
.append('<select name="library_display_type" />')
|
AIRTIME.library.dblClickAdd(data, data.ftype);
|
||||||
.find("select")
|
|
||||||
.append('<option value="0">'+$.i18n._("All")+'</option>')
|
|
||||||
.append('<option value="1">'+$.i18n._("Files")+'</option>')
|
|
||||||
.append('<option value="2">'+$.i18n._("Playlists")+'</option>')
|
|
||||||
.append('<option value="3">'+$.i18n._("Smart Blocks")+'</option>')
|
|
||||||
.append('<option value="4">'+$.i18n._("Web Streams")+'</option>')
|
|
||||||
.end()
|
|
||||||
.change(function(ev){
|
|
||||||
oTable.fnDraw();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$libTable.find("tbody").on("click", "input[type=checkbox]", function(ev) {
|
$libTable.find("tbody").on("mousedown", "tr > td.library_checkbox", function(ev) {
|
||||||
|
var $tr = $(this).parent(),
|
||||||
var $cb = $(this),
|
|
||||||
$tr = $cb.parents("tr"),
|
|
||||||
// Get the ID of the selected row
|
// Get the ID of the selected row
|
||||||
$rowId = $tr.attr("id");
|
$rowId = $tr.attr("id");
|
||||||
|
|
||||||
if ($cb.is(":checked")) {
|
if (!$tr.hasClass(LIB_SELECTED_CLASS)) {
|
||||||
if (ev.shiftKey && $previouslySelected !== undefined) {
|
if (ev.shiftKey && $previouslySelected !== undefined) {
|
||||||
|
if ($previouslySelected.attr("id") == $rowId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If the selected row comes before the previously selected row,
|
// If the selected row comes before the previously selected row,
|
||||||
// we want to select previous rows, otherwise we select next
|
// we want to select previous rows, otherwise we select next
|
||||||
if ($previouslySelected.prevAll("#" + $rowId).length !== 0) {
|
if ($previouslySelected.prevAll("#" + $rowId).length !== 0) {
|
||||||
$previouslySelected.prevUntil($tr).each(function (i, el) {
|
$previouslySelected.prevUntil($tr).each(function (i, el) {
|
||||||
mod.selectItem($(el));
|
mod.selectItem($(el));
|
||||||
|
mod.checkItem($(el));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$previouslySelected.nextUntil($tr).each(function (i, el) {
|
$previouslySelected.nextUntil($tr).each(function (i, el) {
|
||||||
mod.selectItem($(el));
|
mod.selectItem($(el));
|
||||||
|
mod.checkItem($(el));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mod.selectItem($tr);
|
||||||
|
mod.checkItem($tr);
|
||||||
|
} else {
|
||||||
|
flagForDeselection = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$libTable.find("tbody").on("mousedown", "tr > td:not(.library_checkbox)", function(ev) {
|
||||||
|
var $tr = $(this).parent(),
|
||||||
|
// Get the ID of the selected row
|
||||||
|
$rowId = $tr.attr("id");
|
||||||
|
|
||||||
|
if (!$tr.hasClass(LIB_SELECTED_CLASS)) {
|
||||||
|
if (ev.shiftKey && $previouslySelected !== undefined) {
|
||||||
|
if ($previouslySelected.attr("id") == $rowId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the selected row comes before the previously selected row,
|
||||||
|
// we want to select previous rows, otherwise we select next
|
||||||
|
if ($previouslySelected.prevAll("#" + $rowId).length !== 0) {
|
||||||
|
$previouslySelected.prevUntil($tr).each(function (i, el) {
|
||||||
|
mod.selectItem($(el));
|
||||||
|
mod.checkItem($(el));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$previouslySelected.nextUntil($tr).each(function (i, el) {
|
||||||
|
mod.selectItem($(el));
|
||||||
|
mod.checkItem($(el));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (!ev.ctrlKey) {
|
||||||
|
mod.selectNone();
|
||||||
|
}
|
||||||
|
|
||||||
mod.selectItem($tr);
|
mod.selectItem($tr);
|
||||||
// Remember this row so we can properly multiselect
|
mod.checkItem($tr);
|
||||||
$previouslySelected = $tr;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
mod.deselectItem($tr);
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$libTable.find("tbody").on("click", "tr > td.library_checkbox", function() {
|
||||||
|
var tr = $(this).parent();
|
||||||
|
|
||||||
|
if (flagForDeselection) {
|
||||||
|
flagForDeselection = false;
|
||||||
|
mod.deselectItem(tr);
|
||||||
|
mod.uncheckItem(tr);
|
||||||
|
} else {
|
||||||
|
mod.checkItem(tr);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$libTable.find("tbody").on("click", "tr > td:not(.library_checkbox)", function(e) {
|
||||||
|
var tr = $(this).parent();
|
||||||
|
if (!(e.shiftKey || e.ctrlKey)) {
|
||||||
|
mod.selectNone();
|
||||||
|
mod.selectItem(tr);
|
||||||
|
}
|
||||||
|
mod.checkItem(tr);
|
||||||
|
});
|
||||||
|
|
||||||
|
$libTable.find("thead").on("click", "th > input[type='checkbox']", function() {
|
||||||
|
if ($(this).is(":checked")) {
|
||||||
|
AIRTIME.library.selectCurrentPage();
|
||||||
|
$(this).prop("checked", true);
|
||||||
|
} else {
|
||||||
|
AIRTIME.library.selectNone();
|
||||||
|
$(this).prop("checked", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#sb-actions').on("click", function(e) {
|
||||||
|
$("#library_display tr:has(td)").contextMenu({x: $(e.target).offset().left, y: $(e.target).offset().top});
|
||||||
});
|
});
|
||||||
|
|
||||||
// begin context menu initialization.
|
// begin context menu initialization.
|
||||||
$.contextMenu({
|
AIRTIME.library.ctxMenu = $.contextMenu({
|
||||||
selector: '#library_display td:not(.library_checkbox)',
|
selector: '#library_display tr:has(td)',
|
||||||
trigger: "left",
|
//trigger: "left",
|
||||||
ignoreRightClick: true,
|
trigger: "custom",
|
||||||
|
|
||||||
build: function($el, e) {
|
build: function($el, e) {
|
||||||
var data, screen, items, callback, $tr;
|
var data, screen, items, callback, $tr;
|
||||||
|
|
||||||
$tr = $el.parent();
|
$tr = $el;
|
||||||
data = $tr.data("aData");
|
data = $tr.data("aData");
|
||||||
screen = $tr.data("screen");
|
screen = $tr.data("screen");
|
||||||
|
|
||||||
|
@ -925,23 +976,20 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
// define an edit callback.
|
// define an edit callback.
|
||||||
if (oItems.edit !== undefined) {
|
if (oItems.edit !== undefined) {
|
||||||
|
|
||||||
if (data.ftype === "audioclip") {
|
if (data.ftype === "audioclip") {
|
||||||
callback = function() {
|
callback = function() {
|
||||||
$.get(oItems.edit.url, {format: "json"}, function(json){
|
$.get(oItems.edit.url, {format: "json"}, function(json){
|
||||||
buildEditMetadataDialog(json);
|
AIRTIME.playlist.fileMdEdit(json);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
} else if (data.ftype === "playlist" || data.ftype === "block") {
|
} else if (data.ftype === "playlist" || data.ftype === "block") {
|
||||||
callback = function() {
|
callback = function() {
|
||||||
var url = baseUrl+'Playlist/edit';
|
AIRTIME.playlist.fnEdit(data.id, data.ftype, baseUrl+'playlist/edit');
|
||||||
AIRTIME.playlist.fnEdit(data.id, data.ftype, url);
|
|
||||||
AIRTIME.playlist.validatePlaylistElements();
|
AIRTIME.playlist.validatePlaylistElements();
|
||||||
};
|
};
|
||||||
} else if (data.ftype === "stream") {
|
} else if (data.ftype === "stream") {
|
||||||
callback = function() {
|
callback = function() {
|
||||||
var url = baseUrl+'Webstream/edit';
|
AIRTIME.playlist.fnEdit(data.id, data.ftype, baseUrl + 'webstream/edit');
|
||||||
AIRTIME.playlist.fnEdit(data.id, data.ftype, url);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Exception($.i18n._("Unknown type: ") + data.ftype);
|
throw new Exception($.i18n._("Unknown type: ") + data.ftype);
|
||||||
|
@ -960,16 +1008,12 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
callback = function() {
|
callback = function() {
|
||||||
if (data.ftype === 'playlist' && data.length !== '0.0'){
|
if (data.ftype === 'playlist' && data.length !== '0.0'){
|
||||||
playlistIndex = $(this).parent().attr('id').substring(3); // remove
|
playlistIndex = $(this).parent().attr('id').substring(3); // remove the pl_
|
||||||
// the
|
|
||||||
// pl_
|
|
||||||
open_playlist_preview(playlistIndex, 0);
|
open_playlist_preview(playlistIndex, 0);
|
||||||
} else if (data.ftype === 'audioclip' || data.ftype === 'stream') {
|
} else if (data.ftype === 'audioclip' || data.ftype === 'stream') {
|
||||||
open_audio_preview(data.ftype, data.id);
|
open_audio_preview(data.ftype, data.id);
|
||||||
} else if (data.ftype === 'block') {
|
} else if (data.ftype === 'block') {
|
||||||
blockIndex = $(this).parent().attr('id').substring(3); // remove
|
blockIndex = $(this).parent().attr('id').substring(3); // remove the pl_
|
||||||
// the
|
|
||||||
// pl_
|
|
||||||
open_block_preview(blockIndex, 0);
|
open_block_preview(blockIndex, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1092,6 +1136,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.libraryInit = libraryInit;
|
mod.libraryInit = libraryInit;
|
||||||
|
|
||||||
return AIRTIME;
|
return AIRTIME;
|
||||||
|
@ -1117,39 +1162,6 @@ function closeDialogLibrary(event, ui) {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkImportStatus() {
|
|
||||||
$.getJSON(baseUrl+'Preference/is-import-in-progress', function(data){
|
|
||||||
var $div = $('#import_status');
|
|
||||||
var table = $('#library_display').dataTable();
|
|
||||||
if (data == true){
|
|
||||||
$div.show();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if ($div.is(':visible')) {
|
|
||||||
table.fnStandingRedraw();
|
|
||||||
}
|
|
||||||
$div.hide();
|
|
||||||
}
|
|
||||||
setTimeout(checkImportStatus, 5000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function addProgressIcon(id) {
|
|
||||||
var tr = $("#au_"+id),
|
|
||||||
span;
|
|
||||||
|
|
||||||
span = tr.find("td.library_title").find("span");
|
|
||||||
|
|
||||||
if (span.length > 0){
|
|
||||||
span.removeClass()
|
|
||||||
.addClass("small-icon progress");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
tr.find("td.library_title")
|
|
||||||
.append('<span class="small-icon progress"></span>');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function is called from dataTables.columnFilter.js
|
* This function is called from dataTables.columnFilter.js
|
||||||
*/
|
*/
|
||||||
|
@ -1169,7 +1181,7 @@ function validateAdvancedSearch(divs) {
|
||||||
searchTerm[0] = "";
|
searchTerm[0] = "";
|
||||||
searchTerm[1] = "";
|
searchTerm[1] = "";
|
||||||
$.each(divs, function(i, div){
|
$.each(divs, function(i, div){
|
||||||
fieldName = $(div).children(':nth-child(2)').attr('id');
|
fieldName = $(div).children('div').attr('id');
|
||||||
fields = $(div).children().find('input');
|
fields = $(div).children().find('input');
|
||||||
searchTermType = validationTypes[fieldName];
|
searchTermType = validationTypes[fieldName];
|
||||||
valid = true;
|
valid = true;
|
||||||
|
@ -1213,9 +1225,9 @@ function validateAdvancedSearch(divs) {
|
||||||
*/
|
*/
|
||||||
} else if (searchTerm[0] === "" && searchTerm[1] !== "" ||
|
} else if (searchTerm[0] === "" && searchTerm[1] !== "" ||
|
||||||
searchTerm[0] === "" && searchTerm[1] === ""){
|
searchTerm[0] === "" && searchTerm[1] === ""){
|
||||||
if ($(field).closest('div').children(':last-child').hasClass('checked-icon') ||
|
if ($(field).closest('div').prev().hasClass('checked-icon') ||
|
||||||
$(field).closest('div').children(':last-child').hasClass('not-available-icon')) {
|
$(field).closest('div').prev().hasClass('not-available-icon')) {
|
||||||
$(field).closest('div').children(':last-child').remove();
|
$(field).closest('div').prev().remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1244,24 +1256,30 @@ function addRemoveValidationIcons(valid, field, searchTermType) {
|
||||||
invalidIndicator = " <span title='"+title+"' class='not-available-icon sp-checked-icon'></span>";
|
invalidIndicator = " <span title='"+title+"' class='not-available-icon sp-checked-icon'></span>";
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (!field.closest('div').children(':last-child').hasClass('checked-icon')) {
|
if (!field.closest('div').prev().hasClass('checked-icon')) {
|
||||||
// remove invalid icon before adding valid icon
|
// remove invalid icon before adding valid icon
|
||||||
if (field.closest('div').children(':last-child').hasClass('not-available-icon')) {
|
if (field.closest('div').prev().hasClass('not-available-icon')) {
|
||||||
field.closest('div').children(':last-child').remove();
|
field.closest('div').prev().remove();
|
||||||
}
|
}
|
||||||
field.closest('div').append(validIndicator);
|
field.closest('div').before(validIndicator);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!field.closest('div').children(':last-child').hasClass('not-available-icon')) {
|
if (!field.closest('div').prev().hasClass('not-available-icon')) {
|
||||||
// remove valid icon before adding invalid icon
|
// remove valid icon before adding invalid icon
|
||||||
if (field.closest('div').children(':last-child').hasClass('checked-icon')) {
|
if (field.closest('div').prev().hasClass('checked-icon')) {
|
||||||
field.closest('div').children(':last-child').remove();
|
field.closest('div').prev().remove();
|
||||||
}
|
}
|
||||||
field.closest('div').append(invalidIndicator);
|
field.closest('div').before(invalidIndicator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resizeAdvancedSearch() {
|
||||||
|
var s = $("#advanced_search");
|
||||||
|
s.css("max-height", $(window).height() / 4);
|
||||||
|
s.css("overflow", "auto");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validation types: s => string i => integer n => numeric (positive/negative,
|
* Validation types: s => string i => integer n => numeric (positive/negative,
|
||||||
* whole/decimals) t => timestamp l => length
|
* whole/decimals) t => timestamp l => length
|
||||||
|
@ -1303,11 +1321,11 @@ var validationTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#editmdsave').live("click", function() {
|
$('.active-tab .md-save').live("click", function() {
|
||||||
var file_id = $('#file_id').val(),
|
var file_id = $('#file_id').val(),
|
||||||
data = $("#edit-md-dialog form").serializeArray();
|
data = $(".active-tab #edit-md-dialog form").serializeArray();
|
||||||
$.post(baseUrl+'library/edit-file-md', {format: "json", id: file_id, data: data}, function() {
|
$.post(baseUrl+'library/edit-file-md', {format: "json", id: file_id, data: data}, function() {
|
||||||
$("#edit-md-dialog").dialog().remove();
|
//$("#edit-md-dialog").dialog().remove();
|
||||||
|
|
||||||
// don't redraw the library table if we are on calendar page
|
// don't redraw the library table if we are on calendar page
|
||||||
// we would be on calendar if viewing recorded file metadata
|
// we would be on calendar if viewing recorded file metadata
|
||||||
|
@ -1315,10 +1333,8 @@ $(document).ready(function() {
|
||||||
oTable.fnStandingRedraw();
|
oTable.fnStandingRedraw();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$('#editmdcancel').live("click", function() {
|
AIRTIME.playlist.closeTab();
|
||||||
$("#edit-md-dialog").dialog().remove();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#edit-md-dialog').live("keyup", function(event) {
|
$('#edit-md-dialog').live("keyup", function(event) {
|
||||||
|
@ -1326,5 +1342,51 @@ $(document).ready(function() {
|
||||||
$('#editmdsave').click();
|
$('#editmdsave').click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (location.hash === "") {
|
||||||
|
$("a[href$='#files']").parent().addClass("selected");
|
||||||
|
}
|
||||||
|
$("a[href$='"+location.hash+"']").parent().addClass("selected");
|
||||||
|
|
||||||
|
// Slightly hacky way of triggering the click event when it's outside of the anchor text
|
||||||
|
$(".media_type_selector").on("click", function() {
|
||||||
|
// Need get(0) here so we don't create a stack overflow by recurring the click on the parent
|
||||||
|
$(this).find("a").get(0).click();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(window).on('hashchange', function() {
|
||||||
|
// If we click Dashboard from one of the media views, do nothing
|
||||||
|
if (!location.hash) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AIRTIME.library.selectNone();
|
||||||
|
$(".media_type_selector").each(function () {
|
||||||
|
$(this).removeClass("selected");
|
||||||
|
});
|
||||||
|
$("a[href$='"+location.hash+"']").parent().addClass("selected");
|
||||||
|
oTable.fnDraw();
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Overridden by hashchange function
|
||||||
|
|
||||||
|
$(".media_type_selector").on("click", function() {
|
||||||
|
if (!$(this).hasClass("selected")) {
|
||||||
|
AIRTIME.library.selectNone();
|
||||||
|
$(".media_type_selector").each(function () {
|
||||||
|
$(this).removeClass("selected");
|
||||||
|
});
|
||||||
|
$(this).addClass("selected");
|
||||||
|
oTable.fnDraw();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
$("#advanced-options").on("click", function() {
|
||||||
|
resizeAdvancedSearch();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(window).resize(function() {
|
||||||
|
resizeAdvancedSearch();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,9 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$togglePl = $("<button id='pl_edit' class='btn btn-small' href='#' title='"+$.i18n._("Open Media Builder")+"'>"+$.i18n._("Open Media Builder")+"</button>"),
|
$togglePl = $("<button id='pl_edit' class='btn btn-small' href='#' title='"+$.i18n._("Open Media Builder")+"'>"+$.i18n._("Open Media Builder")+"</button>"),
|
||||||
widgetHeight,
|
widgetHeight,
|
||||||
resizeTimeout,
|
resizeTimeout,
|
||||||
width;
|
width,
|
||||||
|
$tabCount = 0,
|
||||||
|
$openTabs = {};
|
||||||
|
|
||||||
function isTimeValid(time) {
|
function isTimeValid(time) {
|
||||||
//var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$");
|
//var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$");
|
||||||
|
@ -32,7 +34,8 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
function playlistError(json) {
|
function playlistError(json) {
|
||||||
alert(json.error);
|
alert(json.error);
|
||||||
openPlaylist(json);
|
//closeTab();
|
||||||
|
//openPlaylist(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopAudioPreview() {
|
function stopAudioPreview() {
|
||||||
|
@ -67,12 +70,12 @@ var AIRTIME = (function(AIRTIME){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
var span = $(this),
|
var span = $(this),
|
||||||
id = span.parent().attr("id").split("_").pop(),
|
id = span.parent().attr("id").split("_").pop(),
|
||||||
url = baseUrl+"Playlist/set-cue",
|
url = baseUrl+"playlist/set-cue",
|
||||||
cueIn = $.trim(span.text()),
|
cueIn = $.trim(span.text()),
|
||||||
li = span.parents("li"),
|
li = span.parents("li"),
|
||||||
unqid = li.attr("unqid"),
|
unqid = li.attr("unqid"),
|
||||||
lastMod = getModified(),
|
lastMod = getModified(),
|
||||||
type = $('.obj_type').val();
|
type = $pl.find('.obj_type').val();
|
||||||
|
|
||||||
if (!isTimeValid(cueIn)){
|
if (!isTimeValid(cueIn)){
|
||||||
showError(span, $.i18n._("please put in a time '00:00:00 (.0)'"));
|
showError(span, $.i18n._("please put in a time '00:00:00 (.0)'"));
|
||||||
|
@ -93,7 +96,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
setPlaylistContent(json);
|
setPlaylistContent(json);
|
||||||
|
|
||||||
li = $('.side_playlist li[unqid='+unqid+']');
|
li = $('.side_playlist.active-tab li[unqid='+unqid+']');
|
||||||
li.find(".cue-edit").toggle();
|
li.find(".cue-edit").toggle();
|
||||||
highlightActive(li);
|
highlightActive(li);
|
||||||
highlightActive(li.find('.spl_cue'));
|
highlightActive(li.find('.spl_cue'));
|
||||||
|
@ -104,12 +107,12 @@ var AIRTIME = (function(AIRTIME){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
var span = $(this),
|
var span = $(this),
|
||||||
id = span.parent().attr("id").split("_").pop(),
|
id = span.parent().attr("id").split("_").pop(),
|
||||||
url = baseUrl+"Playlist/set-cue",
|
url = baseUrl+"playlist/set-cue",
|
||||||
cueOut = $.trim(span.text()),
|
cueOut = $.trim(span.text()),
|
||||||
li = span.parents("li"),
|
li = span.parents("li"),
|
||||||
unqid = li.attr("unqid"),
|
unqid = li.attr("unqid"),
|
||||||
lastMod = getModified(),
|
lastMod = getModified(),
|
||||||
type = $('.obj_type').val();
|
type = $pl.find('.obj_type').val();
|
||||||
|
|
||||||
if (!isTimeValid(cueOut)){
|
if (!isTimeValid(cueOut)){
|
||||||
showError(span, $.i18n._("please put in a time '00:00:00 (.0)'"));
|
showError(span, $.i18n._("please put in a time '00:00:00 (.0)'"));
|
||||||
|
@ -131,7 +134,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
setPlaylistContent(json);
|
setPlaylistContent(json);
|
||||||
|
|
||||||
li = $('.side_playlist li[unqid='+unqid+']');
|
li = $('.side_playlist.active-tab li[unqid='+unqid+']');
|
||||||
li.find(".cue-edit").toggle();
|
li.find(".cue-edit").toggle();
|
||||||
highlightActive(li);
|
highlightActive(li);
|
||||||
highlightActive(li.find('.spl_cue'));
|
highlightActive(li.find('.spl_cue'));
|
||||||
|
@ -141,9 +144,9 @@ var AIRTIME = (function(AIRTIME){
|
||||||
/* used from waveform pop-up */
|
/* used from waveform pop-up */
|
||||||
function changeCues($el, id, cueIn, cueOut) {
|
function changeCues($el, id, cueIn, cueOut) {
|
||||||
|
|
||||||
var url = baseUrl+"Playlist/set-cue",
|
var url = baseUrl+"playlist/set-cue",
|
||||||
lastMod = getModified(),
|
lastMod = getModified(),
|
||||||
type = $('.obj_type').val(),
|
type = $pl.find('.obj_type').val(),
|
||||||
li,
|
li,
|
||||||
span;
|
span;
|
||||||
|
|
||||||
|
@ -176,7 +179,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
if (json.cue_error !== undefined) {
|
if (json.cue_error !== undefined) {
|
||||||
|
|
||||||
li = $('.side_playlist li[unqid='+id+']');
|
li = $('.side_playlist.active-tab li[unqid='+id+']');
|
||||||
|
|
||||||
if (json.code === 0) {
|
if (json.code === 0) {
|
||||||
|
|
||||||
|
@ -201,7 +204,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
setPlaylistContent(json);
|
setPlaylistContent(json);
|
||||||
|
|
||||||
li = $('.side_playlist li[unqid='+id+']');
|
li = $('.side_playlist.active-tab li[unqid='+id+']');
|
||||||
li.find(".cue-edit").toggle();
|
li.find(".cue-edit").toggle();
|
||||||
highlightActive(li);
|
highlightActive(li);
|
||||||
highlightActive(li.find('.spl_cue'));
|
highlightActive(li.find('.spl_cue'));
|
||||||
|
@ -211,9 +214,9 @@ var AIRTIME = (function(AIRTIME){
|
||||||
/* used from waveform pop-up */
|
/* used from waveform pop-up */
|
||||||
function changeCrossfade($el, id1, id2, fadeIn, fadeOut, offset, id) {
|
function changeCrossfade($el, id1, id2, fadeIn, fadeOut, offset, id) {
|
||||||
|
|
||||||
var url = baseUrl+"Playlist/set-crossfade",
|
var url = baseUrl+"playlist/set-crossfade",
|
||||||
lastMod = getModified(),
|
lastMod = getModified(),
|
||||||
type = $('.obj_type').val();
|
type = $pl.find('.obj_type').val();
|
||||||
|
|
||||||
$.post(url,
|
$.post(url,
|
||||||
{format: "json", fadeIn: fadeIn, fadeOut: fadeOut, id1: id1, id2: id2, offset: offset, modified: lastMod, type: type},
|
{format: "json", fadeIn: fadeIn, fadeOut: fadeOut, id1: id1, id2: id2, offset: offset, modified: lastMod, type: type},
|
||||||
|
@ -229,7 +232,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
setPlaylistContent(json);
|
setPlaylistContent(json);
|
||||||
|
|
||||||
$li = $('.side_playlist li[unqid='+id+']');
|
$li = $pl.find('li[unqid='+id+']');
|
||||||
$li.find('.crossfade').toggle();
|
$li.find('.crossfade').toggle();
|
||||||
highlightActive($li.find('.spl_fade_control'));
|
highlightActive($li.find('.spl_fade_control'));
|
||||||
});
|
});
|
||||||
|
@ -240,12 +243,12 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
var span = $(this),
|
var span = $(this),
|
||||||
id = span.parent().attr("id").split("_").pop(),
|
id = span.parent().attr("id").split("_").pop(),
|
||||||
url = baseUrl+"Playlist/set-fade",
|
url = baseUrl+"playlist/set-fade",
|
||||||
fadeIn = $.trim(span.text()),
|
fadeIn = $.trim(span.text()),
|
||||||
li = span.parents("li"),
|
li = span.parents("li"),
|
||||||
unqid = li.attr("unqid"),
|
unqid = li.attr("unqid"),
|
||||||
lastMod = getModified(),
|
lastMod = getModified(),
|
||||||
type = $('.obj_type').val();
|
type = $pl.find('.obj_type').val();
|
||||||
|
|
||||||
if (!isFadeValid(fadeIn)){
|
if (!isFadeValid(fadeIn)){
|
||||||
showError(span, $.i18n._("please put in a time in seconds '00 (.0)'"));
|
showError(span, $.i18n._("please put in a time in seconds '00 (.0)'"));
|
||||||
|
@ -267,7 +270,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
setPlaylistContent(json);
|
setPlaylistContent(json);
|
||||||
|
|
||||||
li = $('.side_playlist li[unqid='+unqid+']');
|
li = $pl.find('li[unqid='+unqid+']');
|
||||||
li.find('.crossfade').toggle();
|
li.find('.crossfade').toggle();
|
||||||
highlightActive(li.find('.spl_fade_control'));
|
highlightActive(li.find('.spl_fade_control'));
|
||||||
});
|
});
|
||||||
|
@ -278,12 +281,12 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
var span = $(this),
|
var span = $(this),
|
||||||
id = span.parent().attr("id").split("_").pop(),
|
id = span.parent().attr("id").split("_").pop(),
|
||||||
url = baseUrl+"Playlist/set-fade",
|
url = baseUrl+"playlist/set-fade",
|
||||||
fadeOut = $.trim(span.text()),
|
fadeOut = $.trim(span.text()),
|
||||||
li = span.parents("li"),
|
li = span.parents("li"),
|
||||||
unqid = li.attr("unqid"),
|
unqid = li.attr("unqid"),
|
||||||
lastMod = getModified(),
|
lastMod = getModified(),
|
||||||
type = $('.obj_type').val();
|
type = $pl.find('.obj_type').val();
|
||||||
|
|
||||||
if (!isFadeValid(fadeOut)){
|
if (!isFadeValid(fadeOut)){
|
||||||
showError(span, $.i18n._("please put in a time in seconds '00 (.0)'"));
|
showError(span, $.i18n._("please put in a time in seconds '00 (.0)'"));
|
||||||
|
@ -305,7 +308,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
setPlaylistContent(json);
|
setPlaylistContent(json);
|
||||||
|
|
||||||
li = $('.side_playlist li[unqid='+unqid+']');
|
li = $pl.find('li[unqid='+unqid+']');
|
||||||
li.find('.crossfade').toggle();
|
li.find('.crossfade').toggle();
|
||||||
highlightActive(li.find('.spl_fade_control'));
|
highlightActive(li.find('.spl_fade_control'));
|
||||||
});
|
});
|
||||||
|
@ -355,30 +358,12 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
|
|
||||||
function editName() {
|
function editName() {
|
||||||
var nameElement = $(this),
|
var nameElement = $(this);
|
||||||
lastMod = getModified(),
|
|
||||||
type = $('.obj_type').val();
|
|
||||||
//remove any newlines if user somehow snuck them in (easy to do if dragging/dropping text)
|
//remove any newlines if user somehow snuck them in (easy to do if dragging/dropping text)
|
||||||
nameElement.text(nameElement.text().replace("\n", ""));
|
nameElement.text(nameElement.text().replace("\n", ""));
|
||||||
|
|
||||||
/* --until we decide whether Playlist name should autosave or not
|
var name = $pl.find(".playlist_name_display").text();
|
||||||
|
$(".nav.nav-tabs .active a > span.tab-name").text(name);
|
||||||
url = baseUrl+'Playlist/set-playlist-name';
|
|
||||||
|
|
||||||
$.post(url,
|
|
||||||
{format: "json", name: nameElement.text(), modified: lastMod, type: type},
|
|
||||||
function(json){
|
|
||||||
|
|
||||||
if (json.error !== undefined) {
|
|
||||||
playlistError(json);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
setModified(json.modified);
|
|
||||||
nameElement.text(json.playlistName);
|
|
||||||
redrawLib();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function redrawLib() {
|
function redrawLib() {
|
||||||
|
@ -394,15 +379,15 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$('#spl_name > a')
|
$('#spl_name > a')
|
||||||
.empty()
|
.empty()
|
||||||
.append(json.name);
|
.append(json.name);
|
||||||
$('.obj_length')
|
$pl.find('.obj_length')
|
||||||
.empty()
|
.empty()
|
||||||
.append(json.length);
|
.append(json.length);
|
||||||
$('#fieldset-metadate_change textarea')
|
$('#fieldset-metadate_change textarea')
|
||||||
.empty()
|
.empty()
|
||||||
.val(json.description);
|
.val(json.description);
|
||||||
|
|
||||||
$('.spl_sortable').off('focusout keydown');
|
$pl.find('.spl_sortable').off('focusout keydown');
|
||||||
$('.spl_sortable')
|
$pl.find('.spl_sortable')
|
||||||
.empty()
|
.empty()
|
||||||
.append($html);
|
.append($html);
|
||||||
setCueEvents();
|
setCueEvents();
|
||||||
|
@ -413,12 +398,12 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
|
|
||||||
function setFadeIcon(){
|
function setFadeIcon(){
|
||||||
var contents = $(".spl_sortable");
|
var contents = $pl.find(".spl_sortable");
|
||||||
var show = contents.is(":visible");
|
var show = contents.is(":visible");
|
||||||
var empty = $(".spl_empty");
|
var empty = $pl.find(".spl_empty");
|
||||||
|
|
||||||
if (!show || empty.length > 0) {
|
if (!show || empty.length > 0) {
|
||||||
$("#spl_crossfade").hide();
|
$pl.find("#spl_crossfade").hide();
|
||||||
} else {
|
} else {
|
||||||
//get list of playlist contents
|
//get list of playlist contents
|
||||||
var list = contents.children();
|
var list = contents.children();
|
||||||
|
@ -428,33 +413,95 @@ var AIRTIME = (function(AIRTIME){
|
||||||
var last = list.last();
|
var last = list.last();
|
||||||
if (first.find(':first-child').children().attr('blockid') !== undefined &&
|
if (first.find(':first-child').children().attr('blockid') !== undefined &&
|
||||||
last.find(':first-child').children().attr('blockid') !== undefined) {
|
last.find(':first-child').children().attr('blockid') !== undefined) {
|
||||||
$("#spl_crossfade").hide();
|
$pl.find("#spl_crossfade").hide();
|
||||||
} else {
|
} else {
|
||||||
$("#spl_crossfade").show();
|
$pl.find("#spl_crossfade").show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getId() {
|
function getId() {
|
||||||
return parseInt($(".obj_id").val(), 10);
|
return parseInt($pl.find(".obj_id").val(), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getModified() {
|
function getModified() {
|
||||||
return parseInt($(".obj_lastMod").val(), 10);
|
return parseInt($pl.find(".obj_lastMod").val(), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setModified(modified) {
|
function setModified(modified) {
|
||||||
$(".obj_lastMod").val(modified);
|
$pl.find(".obj_lastMod").val(modified);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Should all be moved to builder.js eventually
|
||||||
|
*/
|
||||||
|
function buildNewTab(json) {
|
||||||
|
AIRTIME.library.selectNone();
|
||||||
|
|
||||||
|
var tabId = $openTabs[json.type + json.id];
|
||||||
|
if (tabId !== undefined) {
|
||||||
|
AIRTIME.showbuilder.switchTab($("#pl-tab-content-" + tabId), $("#pl-tab-" + tabId));
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
$tabCount++;
|
||||||
|
|
||||||
|
var wrapper = "<div tab-type='" + json.type + "' tab-id='" + $tabCount + "' id='pl-tab-content-" + $tabCount + "' class='side_playlist pl-content'><div class='editor_pane_wrapper'></div></div>",
|
||||||
|
t = $("#show_builder").append(wrapper).find("#pl-tab-content-" + $tabCount),
|
||||||
|
pane = $(".editor_pane_wrapper:last"),
|
||||||
|
name = json.type == "md" ? // file
|
||||||
|
pane.append(json.html).find("#track_title").val() + $.i18n._(" - Metadata Editor")
|
||||||
|
: pane.append(json.html).find(".playlist_name_display").text(),
|
||||||
|
tab =
|
||||||
|
"<li tab-id='" + $tabCount + "' tab-type='" + json.type + "' id='pl-tab-" + $tabCount + "' role='presentation' class='active'>" +
|
||||||
|
"<a href='#'><span class='tab-name'></span>" +
|
||||||
|
"<span href='#' class='lib_pl_close icon-remove'></span>" +
|
||||||
|
"</a>" +
|
||||||
|
"</li>",
|
||||||
|
tabs = $(".nav.nav-tabs");
|
||||||
|
|
||||||
|
if (json.id) {
|
||||||
|
$openTabs[json.type + json.id] = $tabCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(".nav.nav-tabs li").removeClass("active");
|
||||||
|
tabs.append(tab);
|
||||||
|
tabs.find("#pl-tab-" + $tabCount + " span.tab-name").text(name);
|
||||||
|
|
||||||
|
var newTab = $("#pl-tab-" + $tabCount);
|
||||||
|
AIRTIME.showbuilder.switchTab(t, newTab);
|
||||||
|
|
||||||
|
return {wrapper: pane, tab: newTab, pane: t};
|
||||||
|
}
|
||||||
|
|
||||||
|
function openFileMdEditor(json) {
|
||||||
|
var newTab = buildNewTab(json);
|
||||||
|
if (newTab === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
newTab.tab.on("click", function() {
|
||||||
|
if (!$(this).hasClass('active')) {
|
||||||
|
AIRTIME.showbuilder.switchTab(newTab.pane, newTab.tab);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
newTab.wrapper.find(".md-cancel").on("click", function() {
|
||||||
|
closeTab();
|
||||||
|
});
|
||||||
|
initialEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
function openPlaylist(json) {
|
function openPlaylist(json) {
|
||||||
$(".side_playlist")
|
var newTab = buildNewTab(json);
|
||||||
.empty()
|
if (newTab === undefined) {
|
||||||
.append(json.html);
|
return;
|
||||||
|
}
|
||||||
setUpPlaylist();
|
newTab.tab.on("click", function() {
|
||||||
setCueEvents();
|
if (!$(this).hasClass('active')) {
|
||||||
setFadeEvents();
|
AIRTIME.showbuilder.switchTab(newTab.pane, newTab.tab);
|
||||||
|
$.post(baseUrl+'playlist/edit',
|
||||||
|
{format: "json", id: newTab.pane.find(".obj_id").val(), type: newTab.pane.find(".obj_type").val()});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AIRTIME.playlist.init();
|
||||||
|
|
||||||
// functions in smart_blockbuilder.js
|
// functions in smart_blockbuilder.js
|
||||||
setupUI();
|
setupUI();
|
||||||
|
@ -464,16 +511,38 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
|
|
||||||
function openPlaylistPanel() {
|
function openPlaylistPanel() {
|
||||||
var screenWidth = Math.floor(viewport.width - 40);
|
|
||||||
viewport = AIRTIME.utilities.findViewportDimensions();
|
viewport = AIRTIME.utilities.findViewportDimensions();
|
||||||
|
var screenWidth = Math.floor(viewport.width - 40);
|
||||||
widgetHeight = viewport.height - 185;
|
widgetHeight = viewport.height - 185;
|
||||||
|
|
||||||
$lib.width(Math.floor(screenWidth * 0.53));
|
|
||||||
$pl.show().width(Math.floor(screenWidth * 0.44));
|
$pl.show().width(Math.floor(screenWidth * 0.44));
|
||||||
$pl.height(widgetHeight);
|
$pl.height(widgetHeight);
|
||||||
$("#pl_edit").hide();
|
$("#pl_edit").hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeTab(id) {
|
||||||
|
var curr = $(".active-tab"),
|
||||||
|
pane = id ? $(".pl-content[tab-id='" + id + "']") : curr,
|
||||||
|
tab = id ? $(".nav.nav-tabs [tab-id='" + id + "']") : $(".nav.nav-tabs .active"),
|
||||||
|
toPane = pane.next().length > 0 ? pane.next() : pane.prev(),
|
||||||
|
toTab = tab.next().length > 0 ? tab.next() : tab.prev(),
|
||||||
|
objId = pane.find(".obj_id").val(),
|
||||||
|
pl = id ? pane : $pl;
|
||||||
|
delete $openTabs[tab.attr("tab-type") + objId]; // Remove the closed tab from our open tabs array
|
||||||
|
|
||||||
|
// Remove the relevant DOM elements (the tab and the tab content)
|
||||||
|
tab.remove();
|
||||||
|
pl.remove();
|
||||||
|
|
||||||
|
if (pane.get(0) == curr.get(0)) { // Closing the current tab, otherwise we don't need to switch tabs
|
||||||
|
AIRTIME.showbuilder.switchTab(toPane, toTab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mod.closeTab = function(id) {
|
||||||
|
closeTab(id);
|
||||||
|
};
|
||||||
|
|
||||||
//Purpose of this function is to iterate over all playlist elements
|
//Purpose of this function is to iterate over all playlist elements
|
||||||
//and verify whether they can be previewed by the browser or not. If not
|
//and verify whether they can be previewed by the browser or not. If not
|
||||||
//then the playlist element is greyed out
|
//then the playlist element is greyed out
|
||||||
|
@ -505,7 +574,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
position: {
|
position: {
|
||||||
my: "left bottom",
|
my: "left bottom",
|
||||||
at: "right center"
|
at: "right center"
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -529,18 +598,17 @@ var AIRTIME = (function(AIRTIME){
|
||||||
position: {
|
position: {
|
||||||
my: "left bottom",
|
my: "left bottom",
|
||||||
at: "right center"
|
at: "right center"
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
$(value).bind("click", openAudioPreview);
|
$(value).bind("click", openAudioPreview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
//sets events dynamically for playlist entries (each row in the playlist)
|
//sets events dynamically for playlist entries (each row in the playlist)
|
||||||
function setPlaylistEntryEvents() {
|
function setPlaylistEntryEvents() {
|
||||||
|
|
||||||
$pl.delegate(".spl_sortable .ui-icon-closethick",
|
$pl.delegate(".spl_sortable .ui-icon-closethick",
|
||||||
{"click": function(ev){
|
{"click": function(ev){
|
||||||
var id;
|
var id;
|
||||||
|
@ -608,7 +676,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
//sets events dynamically for the cue editor.
|
//sets events dynamically for the cue editor.
|
||||||
function setCueEvents() {
|
function setCueEvents() {
|
||||||
var temp = $('.spl_sortable');
|
var temp = $('.active-tab .spl_sortable');
|
||||||
temp.on("focusout", ".spl_cue_in span", changeCueIn);
|
temp.on("focusout", ".spl_cue_in span", changeCueIn);
|
||||||
temp.on("keydown", ".spl_cue_in span", submitOnEnter);
|
temp.on("keydown", ".spl_cue_in span", submitOnEnter);
|
||||||
|
|
||||||
|
@ -625,7 +693,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
//sets events dynamically for the fade editor.
|
//sets events dynamically for the fade editor.
|
||||||
function setFadeEvents() {
|
function setFadeEvents() {
|
||||||
var temp = $('.spl_sortable');
|
var temp = $('.active-tab .spl_sortable');
|
||||||
temp.on("focusout", ".spl_fade_in span", changeFadeIn);
|
temp.on("focusout", ".spl_fade_in span", changeFadeIn);
|
||||||
temp.on("keydown", ".spl_fade_in span", submitOnEnter);
|
temp.on("keydown", ".spl_fade_in span", submitOnEnter);
|
||||||
|
|
||||||
|
@ -646,7 +714,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
//main playlist fades events
|
//main playlist fades events
|
||||||
$pl.on("click", "#spl_crossfade", function() {
|
$pl.on("click", "#spl_crossfade", function() {
|
||||||
var lastMod = getModified(),
|
var lastMod = getModified(),
|
||||||
type = $('.obj_type').val();
|
type = $pl.find('.obj_type').val();
|
||||||
|
|
||||||
if ($(this).hasClass("ui-state-active")) {
|
if ($(this).hasClass("ui-state-active")) {
|
||||||
$(this).removeClass("ui-state-active");
|
$(this).removeClass("ui-state-active");
|
||||||
|
@ -655,7 +723,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
else {
|
else {
|
||||||
$(this).addClass("ui-state-active");
|
$(this).addClass("ui-state-active");
|
||||||
|
|
||||||
var url = baseUrl+'Playlist/get-playlist-fades';
|
var url = baseUrl+'playlist/get-playlist-fades';
|
||||||
$.post(url,
|
$.post(url,
|
||||||
{format: "json", modified: lastMod, type: type},
|
{format: "json", modified: lastMod, type: type},
|
||||||
function(json){
|
function(json){
|
||||||
|
@ -692,11 +760,11 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$pl.on("blur", "span.spl_main_fade_in", function(event){
|
$pl.on("blur", "span.spl_main_fade_in", function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
var url = baseUrl+"Playlist/set-playlist-fades",
|
var url = baseUrl+"playlist/set-playlist-fades",
|
||||||
span = $(this),
|
span = $(this),
|
||||||
fadeIn = $.trim(span.text()),
|
fadeIn = $.trim(span.text()),
|
||||||
lastMod = getModified(),
|
lastMod = getModified(),
|
||||||
type = $('.obj_type').val();
|
type = $pl.find('.obj_type').val();
|
||||||
|
|
||||||
if (!isFadeValid(fadeIn)){
|
if (!isFadeValid(fadeIn)){
|
||||||
showError(span, $.i18n._("please put in a time in seconds '00 (.0)'"));
|
showError(span, $.i18n._("please put in a time in seconds '00 (.0)'"));
|
||||||
|
@ -716,11 +784,11 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$pl.on("blur", "span.spl_main_fade_out", function(event){
|
$pl.on("blur", "span.spl_main_fade_out", function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
var url = baseUrl+"Playlist/set-playlist-fades",
|
var url = baseUrl+"playlist/set-playlist-fades",
|
||||||
span = $(this),
|
span = $(this),
|
||||||
fadeOut = $.trim(span.text()),
|
fadeOut = $.trim(span.text()),
|
||||||
lastMod = getModified(),
|
lastMod = getModified(),
|
||||||
type = $('.obj_type').val();
|
type = $pl.find('.obj_type').val();
|
||||||
|
|
||||||
if (!isFadeValid(fadeOut)){
|
if (!isFadeValid(fadeOut)){
|
||||||
showError(span, $.i18n._("please put in a time in seconds '00 (.0)'"));
|
showError(span, $.i18n._("please put in a time in seconds '00 (.0)'"));
|
||||||
|
@ -764,15 +832,18 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
|
|
||||||
$pl.on("click", 'button[id="playlist_shuffle_button"]', function(){
|
$pl.on("click", 'button[id="playlist_shuffle_button"]', function(){
|
||||||
obj_id = $('input[id="obj_id"]').val();
|
obj_id = $pl.find('.obj_id').val();
|
||||||
url = baseUrl+"Playlist/shuffle";
|
url = baseUrl+"playlist/shuffle";
|
||||||
enableLoadingIcon();
|
enableLoadingIcon();
|
||||||
$.post(url, {format: "json", obj_id: obj_id}, function(json){
|
$.post(url, {format: "json", obj_id: obj_id}, function(json){
|
||||||
|
|
||||||
if (json.error !== undefined) {
|
if (json.error !== undefined) {
|
||||||
alert(json.error);
|
alert(json.error);
|
||||||
}
|
}
|
||||||
AIRTIME.playlist.fnOpenPlaylist(json);
|
if (json.html !== undefined) {
|
||||||
|
closeTab();
|
||||||
|
openPlaylist(json);
|
||||||
|
}
|
||||||
if (json.result == "0") {
|
if (json.result == "0") {
|
||||||
$pl.find('.success').text($.i18n._('Playlist shuffled'));
|
$pl.find('.success').text($.i18n._('Playlist shuffled'));
|
||||||
$pl.find('.success').show();
|
$pl.find('.success').show();
|
||||||
|
@ -780,9 +851,9 @@ var AIRTIME = (function(AIRTIME){
|
||||||
disableLoadingIcon();
|
disableLoadingIcon();
|
||||||
setTimeout(removeSuccessMsg, 5000);
|
setTimeout(removeSuccessMsg, 5000);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
$pl.on("click", "#webstream_save", function(){
|
$pl.find("#webstream_save").on("click", function(){
|
||||||
//get all fields and POST to server
|
//get all fields and POST to server
|
||||||
//description
|
//description
|
||||||
//stream url
|
//stream url
|
||||||
|
@ -795,9 +866,9 @@ var AIRTIME = (function(AIRTIME){
|
||||||
var name = $pl.find(".playlist_name_display").text();
|
var name = $pl.find(".playlist_name_display").text();
|
||||||
|
|
||||||
//hide any previous errors (if any)
|
//hide any previous errors (if any)
|
||||||
$(".side_playlist .errors").empty().hide();
|
$(".side_playlist.active-tab .errors").empty().hide();
|
||||||
|
|
||||||
var url = baseUrl+'Webstream/save';
|
var url = baseUrl+'webstream/save';
|
||||||
$.post(url,
|
$.post(url,
|
||||||
{format: "json", id:id, description: description, url:streamurl, length: length, name: name},
|
{format: "json", id:id, description: description, url:streamurl, length: length, name: name},
|
||||||
function(json){
|
function(json){
|
||||||
|
@ -807,23 +878,23 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
if (!field[0]) {
|
if (!field[0]) {
|
||||||
var elemId = "#"+s+"-error";
|
var elemId = "#"+s+"-error";
|
||||||
var $div = $(".side_playlist " + elemId).text(field[1]).show();
|
var $div = $(".side_playlist.active-tab " + elemId).text(field[1]).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var $status = $(".side_playlist .status");
|
var $status = $(".side_playlist.active-tab .status");
|
||||||
$status.html(json.statusMessage);
|
$status.html(json.statusMessage);
|
||||||
$status.show();
|
$status.show();
|
||||||
setTimeout(function(){$status.fadeOut("slow", function(){$status.empty()})}, 5000);
|
setTimeout(function(){$status.fadeOut("slow", function(){$status.empty()})}, 5000);
|
||||||
|
|
||||||
var $ws_id = $(".obj_id");
|
var $ws_id = $(".active-tab .obj_id");
|
||||||
$ws_id.attr("value", json.streamId);
|
$ws_id.attr("value", json.streamId);
|
||||||
|
|
||||||
var $ws_id = $("#ws_delete");
|
var $ws_id = $("#ws_delete");
|
||||||
$ws_id.show();
|
$ws_id.show();
|
||||||
|
|
||||||
|
|
||||||
var length = $(".side_playlist .ws_length");
|
var length = $(".side_playlist.active-tab .ws_length");
|
||||||
length.text(json.length);
|
length.text(json.length);
|
||||||
|
|
||||||
//redraw the library to show the new webstream
|
//redraw the library to show the new webstream
|
||||||
|
@ -835,6 +906,11 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$pl.find("#webstream_cancel, #cancel_button").on("click", function() {
|
||||||
|
var tabId = $pl.attr("tab-id");
|
||||||
|
$("li[tab-id=" + tabId + "] .lib_pl_close").click();
|
||||||
|
});
|
||||||
|
|
||||||
$lib.on("click", "#pl_edit", function() {
|
$lib.on("click", "#pl_edit", function() {
|
||||||
openPlaylistPanel();
|
openPlaylistPanel();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
@ -850,10 +926,31 @@ var AIRTIME = (function(AIRTIME){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$pl.on("click", "#lib_pl_close", function() {
|
// Unbind so each tab is only handled by its own close button
|
||||||
var screenWidth = Math.floor(viewport.width - 40);
|
$(".lib_pl_close").unbind().click(function(e) {
|
||||||
$pl.hide();
|
e.preventDefault();
|
||||||
$lib.width(screenWidth).find("#library_display_length").append($togglePl.show());
|
e.stopPropagation();
|
||||||
|
|
||||||
|
$(this).unbind("click"); // Prevent repeated clicks in quick succession from closing multiple tabs
|
||||||
|
|
||||||
|
var tabId = $(this).closest("li").attr("tab-id");
|
||||||
|
//AIRTIME.showbuilder.switchTab($("#pl-tab-content-" + tabId), $("#pl-tab-" + tabId));
|
||||||
|
//$pl.hide();
|
||||||
|
|
||||||
|
// We need to update the text on the add button
|
||||||
|
AIRTIME.library.checkAddButton();
|
||||||
|
// We also need to run the draw callback to update how dragged items are drawn
|
||||||
|
AIRTIME.library.fnDrawCallback();
|
||||||
|
|
||||||
|
var name = $pl.find('.playlist_name_display').text().trim();
|
||||||
|
|
||||||
|
if ((name == "Untitled Playlist"
|
||||||
|
|| name == "Untitled Smart Block")
|
||||||
|
&& $pl.find(".spl_sortable .spl_empty").length == 1) {
|
||||||
|
mod.fnDelete(undefined, tabId);
|
||||||
|
} else {
|
||||||
|
closeTab(tabId);
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
url : baseUrl+"usersettings/set-library-screen-settings",
|
url : baseUrl+"usersettings/set-library-screen-settings",
|
||||||
|
@ -868,16 +965,16 @@ var AIRTIME = (function(AIRTIME){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#save_button').live("click", function(event){
|
$pl.on("click", "#save_button", function(event) {
|
||||||
/* Smart blocks: get name, description, and criteria
|
/* Smart blocks: get name, description, and criteria
|
||||||
* Playlists: get name, description
|
* Playlists: get name, description
|
||||||
*/
|
*/
|
||||||
var criteria = $('form').serializeArray(),
|
var criteria = $pl.find('form').serializeArray(),
|
||||||
block_name = $('.playlist_name_display').text(),
|
block_name = $pl.find('.playlist_name_display').text(),
|
||||||
block_desc = $('textarea[name="description"]').val(),
|
block_desc = $pl.find('textarea[name="description"]').val(),
|
||||||
save_action = baseUrl+'Playlist/save',
|
save_action = baseUrl+'playlist/save',
|
||||||
obj_id = $('input[id="obj_id"]').val(),
|
obj_id = $pl.find(".obj_id").val(),
|
||||||
obj_type = $('.obj_type').val(),
|
obj_type = $pl.find('.obj_type').val(),
|
||||||
lastMod = getModified(),
|
lastMod = getModified(),
|
||||||
dt = $('table[id="library_display"]').dataTable();
|
dt = $('table[id="library_display"]').dataTable();
|
||||||
enableLoadingIcon();
|
enableLoadingIcon();
|
||||||
|
@ -888,7 +985,8 @@ var AIRTIME = (function(AIRTIME){
|
||||||
alert(json.error);
|
alert(json.error);
|
||||||
}
|
}
|
||||||
if (json.html !== undefined) {
|
if (json.html !== undefined) {
|
||||||
AIRTIME.playlist.fnOpenPlaylist(json);
|
closeTab();
|
||||||
|
openPlaylist(json);
|
||||||
}
|
}
|
||||||
setModified(json.modified);
|
setModified(json.modified);
|
||||||
if (obj_type == "block") {
|
if (obj_type == "block") {
|
||||||
|
@ -905,7 +1003,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#pl-bl-clear-content").live("click", function(event) {
|
$pl.find("#pl-bl-clear-content").unbind().on("click", function(event) {
|
||||||
var sUrl = baseUrl+"playlist/empty-content",
|
var sUrl = baseUrl+"playlist/empty-content",
|
||||||
oData = {};
|
oData = {};
|
||||||
playlistRequest(sUrl, oData);
|
playlistRequest(sUrl, oData);
|
||||||
|
@ -983,7 +1081,6 @@ var AIRTIME = (function(AIRTIME){
|
||||||
//http://stackoverflow.com/questions/2150002/jquery-ui-sortable-how-can-i-change-the-appearance-of-the-placeholder-object
|
//http://stackoverflow.com/questions/2150002/jquery-ui-sortable-how-can-i-change-the-appearance-of-the-placeholder-object
|
||||||
placeholder: {
|
placeholder: {
|
||||||
element: function(currentItem) {
|
element: function(currentItem) {
|
||||||
|
|
||||||
return $('<li class="placeholder ui-state-highlight"></li>')[0];
|
return $('<li class="placeholder ui-state-highlight"></li>')[0];
|
||||||
},
|
},
|
||||||
update: function(container, p) {
|
update: function(container, p) {
|
||||||
|
@ -991,10 +1088,12 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
forcePlaceholderSize: true,
|
forcePlaceholderSize: true,
|
||||||
handle: 'div.list-item-container',
|
//handle: 'div.list-item-container',
|
||||||
start: function(event, ui) {
|
start: function(event, ui) {
|
||||||
ui.placeholder.height(56);
|
ui.placeholder.height(56);
|
||||||
},
|
},
|
||||||
|
axis: "y",
|
||||||
|
containment: "document",
|
||||||
receive: fnReceive,
|
receive: fnReceive,
|
||||||
update: fnUpdate
|
update: fnUpdate
|
||||||
};
|
};
|
||||||
|
@ -1005,7 +1104,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
|
|
||||||
mod.fnNew = function() {
|
mod.fnNew = function() {
|
||||||
var url = baseUrl+'Playlist/new';
|
var url = baseUrl+'playlist/new';
|
||||||
|
|
||||||
stopAudioPreview();
|
stopAudioPreview();
|
||||||
|
|
||||||
|
@ -1018,7 +1117,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.fnWsNew = function() {
|
mod.fnWsNew = function() {
|
||||||
var url = baseUrl+'Webstream/new';
|
var url = baseUrl+'webstream/new';
|
||||||
|
|
||||||
stopAudioPreview();
|
stopAudioPreview();
|
||||||
|
|
||||||
|
@ -1032,7 +1131,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
|
|
||||||
mod.fnNewBlock = function() {
|
mod.fnNewBlock = function() {
|
||||||
var url = baseUrl+'Playlist/new';
|
var url = baseUrl+'playlist/new';
|
||||||
|
|
||||||
stopAudioPreview();
|
stopAudioPreview();
|
||||||
|
|
||||||
|
@ -1044,33 +1143,36 @@ var AIRTIME = (function(AIRTIME){
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod.fileMdEdit = function(json) {
|
||||||
|
openFileMdEditor(json);
|
||||||
|
};
|
||||||
|
|
||||||
mod.fnEdit = function(id, type, url) {
|
mod.fnEdit = function(id, type, url) {
|
||||||
if ($pl.is(":hidden")) {
|
//openPlaylistPanel();
|
||||||
openPlaylistPanel();
|
|
||||||
}
|
|
||||||
stopAudioPreview();
|
stopAudioPreview();
|
||||||
|
|
||||||
$.post(url,
|
$.post(url,
|
||||||
{format: "json", id: id, type: type},
|
{format: "json", id: id, type: type},
|
||||||
function(json){
|
function(json){
|
||||||
openPlaylist(json);
|
openPlaylist(json);
|
||||||
|
redrawLib();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
mod.fnDelete = function(plid) {
|
mod.fnDelete = function(plid, tabId) {
|
||||||
var url, id, lastMod;
|
var url, id, lastMod, type, pl = (tabId === undefined) ? $pl : $('#pl-tab-content-' + tabId);
|
||||||
|
|
||||||
stopAudioPreview();
|
stopAudioPreview();
|
||||||
id = (plid === undefined) ? getId() : plid;
|
id = (plid === undefined) ? getId() : plid;
|
||||||
lastMod = getModified();
|
lastMod = getModified();
|
||||||
type = $('.obj_type').val();
|
type = pl.find('.obj_type').val();
|
||||||
url = baseUrl+'Playlist/delete';
|
url = baseUrl+'playlist/delete';
|
||||||
|
|
||||||
$.post(url,
|
$.post(url,
|
||||||
{format: "json", ids: id, modified: lastMod, type: type},
|
{format: "json", ids: id, modified: lastMod, type: type},
|
||||||
function(json) {
|
function(json) {
|
||||||
openPlaylist(json);
|
closeTab(tabId);
|
||||||
redrawLib();
|
redrawLib();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1081,8 +1183,8 @@ var AIRTIME = (function(AIRTIME){
|
||||||
stopAudioPreview();
|
stopAudioPreview();
|
||||||
id = (wsid === undefined) ? getId() : wsid;
|
id = (wsid === undefined) ? getId() : wsid;
|
||||||
lastMod = getModified();
|
lastMod = getModified();
|
||||||
type = $('.obj_type').val();
|
type = $pl.find('.obj_type').val();
|
||||||
url = baseUrl+'Webstream/delete';
|
url = baseUrl+'webstream/delete';
|
||||||
|
|
||||||
$.post(url,
|
$.post(url,
|
||||||
{format: "json", ids: id, modified: lastMod, type: type},
|
{format: "json", ids: id, modified: lastMod, type: type},
|
||||||
|
@ -1112,18 +1214,13 @@ var AIRTIME = (function(AIRTIME){
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.enableUI = function() {
|
mod.enableUI = function() {
|
||||||
|
|
||||||
$lib.unblock();
|
$lib.unblock();
|
||||||
$pl.unblock();
|
$pl.unblock();
|
||||||
|
|
||||||
//Block UI changes the postion to relative to display the messages.
|
|
||||||
$lib.css("position", "static");
|
|
||||||
$pl.css("position", "static");
|
|
||||||
setupUI();
|
setupUI();
|
||||||
};
|
};
|
||||||
|
|
||||||
function playlistResponse(json){
|
function playlistResponse(json){
|
||||||
|
|
||||||
if (json.error !== undefined) {
|
if (json.error !== undefined) {
|
||||||
playlistError(json);
|
playlistError(json);
|
||||||
}
|
}
|
||||||
|
@ -1137,7 +1234,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
function playlistRequest(sUrl, oData) {
|
function playlistRequest(sUrl, oData) {
|
||||||
var lastMod,
|
var lastMod,
|
||||||
obj_type = $('.obj_type').val();
|
obj_type = $pl.find('.obj_type').val();
|
||||||
|
|
||||||
mod.disableUI();
|
mod.disableUI();
|
||||||
|
|
||||||
|
@ -1155,6 +1252,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
|
|
||||||
mod.fnAddItems = function(aItems, iAfter, sAddType) {
|
mod.fnAddItems = function(aItems, iAfter, sAddType) {
|
||||||
|
AIRTIME.library.selectNone();
|
||||||
var sUrl = baseUrl+"playlist/add-items";
|
var sUrl = baseUrl+"playlist/add-items";
|
||||||
oData = {"aItems": aItems, "afterItem": iAfter, "type": sAddType};
|
oData = {"aItems": aItems, "afterItem": iAfter, "type": sAddType};
|
||||||
playlistRequest(sUrl, oData);
|
playlistRequest(sUrl, oData);
|
||||||
|
@ -1401,33 +1499,20 @@ var AIRTIME = (function(AIRTIME){
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod.setAsActive = function() {
|
||||||
|
$pl = $(".active-tab");
|
||||||
|
};
|
||||||
|
|
||||||
mod.init = function() {
|
mod.init = function() {
|
||||||
/*
|
AIRTIME.playlist.setAsActive();
|
||||||
$.contextMenu({
|
|
||||||
selector: '#spl_new, #ws_new',
|
|
||||||
trigger: "left",
|
|
||||||
ignoreRightClick: true,
|
|
||||||
items: {
|
|
||||||
"sp": {name: "New Playlist", callback: AIRTIME.playlist.fnNew},
|
|
||||||
"sb": {name: "New Smart Block", callback: AIRTIME.playlist.fnNewBlock},
|
|
||||||
"ws": {name: "New Webstream", callback: AIRTIME.playlist.fnWsNew}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
$('#lib-new-pl').live('click', function(){AIRTIME.playlist.fnNew();});
|
|
||||||
$('#lib-new-bl').live('click', function(){AIRTIME.playlist.fnNewBlock();});
|
|
||||||
$('#lib-new-ws').live('click', function(){AIRTIME.playlist.fnWsNew();});
|
|
||||||
/*
|
|
||||||
$pl.delegate("#spl_new",
|
|
||||||
{"click": AIRTIME.playlist.fnNew});*/
|
|
||||||
|
|
||||||
$pl.delegate("#spl_delete", {"click": function(ev){
|
//$pl.delegate("#spl_delete", {"click": function(ev){
|
||||||
AIRTIME.playlist.fnDelete();
|
// AIRTIME.playlist.fnDelete();
|
||||||
}});
|
//}});
|
||||||
|
//
|
||||||
$pl.delegate("#ws_delete", {"click": function(ev){
|
//$pl.delegate("#ws_delete", {"click": function(ev){
|
||||||
AIRTIME.playlist.fnWsDelete();
|
// AIRTIME.playlist.fnWsDelete();
|
||||||
}});
|
//}});
|
||||||
|
|
||||||
$pl.delegate(".pl-waveform-cues-btn", {"click": function(ev){
|
$pl.delegate(".pl-waveform-cues-btn", {"click": function(ev){
|
||||||
AIRTIME.playlist.showCuesWaveform(ev);
|
AIRTIME.playlist.showCuesWaveform(ev);
|
||||||
|
@ -1444,45 +1529,6 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
initialEvents();
|
initialEvents();
|
||||||
setUpPlaylist();
|
setUpPlaylist();
|
||||||
};
|
|
||||||
|
|
||||||
function setWidgetSize() {
|
|
||||||
viewport = AIRTIME.utilities.findViewportDimensions();
|
|
||||||
widgetHeight = viewport.height - 185;
|
|
||||||
width = Math.floor(viewport.width - 80);
|
|
||||||
|
|
||||||
var libTableHeight = widgetHeight - 175;
|
|
||||||
|
|
||||||
if (!$pl.is(':hidden')) {
|
|
||||||
$lib.height(widgetHeight)
|
|
||||||
.find(".dataTables_scrolling")
|
|
||||||
.css("max-height", libTableHeight)
|
|
||||||
.end()
|
|
||||||
.width(Math.floor(width * 0.54));
|
|
||||||
|
|
||||||
$pl.height(widgetHeight)
|
|
||||||
.width(Math.floor(width * 0.45));
|
|
||||||
} else {
|
|
||||||
$lib.height(widgetHeight)
|
|
||||||
.find(".dataTables_scrolling")
|
|
||||||
.css("max-height", libTableHeight)
|
|
||||||
.end()
|
|
||||||
.width(width + 40);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod.onReady = function() {
|
|
||||||
$lib = $("#library_content");
|
|
||||||
$pl = $(".side_playlist");
|
|
||||||
|
|
||||||
setWidgetSize();
|
|
||||||
|
|
||||||
AIRTIME.library.libraryInit();
|
|
||||||
AIRTIME.playlist.init();
|
|
||||||
|
|
||||||
if ($pl.is(':hidden')) {
|
|
||||||
$lib.find("#library_display_length").append($togglePl.show());
|
|
||||||
}
|
|
||||||
|
|
||||||
$pl.find(".ui-icon-alert").qtip({
|
$pl.find(".ui-icon-alert").qtip({
|
||||||
content: {
|
content: {
|
||||||
|
@ -1505,10 +1551,20 @@ var AIRTIME = (function(AIRTIME){
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.onResize = function() {
|
mod.onReady = function() {
|
||||||
|
$lib = $("#library_content");
|
||||||
|
|
||||||
clearTimeout(resizeTimeout);
|
$('#new-playlist').live('click', function(){AIRTIME.playlist.fnNew();});
|
||||||
resizeTimeout = setTimeout(setWidgetSize, 100);
|
$('#new-smart-block').live('click', function(){AIRTIME.playlist.fnNewBlock();});
|
||||||
|
$('#new-webstream').live('click', function(){AIRTIME.playlist.fnWsNew();});
|
||||||
|
|
||||||
|
AIRTIME.playlist.init();
|
||||||
|
};
|
||||||
|
|
||||||
|
mod.onResize = function() {
|
||||||
|
var h = $(".panel-header .nav").height();
|
||||||
|
$(".pl-content").css("margin-top", h + 5); // 8px extra for padding
|
||||||
|
$("#show_builder_table_wrapper").css("top", h + 5);
|
||||||
};
|
};
|
||||||
|
|
||||||
return AIRTIME;
|
return AIRTIME;
|
||||||
|
|
|
@ -1,609 +0,0 @@
|
||||||
$(document).ready(function() {
|
|
||||||
setSmartBlockEvents();
|
|
||||||
});
|
|
||||||
|
|
||||||
function setSmartBlockEvents() {
|
|
||||||
var activeTab = $('.active-tab'),
|
|
||||||
form = activeTab.find('.smart-block-form');
|
|
||||||
|
|
||||||
/********** ADD CRITERIA ROW **********/
|
|
||||||
form.find('#criteria_add').live('click', function(){
|
|
||||||
|
|
||||||
var div = $('dd[id="sp_criteria-element"]').children('div:visible:last');
|
|
||||||
|
|
||||||
div.find('.db-logic-label').text('and').show();
|
|
||||||
div = div.next().show();
|
|
||||||
|
|
||||||
div.children().removeAttr('disabled');
|
|
||||||
div = div.next();
|
|
||||||
if (div.length === 0) {
|
|
||||||
$(this).hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
appendAddButton();
|
|
||||||
appendModAddButton();
|
|
||||||
removeButtonCheck();
|
|
||||||
});
|
|
||||||
|
|
||||||
/********** ADD MODIFIER ROW **********/
|
|
||||||
form.find('a[id^="modifier_add"]').live('click', function(){
|
|
||||||
var criteria_value = $(this).siblings('select[name^="sp_criteria_field"]').val();
|
|
||||||
|
|
||||||
|
|
||||||
//make new modifier row
|
|
||||||
var newRow = $(this).parent().clone(),
|
|
||||||
newRowCrit = newRow.find('select[name^="sp_criteria_field"]'),
|
|
||||||
newRowMod = newRow.find('select[name^="sp_criteria_modifier"]'),
|
|
||||||
newRowVal = newRow.find('input[name^="sp_criteria_value"]'),
|
|
||||||
newRowExtra = newRow.find('input[name^="sp_criteria_extra"]'),
|
|
||||||
newRowRemove = newRow.find('a[id^="criteria_remove"]');
|
|
||||||
|
|
||||||
//remove error msg
|
|
||||||
if (newRow.children().hasClass('errors sp-errors')) {
|
|
||||||
newRow.find('span[class="errors sp-errors"]').remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
//hide the critieria field select box
|
|
||||||
newRowCrit.addClass('sp-invisible');
|
|
||||||
|
|
||||||
//keep criteria value the same
|
|
||||||
newRowCrit.val(criteria_value);
|
|
||||||
|
|
||||||
//reset all other values
|
|
||||||
newRowMod.val('0');
|
|
||||||
newRowVal.val('');
|
|
||||||
newRowExtra.val('');
|
|
||||||
disableAndHideExtraField(newRowVal);
|
|
||||||
sizeTextBoxes(newRowVal, 'sp_extra_input_text', 'sp_input_text');
|
|
||||||
|
|
||||||
//remove the 'criteria add' button from new modifier row
|
|
||||||
newRow.find('#criteria_add').remove();
|
|
||||||
|
|
||||||
$(this).parent().after(newRow);
|
|
||||||
reindexElements();
|
|
||||||
appendAddButton();
|
|
||||||
appendModAddButton();
|
|
||||||
removeButtonCheck();
|
|
||||||
});
|
|
||||||
|
|
||||||
/********** REMOVE ROW **********/
|
|
||||||
form.find('a[id^="criteria_remove"]').live('click', function(){
|
|
||||||
var curr = $(this).parent();
|
|
||||||
var curr_pos = curr.index();
|
|
||||||
var list = curr.parent();
|
|
||||||
var list_length = list.find("div:visible").length;
|
|
||||||
var count = list_length - curr_pos;
|
|
||||||
var next = curr.next();
|
|
||||||
var item_to_hide;
|
|
||||||
var prev;
|
|
||||||
var index;
|
|
||||||
|
|
||||||
//remove error message from current row, if any
|
|
||||||
var error_element = curr.find('span[class="errors sp-errors"]');
|
|
||||||
if (error_element.is(':visible')) {
|
|
||||||
error_element.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* assign next row to current row for all rows below and including
|
|
||||||
* the row getting removed
|
|
||||||
*/
|
|
||||||
for (var i=0; i<count; i++) {
|
|
||||||
|
|
||||||
index = getRowIndex(curr);
|
|
||||||
|
|
||||||
var criteria = next.find('[name^="sp_criteria_field"]').val();
|
|
||||||
curr.find('[name^="sp_criteria_field"]').val(criteria);
|
|
||||||
|
|
||||||
var modifier = next.find('[name^="sp_criteria_modifier"]').val();
|
|
||||||
populateModifierSelect(curr.find('[name^="sp_criteria_field"]'), false);
|
|
||||||
curr.find('[name^="sp_criteria_modifier"]').val(modifier);
|
|
||||||
|
|
||||||
var criteria_value = next.find('[name^="sp_criteria_value"]').val();
|
|
||||||
curr.find('[name^="sp_criteria_value"]').val(criteria_value);
|
|
||||||
|
|
||||||
/* if current and next row have the extra criteria value
|
|
||||||
* (for 'is in the range' modifier), then assign the next
|
|
||||||
* extra value to current and remove that element from
|
|
||||||
* next row
|
|
||||||
*/
|
|
||||||
if (curr.find('[name^="sp_criteria_extra"]').attr("disabled") != "disabled"
|
|
||||||
&& next.find('#extra_criteria').is(':visible')) {
|
|
||||||
|
|
||||||
var criteria_extra = next.find('[name^="sp_criteria_extra"]').val();
|
|
||||||
curr.find('[name^="sp_criteria_extra"]').val(criteria_extra);
|
|
||||||
disableAndHideExtraField(next.find(':first-child'), getRowIndex(next));
|
|
||||||
|
|
||||||
/* if only the current row has the extra criteria value,
|
|
||||||
* then just remove the current row's extra criteria element
|
|
||||||
*/
|
|
||||||
} else if (curr.find('[name^="sp_criteria_extra"]').attr("disabled") != "disabled"
|
|
||||||
&& next.find('#extra_criteria').not(':visible')) {
|
|
||||||
disableAndHideExtraField(curr.find(':first-child'), index);
|
|
||||||
|
|
||||||
/* if only the next row has the extra criteria value,
|
|
||||||
* then add the extra criteria element to current row
|
|
||||||
* and assign next row's value to it
|
|
||||||
*/
|
|
||||||
} else if (next.find('#extra_criteria').is(':visible')) {
|
|
||||||
criteria_extra = next.find('[name^="sp_criteria_extra"]').val();
|
|
||||||
enableAndShowExtraField(curr.find(':first-child'), index);
|
|
||||||
curr.find('[name^="sp_criteria_extra"]').val(criteria_extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* determine if current row is a modifier row
|
|
||||||
* if it is, make the criteria select invisible
|
|
||||||
*/
|
|
||||||
prev = curr.prev();
|
|
||||||
if (curr.find('[name^="sp_criteria_field"]').val() == prev.find('[name^="sp_criteria_field"]').val()) {
|
|
||||||
if (!curr.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
|
||||||
curr.find('select[name^="sp_criteria_field"]').addClass('sp-invisible');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (curr.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
|
||||||
curr.find('select[name^="sp_criteria_field"]').removeClass('sp-invisible');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
curr = next;
|
|
||||||
next = curr.next();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Disable the last visible row since it holds the values the user removed
|
|
||||||
* Reset the values to empty and resize the criteria value textbox
|
|
||||||
* in case the row had the extra criteria textbox
|
|
||||||
*/
|
|
||||||
item_to_hide = list.find('div:visible:last');
|
|
||||||
item_to_hide.children().attr('disabled', 'disabled');
|
|
||||||
if (item_to_hide.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
|
||||||
item_to_hide.find('select[name^="sp_criteria_field"]').removeClass('sp-invisible');
|
|
||||||
}
|
|
||||||
item_to_hide.find('[name^="sp_criteria_field"]').val(0).end()
|
|
||||||
.find('[name^="sp_criteria_modifier"]').val(0).end()
|
|
||||||
.find('[name^="sp_criteria_value"]').val('').end()
|
|
||||||
.find('[name^="sp_criteria_extra"]').val('');
|
|
||||||
|
|
||||||
sizeTextBoxes(item_to_hide.find('[name^="sp_criteria_value"]'), 'sp_extra_input_text', 'sp_input_text');
|
|
||||||
item_to_hide.hide();
|
|
||||||
|
|
||||||
list.next().show();
|
|
||||||
|
|
||||||
//check if last row is a modifier row
|
|
||||||
var last_row = list.find('div:visible:last');
|
|
||||||
if (last_row.find('[name^="sp_criteria_field"]').val() == last_row.prev().find('[name^="sp_criteria_field"]').val()) {
|
|
||||||
if (!last_row.find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
|
||||||
last_row.find('select[name^="sp_criteria_field"]').addClass('sp-invisible');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// always put '+' button on the last enabled row
|
|
||||||
appendAddButton();
|
|
||||||
|
|
||||||
reindexElements();
|
|
||||||
|
|
||||||
// always put '+' button on the last modifier row
|
|
||||||
appendModAddButton();
|
|
||||||
|
|
||||||
// remove the 'x' button if only one row is enabled
|
|
||||||
removeButtonCheck();
|
|
||||||
});
|
|
||||||
|
|
||||||
/********** SAVE ACTION **********/
|
|
||||||
// moved to spl.js
|
|
||||||
|
|
||||||
/********** GENERATE ACTION **********/
|
|
||||||
activeTab.find('button[id="generate_button"]').live("click", function(){
|
|
||||||
buttonClickAction('generate', 'new-playlist/smart-block-generate');
|
|
||||||
});
|
|
||||||
|
|
||||||
/********** SHUFFLE ACTION **********/
|
|
||||||
activeTab.find('button[id="shuffle_button"]').live("click", function(){
|
|
||||||
buttonClickAction('shuffle', 'new-playlist/smart-block-shuffle');
|
|
||||||
});
|
|
||||||
|
|
||||||
/********** CHANGE PLAYLIST TYPE **********/
|
|
||||||
form.find('dd[id="sp_type-element"]').live("change", function(){
|
|
||||||
setupUI();
|
|
||||||
AIRTIME.library.checkAddButton();
|
|
||||||
});
|
|
||||||
|
|
||||||
/********** CRITERIA CHANGE **********/
|
|
||||||
form.find('select[id^="sp_criteria"]:not([id^="sp_criteria_modifier"])').live("change", function(){
|
|
||||||
var index = getRowIndex($(this).parent());
|
|
||||||
//need to change the criteria value for any modifier rows
|
|
||||||
var critVal = $(this).val();
|
|
||||||
var divs = $(this).parent().nextAll(':visible');
|
|
||||||
$.each(divs, function(i, div){
|
|
||||||
var critSelect = $(div).children('select[id^="sp_criteria_field"]');
|
|
||||||
if (critSelect.hasClass('sp-invisible')) {
|
|
||||||
critSelect.val(critVal);
|
|
||||||
/* If the select box is visible we know the modifier rows
|
|
||||||
* have ended
|
|
||||||
*/
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// disable extra field and hide the span
|
|
||||||
disableAndHideExtraField($(this), index);
|
|
||||||
populateModifierSelect(this, true);
|
|
||||||
});
|
|
||||||
|
|
||||||
/********** MODIFIER CHANGE **********/
|
|
||||||
form.find('select[id^="sp_criteria_modifier"]').live("change", function(){
|
|
||||||
var criteria_value = $(this).next(),
|
|
||||||
index_num = getRowIndex($(this).parent());
|
|
||||||
|
|
||||||
if ($(this).val() == 'is in the range') {
|
|
||||||
enableAndShowExtraField(criteria_value, index_num);
|
|
||||||
} else {
|
|
||||||
disableAndHideExtraField(criteria_value, index_num);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setupUI();
|
|
||||||
appendAddButton();
|
|
||||||
appendModAddButton();
|
|
||||||
removeButtonCheck();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRowIndex(ele) {
|
|
||||||
var id = ele.find('[name^="sp_criteria_field"]').attr('id'),
|
|
||||||
delimiter = '_',
|
|
||||||
start = 3,
|
|
||||||
tokens = id.split(delimiter).slice(start),
|
|
||||||
index = tokens.join(delimiter);
|
|
||||||
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function appends a '+' button for the last
|
|
||||||
* modifier row of each criteria.
|
|
||||||
* If there are no modifier rows, the '+' button
|
|
||||||
* remains at the criteria row
|
|
||||||
*/
|
|
||||||
function appendModAddButton() {
|
|
||||||
var divs = $('.active-tab .smart-block-form').find('div select[name^="sp_criteria_modifier"]').parent(':visible');
|
|
||||||
$.each(divs, function(i, div){
|
|
||||||
if (i > 0) {
|
|
||||||
/* If the criteria field is hidden we know it is a modifier row
|
|
||||||
* and can hide the previous row's modifier add button
|
|
||||||
*/
|
|
||||||
if ($(div).find('select[name^="sp_criteria_field"]').hasClass('sp-invisible')) {
|
|
||||||
$(div).prev().find('a[id^="modifier_add"]').addClass('sp-invisible');
|
|
||||||
} else {
|
|
||||||
$(div).prev().find('a[id^="modifier_add"]').removeClass('sp-invisible');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//always add modifier add button to the last row
|
|
||||||
if (i+1 == divs.length) {
|
|
||||||
$(div).find('a[id^="modifier_add"]').removeClass('sp-invisible');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function re-indexes all the form elements.
|
|
||||||
* We need to do this everytime a row gets deleted
|
|
||||||
*/
|
|
||||||
function reindexElements() {
|
|
||||||
var divs = $('.active-tab .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) {
|
|
||||||
|
|
||||||
/* If the current row's criteria field is hidden we know it is
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
$(div).find('select[name^="sp_criteria_field"]').attr('name', 'sp_criteria_field_'+index+'_'+modIndex);
|
|
||||||
$(div).find('select[name^="sp_criteria_field"]').attr('id', 'sp_criteria_field_'+index+'_'+modIndex);
|
|
||||||
$(div).find('select[name^="sp_criteria_modifier"]').attr('name', 'sp_criteria_modifier_'+index+'_'+modIndex);
|
|
||||||
$(div).find('select[name^="sp_criteria_modifier"]').attr('id', 'sp_criteria_modifier_'+index+'_'+modIndex);
|
|
||||||
$(div).find('input[name^="sp_criteria_value"]').attr('name', 'sp_criteria_value_'+index+'_'+modIndex);
|
|
||||||
$(div).find('input[name^="sp_criteria_value"]').attr('id', 'sp_criteria_value_'+index+'_'+modIndex);
|
|
||||||
$(div).find('input[name^="sp_criteria_extra"]').attr('name', 'sp_criteria_extra_'+index+'_'+modIndex);
|
|
||||||
$(div).find('input[name^="sp_criteria_extra"]').attr('id', 'sp_criteria_extra_'+index+'_'+modIndex);
|
|
||||||
$(div).find('a[name^="modifier_add"]').attr('id', 'modifier_add_'+index);
|
|
||||||
$(div).find('a[id^="criteria_remove"]').attr('id', 'criteria_remove_'+index+'_'+modIndex);
|
|
||||||
} else if (i > 0) {
|
|
||||||
$(div).remove();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function buttonClickAction(clickType, url){
|
|
||||||
var data = $('.active-tab .smart-block-form').serializeArray(),
|
|
||||||
obj_id = $('.active-tab .obj_id').val();
|
|
||||||
|
|
||||||
enableLoadingIcon();
|
|
||||||
$.post(url, {format: "json", data: data, obj_id: obj_id}, function(data){
|
|
||||||
callback(data, clickType);
|
|
||||||
disableLoadingIcon();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function setupUI() {
|
|
||||||
var activeTab = $('.active-tab'),
|
|
||||||
playlist_type = activeTab.find('input:radio[name=sp_type]:checked').val();
|
|
||||||
|
|
||||||
/* Activate or Deactivate shuffle button
|
|
||||||
* It is only active if playlist is not empty
|
|
||||||
*/
|
|
||||||
var sortable = activeTab.find('.spl_sortable'),
|
|
||||||
plContents = sortable.children(),
|
|
||||||
shuffleButton = activeTab.find('.sp-button, #pl-bl-clear-content');
|
|
||||||
|
|
||||||
if (!plContents.hasClass('spl_empty')) {
|
|
||||||
if (shuffleButton.hasClass('ui-state-disabled')) {
|
|
||||||
shuffleButton.removeClass('ui-state-disabled');
|
|
||||||
shuffleButton.removeAttr('disabled');
|
|
||||||
}
|
|
||||||
} else if (!shuffleButton.hasClass('ui-state-disabled')) {
|
|
||||||
shuffleButton.addClass('ui-state-disabled');
|
|
||||||
shuffleButton.attr('disabled', 'disabled');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activeTab.find('.obj_type').val() == 'block') {
|
|
||||||
if (playlist_type == "0") {
|
|
||||||
shuffleButton.parent().show();
|
|
||||||
sortable.show();
|
|
||||||
} else {
|
|
||||||
shuffleButton.parent().hide();
|
|
||||||
sortable.hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$(".playlist_type_help_icon").qtip({
|
|
||||||
content: {
|
|
||||||
text: $.i18n._("A static smart block will save the criteria and generate the block content immediately. This allows you to edit and view it in the Library before adding it to a show.")+"<br /><br />" +
|
|
||||||
$.i18n._("A dynamic smart block will only save the criteria. The block content will get generated upon adding it to a show. You will not be able to view and edit the content in the Library.")
|
|
||||||
},
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".repeat_tracks_help_icon").qtip({
|
|
||||||
content: {
|
|
||||||
text: sprintf($.i18n._("The desired block length will not be reached if %s cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block."), PRODUCT_NAME)
|
|
||||||
},
|
|
||||||
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) {
|
|
||||||
var spanExtra = valEle.nextAll("#extra_criteria");
|
|
||||||
spanExtra.children('#sp_criteria_extra_'+index).removeAttr("disabled");
|
|
||||||
spanExtra.show();
|
|
||||||
|
|
||||||
//make value input smaller since we have extra element now
|
|
||||||
var criteria_val = $('#sp_criteria_value_'+index);
|
|
||||||
sizeTextBoxes(criteria_val, 'sp_input_text', 'sp_extra_input_text');
|
|
||||||
}
|
|
||||||
|
|
||||||
function disableAndHideExtraField(valEle, index) {
|
|
||||||
var spanExtra = valEle.nextAll("#extra_criteria");
|
|
||||||
spanExtra.children('#sp_criteria_extra_'+index).val("").attr("disabled", "disabled");
|
|
||||||
spanExtra.hide();
|
|
||||||
|
|
||||||
//make value input larger since we don't have extra field now
|
|
||||||
var criteria_value = $('#sp_criteria_value_'+index);
|
|
||||||
sizeTextBoxes(criteria_value, 'sp_extra_input_text', 'sp_input_text');
|
|
||||||
}
|
|
||||||
|
|
||||||
function sizeTextBoxes(ele, classToRemove, classToAdd) {
|
|
||||||
if (ele.hasClass(classToRemove)) {
|
|
||||||
ele.removeClass(classToRemove).addClass(classToAdd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function populateModifierSelect(e, popAllMods) {
|
|
||||||
var criteria_type = getCriteriaOptionType(e),
|
|
||||||
index = getRowIndex($(e).parent()),
|
|
||||||
divs;
|
|
||||||
|
|
||||||
if (popAllMods) {
|
|
||||||
index = index.substring(0, 1);
|
|
||||||
}
|
|
||||||
divs = $(e).parents().find('select[id^="sp_criteria_modifier_'+index+'"]');
|
|
||||||
|
|
||||||
$.each(divs, function(i, div){
|
|
||||||
$(div).children().remove();
|
|
||||||
|
|
||||||
if (criteria_type == 's') {
|
|
||||||
$.each(stringCriteriaOptions, function(key, value){
|
|
||||||
$(div).append($('<option></option>')
|
|
||||||
.attr('value', key)
|
|
||||||
.text(value));
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$.each(numericCriteriaOptions, function(key, value){
|
|
||||||
$(div).append($('<option></option>')
|
|
||||||
.attr('value', key)
|
|
||||||
.text(value));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCriteriaOptionType(e) {
|
|
||||||
var criteria = $(e).val();
|
|
||||||
return criteriaTypes[criteria];
|
|
||||||
}
|
|
||||||
|
|
||||||
function callback(json, type) {
|
|
||||||
var dt = $('table[id="library_display"]').dataTable(),
|
|
||||||
form = $('.active-tab .smart-block-form');
|
|
||||||
|
|
||||||
if (type == 'shuffle' || type == 'generate') {
|
|
||||||
if (json.error !== undefined) {
|
|
||||||
alert(json.error);
|
|
||||||
}
|
|
||||||
AIRTIME.playlist.closeTab();
|
|
||||||
AIRTIME.playlist.fnOpenPlaylist(json);
|
|
||||||
if (json.result == "0") {
|
|
||||||
if (type == 'shuffle') {
|
|
||||||
form.find('.success').text($.i18n._('Smart block shuffled'));
|
|
||||||
} else if (type == 'generate') {
|
|
||||||
form.find('.success').text($.i18n._('Smart block generated and criteria saved'));
|
|
||||||
//redraw library table so the length gets updated
|
|
||||||
dt.fnStandingRedraw();
|
|
||||||
}
|
|
||||||
form.find('.success').show();
|
|
||||||
}
|
|
||||||
form.find('#smart_block_options').removeClass("closed");
|
|
||||||
} else {
|
|
||||||
AIRTIME.playlist.closeTab();
|
|
||||||
AIRTIME.playlist.fnOpenPlaylist(json);
|
|
||||||
if (json.result == "0") {
|
|
||||||
$('.active-tab #sp-success-saved').text($.i18n._('Smart block saved')).show();
|
|
||||||
|
|
||||||
//redraw library table so the length gets updated
|
|
||||||
dt.fnStandingRedraw();
|
|
||||||
}
|
|
||||||
form.find('#smart_block_options').removeClass("closed");
|
|
||||||
}
|
|
||||||
setTimeout(removeSuccessMsg, 5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
function appendAddButton() {
|
|
||||||
var add_button = "<a class='btn btn-small' id='criteria_add'>" +
|
|
||||||
"<i class='icon-white icon-plus'></i></a>";
|
|
||||||
var rows = $('.active-tab #smart_block_options'),
|
|
||||||
enabled = rows.find('select[name^="sp_criteria_field"]:enabled');
|
|
||||||
|
|
||||||
rows.find('#criteria_add').remove();
|
|
||||||
|
|
||||||
if (enabled.length > 1) {
|
|
||||||
rows.find('select[name^="sp_criteria_field"]:enabled:last')
|
|
||||||
.siblings('a[id^="criteria_remove"]')
|
|
||||||
.after(add_button);
|
|
||||||
} else {
|
|
||||||
enabled.siblings('span[id="extra_criteria"]')
|
|
||||||
.after(add_button);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeButtonCheck() {
|
|
||||||
var rows = $('.active-tab dd[id="sp_criteria-element"]').children('div'),
|
|
||||||
enabled = rows.find('select[name^="sp_criteria_field"]:enabled'),
|
|
||||||
rmv_button = enabled.siblings('a[id^="criteria_remove"]');
|
|
||||||
if (enabled.length == 1) {
|
|
||||||
rmv_button.attr('disabled', 'disabled');
|
|
||||||
rmv_button.hide();
|
|
||||||
} else {
|
|
||||||
rmv_button.removeAttr('disabled');
|
|
||||||
rmv_button.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function enableLoadingIcon() {
|
|
||||||
$(".side_playlist.active-tab").block({
|
|
||||||
message: $.i18n._("Processing..."),
|
|
||||||
theme: true,
|
|
||||||
allowBodyStretch: true,
|
|
||||||
applyPlatformOpacityRules: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function disableLoadingIcon() {
|
|
||||||
$(".side_playlist.active-tab").unblock()
|
|
||||||
}
|
|
||||||
// We need to know if the criteria value will be a string
|
|
||||||
// or numeric value in order to populate the modifier
|
|
||||||
// select list
|
|
||||||
var criteriaTypes = {
|
|
||||||
0 : "",
|
|
||||||
"album_title" : "s",
|
|
||||||
"bit_rate" : "n",
|
|
||||||
"bpm" : "n",
|
|
||||||
"composer" : "s",
|
|
||||||
"conductor" : "s",
|
|
||||||
"copyright" : "s",
|
|
||||||
"cuein" : "n",
|
|
||||||
"cueout" : "n",
|
|
||||||
"artist_name" : "s",
|
|
||||||
"encoded_by" : "s",
|
|
||||||
"utime" : "n",
|
|
||||||
"mtime" : "n",
|
|
||||||
"lptime" : "n",
|
|
||||||
"genre" : "s",
|
|
||||||
"isrc_number" : "s",
|
|
||||||
"label" : "s",
|
|
||||||
"language" : "s",
|
|
||||||
"length" : "n",
|
|
||||||
"mime" : "s",
|
|
||||||
"mood" : "s",
|
|
||||||
"owner_id" : "s",
|
|
||||||
"replay_gain" : "n",
|
|
||||||
"sample_rate" : "n",
|
|
||||||
"track_title" : "s",
|
|
||||||
"track_number" : "n",
|
|
||||||
"info_url" : "s",
|
|
||||||
"year" : "n"
|
|
||||||
};
|
|
||||||
|
|
||||||
var stringCriteriaOptions = {
|
|
||||||
"0" : $.i18n._("Select modifier"),
|
|
||||||
"contains" : $.i18n._("contains"),
|
|
||||||
"does not contain" : $.i18n._("does not contain"),
|
|
||||||
"is" : $.i18n._("is"),
|
|
||||||
"is not" : $.i18n._("is not"),
|
|
||||||
"starts with" : $.i18n._("starts with"),
|
|
||||||
"ends with" : $.i18n._("ends with")
|
|
||||||
};
|
|
||||||
|
|
||||||
var numericCriteriaOptions = {
|
|
||||||
"0" : $.i18n._("Select modifier"),
|
|
||||||
"is" : $.i18n._("is"),
|
|
||||||
"is not" : $.i18n._("is not"),
|
|
||||||
"is greater than" : $.i18n._("is greater than"),
|
|
||||||
"is less than" : $.i18n._("is less than"),
|
|
||||||
"is in the range" : $.i18n._("is in the range")
|
|
||||||
};
|
|
|
@ -3,7 +3,8 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
function setSmartBlockEvents() {
|
function setSmartBlockEvents() {
|
||||||
var form = $('#smart-block-form');
|
var activeTab = $('.active-tab'),
|
||||||
|
form = activeTab.find('.smart-block-form');
|
||||||
|
|
||||||
/********** ADD CRITERIA ROW **********/
|
/********** ADD CRITERIA ROW **********/
|
||||||
form.find('#criteria_add').live('click', function(){
|
form.find('#criteria_add').live('click', function(){
|
||||||
|
@ -28,6 +29,7 @@ function setSmartBlockEvents() {
|
||||||
form.find('a[id^="modifier_add"]').live('click', function(){
|
form.find('a[id^="modifier_add"]').live('click', function(){
|
||||||
var 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
|
//make new modifier row
|
||||||
var newRow = $(this).parent().clone(),
|
var newRow = $(this).parent().clone(),
|
||||||
newRowCrit = newRow.find('select[name^="sp_criteria_field"]'),
|
newRowCrit = newRow.find('select[name^="sp_criteria_field"]'),
|
||||||
|
@ -190,13 +192,13 @@ function setSmartBlockEvents() {
|
||||||
// moved to spl.js
|
// moved to spl.js
|
||||||
|
|
||||||
/********** GENERATE ACTION **********/
|
/********** GENERATE ACTION **********/
|
||||||
$('button[id="generate_button"]').live("click", function(){
|
activeTab.find('button[id="generate_button"]').live("click", function(){
|
||||||
buttonClickAction('generate', 'Playlist/smart-block-generate');
|
buttonClickAction('generate', 'playlist/smart-block-generate');
|
||||||
});
|
});
|
||||||
|
|
||||||
/********** SHUFFLE ACTION **********/
|
/********** SHUFFLE ACTION **********/
|
||||||
$('button[id="shuffle_button"]').live("click", function(){
|
activeTab.find('button[id="shuffle_button"]').live("click", function(){
|
||||||
buttonClickAction('shuffle', 'Playlist/smart-block-shuffle');
|
buttonClickAction('shuffle', 'playlist/smart-block-shuffle');
|
||||||
});
|
});
|
||||||
|
|
||||||
/********** CHANGE PLAYLIST TYPE **********/
|
/********** CHANGE PLAYLIST TYPE **********/
|
||||||
|
@ -262,7 +264,7 @@ function getRowIndex(ele) {
|
||||||
* remains at the criteria row
|
* remains at the criteria row
|
||||||
*/
|
*/
|
||||||
function appendModAddButton() {
|
function appendModAddButton() {
|
||||||
var divs = $('#smart-block-form').find('div select[name^="sp_criteria_modifier"]').parent(':visible');
|
var divs = $('.active-tab .smart-block-form').find('div select[name^="sp_criteria_modifier"]').parent(':visible');
|
||||||
$.each(divs, function(i, div){
|
$.each(divs, function(i, div){
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
/* If the criteria field is hidden we know it is a modifier row
|
/* If the criteria field is hidden we know it is a modifier row
|
||||||
|
@ -286,7 +288,7 @@ function appendModAddButton() {
|
||||||
* We need to do this everytime a row gets deleted
|
* We need to do this everytime a row gets deleted
|
||||||
*/
|
*/
|
||||||
function reindexElements() {
|
function reindexElements() {
|
||||||
var divs = $('#smart-block-form').find('div select[name^="sp_criteria_field"]').parent(),
|
var divs = $('.active-tab .smart-block-form').find('div select[name^="sp_criteria_field"]').parent(),
|
||||||
index = 0,
|
index = 0,
|
||||||
modIndex = 0;
|
modIndex = 0;
|
||||||
/* Hide all logic labels
|
/* Hide all logic labels
|
||||||
|
@ -330,8 +332,8 @@ function reindexElements() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function buttonClickAction(clickType, url){
|
function buttonClickAction(clickType, url){
|
||||||
var data = $('#smart-block-form').serializeArray(),
|
var data = $('.active-tab .smart-block-form').serializeArray(),
|
||||||
obj_id = $('.obj_id').val();
|
obj_id = $('.active-tab .obj_id').val();
|
||||||
|
|
||||||
enableLoadingIcon();
|
enableLoadingIcon();
|
||||||
$.post(url, {format: "json", data: data, obj_id: obj_id}, function(data){
|
$.post(url, {format: "json", data: data, obj_id: obj_id}, function(data){
|
||||||
|
@ -341,17 +343,15 @@ function buttonClickAction(clickType, url){
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupUI() {
|
function setupUI() {
|
||||||
var playlist_type = $('input:radio[name=sp_type]:checked').val();
|
var activeTab = $('.active-tab'),
|
||||||
var target_length = $('input[name="sp_limit_value"]').val();
|
playlist_type = activeTab.find('input:radio[name=sp_type]:checked').val();
|
||||||
if (target_length == '') {
|
|
||||||
target_length = '0.0';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Activate or Deactivate shuffle button
|
/* Activate or Deactivate shuffle button
|
||||||
* It is only active if playlist is not empty
|
* It is only active if playlist is not empty
|
||||||
*/
|
*/
|
||||||
var plContents = $('.spl_sortable').children();
|
var sortable = activeTab.find('.spl_sortable'),
|
||||||
var shuffleButton = $('button[id="shuffle_button"], button[id="playlist_shuffle_button"], button[id="pl-bl-clear-content"]');
|
plContents = sortable.children(),
|
||||||
|
shuffleButton = activeTab.find('.sp-button, #pl-bl-clear-content');
|
||||||
|
|
||||||
if (!plContents.hasClass('spl_empty')) {
|
if (!plContents.hasClass('spl_empty')) {
|
||||||
if (shuffleButton.hasClass('ui-state-disabled')) {
|
if (shuffleButton.hasClass('ui-state-disabled')) {
|
||||||
|
@ -363,16 +363,13 @@ function setupUI() {
|
||||||
shuffleButton.attr('disabled', 'disabled');
|
shuffleButton.attr('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
var dynamic_length = target_length;
|
if (activeTab.find('.obj_type').val() == 'block') {
|
||||||
if ($('.obj_type').val() == 'block') {
|
|
||||||
if (playlist_type == "0") {
|
if (playlist_type == "0") {
|
||||||
$('button[id="generate_button"]').show();
|
shuffleButton.parent().show();
|
||||||
$('button[id="shuffle_button"]').show();
|
sortable.show();
|
||||||
$('.spl_sortable').show();
|
|
||||||
} else {
|
} else {
|
||||||
$('button[id="generate_button"]').hide();
|
shuffleButton.parent().hide();
|
||||||
$('button[id="shuffle_button"]').hide();
|
sortable.hide();
|
||||||
$('.spl_sortable').hide();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +392,7 @@ function setupUI() {
|
||||||
position: {
|
position: {
|
||||||
my: "left bottom",
|
my: "left bottom",
|
||||||
at: "right center"
|
at: "right center"
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".repeat_tracks_help_icon").qtip({
|
$(".repeat_tracks_help_icon").qtip({
|
||||||
|
@ -416,7 +413,7 @@ function setupUI() {
|
||||||
position: {
|
position: {
|
||||||
my: "left bottom",
|
my: "left bottom",
|
||||||
at: "right center"
|
at: "right center"
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,14 +478,15 @@ function getCriteriaOptionType(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function callback(json, type) {
|
function callback(json, type) {
|
||||||
var dt = $('table[id="library_display"]').dataTable();
|
var dt = $('table[id="library_display"]').dataTable(),
|
||||||
|
form = $('.active-tab .smart-block-form');
|
||||||
|
|
||||||
if (type == 'shuffle' || type == 'generate') {
|
if (type == 'shuffle' || type == 'generate') {
|
||||||
if (json.error !== undefined) {
|
if (json.error !== undefined) {
|
||||||
alert(json.error);
|
alert(json.error);
|
||||||
}
|
}
|
||||||
|
AIRTIME.playlist.closeTab();
|
||||||
AIRTIME.playlist.fnOpenPlaylist(json);
|
AIRTIME.playlist.fnOpenPlaylist(json);
|
||||||
var form = $('#smart-block-form');
|
|
||||||
if (json.result == "0") {
|
if (json.result == "0") {
|
||||||
if (type == 'shuffle') {
|
if (type == 'shuffle') {
|
||||||
form.find('.success').text($.i18n._('Smart block shuffled'));
|
form.find('.success').text($.i18n._('Smart block shuffled'));
|
||||||
|
@ -501,14 +499,12 @@ function callback(json, type) {
|
||||||
}
|
}
|
||||||
form.find('#smart_block_options').removeClass("closed");
|
form.find('#smart_block_options').removeClass("closed");
|
||||||
} else {
|
} else {
|
||||||
|
AIRTIME.playlist.closeTab();
|
||||||
AIRTIME.playlist.fnOpenPlaylist(json);
|
AIRTIME.playlist.fnOpenPlaylist(json);
|
||||||
var form = $('#smart-block-form');
|
|
||||||
if (json.result == "0") {
|
if (json.result == "0") {
|
||||||
$('#sp-success-saved').text($.i18n._('Smart block saved'));
|
$('.active-tab #sp-success-saved').text($.i18n._('Smart block saved')).show();
|
||||||
$('#sp-success-saved').show();
|
|
||||||
|
|
||||||
//redraw library table so the length gets updated
|
//redraw library table so the length gets updated
|
||||||
var dt = $('table[id="library_display"]').dataTable();
|
|
||||||
dt.fnStandingRedraw();
|
dt.fnStandingRedraw();
|
||||||
}
|
}
|
||||||
form.find('#smart_block_options').removeClass("closed");
|
form.find('#smart_block_options').removeClass("closed");
|
||||||
|
@ -519,7 +515,7 @@ function callback(json, type) {
|
||||||
function appendAddButton() {
|
function appendAddButton() {
|
||||||
var add_button = "<a class='btn btn-small' id='criteria_add'>" +
|
var add_button = "<a class='btn btn-small' id='criteria_add'>" +
|
||||||
"<i class='icon-white icon-plus'></i></a>";
|
"<i class='icon-white icon-plus'></i></a>";
|
||||||
var rows = $('#smart_block_options'),
|
var rows = $('.active-tab #smart_block_options'),
|
||||||
enabled = rows.find('select[name^="sp_criteria_field"]:enabled');
|
enabled = rows.find('select[name^="sp_criteria_field"]:enabled');
|
||||||
|
|
||||||
rows.find('#criteria_add').remove();
|
rows.find('#criteria_add').remove();
|
||||||
|
@ -535,7 +531,7 @@ function appendAddButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeButtonCheck() {
|
function removeButtonCheck() {
|
||||||
var rows = $('dd[id="sp_criteria-element"]').children('div'),
|
var rows = $('.active-tab dd[id="sp_criteria-element"]').children('div'),
|
||||||
enabled = rows.find('select[name^="sp_criteria_field"]:enabled'),
|
enabled = rows.find('select[name^="sp_criteria_field"]:enabled'),
|
||||||
rmv_button = enabled.siblings('a[id^="criteria_remove"]');
|
rmv_button = enabled.siblings('a[id^="criteria_remove"]');
|
||||||
if (enabled.length == 1) {
|
if (enabled.length == 1) {
|
||||||
|
@ -548,7 +544,7 @@ function removeButtonCheck() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableLoadingIcon() {
|
function enableLoadingIcon() {
|
||||||
$(".side_playlist").block({
|
$(".side_playlist.active-tab").block({
|
||||||
message: $.i18n._("Processing..."),
|
message: $.i18n._("Processing..."),
|
||||||
theme: true,
|
theme: true,
|
||||||
allowBodyStretch: true,
|
allowBodyStretch: true,
|
||||||
|
@ -557,7 +553,7 @@ function enableLoadingIcon() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function disableLoadingIcon() {
|
function disableLoadingIcon() {
|
||||||
$(".side_playlist").unblock()
|
$(".side_playlist.active-tab").unblock()
|
||||||
}
|
}
|
||||||
// We need to know if the criteria value will be a string
|
// We need to know if the criteria value will be a string
|
||||||
// or numeric value in order to populate the modifier
|
// or numeric value in order to populate the modifier
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,360 +0,0 @@
|
||||||
AIRTIME = (function(AIRTIME) {
|
|
||||||
|
|
||||||
var viewport,
|
|
||||||
$lib,
|
|
||||||
$libWrapper,
|
|
||||||
$builder,
|
|
||||||
$fs,
|
|
||||||
widgetHeight,
|
|
||||||
screenWidth,
|
|
||||||
resizeTimeout,
|
|
||||||
oBaseDatePickerSettings,
|
|
||||||
oBaseTimePickerSettings,
|
|
||||||
oRange,
|
|
||||||
dateStartId = "#sb_date_start",
|
|
||||||
timeStartId = "#sb_time_start",
|
|
||||||
dateEndId = "#sb_date_end",
|
|
||||||
timeEndId = "#sb_time_end",
|
|
||||||
mod;
|
|
||||||
|
|
||||||
if (AIRTIME.builderMain === undefined) {
|
|
||||||
AIRTIME.builderMain = {};
|
|
||||||
}
|
|
||||||
mod = AIRTIME.builderMain;
|
|
||||||
|
|
||||||
oBaseDatePickerSettings = {
|
|
||||||
dateFormat: 'yy-mm-dd',
|
|
||||||
//i18n_months, i18n_days_short are in common.js
|
|
||||||
monthNames: i18n_months,
|
|
||||||
dayNamesMin: i18n_days_short,
|
|
||||||
onClick: function(sDate, oDatePicker) {
|
|
||||||
$(this).datepicker( "setDate", sDate );
|
|
||||||
},
|
|
||||||
onClose: validateTimeRange
|
|
||||||
};
|
|
||||||
|
|
||||||
oBaseTimePickerSettings = {
|
|
||||||
showPeriodLabels: false,
|
|
||||||
showCloseButton: true,
|
|
||||||
closeButtonText: $.i18n._("Done"),
|
|
||||||
showLeadingZero: false,
|
|
||||||
defaultTime: '0:00',
|
|
||||||
hourText: $.i18n._("Hour"),
|
|
||||||
minuteText: $.i18n._("Minute"),
|
|
||||||
onClose: validateTimeRange
|
|
||||||
};
|
|
||||||
|
|
||||||
function setWidgetSize() {
|
|
||||||
viewport = AIRTIME.utilities.findViewportDimensions();
|
|
||||||
widgetHeight = viewport.height - 180;
|
|
||||||
screenWidth = Math.floor(viewport.width - 50);
|
|
||||||
|
|
||||||
var libTableHeight = widgetHeight - 175,
|
|
||||||
builderTableHeight = widgetHeight - 95,
|
|
||||||
oTable;
|
|
||||||
|
|
||||||
if ($fs.is(':visible')) {
|
|
||||||
builderTableHeight = builderTableHeight - 40;
|
|
||||||
}
|
|
||||||
|
|
||||||
//set the heights of the main widgets.
|
|
||||||
$builder//.height(widgetHeight)
|
|
||||||
.find(".dataTables_scrolling")
|
|
||||||
//.css("max-height", builderTableHeight)
|
|
||||||
.end();
|
|
||||||
//.width(screenWidth);
|
|
||||||
|
|
||||||
$lib//.height(widgetHeight)
|
|
||||||
.find(".dataTables_scrolling")
|
|
||||||
//.css("max-height", libTableHeight)
|
|
||||||
.end();
|
|
||||||
|
|
||||||
if ($lib.filter(':visible').length > 0) {
|
|
||||||
|
|
||||||
//$lib.width(Math.floor(screenWidth * 0.47));
|
|
||||||
|
|
||||||
$builder//.width(Math.floor(screenWidth * 0.47))
|
|
||||||
.find("#sb_edit")
|
|
||||||
.remove()
|
|
||||||
.end()
|
|
||||||
.find("#sb_date_start")
|
|
||||||
.css("margin-left", 0)
|
|
||||||
.end();
|
|
||||||
|
|
||||||
oTable = $('#show_builder_table').dataTable();
|
|
||||||
//oTable.fnDraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function validateTimeRange() {
|
|
||||||
var oRange,
|
|
||||||
inputs = $('.sb-timerange > input'),
|
|
||||||
start, end;
|
|
||||||
|
|
||||||
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
|
|
||||||
|
|
||||||
start = oRange.start;
|
|
||||||
end = oRange.end;
|
|
||||||
|
|
||||||
if (end >= start) {
|
|
||||||
inputs.removeClass('error');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (!inputs.hasClass('error')) {
|
|
||||||
inputs.addClass('error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
start: start,
|
|
||||||
end: end,
|
|
||||||
isValid: end >= start
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function showSearchSubmit() {
|
|
||||||
var fn,
|
|
||||||
op,
|
|
||||||
oTable = $('#show_builder_table').dataTable(),
|
|
||||||
check;
|
|
||||||
|
|
||||||
check = validateTimeRange();
|
|
||||||
|
|
||||||
if (check.isValid) {
|
|
||||||
|
|
||||||
//reset timestamp value since input values could have changed.
|
|
||||||
AIRTIME.showbuilder.resetTimestamp();
|
|
||||||
|
|
||||||
fn = oTable.fnSettings().fnServerData;
|
|
||||||
fn.start = check.start;
|
|
||||||
fn.end = check.end;
|
|
||||||
|
|
||||||
op = $("div.sb-advanced-options");
|
|
||||||
if (op.is(":visible")) {
|
|
||||||
|
|
||||||
if (fn.ops === undefined) {
|
|
||||||
fn.ops = {};
|
|
||||||
}
|
|
||||||
fn.ops.showFilter = op.find("#sb_show_filter").val();
|
|
||||||
fn.ops.myShows = op.find("#sb_my_shows").is(":checked") ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
oTable.fnDraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mod.onReady = function() {
|
|
||||||
// Normally we would just use audio/*, but it includes file types that we can't handle (like .m4a)
|
|
||||||
// We initialize the acceptedMimeTypes variable in Bootstrap so we don't have to duplicate the list
|
|
||||||
Dropzone.options.content = {
|
|
||||||
url:'/rest/media',
|
|
||||||
clickable: false,
|
|
||||||
acceptedFiles: acceptedMimeTypes.join(),
|
|
||||||
init: function () {
|
|
||||||
this.on("sending", function (file, xhr, data) {
|
|
||||||
data.append("csrf_token", $("#csrf").val());
|
|
||||||
});
|
|
||||||
},
|
|
||||||
dictDefaultMessage: '',
|
|
||||||
createImageThumbnails: false,
|
|
||||||
previewTemplate : '<div style="display:none"></div>'
|
|
||||||
};
|
|
||||||
|
|
||||||
// define module vars.
|
|
||||||
$lib = $("#library_content");
|
|
||||||
$builder = $("#show_builder");
|
|
||||||
$fs = $builder.find('fieldset');
|
|
||||||
|
|
||||||
$("#schedule-tab").on("click", function() {
|
|
||||||
if (!$(this).hasClass('active')) {
|
|
||||||
AIRTIME.showbuilder.switchTab($("#show_builder .outer-datatable-wrapper"), $(this));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Icon hover states for search.
|
|
||||||
*/
|
|
||||||
$builder.on("mouseenter", ".sb-timerange .ui-button", function(ev) {
|
|
||||||
$(this).addClass("ui-state-hover");
|
|
||||||
});
|
|
||||||
$builder.on("mouseleave", ".sb-timerange .ui-button", function(ev) {
|
|
||||||
$(this).removeClass("ui-state-hover");
|
|
||||||
});
|
|
||||||
|
|
||||||
$builder.find(dateStartId)
|
|
||||||
.datepicker(oBaseDatePickerSettings)
|
|
||||||
.blur(validateTimeRange);
|
|
||||||
|
|
||||||
$builder.find(timeStartId)
|
|
||||||
.timepicker(oBaseTimePickerSettings)
|
|
||||||
.blur(validateTimeRange);
|
|
||||||
|
|
||||||
$builder.find(dateEndId)
|
|
||||||
.datepicker(oBaseDatePickerSettings)
|
|
||||||
.blur(validateTimeRange);
|
|
||||||
|
|
||||||
$builder.find(timeEndId)
|
|
||||||
.timepicker(oBaseTimePickerSettings)
|
|
||||||
.blur(validateTimeRange);
|
|
||||||
|
|
||||||
|
|
||||||
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId,
|
|
||||||
dateEndId, timeEndId);
|
|
||||||
AIRTIME.showbuilder.fnServerData.start = oRange.start;
|
|
||||||
AIRTIME.showbuilder.fnServerData.end = oRange.end;
|
|
||||||
|
|
||||||
//the user might not have the library on the page (guest user)
|
|
||||||
if (AIRTIME.library !== undefined) {
|
|
||||||
AIRTIME.library.libraryInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
AIRTIME.showbuilder.builderDataTable();
|
|
||||||
setWidgetSize();
|
|
||||||
|
|
||||||
$libWrapper = $lib.find("#library_display_wrapper");
|
|
||||||
//$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 : baseUrl+"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").find("#sb_date_start").css("margin-left", 30)
|
|
||||||
.end().end();
|
|
||||||
|
|
||||||
schedTable.fnDraw();
|
|
||||||
|
|
||||||
$.ajax( {
|
|
||||||
url : baseUrl+"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;
|
|
||||||
data["showInstanceFilter"] = fn.ops.showInstanceFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax( {
|
|
||||||
"dataType" : "json",
|
|
||||||
"type" : "GET",
|
|
||||||
"url" : baseUrl+"showbuilder/check-builder-feed",
|
|
||||||
"data" : data,
|
|
||||||
"success" : function(json) {
|
|
||||||
if (json.update === true) {
|
|
||||||
oTable.fnDraw();
|
|
||||||
}
|
|
||||||
setTimeout(checkScheduleUpdates, 5000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//check if the timeline view needs updating.
|
|
||||||
setTimeout(checkScheduleUpdates, 5000);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
mod.onResize = function() {
|
|
||||||
|
|
||||||
clearTimeout(resizeTimeout);
|
|
||||||
resizeTimeout = setTimeout(setWidgetSize, 100);
|
|
||||||
};
|
|
||||||
|
|
||||||
return AIRTIME;
|
|
||||||
|
|
||||||
} (AIRTIME || {}));
|
|
||||||
|
|
||||||
$(document).ready(AIRTIME.builderMain.onReady);
|
|
||||||
$(window).resize(AIRTIME.builderMain.onResize);
|
|
|
@ -7,13 +7,15 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$sbContent,
|
$sbContent,
|
||||||
$sbTable,
|
$sbTable,
|
||||||
$toolbar,
|
$toolbar,
|
||||||
$ul,
|
|
||||||
$lib,
|
$lib,
|
||||||
cursors = [],
|
cursors = [],
|
||||||
cursorIds = [],
|
cursorIds = [],
|
||||||
showInstanceIds = [],
|
showInstanceIds = [],
|
||||||
headerFooter = [],
|
headerFooter = [],
|
||||||
DISABLED_CLASS = 'ui-state-disabled';
|
DISABLED_CLASS = 'ui-state-disabled',
|
||||||
|
selectedRows,
|
||||||
|
$previouslySelected,
|
||||||
|
flagForDeselection;
|
||||||
|
|
||||||
if (AIRTIME.showbuilder === undefined) {
|
if (AIRTIME.showbuilder === undefined) {
|
||||||
AIRTIME.showbuilder = {};
|
AIRTIME.showbuilder = {};
|
||||||
|
@ -70,7 +72,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
.find(".fc-event-inner")
|
.find(".fc-event-inner")
|
||||||
.append('<span id="'+instance_id+'" title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
|
.append('<span id="'+instance_id+'" title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
mod.getTimestamp = function() {
|
mod.getTimestamp = function() {
|
||||||
|
|
||||||
|
@ -106,19 +108,34 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod.switchTab = function(tab, el) {
|
||||||
|
$(".active-tab").hide().removeClass("active-tab");
|
||||||
|
tab.addClass("active-tab").show();
|
||||||
|
|
||||||
|
$(".nav.nav-tabs .active").removeClass("active");
|
||||||
|
el.addClass("active");
|
||||||
|
|
||||||
|
if (tab.hasClass("pl-content")) {
|
||||||
|
AIRTIME.playlist.setAsActive();
|
||||||
|
}
|
||||||
|
AIRTIME.playlist.onResize();
|
||||||
|
AIRTIME.library.fnRedraw();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
mod.checkSelectButton = function() {
|
mod.checkSelectButton = function() {
|
||||||
var $selectable = $sbTable.find("tbody").find("input:checkbox");
|
var $selectable = $sbTable.find("tr");
|
||||||
|
|
||||||
if ($selectable.length !== 0) {
|
if ($selectable.length !== 0) {
|
||||||
AIRTIME.button.enableButton("btn-group #timeline-select", false);
|
AIRTIME.button.enableButton("btn-group #timeline-select", false);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
AIRTIME.button.disableButton("btn-group #timeline-select", false);
|
AIRTIME.button.disableButton("btn-group #timeline-select", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//need to check if the 'Select' button is disabled
|
//need to check if the 'Select' button is disabled
|
||||||
if ($(".btn-group #timeline-select").is(":disabled")) {
|
var select = $(".btn-group #timeline-select");
|
||||||
$(".btn-group #timeline-select").removeAttr("disabled");
|
if (select.is(":disabled")) {
|
||||||
|
select.removeAttr("disabled");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,7 +151,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.checkDeleteButton = function() {
|
mod.checkDeleteButton = function() {
|
||||||
var $selected = $sbTable.find("tbody").find("input:checkbox").filter(":checked");
|
var $selected = $sbTable.find("tr."+SB_SELECTED_CLASS);
|
||||||
|
|
||||||
var button = $("#show_builder").find(".icon-trash").parent();
|
var button = $("#show_builder").find(".icon-trash").parent();
|
||||||
if ($selected.length !== 0) {
|
if ($selected.length !== 0) {
|
||||||
|
@ -210,7 +227,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
* sNot is an optional string to filter selected elements by. (ex removing the currently playing item)
|
* sNot is an optional string to filter selected elements by. (ex removing the currently playing item)
|
||||||
*/
|
*/
|
||||||
mod.getSelectedData = function(sNot) {
|
mod.getSelectedData = function(sNot) {
|
||||||
var $selected = $sbTable.find("tbody").find("input:checkbox").filter(":checked").parents("tr"),
|
var $selected = $sbTable.find("tr."+SB_SELECTED_CLASS),
|
||||||
aData = [],
|
aData = [],
|
||||||
i, length,
|
i, length,
|
||||||
$item;
|
$item;
|
||||||
|
@ -228,23 +245,17 @@ var AIRTIME = (function(AIRTIME){
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.selectAll = function () {
|
mod.selectAll = function () {
|
||||||
$inputs = $sbTable.find("input:checkbox");
|
var $trs = $sbTable.find("tr.lib-audio").not(".sb-past, .sb-empty");
|
||||||
|
$trs.addClass(SB_SELECTED_CLASS).find(".sb-checkbox > input").prop('checked', true);
|
||||||
$inputs.attr("checked", true);
|
|
||||||
|
|
||||||
$trs = $inputs.parents("tr");
|
|
||||||
$trs.addClass(SB_SELECTED_CLASS);
|
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.selectNone = function () {
|
mod.selectNone = function () {
|
||||||
$inputs = $sbTable.find("input:checkbox");
|
var $trs = $sbTable.find("tr.lib-audio");
|
||||||
|
$trs.removeClass(SB_SELECTED_CLASS).find(".sb-checkbox > input").prop('checked', false);
|
||||||
$inputs.attr("checked", false);
|
$previouslySelected = undefined;
|
||||||
|
selectedRows = undefined;
|
||||||
$trs = $inputs.parents("tr");
|
|
||||||
$trs.removeClass(SB_SELECTED_CLASS);
|
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
};
|
};
|
||||||
|
@ -265,22 +276,18 @@ var AIRTIME = (function(AIRTIME){
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.enableUI = function() {
|
mod.enableUI = function() {
|
||||||
|
|
||||||
$lib.unblock();
|
$lib.unblock();
|
||||||
$sbContent.unblock();
|
$sbContent.unblock();
|
||||||
|
|
||||||
//Block UI changes the postion to relative to display the messages.
|
|
||||||
$lib.css("position", "static");
|
|
||||||
$sbContent.css("position", "static");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.fnItemCallback = function(json) {
|
mod.fnItemCallback = function(json) {
|
||||||
checkError(json);
|
checkError(json);
|
||||||
|
|
||||||
mod.getSelectedCursors();
|
mod.getSelectedCursors();
|
||||||
|
selectedRows = $("." + SB_SELECTED_CLASS);
|
||||||
oSchedTable.fnDraw();
|
oSchedTable.fnDraw();
|
||||||
|
|
||||||
mod.enableUI();
|
mod.enableUI();
|
||||||
|
|
||||||
//Unneccessary reload of the library pane after moving tracks in the showbuilder pane.
|
//Unneccessary reload of the library pane after moving tracks in the showbuilder pane.
|
||||||
//$("#library_content").find("#library_display").dataTable().fnStandingRedraw();
|
//$("#library_content").find("#library_display").dataTable().fnStandingRedraw();
|
||||||
|
|
||||||
|
@ -315,6 +322,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
};
|
};
|
||||||
|
|
||||||
mod.fnAdd = function(aMediaIds, aSchedIds) {
|
mod.fnAdd = function(aMediaIds, aSchedIds) {
|
||||||
|
AIRTIME.library.selectNone();
|
||||||
mod.disableUI();
|
mod.disableUI();
|
||||||
|
|
||||||
$.post(baseUrl+"showbuilder/schedule-add",
|
$.post(baseUrl+"showbuilder/schedule-add",
|
||||||
|
@ -385,7 +393,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
"url": sSource,
|
"url": sSource,
|
||||||
"data": aoData,
|
"data": aoData,
|
||||||
"success": function(json) {
|
"success": function(json) {
|
||||||
mod.updateCalendarStatusIcon(json)
|
mod.updateCalendarStatusIcon(json);
|
||||||
mod.setTimestamp(json.timestamp);
|
mod.setTimestamp(json.timestamp);
|
||||||
mod.setShowInstances(json.instances);
|
mod.setShowInstances(json.instances);
|
||||||
mod.getSelectedCursors();
|
mod.getSelectedCursors();
|
||||||
|
@ -398,20 +406,18 @@ var AIRTIME = (function(AIRTIME){
|
||||||
var $scroll = $sbContent.find(".dataTables_scrolling");
|
var $scroll = $sbContent.find(".dataTables_scrolling");
|
||||||
var scrolled = $scroll.scrollTop();
|
var scrolled = $scroll.scrollTop();
|
||||||
var scrollingTop = $scroll.offset().top;
|
var scrollingTop = $scroll.offset().top;
|
||||||
var oTable = $('#show_builder_table').dataTable();
|
|
||||||
var current = $sbTable.find("."+NOW_PLAYING_CLASS);
|
var current = $sbTable.find("."+NOW_PLAYING_CLASS);
|
||||||
var currentTop = current.offset().top;
|
var currentTop = current.offset().top;
|
||||||
|
|
||||||
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
|
$scroll.scrollTop(currentTop - scrollingTop + scrolled);
|
||||||
}
|
};
|
||||||
|
|
||||||
mod.builderDataTable = function() {
|
mod.builderDataTable = function() {
|
||||||
$sbContent = $('#show_builder');
|
$sbContent = $('#show_builder');
|
||||||
$lib = $("#library_content"),
|
$lib = $("#library_content");
|
||||||
$sbTable = $sbContent.find('table');
|
$sbTable = $sbContent.find('table');
|
||||||
var isInitialized = false;
|
var isInitialized = false;
|
||||||
|
|
||||||
var emptyNode = document.createElement('div');
|
|
||||||
var lockedPreviewIcon = document.createElement('span');
|
var lockedPreviewIcon = document.createElement('span');
|
||||||
lockedPreviewIcon.setAttribute('class', 'ui-icon ui-icon-locked');
|
lockedPreviewIcon.setAttribute('class', 'ui-icon ui-icon-locked');
|
||||||
var previewIcon = document.createElement('img');
|
var previewIcon = document.createElement('img');
|
||||||
|
@ -420,7 +426,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
oSchedTable = $sbTable.dataTable( {
|
oSchedTable = $sbTable.dataTable( {
|
||||||
"aoColumns": [
|
"aoColumns": [
|
||||||
/* checkbox */ {"mDataProp": "allowed", "sTitle": "", "sWidth": "15px", "sClass": "sb-checkbox"},
|
/* checkbox */ {"mDataProp": "allowed", "sTitle": "", "sWidth": "16px", "sClass": "sb-checkbox"},
|
||||||
/* Type */ {"mDataProp": "image", "sTitle": "", "sClass": "library_image sb-image", "sWidth": "16px"},
|
/* Type */ {"mDataProp": "image", "sTitle": "", "sClass": "library_image sb-image", "sWidth": "16px"},
|
||||||
/* starts */ {"mDataProp": "starts", "sTitle": $.i18n._("Start"), "sClass": "sb-starts", "sWidth": "60px"},
|
/* starts */ {"mDataProp": "starts", "sTitle": $.i18n._("Start"), "sClass": "sb-starts", "sWidth": "60px"},
|
||||||
/* ends */ {"mDataProp": "ends", "sTitle": $.i18n._("End"), "sClass": "sb-ends", "sWidth": "60px"},
|
/* ends */ {"mDataProp": "ends", "sTitle": $.i18n._("End"), "sClass": "sb-ends", "sWidth": "60px"},
|
||||||
|
@ -451,16 +457,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
delete oData.aoSearchCols;
|
delete oData.aoSearchCols;
|
||||||
},
|
},
|
||||||
"fnStateSave": function fnStateSave(oSettings, oData) {
|
"fnStateSave": function fnStateSave(oSettings, oData) {
|
||||||
|
|
||||||
localStorage.setItem('datatables-timeline', JSON.stringify(oData));
|
localStorage.setItem('datatables-timeline', JSON.stringify(oData));
|
||||||
|
|
||||||
/*
|
|
||||||
$.ajax({
|
|
||||||
url: baseUrl+"usersettings/set-timeline-datatable",
|
|
||||||
type: "POST",
|
|
||||||
data: {settings : oData, format: "json"},
|
|
||||||
dataType: "json"
|
|
||||||
});*/
|
|
||||||
},
|
},
|
||||||
"fnStateLoad": function fnBuilderStateLoad(oSettings) {
|
"fnStateLoad": function fnBuilderStateLoad(oSettings) {
|
||||||
var settings = localStorage.getItem('datatables-timeline');
|
var settings = localStorage.getItem('datatables-timeline');
|
||||||
|
@ -478,20 +475,10 @@ var AIRTIME = (function(AIRTIME){
|
||||||
//sure everything works properly.
|
//sure everything works properly.
|
||||||
for (i = 0, length = a.length; i < length; i++) {
|
for (i = 0, length = a.length; i < length; i++) {
|
||||||
if (typeof(a[i]) === "string") {
|
if (typeof(a[i]) === "string") {
|
||||||
a[i] = (a[i] === "true") ? true : false;
|
a[i] = (a[i] === "true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
a = oData.ColReorder;
|
|
||||||
if (a) {
|
|
||||||
for (i = 0, length = a.length; i < length; i++) {
|
|
||||||
if (typeof(a[i]) === "string") {
|
|
||||||
a[i] = parseInt(a[i], 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
oData.iCreate = parseInt(oData.iCreate, 10);
|
oData.iCreate = parseInt(oData.iCreate, 10);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -513,7 +500,6 @@ var AIRTIME = (function(AIRTIME){
|
||||||
//Albert:
|
//Albert:
|
||||||
//$(nRow.children[iNodeIndex]).replaceWith(emptyNode);
|
//$(nRow.children[iNodeIndex]).replaceWith(emptyNode);
|
||||||
|
|
||||||
|
|
||||||
$node = $(nRow.children[iNodeIndex]);
|
$node = $(nRow.children[iNodeIndex]);
|
||||||
$node.html(sRowContent);
|
$node.html(sRowContent);
|
||||||
|
|
||||||
|
@ -599,7 +585,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$node.empty();
|
$node.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
sSeparatorHTML = '<span>'+$.i18n._("Show Empty")+'</span>';
|
sSeparatorHTML = '<span>'+$.i18n._("Drag tracks here from the library")+'</span>';
|
||||||
cl = cl + " sb-empty odd";
|
cl = cl + " sb-empty odd";
|
||||||
|
|
||||||
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
|
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
|
||||||
|
@ -627,12 +613,6 @@ var AIRTIME = (function(AIRTIME){
|
||||||
//$image.html('<span class="ui-icon ui-icon-locked"></span>');
|
//$image.html('<span class="ui-icon ui-icon-locked"></span>');
|
||||||
$image.append(lockedPreviewIcon);
|
$image.append(lockedPreviewIcon);
|
||||||
} else {
|
} else {
|
||||||
/*
|
|
||||||
$image.html('<img title="'+$.i18n._("Track preview")+'" src="'+baseUrl+'css/images/icon_audioclip.png"></img>')
|
|
||||||
.click(function() {
|
|
||||||
open_show_preview(aData.instance, aData.pos);
|
|
||||||
return false;
|
|
||||||
});*/
|
|
||||||
$image.append(previewIcon.cloneNode(false));
|
$image.append(previewIcon.cloneNode(false));
|
||||||
$image.click(function() {
|
$image.click(function() {
|
||||||
open_show_preview(aData.instance, aData.pos);
|
open_show_preview(aData.instance, aData.pos);
|
||||||
|
@ -691,7 +671,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
if (aData.scheduled === 1) {
|
if (aData.scheduled === 1) {
|
||||||
$nRow.addClass(NOW_PLAYING_CLASS);
|
$nRow.addClass(NOW_PLAYING_CLASS);
|
||||||
}
|
}
|
||||||
else if (aData.scheduled === 0) {
|
else if (aData.scheduled === 0 || aData.scheduled === undefined) {
|
||||||
$nRow.addClass("sb-past");
|
$nRow.addClass("sb-past");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -718,14 +698,6 @@ var AIRTIME = (function(AIRTIME){
|
||||||
if (aData.currentShow === true) {
|
if (aData.currentShow === true) {
|
||||||
$nRow.addClass("sb-current-show");
|
$nRow.addClass("sb-current-show");
|
||||||
}
|
}
|
||||||
|
|
||||||
//call the context menu so we can prevent the event from propagating.
|
|
||||||
$nRow.find('td:gt(1)').click(function(e){
|
|
||||||
|
|
||||||
$(this).contextMenu({x: e.pageX, y: e.pageY});
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
//remove any selected nodes before the draw.
|
//remove any selected nodes before the draw.
|
||||||
"fnPreDrawCallback": function( oSettings ) {
|
"fnPreDrawCallback": function( oSettings ) {
|
||||||
|
@ -744,95 +716,12 @@ var AIRTIME = (function(AIRTIME){
|
||||||
}
|
}
|
||||||
|
|
||||||
isInitialized = true;
|
isInitialized = true;
|
||||||
var wrapperDiv,
|
var aData,
|
||||||
markerDiv,
|
|
||||||
$td,
|
|
||||||
aData,
|
|
||||||
elements,
|
elements,
|
||||||
i, length, temp,
|
i, length, temp;
|
||||||
$cursorRows,
|
|
||||||
$table = $(this),
|
|
||||||
$parent = $table.parent(),
|
|
||||||
$tr,
|
|
||||||
//use this array to cache DOM heights then we can detach the table to manipulate it to increase speed.
|
|
||||||
heights = [];
|
|
||||||
|
|
||||||
clearTimeout(mod.timeout);
|
clearTimeout(mod.timeout);
|
||||||
|
|
||||||
/*
|
|
||||||
//only create the cursor arrows if the library is on the page.
|
|
||||||
if ($lib.length > 0 && $lib.filter(":visible").length > 0) {
|
|
||||||
|
|
||||||
$cursorRows = $sbTable.find("tbody tr.sb-future.sb-allowed:not(.sb-header, .sb-empty)");
|
|
||||||
|
|
||||||
//need to get heights of tds while elements are still in the DOM.
|
|
||||||
for (i = 0, length = $cursorRows.length; i < length; i++) {
|
|
||||||
$td = $($cursorRows.get(i)).find("td:first");
|
|
||||||
heights.push($td.height());
|
|
||||||
}
|
|
||||||
|
|
||||||
//detach the table to increase speed.
|
|
||||||
$table.detach();
|
|
||||||
|
|
||||||
for (i = 0, length = $cursorRows.length; i < length; i++) {
|
|
||||||
|
|
||||||
$td = $($cursorRows.get(i)).find("td:first");
|
|
||||||
if ($td.hasClass("dataTables_empty")) {
|
|
||||||
$parent.append($table);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wrapperDiv = $("<div />", {
|
|
||||||
"class": "innerWrapper",
|
|
||||||
"css": {
|
|
||||||
"height": heights[i]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
markerDiv = $("<div />", {
|
|
||||||
"class": "marker"
|
|
||||||
});
|
|
||||||
|
|
||||||
$td.append(markerDiv).wrapInner(wrapperDiv);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//re-highlight selected cursors before draw took place
|
|
||||||
for (i = 0; i < cursorIds.length; i++) {
|
|
||||||
if (headerFooter[i] == "f") {
|
|
||||||
$tr = $table.find("tbody tr.sb-footer[id="+cursorIds[i]+"][si_id="+showInstanceIds[i]+"]");
|
|
||||||
} else {
|
|
||||||
$tr = $table.find("tr[id="+cursorIds[i]+"][si_id="+showInstanceIds[i]+"]");
|
|
||||||
}
|
|
||||||
|
|
||||||
//If the currently playing track's cursor is selected,
|
|
||||||
//and that track is deleted, the cursor position becomes
|
|
||||||
//unavailble. We have to check the position is available
|
|
||||||
// before re-highlighting it.
|
|
||||||
//
|
|
||||||
if ($tr.find(".sb-checkbox").children().hasClass("innerWrapper")) {
|
|
||||||
mod.selectCursor($tr);
|
|
||||||
|
|
||||||
// If the selected cursor is the footer row we need to
|
|
||||||
//explicitly select it because that row does not have
|
|
||||||
// innerWrapper class
|
|
||||||
//
|
|
||||||
} else if ($tr.hasClass("sb-footer")) {
|
|
||||||
mod.selectCursor($tr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//if there is only 1 cursor on the page highlight it by default.
|
|
||||||
if ($cursorRows.length === 1) {
|
|
||||||
$td = $cursorRows.find("td:first");
|
|
||||||
if (!$td.hasClass("dataTables_empty")) {
|
|
||||||
$cursorRows.addClass("cursor-selected-row");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$parent.append($table);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//order of importance of elements for setting the next timeout.
|
//order of importance of elements for setting the next timeout.
|
||||||
elements = [
|
elements = [
|
||||||
$sbTable.find("tr."+NOW_PLAYING_CLASS),
|
$sbTable.find("tr."+NOW_PLAYING_CLASS),
|
||||||
|
@ -859,14 +748,24 @@ var AIRTIME = (function(AIRTIME){
|
||||||
|
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
mod.checkToolBarIcons();
|
||||||
|
|
||||||
|
var sid;
|
||||||
|
if (selectedRows !== undefined) {
|
||||||
|
selectedRows.each(function (i, el) {
|
||||||
|
sid = $(el).attr("id");
|
||||||
|
var tr = $("#" + sid);
|
||||||
|
tr.addClass(SB_SELECTED_CLASS);
|
||||||
|
tr.find("input[type='checkbox']").prop("checked", true);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// R = ColReorder, C = ColVis
|
// R = ColReorder, C = ColVis
|
||||||
"sDom": 'R<"dt-process-rel"r><"sb-padded"<"H"C>><"dataTables_scrolling sb-padded"t>',
|
"sDom": 'R<"dt-process-rel"r><"sb-padded"<"H"C>><"dataTables_scrolling sb-padded"t><"F">',
|
||||||
|
|
||||||
"oColVis": {
|
"oColVis": {
|
||||||
"aiExclude": [ 0, 1 ],
|
"aiExclude": [ 0, 1 ],
|
||||||
"buttonText": $.i18n._("Show / hide columns"),
|
"buttonText": $.i18n._("Columns")
|
||||||
},
|
},
|
||||||
|
|
||||||
"oColReorder": {
|
"oColReorder": {
|
||||||
|
@ -874,35 +773,159 @@ var AIRTIME = (function(AIRTIME){
|
||||||
},
|
},
|
||||||
|
|
||||||
"sAjaxDataProp": "schedule",
|
"sAjaxDataProp": "schedule",
|
||||||
"oLanguage": datatables_dict,
|
"oLanguage": getDatatablesStrings({
|
||||||
"sAjaxSource": baseUrl+"showbuilder/builder-feed"
|
"sZeroRecords": $.i18n._("There are no shows scheduled during the specified time period."),
|
||||||
|
"sEmptyTable": $.i18n._("There are no shows scheduled during the specified time period."),
|
||||||
|
}),
|
||||||
|
"sAjaxSource": baseUrl+"showbuilder/builder-feed",
|
||||||
|
|
||||||
|
"bScrollCollapseY": false
|
||||||
});
|
});
|
||||||
|
|
||||||
$sbTable.find("tbody").on("click", "input:checkbox", function(ev) {
|
$sbTable.find("tbody").on("mousedown", "tr:not(.sb-header, .sb-footer, .sb-past, .sb-empty, :has(td.dataTables_empty))", function(ev) {
|
||||||
|
var $tr = $(this),
|
||||||
|
// Get the ID of the selected row
|
||||||
|
$rowId = $tr.attr("id");
|
||||||
|
|
||||||
var $cb = $(this),
|
if (!$tr.hasClass(SB_SELECTED_CLASS)) {
|
||||||
$tr = $cb.parents("tr"),
|
if (ev.shiftKey && $previouslySelected !== undefined) {
|
||||||
$prev;
|
if ($previouslySelected.attr("id") == $rowId) {
|
||||||
|
return;
|
||||||
if ($cb.is(":checked")) {
|
|
||||||
|
|
||||||
if (ev.shiftKey) {
|
|
||||||
$prev = $sbTable.find("tbody").find("tr."+SB_SELECTED_CLASS).eq(-1);
|
|
||||||
|
|
||||||
$prev.nextUntil($tr)
|
|
||||||
.addClass(SB_SELECTED_CLASS)
|
|
||||||
.find("input:checkbox")
|
|
||||||
.attr("checked", true)
|
|
||||||
.end();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the selected row comes before the previously selected row,
|
||||||
|
// we want to select previous rows, otherwise we select next
|
||||||
|
if ($previouslySelected.prevAll("#" + $rowId).length !== 0) {
|
||||||
|
$previouslySelected.prevUntil($tr).each(function (i, el) {
|
||||||
|
$(el).addClass(SB_SELECTED_CLASS);
|
||||||
|
$(el).find(".sb-checkbox > input").prop('checked', true);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$previouslySelected.nextUntil($tr).each(function (i, el) {
|
||||||
|
$(el).addClass(SB_SELECTED_CLASS);
|
||||||
|
$(el).find(".sb-checkbox > input").prop('checked', true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
$tr.addClass(SB_SELECTED_CLASS);
|
$tr.addClass(SB_SELECTED_CLASS);
|
||||||
|
$tr.find(".sb-checkbox > input").prop('checked', true);
|
||||||
|
} else {
|
||||||
|
flagForDeselection = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedRows = $("." + SB_SELECTED_CLASS);
|
||||||
|
// Remember this row so we can properly multiselect
|
||||||
|
$previouslySelected = $tr;
|
||||||
|
});
|
||||||
|
|
||||||
|
$sbTable.find("tbody").on("click", "tr:not(.sb-header, .sb-footer, .sb-past, .sb-empty, :has(td.dataTables_empty))", function(ev) {
|
||||||
|
if (flagForDeselection) {
|
||||||
|
flagForDeselection = false;
|
||||||
|
$(this).removeClass(SB_SELECTED_CLASS);
|
||||||
|
$(this).find(".sb-checkbox > input").prop('checked', false);
|
||||||
|
} else {
|
||||||
|
$(this).find(".sb-checkbox > input").prop('checked', true);
|
||||||
|
}
|
||||||
|
selectedRows = $("." + SB_SELECTED_CLASS);
|
||||||
|
mod.checkToolBarIcons();
|
||||||
|
});
|
||||||
|
|
||||||
|
//begin context menu initialization.
|
||||||
|
$.contextMenu({
|
||||||
|
selector: '#show_builder tr.lib-audio:not(.sb-past)',
|
||||||
|
trigger: "right",
|
||||||
|
|
||||||
|
build: function($el, e) {
|
||||||
|
var items,
|
||||||
|
$tr = $el,
|
||||||
|
data = $tr.data("aData"),
|
||||||
|
cursorClass = "cursor-selected-row",
|
||||||
|
callback;
|
||||||
|
|
||||||
|
function processMenuItems(oItems) {
|
||||||
|
|
||||||
|
//define a preview callback.
|
||||||
|
if (oItems.preview !== undefined) {
|
||||||
|
|
||||||
|
callback = function() {
|
||||||
|
open_show_preview(data.instance, data.pos);
|
||||||
|
};
|
||||||
|
|
||||||
|
oItems.preview.callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
//define a select cursor callback.
|
||||||
|
if (oItems.selCurs !== undefined) {
|
||||||
|
|
||||||
|
callback = function() {
|
||||||
|
var $tr = $(this).parents('tr').next();
|
||||||
|
|
||||||
|
mod.selectCursor($tr);
|
||||||
|
};
|
||||||
|
|
||||||
|
oItems.selCurs.callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
//define a remove cursor callback.
|
||||||
|
if (oItems.delCurs !== undefined) {
|
||||||
|
|
||||||
|
callback = function() {
|
||||||
|
var $tr = $(this).parents('tr').next();
|
||||||
|
|
||||||
|
mod.removeCursor($tr);
|
||||||
|
};
|
||||||
|
|
||||||
|
oItems.delCurs.callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
//define a delete callback.
|
||||||
|
if (oItems.del !== undefined) {
|
||||||
|
|
||||||
|
callback = function() {
|
||||||
|
AIRTIME.showbuilder.fnRemove([{
|
||||||
|
id: data.id,
|
||||||
|
timestamp: data.timestamp,
|
||||||
|
instance: data.instance
|
||||||
|
}]);
|
||||||
|
};
|
||||||
|
|
||||||
|
oItems.del.callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
//only show the cursor selecting options if the library is visible on the page.
|
||||||
|
if ($tr.next().find('.marker').length === 0) {
|
||||||
|
delete oItems.selCurs;
|
||||||
|
delete oItems.delCurs;
|
||||||
|
}
|
||||||
|
//check to include either select or remove cursor.
|
||||||
|
else {
|
||||||
|
if ($tr.next().hasClass(cursorClass)) {
|
||||||
|
delete oItems.selCurs;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$tr.removeClass(SB_SELECTED_CLASS);
|
delete oItems.delCurs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod.checkToolBarIcons();
|
items = oItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
request = $.ajax({
|
||||||
|
url: baseUrl+"showbuilder/context-menu",
|
||||||
|
type: "GET",
|
||||||
|
data: {id : data.id, format: "json"},
|
||||||
|
dataType: "json",
|
||||||
|
async: false,
|
||||||
|
success: function(json){
|
||||||
|
processMenuItems(json.items);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
items: items
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var sortableConf = (function(){
|
var sortableConf = (function(){
|
||||||
|
@ -1000,7 +1023,7 @@ var AIRTIME = (function(AIRTIME){
|
||||||
return {
|
return {
|
||||||
placeholder: "sb-placeholder ui-state-highlight",
|
placeholder: "sb-placeholder ui-state-highlight",
|
||||||
//forcePlaceholderSize: true,
|
//forcePlaceholderSize: true,
|
||||||
distance: 10,
|
distance: 25,
|
||||||
helper:
|
helper:
|
||||||
function(event, item) {
|
function(event, item) {
|
||||||
var selected = mod.getSelectedData(NOW_PLAYING_CLASS),
|
var selected = mod.getSelectedData(NOW_PLAYING_CLASS),
|
||||||
|
@ -1042,7 +1065,6 @@ var AIRTIME = (function(AIRTIME){
|
||||||
.addClass("ui-state-highlight")
|
.addClass("ui-state-highlight")
|
||||||
.append(message)
|
.append(message)
|
||||||
.end();
|
.end();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
helperData = selected;
|
helperData = selected;
|
||||||
|
@ -1053,19 +1075,10 @@ var AIRTIME = (function(AIRTIME){
|
||||||
cancel: '.sb-footer',
|
cancel: '.sb-footer',
|
||||||
receive: fnReceive,
|
receive: fnReceive,
|
||||||
update: fnUpdate,
|
update: fnUpdate,
|
||||||
|
axis: "y",
|
||||||
|
containment: "document",
|
||||||
start: function(event, ui) {
|
start: function(event, ui) {
|
||||||
/*
|
var elements = $sbTable.find('tr.'+SB_SELECTED_CLASS).not("."+NOW_PLAYING_CLASS);
|
||||||
var elements = $sbTable.find('tr input:checked').parents('tr')
|
|
||||||
.not(ui.item)
|
|
||||||
.not("."+NOW_PLAYING_CLASS);
|
|
||||||
|
|
||||||
//remove all other items from the screen,
|
|
||||||
//don't remove ui.item or else we can not get position information when the user drops later.
|
|
||||||
elements.remove();
|
|
||||||
*/
|
|
||||||
|
|
||||||
var elements = $sbTable.find('tr input:checked').parents('tr').not("."+NOW_PLAYING_CLASS);
|
|
||||||
|
|
||||||
elements.hide();
|
elements.hide();
|
||||||
},
|
},
|
||||||
stop: function() {
|
stop: function() {
|
||||||
|
@ -1078,7 +1091,10 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$sbTable.sortable(sortableConf);
|
$sbTable.sortable(sortableConf);
|
||||||
|
|
||||||
//start setup of the builder toolbar.
|
//start setup of the builder toolbar.
|
||||||
$toolbar = $(".sb-content .fg-toolbar");
|
$toolbar = $(".sb-content .fg-toolbar:first");
|
||||||
|
var footer = $(".sb-content .fg-toolbar:last"),
|
||||||
|
timerange = $(".sb-timerange");
|
||||||
|
$toolbar.append(timerange);
|
||||||
|
|
||||||
$menu = $("<div class='btn-toolbar'/>");
|
$menu = $("<div class='btn-toolbar'/>");
|
||||||
$menu.append("<div class='btn-group'>" +
|
$menu.append("<div class='btn-group'>" +
|
||||||
|
@ -1091,21 +1107,29 @@ var AIRTIME = (function(AIRTIME){
|
||||||
"</ul>" +
|
"</ul>" +
|
||||||
"</div>")
|
"</div>")
|
||||||
.append("<div class='btn-group'>" +
|
.append("<div class='btn-group'>" +
|
||||||
"<button title='"+$.i18n._("Remove overbooked tracks")+"' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
|
"<button title='"+$.i18n._("Trim overbooked shows")+"' class='ui-state-disabled btn btn-small btn-icon-text' disabled='disabled'>" +
|
||||||
"<i class='icon-white icon-cut'></i></button></div>")
|
"<i class='icon-white icon-cut'></i>" +
|
||||||
|
"<span>" + $.i18n._('Trim overbooked shows') + "</span>" +
|
||||||
|
"</button></div>")
|
||||||
.append("<div class='btn-group'>" +
|
.append("<div class='btn-group'>" +
|
||||||
"<button title='"+$.i18n._("Remove selected scheduled items")+"' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
|
"<button title='"+$.i18n._("Remove selected scheduled items")+"' class='ui-state-disabled btn btn-small btn-icon-text btn-danger' disabled='disabled'>" +
|
||||||
"<i class='icon-white icon-trash'></i></button></div>");
|
"<i class='icon-white icon-trash'></i>" +
|
||||||
|
"<span>" + $.i18n._('Remove') + "</span>" +
|
||||||
|
"</button></div>");
|
||||||
|
|
||||||
//if 'Add/Remove content' was chosen from the context menu
|
//if 'Add/Remove content' was chosen from the context menu
|
||||||
//in the Calendar do not append these buttons
|
//in the Calendar do not append these buttons
|
||||||
if ($(".ui-dialog-content").length === 0) {
|
if ($(".ui-dialog-content").length === 0) {
|
||||||
$menu.append("<div class='btn-group'>" +
|
$menu.append("<div class='btn-group'>" +
|
||||||
"<button title='"+$.i18n._("Jump to the current playing track")+"' class='ui-state-disabled btn btn-small' disabled='disabled'>" +
|
"<button title='"+$.i18n._("Jump to the current playing track")+"' class='ui-state-disabled btn btn-small btn-icon-text' disabled='disabled'>" +
|
||||||
"<i class='icon-white icon-step-forward'></i></button></div>")
|
"<i class='icon-white icon-step-forward'></i>" +
|
||||||
|
"<span>" + $.i18n._('Jump to Current') + "</span>" +
|
||||||
|
"</button></div>")
|
||||||
.append("<div class='btn-group'>" +
|
.append("<div class='btn-group'>" +
|
||||||
"<button title='"+$.i18n._("Cancel current show")+"' class='ui-state-disabled btn btn-small btn-danger' disabled='disabled'>" +
|
"<button title='"+$.i18n._("Cancel current show")+"' class='ui-state-disabled btn btn-small btn-icon-text btn-danger' disabled='disabled'>" +
|
||||||
"<i class='icon-white icon-ban-circle'></i></button></div>");
|
"<i class='icon-white icon-ban-circle'></i>" +
|
||||||
|
"<span>" + $.i18n._('Cancel current show') + "</span>" +
|
||||||
|
"</button></div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localStorage.getItem('user-type') != 'G') {
|
if (localStorage.getItem('user-type') != 'G') {
|
||||||
|
@ -1239,106 +1263,6 @@ var AIRTIME = (function(AIRTIME){
|
||||||
$el.removeAttr("disabled");
|
$el.removeAttr("disabled");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//begin context menu initialization.
|
|
||||||
$.contextMenu({
|
|
||||||
selector: '.sb-content table tbody tr:not(.sb-empty, .sb-footer, .sb-header, .sb-record) td:not(.sb-checkbox, .sb-image)',
|
|
||||||
trigger: "left",
|
|
||||||
ignoreRightClick: true,
|
|
||||||
|
|
||||||
build: function($el, e) {
|
|
||||||
var items,
|
|
||||||
$tr = $el.parent(),
|
|
||||||
data = $tr.data("aData"),
|
|
||||||
cursorClass = "cursor-selected-row",
|
|
||||||
callback;
|
|
||||||
|
|
||||||
function processMenuItems(oItems) {
|
|
||||||
|
|
||||||
//define a preview callback.
|
|
||||||
if (oItems.preview !== undefined) {
|
|
||||||
|
|
||||||
callback = function() {
|
|
||||||
open_show_preview(data.instance, data.pos);
|
|
||||||
};
|
|
||||||
|
|
||||||
oItems.preview.callback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
//define a select cursor callback.
|
|
||||||
if (oItems.selCurs !== undefined) {
|
|
||||||
|
|
||||||
callback = function() {
|
|
||||||
var $tr = $(this).parents('tr').next();
|
|
||||||
|
|
||||||
mod.selectCursor($tr);
|
|
||||||
};
|
|
||||||
|
|
||||||
oItems.selCurs.callback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
//define a remove cursor callback.
|
|
||||||
if (oItems.delCurs !== undefined) {
|
|
||||||
|
|
||||||
callback = function() {
|
|
||||||
var $tr = $(this).parents('tr').next();
|
|
||||||
|
|
||||||
mod.removeCursor($tr);
|
|
||||||
};
|
|
||||||
|
|
||||||
oItems.delCurs.callback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
//define a delete callback.
|
|
||||||
if (oItems.del !== undefined) {
|
|
||||||
|
|
||||||
callback = function() {
|
|
||||||
AIRTIME.showbuilder.fnRemove([{
|
|
||||||
id: data.id,
|
|
||||||
timestamp: data.timestamp,
|
|
||||||
instance: data.instance
|
|
||||||
}]);
|
|
||||||
};
|
|
||||||
|
|
||||||
oItems.del.callback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
//only show the cursor selecting options if the library is visible on the page.
|
|
||||||
if ($tr.next().find('.marker').length === 0) {
|
|
||||||
delete oItems.selCurs;
|
|
||||||
delete oItems.delCurs;
|
|
||||||
}
|
|
||||||
//check to include either select or remove cursor.
|
|
||||||
else {
|
|
||||||
if ($tr.next().hasClass(cursorClass)) {
|
|
||||||
delete oItems.selCurs;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
delete oItems.delCurs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
items = oItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
request = $.ajax({
|
|
||||||
url: baseUrl+"showbuilder/context-menu",
|
|
||||||
type: "GET",
|
|
||||||
data: {id : data.id, format: "json"},
|
|
||||||
dataType: "json",
|
|
||||||
async: false,
|
|
||||||
success: function(json){
|
|
||||||
processMenuItems(json.items);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return {
|
|
||||||
items: items
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return AIRTIME;
|
return AIRTIME;
|
||||||
|
|
|
@ -15,12 +15,6 @@ AIRTIME = (function(AIRTIME) {
|
||||||
timeStartId = "#sb_time_start",
|
timeStartId = "#sb_time_start",
|
||||||
dateEndId = "#sb_date_end",
|
dateEndId = "#sb_date_end",
|
||||||
timeEndId = "#sb_time_end",
|
timeEndId = "#sb_time_end",
|
||||||
$toggleLib = $("<a id='sb_edit' class='btn btn-small' href='#' title='"+$.i18n._("Open library to add or remove content")+"'>"+$.i18n._("Add / Remove Content")+"</a>"),
|
|
||||||
$libClose = $('<a />', {
|
|
||||||
"class": "close-round",
|
|
||||||
"href": "#",
|
|
||||||
"id": "sb_lib_close"
|
|
||||||
}),
|
|
||||||
mod;
|
mod;
|
||||||
|
|
||||||
if (AIRTIME.builderMain === undefined) {
|
if (AIRTIME.builderMain === undefined) {
|
||||||
|
@ -64,22 +58,22 @@ AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the heights of the main widgets.
|
//set the heights of the main widgets.
|
||||||
$builder.height(widgetHeight)
|
$builder//.height(widgetHeight)
|
||||||
.find(".dataTables_scrolling")
|
.find(".dataTables_scrolling")
|
||||||
.css("max-height", builderTableHeight)
|
//.css("max-height", builderTableHeight)
|
||||||
.end()
|
.end();
|
||||||
.width(screenWidth);
|
//.width(screenWidth);
|
||||||
|
|
||||||
$lib.height(widgetHeight)
|
$lib//.height(widgetHeight)
|
||||||
.find(".dataTables_scrolling")
|
.find(".dataTables_scrolling")
|
||||||
.css("max-height", libTableHeight)
|
//.css("max-height", libTableHeight)
|
||||||
.end();
|
.end();
|
||||||
|
|
||||||
if ($lib.filter(':visible').length > 0) {
|
if ($lib.filter(':visible').length > 0) {
|
||||||
|
|
||||||
$lib.width(Math.floor(screenWidth * 0.47));
|
//$lib.width(Math.floor(screenWidth * 0.47));
|
||||||
|
|
||||||
$builder.width(Math.floor(screenWidth * 0.47))
|
$builder//.width(Math.floor(screenWidth * 0.47))
|
||||||
.find("#sb_edit")
|
.find("#sb_edit")
|
||||||
.remove()
|
.remove()
|
||||||
.end()
|
.end()
|
||||||
|
@ -150,11 +144,33 @@ AIRTIME = (function(AIRTIME) {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod.onReady = function() {
|
mod.onReady = function() {
|
||||||
|
// Normally we would just use audio/*, but it includes file types that we can't handle (like .m4a)
|
||||||
|
// We initialize the acceptedMimeTypes variable in Bootstrap so we don't have to duplicate the list
|
||||||
|
Dropzone.options.content = {
|
||||||
|
url:'/rest/media',
|
||||||
|
clickable: false,
|
||||||
|
acceptedFiles: acceptedMimeTypes.join(),
|
||||||
|
init: function () {
|
||||||
|
this.on("sending", function (file, xhr, data) {
|
||||||
|
data.append("csrf_token", $("#csrf").val());
|
||||||
|
});
|
||||||
|
},
|
||||||
|
dictDefaultMessage: '',
|
||||||
|
createImageThumbnails: false,
|
||||||
|
previewTemplate : '<div style="display:none"></div>'
|
||||||
|
};
|
||||||
|
|
||||||
// define module vars.
|
// define module vars.
|
||||||
$lib = $("#library_content");
|
$lib = $("#library_content");
|
||||||
$builder = $("#show_builder");
|
$builder = $("#show_builder");
|
||||||
$fs = $builder.find('fieldset');
|
$fs = $builder.find('fieldset');
|
||||||
|
|
||||||
|
$("#schedule-tab").on("click", function() {
|
||||||
|
if (!$(this).hasClass('active')) {
|
||||||
|
AIRTIME.showbuilder.switchTab($("#show_builder .outer-datatable-wrapper"), $(this));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Icon hover states for search.
|
* Icon hover states for search.
|
||||||
*/
|
*/
|
||||||
|
@ -196,10 +212,8 @@ AIRTIME = (function(AIRTIME) {
|
||||||
setWidgetSize();
|
setWidgetSize();
|
||||||
|
|
||||||
$libWrapper = $lib.find("#library_display_wrapper");
|
$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_submit", showSearchSubmit);
|
||||||
|
|
||||||
|
@ -236,11 +250,9 @@ AIRTIME = (function(AIRTIME) {
|
||||||
var schedTable = $("#show_builder_table").dataTable();
|
var schedTable = $("#show_builder_table").dataTable();
|
||||||
|
|
||||||
$lib.hide();
|
$lib.hide();
|
||||||
$builder.width(screenWidth).find(".sb-timerange").prepend(
|
$builder.width(screenWidth).find(".sb-timerange").find("#sb_date_start").css("margin-left", 30)
|
||||||
$toggleLib).find("#sb_date_start").css("margin-left", 30)
|
|
||||||
.end().end();
|
.end().end();
|
||||||
|
|
||||||
$toggleLib.removeClass("ui-state-hover");
|
|
||||||
schedTable.fnDraw();
|
schedTable.fnDraw();
|
||||||
|
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
|
@ -264,8 +276,8 @@ AIRTIME = (function(AIRTIME) {
|
||||||
if ($fs.hasClass("closed")) {
|
if ($fs.hasClass("closed")) {
|
||||||
|
|
||||||
$fs.removeClass("closed");
|
$fs.removeClass("closed");
|
||||||
$builder.find('.dataTables_scrolling').css(
|
//$builder.find('.dataTables_scrolling').css(
|
||||||
"max-height", widgetHeight - 150);
|
// "max-height", widgetHeight - 150);
|
||||||
} else {
|
} else {
|
||||||
$fs.addClass("closed");
|
$fs.addClass("closed");
|
||||||
|
|
||||||
|
@ -273,8 +285,8 @@ AIRTIME = (function(AIRTIME) {
|
||||||
$fs.find('select').val(0);
|
$fs.find('select').val(0);
|
||||||
$fs.find('input[type="checkbox"]').attr("checked",
|
$fs.find('input[type="checkbox"]').attr("checked",
|
||||||
false);
|
false);
|
||||||
$builder.find('.dataTables_scrolling').css(
|
//$builder.find('.dataTables_scrolling').css(
|
||||||
"max-height", widgetHeight - 110);
|
// "max-height", widgetHeight - 110);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue