1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 00:06:55 +02:00
This commit is contained in:
Ryan Cramer
2016-10-11 12:04:03 -04:00
parent 7568093ea7
commit 144872bedb
2 changed files with 20 additions and 8 deletions

View File

@@ -18,6 +18,7 @@
* @property bool|int $uploadOnlyMode Set to true or 1 to disable existing file list display * @property bool|int $uploadOnlyMode Set to true or 1 to disable existing file list display
* @property bool|int $noCollapseItem Set to true to disable collapsed items (like for LanguageTranslator tool or other things that add tools to files) * @property bool|int $noCollapseItem Set to true to disable collapsed items (like for LanguageTranslator tool or other things that add tools to files)
* @property bool|int $noShortName Set to true to disable shortened filenames in output * @property bool|int $noShortName Set to true to disable shortened filenames in output
* @property bool|int $noCustomButton Set to true to disable use of the styled <input type='file'>
* *
*/ */
class InputfieldFile extends Inputfield implements InputfieldItemList { class InputfieldFile extends Inputfield implements InputfieldItemList {
@@ -102,6 +103,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
$this->set('noAjax', 0); // disable ajax uploading $this->set('noAjax', 0); // disable ajax uploading
$this->set('noCollapseItem', 0); $this->set('noCollapseItem', 0);
$this->set('noShortName', 0); $this->set('noShortName', 0);
$this->set('noCustomButton', false);
$this->attr('type', 'file'); $this->attr('type', 'file');
$this->labels = array( $this->labels = array(
@@ -406,14 +408,23 @@ class InputfieldFile extends Inputfield implements InputfieldItemList {
"data-extensions='$extensions' " . "data-extensions='$extensions' " .
"data-fieldname='$attrs[name]' " . "data-fieldname='$attrs[name]' " .
"class='InputfieldFileUpload'> "class='InputfieldFileUpload'>
";
<div class='InputMask ui-button ui-state-default'> if($this->getSetting('noCustomButton')) {
<span class='ui-button-text'> $out .= "<input $attrStr>";
<i class='fa fa-fw fa-folder-open-o'></i>$chooseLabel
</span>
<input $attrStr>
</div>
} else {
$out .= "
<div class='InputMask ui-button ui-state-default'>
<span class='ui-button-text'>
<i class='fa fa-fw fa-folder-open-o'></i>$chooseLabel
</span>
<input $attrStr>
</div>
";
}
$out .= "
<span class='InputfieldFileValidExtensions detail'>$formatExtensions</span> <span class='InputfieldFileValidExtensions detail'>$formatExtensions</span>
<input type='hidden' class='InputfieldFileMaxFiles' value='$this->maxFiles' /> <input type='hidden' class='InputfieldFileMaxFiles' value='$this->maxFiles' />
"; ";

View File

@@ -532,6 +532,7 @@ class ProcessModule extends Process {
$f->description = $this->_('Upload a ZIP file containing module file(s). If you upload a module that is already installed, it will be overwritten with the one you upload.'); $f->description = $this->_('Upload a ZIP file containing module file(s). If you upload a module that is already installed, it will be overwritten with the one you upload.');
$f->notes = $trustNote; $f->notes = $trustNote;
$f->required = false; $f->required = false;
$f->noCustomButton = true;
$fieldset->add($f); $fieldset->add($f);
$f = $this->modules->get('InputfieldSubmit'); $f = $this->modules->get('InputfieldSubmit');
$f->attr('id+name', 'upload'); $f->attr('id+name', 'upload');