feat(preferences): apply auto-completion (village name suggestions) [#198]

Honour the per-user auto-completion checkboxes on the rally point and the
marketplace, where the target village is typed by name (dname field):
  - v1: own villages
  - v2: villages in the surroundings of the active village
  - v3: villages of the player's alliance members

A new Database::getAutoCompleteVillages() builds the bounded, de-duplicated
name list from the enabled categories (system accounts excluded). A shared
Templates/villageAutocomplete.tpl renders a native <datalist> consumed by
the dname input via list="dnameSuggest"; nothing is emitted when every box
is unchecked, keeping the previous behaviour. Removes the "not coded yet"
tag from the auto-completion section in the preferences form.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ferywir
2026-06-12 08:42:44 +02:00
parent 8d46fc78ae
commit 6d57cd7fe1
5 changed files with 97 additions and 6 deletions
+1 -4
View File
@@ -350,10 +350,7 @@ if(isset($_POST['lang']))
<thead>
<tr>
<th colspan="2">
Auto completion
<span style="color:#999; font-weight:400; font-size:0.9em; font-style:italic; opacity:0.7;">
<?php echo TZ_NOT_CODED_YET; ?>
</span>
<?php echo AUTO_COMPL; ?>
</th>
</tr>
<tr><td colspan="2"><?php echo TZ_USED_FOR_RALLY_POINT_AND_MARKETPLA; ?></td></tr>