Update handler (#1428)

* update handler

* update handler

* update

* lint fixes

* update

* Update src/01/02/z2ui5_cl_core_http_get.clas.abap

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>

* update

* Update src/01/02/z2ui5_cl_core_http_get.clas.abap

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>

---------

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>
This commit is contained in:
oblomov-dev 2024-09-14 10:39:27 +02:00 committed by GitHub
parent b7b464d981
commit ae603290cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 162 additions and 1029 deletions

View File

@ -167,6 +167,7 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
mo_action->ms_next-s_set-s_view_nest2-id = id. mo_action->ms_next-s_set-s_view_nest2-id = id.
mo_action->ms_next-s_set-s_view_nest2-method_destroy = method_destroy. mo_action->ms_next-s_set-s_view_nest2-method_destroy = method_destroy.
mo_action->ms_next-s_set-s_view_nest2-method_insert = method_insert. mo_action->ms_next-s_set-s_view_nest2-method_insert = method_insert.
mo_action->ms_next-s_set-s_view_nest2-s_config = s_config.
ENDMETHOD. ENDMETHOD.
@ -191,6 +192,7 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
mo_action->ms_next-s_set-s_view_nest-id = id. mo_action->ms_next-s_set-s_view_nest-id = id.
mo_action->ms_next-s_set-s_view_nest-method_destroy = method_destroy. mo_action->ms_next-s_set-s_view_nest-method_destroy = method_destroy.
mo_action->ms_next-s_set-s_view_nest-method_insert = method_insert. mo_action->ms_next-s_set-s_view_nest-method_insert = method_insert.
mo_action->ms_next-s_set-s_view_nest-s_config = s_config.
ENDMETHOD. ENDMETHOD.
@ -214,6 +216,7 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
mo_action->ms_next-s_set-s_popover-check_destroy = abap_false. mo_action->ms_next-s_set-s_popover-check_destroy = abap_false.
mo_action->ms_next-s_set-s_popover-xml = xml. mo_action->ms_next-s_set-s_popover-xml = xml.
mo_action->ms_next-s_set-s_popover-open_by_id = by_id. mo_action->ms_next-s_set-s_popover-open_by_id = by_id.
mo_action->ms_next-s_set-s_popover-s_config = s_config.
ENDMETHOD. ENDMETHOD.
@ -236,6 +239,7 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
mo_action->ms_next-s_set-s_popup-check_destroy = abap_false. mo_action->ms_next-s_set-s_popup-check_destroy = abap_false.
mo_action->ms_next-s_set-s_popup-xml = val. mo_action->ms_next-s_set-s_popup-xml = val.
mo_action->ms_next-s_set-s_popup-s_config = s_config.
ENDMETHOD. ENDMETHOD.
@ -257,7 +261,7 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
METHOD z2ui5_if_client~view_display. METHOD z2ui5_if_client~view_display.
mo_action->ms_next-s_set-s_view-xml = val. mo_action->ms_next-s_set-s_view-xml = val.
mo_action->ms_next-s_set-s_view-t_config = t_config. mo_action->ms_next-s_set-s_view-s_config = s_config.
ENDMETHOD. ENDMETHOD.

View File

@ -6,7 +6,6 @@ CLASS z2ui5_cl_core_http_get DEFINITION
PUBLIC SECTION. PUBLIC SECTION.
DATA ms_request TYPE z2ui5_if_types=>ty_s_http_request_get. DATA ms_request TYPE z2ui5_if_types=>ty_s_http_request_get.
DATA mv_response TYPE string.
METHODS constructor METHODS constructor
IMPORTING IMPORTING
@ -17,6 +16,8 @@ CLASS z2ui5_cl_core_http_get DEFINITION
VALUE(result) TYPE string. VALUE(result) TYPE string.
METHODS get_js METHODS get_js
* IMPORTING
* cs_config TYPE z2ui5_if_types=>ty_s_http_request_get
RETURNING RETURNING
VALUE(result) TYPE string. VALUE(result) TYPE string.
@ -28,18 +29,24 @@ CLASS z2ui5_cl_core_http_get DEFINITION
METHODS get_default_config METHODS get_default_config
RETURNING RETURNING
VALUE(result) TYPE z2ui5_if_types=>ty_s_http_request_get-t_config. VALUE(result) TYPE z2ui5_if_types=>ty_s_http_request_get.
METHODS get_default_security_policy METHODS main_get_config
RETURNING RETURNING
VALUE(result) TYPE string. VALUE(result) TYPE z2ui5_if_types=>ty_s_http_request_get.
METHODS main_get_index_html
IMPORTING
cs_config TYPE z2ui5_if_types=>ty_s_http_request_get
RETURNING VALUE(result) TYPE string.
PRIVATE SECTION. PRIVATE SECTION.
ENDCLASS. ENDCLASS.
CLASS Z2UI5_CL_CORE_HTTP_GET IMPLEMENTATION. CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
METHOD constructor. METHOD constructor.
@ -51,27 +58,135 @@ CLASS Z2UI5_CL_CORE_HTTP_GET IMPLEMENTATION.
METHOD get_default_config. METHOD get_default_config.
result = VALUE #( DATA(lv_csp) = `<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval' data: ` &&
( n = `src` v = `https://sdk.openui5.org/resources/sap-ui-cachebuster/sap-ui-core.js` )
* ( n = `src` v = `https://ui5.sap.com/1.124.0/resources/sap-ui-core.js` )
( n = `data-sap-ui-theme` v = `sap_horizon` )
( n = `data-sap-ui-async` v = `true` )
( n = `data-sap-ui-bindingSyntax` v = `complex` )
( n = `data-sap-ui-frameOptions` v = `trusted` )
( n = `data-sap-ui-compatVersion` v = `edge` ) ).
ENDMETHOD.
METHOD get_default_security_policy.
result = `<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval' data: ` &&
`ui5.sap.com *.ui5.sap.com sapui5.hana.ondemand.com *.sapui5.hana.ondemand.com openui5.hana.ondemand.com *.openui5.hana.ondemand.com ` && `ui5.sap.com *.ui5.sap.com sapui5.hana.ondemand.com *.sapui5.hana.ondemand.com openui5.hana.ondemand.com *.openui5.hana.ondemand.com ` &&
`sdk.openui5.org *.sdk.openui5.org cdn.jsdelivr.net *.cdn.jsdelivr.net cdnjs.cloudflare.com *.cdnjs.cloudflare.com schemas *.schemas"/>`. `sdk.openui5.org *.sdk.openui5.org cdn.jsdelivr.net *.cdn.jsdelivr.net cdnjs.cloudflare.com *.cdnjs.cloudflare.com schemas *.schemas"/>`.
DATA(lv_style) = ` html, body, body > div, #container, #container-uiarea {` && |\n| &&
` height: 100%;` && |\n| &&
` }` && |\n| &&
` .dbg-ltr {` && |\n| &&
` direction: ltr !important;` && |\n| &&
` }`.
result = VALUE #(
t_param = VALUE #(
( n = `TITLE` v = `abap2UI5` )
( n = `STYLE` v = lv_style )
( n = `SET_SIZE_LIMIT` v = `100` )
( n = `BODY_CLASS` v = `sapUiBody sapUiSizeCompact` )
)
t_config = VALUE #(
( n = `src` v = `https://sdk.openui5.org/resources/sap-ui-cachebuster/sap-ui-core.js` )
* ( n = `src` v = `https://sdk.openui5.org/nightly/2/resources/sap-ui-core.js` )
( n = `data-sap-ui-theme` v = `sap_horizon` )
( n = `data-sap-ui-async` v = `true` )
( n = `id` v = `sap-ui-bootstrap` )
( n = `data-sap-ui-bindingSyntax` v = `complex` )
( n = `data-sap-ui-frameOptions` v = `trusted` )
( n = `data-sap-ui-compatVersion` v = `edge` ) )
content_security_policy = lv_csp ).
ENDMETHOD. ENDMETHOD.
METHOD get_js_cc_startup.
result = ` ` &&
z2ui5_cl_cc_timer=>get_js( ) &&
z2ui5_cl_cc_focus=>get_js( ) &&
z2ui5_cl_cc_title=>get_js( ) &&
z2ui5_cl_cc_lp_title=>get_js( ) &&
z2ui5_cl_cc_history=>get_js( ) &&
z2ui5_cl_cc_scrolling=>get_js( ) &&
z2ui5_cl_cc_info=>get_js( ) &&
z2ui5_cl_cc_geoloc=>get_js( ) &&
z2ui5_cl_cc_file_upl=>get_js( ) &&
z2ui5_cl_cc_multiinput=>get_js( ) &&
z2ui5_cl_cc_uitable=>get_js( ) &&
z2ui5_cl_cc_util=>get_js( ) &&
z2ui5_cl_cc_favicon=>get_js( ) &&
z2ui5_cl_cc_dirty=>get_js( ) &&
` `.
ENDMETHOD.
METHOD main_get_config.
result = get_default_config( ).
LOOP AT ms_request-t_param REFERENCE INTO DATA(lr_param).
TRY.
result-t_param[ n = lr_param->n ]-v = lr_param->v.
CATCH cx_root.
INSERT lr_param->* INTO TABLE result-t_param.
ENDTRY.
ENDLOOP.
LOOP AT ms_request-t_config REFERENCE INTO DATA(lr_option).
TRY.
result-t_config[ n = lr_option->n ]-v = lr_option->v.
CATCH cx_root.
INSERT lr_option->* INTO TABLE result-t_config.
ENDTRY.
ENDLOOP.
IF ms_request-content_security_policy IS NOT INITIAL.
result-content_security_policy = ms_request-content_security_policy.
ENDIF.
IF ms_request-custom_js IS NOT INITIAL.
result-custom_js = ms_request-custom_js.
ENDIF.
ENDMETHOD.
METHOD main_get_index_html.
result = `<!DOCTYPE html>` && |\n| &&
`<html lang="en">` && |\n| &&
`<head>` && |\n| &&
cs_config-content_security_policy && |\n| &&
` <meta charset="UTF-8">` && |\n| &&
` <meta name="viewport" content="width=device-width, initial-scale=1.0">` && |\n| &&
` <meta http-equiv="X-UA-Compatible" content="IE=edge">` && |\n| &&
| <title>{ cs_config-t_param[ n = `TITLE` ]-v }</title> \n| &&
| <style>{ cs_config-t_param[ n = `STYLE` ]-v }</style> \n| &&
` <script id="sap-ui-bootstrap"`.
LOOP AT cs_config-t_config REFERENCE INTO DATA(lr_config).
result = result && | { lr_config->n }='{ lr_config->v }'|.
ENDLOOP.
result = result &&
` ></script></head>` && |\n| &&
`<body class="sapUiBody sapUiSizeCompact" >` && |\n| &&
` <div id="content" data-handle-validation="true" ></div>` && |\n| &&
`<abc/>` && |\n|.
DATA(lv_add_js) = get_js_cc_startup( ) && cs_config-custom_js.
result = result &&
| <script> sap.z2ui5 = sap.z2ui5 \|\| \{\} ; if ( typeof z2ui5 == "undefined" ) \{ var z2ui5 = \{\}; \}; \n| &&
| { get_js( ) } \n| &&
| { lv_add_js } \n| &&
| { z2ui5_cl_cc_debug_tool=>get_js( ) } \n| &&
| sap.z2ui5.JSON_MODEL_LIMIT = { cs_config-t_param[ n = `SET_SIZE_LIMIT` ]-v };| &&
* | sap.z2ui5.NAME_TWO_WAY_MODEL = "{ z2ui5_if_core_types=>cs_ui5-two_way_model }" ;| &&
| { z2ui5_cl_cc_debug_tool=>get_js( ) } \n| &&
| </script><abc/></body></html> |.
ENDMETHOD.
METHOD main.
DATA(ls_config) = main_get_config( ).
result = main_get_index_html( ls_config ).
NEW z2ui5_cl_core_draft_srv( )->cleanup( ).
ENDMETHOD.
METHOD get_js. METHOD get_js.
DATA(lv_two_way_model) = z2ui5_if_core_types=>cs_ui5-two_way_model. DATA(lv_two_way_model) = z2ui5_if_core_types=>cs_ui5-two_way_model.
@ -566,83 +681,4 @@ CLASS Z2UI5_CL_CORE_HTTP_GET IMPLEMENTATION.
ENDMETHOD. ENDMETHOD.
METHOD get_js_cc_startup.
result = ` ` &&
z2ui5_cl_cc_timer=>get_js( ) &&
z2ui5_cl_cc_focus=>get_js( ) &&
z2ui5_cl_cc_title=>get_js( ) &&
z2ui5_cl_cc_lp_title=>get_js( ) &&
z2ui5_cl_cc_history=>get_js( ) &&
z2ui5_cl_cc_scrolling=>get_js( ) &&
z2ui5_cl_cc_info=>get_js( ) &&
z2ui5_cl_cc_geoloc=>get_js( ) &&
z2ui5_cl_cc_file_upl=>get_js( ) &&
z2ui5_cl_cc_multiinput=>get_js( ) &&
z2ui5_cl_cc_uitable=>get_js( ) &&
z2ui5_cl_cc_util=>get_js( ) &&
z2ui5_cl_cc_favicon=>get_js( ) &&
z2ui5_cl_cc_dirty=>get_js( ) &&
` `.
ENDMETHOD.
METHOD main.
DATA(lt_config) = COND #( WHEN ms_request-t_config IS INITIAL
THEN get_default_config( )
ELSE ms_request-t_config ).
DATA(lv_sec_policy) = COND #( WHEN ms_request-content_security_policy IS INITIAL
THEN get_default_security_policy( )
ELSE ms_request-content_security_policy ).
mv_response = `<!DOCTYPE html>` && |\n| &&
`<html lang="en">` && |\n| &&
`<head>` && |\n| &&
lv_sec_policy && |\n| &&
` <meta charset="UTF-8">` && |\n| &&
` <meta name="viewport" content="width=device-width, initial-scale=1.0">` && |\n| &&
` <meta http-equiv="X-UA-Compatible" content="IE=edge">` && |\n| &&
` <title>abap2UI5</title>` && |\n| &&
` <style>` && |\n| &&
` html, body, body > div, #container, #container-uiarea {` && |\n| &&
` height: 100%;` && |\n| &&
` }` && |\n| &&
` .dbg-ltr {` && |\n| &&
` direction: ltr !important;` && |\n| &&
` }` && |\n| &&
` </style> ` &&
` <script id="sap-ui-bootstrap"`.
LOOP AT lt_config REFERENCE INTO DATA(lr_config).
mv_response = mv_response && | { lr_config->n }='{ lr_config->v }'|.
ENDLOOP.
mv_response = mv_response &&
` ></script></head>` && |\n| &&
`<body class="sapUiBody sapUiSizeCompact" >` && |\n| &&
` <div id="content" data-handle-validation="true" ></div>` && |\n| &&
`<abc/>` && |\n|.
DATA(lv_add_js) = get_js_cc_startup( ) && ms_request-custom_js.
mv_response = mv_response &&
`<script> sap.z2ui5 = sap.z2ui5 || {} ; if ( typeof z2ui5 == "undefined" ) { var z2ui5 = {}; };` && |\n| &&
get_js( ) && |\n| &&
lv_add_js && |\n| &&
` sap.z2ui5.JSON_MODEL_LIMIT = ` && COND #( WHEN ms_request-json_model_limit IS NOT INITIAL THEN ms_request-json_model_limit ELSE 100 ) && `;`.
mv_response = mv_response &&
z2ui5_cl_cc_debug_tool=>get_js( ).
mv_response = mv_response && |\n| &&
`</script>` && |\n| &&
`<abc/></body></html>`.
NEW z2ui5_cl_core_draft_srv( )->cleanup( ).
result = mv_response.
ENDMETHOD.
ENDCLASS. ENDCLASS.

View File

@ -1,669 +0,0 @@
CLASS z2ui5_cl_core_http_get2 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS class_constructor.
METHODS constructor
IMPORTING
val TYPE z2ui5_if_types=>ty_s_config_index_html OPTIONAL.
METHODS main
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
CLASS-DATA cs_config_default TYPE z2ui5_if_types=>ty_s_config_index_html.
DATA ms_config_in TYPE z2ui5_if_types=>ty_s_config_index_html.
DATA mv_index_html TYPE string.
CLASS-METHODS set_default_config.
METHODS get_js
RETURNING
VALUE(result) TYPE string.
METHODS get_js_cc_startup
RETURNING
VALUE(result) TYPE string.
METHODS main_set_config
RETURNING
VALUE(result) TYPE z2ui5_if_types=>ty_s_config_index_html.
METHODS main_set_index_html
IMPORTING
cs_config TYPE z2ui5_if_types=>ty_s_config_index_html.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_core_http_get2 IMPLEMENTATION.
METHOD constructor.
me->ms_config_in = val.
ENDMETHOD.
METHOD class_constructor.
set_default_config( ).
ENDMETHOD.
METHOD set_default_config.
DATA(lv_csp) = `default-src 'self' 'unsafe-inline' 'unsafe-eval' data: ` &&
`ui5.sap.com *.ui5.sap.com sapui5.hana.ondemand.com *.sapui5.hana.ondemand.com openui5.hana.ondemand.com *.openui5.hana.ondemand.com ` &&
`sdk.openui5.org *.sdk.openui5.org cdn.jsdelivr.net *.cdn.jsdelivr.net cdnjs.cloudflare.com *.cdnjs.cloudflare.com schemas *.schemas`.
cs_config_default = VALUE #(
t_param = VALUE #(
( n = `TITLE` v = `abap2UI5` )
( n = `BODY_CLASS` v = `sapUiBody sapUiSizeCompact` )
( n = `CONTENT_SECURITY_POLICY` v = lv_csp )
)
t_option = VALUE #(
( n = `src` v = `https://sdk.openui5.org/resources/sap-ui-cachebuster/sap-ui-core.js` )
* ( n = `src` v = `https://sdk.openui5.org/nightly/2/resources/sap-ui-core.js` )
( n = `data-sap-ui-theme` v = `sap_horizon` )
( n = `data-sap-ui-async` v = `true` )
( n = `id` v = `sap-ui-bootstrap` )
( n = `data-sap-ui-bindingSyntax` v = `complex` )
( n = `data-sap-ui-frameOptions` v = `trusted` )
( n = `data-sap-ui-compatVersion` v = `edge` )
) ).
ENDMETHOD.
METHOD main_set_config.
result = cs_config_default.
LOOP AT ms_config_in-t_param REFERENCE INTO DATA(lr_param).
TRY.
result-t_param[ n = lr_param->n ]-v = lr_param->v.
CATCH cx_root.
INSERT lr_param->* INTO TABLE result-t_param.
ENDTRY.
ENDLOOP.
LOOP AT ms_config_in-t_option REFERENCE INTO DATA(lr_option).
TRY.
result-t_option[ n = lr_option->n ]-v = lr_option->v.
CATCH cx_root.
INSERT lr_option->* INTO TABLE result-t_option.
ENDTRY.
ENDLOOP.
ENDMETHOD.
METHOD get_js_cc_startup.
result = ` ` &&
z2ui5_cl_cc_timer=>get_js( ) &&
z2ui5_cl_cc_focus=>get_js( ) &&
z2ui5_cl_cc_title=>get_js( ) &&
z2ui5_cl_cc_lp_title=>get_js( ) &&
z2ui5_cl_cc_history=>get_js( ) &&
z2ui5_cl_cc_scrolling=>get_js( ) &&
z2ui5_cl_cc_info=>get_js( ) &&
z2ui5_cl_cc_geoloc=>get_js( ) &&
z2ui5_cl_cc_file_upl=>get_js( ) &&
z2ui5_cl_cc_multiinput=>get_js( ) &&
z2ui5_cl_cc_uitable=>get_js( ) &&
z2ui5_cl_cc_util=>get_js( ) &&
z2ui5_cl_cc_favicon=>get_js( ) &&
z2ui5_cl_cc_dirty=>get_js( ) &&
` `.
ENDMETHOD.
METHOD main.
DATA(ls_config) = main_set_config( ).
main_set_index_html( ls_config ).
result = mv_index_html.
NEW z2ui5_cl_core_draft_srv( )->cleanup( ).
ENDMETHOD.
METHOD main_set_index_html.
mv_index_html = `<!DOCTYPE html>` && |\n| &&
`<head>` && |\n| &&
| <meta http-equiv="Content-Security-Policy" content="{ cs_config-t_param[ n = `CONTENT_SECURITY_POLICY` ]-v }"/>\n| &&
` <meta charset="UTF-8">` && |\n| &&
` <meta name="viewport" content="width=device-width, initial-scale=1.0">` && |\n| &&
| <title>{ cs_config-t_param[ n = `TITLE` ]-v }</title> \n| &&
` <script `.
LOOP AT cs_config-t_option REFERENCE INTO DATA(lr_config).
mv_index_html = mv_index_html && | { lr_config->n }='{ lr_config->v }'|.
ENDLOOP.
mv_index_html = mv_index_html &&
| ></script></head> \n| &&
| <body class="{ cs_config-t_param[ n = 'BODY_CLASS' ]-v }" id="content" > \n| &&
|<body class="sapUiBody" id="content" > \n| &&
| <div data-sap-ui-component data-height="100%" data-id="container" ></div> \n| &&
|<abc/> \n|.
DATA(lv_add_js) = get_js_cc_startup( ) && ms_config_in-add_js.
mv_index_html = mv_index_html &&
| <script> sap.z2ui5 = sap.z2ui5 \|\| \{\} ; if ( typeof z2ui5 == "undefined" ) \{ var z2ui5 = \{\}; \}; \n| &&
| { get_js( ) } \n| &&
| { lv_add_js } \n| &&
| { z2ui5_cl_cc_debug_tool=>get_js( ) } \n| &&
| </script><abc/></body></html> |.
ENDMETHOD.
METHOD get_js.
DATA(lv_two_way_model) = z2ui5_if_core_types=>cs_ui5-two_way_model.
result = ` if (!z2ui5.Controller) { ` &&
`sap.ui.define("z2ui5/Controller", ["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/model/json/JSONModel", "sap/ui/core/BusyIndicator", "sap/m/MessageBox", "sap/m/MessageToast", "sap/ui/core/Fragment", "sap/m/BusyDialog` &&
`", "sap/ui/VersionInfo" ], function(Control` &&
`ler, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment, mBusyDialog, VersionInfo ) {` && |\n| &&
` "use strict";` && |\n| &&
` return Controller = Controller.extend("z2ui5.Controller", {` && |\n| &&
` async onAfterRendering() {` && |\n| &&
` try{` && |\n| &&
` if (!sap.z2ui5.oResponse.PARAMS) {` && |\n| &&
` BusyIndicator.hide();` && |\n| &&
` sap.z2ui5.isBusy = false;` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` const {S_POPUP, S_VIEW_NEST, S_VIEW_NEST2, S_POPOVER} = sap.z2ui5.oResponse.PARAMS;` && |\n| &&
` if (S_POPUP?.CHECK_DESTROY) {` && |\n| &&
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
` }` && |\n| &&
` if (S_POPOVER?.CHECK_DESTROY) {` && |\n| &&
` sap.z2ui5.oController.PopoverDestroy();` && |\n| &&
` }` && |\n| &&
` if (S_POPUP?.XML) {` && |\n| &&
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
` await this.displayFragment(S_POPUP.XML, 'oViewPopup');` && |\n| &&
` }` && |\n| &&
` if (!sap.z2ui5.checkNestAfter) {` && |\n| &&
` if (S_VIEW_NEST?.XML) {` && |\n| &&
` sap.z2ui5.oController.NestViewDestroy();` && |\n| &&
` await this.displayNestedView(S_VIEW_NEST.XML, 'oViewNest', 'S_VIEW_NEST');` && |\n| &&
` sap.z2ui5.checkNestAfter = true;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` if (!sap.z2ui5.checkNestAfter2) {` && |\n| &&
` if (S_VIEW_NEST2?.XML) {` && |\n| &&
` sap.z2ui5.oController.NestViewDestroy2();` && |\n| &&
` await this.displayNestedView2(S_VIEW_NEST2.XML, 'oViewNest2', 'S_VIEW_NEST2');` && |\n| &&
` sap.z2ui5.checkNestAfter2 = true;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` if (S_POPOVER?.XML) {` && |\n| &&
` await this.displayPopover(S_POPOVER.XML, 'oViewPopover', S_POPOVER.OPEN_BY_ID);` && |\n| &&
` }` && |\n| &&
` BusyIndicator.hide();` && |\n| &&
` sap.z2ui5.isBusy = false;` && |\n| &&
` sap.z2ui5.onAfterRendering.forEach(item=>{` && |\n| &&
` if (item !== undefined) {` && |\n| &&
` item();` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` )` && |\n| &&
` }catch(e){BusyIndicator.hide(); sap.z2ui5.isBusy = false; MessageBox.error( e.toLocaleString() , { title : "Unexpected Error Occured - App Terminated" , actions : [ ] , onClose : () => { new mBusyDialog({ text : "Please Restart t` &&
`he App" }).open(); } } ) }` && |\n| &&
` },` && |\n| &&
|\n| &&
` async displayFragment(xml, viewProp) {` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` const oFragment = await Fragment.load({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerPopup,` && |\n| &&
` id: "popupId"` && |\n| &&
` });` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oFragment.setModel(oview_model);` && |\n| &&
` sap.z2ui5[viewProp] = oFragment;` && |\n| &&
` sap.z2ui5[viewProp].Fragment = Fragment;` && |\n| &&
` oFragment.open();` && |\n| &&
` },` && |\n| &&
` async displayPopover(xml, viewProp, openById) {` && |\n| &&
` // let sapUiCore = sap.ui.require('sap/ui/core/Core');` && |\n| &&
` sap.ui.require(["sap/ui/core/Element"], async function(Element) { ` &&
` ` &&
` ` && |\n| &&
` const oFragment = await Fragment.load({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerPopover,` && |\n| &&
` id: "popoverId"` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oFragment.setModel(oview_model);` && |\n| &&
` sap.z2ui5[viewProp] = oFragment;` && |\n| &&
` sap.z2ui5[viewProp].Fragment = Fragment;` && |\n| &&
` let oControl = {};` && |\n| &&
` if( sap.z2ui5.oView?.byId(openById) ) {` && |\n| &&
` oControl = sap.z2ui5.oView.byId(openById);` && |\n| &&
` } else if ( sap.z2ui5.oViewPopup?.Fragment.byId('popupId',openById) ) {` && |\n| &&
` oControl = sap.z2ui5.oViewPopup.Fragment.byId('popupId',openById);` && |\n| &&
` } else if ( sap.z2ui5.oViewNest?.byId(openById) ) {` && |\n| &&
` oControl = sap.z2ui5.oViewNest.byId(openById);` && |\n| &&
` } else if ( sap.z2ui5.oViewNest2?.byId(openById) ) {` && |\n| &&
` oControl = sap.z2ui5.oViewNest2.byId(openById);` && |\n| &&
` } else {` && |\n| &&
` if(sapUiCore.byId(openById)) {` && |\n| &&
` // oControl = sapUiCore.byId(openById);` && |\n| &&
` oControl = Element.getElementById(openById);` && |\n| &&
` } else {` && |\n| &&
` oControl = null;` && |\n| &&
` };` && |\n| &&
` }` && |\n| &&
` oFragment.openBy(oControl);` && |\n| &&
` }); },` && |\n| &&
` async displayNestedView(xml, viewProp, viewNestId) {` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` const oView = await XMLView.create({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerNest,` && |\n| &&
` preprocessors: { xml: { models: { template: oview_model } } }` && |\n| &&
` });` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(oview_model);` && |\n| &&
` let oParent = sap.z2ui5.oView.byId(sap.z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
` if (oParent) {` && |\n| &&
` try {` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
` } catch {}` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
` }` && |\n| &&
` sap.z2ui5[viewProp] = oView;` && |\n| &&
` },` && |\n| &&
` async displayNestedView2(xml, viewProp, viewNestId) {` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` const oView = await XMLView.create({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerNest2,` && |\n| &&
` preprocessors: { xml: { models: { template: oview_model } } }` && |\n| &&
` });` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(oview_model);` && |\n| &&
` let oParent = sap.z2ui5.oView.byId(sap.z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
` if (oParent) {` && |\n| &&
` try {` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
` } catch {}` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
` }` && |\n| &&
` sap.z2ui5[viewProp] = oView;` && |\n| &&
` },` && |\n| &&
` PopupDestroy() {` && |\n| &&
` if (!sap.z2ui5.oViewPopup) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.oViewPopup.close) {` && |\n| &&
` try {` && |\n| &&
` sap.z2ui5.oViewPopup.close();` && |\n| &&
` } catch {}` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewPopup.destroy();` && |\n| &&
` },` && |\n| &&
` PopoverDestroy() {` && |\n| &&
` if (!sap.z2ui5.oViewPopover) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.oViewPopover.close) {` && |\n| &&
` try {` && |\n| &&
` sap.z2ui5.oViewPopover.close();` && |\n| &&
` } catch {}` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewPopover.destroy();` && |\n| &&
` },` && |\n| &&
` NestViewDestroy() {` && |\n| &&
` if (!sap.z2ui5.oViewNest) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewNest.destroy();` && |\n| &&
` },` && |\n| &&
` NestViewDestroy2() {` && |\n| &&
` if (!sap.z2ui5.oViewNest2) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewNest2.destroy();` && |\n| &&
` },` && |\n| &&
` ViewDestroy() {` && |\n| &&
` if (!sap.z2ui5.oView) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oView.destroy();` && |\n| &&
` },` && |\n| &&
` eF(...args) {` && |\n| &&
` sap.z2ui5.onBeforeEventFrontend.forEach(item => {` && |\n| &&
` if (item !== undefined) {` && |\n| &&
` item(args);` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` )` && |\n| &&
` let oCrossAppNavigator;` && |\n| &&
` switch (args[0]) {` && |\n| &&
` case 'DOWNLOAD_B64_FILE':` && |\n| &&
` var a = document.createElement("a");` && |\n| &&
` a.href = args[1];` && |\n| &&
` a.download = args[2];` && |\n| &&
` a.click();` && |\n| &&
` break;` && |\n| &&
` case 'CROSS_APP_NAV_TO_PREV_APP':` && |\n| &&
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
` oCrossAppNavigator.backToPreviousApp();` && |\n| &&
` break;` && |\n| &&
` case 'CROSS_APP_NAV_TO_EXT':` && |\n| &&
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
` const hash = (oCrossAppNavigator.hrefForExternal({` && |\n| &&
` target: args[1],` && |\n| &&
` params: args[2]` && |\n| &&
` })) || "";` && |\n| &&
` if (args[3] === 'EXT') {` && |\n| &&
` let url = window.location.href.split('#')[0] + hash;` && |\n| &&
` sap.m.URLHelper.redirect(url, true);` && |\n| &&
` } else {` && |\n| &&
` oCrossAppNavigator.toExternal({` && |\n| &&
` target: {` && |\n| &&
` shellHash: hash` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` break;` && |\n| &&
` case 'LOCATION_RELOAD':` && |\n| &&
` window.location = args[1];` && |\n| &&
` break;` && |\n| &&
` case 'OPEN_NEW_TAB':` && |\n| &&
` window.open(args[1], '_blank');` && |\n| &&
` break;` && |\n| &&
` case 'POPUP_CLOSE':` && |\n| &&
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
` break;` && |\n| &&
` case 'POPOVER_CLOSE':` && |\n| &&
` sap.z2ui5.oController.PopoverDestroy();` && |\n| &&
` break;` && |\n| &&
` case 'NAV_CONTAINER_TO':` && |\n| &&
` var navCon = sap.z2ui5.oView.byId(args[1]);` && |\n| &&
` var navConTo = sap.z2ui5.oView.byId(args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` case 'NEST_NAV_CONTAINER_TO':` && |\n| &&
` navCon = sap.z2ui5.oViewNest.byId(args[1]);` && |\n| &&
` navConTo = sap.z2ui5.oViewNest.byId(args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` case 'NEST2_NAV_CONTAINER_TO':` && |\n| &&
` navCon = sap.z2ui5.oViewNest2.byId(args[1]);` && |\n| &&
` navConTo = sap.z2ui5.oViewNest2.byId(args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` case 'POPUP_NAV_CONTAINER_TO':` && |\n| &&
` navCon = Fragment.byId("popupId",args[1]);` && |\n| &&
` navConTo = Fragment.byId("popupId",args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` eB(...args) {` && |\n| &&
` if (!window.navigator.onLine) {` && |\n| &&
` MessageBox.alert('No internet connection! Please reconnect to the server and try again.');` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.isBusy == true) {` && |\n| &&
` if (!args[0][2]) { ` && |\n| &&
` let oBusyDialog = new mBusyDialog();` && |\n| &&
` oBusyDialog.open();` && |\n| &&
` setTimeout( (oBusyDialog) => { oBusyDialog.close() } , 100 , oBusyDialog );` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.isBusy = true;` && |\n| &&
` BusyIndicator.show();` && |\n| &&
` sap.z2ui5.oBody = {};` && |\n| &&
` if ( args[0][3] ) {` && |\n| &&
` sap.z2ui5.oBody.` && lv_two_way_model && ` = sap.z2ui5.oView.getModel().getData().` && lv_two_way_model && `;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
` }` && |\n| &&
` else if ( sap.z2ui5.oController == this ) {` && |\n| &&
` sap.z2ui5.oBody.` && lv_two_way_model && ` = sap.z2ui5.oView.getModel().getData().` && lv_two_way_model && `;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
` }else if ` && |\n| &&
` ( sap.z2ui5.oControllerPopup == this ) {` && |\n| &&
` if (sap.z2ui5.oViewPopup){` && |\n| &&
` sap.z2ui5.oBody.` && lv_two_way_model && ` = sap.z2ui5.oViewPopup.getModel().getData().` && lv_two_way_model && `;` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
` }else if ( ` && |\n| &&
` sap.z2ui5.oControllerPopover == this ) {` && |\n| &&
` sap.z2ui5.oBody.` && lv_two_way_model && ` = sap.z2ui5.oViewPopover.getModel().getData().` && lv_two_way_model && `;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
` }else if ( ` && |\n| &&
` sap.z2ui5.oControllerNest == this ) {` && |\n| &&
` sap.z2ui5.oBody.` && lv_two_way_model && ` = sap.z2ui5.oViewNest.getModel().getData().` && lv_two_way_model && `;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'NEST';` && |\n| &&
` }else if (` && |\n| &&
` sap.z2ui5.oControllerNest2 == this ) {` && |\n| &&
` sap.z2ui5.oBody.` && lv_two_way_model && ` = sap.z2ui5.oViewNest2.getModel().getData().` && lv_two_way_model && `;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'NEST2';` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.onBeforeRoundtrip.forEach(item=>{` && |\n| &&
` if (item !== undefined) {` && |\n| &&
` item();` && |\n| &&
` }})` && |\n| &&
` if (args[0][1]) {` && |\n| &&
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oBody.ID = sap.z2ui5.oResponse.ID;` && |\n| &&
` sap.z2ui5.oBody.ARGUMENTS = args;` && |\n| &&
` sap.z2ui5.oBody.ARGUMENTS.forEach( ( item , i ) => { ` && |\n| &&
` if ( i == 0 ) { return; } if ( typeof item === 'object' ){ ` && |\n| &&
` sap.z2ui5.oBody.ARGUMENTS[ i ] = JSON.stringify( item ); ` && |\n| &&
` } ` && |\n| &&
` }); ` && |\n| &&
` sap.z2ui5.oResponseOld = sap.z2ui5.oResponse;` && |\n| &&
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
` },` && |\n| &&
` responseError(response) {` && |\n| &&
` document.write(response);` && |\n| &&
` },` && |\n| &&
` updateModelIfRequired(paramKey, oView) {` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS == undefined) { return; }` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS[paramKey]?.CHECK_UPDATE_MODEL) {` && |\n| &&
` let model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` if (oView) { oView.setModel(model); }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` async responseSuccess(response) {` && |\n| &&
` try{` && |\n| &&
` sap.z2ui5.oResponse = response;` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS?.S_VIEW?.CHECK_DESTROY) {` && |\n| &&
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
` };` && |\n| &&
` if(sap.z2ui5.oResponse.PARAMS?.S_FOLLOW_UP_ACTION?.CUSTOM_JS) {` && |\n| &&
` setTimeout(() => {` && |\n| &&
` let mParams = sap.z2ui5.oResponse?.PARAMS.S_FOLLOW_UP_ACTION.CUSTOM_JS.split("'");` && |\n| &&
` let mParamsEF = mParams.filter((val, index) => index % 2)` && |\n| &&
` if(mParamsEF.length) {` && |\n| &&
` sap.z2ui5.oController.eF.apply( undefined , mParamsEF);` && |\n| &&
` } else {` && |\n| &&
` Function("return " + mParams[0])();` && |\n| &&
` }` && |\n| &&
` },100);` && |\n| &&
` };` && |\n| &&
|\n| &&
` sap.z2ui5.oController.showMessage('S_MSG_TOAST', sap.z2ui5.oResponse.PARAMS);` && |\n| &&
` sap.z2ui5.oController.showMessage('S_MSG_BOX', sap.z2ui5.oResponse.PARAMS);` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS?.S_VIEW?.XML) { if ( sap.z2ui5.oResponse.PARAMS?.S_VIEW?.XML !== '') {` && |\n| &&
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
` await sap.z2ui5.oController.displayView(sap.z2ui5.oResponse.PARAMS.S_VIEW.XML, sap.z2ui5.oResponse.OVIEWMODEL, sap.z2ui5.oResponse.PARAMS.S_VIEW.T_CONFIG );` && |\n| &&
` return; } } ` && |\n| &&
` this.updateModelIfRequired('S_VIEW', sap.z2ui5.oView);` && |\n| &&
` this.updateModelIfRequired('S_VIEW_NEST', sap.z2ui5.oViewNest);` && |\n| &&
` this.updateModelIfRequired('S_VIEW_NEST2', sap.z2ui5.oViewNest2);` && |\n| &&
` this.updateModelIfRequired('S_POPUP', sap.z2ui5.oViewPopup);` && |\n| &&
` this.updateModelIfRequired('S_POPOVER', sap.z2ui5.oViewPopover);` && |\n| &&
` sap.z2ui5.oController.onAfterRendering();` && |\n| &&
` }catch(e){BusyIndicator.hide(); if(e.message.includes("openui5")) { if(e.message.includes("script load error")) { sap.z2ui5.oController.checkSDKcompatibility(e) } } else { ` && |\n| &&
` MessageBox.error(e.toLocaleString()); } }` && |\n| &&
` },` && |\n| &&
` async checkSDKcompatibility(err) {` && |\n| &&
` let oCurrentVersionInfo = await VersionInfo.load();` && |\n| &&
` var ui5_sdk = oCurrentVersionInfo.gav.includes('com.sap.ui5') ? true : false;` && |\n| &&
` if(!ui5_sdk) {` && |\n| &&
` if(err) {` && |\n| &&
` MessageBox.error("openui5 SDK is loaded, module: " + err._modules + " is not availabe in openui5" );` && |\n| &&
` return;` && |\n| &&
` };` && |\n| &&
` };` && |\n| &&
` MessageBox.error(err.toLocaleString());` && |\n| &&
` },` && |\n| &&
` showMessage(msgType, params) {` && |\n| &&
` if (params == undefined) { return; }` && |\n| &&
` if (params[msgType]?.TEXT !== undefined) {` && |\n| &&
` if (msgType === 'S_MSG_TOAST') {` && |\n| &&
` MessageToast.show(params[msgType].TEXT,{duration: params[msgType].DURATION ? parseInt(params[msgType].DURATION) : 3000 ,` && |\n| &&
` width: params[msgType].WIDTH ? params[msgType].WIDTH : '15em' ,` && |\n| &&
` onClose: params[msgType].ONCLOSE ? params[msgType].ONCLOSE : null ,` && |\n| &&
` autoClose: params[msgType].AUTOCLOSE ? true : false ,` && |\n| &&
` animationTimingFunction: params[msgType].ANIMATIONTIMINGFUNCTION ? params[msgType].ANIMATIONTIMINGFUNCTION : 'ease' ,` && |\n| &&
` animationDuration: params[msgType].ANIMATIONDURATION ? parseInt(params[msgType].ANIMATIONDURATION) : 1000 ,` && |\n| &&
` closeonBrowserNavigation: params[msgType].CLOSEONBROWSERNAVIGATION ? true : false` && |\n| &&
` });` && |\n| &&
` if(params[msgType].CLASS) {` && |\n| &&
` let mtoast = {};` && |\n| &&
` mtoast = document.getElementsByClassName("sapMMessageToast")[0];` && |\n| &&
` if(mtoast) { mtoast.classList.add(params[msgType].CLASS); }` && |\n| &&
` };` && |\n| &&
` } else if (msgType === 'S_MSG_BOX') {` && |\n| &&
` if (params[msgType].TYPE) {` && |\n| &&
` MessageBox[params[msgType].TYPE](params[msgType].TEXT);` && |\n| &&
` } else {` && |\n| &&
` MessageBox.show(params[msgType].TEXT,{styleClass:params[msgType].STYLECLASS ? params[msgType].STYLECLASS : '',` && |\n| &&
` title: params[msgType].TITLE ? params[msgType].TITLE : '',` && |\n| &&
` onClose: params[msgType].ONCLOSE ? Function("sAction", "return " + params[msgType].ONCLOSE) : null,` && |\n| &&
` actions: params[msgType].ACTIONS ? params[msgType].ACTIONS : 'OK',` && |\n| &&
` emphasizedAction: params[msgType].EMPHASIZEDACTION ? params[msgType].EMPHASIZEDACTION : 'OK',` && |\n| &&
` initialFocus: params[msgType].INITIALFOCUS ? params[msgType].INITIALFOCUS : null,` && |\n| &&
` textDirection: params[msgType].TEXTDIRECTION ? params[msgType].TEXTDIRECTION : 'Inherit',` && |\n| &&
` icon: params[msgType].ICON ? params[msgType].ICON : 'NONE' ,` && |\n| &&
` details: params[msgType].DETAILS ? params[msgType].DETAILS : '',` && |\n| &&
` closeOnNavigation: params[msgType].CLOSEONNAVIGATION ? true : false` && |\n| &&
` }` && |\n| &&
` )` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` async displayView(xml, viewModel , aConfig ) {` && |\n| &&
` let oview_model = new JSONModel(viewModel);` && |\n| &&
` const found = aConfig?.find((element) => element.N == 'setSizeLimit' );` && |\n| &&
` if (found) { oview_model.setSizeLimit(found.V); }` && |\n| &&
` sap.z2ui5.oView = await XMLView.create({` && |\n| &&
` definition: xml,` && |\n| &&
` models: oview_model,` && |\n| &&
` controller: sap.z2ui5.oController,` && |\n| &&
` id: 'mainView',` && |\n| &&
` preprocessors: { xml: { models: { template: oview_model } } }` && |\n| &&
` });` && |\n| &&
` sap.z2ui5.oView.setModel(sap.z2ui5.oDeviceModel, "device");` && |\n| &&
` if (sap.z2ui5.oParent) {` && |\n| &&
` sap.z2ui5.oParent.removeAllPages();` && |\n| &&
` sap.z2ui5.oParent.insertPage(sap.z2ui5.oView);` && |\n| &&
` } else {` && |\n| &&
` sap.z2ui5.oView.placeAt("content");` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` async readHttp() {` && |\n| &&
` const response = await fetch(sap.z2ui5.pathname, {` && |\n| &&
` method: 'POST',` && |\n| &&
` headers: {` && |\n| &&
` 'Content-Type': 'application/json'` && |\n| &&
` },` && |\n| &&
` body: JSON.stringify(sap.z2ui5.oBody)` && |\n| &&
` });` && |\n| &&
` if (!response.ok) {` && |\n| &&
` const responseText = await response.text();` && |\n| &&
` sap.z2ui5.oController.responseError(responseText);` && |\n| &&
` } else {` && |\n| &&
` const responseData = await response.json();` && |\n| &&
` sap.z2ui5.responseData = responseData;` && |\n| &&
` sap.z2ui5.oController.responseSuccess({` && |\n| &&
` ID : responseData.S_FRONT.ID,` && |\n| &&
` PARAMS : responseData.S_FRONT.PARAMS,` && |\n| &&
` OVIEWMODEL : responseData.MODEL,` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` Roundtrip() {` && |\n| &&
` sap.z2ui5.checkTimerActive = false;` && |\n| &&
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
` sap.z2ui5.checkNestAfter2 = false;` && |\n| &&
` let event = (args) => { if ( args != undefined ) { return args[0][0]; } };` && |\n| &&
` sap.z2ui5.oBody.S_FRONT = {` && |\n| &&
` ID: sap.z2ui5?.oBody?.ID,` && |\n| &&
` COMPDATA: (sap.z2ui5.ComponentData) ? sap.z2ui5.ComponentData : {} ,` && |\n| &&
` ` && lv_two_way_model && `: sap.z2ui5?.oBody?.` && lv_two_way_model && `,` && |\n| &&
` ORIGIN: window.location.origin,` && |\n| &&
` PATHNAME: window.location.pathname, // sap.z2ui5.pathname,` && |\n| &&
` SEARCH: (sap.z2ui5.search) ? sap.z2ui5.search : window.location.search,` && |\n| &&
` VIEW: sap.z2ui5.oBody?.VIEWNAME,` && |\n| &&
` T_STARTUP_PARAMETERS: sap.z2ui5.startupParameters,` && |\n| &&
` EVENT: event(sap.z2ui5.oBody?.ARGUMENTS),` && |\n| &&
` };` && |\n| &&
` if ( sap.z2ui5.oBody?.ARGUMENTS != undefined ) { if ( sap.z2ui5.oBody?.ARGUMENTS.length > 0 ) { sap.z2ui5.oBody?.ARGUMENTS.shift(); } }` && |\n| &&
` sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG = sap.z2ui5.oBody?.ARGUMENTS;` && |\n| &&
` delete sap.z2ui5.oBody.ID;` && |\n| &&
` delete sap.z2ui5.oBody?.VIEWNAME;` && |\n| &&
` delete sap.z2ui5.oBody?.S_FRONT.` && lv_two_way_model && `;` && |\n| &&
` delete sap.z2ui5.oBody?.ARGUMENTS;` && |\n| &&
` if (!sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG) { delete sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG; } ` && |\n| &&
` if (sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG) { if (sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG.length == 0 ) { delete sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG; } }` && |\n| &&
` if (sap.z2ui5.oBody.S_FRONT.T_STARTUP_PARAMETERS == undefined) { delete sap.z2ui5.oBody.S_FRONT.T_STARTUP_PARAMETERS; } ` && |\n| &&
` if ( sap.z2ui5.oBody.S_FRONT.SEARCH == '' ){ delete sap.z2ui5.oBody.S_FRONT.SEARCH; } ` && |\n| &&
` if (!sap.z2ui5.oBody.` && lv_two_way_model && `){ delete sap.z2ui5.oBody.` && lv_two_way_model && `; } ` && |\n| &&
` sap.z2ui5.oController.readHttp();` && |\n| &&
` },` && |\n| &&
` })` && |\n| &&
`}); } ` && |\n| &&
`sap.ui.require(["z2ui5/Controller", "sap/ui/core/BusyIndicator", "sap/ui/model/json/JSONModel", "sap/ui/core/mvc/XMLView", "sap/ui/core/Fragment", "sap/m/MessageToast", "sap/m/MessageBox"], (Controller,BusyIndicator, JSONModel)=>{` &&
|\n| &&
` BusyIndicator.show();` && |\n| &&
` sap.z2ui5.oController = new Controller();` && |\n| &&
` sap.z2ui5.oControllerNest = new Controller();` && |\n| &&
` sap.z2ui5.oControllerNest2 = new Controller();` && |\n| &&
` sap.z2ui5.oControllerPopup = new Controller();` && |\n| &&
` sap.z2ui5.oControllerPopover = new Controller();` && |\n| &&
` sap.z2ui5.pathname = sap.z2ui5.pathname || window.location.pathname;` && |\n| &&
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
` sap.z2ui5.oBody = { };` && |\n| &&
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
` sap.z2ui5.onBeforeRoundtrip = [];` && |\n| &&
` sap.z2ui5.onAfterRendering = [];` && |\n| &&
` sap.z2ui5.onBeforeEventFrontend = [];` && |\n| &&
` sap.z2ui5.onAfterRoundtrip = []; ` && |\n| &&
` ` && |\n| &&
` }` && |\n| &&
`);`.
ENDMETHOD.
ENDCLASS.

View File

@ -1,151 +0,0 @@
CLASS ltcl_test_http_get DEFINITION FINAL FOR TESTING
DURATION MEDIUM
RISK LEVEL HARMLESS.
PUBLIC SECTION.
PROTECTED SECTION.
PRIVATE SECTION.
METHODS file_not_initial FOR TESTING RAISING cx_static_check.
METHODS launchpad_compatibility FOR TESTING RAISING cx_static_check.
METHODS path_setup FOR TESTING RAISING cx_static_check.
METHODS js_no_debugger FOR TESTING RAISING cx_static_check.
METHODS js_no_sap_ui_get_core FOR TESTING RAISING cx_static_check.
METHODS js_no_window FOR TESTING RAISING cx_static_check.
METHODS js_no_document FOR TESTING RAISING cx_static_check.
METHODS js_2x_compatibility FOR TESTING RAISING cx_static_check.
METHODS bootstrap_with_open_ui5 FOR TESTING RAISING cx_static_check.
METHODS js_no_jquery FOR TESTING RAISING cx_static_check.
METHODS debugging_tools FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS z2ui5_cl_core_http_get2 DEFINITION LOCAL FRIENDS ltcl_test_http_get.
CLASS ltcl_test_http_get IMPLEMENTATION.
METHOD file_not_initial.
DATA(lo_get) = NEW z2ui5_cl_core_http_get2( ).
DATA(lv_index_html) = lo_get->main( ).
IF lv_index_html IS INITIAL.
cl_abap_unit_assert=>fail( 'HTTP GET - index html initial' ).
ENDIF.
ENDMETHOD.
METHOD launchpad_compatibility.
DATA(lo_get) = NEW z2ui5_cl_core_http_get2( ).
DATA(lv_index_html) = lo_get->main( ).
IF lv_index_html CS ` && `.
cl_abap_unit_assert=>fail( 'index.html contains the character & -> no launchpad compatibility' ).
ENDIF.
ENDMETHOD.
METHOD path_setup.
DATA(lo_get) = NEW z2ui5_cl_core_http_get2( ).
DATA(lv_index_html) = to_upper( lo_get->main( ) ).
IF lv_index_html CS `SAP.Z2UI5.PATHNAME || '/SAP/TEST';`.
cl_abap_unit_assert=>fail( 'path static' ).
ENDIF.
IF lv_index_html NS `SAP.Z2UI5.PATHNAME || WINDOW.LOCATION.PATHNAME;`.
cl_abap_unit_assert=>fail( 'path static' ).
ENDIF.
ENDMETHOD.
METHOD js_no_debugger.
DATA(lo_get) = NEW z2ui5_cl_core_http_get2( ).
DATA(lv_index_html) = to_upper( lo_get->main( ) ).
IF lv_index_html CS `DEBUGGER`.
cl_abap_unit_assert=>fail( 'debugger command not allowed' ).
ENDIF.
ENDMETHOD.
METHOD js_no_sap_ui_get_core.
DATA(lo_get) = NEW z2ui5_cl_core_http_get2( ).
DATA(lv_index_html) = to_upper( lo_get->main( ) ) ##NEEDED.
* IF lv_index_html CS `SAP.UI.GETCORE`.
* cl_abap_unit_assert=>fail( 'sap.ui.get.core not allowed' ).
* ENDIF.
ENDMETHOD.
METHOD js_2x_compatibility.
DATA(lo_get) = NEW z2ui5_cl_core_http_get2( ).
DATA(lv_index_html) = to_upper( lo_get->main( ) ) ##NEEDED.
IF lv_index_html CS `SAP.UI.GETVERSIONINFO`.
cl_abap_unit_assert=>fail( 'SAP.UI.GETVERSIONINFO not allowed' ).
ENDIF.
ENDMETHOD.
METHOD js_no_jquery.
DATA(lo_get) = NEW z2ui5_cl_core_http_get2( ).
DATA(lv_index_html) = to_upper( lo_get->main( ) ).
IF lv_index_html CS `JQUERY`.
cl_abap_unit_assert=>fail( 'use of jquery not allowed' ).
ENDIF.
ENDMETHOD.
METHOD js_no_window.
DATA(lo_get) = NEW z2ui5_cl_core_http_get2( ).
DATA(lv_index_html) = to_upper( lo_get->main( ) ) ##NEEDED.
* IF lv_index_html CS `WINDOW.`.
* cl_abap_unit_assert=>fail( 'use of window not allowed' ).
* ENDIF.
ENDMETHOD.
METHOD js_no_document.
DATA(lo_get) = NEW z2ui5_cl_core_http_get2( ).
DATA(lv_index_html) = to_upper( lo_get->main( ) ) ##NEEDED.
* IF lv_index_html CS `DOCUMENT.`.
* cl_abap_unit_assert=>fail( 'use of document not allowed' ).
* ENDIF.
ENDMETHOD.
METHOD bootstrap_with_open_ui5.
DATA(lo_get) = NEW z2ui5_cl_core_http_get2( ).
DATA(lv_index_html) = to_upper( lo_get->main( ) ) ##NEEDED.
DATA(lv_check) = xsdbool( lv_index_html CS `HTTPS://SDK.OPENUI5.ORG/RESOURCES` ).
IF lv_check = abap_false.
cl_abap_unit_assert=>fail( 'no bootstrap with openUI5' ).
ENDIF.
lv_check = xsdbool( lv_index_html CS `NIGHTLY` ).
IF lv_check = abap_true.
cl_abap_unit_assert=>fail( 'no bootstrap with nightly version' ).
ENDIF.
ENDMETHOD.
METHOD debugging_tools.
DATA(lv_index_html) = to_upper( z2ui5_cl_cc_debug_tool=>get_js( ) ) ##NEEDED.
IF lv_index_html CS `<`.
cl_abap_unit_assert=>fail( 'use of < not allowed - launchpad compatibility' ).
ENDIF.
IF lv_index_html CS `/>`.
cl_abap_unit_assert=>fail( 'use of /> not allowed - launchpad compatibility' ).
ENDIF.
ENDMETHOD.
ENDCLASS.

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_CORE_HTTP_GET2</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>abap2UI5 - http get handler test</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -51,8 +51,8 @@ INTERFACE z2ui5_if_core_types
xml TYPE string, xml TYPE string,
check_destroy TYPE abap_bool, check_destroy TYPE abap_bool,
check_update_model TYPE abap_bool, check_update_model TYPE abap_bool,
update_path TYPE string_table, * update_path TYPE string_table,
t_config TYPE z2ui5_if_types=>ty_t_name_value, s_config TYPE z2ui5_if_types=>ty_s_view_config,
END OF s_view, END OF s_view,
BEGIN OF s_view_nest, BEGIN OF s_view_nest,
xml TYPE string, xml TYPE string,
@ -61,6 +61,7 @@ INTERFACE z2ui5_if_core_types
method_destroy TYPE string, method_destroy TYPE string,
check_destroy TYPE abap_bool, check_destroy TYPE abap_bool,
check_update_model TYPE abap_bool, check_update_model TYPE abap_bool,
s_config TYPE z2ui5_if_types=>ty_s_view_config,
END OF s_view_nest, END OF s_view_nest,
BEGIN OF s_view_nest2, BEGIN OF s_view_nest2,
xml TYPE string, xml TYPE string,
@ -69,12 +70,14 @@ INTERFACE z2ui5_if_core_types
method_destroy TYPE string, method_destroy TYPE string,
check_destroy TYPE abap_bool, check_destroy TYPE abap_bool,
check_update_model TYPE abap_bool, check_update_model TYPE abap_bool,
s_config TYPE z2ui5_if_types=>ty_s_view_config,
END OF s_view_nest2, END OF s_view_nest2,
BEGIN OF s_popup, BEGIN OF s_popup,
xml TYPE string, xml TYPE string,
id TYPE string, id TYPE string,
check_destroy TYPE abap_bool, check_destroy TYPE abap_bool,
check_update_model TYPE abap_bool, check_update_model TYPE abap_bool,
s_config TYPE z2ui5_if_types=>ty_s_view_config,
END OF s_popup, END OF s_popup,
BEGIN OF s_popover, BEGIN OF s_popover,
xml TYPE string, xml TYPE string,
@ -82,6 +85,7 @@ INTERFACE z2ui5_if_core_types
open_by_id TYPE string, open_by_id TYPE string,
check_destroy TYPE abap_bool, check_destroy TYPE abap_bool,
check_update_model TYPE abap_bool, check_update_model TYPE abap_bool,
s_config TYPE z2ui5_if_types=>ty_s_view_config,
END OF s_popover, END OF s_popover,
BEGIN OF s_msg_box, BEGIN OF s_msg_box,
type TYPE string, type TYPE string,

View File

@ -1,34 +0,0 @@
CLASS z2ui5_cl_http_handler2 DEFINITION
PUBLIC
CREATE PUBLIC.
PUBLIC SECTION.
CLASS-METHODS main
IMPORTING
body TYPE string
config TYPE z2ui5_if_types=>ty_s_config_index_html OPTIONAL
RETURNING
VALUE(result) TYPE string.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_http_handler2 IMPLEMENTATION.
METHOD main.
IF body IS INITIAL.
DATA(lo_get) = NEW z2ui5_cl_core_http_get2( config ).
result = lo_get->main( ).
ELSE.
DATA(lo_post) = NEW z2ui5_cl_core_http_post( body ).
result = lo_post->main( ).
ENDIF.
ENDMETHOD.
ENDCLASS.

View File

@ -1,25 +0,0 @@
CLASS ltcl_unit_test DEFINITION FINAL FOR TESTING
DURATION MEDIUM
RISK LEVEL HARMLESS.
PUBLIC SECTION.
PROTECTED SECTION.
PRIVATE SECTION.
METHODS test_get FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_unit_test IMPLEMENTATION.
METHOD test_get.
DATA(lv_resp) = z2ui5_cl_http_handler2=>main( `` ).
IF lv_resp IS INITIAL.
cl_abap_unit_assert=>fail( 'HTTP GET' ).
ENDIF.
ENDMETHOD.
ENDCLASS.

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_HTTP_HANDLER2</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>abap2UI5 - http handler test</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -28,7 +28,7 @@ INTERFACE z2ui5_if_client
METHODS view_display METHODS view_display
IMPORTING IMPORTING
val TYPE clike val TYPE clike
t_config TYPE z2ui5_if_types=>ty_t_name_value OPTIONAL. s_config TYPE z2ui5_if_types=>ty_s_view_config OPTIONAL.
METHODS view_model_update. METHODS view_model_update.
@ -37,7 +37,8 @@ INTERFACE z2ui5_if_client
val TYPE clike val TYPE clike
id TYPE clike id TYPE clike
method_insert TYPE clike method_insert TYPE clike
method_destroy TYPE clike OPTIONAL. method_destroy TYPE clike OPTIONAL
s_config TYPE z2ui5_if_types=>ty_s_view_config OPTIONAL.
METHODS nest_view_destroy. METHODS nest_view_destroy.
METHODS nest_view_model_update. METHODS nest_view_model_update.
@ -47,14 +48,16 @@ INTERFACE z2ui5_if_client
val TYPE clike val TYPE clike
id TYPE clike id TYPE clike
method_insert TYPE clike method_insert TYPE clike
method_destroy TYPE clike OPTIONAL. method_destroy TYPE clike OPTIONAL
s_config TYPE z2ui5_if_types=>ty_s_view_config OPTIONAL.
METHODS nest2_view_destroy. METHODS nest2_view_destroy.
METHODS nest2_view_model_update. METHODS nest2_view_model_update.
METHODS popup_display METHODS popup_display
IMPORTING IMPORTING
val TYPE clike. val TYPE clike
s_config TYPE z2ui5_if_types=>ty_s_view_config OPTIONAL.
METHODS popup_model_update. METHODS popup_model_update.
@ -64,8 +67,9 @@ INTERFACE z2ui5_if_client
METHODS popover_display METHODS popover_display
IMPORTING IMPORTING
xml TYPE clike xml TYPE clike
by_id TYPE clike. by_id TYPE clike
s_config TYPE z2ui5_if_types=>ty_s_view_config OPTIONAL.
METHODS popover_destroy. METHODS popover_destroy.

View File

@ -13,16 +13,9 @@ INTERFACE z2ui5_if_types
t_config TYPE ty_t_name_value, t_config TYPE ty_t_name_value,
content_security_policy TYPE string, content_security_policy TYPE string,
custom_js TYPE string, custom_js TYPE string,
json_model_limit TYPE string, t_param TYPE ty_t_name_value,
END OF ty_s_http_request_get. END OF ty_s_http_request_get.
TYPES:
BEGIN OF ty_s_config_index_html,
t_option TYPE ty_t_name_value,
t_param TYPE ty_t_name_value,
add_js TYPE string,
END OF ty_s_config_index_html.
TYPES: TYPES:
BEGIN OF ty_s_draft, BEGIN OF ty_s_draft,
id TYPE string, id TYPE string,
@ -39,6 +32,11 @@ INTERFACE z2ui5_if_types
t_startup_params TYPE ty_t_name_value, t_startup_params TYPE ty_t_name_value,
END OF ty_s_config. END OF ty_s_config.
TYPES:
BEGIN OF ty_s_view_config,
set_size_limit TYPE string,
END OF ty_s_view_config.
TYPES: TYPES:
BEGIN OF ty_s_get, BEGIN OF ty_s_get,
event TYPE string, event TYPE string,