advanced reports dependency injection development environment frontend editing git javascript meetup php pixlr porthole purify queuedjobs rage silverstripe tidy ubuntu webservices wiki
Have added some new functionality for the advanced reports module that allows for late binding data into the conditions used in the report. This is through the use of either strtotime: last sunday|Y-m-d H:i:s for doing time calcs, or using param: ParamName for using parameters specified in either the _GET array, or via the default parameter listing for the report (to provide a fallback). https://github.com/nyeholt/silverstripe-advancereports Also, our new guy Shea has been doing some cool stuff on the simplewiki module to add in some much much nicer file upload/linking and page linking that uses autocomplete for selecting items instead of the nasty nasty hacky stuff that was there previously. VERY much nicer to use now https://github.com/nyeholt/silverstripe-simplewiki
I recently slapped together a 'Clean Content' module for SS pages that allows you to have HTML Tidy and/or Purify run on content. This can be done optionally on save, or from a template call to $Clean(ContentFieldName) which will run the appropriate cleaning option. Note that it'll need the tidy plugin enabled for that - it ships with the HTML purify extension.
A couple of new things - I've added a new SilverStripe module for defining APIs a little bit more specifically than dealing with the rest service that comes out of the box. Instead of being an XML/JSON wrapper around data objects, it's an XML/JSON wrapper around service classes (business logic) to allow you to be specific about what end users get. It's also meant to encourage re-usable service layer code, that can be used from your controller layer too.
I've also been playing around with Porthole for doing cross-frame-domain javascript communication (more on that project another time). It's a little barebones for what I need it for, so I wrote a wrapper around it to enable some more structured communication. This allows for registering a handler class (with methods) to handle the incoming communication, and for sending communication to specific methods of bound handlers.
// this call must be made, as it sets up the appropriate data comms
// to the child frame
ProxyFrameManager.listenTo('FrameName');
// to send to the child
ProxyFrameManager.send('FrameName', 'methodName', 'param1', {and: 'so on'});
Then in the child...
ProxyFrameManager.listenTo('$ParentPageProxyUrl', {
methodName: function (param, objectParam) {
// do something to handle the call here
}
});
A demo can be found here
One thing I've regularly found missing from SilverStripe is the ability to paste a screenshot directly into the CMS. Of course, that's not yet possible using JS or Flash directly, but Java does give you the option to access the clipboard, and using an applet, I've hooked this capability into the CMS.

It's not as fluent as clicking the wysiwyg and hitting Ctrl+V (though I'm sure someone could script those actions...), but clicking ctrl+shift+V when the "Insert Image" toolbar is open will paste to the applet, then you need to manually click the 'Upload' button. This will select the image for you in the list on the right, so you then can just click "Insert Image".
The other nice thing is being able to hook into the Pixlr editor. If you have the 'and Edit' box checked, then the pixlr editor will be launched after clicking upload, allowing you to modify the image immediately.

You can get it from Github. It's currently self signed, so you'll get a java nag warning, and I've found that it performs terribly on OpenJDK on Ubuntu (though no problems with the Sun JRE). So let me know if you have any specific issues.
Not been a great deal going on other than Work and Real Life lately. I was up in Brisbane for a meetup hosted by the guys at Hive, which was awesome, and will be up in Sydney at the end of the month for a SydneyPHP meetup (more details to come).
In the meantime, check this out - my JS fingers are getting itchy.
Thanks to everyone who turned up for the meetup last week. Here's some links to the presentations that were given:
I just found the link to some slides that Andrew Short prepared with a bit of input from myself that he gave at the Sydney PHP User Group meetup a few months ago. If I can make it, I'll probably roll them out at the Melbourne User Group soon...
I've added a new piece of code to the Queued Jobs module that allows you to quickly add scheduling to any data object.
It's very straight forward to add
Object::add_extension('MyDataObject', 'ScheduledExecutionExtension');In SilverStripe, users can select their locale, along with specifying a default date and time format to use. This should also be replicated throughout the site, but if you're forgetful like me, sometimes it won't display as expected. The secret? Making sure you set the user's preference for the request!
In Page_Controller::init() simply add
$member = Member::currentUser();
if(!empty($member->Locale)) i18n::set_locale($member->Locale);
if(!empty($member->DateFormat)) i18n::set_date_format($member->DateFormat);
if(!empty($member->TimeFormat)) i18n::set_time_format($member->TimeFormat);
Have finally updated to Ubuntu 10.10, taking the opportunity to completely clean out. Of course, this means reconfiguring everything - these two git settings are the ones that I most missed
The following adds an indication on your command-line as to the branch you are currently on. Massively helpful.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\[\033[00m\]\u@\h\[\033[01;34m\] \w \[\033[31m\]\$(parse_git_branch) \[\033[00m\]$\[\033[00m\] "
The next simply sets a global config for colours when doing things like diff and status
git config --global color.ui "auto"