Changeset 991672cdc03b…
Parent 9fa408c4fe1c…
by
Changes to 3 files · Browse files at 991672cdc03b Showing diff from parent 9fa408c4fe1c Diff from another changeset...
@@ -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.4.1")]
-[assembly: AssemblyFileVersion("0.1.4.1")]
+[assembly: AssemblyVersion("0.2.0.0")]
+[assembly: AssemblyFileVersion("0.2.0.0")]
|
@@ -36,6 +36,10 @@
#region IPluginJS Members
+ // this js comes down on every page. I put this here instead of in the static js file
+ // because we need the pluginprefix for this plugin (which is based on when the plugin is
+ // installed. alternatively, we could just set a variable for it in JS-land and put the
+ // rest of these functions into the static js file
public CJSInfo JSInfo()
{
string fullAjaxPostUrl = api.Url.PluginRawPageUrl() +
@@ -156,12 +160,23 @@
private string PostComment(int ixInterval, string sComment)
{
- return "you posted '" + sComment + "' for interval #" + ixInterval;
+ CTimeIntervalQuery query = api.TimeInterval.NewTimeIntervalQuery();
+ query.AddWhere("TimeInterval.ixInterval = @ixInterval");
+ query.SetParamInt("@ixInterval", ixInterval);
+
+ CTimeInterval[] rgTimeIntervals = query.List();
+ if (rgTimeIntervals.Length > 0)
+ {
+ CTimeInterval interval = rgTimeIntervals[0];
+ interval.SetPluginField(sPluginId, "sComment", sComment);
+ interval.Commit();
+ }
+ return "success: '" + sComment + "' recorded for interval #" + ixInterval;
}
private string GetComment(int ixInterval)
{
- string sComment = "none";
+ string sComment = "";
CTimeIntervalQuery query = api.TimeInterval.NewTimeIntervalQuery();
query.AddWhere("TimeInterval.ixInterval = @ixInterval");
|
@@ -1,3 +1,7 @@ + // this is the standard fogbugz popup code, managed by the PopupManager object
+// I set the html and added js after oSelf.Popup.setHtml which finds the ixInterval that got added to
+// the dialog in doTimesheetMagic to the form here. it also calls getTimeIntervalComment to fetch
+// the comment for the interval being shown
var TimeIntervalExamplePlugin = new function(){
var oSelf = this;
@@ -24,9 +28,8 @@ });
}();
+// this code will be called each time the timesheet dialog is displayed
function doTimesheetMagic(){
- // put your jQuery magic here that manipulates the timesheet table
- // keep in mind that this code will be called each time the timesheet dialog is displayed
var i = 0;
jQuery("#idTimesheetTable tbody tr").each( function(index)
{
@@ -51,6 +54,7 @@ i++;
});
}
+// this lets our code run after the dialog is actually done coming down from the server
var nWaitCount = 0;
function waitForTimesheetReady(){
console.log('lookin for timesheet table...');
@@ -63,6 +67,8 @@ doTimesheetMagic();
}
}
+// this runs when the timesheet dialog is displayed. it can be changed / added to
+// to also run when you click the next and previous arrows in the dialog
var oldShow = ClockPopup.show;
ClockPopup.show = function(){
console.log('Calling ClockPopup.show()...');
@@ -71,10 +77,10 @@ waitForTimesheetReady();
return result;
};
-
+// runs after the comment is fetched for an interval
function getCallback(data)
{
- if (!data || data.substring(0,7) == 'failure')
+ if (data.substring(0,7) == 'failure')
{
alert('error');
}
@@ -83,7 +89,7 @@ $('form#TimeIntervalExamplePluginForm input[name=comment]').val(data);
}
}
-
+// runs after the comment is posted for an interval
function postCallback(data)
{
alert(data);
|
Loading...