Extension:Send2Wiki

The Send2Wiki extension allows users to send web pages to a wiki via a web browser bookmarklet. Chrome is stripped from web pages hosted on known Open Course Ware websites and registered Wikis. Optionally the user can request a machine translation into a specified language. The extension attempts to detect and preserve Creative Commons, GFDL and other licenses.

What can this extension do?

 * Provides a bookmarklet that makes it easy to send web pages to a wiki.
 * Converts web page HTML to wiki format (using html2wiki by David J. Iberri).
 * Strips chrome from web pages during the conversion process.
 * Displays information about sent articles in the MediaWiki footer.
 * Optionally translates web page to another language (using Google's Language Tools).
 * Preserves links by converting relative links to absolute ones.
 * Autodetects license information such as Creative Commons and GFDL licenses.
 * Lets the user specify a license for the the new wiki page.
 * Sends PDFs to the wiki by first converting them to HTML (using PDFTOHTML based on xpdf 2.02 by Derek Noonburg).
 * Creates didilies describing the conversion.

Usage
On a MediaWiki instance that has the extension installed:


 * 1) Go to the Send2Wiki special page (Special:Send2Wiki)
 * 2) Drag the Send2Wiki bookmarklet to your web browser's Links toolbar.
 * 3) Surf to your favorite web page and click the Send2Wiki bookmarklet.
 * 4) Specify any conversion details and send the page.

The web page will be converted to MediaWiki format and copied into the wiki.

Visit the Send2Wiki website to try it out!

Installation

 * Download the Send2Wiki source.
 * Install html2wiki (see http://search.cpan.org/src/DIBERRI/HTML-WikiConverter-0.61/INSTALL).
 * Install the Send2Wiki Perl Module.
 * Copy the Send2Wiki Perl Module to where you are building the WikiConverter.
 * Add the send2wiki tables to the MediaWiki database by running send2wiki.sql
 * Install the Send2Wiki skin and extension by copying the send2wiki extensions and skins folders to the root of your mediawiki install.
 * Modify the Send2Wiki page to specify the url to the send2wiki page on the domain that you are hosting your wiki on.
 * Or if your wiki specifies titles in the query string:
 * Notice that in the latter, the trailing question mark needs to be changed to an ampersand.
 * Enable the Send2Wiki MediaWiki extension and skin by modifying LocalSettings.php (located in the root of the MediaWiki install). See the next section for details.
 * Add the send2wiki tables to the MediaWiki database by running send2wiki.sql
 * Install the Send2Wiki skin and extension by copying the send2wiki extensions and skins folders to the root of your mediawiki install.
 * Modify the Send2Wiki page to specify the url to the send2wiki page on the domain that you are hosting your wiki on.
 * Or if your wiki specifies titles in the query string:
 * Notice that in the latter, the trailing question mark needs to be changed to an ampersand.
 * Enable the Send2Wiki MediaWiki extension and skin by modifying LocalSettings.php (located in the root of the MediaWiki install). See the next section for details.
 * Modify the Send2Wiki page to specify the url to the send2wiki page on the domain that you are hosting your wiki on.
 * Or if your wiki specifies titles in the query string:
 * Notice that in the latter, the trailing question mark needs to be changed to an ampersand.
 * Enable the Send2Wiki MediaWiki extension and skin by modifying LocalSettings.php (located in the root of the MediaWiki install). See the next section for details.
 * Notice that in the latter, the trailing question mark needs to be changed to an ampersand.
 * Enable the Send2Wiki MediaWiki extension and skin by modifying LocalSettings.php (located in the root of the MediaWiki install). See the next section for details.
 * Enable the Send2Wiki MediaWiki extension and skin by modifying LocalSettings.php (located in the root of the MediaWiki install). See the next section for details.

Changes to LocalSettings.php
Change: $wgDefaultSkin = 'monobook'; to: $wgDefaultSkin = 'send2wiki'; Add to the end (before the closing ?>): $wgAllowExternalImages = true; require_once($IP.'/extensions/Send2Wiki/Send2Wiki.php');

MediaWiki Customizations
Send2Wiki customizes MediaWiki by adding:
 * Send2Wiki tables to the wiki database
 * Send2Wiki Special Page
 * Send2Wiki Skin

Send2Wiki Tables
In order for the Send2Wiki extensions to work, two tables need to be added to the wiki database. They are defined in send2wiki.sql.

Send2Wiki Special Page
The Send2Wiki Special Page is a MediaWiki special page that can be used to obtain the Send2Wiki bookmarklet and to send web pages to a wiki.

When the Send2Wiki special page is loaded with the right url query string parameters (as are passed by the bookmarklet), it displays a form that allows the user to specify a title and a license for the derived web page. Send2Wiki attempts to detect a license in the original page and displays that to the user. When a web page is sent to the wiki the special page stores the following information in the send2wiki tables:


 * URI of the page that was sent
 * ID of the user that sent the page
 * License detected in the web page
 * License chose for the web page

You can access the Send2Wiki special page from the list of SpecialPages that can be accessed from the MediaWiki side bar.

If you click the bookmarklet when you are not logged in, you are required to login (and register if needed) before proceeding.

Send2Wiki Skin
The Send2Wiki Skin is a MediaWiki skin used to display Send2Wiki license information in the head and in the footer of MediaWiki pages that have been created using Send2Wiki. It extends the default skin installed with MediaWiki (monobook).

Send2Wiki Bookmarklet
The Send2Wiki Bookmarklet is a link that can be dragged (or in the case of IE clicked on and added as a Favorite) to a web browsers Link toolbar. Once the bookmarklet is installed, you can click on it when viewing a page that you want to create a wiki page from. Obtain the Send2Wiki bookmarklet from the Send2Wiki special page via the Special Pages link on the MediaWiki left sidebar.

HTML to Wiki Perl Module
Send2Wiki adapts David Iberri's html2wiki by modifying HTML::WikiConverter::MediaWiki.

html2wiki is a command line perl utility that will convert web pages in the wild to wiki format.

HTML::WikiConverter::MediaWiki was modified because even though html2wiki claims to preserve image links (convert them to external links), it doesn't appear to actually do so. Perhaps this is because the default MediaWiki configuration is to not allow external image references

The current implementation is a direct copy of and modification of MediaWiki.pm. The only modification is the _image method. A more valid implementation I'm sure is to extend the MediaWiki class and override the _object method, but that wasn't done because I'm a perl newbe and couldn't figure out how to do that quickly.

PDF to HTML Converter
Send2Wiki utilizes the pdftohtml utility based on xpdf 2.02 by Derek Noonburg.

Send2Wiki uses the experimental version (0.40) of pdftohtml as opposed to the standard release because I couldn't the standard release to produce any output within a short time period. It was outputing error messages about invalid colors.