Skip to content

Commit 5ae5221

Browse files
authored
N°6925 - Enable on any search result edition of OQL (#711)
1 parent b15ca2f commit 5ae5221

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

application/utils.inc.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,11 @@ public static function GetPopupMenuItemsBlock(iUIBlock &$oContainerBlock, $iMenu
15551555
}
15561556
$aResult[] = new JSPopupMenuItem('UI:Menu:AddToDashboard', Dict::S('UI:Menu:AddToDashboard'), "DashletCreationDlg('$sOQL', '$sContext')");
15571557
$aResult[] = new JSPopupMenuItem('UI:Menu:ShortcutList', Dict::S('UI:Menu:ShortcutList'), "ShortcutListDlg('$sOQL', '$sDataTableId', '$sContext')");
1558+
if (ApplicationMenu::IsMenuIdEnabled('RunQueriesMenu')) {
1559+
$oMenuItemPlay = new JSPopupMenuItem('UI:Menu:OpenOQL', Dict::S('UI:Edit:TestQuery'), "OpenOql('$sOQL')");
1560+
$oMenuItemPlay->SetIconClass('fas fa-play');
1561+
$aResult[] = $oMenuItemPlay;
1562+
}
15581563

15591564
break;
15601565

js/utils.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,24 @@ function DashletCreationDlg(sOQL, sContext) {
369369
return false;
370370
}
371371

372+
function OpenOql(sOQL) {
373+
sBaseUrl = GetAbsoluteUrlAppRoot() + 'pages/run_query.php';
374+
var form = document.createElement("form");
375+
form.setAttribute("method", "post");
376+
form.setAttribute("action", sBaseUrl);
377+
form.setAttribute("target", '_blank');
378+
form.setAttribute("id", 'run_query_form');
379+
var input = document.createElement('input');
380+
input.type = 'hidden';
381+
input.name = 'expression';
382+
input.value = sOQL;
383+
form.appendChild(input);
384+
document.body.appendChild(form);
385+
// form.submit() is blocked by the browser
386+
$('#run_query_form').submit();
387+
document.body.removeChild(form);
388+
}
389+
372390
function ShortcutListDlg(sOQL, sDataTableId, sContext) {
373391
var sDataTableName = 'datatable_'+sDataTableId;
374392
var oTableSettings = {

0 commit comments

Comments
 (0)