238 lines
6.5 KiB
HTML
238 lines
6.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Setup</title>
|
|
<link rel="stylesheet" type="text/css" href="css/bestformat.css">
|
|
<script src="php/3rdparty/jquery-2.0.3.min.js"></script>
|
|
<script src="utilities.js"></script>
|
|
|
|
<script>
|
|
|
|
function testdb() {
|
|
var dbhost = $("#db_host").val();
|
|
var dbname = $("#db_name").val();
|
|
var dbuser = $("#dbuser").val();
|
|
var dbpass = $("#dbpass").val();
|
|
|
|
var data = {
|
|
host:dbhost,
|
|
dbname:dbname,
|
|
user:dbuser,
|
|
pass:dbpass
|
|
};
|
|
|
|
doAjaxSuppressError("POST",
|
|
"install/installer.php?command=testDbConnection",
|
|
data,answerOfTestDb,
|
|
"Kommunikation zum Server fehlerhaft");
|
|
}
|
|
|
|
function getDbVals() {
|
|
doAjax("GET",
|
|
"install/installer.php?command=getConfig",
|
|
null,fillDbVals,
|
|
"Kommunikation zum Server fehlerhaft");
|
|
}
|
|
|
|
function fillDbVals(dbVals) {
|
|
if (dbVals.status == "OK") {
|
|
var db = dbVals.result;
|
|
$("#db_host").val(db.host);
|
|
$("#db_name").val(db.db);
|
|
$("#dbuser").val(db.user);
|
|
$("#dbpass").val(db.password);
|
|
$("#table_prefix").val(db.tabprefix);
|
|
testdb();
|
|
}
|
|
}
|
|
|
|
function answerOfTestDb(jsonText) {
|
|
if (jsonText.toLowerCase() == 'error') {
|
|
$("#testdbstatus").html("<b style='color:red;'>Fehlerhaft</b>");
|
|
$("#testdbstatus").data("status",false);
|
|
} else {
|
|
$("#testdbstatus").html("<b style='color:green;'>OK</b>");
|
|
$("#testdbstatus").data("status",true);
|
|
}
|
|
}
|
|
|
|
function checkWriteAccess() {
|
|
doAjax("GET",
|
|
"install/installer.php?command=checkWriteAccess",
|
|
null,
|
|
insertWriteAccessVals,
|
|
"Kommunikation mit Webserver fehlerhaft");
|
|
}
|
|
|
|
function insertBoolVal(id,boolval) {
|
|
if (boolval) {
|
|
$(id).html("<b style='color:green;'>OK</b>");
|
|
$(id).data("status",true);
|
|
} else {
|
|
$(id).html("<b style='color:red;'>Nicht beschreibbar</b>");
|
|
$(id).data("status",false);
|
|
}
|
|
}
|
|
|
|
function insertWriteAccessVals(writestatus) {
|
|
insertBoolVal("#writeaccessconfigfolder",writestatus.configfolder);
|
|
insertBoolVal("#writeaccessconfigfile",writestatus.configfile);
|
|
|
|
if (
|
|
$("#writeaccessconfigfolder").data("status") &&
|
|
$("#writeaccessconfigfile").data("status")) {
|
|
|
|
$("#writestatus").html("<b style='color:green;'>OK</b>");
|
|
$("#writestatus").data("status",true);
|
|
} else {
|
|
$("#writestatus").html("<b style='color:red;'>Fehlerhaft</b>");
|
|
$("#writestatus").data("status",false);
|
|
}
|
|
}
|
|
|
|
function startinstall() {
|
|
if ($("#adminpass").val().length == 0) {
|
|
alert("Administratorpasswort ist nicht gesetzt");
|
|
return;
|
|
}
|
|
|
|
if ($("#adminpass").val() != $("#adminpass2").val()) {
|
|
alert("Administratorpasswort uneinheitlich eingegeben");
|
|
return;
|
|
}
|
|
|
|
if ( $("#testdbstatus").data("status") &&
|
|
$("#writestatus").data("status")
|
|
) {
|
|
var data = {
|
|
host: $("#db_host").val(),
|
|
db: $("#db_name").val(),
|
|
user: $("#dbuser").val(),
|
|
password: $("#dbpass").val(),
|
|
prefix: $("#table_prefix").val(),
|
|
adminpass: $("#adminpass").val()
|
|
}
|
|
$("#progress").html("<b style='color:red;'>Arbeitet...</b>");
|
|
//$("#startinstall").attr("disabled", "disabled");
|
|
doAjax("POST",
|
|
"install/installer.php?command=install",
|
|
data,
|
|
resultOfInstall,
|
|
"Fehler bei der Installation");
|
|
} else {
|
|
alert("Installation nicht möglich");
|
|
}
|
|
}
|
|
|
|
function resultOfInstall(jsonAnswer) {
|
|
if (jsonAnswer == "OK") {
|
|
$("#progress").html("<b style='color:green;'>Abgeschlossen</b>");
|
|
alert("Die Installation ist nun abgeschlossen. Sie werden nun zur Einstiegsseite "
|
|
+ "umgeleitet. Wenn Sie sich mit dem soeben vergebenen Password einloggen "
|
|
+ "können, war die Installation erfolgreich. Löschen Sie in diesem Fall "
|
|
+ "das Verzeichnis 'install', damit die Installation nicht zu einem späteren "
|
|
+ "Zeitpunkt versehentlich überschrieben wird!");
|
|
window.location.href = "index.html";
|
|
}
|
|
}
|
|
|
|
function binding() {
|
|
$("#testdb").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
testdb();
|
|
});
|
|
|
|
checkWriteAccess();
|
|
|
|
$("#testwriteaccess").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
checkWriteAccess();
|
|
});
|
|
|
|
$("#startinstall").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
startinstall();
|
|
});
|
|
}
|
|
|
|
$(document).ready(function() {
|
|
binding();
|
|
checkWriteAccess();
|
|
getDbVals();
|
|
$("#startinstall").css({ width: '300px', 'padding-top': '10px', 'padding-bottom': '10px' });
|
|
});
|
|
|
|
</script>
|
|
|
|
</head>
|
|
<body style="background-color:SaddleBrown ;">
|
|
|
|
<center><img src=img/bannerwithphone.png width=800px></img></center>
|
|
|
|
<form>
|
|
<center>
|
|
<table border="0" cellpadding="5" cellspacing="0" class="viewtable">
|
|
<tr><th width=200px>Kategorie<th width=200px;>Einstellung<th width=200px>Wert</tr>
|
|
<tr>
|
|
<td rowspan=7>Datenbank
|
|
<td align="right">Datenbank-Server: </td>
|
|
<td><input id="db_host" type="text" size="30" maxlength="30" placeholder="localhost"></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="right">Datenbank-Name: </td>
|
|
<td><input id="db_name" type="text" size="30" maxlength="30"></td>
|
|
<tr>
|
|
<tr>
|
|
<td align="right">Datenbank-Benutzer: </td>
|
|
<td><input id="dbuser" type="text" size="30" maxlength="30"></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="right">Datenbank-Passwort: </td>
|
|
<td><input id="dbpass" type="password" size="30" maxlength="30"></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="right">Präfix für die Tabellen: </td>
|
|
<td><input id="table_prefix" type="text" size="30" maxlength="30"></td>
|
|
</tr>
|
|
<tr>
|
|
<td id=testdbbutton><button type="submit" id="testdb">Teste DB-Zugriff</button>
|
|
<td align=center id=testdbstatus>
|
|
</tr>
|
|
|
|
<tr><td rowspan=3>Schreibberechtigungen
|
|
<td align="right">php-Verzeichnis
|
|
<td align=center id=writeaccessconfigfolder>
|
|
</tr>
|
|
<tr>
|
|
<td align="right">config.php
|
|
<td align=center id=writeaccessconfigfile>
|
|
</tr>
|
|
<tr>
|
|
<td><button type="submit" id="testwriteaccess" onclick="checkWriteAccess();">Teste Schreibberechtigungen</button>
|
|
<td align=center id=writestatus>
|
|
</tr>
|
|
<tr>
|
|
<td rowspan=2>Applikation
|
|
<td align="right">Administrator-Passwort: </td>
|
|
<td><input id="adminpass" type="password" size="30" maxlength="30"></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="right">Administrator-Passwort (Wdh.): </td>
|
|
<td><input id="adminpass2" type="password" size="30" maxlength="30"></td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<td align=center><button type="submit" id="startinstall" onclick="startinstall();">Starte Installation</button>
|
|
<td><div id=progress> </div>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
</form>
|
|
|
|
</body>
|
|
|
|
</html> |