Skip to content
GitLab
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
1eac8e30
Commit
1eac8e30
authored
Aug 18, 2020
by
Marc Egger
Browse files
Refs #9600 Edit report file using frontend editor.
parent
00d02c9d
Pipeline
#3686
failed with stages
in 4 minutes and 35 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
extension/Classes/Core/Exception/AbstractException.php
View file @
1eac8e30
...
...
@@ -8,6 +8,7 @@
namespace
IMATHUZH\Qfq\Core\Exception
;
use
IMATHUZH\Qfq\Core\QuickFormQuery
;
use
IMATHUZH\Qfq\Core\Store\Store
;
use
IMATHUZH\Qfq\Core\Store\Sip
;
use
IMATHUZH\Qfq\Core\Store\T3Info
;
...
...
@@ -168,6 +169,11 @@ class AbstractException extends \Exception {
$arrMerged
[
$key
]
=
str_replace
(
"
\n
"
,
"<br>"
,
$arrMerged
[
$key
]);
}
// Render inline report editor
$arrMerged
[
ERROR_MESSAGE_TO_DEVELOPER
]
=
QuickFormQuery
::
buildInlineReport
(
\
UserReportException
::
$report_uid
,
\
UserReportException
::
$report_pathFileName
,
\
UserReportException
::
$report_bodytext
,
\
UserReportException
::
$report_header
)
.
$arrMerged
[
ERROR_MESSAGE_TO_DEVELOPER
];
$htmlDebug
=
OnArray
::
arrayToHtmlTable
(
array_merge
(
$arrForm
,
$arrMerged
),
'Debug'
,
EXCEPTION_TABLE_CLASS
);
...
...
extension/Classes/Core/Exception/UserReportException.php
View file @
1eac8e30
...
...
@@ -30,6 +30,13 @@ use IMATHUZH\Qfq\Core\Store\Store;
*/
class
UserReportException
extends
AbstractException
{
// SUPER HACK: to render inline editor when an exception is thrown
// Can't use store, since store needs bodytext to be parsed, which might throw exceptions if there is a syntax error.
public
static
$report_uid
=
null
;
public
static
$report_bodytext
=
''
;
public
static
$report_pathFileName
=
''
;
public
static
$report_header
=
''
;
/**
* $this->getMessage() might give a) a simple string or b) an JSON String.
*
...
...
extension/Classes/Core/QuickFormQuery.php
View file @
1eac8e30
...
...
@@ -152,6 +152,13 @@ class QuickFormQuery {
$t3data
[
T3DATA_BODYTEXT
]
=
ReportAsFile
::
read_report_file
(
$reportPathFileNameFull
);
}
// SUPER HACK: to render inline editor when an exception is thrown
// Can't use store, since store needs bodytext to be parsed, which might throw exceptions if there is a syntax error.
\
UserReportException
::
$report_uid
=
$t3data
[
T3DATA_UID
];
\
UserReportException
::
$report_bodytext
=
$t3data
[
T3DATA_BODYTEXT
];
\
UserReportException
::
$report_header
=
t3data
[
T3DATA_HEADER
];
\
UserReportException
::
$report_pathFileName
=
$reportPathFileNameFull
;
$btp
=
new
BodytextParser
();
$t3data
[
T3DATA_BODYTEXT_RAW
]
=
$t3data
[
T3DATA_BODYTEXT
];
$t3data
[
T3DATA_BODYTEXT
]
=
$btp
->
process
(
$t3data
[
T3DATA_BODYTEXT
]);
...
...
@@ -1724,7 +1731,8 @@ class QuickFormQuery {
$beUserLoggedIn
=
$this
->
store
->
getVar
(
TYPO3_BE_USER
,
STORE_TYPO3
,
SANITIZE_ALLOW_ALNUMX
);
if
(
$beUserLoggedIn
&&
$this
->
inlineReport
)
{
$html
.
=
$this
->
buildInlineReport
();
$html
.
=
$this
->
buildInlineReport
(
$this
->
t3data
[
T3DATA_UID
],
$this
->
t3data
[
T3DATA_REPORT_PATH_FILENAME
],
$this
->
t3data
[
T3DATA_BODYTEXT_RAW
],
$this
->
t3data
[
T3DATA_HEADER
]);
}
$html
.
=
$report
->
process
(
$this
->
t3data
[
T3DATA_BODYTEXT
]);
...
...
@@ -1734,16 +1742,19 @@ class QuickFormQuery {
/**
* Constructs a form to directly edit qfq content elements inline.
*
* @param int|null $uid
* @param string $reportPathFileNameFull
* @param string $bodytext
* @param string $header
* @return string - the html code
* @throws \CodeException
* @throws \UserFormException
*/
private
function
buildInlineReport
()
{
$uid
=
$this
->
t3data
[
T3DATA_UID
];
$reportPathFileNameFull
=
$this
->
t3data
[
T3DATA_REPORT_PATH_FILENAME
];
$bodytext
=
$this
->
t3data
[
T3DATA_BODYTEXT_RAW
];
$header
=
$this
->
t3data
[
T3DATA_HEADER
];
public
static
function
buildInlineReport
(
?int
$uid
,
string
$reportPathFileNameFull
,
string
$bodytext
,
string
$header
):
string
{
if
(
$uid
===
null
)
{
return
''
;
}
$icon
=
Support
::
renderGlyphIcon
(
GLYPH_ICON_TASKS
);
$showFormJs
=
'$("#tt-content-edit-'
.
$uid
.
'").toggleClass("hidden")'
;
$toggleBtn
=
Support
::
wrapTag
(
"<a href='#' onclick='
$showFormJs
' style='float:right;'>"
,
$icon
);
...
...
extension/Classes/Core/Report/ReportAsFile.php
View file @
1eac8e30
<?php
// TODO: fix unittests run by gitlab runner.
// TODO: ?CR: QuickFormQuery.php L138: Why fallback $t3data[T3DATA_UID] = 0; and $t3data[T3DATA_BODYTEXT] = ''; ? When does this happen?
// TODO: ?CR: alle ?CR suchen und durchgehen.
//// FRONTEND EDITOR ////
// ====================//
// TODO: show frontend editor even when an exception occured during report rendering
// Solution: in rendering of exception, add the editor to the html.
// TODO: frontend edit komplett auschalten koennen (CR)
// TODO:
volle kontrolle ueber code, dass der nicht pauschal ausgeliefert wird
. (CR)
// TODO:
frontend editor wird nicht pauschal ausgeliefert, sondern nur wenn auch angezeigt
. (CR)
// TODO: zentrale konfig, ob es angezeigt wird. (sekreteaerin soll nicht sehen obwohl BE login) (CR)
// TODO: pro user option, ob gezeigt wird. (CR)
// TODO: fix unittests run by gitlab runner.
// TODO: ?CR: QuickFormQuery.php L138: Why fallback $t3data[T3DATA_UID] = 0; and $t3data[T3DATA_BODYTEXT] = ''; ? When does this happen?
// TODO: ?CR: alle ?CR suchen und durchgehen.
namespace
IMATHUZH\Qfq\Core\Report
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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