Commit 2968dc8e authored by Elias Villiger's avatar Elias Villiger
Browse files

Feature #6255 - Draft scaffold for inline report editing

parent fef1a122
Pipeline #709 passed with stage
in 1 minute and 44 seconds
...@@ -1184,6 +1184,7 @@ const INDEX_PHP = 'index.php'; ...@@ -1184,6 +1184,7 @@ const INDEX_PHP = 'index.php';
// QuickFormQuery.php // QuickFormQuery.php
const T3DATA_BODYTEXT = 'bodytext'; const T3DATA_BODYTEXT = 'bodytext';
const T3DATA_BODYTEXT_RAW = 'bodytext-raw';
const T3DATA_UID = 'uid'; const T3DATA_UID = 'uid';
// Special Column to check for uploads // Special Column to check for uploads
......
...@@ -151,6 +151,7 @@ class QuickFormQuery { ...@@ -151,6 +151,7 @@ class QuickFormQuery {
} }
$btp = new BodytextParser(); $btp = new BodytextParser();
$t3data[T3DATA_BODYTEXT_RAW] = $t3data[T3DATA_BODYTEXT];
$t3data[T3DATA_BODYTEXT] = $btp->process($t3data[T3DATA_BODYTEXT]); $t3data[T3DATA_BODYTEXT] = $btp->process($t3data[T3DATA_BODYTEXT]);
$this->t3data = $t3data; $this->t3data = $t3data;
...@@ -1328,12 +1329,44 @@ class QuickFormQuery { ...@@ -1328,12 +1329,44 @@ class QuickFormQuery {
private function doReport() { private function doReport() {
$report = new Report($this->t3data, $this->eval, $this->phpUnit); $report = new Report($this->t3data, $this->eval, $this->phpUnit);
$html = '';
$html = $report->process($this->t3data['bodytext']); if ($this->store->getVar(TYPO3_BE_USER, STORE_TYPO3, SANITIZE_ALLOW_ALNUMX)) {
$html .= $this->doInlineReport();
}
$html .= $report->process($this->t3data[T3DATA_BODYTEXT]);
return $html; return $html;
} }
/** Constructs a form to directly edit qfq content elements inline.
*
* @return string - the html code
* @throws CodeException
* @throws UserFormException
*/
private function doInlineReport() {
$uid = $this->t3data[T3DATA_UID];
$icon = Support::wrapTag('<span class="' . GLYPH_ICON . ' ' . GLYPH_ICON_TASKS . '">', '');
$showEditBoxJs = '$("#tt-content-edit-' . $uid . '").toggleClass("hidden")';
$editBtn = Support::wrapTag("<a href='#' onclick='$showEditBoxJs' style='float:right;'>", $icon);
$saveBtnAttributes = Support::doAttribute('class', 'btn btn-default btn-block');
$saveBtnAttributes .= Support::doAttribute('id', "tt-content-save-$uid");
$saveBtn = Support::wrapTag("<button $saveBtnAttributes>", 'Save');
$ttContentCode = Support::htmlEntityEncodeDecode(MODE_ENCODE, $this->t3data[T3DATA_BODYTEXT_RAW]);
$codeBoxAttributes = Support::doAttribute('style', "width:100%; height:200px;");
$codeBoxAttributes .= Support::doAttribute('id', "tt-content-code-$uid");
$codeBox = Support::wrapTag("<textarea $codeBoxAttributes>", $ttContentCode);
$editBox = join(' ', [$saveBtn, $codeBox]);
$editBox = Support::wrapTag("<div id='tt-content-edit-$uid' class='hidden'>", $editBox);
return $editBtn . $editBox;
}
/** /**
* Save the current form. * Save the current form.
* *
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment