Add a brand new charming installation (for version 0.9) (#144)

* Add a brand new charming installation

* Fix alert position in setup requirements validation

* Add some missing definitions

* A distinction between bootstrap CSS classes and myaac classes

For CSS-styled messages

* Remove unused functions for messages

Co-authored-by: slawkens <slawkens@gmail.com>
This commit is contained in:
Fernando Matos
2020-12-22 03:47:47 -03:00
committed by GitHub
parent 3beedc1747
commit 6f42a60e59
19 changed files with 195 additions and 470 deletions

View File

@@ -23,10 +23,12 @@ function message($message, $type, $return)
return true;
}
if($return)
return '<div class="' . $type . '" style="margin-bottom:10px;">' . $message . '</div>';
if($return) {
// for install and admin pages use bootstrap classes
return '<div class="' . ((defined('MYAAC_INSTALL') || defined('MYAAC_ADMIN')) ? 'alert alert-' : '') . $type . '" style="margin-bottom:10px;">' . $message . '</div>';
}
echo '<div class="' . $type . '" style="margin-bottom:10px;">' . $message . '</div>';
echo '<div class="' . ((defined('MYAAC_INSTALL') || defined('MYAAC_ADMIN')) ? 'alert alert-' : '') . $type . '" style="margin-bottom:10px;">' . $message . '</div>';
return true;
}
function success($message, $return = false) {
@@ -39,28 +41,9 @@ function note($message, $return = false) {
return message($message, 'note', $return);
}
function error($message, $return = false) {
return message($message, 'error', $return);
return message($message, ((defined('MYAAC_INSTALL') || defined('MYAAC_ADMIN')) ? 'danger' : 'error'), $return);
}
function message1($head, $message, $type, $icon , $return)
{//return '<div class="' . $type . '">' . $message . '</div>';
if($return)
return '<div class="alert alert-'.$type.' alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-'.$icon.'"></i> '.$head.':</h4>'.$message.'</div>';
echo '<div class="alert alert-'.$type.' alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><h4><i class="icon fa fa-'.$icon.'"></i> '.$head.':</h4>'.$message.'</div>';
return true;
}
function success1($message, $return = false) {
return message('Info', $message, 'success','success', $return);
}
function warning1($message, $return = false) {
return message('Warning',$message, 'warning','ban', $return);
}
function note1($message, $return = false) {
return message('Info',$message, 'info','info', $return);
}
function error1($message, $return = false) {
return message("Alert", $message, 'danger','check', $return);
}
function longToIp($ip)
{
$exp = explode(".", long2ip($ip));

View File

@@ -20,7 +20,7 @@ $locale['not_loaded'] = 'Not loaded';
$locale['loading_spinner'] = 'Please wait, installing...';
$locale['importing_spinner'] = 'Please wait, importing data...';
$locale['please_fill_all'] = 'Please fill all inputs!';
$locale['already_installed'] = 'MyAAC has been already installed. Please delete <b>install/<b/> directory. If you want to reinstall MyAAC - please delete <strong>config.local.php</strong> file from the main directory and refresh the page.';
$locale['already_installed'] = 'MyAAC has been already installed. Please delete <b>install/</b> directory. If you want to reinstall MyAAC - please delete <strong>config.local.php</strong> file from the main directory and refresh the page.';
// welcome
$locale['step_welcome'] = 'Welcome';

View File

@@ -1,32 +1,26 @@
<style>
tr, td {
border-bottom: 1px solid #ddd;
padding: 15px;
}
</style>
{% if errors is not empty %}
<div class="alert alert-danger">
{% for error in errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% endif %}
<form action="{{ constant('BASE_URL') }}install/" method="post" autocomplete="off">
<input type="hidden" name="step" id="step" value="finish" />
<table>
{% for value in ['email', account, 'password', 'player_name'] %}
<tr>
<td>
<label for="vars_{{ value }}">
<span>{{ locale['step_admin_' ~ value] }}</span>
</label>
<br/>
<input type="text" name="vars[{{ value }}]" id="vars_{{ value }}"{% if session['var_' ~ value] is not null %} value="{{ session['var_' ~ value] }}"{% endif %}/>
</td>
<td>
<em>{{ locale['step_admin_' ~ value ~ '_desc']|raw }}</em>
</td>
</tr>
{% endfor %}
</table>
{% for value in ['email', account, 'password', 'player_name'] %}
<div class="form-group mb-2">
<label for="vars_{{ value }}">{{ locale['step_admin_' ~ value] }}</label>
<input class="form-control" type="text" name="vars[{{ value }}]" id="vars_{{ value }}"{% if session['var_' ~ value] is not null %} value="{{ session['var_' ~ value] }}"{% endif %}/>
<small class="form-text text-muted">{{ locale['step_admin_' ~ value ~ '_desc']|raw }}</small>
</div>
{% if errors is defined %}
{% for error in errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{% endif %}
{% endfor %}
<div class="text-center m-3">
{{ buttons|raw }}
</div>
</form>

View File

@@ -1,71 +1,51 @@
{% if errors is not empty %}
<div class="alert alert-danger">
{% for error in errors %}
<span>{{ error }}</span>
{% endfor %}
</div>
{% endif %}
<form action="{{ constant('BASE_URL') }}install/" method="post" autocomplete="off">
<input type="hidden" name="step" id="step" value="database" />
<table>
{% for value in ['server_path', 'mail_admin'] %}
<tr>
<td>
<label for="vars_{{ value }}">
<span>{{ locale['step_config_' ~ value] }}</span>
</label>
<br>
<input type="text" name="vars[{{ value }}]" id="vars_{{ value }}"{% if session['var_' ~ value] is not null %} value="{{ session['var_' ~ value] }}"{% endif %}/>
</td>
<td>
<em>{{ locale['step_config_' ~ value ~ '_desc'] }}</em>
</td>
</tr>
{% endfor %}
<tr>
<td>
<label for="vars_date_timezone">
<span>{{ locale.step_config_timezone }}</span>
</label>
<br/>
<select name="vars[date_timezone]" id="vars_date_timezone">
{% for timezone in timezones %}
<option value="{{ timezone }}"{% if (session['var_date_timezone'] is not null and session['var_date_timezone'] == timezone) or (session['var_date_timezone'] is null and timezone == 'Europe/Berlin') %} selected{% endif %}>{{ timezone }}</option>
{% endfor %}
</select>
</td>
<td>
<em>{{ locale.step_config_timezone_desc }}</em>
</td>
</tr>
<tr>
<td>
<label for="vars_client">
<span>{{ locale.step_config_client }}</span>
</label>
<br/>
<select name="vars[client]" id="vars_client">
{% for id, version in clients %}
<option value="{{ id }}"{% if session['var_client'] is not null and session['var_client'] == id %} selected{% endif %}>{{ version }}</option>
{% endfor %}
</select>
</td>
<td>
<em>{{ locale.step_config_client_desc }}</em>
</td>
</tr>
<tr>
<td>
<label for="vars_usage">
<span>{{ locale.step_config_usage }}</span>
</label>
<br/>
<input type="hidden" value="0" name="vars[usage]">
<input type="checkbox" name="vars[usage]" id="vars_usage" value="1"{% if session['var_usage'] is null or session['var_usage'] == 1 %} checked{% endif %}/>
</td>
<td>
<em>{{ locale.step_config_usage_desc }}</em>
</td>
</tr>
</table>
{% if errors is defined %}
{% for error in errors %}
<p class="error">{{ error }}</p>
{% endfor %}
{% endif %}
{% for value in ['server_path', 'mail_admin'] %}
<div class="form-group mb-2">
<label for="vars_{{ value }}">{{ locale['step_config_' ~ value] }}</label>
<input class="form-control" type="text" name="vars[{{ value }}]" id="vars_{{ value }}"{% if session['var_' ~ value] is not null %} value="{{ session['var_' ~ value] }}"{% endif %}/>
<small class="form-text text-muted">{{ locale['step_config_' ~ value ~ '_desc'] }}</small>
</div>
{% endfor %}
<div class="form-group mb-2">
<label for="vars_date_timezone">{{ locale.step_config_timezone }}</label>
<select class="form-control" name="vars[date_timezone]" id="vars_date_timezone">
{% for timezone in timezones %}
<option value="{{ timezone }}"{% if (session['var_date_timezone'] is not null and session['var_date_timezone'] == timezone) or (session['var_date_timezone'] is null and timezone == 'Europe/Berlin') %} selected{% endif %}>{{ timezone }}</option>
{% endfor %}
</select>
<small class="form-text text-muted">{{ locale.step_config_timezone_desc }}</small>
</div>
<div class="form-group mb-2">
<label for="vars_client">{{ locale.step_config_client }}</label>
<select class="form-control" name="vars[client]" id="vars_client">
{% for id, version in clients %}
<option value="{{ id }}"{% if session['var_client'] is not null and session['var_client'] == id %} selected{% endif %}>{{ version }}</option>
{% endfor %}
</select>
<small class="form-text text-muted">{{ locale.step_config_client_desc }}</small>
</div>
<div class="form-group mb-2">
<label for="vars_usage">{{ locale.step_config_usage }}</label>
<input type="hidden" value="0" name="vars[usage]">
<input type="checkbox" name="vars[usage]" id="vars_usage" value="1"{% if session['var_usage'] is null or session['var_usage'] == 1 %} checked{% endif %}/>
<small class="form-text text-muted d-block">{{ locale.step_config_usage_desc }}</small>
</div>
<div class="text-center m-3">
{{ buttons|raw }}
</div>
</form>

View File

@@ -1,6 +1,8 @@
<form action="{{ constant('BASE_URL') }}install/" method="post">
<input type="hidden" name="step" id="step" value="requirements" />
<textarea rows="10" cols="80" readonly="1">{{ license }}</textarea>
<textarea rows="11" cols="80" readonly="1" class="form-control">{{ license }}</textarea>
<div class="text-center m-3">
{{ buttons|raw }}
</div>
</form>

View File

@@ -1,12 +1,17 @@
<p class="lead">{{ locale.step_welcome_desc }}:</p>
<form action="{{ constant('BASE_URL') }}install/" method="post">
<input type="hidden" name="step" id="step" value="license" />
<div class="input"><p>{{ locale.step_welcome_desc }}</p>
<select name="lang">
<div class="input">
<select name="lang" class="form-control">
{% for locale_ in locales %}
<option value="{{ locale_.id }}"{% if (detected_locale is not null and locale_.id == detected_locale) or cookie_locale == locale_.id %} selected{% endif %}>{{ locale_.name }}</option>
{% endfor %}
</select>
</div>
<div class="text-center m-3">
{{ buttons|raw }}
</div>
</form>