diff --git a/src/repo/zcl_abapgit_repo.clas.abap b/src/repo/zcl_abapgit_repo.clas.abap index 0e9a0706e..9b442a95e 100644 --- a/src/repo/zcl_abapgit_repo.clas.abap +++ b/src/repo/zcl_abapgit_repo.clas.abap @@ -93,9 +93,7 @@ CLASS zcl_abapgit_repo DEFINITION zcx_abapgit_exception . METHODS is_offline RETURNING - VALUE(rv_offline) TYPE abap_bool - RAISING - zcx_abapgit_exception . + VALUE(rv_offline) TYPE abap_bool . METHODS set_files_remote IMPORTING !it_files TYPE zif_abapgit_definitions=>ty_files_tt . diff --git a/src/ui/zabapgit_js_common.w3mi.data.js b/src/ui/zabapgit_js_common.w3mi.data.js index 981c4cf53..cb3363809 100644 --- a/src/ui/zabapgit_js_common.w3mi.data.js +++ b/src/ui/zabapgit_js_common.w3mi.data.js @@ -1551,9 +1551,17 @@ function Hotkeys(oKeyMap){ } // Or a SAP event input - var sUiSapEventFormAction = this.getSapEventFormAction(action); - if (sUiSapEventFormAction) { - submitSapeventForm({}, sUiSapEventFormAction, "post"); + var sUiSapEventInputAction = this.getSapEventInputAction(action); + if (sUiSapEventInputAction) { + submitSapeventForm({}, sUiSapEventInputAction, "post"); + oEvent.preventDefault(); + return; + } + + // Or a SAP event main form + var elForm = this.getSapEventForm(action); + if (elForm) { + elForm.submit(); oEvent.preventDefault(); return; } @@ -1577,7 +1585,9 @@ Hotkeys.prototype.getAllSapEventsForSapEventName = function(sSapEvent) { document.querySelectorAll('a[href*="sapevent:' + sSapEvent + '"],' + 'a[href*="SAPEVENT:' + sSapEvent + '"],' + 'input[formaction*="sapevent:' + sSapEvent + '"],' - + 'input[formaction*="SAPEVENT:' + sSapEvent + '"]')); + + 'input[formaction*="SAPEVENT:' + sSapEvent + '"],' + + 'form[action*="sapevent:' + sSapEvent + '"] input[type="submit"].main,' + + 'form[action*="SAPEVENT:' + sSapEvent + '"] input[type="submit"].main')); }; Hotkeys.prototype.getSapEventHref = function(sSapEvent) { @@ -1595,7 +1605,7 @@ Hotkeys.prototype.getSapEventHref = function(sSapEvent) { }; -Hotkeys.prototype.getSapEventFormAction = function(sSapEvent) { +Hotkeys.prototype.getSapEventInputAction = function(sSapEvent) { return this.getAllSapEventsForSapEventName(sSapEvent) .filter(function(el){ @@ -1610,6 +1620,21 @@ Hotkeys.prototype.getSapEventFormAction = function(sSapEvent) { }; +Hotkeys.prototype.getSapEventForm = function(sSapEvent) { + + return this.getAllSapEventsForSapEventName(sSapEvent) + .filter(function(el){ + // forms + var parentForm = el.parentNode.parentNode.parentNode; + return (el.type === "submit" && parentForm.nodeName === "FORM"); + }) + .map(function(oSapEvent){ + return oSapEvent.parentNode.parentNode.parentNode; + }) + .pop(); + +}; + Hotkeys.prototype.eliminateSapEventFalsePositives = function(sapEvent){ return function(sapEventAttr) { return sapEventAttr.match(new RegExp("\\b" + sapEvent + "\\b")); diff --git a/src/ui/zcl_abapgit_gui_page_sett_remo.clas.abap b/src/ui/zcl_abapgit_gui_page_sett_remo.clas.abap index b3a01e773..e15da2fb3 100644 --- a/src/ui/zcl_abapgit_gui_page_sett_remo.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_sett_remo.clas.abap @@ -954,6 +954,18 @@ CLASS zcl_abapgit_gui_page_sett_remo IMPLEMENTATION. ls_hotkey_action-hotkey = |u|. INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. + IF mo_repo->is_offline( ) = abap_true. + ls_hotkey_action-description = |Switch to Online|. + ls_hotkey_action-action = c_event-switch. + ls_hotkey_action-hotkey = |o|. + INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. + ELSE. + ls_hotkey_action-description = |Switch to Offline|. + ls_hotkey_action-action = c_event-switch. + ls_hotkey_action-hotkey = |o|. + INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions. + ENDIF. + ENDMETHOD.