Updated createConfig dialog
This commit is contained in:
parent
8d42af4d68
commit
9d87beeb75
@ -7,23 +7,18 @@ settings = {}
|
||||
|
||||
settings.createConfig = function() {
|
||||
|
||||
var dbName,
|
||||
dbUser,
|
||||
dbPassword,
|
||||
dbHost,
|
||||
dbTablePrefix,
|
||||
buttons,
|
||||
var msg,
|
||||
action;
|
||||
|
||||
action = function(data) {
|
||||
|
||||
var dbName = data.dbName || '',
|
||||
dbUser = data.dbUser || '',
|
||||
dbPassword = data.dbPassword || '',
|
||||
dbHost = data.dbHost || '',
|
||||
dbTablePrefix = data.dbTablePrefix || '',
|
||||
params;
|
||||
|
||||
buttons = [
|
||||
['Connect', function() {
|
||||
|
||||
dbHost = $('.message input.text#dbHost').val();
|
||||
dbUser = $('.message input.text#dbUser').val();
|
||||
dbPassword = $('.message input.text#dbPassword').val();
|
||||
dbName = $('.message input.text#dbName').val();
|
||||
dbTablePrefix = $('.message input.text#dbTablePrefix').val();
|
||||
|
||||
if (dbHost.length<1) dbHost = 'localhost';
|
||||
if (dbName.length<1) dbName = 'lychee';
|
||||
|
||||
@ -32,17 +27,19 @@ settings.createConfig = function() {
|
||||
|
||||
if (data!==true) {
|
||||
|
||||
// Configuration failed
|
||||
setTimeout(function() {
|
||||
|
||||
// Connection failed
|
||||
if (data.indexOf('Warning: Connection failed!')!==-1) {
|
||||
|
||||
buttons = [
|
||||
['Retry', function() { setTimeout(settings.createConfig, 400) }],
|
||||
['', function() {}]
|
||||
];
|
||||
modal.show('Connection Failed', 'Unable to connect to host database because access was denied. Double-check your host, username and password and ensure that access from your current location is permitted.', buttons, null, false);
|
||||
basicModal.show({
|
||||
body: '<p>Unable to connect to host database because access was denied. Double-check your host, username and password and ensure that access from your current location is permitted.</p>',
|
||||
buttons: {
|
||||
action: {
|
||||
title: 'Retry',
|
||||
fn: settings.createConfig
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
@ -50,11 +47,16 @@ settings.createConfig = function() {
|
||||
// Creation failed
|
||||
if (data.indexOf('Warning: Creation failed!')!==-1) {
|
||||
|
||||
buttons = [
|
||||
['Retry', function() { setTimeout(settings.createConfig, 400) }],
|
||||
['', function() {}]
|
||||
];
|
||||
modal.show('Creation Failed', 'Unable to create the database. Double-check your host, username and password and ensure that the specified user has the rights to modify and add content to the database.', buttons, null, false);
|
||||
basicModal.show({
|
||||
body: '<p>Unable to create the database. Double-check your host, username and password and ensure that the specified user has the rights to modify and add content to the database.</p>',
|
||||
buttons: {
|
||||
action: {
|
||||
title: 'Retry',
|
||||
fn: settings.createConfig
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
@ -62,24 +64,32 @@ settings.createConfig = function() {
|
||||
// Could not create file
|
||||
if (data.indexOf('Warning: Could not create file!')!==-1) {
|
||||
|
||||
buttons = [
|
||||
['Retry', function() { setTimeout(settings.createConfig, 400) }],
|
||||
['', function() {}]
|
||||
];
|
||||
modal.show('Saving Failed', "Unable to save this configuration. Permission denied in <b>'data/'</b>. Please set the read, write and execute rights for others in <b>'data/'</b> and <b>'uploads/'</b>. Take a look the readme for more information.", buttons, null, false);
|
||||
basicModal.show({
|
||||
body: "<p>Unable to save this configuration. Permission denied in <b>'data/'</b>. Please set the read, write and execute rights for others in <b>'data/'</b> and <b>'uploads/'</b>. Take a look at the readme for more information.</p>",
|
||||
buttons: {
|
||||
action: {
|
||||
title: 'Retry',
|
||||
fn: settings.createConfig
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
// Something went wrong
|
||||
buttons = [
|
||||
['Retry', function() { setTimeout(settings.createConfig, 400) }],
|
||||
['', function() {}]
|
||||
];
|
||||
modal.show('Configuration Failed', 'Something unexpected happened. Please try again and check your installation and server. Take a look the readme for more information.', buttons, null, false);
|
||||
return false;
|
||||
basicModal.show({
|
||||
body: '<p>Something unexpected happened. Please try again and check your installation and server. Take a look at the readme for more information.</p>',
|
||||
buttons: {
|
||||
action: {
|
||||
title: 'Retry',
|
||||
fn: settings.createConfig
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}, 400);
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
@ -90,11 +100,27 @@ settings.createConfig = function() {
|
||||
|
||||
});
|
||||
|
||||
}],
|
||||
['', function() {}]
|
||||
];
|
||||
}
|
||||
|
||||
modal.show('Configuration', "Enter your database connection details below: <input id='dbHost' class='text less' type='text' placeholder='Database Host (optional)' value=''><input id='dbUser' class='text less' type='text' placeholder='Database Username' value=''><input id='dbPassword' class='text more' type='password' placeholder='Database Password' value=''><br>Lychee will create its own database. If required, you can enter the name of an existing database instead:<input id='dbName' class='text less' type='text' placeholder='Database Name (optional)' value=''><input id='dbTablePrefix' class='text more' type='text' placeholder='Table prefix (optional)' value=''>", buttons, -235, false);
|
||||
msg = "<p>Enter your database connection details below:";
|
||||
msg += "<input data-name='dbHost' class='text less' type='text' placeholder='Database Host (optional)' value=''>";
|
||||
msg += "<input data-name='dbUser' class='text less' type='text' placeholder='Database Username' value=''>";
|
||||
msg += "<input data-name='dbPassword' class='text more' type='password' placeholder='Database Password' value=''>";
|
||||
msg += "</p>";
|
||||
msg += "<p>Lychee will create its own database. If required, you can enter the name of an existing database instead:";
|
||||
msg += "<input data-name='dbName' class='text less' type='text' placeholder='Database Name (optional)' value=''>";
|
||||
msg += "<input data-name='dbTablePrefix' class='text more' type='text' placeholder='Table prefix (optional)' value=''>";
|
||||
msg += "</p>";
|
||||
|
||||
basicModal.show({
|
||||
body: msg,
|
||||
buttons: {
|
||||
action: {
|
||||
title: 'Connect',
|
||||
fn: action
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user