Commit aadd22b6 authored by Elias Villiger's avatar Elias Villiger
Browse files

Feature #6249 - Initial functional hardcoded subrecord DragAndDrop draft

parent 98bcedbe
......@@ -2456,12 +2456,19 @@ abstract class AbstractBuildForm {
}
$rowAttribute = Support::doAttribute('class', $rowClass);
$rowAttribute .= Support::doAttribute('title', $rowTooltip);
$rowAttribute .= Support::doAttribute('id', 'any-tag-'.$row[$nameColumnId]);
$rowAttribute .= Support::doAttribute('data-dnd-id', $row[$nameColumnId]);
$htmlBody .= Support::wrapTag("<tr $rowAttribute>", $rowHtml, true);
}
// TODO EV: Replace with generic, only if DND is ON
$subrecordId = $formElement[FE_ID];
$apiAttribute = $this->evaluate->parse( "{{ '".DND_SUBRECORD_ID."=$subrecordId' AS _data-dnd-api }}");
$attribute = Support::doAttribute('class', $formElement[FE_SUBRECORD_TABLE_CLASS]);
return Support::wrapTag("<table $attribute>", $htmlHead . Support::wrapTag('<tbody>', $htmlBody), true);
return Support::wrapTag("<table $attribute>",
$htmlHead . Support::wrapTag("<tbody class=\"qfq-dnd-sort\" $apiAttribute data-columns=\"5\">", $htmlBody), true);
}
/**
......
......@@ -1544,4 +1544,5 @@ const DND_COLUMN_ID = 'id';
const DND_COLUMN_ORD = 'ord';
const DND_COLUMN_ORD_NEW = 'ordNew';
const DND_DATA_DND_API = 'data-dnd-api';
const DND_SUBRECORD_ID = 'dnd-subrecord-id'; // Internal qualifier used to communicate with dnd api
......@@ -321,7 +321,7 @@ class QuickFormQuery {
$foundInStore = '';
// Fill STORE_FORM
if ($formMode === FORM_UPDATE || $formMode === FORM_SAVE || $formMode === FORM_DRAG_AND_DROP) {
if ($formMode === FORM_UPDATE || $formMode === FORM_SAVE) {
$fillStoreForm = new FillStoreForm();
$fillStoreForm->process($formMode);
}
......@@ -1379,8 +1379,25 @@ class QuickFormQuery {
* @throws UserReportException
*/
public function dragAndDrop() {
$json = $this->doForm(FORM_DRAG_AND_DROP);
$fillStoreForm = new FillStoreForm();
$fillStoreForm->process(FORM_DRAG_AND_DROP);
$json = "";
$dndSubrecordId = $this->store->getVar(DND_SUBRECORD_ID, STORE_SIP . STORE_TYPO3 . STORE_CLIENT . STORE_ZERO);
if ($dndSubrecordId > 0) { // Subrecord dragndrop
// TODO EV: Fill in formSpec based on dndSubrecordId
$dummyFormSpec= [
F_ORDER_INTERVAL => "1",
F_ORDER_COLUMN => "xId",
F_DRAG_AND_DROP_ORDER_SQL => $this->eval->parse("{{!SELECT gm.id AS id, gm.xId AS ord FROM gGroupMember AS gm WHERE gm.grId=8 ORDER BY gm.xId}}"),
F_TABLE_NAME => "gGroupMember"
];
$dragAndDrop = new DragAndDrop($dummyFormSpec);
$dragAndDrop->process();
} else { // User-defined dragndrop
$json = $this->doForm(FORM_DRAG_AND_DROP);
}
return $json;
}
......
......@@ -26,7 +26,7 @@ require_once(__DIR__ . '/../exceptions/DownloadException.php');
//require_once(__DIR__ . '/../Evaluate.php');
//require_once(__DIR__ . '/../helper/KeyValueStringParser.php');
//
require __DIR__ . '/../../../Resources/Private/vendor/autoload.php';
//require __DIR__ . '/../../../Resources/Private/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
......
Markdown is supported
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