Padre::Plugin::WebGUI now with remote editing

Up until now the WebGUI Padre plugin I’ve been working on has been more or less a proof-of-concept / toy / test-bed for experimental ideas. Whilst that has been fun (and made for good conference slides), the reality is that I haven’t actually been using the plugin for my daily WebGUI development, so how could I expect other WebGUI developers to do so?

I’m hoping to change that. As of today I’ve stripped out all the experimental features and concentrated on the single feature that seems to have the widest possible appeal, namely, remote editing.

Version 0.02 of Padre::Plugin::WebGUI, which is on its way to the CPAN, allows you to connect over HTTP to your webgui site, view you asset tree and edit your assets from inside the Padre text editor. That hopefully makes it as useful for designers and content managers as it is for developers.

Previously the plugin got most of its power from the WGDev library. However this meant that you had to install WebGUI and WGDev as a prerequisite. Given that the WRE ships with non-threaded perl, this meant either installing these prereqs into your system perl or building another perl specifically to run them.  Not an overly arduous task, but enough of a hurdle to dissuade most WebGUI developers from playing with the plugin. That obstacle has now been removed. You do not need to have WebGUI or WGDev installed to run the plugin.

Using WGDev also meant that you could only connect locally to your site. That restriction is now gone.

Installation

Firstly, install Padre.

To allow your WebGUI site to talk to the plugin, add this content handler (WebGUI::Content::Padre) to your site and restart modperl  (the easiest way to do this is to drop the module into your /data/WebGUI/lib/WebGUI/Content dir and add the new content handler to your site config file. There is also an install script that will do the site config editing for you).

Next install the plugin from the CPAN


cpan Padre::Plugin::WebGUI

Usage

Inside Padre, go to the Plugin Manager and enable the WebGUI plugin. You should then see a WebGUI item appear in your Plugins menu.

From the WebGUI menu, tick “Show Asset Tree” and double-click on “Connect” in the new panel that appears.

connect

You will be prompted for the URL of the site you want to connect to. Currently you need to enter you the site in the form: http://username:password@site.com (later we will add a site manager to make this nicer). Remember that this can be any webgui site that you have access to, not just a local site.

connect2

You will then see the Asset Tree dynamically populated with information from your site.

asset_tree

Try double-clicking on an article.

getting_started

A new file tab should open with the name set to the name of your article (with [wg] prepended). The article content will be loaded into to tab, with Padre’s HTML syntax highlighting in effect. If you have Padre::Plugin::HTML installed, you can use the Tidy/Lint/Validate the HTML to your heart’s content. And every time you hit Save, your changes will be pushed up to the site as a new Version Tag.

look_ma

Try double-clicking on another sort of asset, for instance a Template. Once again, the template html will be loaded into a new tab with nice syntax highlighting.

template

And for fun, try opening up a CSS Snippet. The plugin will detect that your snippet is set to the ‘text/css’ mime type and use CSS code highlighting instead of HTML.

css

And similarly for JavaScript Snippets.

javascript

Design and Extensions

As far as Padre is concerned the file you are editing is just a regular file on your file system. For example when you edit the text, an asterisk (*) appears next to the name of the file indicating that you haven’t save it yet.  The integration between the webgui content handler and the plugin is minimal, meaning that you could conceivably use this plugin to do remote editing on non-webgui sites too.

Padre has a nice architectural design, which makes it really easy for us to associate different WebGUI::Asset types with Padre::Document types. Currently most assets delegate to the default Padre::Document::WebGUI::Asset module which does HTML syntax highlighting and expects only generic content from the content handler running on your site. Padre::Document::WebGUI::Snippet has a slightly higher IQ level in that it asks the server to tell it what mimetype the asset is set to, so that it can use the appropriate syntax highlighter.

We could do some really interesting things by building asset-specific Padre::Document modules. For instance you could build a document type that uses fancy wxWidgets controls to do things that aren’t possible on the web (desktop integration etc..) And it’s just as easy to build these for your own custom asset types as it is for core ones. Given that Padre is cross-platform, you’re basically looking at a way of extending WebGUI interactions out into desktop-land.

If you’re a WebGUI designer/developer/content manager and you want to start playing with Padre::Plugin::WebGUI as a novel way of editing content, come find me on #webgui or #padre.

4 thoughts on “Padre::Plugin::WebGUI now with remote editing”

  1. Thanks Gabor. The credit really goes to you and the rest of the Padre dev team for making such an awesome API.

    I’ll upload my slides onto the WebGUI User Conference website later today. Once I do they’ll be online at http://www.plainblack.com/wuc/files. I talked about Padre in both my “Extending WebGUI” and “Ultimate WebGUI Development Environment” talks.

    1. Gladly!

      I think the following is worth propagating (since I wasn’t sure from the outset what the advantages were):

      (18:05:48) patspam: so on another topic, what’s the advantage of putting Padre::Plugin::WebGUI into the padre svn?
      (18:06:07) Alias_: 1. It counts towards the contributor count, commit count, and line count of “Padre” :)
      (18:06:23) Alias_: 2. Other people pretty much automatically can make changes to it and help out without the need for special permissions
      (18:06:37) Alias_: 3. If we want to make changes to the plugin API, we’re able to know it will break your plugin in advance
      (18:06:55) Alias_: 4. It’s easier for other people to steal good ideas from you
      (18:07:13) patspam: #3 is especially good
      (18:07:19) Alias_: 5. We can watch your new improvements as you add them, not only once you reach release time
      (18:07:32) Alias_: 6. Anyone you recruit to help out also automatically gets commit to Padre as a whole
      (18:07:47) patspam: ok I’m sold!
      (18:07:53) Alias_: yay
      (18:08:14) Alias_: Welcome to the Creative Anarchy

Comments are closed.