{
if(isset($_REQUEST["q"])) {
$query = $_REQUEST["q"];
- if($query == "admin/repos") return "gwvp_RepoAdminPage";
+ $qspl = explode("/", $query);
+ if(isset($qspl[0]) && isset($qspl[1])) {
+ if($qspl[0] == "admin" && $qspl[1] == "repos") {
+ if(isset($qspl[2])) {
+ switch($qspl[2]) {
+ case "create":
+ return "gwvp_CreateRepoPage";
+ break;
+ case "docreate":
+ return "gwvp_DoCreateRepoPage";
+ break;
+ default:
+ return "gwvp_RepoAdminPage";
+ }
+ } else {
+ return "gwvp_RepoAdminPage";
+ }
+ }
+ }
else return false;
}
gwvp_goMainPage("gwvp_RepoAdminPageBody");
}
+function gwvp_CreateRepoPage()
+{
+ gwvp_goMainPage("gwvp_CreateRepoPageBody");
+}
+
+function gwvp_DoCreateRepoPage()
+{
+ global $BASE_URL;
+
+ $reponame = $_REQUEST["reponame"];
+
+ if(gwvp_createGitRepo($reponame)) {
+ gwvp_SendMessage("info", "Repo, $reponame, created");
+ header("Location: $BASE_URL/admin/repos");
+ }
+
+
+}
+
+function gwvp_CreateRepoPageBody()
+{
+ global $BASE_URL, $repo_base;
+
+ echo "<h2>Create a Repo</h2>";
+ echo "<form method=\"post\" action=\"$BASE_URL/admin/repos/docreate\">";
+ echo "<table>";
+ echo "<tr><td>Repository Name</td><td><input type=\"text\" name=\"reponame\"></td></tr>";
+ echo "<tr><td>Repository Description</td><td><input type=\"text\" name=\"repodesc\"></td></tr>";
+ echo "</table>";
+ echo "<h3>Permissions</h3>";
+
+ // no, this bit is wrong, need to come up with something better
+ echo "<table border=\"1\">";
+ echo "<tr><td>Anonymous</td><td>Authenticated</td><td>Group</td></tr>";
+ echo "<tr><td valign=\"top\">";
+ // anon permission dialog
+ echo "<input type=\"checkbox\" name=\"anonvisible\"> Can anonymous users see the repo?<br>";
+ echo "<input type=\"checkbox\" name=\"anonclone\"> Can anonymous user clone from the repo (read-only)?<br>";
+ echo "</td><td>";
+ // authed permission dialog
+ echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user see the repo?<br>";
+ echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user clone from the repo (read-only)?<br>";
+ echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user clone *TO* the repo (read/write)?<br>";
+ echo "</td><td>";
+ // group permissions dialog
+ echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user see the repo?<br>";
+ echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user clone from the repo (read-only)?<br>";
+ echo "<input type=\"checkbox\" name=\"authdvisible\"> Can any authenticated user clone *TO* the repo (read/write)?<br>";
+
+ echo "</td></tr>";
+ echo "</table>";
+ echo "<input type=\"submit\" name=\"create\" value=\"Create\"><br>";
+ echo "</form>";
+}
function gwvp_RepoAdminPageBody()
{
- echo "I am a repo admin page body";
+ // first we need a menu
+ global $BASE_URL;
+
+ echo "<h2>Repo Management</h2>";
+ echo "<a href=\"$BASE_URL/admin/repos/create\">Create a Repo</a><br>";
+
+
+ // next we need a repo list - with perms checking - ug
+ // i must also remember that the home page will also contain a list of repos and that this page is solely for maintance
+ // and creation of repos - so i dont need to get over-worked about the info stored on this page outside of those activities
+ $rlist = gwvp_GetRepoList();
+ echo "<table border=\"1\"><tr><th>Repo Name</th><th>Repo Description</th><th>Repo Owner</th></tr>";
+ foreach($rlist as $u_res) {
+ $rname = $u_res["name"];
+ $rdesc = $u_res["description"];
+ $rown = $u_res["owner"];
+ echo "<tr><td>$rname</td><td>$rdesc</td><td>$rown</td></tr>";
+ }
+ echo "</table>";
+
+ return;
}
+
+
?>
\ No newline at end of file