Wiki

Case Status Kiln
Register Log In

Wiki

 
"How To" Guides»Tutorial- A Simple Todo List
  • RSS Feed

Last modified on 12/15/2014 5:16 PM by User.

Tags:

Tutorial- A Simple Todo List

Tutorials > Simple Todo List

Todo List Plugin

Now that you've gotten your development environment setup and built the classic Hello, world it's time to build something a little more functional.

Goal

This tutorial walks you through creation of a simple plugin to give each FogBugz user a basic todo list. The functionality is limited, but it gives you a quick introduction to using the database, building a form and handling post-backs, as well as one of the basic FogBugz UI elements, CEditableTable. For a more extensive use of the editable table, including pop-up dialogs, see How To Create A FogBugz Editable Table With Pop-Up Dialogs. For examples with only basic form elements without the complexity of editable tables, see Implementing IPluginConfigPageDisplay and Implementing IPluginPageDisplay.

Note: This example follows the practices described in Plugin Security. It makes use of an action token in its html forms to prevent cross-site request forgery. It also HTML encodes user data before outputting, and sets the page visibility permission level such that only logged-in users can view it. Note also that in this example, the author builds the elements within the table manually. Alternatively, form elements can be generated by FogBugz with members of the FogCreek.FogBugz.UI.Forms namespace. You can also build complete table and dialog interfaces which match the FogBugz UI with FogCreek.FogBugz.UI.CEditableTable and FogCreek.FogBugz.UI.Dialog. See How To Create A FogBugz Editable Table With Pop-Up Dialogs for an example.

Functionality

This plugin implements the following interfaces contained in the FogCreek.FogBugz.Plugins.Interfaces class library:

  • IPluginDatabase- provides the ability to create a table to store our todos (Example)
  • IPluginPageDisplay- for the Todo List page itself (Example)
  • IPluginSettingsMenu- put a link to the Todo List in the user's Settings menu (Example)
  • IPluginPersonDisplay- show the count of todos for each user on the users page (Simple Example, Advanced Example)

Our plugin will create a link to the current user's todo list in the Settings menu for all logged-in users. Clicking "Todo List" shows the plugin page, shown here with some todo items added:

There is also an instructions page, linked to above the list:

Finally, the plugin adds a column to the Settings -> Users table to display the count of open todo items for each user in FogBugz:

To demonstrate the security provided by action tokens, here is the result of constructing a url to try to create a todo manually, without the necessary token (here, the plugin ID is 147):

http://[fogbugz install]/default.asp?pg=pgPlugin&ixPlugin=147&P147_sAction=addTodo&P147_sDescription=test

 

Compile and Install It On Your Own

Download the source file:   TodoList_Example.cs

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

Next

Try out more tutorials here: Tutorials. Or find the interfaces you need to build that feature you've always wanted: FogBugz Plugin Interfaces