Extension:Attribute

Why is this extension necessary?
Currently mediawiki only allows the use of categories as attributes. These can only hold binary values:
 * 0: does not belong to category
 * 1: does belong to category

Real live attributes of articles can have arbitrary values:
 * authors: Meyer, Smith, Hu
 * comment: This is neat.
 * date of expiry: 2008-12-31

Futhermore data not only occurs as single values but also as datasets:

Example: Mean average temperature [°C] month= "1", value= "5.7" month= "2", value= "5.8" month= "3", value= "7.8" month= "4", value="11.0" month= "5", value="14.7" month= "6", value="17.7" month= "7", value="19.3" month= "8", value="19.2" month= "9", value="17.2" month="10", value="14.0" month="11", value="10.3" month="12", value= "7.3"

A method to enter such data into MediaWiki in a retrievable way is needed.

Editing
A new tag attribute is defined.    The icon is added to the editor to create attribute tags.

When saving changes the attribute values are written to a database table allowing SQL queries to

Attribute Tab
An attribute tab is added to the article page showing all attributes.

Attribute query page

 * A special page for attribute queries is provided.

Install files
require_once( "$IP/extensions/xyAttribute/xyAttribute.php"); $xyAttributePng = "/extensions/xyAttribute/attribute.png"; $xyAttributeMultipleValues = true;
 * Download current version from http://sourceforge.net/project/showfiles.php?group_id=174951
 * Unzip files to mediawiki/extensions/xyAttribute.
 * Add the following statements to Your localSettings.php
 * Adjust pathes as necessary.

When $xyAttributeMultipleValues = true an attribute can have multiple values like:  $xyAttributeMultipleValues = false signifies that only the last value shall be used.

Create table
In Your MediaWiki site You will now find an "Attributes" tab on each page.

The first time You hit it the installation procedure ist started.

Tested environments
The extension has been successfully tested in the following environments:

MediaWiki 1.8

 * Windows 2000 prof
 * MediaWiki 1.8 alpha rev. 15483
 * Apache 2.0.49
 * PHP Version 5.1.1
 * MySQL - 5.0.23-community-nt

MediaWiki 1.7

 * Windows 2000 prof
 * MediaWiki 1.7.1
 * Apache 2.0.49
 * PHP Version 5.1.1
 * MySQL - 5.0.23-community-nt

MediaWiki 1.5
The following setups needed patching
 * Windows 2000 prof
 * MediaWiki 1.5.8, rev. 16026
 * Apache 2.0.49
 * PHP Version 5.1.1
 * MySQL - 5.0.23-community-nt
 * Linux (RedHat)
 * MediaWiki 1.5.8, rev. 16026
 * Apache 2.0.49
 * PHP 4.3.8
 * MySQL 3.23.58

For adding the tab "attributes" in version 1.5 the following patch is needed:  Index: includes/SkinTemplate.php

=
====================================================== --- includes/SkinTemplate.php	(revision 16026) +++ includes/SkinTemplate.php	(working copy) @@ -695,6 +695,7 @@ 					} 				} 			} +			wfRunHooks( 'SkinTemplateTabs', array( &$this, &$content_actions ) )	; } else { /* show special page tab */ 

The extra editor button can be made visible with this patch in mediawiki 1.5:  Index: EditPage.php

=
====================================================== --- includes/EditPage.php	(revision 16026) +++ includes/EditPage.php	(working copy) @@ -1010,6 +1010,7 @@ 	 */ 	function getEditToolbar { global $wgStylePath, $wgContLang, $wgMimeType, $wgJsMimeType; +		global $xyAttributePng; /** 		 * toolarray an array of arrays which each include the filename of @@ -1124,6 +1125,7 @@ $toolbar.="addInfobox('" . wfEscapeJsString( wfMsg( "infobox" ) ) . 			"','" . wfEscapeJsString( wfMsg( "infobox_alert" ) ) . "');\n"; +		$toolbar.="addButton('$xyAttributePng','".wfMsg('xyattribute')."','<'+'attribute name=\"','\" />','value');\n"; $toolbar.="document.writeln(\" \");\n"; $toolbar.="/*]]>*/\n "; 

Evaluation
A special page for querying the database for attribute values is needed.

Alternatives

 * Data Extension
 * Semantic MediaWiki

Project Homepage
The homepage of the project on Sourceforge is http://xywattributeext.sourceforge.net