Extension:PageAttachment

What can this extension do?
This extension extends MediaWiki to allow adding files to a page as attachments.

By default, attachments are only allowed to be added to pages in the "Main" namespace. Through configuration changes, attachments can be allowed to be attached to any other pages under other namespaces, for example, "User Talk" pages.

What is new in version 1.1.0

 * A configurable feature has been added to allow permanent file deletion when an attachment is removed. By default this is turned off. Even if permanent file deletion is turned on, files are not allowed to be permanently deleted if the file is attached other pages or, embedded in a page.  This can be overridden by appropriate configuration settings.

What is new in version 1.2.0

 * A description column has been added to display file description. The display is limited to 35 characters which can be configured through the configuration file. If the description is longer than 35 characters, an icon appears indicating that there is more text and when mouse hovers over the field, a popup shows the whole description text, and if the mouse is moved out of the description field, the popup disappears.  The popup style & size can also be configured through the configuration file and modifying the CSS.

What is new in version 1.3.0

 * A configurable feature has been added to allow setting category for the uploaded attachment file.

What is new in version 2.0.0

 * Code has been updated to make the extension compatible with MediaWiki 1.18.0

What is new in version 2.0.0-php-5.2-b3

 * This BETA 3 release supports PHP 5.2 and MediaWiki 1.18

What is new in version 1.3.1-php-5.2-b1

 * This BETA 1 release supports PHP 5.2 and MediaWiki 1.16 & 1.17

What is new in version 1.3.2

 * Compatible with PHP version >= 5.3.0
 * Contains new messages files for the following languages:
 * German
 * German (Formal)

What is new in version 2.0.2

 * Compatible with PHP version >= 5.3.0
 * Contains new messages files for the following languages:
 * German
 * German (Formal)

What is new in version 2.0.2-php-5.2-b4

 * Contains new messages files for the following languages:
 * German
 * German (Formal)

What is new in version 1.3.2-php-5.2-b2

 * Contains new messages files for the following languages:
 * German
 * German (Formal)

Compatibility
TBR: To be released.


 * Notes on PHP 5.2 release
 * PHP 5.2 compatible release is created by transforming the PHP 5.3 compatible code through the use of "ant" script.
 * Custom Date Formatting is not supported

Usage
Supported use-cases: Note: By default following are turned off
 * View attachments
 * Upload & attach a file
 * Browse/search for existing (uploaded) files and attach
 * Download an attachment
 * Remove an attachment (does not delete the file from MediaWiki repository)
 * Remove an attachment permanentely ( NEW )
 * View an attachment file's history
 * View audit log
 * For a specific attachment
 * For all attachmnets for a page
 * Auto remove an attachment when the attachment file is deleted from MediaWiki repository
 * Auto restore an attachment when a file deleted from MediaWiki repository is restored and if it was attached to any page
 * Set attachment category during upload ( NEW )
 * Audit logging
 * Set attachment category during upload
 * Permanent file deletion

Download instructions
This project is hosted on Google Code at the following link:

MediaWiki PageAttachment on Google Code

This project uses Mercurial repository. You can create your clone using following command:

hg clone https://code.google.com/p/mediawiki-page-attachment/

End-user installable package:

Download MdiaWiki PageAttachment Extension

If you need help with using a Mecurial repository, please take a look at the following links:


 * Mercurial on Wikipedia
 * Mercurial Project Site
 * Mercurial Beginner's Guides

Prerequisites
MediaWiki file upload functionality must be enabled for this extension to work. If file upload is not enabled, only "view" activity is allowed.

Please consult: Configuring File Uploads

Installation
Step 1

To install this extension, add the following to LocalSettings.php:

Step 2

Review the following file for available & default configurations:

config/DefaultConfigurations.php

Step 3

To override defaults and to set site specific configurations, update the following file:

config/SiteSpecificConfigurations.php

For example see the following file contained in the downloaded package:

exmaple-configuration/SiteSpecificConfigurations.php

Step 4

Run MediaWiki's update to create required database tables.

Please Consult: update.php

Configuration
It is recommended to use the site specific configuration file to override the defaults and specify site specific settings. Default configuration file is: config/DefaultConfigurations.php Site specific configuration file is: config/SiteSpecificConfigurations.php

Allowed Namespaces
Attachments are allowed only on pages under configured namespaces.

By default, only "Main" namespace is enabled:

To add other namespaces, for example, "Talk", "User", and "User Talk" add the following in the site specific configuration file:

MediaWiki User Rights
For upload & attachment activity, check is made to ensure the following:
 * User is not blocked
 * Wiki is not in readonly mode

PageAttachment User Rights
This extension maintains page attachment specific rights separately.

Page attachment specific rights are:
 * View attachments
 * Upload & attach a file
 * Browse/Search for existing (uploaded) files and attach
 * Remove attachments
 * Download attachments
 * View history
 * View audit log (if audit logging is enabled)

NOTE: View rights must be enabled for all other rights to work

The rights can be applied:
 * When login is not required
 * Only at the activity level (e.g. upload & attach a file)
 * When login is required, rights can be applied to each activity
 * At a group level
 * At a user specific level

NOTE: The groups/users must be valid MediaWiki groups/users.

Audit Log
Audit logging by default is turned off. To enable audit logging, set the following:

Cache

 * Server side cache
 * PageAttachment extension uses cache to store page attachment list, attachment data, and article names.
 * MediaWiki's Cache
 * By default, MediaWiki cache is used and recommended.
 * Recommeded for Production use.
 * To use MediaWiki's cache, no configuration change is required.
 * Please consult: MediaWiki Cache Setup
 * '''PageAttachment's Internal Cache
 * Alternatively, you can use one of the two internal cache implementations.
 * * SQLite3 Cache
 * * Database Cache
 * Use internal cache implementations for development & testing purposes only.
 * To use SQLite3 internal cache, set the following in the site-specific configuration file:


 * To use Database cache, set the following in the site-specific configuration file:


 * Browser cache
 * Ajax is used to load the page attachment list.
 * By default Ajax data caching in user's web browser is disabled. The reason for this that Ajax caching will sometime cause inconsistent data display based on when an attachment was added/update/removed and after user's login/logout.
 * If you want to enable Ajax caching, set the following in the site-specific configuration file:


 * N = Number of seconds to cache Ajax data in the user's browser.

User Interface
User Name Format By default, real-user name is displayed, if available. To disable this and to display only user id, set the following: Status Message Display Format The default format applies to all skins. You can override the default and/or provide skin specific formats. The default status message format is: The foregoing is rendered as the following:
 * &#187; STATUS_MESSAGE &#171;

The STATUS_MESSAGE is replaced with the actual message. To change the default format, replace the YOUR_HTML_CODE with your actual HTML code. Please, leave the STATUS_MESSAGE token in: To specify skin specific format, add additional settings and replace 'default' with the actual skin name. Example: Date Format Date formatting is based on MediaWiki settings. You can override this and specify language specific settings. By default, for English language, MediaWiki date format is overriden with the following format: The rendered date looks like, e.g.: Jul 24, 2011 11:17 pm To disable this, unset the foregoing setting as follows: Cascading Style Sheet (CSS) Files Icon Image Files The default icons apply to all skins. You can override the default and/or provide skin specific icons. The default icon image files are: To provide skin specific icons, add additional settings and replace the 'default' with the skin name. Note: The included image files are obtained from Tango Desktop Project and resized. Display Column Widths
 * Common
 * For left-to-right (LTR) language
 * For right-to-left (RTL) language

View/Submit Issues, Enhancement Requests
Please, submit new issue/enhancement-request at the following link:

PageAttachment Issues

Google Discussion Group
Google Discussion Group for PageAttachment Extension