[aur-dev] [PATCH 4/4] Add dashboard

Lukas Fleischer lfleischer at archlinux.org
Fri Feb 3 23:50:32 UTC 2017


For logged in users, the home page is replaced with an overview of the
packages the user maintains or co-maintains.

Signed-off-by: Lukas Fleischer <lfleischer at archlinux.org>
---
 web/html/home.php       | 34 +++++++++++++++++++++++++++++++++-
 web/template/header.php |  7 ++++---
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/web/html/home.php b/web/html/home.php
index 475370b..8d6884b 100644
--- a/web/html/home.php
+++ b/web/html/home.php
@@ -8,13 +8,42 @@ check_sid();
 
 include_once('stats.inc.php');
 
-html_header( __("Home") );
+if ($_COOKIE["AURSID"]) {
+	html_header( __("Dashboard") );
+} else {
+	html_header( __("Home") );
+}
 
 ?>
 
 <div id="content-left-wrapper">
 	<div id="content-left">
 		<div id="intro" class="box">
+			<?php if ($_COOKIE["AURSID"]): ?>
+			<h2><?= __("Dashboard"); ?></h2>
+			<h3><?= __("My Packages"); ?></h3>
+			<?php
+			$params = array(
+				'PP' => 50,
+				'SeB' => 'm',
+				'K' => username_from_sid($_COOKIE["AURSID"]),
+				'SB' => 'l',
+				'SO' => 'd'
+			);
+			pkg_search_page($params, false, $_COOKIE["AURSID"]);
+			?>
+			<h3><?= __("Co-Maintained Packages"); ?></h3>
+			<?php
+			$params = array(
+				'PP' => 50,
+				'SeB' => 'c',
+				'K' => username_from_sid($_COOKIE["AURSID"]),
+				'SB' => 'l',
+				'SO' => 'd'
+			);
+			pkg_search_page($params, false, $_COOKIE["AURSID"]);
+			?>
+			<?php else: ?>
 			<h2>AUR <?= __("Home"); ?></h2>
 			<p>
 			<?php
@@ -42,7 +71,9 @@ html_header( __("Home") );
 			<?= __('AUR packages are user produced content. Any use of the provided files is at your own risk.'); ?>
 			</p>
 			<p class="readmore"><a href="https://wiki.archlinux.org/index.php/AUR"><?= __('Learn more...') ?></a></p>
+			<?php endif; ?>
 		</div>
+		<?php if (!$_COOKIE["AURSID"]): ?>
 		<div id="news">
 			<h3><a><?= __('Support') ?></a><span class="arrow"></span></h3>
 			<h4><?= __('Package Requests') ?></h4>
@@ -122,6 +153,7 @@ html_header( __("Home") );
 			</p>
 			</div>
 		</div>
+		<?php endif; ?>
 	</div>
 </div>
 <div id="content-right">
diff --git a/web/template/header.php b/web/template/header.php
index 874109a..7343575 100644
--- a/web/template/header.php
+++ b/web/template/header.php
@@ -53,10 +53,9 @@
 			</div>
 			<div id="archdev-navbar">
 				<ul>
-					<li><a href="<?= get_uri('/'); ?>">AUR <?= __("Home"); ?></a></li>
-					<li><a href="<?= get_uri('/packages/'); ?>"><?= __("Packages"); ?></a></li>
 					<?php if (isset($_COOKIE['AURSID'])): ?>
-						<li><a href="<?= get_uri('/packages/'); ?>?SeB=m&K=<?= username_from_sid($_COOKIE["AURSID"]); ?>"><?= __("My Packages"); ?></a></li>
+						<li><a href="<?= get_uri('/'); ?>"><?= __("Dashboard"); ?></a></li>
+						<li><a href="<?= get_uri('/packages/'); ?>"><?= __("Packages"); ?></a></li>
 						<?php if (has_credential(CRED_PKGREQ_LIST)): ?>
 						<li><a href="<?= get_uri('/requests/') ; ?>"><?= __("Requests"); ?></a></li>
 						<?php endif; ?>
@@ -67,6 +66,8 @@
 						<?php if (has_credential(CRED_TU_LIST_VOTES)): ?><li><a href="<?= get_uri('/tu/'); ?>"><?= __("Trusted User"); ?></a></li><?php endif; ?>
 						<li><a href="<?= get_uri('/logout/'); ?>"><?= __("Logout"); ?></a></li>
 					<?php else: ?>
+						<li><a href="<?= get_uri('/'); ?>">AUR <?= __("Home"); ?></a></li>
+						<li><a href="<?= get_uri('/packages/'); ?>"><?= __("Packages"); ?></a></li>
 						<li><a href="<?= get_uri('/register/'); ?>"><?= __("Register"); ?></a></li>
 						<?php if (config_get_bool('options', 'disable_http_login') && empty($_SERVER['HTTPS'])): ?>
 						<li><a href="<?= get_uri('/login/', true); ?>"><?= __("Login"); ?></a></li>
-- 
2.11.1


More information about the aur-dev mailing list