import
[web.mtrack] / web / admin / index.php
1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
3 include '../../inc/common.php';
4
5 mtrack_head("Administration");
6
7 $cat_titles = array(
8   'tickets' => 'Configure Tickets',
9   'projects' => 'Configure Projects &amp; Notifications',
10   'repo' => 'Configure Repositories',
11   'user' => 'User Administration &amp; Authentication',
12   'logs' => 'Review Logs',
13 );
14
15 $by_cat = array();
16
17 function add_cat($url) {
18   global $by_cat;
19   $cats = func_get_args();
20   array_shift($cats);
21   foreach ($cats as $cat) {
22     $by_cat[$cat][] = $url;
23   }
24 }
25
26 if (MTrackACL::hasAnyRights('Projects', 'modify')) {
27   add_cat("<a href='{$ABSWEB}admin/project.php'>Projects</a> and their notification settings", 'projects');
28 }
29
30 if (MTrackACL::hasAnyRights('Enumerations', 'modify')) {
31   $eurl = $ABSWEB . 'admin/enum.php';
32   add_cat("<a href='$eurl/Priority'>Priority</a>, <a href='$eurl/TicketState'>TicketState</a>, <a href='$eurl/Severity'>Severity</a>, <a href='$eurl/Resolution'>Resolution</a> and <a href='$eurl/Classification'>Classification</a> fields used in tickets", 'tickets');
33   add_cat("<a href='{$ABSWEB}admin/customfield.php'>Custom Fields</a>", 'tickets');
34 }
35
36 if (MTrackACL::hasAnyRights('Components', 'modify')) {
37   add_cat("<a href='{$ABSWEB}admin/component.php'>Components</a> and their associations with Projects", 'tickets', 'projects');
38 }
39
40 if (MTrackACL::hasAnyRights('Tickets', 'create')) {
41   add_cat("<a href='{$ABSWEB}admin/importcsv.php'>Import Tickets</a> from a CSV file", 'tickets');
42 }
43
44 if (MTrackACL::hasAnyRights('Browser', 'modify')) {
45   add_cat("Configure <a href='{$ABSWEB}admin/repo.php'>Repositories</a> and their links to Projects", 'repo');
46 }
47
48 if (MTrackACL::hasAllRights('User', 'modify')) {
49   add_cat("Administer <a href='{$ABSWEB}admin/auth.php'>Authentication</a>", 'user');
50   add_cat("Administer <a href='{$ABSWEB}admin/user.php'>Users</a>", 'user');
51 }
52
53 if (MTrackACL::hasAllRights('Browser', 'modify')) {
54   add_cat("<a href='{$ABSWEB}admin/logs.php'>Indexer logs</a>", 'logs');
55 }
56
57 foreach ($cat_titles as $cat => $title) {
58   $links = $by_cat[$cat];
59   if (count($links) == 0) {
60     continue;
61   }
62   echo "<h2>$title</h2>";
63   foreach ($links as $link) {
64     echo $link, "<br>\n";
65   }
66 }
67
68 mtrack_foot();
69