summaryrefslogtreecommitdiff
path: root/themes/CleanFS/templates/common.cat.tpl
blob: fb0e6139010b28408f62d8ce8ea35f105d047a2c (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
148
149
150
151
152
153
154
155
156
157
<p><?php echo Filters::noXSS(L('listnote')); ?></p>
<?php if ($do=='pm'): ?>
<h3><?php echo Filters::noXSS(L('categoriesglobal')); ?></h3>
<table class="list" id="idtablesys">
<colgroup>
  <col class="cname" />
  <col class="cowner" />
  <col class="cshow" />
  <col class="cdelete" />
  <col class="cusage" />
</colgroup>
<thead>
<tr>
  <th><?php echo Filters::noXSS(L('name')); ?></th>
  <th><?php echo Filters::noXSS(L('owner')); ?></th>
  <th><?php echo Filters::noXSS(L('show')); ?></th>
  <th>&nbsp;</th> 
  <th><?php echo Filters::noXSS(L('usedintasks')); ?></th>
</tr>   
</thead>
<tbody>
<?php if (isset($sysrows) && count($sysrows)): ?>
<?php
$syscountlines=-1;    
foreach ($sysrows as $row):
$syscountlines++;
?>  
<tr>
  <td class="first"><span class="depthmark"><?php echo str_repeat('&rarr;', $row['depth']); ?></span><?php echo Filters::noXSS($row['category_name']); ?></td>
  <td><?php echo ($row['category_owner']==0)? '': Filters::noXSS($row['category_owner']); ?></td>
  <td title="<?php echo Filters::noXSS(L('showtip')); ?>"><?php echo $row['show_in_list']; ?></td>
  <td>&nbsp;</td>
  <td><?php echo $row['used_in_tasks'] >0 ? $row['used_in_tasks']:''; ?></td>
</tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td colspan="5"><?php echo Filters::noXSS(L('novalues')); ?></td></tr>
<?php endif; ?>
</tbody>
</table>
<?php endif; ?> 
<h3><?php echo $do=='pm' ? Filters::noXSS(L('categoriesproject')) : Filters::noXSS(L('categoriesglobal')); ?></h3>
<?php
$countlines = -1;
$categories = $proj->listCategories($proj->id, false, false, false);
if ( count($categories) ){
  $root = $categories[0];
  unset($categories[0]);
} else{
  $root=array();
}

if (count($categories)) : ?>
<div id="controlBox">
  <div class="grip"></div>
  <div class="inner">
    <a style="display:block;text-align:center;" href="#" onclick="TableControl.up('catTable'); return false;"><img src="<?php echo Filters::noXSS($this->themeUrl()); ?>/up.png" alt="Up" /></a>   
    <a href="#" onclick="TableControl.shallower('catTable'); return false;"><img src="<?php echo Filters::noXSS($this->themeUrl()); ?>/left.png" alt="Left" /></a>
    <a href="#" onclick="TableControl.deeper('catTable'); return false;"><img src="<?php echo Filters::noXSS($this->themeUrl()); ?>/right.png" alt="Right" /></a>
    <a style="display:block;text-align:center;" href="#" onclick="TableControl.down('catTable'); return false;"><img src="<?php echo Filters::noXSS($this->themeUrl()); ?>/down.png" alt="Down" /></a>
</div>
</div>
<?php endif; ?>
<?php echo tpl_form(Filters::noXSS(CreateURL($do, 'cat', $proj->id))); ?>
    <table class="list" id="catTable">
       <thead>
       <tr>
         <th><?php echo Filters::noXSS(L('name')); ?></th>
         <th><?php echo Filters::noXSS(L('owner')); ?></th>
         <th><?php echo Filters::noXSS(L('show')); ?></th>
         <th><?php echo Filters::noXSS(L('delete')); ?></th>
         <th><?php echo Filters::noXSS(L('usedintasks')); ?></th>
       </tr>
     </thead>
     <tbody>
      <?php
      foreach ($categories as $row):
          $countlines++;
      ?>
      <tr class="depth<?php echo Filters::noXSS($row['depth']); ?>">
        <td class="first">
          <input type="hidden" name="lft[<?php echo Filters::noXSS($row['category_id']); ?>]" value="<?php echo Filters::noXSS($row['lft']); ?>" />
          <input type="hidden" name="rgt[<?php echo Filters::noXSS($row['category_id']); ?>]" value="<?php echo Filters::noXSS($row['rgt']); ?>" />
          <span class="depthmark"><?php echo str_repeat('&rarr;', intval($row['depth'])); ?></span>
          <input id="categoryname<?php echo Filters::noXSS($countlines); ?>" class="text" type="text" maxlength="40" name="list_name[<?php echo Filters::noXSS($row['category_id']); ?>]" value="<?php echo Filters::noXSS($row['category_name']); ?>" />
        </td>
        <td title="<?php echo Filters::noXSS(L('categoryownertip')); ?>">
          <?php echo tpl_userselect('category_owner[' . $row['category_id'] . ']' . $countlines, $row['category_owner'], 'categoryowner' . $countlines); ?>

        </td>
        <td title="<?php echo Filters::noXSS(L('listshowtip')); ?>">
          <?php echo tpl_checkbox('show_in_list[' . $row['category_id'] . ']', $row['show_in_list'], 'showinlist'.$countlines); ?>

        </td>
        <td title="<?php echo Filters::noXSS(L('listdeletetip')); ?>">
          <input id="delete<?php echo Filters::noXSS($row['category_id']); ?>" type="checkbox"
          <?php if ($row['used_in_tasks']): ?>disabled="disabled"<?php endif; ?>
          name="delete[<?php echo Filters::noXSS($row['category_id']); ?>]" value="1" />
        </td>
        <td><?php echo $row['used_in_tasks'] >0 ? $row['used_in_tasks']:''; ?></td>
      </tr>
      <?php endforeach; ?>
      </tbody>
      <?php if($countlines > -1): ?>
      <tr>
        <td colspan="4"></td>
        <td class="buttons">
          <input type="hidden" name="action" value="update_category" />
          <input type="hidden" name="list_type" value="category" />
          <input type="hidden" name="project_id" value="<?php echo Filters::noXSS($proj->id); ?>" />
          <button type="submit"><?php echo Filters::noXSS(L('update')); ?></button>
        </td>
      </tr>
      <?php endif; ?>
    </table>
    <?php if (count($categories)): ?>
    <script type="text/javascript">
      <?php
          echo 'TableControl.create("catTable",{
              controlBox: "controlBox",
              tree: true,
              spreadActiveClass: true
          });';
          echo 'new Draggable("controlBox",{
              handle: "grip"
          });';
      ?>
    </script>
    <?php endif; ?>
</form>
<hr />
<?php echo tpl_form(Filters::noXSS(CreateURL($do, 'cat', $proj->id))); ?>
    <table class="list">
      <tr>
        <td>
          <input id="listnamenew" class="text" type="text" maxlength="40" name="list_name" autofocus />
        </td>
        <td title="<?php echo Filters::noXSS(L('categoryownertip')); ?>">
          <?php echo tpl_userselect('category_owner', Req::val('category_owner'), 'categoryownernew'); ?>

        </td>
        <td title="<?php echo Filters::noXSS(L('categoryparenttip')); ?>">
          <label for="parent_id"><?php echo Filters::noXSS(L('parent')); ?></label>
          <select id="parent_id" name="parent_id">
            <option value="<?php echo Filters::noXSS($root['category_id']); ?>"><?php echo Filters::noXSS(L('notsubcategory')); ?></option>
            <?php echo tpl_options($proj->listCategories($proj->id, false), Req::val('parent_id')); ?>
          </select>
        </td>
        <td class="buttons">
          <input type="hidden" name="action" value="<?php echo Filters::noXSS($do); ?>.add_category" />
          <input type="hidden" name="area" value="<?php echo Filters::noXSS(Req::val('area')); ?>" />
          <input type="hidden" name="project_id" value="<?php echo Filters::noXSS($proj->id); ?>" />
          <button type="submit"><?php echo Filters::noXSS(L('addnew')); ?></button>
        </td>
      </tr>
    </table>
</form>