*
* Copyright 1999-2001 (c) VA Linux Systems
* Copyright 2010 Roland Mas
+ * Copyright 2010 Alain Peyrat, Alcatel-Lucent
*
*/
require_once $gfcommon.'tracker/ArtifactFactory.class.php';
$offset = getStringFromRequest('offset');
$_sort_col = getStringFromRequest('_sort_col',$_sort_col);
$_sort_ord = getStringFromRequest('_sort_ord',$_sort_ord);
-$max_rows = getStringFromRequest('max_rows');
+$max_rows = getIntFromRequest('max_rows', 25);
$set = getStringFromRequest('set');
$_assigned_to = getIntFromRequest('_assigned_to');
$_status = getIntFromRequest('_status');
//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('atid'=>$ath->getID()));
+$ath->header(array('atid'=>$ath->getID(), 'title'=>$ath->getName()));
/**
*
$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 '
<div id="tabber" class="tabber">
<div class="tabbertab" title="'._('Advanced queries').'">';
</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>'.
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.'&_sort_col='.$_sort_col.'&_sort_ord='.$_sort_ord;
if (array_key_exists($ath->getCustomStatusField(),$_extra_fields)) {
foreach ($browse_fields as $f) {
$title=$f;
if (intval($f) > 0) {
- $title = $ath->getExtraFieldName($f);
+ $title = $ath->getExtraFieldName($f);
} else {
if ($f == 'id')
$title=_('ID');
$title=_('Assigned to');
if ($f == 'submitted_by')
$title=_('Submitted by');
+ if ($f == 'related_tasks')
+ $title=_('Related tasks');
}
$title_arr[] = $title;
}
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 {
if (in_array('priority', $browse_fields)) {
show_priority_colors_key();
-
}
} else {
-
- echo '
- <h1>'._('No items found').'</h1>';
+ echo '<div class="warning_msg">'._('No items found').'</div>';
echo db_error();
- //echo "<!-- $sql -->";
-
}
$ath->footer(array());