Difference between revisions of "Template:Extension/doc"

Jump to navigation Jump to search
19,319 bytes added ,  10:37, 3 August 2013
Reverted 1 edit by 66.87.96.147 (talk). (TW)
(Blanked the page)
>Glaisher
(Reverted 1 edit by 66.87.96.147 (talk). (TW))
Line 1: Line 1:
<noinclude>{{Documentation subpage}}</noinclude>


<!---->
This template should be added to all extension pages on this wiki (but only the main page).  It will add a useful infobox (see below) and will automatically add the extension to [[:Category:All extensions]], along with the appropriate [[:Category:Extensions by status|status]] and [[:Category:Extensions by implementation type|implementation type]] categories.
== Usage ==
{| width="100%"
|-
! width=40% |
! width=60% |
|- valign="top"
| align="left" |
<span id="CutAndPaste">Copy and paste:</span>
<pre>{{Extension|templatemode =
|name            =
|status          =
|type1          =
|type2          =
|hook1          =
|hook2          =
|username        =
|author          =
|description    =
|image          =
|imagesize      =
|version        =
|update          =
|mediawiki      =
|php            =
|needs-updatephp =
|schema-registry =
|license        =
|download        =
|readme          =
|changelog      =
|parameters      =
|tags            =
|rights          =
|example        =
|compatibility  =
|bugzilla        =
}}</pre>
For help with parameter values, see [[#Content parameters|below]].
| align="right"|{{Extension|templatemode=nocats
|name = {{{name}}}
|status        = {{{status}}}
|type1        = {{{type1}}}
|type2        = {{{type2}}}
|hook1        = hook1
|hook2        = hook2
|username      = SomeUser
|author        = SomeAuthor
|image        = Placeholder.png
|version      = {{{version}}}
|update        = {{{update}}}
|mediawiki    = {{{mediawiki}}}
|php          = {{{php}}}
|needs-updatephp = {{{needs-updatephp}}}
|schema-registry = {{{schema-registry}}}
|license      = {{{license}}}
|download      = {{{download}}}
|readme        = {{{readme}}}
|changelog    = {{{changelog}}}
|description  = {{{description}}}
|parameters    = {{{parameters}}}
|tags          = {{{tags}}}
|rights        = {{{rights}}}
|namespace    = {{{namespace}}}
|example      = {{{example}}}
|compatibility = {{{compatibility}}}
|bugzilla      = {{{bugzilla}}}
|pagedrive1 = true
|demo = true
}}
|}
<br style="clear:both"/>
== Content parameters ==
This section describes parameters that govern infobox content. For help with '''templatemode''' and other control parameters, please see ''[[#Control parameters|Control parameters]]''.
<!-- BEFORE YOU EDIT THIS:
    span ids on each parameter are used by the code in Template:Extension.
    They enable each label in the info box to link its documentation.
    If you change an id, please update the code in Template:Extension accordingly.
--> 
{| class="wikitable"
|+ '''Content parameters'''
|-
! Parameter
! Description
|-
|<span id="name">'''name'''</span> || '''name of the extension'''
|-
|<span id="status">'''status'''</span> || '''current release status'''
One of:
* ''[[:Category:Unstable extensions|unstable]]'' (broken - do not use this extension)
* ''[[:Category:Experimental extensions|experimental]]'' (early stages of development, may change drastically)
* ''[[:Category:Beta status extensions|beta]]'' (stable but not fully tested)
* ''[[:Category:Stable extensions|stable]]'' (stable version)
* ''[[:Category:Not LTS ready|unmaintained]]'' (unmaintained - previously claimed to be stable, now unmaintained)
* ''[[:Category:Extensions with unknown status|unknown]]'' (default)
If the status is anything other than the above, it will be ignored and the default value of 'Unknown' will be displayed in the template instead. In cases where the value is omitted, it will be categorized as [[:category:extensions with unknown status|unknown]]. In cases where the value is invalid, it will be placed in a [[:category:extensions with invalid status|special category]] so that the error can be caught and fixed.
* [[Extension status|release status colour scheme]]
|-
| '''type1'''<br/>''type2''<br/>''type3''<br/>''type4''<br/>''type5''<br/>''type6''<br/> || <span id="type">'''implementation type'''</span><!-- id here so at top of documentation -->
The  implementation strategy(s) employed in building this extension. This parameter is used to create categories that help programmers find examples of various MediaWiki specific implementation strategies or patterns. Although the values of this parameter sometimes coincide with the use case or purpose of an extension, that is not reason for this parameter. If the values you have chosen for this parameter do not adequately identify the [[w:Requirements|purpose]] or possible [[w:Use case|use case]]s, we recommend you add additional [[Help:Categories|category links]] as needed.
Legal values for the '''type1''', '''type2''', ... parameters are:
* '''''[[:Category:Parser extensions|parser]]''''' - catchall for uncategorized [[Manual:Extending wiki markup|parser extensions]]. If you have written a parser extension, please use one of the following more specific types:
** ''[[:Category:ContentHandler extensions|contenthandler]]'' - Extensions using [[Manual:ContentHandler|ContentHandler]].
** ''[[:Category:Link markup extensions|link]]'' - customized [[Manual:Extending wiki markup|link markup]], e.g. <code><nowiki>[[</nowiki>...]]</code>
** ''[[:Category:Parser function extensions|parser function]]'' - custom [[Manual:Parser functions|parameterized template markup]], e.g. <code><nowiki>{{</nowiki>''#name:'' ... }}</code>
** ''[[:Category:Tag extensions|tag]]'' - [[Manual:Tag extensions|custom XML tag markup]], e.g. <code><nowiki><</nowiki>''tagname''>...<nowiki></</nowiki>''tagname''></code>
** ''[[:Category:Variable extensions|variable]]'' - custom [[Manual:Variables|unparameterized template markup]], e.g. <code><nowiki>{{NAME}}</nowiki></code>
** ''[[:Category:Extended syntax extensions|extended syntax]]'' - Extensions that add non-standard wiki syntax (i.e. <em>not</em> [[Manual:Tag extensions|tags]], [[Manual:Parser functions|parser functions]], or [[Manual:Variables|variables]]).
*:
* [[:Category:User access extensions|'''''access''''']] - catchall for [[Manual:User access extensions|user access extensions]], that is, extensions that create, authenticate, grant permissions, revoke permissions, or monitor the activity of users. If you have written an access extension, please use one of the following more specific types:
** [[:Category:User activity extensions|''user activity'']] - extensions that monitor user activity (logins, logouts, new user creation, etc.)
** [[:Category:User identity extensions|''user identity'']] - extensions that create and delete users, and/or verify the identity of a user
** [[:Category:User rights extensions|''user rights'']] - extensions to the rights management system, e.g. changes to the way rights are assigned, API, maintenance tools (does not include extensions that merely name the rights needed to use the features of that extension; for this purpose use the [[#rights|rights parameter]])
* [[:Category:User interface extensions|'''''interface''''']] - catchall for uncategorized user interface extensions.
** ''[[:Category:Media handling extensions|media]]'' - extensions that permit the embedding of multimedia content on wiki pages by registering a file extension with [[Manual:$wgMediaHandlers|$wgMediaHandlers]].
** ''[[:Category:Personalization extensions|mywiki]]'' - extensions that provide infrastructure so that users may personalize their MediaWiki experience and/or assist in the management of that infrastructure
** [[:Category:Notification extensions|''notify'']] - extensions that email users, broadcast messages and provide other forms of community notification
** ''[[:Category:Page action extensions|''page action'']]'' - extensions that enhance or modify [[Manual:Page action|page action]]s. This includes anything that implements an action that reads, writes, searches for, creates, renames, deletes, redirects or discusses a page. It does not include rights (use ''user rights'') or logs (use ''user activity'').
** [[:Category:Search extensions|''search'']] - extensions that search through and select articles for users.
** [[:Category:Skin extensions|''skin'']] - extensions adding [[w:CSS|CSS]] or [[w:JavaScript|JavaScript]], or implementing hook functions to change the look and feel of MediaWiki via the skins framework.
** [[:Category:Ajax extensions|''ajax'']] - extensions that use [[w:Ajax|Ajax]] programming techniques.
** [[:Category:Special page extensions|''special'']] - extensions that subclass the [[Manual:SpecialPage class|SpecialPage class]], use one of its hooks, or patch one or more functions in [http://svn.wikimedia.org/doc/SpecialPage_8php-source.html SpecialPage.php]. See [[Manual:Special pages]] for more information.
* '''other'''
** [[:Category:API extensions|''api'']] - extensions that add a new API module or extend a core API module.
** [[:Category:Hook extensions|''hook'']] - Hook extension - defines a <em>new</em> hook - see hook1, etc. below if you want to define hooks <em>used</em> by your extension
{{note|1=We are in the process of revising the values of this page. Types below this point are likely to be deprecated or redefined. We apologize for the inconvenience. See the [[Template talk:Extension/Archive_1#Type taxonomy|talk on type taxonomy]] for more information.}}
* ''[[:Category:Database extensions|database]]'' - adds tables and/or fields to the database backing a MediaWiki installation
* ''[[:Category:Data extraction extensions|data extraction]]'' - Data extraction
* ''[[:Category:Extension examples|example]]'' - Not a real extension, but an example of how to write one
Any other value for 'type' is invalid, and will cause the extension to be placed in [[:Category:Extensions with invalid or missing type]].
Note: Many extensions have more than one type, if this applies to yours, replace <code><nowiki>|type=</nowiki></code> with <code><nowiki>|type1=|type2=|type3=...</nowiki></code>. You may define up to six types for an extension.
|-
| <span id="hook">'''hook1'''</span><br/>''hook2''<br/>''hook3''<br/>''hook4''<br/>...<br/>''hook30''
|valign="top"| '''name of each hook used by the extension'''
Entering values in this field is a good way to get exposure for your extension and help other developers. Each documented hook will automatically add the extension to a category listing extensions that use that hook. This category is autolinked to each hook article so that programmers can easily find examples of extensions that use a particular hook.
For built-in hooks:
* use the hook name alone. Please see [[Manual:Hooks]] for values (but omit introductory '/').
For custom hooks defined by extensions:
* use ''extensionName''/''hookName''. For a partial list of custom hooks, see [[Extension hook registry]]. 
For multiple hooks, assign the first hook to '''hook1''', the second to '''hook2''' and so on.
|-
| <span id="username">'''username'''</span> || The author's username on MediaWiki.org (if they have one). May be omitted, but if present it will be used to link to the author's user & user_talk page. It should be provided without namespace and without <nowiki>[[]]</nowiki>s.
|-
| <span id="author">author</span>|| The extension author's name, if different from their MediaWiki.org username. Free text. If omitted then the 'username' field will be used (if present).
|-
| <span id="description">'''description'''</span>|| '''short description'''
|-
| <span id="image">image</span>|| screenshot or logo of extension. It should be provided without namespace and without <nowiki>[[]]</nowiki>s.
|-
| <span id="imagesize">imagesize</span>|| ''facultative'', size of the image (default size is 220px)
|-
| <span id="version">version</span>|| last version
|-
| <span id="update">update</span>|| date of the last update
|-
| <span id="mediawiki">mediawiki</span>|| required version of MediaWiki
|-
| <span id="php">php</span>|| required version of PHP
|-
| <span id="needs-updatephp">needs-updatephp</span>|| '''''yes''''' indicates that the extension requires a database table schema change or a similar action, before the MediaWiki can run. It is a common pitfall: your MediaWiki will stall, if you forgot to run update.php - if the extension requires it.
Extensions which conform to MediaWiki extension standards come with a '''schema change script which you need to start manually''' (once) before starting and accessing the MediaWiki through your browser, and after you copied all the extension files to <tt>$IP/extensions/ExtensionName</tt> and inserted <tt>require_once( "$IP/extensions/ExtensionName" )</tt> to <tt>$IP/LocalSettings.php</tt>:
php $IP/maintenance/update.php
{{$IP}}
|-
| <span id="schema-registry">schema-registry</span>|| '''''yes''''' indicates that the extension's schema changes are registered at [[Database table and field registration]].
|-
| <span id="license">license</span>|| license(s) governing use of this extension, e.g. GPL
|-
| <span id="download">'''download'''</span>|| '''link to the download''' : [http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ SVN], {{tl|WikimediaDownload}} with server=gerrit, or other. If you put the code into page in the MediaWiki wiki, link to it using a full page name and section name, e.g. <code> <nowiki>[[Extension:Example/version_1.22a#Code]]</nowiki> </code> (it must remain valid when bot-copied elsewhere)
|-
| <span id="readme">readme</span>|| external link to the readme file, e.g. http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Sort/README
|-
| <span id="changelog">changelog</span>|| external link to the changelog file, e.g. [[Extension:LDAP Authentication/Changelog]]
|-
| <span id="parameters">parameters</span> || available parameters for LocalSettings.php
|-
| <span id="tags">tags</span> || any tags your extension uses (e.g. &lt;tag1&gt;, &lt;tag2&gt;).
|-
| rights|| <span id="rights">rights</span> added by the extension. '''Not to be confused with the license!''' Rights are such as ''[[Extension:MakeBot|makebot]]'' or ''[[Extension:Desysop|desysop]]'', not such as GFDL or LGPL or GPL - those are licenses!
|-
| <span id="namespace">namespace</span> || namespace in which this extension is used
|-
| <span id="example">example</span> || example, website or screenshot of working extension
|-
| <span id="compatibility">compatibility</span> || compatibility chart, e.g. [[Template:Extension Testing]]
|-
| <span id="bugzilla">bugzilla</span> || Bugzilla MediaWiki extension component name
|-
| <span id="CheckUsageNameOverride">CheckUsageNameOverride</span> || override the page name used for the check usage link.
|}
== Control parameters ==
{| class="wikitable"
|+ '''Control parameters'''
|-
! Parameter
! Description
|-
| '''templatemode''' || '''Controls auto-categorization of host page.'''
Normally left blank.  Alternate values are:
* ''nocats'' - suppresses categorization and the 'check usage' link. Use this value if you are adding this template to [[Help:Subpage|subpages]] of an extension or to how-to documentation of extensions. For example, the usage image above sets <code>templatemode=nocats</code> because this isn't an actual extension page and we don't want to add this page to any categories on account of it.
* ''nousage'' - suppresses the 'check usage' link.  Link is also suppressed if the page is a subpage; it is not in the Extension: namespace; or if suppressed by 'templatemode=nocats'
If this is left blank, this template will add the host page to [[:Category:All extensions]] and to one or more additional categories, depending on the values assigned to the [[#Content parameters|Content parameters]].
|}
== Using the infobox ==
=== Existing extension pages ===
If you want to add the infobox to an existing page, copy and paste the code at the [[#CutAndPaste|top of this page]].
=== Create a new extension article ===
If you want to create a new extension page, enter the name below and click the button. A new page will be created with the infobox template already in place.
{{Extension/CreateExtensionInputBox}}
== Enhancing this template ==
If you would like to improve on this template, thanks!  This is a complicated template so here is some help along the way:
=== Fixing documentation ===
If you would like to fix documentation, please be aware that documentation and code is split into two files:
* '''[[Template:Extension/Doc]]''' - stores all documentation.
* '''[[Template:Extension]]''' - stores only the code for the template and a small amount of non-included material (category links, transcluded documentation link).
In addition, [[Template:Extension/Sample]] stores the boiler plate that is preloaded into newly created pages and contains some basic documentation on how to fill in the template parameters.  It needs to be kept in sync with [[Template:Extension/Doc]].
=== The Create extension button ===
To improve the create extension button behavior:
* '''[[Template:Extension/Sample]]:''' The boilerplate extension that is preloaded into newly-created pages.
* '''[[Template:Extension/CreateExtensionInputBox]]:''' An input box that can be inserted wherever you want users to easily create extensions.  For documentation on the <code><nowiki><inputbox></nowiki></code> tag, please see [[Extension:InputBox]].
* '''[[Extension:MyExtension]]:''' - Defines a placeholder, in case a user accidentally hits the create button without changing the extension name.
=== Infobox parameters ===
In general:
* To make this template easy to use, each label in the infobox is linked to documentation on the template parameter(s) it displays.  If you add a parameter, please be sure to also add it to the [[Template:Extension/Doc#Content parameters|content parameter documentation]] and link its label to that documentation.
To change/correct/add to the implementation type parameters:
* Check the [[Template_talk:Extension|talk page]] - there have been some extensive discussions about this field.
* '''[[Template:Extension/TypeSwitch]]:''' Stores the possible values for the type field.  Multiple values are implemented by calling this template with [[Template:Foreach]].
* '''[[Template:Extension/TypeSwitchNoCats]]:''' Does not need to be modified when adding a new type.  Used instead of [[Template:Extension/TypeSwitch]] when this template is used in <code>templatemode=nocats</code>.  Templates used with [[Template:Foreach]] can only take one parameter so we need to wrap the call to [[Template:Extension/TypeSwitch]] with another template that sets the mode.
* '''[[Template:Extension/Doc]]:''' Documentation for this template needs to be kept in sync with any changes to the implementation type taxonomy.
To change the behavior of the hook parameters:
* '''[[Template:Extension/HookInUse]]:''' Adds links and categories for a hook in use.  Multiple hooks in use are implemented by calling this template with [[Template:Foreach]].
* '''[[Template:Extension/HookInUseNoCats]]:''' Used instead of [[Template:Extension/HookInUse]] when this template is used in <code>templatemode=nocats</code>.  Templates used with [[Template:Foreach]] can only take one parameter so we need to wrap the call to [[Template:Extension/HookInUse]] with another template that sets the mode.
== Test case ==
See if the following pages are still ok, after edited this template.
* [[Extension:Description2]]
* [[Template:Extension]]
Anonymous user

Navigation menu