Extension:UploadWizard
リリースの状態: 安定 |
|
|---|---|
| 実装 | メディア, 特別ページ |
| 説明 | 複数ファイルのアップロードウィザード |
| 作者 | Neil Kandalgaonkar, Jeroen De Dauw, Mark Holmquist, Ryan Kaldari, Ankur Anand, Yuvi Panda, Michael Dale, |
| 最新バージョン | continuous updates |
| MediaWiki | >= 1.47.0 |
| データベースの変更 | はい |
|
Campaign |
|
|
|
|
|
|
|
| ライセンス | GNU 一般公衆利用許諾書 2.0 以降 |
| ダウンロード | README |
| translatewiki.net で翻訳を利用できる場合は、UploadWizard 拡張機能の翻訳にご協力ください | |
| Vagrant role | uploadwizard |
| 問題点 | 未解決のタスク · バグを報告 |
UploadWizard 拡張機能は、利用者がステップ バイ ステップの JavaScript ウィザードを使用して、Special:UploadWizard ページ経由で複数のファイルをアップロードできるようにします。
インストール
アップロードとサムネイルを可能にする
MediaWikiは、メディアファイルをホストし、サムネイル(メディアファイルの小さなプレビュー)を作成する機能が必要です。 画像をアップロードして、そのファイルページで小さいプレビューを見ることができれば、すでに準備は整っています。 そうでない場合は、 Manual:画像の管理 の 画像のサムネイル化を参照してください。
- GNU/LinuxまたはMac OS Xをお使いの場合
imagesディレクトリがウェブサーバーから書き込み可能であることを確認してください。- ImageMagickライブラリとバイナリをインストールしてください。
- ここで指定されたUploadWizardのファイルをダウンロードし、解凍してください。 Special:ExtensionDistributor/UploadWizard
- LocalSettings.php に以下の設定を追加します:
$wgEnableUploads = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = <path to your convert command>; # /usr/bin/convert ではない場合のみ設定が必要です。
wfLoadExtension( 'UploadWizard' );
You should also install the EventLogging extension. This is used only if you use the campaigns feature, and should be made a soft dependency at some point in the future.
Internet Explorerを使用している場合は、以下のコア構成変数も変更する必要があります。 phab:T41877 を参照してください。
$wgApiFrameOptions = 'SAMEORIGIN';
Flickrアップロードの有効化
UploadWizard を使ってFlickrから直接ファイルをアップロードすることもできます。
この設定を有効にするには、まず Flickr から APIキーを取得する必要があります。
- Flickr にログインする
- Flickr App Garden の Apps By You に行く
- 'Get another key'をクリック
- 'Apply for a non-commercial key'を選択
- 名前と説明を入力し、提出する前に二つの免責に同意するためのチェックボックスをチェックする
鍵を手に入れれば、以下のように LocalSettings.php に追記します。
$wgAllowCopyUploads = true;
$wgGroupPermissions['user']['upload_by_url'] = true;
$wgCopyUploadsDomains = ['*.flickr.com', '*.staticflickr.com'];
$wgUploadWizardConfig['flickrApiKey'] = 'YOUR_FLICKR_KEY_HERE';
その他の設定
- ライセンスチュートリアルを有効にするには、 インスタントコモンズ を有効にする必要があります。 インスタントコモンズを有効にするには、を LocalSettings.php に追記します。
$wgUseInstantCommons = true;
- You may want to set in LocalSettings.php, where
$wgUploadNavigationUrl = '/wiki/Special:UploadWizard';
/wiki/is the correct path for your wiki. A more general way of doing this that works for whatever path configuration you have, but that requires PHP 5.3 or later is:
$wgExtensionFunctions[] = function() {
$GLOBALS['wgUploadNavigationUrl'] = SpecialPage::getTitleFor( 'UploadWizard' )->getLocalURL();
return true;
};
これにより、サイドバーにある ファイルをアップロード のリンクが変更されます (おそらく他の場所と同様です) 。
詳細は Manual:$wgUploadNavigationUrl を参照してください。
他にもいくつかのオプションが利用可能です。 例えば:
$wgUploadWizardConfig = [
'debug' => false,
'autoAdd' => [
'wikitext' => [
'This file was uploaded with the UploadWizard extension.'
],
'categories' => [
'Uploaded with UploadWizard'
],
], // ウィキの言語に合わせてローカライズする必要があります
'feedbackPage' => 'Feedback about UploadWizard',
'altUploadForm' => 'Special:Upload',
'feedbackLink' => false, // フィードバックへのリンクを無効にする(既定:Commonsへのリンク)
'alternativeUploadToolsPage' => false, // 代替アップロードツールへのリンクを無効にする(既定:Commonsへのリンク)
'enableFormData' => true, // 対応ブラウザでFileAPIアップロードを有効にする
'enableMultipleFiles' => true,
'enableMultiFileSelect' => false,
'uwLanguages' => [
'ar' => 'العربية',
'de' => 'Deutsch',
'en' => 'English'
], // ファイル説明で選択可能な言語(既定は「en」です)。
'tutorial' => [
'skip' => true
], // チュートリアルをスキップする
'maxUploads' => 15, // 一つのフォームでアップロード可能な数 - 既定は50
'fileExtensions' => $wgFileExtensions // これを省略するとエラーが発生する可能性があります
];
ライセンスフリー環境での使用について
UploadWizardをライセンスを使用しない環境にインストールする場合は、以下の設定を LocalSettings.php に追加することをお勧めします。 This will limit the license choices to a single default that references the wiki's generic disclaimer. 場合によっては他にも多くの設定を追加する必要があることに注意してください。
$wgUploadWizardConfig = [
'licensing' => [
'ownWorkDefault' => 'own',
'ownWork' => [
'type' => 'or',
'template' => 'licensing', // これによりファイル情報ページにTemplate:Licensingへのリンクが追加されます。
'licenses' => [
'generic',
],
],
],
];
$wgUploadWizardConfig配列でサポートされているその他のオプションについては、UploadWizard.config.phpファイル(80行目あたりから)を参照してください。
汎用UIメッセージの変更
汎用UIメッセージを変更したい場合は、ウィキの以下のページを編集することで変更できます。
- MediaWiki:Mwe-upwiz-source-ownwork
- MediaWiki:Mwe-upwiz-source-ownwork-assert-generic
- MediaWiki:Mwe-upwiz-source-ownwork-generic-explain
アップロードウィザードによって作成されたファイルページを変更する 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. 例えば:
$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 ) ) {
// データを取得
$description = $matches[1];
$date = $matches[2];
$source = $matches[3];
$author = $matches[4];
$permission = $matches[5];
$otherVersions = $matches[6];
$license = $matches[7];
$licenseDetails = $matches[8];
// データを処理
if ( $source === '{{own}}' ) {
$source = 'Own work';
}
if ( preg_match( '/\[\[([^|]+)\|[^]]+\]\]/', $author, $matches ) ) {
$author = $matches[1]; // Unlink the author
}
if ( $licenseDetails ) {
$license = $licenseDetails;
}
// ウィキテキストを構築
$text = "$description
{{File data
| date = $date
| author = $author
| source = $source
| license = $license
}}";
}
};
使用法
URL引数
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. Language is set by language codes like: en, fr, de, zh-min-nan (technically ISO 639-1 and variations).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.- (e.g.
&lat=51.1114929)
- (e.g.
lon– Sets the initial value for the longitude field.- (e.g.
&lon=17.0324708)
- (e.g.
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.- (例:
fields[]=value_first&fields[]=value_second) - (e.g.
fields[0]=1st%20field%20value&fields[1]=2nd%20field%20value)
- (例:
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 withobjref. 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 firstfields[]value. 代わりにfields[]を使用してください。id2– If specified, this value is used instead of the secondfields[]value. 代わりにfields[]を使用してください。
オブジェクトの参照
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 toolsadmin. 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
テスト
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
テンプレート
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:
- the Template:Information (you could use mediawiki's export tool to import this template into your own installation of mediawiki)
- Description language identifiers like the "En" template, if none are defined, then only {{en}} is used.
- the Location template for geocoordinates
- Various licensing tags (which are configurable)
- (Optionally) a template to indicate that a file is uncategorized
関連項目
- Extension:UploadWizard にカスタムライセンスを追加するにはどうすればよいですか?
- Above but for the messages only (Miraheze's Issue Tracker)
- キャンペーンに関する資料
- 開発者向けの説明文書
- Extension:UploadWizard/Error behavior
- Extension:EnhancedUpload – a new special page for multi-upload and improves drag-and-drop upload in VisualEditor
- ウィキメディアの運用ノート
- Commons:Upload Wizard – ウィキメディア・コモンズのアップロードウィザード情報ページ
- Extension:MediaUploader – UploadWizard からフォークされた、サードパーティ利用者向けの柔軟な複数ファイル対応ステップ バイ ステップ アップローダー
- Extension:MsUpload
- User:Drecodeam/GSoC 2012 Application - Ankur Anand's work on Flickr & geolocation integration
関連仕様
- カスタムWikiTextライセンス機能
- 場所 - gps座標の入力/EXIFからの導出
| この拡張機能は 1 つ以上のウィキメディアのプロジェクトで使用されています。 これはおそらく、この拡張機能が安定していて高いトラフィックのウェブサイトでも十分に動作することを意味します。 この拡張機能がインストールされている場所を確認するには、ウィキメディアの設定ファイル CommonSettings.php および InitialiseSettings.php 内で、この拡張機能の名前を探してください。 特定のウィキにインストールされている拡張機能の完全な一覧は、そのウィキの Special:Version ページにあります。 |
| この拡張機能は以下のウィキ ファーム/ウィキ ホスト/パッケージに含まれています: |
- Stable extensions/ja
- Media handling extensions/ja
- Special page extensions/ja
- APIGetAllowedParams extensions/ja
- ArticleDeleteComplete extensions/ja
- BeforePageDisplay extensions/ja
- ChangeTagsAllowedAdd extensions/ja
- ChangeTagsListActive extensions/ja
- CodeEditorGetPageLanguage extensions/ja
- CodeMirrorGetMode extensions/ja
- ContentModelCanBeUsedOn extensions/ja
- EditFilterMergedContent extensions/ja
- GetPreferences extensions/ja
- IsUploadAllowedFromUrl extensions/ja
- LinksUpdateComplete extensions/ja
- ListDefinedTags extensions/ja
- LoadExtensionSchemaUpdates extensions/ja
- PageMoveComplete extensions/ja
- PageSaveComplete extensions/ja
- PreferencesGetIcon extensions/ja
- UploadVerifyUpload extensions/ja
- GPL licensed extensions/ja
- Extensions in Wikimedia version control/ja
- All extensions/ja
- Extensions used on Wikimedia/ja
- Extensions included in Canasta/ja
- Extensions included in Miraheze/ja
- Extensions included in ProWiki/ja
- Bulk upload/ja
