1
|
|
|
<?php |
2
|
|
|
// |
3
|
|
|
// Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved |
4
|
|
|
// |
5
|
|
|
// |
6
|
|
|
// |
7
|
|
|
// Parts of code come from bug_util.php (written by Laurent Julliard) |
8
|
|
|
// |
9
|
|
|
// Written for Codendi by Stephane Bouhet |
10
|
|
|
// |
11
|
|
|
|
12
|
|
|
require_once('common/event/EventManager.class.php'); |
13
|
|
|
|
14
|
|
|
|
15
|
|
|
class ArtifactReportHtml extends ArtifactReport { |
16
|
|
|
|
17
|
|
|
var $fields_per_line; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Constructor. |
21
|
|
|
* |
22
|
|
|
* @param report_id |
23
|
|
|
* @param atid: the artifact type id |
24
|
|
|
* |
25
|
|
|
* @return boolean success. |
26
|
|
|
*/ |
27
|
|
|
function ArtifactReportHtml($report_id,$atid) { |
28
|
|
|
// echo 'ArtifactReportHtml('.$report_id.','.$atid.')'; |
29
|
|
|
return $this->ArtifactReport($report_id,$atid); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Return the HTML table which displays the priority colors and export button |
34
|
|
|
* |
35
|
|
|
* @param msg: the label of te table |
36
|
|
|
* |
37
|
|
|
* @return string |
38
|
|
|
*/ |
39
|
|
|
function showPriorityColorsKey($msg,$aids,$masschange,$pv) { |
40
|
|
|
$hp = Codendi_HTMLPurifier::instance(); |
41
|
|
|
global $Language,$group_id; |
42
|
|
|
$html_result = ""; |
43
|
|
|
|
44
|
|
|
if (!$masschange) { |
45
|
|
|
$html_result .= '<table width="100%"><tr><td align="left" width="50%">'; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
$html_result .= '<P class="small"><B>'.($msg ? $msg : $Language->getText('tracker_include_report','prio_colors')).'</B><BR><TABLE BORDER=0><TR>'; |
49
|
|
|
|
50
|
|
|
for ($i=1; $i<10; $i++) { |
51
|
|
|
$html_result .= '<TD class="'.get_priority_color($i).'">'.$i.'</TD>'; |
52
|
|
|
} |
53
|
|
|
$html_result .= '</TR></TABLE>'; |
54
|
|
|
|
55
|
|
|
if ((!$masschange)&&($pv == 0)) { |
56
|
|
|
$html_result .= '</td><td align="right" width="50%">'; |
57
|
|
|
$html_result .= ' |
58
|
|
|
<FORM ACTION="" METHOD="POST" NAME="artifact_export_form"> |
59
|
|
|
<INPUT TYPE="HIDDEN" NAME="atid" VALUE="'.(int)$this->group_artifact_id.'"> |
60
|
|
|
<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="'.(int)$group_id.'"> |
61
|
|
|
<INPUT TYPE="HIDDEN" NAME="func" VALUE="export"> |
62
|
|
|
<INPUT TYPE="HIDDEN" NAME="export_aids" VALUE="'. $hp->purify(implode(",",$aids), CODENDI_PURIFIER_CONVERT_HTML) .'"> |
63
|
|
|
<input type="checkbox" name="only_displayed_fields" /> <small>'.$Language->getText('tracker_include_report','export_only_report_fields').'</small><br /> |
64
|
|
|
<FONT SIZE="-1"><INPUT TYPE="SUBMIT" VALUE="'.$Language->getText('tracker_include_report','btn_export').'"></FONT><br /> |
65
|
|
|
<input type="hidden" name="report_id" value="'.(int)$this->getReportId().'" /> |
66
|
|
|
</FORM>'; |
67
|
|
|
|
68
|
|
|
$html_result .= '</td></tr></table>'; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
return $html_result; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Check is a sort criteria is already in the list of comma |
76
|
|
|
* separated criterias. If so invert the sort order, if not then |
77
|
|
|
* simply add it |
78
|
|
|
* |
79
|
|
|
* @param criteria_list: the criteria list |
80
|
|
|
* @param order: the order chosen by the UI |
81
|
|
|
* @param msort: if multi sort is activate |
82
|
|
|
* |
83
|
|
|
* @return string |
84
|
|
|
*/ |
85
|
|
|
function addSortCriteria($criteria_list, $order, $msort) |
86
|
|
|
{ |
87
|
|
|
//echo "<br>DBG \$criteria_list=$criteria_list,\$order=$order"; |
88
|
|
|
$found = false; |
89
|
|
|
if ($criteria_list) { |
90
|
|
|
$arr = explode(',',$criteria_list); |
91
|
|
|
$i = 0; |
92
|
|
|
while (list(,$attr) = each($arr)) { |
93
|
|
|
preg_match("/\s*([^<>]*)([<>]*)/", $attr,$match); |
94
|
|
|
list(,$mattr,$mdir) = $match; |
95
|
|
|
//echo "<br>DBG \$mattr=$mattr,\$mdir=$mdir"; |
96
|
|
|
if ($mattr == $order) { |
97
|
|
|
if ( ($mdir == '>') || (!isset($mdir)) ) { |
98
|
|
|
$arr[$i] = $order.'<'; |
99
|
|
|
} else { |
100
|
|
|
$arr[$i] = $order.'>'; |
101
|
|
|
} |
102
|
|
|
$found = true; |
103
|
|
|
} |
104
|
|
|
$i++; |
105
|
|
|
} |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
if (!$found) { |
109
|
|
|
if (!$msort) { unset($arr); } |
110
|
|
|
if ( ($order == 'severity') || ($order == 'hours') ) { |
111
|
|
|
// severity, effort and dates sorted in descending order by default |
112
|
|
|
$arr[] = $order.'<'; |
113
|
|
|
} else { |
114
|
|
|
$arr[] = $order.'>'; |
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
//echo "<br>DBG \$arr[]=".join(',',$arr); |
119
|
|
|
|
120
|
|
|
return(join(',', $arr)); |
121
|
|
|
|
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Transform criteria list to readable text statement |
126
|
|
|
* $url must not contain the morder parameter |
127
|
|
|
* |
128
|
|
|
* @param criteria_list: the criteria list |
129
|
|
|
* @param url: HTTP Get variables to add |
130
|
|
|
* |
131
|
|
|
* @return string |
132
|
|
|
*/ |
133
|
|
|
function criteriaListToText($criteria_list, $url) { |
134
|
|
|
|
135
|
|
|
global $art_field_fact; |
136
|
|
|
$arr_text = array(); |
137
|
|
|
if ($criteria_list) { |
138
|
|
|
|
139
|
|
|
$arr = explode(',',$criteria_list); |
140
|
|
|
$morder=''; |
141
|
|
|
while (list(,$crit) = each($arr)) { |
142
|
|
|
|
143
|
|
|
$morder .= ($morder ? ",".$crit : $crit); |
144
|
|
|
$attr = str_replace('>','',$crit); |
145
|
|
|
$attr = str_replace('<','',$attr); |
146
|
|
|
|
147
|
|
|
$field = $art_field_fact->getFieldFromName($attr); |
148
|
|
|
if ( $field && $field->isUsed() ) { |
149
|
|
|
$label = $field->getLabel(); |
150
|
|
|
$arr_text[] = '<a href="'.$url.'&morder='.urlencode($morder).'#results">'. |
151
|
|
|
$label.'</a><img src="'.util_get_dir_image_theme(). |
152
|
|
|
((substr($crit, -1) == '<') ? 'dn' : 'up'). |
153
|
|
|
'_arrow.png" border="0">'; |
154
|
|
|
} |
155
|
|
|
} |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
return join(' > ',$arr_text); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* Display the HTML code to display the query fields |
163
|
|
|
* |
164
|
|
|
* @param prefs: array of parameters used for the current query |
165
|
|
|
* @param advsrch,pv: HTTP get variables |
166
|
|
|
* |
167
|
|
|
* @return string |
168
|
|
|
* |
169
|
|
|
*/ |
170
|
|
|
function displayQueryFields($prefs,$advsrch,$pv) { |
171
|
|
|
global $ath,$Language; |
172
|
|
|
$hp = Codendi_HTMLPurifier::instance(); |
173
|
|
|
$html_select = ''; |
174
|
|
|
// |
175
|
|
|
// Loop through the list of used fields to define label and fields/boxes |
176
|
|
|
// used as search criteria |
177
|
|
|
// |
178
|
|
|
$query_fields = $this->getQueryFields(); |
179
|
|
|
|
180
|
|
|
//the width has been removed to correct the display of the Query Form (related to the fix of STTab theme) |
181
|
|
|
$html_select .= "<table>"; |
182
|
|
|
$labels = ''; |
183
|
|
|
$boxes = ''; |
184
|
|
|
// Number of search criteria (boxes) displayed in one row |
185
|
|
|
$this->fields_per_line = 5; |
186
|
|
|
|
187
|
|
|
$ib=0;$is=0; |
188
|
|
|
$load_cal=false; |
189
|
|
|
|
190
|
|
|
while (list($key,$field) = each($query_fields) ) { |
|
|
|
|
191
|
|
|
|
192
|
|
|
$field_html = new ArtifactFieldHtml($field); |
193
|
|
|
|
194
|
|
|
//echo $field->getName()."-".$field->display_type."-".$field->data_type."-".$field->dump()."<br>"; |
195
|
|
|
|
196
|
|
|
// beginning of a new row |
197
|
|
|
if ($ib % $this->fields_per_line == 0) { |
198
|
|
|
$align = "left"; |
199
|
|
|
$labels .= "\n".'<TR align="'.$align.'" valign="top">'; |
200
|
|
|
$boxes .= "\n".'<TR align="'.$align.'" valign="top">'; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
// Need to build help button argument. |
204
|
|
|
// Concatenate 3 args in one string |
205
|
|
|
$group_id = $ath->Group->getID(); |
206
|
|
|
$help_args = $group_id.'|'.$this->group_artifact_id.'|'.$field->getName(); |
207
|
|
|
$labels .= '<td class="small"><b>'. $hp->purify(SimpleSanitizer::unsanitize($field->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) .' '. |
208
|
|
|
help_button('browse_tracker_query_field',$help_args). |
209
|
|
|
'</b></td>'; |
210
|
|
|
|
211
|
|
|
$boxes .= '<TD><FONT SIZE="-1">'; |
212
|
|
|
|
213
|
|
|
if ( $field->isSelectBox() ) { |
214
|
|
|
|
215
|
|
|
// Check for advanced search if you have the field in the $prefs (HTTP parameters) |
216
|
|
|
if ( $advsrch ) { |
217
|
|
|
if ( isset($prefs[$field->getName()]) && $prefs[$field->getName()] ) { |
218
|
|
|
if ( is_array($prefs[$field->getName()]) ) { |
219
|
|
|
$values = $prefs[$field->getName()]; |
220
|
|
|
} else { |
221
|
|
|
$values[] = $prefs[$field->getName()]; |
222
|
|
|
} |
223
|
|
|
} else { |
224
|
|
|
$values[] = 0; |
225
|
|
|
} |
226
|
|
|
} else { |
227
|
|
|
if (isset($prefs[$field->getName()][0])) |
228
|
|
|
$values = $prefs[$field->getName()][0]; |
229
|
|
|
else $values=""; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
$boxes .= |
233
|
|
|
$field_html->display($this->group_artifact_id,$values, |
234
|
|
|
false,false,($pv != 0?true:false),false,true,$Language->getText('global','none'), true,$Language->getText('global','any')); |
235
|
|
|
|
236
|
|
|
} else if ( $field->isMultiSelectBox() ) { |
237
|
|
|
$boxes .= |
238
|
|
|
$field_html->display($this->group_artifact_id, |
239
|
|
|
$prefs[$field->getName()], |
240
|
|
|
false,false,($pv != 0?true:false),false,true,$Language->getText('global','none'), true,$Language->getText('global','any')); |
241
|
|
|
|
242
|
|
|
} else if ($field->isDateField() ){ |
243
|
|
|
|
244
|
|
|
$load_cal = true; // We need to load the Javascript Calendar |
245
|
|
|
if ($advsrch) { |
246
|
|
|
$date_begin = isset($prefs[$field->getName()][0]) ? $prefs[$field->getName()][0] : ''; |
247
|
|
|
$date_end = isset($prefs[$field->getName().'_end'][0]) ? $prefs[$field->getName().'_end'][0] : ''; |
248
|
|
|
$boxes .= $field_html->multipleFieldDate($date_begin, $date_end, 0, 0, $pv); |
249
|
|
|
} else { |
250
|
|
|
$val_op = isset($prefs[$field->getName().'_op'][0]) ? $prefs[$field->getName().'_op'][0] : ''; |
251
|
|
|
$val = isset($prefs[$field->getName()][0]) ? $prefs[$field->getName()][0] : ''; |
252
|
|
|
$boxes .= $field_html->fieldDateOperator($val_op, $pv) . $field_html->fieldDate($val, $pv); |
253
|
|
|
} |
254
|
|
|
|
255
|
|
|
} else if ( $field->isTextField() || |
256
|
|
|
$field->isTextArea() ) { |
257
|
|
|
$val=isset($prefs[$field->getName()][0])?$prefs[$field->getName()][0]:""; |
258
|
|
|
$boxes .= |
259
|
|
|
($pv != 0 ? $val : $field_html->fieldText(stripslashes($val),15,80)) ; |
260
|
|
|
|
261
|
|
|
} |
262
|
|
|
$boxes .= "</TD>\n"; |
263
|
|
|
|
264
|
|
|
$ib++; |
265
|
|
|
|
266
|
|
|
// end of this row |
267
|
|
|
if ($ib % $this->fields_per_line == 0) { |
268
|
|
|
$html_select .= $labels.'</TR>'.$boxes.'</TR>'; |
269
|
|
|
$labels = $boxes = ''; |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
// Make sure the last few cells are in the table |
275
|
|
|
if ($labels) { |
276
|
|
|
$html_select .= $labels.'</TR>'.$boxes.'</TR>'; |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
$html_select .= "</table>"; |
280
|
|
|
|
281
|
|
|
return $html_select; |
282
|
|
|
|
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
function getFieldsSelectbox($name, $label, $used, $ath) { |
286
|
|
|
$html_result = ''; |
287
|
|
|
$html_result .= '<select name="'. $name .'" onchange="this.form.submit();">'; |
288
|
|
|
$html_result .= '<option selected="selected" value="">'. $label .'</option>'; |
289
|
|
|
$afsf = new ArtifactFieldSetFactory($ath); |
290
|
|
|
foreach($afsf->getAllFieldSets() as $fieldset) { |
291
|
|
|
$html_result .= '<optgroup label="'. $fieldset->getLabel() .'">'; |
292
|
|
|
foreach($fieldset->getArtifactFields() as $field) { |
293
|
|
|
if ($field->isUsed()) { |
294
|
|
|
$highlight = ''; |
295
|
|
|
if ($field->getName() != 'comment_type_id') { |
296
|
|
|
if (isset($used[$field->getName()])) { |
297
|
|
|
$highlight = 'boxhighlight'; |
298
|
|
|
} |
299
|
|
|
$html_result .= '<option value="'. $field->getName() .'" class="'. $highlight .'">'; |
300
|
|
|
$html_result .= $field->getLabel(); |
301
|
|
|
$html_result .= '</option>'; |
302
|
|
|
} |
303
|
|
|
} |
304
|
|
|
} |
305
|
|
|
$html_result .= '</optgroup>'; |
306
|
|
|
} |
307
|
|
|
$html_result .= '</select>'; |
308
|
|
|
return $html_result; |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
/** |
312
|
|
|
* Return the HTML code to display the results of the query fields |
313
|
|
|
* |
314
|
|
|
* @param group_id: the group id |
315
|
|
|
* @param prefs: array of parameters used for the current query |
316
|
|
|
* @param total_rows: number of rows of the result |
317
|
|
|
* @param url: HTTP Get variables to add |
318
|
|
|
* @param nolink: link to detailartifact |
319
|
|
|
* @param offset,chunksz,morder,advsrch,offset,chunksz: HTTP get variables |
320
|
|
|
* |
321
|
|
|
* @return string |
322
|
|
|
* |
323
|
|
|
*/ |
324
|
|
|
function showResult ($group_id,$prefs,$offset,$total_rows,$url,$nolink,$chunksz,$morder,$advsrch,$chunksz,$aids,$masschange=false,$pv) { |
|
|
|
|
325
|
|
|
global $Language,$ath; |
326
|
|
|
$hp = Codendi_HTMLPurifier::instance(); |
327
|
|
|
$html_result = ""; |
328
|
|
|
|
329
|
|
|
// Build the list of links to use for column headings |
330
|
|
|
// Used to trigger sort on that column |
331
|
|
|
$result_fields = $this->getResultFields(); |
332
|
|
|
|
333
|
|
|
$links_arr = array(); |
334
|
|
|
$title_arr = array(); |
335
|
|
|
$width_arr = array(); |
336
|
|
|
$id_arr = array(); |
337
|
|
|
|
338
|
|
|
if ( count($result_fields) == 0 ) return; |
339
|
|
|
|
340
|
|
|
reset($result_fields); |
341
|
|
|
while (list(,$field) = each($result_fields)) { |
342
|
|
|
if ($pv != 0) { |
343
|
|
|
$links_arr[] = $url.'&pv='.(int)$pv.'&order='.urlencode($field->getName()).'#results'; |
344
|
|
|
} else { |
345
|
|
|
$links_arr[] = $url.'&order='.urlencode($field->getName()).'#results'; |
346
|
|
|
} |
347
|
|
|
$title_arr[] = $hp->purify(SimpleSanitizer::unsanitize($field->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) ; |
348
|
|
|
$width_arr[$field->getName()] = $field->getColWidth(); |
349
|
|
|
$id_arr[] = $hp->purify($field->getName(), CODENDI_PURIFIER_CONVERT_HTML) ; |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
$query = $this->createQueryReport($prefs,$morder,$advsrch,$offset,$chunksz,$aids); |
353
|
|
|
$result = $this->getResultQueryReport($query); |
354
|
|
|
$rows = count($result); |
355
|
|
|
|
356
|
|
|
/* |
357
|
|
|
Show extra rows for <-- Prev / Next --> |
358
|
|
|
*/ |
359
|
|
|
$nav_bar ='<table width= "100%"><tr>'; |
360
|
|
|
$nav_bar .= '<td width="40%" align ="left">'; |
361
|
|
|
|
362
|
|
|
// If all artifacts on screen so no prev/begin pointer at all |
363
|
|
|
if ($total_rows > $chunksz) { |
364
|
|
|
if ($offset > 0) { |
365
|
|
|
$nav_bar .= |
366
|
|
|
'<A HREF="'.$url.'&offset=0#results" class="small"><B><< '.$Language->getText('global','begin').'</B></A>'. |
367
|
|
|
' '. |
368
|
|
|
'<A HREF="'.$url.'&offset='.($offset-$chunksz). |
369
|
|
|
'#results" class="small"><B>< '.$Language->getText('global','prev').' '.(int)$chunksz.'</B></A></td>'; |
370
|
|
|
} else { |
371
|
|
|
$nav_bar .= |
372
|
|
|
'<span class="disable"><< '.$Language->getText('global','begin').' < '.$Language->getText('global','prev').' '.(int)$chunksz.'</span>'; |
373
|
|
|
} |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
$nav_bar .= '</td>'; |
377
|
|
|
|
378
|
|
|
$offset_last = min($offset+$chunksz-1, $total_rows-1); |
379
|
|
|
|
380
|
|
|
#display 'Items x - y' only in normal and printer-version modes |
381
|
|
|
if ($pv != 2) { |
382
|
|
|
$nav_bar .= '<td width= "20% " align = "center" class="small">'.$Language->getText('tracker_include_report','items').' '.($offset+1).' - '. |
383
|
|
|
($offset_last+1)."</td>\n"; |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
$nav_bar .= '<td width="40%" align ="right">'; |
387
|
|
|
|
388
|
|
|
// If all artifacts on screen, no next/end pointer at all |
389
|
|
|
if ($total_rows > $chunksz) { |
390
|
|
|
if ( ($offset+$chunksz) < $total_rows ) { |
391
|
|
|
|
392
|
|
|
$offset_end = ($total_rows - ($total_rows % $chunksz)); |
393
|
|
|
if ($offset_end == $total_rows) { $offset_end -= $chunksz; } |
394
|
|
|
|
395
|
|
|
$nav_bar .= |
396
|
|
|
'<A HREF="'.$url.'&offset='.($offset+$chunksz). |
397
|
|
|
'#results" class="small"><B>'.$Language->getText('global','next').' '.(int)$chunksz.' ></B></A>'. |
398
|
|
|
' '. |
399
|
|
|
'<A HREF="'.$url.'&offset='.($offset_end). |
400
|
|
|
'#results" class="small"><B>'.$Language->getText('global','end').' >></B></A></td>'; |
401
|
|
|
} else { |
402
|
|
|
$nav_bar .= |
403
|
|
|
'<span class="disable">'.$Language->getText('global','next').' '.(int)$chunksz. |
404
|
|
|
' > '.$Language->getText('global','end').' >></span>'; |
405
|
|
|
} |
406
|
|
|
} |
407
|
|
|
$nav_bar .= '</td>'; |
408
|
|
|
$nav_bar .="</tr></table>\n"; |
409
|
|
|
|
410
|
|
|
$html_result .= $nav_bar; |
411
|
|
|
|
412
|
|
|
if ($masschange) { |
413
|
|
|
$html_result .= '</form><FORM NAME="artifact_list" action="" METHOD="POST">'; |
414
|
|
|
//TODO: put width here |
415
|
|
|
$html_result .= html_build_list_table_top ($title_arr,$links_arr,true); |
416
|
|
|
} else { |
417
|
|
|
$html_result .= '<table width="100%" cellpadding="2" cellspacing="1" border="0">'; |
418
|
|
|
$html_result .= '<thead>'; |
419
|
|
|
$html_result .= '<tr class="boxtable">'; |
420
|
|
|
while((list(,$title) = each($title_arr)) && |
421
|
|
|
(list(,$link) = each($links_arr)) && |
422
|
|
|
(list(,$id) = each($id_arr)) && |
423
|
|
|
(list(,$width) = each($width_arr))) { |
424
|
|
|
if ($width) { |
425
|
|
|
$width = 'style="width:'.$width.'%"'; |
426
|
|
|
} else { |
427
|
|
|
$width = ''; |
428
|
|
|
} |
429
|
|
|
$html_result .= '<th class="boxtitle" '. $width .'><a href="'. $link .'" id="'. $id .'">'. $title .'</a></th>'; |
430
|
|
|
} |
431
|
|
|
$html_result .= '</tr>'; |
432
|
|
|
$html_result .= '</thead>'; |
433
|
|
|
} |
434
|
|
|
$html_result .= '<tbody>'; |
435
|
|
|
for ($i=0; $i < $rows ; $i++) { |
436
|
|
|
|
437
|
|
|
$html_result .= '<TR class="'. get_priority_color($result[$i]['severity_id']) .'">'."\n"; |
438
|
|
|
|
439
|
|
|
if ($masschange) { |
440
|
|
|
$html_result .= '<TD align="center"><INPUT TYPE="checkbox" name="mass_change_ids[]" value="'.$result[$i]['artifact_id'].'"></td>'; |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
reset($result_fields); |
444
|
|
|
while (list($key,$field) = each($result_fields) ) { |
445
|
|
|
//echo "$key=".$result[$i][$key]."<br>"; |
446
|
|
|
|
447
|
|
|
$value = $result[$i][$key]; |
448
|
|
|
$width = ' class="small"'; |
449
|
|
|
|
450
|
|
|
if ( $field->isDateField() ) { |
451
|
|
|
if ($value) { |
452
|
|
|
if ($field->getName() == 'last_update_date') { |
453
|
|
|
$html_result .= "<TD $width>".format_date("Y-m-d H:i",$value).'</TD>'."\n"; |
454
|
|
|
} else { |
455
|
|
|
$html_result .= "<TD $width>".format_date("Y-m-d",$value).'</TD>'."\n"; |
456
|
|
|
} |
457
|
|
|
} else { |
458
|
|
|
$html_result .= '<TD align="center">-</TD>'; |
459
|
|
|
} |
460
|
|
|
} else if ($field->getName() == 'artifact_id') { |
461
|
|
|
if ($nolink) |
462
|
|
|
$html_result .= "<TD $width>". $hp->purify($value, CODENDI_PURIFIER_CONVERT_HTML) ."</TD>\n"; |
463
|
|
|
else { |
464
|
|
|
$target = ($pv == 0 ? "" : " target=blank"); |
465
|
|
|
$html_result .= "<TD $width>".'<A HREF="/tracker/?func=detail&aid='. |
466
|
|
|
urlencode($value).'&atid='.(int)$this->group_artifact_id.'&group_id='.(int)$group_id.'"'.$target.'>'. |
467
|
|
|
$value .'</A></TD>'."\n"; |
468
|
|
|
} |
469
|
|
|
|
470
|
|
|
} else if ( $field->isUsername() ) { |
471
|
|
|
if ($nolink) { |
472
|
|
|
$html_result .= "<TD $width>".util_multi_user_nolink($value)."</TD>\n"; |
473
|
|
|
}else { |
474
|
|
|
$html_result .= "<TD $width>".util_multi_user_link($value)."</TD>\n"; |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
} else if ( $field->isFloat() ) { |
478
|
|
|
$html_result .= "<TD $width>". number_format($value,2) .' </TD>'."\n"; |
479
|
|
|
} else if( $field->isTextArea()){ |
480
|
|
|
$unsane = util_unconvert_htmlspecialchars($value); |
481
|
|
|
$text = str_replace("\t", " ", $hp->purify($unsane, CODENDI_PURIFIER_BASIC, $group_id)); |
482
|
|
|
$text = str_replace(' ', ' ', $text); |
483
|
|
|
$text = str_replace(' ', ' ', $text); |
484
|
|
|
$html_result .= '<TD '. $width .' style="font-family:monospace; font-size:10pt;">'. $text . ' </TD>'; |
485
|
|
|
} else if($field->getName() == 'status_id') { |
486
|
|
|
$html_result .= "<TD $width>"; |
487
|
|
|
$html_result .= '<div id="status_id_'. $i .'">'; |
488
|
|
|
$html_result .= $hp->purify($value, CODENDI_PURIFIER_BASIC, $group_id); |
489
|
|
|
$html_result .= '</div>'; |
490
|
|
|
if ($field->userCanUpdate($group_id, $ath->getId())) { |
491
|
|
|
$field_values = $field->getFieldPredefinedValues($ath->getId(),false,false,true,false); |
492
|
|
|
$array_values = array(); |
493
|
|
|
while($row = db_fetch_array($field_values)) { |
494
|
|
|
$array_values[] = "[".$row['value_id'].", '". addslashes($row['value']) ."']"; |
495
|
|
|
} |
496
|
|
|
} |
497
|
|
|
$html_result .= "</TD>\n"; |
498
|
|
|
} else { |
499
|
|
|
$html_result .= "<TD $width>". $hp->purify(util_unconvert_htmlspecialchars($value), CODENDI_PURIFIER_BASIC, $group_id) .' </TD>'."\n"; |
500
|
|
|
} |
501
|
|
|
|
502
|
|
|
} // while |
503
|
|
|
$html_result .= "</tr>\n"; |
504
|
|
|
} |
505
|
|
|
|
506
|
|
|
$html_result .= '</tbody></table>'; |
507
|
|
|
|
508
|
|
|
if ($masschange) { |
509
|
|
|
$html_result .= '<script language="JavaScript">'; |
510
|
|
|
$html_result .= " |
511
|
|
|
<!-- |
512
|
|
|
function checkAll(val) { |
513
|
|
|
$$('input[name=\"mass_change_ids[]\"]').each(function (element) { |
514
|
|
|
element.checked = val; |
515
|
|
|
}); |
516
|
|
|
} |
517
|
|
|
//--> |
518
|
|
|
</script>"; |
519
|
|
|
|
520
|
|
|
$html_result .= '<INPUT TYPE="HIDDEN" NAME="atid" VALUE="'.(int)$this->group_artifact_id.'"> |
521
|
|
|
<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="'.(int)$group_id.'"> |
522
|
|
|
<INPUT TYPE="HIDDEN" NAME="report_id" VALUE="'.(int)$this->report_id.'"> |
523
|
|
|
<INPUT TYPE="HIDDEN" NAME="advsrch" VALUE="'.(int)$advsrch.'"> |
524
|
|
|
<INPUT TYPE="HIDDEN" NAME="func" VALUE="masschange_detail">'; |
525
|
|
|
// get the query |
526
|
|
|
while (list($field,$value) = each($prefs) ) { |
527
|
|
|
if (is_array($value)) { |
528
|
|
|
while (list(,$val) = each($value)) { |
529
|
|
|
$html_result .= '<INPUT TYPE="HIDDEN" NAME="'. $hp->purify($field, CODENDI_PURIFIER_CONVERT_HTML) .'[]" VALUE="'. $hp->purify($val, CODENDI_PURIFIER_CONVERT_HTML) .'">'; |
530
|
|
|
} |
531
|
|
|
} else { |
532
|
|
|
$html_result .= '<INPUT TYPE="HIDDEN" NAME="'. $hp->purify($field, CODENDI_PURIFIER_CONVERT_HTML) .'" VALUE="'. $hp->purify($value, CODENDI_PURIFIER_CONVERT_HTML) .'">'; |
533
|
|
|
} |
534
|
|
|
} |
535
|
|
|
#stuff related to mass-change (buttons, check_all_items link, clear_all_items link) should be hidden in printer version |
536
|
|
|
#as well as table-only view. keep only 'select' column checkboxes |
537
|
|
|
if ($pv == 0) { |
538
|
|
|
if ($total_rows > $chunksz) { |
539
|
|
|
$html_result .= |
540
|
|
|
'<a href="javascript:checkAll(1)">'.$Language->getText('tracker_include_report','check_items').' '.($offset+1).'-'.($offset_last+1).'</a>'. |
541
|
|
|
' - <a href="javascript:checkAll(0)">'.$Language->getText('tracker_include_report','clear_items').' '.($offset+1).'-'.($offset_last+1).'</a><p>'; |
542
|
|
|
|
543
|
|
|
$html_result .= '<table width= "100%"><tr><td width="50%" align ="center" class="small">'; |
544
|
|
|
$html_result .= '<INPUT TYPE="SUBMIT" name="submit_btn" VALUE="'.$Language->getText('tracker_masschange_detail','selected_items').'('.($offset+1).'-'.($offset_last+1).')">'; |
545
|
|
|
$html_result .= '</td><td width="50%" align ="center" class="small">'; |
546
|
|
|
$html_result .= '<INPUT TYPE="SUBMIT" name="submit_btn" VALUE="'.$Language->getText('tracker_include_report','mass_change_all',(int)$total_rows).'">'; |
547
|
|
|
|
548
|
|
|
} else { |
549
|
|
|
$html_result .= |
550
|
|
|
'<a href="javascript:checkAll(1)">'.$Language->getText('tracker_include_report','check_all_items').'</a>'. |
551
|
|
|
' - <a href="javascript:checkAll(0)">'.$Language->getText('tracker_include_report','clear_all_items').' </a><p>'; |
552
|
|
|
|
553
|
|
|
$html_result .= '<table width= "100%"><tr><td width="60%" align ="center" class="small">'; |
554
|
|
|
$html_result .= '<INPUT TYPE="SUBMIT" name="submit_btn" VALUE="'.$Language->getText('tracker_masschange_detail','selected_items',array(1,(int)$total_rows)).'">'; |
555
|
|
|
} |
556
|
|
|
} |
557
|
|
|
$html_result .= '</td></tr></table>'; |
558
|
|
|
} else { |
559
|
|
|
$html_result .= $nav_bar; |
560
|
|
|
} |
561
|
|
|
|
562
|
|
|
|
563
|
|
|
return $html_result; |
564
|
|
|
} |
565
|
|
|
|
566
|
|
|
/** |
567
|
|
|
* Display the report |
568
|
|
|
* |
569
|
|
|
* @param prefs: array of parameters used for the current query |
570
|
|
|
* @param group_id,report_id,set,advsrch,msort,morder,order,pref_stg,offset,chunksz,pv: HTTP get variables |
571
|
|
|
* |
572
|
|
|
* @return string |
573
|
|
|
* |
574
|
|
|
*/ |
575
|
|
|
function displayReport($prefs,$group_id,$report_id,$set,$advsrch,$msort,$morder,$order,$pref_stg,$offset,$chunksz,$pv,$masschange=false) { |
576
|
|
|
$hp = Codendi_HTMLPurifier::instance(); |
577
|
|
|
global $ath,$art_field_fact,$Language; |
578
|
|
|
|
579
|
|
|
$html_result = ''; |
580
|
|
|
|
581
|
|
|
// Display browse informations if any |
582
|
|
|
if ( $ath->getBrowseInstructions() && $pv == 0) { |
583
|
|
|
$html_result .= $hp->purify($ath->getBrowseInstructions(), CODENDI_PURIFIER_FULL) ; |
584
|
|
|
} |
585
|
|
|
|
586
|
|
|
$html_result .= ' |
587
|
|
|
<FORM ACTION="" METHOD="GET" CLASS="form-inline" NAME="artifact_form"> |
588
|
|
|
<INPUT TYPE="HIDDEN" NAME="atid" VALUE="'.(int)$this->group_artifact_id.'"> |
589
|
|
|
<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="'.(int)$group_id.'">'; |
590
|
|
|
if ($masschange) { |
591
|
|
|
$html_result .= '<INPUT TYPE="HIDDEN" NAME="func" VALUE="masschange">'; |
592
|
|
|
} else { |
593
|
|
|
$html_result .= '<INPUT TYPE="HIDDEN" NAME="func" VALUE="browse">'; |
594
|
|
|
} |
595
|
|
|
|
596
|
|
|
$html_result .= ' |
597
|
|
|
<INPUT TYPE="HIDDEN" NAME="set" VALUE="custom"> |
598
|
|
|
<INPUT TYPE="HIDDEN" NAME="advsrch" VALUE="'. $hp->purify($advsrch, CODENDI_PURIFIER_CONVERT_HTML) .'"> |
599
|
|
|
<INPUT TYPE="HIDDEN" NAME="msort" VALUE="'. $hp->purify($msort, CODENDI_PURIFIER_CONVERT_HTML) .'"> |
600
|
|
|
<BR> |
601
|
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="5"> |
602
|
|
|
<TR><TD colspan="'.(int)$this->fields_per_line.'" nowrap>'; |
603
|
|
|
|
604
|
|
|
|
605
|
|
|
//Show the list of available artifact reports |
606
|
|
|
if ($pv == 0) { |
607
|
|
|
$res_report = $this->getReports($this->group_artifact_id,user_getid()); |
608
|
|
|
$box_name = 'report_id" onChange="document.artifact_form.go_report.click()'; |
609
|
|
|
$html_result .= '<b>'.$Language->getText('tracker_include_report','using_report'); |
610
|
|
|
$html_result .= html_build_select_box($res_report,$box_name,$report_id,false,'',false,'',false,'', CODENDI_PURIFIER_CONVERT_HTML); |
611
|
|
|
$html_result .= ' <input class="btn" VALUE="'.$Language->getText('tracker_include_report','btn_go').'" NAME="go_report" type="submit">'.'</b>'; |
612
|
|
|
} |
613
|
|
|
|
614
|
|
|
// Start building the URL that we use to for hyperlink in the form |
615
|
|
|
$url = "/tracker/?atid=".(int)$this->group_artifact_id."&group_id=". (int)$group_id ."&set=". $hp->purify($set, CODENDI_PURIFIER_CONVERT_HTML) ."&msort=". $hp->purify($msort, CODENDI_PURIFIER_CONVERT_HTML) ; |
616
|
|
|
if ($masschange) { |
617
|
|
|
$url .= '&func=masschange'; |
618
|
|
|
} |
619
|
|
|
|
620
|
|
|
if ($set == 'custom') { |
621
|
|
|
$url .= $pref_stg; |
622
|
|
|
} else { |
623
|
|
|
$url .= '&advsrch='. $hp->purify($advsrch, CODENDI_PURIFIER_CONVERT_HTML) ; |
624
|
|
|
} |
625
|
|
|
|
626
|
|
|
$url_nomorder = $url; |
627
|
|
|
if ($pv != 0) { |
628
|
|
|
$url_nomorder .= "&pv=". (int)$pv; |
629
|
|
|
} |
630
|
|
|
$url .= "&morder=". $hp->purify($morder, CODENDI_PURIFIER_CONVERT_HTML) ; |
631
|
|
|
|
632
|
|
|
$params = array('url'=>&$url); |
633
|
|
|
$em =& EventManager::instance(); |
634
|
|
|
$em->processEvent('tracker_urlparam_processing', $params); |
635
|
|
|
$url_nomorder = $url; |
636
|
|
|
|
637
|
|
|
// Build the URL for alternate Search |
638
|
|
|
if ($advsrch) { |
639
|
|
|
$url_alternate_search = str_replace('advsrch=1','advsrch=0',$url); |
640
|
|
|
$text = $Language->getText('tracker_include_report','simple_search'); |
641
|
|
|
} else { |
642
|
|
|
$url_alternate_search = str_replace('advsrch=0','advsrch=1',$url); |
643
|
|
|
$text = $Language->getText('tracker_include_report','adv_search'); |
644
|
|
|
} |
645
|
|
|
|
646
|
|
|
if ($pv == 0) { |
647
|
|
|
$html_result .= '<small> ('.$Language->getText('tracker_include_report','or_use').' <a href="'. |
648
|
|
|
$url_alternate_search.'">'. $hp->purify($text, CODENDI_PURIFIER_CONVERT_HTML) .'</a>)</small></h3><p>'; |
649
|
|
|
} |
650
|
|
|
|
651
|
|
|
$current_user = UserManager::instance()->getCurrentUser(); |
652
|
|
|
$user_dont_want_to_see_query = $current_user->getPreference('tracker_'. (int)$this->group_artifact_id .'_hide_section_query'); |
653
|
|
|
$html_result .= '</TABLE>'; |
654
|
|
|
// Display query fields |
655
|
|
|
if ($pv != 2) { |
656
|
|
|
$html_result .= '<A name="query"></A>'; |
657
|
|
|
$html_result .= '<fieldset class="tracker-search"><legend>'; |
658
|
|
|
$onclick = ''; |
659
|
|
|
$onclick .= "if ($('artifacts_query').empty()) { return true }"; |
660
|
|
|
if (!$current_user->isAnonymous()) { |
661
|
|
|
$onclick .= "else { new Ajax.Request(this.href); }"; |
662
|
|
|
} |
663
|
|
|
$onclick .= "if ($('artifacts_query').visible()) { this.firstChild.src.replace(/minus.png/, 'plus.png'); } else {this.firstChild.src.replace(/plus.png/, 'minus.png');}"; |
664
|
|
|
$onclick .= "new Effect.toggle($('artifacts_query'), 'slide', {duration:0.1});"; |
665
|
|
|
$onclick .= "return false;"; |
666
|
|
|
$html_result .= '<a href="'. $url .'&func=toggle_section&section=query" onclick="'. $onclick .'">'; |
667
|
|
|
if ($user_dont_want_to_see_query) { |
668
|
|
|
$image = 'ic/toggle_plus.png'; |
669
|
|
|
} else { |
670
|
|
|
$image = 'ic/toggle_minus.png'; |
671
|
|
|
} |
672
|
|
|
$html_result .= $GLOBALS['HTML']->getimage($image); |
673
|
|
|
$html_result .= '</a>'; |
674
|
|
|
$html_result .= $Language->getText('tracker_include_report','query') .'</legend>'; |
675
|
|
|
$html_result .= '<div id="artifacts_query" style="padding-left:16px;">'; |
676
|
|
|
if (!$user_dont_want_to_see_query) { |
677
|
|
|
$html_result .= $this->displayQueryFields($prefs,$advsrch,$pv); |
678
|
|
|
$html_result .= '<div style="text-align:left"><br><input class="btn" type="submit" value="'.$Language->getText('global','btn_submit').'" /></div>'; |
679
|
|
|
} |
680
|
|
|
$html_result .= '</div></fieldset><br>'; |
681
|
|
|
} |
682
|
|
|
|
683
|
|
|
// |
684
|
|
|
// Finally display the result table |
685
|
|
|
// |
686
|
|
|
$user_dont_want_to_see_results = $current_user->getPreference('tracker_'. (int)$this->group_artifact_id .'_hide_section_results'); |
687
|
|
|
$totalrows = $this->selectReportItems($prefs,$morder,$advsrch,$aids); // Filter according to permissions |
688
|
|
|
|
689
|
|
|
if ($totalrows > 0) { |
690
|
|
|
|
691
|
|
|
// Build the sorting header messages |
692
|
|
|
if ($pv != 2) { |
693
|
|
|
if ( $morder ) { |
694
|
|
|
$order_statement = $Language->getText('tracker_include_report','sorted_by').' '.($pv != 0 ? '':help_button('tracker-v3.html#selection-criteria',false)). |
695
|
|
|
' : '.$this->criteriaListToText($morder, $url_nomorder); |
696
|
|
|
} else { |
697
|
|
|
$order_statement =''; |
698
|
|
|
} |
699
|
|
|
|
700
|
|
|
$html_result .= '<A name="results"></A>'; |
701
|
|
|
$html_result .= '<fieldset class="tracker-search"><legend>'; |
702
|
|
|
if ($pv == 0) { |
703
|
|
|
$onclick = ''; |
704
|
|
|
$onclick .= "if ($('artifacts_result').empty()) { return true }"; |
705
|
|
|
if (!$current_user->isAnonymous()) { |
706
|
|
|
$onclick .= "else { new Ajax.Request(this.href); }"; |
707
|
|
|
} |
708
|
|
|
$onclick .= "if ($('artifacts_result').visible()) { this.firstChild.src.replace(/minus.png/, 'plus.png'); } else {this.firstChild.src.replace(/plus.png/, 'minus.png');}"; |
709
|
|
|
$onclick .= "new Effect.toggle($('artifacts_result'), 'slide', {duration:0.1});"; |
710
|
|
|
$onclick .= "return false;"; |
711
|
|
|
$html_result .= '<a href="'. $url .'&func=toggle_section&section=results" onclick="'. $onclick .'">'; |
712
|
|
|
if ($user_dont_want_to_see_results) { |
713
|
|
|
$image = 'ic/toggle_plus.png'; |
714
|
|
|
} else { |
715
|
|
|
$image = 'ic/toggle_minus.png'; |
716
|
|
|
} |
717
|
|
|
$html_result .= $GLOBALS['HTML']->getimage($image); |
718
|
|
|
$html_result .= '</a>'; |
719
|
|
|
} |
720
|
|
|
$html_result .= (int)$totalrows.' '.$Language->getText('tracker_include_report','matching').' '. $order_statement .'</legend>'; |
721
|
|
|
$html_result .= '<div id="artifacts_result" style="padding-left:16px;">'; |
722
|
|
|
} |
723
|
|
|
if ($pv != 2 && !$user_dont_want_to_see_results) { |
724
|
|
|
if ($pv == 0) { |
725
|
|
|
$html_result .= '<p> '.$Language->getText('global','btn_browse') . |
726
|
|
|
' <input TYPE="text" class="input-mini" name="chunksz" size="3" MAXLENGTH="5" '. |
727
|
|
|
'VALUE="'. (int)$chunksz.'"> '. $hp->purify($ath->getItemName(), CODENDI_PURIFIER_CONVERT_HTML) .$Language->getText('tracker_include_report','at_once'); |
728
|
|
|
$html_result .= '<P>'.$Language->getText('tracker_include_report','sort_results').' '; |
729
|
|
|
$field = $art_field_fact->getFieldFromName('severity'); |
730
|
|
|
if ( $field && $field->isUsed()) { |
731
|
|
|
$html_result .= $Language->getText('global','or').' <A HREF="'.$url.'&order=severity#results"><b>'. $hp->purify($Language->getText('tracker_include_report','sort_sev',$field->getLabel()), CODENDI_PURIFIER_CONVERT_HTML) .'</b></A> '; |
732
|
|
|
} |
733
|
|
|
$html_result .= $Language->getText('global','or').' <A HREF="'.$url.'&order=#results"><b>'.$Language->getText('tracker_include_report','reset_sort').'</b></a>. '; |
734
|
|
|
} |
735
|
|
|
|
736
|
|
|
if ($msort) { |
737
|
|
|
$url_alternate_sort = str_replace('msort=1','msort=0',$url). |
738
|
|
|
'&order=#results'; |
739
|
|
|
$text = $Language->getText('global','deactivate'); |
740
|
|
|
} else { |
741
|
|
|
$url_alternate_sort = str_replace('msort=0','msort=1',$url). |
742
|
|
|
'&order=#results'; |
743
|
|
|
$text = $Language->getText('global','activate'); |
744
|
|
|
} |
745
|
|
|
|
746
|
|
|
if ($pv == 0) { |
747
|
|
|
$html_result .= $Language->getText('tracker_include_report','multicolumn_sort',array($url_alternate_sort,$text)).' '. |
748
|
|
|
'(<a href="'.$url.'&pv=1"> <img src="'.util_get_image_theme("ic/printer.png").'" border="0">'. |
749
|
|
|
' '.$Language->getText('global','printer_version').'</a>)'."\n"; |
750
|
|
|
} |
751
|
|
|
} |
752
|
|
|
|
753
|
|
|
if ($pv != 0) { |
754
|
|
|
$chunksz = 100000; |
755
|
|
|
} |
756
|
|
|
if ($pv == 2 || !$user_dont_want_to_see_results) { |
757
|
|
|
$html_result .= $this->showResult($group_id,$prefs,$offset,$totalrows,$url,($pv == 1 ? true:false),$chunksz,$morder,$advsrch,$chunksz,$aids,$masschange,$pv); |
758
|
|
|
} |
759
|
|
|
$html_result .= '</form>'; |
760
|
|
|
if ($pv != 2 && !$user_dont_want_to_see_results) { |
761
|
|
|
#priority colors are not displayed in table-only view |
762
|
|
|
$html_result .= $this->showPriorityColorsKey($Language->getText('tracker_include_report','sev_colors'),$aids,$masschange,$pv); |
763
|
|
|
} |
764
|
|
|
} else { |
765
|
|
|
|
766
|
|
|
$html_result .= '</form>'; |
767
|
|
|
$html_result .= '<h2>'.$Language->getText('tracker_include_report','no_match').'</h2>'; |
768
|
|
|
$html_result .= db_error(); |
769
|
|
|
|
770
|
|
|
} |
771
|
|
|
$html_result .= '</div></fieldset>'; |
772
|
|
|
echo $html_result; |
773
|
|
|
|
774
|
|
|
$em =& EventManager::instance(); |
775
|
|
|
$em->processEvent('tracker_after_report',array('group_id' => $group_id, 'atid' => (int)$this->group_artifact_id, 'url' => $url)); |
776
|
|
|
|
777
|
|
|
} |
778
|
|
|
|
779
|
|
|
/** |
780
|
|
|
* Return a label for the scope code |
781
|
|
|
* |
782
|
|
|
* param scope: the scope code |
783
|
|
|
* |
784
|
|
|
* @return string |
785
|
|
|
*/ |
786
|
|
|
function getScopeLabel($scope) { |
787
|
|
|
global $Language; |
788
|
|
|
|
789
|
|
|
switch ( $scope ) { |
790
|
|
|
case 'P': |
791
|
|
|
return $Language->getText('global','Project'); |
792
|
|
|
case 'I': |
793
|
|
|
return $Language->getText('global','Personal'); |
794
|
|
|
case 'S': |
795
|
|
|
return $Language->getText('global','System'); |
796
|
|
|
} |
797
|
|
|
} |
798
|
|
|
|
799
|
|
|
/** |
800
|
|
|
* Return a link for the setting default report |
801
|
|
|
* |
802
|
|
|
* param default_val: the default report value |
803
|
|
|
* @return string |
804
|
|
|
*/ |
805
|
|
|
|
806
|
|
|
function getDefaultLink($default_val,$scope,$report_id) { |
807
|
|
|
$g = $GLOBALS['ath']->getGroup(); |
808
|
|
|
$group_id = $g->getID(); |
809
|
|
|
$atid = $GLOBALS['ath']->getID(); |
810
|
|
|
if (($scope != 'S') && ($scope != 'I')) { |
811
|
|
|
switch ( $default_val ) { |
812
|
|
|
case 0: |
813
|
|
|
return '<a href="/tracker/admin/?func=report&group_id='.$group_id.'&atid='.$atid.'&update_default='.$report_id.'">'.$GLOBALS['Language']->getText('tracker_include_report','set_default').'</a>'; |
814
|
|
|
case 1: |
815
|
|
|
return '<b>'.$GLOBALS['Language']->getText('tracker_include_report','is_default').'</b>'; |
816
|
|
|
default: |
817
|
|
|
return '<a href="/tracker/admin/?func=report&group_id='.$group_id.'&atid='.$atid.'&update_default='.$report_id.'">'.$GLOBALS['Language']->getText('tracker_include_report','set_default').'</a>'; |
818
|
|
|
} |
819
|
|
|
} else { |
820
|
|
|
return '<b>-</b>'; |
821
|
|
|
} |
822
|
|
|
} |
823
|
|
|
|
824
|
|
|
/** |
825
|
|
|
* Display the report list |
826
|
|
|
* |
827
|
|
|
* param : $reports the list the reports within an artifact to display |
828
|
|
|
* |
829
|
|
|
* @return void |
830
|
|
|
*/ |
831
|
|
|
function showAvailableReports($reports) { |
832
|
|
|
$hp = Codendi_HTMLPurifier::instance(); |
833
|
|
|
global $ath,$Language; |
834
|
|
|
|
835
|
|
|
$g = $ath->getGroup(); |
836
|
|
|
$group_id = $g->getID(); |
837
|
|
|
$atid = $ath->getID(); |
838
|
|
|
|
839
|
|
|
$ath->adminHeader(array ('title'=>$Language->getText('tracker_include_report','report_mgmt'), |
840
|
|
|
'help' => 'tracker-v3.html#tracker-report-management')); |
841
|
|
|
$trackerName = $ath->getName(); |
842
|
|
|
|
843
|
|
|
echo '<H2>'.$Language->getText('tracker_import_admin','tracker').' \'<a href="/tracker/admin/?group_id='.(int)$group_id.'&atid='.(int)$atid.'">'; |
844
|
|
|
echo $hp->purify(SimpleSanitizer::unsanitize($ath->getName()), CODENDI_PURIFIER_CONVERT_HTML); |
845
|
|
|
echo '</a>\''.$Language->getText('tracker_include_report','report_admin').'</H2>'; |
846
|
|
|
|
847
|
|
|
if ($reports) { |
848
|
|
|
// Loop through the list of all artifact report |
849
|
|
|
$title_arr=array(); |
850
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','id'); |
851
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','report_name'); |
852
|
|
|
$title_arr[]=$Language->getText('tracker_include_artifact','desc'); |
853
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','scope'); |
854
|
|
|
if ($ath->userIsAdmin()) { |
855
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','default'); |
856
|
|
|
} |
857
|
|
|
$title_arr[]=$Language->getText('tracker_include_canned','delete'); |
858
|
|
|
|
859
|
|
|
echo '<p>'.$Language->getText('tracker_include_report','mod'); |
860
|
|
|
echo html_build_list_table_top ($title_arr); |
861
|
|
|
$i=0; |
862
|
|
|
while ($arr = db_fetch_array($reports)) { |
863
|
|
|
|
864
|
|
|
echo '<TR class="'. util_get_alt_row_color($i) .'"><TD>'; |
865
|
|
|
|
866
|
|
|
if ( $arr['scope'] == 'S' || (!$ath->userIsAdmin()&&($arr['scope'] == 'P')) ) { |
867
|
|
|
echo (int)$arr['report_id']; |
868
|
|
|
} else { |
869
|
|
|
echo '<A HREF="/tracker/admin/?func=report&group_id='.(int)$group_id. |
870
|
|
|
'&show_report=1&report_id='.(int)$arr['report_id'].'&group_id='.(int)$group_id.'&atid='.(int)$ath->getID().'">'. |
871
|
|
|
$hp->purify($arr['report_id'], CODENDI_PURIFIER_CONVERT_HTML) .'</A>'; |
872
|
|
|
} |
873
|
|
|
|
874
|
|
|
echo "</td><td>". $hp->purify($arr['name'], CODENDI_PURIFIER_CONVERT_HTML) .'</td>'. |
875
|
|
|
"<td>". $hp->purify($arr['description'], CODENDI_PURIFIER_BASIC, $group_id) .'</td>'. |
876
|
|
|
'<td align="center">'. $hp->purify($this->getScopeLabel($arr['scope']), CODENDI_PURIFIER_CONVERT_HTML) .'</td>'; |
877
|
|
|
|
878
|
|
|
$name = $arr['name']; |
879
|
|
|
|
880
|
|
|
if ($ath->userIsAdmin()) { |
881
|
|
|
echo "\n<td align=\"center\">".$this->getDefaultLink($arr['is_default'],$arr['scope'],$arr['report_id']).'</td>'; |
882
|
|
|
} |
883
|
|
|
echo "\n<td align=\"center\">"; |
884
|
|
|
if ( $arr['scope'] == 'S' || (!$ath->userIsAdmin()&&($arr['scope'] == 'P')) ) { |
885
|
|
|
echo '-'; |
886
|
|
|
} else { |
887
|
|
|
echo '<A HREF="/tracker/admin/?func=report&group_id='.(int)$group_id. |
888
|
|
|
'&atid='.(int)$atid.'&delete_report=1&report_id='.(int)$arr['report_id']. |
889
|
|
|
'" onClick="return confirm(\''.$Language->getText('tracker_include_report','delete_report', $hp->purify(addslashes($name), CODENDI_PURIFIER_CONVERT_HTML)).'\');">'. |
890
|
|
|
'<img src="'.util_get_image_theme("ic/trash.png").'" border="0"></A>'; |
891
|
|
|
} |
892
|
|
|
|
893
|
|
|
echo '</td></tr>'; |
894
|
|
|
$i++; |
895
|
|
|
} |
896
|
|
|
echo '</TABLE>'; |
897
|
|
|
} else { |
898
|
|
|
echo '<p><h3>'.$Language->getText('tracker_include_report','no_rep_def').'</h3>'; |
899
|
|
|
} |
900
|
|
|
|
901
|
|
|
echo '<P> '.$Language->getText('tracker_include_report','create_report',array('/tracker/admin/?func=report&group_id='.(int)$group_id.'&atid='.(int)$atid.'&new_report=1')); |
902
|
|
|
} |
903
|
|
|
|
904
|
|
|
/** |
905
|
|
|
* Display the report form |
906
|
|
|
* |
907
|
|
|
* @return void |
908
|
|
|
*/ |
909
|
|
|
function createReportForm() { |
910
|
|
|
$hp = Codendi_HTMLPurifier::instance(); |
911
|
|
|
global $ath,$Language; |
912
|
|
|
|
913
|
|
|
$g = $ath->getGroup(); |
914
|
|
|
$group_id = $g->getID(); |
915
|
|
|
$atid = $ath->getID(); |
916
|
|
|
|
917
|
|
|
$ath->adminHeader(array ('title'=>$Language->getText('tracker_include_report','create_rep'), |
918
|
|
|
'help' => 'tracker-v3.html#tracker-report-setting')); |
919
|
|
|
|
920
|
|
|
echo '<H2>'.$Language->getText('tracker_import_admin','tracker').' \'<a href="/tracker/admin/?group_id='.(int)$group_id.'&atid='.(int)$atid.'">'. $hp->purify(SimpleSanitizer::unsanitize($ath->getName()), CODENDI_PURIFIER_CONVERT_HTML) .'</a>\' - '.$Language->getText('tracker_include_report','create_rep').' </H2>'; |
921
|
|
|
|
922
|
|
|
// display the table of all fields that can be included in the report |
923
|
|
|
$title_arr=array(); |
924
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','field_label'); |
925
|
|
|
$title_arr[]=$Language->getText('tracker_include_artifact','desc'); |
926
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','search_crit'); |
927
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','rank_search'); |
928
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','rep_col'); |
929
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','rank_repo'); |
930
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','col_width'); |
931
|
|
|
|
932
|
|
|
echo' |
933
|
|
|
<FORM ACTION="/tracker/admin/" METHOD="POST"> |
934
|
|
|
<INPUT TYPE="HIDDEN" NAME="func" VALUE="report"> |
935
|
|
|
<INPUT TYPE="HIDDEN" NAME="create_report" VALUE="y"> |
936
|
|
|
<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="'.(int)$group_id.'"> |
937
|
|
|
<INPUT TYPE="HIDDEN" NAME="atid" VALUE="'.(int)$atid.'"> |
938
|
|
|
<INPUT TYPE="HIDDEN" NAME="post_changes" VALUE="1"> |
939
|
|
|
<B>'.$Language->getText('tracker_include_artifact','name').':</B> |
940
|
|
|
<INPUT TYPE="TEXT" NAME="rep_name" VALUE="" CLASS="textfield_small" MAXLENGTH="80"> |
941
|
|
|
<B>'.$Language->getText('tracker_include_report','scope').': </B>'; |
942
|
|
|
|
943
|
|
|
if ($ath->userIsAdmin()) { |
944
|
|
|
echo '<SELECT ID="rep_scope" NAME="rep_scope" onchange="if (document.getElementById(\'rep_scope\').value == \'P\') {document.getElementById(\'rep_default\').disabled=false} else { document.getElementById(\'rep_default\').disabled=true;document.getElementById(\'rep_default\').checked=false }"> |
945
|
|
|
<OPTION VALUE="I">'.$Language->getText('global','Personal').'</OPTION> |
946
|
|
|
<OPTION VALUE="P">'.$Language->getText('global','Project').'</OPTION> |
947
|
|
|
</SELECT>'; |
948
|
|
|
echo ' <B>'.$Language->getText('tracker_include_report','default').':</B>'.'<INPUT TYPE="CHECKBOX" ID="rep_default" NAME="rep_default" DISABLED>'; |
949
|
|
|
} else { |
950
|
|
|
echo $Language->getText('global','Personal').' <INPUT TYPE="HIDDEN" NAME="rep_scope" VALUE="I">'; |
951
|
|
|
echo ' <B>'.$Language->getText('tracker_include_report','default').':</B>'.'<INPUT TYPE="CHECKBOX" ID="rep_default" NAME="rep_default" DISABLED>'; |
952
|
|
|
} |
953
|
|
|
echo ' <P> |
954
|
|
|
<B>'.$Language->getText('tracker_include_artifact','desc').': </B> |
955
|
|
|
<INPUT TYPE="TEXT" NAME="rep_desc" VALUE="" SIZE="50" MAXLENGTH="120"> |
956
|
|
|
<P>'; |
957
|
|
|
|
958
|
|
|
echo html_build_list_table_top ($title_arr); |
959
|
|
|
$i=0; |
960
|
|
|
$aff = new ArtifactFieldFactory($ath); |
961
|
|
|
|
962
|
|
|
$art_fieldset_fact = new ArtifactFieldsetFactory($ath); |
963
|
|
|
$used_fieldsets = $art_fieldset_fact->getAllFieldSetsContainingUsedFields(); |
964
|
|
|
|
965
|
|
|
// fetch list of used fieldsets for this artifact |
966
|
|
|
foreach ($used_fieldsets as $fieldset_id => $fieldset) { |
967
|
|
|
$used_fields = $fieldset->getAllUsedFields(); |
968
|
|
|
echo '<TR class="fieldset_separator">'; |
969
|
|
|
echo '<TD colspan="7">'.$fieldset->getLabel().'</TD>'; |
970
|
|
|
echo '</TR>'; |
971
|
|
|
while ( list($key, $field) = each($used_fields)) { |
|
|
|
|
972
|
|
|
|
973
|
|
|
// Do not show fields not used by the project |
974
|
|
|
if ( !$field->isUsed()) { continue; } |
975
|
|
|
|
976
|
|
|
// Do not show some special fields any way |
977
|
|
|
if ($field->isSpecial()) { |
978
|
|
|
if ( ($field->getName() == 'group_id') || |
979
|
|
|
($field->getName() == 'comment_type_id') ) |
980
|
|
|
{ continue; } |
981
|
|
|
} |
982
|
|
|
|
983
|
|
|
//Do not show unreadable fields |
984
|
|
|
if (!$ath->userIsAdmin() && !$field->userCanRead($group_id, $this->group_artifact_id)) { |
985
|
|
|
continue; |
986
|
|
|
} |
987
|
|
|
|
988
|
|
|
$cb_search = 'CBSRCH_'.$field->getName(); |
989
|
|
|
$cb_report = 'CBREP_'.$field->getName(); |
990
|
|
|
$tf_search = 'TFSRCH_'.$field->getName(); |
991
|
|
|
$tf_report = 'TFREP_'.$field->getName(); |
992
|
|
|
$tf_colwidth = 'TFCW_'.$field->getName(); |
993
|
|
|
echo '<TR class="'. util_get_alt_row_color($i) .'">'; |
994
|
|
|
|
995
|
|
|
echo "\n<td>".$field->label.'</td>'. |
996
|
|
|
"\n<td>".$field->description.'</td>'. |
997
|
|
|
"\n<td align=\"center\">".'<input type="checkbox" name="'.$cb_search.'" value="1"></td>'. |
998
|
|
|
"\n<td align=\"center\">".'<input type="text" name="'.$tf_search.'" value="" size="5" maxlen="5"></td>'. |
999
|
|
|
"\n<td align=\"center\">".'<input type="checkbox" name="'.$cb_report.'" value="1"></td>'. |
1000
|
|
|
"\n<td align=\"center\">".'<input type="text" name="'.$tf_report.'" value="" size="5" maxlen="5"></td>'. |
1001
|
|
|
"\n<td align=\"center\">".'<input type="text" name="'.$tf_colwidth.'" value="" size="5" maxlen="5"></td>'. |
1002
|
|
|
'</tr>'; |
1003
|
|
|
$i++; |
1004
|
|
|
} |
1005
|
|
|
} |
1006
|
|
|
echo '</TABLE>'. |
1007
|
|
|
'<P><CENTER><INPUT TYPE="SUBMIT" VALUE="'.$Language->getText('global','btn_submit').'"></CENTER>'. |
1008
|
|
|
'</FORM>'; |
1009
|
|
|
|
1010
|
|
|
} |
1011
|
|
|
|
1012
|
|
|
/** |
1013
|
|
|
* Display detail report form |
1014
|
|
|
* |
1015
|
|
|
* @return void |
1016
|
|
|
*/ |
1017
|
|
|
function showReportForm() { |
1018
|
|
|
$hp = Codendi_HTMLPurifier::instance(); |
1019
|
|
|
global $ath, $Language; |
1020
|
|
|
|
1021
|
|
|
$g = $ath->getGroup(); |
1022
|
|
|
$group_id = $g->getID(); |
1023
|
|
|
$atid = $ath->getID(); |
1024
|
|
|
|
1025
|
|
|
$ath->adminHeader(array ('title'=>$Language->getText('tracker_include_report','modify_report'), |
1026
|
|
|
'help' => 'tracker-v3.html#tracker-report-setting')); |
1027
|
|
|
|
1028
|
|
|
echo '<H2>'.$Language->getText('tracker_import_admin','tracker').' \'<a href="/tracker/admin/?group_id='.(int)$group_id.'&atid='.(int)$atid.'">'. $hp->purify(SimpleSanitizer::unsanitize($ath->getName()), CODENDI_PURIFIER_CONVERT_HTML) .'</a>\' - '.$Language->getText('tracker_include_report','modify_report').' \''. $hp->purify($this->name, CODENDI_PURIFIER_CONVERT_HTML) .'\'</H2>'; |
1029
|
|
|
|
1030
|
|
|
|
1031
|
|
|
// display the table of all fields that can be included in the report |
1032
|
|
|
// along with their current state in this report |
1033
|
|
|
$title_arr=array(); |
1034
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','field_label'); |
1035
|
|
|
$title_arr[]=$Language->getText('tracker_include_artifact','desc'); |
1036
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','search_crit'); |
1037
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','rank_search'); |
1038
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','rep_col'); |
1039
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','rank_repo'); |
1040
|
|
|
$title_arr[]=$Language->getText('tracker_include_report','col_width'); |
1041
|
|
|
|
1042
|
|
|
echo '<FORM ACTION="/tracker/admin/" METHOD="POST"> |
1043
|
|
|
<INPUT TYPE="HIDDEN" NAME="func" VALUE="report"> |
1044
|
|
|
<INPUT TYPE="HIDDEN" NAME="update_report" VALUE="y"> |
1045
|
|
|
<INPUT TYPE="HIDDEN" NAME="atid" VALUE="'.(int)$atid.'"> |
1046
|
|
|
<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="'.(int)$group_id.'"> |
1047
|
|
|
<INPUT TYPE="HIDDEN" NAME="report_id" VALUE="'.(int)$this->report_id.'"> |
1048
|
|
|
<INPUT TYPE="HIDDEN" NAME="post_changes" VALUE="1"> |
1049
|
|
|
<B>'.$Language->getText('tracker_include_artifact','name').': </B> |
1050
|
|
|
<INPUT TYPE="TEXT" NAME="rep_name" VALUE="'. $hp->purify($this->name, CODENDI_PURIFIER_CONVERT_HTML) .'" CLASS="textfield_small" MAXLENGTH="80"> |
1051
|
|
|
<B>'.$Language->getText('tracker_include_report','scope').': </B>'; |
1052
|
|
|
$scope = $this->scope; |
1053
|
|
|
if ($ath->userIsAdmin()) { |
1054
|
|
|
echo '<SELECT ID="rep_scope" NAME="rep_scope" onchange="if (document.getElementById(\'rep_scope\').value == \'P\') {document.getElementById(\'rep_default\').disabled=false} else { document.getElementById(\'rep_default\').disabled=true;document.getElementById(\'rep_default\').checked=false }" > |
1055
|
|
|
<OPTION VALUE="I"'.($scope=='I' ? 'SELECTED':'').'>'.$Language->getText('global','Personal').'</OPTION> |
1056
|
|
|
<OPTION VALUE="P"'.($scope=='P' ? 'SELECTED':'').'>'.$Language->getText('global','Project').'</OPTION> |
1057
|
|
|
</SELECT>'; |
1058
|
|
|
echo ' <B>'.$Language->getText('tracker_include_report','default').':</B>'.'<INPUT TYPE="CHECKBOX" ID="rep_default" NAME="rep_default" '.($this->is_default == 1 ? 'CHECKED':'').' '.($this->scope != 'P' ? 'DISABLED':'').'>'; |
1059
|
|
|
} else { |
1060
|
|
|
echo ($scope=='P' ? $Language->getText('global','Project'):$Language->getText('global','Personal')). |
1061
|
|
|
'<INPUT TYPE="HIDDEN" NAME="rep_scope" VALUE="'. $hp->purify($scope, CODENDI_PURIFIER_CONVERT_HTML) .'">'; |
1062
|
|
|
echo ' <B>'.$Language->getText('tracker_include_report','default').':</B>'.'<INPUT TYPE="CHECKBOX" ID="rep_default" NAME="rep_default" '.($this->is_default == 1 ? 'CHECKED':'').' DISABLED >'; |
1063
|
|
|
} |
1064
|
|
|
echo ' |
1065
|
|
|
<P> |
1066
|
|
|
<B>'.$Language->getText('tracker_include_artifact','desc').':</B> |
1067
|
|
|
<INPUT TYPE="TEXT" NAME="rep_desc" VALUE="'. $hp->purify($this->description, CODENDI_PURIFIER_CONVERT_HTML) .'" SIZE="50" MAXLENGTH="120"> |
1068
|
|
|
<P>'; |
1069
|
|
|
|
1070
|
|
|
echo html_build_list_table_top ($title_arr); |
1071
|
|
|
|
1072
|
|
|
// Write all the fields, grouped by fieldsetset and ordered by rank. |
1073
|
|
|
|
1074
|
|
|
$i=0; |
1075
|
|
|
$aff = new ArtifactFieldFactory($ath); |
1076
|
|
|
|
1077
|
|
|
$art_fieldset_fact = new ArtifactFieldsetFactory($ath); |
1078
|
|
|
$used_fieldsets = $art_fieldset_fact->getAllFieldSetsContainingUsedFields(); |
1079
|
|
|
|
1080
|
|
|
// fetch list of used fieldsets for this artifact |
1081
|
|
|
foreach ($used_fieldsets as $fieldset_id => $fieldset) { |
1082
|
|
|
$used_fields = $fieldset->getAllUsedFields(); |
1083
|
|
|
echo '<TR class="fieldset_separator">'; |
1084
|
|
|
echo '<TD colspan="7">'.$fieldset->getLabel().'</TD>'; |
1085
|
|
|
echo '</TR>'; |
1086
|
|
|
while ( list($key, $field) = each($used_fields) ) { |
|
|
|
|
1087
|
|
|
|
1088
|
|
|
// Do not show fields not used by the project |
1089
|
|
|
if ( !$field->isUsed()) { continue; } |
1090
|
|
|
|
1091
|
|
|
// Do not show some special fields any way |
1092
|
|
|
if ($field->isSpecial()) { |
1093
|
|
|
if ( ($field->getName() == 'group_id') || |
1094
|
|
|
($field->getName() == 'comment_type_id') ) |
1095
|
|
|
{ continue; } |
1096
|
|
|
} |
1097
|
|
|
|
1098
|
|
|
//Do not show unreadable fields |
1099
|
|
|
if (!$ath->userIsAdmin() && !$field->userCanRead($group_id, $this->group_artifact_id)) { |
1100
|
|
|
continue; |
1101
|
|
|
} |
1102
|
|
|
$cb_search = 'CBSRCH_'.$field->getName(); |
1103
|
|
|
$cb_report = 'CBREP_'.$field->getName(); |
1104
|
|
|
$tf_search = 'TFSRCH_'.$field->getName(); |
1105
|
|
|
$tf_report = 'TFREP_'.$field->getName(); |
1106
|
|
|
$tf_colwidth = 'TFCW_'.$field->getName(); |
1107
|
|
|
|
1108
|
|
|
$rep_field = null; |
1109
|
|
|
if (isset($this->fields[$field->getName()])) { |
1110
|
|
|
$rep_field = $this->fields[$field->getName()]; |
1111
|
|
|
} |
1112
|
|
|
if (!$rep_field) { |
1113
|
|
|
$rep_field = new ArtifactReportField(); |
1114
|
|
|
} |
1115
|
|
|
|
1116
|
|
|
$cb_search_chk = ($rep_field->isShowOnQuery() ? 'CHECKED':''); |
1117
|
|
|
$cb_report_chk = ($rep_field->isShowOnResult() ? 'CHECKED':''); |
1118
|
|
|
$tf_search_val = $rep_field->getPlaceQuery(); |
1119
|
|
|
$tf_report_val = $rep_field->getPlaceResult(); |
1120
|
|
|
$tf_colwidth_val = $rep_field->getColWidth(); |
1121
|
|
|
|
1122
|
|
|
echo '<TR class="'. util_get_alt_row_color($i) .'">'; |
1123
|
|
|
|
1124
|
|
|
echo "\n<td>".$field->getLabel().'</td>'. |
1125
|
|
|
"\n<td>".$field->getDescription().'</td>'. |
1126
|
|
|
"\n<td align=\"center\">".'<input type="checkbox" name="'.$cb_search.'" value="1" '.$cb_search_chk.' ></td>'. |
1127
|
|
|
"\n<td align=\"center\">".'<input type="text" name="'.$tf_search.'" value="'.$tf_search_val.'" size="5" maxlen="5"></td>'. |
1128
|
|
|
"\n<td align=\"center\">".'<input type="checkbox" name="'.$cb_report.'" value="1" '.$cb_report_chk.' ></td>'. |
1129
|
|
|
"\n<td align=\"center\">".'<input type="text" name="'.$tf_report.'" value="'.$tf_report_val.'" size="5" maxlen="5"></td>'. |
1130
|
|
|
"\n<td align=\"center\">".'<input type="text" name="'.$tf_colwidth.'" value="'.$tf_colwidth_val.'" size="5" maxlen="5"></td>'. |
1131
|
|
|
'</TR>'; |
1132
|
|
|
$i++; |
1133
|
|
|
} |
1134
|
|
|
|
1135
|
|
|
} |
1136
|
|
|
|
1137
|
|
|
|
1138
|
|
|
echo '</TABLE>'. |
1139
|
|
|
'<P><CENTER><INPUT TYPE="SUBMIT" VALUE="'.$Language->getText('global','btn_submit').'"></CENTER>'. |
1140
|
|
|
'</FORM>'; |
1141
|
|
|
|
1142
|
|
|
} |
1143
|
|
|
|
1144
|
|
|
|
1145
|
|
|
} |
1146
|
|
|
|
1147
|
|
|
?> |
1148
|
|
|
|
This checks looks for assignemnts to variables using the
list(...)
function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$a
and$c
are used. There was no need to assign$b
.Instead, the list call could have been.