Install: Prefill the fields with values from InstallService

This commit is contained in:
Olivier PEREZ 2015-09-07 12:24:55 +02:00
parent 254512c55a
commit fd27c135c8
3 changed files with 17 additions and 13 deletions

View File

@ -28,9 +28,9 @@ if (is_file(CONF_FILENAME)) {
} }
$error = null; $error = null;
$installService = new InstallService();
if (!empty($_POST)) { if (!empty($_POST)) {
$installService = new InstallService();
$result = $installService->install($_POST, $smarty); $result = $installService->install($_POST, $smarty);
if ($result['status'] === 'OK') { if ($result['status'] === 'OK') {
@ -43,5 +43,5 @@ if (!empty($_POST)) {
$smarty->assign('error', $error); $smarty->assign('error', $error);
$smarty->assign('title', __('Admin', 'Installation')); $smarty->assign('title', __('Admin', 'Installation'));
$smarty->assign('logsAreReadable', is_readable('../' . LOG_FILE)); $smarty->assign('fields', $installService->getFields());
$smarty->display('admin/install.tpl'); $smarty->display('admin/install.tpl');

View File

@ -36,7 +36,7 @@ class InstallService {
), ),
'Database configuration' => 'Database configuration' =>
array( array(
'dbConnectionString' => 'mysql:host=HOST;dbname=SCHEMA;port=3306', 'dbConnectionString' => 'mysql:host=<HOST>;dbname=<SCHEMA>;port=3306',
'dbUser' => 'root', 'dbUser' => 'root',
'dbPassword' => '', 'dbPassword' => '',
'dbPrefix' => 'fd_', 'dbPrefix' => 'fd_',
@ -133,4 +133,8 @@ class InstallService {
); );
} }
public function getFields() {
return $this->fields;
}
} }

View File

@ -15,28 +15,28 @@
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<label for="appName" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'AppName')}</label> <label for="appName" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'AppName')}</label>
<input type="text" class="form-control" id="appName" name="appName" value="Framadate" autofocus> <input type="text" class="form-control" id="appName" name="appName" value="{$fields['General']['appName']}" autofocus required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<label for="appMail" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'AppMail')}</label> <label for="appMail" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'AppMail')}</label>
<input type="email" class="form-control" id="appMail" name="appMail" value=""> <input type="email" class="form-control" id="appMail" name="appMail" value="{$fields['General']['appMail']}" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<label for="responseMail" class="input-group-addon">{__('Installation', 'ResponseMail')}</label> <label for="responseMail" class="input-group-addon">{__('Installation', 'ResponseMail')}</label>
<input type="email" class="form-control" id="responseMail" name="responseMail" value=""> <input type="email" class="form-control" id="responseMail" name="responseMail" value="{$fields['General']['responseMail']}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<label for="defaultLanguage" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'DefaultLanguage')}</label> <label for="defaultLanguage" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'DefaultLanguage')}</label>
<select type="email" class="form-control" id="defaultLanguage" name="defaultLanguage"> <select type="email" class="form-control" id="defaultLanguage" name="defaultLanguage" required>
<option value="de">{$langs['de']}</option> <option value="de">{$langs['de']}</option>
<option value="en">{$langs['es']}</option> <option value="en">{$langs['es']}</option>
<option value="es">{$langs['es']}</option> <option value="es">{$langs['es']}</option>
@ -50,7 +50,7 @@
<label for="cleanUrl" class="input-group-addon">{__('Installation', 'CleanUrl')}</label> <label for="cleanUrl" class="input-group-addon">{__('Installation', 'CleanUrl')}</label>
<div class="form-control"> <div class="form-control">
<input type="checkbox" id="cleanUrl" name="cleanUrl" checked> <input type="checkbox" id="cleanUrl" name="cleanUrl" {($fields['General']['cleanUrl']) ? 'checked' : ''}>
</div> </div>
</div> </div>
</div> </div>
@ -61,35 +61,35 @@
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<label for="dbConnectionString" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'DbConnectionString')}</label> <label for="dbConnectionString" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'DbConnectionString')}</label>
<input type="text" class="form-control" id="dbConnectionString" name="dbConnectionString" value="mysql:host=HOST;dbname=SCHEMA;port=3306"> <input type="text" class="form-control" id="dbConnectionString" name="dbConnectionString" value="{$fields['Database configuration']['dbConnectionString']}" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<label for="dbUser" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'DbUser')}</label> <label for="dbUser" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'DbUser')}</label>
<input type="text" class="form-control" id="dbUser" name="dbUser" value="root"> <input type="text" class="form-control" id="dbUser" name="dbUser" value="{$fields['Database configuration']['dbUser']}" required>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<label for="dbPassword" class="input-group-addon">{__('Installation', 'DbPassword')}</label> <label for="dbPassword" class="input-group-addon">{__('Installation', 'DbPassword')}</label>
<input type="password" class="form-control" id="dbPassword" name="dbPassword"> <input type="password" class="form-control" id="dbPassword" name="dbPassword" value="{$fields['Database configuration']['dbPassword']}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<label for="dbPrefix" class="input-group-addon">{__('Installation', 'DbPrefix')}</label> <label for="dbPrefix" class="input-group-addon">{__('Installation', 'DbPrefix')}</label>
<input type="text" class="form-control" id="dbPrefix" name="dbPrefix" value="fd_"> <input type="text" class="form-control" id="dbPrefix" name="dbPrefix" value="{$fields['Database configuration']['dbPrefix']}">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
<label for="migrationTable" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'MigrationTable')}</label> <label for="migrationTable" class="input-group-addon">{__('Generic', 'ASTERISK')} {__('Installation', 'MigrationTable')}</label>
<input type="text" class="form-control" id="migrationTable" name="migrationTable" value="framadate_migration"> <input type="text" class="form-control" id="migrationTable" name="migrationTable" value="{$fields['Database configuration']['migrationTable']}" required>
</div> </div>
</div> </div>
</fieldset> </fieldset>