Extension:PIM Support

What can this extension do?
It provides a special page providing links to K:John Doe. "K" is a custom namespace, meaning Kontakt (german for contact). The data comes from csv export file from linux kontact PIM. PIM, for whom do not know is short for "Personal Information Management", so this extensions aims (in further development) to offer access to this information: dates, calendar, tasks, emails. For now it's a bit helpful for creating articles about your contacts without typing them and populating these pages with basic contact data.

Usage
View Special:PIM_Support to see all your contacts as links to wikipages. Create a page and you should see some basic contact data on that page.

Download instructions
Please cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php:

export your contacts from kontact and move or copy the file to $IP/extensions/PIM_Support/

copy the file again to kontact_header.csv and remove all but the first line (the header line), leave it in that dir.

I guess you have to experiment a bit with the dir and filename variables in the code to get it running.

Configuration parameters
none yet

User rights
none yet

Code
';   return $dout; }

function wfSetupPIM_Support { // FIXME title of specialpage is not rendered correctly require_once( 'SpecialPage.php' ); SpecialPage::addPage( new SpecialPage( 'PIM_Support', 'edit', /*listed*/ true, /*function*/ false, /*file*/ false ) );

// XXX name indizieren, als file speichern f�r abruf bei artikel-kontakt-seite um     // detail daten nachzuladen in artikel-text }

function loadData { global $csv_fn; if (file_exists( $csv_fn )) { $lines = file( $csv_fn ); return $lines; } }

function indexAsData($lines) { $data = array; foreach ($lines as $k=>$line) { //dump($line); $fields = split('","', $line); $ln = $fields[1]; $fn = $fields[2]; $ind = $ln."_".$fn; $data[$ind] = $fields; }   ksort($data); return $data; }

function indexAsNames($lines) { foreach ($lines as $k=>$line) { //dump($line); $fields = split('","', $line); $ln = $fields[1]; $fn = $fields[2]; $name = $fn." ".$ln; $ind = $ln."_".$fn; $names[$ind] = $name; ksort($names); }   return $names; }

function wfSpecialPIM_Support { global $wgOut; $lines = loadData; if ($lines) { $names = indexAsNames($lines); //sort($lines); $num = count($names);

$out = ''; $out .= "PIM Support Extension - {$num} names \n\n"; //for ($i=65; $i<=90; $i++) $abc[] = chr($i); //foreach ($abc as $v) { // XXX first letters!!

foreach ($names as $k=>$name) { $ptitle_l = str_replace(' ', '_', $name); $out .= "* K:{$name}\t"; //$out .= "xing:{$name}\n";  // XXX test for xing in notizen, substitute umlauts }   } else { $out .= 'Data file not found'; }   $wgOut->addWikiText($out); }