N°3817 - Audit and fix calls to deprecated jQuery method

This commit is contained in:
Anne-Cath
2025-08-06 19:47:57 +02:00
parent 1667f834b9
commit 5b9e0a1d4f
66 changed files with 188 additions and 211 deletions

View File

@@ -53,7 +53,7 @@ $oP->SetBreadCrumbEntry('ui-tool-universalsearch', Dict::S('Menu:UniversalSearch
//$sSearchHeaderForceDropdown
$sSearchHeaderForceDropdown = '<select id="select_class" name="baseClass" onChange="this.form.submit();">';
$sSearchHeaderForceDropdown = '<select id="select_class" name="baseClass" onChange="this.form.trigger(\'submit\');">';
$aClassLabels = array();
foreach (MetaModel::GetClasses('bizmodel, grant_by_profile') as $sCurrentClass) {
if ((MetaModel::HasCategory($sCurrentClass, 'grant_by_profile') && UserRights::IsActionAllowed($sCurrentClass, UR_ACTION_BULK_MODIFY))

View File

@@ -390,7 +390,7 @@ try
$oPage->add_ready_script(
<<<EOF
$('select[name^=field]').change( DoCheckMapping );
$('select[name^=field]').on('change', DoCheckMapping );
aDefaultKeys = new Array($sDefaultKeys);
aReadOnlyKeys = new Array($sReadOnlyKeys);
DoCheckMapping();

View File

@@ -681,7 +681,7 @@ try
$aResult['JSURLs'] = str_replace('"', '\'', $oBlock->sJSURLs);
$aResult['js'] = 'charts['.$iRefresh.'].load({json: '.str_replace('"', '\'', $oBlock->sJson).
',keys: { x: \'label\', value: [\'value\']'.
'},onclick: function (d) { var aURLs = $.parseJSON('.str_replace('"', '\'', $oBlock->sJSURLs).'); window.location.href= aURLs[d.index]; }})';
'},onclick: function (d) { var aURLs = JSON.parse('.str_replace('"', '\'', $oBlock->sJSURLs).'); window.location.href= aURLs[d.index]; }})';
break;
case 'pie':
@@ -692,7 +692,7 @@ try
$aResult['JSURLs'] = str_replace('"', '\'', $oBlock->sJSURLs);
$aResult['js'] = 'charts['.$iRefresh.'].load({columns: '.str_replace('"', '\'', $oBlock->sJSColumns).
',names: '.str_replace('"', '\'', $oBlock->sJSNames).
',onclick: function (d) { var aURLs = $.parseJSON('.str_replace('"', '\'', $oBlock->sJSURLs).'); window.location.href= aURLs[d.index]; }})';
',onclick: function (d) { var aURLs = JSON.parse('.str_replace('"', '\'', $oBlock->sJSURLs).'); window.location.href= aURLs[d.index]; }})';
break;
}
} else {
@@ -2194,7 +2194,7 @@ EOF
<<<EOF
$('#upload_button').on('change', function() {
$('#upload_status').html('<img src="{$sAppRootUrl}images/indicator.gif">');
$('#upload_form').submit();
$('#upload_form').trigger('submit');
$(this).prop('disabled', true);
});
$('.img-picker').magnificPopup({type: 'image', closeOnContentClick: true });

View File

@@ -422,14 +422,14 @@ EOF
{
$('input[name=step]').val(3);
$('#wizForm').removeAttr('onsubmit'); // No need to perform validation checks when going back
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
function CSVGoBack()
{
$('input[name=step]').val(2);
$('#wizForm').removeAttr('onsubmit'); // No need to perform validation checks when going back
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
@@ -437,7 +437,7 @@ EOF
{
$('input[name=step]').val(1);
$('#wizForm').removeAttr('onsubmit'); // No need to perform validation checks when going back
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
@@ -873,7 +873,7 @@ EOF
function GoBack()
{
$('input[name=step]').val(1);
$('#wizForm').submit();
$('#wizForm').trigger('submit');
}
var ajax_request = null;
@@ -1089,7 +1089,7 @@ EOF
);
$oPage->add_ready_script(
<<<EOF
$('#select_template_class').change( function() {
$('#select_template_class').on('change', function() {
DisplayTemplate(this.value);
});
EOF

View File

@@ -181,7 +181,7 @@ try
$oQueryForm->AddSubBlock($oQueryTextArea);
$oP->add_ready_script(<<<JS
$("#expression").select();
$("#expression").trigger('select');
$("#expression").on('keyup', function (oEvent) {
if ((oEvent.ctrlKey || oEvent.metaKey) && oEvent.key === 'Enter') {
$(this).closest('form').trigger('submit');
@@ -326,8 +326,8 @@ JS
$oUseSuggestedQueryButton->SetOnClickJsCode(
<<<JS
let \$oQueryTextarea = $('textarea[name=expression]');
\$oQueryTextarea.val($sEscapedExpression).focus();
\$oQueryTextarea.closest('form').submit();
\$oQueryTextarea.val($sEscapedExpression).trigger('focus');
\$oQueryTextarea.closest('form').trigger('submit');
JS
);
$oSyntaxErrorPanel->AddSubBlock($oUseSuggestedQueryButton);

View File

@@ -135,16 +135,16 @@ EOF
$oOpenAllButton = ButtonUIBlockFactory::MakeForAlternativePrimaryAction('Open All', '', '', false, 'lifecycleOpenAll');
$oOpenAllButton->SetOnClickJsCode(
<<<JS
$('#LifeCycleList').find('.expandable-hitarea').click();
$('#LifeCycleAttrOptList').find('.expandable-hitarea').click();
$('#LifeCycleList').find('.expandable-hitarea').trigger('click');
$('#LifeCycleAttrOptList').find('.expandable-hitarea').trigger('click');
JS
);
$oCloseAllButton = ButtonUIBlockFactory::MakeForAlternativePrimaryAction('Close All', '', '', false, 'lifecycleCloseAll');
$oCloseAllButton->SetOnClickJsCode(
<<<JS
$('#LifeCycleList').find('.collapsable-hitarea').click();
$('#LifeCycleAttrOptList').find('.collapsable-hitarea').click();
$('#LifeCycleList').find('.collapsable-hitarea').trigger('click');
$('#LifeCycleAttrOptList').find('.collapsable-hitarea').trigger('click');
JS
);

View File

@@ -55,7 +55,7 @@ try
$oP->SetBreadCrumbEntry('ui-tool-tag-admin', Dict::S('Menu:TagAdminMenu'), Dict::S('Menu:TagAdminMenu+'), '', 'fas fa-tags', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES);
$sSearchHeaderForceDropdown = '<select id="select_class" name="class" onChange="this.form.submit();">';
$sSearchHeaderForceDropdown = '<select id="select_class" name="class" onChange="this.form.trigger(\'submit\');">';
$aClassLabels = array();
foreach(MetaModel::EnumChildClasses($sBaseClass, ENUM_CHILD_CLASSES_EXCLUDETOP) as $sCurrentClass)
{