Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/themes/CleanFS/templates/admin.groups.tpl
blob: 0d661773560f5efe3b38422b6ac3ebd1d94b8736 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<div id="toolbox">
  <ul id="submenu">
   <li><a href="#users_tab"><?php echo Filters::noXSS(L('users')); ?></a></li>
   <li><a href="#groups_tab"><?php echo Filters::noXSS(L('globalgroups')); ?></a></li>
  </ul>
  <div id="users_tab" class="tab">
    <a class="button" href="<?php echo Filters::noXSS(CreateURL('admin', 'newuser', $proj->id)); ?>"><i class="good fa fa-user-plus fa-lg fa-fw"></i><?php echo L('newuser'); ?></a>
    <a class="button" href="<?php echo Filters::noXSS(CreateURL('admin', 'newuserbulk', $proj->id)); ?>"><i class="good fa fa-user-times fa-lg fa-fw"></i><?php echo L('newuserbulk'); ?></a>
    <a class="button" href="<?php echo Filters::noXSS(CreateURL('admin', 'editallusers', $proj->id)); ?>"><i class="fa fa-group fa-lg fa-fw"></i><?php echo L('editallusers'); ?></a>
    <div class="groupedit">
<!--
    <form action="<?php echo Filters::noXSS($baseurl); ?>index.php" method="get">
            <label for="selectgroup"><?php echo Filters::noXSS(L('editgroup')); ?></label>
            <select name="id" id="selectgroup"><?php echo tpl_options(Flyspray::ListGroups()); ?></select>
            <button type="submit"><?php echo Filters::noXSS(L('edit')); ?></button>
            <input type="hidden" name="do" value="admin" />
            <input type="hidden" name="area" value="editgroup" />
            <input type="hidden" name="project" value="<?php echo $proj->id; ?>" />
    </form>
-->
      <form action="<?php echo Filters::noXSS($baseurl); ?>index.php" method="get">
              <label for="edit_user"><?php echo Filters::noXSS(L('edituser')); ?></label>
              <?php echo tpl_userselect('user_name', '', 'edit_user'); ?>
              <button type="submit"><?php echo Filters::noXSS(L('edit')); ?></button>
              <input type="hidden" name="do" value="admin" />
              <input type="hidden" name="area" value="users" />
              <input type="hidden" name="project" value="<?php echo $proj->id; ?>" />
      </form>
    </div>
  </div>
  <div id="groups_tab" class="tab">
<div><a class="button" href="<?php echo Filters::noXSS(CreateURL('admin', 'newgroup', $proj->id)); ?>"><i class="fa fa-group fa-lg fa-fw"></i><?php echo Filters::noXSS(L('newgroup')); ?></a></div>

<?php
$perm_fields = array(
'group_open',
'is_admin',
'manage_project',
'view_tasks',
'view_groups_tasks', # TODO: What is the definition of "group's task" and how does it effect project views?
'view_own_tasks',    # TODO: What is the definition of "own task" and how does it effect project views?
'open_new_tasks',
'add_multiple_tasks',
'modify_own_tasks',
'modify_all_tasks',
'create_attachments',
'delete_attachments',
'assign_to_self',
'assign_others_to_self',
'edit_assignments',
'close_own_tasks',
'close_other_tasks',
'view_roadmap',
'view_history',
'view_reports',
'add_votes',
'view_comments',
'add_comments',
'edit_comments',
'edit_own_comments',
'delete_comments',
'view_estimated_effort',
'view_current_effort_done',
'track_effort'
);

$yesno = array(
        '<td style="color:#ccc" title="'.eL('no').'">-</td>',
        '<td title="'.eL('yes').'"><i class="good fa fa-check fa-lg"></i></td>'
);

$perms=array();
$gmembers='';
$gnames='';
$gdesc='';
$cols='';
foreach ($groups as $group){
	$cols.='<col class="group g'.$group['group_id'].($group['group_open']==0?' inactive':'').'"></col>';
	$gmembers.='<td>'.$group['users'].'</td>';
	$gnames  .='<td><a class="button" title="'.eL('editgroup').'" href="'.( Filters::noXSS(CreateURL('editgroup', $group['group_id'], 'admin'))).'">'
		.Filters::noXSS($group['group_name'])
		.'<i class="fa fa-pencil fa-lg fa-fw"></i></a></td>';
	$gdesc   .='<td>'.Filters::noXSS($group['group_desc']).'</td>';
	foreach ($group as $key => $val) {
		if (!is_numeric($key) && in_array($key, $perm_fields)) {
			$perms[$key][]=$val;
		}
	}
}
?>
<style>
.perms {border-collapse:collapse;}
.perms tbody tr:hover {background-color:#eee;}
.perms td, .perms th{border:1px solid #999;}
.perms thead th, .perms thead td {text-align:center;}
.perms tbody th{text-align:right;}
.perms tbody td{width:100px;text-align:center;}
.perms tbody span i:first-child {color: #090;}
</style>
<table class="perms">
<colgroup> 
<col></col>
<?php echo $cols; ?>
</colgroup>
<thead>
<tr>
<th><?php echo L('groupmembers'); ?></th>
<?php echo $gmembers; ?>
</tr>
<tr> 
<th><?php echo L('group'); ?></th>
<?php echo $gnames; ?>
</tr>
<tr>
<th><?php echo L('description'); ?></th>
<?php echo $gdesc; ?>
</tr>
</thead>
<tbody>
<?php foreach ($perm_fields as $p): ?>
<tr>
	<th><?php echo eL(str_replace('_', '', $p)); ?></th>
<?php
require_once('permicons.tpl');
$i=0;
# TODO: make it visible that a granted 'view_tasks' overrules 'view_groups_tasks' and 'own_tasks'. (like is_admin)
foreach($perms[$p] as $val){
        if ($perms['is_admin'][$i]==1 && $val == 0){
                if(isset($permicons[$p])){
                        echo '<td title="'.eL('yes').' - Permission granted because of is_admin">( '.$permicons[$p].' )</td>';
                }else{
                        echo $yesno[1];
                }
        } elseif($val==1 && isset($permicons[$p])){
                echo '<td>'.$permicons[$p].'</td>';
        } else{
                echo $yesno[$val];
        }
        $i++;
}
?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>