Skip to content

Commit

Permalink
Merge branch '5.x' into feature/edit-image-sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Jan 10, 2023
2 parents f2b7576 + 66face0 commit 1b56bad
Show file tree
Hide file tree
Showing 560 changed files with 6,611 additions and 12,454 deletions.
8 changes: 3 additions & 5 deletions calendar-bundle/contao/dca/tl_calendar_events.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
'sorting' => array
(
'mode' => DataContainer::MODE_PARENT,
'fields' => array('startTime'),
'fields' => array('startTime DESC'),
'headerFields' => array('title', 'jumpTo', 'tstamp', 'protected', 'allowComments'),
'panelLayout' => 'filter;sort,search,limit',
'defaultSearchField' => 'title',
Expand Down Expand Up @@ -185,8 +185,6 @@
'default' => static fn () => BackendUser::getInstance()->id,
'search' => true,
'filter' => true,
'sorting' => true,
'flag' => DataContainer::SORT_ASC,
'inputType' => 'select',
'foreignKey' => 'tl_user.name',
'eval' => array('doNotCopy'=>true, 'chosen'=>true, 'mandatory'=>true, 'includeBlankOption'=>true, 'tl_class'=>'w50'),
Expand All @@ -204,7 +202,7 @@
'default' => time(),
'filter' => true,
'sorting' => true,
'flag' => DataContainer::SORT_MONTH_DESC,
'flag' => DataContainer::SORT_MONTH_BOTH,
'inputType' => 'text',
'eval' => array('rgxp'=>'time', 'mandatory'=>true, 'doNotCopy'=>true, 'tl_class'=>'w50'),
'load_callback' => array
Expand Down Expand Up @@ -845,7 +843,7 @@ public function getArticleAlias(DataContainer $dc)

while ($objAlias->next())
{
$arrAlias[$objAlias->parent][$objAlias->id] = $objAlias->title . ' (' . ($GLOBALS['TL_LANG']['COLS'][$objAlias->inColumn] ?: $objAlias->inColumn) . ', ID ' . $objAlias->id . ')';
$arrAlias[$objAlias->parent][$objAlias->id] = $objAlias->title . ' (' . ($GLOBALS['TL_LANG']['COLS'][$objAlias->inColumn] ?? $objAlias->inColumn) . ', ID ' . $objAlias->id . ')';
}
}

Expand Down
5 changes: 1 addition & 4 deletions calendar-bundle/contao/modules/ModuleEventReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,7 @@ protected function compile()
->enableLightbox($objEvent->fullsize)
->buildIfResourceExists();

if (null !== $figure)
{
$figure->applyLegacyTemplateData($objTemplate, null, $objEvent->floating);
}
$figure?->applyLegacyTemplateData($objTemplate, null, $objEvent->floating);
}

$objTemplate->enclosure = array();
Expand Down
2 changes: 1 addition & 1 deletion calendar-bundle/public/calendar.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 3 additions & 6 deletions comments-bundle/contao/dca/tl_comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,12 @@
'source' => array
(
'filter' => true,
'sorting' => true,
'reference' => &$GLOBALS['TL_LANG']['tl_comments'],
'sql' => "varchar(32) NOT NULL default ''"
),
'parent' => array
(
'filter' => true,
'sorting' => true,
'sql' => "int(10) unsigned NOT NULL default 0"
),
'date' => array
Expand Down Expand Up @@ -221,6 +219,7 @@
(
'toggle' => true,
'filter' => true,
'sorting' => true,
'inputType' => 'checkbox',
'eval' => array('doNotCopy'=>true),
'save_callback' => array
Expand Down Expand Up @@ -567,11 +566,9 @@ public function listComments($arrRow)
$key = ($arrRow['published'] ? 'published' : 'unpublished') . ($arrRow['addReply'] ? ' replied' : '');

return '
<div class="comment_wrap">
<div class="cte_type ' . $key . '"><a href="mailto:' . Idna::decodeEmail($arrRow['email']) . '" title="' . StringUtil::specialchars(Idna::decodeEmail($arrRow['email'])) . '">' . $arrRow['name'] . '</a>' . ($arrRow['website'] ? ' (<a href="' . $arrRow['website'] . '" title="' . StringUtil::specialchars($arrRow['website']) . '" target="_blank" rel="noreferrer noopener">' . $GLOBALS['TL_LANG']['MSC']['com_website'] . '</a>)' : '') . ' – ' . Date::parse(Config::get('datimFormat'), $arrRow['date']) . ' – IP ' . StringUtil::specialchars($arrRow['ip']) . '<br>' . $title . '</div>
<div class="limit_height mark_links' . (!Config::get('doNotCollapse') ? ' h40' : '') . '">
<div class="cte_preview limit_height' . (!Config::get('doNotCollapse') ? ' h60' : '') . '">
' . $arrRow['comment'] . '
</div>
</div>' . "\n ";
}

Expand Down Expand Up @@ -641,7 +638,7 @@ public function toggleIcon($row, $href, $label, $title, $icon, $attributes)
return Image::getHtml($icon) . ' ';
}

return '<a href="' . $this->addToUrl($href) . '" title="' . StringUtil::specialchars($title) . '" onclick="Backend.getScrollOffset();return AjaxRequest.toggleField(this,true)">' . Image::getHtml($icon, $label, 'data-icon="' . Image::getPath('visible.svg') . '" data-icon-disabled="' . Image::getPath('invisible.svg') . '"data-state="' . ($row['published'] ? 1 : 0) . '"') . '</a> ';
return '<a href="' . $this->addToUrl($href) . '" title="' . StringUtil::specialchars($title) . '" onclick="Backend.getScrollOffset();return AjaxRequest.toggleField(this,true)">' . Image::getHtml($icon, $label, 'data-icon="visible.svg" data-icon-disabled="invisible.svg" data-state="' . ($row['published'] ? 1 : 0) . '"') . '</a> ';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion comments-bundle/contao/languages/en/tl_comments.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<source>Here you can enter the reply.</source>
</trans-unit>
<trans-unit id="tl_comments.published.0">
<source>Publish comment</source>
<source>Published</source>
</trans-unit>
<trans-unit id="tl_comments.published.1">
<source>Make the comment publicly visible on the website.</source>
Expand Down
2 changes: 1 addition & 1 deletion comments-bundle/public/approved.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion comments-bundle/public/comments.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion comments-bundle/public/pending.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion comments-bundle/public/replied.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 8 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
"ausi/slug-generator": "^1.1",
"bacon/bacon-qr-code": "^2.0",
"contao-components/ace": "^1.8",
"contao-components/chosen": "^1.2",
"contao-components/chosen": "^2.0",
"contao-components/colorbox": "^1.6",
"contao-components/colorpicker": "^1.5",
"contao-components/contao": "^9.1",
"contao-components/datepicker": "^2.3",
"contao-components/datepicker": "^3.0",
"contao-components/dropzone": "^5.0.1",
"contao-components/jquery": "^3.5",
"contao-components/jquery-ui": "^1.11.4",
"contao-components/mediabox": "^1.5",
"contao-components/mootools": "^1.6.0.1",
"contao-components/simplemodal": "^2.1",
"contao-components/simplemodal": "^3.0",
"contao-components/swipe": "^2.0.3",
"contao-components/tablesort": "^4.0",
"contao-components/tablesorter": "^2.1",
Expand Down Expand Up @@ -110,6 +110,7 @@
"symfony/dependency-injection": "^5.4 || ^6.0",
"symfony/deprecation-contracts": "^2.1 || ^3.0",
"symfony/doctrine-bridge": "^5.4 || ^6.0",
"symfony/doctrine-messenger": "^5.4 || ^6.0",
"symfony/dom-crawler": "^5.4 || ^6.0",
"symfony/dotenv": "^5.4 || ^6.0",
"symfony/error-handler": "^5.4 || ^6.0",
Expand All @@ -127,6 +128,7 @@
"symfony/lock": "^5.4 || ^6.0",
"symfony/mailer": "^5.4 || ^6.0",
"symfony/maker-bundle": "^1.1",
"symfony/messenger": "^5.4 || ^6.0",
"symfony/mime": "^5.4 || ^6.0",
"symfony/monolog-bridge": "^5.4 || ^6.0",
"symfony/monolog-bundle": "^3.1",
Expand All @@ -137,6 +139,7 @@
"symfony/process": "^5.4 || ^6.0",
"symfony/property-access": "^5.4 || ^6.0",
"symfony/proxy-manager-bridge": "^5.4 || ^6.0",
"symfony/rate-limiter": "^5.4 || ^6.0",
"symfony/routing": "^5.4 || ^6.0",
"symfony/security-bundle": "^6.0.2",
"symfony/security-core": "^6.1",
Expand Down Expand Up @@ -300,11 +303,11 @@
},
"scripts": {
"all": [
"@unit-tests",
"@functional-tests",
"@rector",
"@cs-fixer",
"@service-linter",
"@unit-tests",
"@functional-tests",
"@phpstan",
"@require-checker",
"@monorepo-tools"
Expand Down
2 changes: 2 additions & 0 deletions core-bundle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ security:
provider: contao.security.backend_user_provider
user_checker: contao.security.user_checker
switch_user: true
login_throttling: ~

contao_login:
remember_me: false
Expand All @@ -92,6 +93,7 @@ security:
provider: contao.security.frontend_user_provider
user_checker: contao.security.user_checker
switch_user: false
login_throttling: ~

contao_login:
remember_me: true
Expand Down
61 changes: 61 additions & 0 deletions core-bundle/assets/ajax-form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
window.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('[data-ajax-form]').forEach(el => {
function request(form, body, callback) {
const xhr = new XMLHttpRequest();

xhr.open('POST', form.action, true);
xhr.setRequestHeader('Accept', 'text/html');
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader('X-Contao-Ajax-Form', form.querySelector('[name="FORM_SUBMIT"]').value);

form.ariaBusy = 'true';
form.dataset.ajaxForm = 'loading';

xhr.onload = () => {
form.dispatchEvent(new CustomEvent('ajax-form-onload', {
bubbles: true,
detail: { body, form, xhr },
}));

form.ariaBusy = 'false';
form.dataset.ajaxForm = '';

callback(xhr);
};

xhr.send(body || null)
}

function initForm(form) {
form.addEventListener('submit', e => {
e.preventDefault();

const formData = new FormData(form);

// Send the triggered button data as well
if (e.submitter) {
formData.append(e.submitter.name, e.submitter.value);
}

request(form, formData, xhr => {
const location = xhr.getResponseHeader('X-Ajax-Location');

// Handle the redirect header
if (location) {
window.location.href = location;
return;
}

const template = document.createElement('template');
template.innerHTML = xhr.responseText.trim();

const newForm = template.content.firstElementChild;
form.replaceWith(newForm);
initForm(newForm);
});
});
}

initForm(el);
});
});

0 comments on commit 1b56bad

Please sign in to comment.