nextcloud/core/js/setup.js

84 lines
2.1 KiB
JavaScript
Raw Normal View History

2012-09-06 00:17:33 +04:00
var dbtypes;
2011-06-20 01:33:34 +04:00
$(document).ready(function() {
dbtypes={
sqlite:!!$('#hasSQLite').val(),
mysql:!!$('#hasMySQL').val(),
postgresql:!!$('#hasPostgreSQL').val(),
2012-07-30 22:53:21 +04:00
oracle:!!$('#hasOracle').val(),
2012-09-06 00:17:33 +04:00
};
$('#selectDbType').buttonset();
$('#datadirContent').hide(250);
2011-10-03 15:32:16 +04:00
$('#databaseField').hide(250);
2011-06-20 01:33:34 +04:00
if($('#hasSQLite').val()=='true'){
$('#use_other_db').hide();
$('#dbhost').hide();
$('#dbhostlabel').hide();
2011-06-20 01:33:34 +04:00
}
$('#adminlogin').change(function(){
$('#adminlogin').val($.trim($('#adminlogin').val()));
});
2011-06-20 01:33:34 +04:00
$('#sqlite').click(function() {
$('#use_other_db').slideUp(250);
2011-09-04 17:03:25 +04:00
$('#dbhost').hide(250);
$('#dbhostlabel').hide(250);
2011-06-20 01:33:34 +04:00
});
$('#mysql').click(function() {
$('#use_other_db').slideDown(250);
2011-09-04 17:03:25 +04:00
$('#dbhost').show(250);
$('#dbhostlabel').show(250);
2011-08-07 23:06:53 +04:00
});
$('#pgsql').click(function() {
$('#use_other_db').slideDown(250);
2011-09-04 17:03:25 +04:00
$('#dbhost').show(250);
$('#dbhostlabel').show(250);
2011-06-20 01:33:34 +04:00
});
2012-07-30 22:53:21 +04:00
$('#oci').click(function() {
$('#use_other_db').slideDown(250);
$('#dbhost').show(250);
$('#dbhostlabel').show(250);
});
2011-06-20 01:33:34 +04:00
$('input[checked]').trigger('click');
2011-06-20 01:33:34 +04:00
$('#showAdvanced').click(function() {
$('#datadirContent').slideToggle(250);
2011-10-03 15:32:16 +04:00
$('#databaseField').slideToggle(250);
2011-06-20 01:33:34 +04:00
});
$("form").submit(function(){
// Save form parameters
var post = $(this).serializeArray();
// FIXME: This lines are breaking the installation
// Disable inputs
// $(':submit', this).attr('disabled','disabled').val('Finishing …');
// $('input', this).addClass('ui-state-disabled').attr('disabled','disabled');
// $('#selectDbType').button('disable');
// $('label.ui-button', this).addClass('ui-state-disabled').attr('aria-disabled', 'true').button('disable');
// Create the form
var form = $('<form>');
form.attr('action', $(this).attr('action'));
form.attr('method', 'POST');
for(var i=0; i<post.length; i++){
var input = $('<input type="hidden">');
input.attr(post[i]);
form.append(input);
}
// Submit the form
form.appendTo(document.body);
form.submit();
return false;
});
if(!dbtypes.sqlite){
$('#showAdvanced').click();
$('input[type="radio"]').first().click();
}
2011-06-20 01:33:34 +04:00
});