From fca7d3ce3e20e6c89c798cb71a5260680e7fc1b4 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Fri, 6 Jan 2012 01:34:57 +0100 Subject: my_plugins implemented and rewritten main/index. --- r7r_repo/main.php | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'r7r_repo/main.php') diff --git a/r7r_repo/main.php b/r7r_repo/main.php index 17bce03..6f69cbe 100644 --- a/r7r_repo/main.php +++ b/r7r_repo/main.php @@ -78,6 +78,22 @@ if(isset($_SESSION["r7r_repo_login_name"])) } } +function package_list($pkgs, $heading) +{ + global $ste; + + $ste->vars["list_heading"] = $heading; + $ste->vars["pkgs"] = array_map(function($pkg) { return array( + "name" => $pkg->get_name(), + "version" => $pkg->txtversion, + "author" => $pkg->author, + "description" => $pkg->description, + "last_update" => $pkg->lastupdate + ); }, $pkgs); + + return $ste->exectemplate("package_list.html"); +} + /* url handlers */ $url_handlers = array( "_prelude" => function(&$data, $url_now, &$url_next) @@ -119,15 +135,8 @@ $url_handlers = array( $ste->vars["menu"] = "home"; $latest = Package::latest(); - $ste->vars["latest_pkgs"] = array_map(function($pkg) { return array( - "name" => $pkg->get_name(), - "version" => $pkg->txtversion, - "author" => $pkg->author, - "description" => $pkg->description, - "last_update" => $pkg->lastupdate - ); }, $latest); - echo $ste->exectemplate("home.html"); + echo package_list($latest, "Latest Packages"); }, "login" => function(&$data, $url_now, &$url_next) { @@ -491,6 +500,19 @@ $url_handlers = array( echo $ste->exectemplate("upload.html"); }, + "my_packages" => function(&$data, $url_now, &$url_next) + { + global $ste, $user; + + if($user === NULL) + throw new NotFoundError(); + + $ste->vars["menu"] = "my_packages"; + + $my_packages = $user->get_packages(); + + echo package_list($my_packages, "My Packages"); + }, "setup" => function(&$data, $url_now, &$url_next) { global $settings, $ste; -- cgit v1.2.3-70-g09d2