myaac/system/templates/account.create.html.twig
Slawomir Boczek a72d1a3c9f
Feature: settings (#216)
* New admin panel Pages: Options + Config [WIP]

* Forgot the plugin example of options

* Rename to settings.php

* Add Settings Class

* New myaac_settings table

* Add $limit parameter to $db->select method

* Add $member var annotation

* Remove useless title_separator from config

* Move $menus to menus.php

Also fix active link when menu item has subpage

* Settings [WIP]

New Settings class
New Plugins::load() method
Move config.php to settings.php
MyAAC Settings will have plugin_name = 'core'
Add compat_config.php

* Change options.php to settings.php

* Change name to settings

* Add Settings menu

* Add Sections + Add setting($key) function

Reorganisation

* Add email + password fields as type

* Update 33.php

* add settings migration

* php 8 compatibility

* add missing hook

* Add categories in tabs, move more settings, revert back getPluginSettings

Categories and sections are now not numbered
Remove example settings plugin

* fix typo

* Update .gitignore

* Add 36th migration for settings table

* Execute migrations just after db connect

* Update plugins.php

* [WIP] Some work on settings

Add hidden settings
New method: parse, to parse settings from array
Move base html to twig template
Remove vocation loading from .xml, instead use predefined voc names

* Rename

* Fix path

* [WIP] More work on settings

Move more config to settings (mainly mail_* + some other)
Remove mail_admin, wasnt used anywhere
Add return type to some functions
Add Twig settings(key) function
Possibility to save setting to db

* Add min, max, step to number field option

* Re-enable plugin if disabled and already installed

* Add Settings menu, including all plugins with settings

One change included in previous commit, due to missclick

* Nothing important

* Better boolean detection

* More detailed error message in settings

* Lets call it settings.name instead

* Add new function: only_if, to hide fields when they are not enabled [WIP]

Not fully finished yet

* guild_management: show_if

* Hide section title on show_if

* Fix: check on page load if radio button is checked

* Add: show_if - account_mail_verify

* nothing important

* Rename team_* variables + add to deprecated

* Change variable name

* Extract Settings:save function

* Add settings.callbacks.get

* Move forum config to settings

* Move status config to settings

* Remove whitespaces

* More config to settings: account_types, genders, highscores, admin

* Move signature config to settings

* Move news config to settings

* Rename variable

* Save config.php in Settings

Egg and hen problem solved :)
* Test database connection on save settings -> prevents from making website unusable if connection is wrong
* Test server_path -> same
There is no config.php anymore, just config.local.php, which can be edited manually and also from admin panel

* Remove configs from previous commit

* Fix create account, if account_create_character_create is enabled

* Add more deprecated configs

* Add more info into comment

* Update 5-database.php

* Fix menu highlighting & opening

* Update template.php

* Enable script option

* Reword email settings + move two new settings

* add last_kills_limit + move shop

* google_analytics_id

* add mail_lost_account_interval

* Create character blocked words (by @gpedro), just moved to settings

* Fix google_analytics

* create character name config moved to settings

* Fix for install warning - min/max length

* New create character checks configurable: block monsters & spells names

* fixes

* Improve character npc name check

* New setting: donate_column + move donate config to settings

* Add super fancy No Refresh saving with a toast

* Add new possibility: to deny saving setting if condition is not met

* Move database settings to separate category

* Fix default value displaying

* Add database_hash setting

* add last_kills_limit to compat config

* Move create character blocked names down

* Every setting needs to have default

* Move rest of config to settings

Remove config.php completely
Add new settings category: Game
Fix account_login_by_email
Min textarea size = 2 + adjusted automatically
2023-08-05 21:00:45 +02:00

334 lines
16 KiB
Twig

{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_FORM') }}
<form action="{{ getLink('account/create') }}" method="post" id="createaccount">
<div class="TableContainer" >
<table class="Table5" cellpadding="0" cellspacing="0" >
<div class="CaptionContainer" >
<div class="CaptionInnerContainer" >
<span class="CaptionEdgeLeftTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);" /></span>
<span class="CaptionEdgeRightTop" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);" /></span>
<span class="CaptionBorderTop" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);" ></span>
<span class="CaptionVerticalLeft" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);" /></span>
<div class="Text" >Create {{ config.lua.serverName }} Account</div>
<span class="CaptionVerticalRight" style="background-image:url({{ template_path }}/images/content/box-frame-vertical.gif);" /></span>
<span class="CaptionBorderBottom" style="background-image:url({{ template_path }}/images/content/table-headline-border.gif);" ></span>
<span class="CaptionEdgeLeftBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);" /></span>
<span class="CaptionEdgeRightBottom" style="background-image:url({{ template_path }}/images/content/box-frame-edge.gif);" /></span>
</div>
</div>
<tr>
<td>
<div class="InnerTableContainer" >
<table style="width:100%;" >
{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_BOXES') }}
<tr>
<td>
<div class="TableShadowContainerRightTop"> <div class="TableShadowRightTop" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rt.gif);"></div></div>
<div class="TableContentAndRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rm.gif);">
<div class="TableContentContainer">
<table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
<tbody>
{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_ACCOUNT') }}
{% if not config.account_login_by_email %}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.account is defined %} class="red"{% endif %}>Account {% if constant('USE_ACCOUNT_NAME') %}Name{% else %}Number{% endif %}:</span>
{% if not constant('USE_ACCOUNT_NAME') %}
<div id="SuggestAccountNumber">[<a href="#">suggest number</a>]</div>
{% endif %}
</td>
<td>
<input type="text" name="account" id="account_input" size="30" maxlength="{% if constant('USE_ACCOUNT_NAME') %}30{% else %}10{% endif %}" value="{{ account }}" autofocus/>
<img id="account_indicator" src="images/global/general/{% if not save or errors.account is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
{% endif %}
<tr><td></td><td><span id="account_error" class="FormFieldError">{% if errors.account is defined %}{{ errors.account }}{% endif %}</span></td></tr>
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_ACCOUNT') }}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.email is defined %} class="red"{% endif %}>Email Address:</span>
</td>
<td>
<input type="text" name="email" id="email" size="30" maxlength="50" value="{{ email }}" />
<img id="email_indicator" src="images/global/general/{% if not save or errors.email is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
<tr>
<td></td><td><span id="email_error" class="FormFieldError">{% if errors.email is defined %}{{ errors.email }}{% endif %}</span></td>
</tr>
{% if setting('core.mail_enabled') and config.account_mail_verify %}
<tr><td></td><td><span><strong>Please use real address!<br/>We will send a link to validate your Email.</strong></span></td></tr>
{% endif %}
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_EMAIL') }}
{% if config.account_country %}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.country[0] is defined %} class="red"{% endif %}>Country:</span>
</td>
<td>
<select name="country" id="account_country">
{% for code, country_ in countries %}
<option value="{{ code }}"{% if(country is defined and country == code) or (country is null and country_recognized == code) %}selected{% endif %}>{{ country_ }}</option>
{% endfor %}
</select>
<img src="" id="account_country_img"/>
</td>
</tr>
{% if errors.country is defined %}
<tr><td></td><td><span class="FormFieldError">{{ errors.country }}</span></td></tr>
{% endif %}
{% endif %}
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_COUNTRY') }}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.password is defined %} class="red"{% endif %}>Password:</span>
</td>
<td>
<input type="password" name="password" id="password" value="" size="30" maxlength="29" />
<img id="password_indicator" src="images/global/general/{% if not save or errors.password is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
<tr><td></td><td><span id="password_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_PASSWORD') }}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.password is defined %} class="red"{% endif %}>Repeat password:</span>
</td>
<td>
<input type="password" name="password2" id="password2" value="" size="30" maxlength="29" />
<img id="password2_indicator" src="images/global/general/{% if not save or errors.password is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
<tr><td></td><td><span id="password2_error" class="FormFieldError">{% if errors.password is defined %}{{ errors.password }}{% endif %}</span></td></tr>
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_PASSWORDS') }}
</tbody>
</table>
</div>
</div>
<div class="TableShadowContainer">
<div class="TableBottomShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bm.gif);"> <div class="TableBottomLeftShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bl.gif);"></div> <div class="TableBottomRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-br.gif);"></div> </div></div>
</td>
</tr>
{{ hook('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_1') }}
{% if (not setting('core.mail_enabled') or not config.account_mail_verify) and config.account_create_character_create %}
<tr>
<td>
<div class="TableShadowContainerRightTop">
<div class="TableShadowRightTop" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rt.gif);"></div>
</div>
<div class="TableContentAndRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rm.gif);">
<div class="TableContentContainer">
<table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
<tbody>
{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_CHARACTER_NAME') }}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.name is defined %} class="red"{% endif %}>Character Name:</span>
</td>
<td>
<input id="character_name" name="name" size="{{ setting('core.create_character_name_max_length') }}" maxlength="{{ setting('core.create_character_name_max_length') }}" value="{{ name }}"/>
<img id="character_indicator" src="images/global/general/{% if not save or errors.name is defined %}n{% endif %}ok.gif" style="display: none;" />
<br>
</td>
</tr>
<tr>
<td></td>
<td>
<span id="character_error" class="FormFieldError">{% if errors.name is defined %}{{ errors.name }}{% endif %}</span>
</td>
</tr>
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_CHARACTER_NAME') }}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.sex is defined %} class="red"{% endif %}>Sex:</span>
</td>
<td>
<table width="100%">
<tbody>
<tr>
<td>
{% set i = 0 %}
{% for id, gender in config.genders|reverse(true) %}
{% set i = i + 1 %}
<span style="margin-right:15px;" class="OptionContainer">
<input type="radio" name="sex" id="sex{{ i }}" value="{{ id }}"{% if sex is not null and sex == id %} checked="checked"{% endif %}>
<label for="sex{{ i }}">{{ gender|lower }}</label>
</span>
{% endfor %}
</td>
<td>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td></td>
<td>
<span id="sex_error" class="FormFieldError">{% if errors.sex is defined %}{{ errors.sex }}{% endif %}</span>
</td>
</tr>
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_SEX') }}
{% if config.character_samples|length > 1 %}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.vocation is defined %} class="red"{% endif %}>Vocation:</span>
</td>
<td>
<table width="100%" >
<tbody>
<tr>
<td>
{% for key, sample_char in config.character_samples %}
<span style="margin-right:15px;" class="OptionContainer">
<input type="radio" name="vocation" id="vocation{{ key }}" value="{{ key }}"
{% if vocation is not null and vocation == key %} checked="checked"{% endif %}>
<label for="vocation{{ key }}">{{ config['vocations'][key] }}</label>
</span>
{% endfor %}
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td></td>
<td>
<span id="vocation_error" class="FormFieldError">{% if errors.vocation is defined %}{{ errors.vocation }}{% endif %}</span>
</td>
</tr>
{% endif %}
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_VOCATION') }}
{% if config.character_towns|length > 1 %}
<tr>
<td class="LabelV" style="width: 150px">
<span{% if errors.town is defined %} class="red"{% endif %}>Select your town:</span>
</td>
<td>
<table width="100%" >
<tbody>
<tr>
<td>
{% for town_id in config.character_towns %}
<span style="margin-right:15px;" class="OptionContainer">
<input type="radio" name="town" id="town{{ town_id }}" value="{{ town_id }}"
{% if town is not null and town == town_id %} checked="checked"{% endif %}>
<label for="town{{ town_id }}">{{ config.towns[town_id] }}</label>
</span>
{% endfor %}
</td>
</tr>
</tbody>
</table>
</td>
</tr>
{% endif %}
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_TOWNS') }}
</tbody>
</table>
</div>
</div>
<div class="TableShadowContainer">
<div class="TableBottomShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bm.gif);">
<div class="TableBottomLeftShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bl.gif);"></div>
<div class="TableBottomRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-br.gif);"></div>
</div>
</div>
</td>
</tr>
{% endif %}
{{ hook('HOOK_ACCOUNT_CREATE_BETWEEN_BOXES_2') }}
<tr>
<td>
<div class="TableShadowContainerRightTop">
<div class="TableShadowRightTop" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rt.gif);"></div>
</div>
<div class="TableContentAndRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-rm.gif);">
<div class="TableContentContainer">
<table class="TableContent" width="100%" style="border:1px solid #faf0d7;">
<tbody>
<tr>
<td colspan="2" ><b>Please select the following check box:</b></td>
</tr>
<tr>
<td colspan="2" >
<span><input type="checkbox" id="accept_rules" name="accept_rules" value="true"{% if accept_rules %}checked{% endif %}/> <label for="accept_rules">I agree to the <a href="?subtopic=rules" target="_blank">{{ config.lua.serverName }} Rules</a>.</label></span>
</td>
</tr>
{% if errors.accept_rules is defined %}
<tr>
<td colspan="2">
<span class="FormFieldError">{{ errors.accept_rules }}</span>
</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
<div class="TableShadowContainer">
<div class="TableBottomShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bm.gif);"> <div class="TableBottomLeftShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-bl.gif);"></div> <div class="TableBottomRightShadow" style="background-image:url({{ template_path }}/images/global/content/table-shadow-br.gif);"></div>
</div>
</div>
</td>
</tr>
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_BOXES') }}
</table>
</div>
</td>
</tr>
</table>
</div>
<br/>
{{ hook('HOOK_ACCOUNT_CREATE_BEFORE_SUBMIT_BUTTON') }}
<table width="100%">
<tr align="center">
<td>
<table border="0" cellspacing="0" cellpadding="0" >
<tr>
<td style="border:0px;" >
<input type="hidden" name="save" value="1" >
{{ include('buttons.submit.html.twig') }}
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
{{ hook('HOOK_ACCOUNT_CREATE_AFTER_FORM') }}
<script type="text/javascript" src="{{ constant('BASE_URL') }}tools/check_name.js"></script>
<style>
#SuggestAccountNumber {
font-size: 7pt;
}
</style>