Last night I attended Oxford Geek Night, where I gave a quick talk about the Digital Britain report.

My presentation slides are below, but I thought I’d write a quick blog post to go into a little more detail.

The Digital Britain report, for those who aren’t already aware, is a report produced by the government. It contains a number of recommendations aimed at improving the UK’s digital infrastructure and boosting the social and economic impact of digital technology.

“The report provides actions and recommendations to promote and protect talent and innovation in our creative industries, to modernise TV and radio frameworks and support local news, and introduces policies to maximise the social and economic benefits from digital technologies.”

What I hoped for was that the government would use this report as an opportunity to do something interesting – for example:

  • Opening the wealth of government data – statistics, contract details etc – the government holds to the general public
  • Scrapping the archaic idea of Crown Copyright, which is both unfair and harms our economy. I would like to see a situation where anything which is produced by the state should be released as public domain.
  • Modification of the tax and accountancy laws to make them more startup friendly.
  • Focussing attention and even funds towards direct democracy – building tools to interact with the government.
  • Overhauling the data protection laws to enshrine in law the idea that data about you belongs to you.

However, what we got was a top down and prescriptive rather than bottom up and inventive. Some vague tax breaks for big companies, ISPs told to police their users, and a tax on all phone lines.

Some things we could do:

  • Educate your MP – they aren’t experts at this stuff, and it is up to people in the industry to tell the policy makers where the problems are. Open source laws FTW 🙂
  • Innovate – continue doing what you were doing already, building out those tools and having those creative ideas.
  • Recreate and obsolete – In the short term, things like Crown copyright are not going away. I wonder how much of their data we can recreate in the public domain? OpenStreetmap is doing a good job at recreating google maps
  • Local councils and individual projects can be a lot more receptive than central government.

In short, you are the government. You’ve got to act like it!

Image from the Digital Britain report

Trac_Logo_512x512There are a number of ways that an Elgg plugin developer can manipulate views via the powerful Elgg views system.

Most Elgg programmers are by now familiar with extending or replacing existing views, or providing new views for new objects etc.

But what if you just wanted to make a simple tweak to an existing view – for example to replace all instances of rude words in a feed article, or to turn passive links into active ones?

Well, fortunately Elgg provides a post processing hook for views which can do just that.

After every view has been generated, the framework will trigger a plugin hook called “‘display’, ‘view'”. This hook is passed a parameter ‘view’ which contains the name of the view being processed (eg. object/blog).

The contents of the view are passed in the $returnvalue variable which you can perform any processing on before returning it from the hook.

I have just uploaded a Trac tags plugin to the Elgg community site which provides a good example of this.

The Trac tags plugin is a tiny plugin which uses the views post processing hook to turn Trac links (e.g. #xxxxx for tickets and [xxxxx] for changesets) into active links into your repository, and here’s how – first we register the hook:

function tractags_init()
{
....
// Register our post processing hook
register_plugin_hook('display', 'view', 'tractags_rewrite');


// define views we want to rewrite codes on (means we don't have to process *everything*)
$CONFIG->tractags_views = array(
'object/thewire',
'object/blog'
);

....
}

Then in our handler looks something like this:

function tractags_rewrite($hook, $entity_type, $returnvalue, $params)
{
global $CONFIG;

$view = $params['view'];

if (($view) && (in_array($view, $CONFIG->tractags_views)))
{
// Search and replace ticket numbers
$returnvalue = preg_replace_callback('/(#)([0-9]+)/i',
create_function(
'$matches',
'
global $CONFIG;

return "<a href=\"{$CONFIG->trac_baseurl}ticket/{$matches[2]}\">{$matches[0]}</a>";
'
), $returnvalue);

// Search and replace changesets
$returnvalue = preg_replace_callback('/(\[)([0-9]+)(\])/i',
create_function(
'$matches',
'
global $CONFIG;

return "<a href=\"{$CONFIG->trac_baseurl}changeset/{$matches[2]}\">{$matches[0]}</a>";
'
), $returnvalue);

return $returnvalue;
}
}

I’m sure you will be able to come up with some much more interesting uses!

Image from the Trac project.

I am delighted to report that tickets for the Barcamp Transparency main event are now available.

This is a free event, but we need to get an idea of how many people are coming, and a rough list of contacts so that we can furnish you with things like Wifi keys etc.

Anyway, tickets are being served by Eventbrite like our virtual event, go get yours!