Initial commit - Typo3 11.5.41

This commit is contained in:
Matteo Gallo
2026-07-03 17:53:31 +02:00
commit 5ca4743197
6811 changed files with 568848 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
define(['jquery', 'TYPO3/CMS/Backend/Tooltip', 'TYPO3/CMS/Backend/Input/Clearable'], function ($) {
var clearables = Array.from(document.querySelectorAll('.t3js-clearable')).filter(inputElement => {
// Filter input fields being a date time picker and a color picker
return !inputElement.classList.contains('t3js-datetimepicker') && !inputElement.classList.contains('t3js-color-picker');
});
clearables.forEach(clearableField => clearableField.clearable());
$(document).ready(function () {
var form = $('#administrationForm');
if (form.data('autosubmitform') == 1) {
form.submit();
}
$('a[data-togglelink="1"]').click(function (e) {
e.preventDefault();
$('#setting-container').toggle();
});
});
});

View File

@@ -0,0 +1,17 @@
$(document).ready(function () {
$('.news').on('click', '.page-navigation a', function (e) {
var ajaxUrl = $(this).data('link');
if (ajaxUrl !== undefined && ajaxUrl !== '') {
e.preventDefault();
var container = 'news-container-' + $(this).data('container');
$.ajax({
url: ajaxUrl,
type: 'GET',
success: function (result) {
var ajaxDom = $(result).find('#' + container);
$('#' + container).replaceWith(ajaxDom);
}
});
}
});
});

View File

@@ -0,0 +1,124 @@
define([
'jquery',
'TYPO3/CMS/Backend/Notification'], function ($, Notification) {
var NewsImport = function () {
var me = this;
var extKey = 'news';
var runCounter = 0;
var jobInfo = {};
me.init = function () {
$('#jobSelector').on('change', function () {
var jobClassName = $(this).val();
// alert(jobClassName);
if (jobClassName != '0') {
me.loadJobInfo(jobClassName);
} else {
$('#job').hide();
}
})
};
me.loadJobInfo = function (jobClassName) {
var params = me.getBackendRequest('system', 'tx_news_m1', 'Import', 'jobInfo', {jobClassName: jobClassName});
$.ajax({
url: moduleUrl,
data: params,
success: function (response) {
var r = $.parseJSON(response);
if (r.totalRecordCount == 0) {
Notification.info('There are no records to be imported!');
} else {
jobInfo = r;
me.initJob(jobClassName);
}
},
error: function (response) {
var r = $.parseJSON(response.responseText);
Notification.error(r.message);
}
});
};
me.initJob = function (jobClassName) {
jobInfo['jobClassName'] = jobClassName;
$('#job').show();
$('#progressBar').width('0%').text('fo');
$('#startButton').on('click', function () {
runCounter = 0;
me.run();
});
};
me.run = function () {
var params = me.getBackendRequest('system', 'tx_news_m1', 'Import', 'runJob', {
jobClassName: jobInfo.jobClassName,
offset: runCounter * jobInfo.increaseOffsetPerRunBy
});
$.ajax({
url: moduleUrl,
data: params,
success: function (response) {
var progress = runCounter / jobInfo.runsToComplete;
var progressValue = Math.round(100 * progress) + '%';
$('#progressBar').width(progressValue).text(progressValue);
runCounter++;
if (runCounter <= jobInfo.runsToComplete) {
me.run();
} else {
$('#progressBar').text('Done!');
$('#news-import-form').hide();
$('#job').hide();
$('#news-import-done').show();
console.log('done');
runCounter = 1;
}
},
error: function (response) {
var r = $.parseJSON(response.responseText);
Notification.error(r.message);
},
done: function () {
console.log('d1');
}
});
};
me.getBackendRequest = function (mainModuleName, subModuleName, controller, action, parameters) {
var parameterPrefix = me.getParameterPrefix(mainModuleName, subModuleName);
var params = {};
parameters['controller'] = controller;
parameters['action'] = action;
$.each(parameters, function (name, value) {
params[parameterPrefix + '[' + name + ']'] = value;
});
return params;
};
me.underscoreToUpperCamelCase = function (subject) {
var matches = subject.match(/(_\w)/g);
if (matches) {
matches.each(function (m) {
subject = subject.replace(m, m.charAt(1).toUpperCase());
});
}
return subject.charAt(0).toUpperCase() + subject.substr(1);
};
me.getParameterPrefix = function (mainModuleName, subModuleName) {
return 'tx_' + extKey + '_' + mainModuleName + '_' + extKey + subModuleName.replace(/_/g, '');
};
};
$(document).ready(function () {
var importer = new NewsImport();
importer.init();
});
});

View File

@@ -0,0 +1,19 @@
define(['jquery'], function ($) {
var table = $('.news-table');
$(table).each(function() {
if ($(this).width() < 350) {
$(this).addClass('news-table-small');
}
});
$('.news-table tfoot a').click(function (e, element) {
$(this).toggleClass('open');
$('#' + $(this).data('identifier')).toggleClass('hidden');
e.preventDefault();
});
});

View File

@@ -0,0 +1,82 @@
define(['jquery', 'TYPO3/CMS/Backend/FormEngine'], function($, FormEngine) {
'use strict';
var TagSuggestWizard = {};
TagSuggestWizard.initialize = function() {
$('.news-taggable').closest('.formengine-field-item').find('.t3-form-suggest').filter(function() {
return !$(this).data('news-taggable-initialized');
}).each(function() {
$(this).data('news-taggable-initialized', true);
var autocomplete = $(this).autocomplete();
var onSelectCallback = autocomplete.options.onSelect;
var transformResultCallback = autocomplete.options.transformResult;
autocomplete.setOptions({
transformResult: function(response) {
response = transformResultCallback(response);
var $form = FormEngine.getFormElement();
var tagData = $form.data('tx_news_domain_model_tag') || {};
response.suggestions = $.map(response.suggestions, function(dataItem) {
if (typeof dataItem.data.uid == 'string' && dataItem.data.uid.indexOf('NEW') === 0) {
var key = dataItem.data.label.toLowerCase();
if (key in tagData) {
dataItem.data.uid = tagData[key];
} else {
tagData[key] = dataItem.data.uid;
}
}
return dataItem;
});
$form.data('tx_news_domain_model_tag', tagData);
return response;
},
onSelect: function(suggestion) {
if ($.isFunction(onSelectCallback)) {
onSelectCallback.call(this, suggestion);
}
var $this = $(this);
if (suggestion.data.table === 'tx_news_domain_model_tag'
&& typeof suggestion.data.uid == 'string'
&& suggestion.data.uid.indexOf('NEW') === 0
) {
var $parent = $this.parent();
var pid = (typeof suggestion.data.pid !== 'undefined') ? suggestion.data.pid : $this.data('pid');
$('<input>').attr({
type: 'hidden',
name: 'data[tx_news_domain_model_tag][' + suggestion.data.uid + '][pid]',
value: pid
}).appendTo($parent);
$('<input>').attr({
type: 'hidden',
name: 'data[tx_news_domain_model_tag][' + suggestion.data.uid + '][title]',
value: suggestion.data.label
}).appendTo($parent);
}
$this.focus();
$this.val('');
$this.autocomplete().hide();
}
})
});
};
TagSuggestWizard.reinitialize = FormEngine.reinitialize;
FormEngine.reinitialize = function() {
TagSuggestWizard.reinitialize();
if ($('.t3-form-suggest').length) {
require(['TYPO3/CMS/Backend/FormEngineSuggest'], function() {
$(function() {
TagSuggestWizard.initialize();
})
});
}
};
return TagSuggestWizard;
});