Wiki

Case Status Kiln
Register Log In

Wiki

 
FogBugz Plugin Interfaces (All…»Implementing IPluginFilterView…
  • RSS Feed

Last modified on 1/2/2015 1:56 PM by User.

Tags:

Implementing IPluginFilterViewOptions

Introduction

This article will demonstrate a simple FogBugz plugin that implements the IPluginFilterViewOptions interface contained in the FogCreek.FogBugz.Plugins.Interfaces class library.

Functionality

This is an extended example that starts with the example covered in Implementing IPluginFilterView, adding custom options to our custom view. Generally you will only implement this interface in order to add options to a custom view that you control, so that you can change the details of its display behavior. As a real-world example, the FogBugz Reporting Plugin uses this interface to add breakdowns to chart views.

Here, we will take our little plugin that gives us a plain list of titles for the cases in a filter and add the ability to set the background color of the view.

First, we create some utility functions and constants for the fields we will be sending in the request and adding to the CFilter entity:

Now we can create a table that joins filter, and populate it on filter commit:

Great! Now we have the DB schema for saving the view background color, and we can create the options and display them (but we only want to display them when the CFilter.sView is "Titles" the name of our custom view, because the option doesn't make sense on the other views: they won't know how to change their background color.

Finally, let's modify the view display code to do something with the new background color option:

");\n }\n return "<div style=\\"background-color:" + BGColor(filter) + ";\\">" + sb.ToString() + "</div>";\n}'}" plugin_content="" type="hidden">

Cool! Now we have a persistent option that is specific to this filter and view.

Compile and Install It On Your Own

Download the source file:  IPluginFilterViewOptions_Example.cs

Then follow these instructions to create a functioning plugin assembly: Compiling and Installing a FogBugz Plugin