2011-06-15 18:06:50 +02:00
|
|
|
function showErrorSections() {
|
2011-08-18 19:53:12 +02:00
|
|
|
if($("#soundcloud-settings .errors").length > 0) {
|
2011-06-15 18:06:50 +02:00
|
|
|
$("#soundcloud-settings").show();
|
2012-02-08 06:04:19 +01:00
|
|
|
$(window).scrollTop($("#soundcloud-settings .errors").position().top);
|
|
|
|
}
|
|
|
|
|
2012-06-11 21:18:12 +02:00
|
|
|
if($("#email-server-settings .errors").length > 0) {
|
|
|
|
$("#email-server-settings").show();
|
|
|
|
$(window).scrollTop($("#email-server-settings .errors").position().top);
|
|
|
|
}
|
|
|
|
|
2012-02-08 06:04:19 +01:00
|
|
|
if($("#livestream-settings .errors").length > 0) {
|
|
|
|
$("#livestream-settings").show();
|
|
|
|
$(window).scrollTop($("#livestream-settings .errors").position().top);
|
2011-06-15 18:06:50 +02:00
|
|
|
}
|
|
|
|
}
|
2011-06-09 15:56:32 +02:00
|
|
|
|
2012-06-11 18:53:09 +02:00
|
|
|
function setConfigureMailServerListener() {
|
|
|
|
var configMailServer = $("#configureMailServer");
|
|
|
|
configMailServer.click(function(event){
|
|
|
|
setMailServerInputReadonly();
|
2012-08-28 22:17:37 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
var msRequiresAuth = $("#msRequiresAuth");
|
|
|
|
msRequiresAuth.click(function(event){
|
|
|
|
setMsAuthenticationFieldsReadonly($(this));
|
|
|
|
});
|
2012-06-11 18:53:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function setEnableSystemEmailsListener() {
|
|
|
|
var enableSystemEmails = $("#enableSystemEmail");
|
|
|
|
enableSystemEmails.click(function(event){
|
|
|
|
setSystemFromEmailReadonly();
|
2012-08-28 22:17:37 +02:00
|
|
|
});
|
2012-06-11 18:53:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function setSystemFromEmailReadonly() {
|
|
|
|
var enableSystemEmails = $("#enableSystemEmail");
|
|
|
|
var systemFromEmail = $("#systemEmail");
|
|
|
|
if ($(enableSystemEmails).is(':checked')) {
|
|
|
|
systemFromEmail.removeAttr("readonly");
|
|
|
|
} else {
|
|
|
|
systemFromEmail.attr("readonly", "readonly");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setMailServerInputReadonly() {
|
|
|
|
var configMailServer = $("#configureMailServer");
|
|
|
|
var mailServer = $("#mailServer");
|
|
|
|
var port = $("#port");
|
2012-08-28 22:17:37 +02:00
|
|
|
var requiresAuthCB = $("#msRequiresAuth");
|
|
|
|
|
|
|
|
if (configMailServer.is(':checked')) {
|
2012-06-11 18:53:09 +02:00
|
|
|
mailServer.removeAttr("readonly");
|
|
|
|
port.removeAttr("readonly");
|
2012-08-28 22:17:37 +02:00
|
|
|
requiresAuthCB.parent().show();
|
2012-06-11 18:53:09 +02:00
|
|
|
} else {
|
|
|
|
mailServer.attr("readonly", "readonly");
|
2012-08-28 22:17:37 +02:00
|
|
|
port.attr("readonly", "readonly");
|
|
|
|
requiresAuthCB.parent().hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
setMsAuthenticationFieldsReadonly(requiresAuthCB);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable/disable mail server authentication fields
|
|
|
|
*/
|
|
|
|
function setMsAuthenticationFieldsReadonly(ele) {
|
|
|
|
var email = $("#email");
|
|
|
|
var password = $("#ms_password");
|
|
|
|
var configureMailServer = $("#configureMailServer");
|
|
|
|
|
|
|
|
if (ele.is(':checked') && configureMailServer.is(':checked')) {
|
|
|
|
email.removeAttr("readonly");
|
|
|
|
password.removeAttr("readonly");
|
|
|
|
} else if (ele.not(':checked') || configureMailServer.not(':checked')) {
|
2012-06-11 18:53:09 +02:00
|
|
|
email.attr("readonly", "readonly");
|
|
|
|
password.attr("readonly", "readonly");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-11 19:13:36 +01:00
|
|
|
function setSoundCloudCheckBoxListener() {
|
|
|
|
var subCheckBox= $("#UseSoundCloud,#SoundCloudDownloadbleOption");
|
|
|
|
var mainCheckBox= $("#UploadToSoundcloudOption");
|
|
|
|
subCheckBox.change(function(e){
|
|
|
|
if (subCheckBox.is(':checked')) {
|
|
|
|
mainCheckBox.attr("checked", true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
mainCheckBox.change(function(e){
|
|
|
|
if (!mainCheckBox.is(':checked')) {
|
|
|
|
$("#UseSoundCloud,#SoundCloudDownloadbleOption").attr("checked", false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2011-06-21 11:57:56 +02:00
|
|
|
$(document).ready(function() {
|
2011-04-04 00:04:14 +02:00
|
|
|
|
2012-06-11 18:53:09 +02:00
|
|
|
$('.collapsible-header').live('click',function() {
|
2011-06-21 11:57:56 +02:00
|
|
|
$(this).next().toggle('fast');
|
2012-09-14 23:35:14 +02:00
|
|
|
$(this).toggleClass("closed");
|
2011-06-21 11:57:56 +02:00
|
|
|
return false;
|
|
|
|
}).next().hide();
|
2012-10-27 00:09:30 +02:00
|
|
|
|
|
|
|
$('#pref_save').live('click', function() {
|
|
|
|
var data = $('#pref_form').serialize();
|
2013-01-14 22:00:38 +01:00
|
|
|
var url = baseUrl+'Preference/index';
|
2012-10-27 00:09:30 +02:00
|
|
|
|
2013-02-07 21:41:47 +01:00
|
|
|
$.post(url, {format: "json", data: data}, function(json){
|
2012-10-27 00:09:30 +02:00
|
|
|
$('#content').empty().append(json.html);
|
2013-01-25 17:21:34 +01:00
|
|
|
$.cookie("default_airtime_locale", $('#locale').val(), {path: '/'});
|
2012-10-27 00:09:30 +02:00
|
|
|
setTimeout(removeSuccessMsg, 5000);
|
2012-11-12 17:45:26 +01:00
|
|
|
showErrorSections();
|
2012-10-27 00:09:30 +02:00
|
|
|
});
|
|
|
|
});
|
2011-04-04 00:04:14 +02:00
|
|
|
|
2011-06-21 11:57:56 +02:00
|
|
|
showErrorSections();
|
2012-06-11 18:53:09 +02:00
|
|
|
|
2013-01-11 19:13:36 +01:00
|
|
|
setSoundCloudCheckBoxListener();
|
2012-06-11 18:53:09 +02:00
|
|
|
setMailServerInputReadonly();
|
|
|
|
setSystemFromEmailReadonly();
|
|
|
|
setConfigureMailServerListener();
|
|
|
|
setEnableSystemEmailsListener();
|
2011-06-21 11:57:56 +02:00
|
|
|
});
|