pkgbase_details.php/pkg_details.php: Show keywords
[aur.git] / web / template / pkgbase_details.php
blobdc30e48e41921ddde4472382841b4e76e5270541
1 <?php
3 $pkgbuild_uri = sprintf(config_get('options', 'pkgbuild_uri'), urlencode($row['Name']));
4 $log_uri = sprintf(config_get('options', 'log_uri'), urlencode($row['Name']));
5 $snapshot_uri = sprintf(config_get('options', 'snapshot_uri'), urlencode($row['Name']));
6 $git_clone_uri_anon = sprintf(config_get('options', 'git_clone_uri_anon'), htmlspecialchars($row['Name']));
7 $git_clone_uri_priv = sprintf(config_get('options', 'git_clone_uri_priv'), htmlspecialchars($row['Name']));
9 $uid = uid_from_sid($SID);
11 $base_id = intval($row['ID']);
13 $keywords = pkgbase_get_keywords($base_id);
15 $submitter = username_from_id($row["SubmitterUID"]);
16 $maintainer = username_from_id($row["MaintainerUID"]);
17 $comaintainers = pkgbase_get_comaintainers($base_id);
18 $packager = username_from_id($row["PackagerUID"]);
20 $votes = $row['NumVotes'];
22 # In case of wanting to put a custom message
23 $msg = __('unknown');
25 # Print the timestamps for last updates
26 $updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["ModifiedTS"]));
27 $submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
28 $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
30 $pkgs = pkgbase_get_pkgnames($base_id);
32 <div id="pkgdetails" class="box">
33 <h2><?= __('Package Base Details') . ': ' . htmlspecialchars($row['Name']) ?></h2>
34 <div id="detailslinks" class="listing">
35 <div id="actionlist">
36 <h4><?= __('Package Actions') ?></h4>
37 <ul class="small">
38 <li>
39 <a href="<?= $pkgbuild_uri ?>"><?= __('View PKGBUILD') ?></a> /
40 <a href="<?= $log_uri ?>"><?= __('View Changes') ?></a>
41 </li>
42 <li><a href="<?= $snapshot_uri ?>"><?= __('Download snapshot') ?></a>
43 <li><a href="https://wiki.archlinux.org/index.php/Special:Search?search=<?= urlencode($row['Name']) ?>"><?= __('Search wiki') ?></a></li>
44 <li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
45 <?php if ($uid): ?>
46 <?php if ($row["OutOfDateTS"] === NULL): ?>
47 <li>
48 <form action="<?= get_pkgbase_uri($row['Name']) . 'flag/'; ?>" method="post">
49 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
50 <input type="submit" class="button text-button" name="do_Flag" value="<?= __('Flag package out-of-date') ?>" />
51 </form>
52 </li>
53 <?php elseif (($row["OutOfDateTS"] !== NULL) && has_credential(CRED_PKGBASE_UNFLAG, array($row["MaintainerUID"]))): ?>
54 <li>
55 <form action="<?= get_pkgbase_uri($row['Name']) . 'unflag/'; ?>" method="post">
56 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
57 <input type="submit" class="button text-button" name="do_UnFlag" value="<?= __('Unflag package') ?>" />
58 </form>
59 </li>
60 <?php endif; ?>
61 <?php if (pkgbase_user_voted($uid, $base_id)): ?>
62 <li>
63 <form action="<?= get_pkgbase_uri($row['Name']) . 'unvote/'; ?>" method="post">
64 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
65 <input type="submit" class="button text-button" name="do_UnVote" value="<?= __('Remove vote') ?>" />
66 </form>
67 </li>
68 <?php else: ?>
69 <li>
70 <form action="<?= get_pkgbase_uri($row['Name']) . 'vote/'; ?>" method="post">
71 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
72 <input type="submit" class="button text-button" name="do_Vote" value="<?= __('Vote for this package') ?>" />
73 </form>
74 </li>
75 <?php endif; ?>
76 <?php if (pkgbase_user_notify($uid, $base_id)): ?>
77 <li>
78 <form action="<?= get_pkgbase_uri($row['Name']) . 'unnotify/'; ?>" method="post">
79 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
80 <input type="submit" class="button text-button" name="do_UnNotify" value="<?= __('Disable notifications') ?>" />
81 </form>
82 </li>
83 <?php else: ?>
84 <li>
85 <form action="<?= get_pkgbase_uri($row['Name']) . 'notify/'; ?>" method="post">
86 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
87 <input type="submit" class="button text-button" name="do_Notify" value="<?= __('Notify of new comments') ?>" />
88 </form>
89 </li>
90 <?php endif; ?>
91 <?php if (has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array($row["MaintainerUID"]))): ?>
92 <li><a href="<?= get_pkgbase_uri($row['Name']) . 'comaintainers/'; ?>"><?= __('Manage Co-Maintainers'); ?></a></li>
93 <?php endif; ?>
94 <li><span class="flagged"><?php if ($row["RequestCount"] > 0) { echo _n('%d pending request', '%d pending requests', $row["RequestCount"]); } ?></span></li>
95 <li><a href="<?= get_pkgbase_uri($row['Name']) . 'request/'; ?>"><?= __('File Request'); ?></a></li>
96 <?php if (has_credential(CRED_PKGBASE_DELETE)): ?>
97 <li><a href="<?= get_pkgbase_uri($row['Name']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
98 <li><a href="<?= get_pkgbase_uri($row['Name']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
99 <?php endif; ?>
100 <?php endif; ?>
102 <?php if ($uid && $row["MaintainerUID"] === NULL): ?>
103 <li>
104 <form action="<?= get_pkgbase_uri($row['Name']) . 'adopt/'; ?>" method="post">
105 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
106 <input type="submit" class="button text-button" name="do_Adopt" value="<?= __('Adopt Package') ?>" />
107 </form>
108 </li>
109 <?php elseif (has_credential(CRED_PKGBASE_DISOWN, array($row["MaintainerUID"]))): ?>
110 <li>
111 <form action="<?= get_pkgbase_uri($row['Name']) . 'disown/'; ?>" method="post">
112 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
113 <input type="submit" class="button text-button" name="do_Disown" value="<?= __('Disown Package') ?>" />
114 </form>
115 </li>
116 <?php endif; ?>
117 </ul>
118 </div>
119 </div>
121 <table id="pkginfo">
122 <tr>
123 <th><?= __('Git Clone URL') . ': ' ?></th>
124 <td>
125 <a href="<?= $git_clone_uri_anon ?>"><?= $git_clone_uri_anon ?></a> (<?= __('read-only') ?>)
126 <?php if ($uid == $row["MaintainerUID"]): ?>
127 <br /> <a href="<?= $git_clone_uri_priv ?>"><?= $git_clone_uri_priv ?></a>
128 <?php endif; ?>
129 </td>
130 </tr>
131 <?php
132 if (has_credential(CRED_PKGBASE_SET_KEYWORDS, array($row["MaintainerUID"])) || count($keywords) > 0):
134 <tr>
135 <th><?= __('Keywords') . ': ' ?></th>
136 <td>
137 <?php
138 if (has_credential(CRED_PKGBASE_SET_KEYWORDS, array($row["MaintainerUID"]))):
140 <form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['Name']), ENT_QUOTES); ?>">
141 <div>
142 <input type="hidden" name="action" value="do_SetKeywords" />
143 <?php if ($SID): ?>
144 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
145 <?php endif; ?>
146 <input type="text" name="keywords" value="<?= htmlspecialchars(implode(" ", $keywords), ENT_QUOTES) ?>"/>
147 <input type="submit" value="<?= __('Update') ?>"/>
148 </div>
149 </form>
150 <?php
151 else:
152 foreach ($keywords as $kw) {
153 echo '<a class="keyword" href="';
154 echo get_uri('/packages/') . '?K=' . urlencode($kw) . '&amp;SB=p';
155 echo '">' . htmlspecialchars($kw) . "</a>\n";
157 endif;
159 </td>
160 </tr>
161 <?php endif; ?>
162 <tr>
163 <th><?= __('Submitter') .': ' ?></th>
164 <td><?= html_format_username($submitter) ?></td>
165 </tr>
166 <tr>
167 <th><?= __('Maintainer') .': ' ?></th>
168 <td><?= html_format_maintainers($maintainer, $comaintainers) ?></td>
169 </tr>
170 <tr>
171 <th><?= __('Last Packager') .': ' ?></th>
172 <td><?= html_format_username($packager) ?></td>
173 </tr>
174 <tr>
175 <th><?= __('Votes') . ': ' ?></th>
176 <?php if (has_credential(CRED_PKGBASE_LIST_VOTERS)): ?>
177 <td><a href="<?= get_pkgbase_uri($row['Name']); ?>voters/"><?= $votes ?></a></td>
178 <?php else: ?>
179 <td><?= $votes ?></td>
180 <?php endif; ?>
181 </tr>
182 <tr>
183 <th><?= __('First Submitted') . ': ' ?></th>
184 <td><?= $submitted_time ?></td>
185 </tr>
186 <tr>
187 <th><?= __('Last Updated') . ': ' ?></th>
188 <td><?= $updated_time ?></td>
189 </tr>
190 </table>
192 <div id="metadata">
193 <div id="pkgs" class="listing">
194 <h3><?= __('Packages') . " (" . count($pkgs) . ")"?></h3>
195 <?php if (count($pkgs) > 0): ?>
196 <ul>
197 <?php
198 while (list($k, $pkg) = each($pkgs)):
200 <li><a href="<?= htmlspecialchars(get_pkg_uri($pkg), ENT_QUOTES); ?>" title="<?= __('View packages details for').' '. htmlspecialchars($pkg) ?>"><?= htmlspecialchars($pkg) ?></a></li>
201 <?php endwhile; ?>
202 </ul>
203 <?php endif; ?>
204 </div>
205 </div>
206 </div>