2012-09-05 20:17:33 +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(),
|
2012-07-30 18:53:21 +00:00
|
|
|
oracle:!!$('#hasOracle').val(),
|
2013-02-10 12:07:59 +00:00
|
|
|
mssql:!!$('#hasMSSQL').val()
|
2012-09-05 20:17:33 +00:00
|
|
|
};
|
2013-03-13 10:03:52 +00:00
|
|
|
|
2011-08-11 16:18:50 +00:00
|
|
|
$('#selectDbType').buttonset();
|
2013-03-13 10:03:52 +00:00
|
|
|
|
2013-07-24 16:02:36 +00:00
|
|
|
if($('#hasSQLite').val()){
|
2011-09-11 20:06:45 +00:00
|
|
|
$('#use_other_db').hide();
|
2013-07-24 16:02:36 +00:00
|
|
|
$('#use_oracle_db').hide();
|
2014-06-02 20:56:50 +00:00
|
|
|
} else {
|
|
|
|
$('#sqliteInformation').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);
|
2013-07-24 16:02:36 +00:00
|
|
|
$('#use_oracle_db').slideUp(250);
|
2014-06-02 20:56:50 +00:00
|
|
|
$('#sqliteInformation').show();
|
2014-09-08 11:41:23 +00:00
|
|
|
$('#dbname').attr('pattern','[0-9a-zA-Z$_-]+');
|
2011-06-19 21:33:34 +00:00
|
|
|
});
|
|
|
|
|
2013-10-11 13:35:59 +00:00
|
|
|
$('#mysql,#pgsql,#mssql').click(function() {
|
2011-08-09 09:32:22 +00:00
|
|
|
$('#use_other_db').slideDown(250);
|
2013-07-24 16:02:36 +00:00
|
|
|
$('#use_oracle_db').slideUp(250);
|
2014-06-02 20:56:50 +00:00
|
|
|
$('#sqliteInformation').hide();
|
2014-09-08 11:41:23 +00:00
|
|
|
$('#dbname').attr('pattern','[0-9a-zA-Z$_-]+');
|
2011-06-19 21:33:34 +00:00
|
|
|
});
|
2013-07-24 16:02:36 +00:00
|
|
|
|
2012-07-30 18:53:21 +00:00
|
|
|
$('#oci').click(function() {
|
|
|
|
$('#use_other_db').slideDown(250);
|
2013-07-24 16:02:36 +00:00
|
|
|
$('#use_oracle_db').show(250);
|
2014-06-02 20:56:50 +00:00
|
|
|
$('#sqliteInformation').hide();
|
2014-09-08 11:41:23 +00:00
|
|
|
$('#dbname').attr('pattern','[0-9a-zA-Z$_-.]+');
|
2012-07-30 18:53:21 +00:00
|
|
|
});
|
2013-07-24 16:02:36 +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);
|
2014-03-05 09:22:35 +00:00
|
|
|
$('#databaseBackend').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
|
2013-10-04 15:09:59 +00:00
|
|
|
$(':submit', this).attr('disabled','disabled').val($(':submit', this).data('finishing'));
|
2013-02-07 07:12:09 +00:00
|
|
|
$('input', this).addClass('ui-state-disabled').attr('disabled','disabled');
|
|
|
|
$('#selectDbType').buttonset('disable');
|
2014-07-04 12:29:12 +00:00
|
|
|
$('.strengthify-wrapper, .tipsy')
|
|
|
|
.css('-ms-filter', '"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"')
|
|
|
|
.css('filter', 'alpha(opacity=30)')
|
|
|
|
.css('opacity', .3);
|
2011-09-23 17:39:30 +00: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 10:03:52 +00:00
|
|
|
|
2013-10-11 13:35:59 +00:00
|
|
|
// Expand latest db settings if page was reloaded on error
|
|
|
|
var currentDbType = $('input[type="radio"]:checked').val();
|
2013-03-13 10:03:52 +00:00
|
|
|
|
2013-10-11 13:35:59 +00:00
|
|
|
if (currentDbType === undefined){
|
2012-01-29 16:39:54 +00:00
|
|
|
$('input[type="radio"]').first().click();
|
|
|
|
}
|
2013-03-13 10:03:52 +00:00
|
|
|
|
2014-03-01 01:46:27 +00:00
|
|
|
if (
|
|
|
|
currentDbType === 'sqlite' ||
|
|
|
|
(dbtypes.sqlite && currentDbType === undefined)
|
|
|
|
){
|
2013-10-11 13:35:59 +00:00
|
|
|
$('#datadirContent').hide(250);
|
2014-03-05 09:22:35 +00:00
|
|
|
$('#databaseBackend').hide(250);
|
2013-10-11 13:35:59 +00:00
|
|
|
$('#databaseField').hide(250);
|
|
|
|
}
|
2013-03-13 10:03:52 +00:00
|
|
|
|
|
|
|
$('#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-19 21:33:34 +00:00
|
|
|
});
|