mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
hotkeys for form actions (#5133)
This commit is contained in:
parent
e4b29954a4
commit
500d7eeb9f
|
@ -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 .
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user