MediaWiki:Upload.js

/*  */

function setupUploadForm{ $("#uploadBasicLinkJS").show; $("#uploadTemplateNoJS").hide;

var wpLicense = $('wpLicense');

if ( wpLicense && window.location.search.indexOf('wpForReUpload=1') == -1){ if (window.location.search.indexOf('basic=true') == -1){ // Add link to basic form $("#uploadtext").prepend(' Switch to basic upload form ');

// Stretch table to full width $('#mw-htmlform-description').css('width', '100%');

// Bind upload button to verify function $('#mw-upload-form').bind('submit', verifySummary);

// Hide existing rows var rows = $('#mw-htmlform-description').find('tr'); rows.eq(2).hide; rows.eq(3).detach;

$('#mw-htmlform-description').addClass('hidable start-hidden');

// Add new required rows rows.eq(1).after(' Source:  '); $('#mw-htmlform-description').append(' '); var tbody1 = $('#mw-htmlform-description').children('tbody').eq(0); tbody1.append(' Description:  '); tbody1.append(' Optional fields  ');

// Add new optional rows var tbody2 = $('#mw-htmlform-description').children('tbody').eq(1); tbody2.append(' Attention:  '); tbody2.append(' Original designer / artist: <textarea id="authorBox" cols="60" rows="2" style="overflow: auto;"> '); tbody2.append(' <td class="mw-label" style="width: 125px;">Conversion / editing / upload information: <td class="mw-input"><textarea id="filespecsBox" cols="60" rows="2" style="overflow: auto;"> '); tbody2.append(' <td class="mw-label" style="width: 125px;">Other versions / source images: <td class="mw-input"><textarea id="versionsBox" cols="60" rows="2" style="overflow: auto;"> '); tbody2.append(' <td class="mw-label" style="width: 125px;">Artist categories: <td class="mw-input"><textarea id="catartistBox" cols="60" rows="2" style="overflow: auto;"> '); tbody2.append(' <td class="mw-label" style="width: 125px;">Licensee categories: <td class="mw-input"><textarea id="catlicenseeBox" cols="60" rows="2" style="overflow: auto;"> '); tbody2.append(' <td class="mw-label" style="width: 125px;">Subject categories: <td class="mw-input"><textarea id="catsubjectBox" cols="60" rows="2" style="overflow: auto;"> '); tbody2.append(' <td class="mw-label" style="width: 125px;">Type categories: <td class="mw-input"><textarea id="cattypeBox" cols="60" rows="2" style="overflow: auto;"> '); } else { // Old style form just needs Information template in the summary box $('#wpUploadDescription').val('==Summary==\r\n');

// Add link to guided form $("#uploadtext").prepend(' Switch to guided upload form</a> '); }	} }

function verifySummary{ var wpLicense = document.getElementById('wpLicense');

// Check for licensing if ( wpLicense.value == "" ){ alert('Licensing must be completed.'); return false; }

// Check for source if ( document.getElementById('sourceBox').value == "" ){ alert('Source must be completed.'); return false; }

var strBuilder = '==Summary==\r\n';

document.getElementById('wpUploadDescription').value = strBuilder;

wpLicense.selectedIndex = 0;

return true; }

/* */