Release of v5.1.0

Add [AllowDynamicProperties] in the base view class for J5. Move the _prepareDocument  above the display call in the base view class. Remove all backward compatibility issues, so JCB will not need the [Backward Compatibility] plugin to run. Added new import powers for custom import of spreadsheets. Move the setDocument and _prepareDocument above the display in the site view and custom admin view. Update the trashhelper layout to work in Joomla 5. Add AllowDynamicProperties (Joomla 4+5) to view class to allow Custom Dynamic Get methods to work without issues. Fix Save failed issue in dynamicGet. #1148. Move all [TEXT, EDITOR, TEXTAREA] fields from [NOT NULL] to [NULL]. Add the DateHelper class and improve the date methods. Add simple SessionHelper class. Add first classes for the new import engine. Improve the [VDM Registry] to be Joomla Registry Compatible. Move all registries to the [VDM Registry] class. Fix Checked Out to be null and not 0. (#1194). Fix created_by, modified_by, checked_out fields in the compiler of the SQL. (#1194). Update all core date fields in table class. (#1188). Update created_by, modified_by, checked_out fields in table class. Implementation of the decentralized Super-Power CORE repository network. (#1190). Fix the noticeboard to display Llewellyn's Joomla Social feed. Started compiling JCB5 on Joomla 5 with PHP 8.2. Add init_defaults option for dynamic form selection setup (to int new items with default values dynamically). Update all JCB 5 tables to utf8mb4_unicode_ci collation if misaligned. Move all internal ID linking to GUID inside of JCB 5. Updated the admin-tab-fields in add-fields view. #1205. Remove Custom Import Tab from admin view. Improved the customcode and placeholder search features.
This commit is contained in:
2025-02-14 22:55:55 +02:00
parent 82922eca5a
commit 442263e387
645 changed files with 42297 additions and 18475 deletions

View File

@ -71,53 +71,162 @@ function checkPlaceholderName_server(placeholderName, ide){
}
// check where this Function is used
/**
* Checks where a given function is used by iterating through a list of numeric targets (029).
* For each target, it calls placedin_server() concurrently and updates the UI based on the responses.
*
* @param {string} placeholder - The placeholder parameter to send to the server.
* @param {string|number} ide - The identifier to send.
*/
function placedin(placeholder, ide) {
var found = false;
jQuery('#before-placedin').hide();
jQuery('#note-placedin-not').hide();
jQuery('#note-placedin-found').hide();
jQuery('#loading-placedin').show();
var targets = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v']; // if you update this, also update (below 21) & [customcode-codeUsedInHtmlNote]!
var targetNumber = 21;
var run = 0;
var placedinChecker = setInterval(function(){
var target = targets[run];
placedin_server(placeholder, ide, target).done(function(used) {
if (used.in) {
jQuery('#placedin-'+used.id).show();
jQuery('#area-'+used.id).html(used.in);
jQuery.UIkit.notify({message: used.in, timeout: 5000, status: 'success', pos: 'top-right'});
found = true;
} else {
jQuery('#placedin-'+target).hide();
}
if (run == targetNumber) {
jQuery('#loading-placedin').hide();
if (found) {
jQuery('#note-placedin-found').show();
} else {
jQuery('#note-placedin-not').show();
}
}
});
if (run == targetNumber) {
clearInterval(placedinChecker);
let found = false;
// Helper functions to show/hide elements by ID.
const hideElement = (id) => {
const el = document.getElementById(id);
if (el) {
el.style.display = 'none';
}
};
const showElement = (id) => {
const el = document.getElementById(id);
if (el) {
el.style.display = 'block';
}
};
// Hide initial UI elements.
hideElement('before-placedin');
hideElement('note-placedin-not');
hideElement('note-placedin-found');
showElement('loading-placedin');
// Create a targets array of 30 integers (0 to 29).
const targets = Array.from({ length: 30 }, (_, i) => i);
// Map each target to a promise that makes an AJAX call.
const promises = targets.map((target) => {
return placedin_server(placeholder, ide, target)
.then((used) => {
if (used && used.in) {
// Check if the element with id "placedin-{used.id}" exists.
let funcElement = document.getElementById('placedin-' + used.id);
if (!funcElement) {
// Create the main container div.
funcElement = document.createElement('div');
funcElement.id = 'placedin-' + used.id;
// Create the header element with the area name.
const header = document.createElement('h2');
header.textContent = used.area_name;
// Create the inner div element that will contain the result.
const innerDiv = document.createElement('div');
innerDiv.id = 'area-' + used.id;
// Append the header and inner div to the main element.
funcElement.appendChild(header);
funcElement.appendChild(innerDiv);
// Append this element to the container with id "placedin-targets".
const container = document.getElementById('placedin-targets');
if (container) {
container.appendChild(funcElement);
} else {
console.error(
"Container with id 'placedin-targets' not found. Appending to document.body instead."
);
}
}
// Ensure the element is visible.
showElement('placedin-' + used.id);
// Update the inner div's content with the response.
const areaEl = document.getElementById('area-' + used.id);
if (areaEl) {
areaEl.innerHTML = used.in;
}
// Notify the user using UIkit.notification if available, otherwise log to the console.
if (typeof UIkit !== 'undefined' && UIkit.notify) {
UIkit.notify({
message: used.in,
timeout: 5000,
status: 'success',
pos: 'top-right'
});
} else {
console.log('Notification:', used.in);
}
found = true;
} else {
// If no valid response, hide the element with id "placedin-{target}".
hideElement('placedin-' + target);
}
})
.catch((error) => {
console.error('Error in placedin_server for target ' + target + ':', error);
});
});
// Once all Ajax calls are completed, update the UI accordingly.
Promise.all(promises).then(() => {
hideElement('loading-placedin');
if (found) {
showElement('note-placedin-found');
} else {
showElement('note-placedin-not');
}
run++;
}, 800);
}
function placedin_server(placeholder, ide, target){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.placedin&format=json";
if(token.length > 0){
var request = token+'=1&placeholder='+placeholder+'&id='+ide+'&target='+target+'&raw=true&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
/**
* Sends an AJAX GET request to the server with the specified parameters.
* The function builds a URL with query parameters and returns a promise
* that resolves with the JSON response.
*
* @param {string} placeholder - The placeholder to send with the request.
* @param {string|number} ide - The identifier to send.
* @param {string|number} target - The target placeholder to send.
*
* @returns {Promise<Object>} - A promise that resolves to the JSON response.
*/
function placedin_server(placeholder, ide, target) {
// Check if the global variable 'token' exists and has a non-empty placeholder.
// 'token', 'functioName', and 'return_here' are assumed to be defined elsewhere in your code.
if (token && token.length > 0) {
var request =
token +
'=1&placeholder=' +
placeholder +
'&id=' +
ide +
'&target=' +
target +
'&raw=true&return_here=' +
return_here;
} else {
console.error(
'There was a issue with the placeholders passed to the [placedin_server] method and we could not make the Ajax call.'
);
return Promise.reject(new Error('Invalid token or parameters.'));
}
// Base URL for the AJAX request.
const baseUrl = `index.php?option=com_componentbuilder&task=ajax.placedin&format=json&${request}`;
// Use the Fetch API to perform a GET request.
return fetch(baseUrl, {
method: "GET",
headers: {
"Accept": "application/json"
}
}).then(response => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.json();
});
}