aurweb/web/template/account_search_results.php
Lukas Fleischer cbab9870c1 Fix HTML code in the account search results table
Do not add an opening <tbody> tag for every row. Instead, wrap all rows
in <tbody></tbody>.

While at it, also simplify the code used to color the rows.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-26 13:51:18 +01:00

87 lines
2.7 KiB
PHP

<?php
if (!$result):
print __("No results matched your search criteria.");
else:
if ($result):
?>
<table class="results">
<thead>
<tr>
<th><?= __("Username") ?></th>
<th><?= __("Type") ?></th>
<th><?= __("Status") ?></th>
<th><?= __("Real Name") ?></th>
<th><?= __("IRC Nick") ?></th>
<th><?= __("PGP Key Fingerprint") ?></th>
<th><?= __("Edit Account") ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($userinfo as $idx => $row): ?>
<tr class ="<?= ($idx % 2 == 0) ? 'odd' : 'even' ?>">
<td><a href="<?= get_uri('/packages/'); ?>?SeB=m&amp;K=<?= $row["Username"] ?>"><?= $row["Username"] ?></a></td>
<td><?= $row["AccountType"] ?></td>
<td>
<?php
if ($row["Suspended"]):
print __("Suspended");
else:
print __("Active");
endif;
?>
</td>
<td><?php $row["RealName"] ? print htmlspecialchars($row["RealName"],ENT_QUOTES) : print "&nbsp;" ?></td>
<td><?php $row["IRCNick"] ? print htmlspecialchars($row["IRCNick"],ENT_QUOTES) : print "&nbsp;" ?></td>
<td><?php $row["PGPKey"] ? print html_format_pgp_fingerprint($row["PGPKey"]) : print "&nbsp;" ?></td>
<td>
<?php if (can_edit_account($row)): ?>
<a href="<?= get_user_uri($row["Username"]) . "edit/" ?>"><?= __("Edit") ?></a>
<?php else: ?>
&nbsp;
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<table class="results">
<tr>
<td align="left">
<form action="<?= get_uri('/accounts/'); ?>" method="post">
<fieldset>
<input type="hidden" name="Action" value="SearchAccounts" />
<input type="hidden" name="O" value="<?= ($OFFSET-$HITS_PER_PAGE) ?>" />
<?php
reset($search_vars);
foreach ($search_vars as $k => $ind):
?>
<input type="hidden" name="<?= $ind ?>" value="<?= ${$ind} ?>" />
<?php endforeach; ?>
<input type="submit" class="button" value="&lt;-- <?= __("Less") ?>" />
</fieldset>
</form>
</td>
<td align="right">
<form action="<?= get_uri('/accounts/'); ?>" method="post">
<fieldset>
<input type="hidden" name="Action" value="SearchAccounts" />
<input type="hidden" name="O" value="<?= ($OFFSET+$HITS_PER_PAGE) ?>" />
<?php
reset($search_vars);
foreach ($search_vars as $k => $ind):
?>
<input type="hidden" name="<?= $ind ?>" value="<?= ${$ind} ?>" />
<?php endforeach; ?>
<input type="submit" class="button" value="<?= __("More") ?> --&gt;" />
</fieldset>
</form>
</td>
</tr>
</table>
<?php else: ?>
<p style="text-align:center;">
<?= __("No more results to display."); ?>
</p>
<?php endif; ?>
<?php endif; ?>