The ColdFusion community is full of bright people who have built really neat libraries and widgets to make better features and functions for applications. One of my favorites, CFUniform (a rich forms library) lets you build consistent, feature rich forms with very minimal code. I use this library all the time to make my applications snazzier and more maintainable. There are plenty of cool projects I've not yet used and while working on some Model-Glue features this weekend, I had an idea.
See, I've been working on the scaffolding feature in Model-Glue. This feature is a great way to get a jump start on a data-centric application. Simply configure Model-Glue and your ORM of choice and Model-Glue will generate everything needed to Administrate your data. Forms, Lists, delete screens, Bam, it'll generate the whole thing for you in seconds. Of course, the generated code is easily customized to fit the need of the application, but because it is generated from the database, the functionality is generic and the look and feel is somewhat limited.
What if we had a real easy way to plug in some of these rich libraries into Model-Glue? Forms libraries, Ajax widgets, Grids, Rich tables, all these could be as simple as adding a few characters into an XML file. Sounds fun, right?
What I want is to talk to a few of the folks behind some of the coolest libraries to explore how I can provide the best integrations. If you are the author or maintainer of some library or widget, or you use something that you are really fond of, let me know by leaving a comment. We might be able to work together to provide some really neat, useful functionality for the community.
We on the Model-Glue team have put together a simple survey and want to hear from you. Even if you aren't using Model-Glue or Frameworks or OO at all, your views are important to us.
How long will it take?
We've all taken long and boring surveys with endless questions requiring 1-10 rankings on sundry topics like "How much do you prefer crunchy peanut butter over creamy peanut butter?". Model-Glue is all about making things easy for developers and this survey is no exception. This survey was tested with several monkeys from the North Carolina Zoo. Each monkey was able to complete the survey and give quality answers, all within a 20 minute period. The way we see it, a reasonably intelligent ColdFusion user like yourself should be able to complete the survey in 10 minutes.
Would you kindly give us 10 minutes of your time for the Model-Glue Survey? We promise to read all answers and use the answers for the good of the framework.
No monkey's were harmed in the making of this Blog Post.
To date, in our series on Surfing Stats, we have covered the intent, directory structure and the main application file. (download the code using the download link at the bottom of the the Intro to Surfing Stats post). Now we will look at the datasets.
Model-Glue is a very powerful and robust ColdFusion Framework. When solving application problems with Model-Glue there are recurring solutions that work well for particular problems. Up until now, one would have to troll the various blogs hoping the right keywords unlocked google to reveal a proper solution. While effective, this method is also time consuming.
Todd Sharp has developed and released the Model-Glue cookbook. Following the common cookbook format, this timely and relevant application will hold collective wisdom on how to use the Model-Glue framework for fun and profit.
If you want to learn more about Model-Glue, please check the Model-Glue cookbook for interesting tips and solutions for everyday programming. It even has an RSS feed for you!
If you are a Model-Glue expert, or you have found some interesting solutions with Model-Glue, share them with the simple Entry Form. Adding an entry to the Model-Glue Cookbook is easier than blogging and you get full credit.
I admire Todd Sharp. He is an effective community leader, generous with his time and efforts. I mean, look at what he has done in just the last 3 months:
- Snip-a-thon contest
- PPTUtils Project
- Model-Glue Cookbook
Todd gets my vote for Most Deserving of Adobe Community Expert Status
ModelGlue Users and especially my MG series users, have a read on Doug Boude's Blog about the The Model-Glue Event Lifecycle.
Doug has a lot of other interesting Model Glue related content as well. Here are three of my favourites:
Previously, we connected Transfer ORM into our ContactOMatic application. Now, we will use it to get some things done! The completed files for this exercise are included at the bottom of the post, just click on the 'Download' link.
Using Transfer with MG:U is quite different than hand coding all the data access instructions so I separated out the new Transfer enabled code from the old hand coded bits to help compare similar operations between the two styles. This means the ContactOMatic is not an example of Architectural Purity! Shock! Horror! Gasp!
To make the separation, I added another ModelGlue configuration file, named ContactAction.xml, to the main ModelGlue.xml file through the use of the include tag as follows:
I spent several hours going over a new ModelGlue:Unity + Transfer set up and had an error that stumped me. For the life of me I couldn't get any scaffolds to work. ModelGlue and Transfer loaded up perfectly, Directly querying the database worked perfectly. All signs pointed to GO, except for the lack of any scaffolded events working.
Message Model-Glue: There is no known event handler for "skiresort.list".
Now, I've set this up several times so I was sure I misconfigured something. I checked every possible thing I could think of that could be holding this up and then started cfdumping the internals of the frameworks. Getting nowhere fast, I started complaining about it in the IRC channel and the second I started explaining it, the answer came to me. So for public humiliation and for posterity, here is the answer.
If you want to access the event-handlers generated by the scaffolding feature, the <scaffold /> tag in the modelglue.xml file MUST be contained in the <event-handlers /> tag.
This is Bad
<result do="view.template" />
This is Good
<scaffold object="skiresort" type="list,view,edit,commit,delete">
<result do="view.template" />
I shall hang my head in shame for the next 5 minutes....
Previously in this series, we installed the ModelGlue:Unity framework and the ColdSpring framework. We used the ModelGlueApplicationTemplate as the skeleton, added our basic flow and navigation. We can save and list contacts and our validation is working nicely,
In this section of our Contact-O-Matic, we will pull out the contact types values from coldspring and used them to add defined categories to our contacts. In a previous segment, we added the Contact Types as a 'map' in ColdSpring, now we will pull out the values and add them to our form.
Previously in this series, we installed the ModelGlue:Unity framework and the ColdSpring framework. We used the ModelGlueApplicationTemplate as the skeleton, added our basic flow and navigation. Finally we can save and list contacts Our Contact-O-Matic is moving right along.
In the last segment, we tested the 'failure' path and were routed back to the form. We also tested the 'success' path and were routed to the contact list. Open the ContactFormBean.cfc located in *ContactManagerMG/Model and edit the validate function (You did check the validate box in the rooibos generator like the last series said, didn't you ;) )
Our validate function should have the returntype of boolean. We will pass in a structure to hold any error messages and check the lengths of our two properties ContactName and ContactType. Your validate function should look like this:
Previously in this series, we installed the ModelGlue:Unity framework and the ColdSpring framework. We used the ModelGlueApplicationTemplate as the skeleton then we added our basic flow and navigation. Our Contact-O-Matic is moving right along.
In this segment of our regularly scheduled programming, we look a bit deeper into ColdSpring, add the contact form and contact list.