Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
0c1a3e5b
Commit
0c1a3e5b
authored
Apr 10, 2017
by
Carsten Rose
Browse files
#3544 / Form: view current form
Implemented.
parent
8148d1dd
Changes
4
Hide whitespace changes
Inline
Side-by-side
extension/qfq/qfq/AbstractBuildForm.php
View file @
0c1a3e5b
...
...
@@ -485,7 +485,7 @@ abstract class AbstractBuildForm {
}
// Build 'FormElement' Edit symbol
$feEditUrl
=
$this
->
createFormEditorUrl
(
FORM_NAME_FORM_ELEMENT
,
$formElement
[
FE_ID
],
[
'formId'
=>
$formElement
[
'formId'
]]);
$feEditUrl
=
$this
->
createFormEditorUrl
(
FORM_NAME_FORM_ELEMENT
,
$formElement
[
FE_ID
],
[
'formId'
=>
$formElement
[
FE_FORM_ID
]]);
$titleAttr
=
Support
::
doAttribute
(
'title'
,
$this
->
formSpec
[
FE_NAME
]
.
' / '
.
$formElement
[
FE_NAME
]
.
' ['
.
$formElement
[
FE_ID
]
.
']'
);
$icon
=
Support
::
wrapTag
(
'<span class="'
.
GLYPH_ICON
.
' '
.
GLYPH_ICON_EDIT
.
'">'
,
''
);
$elementHtml
.
=
Support
::
wrapTag
(
"<a class='hidden "
.
CLASS_FORM_ELEMENT_EDIT
.
"' href='
$feEditUrl
'
$titleAttr
>"
,
$icon
);
...
...
@@ -2556,11 +2556,11 @@ abstract class AbstractBuildForm {
$value
=
substr
(
$value
,
0
,
$formElement
[
FE_MAX_LENGTH
]);
}
// See: https://project.math.uzh.ch/issues/3536
// $type = $formElement[FE_TYPE];
// if ($type === 'datetime') {
// $type = 'datetime-local';
// }
$type
=
'text'
;
// date|time|datetime|datetime-local are not appropriate - only I18n representation possible.
$attribute
.
=
Support
::
doAttribute
(
'type'
,
$type
);
...
...
extension/qfq/qfq/BuildFormBootstrap.php
View file @
0c1a3e5b
...
...
@@ -132,14 +132,55 @@ class BuildFormBootstrap extends AbstractBuildForm {
* @return string - the rendered Checkbox
*/
private
function
buildShowEditFormElementCheckbox
()
{
// EditFormElement Icons
$js
=
'$(".'
.
CLASS_FORM_ELEMENT_EDIT
.
'").toggleClass("hidden")'
;
$element
=
"<input type='checkbox' onchange='"
.
$js
.
"'>"
.
Support
::
wrapTag
(
"<span title='Toggle: Edit form element icons' class='"
.
GLYPH_ICON
.
' '
.
GLYPH_ICON_TASKS
.
"'>"
,
''
);
$element
=
Support
::
wrapTag
(
'<label class="btn btn-default navbar-btn">'
,
$element
);
return
Support
::
wrapTag
(
'<div class="btn-group" data-toggle="buttons">'
,
$element
);
}
/**
* Creates a link to open current form loaded in FormEditor
*
* @return string - the rendered Checkbox
*/
private
function
buildViewForm
()
{
switch
(
$this
->
formSpec
[
F_NAME
])
{
case
'form'
:
$form
=
$this
->
store
->
getVar
(
F_NAME
,
STORE_RECORD
);
break
;
case
'formElement'
:
$row
=
$this
->
db
->
sql
(
"SELECT f.name FROM Form AS f WHERE id="
.
$this
->
store
->
getVar
(
FE_FORM_ID
,
STORE_RECORD
),
ROW_EXPECT_1
);
$form
=
current
(
$row
);
break
;
default
:
return
''
;
}
if
(
$form
===
false
)
{
return
''
;
}
$queryStringArray
=
[
'id'
=>
$this
->
store
->
getVar
(
SYSTEM_EDIT_FORM_PAGE
,
STORE_SYSTEM
),
'form'
=>
$form
,
'r'
=>
0
];
$queryString
=
Support
::
arrayToQueryString
(
$queryStringArray
);
$sip
=
$this
->
store
->
getSipInstance
();
$url
=
$sip
->
queryStringToSip
(
$queryString
);
$toolTip
=
"View current form with r=0"
.
PHP_EOL
.
PHP_EOL
.
OnArray
::
toString
(
$queryStringArray
,
' = '
,
PHP_EOL
,
"'"
);
return
$this
->
buildButtonAnchor
(
'form-view-'
.
$this
->
formSpec
[
F_ID
],
$url
,
$toolTip
,
GLYPH_ICON_VIEW
,
''
);
}
// glyphicon glyphicon-eye-open
/**
* Build Buttons panel on top right corner of form.
* Simulate Submit Button: http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml
...
...
@@ -160,7 +201,9 @@ class BuildFormBootstrap extends AbstractBuildForm {
$toolTip
=
"Edit form"
.
PHP_EOL
.
PHP_EOL
.
OnArray
::
toString
(
$this
->
store
->
getStore
(
STORE_SIP
),
' = '
,
PHP_EOL
,
"'"
);
$url
=
$this
->
createFormEditorUrl
(
FORM_NAME_FORM
,
$this
->
formSpec
[
F_ID
]);
$buttonEditForm
=
$this
->
buildShowEditFormElementCheckbox
()
.
$this
->
buildButtonAnchor
(
'form-edit-button'
,
$url
,
$toolTip
,
GLYPH_ICON_TOOL
);
$buttonEditForm
=
$this
->
buildViewForm
()
.
$this
->
buildShowEditFormElementCheckbox
()
.
$this
->
buildButtonAnchor
(
'form-edit-button'
,
$url
,
$toolTip
,
GLYPH_ICON_TOOL
);
}
// Button: Save
...
...
@@ -215,15 +258,23 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
/**
* @param $id
* @param $url
* @param $title
* @param $icon
* Generic function to create a button with a given id, $url, $title, $icon (=glyph), $disabled
* @param string $id
* @param string $url
* @param string $title
* @param string $icon
* @param string $disabled
* @return string
*/
private
function
buildButtonAnchor
(
$id
,
$url
,
$title
,
$icon
,
$disabled
=
''
)
{
return
"<a "
.
Support
::
doAttribute
(
'href'
,
$url
)
.
" id='
$id
' class='btn btn-default navbar-btn
$disabled
' "
.
Support
::
doAttribute
(
'title'
,
$title
)
.
"><span class='glyphicon
$icon
'></span></a>"
;
$icon
=
Support
::
wrapTag
(
"<span "
.
Support
::
doAttribute
(
'class'
,
"glyphicon
$icon
"
)
.
">"
,
''
);
$attribute
=
Support
::
doAttribute
(
'href'
,
$url
);
$attribute
.
=
Support
::
doAttribute
(
'id'
,
$id
);
$attribute
.
=
Support
::
doAttribute
(
'class'
,
"btn btn-default navbar-btn
$disabled
"
);
$attribute
.
=
Support
::
doAttribute
(
'title'
,
$title
);
return
Support
::
wrapTag
(
"<a
$attribute
>"
,
$icon
);
}
/**
...
...
extension/qfq/qfq/Constants.php
View file @
0c1a3e5b
...
...
@@ -549,6 +549,7 @@ const GLYPH_ICON_TOOL = 'glyphicon-wrench';
const
GLYPH_ICON_CHECK
=
'glyphicon-ok'
;
const
GLYPH_ICON_CLOSE
=
'glyphicon-remove'
;
const
GLYPH_ICON_TASKS
=
'glyphicon-tasks'
;
const
GLYPH_ICON_VIEW
=
'glyphicon-eye-open'
;
// FORM
const
F_ID
=
'id'
;
...
...
@@ -610,6 +611,7 @@ const FE_SUBRECORD_ROW_TITLE = '_rowTitle';
// FormElement columns: real
const
FE_ID
=
'id'
;
const
FE_ID_CONTAINER
=
'feIdContainer'
;
const
FE_FORM_ID
=
'formId'
;
const
FE_NAME
=
'name'
;
const
FE_TYPE
=
'type'
;
const
FE_MODE
=
'mode'
;
...
...
extension/qfq/qfq/form/FormAction.php
View file @
0c1a3e5b
...
...
@@ -217,7 +217,7 @@ class FormAction {
$mail
[
SENDMAIL_IDX_X_ID
]
=
$this
->
evaluate
->
parse
(
$feSpecAction
[
FE_SENDMAIL_X_ID
]);
$mail
[
SENDMAIL_IDX_RECEIVER_CC
]
=
$this
->
evaluate
->
parse
(
$feSpecAction
[
FE_SENDMAIL_CC
]);
$mail
[
SENDMAIL_IDX_RECEIVER_BCC
]
=
$this
->
evaluate
->
parse
(
$feSpecAction
[
FE_SENDMAIL_BCC
]);
$mail
[
SENDMAIL_IDX_SRC
]
=
"FormId: "
.
$feSpecAction
[
'formId'
]
.
", FormElementId: "
.
$feSpecAction
[
'id'
];
$mail
[
SENDMAIL_IDX_SRC
]
=
"FormId: "
.
$feSpecAction
[
FE_FORM_ID
]
.
", FormElementId: "
.
$feSpecAction
[
'id'
];
// Mail: send
new
Sendmail
(
$mail
);
...
...
Write
Preview
Markdown
is supported
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