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

initial checking case FC2036704

Changeset 98193e382721

Parent 8557f332516f

by Adam Wishneusky

Changes to 6 files · Browse files at 98193e382721 Showing diff from parent 8557f332516f Diff from another changeset...

Change 1 of 1 Show Entire File TimeIntervalExample.sln Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
@@ -0,0 +1,20 @@
+ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TimeIntervalExample", "TimeIntervalExample\TimeIntervalExample.csproj", "{BAADAECF-22A2-438F-9098-E1E977B1BAF8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BAADAECF-22A2-438F-9098-E1E977B1BAF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BAADAECF-22A2-438F-9098-E1E977B1BAF8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BAADAECF-22A2-438F-9098-E1E977B1BAF8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BAADAECF-22A2-438F-9098-E1E977B1BAF8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal
 
 
 
 
Change 1 of 1 Show Entire File TimeIntervalExample/​Properties/​AssemblyInfo.cs Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@@ -0,0 +1,43 @@
+using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +using FogCreek.Plugins; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyFogCreekPluginId("Adam+TimeIntervalExample@fogcreek.com")] +[assembly: AssemblyFogCreekMajorVersion(3)] +[assembly: AssemblyFogCreekMinorVersionMin(6)] +[assembly: AssemblyFogCreekEmailAddress("customer-service@fogcreek.com")] +[assembly: AssemblyFogCreekWebsite("http://www.fogcreek.com/FogBugz/support.html")] +[assembly: AssemblyTitle("TimeIntervalExample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Fog Creek Software")] +[assembly: AssemblyProduct("TimeIntervalExample")] +[assembly: AssemblyCopyright("Copyright © Fog Creek Software 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("37dd7a8b-0034-48c8-9922-243ff0a76880")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// 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.0.0")] +[assembly: AssemblyFileVersion("0.1.0.0")] // adam - Added this cool new FogBugz plugin!
Change 1 of 1 Show Entire File TimeIntervalExample/​TimeIntervalExample.cs Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
@@ -0,0 +1,146 @@
+using System; +using System.Collections.Generic; +using System.Text; +using System.Web; + +using FogCreek.FogBugz; +using FogCreek.FogBugz.Plugins; +using FogCreek.FogBugz.Plugins.Api; +using FogCreek.FogBugz.Plugins.Entity; +using FogCreek.FogBugz.Plugins.Interfaces; +using FogCreek.FogBugz.UI.Dialog; + +namespace TimeIntervalExample +{ + public class TimeIntervalExample : Plugin, IPluginTimeIntervalCommit, IPluginTimeIntervalJoin, + IPluginJS, IPluginDatabase, IPluginRawPageDisplay + { + public TimeIntervalExample(CPluginApi api) : base(api) { } + + protected const string SPluginId = "Adam+TimeIntervalExample@fogcreek.com"; + string _preCommitComment = ""; + private const string CommentsTable = "TimeIntervalComment"; + private const string IntervalColumn = "ixInterval"; + private const string CommentColumn = "sComment"; + public const int CommentColumnMaxLength = 255; + private const int PluginSchemaVer = 1; + + #region IPluginTimeIntervalCommit Members + + public void TimeIntervalCommitAfter(CTimeInterval timeinterval) + { + throw new NotImplementedException(); + } + + public bool TimeIntervalCommitBefore(CTimeInterval timeinterval) + { + throw new NotImplementedException(); + } + + public void TimeIntervalCommitRollback(CTimeInterval timeinterval) + { + throw new NotImplementedException(); + } + + #endregion + + #region IPluginTimeIntervalJoin Members + + public string[] TimeIntervalJoinTables() + { + return new string[] { "TimeIntervalComment" }; + } + + #endregion + + #region IPluginJS Members + + public CJSInfo JSInfo() + { + throw new NotImplementedException(); + } + + #endregion + + #region IPluginDatabase Members + + public CTable[] DatabaseSchema() + { + var timeIntervalComments = api.Database.NewTable(api.Database.PluginTableName(CommentsTable)); + timeIntervalComments.sDesc = "Assigns Comments to TimeIntervals"; + timeIntervalComments.AddAutoIncrementPrimaryKey("ixTimeIntervalComment"); + timeIntervalComments.AddIntColumn(IntervalColumn, true, 0); + timeIntervalComments.AddVarcharColumn(CommentColumn, CommentColumnMaxLength, false); + + return new[] { timeIntervalComments }; + } + + public int DatabaseSchemaVersion() + { + return PluginSchemaVer; + } + + public void DatabaseUpgradeAfter(int ixVersionFrom, int ixVersionTo, CDatabaseUpgradeApi apiUpgrade) + { + if (ixVersionTo == 1) + { + // No action required. Don't create any data in the tables + } + } + + public void DatabaseUpgradeBefore(int ixVersionFrom, int ixVersionTo, CDatabaseUpgradeApi apiUpgrade) + { + if (ixVersionTo == 1) + { + // No action required. Don't create any data in the tables + } + } + + #endregion + + #region IPluginRawPageDisplay Members + + public string RawPageDisplay() + { + if (api.Request[api.AddPluginPrefix("action")] != null && + Convert.ToString(api.Request[api.AddPluginPrefix("action")]) == "postComment") + { + // make sure the request includes a valid action token + if ((api.Request[api.AddPluginPrefix("actionToken")] == null) || + !api.Security.ValidateActionToken(api.Request[api.AddPluginPrefix("actionToken")], + "postComment")) + { + return "action token invalid"; + } + else + { + PostComment(); + } + + } + + if (api.Request[api.AddPluginPrefix("data")] == "getComment") + { + return GetComment(); + } + else return "command not recognized"; + } + + public PermissionLevel RawPageVisibility() + { + return PermissionLevel.Normal; + } + + #endregion + + private void PostComment() + { + + } + + private void GetComment() + { + throw new NotImplementedException(); + } + } +}
Change 1 of 1 Show Entire File TimeIntervalExample/​TimeIntervalExample.csproj Stacked
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{BAADAECF-22A2-438F-9098-E1E977B1BAF8}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>TimeIntervalExample</RootNamespace> + <AssemblyName>TimeIntervalExample</AssemblyName> + <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <TargetFrameworkSubset> + </TargetFrameworkSubset> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="FogBugz, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a9eb54ba6d925add, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>.\FogBugz.dll</HintPath> + </Reference> + <Reference Include="FogCreek.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d8367ba9769b01ac, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>.\FogCreek.Plugins.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Web" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="TimeIntervalExample.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <PropertyGroup> + <PostBuildEvent>xcopy /Y /I /S /E "$(ProjectDir)static" "$(TargetDir)static" +"$(SolutionDir)..\_postbuildSln.bat" $(TargetName)</PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file