2012-01-29 16:39:54 +00:00
|
|
|
var dbtypes
|
2011-06-19 21:33:34 +00:00
|
|
|
$(document).ready(function() {
|
2012-01-29 16:39:54 +00:00
|
|
|
dbtypes={
|
|
|
|
sqlite:!!$('#hasSQLite').val(),
|
|
|
|
mysql:!!$('#hasMySQL').val(),
|
|
|
|
postgresql:!!$('#hasPostgreSQL').val(),
|
|
|
|
}
|
|
|
|
|
2011-08-11 16:18:50 +00:00
|
|
|
$('#selectDbType').buttonset();
|
2011-09-30 16:22:12 +00:00
|
|
|
$('#datadirContent').hide(250);
|
2011-10-03 11:32:16 +00:00
|
|
|
$('#databaseField').hide(250);
|
2011-06-19 21:33:34 +00:00
|
|
|
if($('#hasSQLite').val()=='true'){
|
2011-09-11 20:06:45 +00:00
|
|
|
$('#use_other_db').hide();
|
|
|
|
$('#dbhost').hide();
|
|
|
|
$('#dbhostlabel').hide();
|
2011-06-19 21:33:34 +00:00
|
|
|
}
|
2012-01-02 13:21:46 +00:00
|
|
|
$('#adminlogin').change(function(){
|
|
|
|
$('#adminlogin').val($.trim($('#adminlogin').val()));
|
|
|
|
});
|
2011-06-19 21:33:34 +00:00
|
|
|
$('#sqlite').click(function() {
|
2011-08-09 09:32:22 +00:00
|
|
|
$('#use_other_db').slideUp(250);
|
2011-09-04 13:03:25 +00:00
|
|
|
$('#dbhost').hide(250);
|
|
|
|
$('#dbhostlabel').hide(250);
|
2011-06-19 21:33:34 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$('#mysql').click(function() {
|
2011-08-09 09:32:22 +00:00
|
|
|
$('#use_other_db').slideDown(250);
|
2011-09-04 13:03:25 +00:00
|
|
|
$('#dbhost').show(250);
|
|
|
|
$('#dbhostlabel').show(250);
|
2011-08-07 19:06:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$('#pgsql').click(function() {
|
2011-08-09 09:32:22 +00:00
|
|
|
$('#use_other_db').slideDown(250);
|
2011-09-04 13:03:25 +00:00
|
|
|
$('#dbhost').show(250);
|
|
|
|
$('#dbhostlabel').show(250);
|
2011-06-19 21:33:34 +00:00
|
|
|
});
|
|
|
|
|
2011-09-30 16:22:12 +00:00
|
|
|
$('input[checked]').trigger('click');
|
|
|
|
|
2011-06-19 21:33:34 +00:00
|
|
|
$('#showAdvanced').click(function() {
|
2011-09-30 16:22:12 +00:00
|
|
|
$('#datadirContent').slideToggle(250);
|
2011-10-03 11:32:16 +00:00
|
|
|
$('#databaseField').slideToggle(250);
|
2011-06-19 21:33:34 +00:00
|
|
|
});
|
2011-09-23 17:39:30 +00:00
|
|
|
$("form").submit(function(){
|
|
|
|
// Save form parameters
|
|
|
|
var post = $(this).serializeArray();
|
|
|
|
|
|
|
|
// Disable inputs
|
2011-09-24 19:56:40 +00:00
|
|
|
$(':submit', this).attr('disabled','disabled').val('Finishing …');
|
2011-09-23 17:39:30 +00:00
|
|
|
$('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;
|
|
|
|
});
|
2012-01-29 16:39:54 +00:00
|
|
|
|
|
|
|
if(!dbtypes.sqlite){
|
|
|
|
$('#showAdvanced').click();
|
|
|
|
$('input[type="radio"]').first().click();
|
|
|
|
}
|
2011-06-19 21:33:34 +00:00
|
|
|
});
|