Last night I left off with the creation of a Castle MonoRail template project and got it to display the ’sample demo’. Tonight I’m going to add ExtJS components to the project and remove the ’sample demo’ components from the project.
I blogged about ExtJS earlier with a link but what you also need to know is the licensing agreement. It comes in three flavors: Commercial, Open Source and OEM/Reseller. I’m not planning on commercializing the Genealogist project so I can go with the Open Source (GNU GPL license v3). At my day job we are seriously considering going with this and if our lawyers bless it we will be using the Commercial license.
This is what the Solution Explorer looks like after creating it using the Castle MonoRail
project template.
I kept the files in the config directory but I opened the controllers.config file and deleted the login.controller and contact.controller components from the file. I kept the home.controller component.
In the Controllers directory I deleted the ContactController and the LoginController. I also deleted both files, ContactInfo.cs and Country.cs from the Models directory.
The Views directory had a Contact and Login directories that I deleted but I kept the Home, layouts and rescues directories.
In the layouts directory I replaced the existing code in the default.brail file with ExtJS code from the Writing a Big Application in ExtJS tutorial.
1: <html>
2: <head>
3: <meta http-equiv=“Content-Type” content=“text/html; charset=utf-8″>
4: <link rel=“stylesheet” type=“text/css” href=“../../Content/ext/resources/css/ext-all.css”>
5: <link rel=“stylesheet” type=“text/css” href=“../../Content/css/application.css”>
6: <script type=“text/javascript” src=“../../Content/extJS/adapter/ext/ext-base.js”></script>
7: <script type=“text/javascript” src=“../../Content/extJS/ext-all-debug.js”></script>
8: <script type=“text/javascript” src=“../../Content/js/application.js”></script>
9: <title>A Big Application</title>
10: </head>
11: <body>
12: <div>Banner</div>
13: <div>MainContent</div>
14: <div>Footer</div>
15: </body>
16: </html>
The Default.aspx page has no code behind and only contains a script section that overrides the OnLoad event of the page lifecycle.
1: <%@ Page Language=“C#” %>
2: <script runat=“server”>
3: protected override void OnLoad(EventArgs e)
4: {
5: Response.Redirect(“~/home/index.castle”);
6: base.OnLoad(e);
7: }
8: </script>
Even though this redirects to the ~/home/index.castle page the ~/layout/default.brail page gets run and there is no content holder, ${ChildOutput}, to render the ~/home/index.brail page in. So what is rendered is this:

If you’re paying attention you will notice that the redirect is to ~/home/index.castle and there is no ~/home/index.castle file. This confused me at first until I realized that in the web.config file this section mapped the .castle extension to the .brail extension.
1: <httpHandlers>
2: <add verb=“*” path=“*.castle” type=“Castle.MonoRail.Framework.MonoRailHttpHandlerFactory, Castle.MonoRail.Framework” />
3: <!– block direct user access to template files –>
4: <add verb=“*” path=“*.vm” type=“System.Web.HttpForbiddenHandler” />
5: <add verb=“*” path=“*.njs” type=“System.Web.HttpForbiddenHandler” />
6: <add verb=“*” path=“*.brail” type=“System.Web.HttpForbiddenHandler” />
7: <add verb=“*” path=“*.brailjs” type=“System.Web.HttpForbiddenHandler” />
8: <add verb=“*” path=“*.st” type=“System.Web.HttpForbiddenHandler” />
9: </httpHandlers>
You can replace the path=”*.castle” with whatever you want as the extension and it will map the extensions: .vm, .nis, .brail, .brailjs and .st to it.
For a long time in my software career I made the statement, “I don’t do no stinkin’ UI”. The UI I just rendered above shows how little I know about UI but at this point I’m going to start working with .css and images and other UI components. This is just the start.