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 if($run && $query_id) {
20 $aq = new ArtifactQuery($ath,$query_id);
21 if (!$aq || !is_object($aq)) {
22 exit_error('Error',$aq->getErrorMessage());
25 $_sort_col=$aq->getSortCol();
26 $_sort_ord=$aq->getSortOrd();
27 $_status=$aq->getStatus();
28 $_assigned_to=$aq->getAssignee();
31 $af = new ArtifactFactory($ath);
32 if (!$af || !is_object($af)) {
33 exit_error('Error','Could Not Get Factory');
34 } elseif ($af->isError()) {
35 exit_error('Error',$af->getErrorMessage());
38 $af->setup($offset,$_sort_col,$_sort_ord,$max_rows,$set,$_assigned_to,$_status,$_changed_from);
39 $_sort_col=$af->order_col;
42 $_assigned_to=$af->assigned_to;
43 $_changed_from=$af->changed_from;
45 $art_arr =& $af->getArtifacts();
47 if (!$art_arr && $af->isError()) {
48 exit_error('Error',$af->getErrorMessage());
51 //build page title to make bookmarking easier
52 //if a user was selected, add the user_name to the title
54 $ath->header(array('titlevals'=>array($ath->getName()),'atid'=>$ath->getID()));
57 <table width="60%" border="0">
58 <form action="'. $PHP_SELF .'?group_id='.$group_id.'&atid='.$ath->getID().'" method="post">';
60 if (!session_loggedin()) {
63 * Build the powerful browsing options pop-up boxes
68 // creating a custom technician box which includes "any" and "unassigned"
70 $res_tech= $ath->getTechnicians();
72 $tech_id_arr=util_result_column_to_array($res_tech,0);
73 $tech_id_arr[]='0'; //this will be the 'any' row
75 $tech_name_arr=util_result_column_to_array($res_tech,1);
76 $tech_name_arr[]=$Language->getText('tracker','any');
78 $tech_box=html_build_select_box_from_arrays ($tech_id_arr,$tech_name_arr,'_assigned_to',$_assigned_to,true,$Language->getText('tracker','unassigned'));
82 // custom order by arrays to build a pop-up box
84 $order_name_arr=array();
85 $order_name_arr[]=$Language->getText('tracker','id');
86 $order_name_arr[]=$Language->getText('tracker','priority');
87 $order_name_arr[]=$Language->getText('tracker','summary');
88 $order_name_arr[]=$Language->getText('tracker','open_date');
89 $order_name_arr[]=$Language->getText('tracker','close_date');
90 $order_name_arr[]=$Language->getText('tracker','submitter');
91 $order_name_arr[]=$Language->getText('tracker','assignee');
95 $order_arr[]='artifact_id';
96 $order_arr[]='priority';
97 $order_arr[]='summary';
98 $order_arr[]='open_date';
99 $order_arr[]='close_date';
100 $order_arr[]='submitted_by';
101 $order_arr[]='assigned_to';
104 // custom sort arrays to build pop-up box
106 $sort_name_arr=array();
107 $sort_name_arr[]=$Language->getText('tracker_browse','ascending');
108 $sort_name_arr[]=$Language->getText('tracker_browse','descending');
115 // custom changed arrays to build pop-up box
117 $changed_name_arr=array();
118 $changed_name_arr[]=$Language->getText('tracker_browse','changed_any');
119 $changed_name_arr[]=$Language->getText('tracker_browse','hour24');
120 $changed_name_arr[]=$Language->getText('tracker_browse','day7');
121 $changed_name_arr[]=$Language->getText('tracker_browse','week2');
122 $changed_name_arr[]=$Language->getText('tracker_browse','month1');
124 $changed_arr=array();
125 $changed_arr[]= 0x7fffffff; // Any
126 $changed_arr[]= 3600 * 24; // 24 hour
127 $changed_arr[]= 3600 * 24 * 7; // 1 week
128 $changed_arr[]= 3600 * 24 * 14;// 2 week
129 $changed_arr[]= 3600 * 24 * 30;// 1 month
132 <input type="hidden" name="set" value="custom" />
134 <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>'.
135 '<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>';
136 '<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>
141 <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>'.
142 '<td colspan="2"><span style="font-size:smaller">'.
143 html_build_select_box_from_arrays($order_arr,$order_name_arr,'_sort_col',$_sort_col,false) .
144 html_build_select_box_from_arrays($sort_arr,$sort_name_arr,'_sort_ord',$_sort_ord,false) .
145 '<input type="submit" name="submit" value="'.$Language->getText('general','browse').'" /></span></td>
148 $res=db_query("SELECT artifact_query_id,query_name
149 FROM artifact_query WHERE user_id='".user_getid()."' AND group_artifact_id='".$ath->getID()."'");
153 if (db_numrows($res)>0) {
155 <td align="right"><span style="font-size:smaller">'.html_build_select_box($res,'query_id',$query_id,false).'</span></td>'.
156 '<td align="left"><span style="font-size:smaller"><input type="submit" name="run" value="'.$Language->getText('tracker','run_query').'"></input></span></td>';
158 echo '<td colspan="2"> </td>';
160 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>
167 * Show the free-form text submitted by the project admin
169 echo $ath->getBrowseInstructions();
171 if ($art_arr && count($art_arr) > 0) {
173 if ($set=='custom') {
174 $set .= '&_assigned_to='.$_assigned_to.'&_status='.$_status.'&_sort_col='.$_sort_col.'&_sort_ord='.$_sort_ord;
178 $IS_ADMIN=$ath->userIsAdmin();
182 <form name="artifactList" action="'. $PHP_SELF .'?group_id='.$group_id.'&atid='.$ath->getID().'" METHOD="POST">
183 <input type="hidden" name="func" value="massupdate">';
186 $display_col=array('summary'=>1,
194 $title_arr[]=$Language->getText('tracker','id');
195 if ($display_col['summary'])
196 $title_arr[]=$Language->getText('tracker','summary');
197 if ($display_col['open_date'])
198 $title_arr[]=$Language->getText('tracker','open_date');
199 if ($display_col['status'])
200 $title_arr[]=$Language->getText('tracker','status');
201 if ($display_col['priority'])
202 $title_arr[]=$Language->getText('tracker','priority');
203 if ($display_col['assigned_to'])
204 $title_arr[]=$Language->getText('tracker','assigned_to');
205 if ($display_col['submitted_by'])
206 $title_arr[]=$Language->getText('tracker','submitted_by');
209 echo $GLOBALS['HTML']->listTableTop ($title_arr);
211 $then=(time()-$ath->getDuePeriod());
212 $rows=count($art_arr);
213 for ($i=0; $i < $rows; $i++) {
215 <tr bgcolor="'. html_get_priority_color( $art_arr[$i]->getPriority() ) .'">'.
217 ($IS_ADMIN?'<input type="CHECKBOX" name="artifact_id_list[]" value="'.
218 $art_arr[$i]->getID() .'"> ':'').
219 $art_arr[$i]->getID() .
221 if ($display_col['summary'])
222 echo '<td><a href="'.$PHP_SELF.'?func=detail&aid='.
223 $art_arr[$i]->getID() .
224 '&group_id='. $group_id .'&atid='.
226 $art_arr[$i]->getSummary().
228 if ($display_col['open_date'])
229 echo '<td>'. (($set != 'closed' && $art_arr[$i]->getOpenDate() < $then)?'* ':' ') .
230 date($sys_datefmt,$art_arr[$i]->getOpenDate()) .'</td>';
231 if ($display_col['status'])
232 echo '<td>'. $art_arr[$i]->getStatusName() .'</td>';
233 if ($display_col['priority'])
234 echo '<td>'. $art_arr[$i]->getPriority() .'</td>';
235 if ($display_col['assigned_to'])
236 echo '<td>'. $art_arr[$i]->getAssignedRealName() .'</td>';
237 if ($display_col['submitted_by'])
238 echo '<td>'. $art_arr[$i]->getSubmittedRealName() .'</td>';
243 Show extra rows for <-- Prev / Next -->
245 if (($offset > 0) || ($rows >= 50)) {
247 <tr><td colspan="2">';
249 echo '<a href="'.$PHP_SELF.'?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
250 $set.'&offset='.($offset-50).'"><strong><-- '.$Language->getText('tracker_browse','previous').'</strong></a>';
254 echo '</td><td> </td><td colspan="2">';
256 echo '<a href="'.$PHP_SELF.'?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
257 $set.'&offset='.($offset+50).'"><strong>'.$Language->getText('tracker_browse','next').' --></strong></a>';
263 echo $GLOBALS['HTML']->listTableBottom();
268 echo '<script language="JavaScript">
270 function checkAll(val) {
271 al=document.artifactList;
272 len = al.elements.length;
274 for( i=0 ; i<len ; i++) {
275 if (al.elements[i].name==\'artifact_id_list[]\') {
276 al.elements[i].checked=val;
283 <table width="100%" border="0">
286 <a href="javascript:checkAll(1)">'.$Language->getText('tracker_browse','check_all').'</a>
288 <a href="javascript:checkAll(0)">'.$Language->getText('tracker_browse','clear_all').'</a>
291 <FONT COLOR="#FF0000">'.$Language->getText('tracker_browse','admin_mass_update').'
296 // build custom fields
298 $ef =& $ath->getExtraFields(ARTIFACT_EXTRAFIELD_FILTER_INT);
299 $keys=array_keys($ef);
302 for ($i=0; $i<count($keys); $i++) {
303 if (($ef[$keys[$i]]['field_type']==ARTIFACT_EXTRAFIELDTYPE_CHECKBOX) || ($ef[$keys[$i]]['field_type']==ARTIFACT_EXTRAFIELDTYPE_MULTISELECT)) {
304 $sel[$keys[$i]]=array('100');
306 $sel[$keys[$i]]='100';
309 $ath->renderExtraFields($sel,true,$Language->getText('tracker_browse','no_change'),false,'',ARTIFACT_EXTRAFIELD_FILTER_INT,true);
311 <td><strong>'.$Language->getText('tracker','priority').': <a href="javascript:help_window(\'/help/tracker.php?helpname=priority\')"><strong>(?)</strong></a>
313 echo build_priority_select_box ('priority', '100', true);
320 <td><strong>'.$Language->getText('tracker','assigned_to').': <a href="javascript:help_window(\'/help/tracker.php?helpname=assignee\')"><strong>(?)</strong></a>
321 </strong><br />'. $ath->technicianBox ('assigned_to','100.1',true,$Language->getText('tracker_artifacttype','nobody'),'100.1',$Language->getText('tracker_browse','no_change')) .'</td>
323 if (!$ath->usesCustomStatuses()) {
324 echo '<strong>'.$Language->getText('tracker','status').': <a href="javascript:help_window(\'/help/tracker.php?helpname=status\')"><strong>(?)</strong></a></strong>
325 <br />'. $ath->statusBox ('status_id','xzxz',true,$Language->getText('tracker_browse','no_change'));
330 <tr><td colspan="2"><strong>'.$Language->getText('tracker_browse','canned_response').':
331 <a href="javascript:help_window(\'/help/tracker.php?helpname=canned_response\')"><strong>(?)</strong></a>
332 </strong><br />'. $ath->cannedResponseBox ('canned_response') .'</td></tr>
334 <tr><td colspan="3" align="MIDDLE"><input type="SUBMIT" name="submit" value="'.$Language->getText('tracker_browse','mass_update').'"></td></tr>
340 echo $Language->getText('tracker_browse','old_requests',array(($ath->getDuePeriod()/86400) ));
341 show_priority_colors_key();
346 <h1>'.$Language->getText('tracker_browse','no_items').'</h1>';
348 //echo "<!-- $sql -->";
352 $ath->footer(array());