summaryrefslogtreecommitdiff
path: root/scripts/pm.php
blob: c9884e8c3340d66a3c6994eddfe5acde9ebbb05a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php

  /********************************************************\
  | Project Managers Toolbox                               |
  | ~~~~~~~~~~~~~~~~~~~~~~~~                               |
  | This script is for Project Managers to modify settings |
  | for their project, including general permissions,      |
  | members, group permissions, and dropdown list items.   |
  \********************************************************/

if (!defined('IN_FS')) {
    die('Do not access this file directly.');
}

if (!$user->perms('manage_project') || !$proj->id) {
    Flyspray::show_error(16);
}

switch ($area = Req::val('area', 'prefs')) {
    case 'pendingreq':
        $sql = $db->query("SELECT  *
                             FROM  {admin_requests} ar
                        LEFT JOIN  {tasks} t ON ar.task_id = t.task_id
                        LEFT JOIN  {users} u ON ar.submitted_by = u.user_id
                            WHERE  ar.project_id = ? AND resolved_by = 0
                         ORDER BY  ar.time_submitted ASC", array($proj->id));

        $page->assign('pendings', $db->fetchAllArray($sql));

    case 'prefs':
    case 'groups':
      $page->assign('globalgroups', Flyspray::listGroups(0)); # global user groups
      $page->assign('groups', Flyspray::listGroups($proj->id)); # project specific user groups
    case 'editgroup':
        // yeah, utterly stupid, is changed in 1.0 already
        if (Req::val('area') == 'editgroup') {
            $group_details = Flyspray::getGroupDetails(Req::num('id'));
            if (!$group_details || $group_details['project_id'] != $proj->id) {
                Flyspray::show_error(L('groupnotexist'));
                Flyspray::redirect(createURL('pm', 'groups', $proj->id));
            }
            $page->uses('group_details');
        }
    case 'tasktype':
    case 'tag':
    case 'resolution':
    case 'os':
    case 'version':
    case 'cat':
    case 'status':
    case 'newgroup':

        $page->setTitle($fs->prefs['page_title'] . L('pmtoolbox'));
        $page->pushTpl('pm.menu.tpl');
        $page->pushTpl('pm.'.$area.'.tpl');
        break;

    default:
        Flyspray::show_error(17);
}
?>