Erweiterung:UploadWizard

This page is a translated version of the page Extension:UploadWizard and the translation is 40% complete.
MediaWiki-Erweiterungen
UploadWizard
Freigabestatus: stabil
Einbindung Medien, Spezialseite
Beschreibung Schrittweiser Upload-Assistent für mehrere Dateien
Autor(en) Neil Kandalgaonkar, Jeroen De Dauw, Mark Holmquist, Ryan Kaldari, Ankur Anand, Yuvi Panda, Michael Dale,
Letzte Version continuous updates
MediaWiki >= 1.43
Datenbankänderungen Ja
Tabellen uw_campaigns
Lizenz GNU General Public License 2.0 oder neuer
Herunterladen
README
Campaign
  • $wgUploadWizardConfig
  • upwizcampaigns
  • mass-upload
Quarterly downloads 147 (Ranked 36th)
Übersetze die UploadWizard-Erweiterung, wenn sie auf translatewiki.net verfügbar ist
Vagrant-Rolle uploadwizard
Probleme Offene Aufgaben · Einen Fehler melden

Mit der Erweiterung UploadWizard kann ein Benutzer mehrere Dateien mit einem schrittweisen JavaScript-Assistenten hochladen.

Siehe auch: Beschreibungsseite des Upload-Assistenten in Wikimedia Commons

Installation

Uploads und Thumbnails aktivieren

Ihr MediaWiki muss in der Lage sein, Mediendateien zu hosten und Miniaturansichten zu erstellen (kleinere Vorschau von Mediendateien). Wenn Sie Bilder hochladen und kleinere Vorschauen auf der jeweiligen Dateibeschreibungsseite anzeigen können, hat ihr Wiki die nötigen Funktionen. Falls nicht, finden Sie eine vollständige Anleitung unter Handbuch:Verwalten von Bildern , insbesondere Bild-Miniaturansicht.

Für Benutzer von GNU/Linux oder Mac OS X
$wgEnableUploads = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = <path to your convert command>;  # Only needs to be set if different from /usr/bin/convert

wfLoadExtension( 'UploadWizard' );

Du solltest auch die Erweiterung EventLogging installieren. Diese wird nur verwendet, wenn du die Kampagnenfunktion verwendest, und sollte irgendwann in der Zukunft zu einer weichen Abhängigkeit gemacht werden.

If you use Internet Explorer, you'll also need to change the following core configuration variable. Siehe phab:T41877:

$wgApiFrameOptions = 'SAMEORIGIN';

Flickr-Uploads aktivieren

You can also use UploadWizard to transfer files directly from Flickr. Um diese Option zu aktivieren, musst du zunächst einen API-Schlüssel von Flickr erhalten:

  1. Log in to Flickr;
  2. Go to the Apps By You page in the Flickr App Garden;
  3. Klicke auf 'Einen anderen Schlüssel holen';
  4. Wähle 'Einen nicht-kommerziellen Schlüssel beantragen';
  5. Gib einen Namen und eine Beschreibung ein und aktiviere die beiden Ausschlusskästchen, bevor du abschickst.

Sobald du einen Schlüssel hast, füge Folgendes an deine LocalSettings.php:

$wgAllowCopyUploads = true;
$wgGroupPermissions['user']['upload_by_url'] = true;
$wgCopyUploadsDomains = ['*.flickr.com', '*.staticflickr.com'];
$wgUploadWizardConfig['flickrApiKey'] = 'YOUR_FLICKR_KEY_HERE';

Weitere Konfigurationsmöglichkeiten

  • Du musst InstantCommons aktiviert haben, um auf das Lizenzierungs-Tutorial zugreifen zu können. To enable InstantCommons add
    $wgUseInstantCommons = true;
    
    to LocalSettings.php.
  • Du möchtest vielleicht
    $wgUploadNavigationUrl = '/wiki/Special:UploadWizard';
    
    in LocalSettings.php setzen, wobei /wiki/ der richtige Pfad für dein Wiki ist. Eine allgemeinere Methode, die für jede Pfadkonfiguration funktioniert, jedoch PHP 5.3 oder höher erfordert, ist:
$wgExtensionFunctions[] = function() {
	$GLOBALS['wgUploadNavigationUrl'] = SpecialPage::getTitleFor( 'UploadWizard' )->getLocalURL();
	return true;
};

Dadurch wird der "Datei hochladen" Link in der Seitenleiste geändert - wahrscheinlich auch an anderen Stellen. More at Handbuch:$wgUploadNavigationUrl .

Verschiedene andere Optionen sind über ein Konfigurationsfeld verfügbar. Zum Beispiel:

$wgUploadWizardConfig = [
	'debug' => false,
	'autoAdd' => [
	 	'wikitext' => [
			'This file was uploaded with the UploadWizard extension.'
			],
	 	'categories' => [
	 		 'Uploaded with UploadWizard'	
	 		 ],
		], // Should be localised to the language of your wiki instance
	'feedbackPage' => 'Feedback about UploadWizard',
	'altUploadForm' => 'Special:Upload',
	'feedbackLink' => false, // Disable the link for feedback (default: points to Commons)
	'alternativeUploadToolsPage' => false, // Disable the link to alternative upload tools (default: points to Commons)
	'enableFormData' => true, // Enable FileAPI uploads be used on supported browsers
	'enableMultipleFiles' => true,
	'enableMultiFileSelect' => false,
	'uwLanguages' => [
		'ar' => 'العربية',
		'de' => 'Deutsch',
		'en' => 'English'
		], // Selectable languages for file descriptions - defaults to 'en'
	'tutorial' => [
	 	'skip' => true
		], // Skip the tutorial
	'maxUploads' => 15, // Number of uploads with one form - defaults to 50
	'fileExtensions' => $wgFileExtensions // omitting this may cause errors
	];

Verwendung in lizenzfreien Umgebungen

If you are installing UploadWizard in an environment where licenses are not used, you may want to add the configuration below to LocalSettings.php. Dadurch wird die Auswahl an Lizenzen auf einen einzigen Standard beschränkt, der auf den allgemeinen Haftungsausschluss des Wikis verweist. Beachte, dass je nach Anwendungsfall viele weitere Konfigurationseinstellungen existieren, die du hinzufügen kannst.

$wgUploadWizardConfig = [
	'licensing' => [
		'ownWorkDefault' => 'own',
		'ownWork' => [
			'type' => 'or',
			'template' => 'licensing', // this adds a link to Template:Licensing to the file info page
			'licenses' => [
				'generic',
			],
		],
	],
];
Dies sind nur einige Beispiele für Einstellungen. In der Datei UploadWizard.config.php (ab etwa Zeile 80) findest du viele weitere Optionen, die im Array $wgUploadWizardConfig unterstützt werden.

Ändern der allgemeinen UI-Nachrichten

Wenn du die allgemeinen Nachrichten ändern möchtest, kannst du dies im Wiki selbst tun, indem du die folgenden Seiten bearbeitest:

  • MediaWiki:Mwe-upwiz-source-ownwork
  • MediaWiki:Mwe-upwiz-source-ownwork-assert-generic
  • MediaWiki:Mwe-upwiz-source-ownwork-generic-explain

Modifying file pages created by Upload Wizard

To modify the wikitext of file pages created by UploadWizard, add a hook to LocalSettings.php that fires on every page save, then check if the page has the structure of a page created by UploadWizard, and modify it to your liking. For example:

$wgHooks['ParserPreSaveTransformComplete'][] = function ( Parser $parser, string &$text ) {
	if ( preg_match( '/=={{int:filedesc}}==
{{Information
\|description=(.*)
\|date=(.*)
\|source=(.*)
\|author=(.*)
\|permission=(.*)
\|other versions=(.*)
}}

=={{int:license-header}}==
{{(.*)}}
*(.*)/', $text, $matches ) ) {

		// Get data
		$description = $matches[1];
		$date = $matches[2];
		$source = $matches[3];
		$author = $matches[4];
		$permission = $matches[5];
		$otherVersions = $matches[6];
		$license = $matches[7];
		$licenseDetails = $matches[8];

		// Process data
		if ( $source === '{{own}}' ) {
			$source = 'Own work';
		}
		if ( preg_match( '/\[\[([^|]+)\|[^]]+\]\]/', $author, $matches ) ) {
			$author = $matches[1]; // Unlink the author
		}
		if ( $licenseDetails ) {
			$license = $licenseDetails;
		}

		// Build wikitext
		$text = "$description

{{File data
| date = $date
| author = $author
| source = $source
| license = $license
}}";
	}
};

Benutzung

URL-Argumente

There are several URL arguments that can be specified to alter the behaviour of the UploadWizard:

  • campaign - Specifies which upload campaign to use.
  • caption - Sets the initial value for the caption field (structural data). Note that by default this will be copied to the description.
  • captionlang - Sets the language of the first caption field.
  • description - Sets the initial value for the description field. Note that setting the description will disable copying the caption to the description.
  • descriptionlang - Sets the language of the first description field.
  • lat - Sets the initial value for the latitude field.
  • lon - Sets the initial value for the longitude field.
  • alt - Sets the initial value for the altitude field.
  • categories - Sets the initial value for the categories field, multiple categories separated by |.
  • fields[] - The initial values of additional fields defined by a campaign. Values of multiple fields must be passed in the exact same order as defined in the campaign.
(e.g. fields[]=value_first&fields[]=value_second)
  • objref - Specifies an object reference that can be used to update a page with a thumbnail of an uploaded image. See #Object references for further details.
  • updateList - Specifies whether a list page should be updated at all. This parameter only works in combination with objref. See #Object references for further details.

These arguments can be specified as follows: if you have an argument named campaign and want to provide the value foobar, then append campaign=foobar to the url. For example wiki/Special:UploadWizard?campaign=foobar or w/index.php?title=Special:UploadWizard&campaign=foobar.

The following URL arguments are still supported for existing URLs, but deprecated:

  • id: If specified, this value is used instead of the first fields[] value. Please use fields[] instead.
  • id2: If specified, this value is used instead of the second fields[] value. Please use fields[] instead.


Objektreferenzen

Upload Wizard provides a way to store “object references” - references to list templates in Wiki pages - in the file description page. These may be used by bots to insert a thumbnail image into a list page. A bot that is doing this for monument lists of German Wikipedia is running on tool labs. Its code is hosted on GitHub. Though its purpose is to update monument lists on Wikipedia it can be adopted to serve in different scenarios.

This feature uses the parameters objref and updateList. If both parameters are passed, the Upload Wizard shows a checkbox for each upload, which can be used to select the image that the object reference is added to. If the parameter updateList is omitted, the checkboxes will be disabled and an additional notice is being displayed stating that an image for the object already exists in the list.

  • objref - Specifies an object reference that can be used to update a page with a thumbnail of an uploaded image. Passing this parameter is expected in the following format objref=prefix|page_title|object_id
    • prefix - Interwiki or interlanguage prefix as defined per Special:Interwiki. The prefix must be defined in order to make this work.
    • page_title - The title of the page the object is listed on.
    • object_id - A unique identifier of the object for a bot to update
  • updateList: Specifies whether a list page should be updated at all. Set to any value, this parameter enables a checkbox

Tests

If you're testing UploadWizard for whatever reason, and you've run out of "real" images to upload as test cases, you can always use the handy MediaWiki utility for creating test images. Open a terminal emulator, get into a directory where you want to store a bunch of test JPG files, and run

$ php path/to/mediawiki/tests/phpunit/includes/api/generateRandomImages.php

Here's a Bash script that should make it easier to do all of this without much trouble. It's a good idea to put this in your PATH and/or make a handy shortcut to it somewhere that will make it trivial to update your images with new ones.

#!/bin/bash

# Declare some paths (easier to configure)
PICPATH=/path/to/image/directory
MW_INSTALL_PATH=/path/to/mediawiki

# Get to the pic path, and remove old test images
cd $PICPATH
rm *.jpg

# Run the generate script three times to give us a bunch of images
php $MW_INSTALL_PATH/tests/phpunit/includes/api/generateRandomImages.php
php $MW_INSTALL_PATH/tests/phpunit/includes/api/generateRandomImages.php
php $MW_INSTALL_PATH/tests/phpunit/includes/api/generateRandomImages.php

Vorlagen

  Warnung: This list is not complete and more templates are required, otherwise you will end with SCRIPT error or other error messages not in English!

Upload Wizard will insert a few templates into generated file description pages, which need to exist on the wiki in order for the description pages to be rendered correctly. The templates used include:

Siehe auch

Verwandte Spezifikationen