The Ortus BlogBox

"Ortus: A rise, beginning, coming into being, born, the origin!"

 

 

Category Filtering: 'tutorials'

 

Content Box Theme Development: Creating a CI Pipeline

Jon Clausen
Aug 05, 2016

 

An incredibly powerful feature of ContentBox 3 is the increasing availability of open source themes to jump start your custom development.   For those wishing to contribute back to the community, creating your own theme is as simple as cloning one of our boilerplate themes, creating a new GitHub repo for your customizations, and publishing your theme on Forgebox.  

ContentBox CMS, TestBox, Tutorials 0

Screencast showing off new ForgeBox 2.0 features in CommandBox 3.1.0 beta

Brad Wood
May 17, 2016

 

We recently announced the availability of CommandBox 3.1.0 beta for testing.  We've make a screen cast also showing how to start Adobe, Lucee 5, and Railo servers which you can view here.  We've also prepared this short screencast that shows how you now interact with the new ForgeBox 2.0 API via your command line to create users, and publish packages.   Check it out below.

If you'd like to see more, please check out our official announcement blog that overviews all of the CommandBox 3.1.0 beta features.

https://www.ortussolutions.com/blog/commandbox-v310-beta-ready-for-testing

CommandBox, Tutorials, Walkthroughs 0

Screencast showing how to start Adobe, Railo, and Lucee 5 servers in CommandBox

Brad Wood
May 16, 2016

 

We recently announced the availability of CommandBox 3.1.0 beta for testing.  We've also prepared this short screencast that shows starting up Adobe, Railo, and Lucee 5 servers in CommandBox.

If you'd like to see more, please check out our official announcement blog that overviews all of the CommandBox 3.1.0 beta features.

https://www.ortussolutions.com/blog/commandbox-v310-beta-ready-for-testing

CommandBox, Tutorials, Walkthroughs 3

Coldbox Legacy App Demo

Brad Wood
Jan 18, 2016

 

There are a lot of people out there in the CFML world managing legacy codebases.  Some of them use frameworks that are no longer maintained, and many  use no framework at all.  A common question that I get is whether an app can be slowly converted over to  ColdBox without having to rewrite everything at once.  The answer is YES!  ColdBox will comfortably live alongside your legacy code, giving you the chance to slowly convert it over as you get the chance.  

ColdBox MVC, CommandBox, Sample Apps, Tips & Tricks, Tutorials 0

Submit Your First Pull Request to an Open Source Project

Brad Wood
Sep 23, 2015

 

Update 10/10/2015 -- New tickets added!

Perhaps you're using open source projects with your work.  You've heard about how Git works, and maybe you even attended one of my sessions on how to submit pull requests. You've never actually tried to do one before though.  You were brave one day and clicked the "Fork" button in GitHub but were left staring at your keyboard wondering what the heck you could do to help out a project that wouldn't sink your entire weekend.

The Wait is Over

Ladies and gentlemen, boys and girls of all ages: your time has come.  Today we're breaking down all the walls keeping from being a productive member in the open source community.  Everything you need is documented and laid out in front of you.  Heck, for this to be any easier, I'd just have to do it for you!  If you've been waiting for just the right chance to come along to submit your first pull request, please keep reading. 

Today we are announcing a special program where we've created a handful of super-duper easy tickets for an assortment of Box products.  These are already entered into our ticket tracker and approved.  All we need is someone to complete them!  You don't even need to know how our products work to help out.  Each ticket spells out what amounts to a one-line change to get your feet wet and experience the process of submitting something that will release to the world in the next version of our product.  We'll even make sure to include your names in the release notes :)

You. Yes, you!

There's a little bit of a catch.  These special tickets are ONLY for people who have never submitted a pull request via GitHub before.  You know who you are.  If you've contributed before, we thank you so much but please step aside so someone who's never been a part of this process can give it a spin.  Please only take one of these tickets too.  If you really love this and want to help more in the future, don't worry-- we'll have lots of other opportunities to put your newly learned Git skillz to good use.  

What You Need to Do

Ok, we've made this super easy.  The tickets already exist in JIRA, but I would recommend creating a quick JIRA account so you can assign yourself to the ticket.  That way, we won't have two people trying to work on the same thing at once.  Here is our guide that covers signing up for a free JIRA account.

How To Create A JIRA Account And Enter ColdBox Tickets

Next, choose one of these simple tickets and assign it to yourself:

Next, follow the step-by-step guide here that will walk you through getting a copy of the code, making the change, and submitting that change back to us.

How To Submit Pull Requests to the ColdBox Platform

If you get stuck or have questions, no worries!  Just jump on the CFML Slack team and give a shout out in the #box-products channel.  Or you can shoot an E-mail off to our Google Group.

Thank You

You did it!  Today you have become part of something bigger than yourself.  You contributed to an open source project and it really wasn't that bad.  A new world of opportunity and collaboration has just opened up to you. Go ahead and kick back while you revel in your new found meaning.  In fact, take the rest of the day off-- I've already cleared it with your boss.

If you happen across this post and the 4 tickets above have already been gobbled up, please give a holler.  I will gladly create more easy-grab changes for first timers to try out.  This is important to CFML and at Ortus we understand that as much as anyone does.  We want CFML to succeed, and for that the CFML community needs to be engaged.  

ColdBox MVC, Community, Tutorials, Walkthroughs 0

Converting Fusebox 5.1 Sample App to ColdBox MVC - Part 2

Brad Wood
Aug 12, 2014

 

This is the second half of our two-part conversion of a FuseBox 5.1 sample app to ColdBox MVC.  If you haven't been following our blog series on converting your legacy FuseBox apps over to ColdBox MVC you may want to back up and read the previous post first..  In that post we took a look at the different files in each version of the app.  We talked about how each framework bootstraps itself up, as well as settings and circuits/handlers.  We'll pick up right were we left off in this post and finish off the code by looking at how we converted the views, models, and error handling.

Views

ColdBox will automatically look for a view file named after your action in a folder named after your handler.  Of course, all this happens in our "/views" convention folder.  You are free to name your view files whatever you want though.  Just use the following code to tell the framework what view to include:

// Include /views/randomFolder/randomFile.cfm
event.setView( "randomFolder/randomFile" );

Our views are almost identical.  There are two main differences.  The first is that our views "get" data from the handler by accessing the readily-available rc (request collection) and prc (private request collection) scopes.  rc is used for any input from the user via FORM or URL scopes.  prc is for any other data the handler wants to pass along to the view.  The second is in how we build links.

/view/listEmails.cfm

<a href="#self##xfa.conform#">Return to Connect Form</a>

/views/list.cfm

<a href="#event.buildLink( prc.xeh.conform )#">Return to Connect Form</a>

ColdBox gives you a nice helper method in the event object to build links for you.  It automatically handles HTTPS, the base domain, app mapping, and query string.  event.buildLink() can also generate SES URLs with no changes when you have it enabled.

Layouts

ColdBox layouts are placed in a folder called /layouts by default and unless you've specified something else, will look for a file called Main.cfm.

/layouts/Main.cfm

<cfoutput>
	<html>
		<head>
			<link href="/includes/getmymail.css" rel="stylesheet" type="text/css" />
		</head>
		<body>
			#renderView()#
		</body>
	</html>	
</cfoutput>

The renderView() call is where the output from the view will be placed.

Model

Your models are your services, beans, and DAO that represent the business logic in your application.  In ColdBox, these go under a folder called /model.  I created a MailService.cfc which encapsulates getting a list of messages and getting a single message.  

/model/MailService.cfc

component singleton {
	property name="attachmentPath" inject="coldbox:setting:attachmentPath";
	property name='sessionStorage' inject='coldbox:plugin:sessionStorage';
	
	function getAllMessages( required numeric start	) {
		// Get connection Info
		var connectionInfo = sessionStorage.getVar( 'connectionInfo' );
		
		return new pop().getHeaderOnly(
			server = connectionInfo.serverName,
			username = connectionInfo.userName,
			password = connectionInfo.password,
			port = connectionInfo.serverPort,
			maxrows = connectionInfo.msgsPerPage,
			startrow = arguments.start
		);
	}
	
	function getMessage( required string uid ) {
		// Get connection Info
		var connectionInfo = sessionStorage.getVar( 'connectionInfo' );
				
		return new pop().getAll(
			server = connectionInfo.serverName,
			username = connectionInfo.userName,
			password = connectionInfo.password,
			port = connectionInfo.serverPort,
			uid = arguments.uid,
			attachmentpath = attachmentPath,
			generateuniquefilenames = true
		);
	}	
}

Note the singleton annotation at the top in the component definition.  This tells WireBox to only create one instance of this service that the entire application shares.  I'm also using properties to inject a reference to my attachmentPath setting as well as the sessionStorage plugin again.  No configuration is necessary for WireBox to find the MailService CFC since we've placed it in the /model convention folder.  Unfortunately, I found that Railo doesn't support the same script syntax for the CFPOP tag so I also created a RailoMailService.cfc file in the /model folder and created the following WireBox configuration file.

/config/WireBox.cfc

component extends='coldbox.system.ioc.config.Binder' {
	function configure() {		
		// Use this to detect the CFML engine
		var CFMLEngine = new coldbox.system.core.util.CFMLEngine(); 
		
		// Railo uses a different script syntax
		if( CFMLEngine.getEngine() == CFMLEngine.RAILO ) {
			// This will override the default MailService mappings
			map( 'MailService' ).to( 'model.RailoMailService' );		
		}
		
		// No "else" needed for Adobe CF. WireBox will simply "find" the 
		// "MailService" CFC in the "/model" folder automatically.		
	}
}

This file uses a utility built into ColdBox called CFMLEngine to detect the engine in use and conditionally overwrite the MailService mapping to point to the Railo version.

Error Handling

In the FuseBox code, there are try/catches around a lot of code in the "model" files.  If an error occurs, a custom error page is included.  

<cftry>
<cfpop  .../>
	<cfcatch>
		<cfinclude template="../view/error/connectionError.cfm" />
	</cfcatch>
</cftry>

What if an error occurs somewhere else in the request though?  What if you add new code and forget to wrap it in a try/catch.  Even worse, what if you decide to rename your error template after it's referenced everywhere?  In ColdBox, error handling is built in.  All of your code is run in a try/catch at the framework level, and there's a nice default error template that displays.  In your production settings though, you'll want to override this to a more secure page that doesn't divulge information with the customErrorTemplate setting.

customErrorTemplate = "includes/templates/oops_sorry.cfm"

You can read more about the exception handling provided to you in ColdBox here.

Conclusion

To see all the code, please visit this repo on GitHub: https://github.com/bdw429s/FuseBox-5.1-Sample-App-Conversion

This sample app was a little more involved than the last one, and hopefully everything makes sense even though I included a lot more code.  If clone the Git repo you can unzip the FuseBox code and open them side by side.  Please comment below if you have any questions or suggestions, and here's our list of handy resources:

 

 

ColdBox MVC, Sample Apps, Tips & Tricks, Tutorials, Walkthroughs 0

Converting Fusebox 3 Sample App to ColdBox MVC

Brad Wood
Jul 14, 2014

 

In our last installment, we talked about the benefits of converting legacy FuseBox applications over to ColdBox MVC.  In this entry we'll actually convert the Fusebox 3 sample app available from fusebox.org to show you the similiarities and differences between the two frameworks.  

Overview

Here's a screenshot of the files in the Fusebox and ColdBox code side-by-side. Both are pretty self-explanatory, so we'll work our way through the contents of each file as we go.

ColdBox MVC, Sample Apps, Tips & Tricks, Tutorials, Walkthroughs 0

Converting Fusebox to ColdBox MVC

Brad Wood
Jul 03, 2014

 

Fusebox is one of the oldest frameworks for ColdFusion.  My first real ColdFusion job was working on a large intranet site built upon Fusebox.  The framework has changed hands several times and though it has now gone cold in terms of new development but it is still used by 1 in 3 ColdFusion developers according to the State of the CF Union survey results from 2014.  

Party like it's 1999

There's a lot of legacy code out there still running on FuseBox, but that doesn't mean it has to stay that way.  The Internet has moved on to design patterns like MVC and more-object oriented approaches for code reuse and testing.   The thought of reworking your old codebase might seem scary, especially if you're not familiar with MVC and you aren't using any OO principles.  Don't despair though, it's often times better to make incremental improvements to code instead of trying to throw it out and rewrite it from scratch.  The old adage says, how do you eat an elephant? "One bite at a time!"

ColdBox MVC, Sample Apps, Tips & Tricks, Tutorials, Walkthroughs 0

How To Create A JIRA Account And Enter ColdBox Tickets

Brad Wood
Jun 27, 2014

 

After using the ColdBox MVC Platform or any of the Box libraries you might think of an enhancement or new feature you'd like to see.  Or perhaps you found an issue, and after posting it to our Google Group, we asked you to put in a ticket.  Well, today is you day because here is a step by step guide for getting set up in our bug tracker so you can enter tickets, as well as comment, vote, or watch other people's tickets.  Out open source libraries are developed out in the open for full transparency and to encourage the public to join in and be part of the exciting process.

Atlassian JIRA

Atlassian has created a number of development workflow tools like BitBucket, SourceTree, and Bamboo.  JIRA (pronounced Jeer-ah) is their popular system for bug tracking and does lots of cool stuff with agile plugins. The URL for the Ortus JIRA bug tracker is (We'll wait while you bookmark it):

https://ortussolutions.atlassian.net/browse/COLDBOX/

When you first visit, you'll see something like this. From a non-logged in state you can still view tickets and read comments but you can't create tickets or interact with existing ones.  Start by hitting the green "Log In" button in the upper right hand corner of the screen.

Not logged in (click to enlarge)

On the log in form, click the "Create an account" link on the right hand column under the username and password fields.  Don't be tempted to use the "Log in using Google" option.  That only works if your E-mail address ends in @ortussolutions.com!

ColdBox MVC, Community, Tips & Tricks, Tutorials, Walkthroughs 0

Getting Started With ContentBox and Fuseguard

Luis Majano
Apr 03, 2014

 

Here is a short introductory video on how to leverage the Ortus FuseGuard Module to bring a nice software firewall to ContentBox Modular CMS!

 

 

ContentBox CMS, FuseGuard, Tutorials, Tutorials 0
1 2 3 4 5 6 ... 8 >>