X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=admin%2Frepo.php;fp=admin%2Frepo.php;h=44d6d995fd97449833dca9978cff36e6e013b715;hb=29cac3c0e01987683ce5d500381a30d9cc1c4936;hp=0000000000000000000000000000000000000000;hpb=837ccffb3a0d087521a4f3061499690f22972ad8;p=web.mtrack diff --git a/admin/repo.php b/admin/repo.php new file mode 100644 index 00000000..44d6d995 --- /dev/null +++ b/admin/repo.php @@ -0,0 +1,282 @@ +getLinks(); + $plinks = array(); + + foreach ($_POST as $name => $value) { + if (preg_match("/^link:(\d+|new):project$/", $name, $M)) { + $lid = $M[1]; + $plinks[$lid] = array( + (int)$_POST["link:$lid:project"], + trim($_POST["link:$lid:regex"])); + } + } + if (isset($plinks['new'])) { + $n = $plinks['new']; + unset($plinks['new']); + if (strlen($n[1])) { + $P->addLink($n[0], $n[1]); + } + } + foreach ($plinks as $lid => $n) { + if (isset($links[$lid])) { + if ($n != $links[$lid] || !strlen($n[1])) { + $P->removeLink($lid); + if (strlen($n[1])) { + $P->addLink($n[0], $n[1]); + } + } + } else if (strlen($n[1])) { + $P->addLink($n[0], $n[1]); + } + } + + $restricted = !MTrackACL::hasAnyRights('Browser', 'create'); + if ($rid == 'new') { + if (isset($_POST['repo:name'])) { + $P->shortname = $_POST["repo:name"]; + } + if (isset($_POST['repo:type'])) { + $P->scmtype = $_POST["repo:type"]; + } + if (isset($_POST['repo:path'])) { + if ($restricted) throw new Exception("cannot set the repo path"); + $P->repopath = $_POST["repo:path"]; + } + if (isset($_POST['repo:parent']) && strlen($_POST['repo:parent'])) { + $P->parent = $_POST["repo:parent"]; + } + } else { + $editable = !strlen($P->parent); + + if (isset($_POST['repo:name']) && $_POST['repo:name'] != $P->shortname) { + if (!$editable) throw new Exception("cannot change the repo name"); + $P->shortname = $_POST["repo:name"]; + } + if (isset($_POST['repo:type']) && $_POST['repo:type'] != $P->scmtype) { + if (!$editable) throw new Exception("cannot change the repo type"); + $P->scmtype = $_POST["repo:type"]; + } + if (isset($_POST['repo:path']) && $_POST['repo:path'] != $P->repopath) { + if (!$editable) throw new Exception("cannot change the repo path"); + $P->repopath = $_POST["repo:path"]; + } + if (isset($_POST['repo:parent']) && $_POST['repo:parent'] != $P->parent) { + if (!$editable) throw new Exception("cannot change the repo parent"); + $P->parent = $_POST["repo:parent"]; + } + } + if (isset($_POST["repo:description"])) { + $P->description = $_POST["repo:description"]; + } + + $CS = MTrackChangeset::begin("repo:$rid", "Edit repo $P->shortname"); + $P->save($CS); + $CS->setObject("repo:$P->repoid"); + + if (isset($_POST['perms'])) { + $perms = json_decode($_POST['perms']); + MTrackACL::setACL("repo:$P->repoid", 0, $perms); + } + + $CS->commit(); + header("Location: ${ABSWEB}browse.php/" . $P->getBrowseRootName()); + exit; +} + +mtrack_head("Administration - Repositories"); +if (!strlen($rid)) { + MTrackACL::requireAnyRights('Browser', 'modify'); +?> +
+Repositories are version controlled folders that remember your files and +folders at various points in time. Mtrack has support for multiple different +Software Configuration Management systems (also known as Version Control +Systems; SCM and VCS are the common acronyms). +
++Listed below are the repositories that mtrack is configured to use. +The wiki repository is treated specially by mtrack; it stores the +wiki pages. Click on the repository name to edit it, or click on the "Add" +button to tell mtrack to use another repository. +
+