nextcloud/core/js/setup.js

90 lines
2.2 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(),
mssql:!!$('#hasMSSQL').val()
2012-09-06 00:17:33 +04:00
};
$('#selectDbType').buttonset();
if($('#hasSQLite').val()){
$('#use_other_db').hide();
$('#use_oracle_db').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);
$('#use_oracle_db').slideUp(250);
2011-06-20 01:33:34 +04:00
});
2013-10-11 17:35:59 +04:00
$('#mysql,#pgsql,#mssql').click(function() {
$('#use_other_db').slideDown(250);
$('#use_oracle_db').slideUp(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);
$('#use_oracle_db').show(250);
2012-07-30 22:53:21 +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();
// Disable inputs
$(':submit', this).attr('disabled','disabled').val($(':submit', this).data('finishing'));
2013-02-07 11:12:09 +04:00
$('input', this).addClass('ui-state-disabled').attr('disabled','disabled');
$('#selectDbType').buttonset('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;
});
2013-10-11 17:35:59 +04:00
// Expand latest db settings if page was reloaded on error
var currentDbType = $('input[type="radio"]:checked').val();
2013-10-11 17:35:59 +04:00
if (currentDbType === undefined){
$('input[type="radio"]').first().click();
}
2013-10-11 17:35:59 +04:00
if (currentDbType === 'sqlite' || (dbtypes.sqlite && currentDbType === undefined)){
$('#datadirContent').hide(250);
$('#databaseField').hide(250);
}
$('#adminpass').strengthify({
zxcvbn: OC.linkTo('3rdparty','zxcvbn/js/zxcvbn.js'),
titles: [
t('core', 'Very weak password'),
t('core', 'Weak password'),
t('core', 'So-so password'),
t('core', 'Good password'),
t('core', 'Strong password')
]
});
2011-06-20 01:33:34 +04:00
});