$reponame = $_REQUEST["reponame"];
$repodesc = $_REQUEST["repodesc"];
+ // TODO: this code is bollocks, need to redo
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($_FILES["bundlefile"]["size"] > 0) { // if(isset($_FILES["bundlefile"]["size"])) <--- this needs to happen here TODO
+ error_log("bundle file tmpname is ".$_FILES["bundlefile"]["tmp_name"]);
+ gwvp_createGitRepo($reponame, $_FILES["bundlefile"]["tmp_name"]);
+ gwvp_SendMessage("info", "Repo, $reponame, created");
} else if(gwvp_createGitRepo($reponame)) {
- if(isset($_FILES["bundlefile"]["size"])) {
- //error_log("bundle file name is ".$_FILES["bundlefile"]["size"]);
- if($_FILES["bundlefile"]["size"] > 0) {
- error_log("bundle file tmpname is ".$_FILES["bundlefile"]["tmp_name"]);
- }
- }
gwvp_SendMessage("info", "Repo, $reponame, created");
- //header("Location: $BASE_URL/admin/repos");
}
+ header("Location: $BASE_URL/admin/repos");
}
echo "<h2>Create a Repo</h2>";
echo "<form method=\"post\" enctype=\"multipart/form-data\" 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 "<tr><td>Repository Bundle</td><td><input type=\"file\" name=\"bundlefile\"></td><td><i>Create a bundle for pro-creating the git repository</i></td></tr>";
+ echo "<tr><td>Repository Name</td><td bgcolor=\"#eeeeee\"><input type=\"text\" name=\"reponame\" value=\"$reponameobv\"></td></tr>";
+ echo "<tr><td>Repository Description</td><td bgcolor=\"#eeeeee\"><input type=\"text\" name=\"repodesc\" value=\"$repodescobv\"></td></tr>";
+ echo "<tr><td>Repository Bundle</td><td bgcolor=\"#eeeeee\"><input type=\"file\" name=\"bundlefile\"></td><td><i>Create a bundle for pro-creating the git repository (export your git bundle with \"git bundle create /tmp/filename --branches\")<br>";
+ echo "Typically you wouldn't use this as its easier to \"push\" to the repo after its created by adding it as a remote and pushing your local master branch</i></td></tr>";
+
+ echo "<tr><td>Default Permisison Set</td><td bgcolor=\"#eeeeee\">";
+
+ echo "<table>";
+ echo "<tr><td><input type=\"checkbox\" name=\"permsall\" checked></td><td>Anyone Can Read, Only you can write</td></tr>";
+ echo "<tr><td><input type=\"checkbox\" name=\"permsmeonly\"></td><td>Anyone can see the repository exists, but only you can read or write to it</td></tr>";
+ echo "<tr><td><input type=\"checkbox\" name=\"permsinvisible\"></td><td>Repository only visible to you</td></tr>";
echo "</table>";
+
+
+ echo "</td><td><i>Permissions can be changed in repository management later</i></td></tr>";
+
+ echo "</table>";
+
+
+
+
+
echo "<input type=\"submit\" name=\"create\" value=\"Create\"><br>";
echo "</form>";
}
echo "<h2>Repo Management</h2>";
echo "<a href=\"$BASE_URL/admin/repos/create\">Create a Repo</a><br>";
+ if(isset($_SESSION["isloggedin"])) {
+ echo "<h3>Your Repo's</h3>";
+ $ownreps = gwvp_getOwnedRepos($_SESSION["id"]);
+ if($ownreps != false) {
+ echo "<table>";
+ echo "<tr><th>Repo Name</th></tr>";
+ foreach($ownreps as $repos) {
+ $mjay = print_r($repos, true);
+ error_log("snafu: $mjay");
+ $reponame = $repos["name"];
+ echo "<tr><td>$reponame</td></tr>";
+ }
+ echo "</table>";
+ } else {
+ echo "You own no repositories";
+ }
+ echo "<hr>";
+ }
+
// 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>";
+ echo "<table border=\"1\"><tr><th>Repo Name</th><th>Repo Description</th><th>Repo Owner</th><th>Control</th></tr>";
foreach($rlist as $u_res) {
+ $rid = $u_res["id"];
$rname = $u_res["name"];
$rdesc = $u_res["description"];
- $rown = $u_res["owner"];
- echo "<tr><td>$rname</td><td>$rdesc</td><td>$rown</td></tr>";
+ $rown = gwvp_getUserName($u_res["owner"]);
+ echo "<tr><td>$rname</td><td>$rdesc</td><td>$rown</td><td><a href=\"$BASE_URL/admin/repos/modify/$rid\">Modify</a></td></tr>";
}
echo "</table>";
return;
}
+// this funciton returns one of three things
+function gwvp_resolvRepoPerms($userid, $repoid)
+{
+
+}
+
?>
\ No newline at end of file