Commit 1778d6d1 authored by Alan McNatty's avatar Alan McNatty
Browse files

Merge branch 'master' of git://gitorious.org/mahara/mahara

parents 73689206 5ccbb142
...@@ -107,6 +107,10 @@ function pieform_element_filebrowser(Pieform $form, $element) { ...@@ -107,6 +107,10 @@ function pieform_element_filebrowser(Pieform $form, $element) {
$smarty->assign('agreementtext', get_string('uploadcopyrightdefaultcontent', 'install')); $smarty->assign('agreementtext', get_string('uploadcopyrightdefaultcontent', 'install'));
} }
} }
else if (!isset($config['simpleupload'])) {
$config['simpleupload'] = 1;
}
if ($config['upload']) { if ($config['upload']) {
$maxuploadsize = display_size(get_max_upload_size(!$institution && !$group)); $maxuploadsize = display_size(get_max_upload_size(!$institution && !$group));
$smarty->assign('maxuploadsize', $maxuploadsize); $smarty->assign('maxuploadsize', $maxuploadsize);
......
...@@ -70,6 +70,16 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -70,6 +70,16 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
'value':0 'value':0
})); }));
} }
if (is_FF() && self.config.select && !$(self.id + '_uploadsubmit') && $(self.id + '_uploadsubmit_container')) {
var submitbutton = INPUT({
'class': 'submit',
'type': 'submit',
'name': self.id + '_uploadsubmit',
'value': get_string('upload')
});
appendChildNodes(self.id + '_uploadsubmit_container', submitbutton);
self.config.submitbutton = true;
}
self.upload_connectbuttons(); self.upload_connectbuttons();
} }
...@@ -85,7 +95,15 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -85,7 +95,15 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
} }
}); });
} }
connect(self.id + '_userfile', 'onchange', self.upload_submit); if (self.config.submitbutton && $(self.id + '_uploadsubmit')) {
connect(self.id + '_uploadsubmit', 'onclick', self.upload_submit);
}
else {
connect(self.id + '_userfile', 'onchange', self.upload_submit);
if ($(self.id + '_uploadsubmit')) {
removeElement(self.id + '_uploadsubmit');
}
}
} }
this.upload_validate = function () { this.upload_validate = function () {
...@@ -128,7 +146,9 @@ function FileBrowser(idprefix, folderid, config, globalconfig) { ...@@ -128,7 +146,9 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
'name':'userfile', 'name':'userfile',
'size':40 'size':40
})); }));
connect(self.id + '_userfile', 'onchange', self.upload_submit); if (!$(self.id + '_uploadsubmit')) {
connect(self.id + '_userfile', 'onchange', self.upload_submit);
}
$(self.id + '_upload').value = 0; $(self.id + '_upload').value = 0;
return false; return false;
} }
......
...@@ -133,6 +133,7 @@ class PluginArtefactFile extends PluginArtefact { ...@@ -133,6 +133,7 @@ class PluginArtefactFile extends PluginArtefact {
'maxuploadsize', 'maxuploadsize',
'nametoolong', 'nametoolong',
'namefieldisrequired', 'namefieldisrequired',
'upload',
'uploadingfiletofolder', 'uploadingfiletofolder',
'youmustagreetothecopyrightnotice', 'youmustagreetothecopyrightnotice',
), ),
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
<table id="{$prefix}_upload_container" class="fileupload{if $tabs && !$tabs.upload} hidden{/if}"> <table id="{$prefix}_upload_container" class="fileupload{if $tabs && !$tabs.upload} hidden{/if}">
<tbody> <tbody>
{if $config.upload} {if $config.upload}
{* config.uploadagreement: disable the file chooser unless the agreement is checked *}
{* config.simpleupload: the form only contains a file chooser *}
{* config.submitbutton: add submit button even if js is enabled & don't start uploading as soon as a file is chosen *}
<input type="hidden" name="{$prefix}_uploadnumber" id="{$prefix}_uploadnumber" value="1" /> <input type="hidden" name="{$prefix}_uploadnumber" id="{$prefix}_uploadnumber" value="1" />
<input type="hidden" name="MAX_FILE_SIZE" value="{$phpmaxfilesize}" /> <input type="hidden" name="MAX_FILE_SIZE" value="{$phpmaxfilesize}" />
<tr><td colspan=2 id="{$prefix}_upload_messages"></td></tr> <tr><td colspan=2 id="{$prefix}_upload_messages"></td></tr>
...@@ -49,24 +52,24 @@ ...@@ -49,24 +52,24 @@
{$agreementtext|clean_html|safe} {$agreementtext|clean_html|safe}
</td> </td>
</tr> </tr>
{/if}
<tr class="uploadform"> <tr class="uploadform">
<th><label>{str tag='File' section='artefact.file'}</label></th> <th><label>{if $config.simpleupload}{str tag='uploadfile' section='artefact.file'}{else}{str tag='File' section='artefact.file'}{/if}</label></th>
<td> <td>
<span id="{$prefix}_userfile_container"><input type="file" class="file" id="{$prefix}_userfile" name="userfile" size="40" /></span> <span id="{$prefix}_userfile_container"><input type="file" class="file" id="{$prefix}_userfile" name="userfile" size="40" /></span>
<span id="{$prefix}_userfile_maxuploadsize">({str tag=maxuploadsize section=artefact.file} {$maxuploadsize})</span> <span id="{$prefix}_userfile_maxuploadsize">({str tag=maxuploadsize section=artefact.file} {$maxuploadsize})</span>
<noscript><input type="submit" class="submit" name="{$prefix}_upload" id="{$prefix}_upload" value="{str tag=upload section=artefact.file}" /></noscript> {if $config.uploadagreement}<script>setNodeAttribute('{$prefix}_userfile', 'disabled', true);</script>{/if}
<script>setNodeAttribute('{$prefix}_userfile', 'disabled', true);</script>
</td> </td>
</tr> </tr>
{else} <tr class="uploadform">
<tr> <th></th>
<th><label>{str tag='uploadfile' section='artefact.file'}</label></th> <td id="{$prefix}_uploadsubmit_container">{* filebrowser.js may add a submit button in here even if config.submitbutton is off *}
<td> {if $config.submitbutton}
<div id="{$prefix}_userfile_container"><input type="file" class="file" id="{$prefix}_userfile" name="userfile" size="40" /> ({str tag=maxuploadsize section=artefact.file} {$maxuploadsize})</div> <input type="submit" class="submit nojs-hidden-block" name="{$prefix}_uploadsubmit" id="{$prefix}_uploadsubmit" value="{str tag=upload section=artefact.file}" />
{/if}
<noscript><input type="submit" class="submit" name="{$prefix}_upload" id="{$prefix}_upload" value="{str tag=upload section=artefact.file}" /></noscript> <noscript><input type="submit" class="submit" name="{$prefix}_upload" id="{$prefix}_upload" value="{str tag=upload section=artefact.file}" /></noscript>
</td> </td>
</tr> </tr>
{/if}
{/if} {/if}
{if $config.createfolder} {if $config.createfolder}
......
...@@ -740,3 +740,10 @@ function keypressKeyCode(e) { ...@@ -740,3 +740,10 @@ function keypressKeyCode(e) {
} }
return 0; return 0;
} }
function is_FF() {
if ( /Firefox|Gecko|Iceweasel/.test(navigator.userAgent)) {
return true;
}
return false;
}
\ No newline at end of file
...@@ -44,7 +44,7 @@ $string['strfdaymonthyearshort'] = '%%d/%%m/%%Y'; ...@@ -44,7 +44,7 @@ $string['strfdaymonthyearshort'] = '%%d/%%m/%%Y';
$string['strftimew3cdatetime'] = '%%Y-%%m-%%dT%%T%%z'; $string['strftimew3cdatetime'] = '%%Y-%%m-%%dT%%T%%z';
$string['strftimew3cdate'] = '%%Y-%%m-%%d'; $string['strftimew3cdate'] = '%%Y-%%m-%%d';
$string['thislanguage'] = 'English'; $string['thislanguage'] = 'English';
$string['locales'] = 'en_US.utf8,en_GB.utf8,en'; $string['locales'] = 'en_US.utf8,en_GB.utf8,en,english-us,english-uk,english';
?> ?>
Markdown is supported
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