SAAS-948 - Frontend tweaks

This commit is contained in:
Duncan Sommerville 2015-07-28 11:42:04 -04:00
parent 5e58403c7f
commit fcbc37977f
11 changed files with 198 additions and 59 deletions

View File

@ -93,6 +93,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$userType = ""; $userType = "";
} }
$view->headScript()->appendScript("var userType = '$userType';"); $view->headScript()->appendScript("var userType = '$userType';");
$mimeTypes = FileDataHelper::getAudioMimeTypeArray();
$view->headScript()->appendScript("var acceptedMimeTypes = ['".implode("','", array_keys($mimeTypes))."'];");
} }
/** /**

View File

@ -53,6 +53,30 @@ class ShowBuilderController extends Zend_Controller_Action {
$csrf_element = new Zend_Form_Element_Hidden('csrf'); $csrf_element = new Zend_Form_Element_Hidden('csrf');
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label'); $csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
$this->view->csrf = $csrf_element; $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_ShowBuilderTest();
$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;
} }
} }

View File

@ -0,0 +1,103 @@
<?php
class Application_Form_ShowBuilderTest 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(_("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" => "-------------------------");
$shows = CcShowQuery::create()
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
->orderByDbName()
->find();
foreach ($shows as $show) {
$showNames[$show->getDbId()] = $show->getDbName();
}
return $showNames;
}
}

View File

@ -0,0 +1,8 @@
<?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>

View File

@ -6,16 +6,16 @@ if (isset($this->obj)) {
?> ?>
<a href="#" class="close-round" id="lib_pl_close"></a> <a href="#" class="close-round" id="lib_pl_close"></a>
<div class="btn-toolbar spl-no-top-margin clearfix"> <div class="btn-toolbar spl-no-top-margin clearfix">
<div class="btn-group pull-left"> <!-- <div class="btn-group pull-left">-->
<button id="spl_new" class="btn dropdown-toggle" data-toggle="dropdown" aria-disabled="false"> <!-- <button id="spl_new" class="btn dropdown-toggle" data-toggle="dropdown" aria-disabled="false">-->
<?php echo _("New")?> <span class="caret"></span> <!-- --><?php //echo _("New")?><!-- <span class="caret"></span>-->
</button> <!-- </button>-->
<ul class="dropdown-menu"> <!-- <ul class="dropdown-menu">-->
<li id='lib-new-pl'><a href="#"><?php echo _("New Playlist") ?></a></li> <!-- <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-bl'><a href="#">--><?php //echo _("New Smart Block") ?><!--</a></li>-->
<li id='lib-new-ws'><a href="#"><?php echo _("New Webstream") ?></a></li> <!-- <li id='lib-new-ws'><a href="#">--><?php //echo _("New Webstream") ?><!--</a></li>-->
</ul> <!-- </ul>-->
</div> <!-- </div>-->
<?php if (isset($this->obj)) : ?> <?php if (isset($this->obj)) : ?>
<div class='btn-group pull-right'> <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> <button class="btn btn-inverse" title='<?php echo _("Empty playlist content") ?>' type="button" id="pl-bl-clear-content"><?php echo _("Clear") ?></button>

View File

@ -6,16 +6,16 @@ if (isset($this->obj)) {
?> ?>
<a href="#" class="close-round" id="lib_pl_close"></a> <a href="#" class="close-round" id="lib_pl_close"></a>
<div class="btn-toolbar spl-no-top-margin clearfix"> <div class="btn-toolbar spl-no-top-margin clearfix">
<div class="btn-group pull-left"> <!-- <div class="btn-group pull-left">-->
<button id="spl_new" class="btn dropdown-toggle" data-toggle='dropdown' aria-disabled="false"> <!-- <button id="spl_new" class="btn dropdown-toggle" data-toggle='dropdown' aria-disabled="false">-->
<?php echo _("New")?> <span class="caret"></span> <!-- --><?php //echo _("New")?><!-- <span class="caret"></span>-->
</button> <!-- </button>-->
<ul class="dropdown-menu"> <!-- <ul class="dropdown-menu">-->
<li id='lib-new-pl'><a href="#"><?php echo _("New Playlist") ?></a></li> <!-- <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-bl'><a href="#">--><?php //echo _("New Smart Block") ?><!--</a></li>-->
<li id='lib-new-ws'><a href="#"><?php echo _("New Webstream") ?></a></li> <!-- <li id='lib-new-ws'><a href="#">--><?php //echo _("New Webstream") ?><!--</a></li>-->
</ul> <!-- </ul>-->
</div> <!-- </div>-->
<?php if (isset($this->obj)) : ?> <?php if (isset($this->obj)) : ?>
<div class='btn-group pull-right'> <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> <button class="btn btn-inverse" title='<?php echo _("Empty smart block content") ?>' type="button" id="pl-bl-clear-content"><?php echo _("Clear") ?></button>

View File

@ -1,15 +1,15 @@
<a href="#" class="close-round" id="lib_pl_close"></a> <a href="#" class="close-round" id="lib_pl_close"></a>
<div class="btn-toolbar spl-no-top-margin clearfix"> <div class="btn-toolbar spl-no-top-margin clearfix">
<div class="btn-group pull-left"> <!-- <div class="btn-group pull-left">-->
<button id="ws_new" class="btn dropdown-toggle" data-toggle="dropdown" aria-disabled="false"> <!-- <button id="ws_new" class="btn dropdown-toggle" data-toggle="dropdown" aria-disabled="false">-->
<?php echo _("New")?> <span class="caret"></span> <!-- --><?php //echo _("New")?><!-- <span class="caret"></span>-->
</button> <!-- </button>-->
<ul class="dropdown-menu"> <!-- <ul class="dropdown-menu">-->
<li id='lib-new-pl'><a href="#"><?php echo _("New Playlist") ?></a></li> <!-- <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-bl'><a href="#">--><?php //echo _("New Smart Block") ?><!--</a></li>-->
<li id='lib-new-ws'><a href="#"><?php echo _("New Webstream") ?></a></li> <!-- <li id='lib-new-ws'><a href="#">--><?php //echo _("New Webstream") ?><!--</a></li>-->
</ul> <!-- </ul>-->
</div> <!-- </div>-->
<?php if (isset($this->obj)) : ?> <?php if (isset($this->obj)) : ?>
<div class="btn-group pull-right"> <div class="btn-group pull-right">

View File

@ -205,7 +205,7 @@ td.library_bitrate {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
height: 25px; height: 26px;
vertical-align: middle; vertical-align: middle;
margin: 0 !important; margin: 0 !important;
line-height: 16px; line-height: 16px;
@ -218,7 +218,7 @@ td.library_bitrate {
display: inline-block; display: inline-block;
float: none !important; float: none !important;
margin: 0 !important; margin: 0 !important;
height: 25px; height: 26px;
outline: none; outline: none;
vertical-align: middle !important; vertical-align: middle !important;
} }

View File

@ -1,6 +1,6 @@
/* Show Builder*/ /* Show Builder*/
@media screen and (max-width: 1015px) { @media screen and (max-width: 1175px) {
.lib-test, .sb-test, .media-builder-test, #media_type_nav { .lib-test, .sb-test, .media-builder-test, #media_type_nav {
width: 100% !important; width: 100% !important;
} }
@ -13,6 +13,10 @@
text-align: center; text-align: center;
margin: auto; margin: auto;
} }
#media_type_nav .dropdown-menu {
width: 100%;
text-align: center;
}
#media_type_nav .media_type_selector { #media_type_nav .media_type_selector {
margin-top: .25em; margin-top: .25em;
} }
@ -59,25 +63,39 @@
overflow: hidden !important; overflow: hidden !important;
} }
.sb-test, .media-builder-test {
margin-top: 4.6em; /* Standardize this somehow */
}
.lib-test, .sb-test, .media-builder-test { .lib-test, .sb-test, .media-builder-test {
/* 1em for the middle margin, 6 for half the width of the left pane */ /* 1em for the middle margin, 6 for half the width of the left pane */
width: calc(50% - 8em); width: calc(50% - 8em);
min-width: 470px; min-width: 470px;
} }
/* Timeline */
.sb-test {
margin-top: 1.5em;
}
#sb_submit {
text-decoration: none;
padding: .35em;
color: #efefef;
}
.sb-timerange {
margin-bottom: 5px;
}
/* Media builder */ /* Media builder */
.media-builder-test { .media-builder-test {
color: #efefef; color: #efefef;
margin-top: 2em; /* Standardize this somehow */
} }
#side_playlist { #side_playlist {
width: calc(50% - 8em); width: calc(50% - 8em);
font-size: inherit; font-size: inherit;
overflow: hidden;
} }
/* Media type selector */ /* Media type selector */

View File

@ -228,7 +228,7 @@ var AIRTIME = (function(AIRTIME){
}; };
mod.selectAll = function () { mod.selectAll = function () {
var $trs = $sbTable.find("tr.lib-audio").not(".sb-past"); var $trs = $sbTable.find("tr.lib-audio").not(".sb-past, .sb-empty");
$trs.addClass(SB_SELECTED_CLASS); $trs.addClass(SB_SELECTED_CLASS);
mod.checkToolBarIcons(); mod.checkToolBarIcons();
@ -643,7 +643,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 {
@ -739,7 +739,7 @@ var AIRTIME = (function(AIRTIME){
"sAjaxSource": baseUrl+"showbuilder/builder-feed" "sAjaxSource": baseUrl+"showbuilder/builder-feed"
}); });
$sbTable.find("tbody").on("click", "tr:not(.sb-past)", function(ev) { $sbTable.find("tbody").on("click", "tr:not(.sb-past, .sb-empty)", function(ev) {
var $tr = $(this), var $tr = $(this),
// Get the ID of the selected row // Get the ID of the selected row

View File

@ -145,26 +145,9 @@ 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) // Normally we would just use audio/*, but it includes file types that we can't handle (like .m4a)
var acceptedTypes = ["audio/ogg", // We initialize the acceptedMimeTypes variable in Bootstrap so we don't have to duplicate the list
"application/ogg",
"audio/vorbis",
"audio/mp3",
"audio/mpeg",
"audio/mpeg3",
"audio/x-aac",
"audio/aac",
"audio/aacp",
"audio/mp4",
"audio/x-flac",
"audio/wav",
"audio/x-wav",
"audio/mp2",
"audio/mp1",
"audio/x-ms-wma",
"audio/basic"];
Dropzone.options.uploadForm = { Dropzone.options.uploadForm = {
acceptedFiles: acceptedTypes.join(), acceptedFiles: acceptedMimeTypes.join(),
init: function () { init: function () {
this.on("sending", function (file, xhr, data) { this.on("sending", function (file, xhr, data) {
data.append("csrf_token", $("#csrf").val()); data.append("csrf_token", $("#csrf").val());