SAAS-948 - ShowBuilder redesign editors and fixes

This commit is contained in:
Duncan Sommerville 2015-07-27 15:37:55 -04:00
parent ba90b1f1eb
commit 59d89b0b9e
16 changed files with 2048 additions and 236 deletions

View file

@ -11,7 +11,6 @@ class LibraryController extends Zend_Controller_Action
{
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('contents-feed', 'json')
->addActionContext('contents-feed-test', 'json')
->addActionContext('delete', 'json')
->addActionContext('duplicate', 'json')
->addActionContext('delete-group', 'json')
@ -424,19 +423,6 @@ class LibraryController extends Zend_Controller_Action
$this->view->files = SecurityHelper::htmlescape_recursive($r["aaData"]);
}
public function contentsFeedTestAction()
{
$params = $this->getRequest()->getParams();
# terrible name for the method below. it does not only search files.
$r = Application_Model_StoredFile::searchLibraryFiles($params);
$this->view->sEcho = $r["sEcho"];
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
$this->view->iTotalRecords = $r["iTotalRecords"];
$this->view->files = SecurityHelper::htmlescape_recursive($r["aaData"]);
}
public function editFileMdAction()
{
$user = Application_Model_User::getCurrentUser();

View file

@ -30,7 +30,7 @@ class ShowBuilderController extends Zend_Controller_Action {
$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->headScript()->appendFile($baseUrl.'js/airtime/library/library-test.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_test.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
// PLUPLOAD
$this->view->headScript()->appendFile($baseUrl.'js/libs/dropzone.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
@ -40,8 +40,14 @@ class ShowBuilderController extends Zend_Controller_Action {
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/builder_test.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/showbuilder/main_builder_test.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
// MEDIA BUILDER
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl-test.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-test.css?'.$CC_CONFIG['airtime_version']);
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
$csrf_element = new Zend_Form_Element_Hidden('csrf');

View file

@ -907,113 +907,7 @@ SQL;
return $results;
}
public static function searchLibraryFilesTest($datatables)
{
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
$displayColumns = self::getLibraryColumns();
$fileSelect = array();
foreach ($displayColumns as $key) {
if ($key === "id") {
$fileSelect[] = "FILES.id AS $key";
} elseif ($key === "owner_id") {
$fileSelect[] = "sub.login AS $key";
} //file length is displayed based on cueout - cuein.
else if ($key === "length") {
$fileSelect[] = "(cueout - cuein)::INTERVAL AS length";
} elseif ($key === "year") {
$fileSelect[] = "year AS ".$key;
} else {
$fileSelect[] = $key;
}
}
$fileSelect = "SELECT ". join(",", $fileSelect);
$fileTable = "({$fileSelect} FROM cc_files AS FILES LEFT JOIN cc_subjs AS sub ON (sub.id = FILES.owner_id) WHERE file_exists = 'TRUE' AND hidden='FALSE')";
$fromTable = $fileTable." AS File"; //need an alias for the table if it's standalone.
// update is_scheduled to false for tracks that
// have already played out
self::updatePastFilesIsScheduled();
$results = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
$displayTimezone = new DateTimeZone(Application_Model_Preference::GetUserTimezone());
$utcTimezone = new DateTimeZone("UTC");
foreach ($results['aaData'] as &$row) {
$row['id'] = intval($row['id']);
//taken from Datatables.php, needs to be cleaned up there.
if (isset($r['ftype'])) {
if ($r['ftype'] == 'playlist') {
$pl = new Application_Model_Playlist($r['id']);
$r['length'] = $pl->getLength();
} elseif ($r['ftype'] == "block") {
$bl = new Application_Model_Block($r['id']);
$r['bl_type'] = $bl->isStatic() ? 'static' : 'dynamic';
$r['length'] = $bl->getLength();
}
}
if ($row['ftype'] === "audioclip") {
$cuein_formatter = new LengthFormatter($row["cuein"]);
$row["cuein"] = $cuein_formatter->format();
$cueout_formatter = new LengthFormatter($row["cueout"]);
$row["cueout"] = $cueout_formatter->format();
$cuein = Application_Common_DateHelper::playlistTimeToSeconds($row["cuein"]);
$cueout = Application_Common_DateHelper::playlistTimeToSeconds($row["cueout"]);
$row_length = Application_Common_DateHelper::secondsToPlaylistTime($cueout - $cuein);
$formatter = new SamplerateFormatter($row['sample_rate']);
$row['sample_rate'] = $formatter->format();
$formatter = new BitrateFormatter($row['bit_rate']);
$row['bit_rate'] = $formatter->format();
// for audio preview
$row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
}
else {
$row['audioFile'] = $row['id'];
$row_length = $row['length'];
}
$len_formatter = new LengthFormatter($row_length);
$row['length'] = $len_formatter->format();
//convert mtime and utime to localtime
$row['mtime'] = new DateTime($row['mtime'], $utcTimezone);
$row['mtime']->setTimeZone($displayTimezone);
$row['mtime'] = $row['mtime']->format(DEFAULT_TIMESTAMP_FORMAT);
$row['utime'] = new DateTime($row['utime'], $utcTimezone);
$row['utime']->setTimeZone($displayTimezone);
$row['utime'] = $row['utime']->format(DEFAULT_TIMESTAMP_FORMAT);
//need to convert last played to localtime if it exists.
if (isset($row['lptime'])) {
$row['lptime'] = new DateTime($row['lptime'], $utcTimezone);
$row['lptime']->setTimeZone($displayTimezone);
$row['lptime'] = $row['lptime']->format(DEFAULT_TIMESTAMP_FORMAT);
}
// we need to initalize the checkbox and image row because we do not retrieve
// any data from the db for these and datatables will complain
$row['checkbox'] = "";
$row['image'] = "";
$type = substr($row['ftype'], 0, 2);
$row['tr_id'] = "{$type}_{$row['id']}";
}
return $results;
}
/**
/**
* Copy a newly uploaded audio file from its temporary upload directory
* on the local disk (like /tmp) over to Airtime's "stor" directory,
* which is where all ingested music/media live.

View file

@ -1,8 +1,12 @@
<style>
body {
html, body {
background: #242424;
}
div.ColVis_collectionBackground {
background-color: transparent;
}
.wrapper {
position: absolute;
background: #242424;
@ -21,13 +25,26 @@
</form>
<div id="media_type_nav">
<button id="new_media_selector" class="btn btn-small dropdown-toggle" data-toggle="dropdown">
New <span class="caret"></span>
</button>
<div class="media_type_selector selected" selection_id="1">Files</div>
<div class="media_type_selector" selection_id="2">Playlists</div>
<div class="media_type_selector" selection_id="3">Smart Blocks</div>
<div class="media_type_selector" selection_id="4">Webstreams</div>
<div class="btn-group">
<button id="new_media_selector" class="btn btn-small dropdown-toggle" data-toggle="dropdown">
New <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li id="new-playlist">
<a href="#"><?php echo _("Playlist") ?></a>
</li>
<li id="new-smart-block">
<a href="#"><?php echo _("Smart Block") ?></a>
</li>
<li id="new-webstream">
<a href="#"><?php echo _("Webstream") ?></a>
</li>
</ul>
</div>
<div class="media_type_selector selected" selection_id="1"><?php echo _("Files") ?></div>
<div class="media_type_selector" selection_id="2"><?php echo _("Playlists") ?></div>
<div class="media_type_selector" selection_id="3"><?php echo _("Smart Blocks") ?></div>
<div class="media_type_selector" selection_id="4"><?php echo _("Webstreams") ?></div>
</div>
<div id="library_content" class="lib-content tabs lib-test">
@ -40,4 +57,8 @@
</div>
<table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
</div>
<div id="side_playlist" class="pl-content media-builder-test">
</div>
<?php echo $this->dialog ?>

View file

@ -22,9 +22,9 @@
</div>
<?php if (isset($this->obj)) : ?>
<input id="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"></input>
<input id="obj_lastMod" type="hidden" value="<?php echo "1";//$this->obj->getLastModified('U'); ?>"></input>
<input id="obj_type" type="hidden" value="webstream"></input>
<input id="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"/>
<input id="obj_lastMod" type="hidden" value="<?php echo "1";//$this->obj->getLastModified('U'); ?>"/>
<input id="obj_type" type="hidden" value="webstream"/>
<div class="status" style="display:none;"></div>
<div class="playlist_title">