MediaWiki:FileUploadWizard.js: Difference between revisions
Content deleted Content added
bug fix requested on talk |
per tper |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 42:
this.ScriptForm = frm;
// create the TargetForm element that contains the
frm = fuwGet('TargetForm');
if (! frm) {
frm = document.createElement('form');
frm.id = "TargetForm";
var area = fuwGet('placeholderTargetForm');
var parent = area.parentNode;
Line 104 ⟶ 85:
fuwAppendInput('file', filebox);
//
this.UploadOptions = {
filename : '',
text : '',
comment : '',
ignorewarnings : 1,
watch : 1
};
if (fuwTesting) {
Line 119 ⟶ 99:
fuwMakeHiddenfield('recreate', 1, 'SandboxRecreate');
}
if (fuwTesting) {
Line 318 ⟶ 288:
['PD-USGov-NASA','NASA'],
['PD-USGov-Military-Navy','US Navy'],
['PD-USGov-DOC-NOAA','US National Oceanic and Atmospheric Administration'],
['PD-USGov-Military-Air_Force','US Air Force'],
['PD-USGov-Military-Army','US Army'],
['PD-USGov-
],
'IneligibleLicense' :
Line 328 ⟶ 297:
['', 'please select one...'],
['PD-shape','Item consists solely of simple geometric shapes'],
['PD-
['PD-textlogo','Logo or similar item consisting solely of letters and simple geometric shapes'],
['PD-chem','Chemical structural formula'],
Line 338 ⟶ 307:
['Non-free 2D art', '2-dimensional artwork (painting, drawing etc.)'],
['Non-free historic image', 'Unique historic photograph'],
['Non-free fair use
],
'NF3DLicense' :
Line 352 ⟶ 321:
['Non-free book cover', 'Cover page of a book'],
['Non-free album cover', 'Cover of a sound recording (album, single, song, CD)'],
['Non-free video game cover', 'Cover of a video/computer game'],
['Non-free magazine cover', 'Cover page of a magazine'],
['Non-free video cover', 'Cover of a video'],
Line 358 ⟶ 327:
['Non-free product cover', 'Cover of some commercial product'],
['Non-free title-card', 'Title screen of a TV programme'],
['Non-free
['Non-free poster', 'Official poster of an event'],
['Non-free fair use
],
'NFExcerptLicense' :
Line 367 ⟶ 336:
['Non-free television screenshot', 'Television screenshot'],
['Non-free film screenshot', 'Movie screenshot'],
['Non-free video game screenshot', '
['Non-free video screenshot', 'Video screenshot'],
['Non-free music video screenshot', 'Music video screenshot'],
Line 379 ⟶ 348:
['Non-free computer icon', 'Computer icon'],
['Non-free newspaper image', 'Page from a newspaper'],
['Non-free fair use
],
'NFLogoLicense' :
Line 446 ⟶ 415:
['Some permissions granted, but not completely free'],
['Non-free promotional', 'From promotional press kit'],
['Non-free file with
['Non-free file with
['Non-free with permission', 'Permission granted, but only for Wikipedia'],
[]
Line 1,428 ⟶ 1,397:
fuwSetVisible('placeholderTestForm', true);
}
//
this.UploadOptions.filename = opts.InputName;
this.UploadOptions.text = summary;
this.UploadOptions.comment = editSummary;
}
Line 2,181 ⟶ 2,148:
// ========================================================
//
// TO DO: expand stub to add real notification of success,
// link to new file page, instructions about how to include
// file in articles, etc.
// ========================================================
function fuwUploadCompleted(doc) {
if (doc) {
//alert(doc);
Line 2,290 ⟶ 2,245:
alert("Unknown error: upload may have failed.");
}
}
}
Line 2,312 ⟶ 2,255:
var fuw = window.fuw;
fuw.collectInput();
fuw.formatOutput(false);
if (fuwTesting) {
Line 2,340 ⟶ 2,268:
fuwSetVisible('fuwWaiting', true);
// Upload the file, then add success notification etc.
// Note that mw.Api doesn't have special support for the XML format, so even when the API
// returns an error, this won't be detected and it will call the success handler.
var api = new mw.Api({
parameters : { format : 'xml' },
ajax : { dataType : 'xml' }
});
api.upload(fuw.TargetForm.file, fuw.UploadOptions).then(fuwUploadCompleted);
var opts = window.fuw.opts;
// the API won't overwrite the description page text while overwriting
Line 2,357 ⟶ 2,293:
token : mw.user.tokens.get('csrfToken'),
summary : opts.EditSummary,
text :
}
Line 2,419 ⟶ 2,355:
// onload hook function, loading this script
// ========================================================
$(function() {
if (fuwGet('UploadScriptArea')) { window.fuw = new fuwGlobal();
if (! window.fuw.disabled) {
fuwUpdateOptions();
}
}
});
});
|