diff --git a/extension/qfq/qfq/AbstractBuildForm.php b/extension/qfq/qfq/AbstractBuildForm.php index b62910269f7300611da7f16b105dcbea5e8b5fc3..ba875bf14089f884263ea52753910d6fba1c40a2 100644 --- a/extension/qfq/qfq/AbstractBuildForm.php +++ b/extension/qfq/qfq/AbstractBuildForm.php @@ -1766,7 +1766,7 @@ abstract class AbstractBuildForm { $sip = $this->store->getSipInstance(); - return $sip->queryStringToSip($queryString, $mode, API_DIR . '/delete.php'); + return $sip->queryStringToSip($queryString, $mode, API_DIR . '/' . API_DELETE_PHP); } /** diff --git a/extension/qfq/qfq/BuildFormBootstrap.php b/extension/qfq/qfq/BuildFormBootstrap.php index 6919c87c4ceed8ef158d5cf015277fe35afaa1f6..0a14ebf3d8e0a7d515e6ed0ca93e5515160a61e6 100644 --- a/extension/qfq/qfq/BuildFormBootstrap.php +++ b/extension/qfq/qfq/BuildFormBootstrap.php @@ -351,6 +351,9 @@ class BuildFormBootstrap extends AbstractBuildForm { $actionUpload = FILE_ACTION . '=' . FILE_ACTION_UPLOAD; $actionDelete = FILE_ACTION . '=' . FILE_ACTION_DELETE; + $apiDir = API_DIR; + $apiDeletePhp = API_DIR . '/' . API_DELETE_PHP; + $html .= '</form>'; // <form class="form-horizontal" ... $html .= <<<EOF <script type="text/javascript"> @@ -361,14 +364,14 @@ class BuildFormBootstrap extends AbstractBuildForm { var qfqPage = new QfqNS.QfqPage({ tabsId: '$tabId', formId: '$formId', - submitTo: 'typo3conf/ext/qfq/qfq/api/save.php', + submitTo: '$apiDir/save.php', deleteUrl: '$deleteUrl', - refreshUrl: "typo3conf/ext/qfq/qfq/api/load.php", - fileUploadTo: 'typo3conf/ext/qfq/qfq/api/file.php?$actionUpload', - fileDeleteUrl: 'typo3conf/ext/qfq/qfq/api/file.php?$actionDelete' + refreshUrl: '$apiDir/load.php', + fileUploadTo: '$apiDir/file.php?$actionUpload', + fileDeleteUrl: '$apiDir/file.php?$actionDelete' }); - var qfqRecordList = new QfqNS.QfqRecordList('typo3conf/ext/qfq/qfq/api/delete.php'); + var qfqRecordList = new QfqNS.QfqRecordList('$apiDeletePhp'); }) </script> EOF; diff --git a/extension/qfq/qfq/Constants.php b/extension/qfq/qfq/Constants.php index 35bf88e1c4b348a1abb702cb25e1863b8fa6f31c..281c15a415abf0d68011fe266fd6bfb51d4c72b8 100644 --- a/extension/qfq/qfq/Constants.php +++ b/extension/qfq/qfq/Constants.php @@ -380,6 +380,8 @@ const SQL_LOG_MODE_ALL = 'all'; const SQL_LOG_MODE_MODIFY = 'modify'; // api/save.php, api/delete.php, api/load.php +const API_DELETE_PHP = 'delete.php'; + const API_STATUS = 'status'; const API_MESSAGE = 'message'; const API_REDIRECT = 'redirect'; diff --git a/extension/qfq/qfq/report/Link.php b/extension/qfq/qfq/report/Link.php index 1c21b66ad1c462ea9b1df27812235dc66fb2818e..70f3198bbee80575ec07902fa10cf8284bc7a9c9 100644 --- a/extension/qfq/qfq/report/Link.php +++ b/extension/qfq/qfq/report/Link.php @@ -931,8 +931,8 @@ EOF; * Called by $this->callTable * * @param $vars - * @param $key * @param $value + * @return array */ private function buildUrl($vars, $value) { $vars[NAME_LINK_CLASS_DEFAULT] = $this->cssLinkClassExternal; @@ -944,8 +944,8 @@ EOF; * Called by $this->callTable * * @param $vars - * @param $key * @param $value + * @return array */ private function buildMail($vars, $value) { $vars[NAME_LINK_CLASS_DEFAULT] = $this->cssLinkClassExternal; @@ -957,8 +957,8 @@ EOF; * Called by $this->callTable * * @param $vars - * @param $key * @param $value + * @return array * @throws UserReportException */ private function buildPage($vars, $value) { @@ -978,6 +978,7 @@ EOF; * * @param $vars * @param $value + * @return array */ private function buildPicture($vars, $value) { if ($vars[NAME_ALT_TEXT] == '') { @@ -994,8 +995,8 @@ EOF; * Called by $this->callTable * * @param $vars - * @param $key * @param $value + * @return array */ private function buildBullet($vars, $value) { if ($value == '') { @@ -1017,8 +1018,8 @@ EOF; * Called by $this->callTable * * @param $vars - * @param $key * @param $value + * @return array */ private function buildCheck($vars, $value) { if ($value == '') { @@ -1040,14 +1041,13 @@ EOF; * Called by $this->callTable * * @param $vars - * @param $key - * @param $value + * @return array */ - private function buildDelete($vars, $value) { + private function buildDelete($vars) { // TODO: zur Zeit auskommentiert damit die Tests laufen. Aktuell nicht klar ob es sinnvoll ist die spezielle // 'DELETE' Funktionalitet hier an das ICON zu knuepfen. Was ist wenn das Icon benutzt werden soll OHNE die SIP Funktion? - // Vermutlich ist es sonnvoller das `_paged` das Flag setzt. Gibt es / soll es eine anderer Moeglichkeit geben, ausser _paged, + // Vermutlich ist es sonnvoller das `_paged` das Flag setzt. Gibt es / soll es eine andere Moeglichkeit geben, ausser _paged, // die Delete Funktionalitaet zu trigger? // // $vars[NAME_DELETE] = true; @@ -1056,9 +1056,6 @@ EOF; $vars[NAME_GLYPH_TITLE] = "Delete"; $vars[NAME_LINK_CLASS_DEFAULT] = NO_CLASS; - // Include Extjs library -// $this->utils->loadJSlib($this->fr_error); - return $vars; } @@ -1066,8 +1063,8 @@ EOF; * Called by $this->callTable * * @param $vars - * @param $key * @param $value + * @return array */ private function buildEdit($vars, $value) { @@ -1082,8 +1079,8 @@ EOF; * Called by $this->callTable * * @param $vars - * @param $key * @param $value + * @return array */ private function buildHelp($vars, $value) { @@ -1098,8 +1095,8 @@ EOF; * Called by $this->callTable * * @param $vars - * @param $key * @param $value + * @return array */ private function buildInfo($vars, $value) { @@ -1114,8 +1111,8 @@ EOF; * Called by $this->callTable * * @param $vars - * @param $key * @param $value + * @return array */ private function buildNew($vars, $value) { @@ -1130,8 +1127,8 @@ EOF; * Called by $this->callTable * * @param $vars - * @param $key * @param $value + * @return array */ private function buildShow($vars, $value) { @@ -1148,8 +1145,8 @@ EOF; * $vars[NAME_TOOL_TIP_JS][1]: '<span>...</span>' with the tooltip text. * * @param $vars - * @param $key * @param $value + * @return array */ private function buildToolTip($vars, $value) { static $count = 0; diff --git a/extension/qfq/qfq/report/Report.php b/extension/qfq/qfq/report/Report.php index 9c07d3e5143fa92056434581742dabb90fc02ab3..5cd97744f42fb5ee06c13af9ae90029766d27c11 100644 --- a/extension/qfq/qfq/report/Report.php +++ b/extension/qfq/qfq/report/Report.php @@ -979,7 +979,7 @@ class Report { $param[TOKEN_URL_PARAM] .= '&' . SIP_TARGET_URL . '=' . $_SERVER['REQUEST_URI']; if (!isset($param[TOKEN_URL])) { - $param[TOKEN_URL] = API_DIR . '/delete.php'; + $param[TOKEN_URL] = API_DIR . '/' . API_DELETE_PHP; if(!isset($param[TOKEN_CLASS])) { $param[TOKEN_CLASS] = TOKEN_CLASS_NONE; // no_class: By default a button will be rendered. TOKEN_URL typically implies class external. That does not match. diff --git a/extension/qfq/tests/phpunit/ReportTest.php b/extension/qfq/tests/phpunit/ReportTest.php index 5ae8c2948893c37ec9f8e1580e8ccc59a0f3e8e6..4d96ff08ae14bf8c6bff186ee15f1f1440594c87 100644 --- a/extension/qfq/tests/phpunit/ReportTest.php +++ b/extension/qfq/tests/phpunit/ReportTest.php @@ -667,10 +667,9 @@ alert.show(); return false;" EOF; - // _paged: incl. alert $result = $this->report->process("10.sql = SELECT 'p:form' AS _paged FROM Person ORDER BY id LIMIT 1"); - $this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/delete.php?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result); + $this->assertEquals('<a href="' . API_DIR . '/' . API_DELETE_PHP . '?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result); // _paged: other than defaults for the alert. $js = str_replace('Do you really want to delete the record?', 'Move to trash?', $js); @@ -681,11 +680,11 @@ EOF; $js = str_replace('modal: true', 'modal: false', $js); $js = str_replace("type: 'warning'", "type: 'success'", $js); $result = $this->report->process("10.sql = SELECT 'p:form|q:Move to trash?:success:yes:no:10:0' AS _paged FROM Person ORDER BY id LIMIT 1"); - $this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/delete.php?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result); + $this->assertEquals('<a href="' . API_DIR . '/' . API_DELETE_PHP . '?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result); $result = $this->report->process("10.sql = SELECT 'p:form|q:Move to trash?:success:yes:no:10:0|t:click me' AS _paged FROM Person ORDER BY id LIMIT 1"); - $this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/delete.php?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span> click me</a>', $result); + $this->assertEquals('<a href="' . API_DIR . '/' . API_DELETE_PHP . '?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span> click me</a>', $result); } @@ -709,7 +708,7 @@ EOF; // _paged: incl. alert $result = $this->report->process("10.sql = SELECT 'form' AS _Paged FROM Person ORDER BY id LIMIT 1"); - $this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/delete.php?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result); + $this->assertEquals('<a href="' . API_DIR . '/' . API_DELETE_PHP . '?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result); // _paged: other than defaults for the alert. $js = str_replace('Do you really want to delete the record?', 'Move to trash?', $js); @@ -720,11 +719,11 @@ EOF; $js = str_replace('modal: true', 'modal: false', $js); $js = str_replace("type: 'warning'", "type: 'success'", $js); $result = $this->report->process("10.sql = SELECT 'form|||Move to trash?:success:yes:no:10:0' AS _Paged FROM Person ORDER BY id LIMIT 1"); - $this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/delete.php?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result); + $this->assertEquals('<a href="' . API_DIR . '/' . API_DELETE_PHP . '?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span></a>', $result); $result = $this->report->process("10.sql = SELECT 'form|click me||Move to trash?:success:yes:no:10:0' AS _Paged FROM Person ORDER BY id LIMIT 1"); - $this->assertEquals('<a href="typo3conf/ext/qfq/qfq/api/delete.php?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span> click me</a>', $result); + $this->assertEquals('<a href="' . API_DIR . '/' . API_DELETE_PHP . '?id=&s=badcaffee1234" class="btn btn-default" title="Delete" ' . $js . ' ><span class="glyphicon glyphicon-trash" ></span> click me</a>', $result); }