$reponame = $_REQUEST["reponame"];
$repodesc = $_REQUEST["repodesc"];
+ $defperms = 0;
+
+ if(isset($_REQUEST["defperms"])) {
+ switch($_REQUEST["defperms"]) {
+ case "permsall":
+ $defperms = 0;
+ break;
+ case "permsmeonly":
+ $defperms = 1;
+ break;
+ case "permsinvisible":
+ $defperms = 2;
+ break;
+ default:
+ $defperms = 2;
+ }
+ }
+
// 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");
error_log("bundle file tmpname is ".$_FILES["bundlefile"]["tmp_name"]);
// function gwvp_createGitRepo($name, $ownerid, $desc, $defaultperms=0, $bundle=null)
// TODO: deal with default perms
- gwvp_createGitRepo($reponame, $_SESSION["id"], $repodesc, $_FILES["bundlefile"]["tmp_name"]);
+ gwvp_createGitRepo($reponame, $_SESSION["id"], $repodesc, $_FILES["bundlefile"]["tmp_name"], $defperms);
gwvp_SendMessage("info", "Repo, $reponame, created");
- } else if(gwvp_createGitRepo($reponame, $_SESSION["id"], $repodesc)) {
+ } else if(gwvp_createGitRepo($reponame, $_SESSION["id"], $repodesc, null, $defperms)) {
gwvp_SendMessage("info", "Repo, $reponame, created");
}
header("Location: $BASE_URL/admin/repos");
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 "<tr><td><input type=\"radio\" name=\"defperms\" value=\"permsall\" checked></td><td>Anyone Can Read, Only you can write</td></tr>";
+ echo "<tr><td><input type=\"radio\" name=\"defperms\" value=\"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=\"radio\" name=\"defperms\" value=\"permsinvisible\"></td><td>Repository only visible to you</td></tr>";
echo "</table>";