[evolvis-commits] r7172: [#608] Dropdown zur Trackerauswahl in Suchmaske //Merged and tested. Should work

papel at evolvis.org papel at evolvis.org
Mon Jan 24 16:14:13 CET 2011


Author: papel
Date: 2011-01-24 16:14:13 +0100 (Mon, 24 Jan 2011)
New Revision: 7172

Modified:
   trunk/gforge_base/evolvisforge/gforge/www/tracker/browse.php
   trunk/gforge_base/evolvisforge/gforge/www/tracker/include/ArtifactTypeHtml.class.php
   trunk/gforge_base/evolvisforge/gforge/www/tracker/index.php
   trunk/gforge_base/evolvisforge/gforge/www/tracker/tracker.php
Log:
[#608] Dropdown zur Trackerauswahl in Suchmaske //Merged and tested. Should work

Modified: trunk/gforge_base/evolvisforge/gforge/www/tracker/browse.php
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/www/tracker/browse.php	2011-01-24 08:37:17 UTC (rev 7171)
+++ trunk/gforge_base/evolvisforge/gforge/www/tracker/browse.php	2011-01-24 15:14:13 UTC (rev 7172)
@@ -17,7 +17,6 @@
 }
 
 $query_id = getIntFromRequest('query_id');
-$start = getIntFromRequest('start');
 
 //
 //	The browse page can be powered by a pre-saved query
@@ -52,14 +51,43 @@
 	}
 }
 
-$af = new ArtifactFactory($ath);
+$atf = new ArtifactTypeFactory($group);
+$at_arr =& $atf->getArtifactTypes(); //Gets the ids of all artifact types for example.
 
-if (!$af || !is_object($af)) {
-	exit_error('Error','Could Not Get Factory');
-} elseif ($af->isError()) {
-	exit_error('Error',$af->getErrorMessage());
+$arrSubTrackerIds = array();
+$arrSubTrackerNames = array();
+$arrObjAth = array();
+$arrObjAf = array();
+
+$i = 0;
+$stopLoop = false;
+
+foreach($at_arr as $at) {
+	array_push($arrSubTrackerIds, $at->getID());
+	array_push($arrSubTrackerNames, $at->getName());
 }
 
+foreach($at_arr as $at) {
+
+	if($selected_tracker == 0 && ($search_tracker == 1 || $func_ == 'massupdate' || $search_all == 1)) { 
+		array_push($arrObjAth, new ArtifactTypeHtml($group, $at->getID()));
+		array_push($arrObjAf, new ArtifactFactory(new ArtifactTypeHtml($group, $at->getID())));
+	} else {
+		array_push($arrObjAth, $ath);
+		array_push($arrObjAf, new ArtifactFactory($ath));
+		$stopLoop = true;
+	}
+	
+	if (!$arrObjAf[$i] || !is_object($arrObjAf[$i])) {
+		exit_error('Error','Could Not Get Factory');
+	} elseif ($arrObjAf[$i]->isError()) {
+		exit_error('Error',$af->getErrorMessage());
+	}
+	
+	if($stopLoop) {break;}
+$i++;
+}
+
 if (!isset($_sort_col)) {
 	/* default sort order: highest priority first */
 	$_sort_col = 'priority';
@@ -76,14 +104,23 @@
 $_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()];
+
+foreach($arrObjAth as $ath) {
+
+	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()];
+		} else {
+			#This line would maybe be interessting for exception handling in future implementations.
+		}
 	}
 }
 
@@ -102,26 +139,53 @@
 	}
 }
 
-$af->setup($offset,$_sort_col,$_sort_ord,null,$set,$_assigned_to,$_status,$aux_extra_fields);
+$artaf_arr = array();
+
+$i = 0;
+foreach($arrObjAf as $af) {
+
+	$af->setup($offset,$_sort_col,$_sort_ord,null,$set,$_assigned_to,$_status,$aux_extra_fields);
+	array_push($artaf_arr, $af->getArtifacts());
+
+	if (!$artaf_arr[$i] && $af->isError()) {
+		exit_error('Error',$af->getErrorMessage());
+	}
+	$i++;	
+}
+
+/* These values are from the "last" atid in a set of various, but it does not care 
+ * if it is the last oder first one in kind of searching in various trackers, because
+ * all gets sorted the same way.
+ * */
+
+$_sort_col = $af->order_col;
+$_sort_ord = $af->sort;
+$_status = $af->status;
+$_assigned_to = $af->assigned_to;
+$_extra_fields = $af->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;
-$_extra_fields=$af->extra_fields;
 
-$art_arr =& $af->getArtifacts();
+$headerAtid = $ath->getID();
 
-if (!$art_arr && $af->isError()) {
-	exit_error('Error',$af->getErrorMessage());
-}
+/* BEGIN Important for Evolvis feature request [#608] Dropdown zur Trackerauswahl in Suchmaske
+ * https://evolvis.org/tracker/?func=detail&aid=608&group_id=39&atid=369
+ * 
+ * The SubMenü will disapear if someone searchs in all trackers
+ */
+if($selected_tracker == 0 && ($search_tracker == 1 || $search_all == 1)) {
+	$headerAtid = $selected_tracker;
+} 
+/* END
+ */
 
 //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()));
+$arrHeader = array('atid'=>$headerAtid);
+$ath->header($arrHeader);
 
 /**
  *
@@ -138,11 +202,17 @@
 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'), true, _('Any'));
+if($selected_tracker == 0
+	&& $search_tracker != 1
+		&& $func_ != 'massupdate'
+			&& $search_all != 1) {
+	$selected_tracker = $atid;
+}
 
+$arrSubTrackerBox = html_build_select_box_from_arrays($arrSubTrackerIds, $arrSubTrackerNames, 'selected_tracker', $selected_tracker, false, _('Unassigned'),true, _('Any'));
 
+$tech_box = html_build_select_box_from_arrays ($tech_id_arr,$tech_name_arr,'_assigned_to',$_assigned_to,true,_('Unassigned'),true,_('Any'));
+
 //
 //	custom order by arrays to build a pop-up box
 //
@@ -196,6 +266,7 @@
 //
 //	statuses can be custom in GForge 4.5+
 //
+foreach($arrObjAth as $ath) {
 if ($ath->usesCustomStatuses()) {
 	$aux_extra_fields = array();
 	if (is_array($_extra_fields)){
@@ -215,6 +286,7 @@
 	}
 	$status_box = $ath->statusBox('_status',$_status,true,_('Any'));
 }
+}
 /*
 	Logged in users get the option of seeing a power-browse box
 */
@@ -246,13 +318,16 @@
 <form action="'. getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'" method="post">
 <input type="hidden" name="set" value="custom" />
 <input type="hidden" name="query_id" value="-1" />
+<input type="hidden" name="search_tracker" value="1" />
 <table width="100%" border="0"><tr>
-	<td>'._('Assignee').'<br />'. $tech_box .'</td>'.
-	'<td>'._('Status').'<br />'. $status_box .'</td>
+<td>'._('Tracker').'<br />'.$arrSubTrackerBox.'</td>
+<td>'._('Assignee').'<br />'. $tech_box .'</td>'.
+'<td>'._('Status').'<br />'. $status_box .'</td>	
+
 	</tr>
 	<tr>
 		<td align="right">'._('Order by').' <a href="javascript:help_window(\''.util_make_url ('/help/tracker.php?helpname=sort_by').'\')"><strong>(?)</strong></a></td>'.
-		'<td>'. 
+		'<td colspan="2">'. 
 		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').'" /></td>
@@ -261,26 +336,117 @@
 </form>
 ';
 
-if ($art_arr && ($art_cnt = count($art_arr)) > 0) {
-	$focus = getIntFromRequest('focus');
-} else {
-	$art_cnt = 0;
-	$start = 0;
-	$focus = 0;
-}
+	if ($artaf_arr[0] && ($art_cnt = count($artaf_arr[0])) > 0) {
+		$focus = getIntFromRequest('focus');
+		
+	} else {
+		$art_cnt = 0;
+		$start = 0;
+		$focus = 0;
+	}
+
+	if (!isset($_GET['start'])) {
+		
+		if(!isset($_POST['start'])) {
+			$start=0;
+		} else {
+			$start = getIntFromRequest('start');
+		}
+	} else {
+		$start = getIntFromRequest('start');
+	}	
+	
+	if (!isset($_GET['pNS'])) {
+		
+		if(!isset($_POST['pNS'])) {
+			$prevNextStart = '';		
+		} else {
+			$prevNextStart = getStringFromRequest('pNS');
+		}
+	} else {
+		$prevNextStart = getStringFromRequest('pNS');
+	}	
+		
+	if (!isset($_GET['pNT'])) {
+		
+		if(!isset($_POST['pNT'])) {
+			$prevNextTracker = '';
+		} else {
+			$prevNextTracker = getStringFromRequest('pNT');
+		}
+	} else {
+		$prevNextTracker = getStringFromRequest('pNT');
+	}	
+	
+	if (!isset($_GET['total'])) {	
+		if(!isset($_POST['total'])) {
+			$total = 0;
+		} else {
+			$total = getIntFromRequest('total');
+		}
+	} else {
+		$total = getIntFromRequest('total');
+	}
+	
+	if (!isset($_GET['page_count'])) {
+		if(!isset($_POST['page_count'])) {
+			$page_count = 1;
+		} else {
+			$page_count = getIntFromRequest('page_count');
+		}
+	} else {
+		$page_count = getIntFromRequest('page_count');
+	}	
+	
+	if (!isset($_GET['tracker'])) {
+		if(!isset($_POST['tracker'])) {
+			$tracker_count = 0;
+		} else {
+			$tracker_count = getIntFromRequest('tracker');
+		}
+	} else {
+		$tracker_count = getIntFromRequest('tracker');
+	}
+	
+	$resetStartOnce = getIntFromRequest('resetStartOnce');
+
 $paging = 0;
 if (session_loggedin()) {
 	/* logged in users get configurable paging */
-	$paging = $u->getPreference("paging");
-	echo '<form action="'. getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'&start='.$start.'" method="post">'."\n";
+	$paging = $u->getPreference("paging"); 
+
+	if($selected_tracker == 0) {
+		if($resetStartOnce == 1) { $start = 0; $resetStartOnce = 0; }
+	}
+	
+	echo '<form action="'. getStringFromServer('PHP_SELF') .'?group_id='.$group_id.'&atid='.$ath->getID().'&start='.$start.'" method="post">'."\n"; //I should remove the start value
+
+	echo '<input type="hidden" name="tracker" value="0"/>';
+	echo '<input type="hidden" name="page_count" value="1" />';
+	echo '<input type="hidden" name="total" value="0" />'; 
+	echo '<input type="hidden" name="resetStartOnce" value="1" />';
+	echo '<input type="hidden" name="selected_tracker" value="'.$selected_tracker.'" />';
+	echo '<input type="hidden" name="search_tracker" value="1" />';
+
 }
-if (!$paging)
+
+if (!$paging) {
 	$paging = 25;
-if ($art_cnt) {
+}
+	
+if($selected_tracker == 0 || $search_all == 1) {
+	$countValue = 0;
+	$pstart = $total;
+	foreach($artaf_arr as $art_arr) {
+		$countValue += count($art_arr);
+	}
+	$art_cnt = $countValue;
+	$max = ($art_cnt > ($total + $paging)) ? ($total + $paging) : $art_cnt;
+} elseif ($art_cnt) {
 	if ($focus) {
 		for ($i = 0; $i < $art_cnt; ++$i)
-			if ($art_arr[$i]->getID() == $focus) {
-				$start = $i;
+			if($artaf_arr[0]->getID() == $focus) {
+				$pstart = $i;
 				$focus = 0;		// flag
 				break;
 			}
@@ -293,10 +459,12 @@
 		}
 	}
 	$max = ($art_cnt > ($start + $paging)) ? ($start + $paging) : $art_cnt;
-} else
+} else {
 	$max = 0;
+}
+
 printf('<p>' . _('Displaying results %1$d‒%2$d out of %3$d total.'),
-    $start + 1, $max, $art_cnt);
+    $pstart + 1, $max, $art_cnt); 
 if (session_loggedin())
 	printf(' ' . _('Displaying %2$s results.') . "\n\t<input " .
 	    'type="submit" name="setpaging" value="%1$s" />' .
@@ -312,23 +480,23 @@
  */
 echo $ath->getBrowseInstructions();
 
-if ($art_cnt > 0) {
+if($artaf_arr && count($artaf_arr) > 0) {
+	if ($set=='custom') {
 
-	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)) {
 			$set .= '&extra_fields['.$ath->getCustomStatusField().']='.$_extra_fields[$ath->getCustomStatusField()];
 		}
 	}
 
-
 	$IS_ADMIN=$ath->userIsAdmin();
-
+		
 	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">';
+		echo '<input type="hidden" name="selected_tracker" value="'.$selected_tracker.'" />';
 	}
 
 	$display_col=array('summary'=>1,
@@ -339,7 +507,7 @@
 		'submitted_by'=>1);
 
 	$title_arr=array();
-	$title_arr[] = "";
+	//$title_arr[] = "";
 	$title_arr[]=_('ID');
 	if ($display_col['summary'])
 		$title_arr[]=_('Summary');
@@ -355,41 +523,116 @@
 		$title_arr[]=_('Submitted by');
 
 	echo $GLOBALS['HTML']->listTableTop ($title_arr);
-
 	$then=(time()-$ath->getDuePeriod());
 
-	for ($i=$start; $i<$max; $i++) {
-		echo '
-		<tr ' . ($focus && ($i == $focus) ?
+	$maxEntriesOnPage = $paging; 
+	
+	$mTracker = $tracker_count;
+	$mStart = $start;
+
+	foreach($artaf_arr as $art_arr_) {
+		$entries += count($art_arr_);
+	}
+	
+	for($tracker_count; $tracker_count < count($artaf_arr); $tracker_count++) {
+		$breakAllLoops = false;
+		
+		$start_ = $start + $maxEntriesOnPage;
+		
+		$max = ((count($artaf_arr[$tracker_count]) > ($start_)) ? ($start_) : count($artaf_arr[$tracker_count]) );
+
+		$selected_tracker == 0 && ($search_tracker == 1 || $func_ == 'massupdate' || $search_all == 1) ? $trackerName = $at_arr[$tracker_count]->getName() : $trackerName = '';
+	
+		if($max > 0 && $total != ($page_count * $maxEntriesOnPage)) {
+			echo '<tr><td colspan="6"><br /><b><i>'.$trackerName.'</i></b></td></tr>';
+		}
+
+		for ($i=$start; $i<$max; $i++) {
+
+			if($search_all == 1 || $selected_tracker == 0) {
+				if($total == ($page_count * $maxEntriesOnPage)) {
+					$breakAllLoops = true;
+					break;
+				} 
+			}
+			
+			$selected_tracker != '' ? $id = $selected_tracker : $id = $at_arr[$tracker_count]->getID();
+			$selected_tracker == '' ? $id_ = '_'.$id : $id_ = '';
+			echo '
+			<tr ' . ($focus && ($i == $focus) ?
 		    ' bgcolor="#9999FF"' :
 		    $HTML->boxGetAltRowStyle($i)) . '><td>' .
-		($focus && ($i == $focus) ? '»' : '') . '</td><td>' .
-		($IS_ADMIN?'<input type="checkbox" name="artifact_id_list[]" value="'.
-			$art_arr[$i]->getID() .'" /> ':'').
-			'<a href="' . util_make_url('/tracker/t_follow.php/' .
-			    $art_arr[$i]->getID()) . '">' .
-			$art_arr[$i]->getID() . '</a></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(_('Y-m-d H:i'),$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>';
-		echo '</tr>';
-	}
+			($IS_ADMIN?'<input type="CHECKBOX" name="artifact_id_list'.$id_.'[]" value="'.
+				$artaf_arr[$tracker_count][$i]->getID() .'" /> ':'').
 
+				'<a href="' . util_make_url('/tracker/t_follow.php/' . $artaf_arr[$tracker_count][$i]->getID()) . '" />' .$artaf_arr[$tracker_count][$i]->getID() . '</a></td>';
+
+			if ($display_col['summary'])
+			 echo '<td><a href="'.getStringFromServer('PHP_SELF').'?func=detail&aid='.
+				$artaf_arr[$tracker_count][$i]->getID() .
+				'&group_id='. $group_id .'&atid=';
+				echo $id.'">';
+				echo $artaf_arr[$tracker_count][$i]->getSummary().
+				'</a></td>';
+			if ($display_col['open_date'])
+				echo '<td>'. (($set != 'closed' && $artaf_arr[$tracker_count][$i]->getOpenDate() < $then)?'* ':'  ') .
+				date(_('Y-m-d H:i'),$artaf_arr[$tracker_count][$i]->getOpenDate()) .'</td>';
+			if ($display_col['status'])
+				echo '<td>'. $artaf_arr[$tracker_count][$i]->getStatusName() .'</td>';
+			if ($display_col['priority'])
+				echo '<td class="priority'.$artaf_arr[$tracker_count][$i]->getPriority()  .'">'. $artaf_arr[$tracker_count][$i]->getPriority() .'</td>';
+			if ($display_col['assigned_to'])
+				echo '<td>'. $artaf_arr[$tracker_count][$i]->getAssignedRealName() .'</td>';
+			if ($display_col['submitted_by'])
+				echo '<td>'. $artaf_arr[$tracker_count][$i]->getSubmittedRealName() .'</td>';
+			echo '</tr>';
+			
+			$total++;	
+		}
+		
+		if($breakAllLoops == true) {
+			break;
+		}
+		
+		if($max == count($artaf_arr[$tracker_count])) {
+
+			if($search_all == 1) {
+				$k = $tracker_count;
+				$k++;
+				$start = 0; 
+			} elseif ($selected_tracker == 0 && $max == $maxEntriesOnPage){
+	
+				$k = $tracker_count;
+				$k++;
+				$start = 0;
+				$i = $start;
+				break;
+			} else {
+				$k++;
+			}
+
+		} else {
+			$k = $tracker_count;
+			if($search_all != 1 || $i == $max) { 
+				break; 
+			}
+		}
+	}	
+	
+		$entriesTotal = $total;
+		$selected_page = intval($total / $maxEntriesOnPage);
+		$realSelectedPage = ceil($total / $maxEntriesOnPage);
+
+		$tracker_count = $k;
+		
+		if($page_count == ($selected_page + 1)) {
+			$massUpdatePageCount = ($selected_page + 1);
+		} else {
+			$massUpdatePageCount = $selected_page;
+		}
+		
+		$page_count = $selected_page + 1; //The next page shown
+
 	/*
 		Show extra rows for <-- Prev / Next -->
 	* /
@@ -415,27 +658,88 @@
 		}
 	}
 	*/
-	echo $GLOBALS['HTML']->listTableBottom();
-	$pages = $art_cnt / $paging;
-	$currentpage = intval($start / $paging);
-	$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 ".... ";
+	
+		echo $GLOBALS['HTML']->listTableBottom();
+	
+	$pages = ceil($entries / $maxEntriesOnPage);
+
+		if($search_all == 1 || $selected_tracker == 0) {
+
+			$search_all = 1;
+			$m = $i;
+			
+				//Begin params for the previous pages
+				$pNS_ = split(',',$prevNextStart);
+				$pNT_ = split(',',$prevNextTracker);
+				
+				$prevStarts = '';
+				$prevTrackers = '';
+				
+				for($p=0; $p<(count($pNS_)-1);$p++) {
+					
+					$pNS[$p] = $pNS_[$p];	
+					$prevStarts .= $pNS_[$p] . ',';
+					$pNT[$p] .= $pNT_[$p];
+					$prevTrackers .= $pNT_[$p] . ',';
 				}
-				continue;
+				
+				$prevStarts = substr($prevStarts,0,-1);
+				$prevTrackers = substr($prevTrackers,0,-1);
+				//End params for the previous pages
+			
+				//Begin params for the next pages
+				$nextStarts = $prevNextStart . ',' . $m;
+				$nextTrackers = $prevNextTracker . ',' . $tracker_count;
+				
+				$pNS = split(',',$nextStarts);
+				$pNT = split(',',$nextTrackers);
+				//End params for the next pages			
+			
+			echo '<br />';
+
+			if($pages > 1) {
+
+				if($realSelectedPage == $pages && $realSelectedPage == 2) {
+					$total = $pages * $maxEntriesOnPage;
+					echo '<a href="'.getStringFromServer('PHP_SELF')."?func=browse&group_id=".$group_id.'&atid='.$ath->getID().'&set='. $set.'&search_tracker=1"><strong>← '._('previous').' </strong></a>  ';				
+				} elseif($realSelectedPage == $pages) {
+					$total = $pages * $maxEntriesOnPage;
+					echo '<a href="'.getStringFromServer('PHP_SELF')."?func=browse&group_id=".$group_id.'&atid='.$ath->getID().'&set='. $set.'&start='.$pNS[$realSelectedPage-2].'&tracker='.$pNT[$realSelectedPage-2].'&selected_tracker='.$selected_tracker.'&search_all='.$search_all.'&page_count='.$selected_page.'&total='.($total - (2 * $maxEntriesOnPage)).'&pNS='.$prevStarts.'&pNT='.$prevTrackers.'"><strong>← '._('previous').' </strong></a>  ';
+				} elseif($realSelectedPage == 1) {	
+					echo '<a href="'.getStringFromServer('PHP_SELF')."?func=browse&group_id=".$group_id.'&atid='.$ath->getID().'&set='. $set.'&start='.$m.'&tracker='.$tracker_count.'&selected_tracker='.$selected_tracker.'&search_all='.$search_all.'&page_count='.$page_count.'&total='.$entriesTotal.'&pNS='.$nextStarts.'&pNT='.$nextTrackers.'"><strong>'._('next'). ' →</strong></a>  ';
+				} elseif($realSelectedPage == 2) { //The link to the previous page goes to the first page
+					echo '<a href="'.getStringFromServer('PHP_SELF')."?func=browse&group_id=".$group_id.'&atid='.$ath->getID().'&set='. $set.'&search_tracker=1"><strong>← '._('previous').' </strong></a>  ';			
+					echo '<a href="'.getStringFromServer('PHP_SELF')."?func=browse&group_id=".$group_id.'&atid='.$ath->getID().'&set='. $set.'&start='.$m.'&tracker='.$tracker_count.'&selected_tracker='.$selected_tracker.'&search_all='.$search_all.'&page_count='.$page_count.'&total='.$entriesTotal.'&pNS='.$nextStarts.'&pNT='.$nextTrackers.'"><strong>'._('next').' →</strong></a>  ';
+				} else {
+					echo '<a href="'.getStringFromServer('PHP_SELF')."?func=browse&group_id=".$group_id.'&atid='.$ath->getID().'&set='. $set.'&start='.$pNS[$realSelectedPage-2].'&tracker='.$pNT[$realSelectedPage-2].'&selected_tracker='.$selected_tracker.'&search_all='.$search_all.'&page_count='.($selected_page-1).'&total='.($total - (2 * $maxEntriesOnPage)).'&pNS='.$prevStarts.'&pNT='.$prevTrackers.'"><strong>← '._('previous').'</strong></a>  ';
+					echo '<a href="'.getStringFromServer('PHP_SELF')."?func=browse&group_id=".$group_id.'&atid='.$ath->getID().'&set='. $set.'&start='.$m.'&tracker='.$tracker_count.'&selected_tracker='.$selected_tracker.'&search_all='.$search_all.'&page_count='.$page_count.'&total='.$entriesTotal.'&pNS='.$nextStarts.'&pNT='.$nextTrackers.'"><strong>'._('next').' →</strong></a>  ';
+				}
+				echo '<br /><br /><br />';
+			}
+
+		} else {
+
+			$pages = $art_cnt / $paging;
+			$currentpage = intval($start / $paging);
+			$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 * $paging == $start) {
+				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 * $paging).'"><strong>'.($j+1).'</strong></a>  ';
 			}
 		}
-		if ($j * $paging == $start) {
-			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 * $paging).'"><strong>'.($j+1).'</strong></a>  ';
-		}
 	}
 
 	/*
@@ -448,7 +752,7 @@
 		len = al.elements.length;
 		var i=0;
 		for( i=0 ; i<len ; i++) {
-			if (al.elements[i].name==\'artifact_id_list[]\') {
+			if (al.elements[i].name.substring(0, 16)==\'artifact_id_list\') {
 				al.elements[i].checked=val;
 			}
 		}
@@ -466,7 +770,6 @@
 <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>';
 
-
 		//
 		//	build custom fields
 		//
@@ -506,8 +809,30 @@
 				<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"><input type="submit" name="submit" value="'._('Mass update').'" /></td></tr>
+			<tr><td colspan="3">';
 
+		 	echo '<input type="hidden" name="tracker" value="'.$mTracker.'"/>';
+		 	
+			echo '<input type="hidden" name="page_count" value="'.$massUpdatePageCount.'" />';
+
+			echo '<input type="hidden" name="selected_tracker" value="'.$selected_tracker.'" />';
+			
+			if($selected_tracker==0){
+				$s = 1;
+				$massStart = $mStart;
+			} else {
+				$s = 0;
+				$massStart = $start;
+			}
+			
+			echo '<input type="hidden" name="start" value="'.($massStart).'" />';
+			echo '<input type="hidden" name="search_all" value="'.$s.'" />';
+			
+			echo '<input type="hidden" name="total" value="'.($total - (1 * $maxEntriesOnPage)).'" />';
+			echo '<input type="hidden" name="pNS" value="'.$prevNextStart.'" />';
+			echo '<input type="hidden" name="pNT" value="'.$prevNextTracker.'" />';
+			echo '<input type="SUBMIT" name="submit" value="'._('Mass update').'"></td></tr>
+
 			</table>
 		</form>';
 	}

Modified: trunk/gforge_base/evolvisforge/gforge/www/tracker/include/ArtifactTypeHtml.class.php
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/www/tracker/include/ArtifactTypeHtml.class.php	2011-01-24 08:37:17 UTC (rev 7171)
+++ trunk/gforge_base/evolvisforge/gforge/www/tracker/include/ArtifactTypeHtml.class.php	2011-01-24 15:14:13 UTC (rev 7172)
@@ -67,9 +67,11 @@
 				$links[]  = '/tracker/admin/?group_id='.$group_id.'&atid='.$this->getID();
 			}
 		}
-
-		echo $HTML->subMenu($labels,$links);
-		echo "<hr />\n";
+		
+		if($params['atid'] != 0) {
+			echo $HTML->subMenu($labels,$links);
+			echo "<hr />\n";
+		}
 	}
 
 	function footer($params) {

Modified: trunk/gforge_base/evolvisforge/gforge/www/tracker/index.php
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/www/tracker/index.php	2011-01-24 08:37:17 UTC (rev 7171)
+++ trunk/gforge_base/evolvisforge/gforge/www/tracker/index.php	2011-01-24 15:14:13 UTC (rev 7172)
@@ -14,6 +14,7 @@
 require_once $gfwww.'include/note.php';
 require_once $gfcommon.'tracker/Artifact.class.php';
 require_once $gfcommon.'tracker/ArtifactFile.class.php';
+require_once $gfcommon.'tracker/ArtifactFactory.class.php';
 require_once $gfwww.'tracker/include/ArtifactFileHtml.class.php';
 require_once $gfcommon.'tracker/ArtifactType.class.php';
 require_once $gfwww.'tracker/include/ArtifactTypeHtml.class.php';
@@ -29,6 +30,23 @@
 $group_id = getIntFromRequest('group_id');
 $atid = getIntFromRequest('atid');
 
+/* BEGIN Important for Evolvis feature request [#608] Dropdown zur Trackerauswahl in Suchmaske
+ * https://evolvis.org/tracker/?func=detail&aid=608&group_id=39&atid=369
+ */
+$selected_tracker = getIntFromRequest('selected_tracker');
+$search_tracker = getIntFromRequest('search_tracker');
+$search_all = getIntFromRequest('search_all'); 
+
+ 
+$func_ = getStringFromRequest('func');
+if(($search_tracker == 1 || $func_ == 'massupdate') && $selected_tracker != 0) {
+	$atid = getIntFromRequest('selected_tracker');	
+}
+/* END 
+ */
+
+
+
 //if the ATID and GID are not provided, but
 //the artifact_id is, then fetch the other vars
 if ($aid && (!$group_id || !$atid)) {

Modified: trunk/gforge_base/evolvisforge/gforge/www/tracker/tracker.php
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/www/tracker/tracker.php	2011-01-24 08:37:17 UTC (rev 7171)
+++ trunk/gforge_base/evolvisforge/gforge/www/tracker/tracker.php	2011-01-24 15:14:13 UTC (rev 7172)
@@ -136,6 +136,30 @@
 		$canned_response = getIntFromRequest("canned_response");
 		$extra_fields = getArrayFromRequest('extra_fields');
 		
+		$arrObjAth = array();
+		$arrObjAf = array();
+			
+		if($selected_tracker == '') {
+			$atf = new ArtifactTypeFactory($group);
+			$at_arr =& $atf->getArtifactTypes(); 		
+			
+			foreach($at_arr as $at) {
+				array_push($arrObjAth, new ArtifactTypeHtml($group, $at->getID()));
+				array_push($arrObjAf, new ArtifactFactory(new ArtifactTypeHtml($group, $at->getID())));
+			}
+		} else {
+			$arrObjAth = array('');
+		}
+
+
+	foreach($arrObjAth as $singleObjAth) {
+		
+		if($selected_tracker == '') {
+			$name = 'artifact_id_list_'.$singleObjAth->getID();
+			$artifact_id_list = getArrayFromRequest($name);
+			$ath = $singleObjAth;
+		}
+
 		$count=count($artifact_id_list);
 
 		if (!$ath->userIsAdmin()) {
@@ -205,6 +229,7 @@
 		if (!$was_error) {
 			$feedback = _('Updated successfully');			}
 		}
+	}
 		unset ($extra_fields_choice);
 		include $gfwww.'tracker/browse.php';
 		break;



More information about the evolvis-commits mailing list