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
c1ef0204
Commit
c1ef0204
authored
Dec 03, 2019
by
Carsten Rose
Browse files
Merge branch 'b7974-checkboxReadOnly' into B9691-CheckboxDynamicUpdateReadonly
parents
e2ed910d
f1e1a85f
Changes
2
Hide whitespace changes
Inline
Side-by-side
extension/Classes/Core/AbstractBuildForm.php
View file @
c1ef0204
...
...
@@ -1104,7 +1104,7 @@ abstract class AbstractBuildForm {
}
/**
* Create an array with standard elements for 'mode' (hidden, disabled, required)
* Create an array with standard elements for 'mode' (hidden, disabled, required
, readonly
)
* and add 'form-element', 'value'.
* 'Generic Element Update': add via API_ELEMENT_UPDATE 'label' and 'note'.
* All collected data as array - will be later converted to JSON.
...
...
@@ -1113,11 +1113,13 @@ abstract class AbstractBuildForm {
* @param string|array $value
* @param array $formElement
*
* @param int $optionIdx
* @param string $class
* @return array
* @throws \CodeException
* @throws \UserFormException
*/
private
function
getFormElementForJson
(
$htmlFormElementName
,
$value
,
array
$formElement
)
{
private
function
getFormElementForJson
(
$htmlFormElementName
,
$value
,
array
$formElement
,
$optionIdx
=
0
,
$optionClass
=
''
)
{
$addClassRequired
=
array
();
$json
=
$this
->
getJsonFeMode
(
$formElement
[
FE_MODE
]);
// disabled, required
...
...
@@ -1149,11 +1151,13 @@ abstract class AbstractBuildForm {
$addClassRequired
=
HelperFormElement
::
getRequiredPositionClass
(
$formElement
[
F_FE_REQUIRED_POSITION
]);
}
// Label
if
(
isset
(
$formElement
[
FE_LABEL
]))
{
$key
=
$formElement
[
FE_HTML_ID
]
.
HTML_ID_EXTENSION_LABEL
;
$json
[
API_ELEMENT_UPDATE
][
$key
][
API_ELEMENT_CONTENT
]
=
$this
->
buildLabel
(
$htmlFormElementName
,
$formElement
[
FE_LABEL
],
$addClassRequired
[
FE_LABEL
]
??
''
);
}
// Note
if
(
isset
(
$formElement
[
FE_NOTE
]))
{
$key
=
$formElement
[
FE_HTML_ID
]
.
HTML_ID_EXTENSION_NOTE
;
if
(
!
empty
(
$addClassRequired
[
FE_NOTE
]))
{
...
...
@@ -1162,6 +1166,7 @@ abstract class AbstractBuildForm {
$json
[
API_ELEMENT_UPDATE
][
$key
][
API_ELEMENT_CONTENT
]
=
$formElement
[
FE_NOTE
];
}
// Input
if
(
isset
(
$formElement
[
FE_TYPE
]))
{
$key
=
$formElement
[
FE_HTML_ID
]
.
HTML_ID_EXTENSION_INPUT
;
...
...
@@ -1174,14 +1179,26 @@ abstract class AbstractBuildForm {
if
(
!
empty
(
$formElement
[
FE_MODE_SQL
]))
{
$class
=
is_numeric
(
$formElement
[
FE_BS_INPUT_COLUMNS
])
?
(
'col-md-'
.
$formElement
[
FE_BS_INPUT_COLUMNS
])
:
$formElement
[
FE_BS_INPUT_COLUMNS
];
// $class = 'col-md-' . $formElement[FE_BS_INPUT_COLUMNS] . ' ';
$class
.
=
(
$formElement
[
FE_MODE
]
==
FE_MODE_HIDDEN
)
?
' hidden'
:
''
;
$json
[
API_ELEMENT_UPDATE
][
$key
][
API_ELEMENT_ATTRIBUTE
][
'class'
]
=
$class
;
$json
[
API_ELEMENT_UPDATE
][
$key
][
API_ELEMENT_ATTRIBUTE
][
'required'
]
=
(
$formElement
[
FE_MODE
]
==
'required'
);
$json
[
API_ELEMENT_UPDATE
][
$key
][
API_ELEMENT_ATTRIBUTE
][
'hidden'
]
=
$statusHidden
;
$json
[
API_ELEMENT_UPDATE
][
$key
][
API_ELEMENT_ATTRIBUTE
][
'readonly'
]
=
$json
[
'disabled'
]
?
'readonly'
:
'false'
;
// Checkbox: Copy attributes to every checkbox:
// #7974 - nicht klar ob das hier wirklich sinnvoll ist: checkboxen gehen nicht auf readonly bei dynamic update - auch mit diesem IF nicht.
if
(
$formElement
[
FE_TYPE
]
==
FE_TYPE_CHECKBOX
)
{
$optionsKey
=
$formElement
[
FE_HTML_ID
]
.
'-'
.
$optionIdx
;
$json
[
API_ELEMENT_UPDATE
][
$optionsKey
][
API_ELEMENT_ATTRIBUTE
]
=
$json
[
API_ELEMENT_UPDATE
][
$key
][
API_ELEMENT_ATTRIBUTE
];
$json
[
API_ELEMENT_UPDATE
][
$optionsKey
][
API_ELEMENT_ATTRIBUTE
][
'data-disabled'
]
=
$json
[
'disabled'
]
?
'yes'
:
'no'
;
$json
[
API_ELEMENT_UPDATE
][
$optionsKey
][
API_ELEMENT_ATTRIBUTE
][
'class'
]
=
$optionClass
;
}
$class
.
=
(
$formElement
[
FE_MODE
]
==
FE_MODE_HIDDEN
)
?
' hidden'
:
''
;
$json
[
API_ELEMENT_UPDATE
][
$key
][
API_ELEMENT_ATTRIBUTE
][
'class'
]
=
$class
;
if
(
$pattern
!==
null
)
{
$json
[
API_ELEMENT_UPDATE
][
$key
][
API_ELEMENT_ATTRIBUTE
][
'pattern'
]
=
$pattern
;
}
}
// #3647
...
...
@@ -2312,7 +2329,7 @@ abstract class AbstractBuildForm {
}
$html
.
=
$htmlElement
.
$br
;
$json
[]
=
$this
->
getFormElementForJson
(
$htmlFormElementNameUniq
,
$jsonValue
,
$formElement
);
$json
[]
=
$this
->
getFormElementForJson
(
$htmlFormElementNameUniq
,
$jsonValue
,
$formElement
,
$ii
,
$checkboxClass
);
}
...
...
javascript/src/Helper/tinyMCE.js
View file @
c1ef0204
...
...
@@ -68,12 +68,14 @@ QfqNS.Helper = QfqNS.Helper || {};
});
/* Remove ReadOnly Again - we have to implement tinymce differently
to make it easier to change such
attributes
*/
to make it easier to change such */
var
me
=
editor
;
var
$parent
=
$
(
config
.
selector
);
$parent
.
parent
(
'
div
'
).
mouseenter
(
function
(
e
)
{
if
(
$parent
.
is
(
'
[readonly="readonly"]
'
))
{
console
.
log
(
"
Mouse Enter
"
);
console
.
log
(
$parent
.
is
(
'
[disabled]
'
));
if
(
$parent
.
is
(
'
[disabled]
'
))
{
me
.
setMode
(
"
readonly
"
);
}
else
{
me
.
setMode
(
"
design
"
);
...
...
@@ -82,7 +84,7 @@ QfqNS.Helper = QfqNS.Helper || {};
};
tinymce
.
init
(
config
);
if
(
$
(
this
).
is
(
'
[
readonly
]
'
))
{
if
(
$
(
this
).
is
(
'
[
disabled
]
'
))
{
myEditor
.
setMode
(
"
readonly
"
);
}
}
...
...
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