moved permissions to radio boxes
authorpaulr <me@pjr.cc>
Mon, 7 Nov 2011 10:14:15 +0000 (21:14 +1100)
committerpaulr <me@pjr.cc>
Mon, 7 Nov 2011 10:14:15 +0000 (21:14 +1100)
fixed db publishication

gwvplib/gwvpdatabase.php
gwvplib/gwvprepoadmin.php

index b45e360..792c1f7 100644 (file)
@@ -75,6 +75,7 @@ function gwvp_dbCreateSQLiteStructure($dbloc)
        $DB_CONNECTION->query($usersql);
        $DB_CONNECTION->query($groupsql);
        $DB_CONNECTION->query($reposql);
+       $DB_CONNECTION->query($repoperms);
        $DB_CONNECTION->query($configsql);
        $DB_CONNECTION->query($groupmemsql);
 }
index baa7cf1..09f7481 100644 (file)
@@ -55,6 +55,24 @@ function gwvp_DoCreateRepoPage()
        $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");
@@ -63,9 +81,9 @@ function gwvp_DoCreateRepoPage()
                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");
@@ -94,9 +112,9 @@ function gwvp_CreateRepoPageBody()
        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>";