Update wiki links to the new short URL
[aur.git] / web / template / pkgbase_details.php
bloba6857c4e7b7ce085789e2e27e2c86430f1ddce53
1 <?php
3 $pkgbuild_uri = sprintf(config_get('options', 'source_file_uri'), 'PKGBUILD', 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 if ($row["MaintainerUID"] !== NULL) {
21 $maintainers = array_merge(array($row["MaintainerUID"]), pkgbase_get_comaintainer_uids(array($base_id)));
22 } else {
23 $maintainers = array();
25 $unflaggers = array_merge($maintainers, array($row["FlaggerUID"]));
27 $votes = $row['NumVotes'];
28 $popularity = $row['Popularity'];
30 # In case of wanting to put a custom message
31 $msg = __('unknown');
33 # Print the timestamps for last updates
34 $updated_time = ($row["ModifiedTS"] == 0) ? $msg : date("Y-m-d H:i", intval($row["ModifiedTS"]));
35 $submitted_time = ($row["SubmittedTS"] == 0) ? $msg : date("Y-m-d H:i", intval($row["SubmittedTS"]));
36 $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : date("Y-m-d", intval($row["OutOfDateTS"]));
38 $pkgs = pkgbase_get_pkgnames($base_id);
40 $base_uri = get_pkgbase_uri($row['Name']);
43 <div id="pkgdetails" class="box">
44 <h2><?= __('Package Base Details') . ': ' . htmlspecialchars($row['Name']) ?></h2>
46 <?php include('pkgbase_actions.php') ?>
48 <table id="pkginfo">
49 <tr>
50 <th><?= __('Git Clone URL') . ': ' ?></th>
51 <td>
52 <a class="copy" href="<?= $git_clone_uri_anon ?>"><?= $git_clone_uri_anon ?></a> (<?= __('read-only') ?>, <?= __('click to copy') ?>)
53 <?php if (in_array($uid, $maintainers)): ?>
54 <br /> <a class="copy" href="<?= $git_clone_uri_priv ?>"><?= $git_clone_uri_priv ?></a> (<?= __('click to copy') ?>)
55 <?php endif; ?>
56 </td>
57 </tr>
58 <?php
59 if (has_credential(CRED_PKGBASE_SET_KEYWORDS, array($row["MaintainerUID"])) || count($keywords) > 0):
61 <tr>
62 <th><?= __('Keywords') . ': ' ?></th>
63 <td>
64 <?php
65 if (has_credential(CRED_PKGBASE_SET_KEYWORDS, array($row["MaintainerUID"]))):
67 <form method="post" action="<?= htmlspecialchars(get_pkgbase_uri($row['Name']), ENT_QUOTES); ?>">
68 <div>
69 <input type="hidden" name="action" value="do_SetKeywords" />
70 <?php if ($SID): ?>
71 <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
72 <?php endif; ?>
73 <input type="text" name="keywords" value="<?= htmlspecialchars(implode(" ", $keywords), ENT_QUOTES) ?>"/>
74 <input type="submit" value="<?= __('Update') ?>"/>
75 </div>
76 </form>
77 <?php
78 else:
79 foreach ($keywords as $kw) {
80 echo '<a class="keyword" href="';
81 echo get_uri('/packages/') . '?K=' . urlencode($kw) . '&amp;SB=p';
82 echo '">' . htmlspecialchars($kw) . "</a>\n";
84 endif;
86 </td>
87 </tr>
88 <?php endif; ?>
89 <tr>
90 <th><?= __('Submitter') .': ' ?></th>
91 <td><?= html_format_username($submitter) ?></td>
92 </tr>
93 <tr>
94 <th><?= __('Maintainer') .': ' ?></th>
95 <td><?= html_format_maintainers($maintainer, $comaintainers) ?></td>
96 </tr>
97 <tr>
98 <th><?= __('Last Packager') .': ' ?></th>
99 <td><?= html_format_username($packager) ?></td>
100 </tr>
101 <tr>
102 <th><?= __('Votes') . ': ' ?></th>
103 <?php if (has_credential(CRED_PKGBASE_LIST_VOTERS)): ?>
104 <td><a href="<?= get_pkgbase_uri($row['Name']); ?>voters/"><?= $votes ?></a></td>
105 <?php else: ?>
106 <td><?= $votes ?></td>
107 <?php endif; ?>
108 </tr>
109 <tr>
110 <th><?= __('Popularity') . ': ' ?></th>
111 <td><?= number_format($popularity, $popularity >= .2 ? 2 : 6) ?></td>
112 </tr>
113 <tr>
114 <th><?= __('First Submitted') . ': ' ?></th>
115 <td><?= $submitted_time ?></td>
116 </tr>
117 <tr>
118 <th><?= __('Last Updated') . ': ' ?></th>
119 <td><?= $updated_time ?></td>
120 </tr>
121 </table>
123 <div id="metadata">
124 <div id="pkgs" class="listing">
125 <h3><?= __('Packages') . " (" . count($pkgs) . ")"?></h3>
126 <?php if (count($pkgs) > 0): ?>
127 <ul>
128 <?php
129 foreach ($pkgs as $k => $pkg):
131 <li><a href="<?= htmlspecialchars(get_pkg_uri($pkg), ENT_QUOTES); ?>" title="<?= __('View packages details for').' '. htmlspecialchars($pkg) ?>"><?= htmlspecialchars($pkg) ?></a></li>
132 <?php endforeach; ?>
133 </ul>
134 <?php endif; ?>
135 </div>
136 </div>
137 </div>
139 <script>
140 $(document).ready(function() {
141 $('.copy').click(function(e) {
142 var tmp = $("<input>");
143 $("body").append(tmp);
144 tmp.val($(this).text()).select();
145 document.execCommand("copy");
146 tmp.remove();
147 e.preventDefault();
150 </script>