e0943ba89c6761d387165313f8f1ace1979cbdb7
[gwvp.git] / gwvplib / gwvprepoadmin.php
1 <?php
2 $CALL_ME_FUNCTIONS["repoadmin"] = "gwvp_RepoAdminCallMe";
3
4 $MENU_ITEMS["20repos"]["text"] = "Repo Admin";
5 $MENU_ITEMS["20repos"]["link"] = "$BASE_URL/admin/repos";
6
7 function gwvp_RepoAdminCallMe()
8 {
9         if(isset($_REQUEST["q"])) {
10                 $query = $_REQUEST["q"];
11                 $qspl = explode("/", $query);
12                 if(isset($qspl[0]) && isset($qspl[1])) {
13                         if($qspl[0] == "admin" && $qspl[1] == "repos") {
14                                 if(isset($qspl[2])) {
15                                         switch($qspl[2]) {
16                                                 case "create":
17                                                         return "gwvp_CreateRepoPage";
18                                                         break;
19                                                 default:
20                                                         return "gwvp_RepoAdminPage";
21                                         }                                       
22                                 } else {
23                                         return "gwvp_RepoAdminPage";
24                                 }
25                         }
26                 } 
27                 else return false;
28         }
29         
30         return false;
31 }
32
33 function gwvp_RepoAdminPage()
34 {
35         gwvp_goMainPage("gwvp_RepoAdminPageBody");
36 }
37
38
39 function gwvp_RepoAdminPageBody()
40 {
41         // first we need a menu
42         global $BASE_URL;
43         
44         echo "<h2>Repo Management</h2>";
45         echo "<a href=\"$BASE_URL/admin/repos/create\">Create a Repo</a><br>";
46         
47         
48         // next we need a repo list - with perms checking - ug
49         $rlist = gwvp_GetRepoList();
50         echo "<table border=\"1\"><tr><th>Repo Name</th><th>Repo Description</th><th>Repo Owner</th></tr>";
51         foreach($rlist as $u_res) {
52                 $rname = $u_res["name"];
53                 $rdesc = $u_res["description"];
54                 $rown = $u_res["owner"];
55                 echo "<tr><td>$rname</td><td>$rdesc</td><td>$rown</td></tr>";
56         }
57         echo "</table>";
58         
59         return;
60 }
61
62 ?>