Merge branch 'master' of dev.sourcefabric.org:airtime
This commit is contained in:
commit
c67ab97dbc
|
@ -355,6 +355,10 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||
$data['add_show_day_check'] = $this->_getParam('days');
|
||||
|
||||
if($data['add_show_day_check'] == "") {
|
||||
$data['add_show_day_check'] = null;
|
||||
}
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
|
@ -389,20 +393,40 @@ class ScheduleController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
if($data["add_show_repeats"]) {
|
||||
|
||||
$repeats = $formRepeats->isValid($data);
|
||||
if($repeats) {
|
||||
$repeats = $formRepeats->checkReliantFields($data);
|
||||
}
|
||||
|
||||
$formAbsoluteRebroadcast->reset();
|
||||
//make it valid, results don't matter anyways.
|
||||
$rebroadAb = 1;
|
||||
|
||||
if ($data["add_show_rebroadcast"]) {
|
||||
$rebroad = $formRebroadcast->isValid($data);
|
||||
if($rebroad) {
|
||||
$rebroad = $formRebroadcast->checkReliantFields($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$repeats = 1; //make it valid, results don't matter anyways.
|
||||
$formRebroadcast->reset();
|
||||
//make it valid, results don't matter anyways.
|
||||
$repeats = 1;
|
||||
$rebroad = 1;
|
||||
|
||||
if ($data["add_show_rebroadcast"]) {
|
||||
$rebroadAb = $formAbsoluteRebroadcast->isValid($data);
|
||||
if($rebroadAb) {
|
||||
$rebroadAb = $formAbsoluteRebroadcast->checkReliantFields($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$who = $formWho->isValid($data);
|
||||
$style = $formStyle->isValid($data);
|
||||
$record = $formRecord->isValid($data);
|
||||
$rebroadAb = $formAbsoluteRebroadcast->isValid($data);
|
||||
$rebroad = $formRebroadcast->isValid($data);
|
||||
$record = $formRecord->isValid($data);
|
||||
|
||||
if ($what && $when && $repeats && $who && $style && $record && $rebroadAb && $rebroad) {
|
||||
|
||||
|
@ -421,6 +445,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
'add_show_duration' => '1:00'));
|
||||
$formRepeats->reset();
|
||||
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
|
||||
|
||||
$formStyle->reset();
|
||||
$formRecord->reset();
|
||||
$formAbsoluteRebroadcast->reset();
|
||||
|
|
|
@ -36,8 +36,8 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
|||
'value' => '',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm'))
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
|
@ -69,8 +69,8 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
|||
'value' => '',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm'))
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
|
@ -102,8 +102,8 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
|||
'value' => '',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm'))
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
|
@ -135,8 +135,8 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
|||
'value' => '',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm'))
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
|
@ -168,8 +168,8 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
|||
'value' => '',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm'))
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
|
@ -178,6 +178,38 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
|
|||
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData) {
|
||||
|
||||
$valid = true;
|
||||
|
||||
for($i=1; $i<=5; $i++) {
|
||||
|
||||
$day = $formData['add_show_rebroadcast_absolute_date_'.$i];
|
||||
|
||||
if($day == "") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$show_start_time = $formData['add_show_start_date']."".$formData['add_show_start_time'];
|
||||
$show_end = new DateTime($show_start_time);
|
||||
|
||||
$duration = $formData['add_show_duration'];
|
||||
$duration = explode(":", $duration);
|
||||
|
||||
$show_end->add(new DateInterval("PT$duration[0]H"));
|
||||
$show_end->add(new DateInterval("PT$duration[1]M"));
|
||||
$show_end->add(new DateInterval("PT1H"));//min time to wait until a rebroadcast
|
||||
|
||||
$rebroad_start = $day."".$formData['add_show_rebroadcast_absolute_time_'.$i];
|
||||
$rebroad_start = new DateTime($rebroad_start);
|
||||
|
||||
if($rebroad_start < $show_end) {
|
||||
$this->getElement('add_show_rebroadcast_absolute_time_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
|
||||
$valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $valid;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
|||
'value' => '',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm'))
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
|
@ -58,8 +58,8 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
|||
'value' => '',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm'))
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
|
@ -83,8 +83,8 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
|||
'value' => '',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm'))
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
|
@ -108,8 +108,8 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
|||
'value' => '',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm'))
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
|
@ -133,13 +133,51 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
|
|||
'value' => '',
|
||||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm'))
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public function checkReliantFields($formData) {
|
||||
|
||||
$valid = true;
|
||||
|
||||
for($i=1; $i<=5; $i++) {
|
||||
|
||||
$days = $formData['add_show_rebroadcast_date_'.$i];
|
||||
|
||||
if($days == "") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$days = explode(" ", $days);
|
||||
$day = $days[0];
|
||||
|
||||
$show_start_time = $formData['add_show_start_date']."".$formData['add_show_start_time'];
|
||||
$show_end = new DateTime($show_start_time);
|
||||
|
||||
$duration = $formData['add_show_duration'];
|
||||
$duration = explode(":", $duration);
|
||||
|
||||
$show_end->add(new DateInterval("PT$duration[0]H"));
|
||||
$show_end->add(new DateInterval("PT$duration[1]M"));
|
||||
$show_end->add(new DateInterval("PT1H"));//min time to wait until a rebroadcast
|
||||
|
||||
$rebroad_start = $formData['add_show_start_date']."".$formData['add_show_rebroadcast_time_'.$i];
|
||||
$rebroad_start = new DateTime($rebroad_start);
|
||||
$rebroad_start->add(new DateInterval("P".$day."D"));
|
||||
|
||||
if($rebroad_start < $show_end) {
|
||||
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
|
||||
$valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $valid;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
|||
'filters' => array('StringTrim'),
|
||||
'validators' => array(
|
||||
'NotEmpty',
|
||||
array('date', false, array('HH:mm'))
|
||||
array('date', false, array('HH:mm')),
|
||||
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||
)
|
||||
));
|
||||
|
||||
|
|
|
@ -260,12 +260,15 @@ class Show {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get all the show instances in the given time range.
|
||||
*
|
||||
* @param string $start_timestamp
|
||||
* In the format "YYYY-MM-DD HH:mm:ss"
|
||||
* In the format "YYYY-MM-DD HH:mm:ss". This time is inclusive.
|
||||
* @param string $end_timestamp
|
||||
* In the format "YYYY-MM-DD HH:mm:ss"
|
||||
* In the format "YYYY-MM-DD HH:mm:ss". This time is inclusive.
|
||||
* @param unknown_type $excludeInstance
|
||||
* @param boolean $onlyRecord
|
||||
* @return array
|
||||
*/
|
||||
public static function getShows($start_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=FALSE)
|
||||
{
|
||||
|
|
|
@ -14,9 +14,15 @@ require_once __DIR__.'/../../../library/propel/runtime/lib/Propel.php';
|
|||
|
||||
Propel::init(__DIR__.'/../../configs/airtime-conf.php');
|
||||
|
||||
|
||||
AirtimeInstall::DbConnect(true);
|
||||
$sql = "DELETE FROM cc_show";
|
||||
$CC_DBC->query($sql);
|
||||
$sql = "DELETE FROM cc_show_days";
|
||||
$CC_DBC->query($sql);
|
||||
$sql = "DELETE FROM cc_show_instances";
|
||||
$CC_DBC->query($sql);
|
||||
|
||||
/*
|
||||
// Create a playlist
|
||||
$playlist = new Playlist();
|
||||
$playlist->create("Calendar Load test playlist ".uniqid());
|
||||
|
@ -34,65 +40,64 @@ $result = $playlist->addAudioClip($storedFile2->getId());
|
|||
$result = $playlist->addAudioClip($storedFile2->getId());
|
||||
|
||||
echo "Created playlist ".$playlist->getName()." with ID ".$playlist->getId()."\n";
|
||||
|
||||
*/
|
||||
// Create the shows
|
||||
|
||||
$data = array();
|
||||
|
||||
$currentDate = date("Y\\-m\\-d");
|
||||
|
||||
$year = date("Y");
|
||||
$month = date("m");
|
||||
$day = date("d");
|
||||
|
||||
$nextDay = $currentDate;
|
||||
|
||||
#echo $currentDate;
|
||||
$currentHour = date("H");
|
||||
$setHour = $currentHour + 1;
|
||||
|
||||
$showNumber = 1;
|
||||
for ($days=1; $days<100; $days=$days+1)
|
||||
function createTestShow($showNumber, $showTime, $duration = "1:00")
|
||||
{
|
||||
// Adding shows until the end of the day
|
||||
while ($setHour < 24)
|
||||
{
|
||||
echo 'Adding show: '.$nextDay. ' '.$setHour.":00\n";
|
||||
$data['add_show_name'] = 'automated show '.$showNumber;
|
||||
$data['add_show_start_date'] = $nextDay;
|
||||
$data['add_show_start_time'] = $setHour.':00';
|
||||
$showNumber = $showNumber + 1;
|
||||
$data['add_show_duration'] = '1:00';
|
||||
$data['add_show_no_end'] = 0;
|
||||
$data['add_show_repeats'] = 0;
|
||||
$data['add_show_description'] = 'automated show';
|
||||
$data['add_show_url'] = 'http://www.OfirGal.com';
|
||||
$data['add_show_color'] = "";
|
||||
$data['add_show_background_color'] = "";
|
||||
$data['add_show_record'] = 0;
|
||||
$data['add_show_hosts'] ="";
|
||||
$showId = Show::create($data);
|
||||
Show::populateShowUntil($showId, "2012-01-01 00:00:00");
|
||||
$data = array();
|
||||
$strTime = $showTime->format("Y-m-d H:i");
|
||||
echo "Adding show: $strTime\n";
|
||||
$data['add_show_name'] = 'automated show '.$showNumber;
|
||||
$data['add_show_start_date'] = $showTime->format("Y-m-d");
|
||||
$data['add_show_start_time'] = $showTime->format("H:i");
|
||||
$data['add_show_duration'] = $duration;
|
||||
$data['add_show_no_end'] = 0;
|
||||
$data['add_show_repeats'] = 0;
|
||||
$data['add_show_description'] = 'automated show';
|
||||
$data['add_show_url'] = 'http://www.OfirGal.com';
|
||||
$data['add_show_color'] = "";
|
||||
$data['add_show_background_color'] = "";
|
||||
$data['add_show_record'] = 0;
|
||||
$data['add_show_hosts'] ="";
|
||||
$showId = Show::create($data);
|
||||
//echo "show created, ID: $showId\n";
|
||||
|
||||
// populating the show with a playlist
|
||||
$show = new ShowInstance($showId);
|
||||
$show->scheduleShow(array($playlist->getId()));
|
||||
|
||||
$setHour = $setHour + 1;
|
||||
}
|
||||
// set the next day
|
||||
$setHour = 0;
|
||||
if ($day<30) {
|
||||
$day = $day + 1;
|
||||
} else {
|
||||
$day = 1;
|
||||
if ($month<12)
|
||||
{
|
||||
$month = $month + 1;
|
||||
} else {
|
||||
$month = 1;
|
||||
$year = $year + 1;
|
||||
}
|
||||
}
|
||||
$nextDay = $year."-".$month."-".$day;
|
||||
// populating the show with a playlist
|
||||
$instances = Show::getShows($showTime->format("Y-m-d H:i:s"), $showTime->format("Y-m-d H:i:s"));
|
||||
$instance = array_pop($instances);
|
||||
$show = new ShowInstance($instance["instance_id"]);
|
||||
//echo "Adding playlist to show instance ".$show->getShowInstanceId()."\n";
|
||||
$show->scheduleShow(array(1));
|
||||
//echo "done\n";
|
||||
//$show->scheduleShow(array($playlist->getId()));
|
||||
}
|
||||
|
||||
$showTime = new DateTime();
|
||||
|
||||
$resolution = "minute";
|
||||
$showNumber = 1;
|
||||
$numberOfDays = 0;
|
||||
$numberOfHours = 1;
|
||||
$endDate = new DateTime();
|
||||
$endDate->add(new DateInterval("P".$numberOfDays."DT".$numberOfHours."H"));
|
||||
echo "End date: ".$endDate->format("Y-m-d H:i")."\n";
|
||||
|
||||
while ($showTime < $endDate) {
|
||||
echo $showTime->format("Y-m-d H:i")." < " .$endDate->format("Y-m-d H:i")."\n";
|
||||
if ($resolution == "minute") {
|
||||
createTestShow($showNumber, $showTime, "0:01");
|
||||
$showTime->add(new DateInterval("PT1M"));
|
||||
} elseif ($resolution == "hour") {
|
||||
createTestShow($showNumber, $showTime);
|
||||
$showTime->add(new DateInterval("PT1H"));
|
||||
}
|
||||
$showNumber = $showNumber + 1;
|
||||
}
|
||||
RabbitMq::PushScheduleFinal();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<fieldset>
|
||||
<fieldset id="add_show_rebroadcast_absolute">
|
||||
<dl>
|
||||
<dt id="add_show_hosts_rebroadcast_day-label" class="block-display">
|
||||
<label for="add_show_rebroadcast_day" class="optional">Choose Days:</label>
|
||||
|
@ -10,10 +10,21 @@
|
|||
<?php echo $this->element->getElement('add_show_rebroadcast_absolute_date_'.$i) ?>
|
||||
<span class="inline-text">@</span>
|
||||
<?php echo $this->element->getElement('add_show_rebroadcast_absolute_time_'.$i) ?>
|
||||
<?php if($this->element->getElement('add_show_rebroadcast_absolute_time_'.$i)->hasErrors()) : ?>
|
||||
<?php echo var_dump($this->element->getElement('add_show_rebroadcast_absolute_time_'.$i)->getMessages()); ?>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php if(($this->element->getElement('add_show_rebroadcast_absolute_date_'.$i)->hasErrors())
|
||||
|| ($this->element->getElement('add_show_rebroadcast_absolute_time_'.$i)->hasErrors())) : ?>
|
||||
<ul class='errors'>
|
||||
<?php $errors = array_merge(
|
||||
$this->element->getElement('add_show_rebroadcast_absolute_date_'.$i)->getMessages(),
|
||||
$this->element->getElement('add_show_rebroadcast_absolute_time_'.$i)->getMessages()
|
||||
);
|
||||
?>
|
||||
|
||||
<?php foreach($errors as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<?php endfor; ?>
|
||||
</ul>
|
||||
</dd>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<fieldset>
|
||||
<fieldset id="add_show_rebroadcast_relative">
|
||||
<dl>
|
||||
<dt id="add_show_hosts_rebroadcast_repeat_day-label" class="block-display">
|
||||
<label for="add_show_rebroadcast_repeat_day" class="optional">Repeat Days:</label>
|
||||
|
@ -11,6 +11,21 @@
|
|||
<span class="inline-text">@</span>
|
||||
<?php echo $this->element->getElement('add_show_rebroadcast_time_'.$i) ?>
|
||||
</li>
|
||||
|
||||
<?php if(($this->element->getElement('add_show_rebroadcast_date_'.$i)->hasErrors())
|
||||
|| ($this->element->getElement('add_show_rebroadcast_time_'.$i)->hasErrors())) : ?>
|
||||
<ul class='errors'>
|
||||
<?php $errors = array_merge(
|
||||
$this->element->getElement('add_show_rebroadcast_date_'.$i)->getMessages(),
|
||||
$this->element->getElement('add_show_rebroadcast_time_'.$i)->getMessages()
|
||||
);
|
||||
?>
|
||||
|
||||
<?php foreach($errors as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<?php endfor; ?>
|
||||
</ul>
|
||||
</dd>
|
||||
|
|
|
@ -1085,7 +1085,7 @@ button.ui-button-icons-only {
|
|||
padding-right: 2.1em;
|
||||
}
|
||||
/* no icon support for input elements, provide padding by default */
|
||||
input.ui-button {
|
||||
input.ui-button, button.ui-button {
|
||||
padding: .4em 1em;
|
||||
}
|
||||
/*button icon element(s) */
|
||||
|
@ -1117,10 +1117,11 @@ input.ui-button {
|
|||
}
|
||||
|
||||
/* workarounds */
|
||||
button.ui-button::-moz-focus-inner {
|
||||
/*button.ui-button::-moz-focus-inner {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
} /* reset extra padding in Firefox */
|
||||
}*/
|
||||
/* reset extra padding in Firefox */
|
||||
/*
|
||||
* jQuery UI Dialog 1.8.6
|
||||
*
|
||||
|
|
|
@ -1268,6 +1268,9 @@ div.success{
|
|||
height: 28px;
|
||||
margin: 0 0 8px 0;
|
||||
}
|
||||
#schedule-add-show .button-bar.bottom {
|
||||
margin: 16px 0 0 0;
|
||||
}
|
||||
|
||||
.schedule {
|
||||
text-align:left;
|
||||
|
|
|
@ -12,6 +12,7 @@ function startDpSelect(dateText, inst) {
|
|||
date = new Date(time[0], time[1] - 1, time[2]);
|
||||
|
||||
$("#add_show_end_date").datepicker("option", "minDate", date);
|
||||
$('input[name^="add_show_rebroadcast_absolute_date"]').datepicker("option", "minDate", date);
|
||||
}
|
||||
|
||||
function endDpSelect(dateText, inst) {
|
||||
|
@ -64,6 +65,10 @@ function setAddShowEvents() {
|
|||
|
||||
if(!form.find("#add_show_repeats").attr('checked')) {
|
||||
form.find("#schedule-show-when > fieldset:last").hide();
|
||||
$("#add_show_rebroadcast_relative").hide();
|
||||
}
|
||||
else {
|
||||
$("#add_show_rebroadcast_absolute").hide();
|
||||
}
|
||||
|
||||
if(!form.find("#add_show_record").attr('checked')) {
|
||||
|
@ -82,12 +87,12 @@ function setAddShowEvents() {
|
|||
if(form.find("#add_show_rebroadcast").attr('checked')) {
|
||||
|
||||
if($(this).attr('checked')){
|
||||
form.find("#schedule-record-rebroadcast > fieldset:eq(1)").hide();
|
||||
form.find("#schedule-record-rebroadcast > fieldset:last").show();
|
||||
form.find("#add_show_rebroadcast_absolute").hide();
|
||||
form.find("#add_show_rebroadcast_relative").show();
|
||||
}
|
||||
else {
|
||||
form.find("#schedule-record-rebroadcast > fieldset:eq(1)").show();
|
||||
form.find("#schedule-record-rebroadcast > fieldset:last").hide();
|
||||
form.find("#add_show_rebroadcast_absolute").show();
|
||||
form.find("#add_show_rebroadcast_relative").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -100,10 +105,10 @@ function setAddShowEvents() {
|
|||
form.find("#add_show_rebroadcast").click(function(){
|
||||
$(this).blur();
|
||||
if($(this).attr('checked') && !form.find("#add_show_repeats").attr('checked')) {
|
||||
form.find("#schedule-record-rebroadcast > fieldset:eq(1)").show();
|
||||
form.find("#add_show_rebroadcast_absolute").show();
|
||||
}
|
||||
else if($(this).attr('checked') && form.find("#add_show_repeats").attr('checked')) {
|
||||
form.find("#schedule-record-rebroadcast > fieldset:last").show();
|
||||
form.find("#add_show_rebroadcast_relative").show();
|
||||
}
|
||||
else {
|
||||
form.find("#schedule-record-rebroadcast > fieldset:not(:first-child)").hide();
|
||||
|
@ -140,7 +145,7 @@ function setAddShowEvents() {
|
|||
});
|
||||
|
||||
form.find('input[name^="add_show_rebroadcast_absolute_date"]').datepicker({
|
||||
//minDate: new Date(),
|
||||
minDate: new Date(),
|
||||
dateFormat: 'yy-mm-dd'
|
||||
});
|
||||
form.find('input[name^="add_show_rebroadcast_absolute_time"], input[name^="add_show_rebroadcast_time"]').timepicker({
|
||||
|
@ -248,6 +253,14 @@ function showErrorSections() {
|
|||
if($("#schedule-show-style .errors").length > 0) {
|
||||
$("#schedule-show-style").show();
|
||||
}
|
||||
if($("#add_show_rebroadcast_absolute .errors").length > 0) {
|
||||
$("#schedule-record-rebroadcast").show();
|
||||
$("#add_show_rebroadcast_absolute").show();
|
||||
}
|
||||
if($("#add_show_rebroadcast_relative .errors").length > 0) {
|
||||
$("#schedule-record-rebroadcast").show();
|
||||
$("#add_show_rebroadcast_relative").show();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
|
Loading…
Reference in New Issue