name = $_POST["name"]; $P->shortname = $_POST["shortname"]; $P->ordinal = $_POST["ordinal"]; $P->notifyemail = $_POST["email"]; $CS = MTrackChangeset::begin("project:X", $pid == 'new' ? "added project $P->name" : "edit project $P->name"); $P->save($CS); if (MTrackACL::hasAnyRights('Components', 'modify')) { MTrackDB::q('delete from components_by_project where projid = ?', $P->projid); if (isset($_POST['components'])) { $comps = $_POST['components']; foreach ($comps as $cid) { MTrackDB::q( 'insert into components_by_project (compid, projid) values (?, ?)', $cid, $P->projid); } } } $CS->setObject("project:$P->projid"); if (isset($_POST['perms'])) { MTrackACL::setACL("project:$P->projid", 0, json_decode($_POST['perms'])); } $CS->commit(); header("Location: ${ABSWEB}admin/project.php"); exit; } mtrack_head("Administration - Projects"); ?>

Projects

Projects can be created to track development on a per-project or per-product basis. Components may be associated with a project, as well as a default email distribution address.

'new', 'name' => 'My New Project', 'shortname' => 'newproject', 'ordinal' => 5, 'notifyemail' => null ); } echo "
"; echo ""; $name = htmlentities($p['name'], ENT_QUOTES, 'utf-8'); $sname = htmlentities($p['shortname'], ENT_QUOTES, 'utf-8'); $ord = htmlentities($p['ordinal'], ENT_QUOTES, 'utf-8'); $email = htmlentities($p['notifyemail'], ENT_QUOTES, 'utf-8'); echo "", ""; echo "", ""; echo "", ""; echo "", ""; echo "
Name
Short Name
Sorting
Group Email Address
"; if (MTrackACL::hasAnyRights('Components', 'modify')) { $components = array(); foreach (MTrackDB::q( 'select compid, name, deleted from components order by name') ->fetchAll() as $row) { if ($row[2]) { $row[1] .= " (deleted)"; } $components[$row[0]] = $row[1]; } $p_by_c = array(); if ($pid != 'new') { foreach (MTrackDB::q( 'select compid from components_by_project where projid = ?', $pid) ->fetchAll() as $row) { $p_by_c[$row[0]] = $row[0]; } } echo "

Components

"; echo "

Associate component(s) with this project

"; echo mtrack_multi_select_box('components', "(select to add)", $components, $p_by_c); } $repos = array(); foreach (MTrackDB::q('select distinct r.repoid, shortname from project_repo_link p left join repos r on p.repoid = r.repoid where projid = ?', (int)$pid) as $row) { $repos[$row[0]] = $row[1]; } foreach (MTrackDB::q("select repoid, shortname from repos where parent = 'project:' || ?", $p['shortname']) as $row) { $repos[$row[0]] = $row[1]; } if ($pid != 'new') { echo "

Groups

"; echo "

The following groups are associated with this project. You may assign permissions to groups to make it easier to manage groups of users.

"; foreach (MTrackDB::q('select name from groups where project = ?', $pid) as $row) { echo "" . htmlentities($row[0], ENT_QUOTES, 'utf-8') . '
'; } echo "New Group"; } echo "

Linked Repositories

"; if (count($repos)) { echo "\n"; } else { echo "No linked repositories\n"; } echo "

\n"; if (MTrackACL::hasAnyRights("project:$pid", 'modify')) { $action_map = array( 'Admin' => array( 'modify' => 'Administer via web UI', ), ); MTrackACL::renderACLForm('perms', "project:$pid", $action_map); } echo ""; echo ""; echo "
"; } else { ?>

Select a project below to edit it, or click the "Add" button to create a new project.

\n"; foreach (MTrackDB::q( 'select projid, name, shortname, ordinal, notifyemail from projects order by ordinal') as $row) { $pid = $row[0]; $name = htmlentities($row[1], ENT_QUOTES, 'utf-8'); $sname = htmlentities($row[2], ENT_QUOTES, 'utf-8'); if ($sname != $name) { $sname = " ($sname)"; } else { $sname = ''; } $email = htmlentities($row[4], ENT_QUOTES, 'utf-8'); echo "", "$name$sname", "$email", "\n"; } echo "
"; echo "
"; echo ""; echo "
"; } mtrack_foot();