mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-08 05:36:10 +00:00
6d57cd7fe1
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>
82 lines
3.1 KiB
Smarty
82 lines
3.1 KiB
Smarty
<?php
|
|
// -- preluăm stările disabled din form (păstrăm exact valorile originale)
|
|
$disabled = '';
|
|
$disabledr = '';
|
|
|
|
if (!empty($form) && !empty($form->valuearray)) {
|
|
if (!empty($form->valuearray['disabled'])) {
|
|
$disabled = $form->valuearray['disabled'];
|
|
}
|
|
if (!empty($form->valuearray['disabledr'])) {
|
|
$disabledr = $form->valuearray['disabledr'];
|
|
}
|
|
}
|
|
|
|
// logica originală pentru checked
|
|
$reinforcementChecked = (empty($disabledr));
|
|
$raidChecked = (!empty($disabledr) && !empty($disabled));
|
|
|
|
// dacă ambele sunt disabled, reinforcement nu mai e checked (ca în original)
|
|
if ($raidChecked) {
|
|
$reinforcementChecked = false;
|
|
}
|
|
|
|
// coordonate
|
|
if (isset($_GET['z'])) {
|
|
$coor = $database->getCoor($_GET['z']);
|
|
} else {
|
|
$coor['x'] = $form->getValue('x');
|
|
$coor['y'] = $form->getValue('y');
|
|
}
|
|
?>
|
|
<table id="coords" cellpadding="1" cellspacing="1">
|
|
<input type="hidden" name="disabledr" value="<?php echo htmlspecialchars($disabledr ?? '', ENT_QUOTES); ?>">
|
|
<input type="hidden" name="disabled" value="<?php echo htmlspecialchars($disabled ?? '', ENT_QUOTES); ?>">
|
|
<tbody>
|
|
<tr>
|
|
<td class="sel">
|
|
<label>
|
|
<input class="radio" name="c" value="2" type="radio"
|
|
<?php if ($reinforcementChecked) echo 'checked="checked"'; ?>
|
|
<?php echo $disabledr; ?>>
|
|
Reinforcement
|
|
</label>
|
|
</td>
|
|
<td class="vil">
|
|
<span><?php echo TZ_VILLAGE; ?></span>
|
|
<input class="text" name="dname" value="<?php echo htmlspecialchars($form->getValue('dname'), ENT_QUOTES); ?>" maxlength="20" type="text" list="dnameSuggest" autocomplete="off">
|
|
<?php include("Templates/villageAutocomplete.tpl"); ?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="sel">
|
|
<label>
|
|
<input class="radio" name="c" value="3" type="radio" <?php echo $disabled; ?>>
|
|
Normal attack
|
|
</label>
|
|
</td>
|
|
<td class="or"><?php echo constant('OR'); ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="sel">
|
|
<label>
|
|
<input class="radio" name="c" value="4" type="radio"
|
|
<?php if ($raidChecked) echo 'checked="checked"'; ?>>
|
|
Raid
|
|
</label>
|
|
</td>
|
|
<td class="target">
|
|
<span>x:</span>
|
|
<input class="text" name="x" value="<?php echo htmlspecialchars($coor['x'] ?? '', ENT_QUOTES); ?>" maxlength="4" type="text">
|
|
<span>y:</span>
|
|
<input class="text" name="y" value="<?php echo htmlspecialchars($coor['y'] ?? '', ENT_QUOTES); ?>" maxlength="4" type="text">
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<button value="ok" name="s1" id="btn_ok" class="trav_buttons" alt="OK" onclick="this.disabled=true;this.form.submit();"><?php echo TZ_OK_2; ?></button>
|
|
</form>
|
|
<p class="error"><?php echo $form->getError('error'); ?></p>
|
|
</div>
|