2012-09-06 00:17:33 +04:00
|
|
|
var dbtypes;
|
2011-06-20 01:33:34 +04:00
|
|
|
$(document).ready(function() {
|
2012-01-29 20:39:54 +04:00
|
|
|
dbtypes={
|
|
|
|
sqlite:!!$('#hasSQLite').val(),
|
|
|
|
mysql:!!$('#hasMySQL').val(),
|
|
|
|
postgresql:!!$('#hasPostgreSQL').val(),
|
2012-07-30 22:53:21 +04:00
|
|
|
oracle:!!$('#hasOracle').val(),
|
2013-02-10 16:07:59 +04:00
|
|
|
mssql:!!$('#hasMSSQL').val()
|
2012-09-06 00:17:33 +04:00
|
|
|
};
|
2013-03-13 14:03:52 +04:00
|
|
|
|
2011-08-11 20:18:50 +04:00
|
|
|
$('#selectDbType').buttonset();
|
2013-03-13 14:03:52 +04:00
|
|
|
|
2013-07-24 20:02:36 +04:00
|
|
|
if($('#hasSQLite').val()){
|
2011-09-12 00:06:45 +04:00
|
|
|
$('#use_other_db').hide();
|
2013-07-24 20:02:36 +04:00
|
|
|
$('#use_oracle_db').hide();
|
2014-06-03 00:56:50 +04:00
|
|
|
} else {
|
|
|
|
$('#sqliteInformation').hide();
|
2011-06-20 01:33:34 +04:00
|
|
|
}
|
2012-01-02 17:21:46 +04:00
|
|
|
$('#adminlogin').change(function(){
|
|
|
|
$('#adminlogin').val($.trim($('#adminlogin').val()));
|
|
|
|
});
|
2011-06-20 01:33:34 +04:00
|
|
|
$('#sqlite').click(function() {
|
2011-08-09 13:32:22 +04:00
|
|
|
$('#use_other_db').slideUp(250);
|
2013-07-24 20:02:36 +04:00
|
|
|
$('#use_oracle_db').slideUp(250);
|
2014-06-03 00:56:50 +04:00
|
|
|
$('#sqliteInformation').show();
|
2014-09-08 15:41:23 +04:00
|
|
|
$('#dbname').attr('pattern','[0-9a-zA-Z$_-]+');
|
2011-06-20 01:33:34 +04:00
|
|
|
});
|
|
|
|
|
2013-10-11 17:35:59 +04:00
|
|
|
$('#mysql,#pgsql,#mssql').click(function() {
|
2011-08-09 13:32:22 +04:00
|
|
|
$('#use_other_db').slideDown(250);
|
2013-07-24 20:02:36 +04:00
|
|
|
$('#use_oracle_db').slideUp(250);
|
2014-06-03 00:56:50 +04:00
|
|
|
$('#sqliteInformation').hide();
|
2014-09-08 15:41:23 +04:00
|
|
|
$('#dbname').attr('pattern','[0-9a-zA-Z$_-]+');
|
2011-06-20 01:33:34 +04:00
|
|
|
});
|
2013-07-24 20:02:36 +04:00
|
|
|
|
2012-07-30 22:53:21 +04:00
|
|
|
$('#oci').click(function() {
|
|
|
|
$('#use_other_db').slideDown(250);
|
2013-07-24 20:02:36 +04:00
|
|
|
$('#use_oracle_db').show(250);
|
2014-06-03 00:56:50 +04:00
|
|
|
$('#sqliteInformation').hide();
|
2014-09-08 15:41:23 +04:00
|
|
|
$('#dbname').attr('pattern','[0-9a-zA-Z$_-.]+');
|
2012-07-30 22:53:21 +04:00
|
|
|
});
|
2013-07-24 20:02:36 +04:00
|
|
|
|
2011-09-30 20:22:12 +04:00
|
|
|
$('input[checked]').trigger('click');
|
|
|
|
|
2011-06-20 01:33:34 +04:00
|
|
|
$('#showAdvanced').click(function() {
|
2011-09-30 20:22:12 +04:00
|
|
|
$('#datadirContent').slideToggle(250);
|
2014-03-05 13:22:35 +04:00
|
|
|
$('#databaseBackend').slideToggle(250);
|
2011-10-03 15:32:16 +04:00
|
|
|
$('#databaseField').slideToggle(250);
|
2011-06-20 01:33:34 +04:00
|
|
|
});
|
2011-09-23 21:39:30 +04:00
|
|
|
$("form").submit(function(){
|
|
|
|
// Save form parameters
|
|
|
|
var post = $(this).serializeArray();
|
|
|
|
|
2014-12-19 08:06:27 +03:00
|
|
|
// Show spinner while finishing setup
|
|
|
|
$('.float-spinner').show(250);
|
|
|
|
|
2011-09-23 21:39:30 +04:00
|
|
|
// Disable inputs
|
2013-10-04 19:09:59 +04:00
|
|
|
$(':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');
|
2014-07-04 16:29:12 +04:00
|
|
|
$('.strengthify-wrapper, .tipsy')
|
|
|
|
.css('-ms-filter', '"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"')
|
|
|
|
.css('filter', 'alpha(opacity=30)')
|
|
|
|
.css('opacity', .3);
|
2011-09-23 21:39:30 +04:00
|
|
|
|
|
|
|
// 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-03-13 14:03:52 +04:00
|
|
|
|
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-03-13 14:03:52 +04:00
|
|
|
|
2013-10-11 17:35:59 +04:00
|
|
|
if (currentDbType === undefined){
|
2012-01-29 20:39:54 +04:00
|
|
|
$('input[type="radio"]').first().click();
|
|
|
|
}
|
2013-03-13 14:03:52 +04:00
|
|
|
|
2014-03-01 05:46:27 +04:00
|
|
|
if (
|
|
|
|
currentDbType === 'sqlite' ||
|
|
|
|
(dbtypes.sqlite && currentDbType === undefined)
|
|
|
|
){
|
2013-10-11 17:35:59 +04:00
|
|
|
$('#datadirContent').hide(250);
|
2014-03-05 13:22:35 +04:00
|
|
|
$('#databaseBackend').hide(250);
|
2013-10-11 17:35:59 +04:00
|
|
|
$('#databaseField').hide(250);
|
2014-12-19 08:06:27 +03:00
|
|
|
$('.float-spinner').hide(250);
|
2013-10-11 17:35:59 +04:00
|
|
|
}
|
2013-03-13 14:03:52 +04:00
|
|
|
|
|
|
|
$('#adminpass').strengthify({
|
2014-11-06 12:15:22 +03:00
|
|
|
zxcvbn: OC.linkTo('core','vendor/zxcvbn/zxcvbn.js'),
|
2013-03-13 14:03:52 +04:00
|
|
|
titles: [
|
|
|
|
t('core', 'Very weak password'),
|
|
|
|
t('core', 'Weak password'),
|
|
|
|
t('core', 'So-so password'),
|
|
|
|
t('core', 'Good password'),
|
|
|
|
t('core', 'Strong password')
|
|
|
|
]
|
|
|
|
});
|
2014-11-04 00:01:32 +03:00
|
|
|
|
|
|
|
// centers the database chooser if it is too wide
|
|
|
|
if($('#databaseBackend').width() > 300) {
|
|
|
|
// this somehow needs to wait 250 milliseconds
|
|
|
|
// otherwise it gets overwritten
|
|
|
|
setTimeout(function(){
|
|
|
|
// calculate negative left margin
|
|
|
|
// half of the difference of width and default bix width of 300
|
|
|
|
// add 10 to clear left side padding of button group
|
|
|
|
var leftMargin = (($('#databaseBackend').width() - 300) / 2 + 10 ) * -1;
|
|
|
|
|
|
|
|
$('#databaseBackend').css('margin-left', Math.floor(leftMargin) + 'px');
|
|
|
|
}, 250);
|
|
|
|
}
|
2011-06-20 01:33:34 +04:00
|
|
|
});
|