<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>boakes.org &#187; bugs</title>
	<atom:link href="http://boakes.org/tag/bugs/feed/" rel="self" type="application/rss+xml" />
	<link>http://boakes.org</link>
	<description>A place for words and data that I publish (for the benefit of persons unknown).</description>
	<lastBuildDate>Wed, 08 Feb 2012 09:34:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Eventum Extension for MediaWiki</title>
		<link>http://boakes.org/eventum-extension-for-mediawiki/</link>
		<comments>http://boakes.org/eventum-extension-for-mediawiki/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 18:20:31 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[eventum]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[mediawiki]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tag]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://boakes.org/?p=1093</guid>
		<description><![CDATA[I couldn&#8217;t find a MediaWiki extension for Eventum when I needed one, so this evening I knocked one up. It&#8217;s fairly basic, very unoptimised, and probably far from perfect, but it works for me, and someone might use it as the basis for something better. It uses PHPs MySQL library to open a connection to [...]]]></description>
			<content:encoded><![CDATA[<p>I couldn&#8217;t find a MediaWiki extension for Eventum when I needed one, so this evening I knocked one up.</p>
<p>It&#8217;s fairly basic, very unoptimised, and probably far from perfect, but it works for me, and someone might use it as the basis for something better.  It uses PHPs MySQL library to open a connection to a database and execute a query, the results are then avilable to MediaWiki (but perhaps sadly don&#8217;t become part of the version controlled content).</p>
<p>To use it in a page add <code>&lt;eventum bug="123"/&gt;</code> where 123 is the number of the bug you&#8217;d like to query.</p>
<p>Output is formatted through an eventum template which you&#8217;ll have to create, the parameters of that template from 1-5 are, in this basic example, summary, created date, closed date, status title, and status color.  e.g. <code>{{eventum|An example summary|1st Nov 2008|2nd Nov 2009|Closed|#00FF00}}</code></p>
<p><span id="more-1093"></span></p>
<pre lang="php">< ?php
/**
 * Extension Eventum.php
 * @author Rich Boakes <rich@boakes.org>
 * @copyright Rich Boakes
 * @license GPLv2
 * @version 0.0.1 14th April 2009
 * This extension provides a basic eventum lookup mechanism.
 * Hack it to how you'd like it to look.
 * Copyright (C) 2009 Rich Boakes
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 * the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
*  Boston, MA  02110-1301, USA.
 */

if (!defined('MEDIAWIKI')) die();

$wgHooks['ParserFirstCallInit'][] = 'rjbSampleParserInit';

function rjbSampleParserInit() {

    global $wgParser;
    $wgParser->setHook( 'eventum', 'rjbEventumRender' );
    return true;
}

function rjbEventumRender( $input, $args, $parser ) {
  if ($args["bug"] != "") {
    $num=$args["bug"];
  } else {
    foreach( $args as $name => $value ) {
      $num=$value;
    }
  }

  $svr = 'your_sql_hostname';
  $uid = "your_sql_id";
  $pwd = "your_sql_password";
  $qry = "SELECT i.iss_summary, i.iss_created_date, i.iss_closed_date,"
     ." s.sta_title, s.sta_color from eventum_issue i LEFT JOIN"
     ." eventum_status s ON (i.iss_sta_id=s.sta_id) where"
     ." i.iss_id=$num;";

  $link = mysql_connect($svr, $uid, $pwd);
  if (!$link) {
    return("Could not connect to MySQL server: $svr");
  } else {
    mysql_select_db('eventum');
    $result = mysql_query($qry);

    if (!$result) {
      $message = 'Invalid query: ' . mysql_error() . "\n";
      $message .= 'Whole query: ' . $query;
      return("Could not connect to MySQL server: $message");
    }

    $row = mysql_fetch_assoc($result);

    mysql_free_result($result);
    mysql_close($link);

    $output = $parser->recursiveTagParse(
      "{{Eventum|".implode("|",$row)."}}"
    );
    return $output;
  }
}
?>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://boakes.org/eventum-extension-for-mediawiki/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

