Merge branch 'saas' into cc-5709-airtime-analyzer-cloud-storage-saas
Conflicts: airtime_mvc/application/modules/rest/controllers/MediaController.php
This commit is contained in:
commit
4d8b32556b
122 changed files with 33988 additions and 22602 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,5 @@
|
|||
$(window).load(function(){
|
||||
$(window).load(function() {
|
||||
$("#username").focus();
|
||||
$("#locale").val($.cookie("airtime_locale")!== null?$.cookie("airtime_locale"):$.cookie("default_airtime_locale"));
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
|
|
@ -25,7 +25,7 @@ $(document).ready(function(){
|
|||
data: {format:"json"}
|
||||
});
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "remind_never",
|
||||
|
@ -41,12 +41,12 @@ $(document).ready(function(){
|
|||
}
|
||||
},
|
||||
{
|
||||
id: "help_airtime",
|
||||
text: $.i18n._("Yes, help Airtime"),
|
||||
"class": "btn",
|
||||
click: function() {
|
||||
$("#register-form").submit();
|
||||
}
|
||||
id: "help_airtime",
|
||||
text: sprintf($.i18n._("Yes, help %s"), PRODUCT_NAME),
|
||||
"class": "btn",
|
||||
click: function() {
|
||||
$("#register-form").submit();
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
@ -97,12 +97,12 @@ $(document).ready(function(){
|
|||
}
|
||||
|
||||
$("#Privacy").live('click', function(){
|
||||
var support = $("#SupportFeedback");
|
||||
var button = $("#help_airtime");
|
||||
var support = $("#SupportFeedback");
|
||||
var button = $("#help_airtime");
|
||||
if($(this).is(':checked') && support.is(':checked')){
|
||||
button.removeAttr('disabled').removeClass('ui-state-disabled');
|
||||
button.removeAttr('disabled').removeClass('ui-state-disabled');
|
||||
}else{
|
||||
button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
|
||||
button.attr('disabled', 'disabled' ).addClass('ui-state-disabled');
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -118,36 +118,36 @@ $(document).ready(function(){
|
|||
});
|
||||
|
||||
$("#Logo").live('change', function(ev){
|
||||
var content, res, logoEl;
|
||||
|
||||
content = $(this).val();
|
||||
res = content.match(/(jpg|jpeg|png|gif)$/gi);
|
||||
logoEl = $("#Logo-element");
|
||||
|
||||
//not an accepted image extension.
|
||||
if (!res) {
|
||||
var ul, li;
|
||||
|
||||
ul = logoEl.find('.errors');
|
||||
li = $("<li/>").append($.i18n._("Image must be one of jpg, jpeg, png, or gif"));
|
||||
|
||||
//errors ul has already been created.
|
||||
if (ul.length > 0) {
|
||||
ul.empty()
|
||||
.append(li);
|
||||
}
|
||||
else {
|
||||
logoEl
|
||||
.append('<ul class="errors"></ul>')
|
||||
.find(".errors")
|
||||
.append(li);
|
||||
}
|
||||
|
||||
$(this).val("");
|
||||
}
|
||||
else {
|
||||
logoEl.find(".errors").remove();
|
||||
}
|
||||
var content, res, logoEl;
|
||||
|
||||
content = $(this).val();
|
||||
res = content.match(/(jpg|jpeg|png|gif)$/gi);
|
||||
logoEl = $("#Logo-element");
|
||||
|
||||
//not an accepted image extension.
|
||||
if (!res) {
|
||||
var ul, li;
|
||||
|
||||
ul = logoEl.find('.errors');
|
||||
li = $("<li/>").append($.i18n._("Image must be one of jpg, jpeg, png, or gif"));
|
||||
|
||||
//errors ul has already been created.
|
||||
if (ul.length > 0) {
|
||||
ul.empty()
|
||||
.append(li);
|
||||
}
|
||||
else {
|
||||
logoEl
|
||||
.append('<ul class="errors"></ul>')
|
||||
.find(".errors")
|
||||
.append(li);
|
||||
}
|
||||
|
||||
$(this).val("");
|
||||
}
|
||||
else {
|
||||
logoEl.find(".errors").remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -400,7 +400,7 @@ function setupUI() {
|
|||
|
||||
$(".repeat_tracks_help_icon").qtip({
|
||||
content: {
|
||||
text: $.i18n._("The desired block length will not be reached if Airtime cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block.")
|
||||
text: sprintf($.i18n._("The desired block length will not be reached if %s cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block."), PRODUCT_NAME)
|
||||
},
|
||||
hide: {
|
||||
delay: 500,
|
||||
|
|
|
@ -43,7 +43,7 @@ function setWatchedDirEvents() {
|
|||
$('#storageFolder-ok').click(function(){
|
||||
var url, chosen;
|
||||
|
||||
if(confirm($.i18n._("Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!"))){
|
||||
if(confirm(sprintf($.i18n._("Are you sure you want to change the storage folder?\nThis will remove the files from your %s library!"), PRODUCT_NAME))){
|
||||
url = baseUrl+"Preference/change-stor-directory";
|
||||
chosen = $('#storageFolder').val();
|
||||
|
||||
|
|
|
@ -153,7 +153,6 @@ $(document).ready(function() {
|
|||
|
||||
$.post(url, {format: "json", data: data}, function(json){
|
||||
$('#content').empty().append(json.html);
|
||||
$.cookie("default_airtime_locale", $('#locale').val(), {path: '/'});
|
||||
setTimeout(removeSuccessMsg, 5000);
|
||||
showErrorSections();
|
||||
setMailServerInputReadonly();
|
||||
|
|
|
@ -250,12 +250,14 @@ function setupEventListeners() {
|
|||
showErrorSections();
|
||||
checkLiquidsoapStatus();
|
||||
|
||||
var userManualAnchorOpen = "<a target='_blank' href='" + USER_MANUAL_URL + "'>";
|
||||
|
||||
// qtip for help text
|
||||
$(".override_help_icon").qtip({
|
||||
content: {
|
||||
text: $.i18n._("If Airtime is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. The allowed range is between 1024 and 49151.")+" "+
|
||||
text: sprintf($.i18n._("If %s is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. The allowed range is between 1024 and 49151."), PRODUCT_NAME)+" "+
|
||||
sprintf($.i18n._(
|
||||
"For more details, please read the %sAirtime Manual%s"), "<a target='_blank' href='http://www.sourcefabric.org/en/airtime/manuals/'>", "</a>")
|
||||
"For more details, please read the %s%s Manual%s"), userManualAnchorOpen, PRODUCT_NAME, "</a>")
|
||||
},
|
||||
hide: {
|
||||
delay: 500,
|
||||
|
@ -465,7 +467,7 @@ $(document).ready(function() {
|
|||
getAdminPasswordStatus();
|
||||
|
||||
$('#stream_save').live('click', function(){
|
||||
var confirm_pypo_restart_text = $.i18n._("If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted.");
|
||||
var confirm_pypo_restart_text = sprintf($.i18n._("If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If %s is recording, and if the change causes a playout engine restart, the recording will be interrupted."), PRODUCT_NAME);
|
||||
if (confirm(confirm_pypo_restart_text)) {
|
||||
var data = $('#stream_form').serialize();
|
||||
var url = baseUrl+'Preference/stream-setting';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
*
|
||||
* Schedule Dialog creation methods.
|
||||
* Schedule Dialog creation methods.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -54,14 +54,14 @@ function removeAddShowButton(){
|
|||
//$el is DOM element #add-show-form
|
||||
//form is the new form contents to append to $el
|
||||
function redrawAddShowForm($el, form) {
|
||||
|
||||
//need to clean up the color picker.
|
||||
|
||||
//need to clean up the color picker.
|
||||
$el.find("#schedule-show-style input").each(function(i, el){
|
||||
var $input = $(this),
|
||||
colId = $input.data("colorpickerId");
|
||||
|
||||
$("#"+colId).remove();
|
||||
$input.removeData();
|
||||
var $input = $(this),
|
||||
colId = $input.data("colorpickerId");
|
||||
|
||||
$("#"+colId).remove();
|
||||
$input.removeData();
|
||||
});
|
||||
|
||||
$el.empty().append(form);
|
||||
|
@ -75,12 +75,12 @@ function closeAddShowForm(event) {
|
|||
|
||||
var $el = $("#add-show-form");
|
||||
|
||||
$el.hide();
|
||||
$el.hide();
|
||||
windowResize();
|
||||
|
||||
$.get(baseUrl+"Schedule/get-form", {format:"json"}, function(json) {
|
||||
|
||||
redrawAddShowForm($el, json.form);
|
||||
|
||||
redrawAddShowForm($el, json.form);
|
||||
});
|
||||
|
||||
makeAddShowButton();
|
||||
|
@ -88,29 +88,29 @@ function closeAddShowForm(event) {
|
|||
|
||||
//dateText mm-dd-yy
|
||||
function startDpSelect(dateText, inst) {
|
||||
var time, date;
|
||||
var time, date;
|
||||
|
||||
time = dateText.split("-");
|
||||
date = new Date(time[0], time[1] - 1, time[2]);
|
||||
time = dateText.split("-");
|
||||
date = new Date(time[0], time[1] - 1, time[2]);
|
||||
|
||||
if (inst.input)
|
||||
inst.input.trigger('input');
|
||||
}
|
||||
|
||||
function endDpSelect(dateText, inst) {
|
||||
var time, date;
|
||||
var time, date;
|
||||
|
||||
time = dateText.split("-");
|
||||
date = new Date(time[0], time[1] - 1, time[2]);
|
||||
time = dateText.split("-");
|
||||
date = new Date(time[0], time[1] - 1, time[2]);
|
||||
|
||||
if (inst.input)
|
||||
if (inst.input)
|
||||
inst.input.trigger('input');
|
||||
}
|
||||
|
||||
function createDateInput(el, onSelect) {
|
||||
var date;
|
||||
var date;
|
||||
|
||||
el.datepicker({
|
||||
el.datepicker({
|
||||
minDate: adjustDateToServerDate(new Date(), timezoneOffset),
|
||||
onSelect: onSelect,
|
||||
dateFormat: 'yy-mm-dd',
|
||||
|
@ -120,42 +120,42 @@ function createDateInput(el, onSelect) {
|
|||
closeText: $.i18n._('Close'),
|
||||
//showButtonPanel: true,
|
||||
firstDay: calendarPref.weekStart
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function autoSelect(event, ui) {
|
||||
|
||||
$("#add_show_hosts-"+ui.item.index).attr("checked", "checked");
|
||||
event.preventDefault();
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function findHosts(request, callback) {
|
||||
var search, url;
|
||||
var search, url;
|
||||
|
||||
url = baseUrl+"User/get-hosts";
|
||||
search = request.term;
|
||||
url = baseUrl+"User/get-hosts";
|
||||
search = request.term;
|
||||
|
||||
var noResult = new Array();
|
||||
var noResult = new Array();
|
||||
noResult[0] = new Array();
|
||||
noResult[0]['value'] = $("#add_show_hosts_autocomplete").val();
|
||||
noResult[0]['label'] = $.i18n._("No result found");
|
||||
noResult[0]['index'] = null;
|
||||
|
||||
$.post(url,
|
||||
{format: "json", term: search},
|
||||
$.post(url,
|
||||
{format: "json", term: search},
|
||||
|
||||
function(json) {
|
||||
if(json.hosts.length<1){
|
||||
callback(noResult);
|
||||
}else{
|
||||
callback(json.hosts);
|
||||
}
|
||||
});
|
||||
function(json) {
|
||||
if(json.hosts.length<1){
|
||||
callback(noResult);
|
||||
}else{
|
||||
callback(json.hosts);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function beginEditShow(data){
|
||||
|
||||
|
||||
if (data.show_error == true){
|
||||
alertShowErrorAndReload();
|
||||
return false;
|
||||
|
@ -202,11 +202,11 @@ function stringToColor(s)
|
|||
}
|
||||
|
||||
function getContrastYIQ(hexcolor){
|
||||
var r = parseInt(hexcolor.substr(0,2),16);
|
||||
var g = parseInt(hexcolor.substr(2,2),16);
|
||||
var b = parseInt(hexcolor.substr(4,2),16);
|
||||
var yiq = ((r*299)+(g*587)+(b*114))/1000;
|
||||
return (yiq >= 128) ? '000000' : 'ffffff';
|
||||
var r = parseInt(hexcolor.substr(0,2),16);
|
||||
var g = parseInt(hexcolor.substr(2,2),16);
|
||||
var b = parseInt(hexcolor.substr(4,2),16);
|
||||
var yiq = ((r*299)+(g*587)+(b*114))/1000;
|
||||
return (yiq >= 128) ? '000000' : 'ffffff';
|
||||
}
|
||||
|
||||
|
||||
|
@ -214,7 +214,7 @@ function setAddShowEvents(form) {
|
|||
|
||||
//var form = $("#add-show-form");
|
||||
|
||||
form.find("h3").click(function(){
|
||||
form.find("h3").click(function(){
|
||||
$(this).next().toggle();
|
||||
});
|
||||
|
||||
|
@ -235,11 +235,11 @@ function setAddShowEvents(form) {
|
|||
}
|
||||
|
||||
// If we're adding a new show or the show has no logo, hide the "Current Logo" element tree
|
||||
$("[id^=add_show_logo_current]").toggle(($("#add_show_logo_current").attr("src") !== "")
|
||||
&& ($(".button-bar.bottom").find(".ui-button-text").text() === "Update show"));
|
||||
|
||||
var submitButton = $(".button-bar.bottom").find(".add-show-submit");
|
||||
$("[id^=add_show_instance_description]").toggle(submitButton.attr("data-action") === "edit-repeating-show-instance");
|
||||
$("[id^=add_show_logo_current]").toggle(($("#add_show_logo_current").attr("src") !== "")
|
||||
&& ($(".button-bar.bottom").find(".ui-button-text").text() === "Update show"));
|
||||
|
||||
var submitButton = $(".button-bar.bottom").find(".add-show-submit");
|
||||
$("[id^=add_show_instance_description]").toggle(submitButton.attr("data-action") === "edit-repeating-show-instance");
|
||||
|
||||
form.find("#add_show_repeats").click(function(){
|
||||
$(this).blur();
|
||||
|
@ -316,16 +316,16 @@ function setAddShowEvents(form) {
|
|||
form.find("#add_show_rebroadcast").click(function(){
|
||||
$(this).blur();
|
||||
if(form.find("#add_show_record").attr('checked')){
|
||||
if($(this).attr('checked') && !form.find("#add_show_repeats").attr('checked')) {
|
||||
form.find("#add_show_rebroadcast_absolute").show();
|
||||
}
|
||||
else if($(this).attr('checked') && form.find("#add_show_repeats").attr('checked')) {
|
||||
form.find("#add_show_rebroadcast_relative").show();
|
||||
}
|
||||
else {
|
||||
form.find("#schedule-record-rebroadcast > fieldset:not(:first-child)").hide();
|
||||
}
|
||||
}
|
||||
if($(this).attr('checked') && !form.find("#add_show_repeats").attr('checked')) {
|
||||
form.find("#add_show_rebroadcast_absolute").show();
|
||||
}
|
||||
else if($(this).attr('checked') && form.find("#add_show_repeats").attr('checked')) {
|
||||
form.find("#add_show_rebroadcast_relative").show();
|
||||
}
|
||||
else {
|
||||
form.find("#schedule-record-rebroadcast > fieldset:not(:first-child)").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// in case user is creating a new show, there will be
|
||||
|
@ -500,9 +500,9 @@ function setAddShowEvents(form) {
|
|||
endDateVisibility();
|
||||
form.find("#add_show_no_end").click(endDateVisibility);
|
||||
|
||||
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_start_date"), startDpSelect);
|
||||
createDateInput(form.find("#add_show_end_date_no_repeat"), endDpSelect);
|
||||
createDateInput(form.find("#add_show_end_date"), endDpSelect);
|
||||
|
||||
$("#add_show_start_time").timepicker({
|
||||
amPmText: ['', ''],
|
||||
|
@ -527,8 +527,8 @@ function setAddShowEvents(form) {
|
|||
closeText: 'Close',
|
||||
showButtonPanel: true,
|
||||
firstDay: calendarPref.weekStart
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
form.find('input[name^="add_show_rebroadcast_time"]').timepicker({
|
||||
amPmText: ['', ''],
|
||||
defaultTime: '',
|
||||
|
@ -578,37 +578,37 @@ function setAddShowEvents(form) {
|
|||
list.next().show();
|
||||
});
|
||||
|
||||
form.find("#add_show_hosts_autocomplete").autocomplete({
|
||||
source: findHosts,
|
||||
select: autoSelect,
|
||||
form.find("#add_show_hosts_autocomplete").autocomplete({
|
||||
source: findHosts,
|
||||
select: autoSelect,
|
||||
delay: 200
|
||||
});
|
||||
|
||||
form.find("#add_show_hosts_autocomplete").keypress(function(e){
|
||||
});
|
||||
|
||||
form.find("#add_show_hosts_autocomplete").keypress(function(e){
|
||||
if( e.which == 13 ){
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
form.find("#schedule-show-style .input_text").ColorPicker({
|
||||
form.find("#schedule-show-style .input_text").ColorPicker({
|
||||
onChange: function (hsb, hex, rgb, el) {
|
||||
$(el).val(hex);
|
||||
},
|
||||
onSubmit: function(hsb, hex, rgb, el) {
|
||||
$(el).val(hex);
|
||||
$(el).ColorPickerHide();
|
||||
},
|
||||
onBeforeShow: function () {
|
||||
$(this).ColorPickerSetColor(this.value);
|
||||
}
|
||||
});
|
||||
|
||||
// when an image is uploaded, we want to show it to the user
|
||||
form.find("#add_show_logo").change(function(event) {
|
||||
if (this.files && this.files[0]) {
|
||||
$(el).val(hex);
|
||||
},
|
||||
onSubmit: function(hsb, hex, rgb, el) {
|
||||
$(el).val(hex);
|
||||
$(el).ColorPickerHide();
|
||||
},
|
||||
onBeforeShow: function () {
|
||||
$(this).ColorPickerSetColor(this.value);
|
||||
}
|
||||
});
|
||||
|
||||
// when an image is uploaded, we want to show it to the user
|
||||
form.find("#add_show_logo").change(function(event) {
|
||||
if (this.files && this.files[0]) {
|
||||
$("#add_show_logo_preview").show();
|
||||
var reader = new FileReader(); // browser compatibility?
|
||||
|
||||
var reader = new FileReader(); // browser compatibility?
|
||||
|
||||
reader.onload = function (e) {
|
||||
$("#add_show_logo_preview")
|
||||
.attr('src', e.target.result);
|
||||
|
@ -616,78 +616,78 @@ function setAddShowEvents(form) {
|
|||
|
||||
// check image size so we don't crash the page trying to render
|
||||
if (validateImage(this.files[0], $("#add_show_logo"))) {
|
||||
// read the image data as though it were a data URI
|
||||
reader.readAsDataURL(this.files[0]);
|
||||
} else {
|
||||
// remove the file element data
|
||||
$(this).val('').replaceWith($(this).clone(true));
|
||||
$("#add_show_logo_preview").hide();
|
||||
}
|
||||
// read the image data as though it were a data URI
|
||||
reader.readAsDataURL(this.files[0]);
|
||||
} else {
|
||||
// remove the file element data
|
||||
$(this).val('').replaceWith($(this).clone(true));
|
||||
$("#add_show_logo_preview").hide();
|
||||
}
|
||||
} else {
|
||||
$("#add_show_logo_preview").hide();
|
||||
}
|
||||
});
|
||||
|
||||
// validate on upload
|
||||
function validateImage(img, el) {
|
||||
// remove any existing error messages
|
||||
if ($("#img-err")) { $("#img-err").remove(); }
|
||||
|
||||
});
|
||||
|
||||
// validate on upload
|
||||
function validateImage(img, el) {
|
||||
// remove any existing error messages
|
||||
if ($("#img-err")) { $("#img-err").remove(); }
|
||||
|
||||
if (img.size > 2048000) { // 2MB - pull this from somewhere instead?
|
||||
// hack way of inserting an error message
|
||||
var err = $.i18n._("Selected file is too large");
|
||||
el.parent().after(
|
||||
"<ul id='img-err' class='errors'>" +
|
||||
"<li>" + err + "</li>" +
|
||||
"</ul>");
|
||||
"<ul id='img-err' class='errors'>" +
|
||||
"<li>" + err + "</li>" +
|
||||
"</ul>");
|
||||
return false;
|
||||
} else if (validateMimeType(img.type) < 0) {
|
||||
var err = $.i18n._("File format is not supported");
|
||||
el.parent().after(
|
||||
"<ul id='img-err' class='errors'>" +
|
||||
"<li>" + err + "</li>" +
|
||||
"</ul>");
|
||||
return false;
|
||||
var err = $.i18n._("File format is not supported");
|
||||
el.parent().after(
|
||||
"<ul id='img-err' class='errors'>" +
|
||||
"<li>" + err + "</li>" +
|
||||
"</ul>");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Duplicate of the function in ShowController - provide it as a GET endpoint?
|
||||
function validateMimeType(mime) {
|
||||
var extensions = [
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif'
|
||||
// BMP?
|
||||
];
|
||||
return $.inArray(mime, extensions);
|
||||
}
|
||||
|
||||
form.find("#add_show_logo_current_remove").click(function() {
|
||||
if (confirm($.i18n._('Are you sure you want to delete the current logo?'))) {
|
||||
var showId = $("#add_show_id").attr("value");
|
||||
|
||||
if (showId && $("#add_show_logo_current").attr("src") !== "") {
|
||||
var action = '/rest/show/' + showId + '/delete-image';
|
||||
|
||||
$.ajax({
|
||||
url: action,
|
||||
data: '',
|
||||
type: 'POST',
|
||||
success: function() {
|
||||
$("#add_show_logo_current").prop("src", "")
|
||||
$("[id^=add_show_logo_current]").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Duplicate of the function in ShowController - provide it as a GET endpoint?
|
||||
function validateMimeType(mime) {
|
||||
var extensions = [
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
'image/gif'
|
||||
// BMP?
|
||||
];
|
||||
return $.inArray(mime, extensions);
|
||||
}
|
||||
|
||||
form.find("#add_show_logo_current_remove").click(function() {
|
||||
if (confirm($.i18n._('Are you sure you want to delete the current logo?'))) {
|
||||
var showId = $("#add_show_id").attr("value");
|
||||
|
||||
if (showId && $("#add_show_logo_current").attr("src") !== "") {
|
||||
var action = '/rest/show/' + showId + '/delete-image';
|
||||
|
||||
$.ajax({
|
||||
url: action,
|
||||
data: '',
|
||||
type: 'POST',
|
||||
success: function() {
|
||||
$("#add_show_logo_current").prop("src", "")
|
||||
$("[id^=add_show_logo_current]").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.find("#add-show-close").click(closeAddShowForm);
|
||||
|
||||
form.find(".add-show-submit").click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
form.find(".add-show-submit").click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var addShowButton = $(this);
|
||||
|
||||
$('#schedule-add-show').block({
|
||||
|
@ -701,9 +701,25 @@ function setAddShowEvents(form) {
|
|||
if (form.find("#add_show_record").attr("disabled", true)) {
|
||||
form.find("#add_show_record").attr("disabled", false);
|
||||
}
|
||||
|
||||
var startDateDisabled = false,
|
||||
startTimeDisabled = false;
|
||||
|
||||
// Similarly, we need to re-enable start date and time if they're disabled
|
||||
if (form.find("#add_show_start_date").prop("disabled") === true) {
|
||||
form.find("#add_show_start_date").attr("disabled", false);
|
||||
startDateDisabled = true;
|
||||
}
|
||||
if (form.find("#add_show_start_time").prop("disabled") === true) {
|
||||
form.find("#add_show_start_time").attr("disabled", false);
|
||||
startTimeDisabled = true;
|
||||
}
|
||||
|
||||
var data = $("form").serializeArray();
|
||||
|
||||
var data = $("form").serializeArray();
|
||||
// We need to notify the application if date and time were disabled
|
||||
data.push({name: 'start_date_disabled', value: startDateDisabled});
|
||||
data.push({name: 'start_time_disabled', value: startTimeDisabled});
|
||||
|
||||
var hosts = $('#add_show_hosts-element input').map(function() {
|
||||
if($(this).attr("checked")) {
|
||||
return $(this).val();
|
||||
|
@ -717,114 +733,114 @@ function setAddShowEvents(form) {
|
|||
}).get();
|
||||
|
||||
var start_date = $("#add_show_start_date").val(),
|
||||
end_date = $("#add_show_end_date").val(),
|
||||
action = baseUrl+"Schedule/"+String(addShowButton.attr("data-action"));
|
||||
end_date = $("#add_show_end_date").val(),
|
||||
action = baseUrl+"Schedule/"+String(addShowButton.attr("data-action"));
|
||||
|
||||
var image;
|
||||
if ($('#add_show_logo')[0] && $('#add_show_logo')[0].files
|
||||
&& $('#add_show_logo')[0].files[0]) {
|
||||
image = new FormData();
|
||||
image.append('file', $('#add_show_logo')[0].files[0]);
|
||||
&& $('#add_show_logo')[0].files[0]) {
|
||||
image = new FormData();
|
||||
image.append('file', $('#add_show_logo')[0].files[0]);
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: action,
|
||||
data: {format: "json", data: data, hosts: hosts, days: days},
|
||||
success: function(json) {
|
||||
if (json.showId && image) { // Successfully added the show, and it contains an image to upload
|
||||
var imageAction = '/rest/show/' + json.showId + '/upload-image';
|
||||
|
||||
// perform a second xhttprequest in order to send the show image
|
||||
$.ajax({
|
||||
url: imageAction,
|
||||
data: image,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
type: 'POST'
|
||||
});
|
||||
}
|
||||
url: action,
|
||||
data: {format: "json", data: data, hosts: hosts, days: days},
|
||||
success: function(json) {
|
||||
if (json.showId && image) { // Successfully added the show, and it contains an image to upload
|
||||
var imageAction = '/rest/show/' + json.showId + '/upload-image';
|
||||
|
||||
// perform a second xhttprequest in order to send the show image
|
||||
$.ajax({
|
||||
url: imageAction,
|
||||
data: image,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
type: 'POST'
|
||||
});
|
||||
}
|
||||
|
||||
$('#schedule-add-show').unblock();
|
||||
|
||||
var $addShowForm = $("#add-show-form");
|
||||
|
||||
if (json.form) {
|
||||
|
||||
redrawAddShowForm($addShowForm, json.form);
|
||||
|
||||
$("#add_show_end_date").val(end_date);
|
||||
$("#add_show_start_date").val(start_date);
|
||||
showErrorSections();
|
||||
} else if (json.edit) {
|
||||
$("#schedule_calendar").removeAttr("style")
|
||||
.fullCalendar('render');
|
||||
|
||||
$addShowForm.hide();
|
||||
$.get(baseUrl+"Schedule/get-form", {format:"json"}, function(json){
|
||||
redrawAddShowForm($addShowForm, json.form);
|
||||
});
|
||||
makeAddShowButton();
|
||||
} else {
|
||||
redrawAddShowForm($addShowForm, json.newForm);
|
||||
scheduleRefetchEvents(json);
|
||||
}
|
||||
}
|
||||
$('#schedule-add-show').unblock();
|
||||
|
||||
var $addShowForm = $("#add-show-form");
|
||||
|
||||
if (json.form) {
|
||||
|
||||
redrawAddShowForm($addShowForm, json.form);
|
||||
|
||||
$("#add_show_end_date").val(end_date);
|
||||
$("#add_show_start_date").val(start_date);
|
||||
showErrorSections();
|
||||
} else if (json.edit) {
|
||||
$("#schedule_calendar").removeAttr("style")
|
||||
.fullCalendar('render');
|
||||
|
||||
$addShowForm.hide();
|
||||
$.get(baseUrl+"Schedule/get-form", {format:"json"}, function(json){
|
||||
redrawAddShowForm($addShowForm, json.form);
|
||||
});
|
||||
makeAddShowButton();
|
||||
} else {
|
||||
redrawAddShowForm($addShowForm, json.newForm);
|
||||
scheduleRefetchEvents(json);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var regDate = new RegExp(/^[0-9]{4}-[0-1][0-9]-[0-3][0-9]$/);
|
||||
var regTime = new RegExp(/^[0-2][0-9]:[0-5][0-9]$/);
|
||||
|
||||
// when start date/time changes, set end date/time to start date/time+1 hr
|
||||
$('#add_show_start_date, #add_show_start_time').bind('input', 'change', function(){
|
||||
var startDateString = $('#add_show_start_date').val();
|
||||
var startTimeString = $('#add_show_start_time').val();
|
||||
|
||||
if(regDate.test(startDateString) && regTime.test(startTimeString)){
|
||||
var startDate = startDateString.split('-');
|
||||
var startTime = startTimeString.split(':');
|
||||
// when start date/time changes, set end date/time to start date/time+1 hr
|
||||
$('#add_show_start_date, #add_show_start_time').bind('input', 'change', function(){
|
||||
var startDateString = $('#add_show_start_date').val();
|
||||
var startTimeString = $('#add_show_start_time').val();
|
||||
|
||||
if(regDate.test(startDateString) && regTime.test(startTimeString)){
|
||||
var startDate = startDateString.split('-');
|
||||
var startTime = startTimeString.split(':');
|
||||
var startDateTime = new Date(startDate[0], parseInt(startDate[1], 10)-1, startDate[2], startTime[0], startTime[1], 0, 0);
|
||||
|
||||
var endDateString = $('#add_show_end_date_no_repeat').val();
|
||||
var endTimeString = $('#add_show_end_time').val()
|
||||
var endDate = endDateString.split('-');
|
||||
var endTime = endTimeString.split(':');
|
||||
var endDate = endDateString.split('-');
|
||||
var endTime = endTimeString.split(':');
|
||||
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
|
||||
|
||||
if(startDateTime.getTime() >= endDateTime.getTime()){
|
||||
var duration = $('#add_show_duration').val();
|
||||
// parse duration
|
||||
var time = 0;
|
||||
var info = duration.split(' ');
|
||||
var h = parseInt(info[0], 10);
|
||||
time += h * 60 * 60* 1000;
|
||||
if(info.length >1 && $.trim(info[1]) !== ''){
|
||||
var m = parseInt(info[1], 10);
|
||||
time += m * 60 * 1000;
|
||||
}
|
||||
endDateTime = new Date(startDateTime.getTime() + time);
|
||||
}
|
||||
if(startDateTime.getTime() >= endDateTime.getTime()){
|
||||
var duration = $('#add_show_duration').val();
|
||||
// parse duration
|
||||
var time = 0;
|
||||
var info = duration.split(' ');
|
||||
var h = parseInt(info[0], 10);
|
||||
time += h * 60 * 60* 1000;
|
||||
if(info.length >1 && $.trim(info[1]) !== ''){
|
||||
var m = parseInt(info[1], 10);
|
||||
time += m * 60 * 1000;
|
||||
}
|
||||
endDateTime = new Date(startDateTime.getTime() + time);
|
||||
}
|
||||
|
||||
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2);
|
||||
var endTimeFormat = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2);
|
||||
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);
|
||||
$('#add_show_end_date_no_repeat').val(endDateFormat);
|
||||
$('#add_show_end_time').val(endTimeFormat);
|
||||
|
||||
// calculate duration
|
||||
var startDateTimeString = startDateString + " " + startTimeString;
|
||||
var endDateTimeString = $('#add_show_end_date_no_repeat').val() + " " + $('#add_show_end_time').val();
|
||||
var timezone = $("#add_show_timezone").val();
|
||||
calculateDuration(startDateTimeString, endDateTimeString, timezone);
|
||||
}
|
||||
});
|
||||
// calculate duration
|
||||
var startDateTimeString = startDateString + " " + startTimeString;
|
||||
var endDateTimeString = $('#add_show_end_date_no_repeat').val() + " " + $('#add_show_end_time').val();
|
||||
var timezone = $("#add_show_timezone").val();
|
||||
calculateDuration(startDateTimeString, endDateTimeString, timezone);
|
||||
}
|
||||
});
|
||||
|
||||
// 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').bind('input', 'change', function(){
|
||||
var endDateString = $('#add_show_end_date_no_repeat').val();
|
||||
// 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').bind('input', 'change', function(){
|
||||
var endDateString = $('#add_show_end_date_no_repeat').val();
|
||||
var endTimeString = $('#add_show_end_time').val()
|
||||
|
||||
|
||||
if(regDate.test(endDateString) && regTime.test(endTimeString)){
|
||||
var startDateString = $('#add_show_start_date').val();
|
||||
var startTimeString = $('#add_show_start_time').val();
|
||||
|
@ -836,21 +852,21 @@ function setAddShowEvents(form) {
|
|||
var endTime = endTimeString.split(':');
|
||||
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
|
||||
|
||||
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', '');
|
||||
}
|
||||
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
|
||||
var startDateTimeString = startDateString + " " + startTimeString;
|
||||
// calculate duration
|
||||
var startDateTimeString = startDateString + " " + startTimeString;
|
||||
var endDateTimeString = endDateString + " " + endTimeString;
|
||||
var timezone = $("#add_show_timezone").val();
|
||||
calculateDuration(startDateTimeString, endDateTimeString, timezone);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if($('#cb_custom_auth').attr('checked')){
|
||||
$('#custom_auth_div').show()
|
||||
|
@ -866,18 +882,18 @@ function setAddShowEvents(form) {
|
|||
}
|
||||
})
|
||||
|
||||
function calculateDuration(startDateTime, endDateTime, timezone){
|
||||
var loadingIcon = $('#icon-loader-small');
|
||||
|
||||
loadingIcon.show();
|
||||
$.post(
|
||||
baseUrl+"Schedule/calculate-duration",
|
||||
{startTime: startDateTime, endTime: endDateTime, timezone: timezone},
|
||||
function(data) {
|
||||
$('#add_show_duration').val(JSON.parse(data));
|
||||
loadingIcon.hide();
|
||||
});
|
||||
}
|
||||
function calculateDuration(startDateTime, endDateTime, timezone){
|
||||
var loadingIcon = $('#icon-loader-small');
|
||||
|
||||
loadingIcon.show();
|
||||
$.post(
|
||||
baseUrl+"Schedule/calculate-duration",
|
||||
{startTime: startDateTime, endTime: endDateTime, timezone: timezone},
|
||||
function(data) {
|
||||
$('#add_show_duration').val(JSON.parse(data));
|
||||
loadingIcon.hide();
|
||||
});
|
||||
}
|
||||
|
||||
// Since Zend's setAttrib won't apply through the wrapper, set accept=image/* here
|
||||
$("#add_show_logo").prop("accept", "image/*");
|
||||
|
|
17
airtime_mvc/public/js/datatables/i18n/ja.txt
Normal file
17
airtime_mvc/public/js/datatables/i18n/ja.txt
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"sProcessing": "処理中...",
|
||||
"sLengthMenu": "_MENU_ 件表示",
|
||||
"sZeroRecords": "データはありません。",
|
||||
"sInfo": " _TOTAL_ 件中 _START_ から _END_ まで表示",
|
||||
"sInfoEmpty": " 0 件中 0 から 0 まで表示",
|
||||
"sInfoFiltered": "(全 _MAX_ 件より抽出)",
|
||||
"sInfoPostFix": "",
|
||||
"sSearch": "検索:",
|
||||
"sUrl": "",
|
||||
"oPaginate": {
|
||||
"sFirst": "先頭",
|
||||
"sPrevious": "前",
|
||||
"sNext": "次",
|
||||
"sLast": "最終"
|
||||
}
|
||||
}
|
17
airtime_mvc/public/js/datatables/i18n/ja_JP.txt
Normal file
17
airtime_mvc/public/js/datatables/i18n/ja_JP.txt
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"sProcessing": "処理中...",
|
||||
"sLengthMenu": "_MENU_ 件表示",
|
||||
"sZeroRecords": "データはありません。",
|
||||
"sInfo": " _TOTAL_ 件中 _START_ から _END_ まで表示",
|
||||
"sInfoEmpty": " 0 件中 0 から 0 まで表示",
|
||||
"sInfoFiltered": "(全 _MAX_ 件より抽出)",
|
||||
"sInfoPostFix": "",
|
||||
"sSearch": "検索:",
|
||||
"sUrl": "",
|
||||
"oPaginate": {
|
||||
"sFirst": "先頭",
|
||||
"sPrevious": "前",
|
||||
"sNext": "次",
|
||||
"sLast": "最終"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue