[evolvis-commits] r18687: [#2991] display mapping for custom status fields

mirabilos at evolvis.org mirabilos at evolvis.org
Thu Oct 4 15:45:32 CEST 2012


Author: mirabilos
Date: 2012-10-04 15:45:28 +0200 (Thu, 04 Oct 2012)
New Revision: 18687

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/debian/changelog
   trunk/gforge_base/evolvisforge-5.1/src/www/js/common.js
   trunk/gforge_base/evolvisforge-5.1/src/www/js/tooltips.js
   trunk/gforge_base/evolvisforge-5.1/src/www/tracker/include/ArtifactTypeHtml.class.php
   trunk/gforge_base/evolvisforge-5.1/src/www/tracker/item.php
Log:
[#2991] display mapping for custom status fields

also move #tracker-status_id tooltip from right to up, to make the mapping visible

Modified: trunk/gforge_base/evolvisforge-5.1/src/debian/changelog
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/debian/changelog	2012-10-04 13:45:21 UTC (rev 18686)
+++ trunk/gforge_base/evolvisforge-5.1/src/debian/changelog	2012-10-04 13:45:28 UTC (rev 18687)
@@ -25,8 +25,9 @@
   * [#3189] Correct de and en versions of EvolvisForge blurb
   * Never display template groups in project list
   * scmgit: Permit branch deletion in personal repositories
+  * [#2991] Display Open/Closed/Deleted mapping for custom status fields
 
- -- Thorsten Glaser <t.glaser at tarent.de>  Thu, 04 Oct 2012 14:14:33 +0200
+ -- Thorsten Glaser <t.glaser at tarent.de>  Thu, 04 Oct 2012 15:27:30 +0200
 
 fusionforge (1:5.1.1+evolvis70.1) unstable; urgency=high
 

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/js/common.js
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/js/common.js	2012-10-04 13:45:21 UTC (rev 18686)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/js/common.js	2012-10-04 13:45:28 UTC (rev 18687)
@@ -320,3 +320,7 @@
 	    "height=700,width=620";
 	NotepadWin = window.open(notepad_url, notepad_title, notepad_winopt);
 }
+
+function update_tracker_status() {
+	$('efstatusmap').update('(' + status_map[$F('tracker-status_id')] + ')');
+}

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/js/tooltips.js
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/js/tooltips.js	2012-10-04 13:45:21 UTC (rev 18686)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/js/tooltips.js	2012-10-04 13:45:28 UTC (rev 18687)
@@ -242,7 +242,7 @@
 	jQuery('#tracker-summary').tipsy(dright);
 	jQuery('#tracker-assigned_to').tipsy(dright);
 	jQuery('#tracker-priority').tipsy(dright);
-	jQuery('#tracker-status_id').tipsy(dright);
+	jQuery('#tracker-status_id').tipsy(dup);
 	jQuery('#tracker-description').tipsy(dright);
 	jQuery('#tracker-canned_response').tipsy(dleft);
 	jQuery('#tracker-comment').tipsy(dleft);

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/tracker/include/ArtifactTypeHtml.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/tracker/include/ArtifactTypeHtml.class.php	2012-10-04 13:45:21 UTC (rev 18686)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/tracker/include/ArtifactTypeHtml.class.php	2012-10-04 13:45:28 UTC (rev 18687)
@@ -98,7 +98,7 @@
 		$this->_substExtraFields($mode, $efarr, $selected, $show_100, $text_100, $show_any, $text_any, $status_show_100, $template);
 	}
 
-	function renderExtraField($selected,$show_100,$text_100,$show_any,$text_any,$types,$status_show_100,$mode,$whichone) {
+	function renderExtraField($selected,$show_100,$text_100,$show_any,$text_any,$types,$status_show_100,$mode,$whichone,$extracallback=false) {
 		$ofarr = $this->getExtraFields($types);
 		$found = false;
 
@@ -123,7 +123,9 @@
 
 		$ef_found = $ofarr[$found];
 		$efarr = array($found => $ef_found);
-		$template = $this->generateEfRender($ef_found, $mode);
+		$template = $this->generateEfRender($ef_found, $mode,
+		    $extracallback ?
+		    call_user_func($extracallback, $ef_found) : "");
 		$this->_substExtraFields($mode, $efarr, $selected, $show_100, $text_100, $show_any, $text_any, $status_show_100, $template);
 		return $ef_found;
 	}
@@ -393,7 +395,7 @@
 		    'status_id' : ('ef-' . $v['alias']));
 	}
 
-	function generateEfRender($v, $mode) {
+	function generateEfRender($v, $mode, $extrahtml="") {
 		$name = $v['field_name'];
 		/*
 		 * Do not show the required star in query
@@ -408,7 +410,7 @@
 		    html_get_tooltip_extralink($this->geteftipname($v)) .
 		    "\n\t\t" . '{$PostName:' . $v['field_name'] . '}' .
 		    "<br />\n\t\t" . '{$' . $v['field_name'] . '}' .
-		    "\n\t</div>";
+		    "\n\t" . $extrahtml . "</div>";
 	}
 
 	/**

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/tracker/item.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/tracker/item.php	2012-10-04 13:45:21 UTC (rev 18686)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/tracker/item.php	2012-10-04 13:45:28 UTC (rev 18687)
@@ -79,6 +79,24 @@
 	}
 }
 
+if (!$is_add && $ath->usesCustomStatuses() &&
+    ($res = db_query_params('SELECT aefe.element_id, a_s.status_name
+	FROM artifact_extra_field_elements aefe, artifact_status a_s
+	WHERE aefe.status_id=a_s.id
+	AND aefe.extra_field_id=$1',
+    array($ath->getCustomStatusField()))) &&
+    db_numrows($res) >= 1) {
+	$smap = array();
+	while ($row = db_fetch_array($res)) {
+		$smap[$row['element_id']] = $row['status_name'];
+	}
+	$HTML->extra_js[] = 'var status_map = ' .
+	    minijson_encode($smap, false) . ';';
+	$needstatusjs = true;
+} else {
+	$needstatusjs = false;
+}
+
 if ($is_add) {
 	$ath->header(array(
 		'title' => sprintf(_('%1$s %2$s: Submit New'),
@@ -134,8 +152,27 @@
 $i = false;
 if (!$is_add) {
 	if ($ath->usesCustomStatuses()) {
+		function esm_callback($i) {
+			global $data_extrafields;
+
+			$esm = $data_extrafields[$i['extra_field_id']];
+			$res = db_query_params('SELECT a_s.status_name
+				FROM artifact_extra_field_elements aefe,
+				    artifact_status a_s
+				WHERE aefe.status_id=a_s.id
+				AND aefe.element_id=$1',
+			    array($esm));
+			if (!$res || db_numrows($res) < 1) {
+				$esm = ' ';
+			} else {
+				$esm = '(' . db_result($res, 0,
+				    'status_name') . ')';
+			}
+			return ' <span id="efstatusmap">' . $esm . '</span>';
+		}
 		$i = $ath->renderExtraField($data_extrafields, true, 'none',
-		    false, 'Any', array(), false, $mode_extrafields, 'Status');
+		    false, 'Any', array(), false, $mode_extrafields, 'Status',
+		    'esm_callback');
 		$skip_extrafields[] = 'Status';
 	} else {
 		echo "\t<div><strong>" . _('Status') . ":</strong><br />\n";
@@ -516,5 +553,13 @@
 </form>
 <?php
 
+if ($needstatusjs) {
+	?>
+	<script language="JavaScript" type="text/javascript">//<![CDATA[
+		$('tracker-status_id').onchange = update_tracker_status;
+	//]]></script>
+	<?php
+}
+
 $ath->footer(array());
 exit;



More information about the evolvis-commits mailing list