summaryrefslogtreecommitdiffstats
path: root/web/template/pkg_search_results.php
blob: 440698bab95ed8b2bf7f3356695f1dceddaee22d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
if (isset($_COOKIE['AURSID'])) {
	$atype = account_from_sid($_COOKIE['AURSID']);
} else {
	$atype = "";
}

if (!$result): ?>
	<div class="box"><p><?php echo __("Error retrieving package list.") ?></p></div>
<?php elseif ($total == 0): ?>
	<div class="box"><p><?php echo __("No packages matched your search criteria.") ?></p></div>
<?php else: ?>
	<div id="pkglist-results" class="box">
		<div id="pkglist-stats-top">
			<p><?php echo __('%s Packages found. Showing %s - %s', $total, $first, $last) ?></p>
			<p class="pkglist-nav">
				<?php foreach ($templ_pages as $pagenr => $pagestart): ?>
					<?php if ($pagestart === false): ?>
						<span class="page"><?php echo $pagenr ?></span>
					<?php elseif ($pagestart + 1 == $first): ?>
						<span class="page"><?php echo $pagenr ?></span>
					<?php else: ?>
						<a class="page" href="<?php echo get_uri('/packages/'); ?>?<?php echo mkurl('O=' . $pagestart) ?>"><?php echo $pagenr ?></a>
					<?php endif; ?>
				<?php endforeach; ?>
			</p>
		</div>

		<form id="pkglist-results-form" method="post" action="<?php echo get_uri('/packages/'); ?>?<?php echo htmlentities($_SERVER['QUERY_STRING']) ?>">
			<table class="results">
			<thead>
				<tr>
					<?php if ($SID): ?>
					<th>&nbsp;</th>
					<?php endif; ?>
					<th><a href="?<?php echo mkurl('SB=c&SO=' . $SO_next) ?>"><?php echo __("Category") ?></a></th>
					<th><a href="?<?php echo mkurl('SB=n&SO=' . $SO_next) ?>"><?php echo __("Name") ?></a></th>
					<th><a href="?<?php echo mkurl('SB=v&SO=' . $SO_next) ?>"><?php echo __("Votes") ?></a></th>
					<?php if ($SID): ?>
					<th><a href="?<?php echo mkurl('SB=w&SO=' . $SO_next) ?>"><?php echo __("Voted") ?></a></th>
					<th><a href="?<?php echo mkurl('SB=o&SO=' . $SO_next) ?>"><?php echo __("Notify") ?></a></th>
					<?php endif; ?>
					<th><?php echo __("Description") ?></th>
					<th><a href="?<?php echo mkurl('SB=m&SO=' . $SO_next) ?>"><?php echo __("Maintainer") ?></a></th>
				</tr>
			</thead>
			<tbody>

	<?php while (list($indx, $row) = each($searchresults)): ?>
		<tr class="<?php echo ($indx % 2 == 0) ? 'odd' : 'even' ?>">
		<?php if ($SID): ?>
		<td><input type="checkbox" name="IDs[<?php echo $row["ID"] ?>]" value="1" /></td>
		<?php endif; ?>
		<td><?php echo htmlspecialchars($row["Category"]) ?></td>
		<td><a href="<?php echo get_uri('/packages/'); ?>?ID=<?php echo $row["ID"] ?>"><?php echo htmlspecialchars($row["Name"]) . ' ' . htmlspecialchars($row["Version"]) ?></a></td>
		<td><?php echo $row["NumVotes"] ?></td>
		<?php if ($SID): ?>
		<td>
		<?php if (isset($row["Voted"])): ?>
		<?php echo __("Yes") ?>
		<?php endif; ?>
		</td>
		<td>
		<?php if (isset($row["Notify"])): ?>
		<?php echo __("Yes") ?>
		<?php endif; ?>
		</td>
		<?php endif; ?>
		<td><?php echo htmlspecialchars($row['Description'], ENT_QUOTES); ?></td>
		<td>
		<?php if (isset($row["Maintainer"])): ?>
		<a href="<?php echo get_uri('/packages/'); ?>?K=<?php echo htmlspecialchars($row['Maintainer'], ENT_QUOTES) ?>&amp;SeB=m"><?php echo htmlspecialchars($row['Maintainer']) ?></a>
		<?php else: ?>
		<span><?php echo __("orphan") ?></span>
		<?php endif; ?>
		</td>
	</tr>
	<?php endwhile; ?>

			</tbody>
			</table>

			<div id="pkglist-stats-bottom">
				<p><?php echo __('%s Packages found. Showing %s - %s', $total, $first, $last) ?></p>

				<p class="pkglist-nav">
					<?php foreach ($templ_pages as $pagenr => $pagestart): ?>
						<?php if ($pagestart === false): ?>
							<span class="page"><?php echo $pagenr ?></span>
						<?php elseif ($pagestart + 1 == $first): ?>
							<span class="page"><?php echo $pagenr ?></span>
						<?php else: ?>
							<a class="page" href="<?php echo get_uri('/packages/'); ?>?<?php echo mkurl('O=' . $pagestart) ?>"><?php echo $pagenr ?></a>
						<?php endif; ?>
					<?php endforeach; ?>
				</p>
			</div>

			<?php if ($SID): ?>
				<p>
					<select name="action">
						<option><?php echo __("Actions") ?></option>
						<option value="do_Flag"><?php echo __("Flag Out-of-date") ?></option>
						<option value="do_UnFlag"><?php echo __("Unflag Out-of-date") ?></option>
						<option value="do_Adopt"><?php echo __("Adopt Packages") ?></option>
						<option value="do_Disown"><?php echo __("Disown Packages") ?></option>
						<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
						<option value="do_Delete"><?php echo __("Delete Packages") ?></option>
						<?php endif; ?>
						<option value="do_Notify"><?php echo __("Notify") ?></option>
						<option value="do_UnNotify"><?php echo __("UnNotify") ?></option>
					</select>
					<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
						<label for="merge_Into"><?php echo __("Merge into") ?></label>
						<input type="text" id="merge_Into" name="merge_Into" />
						<input type="checkbox" name="confirm_Delete" value="1" /> <?php echo __("Confirm") ?>
					<?php endif; ?>
					<input type="hidden" name="token" value="<?php echo htmlspecialchars($_COOKIE['AURSID']) ?>" />
					<input type="submit" class="button" style="width: 80px" value="<?php echo __("Go") ?>" />
				</p>
			<?php endif; # if ($SID) ?>
		</form>
	</div>
<?php endif; # search was successful and returned multiple results ?>