-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_all_bkp.php
696 lines (658 loc) · 33.4 KB
/
view_all_bkp.php
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
<?php
// ReqHeap - a simple requirement management program.
//
// Copyright (C) 2007 Slav Peev , Matthias Gunter
// Programmed by i-nature.com
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// -----------------------------------------------------------------
//
// Page: "View all" - viewimg all requirements
include("ajax.php");
include("ini/txts/".$_SESSION['chlang']."/state.php");
include("ini/txts/".$_SESSION['chlang']."/component.php");
if ($action=="update" && $ids!="" && ($r_assigned_u_id!="" || $r_p_id!="" || $r_state!="" || $r_priority!="" || $r_source!=""))
{
//checking if the project is not retired
//history
$query="select r.*,p.p_status from requirements r left outer join projects p on r.r_p_id=p.p_id where r.r_id in (".$ids."0)";
$rs = mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_array($rs))
{
if ($row['p_status']==2) $tmp="<span class='error'>".$lng[17][43]."</span><br><br>";
else
{
$query="insert into requirements_history (r_parent_id, r_p_id, r_c_id, r_s_id, r_u_id, r_assigned_u_id, r_name, r_desc, r_state, r_type_r, r_priority, r_valid, r_link, r_satisfaction, r_dissatisfaction, r_conflicts, r_depends, r_component, r_source, r_risk, r_complexity, r_weight, r_points, r_creation_date, r_change_date, r_accept_date, r_accept_user, r_version, r_save_date, r_save_user, r_parent_id2, r_pos, r_stub, r_keywords, r_userfield1, r_userfield2, r_userfield3, r_userfield4, r_userfield5, r_userfield6) values ('".$row['r_id']."','".escapeChars($row['r_p_id'])."','".escapeChars($row['r_c_id'])."','".escapeChars($row['r_s_id'])."','".escapeChars($row['r_u_id'])."','".$row['r_assigned_u_id']."','".escapeChars($row['r_name'])."','".escapeChars($row['r_desc'])."','".escapeChars($row['r_state'])."','".escapeChars($row['r_type_r'])."','".escapeChars($row['r_priority'])."','".escapeChars($row['r_valid'])."','".escapeChars($row['r_link'])."','".escapeChars($row['r_satisfaction'])."','".escapeChars($row['r_dissatisfaction'])."','".escapeChars($row['r_conflicts'])."','".escapeChars($row['r_depends'])."','".escapeChars($row['r_component'])."','".escapeChars($row['r_source'])."','".escapeChars($row['r_risk'])."','".escapeChars($row['r_complexity'])."','".escapeChars($row['r_weight'])."','".escapeChars($row['r_points'])."','".escapeChars($row['r_creation_date'])."','".escapeChars($row['r_change_date'])."','".escapeChars($row['r_accept_date'])."','".escapeChars($row['r_accept_user'])."','".escapeChars($row['r_version'])."',DATE_ADD( NOW( ) , INTERVAL - ".TIME_DIFF_HOURS." HOUR),'".$_SESSION['uid']."','".escapeChars($row['r_parent_id'])."','".escapeChars($row['r_pos'])."','".escapeChars($row['r_stub'])."','".escapeChars($row['r_keywords'])."','".escapeChars($row['r_userfield1'])."','".escapeChars($row['r_userfield2'])."','".escapeChars($row['r_userfield3'])."','".escapeChars($row['r_userfield4'])."','".escapeChars($row['r_userfield5'])."','".escapeChars($row['r_userfield6'])."')";
mysql_query($query) or die(mysql_error());
//assigned user
if ($r_assigned_u_id!="") $q.=", r_assigned_u_id='".escapeChars($r_assigned_u_id)."' ";
//project
if ($r_p_id!="") $q.=", r_p_id='".escapeChars($r_p_id)."' ";
//state
//if ($_SESSION['rights']==1 || $_SESSION['rights']==2 || $_SESSION['rights']==3)
if ($r_state!="")
{
//if accepted date and user should be added
if ($r_state=="1" && $row['r_state']!=1) $q.=", r_state='".escapeChars($r_state)."', r_accept_date=DATE_ADD( NOW( ) , INTERVAL - ".TIME_DIFF_HOURS." HOUR), r_accept_user='".$_SESSION['uid']."'";
else $q.=", r_state='".escapeChars($r_state)."'";
}
//priority
if ($r_priority!="") $q.=", r_priority='".escapeChars($r_priority)."' ";
//source
if ($r_source!="") $q.=", r_source='".escapeChars($r_source)."' ";
$query="update requirements set r_version=r_version+1, r_change_date=DATE_ADD( NOW( ) , INTERVAL - ".TIME_DIFF_HOURS." HOUR) ".$q." where r_id=".$row['r_id'];
mysql_query($query) or die(mysql_error());
}
}
}
?>
<?if ($tmp!="") echo $tmp;?>
<div id="debug" name="debug">aa</div>
<form method="post" action="" name="req">
<input type=hidden name=from value="<?=$from?>">
<input type=hidden name=order value="">
<input type=hidden name=ids value="">
<input type=hidden name=action value="">
<input type=hidden name=filter11 value="">
<table border="0" width="100%">
<tr valign="top">
<td>
<table border="0" cellpadding="2" cellspacing="2" class="content" width="50%">
<tr>
<td align="left" class="gray" nowrap>
<?=$lng[17][3]?>: <select name=filter1>
<option value="">--
<?
//users list
$query4="select u_name, u_id from users where u_rights in (0,1,2,3,4,5) order by u_name asc";
$rs4 = mysql_query($query4) or die(mysql_error());
while($row4=mysql_fetch_array($rs4))
{
echo "<option value='".$row4['u_id']."'>".htmlspecialchars($row4['u_name']);
}
?>
</select>
<script>
for (i=0;i<document.forms.req.filter1.length;i++)
if (document.forms.req.filter1.options[i].value=='<?=$filter1?>')
document.forms.req.filter1.options[i].selected=true;
</script>
<?=$lng[17][16]?>: <select name=filter2>
<option value="">--
<?//state list
include("ini/txts/".$_SESSION['chlang']."/state.php");
echo makeSelect($state_array,$r_state);
?>
</select>
<script>
for (i=0;i<document.forms.req.filter2.length;i++)
if (document.forms.req.filter2.options[i].value=='<?=$filter2?>')
document.forms.req.filter2.options[i].selected=true;
</script>
<?=$lng[17][5]?>: <select name=filter4>
<option value="">--
<option value='1'>1 <?=$lng[15][101]?>
<option value='2'>2
<option value='3'>3
<option value='4'>4
<option value='5'>5
<option value='6'>6
<option value='7'>7
<option value='8'>8
<option value='9'>9
<option value='10'>10 <?=$lng[15][102]?>
</select>
<script>
for (i=0;i<document.forms.req.filter4.length;i++)
if (document.forms.req.filter4.options[i].value=='<?=$filter4?>')
document.forms.req.filter4.options[i].selected=true;
</script>
<?=$lng[17][4]?>:
<select name="filter6">
<option value="">--
<?
//users list
$query4="select u_name, u_id from users where u_rights in (0,1,2,3,4,5) order by u_name asc";
$rs4 = mysql_query($query4) or die(mysql_error());
while($row4=mysql_fetch_array($rs4))
{
if ($row4['u_id']==$filter6) echo "<option value='".$row4['u_id']."' selected>".htmlspecialchars($row4['u_name']);
else echo "<option value='".$row4['u_id']."'>".htmlspecialchars($row4['u_name']);
}
?>
</select>
<?=$lng[17][36]?>:
<select name="filter7">
<option value="">--
<?
//releases list
$query4="select * from releases order by r_name asc";
$rs4 = mysql_query($query4) or die(mysql_error());
while($row4=mysql_fetch_array($rs4))
{
if ($row4['r_id']==$filter7) echo "<option value='".$row4['r_id']."' selected>".htmlspecialchars($row4['r_name']);
else echo "<option value='".$row4['r_id']."'>".htmlspecialchars($row4['r_name']);
}
?>
</select>
</td>
</tr>
<tr>
<td align="left" class="gray" nowrap valign="top">
<?=$lng[17][42]?>: <select name=filter8>
<option value="">--
<?//state list
include("ini/txts/".$_SESSION['chlang']."/component.php");
echo makeSelect($component_array,$r_component);
?>
</select>
<script>
for (i=0;i<document.forms.req.filter8.length;i++)
if (document.forms.req.filter8.options[i].value=='<?=$filter8?>')
document.forms.req.filter8.options[i].selected=true;
</script>
<?=$lng[17][45]?>: <select name=filter9>
<option value="0"><?=$lng[17][46]?>
<option value="1"><?=$lng[17][47]?>
<option value="2"><?=$lng[17][51]?>
</select>
<script>
for (i=0;i<document.forms.req.filter9.length;i++)
if (document.forms.req.filter9.options[i].value=='<?=$filter9?>')
document.forms.req.filter9.options[i].selected=true;
</script>
<?=$lng[17][48]?>: <select name=filter10>
<option value="0"><?=$lng[17][49]?>
<option value="1"><?=$lng[17][50]?>
</select>
<script>
for (i=0;i<document.forms.req.filter10.length;i++)
if (document.forms.req.filter10.options[i].value=='<?=$filter10?>')
document.forms.req.filter10.options[i].selected=true;
</script>
</td>
</tr>
<tr valign="top">
<td align="left" class="gray" nowrap valign="top">
<table border=0 cellspacing=0 cellpadding=0>
<tr valign="top">
<td valign="top" rowspan="2">
<?=$lng[17][52]?>:
</td>
<td rowspan="2">
<select name=filter11_tmp multiple size=3>
<?
//keywords list
$query4="select * from keywords order by k_name asc";
$rs4 = mysql_query($query4) or die(mysql_error());
while($row4=mysql_fetch_array($rs4))
{
if (strstr(",".$filter11,",".$row4['k_id'].",")) echo "<option value='".$row4['k_id']."' selected>".htmlspecialchars($row4['k_name']);
else echo "<option value='".$row4['k_id']."'>".htmlspecialchars($row4['k_name']);
}
?>
</select>
<script>
for (i=0;i<document.forms.req.filter11.length;i++)
if (document.forms.req.filter11.options[i].value=='<?=$filter11?>')
document.forms.req.filter11.options[i].selected=true;
</script>
</td>
<td>
<img src="x.gif" width=8 height=1><?=$lng[17][53]?> <input type="radio" name="filter12" value="<?=$lng[17][53]?>" <?if ($filter12=="" || $filter12==$lng[17][53]) echo "checked";?>>
</td>
<td rowspan="2">
<?=$lng[17][55]?>:
<select name=filter13>
<option value="">--
<option value="1"><?=$lng[17][56]?>
<option value="2"><?=$lng[17][57]?>
<option value="3"><?=$lng[17][58]?>
<option value="5"><?=$lng[17][60]?>
<option value="6"><?=$lng[17][61]?>
</select>
<script>
for (i=0;i<document.forms.req.filter13.length;i++)
if (document.forms.req.filter13.options[i].value=='<?=$filter13?>')
document.forms.req.filter13.options[i].selected=true;
</script>
</td>
<td rowspan="2">
<?=$lng[17][18]?>: <input type="text" size=30 name="filter5" value="<?=stripslashes(htmlspecialchars($filter5))?>"> <input type="button" onclick="sub_search();" value="<?=$lng[17][17]?>">
</td>
</tr>
<tr>
<td>
<?=$lng[17][54]?> <input type="radio" name="filter12" value="<?=$lng[17][54]?>"<?if ($filter12==$lng[17][54]) echo "checked";?>>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td><?if ($_SESSION['_viewalltype']==0) {echo "<br/>".$lng[17][62];echo "<br/>".$lng[17][63];}?>
<br></td>
</tr>
<tr valign="top">
<td width="50%">
<table <?if ($_SESSION['_viewalltype']==0) echo "id='table-1'";?> border="0" cellpadding="2" cellspacing="2" class="content" width="50%">
<?
//sortable columns
if ($order=="") $order="r_change_date desc";
//search
if ($filter1!="") $search.=" and r.r_u_id=".$filter1;
if ($filter2!="") $search.=" and r.r_state=".$filter2;
if ($filter4!="") $search.=" and r.r_priority=".$filter4;
if ($filter5!="") $search.=" and (r.r_name like ('%".escapeChars($filter5)."%') or r.r_desc like ('%".escapeChars($filter5)."%') or r.r_source like ('%".escapeChars($filter5)."%') or p.p_name like ('%".escapeChars($filter5)."%'))";
if ($filter6!="") $search.=" and r.r_assigned_u_id=".$filter6;
if ($filter7!="")
{
$query4="select * from project_releases where pr_r_id=".$filter7;
$rs4 = mysql_query($query4) or die(mysql_error());
$new_pr="(0";
while($row4=mysql_fetch_array($rs4))
{
$new_pr.=",".$row4['pr_p_id'];
}
$new_pr.=")";
$search.=" and r.r_p_id in ".$new_pr;
}
if ($filter8!="") $search.=" and r.r_component=".$filter8;
if ($filter9=="1") $search.=" and r.r_stub=".$filter9;
elseif ($filter9=="2") $search.=" and r.r_stub=".$filter9;
if ($filter10=="1")
{
$query4="select * from comments where c_question=1";
$rs4 = mysql_query($query4) or die(mysql_error());
$new_pr2="(0";
while($row4=mysql_fetch_array($rs4))
{
$new_pr2.=",".$row4['c_r_id'];
}
$new_pr2.=")";
$search.=" and r.r_id in ".$new_pr2;
}
if ($filter11!="")
{
$cnt_k=0;
$search.=" and (";
$kwrds = explode(",", $filter11);
while (list ($key, $val) = each ($kwrds))
{
if ($val!="")
{
if ($cnt_k==0) $search.=" CONCAT(',',r.r_keywords) like ('%,".$val.",%')";
else $search.=" ".$filter12." CONCAT(',',r.r_keywords) like ('%,".$val.",%')";
$cnt_k++;
}
}
$search.=")";
}
if ($filter13!="")
{
if ($filter13==1) $search.=" and r.r_u_id='0'";
elseif ($filter13==2) $search.=" and r.r_assigned_u_id='0'";
elseif ($filter13==3) $search.=" and r.r_component=''";
//elseif ($filter13==4) $search.=" and r.r_assigned_u_id='0'";
elseif ($filter13==5) $search.=" and r.r_keywords=''";
elseif ($filter13==6) $search.=" and r.r_c_id=''";
}
//paging query, number of results (from the param.php file) per page displayed
$paging=$PPAGE;
$query="select count(*) from requirements r left outer join projects p on r.r_p_id=p.p_id where r.r_p_id in (".$project_list.")".$search;
$rs = mysql_query($query) or die(mysql_error());
if($row=mysql_fetch_array($rs)) $all_count=$row[0];
if ($from=="") $from=0;
if ($from+$paging>$all_count) $cnt2=$all_count;
else $cnt2=$from+$paging;
?>
<tr class="gray">
<td colspan="13"> <b><?=$lng[4][3]?> (<?=($all_count==0)?"0":($from+1)?> - <?=$cnt2?> / <?=$all_count?> )</b></td>
</tr>
<tr class="light_blue">
<td> </td>
<td align=center> <a href="#" onclick="document.forms['req'].order.value='r.r_id <?if ($order=='r.r_id asc') echo "desc";else echo "asc";?>';document.forms['req'].submit();"><?=$lng[17][1]?></a></td>
<?if ($_SESSION['_viewalltype']==0) {?><td align=center> <?=$lng[17][44]?></td><?}?>
<td width=200> <a href="#" onclick="document.forms['req'].order.value='r.r_name <?if ($order=='r.r_name asc') echo "desc";else echo "asc";?>';document.forms['req'].submit();"><?=$lng[17][2]?></a></td>
<td nowrap> <a href="#" onclick="document.forms['req'].order.value='p.p_name <?if ($order=='p.p_name asc') echo "desc";else echo "asc";?>';document.forms['req'].submit();"><?=$lng[17][7]?></a></td>
<td nowrap> <a href="#" onclick="document.forms['req'].submit();"><?=$lng[17][36]?></a></td>
<td nowrap> <a href="#" onclick="document.forms['req'].order.value='u.u_name <?if ($order=='u.u_name asc') echo "desc";else echo "asc";?>';document.forms['req'].submit();"><?=$lng[17][3]?></a></td>
<td nowrap> <a href="#" onclick="document.forms['req'].order.value='r.r_state <?if ($order=='r.r_state asc') echo "desc";else echo "asc";?>';document.forms['req'].submit();"><?=$lng[17][16]?></a></td>
<td nowrap> <a href="#" onclick="document.forms['req'].order.value='u_name2 <?if ($order=='u_name2 asc') echo "desc";else echo "asc";?>';document.forms['req'].submit();"><?=$lng[17][4]?></a></td>
<td nowrap> <a href="#" onclick="document.forms['req'].order.value='r.r_priority <?if ($order=='r.r_priority asc') echo "desc";else echo "asc";?>';document.forms['req'].submit();"><?=$lng[17][5]?></a></td>
<td nowrap> <a href="#" onclick="document.forms['req'].order.value='r.r_component <?if ($order=='r.r_component asc') echo "desc";else echo "asc";?>';document.forms['req'].submit();"><?=$lng[17][42]?></a></td>
<td nowrap> <a href="#" onclick="document.forms['req'].order.value='r.r_creation_date <?if ($order=='r.r_creation_date asc') echo "desc";else echo "asc";?>';document.forms['req'].submit();"><?=$lng[17][6]?></a></td>
<td nowrap> <a href="#" onclick="document.forms['req'].order.value='r.r_change_date <?if ($order=='r.r_change_date asc') echo "desc";else echo "asc";?>';document.forms['req'].submit();"><?=$lng[17][8]?></a></td>
</tr>
<?
//getting requirements - recently modified
$cnt=0;
//if tree view
if ($_SESSION['_viewalltype']==0)
{
$query="select * from requirements where r_p_id in (".$project_list.") and r_parent_id=0 order by r_pos asc";
$rs = mysql_query($query) or die(mysql_error());
$cnt3=0;
while($row=mysql_fetch_array($rs))
{
$cnt3++;
$arr[]=$cnt3."|".$row['r_id'];
getTree2($row['r_id'],$cnt3,$arr);
}
$tmpOrder="";
while ($cnt3>0 && list ($key, $val) = each ($arr))
{
$query="select r.*, date_format(r.r_creation_date, '%d.%m.%Y %H:%i') as d1, date_format(r.r_change_date, '%d.%m.%Y %H:%i') as d2, p.p_id,p.p_name,u.u_name,u2.u_name as u_name2 from requirements r left outer join projects p on r.r_p_id=p.p_id left outer join users u on r.r_u_id=u.u_id left outer join users u2 on r.r_assigned_u_id=u2.u_id where r_id=".substr($val,strpos($val,"|")+1)." and r.r_p_id in (".$project_list.") ".$search." order by ".$order.", r_change_date desc Limit ".$from.",".$paging;
$rs = mysql_query($query) or die(mysql_error());
if($row=mysql_fetch_array($rs))
{
$cnt++;
if (mktime (0,0,0,date("m"),date("d")-2,date("Y")) < mktime (0,0,0,substr($row['d2'],3,2),substr($row['d2'],0,2),substr($row['d2'],6,4))) $new=1;
else $new=0;
//setting row colours
$cl=$state_colors_array[$row['r_state']];
$tmpOrder.=$row['r_id']."|";
?>
<tr id="<?=$row['r_id']?>" name="<?=substr($val,0,strpos($val,"|"))?>" class="blue" style="background-color:<?=$cl?>;">
<td width="20" valign="middle" align=center><input type="checkbox" name="ch<?=$cnt?>" value="<?=$row['r_id']?>" <?if (strstr(",".$ids,",".$row['r_id'].",")) echo "checked";?>></td>
<td width="30" valign="middle" align=center> <a href="index.php?inc=view_requirement&r_id=<?=$row['r_id']?>"><?=$new?"<b>":""?><?=$row['r_id']?><?=$new?"</b>":""?></a></td>
<td valign="middle" align=left><?for ($i=0;$i<substr_count($val, ".");$i++) echo " ";?> <?=substr($val,0,strpos($val,"|"))?></td>
<td valign="middle"> <?=$new?"<b>":""?><?=htmlspecialchars($row['r_name'])?><?=$new?"</b>":""?></td>
<td valign="middle"> <a href="index.php?inc=view_project&p_id=<?=$row['p_id']?>"><?=$new?"<b>":""?><?=htmlspecialchars($row['p_name'])?><?=$new?"</b>":""?></a></td>
<td valign="middle">
<?
$query2="select r.*, date_format(r.r_date, '%d.%m.%Y') as d1, date_format(r.r_released_date, '%d.%m.%Y') as d2 from project_releases pr left outer join releases r on pr.pr_r_id=r.r_id where pr.pr_p_id='".$row['p_id']."' order by r.r_name asc";
$rs2 = mysql_query($query2) or die(mysql_error());
while($row2=mysql_fetch_array($rs2))
{
echo "<a href='index.php?inc=view_release&r_id=".$row2['r_id']."'>".htmlspecialchars($row2['r_name'])."</a>";
echo "; ";
}
?>
</td>
<td valign="middle"> <?=$new?"<b>":""?><?=htmlspecialchars($row['u_name'])?><?=$new?"</b>":""?></td>
<td valign="middle">
<?=$new?"<b>":""?>
<?
include("ini/txts/".$_SESSION['chlang']."/state.php");
echo $state_array[$row['r_state']];
?>
<?=$new?"</b>":""?>
</td>
<td valign="middle"> <?=$new?"<b>":""?><?=htmlspecialchars($row['u_name2'])?><?=$new?"</b>":""?></td>
<td valign="middle"> <?=$new?"<b>":""?><?=htmlspecialchars($row['r_priority'])?><?=$new?"</b>":""?></td>
<td valign="middle"> <?=$new?"<b>":""?><?=$component_array[$row['r_component']]?><?=$new?"</b>":""?></td>
<td valign="middle" width="110"> <?=$new?"<b>":""?><?=htmlspecialchars($row['d1'])?><?=$new?"</b>":""?></td>
<td valign="middle" width="110"> <?=$new?"<b>":""?><?=($row['d2']!="00.00.0000 00:00")?$row['d2']:"(".$row['d1'].")"?><?=$new?"</b>":""?></td>
</tr>
<? }
}
}
else //if normal view selected
{
$query="select r.*, date_format(r.r_creation_date, '%d.%m.%Y %H:%i') as d1, date_format(r.r_change_date, '%d.%m.%Y %H:%i') as d2, p.p_id,p.p_name,u.u_name,u2.u_name as u_name2 from requirements r left outer join projects p on r.r_p_id=p.p_id left outer join users u on r.r_u_id=u.u_id left outer join users u2 on r.r_assigned_u_id=u2.u_id where r.r_p_id in (".$project_list.") ".$search." order by ".$order.", r_change_date desc Limit ".$from.",".$paging;
$rs = mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_array($rs))
{
$cnt++;
if (mktime (0,0,0,date("m"),date("d")-2,date("Y")) < mktime (0,0,0,substr($row['d2'],3,2),substr($row['d2'],0,2),substr($row['d2'],6,4))) $new=1;
else $new=0;
//setting row colours
$cl=$state_colors_array[$row['r_state']];
?>
<tr class="blue" style="background-color:<?=$cl?>;">
<td width="20" valign="middle" align=center><input type="checkbox" name="ch<?=$cnt?>" value="<?=$row['r_id']?>" <?if (strstr(",".$ids,",".$row['r_id'].",")) echo "checked";?>></td>
<td width="30" valign="middle" align=center> <a href="index.php?inc=view_requirement&r_id=<?=$row['r_id']?>"><?=$new?"<b>":""?><?=$row['r_id']?><?=$new?"</b>":""?></a></td>
<td valign="middle"> <?=$new?"<b>":""?><?=htmlspecialchars($row['r_name'])?><?=$new?"</b>":""?></td>
<td valign="middle"> <a href="index.php?inc=view_project&p_id=<?=$row['p_id']?>"><?=$new?"<b>":""?><?=htmlspecialchars($row['p_name'])?><?=$new?"</b>":""?></a></td>
<td valign="middle">
<?
$query2="select r.*, date_format(r.r_date, '%d.%m.%Y') as d1, date_format(r.r_released_date, '%d.%m.%Y') as d2 from project_releases pr left outer join releases r on pr.pr_r_id=r.r_id where pr.pr_p_id='".$row['p_id']."' order by r.r_name asc";
$rs2 = mysql_query($query2) or die(mysql_error());
while($row2=mysql_fetch_array($rs2))
{
echo "<a href='index.php?inc=view_release&r_id=".$row2['r_id']."'>".htmlspecialchars($row2['r_name'])."</a>";
echo "; ";
}
?>
</td>
<td valign="middle"> <?=$new?"<b>":""?><?=htmlspecialchars($row['u_name'])?><?=$new?"</b>":""?></td>
<td valign="middle">
<?=$new?"<b>":""?>
<?
include("ini/txts/".$_SESSION['chlang']."/state.php");
echo $state_array[$row['r_state']];
?>
<?=$new?"</b>":""?>
</td>
<td valign="middle"> <?=$new?"<b>":""?><?=htmlspecialchars($row['u_name2'])?><?=$new?"</b>":""?></td>
<td valign="middle"> <?=$new?"<b>":""?><?=htmlspecialchars($row['r_priority'])?><?=$new?"</b>":""?></td>
<td valign="middle"> <?=$new?"<b>":""?><?=$component_array[$row['r_component']]?><?=$new?"</b>":""?></td>
<td valign="middle" width="110"> <?=$new?"<b>":""?><?=htmlspecialchars($row['d1'])?><?=$new?"</b>":""?></td>
<td valign="middle" width="110"> <?=$new?"<b>":""?><?=($row['d2']!="00.00.0000 00:00")?$row['d2']:"(".$row['d1'].")"?><?=$new?"</b>":""?></td>
</tr>
<?}?>
<?}?>
<?
//displaying paging list
if ($all_count>$paging && $cnt!=0)
{
$j=ceil($all_count/$paging);
for ($i=0,$tmp_c=0;$i<$j;$i++,$tmp_c++)
{
if ($i*$paging==$from) $tmp_paging.=($i+1)." ";
else $tmp_paging.="<a href=# onclick='subm_paging(".($i*$paging).");return false;'>".($i+1)."</a> ";
}
$tmp_paging=substr($tmp_paging,0,strlen($tmp_paging)-1);
}
?>
</table>
<table border="0" cellpadding="2" cellspacing="2" class="content" width="50%">
<? if ($cnt>0 && $tmp_paging!="" && $_SESSION['_viewalltype']!=0){?>
<tr class="gray" align=left>
<td colspan=13 align=left> <b>
<?if ($from>0) echo "<a href=# onclick='subm_paging(".($from-$paging).");return false;'><</a> ";?>
<?=$tmp_paging?>
<?if ($from<$all_count-$paging) echo "<a href=# onclick='subm_paging(".($from+$paging).");return false;'>></a>";?>
</b></td>
</tr>
<?}?>
<?if ($_SESSION['uid']!="" && $_SESSION['rights']!=0) { ?>
<tr class="light_blue">
<td colspan="13"> <b><?=$lng[17][28]?></b></td>
</tr>
<tr class="light_blue" align=left>
<td colspan=13 align=left>
<table cellpadding=0 cellspacing=0 border=0>
<tr class="light_blue" align=left valign=top>
<td align=left valign=top>
<?=$lng[17][35]?>: <br>
<select name="r_p_id">
<option value=''><?=$lng[17][38]?>
<?
//projects list
if ($_SESSION['rights']=="") $query_project2="select p_name, p_id from projects where p_status=1 order by p_name asc";
elseif ($_SESSION['rights']=="0" || $_SESSION['rights']=="1" || $_SESSION['rights']=="2" || $_SESSION['rights']=="3") $query_project2="select distinct(p.p_id), p.p_name from projects p left outer join project_users pu on p.p_id=pu.pu_p_id where ((pu.pu_u_id=".$_SESSION['uid']." and p.p_status<>2) or p.p_status=1) order by p.p_name asc";
elseif ($_SESSION['rights']=="4") $query_project2="select distinct(p.p_id), p.p_name from projects p left outer join project_users pu on p.p_id=pu.pu_p_id where (((pu.pu_u_id=".$_SESSION['uid']." or p_leader=".$_SESSION['uid'].") and p.p_status<>2) or p.p_status=1) order by p_name asc";
else $query_project2="select p_name, p_id from projects where p_status<>2 order by p_name asc";
$rs2 = mysql_query($query_project2) or die(mysql_error());
while($row2=mysql_fetch_array($rs2))
{
if ($r_p_id==$row2['p_id']) echo "<option value='".$row2['p_id']."' selected>".htmlspecialchars($row2['p_name']);
else echo "<option value='".$row2['p_id']."'>".htmlspecialchars($row2['p_name']);
}
?>
</select>
</td>
<td align=left valign=top>
<?=$lng[17][37]?>: <br>
<select name="r_assigned_u_id">
<option value='' <?if ($r_assigned_u_id=="") echo "selected";?>><?=$lng[17][26]?>
<option value='0' <?if ($r_assigned_u_id=="0") echo "selected";?>><?=$lng[17][27]?>
<?
//users list
$query4="select u_name, u_id from users where u_rights in (0,1,2,3,4,5) order by u_name asc";
$rs4 = mysql_query($query4) or die(mysql_error());
while($row4=mysql_fetch_array($rs4))
{
if ($row4['u_id']==$r_assigned_u_id) echo "<option value='".$row4['u_id']."' selected>".htmlspecialchars($row4['u_name']);
else echo "<option value='".$row4['u_id']."'>".htmlspecialchars($row4['u_name']);
}
?>
</select>
</td>
<td align=left valign=top>
<?=$lng[17][30]?>: <br>
<select name="r_state">
<option value=''><?=$lng[17][31]?>
<?if ($_SESSION['rights']=="2" || $_SESSION['rights']=="3") echo makeSelect($state_array,$r_state);
else echo makeSelect($state_array2,$r_state);?>
</select>
<script>
for (i=0;i<document.forms.req.r_state.length;i++)
if (document.forms.req.r_state.options[i].value=='<?=$r_state?>')
document.forms.req.r_state.options[i].selected=true;
</script>
</td>
<td align=left valign=top>
<?=$lng[17][39]?>: <br>
<select name="r_priority">
<option value=''><?=$lng[17][40]?>
<option value='1'>1 <?=$lng[15][101]?>
<option value='2'>2
<option value='3'>3
<option value='4'>4
<option value='5'>5
<option value='6'>6
<option value='7'>7
<option value='8'>8
<option value='9'>9
<option value='10'>10 <?=$lng[15][102]?>
</select>
<script>
for (i=0;i<document.forms.req.r_priority.length;i++)
if (document.forms.req.r_priority.options[i].value=='<?=$r_priority?>')
document.forms.req.r_priority.options[i].selected=true;
</script>
</td>
<td align=left valign=top>
<?=$lng[17][41]?>: <br>
<input type="text" name="r_source" value="<?=$r_source?>">
<input type="button" onclick="mov();" value="<?=$lng[17][25]?>">
</td>
</tr>
</table>
</td>
</tr>
<?}?>
</table>
</td>
</tr>
<tr valign="top">
<td><br></td>
</tr>
<tr valign="top">
<td>
<table border="0" cellpadding="2" cellspacing="2" class="content" width="50%">
<tr>
<?for ($i=0;$i<count($state_array);$i++) {?>
<td align="center" class="blue" style="background-color: <?=$state_colors_array[$i]?>;" width="12.5%"> <?=$state_array[$i]?></td>
<?}?>
<!--td align="center" class="red" width="17%"> <?=$lng[17][12]?></td>
<td align="center" class="violet" width="17%"> <?=$lng[17][13]?></td>
<td align="center" class="green" width="17%"> <?=$lng[17][14]?></td>
<td align="center" class="yellow" width="17%"> <?=$lng[17][15]?></td>
<td align="center" class="orange" width="17%"> <?=$lng[17][10]?></td>
<td align="center" class="gray" width="17%"> <?=$lng[17][11]?></td-->
</tr>
</table>
</td>
</tr>
</table>
</form>
<form method=post name=form_paging action="">
<input type=hidden name=from value="">
<input type=hidden name=filter1 value="<?=$filter1?>">
<input type=hidden name=filter2 value="<?=$filter2?>">
<input type=hidden name=filter4 value="<?=$filter4?>">
<input type=hidden name=filter5 value="<?=$filter5?>">
<input type=hidden name=filter6 value="<?=$filter6?>">
<input type=hidden name=filter7 value="<?=$filter7?>">
<input type=hidden name=filter8 value="<?=$filter8?>">
<input type=hidden name=filter9 value="<?=$filter9?>">
<input type=hidden name=filter10 value="<?=$filter10?>">
<input type=hidden name=order value="<?=$order?>">
</form>
<script>
function subm_paging(who)
{
document.forms['form_paging'].from.value=who;
document.forms['form_paging'].submit();
}
function mov()
{
for (i=1;i<<?=$cnt?>+1;i++)
if (document.forms['req'].elements['ch'+i].checked)
document.forms['req'].ids.value+=document.forms['req'].elements['ch'+i].value+",";
document.forms['req'].action.value="update";
if (document.forms['req'].ids.value!="" && (document.forms['req'].r_p_id.value!="" || document.forms['req'].r_assigned_u_id.value!="" || document.forms['req'].r_state.value!="" || document.forms['req'].r_priority.value!="" || document.forms['req'].r_source.value!="")) document.forms['req'].submit();
}
function sub_search()
{
df=document.forms['req'];
df.elements.filter11.value="";
for (i=0;i<df.elements.filter11_tmp.options.length;i++)
{
if (df.elements.filter11_tmp.options[i].selected) df.elements.filter11.value+=df.elements.filter11_tmp.options[i].value+",";
}
df.submit();
}
</script>
<?if ($_SESSION['_viewalltype']==0) {?>
<script language="JavaScript1.2" type="text/javascript" src="tablednd.js"></script>
<script language="JavaScript1.2" type="text/javascript">
var table = document.getElementById('table-1');
var tableDnD = new TableDnD();
var tmpOrder = "<?=$tmpOrder?>";
tableDnD.onDrop = function(table, row) {
var rows = this.table.tBodies[0].rows;
var debugStr = "";
for (var i=0; i<rows.length; i++) {
debugStr += rows[i].id+"|";
}
if (debugStr.indexOf(tmpOrder)==-1){
x_submitOrder(debugStr, row.id, showData);
document.getElementById(row.id).style.background='#FCBABA';
}
tmpOrder = debugStr;
}
tableDnD.init(table);
<?php
//include ajax generated javascript functions
sajax_show_javascript();
?>
function showData(q) {
var now = new Date();
document.getElementById('debug').innerHTML="<br>Categories order was updated successfully.<br>"+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds()+"";
}
</script>
<?}?>