Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 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x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | CLASS zcl_abapgit_gui_page DEFINITION PUBLIC ABSTRACT INHERITING FROM zcl_abapgit_gui_component CREATE PUBLIC. PUBLIC SECTION. INTERFACES: zif_abapgit_gui_modal, zif_abapgit_gui_renderable, zif_abapgit_gui_event_handler, zif_abapgit_gui_error_handler. TYPES: BEGIN OF ty_control, page_layout TYPE string, page_title TYPE string, page_menu TYPE REF TO zcl_abapgit_html_toolbar, page_menu_provider TYPE REF TO zif_abapgit_gui_menu_provider, page_title_provider TYPE REF TO zif_abapgit_gui_page_title, extra_css_url TYPE string, extra_js_url TYPE string, show_as_modal TYPE abap_bool, END OF ty_control . METHODS constructor RAISING zcx_abapgit_exception. CONSTANTS: BEGIN OF c_page_layout, centered TYPE string VALUE `centered`, full_width TYPE string VALUE `full_width`, END OF c_page_layout. PROTECTED SECTION. DATA ms_control TYPE ty_control . METHODS render_content " TODO refactor, render child directly ABSTRACT RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . PRIVATE SECTION. DATA mo_settings TYPE REF TO zcl_abapgit_settings . DATA mx_error TYPE REF TO zcx_abapgit_exception . DATA mo_exception_viewer TYPE REF TO zcl_abapgit_exception_viewer . METHODS render_deferred_parts IMPORTING !ii_html TYPE REF TO zif_abapgit_html !iv_part_category TYPE string RAISING zcx_abapgit_exception . METHODS html_head RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS header_stylesheet_links IMPORTING ii_html TYPE REF TO zif_abapgit_html . METHODS header_script_links IMPORTING ii_html TYPE REF TO zif_abapgit_html . METHODS title RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS footer IMPORTING !iv_time TYPE string RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_link_hints IMPORTING !ii_html TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_browser_control_warning IMPORTING !ii_html TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_command_palettes IMPORTING !ii_html TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_hotkey_overview RETURNING VALUE(ro_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS render_error_message_box RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS scripts RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html RAISING zcx_abapgit_exception . METHODS get_version_details RETURNING VALUE(rv_version) TYPE string. METHODS is_edge_control_warning_needed RETURNING VALUE(rv_result) TYPE abap_bool. ENDCLASS. CLASS zcl_abapgit_gui_page IMPLEMENTATION. METHOD constructor. super->constructor( ). mo_settings = zcl_abapgit_persist_factory=>get_settings( )->read( ). ms_control-page_layout = c_page_layout-centered. ENDMETHOD. METHOD footer. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div id="footer">' ). ri_html->add( '<table class="w100"><tr>' ). ri_html->add( '<td class="w40 sponsor">' ). ri_html->add_a( iv_act = zif_abapgit_definitions=>c_action-sponsor iv_txt = ri_html->icon( iv_name = 'heart-regular/pink' iv_hint = 'Sponsor us' ) ). ri_html->add_a( iv_act = zif_abapgit_definitions=>c_action-sponsor iv_txt = 'Sponsor us' ). ri_html->add( '</td>' ). ri_html->add( '<td class="center">' ). ri_html->add( '<div class="logo">' ). ri_html->add_a( iv_act = zif_abapgit_definitions=>c_action-homepage iv_txt = ri_html->icon( 'git-alt' ) ). ri_html->add_a( iv_act = zif_abapgit_definitions=>c_action-homepage iv_txt = ri_html->icon( iv_name = 'abapgit' iv_hint = iv_time ) ). ri_html->add( '</div>' ). ri_html->add( |<div id="footer-version" class="version">{ get_version_details( ) }</div>| ). ri_html->add( '</td>' ). ri_html->add( '<td id="debug-output" class="w40"></td>' ). ri_html->add( '</tr></table>' ). ri_html->add( '</div>' ). ENDMETHOD. METHOD get_version_details. DATA lo_frontend_serv TYPE REF TO zif_abapgit_frontend_services. rv_version = zif_abapgit_version=>c_abap_version. IF zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_true. rv_version = rv_version && ` - Standalone Version`. ELSE. rv_version = rv_version && ` - Developer Version`. ENDIF. lo_frontend_serv = zcl_abapgit_ui_factory=>get_frontend_services( ). CASE abap_true. WHEN lo_frontend_serv->is_webgui( ). rv_version = rv_version && ` - Web`. WHEN lo_frontend_serv->is_sapgui_for_windows( ). rv_version = rv_version && ` - Win`. WHEN lo_frontend_serv->is_sapgui_for_java( ). rv_version = rv_version && ` - Java`. WHEN OTHERS. * eg. open-abap? rv_version = rv_version && ` - Unknown`. ENDCASE. " Will be filled by JS method displayBrowserControlFooter rv_version = rv_version && '<span id="browser-control-footer"></span>'. ENDMETHOD. METHOD header_script_links. ii_html->add( '<script src="js/common.js"></script>' ). IF ms_control-extra_js_url IS NOT INITIAL. ii_html->add( |<script src="{ ms_control-extra_js_url }"></script>| ). ENDIF. ENDMETHOD. METHOD header_stylesheet_links. ii_html->add( '<link rel="stylesheet" type="text/css" href="css/common.css">' ). ii_html->add( '<link rel="stylesheet" type="text/css" href="css/ag-icons.css">' ). " Themes ii_html->add( '<link rel="stylesheet" type="text/css" href="css/theme-default.css">' ). " Theme basis CASE mo_settings->get_ui_theme( ). WHEN zcl_abapgit_settings=>c_ui_theme-dark. ii_html->add( '<link rel="stylesheet" type="text/css" href="css/theme-dark.css">' ). WHEN zcl_abapgit_settings=>c_ui_theme-belize. ii_html->add( '<link rel="stylesheet" type="text/css" href="css/theme-belize-blue.css">' ). ENDCASE. " Page stylesheets IF ms_control-extra_css_url IS NOT INITIAL. ii_html->add( |<link rel="stylesheet" type="text/css" href="{ ms_control-extra_css_url }">| ). ENDIF. ENDMETHOD. METHOD html_head. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<head>' ). ri_html->add( '<meta http-equiv="content-type" content="text/html; charset=utf-8">' ). ri_html->add( '<meta http-equiv="X-UA-Compatible" content="IE=11,10,9,8" />' ). ri_html->add( '<title>abapGit</title>' ). header_stylesheet_links( ri_html ). header_script_links( ri_html ). " Overwrite the automatic icon scaling done in zcl_abapgit_html=>icon CASE mo_settings->get_icon_scaling( ). WHEN mo_settings->c_icon_scaling-large. ri_html->add( '<style>.icon { font-size: 200% }</style>' ). WHEN mo_settings->c_icon_scaling-small. ri_html->add( '<style>.icon.large { font-size: inherit }</style>' ). ENDCASE. ri_html->add( '</head>' ). ENDMETHOD. METHOD is_edge_control_warning_needed. DATA: lv_gui_release TYPE zif_abapgit_frontend_services=>ty_gui_release, lv_gui_sp TYPE zif_abapgit_frontend_services=>ty_gui_sp, lv_gui_patch TYPE zif_abapgit_frontend_services=>ty_gui_patch, li_frontend_services TYPE REF TO zif_abapgit_frontend_services. " With SAP GUI 8.00 PL3 and 7.70 PL13 Edge browser control is basically working. " For lower releases we render the browser control warning " and toggle it via JS function toggleBrowserControlWarning. rv_result = abap_true. TRY. li_frontend_services = zcl_abapgit_ui_factory=>get_frontend_services( ). li_frontend_services->get_gui_version( IMPORTING ev_gui_release = lv_gui_release ev_gui_sp = lv_gui_sp ev_gui_patch = lv_gui_patch ). CATCH zcx_abapgit_exception. RETURN. ENDTRY. IF lv_gui_release >= '7700' AND lv_gui_sp >= '1' AND lv_gui_patch >= '13' OR lv_gui_release >= '8000' AND lv_gui_sp >= '1' AND lv_gui_patch >= '3'. rv_result = abap_false. ENDIF. ENDMETHOD. METHOD render_browser_control_warning. DATA li_documentation_link TYPE REF TO zif_abapgit_html. CREATE OBJECT li_documentation_link TYPE zcl_abapgit_html. li_documentation_link->add_a( iv_txt = 'Documentation' iv_typ = zif_abapgit_html=>c_action_type-url iv_act = 'https://docs.abapgit.org/guide-sapgui.html#sap-gui-for-windows' ). ii_html->add( '<div id="browser-control-warning" class="browser-control-warning">' ). ii_html->add( zcl_abapgit_gui_chunk_lib=>render_warning_banner( |Attention: You use Edge browser control. | && |There are several known malfunctions. See | && li_documentation_link->render( ) ) ). ii_html->add( '</div>' ). ENDMETHOD. METHOD render_command_palettes. ii_html->add( 'var gCommandPalette = new CommandPalette(enumerateUiActions, {' ). ii_html->add( ' toggleKey: "F1",' ). ii_html->add( ' hotkeyDescription: "Command Palette"' ). ii_html->add( '});' ). ENDMETHOD. METHOD render_deferred_parts. DATA lt_parts TYPE zif_abapgit_html=>ty_table_of. DATA li_part LIKE LINE OF lt_parts. lt_parts = gui_services( )->get_html_parts( )->get_parts( iv_part_category ). LOOP AT lt_parts INTO li_part. ii_html->add( li_part ). ENDLOOP. ENDMETHOD. METHOD render_error_message_box. " You should remember that the we have to instantiate ro_html even " it's overwritten further down. Because ADD checks whether it's " bound. CREATE OBJECT ri_html TYPE zcl_abapgit_html. " You should remember that we render the message panel only " if we have an error. IF mx_error IS NOT BOUND. RETURN. ENDIF. ri_html = zcl_abapgit_gui_chunk_lib=>render_error_message_box( mx_error ). " You should remember that the exception viewer dispatches the events of " error message panel CREATE OBJECT mo_exception_viewer EXPORTING ix_error = mx_error. " You should remember that we render the message panel just once " for each exception/error text. CLEAR: mx_error. ENDMETHOD. METHOD render_hotkey_overview. DATA lo_hotkeys_component TYPE REF TO zif_abapgit_gui_renderable. lo_hotkeys_component ?= gui_services( )->get_hotkeys_ctl( ). " Mmmm ... ro_html = lo_hotkeys_component->render( ). ENDMETHOD. METHOD render_link_hints. DATA: lv_link_hint_key TYPE c LENGTH 1. lv_link_hint_key = mo_settings->get_link_hint_key( ). IF mo_settings->get_link_hints_enabled( ) = abap_true AND lv_link_hint_key IS NOT INITIAL. ii_html->add( |activateLinkHints("{ lv_link_hint_key }");| ). ii_html->add( |setInitialFocusWithQuerySelector('#header', false);| ). ii_html->add( |enableArrowListNavigation();| ). ENDIF. ENDMETHOD. METHOD scripts. CREATE OBJECT ri_html TYPE zcl_abapgit_html. render_deferred_parts( ii_html = ri_html iv_part_category = c_html_parts-scripts ). render_link_hints( ri_html ). render_command_palettes( ri_html ). ri_html->add( |toggleBrowserControlWarning();| ). ri_html->add( |displayBrowserControlFooter();| ). ENDMETHOD. METHOD title. DATA lo_page_menu LIKE ms_control-page_menu. DATA lv_page_title TYPE string. lo_page_menu = ms_control-page_menu. IF lo_page_menu IS NOT BOUND AND ms_control-page_menu_provider IS BOUND. lo_page_menu = ms_control-page_menu_provider->get_menu( ). ENDIF. lv_page_title = ms_control-page_title. IF ms_control-page_title_provider IS BOUND. lv_page_title = ms_control-page_title_provider->get_page_title( ). ENDIF. CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<div id="header">' ). ri_html->add( '<div class="logo">' ). ri_html->add_a( iv_act = zif_abapgit_definitions=>c_action-abapgit_home iv_txt = ri_html->icon( 'git-alt' ) ). ri_html->add_a( iv_act = zif_abapgit_definitions=>c_action-abapgit_home iv_txt = ri_html->icon( 'abapgit' ) ). ri_html->add( '</div>' ). ri_html->add( |<div class="page-title"><span class="spacer">►</span>{ lv_page_title }</div>| ). IF lo_page_menu IS BOUND. ri_html->add( '<div class="float-right">' ). ri_html->add( lo_page_menu->render( iv_right = abap_true ) ). ri_html->add( '</div>' ). ENDIF. IF is_edge_control_warning_needed( ) = abap_true. render_browser_control_warning( ri_html ). ENDIF. ri_html->add( '</div>' ). ENDMETHOD. METHOD zif_abapgit_gui_error_handler~handle_error. mx_error = ix_error. rv_handled = abap_true. ENDMETHOD. METHOD zif_abapgit_gui_event_handler~on_event. CASE ii_event->mv_action. WHEN zif_abapgit_definitions=>c_action-goto_source. IF mo_exception_viewer IS BOUND. mo_exception_viewer->goto_source( ). ENDIF. rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-show_callstack. IF mo_exception_viewer IS BOUND. mo_exception_viewer->show_callstack( ). ENDIF. rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. WHEN zif_abapgit_definitions=>c_action-goto_message. IF mo_exception_viewer IS BOUND. mo_exception_viewer->goto_message( ). ENDIF. rs_handled-state = zcl_abapgit_gui=>c_event_state-no_more_act. ENDCASE. ENDMETHOD. METHOD zif_abapgit_gui_modal~is_modal. rv_yes = boolc( ms_control-show_as_modal = abap_true ). ENDMETHOD. METHOD zif_abapgit_gui_renderable~render. DATA: li_script TYPE REF TO zif_abapgit_html, lo_timer TYPE REF TO zcl_abapgit_timer. register_handlers( ). lo_timer = zcl_abapgit_timer=>create( )->start( ). " Real page CREATE OBJECT ri_html TYPE zcl_abapgit_html. ri_html->add( '<!DOCTYPE html>' ). ri_html->add( '<html lang="en">' ). ri_html->add( html_head( ) ). ri_html->add( |<body class="{ ms_control-page_layout }">| ). ri_html->add( title( ) ). ri_html->add( '<div class="not_sticky">' ). ri_html->add( render_content( ) ). " TODO -> render child ri_html->add( render_hotkey_overview( ) ). ri_html->add( render_error_message_box( ) ). render_deferred_parts( ii_html = ri_html iv_part_category = c_html_parts-hidden_forms ). ri_html->add( footer( lo_timer->end( ) ) ). ri_html->add( '</div>' ). li_script = scripts( ). IF li_script IS BOUND AND li_script->is_empty( ) = abap_false. ri_html->add( '<script>' ). ri_html->add( li_script ). ri_html->add( 'confirmInitialized();' ). ri_html->add( '</script>' ). ENDIF. ri_html->add( '</body>' ). ri_html->add( '</html>' ). ENDMETHOD. ENDCLASS. |