Up to [LON-CAPA] / loncom / javascriptlib
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
- Satisfy w3c HTML validation: id attributes must be unique.
- Client-side checking for uploaded file size. - File size checks in multi-part problems supported where different size limits potentially apply to essayresponse items in the different parts. - File size checks supported in essayresponse item(s) in composite pages.
- Prepend LC_ to class name in client-side checking for uploaded file size, for purposes of namespacing.
File size checking for uploaded files A new javascript file, file_upload.js, handles client side file size checking. The function, checkUploadSize(), accepts an html file input element and a maximum file size (in bytes) as input. If the size of the file to be uploaded exceeds the size allowed, a message is displayed the the element is cleared. Server side checking is still used if it passes this test. Loading file_upload.js adds event handlers to file input elements with class="flUpload". <input type="file" class="flUpload" /> It also looks for a hidden element with id="free_space" that contains the maximum upload size. <input type="hidden" id="free_space" value="$free_space" /> The free space is usually calculated by subtracting a user's disk usage from their quota allowance. In some cases it is a fixed value. I have implemented this for every upload instance I could find. These include: * Message attachments * Authoring space * Portfolio * Course editor * Essay response problems * Helpdesk request forms * RSS feed uploads