more repo admin gui, added a component for controlling cmd line git
authorpaulr <me@pjr.cc>
Fri, 4 Nov 2011 06:37:56 +0000 (17:37 +1100)
committerpaulr <me@pjr.cc>
Fri, 4 Nov 2011 06:37:56 +0000 (17:37 +1100)
gwvplib/gwvpconfig.php
gwvplib/gwvpgitcontrol.php [new file with mode: 0644]
gwvplib/gwvplib.php
gwvplib/gwvprepoadmin.php

index 4ebfb42..74ee6ec 100644 (file)
@@ -4,12 +4,13 @@
 
 // crap, this wont work
 //if(isset($_SESSION["usertype"])) if($_SESSION["usertype"] == "admin") {
-       $CALL_ME_FUNCTIONS["config"] = "gwvp_ConfigCallMe";
-       $MENU_ITEMS["40config"]["text"] = "Configuration";
-       $MENU_ITEMS["40config"]["link"] = "$BASE_URL/admin/config";
-       $MENU_ITEMS["40config"]["userlevel"] = "admin";
+$CALL_ME_FUNCTIONS["config"] = "gwvp_ConfigCallMe";
+$MENU_ITEMS["40config"]["text"] = "Configuration";
+$MENU_ITEMS["40config"]["link"] = "$BASE_URL/admin/config";
+$MENU_ITEMS["40config"]["userlevel"] = "admin";
 //}
 
+global $repo_base, $data_directory; 
 
 function gwvp_ConfigCallMe()
 {
diff --git a/gwvplib/gwvpgitcontrol.php b/gwvplib/gwvpgitcontrol.php
new file mode 100644 (file)
index 0000000..55f9bd5
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+function gwvp_createGitRepo($name)
+{
+       global $repo_base;
+       
+       error_log("would create $repo_base/$name.git");
+       
+       return true;
+}
+?>
\ No newline at end of file
index d24ec5c..693486c 100644 (file)
@@ -9,6 +9,9 @@ require_once("gwvpauth.php");
 require_once("gwvpsetup.php");
 require_once("gwvpdatabase.php");
 require_once("gwvpconfig.php");
+require_once("gwvpgitcontrol.php");
+
+// this is loaded second last
 require_once("gwvppluginloader.php");
 
 // only enable this if you need it:
index 53cf4b1..df122d6 100644 (file)
@@ -16,6 +16,9 @@ function gwvp_RepoAdminCallMe()
                                                case "create":
                                                        return "gwvp_CreateRepoPage";
                                                        break;
+                                               case "docreate":
+                                                       return "gwvp_DoCreateRepoPage";
+                                                       break;
                                                default:
                                                        return "gwvp_RepoAdminPage";
                                        }                                       
@@ -35,6 +38,60 @@ function gwvp_RepoAdminPage()
        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()
 {
@@ -61,4 +118,6 @@ function gwvp_RepoAdminPageBody()
        return;
 }
 
+
+
 ?>
\ No newline at end of file