Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
db9adef9a7
12 changed files with 386 additions and 41 deletions
|
@ -423,7 +423,9 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
|
|
||||||
$formWhen->populate(array('add_show_start_date' => $show->getStartDate(),
|
$formWhen->populate(array('add_show_start_date' => $show->getStartDate(),
|
||||||
'add_show_start_time' => DateHelper::removeSecondsFromTime($show->getStartTime()),
|
'add_show_start_time' => DateHelper::removeSecondsFromTime($show->getStartTime()),
|
||||||
'add_show_duration' => $show->getDuration(),
|
'add_show_end_date_no_repeat' => $show->getEndDate(),
|
||||||
|
'add_show_end_time' => DateHelper::removeSecondsFromTime($show->getEndTime()),
|
||||||
|
'add_show_duration' => $show->getDuration(true),
|
||||||
'add_show_repeats' => $show->isRepeating() ? 1 : 0));
|
'add_show_repeats' => $show->isRepeating() ? 1 : 0));
|
||||||
|
|
||||||
if ($show->isStartDateTimeInPast()){
|
if ($show->isStartDateTimeInPast()){
|
||||||
|
@ -541,7 +543,23 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
if($when) {
|
if($when) {
|
||||||
$when = $formWhen->checkReliantFields($data, $startDateModified);
|
$when = $formWhen->checkReliantFields($data, $startDateModified);
|
||||||
}
|
}
|
||||||
|
// format add_show_duration value to hh:mm so it can be compatible with
|
||||||
|
// existing code
|
||||||
|
$hPos = strpos($data["add_show_duration"], 'h');
|
||||||
|
$mPos = strpos($data["add_show_duration"], 'm');
|
||||||
|
|
||||||
|
$hValue = 0;
|
||||||
|
$mValue = 0;
|
||||||
|
|
||||||
|
if($hPos !== false){
|
||||||
|
$hValue = trim(substr($data["add_show_duration"], 0, $hPos));
|
||||||
|
}
|
||||||
|
if($mPos !== false){
|
||||||
|
$mValue = trim(substr($data["add_show_duration"], $hPos+1, -1 ));
|
||||||
|
}
|
||||||
|
|
||||||
|
$data["add_show_duration"] = $hValue.":".$mValue;
|
||||||
|
|
||||||
if($data["add_show_repeats"]) {
|
if($data["add_show_repeats"]) {
|
||||||
$repeats = $formRepeats->isValid($data);
|
$repeats = $formRepeats->isValid($data);
|
||||||
if($repeats) {
|
if($repeats) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
|
|
||||||
// Add start date element
|
// Add start date element
|
||||||
$this->addElement('text', 'add_show_start_date', array(
|
$this->addElement('text', 'add_show_start_date', array(
|
||||||
'label' => 'Date Start:',
|
'label' => 'Date/Time Start:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'value' => date("Y-m-d"),
|
'value' => date("Y-m-d"),
|
||||||
|
@ -21,13 +21,13 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
array('date', false, array('YYYY-MM-DD'))
|
array('date', false, array('YYYY-MM-DD'))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add start time element
|
// Add start time element
|
||||||
$this->addElement('text', 'add_show_start_time', array(
|
$startTime = $this->addElement('text', 'add_show_start_time', array(
|
||||||
'label' => 'Start Time:',
|
'decorators' => array('ViewHelper', array('HtmlTag', array('tag'=>'dd'))),
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'value' => '0:00',
|
'value' => '00:00',
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
'NotEmpty',
|
'NotEmpty',
|
||||||
|
@ -36,19 +36,40 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add duration element
|
// Add end date element
|
||||||
$this->addElement('text', 'add_show_duration', array(
|
$this->addElement('text', 'add_show_end_date_no_repeat', array(
|
||||||
'label' => 'Duration:',
|
'label' => 'Date/Time End:',
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'value' => '1:00',
|
|
||||||
'required' => true,
|
'required' => true,
|
||||||
|
'value' => date("Y-m-d"),
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'validators' => array(
|
||||||
|
'NotEmpty',
|
||||||
|
array('date', false, array('YYYY-MM-DD'))
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add end time element
|
||||||
|
$this->addElement('text', 'add_show_end_time', array(
|
||||||
|
'decorators' => array('ViewHelper', array('HtmlTag', array('tag'=>'dd'))),
|
||||||
|
'class' => 'input_text',
|
||||||
|
'required' => true,
|
||||||
|
'value' => '01:00',
|
||||||
'filters' => array('StringTrim'),
|
'filters' => array('StringTrim'),
|
||||||
'validators' => array(
|
'validators' => array(
|
||||||
'NotEmpty',
|
'NotEmpty',
|
||||||
array('regex', false,
|
array('date', false, array('HH:mm')),
|
||||||
array('/^\d+:[0-5][0-9]$/',
|
array('regex', false, array('/^[0-9:]+$/', 'messages' => 'Invalid character entered'))
|
||||||
'messages' => 'enter a duration: HH:mm'))
|
)
|
||||||
)
|
|
||||||
|
));
|
||||||
|
|
||||||
|
// Add duration element
|
||||||
|
$this->addElement('text', 'add_show_duration', array(
|
||||||
|
'label' => 'Duration:',
|
||||||
|
'class' => 'input_text',
|
||||||
|
'value' => '01h00m',
|
||||||
|
'readonly' => true
|
||||||
));
|
));
|
||||||
|
|
||||||
// Add repeats element
|
// Add repeats element
|
||||||
|
@ -69,15 +90,22 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$now_epoch = strtotime($now_timestamp);
|
$now_epoch = strtotime($now_timestamp);
|
||||||
$start_epoch = strtotime($start_timestamp);
|
$start_epoch = strtotime($start_timestamp);
|
||||||
|
|
||||||
if ((($formData['add_show_id'] != -1) && $startDateModified) || ($formData['add_show_id'] == -1)){
|
|
||||||
if($start_epoch < $now_epoch) {
|
|
||||||
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
|
|
||||||
$valid = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(strtotime("00:00") == strtotime($formData["add_show_duration"])) {
|
if ((($formData['add_show_id'] != -1) && $startDateModified) || ($formData['add_show_id'] == -1)){
|
||||||
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00:00'));
|
if($start_epoch < $now_epoch) {
|
||||||
|
$this->getElement('add_show_start_date')->setErrors(array('Cannot create show in the past'));
|
||||||
|
$valid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( $formData["add_show_duration"] == "0m" ) {
|
||||||
|
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration 0m'));
|
||||||
|
$valid = false;
|
||||||
|
}elseif(strpos($formData["add_show_duration"], 'h') !== false && intval(substr($formData["add_show_duration"], 0, strpos($formData["add_show_duration"], 'h'))) > 23) {
|
||||||
|
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration > 24h'));
|
||||||
|
$valid = false;
|
||||||
|
}elseif( strstr($formData["add_show_duration"], '-') ){
|
||||||
|
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m'));
|
||||||
$valid = false;
|
$valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,40 @@ class Application_Model_Nowplaying
|
||||||
$type = "a";
|
$type = "a";
|
||||||
$type .= ($dbRow['item_ends'] > $timeNow && $dbRow['item_starts'] <= $timeNow) ? "c" : "";
|
$type .= ($dbRow['item_ends'] > $timeNow && $dbRow['item_starts'] <= $timeNow) ? "c" : "";
|
||||||
|
|
||||||
$dataTablesRows[] = array($type, $dbRow['show_starts'], $dbRow['item_starts'], $dbRow['item_ends'],
|
// remove millisecond from the time format
|
||||||
$dbRow['clip_length'], $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'],
|
$itemStart = explode('.', $dbRow['item_starts']);
|
||||||
|
$itemEnd = explode('.', $dbRow['item_ends']);
|
||||||
|
|
||||||
|
//format duration
|
||||||
|
$duration = explode('.', $dbRow['clip_length']);
|
||||||
|
$duration = explode(':', $duration[0]);
|
||||||
|
|
||||||
|
if($duration[2] == 0){
|
||||||
|
$duration[2] = '';
|
||||||
|
}else{
|
||||||
|
$duration[2] = intval($duration[2],10).'s';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($duration[1] == 0){
|
||||||
|
if($duration[2] == ''){
|
||||||
|
$duration[1] = '';
|
||||||
|
}else{
|
||||||
|
$duration[1] = intval($duration[1],10).'m';
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$duration[1] = intval($duration[1],10).'m';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($duration[0] == 0){
|
||||||
|
$duration[0] = '';
|
||||||
|
}else{
|
||||||
|
$duration[0] = intval($duration[0],10).'h';
|
||||||
|
}
|
||||||
|
|
||||||
|
$duration = $duration[0].$duration[1].$duration[2];
|
||||||
|
|
||||||
|
$dataTablesRows[] = array($type, $dbRow['show_starts'], $itemStart[0], $itemEnd[0],
|
||||||
|
$duration, $dbRow['track_title'], $dbRow['artist_name'], $dbRow['album_title'],
|
||||||
$dbRow['playlist_name'], $dbRow['show_name'], $status);
|
$dbRow['playlist_name'], $dbRow['show_name'], $status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -765,6 +765,13 @@ class Schedule {
|
||||||
$p_view->addNewShow = true;
|
$p_view->addNewShow = true;
|
||||||
|
|
||||||
$formWhat->populate(array('add_show_id' => '-1'));
|
$formWhat->populate(array('add_show_id' => '-1'));
|
||||||
|
$formWhen->populate(array('add_show_start_date' => date("Y-m-d"),
|
||||||
|
'add_show_start_time' => '00:00',
|
||||||
|
'add_show_end_date_no_repeate' => date("Y-m-d"),
|
||||||
|
'add_show_end_time' => '01:00',
|
||||||
|
'add_show_duration' => '1h'));
|
||||||
|
|
||||||
|
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -433,6 +433,45 @@ class Show {
|
||||||
return $startTime;
|
return $startTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the end date of the current show.
|
||||||
|
* Note that this is not the end date of repeated show
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* The end date in the format YYYY-MM-DD
|
||||||
|
*/
|
||||||
|
public function getEndDate(){
|
||||||
|
$startDate = $this->getStartDate();
|
||||||
|
$startTime = $this->getStartTime();
|
||||||
|
$duration = $this->getDuration();
|
||||||
|
|
||||||
|
$startDateTime = new DateTime($startDate.' '.$startTime);
|
||||||
|
$duration = explode(":", $duration);
|
||||||
|
|
||||||
|
$endDate = $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M'));
|
||||||
|
|
||||||
|
return $endDate->format('Y-m-d');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the end time of the current show.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* The start time in the format HH:MM:SS
|
||||||
|
*/
|
||||||
|
public function getEndTime(){
|
||||||
|
$startDate = $this->getStartDate();
|
||||||
|
$startTime = $this->getStartTime();
|
||||||
|
$duration = $this->getDuration();
|
||||||
|
|
||||||
|
$startDateTime = new DateTime($startDate.' '.$startTime);
|
||||||
|
$duration = explode(":", $duration);
|
||||||
|
|
||||||
|
$endDate = $startDateTime->add(new DateInterval('PT'.$duration[0].'H'.$duration[1].'M'));
|
||||||
|
|
||||||
|
return $endDate->format('H:i:s');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate whether the starting point of the show is in the
|
* Indicate whether the starting point of the show is in the
|
||||||
|
@ -535,9 +574,14 @@ class Show {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDuration(){
|
public function getDuration($format=false){
|
||||||
$showDay = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->findOne();
|
$showDay = CcShowDaysQuery::create()->filterByDbShowId($this->getId())->findOne();
|
||||||
return $showDay->getDbDuration();
|
if(!$format){
|
||||||
|
return $showDay->getDbDuration();
|
||||||
|
}else{
|
||||||
|
$info = explode(':',$showDay->getDbDuration());
|
||||||
|
return ($info[0] != 0 ? intval($info[0]).'h'.' ' : '').($info[1] != 0 ? intval($info[1]).'m' : '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShowDays(){
|
public function getShowDays(){
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 4px 0;
|
padding: 4px 0;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
min-width:90px;
|
min-width:100px;
|
||||||
clear:left;
|
clear:left;
|
||||||
}
|
}
|
||||||
#schedule-add-show dt.big {
|
#schedule-add-show dt.big {
|
||||||
|
@ -111,3 +111,18 @@ label.wrapp-label input[type="checkbox"] {
|
||||||
min-width: 150px;
|
min-width: 150px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#add_show_start_time {
|
||||||
|
float: left;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#add_show_end_time, #add_show_end_date_no_repeat, #add_show_start_date {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#add_show_duration {
|
||||||
|
background: #AAAAAA;
|
||||||
|
cursor: default;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -331,8 +331,7 @@ fieldset.plain {
|
||||||
.padded-strong {
|
.padded-strong {
|
||||||
padding:10px;
|
padding:10px;
|
||||||
}
|
}
|
||||||
.input_text {
|
.input_text, input[type="text"], input[type="password"] {
|
||||||
background:#dddddd url("images/input_bg.png") repeat-x scroll 0 0 ;
|
|
||||||
font-family:Arial, Helvetica, sans-serif;
|
font-family:Arial, Helvetica, sans-serif;
|
||||||
border: 1px solid #5b5b5b;
|
border: 1px solid #5b5b5b;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
@ -341,14 +340,22 @@ fieldset.plain {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
text-indent: 3px;
|
text-indent: 3px;
|
||||||
width:auto;
|
width:auto;
|
||||||
|
background-color: #dddddd;
|
||||||
|
border: 1px solid #5b5b5b;
|
||||||
|
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2) inset;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="text"]:focus, input[type="password"]:focus, textarea:focus, .input_text_area:focus {
|
||||||
|
border: 1px solid #0088f1;
|
||||||
}
|
}
|
||||||
.auto-search {
|
.auto-search {
|
||||||
background:#dddddd url(images/search_auto_bg.png) no-repeat 0 0;
|
background:#dddddd url(images/search_auto_bg.png) no-repeat 0 0;
|
||||||
text-indent:25px;
|
text-indent:25px;
|
||||||
}
|
}
|
||||||
.input_text_area {
|
.input_text_area, textarea {
|
||||||
background:#dddddd url("images/input_bg.png") repeat-x scroll 0 0 ;
|
background-color: #dddddd;
|
||||||
border: 1px solid #5b5b5b;
|
border: 1px solid #5b5b5b;
|
||||||
|
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2) inset;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
text-indent: 3px;
|
text-indent: 3px;
|
||||||
}
|
}
|
||||||
|
@ -1200,10 +1207,14 @@ button, input {
|
||||||
margin-right:6px
|
margin-right:6px
|
||||||
}
|
}
|
||||||
.button-bar-top .input_text.hasDatepicker, .input_text.hasDatepicker {
|
.button-bar-top .input_text.hasDatepicker, .input_text.hasDatepicker {
|
||||||
background:url(images/input_with_calendar_bg.png) no-repeat right 0;
|
background-image:url(images/input_with_calendar_bg.png);
|
||||||
|
background-repeat:no-repeat;
|
||||||
|
background-position:right 0;
|
||||||
}
|
}
|
||||||
.input_text.hasTimepicker {
|
.input_text.hasTimepicker {
|
||||||
background:url(images/input_with_time_bg.png) no-repeat right 0;
|
background-image:url(images/input_with_time_bg.png);
|
||||||
|
background-repeat:no-repeat;
|
||||||
|
background-position:right 0;
|
||||||
}
|
}
|
||||||
ul.errors {
|
ul.errors {
|
||||||
display:block;
|
display:block;
|
||||||
|
@ -1445,11 +1456,12 @@ div.success{
|
||||||
}
|
}
|
||||||
.formrow-repeat li {
|
.formrow-repeat li {
|
||||||
list-style-type:none;
|
list-style-type:none;
|
||||||
margin:0 0 7px 0;
|
margin:0 0 8px 0;
|
||||||
padding:0;
|
padding:0;
|
||||||
/*height:26px;*/
|
height:25px;
|
||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
.formrow-repeat li .ui-button-icon-only {
|
.formrow-repeat li .ui-button-icon-only {
|
||||||
width:1.8em;
|
width:1.8em;
|
||||||
}
|
}
|
||||||
|
@ -1467,6 +1479,37 @@ div.success{
|
||||||
display: block;
|
display: block;
|
||||||
line-height: 110%;
|
line-height: 110%;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#add_show_rebroadcast_relative .ui-button-icon-only,
|
||||||
|
#add_show_rebroadcast_absolute .ui-button-icon-only {
|
||||||
|
width: 1.8em;
|
||||||
|
}
|
||||||
|
#add_show_rebroadcast_relative .ui-button-icon-only .ui-button-text,
|
||||||
|
#add_show_rebroadcast_absolute .ui-button-icon-only .ui-button-text,
|
||||||
|
#add_show_rebroadcast_relative .ui-button-icons-only .ui-button-text,
|
||||||
|
#add_show_rebroadcast_absolute .ui-button-icons-only .ui-button-text,
|
||||||
|
#add_show_rebroadcast_relative .ui-button-text-icon-primary .ui-button-text,
|
||||||
|
#add_show_rebroadcast_absolute .ui-button-text-icon-primary .ui-button-text {
|
||||||
|
font-size:12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#add_show_rebroadcast_relative .ui-button-icon-only .ui-icon,
|
||||||
|
#add_show_rebroadcast_absolute .ui-button-icon-only .ui-icon {
|
||||||
|
margin-top: -8px;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
}
|
||||||
|
#add_show_rebroadcast_relative .ui-button-text-icon-primary .ui-icon,
|
||||||
|
#add_show_rebroadcast_absolute .ui-button-text-icon-primary .ui-icon {
|
||||||
|
left: 0.4em;
|
||||||
|
}
|
||||||
|
#add_show_rebroadcast_relative .ui-button .ui-button-text,
|
||||||
|
#add_show_rebroadcast_absolute .ui-button .ui-button-text {
|
||||||
|
display: block;
|
||||||
|
line-height: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
.formrow-repeat li .inline-text {
|
.formrow-repeat li .inline-text {
|
||||||
color: #666666;
|
color: #666666;
|
||||||
padding: 0 6px 0 0;
|
padding: 0 6px 0 0;
|
||||||
|
@ -1613,3 +1656,71 @@ dd.radio-inline-list, .preferences dd.radio-inline-list {
|
||||||
button.ui-button.md-cancel {
|
button.ui-button.md-cancel {
|
||||||
padding: .4em 1em;
|
padding: .4em 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*--//////////////////////// Changes/add-ons Jun 8th, 2011 ////////////////////////--*/
|
||||||
|
|
||||||
|
.dialogPopup.ui-dialog-content {
|
||||||
|
padding: 0.9em 1em;
|
||||||
|
}
|
||||||
|
.dialogPopup dl {
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
.dialogPopup dt {
|
||||||
|
margin:0;
|
||||||
|
padding: 0 0 5px;
|
||||||
|
}
|
||||||
|
.dialogPopup dt label {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.dialogPopup dd {
|
||||||
|
margin:0 0 4px 0;
|
||||||
|
padding: 0 0 5px;
|
||||||
|
}
|
||||||
|
.dialogPopup dd input[type="text"]{
|
||||||
|
width:100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-text p {
|
||||||
|
font-size:12px;
|
||||||
|
color:#5b5b5b;
|
||||||
|
line-height:150%;
|
||||||
|
margin-top:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialogPopup label input[type="checkbox"] {
|
||||||
|
float:left;
|
||||||
|
margin-right:6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialogPopup fieldset {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.dialogPopup fieldset dd input[type="text"] {
|
||||||
|
width:99%;
|
||||||
|
}
|
||||||
|
fieldset.display_field {
|
||||||
|
background-color:#d5d5d5;
|
||||||
|
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2) inset;
|
||||||
|
}
|
||||||
|
label span {
|
||||||
|
font-weight:normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialogPopup .display_field dt, .dialogPopup .display_field dd {
|
||||||
|
color: #353535;
|
||||||
|
float: left;
|
||||||
|
font-size: 13px;
|
||||||
|
margin: 0;
|
||||||
|
min-width: 90px;
|
||||||
|
padding: 6px 0;
|
||||||
|
text-align: left;
|
||||||
|
width:60%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialogPopup .display_field dt {
|
||||||
|
clear: left;
|
||||||
|
font-weight:bold;
|
||||||
|
width:40%;
|
||||||
|
}
|
|
@ -13,6 +13,8 @@ function startDpSelect(dateText, inst) {
|
||||||
|
|
||||||
$("#add_show_end_date").datepicker("option", "minDate", date);
|
$("#add_show_end_date").datepicker("option", "minDate", date);
|
||||||
$('input[name^="add_show_rebroadcast_absolute_date"]').datepicker("option", "minDate", date);
|
$('input[name^="add_show_rebroadcast_absolute_date"]').datepicker("option", "minDate", date);
|
||||||
|
if (inst.input)
|
||||||
|
inst.input.trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
function endDpSelect(dateText, inst) {
|
function endDpSelect(dateText, inst) {
|
||||||
|
@ -21,7 +23,9 @@ function endDpSelect(dateText, inst) {
|
||||||
time = dateText.split("-");
|
time = dateText.split("-");
|
||||||
date = new Date(time[0], time[1] - 1, time[2]);
|
date = new Date(time[0], time[1] - 1, time[2]);
|
||||||
|
|
||||||
$("#add_show_start_date").datepicker( "option", "maxDate", date);
|
//$("#add_show_start_date").datepicker( "option", "maxDate", date);
|
||||||
|
if (inst.input)
|
||||||
|
inst.input.trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDateInput(el, onSelect) {
|
function createDateInput(el, onSelect) {
|
||||||
|
@ -158,14 +162,15 @@ function setAddShowEvents() {
|
||||||
form.find("#add_show_no_end").click(endDateVisibility);
|
form.find("#add_show_no_end").click(endDateVisibility);
|
||||||
|
|
||||||
createDateInput(form.find("#add_show_start_date"), startDpSelect);
|
createDateInput(form.find("#add_show_start_date"), startDpSelect);
|
||||||
|
createDateInput(form.find("#add_show_end_date_no_repeat"), endDpSelect);
|
||||||
createDateInput(form.find("#add_show_end_date"), endDpSelect);
|
createDateInput(form.find("#add_show_end_date"), endDpSelect);
|
||||||
|
|
||||||
form.find("#add_show_start_time").timepicker({
|
form.find("#add_show_start_time").timepicker({
|
||||||
amPmText: ['', '']
|
|
||||||
});
|
|
||||||
form.find("#add_show_duration").timepicker({
|
|
||||||
amPmText: ['', ''],
|
amPmText: ['', ''],
|
||||||
defaultTime: '01:00'
|
defaultTime: '00:00'
|
||||||
|
});
|
||||||
|
form.find("#add_show_end_time").timepicker({
|
||||||
|
amPmText: ['', '']
|
||||||
});
|
});
|
||||||
|
|
||||||
form.find('input[name^="add_show_rebroadcast_date_absolute"]').datepicker({
|
form.find('input[name^="add_show_rebroadcast_date_absolute"]').datepicker({
|
||||||
|
@ -312,6 +317,70 @@ function setAddShowEvents() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// when start date/time changes, set end date/time to start date/time+1 hr
|
||||||
|
$('#add_show_start_date, #add_show_start_time').change(function(){
|
||||||
|
var startDate = $('#add_show_start_date').val().split('-');
|
||||||
|
var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val());
|
||||||
|
|
||||||
|
var endDate = $('#add_show_end_date_no_repeat').val().split('-');
|
||||||
|
var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val());
|
||||||
|
|
||||||
|
if(startDateTime.getTime() > endDateTime.getTime()){
|
||||||
|
endDateTime = new Date(startDateTime.getTime() + (1*60*60*1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2);
|
||||||
|
var endTimeFormat = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2);
|
||||||
|
|
||||||
|
$('#add_show_end_date_no_repeat').val(endDateFormat);
|
||||||
|
$('#add_show_end_time').val(endTimeFormat);
|
||||||
|
|
||||||
|
// calculate duration
|
||||||
|
calculateDuration(endDateTime, startDateTime);
|
||||||
|
});
|
||||||
|
|
||||||
|
// when end date/time changes, check if the changed date is in past of start date/time
|
||||||
|
$('#add_show_end_date_no_repeat, #add_show_end_time').change(function(){
|
||||||
|
var startDate = $('#add_show_start_date').val().split('-');
|
||||||
|
var startDateTime = new Date(startDate[1]+' '+startDate[2]+','+startDate[0]+' '+$('#add_show_start_time').val());
|
||||||
|
|
||||||
|
var endDate = $('#add_show_end_date_no_repeat').val().split('-');
|
||||||
|
var endDateTime = new Date(endDate[1]+' '+endDate[2]+','+endDate[0]+' '+$('#add_show_end_time').val());
|
||||||
|
|
||||||
|
if(startDateTime.getTime() > endDateTime.getTime()){
|
||||||
|
$('#add_show_end_date_no_repeat').css('background-color', '#F49C9C');
|
||||||
|
$('#add_show_end_time').css('background-color', '#F49C9C');
|
||||||
|
}else{
|
||||||
|
$('#add_show_end_date_no_repeat').css('background-color', '');
|
||||||
|
$('#add_show_end_time').css('background-color', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// calculate duration
|
||||||
|
calculateDuration(endDateTime, startDateTime);
|
||||||
|
});
|
||||||
|
|
||||||
|
function calculateDuration(endDateTime, startDateTime){
|
||||||
|
var duration;
|
||||||
|
var durationSeconds = (endDateTime.getTime() - startDateTime.getTime())/1000;
|
||||||
|
if(durationSeconds != 0){
|
||||||
|
var durationHour = parseInt(durationSeconds/3600);
|
||||||
|
var durationMin = parseInt((durationSeconds%3600)/60);
|
||||||
|
duration = (durationHour == 0 ? '' : durationHour+'h'+' ')+(durationMin == 0 ? '' : durationMin+'m');
|
||||||
|
}else{
|
||||||
|
duration = '0m';
|
||||||
|
}
|
||||||
|
$('#add_show_duration').val(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pad(number, length) {
|
||||||
|
var str = '' + number;
|
||||||
|
while (str.length < length) {
|
||||||
|
str = '0' + str;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showErrorSections() {
|
function showErrorSections() {
|
||||||
|
|
|
@ -109,11 +109,32 @@ function dayClick(date, allDay, jsEvent, view) {
|
||||||
else {
|
else {
|
||||||
chosenTime = hours+":"+min;
|
chosenTime = hours+":"+min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(hours < 10){
|
||||||
|
chosenTime = "0"+chosenTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
var endHour = hours + 1;
|
||||||
|
var chosenEndTime;
|
||||||
|
|
||||||
|
if(min < 10){
|
||||||
|
chosenEndTime = endHour+":0"+min;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
chosenEndTime = endHour+":"+min;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(endHour < 10){
|
||||||
|
chosenEndTime = "0"+chosenEndTime;
|
||||||
|
}
|
||||||
|
|
||||||
$("#add_show_start_date").val(chosenDate);
|
$("#add_show_start_date").val(chosenDate);
|
||||||
|
$("#add_show_end_date_no_repeat").val(chosenDate);
|
||||||
$("#add_show_end_date").datepicker("option", "minDate", chosenDate);
|
$("#add_show_end_date").datepicker("option", "minDate", chosenDate);
|
||||||
$("#add_show_end_date").val(chosenDate);
|
$("#add_show_end_date").val(chosenDate);
|
||||||
$("#add_show_start_time").val(chosenTime);
|
$("#add_show_start_time").val(chosenTime);
|
||||||
|
$("#add_show_end_time").val(chosenEndTime);
|
||||||
|
$("#add_show_duration").val('1h');
|
||||||
$("#schedule-show-when").show();
|
$("#schedule-show-when").show();
|
||||||
|
|
||||||
openAddShowForm();
|
openAddShowForm();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue