Update message catalog
[aur.git] / web / html / packages.php
blob75a574e60e53aef84de4b66e4d4632a897db84b9
1 <?php
3 set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
5 include_once("aur.inc.php"); # access AUR common functions
6 set_lang(); # this sets up the visitor's language
7 include_once('pkgfuncs.inc.php'); # package specific functions
8 check_sid(); # see if they're still logged in
10 # Retrieve package ID and name, unless initialized by the routing framework
11 if (!isset($pkgid) || !isset($pkgname)) {
12 if (isset($_GET['ID'])) {
13 $pkgid = intval($_GET['ID']);
14 $pkgname = pkg_name_from_id($_GET['ID']);
15 } else if (isset($_GET['N'])) {
16 $pkgid = pkg_from_name($_GET['N']);
17 $pkgname = $_GET['N'];
18 } else {
19 unset($pkgid, $pkgname);
22 if (isset($pkgid) && ($pkgid == 0 || $pkgid == NULL || $pkgname == NULL)) {
23 header("HTTP/1.0 404 Not Found");
24 include "./404.php";
25 return;
29 # Set the title to the current query or package name
30 if (isset($pkgname)) {
31 $title = $pkgname;
32 } else if (!empty($_GET['K'])) {
33 $title = __("Search Criteria") . ": " . $_GET['K'];
34 } else {
35 $title = __("Packages");
38 $details = array();
39 if (isset($pkgname)) {
40 $details = pkg_get_details($pkgid);
43 html_header($title, $details);
46 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
47 <script type="text/javascript">
48 function collapseDependsList(list) {
49 list = $(list);
50 // Hide everything past a given limit. Don't do anything if we don't have
51 // enough items, or the link already exists.
52 var limit = 20,
53 linkid = list.attr('id') + 'link',
54 items = list.find('li').slice(limit);
55 if (items.length <= 1 || $('#' + linkid).length > 0) {
56 return;
58 items.hide();
59 list.after('<p><a id="' + linkid + '" href="#">Show Moreā€¦</a></p>');
61 // add link and wire it up to show the hidden items
62 $('#' + linkid).click(function(event) {
63 event.preventDefault();
64 list.find('li').show();
65 // remove the full <p/> node from the DOM
66 $(this).parent().remove();
67 });
70 $(document).ready(function() {
71 collapseDependsList("#pkgdepslist");
72 collapseDependsList("#pkgreqslist");
73 collapseDependsList("#pkgsrcslist");
74 });
75 </script>
77 <?php
78 if (isset($pkgid)) {
79 include('pkg_search_form.php');
80 if ($pkgid) {
81 if (isset($_COOKIE["AURSID"])) {
82 pkg_display_details($pkgid, $details, $_COOKIE["AURSID"]);
84 else {
85 pkg_display_details($pkgid, $details, null);
87 } else {
88 print __("Error trying to retrieve package details.")."<br />\n";
90 } else {
91 if (!isset($_GET['K']) && !isset($_GET['SB'])) {
92 $_GET['SB'] = 'p';
93 $_GET['SO'] = 'd';
95 if (isset($_COOKIE["AURSID"])) {
96 pkg_search_page($_COOKIE["AURSID"]);
97 } else {
98 pkg_search_page();
102 html_footer(AURWEB_VERSION);