Extension:MsLinks

From Linux Web Expert

Revision as of 02:26, 17 June 2023 by imported>Legobot (Migrating {{Used by}} data to Module:Used by/data.json)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

MediaWiki extensions manual
MsLinks
Release status: stable
File:Mslinks 2.jpg
Implementation Parser function
Description Creates links to view or download files using icons appropriate to the file type
Author(s) Martin Schwindl, Martin Keyler
Maintainer(s) Sophivorus
Latest version 5.3 (2021-11-15)
MediaWiki 1.23+
PHP 5.3+
License GNU General Public License 2.0 or later
Download
  • $wgMSL_FileTypes
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Translate the MsLinks extension if it is available at translatewiki.net

The MsLinks extension adds a button to the editor that creates links to view or download files using icons appropriate to the file type.

Installation

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/MsLinks</tvar>|Download]] and move the extracted <tvar name=name>MsLinks</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MsLinks
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'MsLinks' );
    
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>


<translate> Vagrant installation:</translate>

  • <translate> If using <tvar name=vagrant>Vagrant </tvar>, install with <tvar name=code>vagrant roles enable MsLinks --provision</tvar></translate>

Configuration

You can configure the icon that is associated with each file type, by adding the icon to the images folder of the MsLinks extension and setting the $wgMSL_FileTypes array appropriately. Below is the default configuration:

$wgMSL_FileTypes = [
	'no' => 'no_icon.png',
	'jpg' => 'image_icon.png',
	'gif' => 'image_icon.png',
	'bmp' => 'image_icon.png',
	'png' => 'image_icon.png',
	'tiff' => 'image_icon.png',
	'tif' => 'image_icon.png',
	'ai' => 'image_ai_icon.png',
	'psd' => 'image_ps_icon.png',
	'pdf' => 'pdf_icon.png',
	'pps' => 'pps_icon.png',
	'ppt' => 'pps_icon.png',
	'pptx' => 'pps_icon.png',
	'xls' => 'xls_icon.png',
	'xlsx' => 'xls_icon.png',
	'doc' => 'doc_icon.png',
	'docx' => 'doc_icon.png',
	'dot' => 'doc_icon.png',
	'dotx' => 'doc_icon.png',
	'rtf' => 'doc_icon.png',
	'txt' => 'txt_icon.png',
	'html' => 'code_icon.png',
	'php' => 'code_icon.png',
	'exe' => 'exe_icon.gif',
	'asc' => 'txt_icon.png',
	'dwg' => 'dwg_icon.gif',
	'zip' => 'zip_icon.png',
	'mov' => 'movie_icon.png',
	'mpeg' => 'movie_icon.png',
	'mpg' => 'movie_icon.png',
	'wmv' => 'movie_icon.png',
	'avi' => 'movie_icon.png',
	'mp4' => 'movie_icon.png',
	'flv' => 'movie_flash_icon.png',
	'wma' => 'music_icon.png',
	'mp3' => 'music_icon.png',
	'wav' => 'music_icon.png',
	'mid' => 'music_icon.png',
];

Usage

To insert a MsLink, simply edit a page and click on the new button in the toolbar. It will insert an empty MsLink, which you can then fill with the filename of the file you want to link to. You can also add some parameters to it, like in regular images. Below are some examples of usage:

Description Input Result
Basic MsLink {{#l:Testfile.pdf}} File:Pdfreaders-f.png Testfile.pdf
MsLink with description {{#l:Testfile.pdf|File description}} File:Pdfreaders-f.png File description
Icon on the right side {{#l:Testfile.pdf|File description|right}} File description File:Pdfreaders-f.png
Direct MsLink {{#l:dlink|Testfile.pdf|This file will be downloaded when clicked}} File:Pdfreaders-f.png This file will be downloaded when clicked

See also