CC-6066 - more work on add/remove content screen

This commit is contained in:
Duncan Sommerville 2015-08-24 12:05:57 -04:00
parent b15160d0fb
commit e6761b54da
7 changed files with 113 additions and 51 deletions

View File

@ -100,6 +100,7 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headScript()->appendFile($baseUrl.'js/libs/moment.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/libs/moment-timezone-with-data-2010-2020.min.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/utilities/utilities.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.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');

View File

@ -175,6 +175,16 @@ class ShowbuilderController extends Zend_Controller_Action
$this->view->start = $start_time;
$this->view->end = $end_time;
$form = new Application_Form_ShowBuilder();
$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;
$this->view->dialog = $this->view->render('showbuilder/builderDialog.phtml');
}

View File

@ -616,9 +616,9 @@ th.library_checkbox {
}
/* Since the z-index gets applied dynamically */
#ui-datepicker-div {
z-index: 1000 !important;
}
/*#ui-datepicker-div {*/
/*z-index: 1000 !important;*/
/*}*/
.datatable .ui-state-highlight, .spl_sortable .ui-state-highlight {
background: rgba(255, 93, 26, .6);

View File

@ -1399,7 +1399,7 @@ button.ui-button.::-moz-focus-inner {
.ui-datepicker th {
padding: .7em .3em;
text-align: center;
font-weight: bold;
font-weight: normal;
border: 0;
}
.ui-datepicker td {

View File

@ -58,6 +58,11 @@ var i18n_days_short = [
$.i18n._("Sa")
];
var dateStartId = "#sb_date_start",
timeStartId = "#sb_time_start",
dateEndId = "#sb_date_end",
timeEndId = "#sb_time_end";
function getDatatablesStrings(overrideDict) {
var dict = {
@ -181,6 +186,31 @@ function openPreviewWindow(url, w, h) {
return false;
}
function validateTimeRange() {
var oRange,
inputs = $('.sb-timerange > input'),
start, end;
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
start = oRange.start;
end = oRange.end;
if (end >= start) {
inputs.removeClass('error');
} else {
if (!inputs.hasClass('error')) {
inputs.addClass('error');
}
}
return {
start: start,
end: end,
isValid: end >= start
};
}
function pad(number, length) {
return sprintf("%'0"+length+"d", number);
}

View File

@ -120,8 +120,7 @@ function findViewportDimensions() {
};
}
function highlightMediaTypeSelector(dialog)
{
function highlightMediaTypeSelector(dialog) {
if (location.hash === "") {
dialog.find("a[href$='#files']").parent().addClass("selected");
}
@ -143,6 +142,54 @@ function highlightMediaTypeSelector(dialog)
});
}
function buildTimerange(dialog) {
var builder = dialog.find("#show_builder"),
oBaseDatePickerSettings = {
dateFormat: 'yy-mm-dd',
//i18n_months, i18n_days_short are in common.js
monthNames: i18n_months,
dayNamesMin: i18n_days_short,
onClick: function(sDate, oDatePicker) {
$(this).datepicker("setDate", sDate);
},
onClose: validateTimeRange
},
oBaseTimePickerSettings = {
showPeriodLabels: false,
showCloseButton: true,
closeButtonText: $.i18n._("Done"),
showLeadingZero: false,
defaultTime: '0:00',
hourText: $.i18n._("Hour"),
minuteText: $.i18n._("Minute"),
onClose: validateTimeRange
};
/*
* Icon hover states for search.
*/
builder.on("mouseenter", ".sb-timerange .ui-button", function(ev) {
$(this).addClass("ui-state-hover");
});
builder.on("mouseleave", ".sb-timerange .ui-button", function(ev) {
$(this).removeClass("ui-state-hover");
});
builder.find(dateStartId)
.datepicker(oBaseDatePickerSettings);
builder.find(timeStartId)
.timepicker(oBaseTimePickerSettings);
builder.find(dateEndId)
.datepicker(oBaseDatePickerSettings);
builder.find(timeEndId)
.timepicker(oBaseTimePickerSettings);
var oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId,
dateEndId, timeEndId);
AIRTIME.showbuilder.fnServerData.start = oRange.start;
AIRTIME.showbuilder.fnServerData.end = oRange.end;
}
function buildScheduleDialog (json, instance_id) {
var dialog = $(json.dialog),
viewport = findViewportDimensions(),
@ -184,6 +231,7 @@ function buildScheduleDialog (json, instance_id) {
dialog.dialog('open');
highlightMediaTypeSelector(dialog);
buildTimerange(dialog);
}
function buildContentDialog (json){

View File

@ -86,32 +86,6 @@ AIRTIME = (function(AIRTIME) {
}
}
function validateTimeRange() {
var oRange,
inputs = $('.sb-timerange > input'),
start, end;
oRange = AIRTIME.utilities.fnGetScheduleRange(dateStartId, timeStartId, dateEndId, timeEndId);
start = oRange.start;
end = oRange.end;
if (end >= start) {
inputs.removeClass('error');
}
else {
if (!inputs.hasClass('error')) {
inputs.addClass('error');
}
}
return {
start: start,
end: end,
isValid: end >= start
};
}
function showSearchSubmit() {
var fn,
op,
@ -121,7 +95,6 @@ AIRTIME = (function(AIRTIME) {
check = validateTimeRange();
if (check.isValid) {
//reset timestamp value since input values could have changed.
AIRTIME.showbuilder.resetTimestamp();