Extension:Uploadify
|
|
The author of this extension is no longer maintaining it! Meaning any reports for additional features and/or bugfixes will more than likely be ignored. Volunteers are encouraged to take on the task of developing and maintaining it. As a courtesy, you may want to contact the author. You should also remove this template and list yourself as maintaining the extension in the page's {{extensions}} infobox. |
|
Uploadify Release status: unstable |
|||
|---|---|---|---|
| Implementation | Special page, Ajax | ||
| Description | Upload multiple files by using Uploadify upload script | ||
| Author(s) | Tobias.strebitzerTalk | ||
| Last version | 0.5.0 (02.11.2011) | ||
| MediaWiki | 1.16 | ||
| PHP | 5.3 | ||
| License | GPL | ||
| Download | zipball Readme Changelog |
||
|
|||
|
|||
|
Check usage (experimental) |
|||
| This extension is broken and does not work. See the talk page |
|---|
The Uploadify Extension allows select users to bulk upload files from a mediawiki sidebar panel. After the files are successfully uploaded, the extension lists the file uploaded.
Contents |
[edit] Usage
Click on the "Select Files" button in the uploadify sidebar panel and select the files you want to upload. The files will be uploaded simultaneously and the page will not be reloaded. This means you can upload files without leaving a page, for example while editing an article. After an upload is complete, a textbox returns to the uploadify panel with the file link. Clicking the textbox will automatically select the tag to be easily copypasted into your markup.
[edit] Download instructions
Download the extension from here and upload the contents into "/extensions/Uploadify".
[edit] Installation
To install this extension, add the following to LocalSettings.php:
# Allow users to use Uploadify $wgGroupPermissions['user']['uploadify'] = true; # Load the extension require_once("$IP/extensions/Uploadify/Uploadify.php");
Then, create an "upload" directory (folder) within the extension. Otherwise, three errors will be shown.
[edit] Configuration parameters
No configuration parameters needed. If you get an "Invalid file type." message, see Manual:$wgFileExtensions.
[edit] Files
Provided here only as a backup. For the most current version of Uploadify which you should use, see github.com
[edit] Uploadify.i18n.php
| Uploadify.i18n.php |
|---|
<?php
/**
* Internationalisation file for the Uploadify Extension.
*
* @file
* @ingroup Extensions
*/
$messages = array();
$messages['en'] = array(
'uploadify' => 'Uploadify',
'uploadify-desc' => "Uploadify Multi-Upload for MediaWiki. Creates a sidebar where you can upload multiple files at once and returns the file link for each upload.",
'uploadify-file-list' => 'File List',
'file-already-exists' => 'File already exists.',
'invalid-file-type' => 'Invalid file type.',
'uploadify-button-text' => 'SELECT FILES'
);
/** German (Deutsch)
* @author Tobias Strebitzer
*/
$messages['de'] = array(
'uploadify' => 'Uploadify',
'uploadify-desc' => "Uploadify Multi-Upload Erweiterung für MediaWiki. Erstellt eine neue Sidebar wo mehrere Dateien gleichzeitig hochgeladen werden können und liefert den Dateilink für jeden Upload.",
'uploadify-file-list' => 'Dateiliste',
'file-already-exists' => 'Datei existiert bereits.',
'invalid-file-type' => 'Ungültiges Dateiformat.',
'uploadify-button-text' => 'DATEIEN WÄHLEN'
);
/** German (formal address) (Deutsch (Sie-Form))
* @author Tobias Strebitzer
*/
$messages['de-formal'] = array(
'usermerge-nonewuser' => 'Leerer neuer Benutzername - es wird eine Zusammenführung mit „$1“ vermutet.<br />
Klicken Sie auf „{{int:usermerge-submit}}“ zum Ausführen.',
);
|
[edit] Uploadify.php
| Uploadify.php |
|---|
<?php
$wgExtensionCredits["other"][] = array(
"name" => "Uploadify Extension",
"author" => "Tobias Strebitzer",
"version" => "0.2.0",
"url" => "http://www.strebitzer.at",
"description" => "uploadify-desc"
);
$wgHooks['SkinBuildSidebar'][] = 'tsUploadifyBox';
$dir = dirname(__FILE__) . '/';
$wgAvailableRights[] = 'uploadify';
$wgSpecialPages['UploadifyHandler'] = 'UploadifyHandler';
$wgAutoloadClasses['UploadifyHandler'] = $dir . "UploadifyHandler.php";
$wgExtensionMessagesFiles['Uploadify'] = $dir . 'Uploadify.i18n.php';
function tsUploadifyBox( $skin, &$bar ) {
global $wgScriptPath, $wgOut, $wgUser;
if ( !$wgUser->isAllowed( 'uploadify' ) ) {
return true;
}
// Add Scripts
$wgOut->addScript("<script language='javascript' type='text/javascript' src='$wgScriptPath/extensions/Uploadify/public/jquery-1.5.min.js'></script>");
$wgOut->addScript("<script language='javascript' type='text/javascript' src='$wgScriptPath/extensions/Uploadify/public/swfobject.js'></script>");
$wgOut->addScript("<script language='javascript' type='text/javascript' src='$wgScriptPath/extensions/Uploadify/public/jquery.uploadify.v2.1.4.min.js'></script>");
// Add Init Script
$script = "$(document).ready(function() {";
$script .= "$('#uploadify').uploadify({";
$script .= "'uploader' : '/extensions/Uploadify/public/uploadify.swf',";
$script .= "'cancelImg' : '/extensions/Uploadify/public/cancel.png',";
$script .= "'script' : '/Special:UploadifyHandler',";
$script .= "'folder' : '/uploads',";
$script .= "'auto' : true,";
$script .= "'multi' : true,";
$script .= "'buttonText': '" . wfMsg('uploadify-button-text') . "',";
$script .= "'removeCompleted': false,";
$script .= "'scriptData': { 'username': wgUserName },";
$script .= "'onComplete': function(event, id, fileObj, response, data) { $(\"div#uploadify\"+id).html(\"<div class='uploadify-mediawiki-result'>\" + response + \"</div>\"); }";
$script .= "});";
$script .= "});";
$wgOut->addScript("<script language='javascript' type='text/javascript'>$script</script>");
// Add Css
$wgOut->addScript("<link rel='stylesheet' type='text/css' href='$wgScriptPath/extensions/Uploadify/public/uploadify.css' media='all'>");
$out = "<div style='padding: 12px 6px;'>";
$out .= "<input id='uploadify' name='uploadify' type='file' />";
$out .= '</div>';
$out .= "<div class='uploadify-file-list-link'><a href='/Special:ListFiles' target='_parent'>";
$out .= wfMsg('uploadify-file-list');
$out .= "</a>";
$bar['Upload'] = $out;
return true;
}
?>
|
[edit] UploadifyHandler.php
| UploadifyHandler.php |
|---|
<?php
class UploadifyHandler extends SpecialPage {
function __construct() {
parent::__construct( 'UploadifyHandler', 'UploadifyHandler' );
}
function execute( $par ) {
global $wgRequest, $wgOut, $wgFileExtensions, $wgUploadDirectory, $wgMaxUploadFiles;
// Plain output
$wgOut->setArticleBodyOnly(true);
// Check if there are Files for upload
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetFile = dirname(__FILE__) . "/upload/" . $_FILES['Filedata']['name'];
$fileParts = pathinfo($_FILES['Filedata']['name']);
$userName = $_POST["username"];
// Check if extension is valid
if (in_array($fileParts['extension'],$wgFileExtensions)) {
// Copy File
move_uploaded_file($tempFile, $targetFile);
// Import File
$result = shell_exec("php maintenance/importImages.php --user=\"$userName\" " . dirname(__FILE__) . "/upload/" . " " . implode(" ", $wgFileExtensions));
// Delete File
unlink($targetFile);
// Check if file exists
if(stripos($result, "exists, skipping") !== false) {
$wgOut->addHTML(wfMsg('file-already-exists'));
}else{
// Report success
$wgOut->addHTML("<input onclick='this.select();' class='uploadify-result' type='text' value='[[File:" . ucfirst($_FILES['Filedata']['name']) . "]]' />");
}
} else {
$wgOut->addHTML(wfMsg('invalid-file-type'));
}
}
}
}
|
[edit] Read me file
From: [1]
| Read me file |
|---|
==What can this extension do?==
The Uploadify Extension allows users with the "uploadify" right to bulk- upload files from a mediawiki sidebar panel. After successful upload, it returns the MediaWiki Link Tag for the uploaded file, ready to be pasted into the MediaWiki edit article form.
==Usage==
Click on the "Select Files" Button in the uploadify sidebar panel and select as many files you want to upload. The files will be uploaded simultaneously and the page will not be reloaded, so you can upload files while you edit an article on the fly. After an upload is complete, a textbox returns to the uploadify panel with the MediaWiki Link- Tag. Clicking in the textbox will automatically select the Tag to be easily copypasted into your markup.
==Download instructions==
[[https://github.com/tobiasstrebitzer/MediaWikiUploadify/zipball/v0.5.0 Download the extension from here]] and upload the contents into "/extensions/Uploadify".
==Installation==
To install this extension, add the following to [[Manual:LocalSettings.php|LocalSettings.php]]:
<source lang="php">
# Allow users to use Uploadify
$wgGroupPermissions['user']['uploadify'] = true;
# Load the extension
require_once("$IP/extensions/Uploadify/Uploadify.php");
</source>
===Configuration parameters===
No configuration parameters needed.
===User rights===
The "uploadify" user right allows the user to use the uploadify extension. Users also need the right to upload files.
In detail, the uploadify right displays the sidebar and allows file uploads to be done
===Thank You===
Credits go to [[http://www.uploadify.com Ronnie Garcia and Travis Nickels]] for creating the fantastic uploadify jquery extension, as well es to [[http://www.jquery.com John Resig (jquery developer)]]
|
[edit] User rights
The "uploadify" user right allows the user to use the uploadify extension. Users also need the right to upload files. In detail, the uploadify right displays the sidebar and allows file uploads to be done
[edit] Thank You
Credits go to Ronnie Garcia and Travis Nickels for creating the fantastic uploadify jquery extension, as well es to John Resig (jquery developer)
