Commit 794aa0c0 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Link.php, Report.php, AbstractBuildForm.php, BuildFormBootstrap.php,...

Link.php, Report.php, AbstractBuildForm.php, BuildFormBootstrap.php, Constants.php: on various points replaced native string against API_DIR and newly API_DELETE_PHP.
parent 9a6f6b63
......@@ -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);
}
/**
......
......@@ -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;
......
......@@ -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';
......
......@@ -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;
......
......@@ -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.
......
......@@ -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);
}
......
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