[Fusionforge-commits] r14724 - in trunk/src: common/tracker/actions www/tracker

Alain Peyrat aljeux at fusionforge.org
Wed Oct 26 14:43:36 CEST 2011


Author: aljeux
Date: 2011-10-26 14:43:35 +0200 (Wed, 26 Oct 2011)
New Revision: 14724

Added:
   trunk/src/common/tracker/actions/ajax.php
Modified:
   trunk/src/common/tracker/actions/add.php
   trunk/src/common/tracker/actions/mod-limited.php
   trunk/src/common/tracker/actions/mod.php
   trunk/src/www/tracker/index.php
Log:
Improve canned response in tracker, fill textarea with ajax

Modified: trunk/src/common/tracker/actions/add.php
===================================================================
--- trunk/src/common/tracker/actions/add.php	2011-10-26 12:17:29 UTC (rev 14723)
+++ trunk/src/common/tracker/actions/add.php	2011-10-26 12:43:35 UTC (rev 14724)
@@ -1,8 +1,10 @@
 <?php
 /**
- * Generic Tracker facility
+ * Tracker Facility
  *
- * Copyright 1999-2001 (c) VA Linux Systems; 2005 GForge, LLC
+ * Copyright 1999-2001 (c) VA Linux Systems
+ * Copyright 2010 (c) Franck Villaume - Capgemini
+ * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
  * http://fusionforge.org/
  *
  * This file is part of FusionForge. FusionForge is free software;

Added: trunk/src/common/tracker/actions/ajax.php
===================================================================
--- trunk/src/common/tracker/actions/ajax.php	                        (rev 0)
+++ trunk/src/common/tracker/actions/ajax.php	2011-10-26 12:43:35 UTC (rev 14724)
@@ -0,0 +1,28 @@
+<?php
+
+$function = getStringFromRequest('function');
+
+switch ($function) {
+	case 'get_canned_response':
+		//$atid = getIntFromRequest('atid');
+		$canned_response_id = getIntFromRequest('canned_response_id');
+		echo get_canned_response($canned_response_id);
+		break;
+	
+	default:
+		echo '';
+		break;
+}
+
+function get_canned_response($id) {
+	$result = db_query_params('SELECT body FROM artifact_canned_responses WHERE id=$1',
+		array ($id));
+	if (! $result || db_numrows($result) < 1) {
+		return '';
+	}
+	else {
+		return db_result($result, 0, 'body');
+	}
+}
+
+?>
\ No newline at end of file

Modified: trunk/src/common/tracker/actions/mod-limited.php
===================================================================
--- trunk/src/common/tracker/actions/mod-limited.php	2011-10-26 12:17:29 UTC (rev 14723)
+++ trunk/src/common/tracker/actions/mod-limited.php	2011-10-26 12:43:35 UTC (rev 14724)
@@ -152,7 +152,7 @@
 <div class="tabbertab" title="<?php echo _('Followups');?>">
 <table border="0" width="80%">
 	<tr><td colspan="2">
-		<br /><strong><?php echo _('OR Attach A Comment') ?>: <?php echo notepad_button('document.forms.trackermodlimitedform.details') ?></strong><br />
+		<br /><strong><?php echo _('Add A Comment') ?>: <?php echo notepad_button('document.forms.trackermodlimitedform.details') ?></strong><br />
 		<textarea id="tracker-comment" name="details" rows="7" cols="60" title="<?php echo util_html_secure(html_get_tooltip_description('comment')) ?>"></textarea>
 		<p>
 		<h2><?php echo _('Followups: ') ;

Modified: trunk/src/common/tracker/actions/mod.php
===================================================================
--- trunk/src/common/tracker/actions/mod.php	2011-10-26 12:17:29 UTC (rev 14723)
+++ trunk/src/common/tracker/actions/mod.php	2011-10-26 12:43:35 UTC (rev 14724)
@@ -197,8 +197,25 @@
 		echo $ath->cannedResponseBox('canned_response');
 		echo ' '.util_make_link ('/tracker/admin/?group_id='.$group_id.'&atid='. $ath->getID() .'&add_canned=1','('._('Admin').')');
 		?>
+		<script language="JavaScript" type="text/javascript">/* <![CDATA[ */
+			$('#tracker-canned_response').change(function() {
+				$.ajax({
+					type: 'POST',
+					url: 'index.php',
+					data: 'rtype=ajax&function=get_canned_response&group_id=<?php echo $group_id ?>&canned_response_id='+$('#tracker-canned_response').val(),
+					success: function(rep){
+						// the following line is not the best but works with IE6
+						$('#tracker-canned_response option').each(function() {$(this).attr("selected", "selected"); return false;});
+						if ($('#tracker-comment').val()) {
+							rep = "\n" + rep
+						}
+						$('#tracker-comment').val($('#tracker-comment').val() + rep);
+					}
+				});
+			});
+		/* ]]> */</script>
 		<p>
-		<strong><?php echo _('OR Attach A Comment') ?>:<?php echo notepad_button('document.forms.trackermodform.details') ?></strong><br />
+		<strong><?php echo _('Add A Comment') ?>:<?php echo notepad_button('document.forms.trackermodform.details') ?></strong><br />
 		<textarea id="tracker-comment" name="details" rows="7" cols="60" title="<?php echo util_html_secure(html_get_tooltip_description('comment')) ?>"></textarea></p>
 		<h2><?php echo _('Followups: ') ;
 		if ($sort_comments_chronologically) {

Modified: trunk/src/www/tracker/index.php
===================================================================
--- trunk/src/www/tracker/index.php	2011-10-26 12:17:29 UTC (rev 14723)
+++ trunk/src/www/tracker/index.php	2011-10-26 12:43:35 UTC (rev 14724)
@@ -68,6 +68,11 @@
 	}
 }
 
+if (getStringFromRequest('rtype') == 'ajax') {
+	include $gfcommon.'tracker/actions/ajax.php';
+	exit;
+}
+
 if ($group_id && $atid) {
 	include $gfcommon.'tracker/actions/tracker.php';
 




More information about the Fusionforge-commits mailing list