-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
63 lines (57 loc) · 2.1 KB
/
index.php
File metadata and controls
63 lines (57 loc) · 2.1 KB
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
62
63
<?php
/**
* $Id: index.php,v 1.12 2008/05/02 14:10:37 david_iondev Exp $
* Trac integration for dotProject
*
* @author David Raison <david@ion.lu>
* @package TracIntegration
* @version 0.5
* @since 0.1
* @copyright ION Development (www.iongroup.lu)
* @license http://www.gnu.org/copyleft/gpl.html GPL License 2 or later
* @todo
* v0.5:
* - Add support for trac xmlrpc calls (http://trac-hacks.org/wiki/XmlRpcPlugin)
* - Document trac.class
* v0.6:
* - Base TracIntegrator Class on CDpObject
*
*/
if (!defined('DP_BASE_DIR')){
die('You should not access this file directly.');
}
// Checking permissions
$perms =& $AppUI->acl();
$canRead = $perms->checkModule( $m, 'view');
$canEdit = $perms->checkModule( $m, 'edit');
$canAdd = $perms->checkModule( $m, 'add');
$canDelete = $perms->checkModule( $m, 'delete');
if (!$canRead) {
$AppUI->redirect( "m=public&a=access_denied" );
}
$AppUI->savePlace();
$titleBlock = new CTitleBlock( 'Trac', 'trac_logo.png', $m, "$m.$a" );
if ($canAdd || $canDelete) $titleBlock->addCrumb('?m=trac&a=addEnv',$AppUI->_('Manage Trac Environments'));
$titleBlock->show();
$tracProj = new CTracIntegrator();
$tracenvs = $tracProj->fetchEnvironments();
$envids = array_keys($tracenvs);
$AppUI->setState('tracenvs',$tracenvs); // reusing it in embed.php, this is saving us a query
// what trac environment to load
if(($envId = dPgetParam($_REQUEST,'envId','')) != '')
$tab = $envId;
else
$tab = dPgetParam($_REQUEST,'tab',$tracenvs[$envids[0]]['idenvironment']); // first env as default
// check if a project exists?
$hosts = $tracProj->fetchHosts();
if (empty($hosts))
$AppUI->setMsg("You need to configure a trac host for one of your projects in the projects module first.",UI_MSG_WARNING);
elseif (empty($tracenvs))
$AppUI->setMsg("You need to add at least one environment.",UI_MSG_WARNING);
else { // generate tabs
$tabBox = new CTabBox('?m=trac',dPgetConfig('root_dir').'/modules/trac/',$tab); // $tab is selected by default
foreach($tracenvs as $env)
$tabBox->add('embed',$env['dtenvironment'],false,$env['idenvironment']); // set environment id as tab key
$tabBox->show();
}
?>