FogBugz » TimeIntervalCommentsPlugin http://fogbugz.stackexchange.com/questions/3316
Clone URL:  
Pushed to one repository · View In Graph Contained in version_0-2-0-0, version_0-2-0-1, and tip

it works minus actually saving intervals our dot case FC2036704

Changeset 9fa408c4fe1c

Parent 2441e8b27b94

by Adam Wishneusky

Changes to 3 files · Browse files at 9fa408c4fe1c Showing diff from parent 2441e8b27b94 Diff from another changeset...

 
39
40
41
42
43
 
 
 
39
40
41
 
 
42
43
@@ -39,5 +39,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers  // by using the '*' as shown below:  // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.2.1")] -[assembly: AssemblyFileVersion("0.1.2.1")] +[assembly: AssemblyVersion("0.1.4.1")] +[assembly: AssemblyFileVersion("0.1.4.1")]
 
39
40
41
42
 
43
44
45
46
 
47
48
49
 
53
54
55
56
57
58
 
 
 
59
60
61
62
63
64
65
66
67
 
 
68
69
70
 
123
124
125
126
 
 
 
 
 
 
 
 
 
 
127
128
129
 
148
149
150
151
 
152
153
 
154
155
156
 
39
40
41
 
42
43
44
45
 
46
47
48
49
 
53
54
55
 
 
 
56
57
58
59
60
61
62
 
 
 
 
 
63
64
65
66
67
 
120
121
122
 
123
124
125
126
127
128
129
130
131
132
133
134
135
 
154
155
156
 
157
158
 
159
160
161
162
@@ -39,11 +39,11 @@
  public CJSInfo JSInfo()   {   string fullAjaxPostUrl = api.Url.PluginRawPageUrl() + - String.Format("&{0}sComment=' + sComment + '&{0}action=postTimeIntervalComment&{0}actionToken={1}", + String.Format("&{0}sComment=' + sComment + '&{0}action=postTimeIntervalComment&{0}actionToken={1}&{0}ixInterval=' + ixInterval",   api.PluginPrefix,   api.Security.GetActionToken("postTimeIntervalComment"));   string fullAjaxGetUrl = api.Url.PluginRawPageUrl() + - String.Format("&{0}action=getTimeIntervalComment&{0}actionToken={1}&{0}ixInterval=", + String.Format("&{0}action=getTimeIntervalComment&{0}actionToken={1}&{0}ixInterval=' + ixInterval",   api.PluginPrefix,   api.Security.GetActionToken("postTimeIntervalComment"));   @@ -53,18 +53,15 @@
 function postTimeIntervalComment()  {   var sComment = $('form#TimeIntervalExamplePluginForm input[name=comment]').val(); - var ixInterval = $('form#TimeIntervalExamplePluginForm input[name=]').val(); - var url = '" + fullAjaxPostUrl + @"'; - jQuery.get(url, myCallback); + var ixInterval = $('form#TimeIntervalExamplePluginForm input[name=ixInterval]').val(); + var url = '" + fullAjaxPostUrl + @"; + jQuery.get(url, function(data) { postCallback(data); });  }    function getTimeIntervalComment(ixInterval)  { - var url = '" + fullAjaxGetUrl + @"' + ixInterval; - jQuery.get(url, function() { - $('form#TimeIntervalExamplePluginForm input[name=comment]').val(data); -alert(data); -}); + var url = '" + fullAjaxGetUrl + @"; + jQuery.get(url, function(data) { getCallback(data); });  }";   return jsInfo;   } @@ -123,7 +120,16 @@
  }   else   { - return PostComment(); + int ixInterval = -1; + string sComment = ""; + if (api.Request[api.AddPluginPrefix("ixInterval")] != null && + Int32.TryParse(Convert.ToString(api.Request[api.AddPluginPrefix("ixInterval")]), out ixInterval)) + { + if (api.Request[api.AddPluginPrefix("sComment")] != null) + sComment = api.Request[api.AddPluginPrefix("sComment")].ToString(); + return PostComment(ixInterval, sComment); + } + else return "failure: invalid ixInterval";   }     } @@ -148,9 +154,9 @@
    #endregion   - private string PostComment() + private string PostComment(int ixInterval, string sComment)   { - return "success"; + return "you posted '" + sComment + "' for interval #" + ixInterval;   }     private string GetComment(int ixInterval)
 
72
73
74
75
 
76
77
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
 
72
73
74
 
75
76
 
77
78
79
80
81
82
83
84
85
86
87
88
89
90
 
@@ -72,7 +72,19 @@
  return result;  };   -function myCallback(sHTML, status) +function getCallback(data)  { - alert(sHTML); + if (!data || data.substring(0,7) == 'failure') + { + alert('error'); + } + else + { + $('form#TimeIntervalExamplePluginForm input[name=comment]').val(data); + } +} + +function postCallback(data) +{ + alert(data);  } \ No newline at end of file