-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsyntax.php
More file actions
1983 lines (1801 loc) · 118 KB
/
syntax.php
File metadata and controls
1983 lines (1801 loc) · 118 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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* IssueTracker Plugin: allows to create simple issue tracker
*
* initial code from DokuMicroBugTracker Plugin: allows to create simple bugtracker
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Taggic <taggic@t-online.de>
*
*
*
*/
//session_start();
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'syntax.php');
require_once(DOKU_PLUGIN.'issuetracker/assilist.php');
/******************************************************************************
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
*/
class syntax_plugin_issuetracker extends DokuWiki_Syntax_Plugin
{
/******************************************************************************/
/* return some info
*/
function getInfo(){
return confToHash(dirname(__FILE__).'/plugin.info.txt');
}
function getType(){ return 'substition';}
function getPType(){ return 'block';}
function getSort(){ return 167;}
/******************************************************************************/
/* Connect pattern to lexer
*/
function connectTo($mode){
$this->Lexer->addSpecialPattern('\{\{issuetracker>[^}]*\}\}',$mode,'plugin_issuetracker');
}
/******************************************************************************/
/* Handle the match
*/
function handle($match, $state, $pos,Doku_Handler &$handler){
$match = substr($match,15,-2); //strip markup from start and end
//handle params
$data = array();
$params = explode('|',$match);
foreach($params as $param) {
$splitparam = explode('=',$param);
if ($splitparam[1] != '')
{
if ($splitparam[0]=='project') { $data['project'] = trim(strtolower($splitparam[1])) ;}
if ($splitparam[0]=='product') { $data['product'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='status') { $data['status'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='severity') { $data['severity'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='display') { $data['display'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='view') { $data['view'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='controls') { $data['controls'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='prod_limit') { $data['prod_limit'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='id') { $data['id'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='version') { $data['version'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='component') { $data['component'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='tblock') { $data['tblock'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='assignee') { $data['assignee'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='reporter') { $data['reporter'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='myissues') { $data['myissues'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='config') { $data['config'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='sort') { $data['sort'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='columns') { $data['columns'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='asympupl') { $data['asympupl'] = trim(strtoupper($splitparam[1])) ;}
if ($splitparam[0]=='email_address') {$data['email_address'] = trim(strtolower($splitparam[1])) ;}
/*continue;*/
}
}
return $data;
}
/******************************************************************************/
/* Captcha OK
*/
function _captcha_ok()
{
$helper = null;
if(@is_dir(DOKU_PLUGIN.'captcha'))
{ $helper = plugin_load('helper','captcha'); }
if(!is_null($helper) && $helper->isEnabled())
{ return $helper->check(); }
return ($this->getConf('use_captcha'));
}
/******************************************************************************/
/* Create output
*/
function render($mode,Doku_Renderer &$renderer, $data) {
global $ID;
$project = htmlspecialchars(stripslashes($_REQUEST['project']));
if(strlen($project) <1) $project = $data['project'];
else $data['project'] = $project;
if ($mode == 'xhtml'){
$renderer->info['cache'] = false;
$Generated_Header = '';
$Generated_Table = '';
$Generated_Scripts = '';
$Generated_Report = '';
if ($data['display'] == '') {$data['display'] = 'ISSUES';}
if ($data['view'] == '') {$data['view'] = '10';}
if ($data['controls'] == '') {$data['controls'] = 'ON';}
if ($data['prod_limit'] == '') {$data['prod_limit'] = 'OFF';}
if ($data['id'] == '') {$data['id'] = '0';}
if ($data['severity'] == '') {$data['severity'] = 'ALL';}
if ($data['status'] == '') {$data['status'] = 'ALL';}
if ($data['product'] == '') {$data['product'] = 'ALL';}
if ($data['version'] == '') {$data['version'] = 'ALL';}
if ($data['component'] == '') {$data['component'] = 'ALL';}
if ($data['tblock'] == '') {$data['tblock'] = false;}
else { $data['tblock'] = true; }
if ($data['assignee'] == '') {$data['assignee'] = 'ALL';}
if ($data['reporter'] == '') {$data['reporter'] = 'ALL';}
if ($data['myissues'] == '') {$data['myissues'] = false;}
else { $data['myissues']= true; }
if ($data['config'] == '') {$data['config'] = false;}
else { $data['config'] = true; }
if($data['asympupl'] == '') {$data['asympupl']=false;}
else{$data['asympupl']=true;}
if ($this->validEmail($data['email_address'])===false ) {
if($data['email_address']!='') { msg("invalid mail given by syntax",-1);}
$data['email_address'] = $this->getConf('email_address');
}
if (stristr($data['display'],'FORM')!= false)
{
//If it is a user report add it to the db-file
if (isset($_REQUEST['severity']))
{
if ($_REQUEST['severity'])
{
// check if captcha is to be used by issue tracker in general
if ($this->getConf('use_captcha') === 0) { $captcha_ok = 1;}
else { $captcha_ok = ($this->_captcha_ok());}
if ($captcha_ok)
{
if (checkSecurityToken())
{ // get issues file contents
$all = false;
$issues = $this->_get_issues($data, $all);
//Add it to the issue file
$issue_id=count($issues);
foreach ($issues as $value)
{if ($value['id'] >= $issue_id) {$issue_id=$value['id'] + 1;}}
$issues[$issue_id]['id'] = $issue_id;
$issues[$issue_id]['product'] = htmlspecialchars(stripslashes($_REQUEST['product']));
$issues[$issue_id]['version'] = htmlspecialchars(stripslashes($_REQUEST['version']));
$issues[$issue_id]['component'] = htmlspecialchars(stripslashes($_REQUEST['component']));
$issues[$issue_id]['tblock'] = htmlspecialchars(stripslashes($_REQUEST['tblock']));
$issues[$issue_id]['severity'] = htmlspecialchars(stripslashes($_REQUEST['severity']));
$issues[$issue_id]['created'] = htmlspecialchars(stripslashes($_REQUEST['created']));
$status = explode(',', $this->getConf('status')) ;
$issues[$issue_id]['status'] = $status[0];
$issues[$issue_id]['user_name'] = htmlspecialchars(stripslashes($_REQUEST['user_name']));
$issues[$issue_id]['user_mail'] = trim(htmlspecialchars(stripslashes($_REQUEST['user_mail'])));
$issues[$issue_id]['user_phone'] = htmlspecialchars(stripslashes($_REQUEST['user_phone']));
$issues[$issue_id]['add_user_mail'] = htmlspecialchars(stripslashes($_REQUEST['add_user_mail']));
// $issues[$issue_id]['title'] = htmlspecialchars(stripslashes($_REQUEST['title']));
$issues[$issue_id]['title'] = htmlspecialchars($_REQUEST['title']);
// $issues[$issue_id]['description'] = htmlspecialchars(stripslashes($_REQUEST['description']));
$issues[$issue_id]['description'] = htmlspecialchars($_REQUEST['description']);
$issues[$issue_id]['attachment1'] = htmlspecialchars(stripslashes($_REQUEST['attachment1']));
$issues[$issue_id]['attachment2'] = htmlspecialchars(stripslashes($_REQUEST['attachment2']));
$issues[$issue_id]['attachment3'] = htmlspecialchars(stripslashes($_REQUEST['attachment3']));
$issues[$issue_id]['assigned'] = '';
$issues[$issue_id]['resolution'] = '';
$issues[$issue_id]['comments'] = '';
$issues[$issue_id]['modified'] = htmlspecialchars(stripslashes($_REQUEST['modified']));
$xuser = $issues[$issue_id]['user_mail'];
$xdescription = $issues[$issue_id]['description'];
//echo "Beschreibung: ".$xdescription."<br />";
// *****************************************************************************
// upload a symptom file
// *****************************************************************************
// check if current user is admin/assignee
// check if syntax parameter asympupl is switched on
$user_grp = pageinfo();
if(array_key_exists('userinfo', $user_grp))
{ foreach ($user_grp['userinfo']['grps'] as $ugrp)
{ $user_grps = $user_grps . $ugrp; }
}
else
{ $user_grps = 'all'; }
$allowed_users = explode('|', $this->getConf('assign'));
$cFlag = false;
foreach ($allowed_users as $w)
{ // check if one of the assigned user roles does match with current user roles
if (strpos($user_grps,$w)!== false)
{ $cFlag = true;
break; }
}
$mime_type1 = $_FILES['attachment1']['type'];
if((($this->getConf('upload')> 0) ||(($cFlag === true) && ($data['asympupl']=true)) || ($this->getConf('registered_users')== 0)) && (strlen($mime_type1)>1)) {
$Generated_Header = $this->_symptom_file_upload($issues,$issue_id,'attachment1');
}
$mime_type2 = $_FILES['attachment2']['type'];
if(($this->getConf('upload')> 0) && (strlen($mime_type2)>1)) {
$Generated_Header = $this->_symptom_file_upload($issues,$issue_id,'attachment2');
}
$mime_type3 = $_FILES['attachment3']['type'];
if(($this->getConf('upload')> 0) && (strlen($mime_type3)>1)) {
$Generated_Header = $this->_symptom_file_upload($issues,$issue_id,'attachment3');
}
//check user mail address, necessary for further clarification of the issue
$valid_umail = $this->validEmail($xuser);
if ( ($valid_umail == true) && ((stripos($xdescription, " ") > 0) || (strlen($xdescription)>5)) && (strlen($issues[$issue_id]['version']) >0))
{
// assemble the path to IssueTracker data store & file
if($this->getConf('it_data')==false) $pfile = DOKU_CONF."../data/meta/".$data['project'].'.issues';
else $pfile = DOKU_CONF."../". $this->getConf('it_data').$data['project'].'.issues';
//save issue-file
$xvalue = io_saveFile($pfile,serialize($issues));
$this->_log_mods($data['project'], $issues[$issue_id], $issues[$issue_id]['user_name'], 'status', '', $issues[$issue_id]['status']);
$pstring = sprintf("showid=%s&project=%s", urlencode($issues[$issue_id]['id']), urlencode($project));
$tmp_link = '<a href="'.DOKU_URL.'doku.php?id='.$ID.'&do=showcaselink&'.$pstring.'" >'.$issue_id.'</a>';
$Generated_Header .= '<div class="it__positive_feedback">'.$this->getLang('msg_reporttrue').$tmp_link.'</div>';
$this->_emailForNewIssue($data['project'],$issues[$issue_id],$data['email_address']);
$_REQUEST['description'] = '';
}
else
{
$wmsg ='';
if ($valid_umail == false)
{ $wmsg = $this->getLang('wmsg1'); }
elseif (strlen($issues[$issue_id]['version']) <1)
{ $wmsg = $this->getLang('wmsg2'); }
else
{ $wmsg = $this->getLang('wmsg3').' ('.stripos($xdescription, " ").', '.strlen($xdescription).')'; }
$Generated_Header .= '<div class="it__negative_feedback">'.$wmsg.'</div>';
}
}
else
{
$Generated_Header .= ':<div class="it__negative_feedback">'.$this->getLang('msg_captchawrong').'</div>';
}
}
}
}
else
{$Generated_Report = $this->_report_render($data);}
}
// Create issue list
elseif (stristr($data['display'],'ISSUES')!= false)
{ // get issues file contents
$all = true;
$issues = $this->_get_issues($data, $all);
// global sort of issues array
if($data['sort']='') $data['sort']='id';
$sort_key = $data['sort'];
$issues = $this->_issues_globalsort($issues, $sort_key);
$step = $data['view'];
$Generated_Table = $this->_table_render($data['project'],$issues,$data,$step,$start);
if (strtolower($data['controls'])==='on') {
$Generated_Scripts = $this->_scripts_render($project);
}
}
// Count only ...
elseif (stristr($data['display'],'COUNT')!= false)
{ // get issues file contents
$all = true;
$issues = $this->_get_issues($data, $all);
$a_result = $this->_count_render($issues,$start,$step,$next_start,$data,$project);
$Generated_Table =$a_result[1];
$count = $a_result[0];
}
// syntax to display a single issue inside wiki text
elseif (stristr($data['display'],'single_issue')!= false)
{ // retrieve issue details
$all = false;
$issues = $this->_get_issues($data, $all);
$issue_id = $data['id'];
if($issues[$issue_id]['status'] == $this->getLang('issue_resolved_status')) { $a_style="<del>"; $e_style="</del>";}
// define output
$Generated_Table = $a_style."<a href='".DOKU_URL.'doku.php?id='.$ID."&do=showcaselink&showid=".$issue_id."&project=".$data['project']."' title='".$issues[$issue_id]['status']."'>".NL;
$Generated_Table .= "<span>#".$issue_id.":</span> ";
$Generated_Table .= "<span>".$issues[$issue_id]['title']."</span> ";
$Generated_Table .= "<span>(".$issues[$issue_id]['status'].")</span>";
$Generated_Table .= "</a>".$e_style;
$Generated_Header = "";
$Generated_Scripts = "";
$Generated_Report = "";
}
// *****************************************************************************
// Show configuration
// *****************************************************************************
elseif (stristr($data['display'],'config')!= false)
{ /* 1. load the defined elements per type
- the related config file (it_matrix.cfg) is stored to the plugin folder
- the matrix structure is as follows
elmnt_type | elmnt_name | rel_childs
- type project has childs of type product
- type product has at least one relative parent or is just newly created
*/
/* $cfg_file = DOKU_PLUGIN."issuetracker/conf/it_matrix.cfg";
$it_cfg = array();
if (@file_exists($cfg_file)) { $it_cfg = unserialize(@file_get_contents($cfg_file)); }
echo "<pre style='font:italic 11px/15px Arial, serif;'>".print_r($it_cfg, true)."</pre>";
// 2. replace the placeholder with config values
// a) loop through the matrix and collect all defined projects
// initially we start with projects
// string to be built according: <option value="strtolower($name)" >$name</option>
$itm_counter = 0;
$itm_counter2 = 0;
foreach($it_cfg as $item) {
if ($item['elmnt_type']=="project") {
$itm_counter++;
if($itm_counter===1){
$name2 .= '<option value="'.$item['elmnt_name'].'" selected="selected">'.$item['elmnt_name'].'</option>'.NL;
$sel_prod = $item['elmnt_name'];
}
else {
$name2 .= '<option value="'.$item['elmnt_name'].'" >'.$item['elmnt_name'].'</option>'.NL;
}
}
// list all potential childs and check the already related items
elseif ($item['elmnt_type']=="product") {
$itm_counter2++;
if (stripos($item['rel_childs'],$sel_prod)!== false) {
$cfgelements .= '<input id="childs_'.$itm_counter2.'" name="childs_'.$itm_counter2.'" class="element checkbox" type="checkbox" checked />
<label class="choice" for="childs_'.$itm_counter2.'">'.$item['elmnt_name'].'</label> <br />'.NL;
}
else {
$cfgelements .= '<input id="childs_'.$itm_counter2.'" name="childs_'.$itm_counter2.'" class="element checkbox" type="checkbox" />
<label class="choice" for="childs_'.$itm_counter2.'">'.$item['elmnt_name'].'</label> <br />'.NL;
}
}
}
$type1 = '<option value="project" selected="selected">Project</option>
<option value="product" >Product</option>
<option value="component" >Component</option>'.NL;
*/
/* $name2 = ' <option value="" selected="selected"></option>
<option value="1" >First element</option>
<option value="2" >Second element</option>
<option value="3" >Third element</option>'.NL;
$cfgelements = '<input id="element_6_1" name="element_6_1" class="element checkbox" type="checkbox" value="1" />
<label class="choice" for="element_6_1">First option</label> <br />
<input id="element_6_2" name="element_6_2" class="element checkbox" type="checkbox" value="1" />
<label class="choice" for="element_6_2">Second option</label> <br />
<input id="element_6_3" name="element_6_3" class="element checkbox" type="checkbox" value="1" />
<label class="choice" for="element_6_3">Third option</label> <br />'.NL;
*/
/* // 3. load html-skeleton
$html_skeleton = DOKU_PLUGIN."issuetracker/cfg_skeleton.html";
if (@file_exists($html_skeleton)) { $Generated_config = @file_get_contents($html_skeleton); }
else { msg("The file 'cfg_skeleton.html' was not found at plugin directory.",-1); return;}
// 4. replace placeholders at html-skeleton
$Generated_config = str_ireplace("%%ID%%",$ID,$Generated_config);
$Generated_config = str_ireplace("%%type1%%",$type1,$Generated_config);
$Generated_config = str_ireplace("%%name2%%",$name2,$Generated_config);
$Generated_config = str_ireplace("%%cfgelements%%",$cfgelements,$Generated_config);
// 5. load the script to assemble the element childs for submit to action.php
$it_script = DOKU_PLUGIN."issuetracker/it_matrix.script";
if (@file_exists($it_script)) { $it_cfg_script = @file_get_contents($it_script); }
else { msg("The file 'it_matrix.script' was not found at plugin directory.",-1); }
$Generated_config = $it_cfg_script .NL. $Generated_config;
*/ }
// Render
$renderer->doc .= $Generated_Header.$Generated_Table.$Generated_Scripts.$Generated_Report.$Generated_config;
}
}
/******************************************************************************/
/* Create count output
*/
function _count_render($issues,$start,$step,$next_start,$data, $project)
{ global $ID;
$count = array();
$productfilter=$data['product'];
foreach ($issues as $issue)
{
if(($issue['project'] !== $project) && ($this->getConf('multi_projects')==0)) {
continue;
}
elseif((strcasecmp($productfilter,'ALL')===0) || (stristr($productfilter,$this->_get_one_value($issue,'product'))!= false))
{ $status = trim($this->_get_one_value($issue,'status'));
$a_count = $a_count + 1;
if (($status != '') && (stripos($this->getConf('status_special'),$status)===false))
{ if ($this->_get_one_value($count,strtoupper($status))=='')
{$count[strtoupper($status)] = array(1,$status);}
else
{$count[strtoupper($status)][0] += 1;}
}
}
}
$rendered_count = '<div class="itl__count_div">'.'<table class="itl__count_tbl">';
foreach ($count as $value)
{
//http://www.fristercons.de/fcon/doku.php?id=issuetracker:issuelist&do=showcaselink&showid=19&project=fcon_project
// $ID.'&do=issuelist_filter&itl_sev_filter='.$value[1]
$rendered_count .= '<tr><td><a href="'.DOKU_URL.'doku.php?id='.$ID.'&do=issuelist_filterlink'.'&itl_start='.$start.'&itl_step='.$step.'&itl_next='.$next_start.'&itl_stat_filter='.$value[1].'&itl_sev_filter='.$data['severity'].'&itl__prod_filter='.$data['product'].'&itl_project='.$data['project'].'" >'.$value[1].'</a> </td><td> '.$value[0].'</td></tr>';
}
$rendered_count .= '</table></div>';
$ret_array = array($a_count,$rendered_count);
return $ret_array;
}
/******************************************************************************/
/* Create table scripts
*/
function _scripts_render($project)
{
// load status values from config into select control
$s_counter = 0;
$status = explode(',', $this->getConf('status')) ;
foreach ($status as $x_status)
{
$s_counter = $s_counter + 1;
$x_status = trim($x_status);
$STR_STATUS = $STR_STATUS . "case '".$x_status."': val = ".$s_counter."; break;";
$pattern = $pattern . "|" . $x_status;
$x_status_select = $x_status_select . "['".$x_status."','".$x_status."'],";
}
// Build string to load products select
$products = explode(',', $this->getConf('products')) ;
foreach ($products as $x_products)
{
$x_products = trim($x_products);
$x_products_select = $x_products_select . "['".$x_products."','".$x_products."'],";
}
// Build string to load severity select
$severity = explode(',', $this->getConf('severity')) ;
foreach ($severity as $x_severity)
{
$x_severity = trim($x_severity);
$x_severity_select = $x_severity_select . "['".$x_severity."','".$x_severity."'],";
}
// see issue 37: AUTH:AD switch to provide text input instead
// select with retriveing all_users from AD
// search also action.php for 'auth_ad_overflow'
if($this->getConf('auth_ad_overflow') == false) {
global $auth;
global $conf;
$filter['grps'] = $this->getConf('assign');
$target = $auth->retrieveUsers(0,0,$filter);
$shw_assignee_as = trim($this->getConf('shw_assignee_as'));
if(stripos("login, mail, name",$shw_assignee_as) === false) $shw_assignee_as = "login";
//--------------------------------------------------------------------------------------------
// Build 'assign to' list from a simple textfile
// 1. check if file exist else use configuration
if($this->getConf('assgnee_list')==="") {
foreach ($target as $key => $x_umail)
{ // show assignee by login, name, mail
if($shw_assignee_as=='login') $x_umail_select = $x_umail_select . "['".$key."','".$x_umail['mail']."'],";
else $x_umail_select = $x_umail_select . "['".$x_umail[$shw_assignee_as]."','".$x_umail['mail']."'],";
}
}
else{
$fileextension = $this->getConf('assgnee_list');
$x_umail_select = __get_assignees_from_files($fileextension);
}
//--------------------------------------------------------------------------------------------
$x_umail_select .= "['',''],";
$authAD_selector = "TableKit.Editable.selectInput('assigned',{}, [".$x_umail_select."]);";
}
//hack if DOKU_BASE is not properly set
if(strlen(DOKU_BASE) < strlen(DOKU_URL)) $BASE = DOKU_URL."lib/plugins/issuetracker/";
else $BASE = DOKU_BASE."lib/plugins/issuetracker/";
return "<script type=\"text/javascript\" src=\"".$BASE."prototype.js\"></script><script type=\"text/javascript\" src=\"".$BASE."fabtabulous.js\"></script>
<script type=\"text/javascript\" src=\"".$BASE."tablekit.js\"></script>
<script type=\"text/javascript\">
TableKit.options.editAjaxURI = '".$BASE."edit.php';
TableKit.Editable.selectInput('status',{}, [".$x_status_select."]);
TableKit.Editable.selectInput('product',{}, [".$x_products_select."]);
TableKit.Editable.selectInput('severity',{}, [".$x_severity_select."]);
".$authAD_selector."
TableKit.Editable.multiLineInput('description');
TableKit.Editable.multiLineInput('resolution');
var _tabs = new Fabtabs('tabs');
$$('a.next-tab').each(function(a) {
Event.observe(a, 'click', function(e){
Event.stop(e);
var t = $(this.href.match(/#(\w.+)/)[1]+'-tab');
_tabs.show(t);
_tabs.menu.without(t).each(_tabs.hide.bind(_tabs));
}.bindAsEventListener(a));
});
</script>";
}
/******************************************************************************/
/* Create list of Issues
*/
function _table_render($project,$issues,$data,$step,$start)
{
global $ID;
global $lang;
if ($step==0) $step=10;
if ($start==0) $start=count($issues)-$step+1;
$next_start = $start + $step + 1;
if ($next_start>count($issues)) $next_start=count($issues);
$imgBASE = DOKU_BASE."lib/plugins/issuetracker/images/";
$style =' style="text-align:center; white-space:pre-wrap;">';
// $date_style =' style="text-align:center; white-space:pre;">';
$user_grp = pageinfo();
$noStatIMG = $this->getConf('noStatIMG');
$noSevIMG = $this->getConf('noSevIMG');
$a_project = $data['project'];
if(array_key_exists('userinfo', $user_grp))
{ foreach ($user_grp['userinfo']['grps'] as $ugrp)
{ $user_grps = $user_grps . $ugrp; }
}
else
{ $user_grps = 'all'; }
if (strtolower($data['controls'])==='on') {
$ret = '<br /><br /><form class="issuetracker__form2" method="post" action="'.$_SERVER['REQUEST_URI'].'" accept-charset="'.$lang['encoding'].'"><p>';
$ret .= formSecurityToken(false).'<input type="hidden" name="do" value="show" />';
}
// the user maybe member of different user groups
// check if one of its assigned groups match with configuration
$allowed_users = explode('|', $this->getConf('assign'));
$cFlag = false;
foreach ($allowed_users as $w)
{ // check if one of the assigned user roles does match with current user roles
if (strpos($user_grps,$w)!== false)
{ $cFlag = true;
break; }
}
// members of defined groups $user_grps allowed to change issue contents
if (($cFlag === true) || ($this->getConf('registered_users')== 0))
{ $dynatable_id = "t_".uniqid((double)microtime()*1000000,1);
if(($this->getConf('multi_projects')!==0) && ($this->getConf('shw_project_col')!==0))
{ $th_project = "<th id='project'>".$this->getLang('th_project')."</th>"; }
$head = "<div class='itl__table'><table id='".$dynatable_id."' class='sortable editable resizable inline' width='100%'>".NL.
"<thead><tr>".NL.
$th_project.NL.
"<th class='".$this->getConf('listview_sort')."' id='id'>".$this->getLang('th_id')."</th>".NL.
"<th id='created'>" .$this->getLang('th_created') ."</th>".NL.
"<th id='product'>" .$this->getLang('th_product') ."</th>".NL.
"<th id='version'>" .$this->getLang('th_version') ."</th>".NL.
"<th id='severity'>" .$this->getLang('th_severity') ."</th>".NL.
"<th id='status'>" .$this->getLang('th_status') ."</th>".NL.
"<th id='user_name'>" .$this->getLang('th_user_name') ."</th>".NL.
"<th id='title'>" .$this->getLang('th_title') ."</th>".NL.
"<th id='assigned'>" .$this->getLang('th_assigned') ."</th>".NL.
"<th id='resolution'>".$this->getLang('th_resolution')."</th>".NL.
"<th id='modified'>" .$this->getLang('th_modified') ."</th>".NL.
"</tr></thead>".NL;
$body = '<tbody>'.NL;
// Note: The checked attribute is a boolean attribute.
if($data['myissues'] == '') { $data['myissues']= false; }
else { $data['myissues']= true; }
for ($i=$next_start-1;$i>=0;$i=$i-1)
{ // check start and end of rows to be displayed
if($i>count($issues)) break; // prevent the php-warning
$issue = $issues[$i];
$a_status = strtolower($this->_get_one_value($issue,'status'));
$a_severity = strtolower($this->_get_one_value($issue,'severity'));
$a_product = strtoupper($this->_get_one_value($issue,'product'));
$a_version = strtoupper($this->_get_one_value($issue,'version'));
$a_component = strtoupper($this->_get_one_value($issue,'component'));
$a_tblock = strtoupper($this->_get_one_value($issue,'tblock'));
$a_assignee = strtoupper($this->_get_one_value($issue,'assignee'));
$a_reporter = strtoupper($this->_get_one_value($issue,'user_name'));
if ((($data['status'] =='ALL') || (stristr($data['status'],$a_status) != false)) &&
(($data['severity'] =='ALL') || (stristr($data['severity'],$a_severity) != false)) &&
(($data['product'] =='ALL') || (stristr($data['product'],$a_product) != false)) &&
(($data['version'] =='ALL') || (stristr($data['version'],$a_version) != false)) &&
(($data['component'] =='ALL') || (stristr($data['component'],$a_component) != false)) &&
(($data['assignee'] =='ALL') || (stristr($data['assignee'],$a_assignee) != false)) &&
(($data['reporter'] =='ALL') || (stristr($data['reporter'],$a_reporter) != false)) &&
(($data['myissues'] == false ) || ($this->_find_myissues($issue, $user_grp) == true)))
{
if ($y>=$step) break;
if (stripos($this->getConf('status_special'),$a_status) !== false) continue;
$y=$y+1;
// check if status image or text to be displayed
if ($noStatIMG == false) {
$status_img = $imgBASE . implode('', explode(' ',$this->img_name_encode($a_status))).'.gif';
// if(!file_exists(str_replace("//", "/", DOKU_INC.$status_img))) { $status_img = $imgBASE . 'status.gif' ;}
$status_img =' class="it_center"><span style="display : none;">'.$a_status.'</span><img border="0" alt="'.$a_status.'" title="'.$a_status.'" style="margin-right:0.5em" vspace="1" align="middle" src="'.$status_img.'" width="16" height="16"/>'.NL;
}
else { $status_img = $style.$a_status; }
// check if severity image or text to be displayed
if ($noSevIMG == false) {
$severity_img = $imgBASE . implode('', explode(' ',$this->img_name_encode($a_severity))).'.gif';
// if(!file_exists(str_replace("//", "/", DOKU_INC.$severity_img))) { $severity_img = $imgBASE . 'status.gif' ;}
$severity_img =' class="it_center"><span style="display : none;">'.$a_severity.'</span><img border="0" alt="'.$a_severity.'" title="'.$a_severity.'" style="margin-right:0.5em" vspace="1" align="middle" src="'.$severity_img.'" width="16" height="16"/>'.NL;
}
else { $severity_img = $style.$a_severity; }
$it_issue_username = $this->_get_one_value($issue,'user_name');
$a_project = $this->_get_one_value($issue,'project');
if(($this->getConf('multi_projects')!==0) && ($this->getConf('shw_project_col')!==0))
{ $td_project = '<td class="itl__td_standard">'.$a_project.'</td>';
}
// build parameter for $_GET method
$pstring = sprintf("showid=%s&project=%s", urlencode($this->_get_one_value($issue,'id')), urlencode($a_project));
$itl_item_title = '<a href="doku.php?id='.$ID.'&do=showcaselink&'.$pstring.'" title="'.$this->_get_one_value($issue,'title').'">'.$this->_get_one_value($issue,'title').'</a>'.NL;
if((($this->getConf('multi_projects')!==0) && ($this->getConf('shw_project_col')!==0)) || $project == $a_project )
{ if($rowEven==="it_roweven") $rowEven="it_rowodd";
else $rowEven="it_roweven";
$body .= '<tr id = "'.$a_project.' '.$this->_get_one_value($issue,'id').'" class="'.$rowEven.'" >'.NL.
$td_project.NL.
'<td class="itl__td_standard">'.$this->_get_one_value($issue,'id').'</td>'.NL.
'<td class="itl__td_date">'.date($this->getConf('d_format'),strtotime($this->_get_one_value($issue,'created'))).'</td>'.NL.
'<td class="itl__td_standard">'.$this->_get_one_value($issue,'product').'</td>'.NL.
'<td class="itl__td_standard">'.$this->_get_one_value($issue,'version').'</td>'.NL.
'<td'.$severity_img.'</td>'.NL.
'<td'.$status_img.'</td>'.NL.
'<td class="canbreak itl__td_standard"><a href="mailto:'.$this->_get_one_value($issue,'user_mail').'">'.$it_issue_username.'</a></td>'.NL.
'<td class="canbreak itl__td_standard">'.$itl_item_title.'</td>'.NL;
// check how the assignee to be displayed: login, name or mail
$a_display = $this->_get_assignee($issue,'assigned');
$body .= '<td class="canbreak itl__td_standard"><a href="mailto:'.$this->_get_one_value($issue,'assigned').'">'.$a_display.'</a></td>'.NL.
'<td class="canbreak itl__td_standard">'.$this->xs_format($this->_get_one_value($issue,'resolution')).'</td>'.NL.
'<td class="itl__td_date">'.date($this->getConf('d_format'),strtotime($this->_get_one_value($issue,'modified'))).'</td>'.NL.
'</tr>'.NL;
}
}
}
$body .= '</tbody></table></div>'.NL;
}
else
{ //$head = "<div class='issuetracker_div' ".$hdr_style."><table id='".$project."' class=\"sortable resizable inline\"><thead><thead><tr><th class=\"sortfirstdesc\" id='id'>Id</th><th id='Status'>Status</th><th id='Severity'>Severity</th><th id='Created'>Created</th><th id='Version'>Version</th><th id='User'>User</th><th id='Description'>Description</th><th id='assigned'>assigned</th><th id='Resolution'>Resolution</th><th id='Modified'>Modified</th></tr></thead>";
$dynatable_id = "t_".uniqid((double)microtime()*1000000,1);
//Build table header according settings or syntax
if(strlen($data['columns'])>0) {
$configs = explode(',', strtolower($data['columns']));
}
else {
$configs = explode(',', $this->getConf('shwtbl_usr')) ;
}
if(($this->getConf('multi_projects')!==0) && ($this->getConf('shw_project_col')!==0))
{ $th_project = "<th id='project'>".$this->getLang('th_project')."</th>"; }
$reduced_header ='';
$reduced_header = "<div class='itl__table'><table id='".$dynatable_id."' class='sortable resizable inline' width='100%'>".NL.
"<thead><tr>".NL.$th_project.NL."<th class='".$this->getConf('listview_sort')."' id='id'>".$this->getLang('th_id')."</th>".NL;
foreach ($configs as $config)
{
$reduced_header .= "<th id='".$config."'>".$this->getLang('th_'.$config)."</th>".NL;
}
$reduced_header .= "</tr></thead>".NL;
//Build rows according settings
$reduced_issues='';
for ($i=$next_start-1;$i>=0;$i=$i-1)
{ // check start and end of rows to be displayed
if($i>count($issues)) break; // prevent the php-warning
$issue = $issues[$i];
$a_project = strtolower($this->_get_one_value($issue,'project'));
$a_status = strtolower($this->_get_one_value($issue,'status'));
$a_severity = strtolower($this->_get_one_value($issue,'severity'));
$a_product = strtoupper($this->_get_one_value($issue,'product'));
$a_version = strtoupper($this->_get_one_value($issue,'version'));
$a_component = strtoupper($this->_get_one_value($issue,'component'));
$a_tblock = strtoupper($this->_get_one_value($issue,'tblock'));
$a_assignee = strtoupper($this->_get_one_value($issue,'assignee'));
$a_reporter = strtoupper($this->_get_one_value($issue,'user_name'));
if ((($data['status'] =='ALL') || (stristr($data['status'],$a_status) != false)) &&
(($data['severity'] =='ALL') || (stristr($data['severity'],$a_severity) != false)) &&
(($data['product'] =='ALL') || (stristr($data['product'],$a_product) != false)) &&
(($data['version'] =='ALL') || (stristr($data['version'],$a_version) != false)) &&
(($data['component'] =='ALL') || (stristr($data['component'],$a_component) != false)) &&
(($data['assignee'] =='ALL') || (stristr($data['assignee'],$a_assignee) != false)) &&
(($data['reporter'] =='ALL') || (stristr($data['reporter'],$a_reporter) != false)) &&
(($data['myissues'] == false ) || ($this->_find_myissues($issue, $user_grp) == true)))
{
if (stripos($this->getConf('status_special'),$a_status) !== false) continue;
if((($this->getConf('multi_projects')!==0) && ($this->getConf('shw_project_col')!==0)) || $project == $a_project )
{ if ($y>=$step) break;
$y=$y+1;
if($rowEven==="it_roweven") $rowEven="it_rowodd";
else $rowEven="it_roweven";
if(($this->getConf('multi_projects')!==0) && ($this->getConf('shw_project_col')!==0))
{ $a_project = $this->_get_one_value($issue,'project');
$td_project = '<td class="itl__td_standard">'.$a_project.'</td>';
}
else{$td_project="";}
$reduced_issues = $reduced_issues.'<tr id = "'.$a_project.' '.$this->_get_one_value($issue,'id').'" class="'.$rowEven.'" >'.NL.
$td_project.NL.
'<td'.$style.$this->_get_one_value($issue,'id').'</td>'.NL;
foreach ($configs as $config)
{
$isval = $this->_get_one_value($issue,strtolower($config));
if ($config == 'status')
{
if ($noStatIMG == false) {
$status_img = $imgBASE . implode('', explode(' ',$this->img_name_encode($isval))).'.gif';
$reduced_issues .='<td class="it_center"><span style="display : none;">'.$a_status.'</span><img border="0" alt="'.$isval.'" title="'.$isval.'" style="margin-right:0.5em" vspace="1" align="middle" src="'.$status_img.'" width="16" height="16"/></td>'.NL;
}
else { $reduced_issues .= '<td'.$style.$isval.'</td>'.NL; }
}
elseif ($config == 'severity')
{
if ($noSevIMG == false) {
$severity_img = $imgBASE . implode('', explode(' ',$this->img_name_encode($isval))).'.gif';
$reduced_issues .='<td class="it_center"><span style="display : none;">'.$a_severity.'</span><img border="0" alt="'.$isval.'" title="'.$isval.'" style="margin-right:0.5em" vspace="1" align="middle" src="'.$severity_img.'" width="16" height="16"/></td>'.NL;
}
else { $reduced_issues .= '<td'.$style.$isval.'</td>'.NL; }
}
elseif ($config == 'title')
{ // build parameter for $_GET method
$pstring = sprintf("showid=%s&project=%s", urlencode($this->_get_one_value($issue,'id')), urlencode($a_project));
$reduced_issues .='<td>'.
'<a href="doku.php?id='.$ID.'&do=showcaselink&'.$pstring.'" title="'.$isval.'">'.$isval.'</a></td>'.NL;
}
elseif ($config == 'created')
{ $reduced_issues .='<td class="itl__td_date">'.date($this->getConf('d_format'),strtotime($this->_get_one_value($issue,'created'))).'</td>'.NL;
}
elseif ($config == 'modified')
{ $reduced_issues .='<td class="itl__td_date">'.date($this->getConf('d_format'),strtotime($this->_get_one_value($issue,'modified'))).'</td>'.NL;
}
elseif ($config == 'resolution')
{ $reduced_issues .='<td class="canbreak itl__td_standard">'.$this->xs_format($this->_get_one_value($issue,'resolution')).'</td>'.NL;
}
elseif ($config == 'description')
{ $reduced_issues .='<td class="canbreak itl__td_standard">'.$this->xs_format($this->_get_one_value($issue,'description')).'</td>'.NL;
}
else
{
$reduced_issues .= '<td'.$style.$isval.'</td>'.NL;
}
}
$reduced_issues .= '</tr>'.NL;
}
}
}
$head = NL.$reduced_header.NL;
$body = '<tbody>'.$reduced_issues.'</tbody>'.NL.'</table>'.NL.'</div>'.NL;
}
// -----------------------------------------------------------------------------
// Control render
if($data['myissues']==false) {$data['myissues'] = "";}
else {$data['myissues'] = "checked='true'";}
if($data['tblock']==false) { $data['tblock'] = ""; }
else $data['tblock'] = "checked='true'";
if (strtolower($data['controls'])==='on') {
$a_result = $this->_count_render($issues,$start,$step,$next_start,$data,$project);
$li_count =$a_result[1];
$count = $a_result[0];
$ret = '<div>'.NL.
'<script type="text/javascript">'.NL.
' function changeAction(where) {'.NL.
' if(where==1) {'.NL.
' document.forms["myForm"].action = "doku.php?id=' . $ID . '&do=issuelist_previous";'.NL.
' }'.NL.
' else if(where==2){'.NL.
' document.forms["myForm"].action = "doku.php?id=' . $ID . '&do=issuelist_next";'.NL.
' }'.NL.
' else if(where==3){'.NL.
' document.forms["myForm"].action = "doku.php?id=' . $ID . '&do=issuelist_filter";'.NL.
' }'.NL.
' document.forms["myForm"].submit();'.NL.
' }'.NL.
' </script>'.NL.
'<table class="itl__t1"><tbody>'.NL.
'<tr class="itd__tables_tr">'.NL.
' <td colspan="4" align="left" valign="middle" height="30">'.NL.
' <label class="it__cir_projectlabel">'.sprintf($this->getLang('lbl_issueqty'),$project).$count.'</label>'.NL.
' </td>'.NL.
' <td class="itl__showdtls" rowspan="2" width="30%">'.$li_count.'</td>'.NL.
'</tr>'.NL.
'<tr class="itd__tables_tr">'.NL.
' <td align ="left" valign="top" width="15%">'.NL;
$ret .= ' <p class="it__cir_projectlabel">'.'<label for="itl_step" style="align:left;">'.$this->getLang('lbl_scroll') .'</label><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Severity')=== false) $ret .= '<label for="itl_sev_filter" style="align:left;">'.$this->getLang('lbl_filtersev') .'</label><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Status')=== false) $ret .= '<label for="itl_stat_filter" style="align:left;">'.$this->getLang('lbl_filterstat') .'</label><br />'.NL;
$ret .= '</p><p class="it__cir_projectlabel">'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Product')=== false) $ret .= '<label for="itl__prod_filter" style="align:left;">'.$this->getLang('lbl_filterprod') .'</label><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Version')=== false) $ret .= '<label for="itl__vers_filter" style="align:left;">'.$this->getLang('lbl_filtervers') .'</label><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Component')=== false) $ret .= '<label for="itl__comp_filter" style="align:left;">'.$this->getLang('lbl_filtercomp') .'</label><br />'.NL;
$ret .= '</p><p class="it__cir_projectlabel">'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Test blocking')=== false) $ret .= '<label for="itl__block_filter" style="align:left;">'.$this->getLang('lbl_filterblock') .'</label><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Assignee')=== false) $ret .= '<label for="itl__assi_filter" style="align:left;">'.$this->getLang('lbl_filterassi') .'</label><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Reporter')=== false) $ret .= '<label for="itl__user_filter" style="align:left;">'.$this->getLang('lbl_filterreporter').'</label><br />'.NL;
$ret .= '</p><p class="it__cir_projectlabel">'.NL;
if(stripos($this->getConf('ltdListFilters'),'MyIssues')=== false) $ret .= '<label for="itl_myis_filter" style="align:left;">'.$this->getLang('cbx_myissues') .'</label><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Sort by')=== false) $ret .= '<label for="it_glbl_sort" style="align:left;">'.$this->getLang('lbl_sort') .'</label>'.NL;
$ret .= '</p></td>'.NL;
$ret .= ' <td align ="left" valign="top" width="25%">'.NL.
' <form name="myForm" action="" method="post">'.NL.
' <input type="hidden" name="itl_start" id="itl_start" value="'.$start.'"/>'.NL.
' <input type="hidden" name="itl_step" id="itl_step" value="'.$step.'"/>'.NL.
' <input type="hidden" name="itl_next" id="itl_next" value="'.$next_start.'"/>'.NL.
' <input type="hidden" name="itl_project" id="itl_project" value="'.$project.'"/>'.NL.
' <input type="hidden" name="it_th_cols" id="it_th_cols" value="'.$data['columns'].'"/>'.NL.
' <input class="itl__buttons" type="button" name="showprevious" value="'.$this->getLang('btn_previuos').'" title="'.$this->getLang('btn_previuos_title').'" onClick="changeAction(1)"/>'.NL.
' <input class="itl__step_input" type="text" name="itl_step" id="itl_step" value="'.$step.'"/>'.NL.
' <input class="itl__buttons" type="button" name="shownext" value="'.$this->getLang('btn_next').'" title="'.$this->getLang('btn_next_title').'" onClick="changeAction(2)"/><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Severity')=== false) $ret .= '<input class="itl__sev_filter" type="text" name="itl_sev_filter" id="itl_sev_filter" value="'.$data['severity'].'"/><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Status')=== false) $ret .= '<input class="itl__stat_filter" type="text" name="itl_stat_filter" id="itl_stat_filter" value="'.$data['status'].'"/><br /></p>'.NL;
$ret .= '</p><p>'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Product')=== false) $ret .= '<input class="itl__prod_filter" type="text" name="itl__prod_filter" id="itl__prod_filter" value="'.$data['product'].'"/><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Version')=== false) $ret .= '<input class="itl__prod_filter" type="text" name="itl__vers_filter" id="itl__vers_filter" value="'.$data['version'].'"/><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Component')=== false) $ret .= '<input class="itl__prod_filter" type="text" name="itl__comp_filter" id="itl__comp_filter" value="'.$data['component'].'"/><br /></p>'.NL;
$ret .= '</p><p>'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Test blocking')=== false) $ret .= '<input type="checkbox" name="itl__block_filter" id="itl__block_filter" ' .$data['tblock'].'/><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Assignee')=== false) $ret .= '<input class="itl__prod_filter" type="text" name="itl__assi_filter" id="itl__assi_filter" value="'.$data['assignee'].'"/><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Filter Reporter')=== false) $ret .= '<input class="itl__prod_filter" type="text" name="itl__user_filter" id="itl__user_filter" value="'.$data['reporter'].'"/><br />'.NL;
$ret .= '</p><p>'.NL;
if(stripos($this->getConf('ltdListFilters'),'MyIssues')=== false) $ret .= '<input type="checkbox" name="itl_myis_filter" id="itl_myis_filter" ' .$data['myissues'].' title="'.$this->getLang('cbx_myissues').'" /><br />'.NL;
if(stripos($this->getConf('ltdListFilters'),'Sort by')=== false) $ret .= '<input class="itl__sev_filter" type="text" name="it_glbl_sort" id="it_glbl_sort" value="'.$data['sort'].'"/><br /></p>'.NL;
$ret .= '</p><input class="itl__buttons" type="button" name="go" value="'.$this->getLang('btn_go').'" title="'.$this->getLang('btn_go').'" onClick="changeAction(3)"/><br />'.NL;
$ret .= '</form>'.NL.
' </td>'.NL.
' <td width="2%"> </td>'.NL.
' <td class="itl__showdtls" align ="left" width="40%">'.NL.
' <form method="post" action="doku.php?id=' . $ID . '&do=showcase">'.NL.
' <label class="it__searchlabel">'.$this->getLang('lbl_showid').'</label>'.NL.
' <input class="itl__sev_filter" type="text" name="showid" id="showid" value="0"/>'.NL.
' <input type="hidden" name="project" id="project" value="'.$project.'"/>'.NL.
' <input type="hidden" name="itl_sev_filter" id="itl_sev_filter" value="'.$data['severity'].'"/>'.NL.
' <input type="hidden" name="itl_stat_filter" id="itl_stat_filter" value="'.$data['status'].'"/>'.NL.
' <input type="hidden" name="itl_myis_filter" id="itl_myis_filter" ' .$data['myissues'].' />'.NL.
' <input class="itl__showid_button" type="submit" name="showcase" id="showcase" value="'.$this->getLang('btn_showid').'" title="'.$this->getLang('btn_showid_title').'"/>'.NL.
' </form><br />'.NL.
' <form method="post" action="doku.php?id=' . $ID . '&do=it_search">'.NL.
' <label class="it__searchlabel">'.$this->getLang('lbl_search').'</label>'.NL.
' <input class="itl__sev_filter" type="text" name="it_str_search" id="it_str_search" value="'.$search.'"/>'.NL.
' <input type="hidden" name="project" id="project" value="'.$project.'"/>'.NL.
' <input class="itl__search_button" type="submit" name="searchcase" id="searchcase" value="'.$this->getLang('btn_search').'" title="'.$this->getLang('btn_search_title').'"/>'.NL.
' </form>'.NL.
' </td>'.NL.
'</tr>'.NL.'</tbody>'.NL.'</table>'.NL.'</div>'.NL;
}
$usr = '<span style="display:none;" id="currentuser">'.$user_grp['userinfo']['name'].'</span>' ; //to log issue mods
$usr .= '<span style="display:none;" id="currentID">'.urlencode($ID).'</span>' ; // to log issue mods
$a_lang = '<span style="display:none;" name="table_kit_OK" id="table_kit_OK">'.$this->getLang('table_kit_OK').'</span>'; // for tablekit.js
$a_lang .= '<span style="display:none;" name="table_kit_Cancel" id="table_kit_Cancel">'.$this->getLang('table_kit_Cancel').'</span>'; // for tablekit.js
$ret = $a_lang.$usr.$ret.$head.$body;
return $ret;
}
/******************************************************************************/
/* pic-up a single value
*/
function _get_one_value($issue, $key) {
if (@array_key_exists($key,$issue))
return $issue[$key];
return '';
}
/******************************************************************************/
/* elaborate the display string of assignee (login, name or mail)
*/
function _get_assignee($issue, $key) {
if(!$issue) return;
if (array_key_exists($key,$issue)) {
global $auth;
global $conf;
$filter['grps'] = $this->getConf('assign');
$usr_array = $auth->retrieveUsers(0,0,$filter);
$shw_assignee_as = trim($this->getConf('shw_assignee_as'));
if(stripos("login, mail, name",$shw_assignee_as) === false) $shw_assignee_as = "login";
foreach ($usr_array as $u_key => $usr)
{ if($usr['mail']==$issue[$key])
{ if ($shw_assignee_as=='login') { return $u_key; }
elseif($shw_assignee_as=='mail') { return $usr['mail']; }
else { return $usr['name']; }
}
}
}
if(stripos("mail",$shw_assignee_as) !== false) return $issue[$key];
else {
$b_display = explode("@",$issue[$key]);
return $b_display[0];
}
}
/******************************************************************************/
/* send an e-mail to admin due to new issue created
*/
function _emailForNewIssue($project,$issue,$email_to)
{
if ($this->getConf('send_email')==1)
{ global $ID;
if ($this->getConf('mail_templates')==1) {
// load user html mail template
$sFilename = DOKU_PLUGIN.'issuetracker/mailtemplate/new_issue_mail.html';
$bodyhtml = file_get_contents($sFilename);
}
$subject=sprintf($this->getLang('issuenew_subject'),$issue['severity'], $project, $issue['product'],$issue['version']);
$subject= mb_encode_mimeheader($subject, "UTF-8", "Q" );
$pstring = sprintf("showid=%s&project=%s", urlencode($issue['id']), urlencode($project));
$body = $this->getLang('issuenew_head').chr(10).chr(10).
$this->getLang('issuenew_intro').chr(10).
$this->getLang('issuemod_title').$issue['title'].chr(10).
$this->getLang('issuemod_issueid').$issue['id'].chr(10).
$this->getLang('issuemod_product').$issue['product'].chr(10).
$this->getLang('issuemod_version').$issue['version'].chr(10).
$this->getLang('issuemod_severity').$issue['severity'].chr(10).
$this->getLang('issuemod_status').$issue['status'].chr(10).
$this->getLang('issuemod_creator').$issue['user_name'].chr(10).
$this->getLang('th_assigned').$issue['assigned'].chr(10).chr(10).
$this->getLang('issuenew_descr').$this->xs_format($issue['description']).chr(10).chr(10).
$this->getLang('issuemod_see').DOKU_URL.'doku.php?id='.$ID.'&do=showcaselink&'.$pstring.chr(10).chr(10).
$this->getLang('issuemod_br').chr(10).$this->getLang('issuemod_end');
$body = html_entity_decode($body);
if ($this->getConf('mail_templates')==1) $bodyhtml = $this->replace_bodyhtml($bodyhtml, $pstring, $project, $issue, $comment);
$from=$email_to ;
$to=$from;
$cc=$issue['add_user_mail'];
if ($this->getConf('mail_templates')==1) {
$headers = "Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable";
$this->mail_send_html($to, $subject, $body, $bodyhtml, $from, $cc, $bcc='', $headers, $params=null);
}
else {
mail_send($to, $subject, $body, $from, $cc, $bcc='', $headers=null, $params=null);
}
}
}
/******************************************************************************/
/***********************************
* HTML Mail functions
*
* Sends HTML-formatted mail
* By Lin Junjie (mail [dot] junjie [at] gmail [dot] com)
*
***********************************/
function mail_send_html($to, $subject, $body, $bodyhtml, $from='', $cc='', $bcc='', $header='', $params=null){
if(defined('MAILHEADER_ASCIIONLY')){
$subject = utf8_deaccent($subject);
$subject = utf8_strip($subject);
}