Monday, September 29, 2008

Logo

Logo has been changed to
Instruction $wgLogo = "/skins/common/images/avbwiki.png" was added into LocalSettings.php

Saturday, September 20, 2008

Dynamic Page List

Today I'm looking for plug-in for generating article list for main page (for example, list of new articles or list of new edits). It seems DynamicPageList extension will be helpful in this situation. In fact, DynamicPageList or (also known as DPL) is base for number of other plug-ins (for example, Wgraph, TreeAndMenu, Calendar).

DPL manual is here.

As recommended here, I'll install DynamicPageList itself and Call and Inputbox. There are no cross references in DPL extensions in Semeb_extensions.zip!

Step 1
Invoke DPL from your LocalSettings.php with

require_once("extensions/DynamicPageList/DynamicPageList2.php");


Step 2: skipped
There is a special feature in DPL which needs another extension: If you use page inclusion and want to use images as link symbols for the original source you must install the LinkedImage extension. For details see there.

Step 3: skipped
In some special cases (when DPL queries refer to uncategorized pages) DPL needs a special database view in the MySQL database. You should run the database statement which creates that view if you want to use DPL statements which refer to uncategorized pages. Many installations work well without that and you can postpone this step until you really need it. If DPL cannot execute a DPL statement without that view it will issue a corresponding warning. More...

Thursday, September 18, 2008

MediaWiki skins

Below a list of sites with non-traditional MediaWiki skins and non-traditional MediaWiki usage (for example, as CMS for commercial site).

Site with well designed skins:
  1. The best one: http://www.aquawiki.ru/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0
  2. http://www.sunandshadows.com/wiki/index.php?title=Main_Page
  3. http://wikiknitting.com/wiki/Main_Page
  4. http://www.theplenty.net/wiki/index.php/Main_Page
  5. http://www.wowace.com/wiki/Main_Page
  6. http://pynchonwiki.com/
  7. http://www.scion-tech.org/wiki/Main_Page
  8. http://www.wikihow.com/Main-Page
  9. http://xbmc.org/wiki/?title=Main_Page
  10. http://en.wiredtape.com/wiki/Main_Page
  11. http://middleton-stjohns.com/wiki/Main_Page
  12. https://wiki.mozilla.org/Main_Page
  13. http://www.openwetware.org/wiki/Main_Page
  14. http://www.theplenty.net/wiki/index.php/Main_Page
  15. http://www.organicdesign.co.nz/
  16. http://www.mono-project.com/Main_Page
  17. http://www.wikithesia.com/index.php?title=Main_Page
  18. http://www.tyska.net/
  19. http://www.starcadia.sasoriza.us/wiki/Portal:Main
  20. http://24.wikia.com/wiki/Main_Page
  21. http://www.ukgameshows.com/page/index.php?title=Main_Page
  22. http://www.werelate.org/wiki/Main_Page
  23. http://krass.com/wiki/Main_Page
  24. http://www.hayinteriors.com.au/
  25. http://strategywiki.org/wiki/Main_Page
  26. http://www.aidklinik.de/
  27. http://www.wikipathways.org/index.php/WikiPathways
  28. http://www.smartlogicsolutions.com/wiki/Main_Page
  29. http://smallbusiness.com/wiki/Main_Page
  30. http://wiki.openid.net//Main_Page
  31. http://oberwiki.net/Main_Page
  32. http://www.newstartministries.org/MediaWiki/index.php/Main_Page
  33. http://wiki.limewire.org/index.php?title=Main_Page
  34. http://www.hurghada-apartment.com/Media%20Wiki%20Script/index.php?title=Home
  35. http://dishiwiki.com/index.php/Main_Page
  36. http://thediypal.com/index.php?title=Main_page
  37. http://www.wikihow.com/Main-Page

Site with interesting main page (with minor skin changes):
  1. http://www.xbox360gaming.com/wiki/index.php?title=Main_Page
  2. http://developer.valvesoftware.com/wiki/Main_Page
  3. http://wirelessafrica.meraka.org.za/wiki/index.php/Wireless_Africa_Home_Page
  4. http://wiki.wazaabi.org/index.php?title=Main_Page
  5. http://vim.wikia.com/wiki/Main_Page
  6. http://www.videoville.org/wiki/Main_Page
  7. http://www.mailquizzer.com/index.php?title=Main_Page
  8. http://wiki.case.edu/Main_Page
  9. http://www.aboutus.org/

Interesting main page layout:
  1. http://www.unmaintained-free-software.org/wiki/Main_Page
  2. http://www.sklogwiki.org/SklogWiki/index.php/Main_Page
  3. http://www.scramble.nl/wiki/index.php?title=Main_Page
  4. http://www.mono-project.com/Main_Page
  5. http://wiki.guildwars.com/wiki/Main_Page
  6. http://www.hifi-wiki.com/index.php/Main_Page
  7. http://www.machinelearning.ru/wiki/index.php?title=%C3%90%C2%97%C3%90%C2%B0%C3%90%C2%B3%C3%90%C2%BB%C3%90%C2%B0%C3%90%C2%B2%C3%90%C2%BD%C3%90%C2%B0%C3%91%C2%8F_%C3%91%C2%81%C3%91%C2%82%C3%91%C2%80%C3%90%C2%B0%C3%90%C2%BD%C3%90%C2%B8%C3%91%C2%86%C3%90%C2%B0
  8. http://wiki.lamak.ru/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0

There are only design ideas... If somebody know where to get cool free template, please notify me via comments to this post.

Wednesday, September 17, 2008

Disable edit for unregistred users

Disable edit/create page without registration.

Add into LocalSettings.php

$wgGroupPermissions['*']['edit'] = false;

// Not necessary to disable this explicity: it requires the edit right
$wgGroupPermissions['*']['createpage'] = false;
$wgGroupPermissions['*']['createtalk'] = false;

http://www.mediawiki.org/wiki/Manual:User_rights

Change the Math button

Change the Math button in editor (standard Edit Toolbar) to produce <tex> and </tex> tags, instead of <math> and </math>

<math> tag support is like small hack, so I prefer to give users <tex> tag and save <math> tag for compatibility with Wikipedia standards.

Find into WIKI_HOME/includes/EditPage.php
array(
'image' => $wgLang->getImageFile('button-math'),
'id' => 'mw-editbutton-math',
'open' => "<math>",
'close' => "</math>",
'sample' => wfMsg('math_sample'),
'tip' => wfMsg('math_tip'),
'key' => 'C'
),


and replace it with
array(
'image' => $wgLang->getImageFile('button-math'),
'id' => 'mw-editbutton-math',
'open' => "<tex<",
'close' => "</tex>",
'sample' => wfMsg('math_sample'),
'tip' => wfMsg('math_tip'),
'key' => 'C'
),


See also http://www.mediawiki.org/wiki/Mimetex_alternative

It's possible to change MediaWiki system messges like math_sample or math_tip. List of messages is here http://WIKI_HOST/index.php5/Special:AllMessages
To change messages see files in WIKI_HOME/languages/messages (find files for your language).

Adding math tag support

Adding <math> tag support (without Latex installing).
The basic recipe is here: http://www.mediawiki.org/wiki/LaTeX_on_a_shared_host

  1. Find WIKI_HOME/includes/Math.php
  2. Backup it!
  3. Find public static function renderMath($tex, $params=array())
  4. Change function body to

public static function renderMath( $tex, $params=array() ) {
return '<img class="tex" src="/cgi-bin/mimetex.cgi?' . rawurlencode($tex) . '" alt="TeX: ' . rawurlencode($tex) . '">';
}


src="/cgi-bin/mimetex.cgi... because I've added mimetex.cgi into my cgi-bin directory. See also http://avbwiki.blogspot.com/2008/09/enable-tex.html

Saturday, September 13, 2008

Enable TeX

Add tex-style math expression support functionality into MediaWiki.
Here is the complete recipe to add TeX support.

The official way to do it based on texvc which is written on Caml, so you need texvc binary (try to find it!) or calm compiler binary to compile texvc, so
  1. compile caml compiler with c++ compiler;
  2. compile texvc with caml compiler;
  3. plus: adjust all paths into makefiles;
  4. install LaTeX and dvips;
  5. install ImageMagic (aka convert utility);
  6. install Ghostscript;
Official manual to enable TeX is here http://www.mediawiki.org/wiki/Manual:Enable_TeX


I prefer more convenient way to add tex math expressions into my wiki:
  1. download mimeTeX from http://www.forkosh.com/mimetex.html (binaries are also available there);
  2. extract mimetex.cgi into cgi-bin directory;
  3. test it: go to http://host/cgi-bin/mimetex.cgi?\sin{x^2}+y^{\cos{x^3}}
On my server result was:
So, good news is that the mimetex is working, but it accessible for everyone over the web! Now I'll do few steps to integrate mimetex into MediaWiki and correct accessibility trouble later (this situation is convinient for testing).

  1. read http://www.mediawiki.org/wiki/Mimetex_alternative
  2. create mimetex.php into wiki_home/extensions/mimetex folder. See code below:

<?php

$wgExtensionFunctions[] = "MimetexExtension";

function MimetexExtension() {
global $wgParser;
# register the extension with the WikiText parser
# the first parameter is the name of the new tag.
# In this case it defines the tag <example> ... </example>
# the second parameter is the callback function for
# processing the text between the tags
$wgParser->setHook( "tex", "render_Mimetex" );
}

/**
* Renders $text in Mimetex
*/

function render_Mimetex($input, $argv, $parser = null) {

if (!$parser) $parser =& $GLOBALS['wgParser'];
// $img_url is the url the mimetex will be sent to.
// IMPORTANT!! The URL below should be the link to YOUR mimetex.cgi if possible
// $img_url = "http://www.forkosh.dreamhost.com/mimetex.cgi?".$input;
$img_url = "/cgi-bin/mimetex.cgi?".$input;

// Sets the output of the tex tag using the url from above, and the input as
// the Alt text. It's important to note that there is no error output added yet.
$output = "<img src=\"$img_url\" alt= \"$input\" />";

return $output;
}
?>

  1. Warning! $img_url in the listing above should point to minitex.cgi $img_url = "/cgi-bin/mimetex.cgi?".$input;

  2. add require("extensions/mimetex/mimetex.php"); at the end of LocalSettings.php
  3. set $wgUseTeX to true in LocalSettings.php
  4. try to add TeX expression somewhere in wiki, for example:
    <tex>\sin{x^2}+y^{\cos{x^2}}</tex>


TeX in MediaWiki

About TeX:



If somebody knows how to prevent direct access to mimetex.cgi from the web, please, notify me via comment to this post! I see the only way - make changes into mimetex.cgi code, but it is not very convenient to reapply my own changes when new version of mimetex.cgi will come. I've tried to solve this with Apache rewrite rules, but...

RewriteCond %{REQUEST_URI} .*mimetex\.cgi.* [NC]
RewriteRule ^(.*)$ index.php [F,L]

this is working, but how to split direct access and access from PHP?

Syntax highlight

Add syntax highlighting functionality.
I think I'll write many code snippets, so it's necessary to add programming languages syntax highlight into my MediaWiki engine.

I tried to find the same plug-in (extension) like is used in Wikipedia project. It seems these guys use something like SyntaxHighlight_GeSHi, because they format code snippets with <source> tag.

SyntaxHighlight_GeSHi
http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi
svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SyntaxHighlight_GeSHi ./SyntaxHighlight_GeSHi

GeSHi itself
http://qbnz.com/highlighter/
http://sourceforge.net/project/showfiles.php?group_id=114997&package_id=124605&release_id=618638

To add frame around source code (like around <pre> tag) change main.css into skin folder:
/* avb: add div.source-XXX for SyntaxHighlight_GeSHi */
pre, div.source-abap, div.source-actionscript, div.source-ada, div.source-apache, div.source-applescript, div.source-asm, div.source-asp, div.source-autoit, div.source-bash, div.source-basic4gl, div.source-blitzbasic, div.source-bnf, div.source-c, div.source-c_mac, div.source-caddcl, div.source-cadlisp, div.source-cfdg, div.source-cfm, div.source-cpp-qt, div.source-cpp, div.source-csharp, div.source-css, div.source-d, div.source-delphi, div.source-diff, div.source-div, div.source-dos, div.source-dot, div.source-eiffel, div.source-fortran, div.source-freebasic, div.source-genero, div.source-gml, div.source-groovy, div.source-haskell, div.source-html4strict, div.source-idl, div.source-ini, div.source-inno, div.source-io, div.source-java, div.source-java5, div.source-javascript, div.source-latex, div.source-Code, div.source-lisp, div.source-lua, div.source-m68k, div.source-matlab, div.source-mirc, div.source-mpasm, div.source-mysql, div.source-nsis, div.source-objc, div.source-ocaml-brief, div.source-ocaml, div.source-oobas, div.source-oracle8, div.source-pascal, div.source-per, div.source-perl, div.source-php-brief, div.source-php, div.source-plsql, div.source-python, div.source-qbasic, div.source-rails, div.source-reg, div.source-robots, div.source-ruby, div.source-sas, div.source-scheme, div.source-sdlbasic, div.source-smalltalk, div.source-smarty, div.source-sql, div.source-tcl, div.source-text, div.source-thinbasic, div.source-tsql, div.source-vb, div.source-vbnet, div.source-vhdl, div.source-visualfoxpro, div.source-winbatch, div.source-xml, div.source-xpp, div.source-z80 {
padding: 1em;
border: 1px dashed #2f6fab;
color: black;
background-color: #f9f9f9;
line-height: 1.1em;
}

It was "pre { ... }" only.