Make URIs to the individual cgit pages configurable
[aur.git] / web / template / pkgbase_details.php
blob2ef8788a1bb1a1a78010986bbf5730874517f99e
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 $catarr = pkgbase_categories();
15 $submitter = username_from_id($row["SubmitterUID"]);
16 $maintainer = username_from_id($row["MaintainerUID"]);
17 $packager = username_from_id($row["PackagerUID"]);
19 $votes = $row['NumVotes'];
21 # In case of wanting to put a custom message
22 $msg = __('unknown');
24 # Print the timestamps for last updates
25 $updated_time = ($row["ModifiedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["ModifiedTS"]));
26 $submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval($row["SubmittedTS"]));
27 $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"]));
29 $pkgs = pkgbase_get_pkgnames($base_id);
31 <div id="pkgdetails" class="box">
32 <h2><?= __('Package Base Details') . ': ' . htmlspecialchars($row['Name']) ?></h2>
33 <div id="detailslinks" class="listing">
34 <div id="actionlist">
35 <h4><?= __('Package Actions') ?></h4>
36 <ul class="small">
37 <li>
38 <a href="<?= $pkgbuild_uri ?>"><?= __('View PKGBUILD') ?></a> /
39 <a href="<?= $log_uri ?>"><?= __('View Changes') ?></a>
40 </li>
41 <li><a href="<?= $snapshot_uri ?>"><?= __('Download snapshot') ?></a>
42 <li><a href="https://wiki.archlinux.org/index.php/Special:Search?search=<?= urlencode($row['Name']) ?>"><?= __('Search wiki') ?></a></li>
43 <li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
44 <?php if ($uid): ?>
45 <?php if ($row["OutOfDateTS"] === NULL): ?>
46 <li>
47 <form action="<?= get_pkgbase_uri($row['Name']) . 'flag/'; ?>" method="post">
48 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
49 <input type="submit" class="button text-button" name="do_Flag" value="<?= __('Flag package out-of-date') ?>" />
50 </form>
51 </li>
52 <?php elseif (($row["OutOfDateTS"] !== NULL) && has_credential(CRED_PKGBASE_UNFLAG, array($row["MaintainerUID"]))): ?>
53 <li>
54 <form action="<?= get_pkgbase_uri($row['Name']) . 'unflag/'; ?>" method="post">
55 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
56 <input type="submit" class="button text-button" name="do_UnFlag" value="<?= __('Unflag package') ?>" />
57 </form>
58 </li>
59 <?php endif; ?>
60 <?php if (pkgbase_user_voted($uid, $base_id)): ?>
61 <li>
62 <form action="<?= get_pkgbase_uri($row['Name']) . 'unvote/'; ?>" method="post">
63 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
64 <input type="submit" class="button text-button" name="do_UnVote" value="<?= __('Remove vote') ?>" />
65 </form>
66 </li>
67 <?php else: ?>
68 <li>
69 <form action="<?= get_pkgbase_uri($row['Name']) . 'vote/'; ?>" method="post">
70 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
71 <input type="submit" class="button text-button" name="do_Vote" value="<?= __('Vote for this package') ?>" />
72 </form>
73 </li>
74 <?php endif; ?>
75 <?php if (pkgbase_user_notify($uid, $base_id)): ?>
76 <li>
77 <form action="<?= get_pkgbase_uri($row['Name']) . 'unnotify/'; ?>" method="post">
78 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
79 <input type="submit" class="button text-button" name="do_UnNotify" value="<?= __('Disable notifications') ?>" />
80 </form>
81 </li>
82 <?php else: ?>
83 <li>
84 <form action="<?= get_pkgbase_uri($row['Name']) . 'notify/'; ?>" method="post">
85 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
86 <input type="submit" class="button text-button" name="do_Notify" value="<?= __('Notify of new comments') ?>" />
87 </form>
88 </li>
89 <?php endif; ?>
90 <?php if (has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array($row["MaintainerUID"]))): ?>
91 <li><a href="<?= get_pkgbase_uri($row['Name']) . 'comaintainers/'; ?>"><?= __('Manage Co-Maintainers'); ?></a></li>
92 <?php endif; ?>
93 <li><span class="flagged"><?php if ($row["RequestCount"] > 0) { echo _n('%d pending request', '%d pending requests', $row["RequestCount"]); } ?></span></li>
94 <li><a href="<?= get_pkgbase_uri($row['Name']) . 'request/'; ?>"><?= __('File Request'); ?></a></li>
95 <?php if (has_credential(CRED_PKGBASE_DELETE)): ?>
96 <li><a href="<?= get_pkgbase_uri($row['Name']) . 'delete/'; ?>"><?= __('Delete Package'); ?></a></li>
97 <li><a href="<?= get_pkgbase_uri($row['Name']) . 'merge/'; ?>"><?= __('Merge Package'); ?></a></li>
98 <?php endif; ?>
99 <?php endif; ?>
101 <?php if ($uid && $row["MaintainerUID"] === NULL): ?>
102 <li>
103 <form action="<?= get_pkgbase_uri($row['Name']) . 'adopt/'; ?>" method="post">
104 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
105 <input type="submit" class="button text-button" name="do_Adopt" value="<?= __('Adopt Package') ?>" />
106 </form>
107 </li>
108 <?php elseif (has_credential(CRED_PKGBASE_DISOWN, array($row["MaintainerUID"]))): ?>
109 <li>
110 <form action="<?= get_pkgbase_uri($row['Name']) . 'disown/'; ?>" method="post">
111 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
112 <input type="submit" class="button text-button" name="do_Disown" value="<?= __('Disown Package') ?>" />
113 </form>
114 </li>
115 <?php endif; ?>
116 </ul>
117 </div>
118 </div>
120 <table id="pkginfo">
121 <tr>
122 <th><?= __('Git Clone URL') . ': ' ?></th>
123 <td>
124 <a href="<?= $git_clone_uri_anon ?>"><?= $git_clone_uri_anon ?></a>
125 <?php if ($uid == $row["MaintainerUID"]): ?>
126 <br /> <a href="<?= $git_clone_uri_priv ?>"><?= $git_clone_uri_priv ?></a>
127 <?php endif; ?>
128 </td>
129 </tr>
130 <tr>
131 <th><?= __('Category') . ': ' ?></th>
132 <?php
133 if (has_credential(CRED_PKGBASE_CHANGE_CATEGORY, array($row["MaintainerUID"]))):
135 <td>
136 <form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['Name']), ENT_QUOTES); ?>">
137 <div>
138 <input type="hidden" name="action" value="do_ChangeCategory" />
139 <?php if ($SID): ?>
140 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
141 <?php endif; ?>
142 <select name="category_id">
143 <?php
144 foreach ($catarr as $cid => $catname):
146 <option value="<?= $cid ?>"<?php if ($cid == $row["CategoryID"]) { ?> selected="selected" <?php } ?>><?= $catname ?></option>
147 <?php endforeach; ?>
148 </select>
149 <input type="submit" value="<?= __('Change category') ?>"/>
150 </div>
151 </form>
152 <?php else: ?>
153 <td>
154 <a href="<?= get_uri('/packages/'); ?>?C=<?= $row['CategoryID'] ?>"><?= $row['Category'] ?></a>
155 <?php endif; ?>
156 </td>
157 </tr>
158 <tr>
159 <th><?= __('Submitter') .': ' ?></th>
160 <?php if ($row["SubmitterUID"] && $SID): ?>
161 <td><a href="<?= get_uri('/account/') . html_format_username($submitter, ENT_QUOTES) ?>" title="<?= __('View account information for %s', html_format_username($submitter)) ?>"><?= html_format_username($submitter) ?></a></td>
162 <?php elseif ($row["SubmitterUID"] && !$SID): ?>
163 <td><?= html_format_username($submitter) ?></td>
164 <?php else: ?>
165 <td><?= __('None') ?></td>
166 <?php endif; ?>
167 </tr>
168 <tr>
169 <th><?= __('Maintainer') .': ' ?></th>
170 <?php if ($row["MaintainerUID"] && $SID): ?>
171 <td><a href="<?= get_uri('/account/') . html_format_username($maintainer) ?>" title="<?= __('View account information for %s', html_format_username($maintainer)) ?>"><?= html_format_username($maintainer) ?></a></td>
172 <?php elseif ($row["MaintainerUID"] && !$SID): ?>
173 <td><?= html_format_username($maintainer) ?></td>
174 <?php else: ?>
175 <td><?= __('None') ?></td>
176 <?php endif; ?>
177 </tr>
178 <tr>
179 <th><?= __('Last Packager') .': ' ?></th>
180 <?php if ($row["PackagerUID"] && $SID): ?>
181 <td><a href="<?= get_uri('/account/') . html_format_username($packager) ?>" title="<?= __('View account information for %s', html_format_username($packager)) ?>"><?= html_format_username($packager) ?></a></td>
182 <?php elseif ($row["PackagerUID"] && !$SID): ?>
183 <td><?= html_format_username($packager) ?></td>
184 <?php else: ?>
185 <td><?= __('None') ?></td>
186 <?php endif; ?>
187 </tr>
188 <tr>
189 <th><?= __('Votes') . ': ' ?></th>
190 <?php if (has_credential(CRED_PKGBASE_LIST_VOTERS)): ?>
191 <td><a href="<?= get_pkgbase_uri($row['Name']); ?>voters/"><?= $votes ?></a></td>
192 <?php else: ?>
193 <td><?= $votes ?></td>
194 <?php endif; ?>
195 </tr>
196 <tr>
197 <th><?= __('First Submitted') . ': ' ?></th>
198 <td><?= $submitted_time ?></td>
199 </tr>
200 <tr>
201 <th><?= __('Last Updated') . ': ' ?></th>
202 <td><?= $updated_time ?></td>
203 </tr>
204 </table>
206 <div id="metadata">
207 <div id="pkgs" class="listing">
208 <h3><?= __('Packages') . " (" . count($pkgs) . ")"?></h3>
209 <?php if (count($pkgs) > 0): ?>
210 <ul>
211 <?php
212 while (list($k, $pkg) = each($pkgs)):
214 <li><a href="<?= htmlspecialchars(get_pkg_uri($pkg), ENT_QUOTES); ?>" title="<?= __('View packages details for').' '. htmlspecialchars($pkg) ?>"><?= htmlspecialchars($pkg) ?></a></li>
215 <?php endwhile; ?>
216 </ul>
217 <?php endif; ?>
218 </div>
219 </div>
220 </div>