diff --git a/extension/Documentation/UsersManual/Index.rst b/extension/Documentation/UsersManual/Index.rst index 264c31c1314be716cdb9b99fd5e2165734b4a39d..df18f6a72a01240e03e86cee39b7707e0a12e8d8 100644 --- a/extension/Documentation/UsersManual/Index.rst +++ b/extension/Documentation/UsersManual/Index.rst @@ -531,7 +531,7 @@ showButton Display or hide the button `new`, `delete`, `close`, `save`. * *new*: Creates a new record. If the form needs any special parameter via SIP or Client, hide this 'new' button - the necessary parameter are not provided. -* *delete*: This simple type of deleting a record only deletes the record itself, not any child records. +* *delete*: This either deletes the current record only, or (if defined via action form element 'before Delete' ) any specified subrecords. * *close*: Close the current form. If there are changes, a popup opens and ask to save / close / cancel. The last page from the history will be shown. * *save*: Save the form. @@ -1783,16 +1783,11 @@ Mandatory: * `table=<table name>` or `form=<form name>` * `r=<record id>` -Optional: - -* `_targetUrl=<url>` , typically, this is the $_SERVER['REQUEST_URI'] available via {{REQUEST_URI:Y}}. -* `_answerMode=html` - Example: :: - SELECT 'u:typo3conf/ext/qfq/qfq/api/delete.php|U:table=Person&r=123&_targetUrl={{REQUEST_URI:Y}}&_answerMode=html|q:Do you want delete John Doe?|s|c:n' AS _link + SELECT 'U:table=Person&r=123|q:Do you want delete John Doe?|s|c:n' AS _link It's easier to use the shortcut via special columnname `_paged`. @@ -1825,7 +1820,8 @@ The colum name is composed of the string *page* and a trailing character to spec +---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+ |_pagec |Internal link without a grafic, with question |*Please confirm!* |p:<pageId>[¶m] | +---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+ -|_paged |Internal link with delete icon (trash) |*Delete record ?* |p:<pageId>[¶m]???? | +|_paged |Internal link with delete icon (trash) |*Delete record ?* |U:form=<formname>&r=<recordid> or | +| | | |U:table=<tablename>&r=<recordid> | +---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+ |_pagee |Internal link with edit icon (pencil) |empty |p:<pageId>[¶m] | +---------------+-----------------------------------------------+-------------------------------------+----------------------------------------------+ @@ -1870,14 +1866,14 @@ Column: _paged Necessary parameter: -* table +* `table` or `form` * r **Syntax** :: - SELECT "p:delete?table=<tablename>&r=<recordId>|q:<question>|..." AS _paged, "p:delete?form=<formname>&r=<recordId>|q:<question>|..." AS _paged + SELECT "U:table=<tablename>&r=<recordId>|q:<question>|..." AS _paged, "U:form=<formname>&r=<recordId>|q:<question>|..." AS _paged .. diff --git a/extension/qfq/api/delete.php b/extension/qfq/api/delete.php index 0da62a021f81e8e9518615df3210e09921eed01c..b58e5e05c15e2c906b1c57e6e0ef9764a9be5242 100644 --- a/extension/qfq/api/delete.php +++ b/extension/qfq/api/delete.php @@ -17,7 +17,22 @@ require_once(__DIR__ . '/../qfq/exceptions/CodeException.php'); /** - * Return JSON encoded answer + * delete: success + * SIP_MODE_ANSWER: MODE_HTML + * Send header 'location' to targetUrl + * + * SUP_MODE_ANSWER: MODE_JSON + * Send AJAX answer with Status 'success' + * + * delete: failed + * SIP_MODE_ANSWER: MODE_HTML + * No forward, print error message. + * + * SUP_MODE_ANSWER: MODE_JSON + * Send AJAX answer with Status 'error' and 'error message' as JSON encoded + * + * + * JSON Format: * * status: success|error * message: <message> @@ -127,7 +142,7 @@ if ($modeAnswer === MODE_JSON) { } } -// Sent header, if given. +// Send header, if given. if ($result[MSG_HEADER] !== '') { header($result[MSG_HEADER]); } diff --git a/extension/qfq/qfq/Constants.php b/extension/qfq/qfq/Constants.php index 281c15a415abf0d68011fe266fd6bfb51d4c72b8..e67af2f42cadb1395f42b82ed3e50cb654f14f81 100644 --- a/extension/qfq/qfq/Constants.php +++ b/extension/qfq/qfq/Constants.php @@ -578,3 +578,22 @@ const SENDMAIL_IDX_X_ID = 7; const SENDMAIL_IDX_RECEIVER_CC = 8; const SENDMAIL_IDX_RECEIVER_BCC = 9; const SENDMAIL_IDX_SRC = 10; + +//Report: Column Token +const COLUMN_PPAGE = "Page"; +const COLUMN_PPAGEC = "Pagec"; +const COLUMN_PPAGED = "Paged"; +const COLUMN_PPAGEE = "Pagee"; +const COLUMN_PPAGEH = "Pageh"; +const COLUMN_PPAGEI = "Pagei"; +const COLUMN_PPAGEN = "Pagen"; +const COLUMN_PPAGES = "Pages"; + +const COLUMN_PAGE = "page"; +const COLUMN_PAGEC = "pagec"; +const COLUMN_PAGED = "paged"; +const COLUMN_PAGEE = "pagee"; +const COLUMN_PAGEH = "pageh"; +const COLUMN_PAGEI = "pagei"; +const COLUMN_PAGEN = "pagen"; +const COLUMN_PAGES = "pages"; \ No newline at end of file diff --git a/extension/qfq/qfq/report/Report.php b/extension/qfq/qfq/report/Report.php index 5cd97744f42fb5ee06c13af9ae90029766d27c11..b63b389aaefc35a0bb0f885b722314dd736ecb0a 100644 --- a/extension/qfq/qfq/report/Report.php +++ b/extension/qfq/qfq/report/Report.php @@ -575,28 +575,30 @@ class Report { $content .= $this->myExec($columnValue); break; - case "Page": - case "Pagec": - case "Paged": - case "Pagee": - case "Pageh": - case "Pagei": - case "Pagen": - case "Pages": + // Uppercase 'P' + case COLUMN_PPAGE: + case COLUMN_PPAGEC: + case COLUMN_PPAGED: + case COLUMN_PPAGEE: + case COLUMN_PPAGEH: + case COLUMN_PPAGEI: + case COLUMN_PPAGEN: + case COLUMN_PPAGES: $pageColumnName = strtolower($columnName); $tokenizedValue = $this->doFixColPosPage($columnName, $columnValue); $linkValue = $this->doPage($pageColumnName, $tokenizedValue); $content .= $this->link->renderLink($linkValue); break; - case "page": - case "pagec": - case "paged": - case "pagee": - case "pageh": - case "pagei": - case "pagen": - case "pages": + // Lowercase 'P' + case COLUMN_PAGE: + case COLUMN_PAGEC: + case COLUMN_PAGED: + case COLUMN_PAGEE: + case COLUMN_PAGEH: + case COLUMN_PAGEI: + case COLUMN_PAGEN: + case COLUMN_PAGES: $linkValue = $this->doPage($columnName, $columnValue); $content .= $this->link->renderLink($linkValue); break; @@ -804,8 +806,15 @@ class Report { $firstParam[] = ''; } - $tokenList .= $this->composeLinkPart(TOKEN_PAGE, $firstParam[0]); // -- PageID -- - $tokenList .= $this->composeLinkPart(TOKEN_URL_PARAM, $firstParam[1]); + switch ($columnName) { + case COLUMN_PPAGED: + // no pageid /pagealias given. + $tokenList .= $this->composeLinkPart(TOKEN_URL_PARAM, $allParam[0]); + break; + default: + $tokenList .= $this->composeLinkPart(TOKEN_PAGE, $firstParam[0]); // -- PageID -- + $tokenList .= $this->composeLinkPart(TOKEN_URL_PARAM, $firstParam[1]); + } if (isset($allParam[1]) && $allParam[1] !== '') { $tokenList .= $this->composeLinkPart(TOKEN_TEXT, $allParam[1]); // -- Text -- @@ -943,37 +952,10 @@ class Report { $kvp = new KeyValueStringParser(); - // Split in: [p => 'delete&r=100&_table=note&..', 'D' => ''... ], + // Split in: [p => 'r=100&table=note&..', 'D' => ''... ], $param = $kvp->parse($columnValue, ':', '|'); - // decode TOKEN_PAGE and fill TOKEN_URL_PARAM with it - if (isset($param[TOKEN_PAGE])) { - $args = $kvp->parse($param[TOKEN_PAGE], '=', '&'); - - // Remove the pageId. Instead set api/delete.php URL. - // Depending if a pageId is given by first arg (without the keyname 'id') or somewhere with 'id=': remove such position. - if (isset($args['id'])) { - unset($args['id']); - } else { - array_shift($args); - } - - // Concat already existing $param[TOKEN_URL_PARAM] with additional from TOKEN_PAE - Support::setIfNotSet($param, TOKEN_URL_PARAM); - - if(count($args)>0) { - if ($param[TOKEN_URL_PARAM] !== '') { - $param[TOKEN_URL_PARAM] .= '&'; - } - $param[TOKEN_URL_PARAM] .= $kvp->unparse($args, '=', '&'); - } - - // Delete TOKEN_PAGE - unset($param[TOKEN_PAGE]); - - } else { - throw new UserFormException('Missing parameter for _page or _Page', ERROR_MISSING_VALUE); - } + Support::setIfNotSet($param, TOKEN_URL_PARAM); $param[TOKEN_URL_PARAM] .= '&' . SIP_MODE_ANSWER . '=' . MODE_HTML; $param[TOKEN_URL_PARAM] .= '&' . SIP_TARGET_URL . '=' . $_SERVER['REQUEST_URI'];