Commit c2b39d88 authored by Marc Egger's avatar Marc Egger
Browse files

Refs #12588 revert to old pageAlias behaviour for T3 version smaller 9

parent 911a3eb0
Pipeline #5400 failed with stages
in 1 minute and 25 seconds
......@@ -25,6 +25,7 @@ use IMATHUZH\Qfq\Core\Report\Link;
use IMATHUZH\Qfq\Core\Report\Report;
use IMATHUZH\Qfq\Core\Store\Sip;
use IMATHUZH\Qfq\Core\Store\Store;
use IMATHUZH\Qfq\Core\Typo3\T3Handler;
/**
* Class AbstractBuildForm
......@@ -2268,7 +2269,8 @@ abstract class AbstractBuildForm {
$dndAttributes .= Support::doAttribute('data-columns', $numColumns);
}
$tableSorterHtmlId = $formElement[F_ID] . '-' . $formElement[FE_ID];
$x = T3Handler::useSlugsInsteadOfPageAlias() ? $formElement[F_ID] : $this->store::getVar(TYPO3_PAGE_ALIAS, STORE_TYPO3);
$tableSorterHtmlId = $x . '-' . $formElement[FE_ID];
$attribute = Support::doAttribute('class', $formElement[FE_SUBRECORD_TABLE_CLASS]);
$attribute .= Support::doAttribute('id', $tableSorterHtmlId);
......
......@@ -13,6 +13,7 @@ use IMATHUZH\Qfq\Core\Helper\Logger;
use IMATHUZH\Qfq\Core\Helper\OnArray;
use IMATHUZH\Qfq\Core\Helper\Path;
use IMATHUZH\Qfq\Core\Helper\Support;
use IMATHUZH\Qfq\Core\Typo3\T3Handler;
/**
......@@ -218,9 +219,14 @@ class BuildFormBootstrap extends AbstractBuildForm {
*/
private function buildLogForm() {
$pageSlug = $this->store::getVar(TYPO3_PAGE_SLUG, STORE_TYPO3);
if (T3Handler::useSlugsInsteadOfPageAlias()) {
$pageSlug = $this->store::getVar(TYPO3_PAGE_SLUG, STORE_TYPO3);
$baseUrl = 'p:' . $pageSlug . '?form=' . $this->formSpec[F_NAME];
} else {
$pageAlias = $this->store::getVar(TYPO3_PAGE_ALIAS, STORE_TYPO3);
$baseUrl = 'p:' . $pageAlias . '&form=' . $this->formSpec[F_NAME];
}
$baseUrl = 'p:' . $pageSlug . '?form=' . $this->formSpec[F_NAME];
$baseMisc = '|b|G:glyphicon-bell|s|c:btn btn-default navbar-btn';
$baseTooltip = '|o:Set form in debugmode and show actions from ';
......
......@@ -2033,9 +2033,9 @@ const ACTION_SLUG_MIGRATION_DO_REPLACE = 'replace'; // replace page aliases by s
const ACTION_SLUG_MIGRATION_DO_PAUSE = 'pause'; // disable the slug migration check temporarily
const ACTION_SLUG_MIGRATION_DO_RESUME = 'resume'; // resume the slug migration check
const ACTION_SLUG_MIGRATION_DO_SKIP_FOREVER = 'skipForever'; // disable the slug migration check
const QFQ_VERSION_KEY_SLUG_MIGRATION = 'pageSlugMigration';
const QFQ_VERSION_KEY_SLUG_MIGRATION_DONE = 'done';
const QFQ_VERSION_KEY_SLUG_MIGRATION_SKIP = 'skip';
const QFQ_VERSION_KEY_SLUG_MIGRATION = 'pageSlugMigration'; // written to note of Form table
const QFQ_VERSION_KEY_SLUG_MIGRATION_DONE = 'done'; // migration check passed once without occurrences found
const QFQ_VERSION_KEY_SLUG_MIGRATION_SKIP = 'skip'; // migration was skipped forever using link in exception
// tablesorter
const TABLESORTER_VIEW_SAVER = 'tablesorter-view-saver';
......
......@@ -32,6 +32,7 @@ use IMATHUZH\Qfq\Core\Helper\Support;
use IMATHUZH\Qfq\Core\Helper\Token;
use IMATHUZH\Qfq\Core\Store\Sip;
use IMATHUZH\Qfq\Core\Store\Store;
use IMATHUZH\Qfq\Core\Typo3\T3Handler;
/*
* a:AltText
......@@ -762,7 +763,8 @@ class Link {
$keyName = $this->tableVarName[$key]; // convert token to name
if ($key == TOKEN_PAGE && $value == '') {
$value = $this->store->getVar(TYPO3_PAGE_SLUG, STORE_TYPO3); // If no pageid|pagealias is defined, take current page
// If no pageid|pagealias|pageSlug is defined, take current page
$value = $this->store->getVar((T3Handler::useSlugsInsteadOfPageAlias() ? TYPO3_PAGE_SLUG : TYPO3_PAGE_ID), STORE_TYPO3);
}
$value = Token::checkForEmptyValue($key, $value);
......@@ -1572,21 +1574,33 @@ EOF;
$vars[NAME_LINK_CLASS_DEFAULT] = ''; // No idea why this is here... (Marc)
// if page is given by a numeric id then prepend 'id=' and return
if (preg_match('/^((?:id=)?)([0-9]+)((?:&.*))$/s', $value,$matches)) {
$vars[NAME_PAGE] = Support::concatUrlParam('', 'id=' . $matches[2] . $matches[3]);
return $vars;
}
if (T3Handler::useSlugsInsteadOfPageAlias()) {
// replace first '&' with '?' if there is no '?'. (for convenience in case someone writes something like 'p:{{pageSlug:T}}&foo=bar&...' )
if (!OnString::strContains($value, '?') && OnString::strContains($value, '&')) {
$value = OnString::strReplaceFirst('&', '?', $value);
}
// if page is given by a numeric id then prepend 'id=' and return
if (preg_match('/^((?:id=)?)([0-9]+)((?:&.*))$/s', $value,$matches)) {
$vars[NAME_PAGE] = Support::concatUrlParam('', 'id=' . $matches[2] . $matches[3]);
return $vars;
}
// make URL absolute by prepending host
$vars[NAME_PAGE] = Path::join($this->store->getVar(SYSTEM_BASE_URL_LANG, STORE_SYSTEM), $value);
// replace first '&' with '?' if there is no '?'. (for convenience in case someone writes something like 'p:{{pageSlug:T}}&foo=bar&...' )
if (!OnString::strContains($value, '?') && OnString::strContains($value, '&')) {
$value = OnString::strReplaceFirst('&', '?', $value);
}
return $vars;
// make URL absolute by prepending host
$vars[NAME_PAGE] = Path::join($this->store->getVar(SYSTEM_BASE_URL_LANG, STORE_SYSTEM), $value);
return $vars;
} else {
if (substr($value, 0, 3) !== 'id=') {
$value = 'id=' . $value;
}
$vars[NAME_PAGE] = Support::concatUrlParam('', $value);
// $vars[NAME_LINK_CLASS_DEFAULT] = $this->cssLinkClassInternal;
return $vars;
}
}
/**
......
......@@ -10,13 +10,13 @@ namespace IMATHUZH\Qfq\Core\Store;
use IMATHUZH\Qfq\Core\Database\Database;
use IMATHUZH\Qfq\Core\Exception\Thrower;
use IMATHUZH\Qfq\Core\Helper\HelperFile;
use IMATHUZH\Qfq\Core\Helper\KeyValueStringParser;
use IMATHUZH\Qfq\Core\Helper\Logger;
use IMATHUZH\Qfq\Core\Helper\OnArray;
use IMATHUZH\Qfq\Core\Helper\Path;
use IMATHUZH\Qfq\Core\Helper\Sanitize;
use IMATHUZH\Qfq\Core\Helper\Support;
use IMATHUZH\Qfq\Core\Typo3\T3Handler;
/*
* Stores:
......@@ -333,7 +333,6 @@ class Store {
$config[SYSTEM_QFQ_PROJECT_PATH] = Path::absoluteProject();
// Set baseUrlLang
$config[SYSTEM_BASE_URL_LANG] = $config[SYSTEM_BASE_URL];
$baseLang = T3Info::getBaseUrlLang();
$config[SYSTEM_BASE_URL_LANG] = is_null($baseLang) ? $config[SYSTEM_BASE_URL] : $baseLang;
......@@ -549,7 +548,7 @@ class Store {
$store = $useStores[0]; // current store
// Deprecation check: Throw exception if pageAlias is used
if ($key === TYPO3_PAGE_ALIAS && $store === STORE_TYPO3) {
if ($key === TYPO3_PAGE_ALIAS && $store === STORE_TYPO3 && T3Handler::useSlugsInsteadOfPageAlias()) {
Thrower::userReportException('Deprecated functionality used.', 'Tried to access the variable ' . TYPO3_PAGE_ALIAS . ' from Typo3 store. Since Typo3 version 9 page slugs are used instead of page aliases. Please use ' . TYPO3_PAGE_SLUG);
}
......
......@@ -37,10 +37,14 @@ class T3Info {
$t3vars[TYPO3_PAGE_ID] = isset($GLOBALS["TSFE"]->id) ? $GLOBALS["TSFE"]->id : '';
$t3vars[TYPO3_PAGE_SLUG] = empty($GLOBALS["TSFE"]->page["slug"]) ? '/' : $GLOBALS["TSFE"]->page["slug"];
$t3vars[TYPO3_PAGE_ALIAS] = empty($GLOBALS["TSFE"]->page["alias"]) ? $t3vars[TYPO3_PAGE_ID] : $GLOBALS["TSFE"]->page["alias"];
if (T3Handler::useSlugsInsteadOfPageAlias()) {
$t3vars[TYPO3_PAGE_SLUG] = empty($GLOBALS["TSFE"]->page["slug"]) ? '/' : $GLOBALS["TSFE"]->page["slug"];
} else {
$t3vars[TYPO3_PAGE_SLUG] = $t3vars[TYPO3_PAGE_ALIAS]; // the Form Editor report (formEditor.qfqr) depends on this for T3 older than version 9.
}
$t3vars[TYPO3_PAGE_TITLE] = isset($GLOBALS["TSFE"]->page["title"]) ? $GLOBALS["TSFE"]->page["title"] : '';
$t3vars[TYPO3_PAGE_TYPE] = isset($GLOBALS["TSFE"]->type) ? $GLOBALS["TSFE"]->type : '';
......
......@@ -16,8 +16,8 @@ dbIndex={{indexQfq:Y}}
# List of Forms: Do not show this list of forms if there is a form given by SIP.
# Table header.
sql = SELECT '<th data-sorter="false" class="filter-false">'
, CONCAT('p:{{pageSlug:T}}?form=form&') as _pagen
, CONCAT('p:{{pageSlug:T}}?form=formJson&|t:json') as _pagen
, CONCAT('p:{{pageSlug:T}}&form=form&') as _pagen
, CONCAT('p:{{pageSlug:T}}&form=formJson&|t:json') as _pagen
, '</th><th>Name'
, '</th><th>Title'
, '</th><th>Table'
......@@ -35,13 +35,13 @@ dbIndex={{indexQfq:Y}}
20 {
# All forms
sql = SELECT '<td>'
, CONCAT('p:{{pageSlug:T}}?form=form&r=', f.id) as _pagee
, CONCAT('p:{{pageSlug:T}}?form=formJson&r=', f.id, '|t:json') as _pagee
, CONCAT('p:{{pageSlug:T}}&form=form&r=', f.id) as _pagee
, CONCAT('p:{{pageSlug:T}}&form=formJson&r=', f.id, '|t:json') as _pagee
, '</td>'
, CONCAT(f.name, ' <span class="text-muted">(', f.id, ')</span>')
, QMORE(strip_tags(f.title),50)
, f.tableName
, CONCAT('p:{{pageSlug:T}}?formIdHistory=', f.id, '|s|b|t:<span class="badge">', COUNT(fsl.id), '</span>'
, CONCAT('p:{{pageSlug:T}}&formIdHistory=', f.id, '|s|b|t:<span class="badge">', COUNT(fsl.id), '</span>'
, IF(COUNT(fsl.id)=0, '|r:3','') ) as _link
, CONCAT( '<em><span title="',MIN(fsl.created), '">', DATE_FORMAT( MIN( fsl.created), '%d.%m.%Y'), '</span></em>')
, CONCAT( '<em><span title="',MAX(fsl.created), '">', DATE_FORMAT( MAX( fsl.created), '%d.%m.%Y'), '</span></em>')
......
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