From d5dbb5b8065eb6290c0a2b573e343f6ad3f8fb26 Mon Sep 17 00:00:00 2001 From: paulr Date: Fri, 4 Nov 2011 17:37:56 +1100 Subject: [PATCH] more repo admin gui, added a component for controlling cmd line git --- gwvplib/gwvpconfig.php | 9 +++--- gwvplib/gwvpgitcontrol.php | 11 ++++++++ gwvplib/gwvplib.php | 3 ++ gwvplib/gwvprepoadmin.php | 59 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 gwvplib/gwvpgitcontrol.php diff --git a/gwvplib/gwvpconfig.php b/gwvplib/gwvpconfig.php index 4ebfb42..74ee6ec 100644 --- a/gwvplib/gwvpconfig.php +++ b/gwvplib/gwvpconfig.php @@ -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 index 0000000..55f9bd5 --- /dev/null +++ b/gwvplib/gwvpgitcontrol.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/gwvplib/gwvplib.php b/gwvplib/gwvplib.php index d24ec5c..693486c 100644 --- a/gwvplib/gwvplib.php +++ b/gwvplib/gwvplib.php @@ -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: diff --git a/gwvplib/gwvprepoadmin.php b/gwvplib/gwvprepoadmin.php index 53cf4b1..df122d6 100644 --- a/gwvplib/gwvprepoadmin.php +++ b/gwvplib/gwvprepoadmin.php @@ -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 "

Create a Repo

"; + echo "
"; + echo ""; + echo ""; + echo ""; + echo "
Repository Name
Repository Description
"; + echo "

Permissions

"; + + // no, this bit is wrong, need to come up with something better + echo ""; + echo ""; + echo ""; + echo "
AnonymousAuthenticatedGroup
"; + // anon permission dialog + echo " Can anonymous users see the repo?
"; + echo " Can anonymous user clone from the repo (read-only)?
"; + echo "
"; + // authed permission dialog + echo " Can any authenticated user see the repo?
"; + echo " Can any authenticated user clone from the repo (read-only)?
"; + echo " Can any authenticated user clone *TO* the repo (read/write)?
"; + echo "
"; + // group permissions dialog + echo " Can any authenticated user see the repo?
"; + echo " Can any authenticated user clone from the repo (read-only)?
"; + echo " Can any authenticated user clone *TO* the repo (read/write)?
"; + + echo "
"; + echo "
"; + echo "
"; +} function gwvp_RepoAdminPageBody() { @@ -61,4 +118,6 @@ function gwvp_RepoAdminPageBody() return; } + + ?> \ No newline at end of file -- 1.7.0.4