Extension:CodeBrowser

Summary
This extension allows users to browse and display syntax-highlighted source code within a page. Currently the source code must be in a publicly accessible directory of the same server on which this extension is running.

Quick Example
On a mediawiki page, add the following tag:

where the attribute 'startdir' is a path to a source code directory relative to the web site root directory.

Live Demo
A live demo of this extension can be see here: CodeBrowser Demo

Pre-Install Requirements
This extension leverages two other extensions:
 * 1) Extension:Include
 * 2) SyntaxHighlight_GeSHi

These must be downloaded an installed first. Simply download each of these extension and upload them to your [mediawiki path]/extensions directory.

Install
to the actual paths on your server (basically change '/w/' to where ever you installed mediawiki on your server). NOTE: this is the same path as: $wgScriptPath in LocalSettings.php
 * Download the CodeBrowser extension from HERE
 * Extract and upload the entire CodeBrowser directory to your [mediawiki path]/extensions directory on your server (i.e. create a folder on your server: [mediawiki path]/extensions/CodeBrowser, and copy the files and folders in your downloaded CodeBrowser folder to your newly created folder on your server)
 * Add the following lines to your LocalSettings.php
 * Modify $wg_codebrowser_config['basedir'] to be the absolute path to your webroot (see HowTo Find Absolute Webroot Path] for more info).
 * In codebrowser.css, modify the paths:
 * The extension is now installed, see the next section How to Use This Extension]

How to Use This Extension
To use this extension, simply include the following tag in a mediawiki page: and set 'startdir' to whichever directory that contains source code you want the user to browse.

Attributes
This extension has the following attributes:

startdir (required)

 * specifies the path to project relative to the domain root
 * Example Usage:
 * Say you have a website: http://mywiki.com
 * Also say you have a project with source code at:
 * http://mywiki.com/projects/my_project/src
 * Then, to let users browse this code on your wiki, simply add the following to a wiki page:

refpage (optional)

 * places link to page on footer of table
 * Example Usage:
 * Say you have a project page: http://mywiki.com/wiki/Projects:My_Project
 * You can add a reference link to this page at the bottom of the code browsing portal by adding the : following attribute:

Parameters
Various parameters can be adjusted from this extension by modifying the: parameter in LocalSettings.php


 * basedir
 * this is the absolute path to your webroot


 * lang
 * the language (currently only english is supported)


 * open_in_new_window
 * when opening a source file, open in new window? true/false


 * time_format
 * the day/time format displayed for source files (see Date/Time Format for more info)


 * hidden_dirs
 * array containing directories to hide


 * supported_files
 * supported file types. The currently supported files are:


 * asp
 * aspx
 * bat
 * c
 * cpp
 * cs
 * h
 * htm
 * html
 * java
 * js
 * m
 * php
 * py
 * rtf
 * txt
 * xml
 * xsd

HowTo Find Absolute Webroot Path
This is the absolute path to your when site's root directory. On a linux/apache server setup, it looks something like: /home/your_user_name/public_html/ Note that the leading slash is required on a linux setup.