pkg_search_results.php 6.67 KB
Newer Older
Loui Chang's avatar
Loui Chang committed
1
<form action='packages.php?<?php echo htmlentities($_SERVER['QUERY_STRING']) ?>' method='post'>
2
<div class="pgbox">
3
4
5
6
7
<?php if (!$result) { ?>
<div class='pgboxbody'><?php print __("Error retrieving package list.") ?></div>
<?php } elseif ($total == 0) { ?>
<div class='pgboxbody'><?php print __("No packages matched your search criteria.") ?></div>
<?php } else { ?>
8
9
10
	<div class="pgboxtitle">
		<span class='f3'><?php print __("Package Listing") ?></span>
	</div>
11

12
<table width='100%' cellspacing='0' cellpadding='2'>
13
14
15
16
<tr>
	<?php if ($SID): ?>
	<th style='border-bottom: #666 1px solid; vertical-align: bottom'>&nbsp;</th>
	<?php endif; ?>
17

18
	<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'>
19
		<a href='?<?php print mkurl('SB=l&SO=' . $SO_next) ?>'><?php print __("Location") ?></a>
20
21
	</span></th>
	<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'>
22
		<a href='?<?php print mkurl('SB=c&SO=' . $SO_next) ?>'><?php print __("Category") ?></a>
23
	</span></th>
24
	<th style='border-bottom: #666 1px solid; vertical-align: bottom; text-align: center;'><span class='f2'>
25
		<a href='?<?php print mkurl('SB=n&SO=' . $SO_next) ?>'><?php print __("Name") ?></a>
26
27
	</span></th>
	<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'>
28
		<a href='?<?php print mkurl('SB=v&SO=' . $SO_next) ?>'><?php print __("Votes") ?></a>
29
	</span></th>
30

31
	<?php if ($SID): ?>
32
33
34
35
36
37
	<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'>
		<a href='?<?php print mkurl('SB=w&SO=' . $SO_next) ?>'><?php print __("Voted") ?></a>
	</span></th>
	<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'>
		<a href='?<?php print mkurl('SB=o&SO=' . $SO_next) ?>'><?php print __("Notify") ?></a>
	</span></th>
38
	<?php endif; ?>
39
	<th style='border-bottom: #666 1px solid; vertical-align: bottom; text-align: center;'><span class='f2'><?php print __("Description") ?></span></th>
40
	<th style='border-bottom: #666 1px solid; vertical-align: bottom'><span class='f2'>
41
		<a href='?<?php print mkurl('SB=m&SO=' . $SO_next) ?>'><?php print __("Maintainer") ?></a>
42
43
44
	</span></th>
</tr>

45
<?php
46
$atype = account_from_sid($_COOKIE['AURSID']);
47
48
for ($i = 0; $row = mysql_fetch_assoc($result); $i++) {
	(($i % 2) == 0) ? $c = "data1" : $c = "data2";
49
	if ($row["OutOfDateTS"] !== NULL): $c = "outofdate"; endif;
50
?>
51
<tr>
52
	<?php if ($SID): ?>
53
54
55
56
57
	<td class='<?php print $c ?>'><input type='checkbox' name='IDs[<?php print $row["ID"] ?>]' value='1'></td>
	<?php endif; ?>
	<td class='<?php print $c ?>'><span class='f5'><span class='blue'><?php print $row["Location"] ?></span></span></td>
	<td class='<?php print $c ?>'><span class='f5'><span class='blue'><?php print $row["Category"] ?></span></span></td>
	<td class='<?php print $c ?>'><span class='f4'><a href='packages.php?ID=<?php print $row["ID"] ?>'><span class='black'><?php print $row["Name"] ?> <?php print $row["Version"] ?></span></a></span></td>
58
	<td class='<?php print $c ?>' style="text-align: right"><span class='f5'><span class='blue'><?php print $row["NumVotes"] ?></span></span></td>
59
60
61
	<?php if ($SID): ?>
	<td class='<?php print $c ?>'><span class='f5'><span class='blue'>
	<?php if (isset($row["Voted"])): ?>
62
	<?php print __("Yes") ?></span></td>
63
	<?php else: ?>
64
	</span></td>
65
66
67
	<?php endif; ?>
	<td class='<?php print $c ?>'><span class='f5'><span class='blue'>
	<?php if (isset($row["Notify"])): ?>
68
	<?php print __("Yes") ?></span></td>
69
	<?php else: ?>
70
	</span></td>
71
72
73
	<?php endif; ?>
	<?php endif; ?>
	<td class='<?php print $c ?>'><span class='f4'><span class='blue'>
74
	<?php print htmlspecialchars($row['Description'], ENT_QUOTES); ?></span></span></td>
75
76
77
78
79
80
81
82
83
84
	<td class='<?php print $c ?>'><span class='f5'><span class='blue'>
	<?php if (isset($row["Maintainer"])): ?>
	<a href='packages.php?K=<?php print $row['Maintainer'] ?>&amp;SeB=m'><?php print $row['Maintainer'] ?></a>
	<?php else: ?>
	<span style='color: blue; font-style: italic;'><?php print __("orphan") ?></span>
	<?php endif; ?>
	</span></span></td>
</tr>
<?php } ?>

85
	</table>
86
87
</div>

88
89
90

<div class="pgbox">
	<table width='100%'>
91
	<tr>
92
		<td align='left'>
93
94
	<div id="legend">
		<span class='f3'><?php echo __('Legend') ?></span>
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
		<span class="outofdate"><?php print __('Out of Date') ?></span>
	</div>
	<?php if ($SID): ?>
	<div>
		<select name='action'>
			<option><?php print __("Actions") ?></option>
			<option value='do_Flag'><?php print __("Flag Out-of-date") ?></option>
			<option value='do_UnFlag'><?php print __("Unflag Out-of-date") ?></option>
			<option value='do_Adopt'><?php print __("Adopt Packages") ?></option>
			<option value='do_Disown'><?php print __("Disown Packages") ?></option>
			<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
			<option value='do_Delete'><?php print __("Delete Packages") ?></option>
			<?php endif; ?>
			<option value='do_Notify'><?php print __("Notify") ?></option>
			<option value='do_UnNotify'><?php print __("UnNotify") ?></option>
		</select>
111
112
113
		<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
		<input type='checkbox' name='confirm_Delete' value='1' /> <?php print __("Confirm") ?>
		<?php endif; ?>
114
115
116
117
118
		<input type='submit' class='button' style='width: 80px' value='<?php print __("Go") ?>' />
	</div>
	<?php endif; ?>
		</td>

119
120
		<td align='right'>
		<span class='f4'><span class='blue'>
121
122
123
		<?php print __("Showing results %s - %s of %s", $first, $last, $total) ?>
		</span></span>
		<br />
Callan Barrett's avatar
Callan Barrett committed
124

125
		<div id="pages">
Callan Barrett's avatar
Callan Barrett committed
126
127
128
129
130
131
132
133
		<?php
			if ($_GET['O'] > 0):
				$O = $_GET['O'] - $_GET['PP'];

				if ($_GET['O'] < $_GET['PP']) {
					$O = 0;
				}
		?>
134
			<a class="page_num" href="packages.php?<?php print mkurl("O=$O") ?>"><?php echo __('Previous') ?></a>
Callan Barrett's avatar
Callan Barrett committed
135
136
		<?php   endif; ?>

137
138
139
140
141
142
143
144
145
146
147
148
149
			<?php
			if ($_GET['PP'] > 0) {
				$pages = ceil($total / $_GET['PP']);
			}

			if ($pages > 1) {
				if ($_GET['O'] > 0) {
					$currentpage = ceil(($_GET['O'] + 1) / $_GET['PP']);
				}
				else {
					$currentpage = 1;
				}

150
				$morepages = $currentpage + 5;
151

Callan Barrett's avatar
Callan Barrett committed
152
153
				print (($currentpage-5) > 1) ? '...' : '';

154
				# Display links for more search results.
155
				for ($i = ($currentpage - 5); $i <= $morepages && $i <= $pages; $i++) {
156
157
158
159
160
161
					if ($i < 1) {
						$i = 1;
					}

					$pagestart = ($i - 1) * $_GET['PP'];

162
163
					if ($i <> $currentpage) :
					?>
164
165
				<a class="page_num" href="packages.php?<?php print mkurl('O=' . ($pagestart)) ?>"><?php echo $i ?></a>
					<?php else : echo "<span id=\"page_sel\">$i</span>";
166
167
					endif;
				}
168

169
170
				print ($pages > $morepages) ? '...' : '';
				?>
171
172

			<?php if ($total - $_GET['PP'] - $_GET['O'] > 0): ?>
173
				<a class="page_num" href='packages.php?<?php print mkurl('O=' . ($_GET['O'] + $_GET['PP'])) ?>'><?php echo __('Next') ?></a>
174
175
			<?php endif; ?>

Callan Barrett's avatar
Callan Barrett committed
176
177
			</div>

178
179
		</td>
	</tr>
180

181
182
183
184
<?php
			}
}
?>
185
186
	</table>
</div>
187
</form>
188