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 = "";
}
$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->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_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>
<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>
<!-- <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>

View file

@ -6,16 +6,16 @@ if (isset($this->obj)) {
?>
<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>
<!-- <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>

View file

@ -1,15 +1,15 @@
<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>
<!-- <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">