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

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.

"; if (MTrackACL::hasAnyRights('Browser', 'create')) { echo "Add new repo
\n"; } mtrack_foot(); exit; } $repotypes = array(); foreach (MTrackRepo::getAvailableSCMs() as $t => $r) { $d = $r->getSCMMetaData(); $repotypes[$t] = $d['name']; } echo "
"; if ($rid == 'new') { MTrackACL::requireAnyRights('Browser', 'create'); ?>

Add new or existing Repository

Use the form below to tell mtrack where to find an existing repository and add it to its list. Leave the "Path" field blank to create a new repository.

" . "" . ""; echo "" . "\n"; echo "" . "" . "\n"; echo "\n"; echo "
Name
Type" . mtrack_select_box("repo:type", $repotypes, null, true) . "
Path
Description
You may use WikiFormatting
\n"; echo "
"; } else { $P = MTrackRepo::loadById($rid); MTrackACL::requireAnyRights("repo:$P->repoid", 'modify'); $name = htmlentities($P->shortname, ENT_QUOTES, 'utf-8'); $type = htmlentities($P->scmtype, ENT_QUOTES, 'utf-8'); $path = htmlentities($P->repopath, ENT_QUOTES, 'utf-8'); $desc = htmlentities($P->description, ENT_QUOTES, 'utf-8'); echo "

Repository: $name

\n"; echo "\n"; if (!$P->parent) { /* not created/managed by us; some fields are editable */ $name = ""; $type = mtrack_select_box("repo:type", $repotypes, $type); $path = ""; } else { $name = htmlentities($P->getBrowseRootName(), ENT_QUOTES, 'utf-8'); } echo ""; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
Name$name
Type$type
Path$path
Description
You may use WikiFormatting
\n"; echo "
\n"; $action_map = array( 'Web' => array( 'read' => 'Browse via web UI', 'modify' => 'Administer via web UI', 'delete' => 'Delete repo via web UI', ), 'SSH' => array( 'checkout' => 'Check-out repo via SSH', 'commit' => 'Commit changes to repo via SSH', ), ); MTrackACL::renderACLForm('perms', "repo:$P->repoid", $action_map); echo "
"; } $projects = array(); foreach (MTrackDB::q('select projid, name, shortname from projects order by name')->fetchAll() as $row) { if ($row[1] != $row[2]) { $projects[$row[0]] = $row[1] . " ($row[2])"; } else { $projects[$row[0]] = $row[1]; } } if (count($projects)) { echo <<Linked Projects

Project links help associate code changes made in a repository with a project, and this in turn helps mtrack decide who to notify about the change.

When assessing a change, mtrack will try each regex listed below and then take the project that corresponds with the longest match--not the longest pattern; the longest actual match.

The regex should just be the bare regex string--you must not enclose it in regex delimiters.

You can remove a link by setting the regex to the empty string.

HTML; echo ""; echo "\n"; if ($rid != 'new') { foreach ($P->getLinks() as $lid => $n) { list($pid, $regex) = $n; $regex = htmlentities($regex, ENT_QUOTES, 'utf-8'); echo "". "\n"; } } if ($rid == 'new') { $newre = '/'; } else { $newre = ''; } echo "". "\n"; echo "
RegexProject
" . "" . mtrack_select_box("link:$lid:project", $projects, $pid) . "
" . "" . mtrack_select_box("link:new:project", $projects) . "Add new link
"; } echo "
"; mtrack_foot();