Jump to content

Extension:HidePageTabs

From mediawiki.org
MediaWiki extensions manual
HidePageTabs
Release status: unmaintained
Implementation Tag
Description Force article's tabs to hide.
Author(s) Michele Fella <michele.fella@gmail.com> (Michele.Fellatalk)
Latest version 0.1.0 (2015-05-01)
MediaWiki 1.26+
Database changes No
License Apache License 2.0
Download
‎<HidePageTabs>

The MediaWiki HidePageTabs extension allows to:

- Force article tabs hiding, this works despite the user groups or permission. Actions such as edit, move and so on will still be available if manually pointed in the url, but the tab in the page will not be visible. A typical example for using this functionality is the hiding of the tabs on the Main Page, where you don't want tabs such as edit, move or delete to be visible.

- Allow only one between edit and edit with form tabs to be visible: it will hide the edit with form for Templates and Forms. For all other pages, if the edit with form will be available it will hide the edit tab. This helps when you want to drive users using forms for the editing of an article

- Hide views and actions tabs according to user groups / category configuration: This works configuring for the a specific group the list of the categories where actions should be checked and the list of possible views or actions that needs to be hidden. The page will be always built according to the wiki wgGroupPermissions configuration, but tabs will be eventually removed according to the configuration rules.

IMPORTANT: This extension does not defines or modify the user group permissions. Assuming a user's group provides permission to edit an article, they will always be able to edit the source of the page by simply appending "&action=edit" to the article's url.

Install

[edit]
  • Download and place the file(s) in a directory called HidePageTabs in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    require_once "$IP/extensions/HidePageTabs/HidePageTabs.php";
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage

[edit]

For each article the following tabs can be hidden by this extension:

Group Tab Description
views view This corresponds to the "Read" tab at the top of the article
views edit This corresponds to the "Create" or "Edit" tab at the top of the article
views formedit This corresponds to the "Edit with form" tab at the top of the article
views history This corresponds to the "View history" tab at the top of the article
actions delete This corresponds to the "Delete" option under the action tab at the top of the article
actions move This corresponds to the "Move" option under the action tab at the top of the article
actions protect This corresponds to the "Protect" option under the action tab at the top of the article
actions unprotect This corresponds to the "Change protection" option under the action tab at the top of the article
actions watch This corresponds to the "Watch" tab at the top of the article
actions unwatch This corresponds to the "UnWatch" tab at the top of the article

Force Hiding

[edit]

This is always the first feature processed by the extension, it simply forces the hiding of tabs independently to any other settings (users groups or permission or category based hiding).

For each article that in your mind should never have one of the above listed tabs, you should define in your LocalSettings.php configuration file, after the inclusion of HidePageTabs, a directive specifying the group-> tab to hide, and add it to the $hideTabsPageList array.

The syntax for the directive definition follows the standard PHP array's one.

Example: If you want to always hide for "Main Page" article the "Read", "Edit", "View history" tabs and the "Delete" and "Move" action, you should add the following line after the inclusion of HidePageTabs extension:

$hideTabsPageList['Main Page'][views] = array('view','edit','history');
$hideTabsPageList['Main Page'][actions] = array('delete', 'move');

Allow only one between edit and edit with form tabs to be visible

[edit]

This is always the second feature processed by the extension.

MediaWiki Standard behaviour is the following: If an user has edit permission on an article and the page is related to Category with its own Form for editing defined, both the standard "Edit" and "Edit wit form" are showed.

Creating and defining form, allows wiki administrators to facilitate the insert/editing of information, and assure all the needed semantic properties are eventually defined within the template. Allowing users to edit the source of a page might bring to inconsistent semantic data.

An option for hiding the "Edit" tab would be to properly set the $wgGroupPermissions['groupname']['viewedittab'] = false; in your LocalSettings.php configuration file, but this might bring to some unexpected behaviour (like not being able to se the edit tab on Template and forms, where you actually would like the opposite to happen).

HidePageTabs helps you on this, hiding the standard "Edit" tab and leaving the "Edit with form" visible for normal articles, and doing the opposite for Template and Forms.

No further configuration is required for this functionality.

Hide views and actions tabs according to user groups / category configuration

[edit]

This functionality helps you defining which tab should be seen or not according to the user group and the page's category the user is visiting.

Example scenario:

You have a categories "tickets" associated to a specific template and for for creation/editing.

You want some of your users to be able only to create/read the articles belonging to this category.

You want some of your users to be able also to edit, delete, move the articles belonging to this category.

Group Page Category Visible tabs
incident_readers tickets 'view','formedit','watch','unwatch'
incident_admin tickets 'view','formedit','watch','unwatch','delete','move','history'

Configuration:

1) Define the groups (check the manual for more details) with your default desired general permission (those permission are for the whole wiki), for example:

$wgGroupPermissions['incident_readers']['read']=true;
$wgGroupPermissions['incident_readers']['edit']=true;
$wgGroupPermissions['incident_readers']['move']=true;
$wgGroupPermissions['incident_admin']['read']=true;
$wgGroupPermissions['incident_admin']['edit']=true;
$wgGroupPermissions['incident_admin']['move']=true;

2) Define the showTabsByGroupCategory containing ONLY the list of tabs you WANT TO SHOW for the specific GROUP and CATEGORY:

$showTabsByGroupCategory['incident_readers']['tickets'] = array('view','formedit','watch','unwatch');
$showTabsByGroupCategory['incident_admin']['tickets'] = array('view','formedit','watch','unwatch','delete','move','history')

3) Assign users to the proper group

See also

[edit]