wow, i just pulled a repo via git from this interface... its
[gwvp.git] / gwvplib / gwvprepoadmin.php
index e0943ba..ec28e8b 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,48 @@ function gwvp_RepoAdminPage()
        gwvp_goMainPage("gwvp_RepoAdminPageBody");
 }
 
+function gwvp_CreateRepoPage()
+{
+       gwvp_goMainPage("gwvp_CreateRepoPageBody");
+}
+
+function gwvp_DoCreateRepoPage()
+{
+       global $BASE_URL;
+       
+       $reponame = $_REQUEST["reponame"];
+       $repodesc = $_REQUEST["repodesc"];
+       
+       if(gwvp_repoExists($reponame)) {
+               gwvp_SendMessage("error", "a repository with the name <b>\"$reponame\"</b> already exists");
+               header("Location: $BASE_URL/admin/repos/create?reponameobv=$reponame&repodescobv=$repodesc");
+       } else if(gwvp_createGitRepo($reponame)) {
+               gwvp_SendMessage("info", "Repo, $reponame, created");
+               header("Location: $BASE_URL/admin/repos");
+       }
+       
+       
+}
+
+function gwvp_CreateRepoPageBody()
+{
+       global $BASE_URL, $repo_base;
+       
+       $reponameobv = "";
+       $repodescobv = "";
+       
+       if(isset($_REQUEST["reponameobv"])) $reponameobv = $_REQUEST["reponameobv"];
+       if(isset($_REQUEST["repodescobv"])) $repodescobv = $_REQUEST["repodescobv"];
+       
+       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\" value=\"$reponameobv\"></td></tr>";
+       echo "<tr><td>Repository Description</td><td><input type=\"text\" name=\"repodesc\" value=\"$repodescobv\"></td></tr>";
+       echo "</table>";
+       echo "<input type=\"submit\" name=\"create\" value=\"Create\"><br>";
+       echo "</form>";
+}
 
 function gwvp_RepoAdminPageBody()
 {
@@ -46,6 +91,8 @@ function gwvp_RepoAdminPageBody()
        
        
        // 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) {
@@ -59,4 +106,6 @@ function gwvp_RepoAdminPageBody()
        return;
 }
 
+
+
 ?>
\ No newline at end of file