Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
b98b5926
Commit
b98b5926
authored
Apr 26, 2016
by
Carsten Rose
Browse files
AbstractBuildForm.php: buildFile recoded to display either 'filename + trash' or 'Upload button'
parent
f63ed7b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/AbstractBuildForm.php
View file @
b98b5926
...
...
@@ -1503,8 +1503,11 @@ abstract class AbstractBuildForm {
* @throws UserFormException
*/
public
function
buildFile
(
array
$formElement
,
$htmlFormElementId
,
$value
,
&
$json
)
{
$attribute
=
''
;
$sip
=
$this
->
store
->
getVar
(
SIP_SIP
,
STORE_SIP
);
$value
=
basename
(
$value
);
// Strip directories
$attribute
=
$this
->
getAttributeMode
(
$formElement
);
$attribute
.
=
Support
::
doAttribute
(
'name'
,
$htmlFormElementId
);
// $attribute .= Support::doAttribute('class', 'form-control');
$attribute
.
=
Support
::
doAttribute
(
'type'
,
'file'
);
...
...
@@ -1512,9 +1515,29 @@ abstract class AbstractBuildForm {
$attribute
.
=
$this
->
getAttributeList
(
$formElement
,
[
'autofocus'
,
'accept'
]);
$attribute
.
=
Support
::
doAttribute
(
'data-load'
,
(
$formElement
[
'dynamicUpdate'
]
===
'yes'
)
?
'data-load'
:
''
);
if
(
$value
===
''
)
{
$textDeleteClass
=
'hidden'
;
$uploadClass
=
''
;
}
else
{
$textDeleteClass
=
''
;
$uploadClass
=
'hidden'
;
$formElement
[
'mode'
]
=
'disabled'
;
}
$attribute
.
=
$this
->
getAttributeMode
(
$formElement
);
$attribute
.
=
Support
::
doAttribute
(
'class'
,
$uploadClass
,
true
);
$htmlInputFile
=
'<input '
.
$attribute
.
'>'
.
$this
->
getHelpBlock
();
$deleteButton
=
Support
::
wrapTag
(
"<button class='delete-file' data-sip='
$sip
' name='trash-
$htmlFormElementId
'>"
,
$this
->
symbol
[
SYMBOL_DELETE
]);
$htmlFilename
=
Support
::
wrapTag
(
"<span class='uploaded-file-name'>"
,
$value
,
false
);
$htmlTextDelete
=
Support
::
wrapTag
(
"<div class='uploaded-file
$textDeleteClass
'>"
,
$htmlFilename
.
' '
.
$deleteButton
);
// <button type="button" class="file-delete" data-sip="571d1fc9e6974"><span class="glyphicon glyphicon-trash"></span></button>
$json
=
$this
->
getJsonElementUpdate
(
$htmlFormElementId
,
$value
,
$formElement
[
'mode'
]);
return
'<input '
.
$attribute
.
'>'
.
$this
->
getHelpBlock
()
;
return
$htmlTextDelete
.
$htmlInputFile
;
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment