3 * SourceForge Generic Tracker facility
5 * SourceForge: Breaking Down the Barriers to Open Source Development
6 * Copyright 1999-2001 (c) VA Linux Systems
7 * http://sourceforge.net
11 require_once('common/tracker/ArtifactFactory.class');
12 require_once('common/tracker/ArtifactQuery.class');
14 // make sure this person has permission to view artifacts
16 if (!$ath->userCanView()) {
17 exit_permission_denied();
19 $run = getStringFromRequest('run');
20 $query_id = getIntFromRequest('query_id');
21 if($run && $query_id) {
22 $aq = new ArtifactQuery($ath,$query_id);
23 if (!$aq || !is_object($aq)) {
24 exit_error('Error',$aq->getErrorMessage());
27 $_sort_col=$aq->getSortCol();
28 $_sort_ord=$aq->getSortOrd();
29 $_status=$aq->getStatus();
30 $_assigned_to=$aq->getAssignee();
33 $af = new ArtifactFactory($ath);
34 if (!$af || !is_object($af)) {
35 exit_error('Error','Could Not Get Factory');
36 } elseif ($af->isError()) {
37 exit_error('Error',$af->getErrorMessage());
40 $offset = getStringFromRequest('offset',$offset);
41 $_sort_col = getStringFromRequest('_sort_col',$_sort_col);
42 $_sort_ord = getStringFromRequest('_sort_ord',$_sort_ord);
43 $max_rows = getStringFromRequest('max_rows',$max_rows);
44 $set = getStringFromRequest('set',$set);
45 $_assigned_to = getStringFromRequest('_assigned_to',$_assigned_to);
46 $_status = getStringFromRequest('_status',$_status);
47 $_category = getStringFromRequest('_category',$_category);
48 $_group = getStringFromRequest('_group',$_group);
49 $_changed_from = getStringFromRequest('_changed_from',$_changed_from);
50 $_resolution = getStringFromRequest('_resolution',$_resolution);
52 $af->setup($offset,$_sort_col,$_sort_ord,$max_rows,$set,$_assigned_to,$_status,$_changed_from);
53 $_sort_col=$af->order_col;
56 $_assigned_to=$af->assigned_to;
57 $_changed_from=$af->changed_from;
59 $art_arr =& $af->getArtifacts();
61 if (!$art_arr && $af->isError()) {
62 exit_error('Error',$af->getErrorMessage());
65 //build page title to make bookmarking easier
66 //if a user was selected, add the user_name to the title
68 $ath->header(array('atid'=>$ath->getID()));
71 <table width="60%" border="0">
72 <form action="'. getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'" method="post">';
74 if (!session_loggedin()) {
77 * Build the powerful browsing options pop-up boxes
82 // creating a custom technician box which includes "any" and "unassigned"
84 $res_tech= $ath->getTechnicians();
86 $tech_id_arr=util_result_column_to_array($res_tech,0);
87 $tech_id_arr[]='0'; //this will be the 'any' row
89 $tech_name_arr=util_result_column_to_array($res_tech,1);
90 $tech_name_arr[]=$Language->getText('tracker','any');
92 $tech_box=html_build_select_box_from_arrays ($tech_id_arr,$tech_name_arr,'_assigned_to',$_assigned_to,true,$Language->getText('tracker','unassigned'));
96 // custom order by arrays to build a pop-up box
98 $order_name_arr=array();
99 $order_name_arr[]=$Language->getText('tracker','id');
100 $order_name_arr[]=$Language->getText('tracker','priority');
101 $order_name_arr[]=$Language->getText('tracker','summary');
102 $order_name_arr[]=$Language->getText('tracker','open_date');
103 $order_name_arr[]=$Language->getText('tracker','close_date');
104 $order_name_arr[]=$Language->getText('tracker','submitter');
105 $order_name_arr[]=$Language->getText('tracker','assignee');
109 $order_arr[]='artifact_id';
110 $order_arr[]='priority';
111 $order_arr[]='summary';
112 $order_arr[]='open_date';
113 $order_arr[]='close_date';
114 $order_arr[]='submitted_by';
115 $order_arr[]='assigned_to';
118 // custom sort arrays to build pop-up box
120 $sort_name_arr=array();
121 $sort_name_arr[]=$Language->getText('tracker_browse','ascending');
122 $sort_name_arr[]=$Language->getText('tracker_browse','descending');
129 // custom changed arrays to build pop-up box
131 $changed_name_arr=array();
132 $changed_name_arr[]=$Language->getText('tracker_browse','changed_any');
133 $changed_name_arr[]=$Language->getText('tracker_browse','hour24');
134 $changed_name_arr[]=$Language->getText('tracker_browse','day7');
135 $changed_name_arr[]=$Language->getText('tracker_browse','week2');
136 $changed_name_arr[]=$Language->getText('tracker_browse','month1');
138 $changed_arr=array();
139 $changed_arr[]= 0x7fffffff; // Any
140 $changed_arr[]= 3600 * 24; // 24 hour
141 $changed_arr[]= 3600 * 24 * 7; // 1 week
142 $changed_arr[]= 3600 * 24 * 14;// 2 week
143 $changed_arr[]= 3600 * 24 * 30;// 1 month
146 <input type="hidden" name="set" value="custom" />
148 <td><span style="font-size:smaller">'.$Language->getText('tracker','assignee').': <a href="javascript:help_window(\'/help/tracker.php?helpname=assignee\')"><strong>(?)</strong></a><br />'. $tech_box .'</span></td>'.
149 '<td><span style="font-size:smaller">'.$Language->getText('tracker','status').': <a href="javascript:help_window(\'/help/tracker.php?helpname=status\')"><strong>(?)</strong></a><br />'. $ath->statusBox('_status',$_status,true,$Language->getText('tracker','status_any')) .'</span></td>';
150 '<td><span style="font-size:smaller">'.$Language->getText('tracker','changed').': <a href="javascript:help_window(\'/help/tracker.php?helpname=changed\')"><strong>(?)</strong></a><br />'. html_build_select_box_from_arrays($changed_arr,$changed_name_arr,'_changed_from',$_changed_from,false) .'</span></td>
155 <td align="right"><span style="font-size:smaller">'.$Language->getText('tracker_browse','sort_by').': <a href="javascript:help_window(\'/help/tracker.php?helpname=sort_by\')"><strong>(?)</strong></a></span></td>'.
156 '<td colspan="2"><span style="font-size:smaller">'.
157 html_build_select_box_from_arrays($order_arr,$order_name_arr,'_sort_col',$_sort_col,false) .
158 html_build_select_box_from_arrays($sort_arr,$sort_name_arr,'_sort_ord',$_sort_ord,false) .
159 '<input type="submit" name="submit" value="'.$Language->getText('general','browse').'" /></span></td>
162 $res=db_query("SELECT artifact_query_id,query_name
163 FROM artifact_query WHERE user_id='".user_getid()."' AND group_artifact_id='".$ath->getID()."'");
167 if (db_numrows($res)>0) {
169 <td align="right"><span style="font-size:smaller">'.html_build_select_box($res,'query_id',$query_id,false).'</span></td>'.
170 '<td align="left"><span style="font-size:smaller"><input type="submit" name="run" value="'.$Language->getText('tracker','run_query').'"></input></span></td>';
172 echo '<td colspan="2"> </td>';
174 echo '<td align="left"><span style="font-size:smaller"><strong><a href="javascript:admin_window(\'/tracker/?func=query&group_id='.$group_id.'&atid='. $ath->getID().'\')">'.$Language->getText('tracker','build_query').'</a></strong></span></td>
181 * Show the free-form text submitted by the project admin
183 echo $ath->getBrowseInstructions();
185 if ($art_arr && count($art_arr) > 0) {
187 if ($set=='custom') {
188 $set .= '&_assigned_to='.$_assigned_to.'&_status='.$_status.'&_sort_col='.$_sort_col.'&_sort_ord='.$_sort_ord;
192 $IS_ADMIN=$ath->userIsAdmin();
196 <form name="artifactList" action="'. getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'" METHOD="POST">
197 <input type="hidden" name="form_key" value="'.form_generate_key().'">
198 <input type="hidden" name="func" value="massupdate">';
201 $display_col=array('summary'=>1,
209 $title_arr[]=$Language->getText('tracker','id');
210 if ($display_col['summary'])
211 $title_arr[]=$Language->getText('tracker','summary');
212 if ($display_col['open_date'])
213 $title_arr[]=$Language->getText('tracker','open_date');
214 if ($display_col['status'])
215 $title_arr[]=$Language->getText('tracker','status');
216 if ($display_col['priority'])
217 $title_arr[]=$Language->getText('tracker','priority');
218 if ($display_col['assigned_to'])
219 $title_arr[]=$Language->getText('tracker','assigned_to');
220 if ($display_col['submitted_by'])
221 $title_arr[]=$Language->getText('tracker','submitted_by');
224 echo $GLOBALS['HTML']->listTableTop ($title_arr);
226 $then=(time()-$ath->getDuePeriod());
227 $rows=count($art_arr);
228 for ($i=0; $i < $rows; $i++) {
230 <tr bgcolor="'. html_get_priority_color( $art_arr[$i]->getPriority() ) .'">'.
232 ($IS_ADMIN?'<input type="CHECKBOX" name="artifact_id_list[]" value="'.
233 $art_arr[$i]->getID() .'"> ':'').
234 $art_arr[$i]->getID() .
236 if ($display_col['summary'])
237 echo '<td><a href="'.getStringFromServer('PHP_SELF').'?func=detail&aid='.
238 $art_arr[$i]->getID() .
239 '&group_id='. $group_id .'&atid='.
241 $art_arr[$i]->getSummary().
243 if ($display_col['open_date'])
244 echo '<td>'. (($set != 'closed' && $art_arr[$i]->getOpenDate() < $then)?'* ':' ') .
245 date($sys_datefmt,$art_arr[$i]->getOpenDate()) .'</td>';
246 if ($display_col['status'])
247 echo '<td>'. $art_arr[$i]->getStatusName() .'</td>';
248 if ($display_col['priority'])
249 echo '<td>'. $art_arr[$i]->getPriority() .'</td>';
250 if ($display_col['assigned_to'])
251 echo '<td>'. $art_arr[$i]->getAssignedRealName() .'</td>';
252 if ($display_col['submitted_by'])
253 echo '<td>'. $art_arr[$i]->getSubmittedRealName() .'</td>';
258 Show extra rows for <-- Prev / Next -->
260 if (($offset > 0) || ($rows >= 50)) {
262 <tr><td colspan="2">';
264 echo '<a href="'.getStringFromServer('PHP_SELF').'?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
265 $set.'&offset='.($offset-50).'&query_id=' . getIntFromRequest('query_id').'"><strong><-- '.$Language->getText('tracker_browse','previous').'</strong></a>';
269 echo '</td><td> </td><td colspan="2">';
271 echo '<a href="'.getStringFromServer('PHP_SELF').'?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
272 $set.'&offset='.($offset+50).'&query_id=' . getIntFromRequest('query_id'). '"><strong>'.$Language->getText('tracker_browse','next').' --></strong></a>';
278 echo $GLOBALS['HTML']->listTableBottom();
283 echo '<script language="JavaScript">
285 function checkAll(val) {
286 al=document.artifactList;
287 len = al.elements.length;
289 for( i=0 ; i<len ; i++) {
290 if (al.elements[i].name==\'artifact_id_list[]\') {
291 al.elements[i].checked=val;
298 <table width="100%" border="0">
301 <a href="javascript:checkAll(1)">'.$Language->getText('tracker_browse','check_all').'</a>
303 <a href="javascript:checkAll(0)">'.$Language->getText('tracker_browse','clear_all').'</a>
306 <FONT COLOR="#FF0000">'.$Language->getText('tracker_browse','admin_mass_update').'
311 // build custom fields
313 $ef =& $ath->getExtraFields(ARTIFACT_EXTRAFIELD_FILTER_INT);
314 $keys=array_keys($ef);
317 for ($i=0; $i<count($keys); $i++) {
318 if (($ef[$keys[$i]]['field_type']==ARTIFACT_EXTRAFIELDTYPE_CHECKBOX) || ($ef[$keys[$i]]['field_type']==ARTIFACT_EXTRAFIELDTYPE_MULTISELECT)) {
319 $sel[$keys[$i]]=array('100');
321 $sel[$keys[$i]]='100';
324 $ath->renderExtraFields($sel,true,$Language->getText('tracker_browse','no_change'),false,'',ARTIFACT_EXTRAFIELD_FILTER_INT,true);
326 <td><strong>'.$Language->getText('tracker','priority').': <a href="javascript:help_window(\'/help/tracker.php?helpname=priority\')"><strong>(?)</strong></a>
328 echo build_priority_select_box ('priority', '100', true);
335 <td><strong>'.$Language->getText('tracker','assigned_to').': <a href="javascript:help_window(\'/help/tracker.php?helpname=assignee\')"><strong>(?)</strong></a>
336 </strong><br />'. $ath->technicianBox ('assigned_to','100.1',true,$Language->getText('tracker_artifacttype','nobody'),'100.1',$Language->getText('tracker_browse','no_change')) .'</td>
338 if (!$ath->usesCustomStatuses()) {
339 echo '<strong>'.$Language->getText('tracker','status').': <a href="javascript:help_window(\'/help/tracker.php?helpname=status\')"><strong>(?)</strong></a></strong>
340 <br />'. $ath->statusBox ('status_id','xzxz',true,$Language->getText('tracker_browse','no_change'));
345 <tr><td colspan="2"><strong>'.$Language->getText('tracker_browse','canned_response').':
346 <a href="javascript:help_window(\'/help/tracker.php?helpname=canned_response\')"><strong>(?)</strong></a>
347 </strong><br />'. $ath->cannedResponseBox ('canned_response') .'</td></tr>
349 <tr><td colspan="3" align="MIDDLE"><input type="SUBMIT" name="submit" value="'.$Language->getText('tracker_browse','mass_update').'"></td></tr>
355 echo $Language->getText('tracker_browse','old_requests',array(($ath->getDuePeriod()/86400) ));
356 show_priority_colors_key();
361 <h1>'.$Language->getText('tracker_browse','no_items').'</h1>';
363 //echo "<!-- $sql -->";
367 $ath->footer(array());