<?php
/**
- * SourceForge Generic Tracker facility
+ * FusionForge Tracker
*
- * SourceForge: Breaking Down the Barriers to Open Source Development
* Copyright 1999-2001 (c) VA Linux Systems
- * http://sourceforge.net
+ * Copyright 2010 Roland Mas
+ * Copyright 2010 Alain Peyrat, Alcatel-Lucent
*
- * @version $Id$
*/
-require_once('common/tracker/ArtifactFactory.class');
-require_once('common/tracker/ArtifactQuery.class');
+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 the query_id = -1, unset the pref and use regular browse boxes
//
if (session_loggedin()) {
- $query_id = getIntFromRequest('query_id');
-
if($query_id) {
if ($query_id == '-1') {
$u =& session_get_user();
$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());
}
-$offset = getStringFromRequest('offset',$offset);
+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 = getStringFromRequest('max_rows',$max_rows);
-$set = getStringFromRequest('set',$set);
-$_assigned_to = getStringFromRequest('_assigned_to',$_assigned_to);
-$_status = getStringFromRequest('_status',$_status);
+$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 ($_GET['extra_fields'][$ath->getCustomStatusField()]) {
+ if (isset($_GET['extra_fields'][$ath->getCustomStatusField()])) {
$_extra_fields[$ath->getCustomStatusField()] = $_GET['extra_fields'][$ath->getCustomStatusField()];
- } else {
+ } elseif (isset($_POST['extra_fields'][$ath->getCustomStatusField()])) {
$_extra_fields[$ath->getCustomStatusField()] = $_POST['extra_fields'][$ath->getCustomStatusField()];
}
}
-$af->setup($offset,$_sort_col,$_sort_ord,null,$set,$_assigned_to,$_status,$_extra_fields);
+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
//
//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()));
/**
*
$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 * 14;// 2 week
$changed_arr[]= 3600 * 24 * 30;// 1 month
+/**
+ *
+ * Show the free-form text submitted by the project admin
+ */
+echo $ath->renderBrowseInstructions();
+
//
// statuses can be custom in GForge 4.5+
//
if ($ath->usesCustomStatuses()) {
- $status_box=$ath->renderSelect ($ath->getCustomStatusField(),$_extra_fields[$ath->getCustomStatusField()],false,'',true,$Language->getText('tracker','status_any'));
+ $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 {
- $status_box = $ath->statusBox('_status',$_status,true,$Language->getText('tracker','status_any'));
+ if (is_array($_status)) {
+ $_status='';
+ }
+ $status_box = $ath->statusBox('_status',$_status,true,_('Any'));
}
-echo '
-<table width="100%" border="0">';
+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 '
- <tr>';
-/*
- Logged in users get the option of seeing a power-browse box
-*/
+<div id="tabber" class="tabber">
+ <div class="tabbertab" title="'._('Advanced queries').'">';
+
if (session_loggedin()) {
- echo '<td rowspan="2">';
- echo '<form action="'. getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'" method="post">';
- echo '<input type="hidden" name="power_query" value="1">';
- $res=db_query("SELECT artifact_query_id,query_name
- FROM artifact_query WHERE user_id='".user_getid()."' AND group_artifact_id='".$ath->getID()."'");
-
- if (db_numrows($res)>0) {
- echo '
- <span style="font-size:smaller">'.html_build_select_box($res,'query_id',$af->getDefaultQuery(),false).'</span><br />
- <span style="font-size:smaller"><input type="submit" name="run" value="'.$Language->getText('tracker','run_query').'"></input>
- <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>';
- } else {
- echo '<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>';
- }
- echo '
- </form>
- </td>';
+ $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()));
}
-echo '
- <form action="'. getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'" method="post">
- <input type="hidden" name="set" value="custom" />
- <td><span style="font-size:smaller">'.$Language->getText('tracker','assignee').': <br />'. $tech_box .'</span></td>'.
- '<td><span style="font-size:smaller">'.$Language->getText('tracker','status').': <br />'. $status_box .'</span></td>';
- echo '
-</tr>
-<input type="hidden" name="query_id" value="-1">';
- echo '
+if (db_numrows($res)>0) {
+ echo '<form action="'. getStringFromServer('PHP_SELF') .'" method="get">';
+ echo ' <table width="100%" cellspacing="0">
+ <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) .
- html_build_select_box_from_arrays($sort_arr,$sort_name_arr,'_sort_ord',$_sort_ord,false) .
- '<input type="submit" name="submit" value="'.$Language->getText('tracker','quickbrowse').'" /></span></td>
- </tr>';
+ <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').'" />';
echo '
+ </td>
+ </tr>
+ </table>
</form>
-</table>';
-/**
- *
- * Show the free-form text submitted by the project admin
- */
-echo $ath->getBrowseInstructions();
+ </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.'&extra_fields['.$ath->getCustomStatusField().']='.$extra_fields[$ath->getCustomStatusField()].'&_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()];
+ }
}
if ($IS_ADMIN) {
echo '
- <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">';
+ <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" />';
}
- $display_col=array('summary'=>1,
- 'open_date'=>1,
- 'status'=>0,
- 'priority'=>1,
- 'assigned_to'=>1,
- 'submitted_by'=>1);
-
+ $browse_fields = explode(',', "id,".$ath->getBrowseList());
$title_arr=array();
- $title_arr[]=$Language->getText('tracker','id');
- if ($display_col['summary'])
- $title_arr[]=$Language->getText('tracker','summary');
- if ($display_col['open_date'])
- $title_arr[]=$Language->getText('tracker','open_date');
- if ($display_col['status'])
- $title_arr[]=$Language->getText('tracker','status');
- if ($display_col['priority'])
- $title_arr[]=$Language->getText('tracker','priority');
- if ($display_col['assigned_to'])
- $title_arr[]=$Language->getText('tracker','assigned_to');
- if ($display_col['submitted_by'])
- $title_arr[]=$Language->getText('tracker','submitted_by');
-
+ 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());
- if (!isset($_GET['start'])) {
- $start=0;
- } else {
- $start=$_GET['start'];
- }
- $max = ((count($art_arr) > ($start + 25)) ? ($start+25) : count($art_arr) );
+ $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 '. $HTML->boxGetAltRowStyle($i) . '>'.
- '<td>'.
- ($IS_ADMIN?'<input type="CHECKBOX" name="artifact_id_list[]" value="'.
- $art_arr[$i]->getID() .'"> ':'').
- $art_arr[$i]->getID() .
- '</td>';
- if ($display_col['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>';
- if ($display_col['open_date'])
- echo '<td>'. (($set != 'closed' && $art_arr[$i]->getOpenDate() < $then)?'* ':' ') .
- date($sys_datefmt,$art_arr[$i]->getOpenDate()) .'</td>';
- if ($display_col['status'])
- echo '<td>'. $art_arr[$i]->getStatusName() .'</td>';
- if ($display_col['priority'])
- echo '<td class="priority'.$art_arr[$i]->getPriority() .'">'. $art_arr[$i]->getPriority() .'</td>';
- if ($display_col['assigned_to'])
- echo '<td>'. $art_arr[$i]->getAssignedRealName() .'</td>';
- if ($display_col['submitted_by'])
- echo '<td>'. $art_arr[$i]->getSubmittedRealName() .'</td>';
+ <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 -->
* /
- //only show this if we�re not using a power query
+ //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><-- '.$Language->getText('tracker_browse','previous').'</strong></a>';
+ 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>'.$Language->getText('tracker_browse','next').' --></strong></a>';
+ 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 $GLOBALS['HTML']->listTableBottom();
- $pages = count($art_arr) / 25;
- $currentpage = intval($start / 25);
+ $pages = count($art_arr) / $pagelength;
+ $currentpage = intval($start / $pagelength);
//echo "Item Count: ".count($arr)."Pages: $pages";
- $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 ".... ";
+ 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;
}
- continue;
+ }
+ if ($j == $currentpage) {
+ echo '<strong>'.($j+1).'</strong> ';
} else {
- $skipped_pages=false;
+ 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> ';
}
}
- 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*25).'"><strong>'.($j+1).'</strong></a> ';
- }
}
/*
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').'
+<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>';
$sel[$keys[$i]]='100';
}
}
- $ath->renderExtraFields($sel,true,$Language->getText('tracker_browse','no_change'),false,'',ARTIFACT_EXTRAFIELD_FILTER_INT,true);
+ $ath->renderExtraFields($sel,true,_('No Change'),false,'',ARTIFACT_EXTRAFIELD_FILTER_INT,true);
echo '<tr>
- <td><strong>'.$Language->getText('tracker','priority').': <a href="javascript:help_window(\'/help/tracker.php?helpname=priority\')"><strong>(?)</strong></a>
+ <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>';
</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>'._('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>'.$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'));
+ 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:
+
?>