2 $CALL_ME_FUNCTIONS["repoadmin"] = "gwvp_RepoAdminCallMe";
4 $MENU_ITEMS["20repos"]["text"] = "Repo Admin";
5 $MENU_ITEMS["20repos"]["link"] = "$BASE_URL/admin/repos";
7 function gwvp_RepoAdminCallMe()
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") {
17 return "gwvp_CreateRepoPage";
20 return "gwvp_DoCreateRepoPage";
23 return "gwvp_RepoAdminPage";
26 return "gwvp_RepoAdminPage";
36 function gwvp_RepoAdminPage()
38 gwvp_goMainPage("gwvp_RepoAdminPageBody");
41 function gwvp_CreateRepoPage()
43 gwvp_goMainPage("gwvp_CreateRepoPageBody");
46 function gwvp_DoCreateRepoPage()
50 $reponame = $_REQUEST["reponame"];
52 if(gwvp_createGitRepo($reponame)) {
53 gwvp_SendMessage("info", "Repo, $reponame, created");
54 header("Location: $BASE_URL/admin/repos");
60 function gwvp_CreateRepoPageBody()
62 global $BASE_URL, $repo_base;
64 echo "<h2>Create a Repo</h2>";
65 echo "<form method=\"post\" action=\"$BASE_URL/admin/repos/docreate\">";
67 echo "<tr><td>Repository Name</td><td><input type=\"text\" name=\"reponame\"></td></tr>";
68 echo "<tr><td>Repository Description</td><td><input type=\"text\" name=\"repodesc\"></td></tr>";
70 echo "<h3>Permissions</h3>";
72 // no, this bit is wrong, need to come up with something better
73 echo "<table border=\"1\">";
74 echo "<tr><td>Anonymous</td><td>Authenticated</td><td>Group</td></tr>";
75 echo "<tr><td valign=\"top\">";
76 // anon permission dialog
77 echo "<input type=\"checkbox\" name=\"anonvisible\"> Can anonymous users see the repo?<br>";
78 echo "<input type=\"checkbox\" name=\"anonclone\"> Can anonymous user clone from the repo (read-only)?<br>";
80 // authed permission dialog
81 echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user see the repo?<br>";
82 echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user clone from the repo (read-only)?<br>";
83 echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user clone *TO* the repo (read/write)?<br>";
85 // group permissions dialog
86 echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user see the repo?<br>";
87 echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user clone from the repo (read-only)?<br>";
88 echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user clone *TO* the repo (read/write)?<br>";
92 echo "<input type=\"submit\" name=\"create\" value=\"Create\"><br>";
96 function gwvp_RepoAdminPageBody()
98 // first we need a menu
101 echo "<h2>Repo Management</h2>";
102 echo "<a href=\"$BASE_URL/admin/repos/create\">Create a Repo</a><br>";
105 // next we need a repo list - with perms checking - ug
106 // i must also remember that the home page will also contain a list of repos and that this page is solely for maintance
107 // and creation of repos - so i dont need to get over-worked about the info stored on this page outside of those activities
108 $rlist = gwvp_GetRepoList();
109 echo "<table border=\"1\"><tr><th>Repo Name</th><th>Repo Description</th><th>Repo Owner</th></tr>";
110 foreach($rlist as $u_res) {
111 $rname = $u_res["name"];
112 $rdesc = $u_res["description"];
113 $rown = $u_res["owner"];
114 echo "<tr><td>$rname</td><td>$rdesc</td><td>$rown</td></tr>";