Update of /cvsroot/upcase-project/UpCase/admin
In directory usw-pr-cvs1:/tmp/cvs-serv11879
Added Files:
category.php
Log Message:
display content of a category of packages
--- NEW FILE: category.php ---
<?php
include_once("../config/uc_config.inc");
// ModeliXe tags:
//
// list_from : url of the package.xml file where info comes from
// pkg_list : looped block that list packages info
// pkg_name : name of a package
// pkg_version : package version
// pkg_descr : package description, translated
// pkg_status : package status
// pkg_home : home page of the original package
// pkg_instlink : url of the script that will install the package
// First lines to include
include_once("lib/uc_page.php");
// Start the session
$p = new UcPage("category");
// Check permissions, log in if necessary
$p->open();
$sess = $p->getSession();
$user = $sess->getUser();
// other includes
//include_once("lib/uc_packages.php");
include_once("lib/uc_repository.php");
include_once("lib/uc_installer.php");
if (!empty($_GET["catname"]))
$catname = $_GET["catname"];
else if (!empty($_POST["catname"]))
$catname = $_POST["catname"];
else
die("No category selected");
// don't use the include_once directive unless you want
// to always display this page in the default language
include("config/uc_templates.inc");
// prepare template
$tmpl = new ModeliXe($uc_tmpl["CATEGORY"]);
$tmpl->SetModeliXe();
$rep = new UcLocalRepository();
$inst = new UcInstaller();
$category = $rep->getCategory($catname);
if (!$category)
die("Invalid category");
$packages = $category->getPackages();
$tmpl->MxText("catdescr", $category->description[$user->lang]);
foreach ($packages as $package)
{
$tmpl->MxUrl("packages.pkgurl", $ucConfig->wwwRoot . "/admin/package.php",
array("name" => $package->name));
$tmpl->MxText("packages.pkgname", $package->name);
$tmpl->MxText("packages.pkgdescr", $package->description[$user->lang]);
$tmpl->Mxtext("packages.pkghome", $package->homePage);
$tmpl->MxUrl("packages.pkghome", $package->homePage);
$tmpl->MxText("packages.pkgver", $package->version);
$tmpl->MxUrl("packages.installer",
$ucConfig->wwwRoot . "/admin/installer.php",
array("cat" => $catname, "pkg" => $package->name));
$instances = $inst->getStatus($package);
foreach ($instances as $instance)
{
$tmpl->MxText("packages.instances.pkgver", $instance["version"]);
$tmpl->MxText("packages.instances.pkgurl", $instance["url"]);
$tmpl->MxText("packages.instances.pkgstatus", $instance["status"]);
$tmpl->MxBloc("packages.instances", "loop");
}
$tmpl->MxBloc("packages", "loop");
}
// output
$tmpl->MxWrite();
?>
|