Commit b2bb2f26 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

When the user hasn't checked the upload agreement, disable rather than hide the file element

parent fdf71aa0
......@@ -28,7 +28,7 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
this.upload_init = function () {
if ($(self.id + '_notice')) {
addElementClass(self.id + '_elements', 'hidden');
setNodeAttribute(self.id + '_userfile', 'disabled', true);
addElementClass(self.id + '_uploadcancel', 'hidden');
}
self.upload_connectbuttons();
......@@ -40,16 +40,16 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
// error class is too general?
forEach(getElementsByTagAndClassName('div', 'error', self.id + '_upload_messages'), removeElement);
if (this.checked) {
removeElementClass(self.id + '_elements', 'hidden');
$(self.id + '_userfile').disabled = false; // setNodeAttribute to false doesn't work here.
} else {
addElementClass(self.id + '_elements', 'hidden');
setNodeAttribute(self.id + '_userfile', 'disabled', true);
}
});
connect(self.id + '_uploadcancel', 'onclick', function () {
removeElementClass(self.id + '_openbutton', 'hidden');
addElementClass(self.id + '_agreement', 'hidden');
$(self.id + '_notice').checked = false;
addElementClass(self.id + '_elements', 'hidden');
setNodeAttribute(self.id + '_userfile', 'disabled', true);
addElementClass(this, 'hidden');
});
}
......
......@@ -32,12 +32,12 @@
{$agreementtext}
</td>
</tr>
<tr id="{$prefix}_elements" class="uploadform">
<tr class="uploadform">
<th><label>{str tag='File' section='artefact.file'}</label></th>
<td>
<div id="{$prefix}_userfile_container"><input type="file" class="file" id="{$prefix}_userfile" name="userfile" size="40" /></div>
<noscript><input type="submit" class="submit" name="upload" id="{$prefix}_upload" value="{str tag=upload section=artefact.file}" /></noscript>
<script>addElementClass('{$prefix}_elements', 'hidden');</script>
<script>setNodeAttribute('{$prefix}_userfile', 'disabled', true);</script>
</td>
</tr>
<tr class="uploadform">
......@@ -76,7 +76,6 @@
<input type="hidden" name="moveto" value="" />
{/if}
<!--input type="hidden" name="changefolder" id="{$prefix}_changefolder" value="0" /-->
<div id="{$prefix}_foldernav" class="foldernav">
{include file="artefact:file:form/folderpath.tpl" path=$path queryparams=$queryparams}
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment