<?php
/**
- *
- * SourceForge Generic Tracker facility
- *
- * SourceForge: Breaking Down the Barriers to Open Source Development
- * Copyright 1999-2001 (c) VA Linux Systems
- * http://sourceforge.net
- *
- * @version $Id$
- *
- */
-require_once('common/tracker/ArtifactFactory.class');
+ * FusionForge Tracker
+ *
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2010 Roland Mas
+ * Copyright 2010 Alain Peyrat, Alcatel-Lucent
+ *
+ */
+require_once $gfcommon.'tracker/ArtifactFactory.class.php';
+require_once $gfcommon.'tracker/ArtifactQuery.class.php';
//
// make sure this person has permission to view artifacts
//
exit_permission_denied();
}
+$query_id = getIntFromRequest('query_id');
+$start = getIntFromRequest('start');
+
+$pagelength = 25 ;
+
+//
+// The browse page can be powered by a pre-saved query
+// or by select boxes chosen by the user
+//
+// If there is a $query_id coming from the request OR the pref
+// was already saved, use the artifact factory that way.
+//
+// If the query_id = -1, unset the pref and use regular browse boxes
+//
+if (session_loggedin()) {
+ if($query_id) {
+ if ($query_id == '-1') {
+ $u =& session_get_user();
+ $u->setPreference('art_query'.$ath->getID(),'');
+ } else {
+ $aq = new ArtifactQuery($ath,$query_id);
+ if (!$aq || !is_object($aq)) {
+ exit_error('Error',$aq->getErrorMessage());
+ }
+ $aq->makeDefault();
+ }
+ } else {
+ $u =& session_get_user();
+ $query_id=$u->getPreference('art_query'.$ath->getID(),'');
+ }
+} elseif ($query_id) {
+ // If user is not logged, then use a cookie to store the current query.
+ if (isset($_COOKIE["GFTrackerQuery"])) {
+ $gf_tracker = unserialize($_COOKIE["GFTrackerQuery"]);
+ } else {
+ $gf_tracker = array();
+ }
+ $gf_tracker[$ath->getID()] = $query_id;
+ // Send the query_id as a cookie to save it.
+ setcookie("GFTrackerQuery", serialize($gf_tracker));
+ $_COOKIE["GFTrackerQuery"] = serialize($gf_tracker);
+} elseif (isset($_COOKIE["GFTrackerQuery"])) {
+ $gf_tracker = unserialize($_COOKIE["GFTrackerQuery"]);
+ $query_id = (int)$gf_tracker[$ath->getID()];
+}
+
$af = new ArtifactFactory($ath);
+
if (!$af || !is_object($af)) {
exit_error('Error','Could Not Get Factory');
} elseif ($af->isError()) {
exit_error('Error',$af->getErrorMessage());
}
-$af->setup($offset,$_sort_col,$_sort_ord,$max_rows,$set,$_assigned_to,$_status,$_category,$_group,$_changed_from);
+if (!isset($_sort_col)) {
+ /* default sort order: highest priority first */
+ $_sort_col = 'priority';
+ $_sort_ord = 'DESC';
+}
+$offset = getStringFromRequest('offset');
+$_sort_col = getStringFromRequest('_sort_col',$_sort_col);
+$_sort_ord = getStringFromRequest('_sort_ord',$_sort_ord);
+$max_rows = getIntFromRequest('max_rows', 25);
+$set = getStringFromRequest('set');
+$_assigned_to = getIntFromRequest('_assigned_to');
+$_status = getIntFromRequest('_status');
+$_extra_fields = array() ;
+$aux_extra_fields = array() ;
+if ($set == 'custom') {
+ //
+ //may be past in next/prev url
+ //
+ if (isset($_GET['extra_fields'][$ath->getCustomStatusField()])) {
+ $_extra_fields[$ath->getCustomStatusField()] = $_GET['extra_fields'][$ath->getCustomStatusField()];
+ } elseif (isset($_POST['extra_fields'][$ath->getCustomStatusField()])) {
+ $_extra_fields[$ath->getCustomStatusField()] = $_POST['extra_fields'][$ath->getCustomStatusField()];
+ }
+}
+
+if (is_array($_extra_fields)){
+ $keys=array_keys($_extra_fields);
+ foreach ($keys as $key) {
+ if ($_extra_fields[$key] != 'Array') {
+ $aux_extra_fields[$key] = $_extra_fields[$key];
+ }
+ }
+} else {
+ if (isset($_extra_fields)){
+ $aux_extra_fields = $_extra_fields;
+ } else {
+ $aux_extra_fields = '';
+ }
+}
+
+$af->setup($offset,$_sort_col,$_sort_ord,$pagelength,$set,$_assigned_to,$_status,$aux_extra_fields);
+//
+// These vals are sanitized and/or retrieved from ArtifactFactory stored settings
+//
$_sort_col=$af->order_col;
$_sort_ord=$af->sort;
$_status=$af->status;
$_assigned_to=$af->assigned_to;
-$_category=$af->category;
-$_group=$af->group;
-$_changed_from=$af->changed_from;
+$_extra_fields=$af->extra_fields;
$art_arr =& $af->getArtifacts();
+
if (!$art_arr && $af->isError()) {
exit_error('Error',$af->getErrorMessage());
}
//build page title to make bookmarking easier
//if a user was selected, add the user_name to the title
//same for status
-$ath->header(array('titlevals'=>array($ath->getName()),'pagename'=>'tracker_browse',
- 'atid'=>$ath->getID(),'sectionvals'=>array($group->getPublicName())));
+$ath->header(array('atid'=>$ath->getID(), 'title'=>$ath->getName()));
/**
*
$tech_id_arr[]='0'; //this will be the 'any' row
$tech_name_arr=util_result_column_to_array($res_tech,1);
-$tech_name_arr[]=$Language->getText('tracker','any');
+$tech_name_arr[]=_('Any');
-$tech_box=html_build_select_box_from_arrays ($tech_id_arr,$tech_name_arr,'_assigned_to',$_assigned_to,true,$Language->getText('tracker','unassigned'));
+if (is_array($_assigned_to)) {
+ $_assigned_to='';
+}
+$tech_box=html_build_select_box_from_arrays ($tech_id_arr,$tech_name_arr,'_assigned_to',$_assigned_to,true,_('Unassigned'));
//
// custom order by arrays to build a pop-up box
//
$order_name_arr=array();
-$order_name_arr[]=$Language->getText('tracker','id');
-$order_name_arr[]=$Language->getText('tracker','priority');
-$order_name_arr[]=$Language->getText('tracker','summary');
-$order_name_arr[]=$Language->getText('tracker','open_date');
-$order_name_arr[]=$Language->getText('tracker','close_date');
-$order_name_arr[]=$Language->getText('tracker','submitter');
-$order_name_arr[]=$Language->getText('tracker','assignee');
+$order_name_arr[]=_('ID');
+$order_name_arr[]=_('Priority');
+$order_name_arr[]=_('Summary');
+$order_name_arr[]=_('Open Date');
+$order_name_arr[]=_('Close Date');
+$order_name_arr[]=_('Submitter');
+$order_name_arr[]=_('Assignee');
$order_arr=array();
// custom sort arrays to build pop-up box
//
$sort_name_arr=array();
-$sort_name_arr[]=$Language->getText('tracker_browse','ascending');
-$sort_name_arr[]=$Language->getText('tracker_browse','descending');
+$sort_name_arr[]=_('Ascending');
+$sort_name_arr[]=_('Descending');
$sort_arr=array();
$sort_arr[]='ASC';
// custom changed arrays to build pop-up box
//
$changed_name_arr=array();
-$changed_name_arr[]=$Language->getText('tracker_browse','changed_any');
-$changed_name_arr[]=$Language->getText('tracker_browse','hour24');
-$changed_name_arr[]=$Language->getText('tracker_browse','day7');
-$changed_name_arr[]=$Language->getText('tracker_browse','week2');
-$changed_name_arr[]=$Language->getText('tracker_browse','month1');
+$changed_name_arr[]=_('Any changes');
+$changed_name_arr[]=_('Last 24H');
+$changed_name_arr[]=_('Last 7days');
+$changed_name_arr[]=_('Last 2weeks');
+$changed_name_arr[]=_('Last 1month');
$changed_arr=array();
-$changed_arr[]= 0x7fffffff; // Any
-$changed_arr[]= 3600 * 24; // 24 hour
+$changed_arr[]= 0x7fffffff; // Any
+$changed_arr[]= 3600 * 24; // 24 hour
$changed_arr[]= 3600 * 24 * 7; // 1 week
$changed_arr[]= 3600 * 24 * 14;// 2 week
$changed_arr[]= 3600 * 24 * 30;// 1 month
+/**
+ *
+ * Show the free-form text submitted by the project admin
+ */
+echo $ath->renderBrowseInstructions();
//
-// Show the new pop-up boxes to select assigned to, status, etc
+// statuses can be custom in GForge 4.5+
//
+if ($ath->usesCustomStatuses()) {
+ $aux_extra_fields = array();
+ if (is_array($_extra_fields)){
+ $keys=array_keys($_extra_fields);
+ foreach ($keys as $key) {
+ if (!is_array($_extra_fields[$key])) {
+ $aux_extra_fields[$key] = $_extra_fields[$key];
+ }
+ }
+ } else {
+ $aux_extra_fields = $_extra_fields;
+ }
+ $status_box=$ath->renderSelect ($ath->getCustomStatusField(),$aux_extra_fields[$ath->getCustomStatusField()],false,'',true,_('Any'));
+} else {
+ if (is_array($_status)) {
+ $_status='';
+ }
+ $status_box = $ath->statusBox('_status',$_status,true,_('Any'));
+}
+echo '<script type="text/javascript" src="/tabber/tabber.js"></script>'."\n";
+
+// start of RDFa
+$proj_name = $group->getUnixName();
+$proj_url = util_make_url_g($group->getUnixName(),$group_id);
+// the tracker's URIs are constructed in order to support addition of an OSLC-CM REST server
+// inside /tracker/cm/. There each tracker has a URL in the form .../project/PROJ_NAME/atid/ATID
+$tracker_stdzd_uri = util_make_url('/tracker/cm/project/'. $proj_name .'/atid/'. $ath->getID());
+print '<div about="'. $tracker_stdzd_uri
+ .'" typeof="sioc:Container" xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:doap="http://usefulinc.com/ns/doap#">'."\n";
+print '<span rel="http://www.w3.org/2002/07/owl#sameAs" resource="" />'."\n";
+print '<span rev="doap:bug-database sioc:space_of" resource="'. $proj_url .'" />'."\n";
+print "</div>\n"; // end of about
echo '
-<table width="10%" border="0">
- <form action="'. $PHP_SELF .'?group_id='.$group_id.'&atid='.$ath->getID().'" method="post">
- <input type="hidden" name="set" value="custom" />
+<div id="tabber" class="tabber">
+ <div class="tabbertab" title="'._('Advanced queries').'">';
+
+if (session_loggedin()) {
+ $res = db_query_params ('SELECT artifact_query_id,query_name, CASE WHEN query_type>0 THEN 1 ELSE 0 END as type
+ FROM artifact_query
+ WHERE group_artifact_id=$1 AND (user_id=$2 OR query_type>0)
+ ORDER BY type ASC, query_name ASC',
+ array ($ath->getID(),
+ user_getid()));
+} else {
+ $res = db_query_params ('SELECT artifact_query_id,query_name, CASE WHEN query_type>0 THEN 1 ELSE 0 END as type
+ FROM artifact_query
+ WHERE group_artifact_id=$1 AND query_type>0
+ ORDER BY type ASC, query_name ASC',
+ array ($ath->getID()));
+}
+
+
+if (db_numrows($res)>0) {
+ echo '<form action="'. getStringFromServer('PHP_SELF') .'" method="get">';
+ echo ' <table width="100%" cellspacing="0">
<tr>
- <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>'.
- '<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>'.
- '<td><span style="font-size:smaller">'.$Language->getText('tracker','category').': <a href="javascript:help_window(\'/help/tracker.php?helpname=category\')"><strong>(?)</strong></a><br />'. $ath->categoryBox ('_category',$_category,$Language->getText('tracker','category_any')) .'</span></td>'.
- '<td><span style="font-size:smaller">'.$Language->getText('tracker','group').': <a href="javascript:help_window(\'/help/tracker.php?helpname=group\')"><strong>(?)</strong></a><br />'. $ath->artifactGroupBox ('_group',$_group,$Language->getText('tracker','group_any')) .'</span></td>' .
- '<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>
- </tr>
+ <td>
+ ';
+ echo '<input type="hidden" name="group_id" value="'.$group_id.'" />';
+ echo '<input type="hidden" name="atid" value="'.$ath->getID().'" />';
+ echo '<input type="hidden" name="power_query" value="1" />';
+ $optgroup['key'] = 'type';
+ $optgroup['values'][0] = 'Private queries';
+ $optgroup['values'][1] = 'Project queries';
+ echo '<span style="font-size:smaller">';
+ echo '<select name="query_id">';
+ echo '<option value="100">Select One</option>';
+ $current = '';
+ $selected = $af->getDefaultQuery();
+ while ($row = db_fetch_array($res)) {
+ if ($current != $row['type']) {
+ if ($current !== '')
+ echo '</optgroup>';
+ $label = $row['type'] ? 'Project' : 'Private';
+ echo '<optgroup label="'.$label.'">';
+ $current = $row['type'];
+ }
+ echo '<option value="'.$row['artifact_query_id'].'"';
+ if ($row['artifact_query_id'] == $selected)
+ echo ' selected="selected"';
+ echo '>'. $row['query_name'] .'</option>'."\n";
+ }
+ if ($current !== '')
+ echo '</optgroup>';
+ echo '</select>';
+ echo '</span>
+ <input type="submit" name="run" value="'._('Power Query').'" />
+ <a href="/tracker/?atid='. $ath->getID().'&group_id='.$group_id.'&func=query">'.
+ _('Build Query').'</a>
+ </td></tr></table>
+ </form>';
+} else {
+ echo '<strong>
+ <a href="/tracker/?atid='. $ath->getID().'&group_id='.$group_id.'&func=query">'._('Build Query').'</a></strong>';
+}
+echo '
+ </div>
+ <div class="tabbertab'.($af->query_type == 'custom' ? ' tabbertabdefault' : '').'" title="'._('Simple Filtering and Sorting').'">
+ <form action="'. getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'" method="post">
+ <table width="100%" cellspacing="0">
<tr>
- <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>'.
- '<td><span style="font-size:smaller">'.
- html_build_select_box_from_arrays($order_arr,$order_name_arr,'_sort_col',$_sort_col,false) .'</td>'.
- '<td><span style="font-size:smaller">'.html_build_select_box_from_arrays($sort_arr,$sort_name_arr,'_sort_ord',$_sort_ord,false) .'</td>'.
- '<td><span style="font-size:smaller"><input type="submit" name="submit" value="'.$Language->getText('general','browse').'" /></td>
- </tr>
- </form></table>';
+ <td>
+ <input type="hidden" name="query_id" value="-1" />
+ <input type="hidden" name="set" value="custom" />
+ '._('Assignee').': '. $tech_box .'
+ </td>
+ <td align="center">
+ '._('State').': '. $status_box .'
+ </td>
+ <td align="right">';
+
+// Compute the list of fields which can be sorted.
+// Currently, only text & integer are taken (for simplicity only).
+$efarr = $ath->getExtraFields(ARTIFACT_EXTRAFIELDTYPE_TEXT.",".ARTIFACT_EXTRAFIELDTYPE_INTEGER);
+$keys=array_keys($efarr);
+for ($k=0; $k<count($keys); $k++) {
+ $i=$keys[$k];
+ $order_name_arr[] = $efarr[$i]['field_name'];
+ $order_arr[] = $efarr[$i]['extra_field_id'];
+}
+
+echo _('Order by').
+ ': <a href="javascript:help_window(\'/help/tracker.php?helpname=sort_by\')">' .
+ '<strong>(?)</strong></a>'.
+ html_build_select_box_from_arrays($order_arr,$order_name_arr,'_sort_col',$_sort_col,false) .
+ html_build_select_box_from_arrays($sort_arr,$sort_name_arr,'_sort_ord',$_sort_ord,false) .
+ '<input type="submit" name="submit" value="'._('Quick Browse').'" />';
-/*
- Show the free-form text submitted by the project admin
-*/
-echo $ath->getBrowseInstructions();
+echo '
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>';
+if ($af->query_type == 'default') {
+ echo '<div class="tabbertab tabbertabdefault" title="'._('Default').'">';
+ echo '<strong>'._('Viewing only opened records by default, use \'Advanced queries\' or \'Simple Filtering and Sorting\' to change.').'</strong>';
+ echo '</div>';
+}
+echo '
+</div>';
if ($art_arr && count($art_arr) > 0) {
+ if ($query_id) {
+ $aq = new ArtifactQuery($ath,$query_id);
+ $has_bargraph = (in_array('bargraph', $aq->getQueryOptions()));
+ } else {
+ $has_bargraph = false;
+ }
+
+ if ($has_bargraph) {
+ // Display the roadmap block based on the values of the Status field.
+ $colors = array('#a71d16', '#ffa0a0', '#f5f5b5', '#bae0ba', '#16a716');
+ $count = array();
+ $percent = array();
+ foreach($art_arr as $art) {
+ if ($ath->usesCustomStatuses()) {
+ $custom_id = $ath->getCustomStatusField();
+ $extra_data = $art->getExtraFieldDataText();
+ $count[ $extra_data[$custom_id]['value'] ]++;
+ } else {
+ $count[ $art->getStatusName()]++;
+ }
+ }
+ foreach($count as $n => $c) {
+ $percent[$n] = round(100*$c/count($art_arr));
+ }
+
+ $i=0;
+ $efarr =& $ath->getExtraFields(ARTIFACT_EXTRAFIELDTYPE_STATUS);
+ $keys=array_keys($efarr);
+ $field_id = $keys[0];
+ $states = $ath->getExtraFieldElements($field_id);
+ $graph = '';
+ $legend = '';
+ if (is_array($states)) {
+ foreach($states as $state) {
+ $name = $state['element_name'];
+ if ($count[$name]) {
+ $graph .= '<td style="background: '.$colors[$i].'; width: '.$percent[$name].'%;"> </td>';
+ $legend .= '<td style="white-space: nowrap; width: '.$percent[$name].'%;">'."<i>$name: $count[$name] ($percent[$name]%)</i></td>";
+ }
+ $i++;
+ }
+ }
+
+ if ($graph) {
+ ?>
+ <table class="progress">
+ <tbody>
+ <tr><?php echo $graph; ?></tr>
+ </tbody>
+ </table>
+ <table class="progress_legend">
+ <tr><?php echo $legend ?></tr>
+ </table>
+ <?php
+ }
+ }
+
if ($set=='custom') {
- $set .= '&_assigned_to='.$_assigned_to.'&_status='.$_status.'&_category='.$_category.'&_group='.$_group.'&_sort_col='.$_sort_col.'&_sort_ord='.$_sort_ord;
+ $set .= '&_assigned_to='.$_assigned_to.'&_status='.$_status.'&_sort_col='.$_sort_col.'&_sort_ord='.$_sort_ord;
+ if (array_key_exists($ath->getCustomStatusField(),$_extra_fields)) {
+ $set .= '&extra_fields['.$ath->getCustomStatusField().']='.$_extra_fields[$ath->getCustomStatusField()];
+ }
}
- $title_arr=array();
- $title_arr[]=$Language->getText('tracker','id');
- $title_arr[]=$Language->getText('tracker','summary');
- $title_arr[]=$Language->getText('tracker','open_date');
- $title_arr[]=$Language->getText('tracker','assigned_to');
- $title_arr[]=$Language->getText('tracker','submitted_by');
$IS_ADMIN=$ath->userIsAdmin();
if ($IS_ADMIN) {
echo '
- <form name="artifactList" action="'. $PHP_SELF .'?group_id='.$group_id.'&atid='.$ath->getID().'" METHOD="POST">
- <input type="hidden" name="func" value="massupdate">';
+ <form name="artifactList" action="'. getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'" method="post">
+ <input type="hidden" name="form_key" value="'.form_generate_key().'" />
+ <input type="hidden" name="func" value="massupdate" />';
+ }
+
+ $browse_fields = explode(',', "id,".$ath->getBrowseList());
+ $title_arr=array();
+ foreach ($browse_fields as $f) {
+ $title=$f;
+ if (intval($f) > 0) {
+ $title = $ath->getExtraFieldName($f);
+ } else {
+ if ($f == 'id')
+ $title=_('ID');
+ if ($f == 'summary')
+ $title=_('Summary');
+ if ($f == 'details')
+ $title=_('Description');
+ if ($f == 'open_date')
+ $title=_('Open Date');
+ if ($f == 'close_date')
+ $title=_('Close Date');
+ if ($f == 'status_id')
+ $title=_('State');
+ if ($f == 'priority')
+ $title=_('Priority');
+ if ($f == 'assigned_to')
+ $title=_('Assigned to');
+ if ($f == 'submitted_by')
+ $title=_('Submitted by');
+ if ($f == 'related_tasks')
+ $title=_('Related tasks');
+ }
+ $title_arr[] = $title;
}
echo $GLOBALS['HTML']->listTableTop ($title_arr);
$then=(time()-$ath->getDuePeriod());
- $rows=count($art_arr);
- for ($i=0; $i < $rows; $i++) {
-/*
- //BAD DESIGN - You don't do subqueries like this - it kills performance.
- //The proper way is to do it in ArtifactFactory by adding a count(*) and left join to the comments table
-
- $comment_count = db_numrows($art_arr[$i]->getMessages());
- if ($comment_count == 0 || $comment_count > 1) {
- $comment_msg = "$comment_count ".$Language->getText('tracker','comments');
- } else {
- $comment_msg = "$comment_count ".$Language->getText('tracker','comment');
- }
-*/
+
+ $max = ((count($art_arr) > ($start + $pagelength)) ? ($start+$pagelength) : count($art_arr) );
+//echo "max: $max";
+ for ($i=$start; $i<$max; $i++) {
+ $extra_data = $art_arr[$i]->getExtraFieldDataText();
echo '
- <tr bgcolor="'. html_get_priority_color( $art_arr[$i]->getPriority() ) .'">'.
- '<td NOWRAP>'.
- ($IS_ADMIN?'<input type="CHECKBOX" name="artifact_id_list[]" value="'.
- $art_arr[$i]->getID() .'"> ':'').
- $art_arr[$i]->getID() .
- '</td>'.
- '<td><a href="'.$PHP_SELF.'?func=detail&aid='.
- $art_arr[$i]->getID() .
- '&group_id='. $group_id .'&atid='.
- $ath->getID().'">'.
- $art_arr[$i]->getSummary() .
- // ' ('. $comment_msg . ')'.
- '</a></td>'.
- '<td>'. (($set != 'closed' && $art_arr[$i]->getOpenDate() < $then)?'* ':' ') .
- date($sys_datefmt,$art_arr[$i]->getOpenDate()) .'</td>'.
- '<td>'. $art_arr[$i]->getAssignedRealName() .'</td>'.
- '<td>'. $art_arr[$i]->getSubmittedRealName() .'</td></tr>';
+ <tr '. $HTML->boxGetAltRowStyle($i) . '>';
+ foreach ($browse_fields as $f) {
+ if ($f == 'id') {
+ echo '<td style="white-space: nowrap;">'.
+ ($IS_ADMIN?'<input type="checkbox" name="artifact_id_list[]" value="'.
+ $art_arr[$i]->getID() .'" /> ':'').
+ '<a href="'.getStringFromServer('PHP_SELF').'?func=detail&aid='.
+ $art_arr[$i]->getID() .
+ '&group_id='. $group_id .'&atid='.
+ $ath->getID().'">'.$art_arr[$i]->getID() .
+ '</a></td>';
+ } else if ($f == 'summary') {
+ echo '<td><a href="'.getStringFromServer('PHP_SELF').'?func=detail&aid='.
+ $art_arr[$i]->getID() .
+ '&group_id='. $group_id .'&atid='.
+ $ath->getID().'">'.
+ $art_arr[$i]->getSummary().
+ '</a></td>';
+ } else if ($f == 'open_date') {
+ echo '<td>'. (($set != 'closed' && $art_arr[$i]->getOpenDate() < $then)?'* ':' ') .
+ date(_('Y-m-d H:i'),$art_arr[$i]->getOpenDate()) .'</td>';
+ } else if ($f == 'status_id') {
+ echo '<td>'. $art_arr[$i]->getStatusName() .'</td>';
+ } else if ($f == 'priority') {
+ echo '<td class="priority'.$art_arr[$i]->getPriority() .'">'. $art_arr[$i]->getPriority() .'</td>';
+ } else if ($f == 'assigned_to') {
+ echo '<td>'. $art_arr[$i]->getAssignedRealName() .'</td>';
+ } else if ($f == 'submitted_by') {
+ echo '<td>'. $art_arr[$i]->getSubmittedRealName() .'</td>';
+ } else if ($f == 'close_date') {
+ echo '<td>'. ($art_arr[$i]->getCloseDate() ?
+ date(_('Y-m-d H:i'),$art_arr[$i]->getCloseDate()) :' ') .'</td>';
+ } else if ($f == 'details') {
+ echo '<td>'. $art_arr[$i]->getDetails() .'</td>';
+ } else if ($f == 'related_tasks') {
+ echo '<td>';
+ $tasks_res = $art_arr[$i]->getRelatedTasks();
+ $s ='';
+ while ($rest = db_fetch_array($tasks_res)) {
+ $link = '/pm/task.php?func=detailtask&project_task_id='.$rest['project_task_id'].
+ '&group_id='.$group_id.'&group_project_id='.$rest['group_project_id'];
+ $title = '[T'.$rest['project_task_id'].']';
+ if ($rest['status_id'] == 2) {
+ $title = '<strike>'.$title.'</strike>';
+ }
+ print $s.'<a href="'.$link.'" title="'.$rest['summary'].'">'.$title.'</a>';
+ $s = ' ';
+ }
+ echo '</td>';
+ } else if (intval($f) > 0) {
+ // Now display extra-fields (fields are numbers).
+ $value = $extra_data[$f]['value'];
+ if ($extra_data[$f]['type'] == 9) {
+ $value = preg_replace('/\b(\d+)\b/e', "_artifactid2url('\\1')", $value);
+ } else if ($extra_data[$f]['type'] == 7) {
+ if ($art_arr[$i]->getStatusID() == 2) {
+ $value = '<strike>'.$value.'</strike>';
+ }
+
+ }
+ echo '<td>' . $value .'</td>';
+ } else {
+ // Display ? for unknown values.
+ echo '<td>?</td>';
+ }
+ }
+ echo '</tr>';
}
/*
Show extra rows for <-- Prev / Next -->
- */
- if (($offset > 0) || ($rows >= 50)) {
- echo '
- <tr><td colspan="2">';
- if ($offset > 0) {
- echo '<a href="'.$PHP_SELF.'?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
- $set.'&offset='.($offset-50).'"><strong><-- '.$Language->getText('tracker_browse','previous').'</strong></a>';
- } else {
- echo ' ';
+ * /
+ //only show this if we're not using a power query
+ if ($af->max_rows > 0) {
+ if (($offset > 0) || ($rows >= 50)) {
+ echo '
+ <tr><td colspan="2">';
+ if ($offset > 0) {
+ echo '<a href="'.getStringFromServer('PHP_SELF').'?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
+ $set.'&offset='.($offset-50).'"><strong><-- '._('Previous 50').'</strong></a>';
+ } else {
+ echo ' ';
+ }
+ echo '</td><td> </td><td colspan="2">';
+ if ($rows >= 50) {
+ echo '<a href="'.getStringFromServer('PHP_SELF').'?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
+ $set.'&offset='.($offset+50).'"><strong>'._('Next 50').' --></strong></a>';
+ } else {
+ echo ' ';
+ }
+ echo '</td></tr>';
}
- echo '</td><td> </td><td colspan="2">';
- if ($rows >= 50) {
- echo '<a href="'.$PHP_SELF.'?func=browse&group_id='.$group_id.'&atid='.$ath->getID().'&set='.
- $set.'&offset='.($offset+50).'"><strong>'.$Language->getText('tracker_browse','next').' --></strong></a>';
- } else {
- echo ' ';
+ }
+ */
+ echo $GLOBALS['HTML']->listTableBottom();
+ $pages = count($art_arr) / $pagelength;
+ $currentpage = intval($start / $pagelength);
+//echo "Item Count: ".count($arr)."Pages: $pages";
+ if ($pages >= 1) {
+ $skipped_pages=false;
+ for ($j=0; $j<$pages; $j++) {
+ if ($pages > 20) {
+ if ((($j > 4) && ($j < ($currentpage-5))) || (($j > ($currentpage+5)) && ($j < ($pages-5)))) {
+ if (!$skipped_pages) {
+ $skipped_pages=true;
+ echo ".... ";
+ }
+ continue;
+ } else {
+ $skipped_pages=false;
+ }
+ }
+ if ($j == $currentpage) {
+ echo '<strong>'.($j+1).'</strong> ';
+ } else {
+ echo '<a href="'.getStringFromServer('PHP_SELF')."?func=browse&group_id=".$group_id.'&atid='.$ath->getID().'&set='. $set.'&start='.($j*$pagelength).'"><strong>'.($j+1).'</strong></a> ';
+ }
}
- echo '</td></tr>';
}
- echo $GLOBALS['HTML']->listTableBottom();
/*
Mass Update Code
*/
if ($IS_ADMIN) {
- echo '<script language="JavaScript">
+ echo '<script type="text/javascript">
<!--
function checkAll(val) {
al=document.artifactList;
//-->
</script>
- <table width="100%" border="0">
+ <table width="100%" border="0" id="admin_mass_update">
<tr><td colspan="2">
-<font size=1>
-<a href="javascript:checkAll(1)">'.$Language->getText('tracker_browse','check_all').'</a>
+
+<a href="javascript:checkAll(1)">'._('Check all').'</a>
-
- <a href="javascript:checkAll(0)">'.$Language->getText('tracker_browse','clear_all').'</a>
-</font>
+ <a href="javascript:checkAll(0)">'._('Clear all').'</a>
+
<p>
-<FONT COLOR="#FF0000">'.$Language->getText('tracker_browse','admin_mass_update').'
- </td></tr>
+<span class="important">'._('<strong>Admin:</strong> If you wish to apply changes to all items selected above, use these controls to change their properties and click once on "Mass Update".').'</span></p>
+ </td></tr>';
- <tr>
- <td><strong>'.$Language->getText('tracker','category').': <a href="javascript:help_window(\'/help/tracker.php?helpname=category\')"><strong>(?)</strong></a>
- </strong><br />'. $ath->categoryBox ('category_id','xzxz',$Language->getText('tracker_browse','no_change')) .'</td>
- <td><strong>'.$Language->getText('tracker','group').': <a href="javascript:help_window(\'/help/tracker.php?helpname=group\')"><strong>(?)</strong></a></strong>
- <br />'. $ath->artifactGroupBox ('artifact_group_id','xzxz',$Language->getText('tracker_browse','no_change')) .'</td>
- </tr>
- <tr>
- <td><strong>'.$Language->getText('tracker','priority').': <a href="javascript:help_window(\'/help/tracker.php?helpname=priority\')"><strong>(?)</strong></a>
+ //
+ // build custom fields
+ //
+ $ef =& $ath->getExtraFields(ARTIFACT_EXTRAFIELD_FILTER_INT);
+ $keys=array_keys($ef);
+
+ $sel=array();
+ for ($i=0; $i<count($keys); $i++) {
+ if (($ef[$keys[$i]]['field_type']==ARTIFACT_EXTRAFIELDTYPE_CHECKBOX) || ($ef[$keys[$i]]['field_type']==ARTIFACT_EXTRAFIELDTYPE_MULTISELECT)) {
+ $sel[$keys[$i]]=array('100');
+ } else {
+ $sel[$keys[$i]]='100';
+ }
+ }
+ $ath->renderExtraFields($sel,true,_('No Change'),false,'',ARTIFACT_EXTRAFIELD_FILTER_INT,true);
+ echo '<tr>
+ <td><strong>'._('Priority').': <a href="javascript:help_window(\'/help/tracker.php?helpname=priority\')"><strong>(?)</strong></a>
</strong><br />';
- echo build_priority_select_box ('priority', '100', true);
- echo '</td><td>';
- if ($ath->useResolution()) {
- echo '
- <strong>'.$Language->getText('tracker_browse','resolution').': <a href="javascript:help_window(\'/help/tracker.php?helpname=resolution\')"><strong>(?)</strong></a>
- </strong><br />';
- echo $ath->resolutionBox('resolution_id','xzxz',true,$Language->getText('tracker_browse','no_change'));
- } else {
- echo '
- <input type="hidden" name="resolution_id" value="100">';
- }
+ echo build_priority_select_box ('priority', '100', true);
+ echo '</td><td>';
- echo '</td>
+ echo '</td>
</tr>
<tr>
- <td><strong>'.$Language->getText('tracker','assigned_to').': <a href="javascript:help_window(\'/help/tracker.php?helpname=assignee\')"><strong>(?)</strong></a>
- </strong><br />'. $ath->technicianBox ('assigned_to','100.1',true,$Language->getText('tracker_artifacttype','nobody'),'100.1',$Language->getText('tracker_browse','no_change')) .'</td>
- <td><strong>'.$Language->getText('tracker','status').': <a href="javascript:help_window(\'/help/tracker.php?helpname=status\')"><strong>(?)</strong></a></strong>
- <br />'. $ath->statusBox ('status_id','xzxz',true,$Language->getText('tracker_browse','no_change')) .'</td>
+ <td><strong>'._('Assigned to').': <a href="javascript:help_window(\'/help/tracker.php?helpname=assignee\')"><strong>(?)</strong></a>
+ </strong><br />'. $ath->technicianBox ('assigned_to','100.1',true,_('Nobody'),'100.1',_('No Change')) .'</td>
+ <td>';
+ if (!$ath->usesCustomStatuses()) {
+ echo '<strong>'._('State').': <a href="javascript:help_window(\'/help/tracker.php?helpname=status\')"><strong>(?)</strong></a></strong>
+ <br />'. $ath->statusBox ('status_id','xzxz',true,_('No Change'));
+ }
+ echo '</td>
</tr>
- <tr><td colspan="2"><strong>'.$Language->getText('tracker_browse','canned_response').':
+ <tr><td colspan="2"><strong>'._('Canned Response').':
<a href="javascript:help_window(\'/help/tracker.php?helpname=canned_response\')"><strong>(?)</strong></a>
</strong><br />'. $ath->cannedResponseBox ('canned_response') .'</td></tr>
- <tr><td colspan="3" align="MIDDLE"><input type="SUBMIT" name="submit" value="'.$Language->getText('tracker_browse','mass_update').'"></td></tr>
-
- </TABLE>
+ <tr><td colspan="3" align="center"><input type="submit" name="submit" value="'._('Mass update').'" /></td></tr>
+ </table>
</form>';
}
- echo $Language->getText('tracker_browse','old_requests',array(($ath->getDuePeriod()/86400) ));
- show_priority_colors_key();
+ printf(_('* Denotes requests > %1$s Days Old'), ($ath->getDuePeriod()/86400));
+ if (in_array('priority', $browse_fields)) {
+ show_priority_colors_key();
+ }
} else {
-
- echo '
- <h1>'.$Language->getText('tracker_browse','no_items').'</h1>';
+ echo '<div class="warning_msg">'._('No items found').'</div>';
echo db_error();
- //echo "<!-- $sql -->";
-
}
$ath->footer(array());
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
?>