Commit 5ecaa5d8 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Sip: fixed typo.

AbstractBuildForm, BuildFormBootstrap: implemented delete record for subrecords.
formEditor.sql: show fewer columns in subrecords
parent 2e267044
......@@ -996,7 +996,8 @@ abstract class AbstractBuildForm {
if (isset($formElement[SUBRECORD_PARAMETER_FORM])) {
$showDebugInfo = $this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM);
$linkNew = Support::wrapTag('<th>', $this->createFormLink($formElement, 0, $primaryRecord, $this->symbol[SYMBOL_NEW], 'New', $showDebugInfo));
$linkNew = Support::wrapTag('<th>', $this->createFormLink($formElement, 0, $primaryRecord, Support::wrapTag('<button type="button">', $this->symbol[SYMBOL_NEW]), 'New', $showDebugInfo));
// Decode settings in subrecordOption
$flagNew = Support::findInSet(SUBRECORD_NEW, $formElement['subrecordOption']);
......@@ -1021,7 +1022,7 @@ abstract class AbstractBuildForm {
$rowHtml = '';
if ($flagEdit) {
$rowHtml .= Support::wrapTag('<td>', $this->createFormLink($formElement, $row[$nameColumnId], $primaryRecord, $this->symbol[SYMBOL_EDIT], 'Edit', $showDebugInfo));
$rowHtml .= Support::wrapTag('<td>', $this->createFormLink($formElement, $row[$nameColumnId], $primaryRecord, Support::wrapTag('<button type="button">', $this->symbol[SYMBOL_EDIT]), 'Edit', $showDebugInfo));
} elseif ($flagNew) {
$rowHtml .= Support::wrapTag('<td>', $rowHtml, false);
}
......@@ -1032,10 +1033,15 @@ abstract class AbstractBuildForm {
}
if ($flagDelete) {
$rowHtml .= Support::wrapTag('<td>', $this->createDeleteLink($targetTableName, $row['id'], $this->symbol[SYMBOL_DELETE], 'Delete', $showDebugInfo));
// $rowHtml .= Support::wrapTag('<td>', $this->createDeleteLink($targetTableName, $row['id'], $this->symbol[SYMBOL_DELETE], 'Delete', $showDebugInfo));
// $this->createDeleteLink($targetTableName, $row['id'], $this->symbol[SYMBOL_DELETE], 'Delete', $showDebugInfo)
// <button type="button" class="record-delete" data-sip={{SIP}}><span class="glyphicon glyphicon-trash"></span></button>
$s = $this->createDeleteUrl($targetTableName, $row['id'], RETURN_SIP);
$rowHtml .= Support::wrapTag('<td>', Support::wrapTag('<a>', Support::wrapTag("<button type='button' class='record-delete' data-sip='$s'>", '<span class="glyphicon glyphicon-trash"></span>')));
}
$html .= Support::wrapTag('<tr>', $rowHtml, true);
$html .= Support::wrapTag('<tr class="record">', $rowHtml, true);
}
return Support::wrapTag('<table class="table">', $html, true);
......@@ -1256,31 +1262,12 @@ abstract class AbstractBuildForm {
return $cell;
}
/**
* @param $table
* @param $recordId
* @param $symbol
* @param $toolTip
* @return string
*/
private function createDeleteLink($table, $recordId, $symbol, $toolTip, $showDebugInfo = false) {
if ($showDebugInfo) {
$toolTip .= PHP_EOL . "table = '$table'" . PHP_EOL . "id = '$recordId'";
}
$url = $this->createDeleteUrl($table, $recordId);
return Support::wrapTag('<a href="' . $url . '" title="' . $toolTip . '">', $symbol);
}
/**
* Create a link (incl. SIP) to delete the current record.
*
* @return string String: "API_DIR/delete.php?sip=...."
*/
public function createDeleteUrl($table, $recordId) {
public function createDeleteUrl($table, $recordId, $mode = RETURN_URL) {
$queryStringArray = [
SIP_TABLE => $table,
......@@ -1291,7 +1278,8 @@ abstract class AbstractBuildForm {
$sip = $this->store->getSipInstance();
return $sip->queryStringToSip($queryString, RETURN_URL, API_DIR . '/delete.php');
// return $sip->queryStringToSip($queryString, RETURN_URL, API_DIR . '/delete.php');
return $sip->queryStringToSip($queryString, $mode, API_DIR . '/delete.php');
}
/**
......@@ -1419,4 +1407,23 @@ abstract class AbstractBuildForm {
return $this->buildNativeHidden(CLIENT_SIP, $sipValue);
}
/**
* @param $table
* @param $recordId
* @param $symbol
* @param $toolTip
* @return string
*/
private function createDeleteLink($table, $recordId, $symbol, $toolTip, $showDebugInfo = false) {
if ($showDebugInfo) {
$toolTip .= PHP_EOL . "table = '$table'" . PHP_EOL . "id = '$recordId'";
}
$url = $this->createDeleteUrl($table, $recordId);
return Support::wrapTag('<a href="' . $url . '" title="' . $toolTip . '">', $symbol);
}
}
\ No newline at end of file
......@@ -37,6 +37,8 @@ class BuildFormBootstrap extends AbstractBuildForm {
if (!isset($this->formSpec['class'])) {
$this->formSpec['class'] = 'container';
}
$this->formSpec['class'] = 'none';
}
/**
......@@ -278,12 +280,14 @@ BUTTON;
QfqNS.Log.level = 0;
var qfqPage = new QfqNS.QfqPage({
tabsId: '$tabId',
formId: '$formId',
submitTo: 'typo3conf/ext/qfq/qfq/api/save.php',
deleteUrl: '$deleteUrl'
});
var qfqPage = new QfqNS.QfqPage({
tabsId: '$tabId',
formId: '$formId',
submitTo: 'typo3conf/ext/qfq/qfq/api/save.php',
deleteUrl: '$deleteUrl'
});
var qfqRecordList = new QfqNS.QfqRecordList('typo3conf/ext/qfq/qfq/api/delete.php');
})
</script>
EOF;
......@@ -315,7 +319,6 @@ EOF;
return $html;
}
public function buildRowNative($formElement, $elementHtml) {
$html = '';
......
......@@ -64,7 +64,7 @@ class Sip {
* @param string $mode Possible values: RETURN_URL|RETURN_SIP
* @return string
* * mode=RETURN_URL: return complete URL
* * mofr=RETURN_SIP: returns only the sip
* * mode=RETURN_SIP: returns only the sip
* @throws CodeException
* @throws UserException
*/
......
......@@ -161,7 +161,7 @@ VALUES
'', '', 4, ''),
(1, '', 'FormElements', 'show', 'subrecord', 'native', 500, 0, 0, '', '', '',
'{{!SELECT * FROM FormElement WHERE formId={{id:R0}}}}',
'{{!SELECT id, feIdContainer, name, label, mode, class, type, ord, size, sql1, parameter FROM FormElement WHERE formId={{id:R0}}}}',
'', 'form=formElement\ndetail=id:formId', 5, 'new,edit,delete');
#
......
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