FogBugz Plugin Interfaces > Wikis and Wiki Pages > IPluginWikiJoin, IPluginWikiDisplay, and IPluginWikiCommit
This article will demonstrate a pair of simple FogBugz plugins that implement the IPluginWikiJoin, IPluginWikiDisplay, and IPluginWikiCommit interfaces contained in the FogCreek.FogBugz.Plugins.Interfaces class library.
IPluginPersonDisplay and IPluginPersonCommit
In this example, two plugins are created that each add a custom field to a FogBugz "Wikis" page. One adds a control allowing you assign a "Level of Awesomeness" to a wiki, and the other adds text box input allowing you to give the wiki a "Secret Code Name." In addition, each plugin generates a checkbox control allowing the user to force the IPluginWikiCommit function WikiCommitBefore to return false, thereby causing the commit to fail. To demonstrate how commit and rollback occurs (and the order in which they occur across two plugins that each implement IPluginWikiCommit), all of the member functions of IPluginWikiCommit generate a UI notification (using CPluginApi.Notifications) indicating that they were called.
If you upload the plugin and play around with it, you'll notice that:
- For the WikiCommitBefore and WikiCommitAfter methods, FogBugz handles each plugin instance implementing IPluginWikiCommit in the order that the plugin was installed. (The CPluginApi.PluginPrefix property reveals this; for example it will return "P4" if called from the 4th plugin ever installed on the FogBugz site.)
- For the WikiCommitRollback method, FogBugz first handles the plugin instance that returned false from WikiCommitBefore, then calls the WikiCommitRollback function of all plugin instances that previously called WikiCommitBefore in reverse order (ie, they're "popped off the stack").
Each of the example plugins use the IPluginWikiJoin method to specify a table containing an integer "ixWiki" column, allowing FogBugz to automatically join the columns of that table to the "Wiki" table. This allows the plugin developer to use CWiki.GetPluginField() and CWiki.GetPluginFieldOriginal() to easily retrieve column values from the joined table, and use CWiki.SetPluginField() to specify a value to be set upon commit.
Compile and Install It On Your Own
Then follow these instructions to create a functioning plugin assembly: Compiling and Installing a FogBugz Plugin