Index: trac/htdocs/js/trac.js
===================================================================
--- trac/htdocs/js/trac.js	(revision 7651)
+++ trac/htdocs/js/trac.js	(working copy)
@@ -72,4 +72,77 @@
     return $(elem).parents(tagName).get(0);
   }
 
-})(jQuery);
\ No newline at end of file
+})(jQuery);
+
+//Functions for the processing of special custom fields
+
+//Add the contents of newfield to oldfield
+function accumulateInt(oldfield,newfield)
+{
+  if (checkInt(newfield.value))
+  {
+    if (checkInt(oldfield.defaultValue))
+    {
+      oldfield.value = parseInt(oldfield.defaultValue, 10) + parseInt(newfield.value, 10); 
+    }
+    else
+    {
+      oldfield.value = newfield.value;
+    }
+    newfield.value = "0";
+  }
+  else
+  {
+    newfield.value = newfield.defaultValue;
+    oldfield.value = oldfield.defaultValue;
+  }
+}
+
+//Check whether the string can be parsed into an integer
+function checkInt(text)
+{
+  var result = true;
+  if (isBlank(text))
+  {
+    result = false;
+  }
+  for(var i=0;i<text.length;i++)
+  {
+    if(!isDigit(text.charAt(i)))
+    {
+      result = false;
+    }
+  }
+
+  return result;
+}
+
+function isDigit(num)
+{
+  if (num.length>1)
+  {
+    return false;
+  }
+  var string="-1234567890";
+  if (string.indexOf(num)!=-1)
+  {
+    return true;
+  }
+  return false;
+}
+
+function isBlank(val)
+{
+  if(val==null)
+  {
+    return true;
+  }
+  for(var i=0;i<val.length;i++) 
+  {
+    if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r"))
+    {
+      return false;
+    }
+  }
+return true;
+}
\ No newline at end of file
Index: trac/ticket/templates/ticket.html
===================================================================
--- trac/ticket/templates/ticket.html	(revision 7651)
+++ trac/ticket/templates/ticket.html	(working copy)
@@ -337,7 +337,8 @@
                     </label>
                     <py:otherwise><!--! Text input fields -->
                       <py:choose>
-                        <span py:when="field.cc_entry"><!--! Special case for Cc: field -->
+		      	 <!--! Special case for Cc: field -->
+                        <span py:when="field.cc_entry">
                           <em>${field.cc_entry}</em>
                           <input type="checkbox" id="field-cc" name="cc_update"
                             title="This checkbox allows you to add or remove yourself from the CC list."
@@ -349,6 +350,38 @@
                             title="Space or comma delimited email addresses and usernames are accepted."
                             name="field_${field.name}" value="${ticket[field.name]}" />
                         </span>
+                        <!--! Integer Field -->
+                        <span py:when="field.type == 'integer'">
+                          <input  type="text" id="field-${field.name}"
+                            title="Integer data only"
+                            name="field_${field.name}" value="${ticket[field.name]}"
+			     onchange="javascript:if (!checkInt(this.value)){this.value = this.defaultValue;};" />
+                        </span>
+                        <!--! Cumulative Integer Field -->
+                        <span py:when="field.type == 'cumulative_integer'">
+                          <input  type="text" id="field-${field.name}" readonly="true"
+                            title="Add the value in the right hand box to the total. Integer data only"
+                            name="field_${field.name}" value="${ticket[field.name]}"/>
+			     
+                          <input  type="text" id="field-${field.name}-acc"
+                            title="Add the value in the this box to the total on the left. Integer data only"
+                            name="field_${field.name}_acc" value="0"
+			     onchange="javascript:accumulateInt(document.getElementById('field-${field.name}'),this);" />
+                        </span>
+                        <!--! WriteOnce Integer Field -->
+                        <span py:when="field.type == 'set_once_integer'">
+  			     <py:if test="ticket.exists">	
+				 <input  type="text" id="field-${field.name}" readonly="true"
+				    title="Integer data only"
+				    name="field_${field.name}" value="${ticket[field.name]}"/>
+                            </py:if>
+  			     <py:if test="not ticket.exists">	
+				 <input  type="text" id="field-${field.name}"
+				    title="This value can only be edited on New tickets. Integer data only"
+				    name="field_${field.name}" value="${ticket[field.name]}"
+				     onchange="javascript:if (!checkInt(this.value)){this.value = this.defaultValue;};" />
+                            </py:if>
+                        </span>
                         <!--! All the other text input fields -->
                         <input py:otherwise="" type="text" id="field-${field.name}"
                           name="field_${field.name}" value="${ticket[field.name]}" />

