pkgreq_results.php: Split out package results box

Do not include the wrapper div container in the template.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2017-02-07 08:29:53 +01:00
parent ff8eb62a75
commit 05007d8b1a
2 changed files with 126 additions and 126 deletions

View file

@ -77,7 +77,9 @@ if (isset($base_id)) {
$SID = $_COOKIE['AURSID']; $SID = $_COOKIE['AURSID'];
html_header(__("Requests")); html_header(__("Requests"));
echo '<div id="pkglist-results" class="box">';
include('pkgreq_results.php'); include('pkgreq_results.php');
echo '</div>';
} }
html_footer(AURWEB_VERSION); html_footer(AURWEB_VERSION);

View file

@ -1,129 +1,127 @@
<div id="pkglist-results" class="box"> <div class="pkglist-stats">
<div class="pkglist-stats"> <p>
<p> <?= _n('%d package request found.', '%d package requests found.', $total) ?>
<?= _n('%d package request found.', '%d package requests found.', $total) ?> <?= __('Page %d of %d.', $current, $pages) ?>
<?= __('Page %d of %d.', $current, $pages) ?> </p>
</p> <?php if (count($templ_pages) > 1): ?>
<?php if (count($templ_pages) > 1): ?> <p class="pkglist-nav">
<p class="pkglist-nav"> <?php foreach ($templ_pages as $pagenr => $pagestart): ?>
<?php foreach ($templ_pages as $pagenr => $pagestart): ?> <?php if ($pagestart === false): ?>
<?php if ($pagestart === false): ?> <span class="page"><?= $pagenr ?></span>
<span class="page"><?= $pagenr ?></span> <?php elseif ($pagestart + 1 == $first): ?>
<?php elseif ($pagestart + 1 == $first): ?> <span class="page"><?= $pagenr ?></span>
<span class="page"><?= $pagenr ?></span>
<?php else: ?>
<a class="page" href="<?= get_uri('/requests/'); ?>?<?= mkurl('O=' . $pagestart) ?>"><?= $pagenr ?></a>
<?php endif; ?>
<?php endforeach; ?>
</p>
<?php endif; ?>
</div>
<table class="results">
<thead>
<tr>
<th><?= __("Package") ?></th>
<th><?= __("Type") ?></th>
<th><?= __("Comments") ?></th>
<th><?= __("Filed by") ?></th>
<th><?= __("Date") ?></th>
<th><?= __("Status") ?></th>
</tr>
</thead>
<tbody>
<?php while (list($indx, $row) = each($results)): ?>
<?php
$idle_time = config_get_int('options', 'request_idle_time');
$due = ($row['Open'] && time() - intval($row['RequestTS']) > $idle_time);
if (!$due) {
$time_left = $idle_time - (time() - intval($row['RequestTS']));
if ($time_left > 48 * 3600) {
$time_left_fmt = _n("~%d day left", "~%d days left", round($time_left / (24 * 3600)));
} elseif ($time_left > 3600) {
$time_left_fmt = _n("~%d hour left", "~%d hours left", round($time_left / 3600));
} else {
$time_left_fmt = __("<1 hour left");
}
}
?>
<tr class="<?= ($indx % 2 == 0) ? 'odd' : 'even' ?>">
<?php if ($row['BaseID']): ?>
<td><a href="<?= htmlspecialchars(get_pkgbase_uri($row["Name"]), ENT_QUOTES); ?>"><?= htmlspecialchars($row["Name"]) ?></a></td>
<?php else: ?> <?php else: ?>
<td><?= htmlspecialchars($row["Name"]) ?></td> <a class="page" href="<?= get_uri('/requests/'); ?>?<?= mkurl('O=' . $pagestart) ?>"><?= $pagenr ?></a>
<?php endif; ?> <?php endif; ?>
<?php if ($row['Type'] == 'merge'): ?> <?php endforeach; ?>
<td> </p>
<?= htmlspecialchars(ucfirst($row['Type']), ENT_QUOTES); ?> <?php endif; ?>
<?php if (!empty($row['MergeInto'])): ?> </div>
(<?= htmlspecialchars($row['MergeInto'], ENT_QUOTES); ?>)
<?php endif; ?> <table class="results">
</td> <thead>
<?php else: ?> <tr>
<td><?= htmlspecialchars(ucfirst($row['Type']), ENT_QUOTES); ?></td> <th><?= __("Package") ?></th>
<?php endif; ?> <th><?= __("Type") ?></th>
<td class="wrap"><?= htmlspecialchars($row['Comments'], ENT_QUOTES); ?></td> <th><?= __("Comments") ?></th>
<td> <th><?= __("Filed by") ?></th>
<a href="<?= get_uri('/account/') . htmlspecialchars($row['User'], ENT_QUOTES) ?>" title="<?= __('View account information for %s', htmlspecialchars($row['User'])) ?>"><?= htmlspecialchars($row['User']) ?></a> <th><?= __("Date") ?></th>
</td> <th><?= __("Status") ?></th>
<td<?php if ($due): ?> class="flagged"<?php endif; ?>><?= date("Y-m-d H:i", intval($row['RequestTS'])) ?></td> </tr>
<?php if ($row['Open']): ?> </thead>
<td> <tbody>
<?php if ($row['BaseID']): ?>
<?php if ($row['Type'] == 'deletion'): ?> <?php while (list($indx, $row) = each($results)): ?>
<a href="<?= get_pkgbase_uri($row['Name']) ?>delete/?via=<?= intval($row['ID']) ?>"><?= __('Accept') ?></a> <?php
<br/ > $idle_time = config_get_int('options', 'request_idle_time');
<?php elseif ($row['Type'] == 'merge'): ?> $due = ($row['Open'] && time() - intval($row['RequestTS']) > $idle_time);
<a href="<?= get_pkgbase_uri($row['Name']) ?>merge/?into=<?= urlencode($row['MergeInto']) ?>&via=<?= intval($row['ID']) ?>"><?= __('Accept') ?></a> if (!$due) {
<br /> $time_left = $idle_time - (time() - intval($row['RequestTS']));
<?php elseif ($row['Type'] == 'orphan' && $due): ?> if ($time_left > 48 * 3600) {
<form action="<?= get_pkgbase_uri($row['Name']) . 'disown/'; ?>" method="post"> $time_left_fmt = _n("~%d day left", "~%d days left", round($time_left / (24 * 3600)));
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" /> } elseif ($time_left > 3600) {
<input type="hidden" name="via" value="<?= intval($row['ID']) ?>" /> $time_left_fmt = _n("~%d hour left", "~%d hours left", round($time_left / 3600));
<input type="submit" class="button text-button" name="do_Disown" value="<?= __('Accept') ?>" /> } else {
</form> $time_left_fmt = __("<1 hour left");
<?php elseif ($row['Type'] == 'orphan' && !$due): ?> }
<?= __('Locked') ?> (<?= $time_left_fmt ?>) }
<br /> ?>
<?php endif; ?> <tr class="<?= ($indx % 2 == 0) ? 'odd' : 'even' ?>">
<?php endif; ?> <?php if ($row['BaseID']): ?>
<a href="<?= get_pkgreq_route() . '/' . intval($row['ID']) ?>/close/"><?= __('Close') ?></a> <td><a href="<?= htmlspecialchars(get_pkgbase_uri($row["Name"]), ENT_QUOTES); ?>"><?= htmlspecialchars($row["Name"]) ?></a></td>
</td> <?php else: ?>
<?php else: ?> <td><?= htmlspecialchars($row["Name"]) ?></td>
<?php if ($row['Status'] == 1): ?> <?php endif; ?>
<td><?= __("Closed") ?></td> <?php if ($row['Type'] == 'merge'): ?>
<?php elseif ($row['Status'] == 2): ?> <td>
<td><?= __("Accepted") ?></td> <?= htmlspecialchars(ucfirst($row['Type']), ENT_QUOTES); ?>
<?php elseif ($row['Status'] == 3): ?> <?php if (!empty($row['MergeInto'])): ?>
<td><?= __("Rejected") ?></td> (<?= htmlspecialchars($row['MergeInto'], ENT_QUOTES); ?>)
<?php else: ?> <?php endif; ?>
<td><?= __("unknown") ?></td> </td>
<?php endif; ?> <?php else: ?>
<?php endif; ?> <td><?= htmlspecialchars(ucfirst($row['Type']), ENT_QUOTES); ?></td>
</tr> <?php endif; ?>
<?php endwhile; ?> <td class="wrap"><?= htmlspecialchars($row['Comments'], ENT_QUOTES); ?></td>
<td>
</tbody> <a href="<?= get_uri('/account/') . htmlspecialchars($row['User'], ENT_QUOTES) ?>" title="<?= __('View account information for %s', htmlspecialchars($row['User'])) ?>"><?= htmlspecialchars($row['User']) ?></a>
</table> </td>
<td<?php if ($due): ?> class="flagged"<?php endif; ?>><?= date("Y-m-d H:i", intval($row['RequestTS'])) ?></td>
<div class="pkglist-stats"> <?php if ($row['Open']): ?>
<p> <td>
<?= _n('%d package request found.', '%d package requests found.', $total) ?> <?php if ($row['BaseID']): ?>
<?= __('Page %d of %d.', $current, $pages) ?> <?php if ($row['Type'] == 'deletion'): ?>
</p> <a href="<?= get_pkgbase_uri($row['Name']) ?>delete/?via=<?= intval($row['ID']) ?>"><?= __('Accept') ?></a>
<?php if (count($templ_pages) > 1): ?> <br/ >
<p class="pkglist-nav"> <?php elseif ($row['Type'] == 'merge'): ?>
<?php foreach ($templ_pages as $pagenr => $pagestart): ?> <a href="<?= get_pkgbase_uri($row['Name']) ?>merge/?into=<?= urlencode($row['MergeInto']) ?>&via=<?= intval($row['ID']) ?>"><?= __('Accept') ?></a>
<?php if ($pagestart === false): ?> <br />
<span class="page"><?= $pagenr ?></span> <?php elseif ($row['Type'] == 'orphan' && $due): ?>
<?php elseif ($pagestart + 1 == $first): ?> <form action="<?= get_pkgbase_uri($row['Name']) . 'disown/'; ?>" method="post">
<span class="page"><?= $pagenr ?></span> <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
<?php else: ?> <input type="hidden" name="via" value="<?= intval($row['ID']) ?>" />
<a class="page" href="<?= get_uri('/requests/'); ?>?<?= mkurl('O=' . $pagestart) ?>"><?= $pagenr ?></a> <input type="submit" class="button text-button" name="do_Disown" value="<?= __('Accept') ?>" />
<?php endif; ?> </form>
<?php endforeach; ?> <?php elseif ($row['Type'] == 'orphan' && !$due): ?>
</p> <?= __('Locked') ?> (<?= $time_left_fmt ?>)
<?php endif; ?> <br />
</div> <?php endif; ?>
<?php endif; ?>
<a href="<?= get_pkgreq_route() . '/' . intval($row['ID']) ?>/close/"><?= __('Close') ?></a>
</td>
<?php else: ?>
<?php if ($row['Status'] == 1): ?>
<td><?= __("Closed") ?></td>
<?php elseif ($row['Status'] == 2): ?>
<td><?= __("Accepted") ?></td>
<?php elseif ($row['Status'] == 3): ?>
<td><?= __("Rejected") ?></td>
<?php else: ?>
<td><?= __("unknown") ?></td>
<?php endif; ?>
<?php endif; ?>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<div class="pkglist-stats">
<p>
<?= _n('%d package request found.', '%d package requests found.', $total) ?>
<?= __('Page %d of %d.', $current, $pages) ?>
</p>
<?php if (count($templ_pages) > 1): ?>
<p class="pkglist-nav">
<?php foreach ($templ_pages as $pagenr => $pagestart): ?>
<?php if ($pagestart === false): ?>
<span class="page"><?= $pagenr ?></span>
<?php elseif ($pagestart + 1 == $first): ?>
<span class="page"><?= $pagenr ?></span>
<?php else: ?>
<a class="page" href="<?= get_uri('/requests/'); ?>?<?= mkurl('O=' . $pagestart) ?>"><?= $pagenr ?></a>
<?php endif; ?>
<?php endforeach; ?>
</p>
<?php endif; ?>
</div> </div>