From 4bc990f9c0a5da9e42f5ed58917cf051e1eacc0f Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 26 Jun 2015 12:06:21 +0200 Subject: Split out code to generate action links Add (and use) two new helper functions html_account_link() and html_account_form() to generate the links in the package actions box. Signed-off-by: Lukas Fleischer --- web/lib/aur.inc.php | 37 ++++++++++++++++++ web/template/pkg_details.php | 74 ++++++++++-------------------------- web/template/pkgbase_details.php | 82 ++++++++++++++-------------------------- 3 files changed, 86 insertions(+), 107 deletions(-) diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php index 7f923d7..95f72ce 100644 --- a/web/lib/aur.inc.php +++ b/web/lib/aur.inc.php @@ -221,6 +221,43 @@ function html_format_maintainers($maintainer, $comaintainers) { return $code; } +/** + * Format a link in the package actions box + * + * @param string $uri The link target + * @param string $desc The link label + * + * @return string The generated HTML code for the action link + */ +function html_action_link($uri, $desc) { + $code = ''; + $code .= htmlspecialchars($desc) . ''; + + return $code; +} + +/** + * Format a form in the package actions box + * + * @param string $uri The link target + * @param string $action The action name (passed as HTTP POST parameter) + * @param string $desc The link label + * + * @return string The generated HTML code for the action link + */ +function html_action_form($uri, $action, $desc) { + $code = '
'; + $code .= ''; + $code .= '
'; + + return $code; +} + /** * Determine the user's e-mail address in the database using a session ID * diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index 6864431..e894c07 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -83,6 +83,9 @@ foreach ($rels as $rel) { # $sources[0] = 'src'; $sources = pkg_sources($row["ID"]); + +$base_uri = get_pkgbase_uri($row['BaseName']); + ?>

@@ -99,75 +102,40 @@ $sources = pkg_sources($row["ID"]);
  • -
  • -
    - - -
    -
  • +
  • -
  • -
    - - -
    -
  • +
  • + -
  • -
    - - -
    -
  • +
  • -
  • -
    - - -
    -
  • +
  • + -
  • -
    - - -
    -
  • +
  • -
  • -
    - - -
    -
  • +
  • + -
  • +
  • +
  • 0) { echo _n('%d pending request', '%d pending requests', $row["RequestCount"]); } ?>
  • -
  • +
  • + -
  • -
  • - +
  • +
  • -
  • -
    - - -
    -
  • +
  • -
  • -
    - - -
    -
  • +
  • +
    diff --git a/web/template/pkgbase_details.php b/web/template/pkgbase_details.php index dc30e48..f6d8071 100644 --- a/web/template/pkgbase_details.php +++ b/web/template/pkgbase_details.php @@ -17,6 +17,12 @@ $maintainer = username_from_id($row["MaintainerUID"]); $comaintainers = pkgbase_get_comaintainers($base_id); $packager = username_from_id($row["PackagerUID"]); +if ($row["MaintainerUID"] !== NULL) { + $maintainers = array_merge(array($row["MaintainerUID"]), pkgbase_get_comaintainer_uids(array($base_id))); +} else { + $maintainers = NULL; +} + $votes = $row['NumVotes']; # In case of wanting to put a custom message @@ -28,6 +34,9 @@ $submitted_time = ($row["SubmittedTS"] == 0) ? $msg : gmdate("Y-m-d H:i", intval $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("Y-m-d", intval($row["OutOfDateTS"])); $pkgs = pkgbase_get_pkgnames($base_id); + +$base_uri = get_pkgbase_uri($row['Name']); + ?>

    @@ -44,75 +53,40 @@ $pkgs = pkgbase_get_pkgnames($base_id);
  • -
  • -
    - - -
    -
  • - -
  • -
    - - -
    -
  • +
  • + +
  • + -
  • -
    - - -
    -
  • +
  • -
  • -
    - - -
    -
  • +
  • + -
  • -
    - - -
    -
  • +
  • -
  • -
    - - -
    -
  • +
  • + -
  • +
  • +
  • 0) { echo _n('%d pending request', '%d pending requests', $row["RequestCount"]); } ?>
  • -
  • +
  • + -
  • -
  • - +
  • +
  • -
  • -
    - - -
    -
  • +
  • -
  • -
    - - -
    -
  • +
  • +
    -- cgit v1.2.3-70-g09d2