not entirely sure, think its all the messaging components
[glcas.git] / plugins / webbase.php
1 <?php 
2
3 global $URL_HANDLERS;
4 $URL_HANDLERS["/"] = "GLCASWebBase";
5
6
7 class GLCASWebBase {
8         function __construct($config)
9         {
10                 $this->config = $config;
11                 error_log("construct GLCASWebBase");
12         }
13         
14         function go($url)
15         {
16                 error_log("go GLCASWebBase");
17                 GLCASpageBuilder($this, "body");
18         }
19         
20         function body($url)
21         {
22                 global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL;
23                 
24                 // first, list available repos
25                 echo "<h3>Repositories</h3>";
26                 echo "<br><table border=\"1\">";
27                 echo "<tr><th>Name</th><th>Type</th><th>OS</th><th>Version</th><th>Architecture</th><th>Other</th><th>Prefix</th><th>Short URL</th><th>Browse</th></tr>";
28                 
29                 // now iterate thru the repos and print them
30                 $repo = new GLCASRepo($this->config);
31                 $repos = $repo->getRepos();
32                 
33                 foreach($repos as $rkey => $rval) {
34                         $desc = $rval["desc"];
35                         $os = $rval["os"];
36                         $version = $rval["version"];
37                         $arch = $rval["arch"];
38                         $other = $rval["other"];
39                         $repotype = $rval["repotype"];
40                         $prefix = $rval["prefix"];
41                         $shorturl = $rval["shorturl"];
42                         if($prefix == "") $prefix = "-";
43                         if($shorturl == "") $shorturl = "-";
44                         echo "<tr><td>$desc</td><td>$repotype</td><td>$os</td><td>$version</td><td>$arch</td><td>$other</td><td>$prefix</td><td>$shorturl</td>";
45                         
46                         // get url
47                         $browseurl = "$BASE_URL/repo/$rkey";
48                         if($shorturl!="-") {
49                                 $brurl = $shorturl;
50                                 if($prefix != "-") $brurl = "$prefix/$shorturl";
51                                 $browseurl = "$BASE_URL/$brurl/";
52                         }
53                         echo "<td><a href=\"$browseurl\">Browse</td><td>";
54                         echo "</td>";
55                         echo "</tr>";
56                 }
57                 
58                 echo "</table><br><hr>";
59                         
60         }
61         
62         private $config;
63 }
64
65
66 ?>