← servoy magazine

[Tips] Automatically Create an Etherpad..."Pad" from Servoy

We're huge fans of Google Wave. So much so that a large portion of our project management was being done in Wave when Google announced its demise several months ago.

In our search for a Wave replacement, we happened upon Etherpad—which seems to be the core of Google Wave to begin with. I never bought into the hype of Google Wave as a replacement for email and instant messaging; instead we used it solely for collaborative document creation. It so happens that this is what Etherpad does extremely well.

Unlike Wave, Etherpad doesn't have a default navigation system for "pads". You have to know the URL to a particular pad to access it.

An easy solution is to use a Servoy-built application to manage pads. For this to work smoothly, you need to be able to automatically create pads from within Servoy.

Initially I thought this would be easy to do with Servoy's http plugin. Unfortunately, it turns out the http plugin has no way to follow redirects. So curl to the rescue. Took a bit to figure out that Etherpad does cookie validation so not your standard "post and grab" curl either. 

End result:

 

function ETHERPAD_new_pad(event) {
	
	var uuid = application.getUUID()
	
	// initial page to set cookie
	var results = application.executeProgram(
					"curl",
					"-b cookies",
					"-L",
					"http://your-etherpad-install.com:9000/" + uuid)
	
			
	// create pad		
	var results = application.executeProgram(
					"curl",
					"-b cookies",
					"-d padId=" + uuid,
					"-d createPad=Create%20Pad",
					"-L",
					"http://your-etherpad-install:9000/ep/pad/create?padId=" + uuid)
	
	etherpad_URL = 'http://your-etherpad-install:9000/' + uuid				
		
}

Comments (2)

Dean Westover
Nice post David. Would be interested in instructions that anyone might have for installing Etherpad on a Windows Server.
David Workman
Drop Troy an email (troy at data-mosaic.com). He managed to get it installed on Ubuntu after a bit of effort (it's not a straight-forward process). He has windows chops as well.