diff --git a/src/ui/package.devc.xml b/src/ui/package.devc.xml new file mode 100644 index 000000000..03346b167 --- /dev/null +++ b/src/ui/package.devc.xml @@ -0,0 +1,10 @@ + + + + + + UI + + + + diff --git a/src/ui/zcl_abapgit_html.clas.abap b/src/ui/zcl_abapgit_html.clas.abap new file mode 100644 index 000000000..898c45976 --- /dev/null +++ b/src/ui/zcl_abapgit_html.clas.abap @@ -0,0 +1,368 @@ +CLASS zcl_abapgit_html DEFINITION + PUBLIC + CREATE PUBLIC . + + PUBLIC SECTION. + + CONSTANTS c_indent_size TYPE i VALUE 2 ##NO_TEXT. + + CLASS-METHODS class_constructor . + METHODS reset . + METHODS add + IMPORTING + !iv_chunk TYPE any . + METHODS render + IMPORTING + !iv_no_indent_jscss TYPE abap_bool OPTIONAL + RETURNING + VALUE(rv_html) TYPE string . + METHODS is_empty + RETURNING + VALUE(rv_yes) TYPE abap_bool . + METHODS add_a + IMPORTING + !iv_txt TYPE string + !iv_act TYPE string + !iv_typ TYPE char1 DEFAULT zif_abapgit_definitions=>gc_action_type-sapevent + !iv_opt TYPE clike OPTIONAL + !iv_class TYPE string OPTIONAL + !iv_id TYPE string OPTIONAL + !iv_style TYPE string OPTIONAL . + METHODS add_icon + IMPORTING + !iv_name TYPE string + !iv_hint TYPE string OPTIONAL + !iv_class TYPE string OPTIONAL . + CLASS-METHODS a + IMPORTING + !iv_txt TYPE string + !iv_act TYPE string + !iv_typ TYPE char1 DEFAULT zif_abapgit_definitions=>gc_action_type-sapevent + !iv_opt TYPE clike OPTIONAL + !iv_class TYPE string OPTIONAL + !iv_id TYPE string OPTIONAL + !iv_style TYPE string OPTIONAL + RETURNING + VALUE(rv_str) TYPE string . + CLASS-METHODS icon + IMPORTING + !iv_name TYPE string + !iv_hint TYPE string OPTIONAL + !iv_class TYPE string OPTIONAL + RETURNING + VALUE(rv_str) TYPE string . + PRIVATE SECTION. + CLASS-DATA: go_single_tags_re TYPE REF TO cl_abap_regex. + + DATA: mt_buffer TYPE string_table. + + TYPES: + BEGIN OF ty_indent_context, + no_indent_jscss TYPE abap_bool, + within_style TYPE abap_bool, + within_js TYPE abap_bool, + indent TYPE i, + indent_str TYPE string, + END OF ty_indent_context, + + BEGIN OF ty_study_result, + style_open TYPE abap_bool, + style_close TYPE abap_bool, + script_open TYPE abap_bool, + script_close TYPE abap_bool, + tag_close TYPE abap_bool, + curly_close TYPE abap_bool, + openings TYPE i, + closings TYPE i, + singles TYPE i, + END OF ty_study_result. + + METHODS indent_line + CHANGING + cs_context TYPE ty_indent_context + cv_line TYPE string. + + METHODS study_line + IMPORTING iv_line TYPE string + is_context TYPE ty_indent_context + RETURNING VALUE(rs_result) TYPE ty_study_result. + +ENDCLASS. + + + +CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION. + + + METHOD a. + + DATA: lv_class TYPE string, + lv_href TYPE string, + lv_click TYPE string, + lv_id TYPE string, + lv_style TYPE string. + + lv_class = iv_class. + + IF iv_opt CA zif_abapgit_definitions=>gc_html_opt-strong. + lv_class = lv_class && ' emphasis' ##NO_TEXT. + ENDIF. + IF iv_opt CA zif_abapgit_definitions=>gc_html_opt-cancel. + lv_class = lv_class && ' attention' ##NO_TEXT. + ENDIF. + IF iv_opt CA zif_abapgit_definitions=>gc_html_opt-crossout. + lv_class = lv_class && ' crossout grey' ##NO_TEXT. + ENDIF. + IF lv_class IS NOT INITIAL. + SHIFT lv_class LEFT DELETING LEADING space. + lv_class = | class="{ lv_class }"|. + ENDIF. + + lv_href = ' href="#"'. " Default, dummy + IF iv_act IS NOT INITIAL OR iv_typ = zif_abapgit_definitions=>gc_action_type-dummy. + CASE iv_typ. + WHEN zif_abapgit_definitions=>gc_action_type-url. + lv_href = | href="{ iv_act }"|. + WHEN zif_abapgit_definitions=>gc_action_type-sapevent. + lv_href = | href="sapevent:{ iv_act }"|. + WHEN zif_abapgit_definitions=>gc_action_type-onclick. + lv_href = ' href="#"'. + lv_click = | onclick="{ iv_act }"|. + WHEN zif_abapgit_definitions=>gc_action_type-dummy. + lv_href = ' href="#"'. + ENDCASE. + ENDIF. + + IF iv_id IS NOT INITIAL. + lv_id = | id="{ iv_id }"|. + ENDIF. + + IF iv_style IS NOT INITIAL. + lv_style = | style="{ iv_style }"|. + ENDIF. + + rv_str = |{ iv_txt }|. + + ENDMETHOD. "a + + + METHOD add. + + DATA: lv_type TYPE c, + lo_html TYPE REF TO zcl_abapgit_html. + + FIELD-SYMBOLS: TYPE string_table. + + DESCRIBE FIELD iv_chunk TYPE lv_type. " Describe is faster than RTTI classes + + CASE lv_type. + WHEN 'C' OR 'g'. " Char or string + APPEND iv_chunk TO mt_buffer. + WHEN 'h'. " Table + ASSIGN iv_chunk TO . " Assuming table of strings ! Will dump otherwise + APPEND LINES OF TO mt_buffer. + WHEN 'r'. " Object ref + ASSERT iv_chunk IS BOUND. " Dev mistake + TRY. + lo_html ?= iv_chunk. + CATCH cx_sy_move_cast_error. + ASSERT 1 = 0. " Dev mistake + ENDTRY. + APPEND LINES OF lo_html->mt_buffer TO mt_buffer. + WHEN OTHERS. + ASSERT 1 = 0. " Dev mistake + ENDCASE. + + ENDMETHOD. " add + + + METHOD add_a. + + add( a( iv_txt = iv_txt + iv_act = iv_act + iv_typ = iv_typ + iv_opt = iv_opt + iv_class = iv_class + iv_id = iv_id + iv_style = iv_style ) ). + + ENDMETHOD. "add_a + + + METHOD add_icon. + + add( icon( iv_name = iv_name + iv_class = iv_class + iv_hint = iv_hint ) ). + + ENDMETHOD. "add_icon + + + METHOD class_constructor. + CREATE OBJECT go_single_tags_re + EXPORTING + pattern = '<(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|LINK|META|PARAM|SOURCE|!)' + ignore_case = abap_false. + ENDMETHOD. "class_constructor + + + METHOD icon. + + DATA: lv_hint TYPE string, + lv_name TYPE string, + lv_color TYPE string, + lv_class TYPE string. + + SPLIT iv_name AT '/' INTO lv_name lv_color. + + IF iv_hint IS NOT INITIAL. + lv_hint = | title="{ iv_hint }"|. + ENDIF. + IF iv_class IS NOT INITIAL. + lv_class = | { iv_class }|. + ENDIF. + IF lv_color IS NOT INITIAL. + lv_color = | { lv_color }|. + ENDIF. + + rv_str = ||. + + ENDMETHOD. "icon + + + METHOD indent_line. + + DATA: ls_study TYPE ty_study_result, + lv_x_str TYPE string. + + ls_study = study_line( + is_context = cs_context + iv_line = cv_line ). + + " First closing tag - shift back exceptionally + IF ( ls_study-script_close = abap_true + OR ls_study-style_close = abap_true + OR ls_study-curly_close = abap_true + OR ls_study-tag_close = abap_true ) + AND cs_context-indent > 0. + lv_x_str = repeat( val = ` ` occ = ( cs_context-indent - 1 ) * c_indent_size ). + cv_line = lv_x_str && cv_line. + ELSE. + cv_line = cs_context-indent_str && cv_line. + ENDIF. + + " Context status update + CASE abap_true. + WHEN ls_study-script_open. + cs_context-within_js = abap_true. + cs_context-within_style = abap_false. + WHEN ls_study-style_open. + cs_context-within_js = abap_false. + cs_context-within_style = abap_true. + WHEN ls_study-script_close OR ls_study-style_close. + cs_context-within_js = abap_false. + cs_context-within_style = abap_false. + ls_study-closings = ls_study-closings + 1. + ENDCASE. + + " More-less logic chosen due to possible double tags in a line '' + IF ls_study-openings <> ls_study-closings. + IF ls_study-openings > ls_study-closings. + cs_context-indent = cs_context-indent + 1. + ELSEIF cs_context-indent > 0. " AND ls_study-openings < ls_study-closings + cs_context-indent = cs_context-indent - 1. + ENDIF. + cs_context-indent_str = repeat( val = ` ` occ = cs_context-indent * c_indent_size ). + ENDIF. + + ENDMETHOD. "indent_line + + + METHOD is_empty. + rv_yes = boolc( lines( mt_buffer ) = 0 ). + ENDMETHOD. "is_empty + + + METHOD render. + + DATA: ls_context TYPE ty_indent_context, + lt_temp TYPE string_table. + + FIELD-SYMBOLS: LIKE LINE OF lt_temp, + LIKE LINE OF lt_temp. + + ls_context-no_indent_jscss = iv_no_indent_jscss. + + LOOP AT mt_buffer ASSIGNING . + APPEND TO lt_temp ASSIGNING . + indent_line( CHANGING cs_context = ls_context cv_line = ). + ENDLOOP. + + CONCATENATE LINES OF lt_temp INTO rv_html SEPARATED BY zif_abapgit_definitions=>gc_newline. + + ENDMETHOD. "render + + + METHOD reset. + CLEAR me->mt_buffer. + ENDMETHOD. "reset + + + METHOD study_line. + + DATA: lv_line TYPE string, + lv_len TYPE i. + + lv_line = to_upper( shift_left( val = iv_line sub = ` ` ) ). + lv_len = strlen( lv_line ). + + " Some assumptions for simplification and speed + " - style & scripts tag should be opened/closed in a separate line + " - style & scripts opening and closing in one line is possible but only once + + " TODO & Issues + " - What if the string IS a well formed html already not just single line ? + + IF is_context-within_js = abap_true OR is_context-within_style = abap_true. + + IF is_context-within_js = abap_true AND lv_len >= 8 AND lv_line(8) = '= 7 AND lv_line(7) = '= 1 AND lv_line(1) = '}'. + rs_result-curly_close = abap_true. + ENDIF. + + FIND ALL OCCURRENCES OF '{' IN lv_line MATCH COUNT rs_result-openings. + FIND ALL OCCURRENCES OF '}' IN lv_line MATCH COUNT rs_result-closings. + ENDIF. + + ELSE. + IF lv_len >= 7 AND lv_line(7) = ' 0. " Not found + rs_result-script_open = abap_true. + ENDIF. + ENDIF. + IF lv_len >= 6 AND lv_line(6) = ' 0. " Not found + rs_result-style_open = abap_true. + ENDIF. + ENDIF. + IF lv_len >= 2 AND lv_line(2) = 'add( '' ). + mo_html->add( 'hello world' ). + mo_html->add( '' ). + + lv_exp = '' && zif_abapgit_definitions=>gc_newline && + ' hello world' && zif_abapgit_definitions=>gc_newline && + ''. + + cl_abap_unit_assert=>assert_equals( + act = mo_html->render( ) + exp = lv_exp ). + + ENDMETHOD. + + METHOD indent2. + + DATA lv_exp TYPE string. + + mo_html->add( '' ). + mo_html->add( '' ). + mo_html->add( '' ). + + lv_exp = '' && zif_abapgit_definitions=>gc_newline && + ' ' && zif_abapgit_definitions=>gc_newline && + ''. + + cl_abap_unit_assert=>assert_equals( + act = mo_html->render( ) + exp = lv_exp ). + + ENDMETHOD. + + METHOD indent3. + + DATA lv_exp TYPE string. + + mo_html->add( '' ). + mo_html->add( '' ). + mo_html->add( '' ). + + lv_exp = '' && zif_abapgit_definitions=>gc_newline && + ' ' && zif_abapgit_definitions=>gc_newline && + ''. + + cl_abap_unit_assert=>assert_equals( + act = mo_html->render( ) + exp = lv_exp ). + + ENDMETHOD. + + METHOD indent4. + + DATA lv_exp TYPE string. + + mo_html->add( '' ). + mo_html->add( 'foo
bar' ). + mo_html->add( '' ). + + lv_exp = '' && zif_abapgit_definitions=>gc_newline && + ' foo
bar' && zif_abapgit_definitions=>gc_newline && + ''. + + cl_abap_unit_assert=>assert_equals( + act = mo_html->render( ) + exp = lv_exp ). + + ENDMETHOD. + + METHOD style1. + + DATA lv_exp TYPE string. + + mo_html->add( '' ). + + lv_exp = ''. + + cl_abap_unit_assert=>assert_equals( + act = mo_html->render( ) + exp = lv_exp ). + + ENDMETHOD. + +ENDCLASS. diff --git a/src/ui/zcl_abapgit_html.clas.xml b/src/ui/zcl_abapgit_html.clas.xml new file mode 100644 index 000000000..a5efdfc0d --- /dev/null +++ b/src/ui/zcl_abapgit_html.clas.xml @@ -0,0 +1,19 @@ + + + + + + ZCL_ABAPGIT_HTML + 1 + E + HTML + 2 + 1 + X + X + X + X + + + + diff --git a/src/zabapgit_gui.prog.abap b/src/zabapgit_gui.prog.abap index 6b3c01238..b7e27668f 100644 --- a/src/zabapgit_gui.prog.abap +++ b/src/zabapgit_gui.prog.abap @@ -252,7 +252,7 @@ CLASS lcl_gui IMPLEMENTATION. METHOD render. DATA: lv_url TYPE w3url, - lo_html TYPE REF TO lcl_html. + lo_html TYPE REF TO zcl_abapgit_html. lo_html = mi_cur_page->render( ). lv_url = cache_html( lo_html->render( iv_no_indent_jscss = abap_true ) ). diff --git a/src/zabapgit_html.prog.abap b/src/zabapgit_html.prog.abap index a373f0690..bc7439718 100644 --- a/src/zabapgit_html.prog.abap +++ b/src/zabapgit_html.prog.abap @@ -2,365 +2,6 @@ *& Include ZABAPGIT_HTML *&---------------------------------------------------------------------* -*----------------------------------------------------------------------* -* CLASS lcl_html DEFINITION -*----------------------------------------------------------------------* - -CLASS lcl_html DEFINITION FINAL. - PUBLIC SECTION. - CONSTANTS: c_indent_size TYPE i VALUE 2. - - CLASS-METHODS class_constructor. - METHODS reset. - METHODS add - IMPORTING iv_chunk TYPE any. - METHODS render - IMPORTING iv_no_indent_jscss TYPE abap_bool OPTIONAL - RETURNING VALUE(rv_html) TYPE string. - METHODS is_empty - RETURNING VALUE(rv_yes) TYPE abap_bool. - - METHODS add_a - IMPORTING - iv_txt TYPE string - iv_act TYPE string - iv_typ TYPE char1 DEFAULT zif_abapgit_definitions=>gc_action_type-sapevent - iv_opt TYPE clike OPTIONAL - iv_class TYPE string OPTIONAL - iv_id TYPE string OPTIONAL - iv_style TYPE string OPTIONAL. - - METHODS add_icon - IMPORTING - iv_name TYPE string - iv_hint TYPE string OPTIONAL - iv_class TYPE string OPTIONAL. - - CLASS-METHODS a - IMPORTING - iv_txt TYPE string - iv_act TYPE string - iv_typ TYPE char1 DEFAULT zif_abapgit_definitions=>gc_action_type-sapevent - iv_opt TYPE clike OPTIONAL - iv_class TYPE string OPTIONAL - iv_id TYPE string OPTIONAL - iv_style TYPE string OPTIONAL - RETURNING VALUE(rv_str) TYPE string. - - CLASS-METHODS icon - IMPORTING - iv_name TYPE string - iv_hint TYPE string OPTIONAL - iv_class TYPE string OPTIONAL - RETURNING VALUE(rv_str) TYPE string. - - PRIVATE SECTION. - CLASS-DATA: go_single_tags_re TYPE REF TO cl_abap_regex. - - DATA: mt_buffer TYPE string_table. - - TYPES: - BEGIN OF ty_indent_context, - no_indent_jscss TYPE abap_bool, - within_style TYPE abap_bool, - within_js TYPE abap_bool, - indent TYPE i, - indent_str TYPE string, - END OF ty_indent_context, - - BEGIN OF ty_study_result, - style_open TYPE abap_bool, - style_close TYPE abap_bool, - script_open TYPE abap_bool, - script_close TYPE abap_bool, - tag_close TYPE abap_bool, - curly_close TYPE abap_bool, - openings TYPE i, - closings TYPE i, - singles TYPE i, - END OF ty_study_result. - - METHODS indent_line - CHANGING - cs_context TYPE ty_indent_context - cv_line TYPE string. - - METHODS study_line - IMPORTING iv_line TYPE string - is_context TYPE ty_indent_context - RETURNING VALUE(rs_result) TYPE ty_study_result. - -ENDCLASS. "lcl_html DEFINITION - -*----------------------------------------------------------------------* -* CLASS lcl_html IMPLEMENTATION -*----------------------------------------------------------------------* -CLASS lcl_html IMPLEMENTATION. - - METHOD add. - - DATA: lv_type TYPE c, - lo_html TYPE REF TO lcl_html. - - FIELD-SYMBOLS: TYPE string_table. - - DESCRIBE FIELD iv_chunk TYPE lv_type. " Describe is faster than RTTI classes - - CASE lv_type. - WHEN 'C' OR 'g'. " Char or string - APPEND iv_chunk TO mt_buffer. - WHEN 'h'. " Table - ASSIGN iv_chunk TO . " Assuming table of strings ! Will dump otherwise - APPEND LINES OF TO mt_buffer. - WHEN 'r'. " Object ref - ASSERT iv_chunk IS BOUND. " Dev mistake - TRY. - lo_html ?= iv_chunk. - CATCH cx_sy_move_cast_error. - ASSERT 1 = 0. " Dev mistake - ENDTRY. - APPEND LINES OF lo_html->mt_buffer TO mt_buffer. - WHEN OTHERS. - ASSERT 1 = 0. " Dev mistake - ENDCASE. - - ENDMETHOD. " add - - METHOD reset. - CLEAR me->mt_buffer. - ENDMETHOD. "reset - - METHOD is_empty. - rv_yes = boolc( lines( mt_buffer ) = 0 ). - ENDMETHOD. "is_empty - - METHOD class_constructor. - CREATE OBJECT go_single_tags_re - EXPORTING - pattern = '<(AREA|BASE|BR|COL|COMMAND|EMBED|HR|IMG|INPUT|LINK|META|PARAM|SOURCE|!)' - ignore_case = abap_false. - ENDMETHOD. "class_constructor - - METHOD study_line. - - DATA: lv_line TYPE string, - lv_len TYPE i. - - lv_line = to_upper( shift_left( val = iv_line sub = ` ` ) ). - lv_len = strlen( lv_line ). - - " Some assumptions for simplification and speed - " - style & scripts tag should be opened/closed in a separate line - " - style & scripts opening and closing in one line is possible but only once - - " TODO & Issues - " - What if the string IS a well formed html already not just single line ? - - IF is_context-within_js = abap_true OR is_context-within_style = abap_true. - - IF is_context-within_js = abap_true AND lv_len >= 8 AND lv_line(8) = '
= 7 AND lv_line(7) = '= 1 AND lv_line(1) = '}'. - rs_result-curly_close = abap_true. - ENDIF. - - FIND ALL OCCURRENCES OF '{' IN lv_line MATCH COUNT rs_result-openings. - FIND ALL OCCURRENCES OF '}' IN lv_line MATCH COUNT rs_result-closings. - ENDIF. - - ELSE. - IF lv_len >= 7 AND lv_line(7) = ' 0. " Not found - rs_result-script_open = abap_true. - ENDIF. - ENDIF. - IF lv_len >= 6 AND lv_line(6) = ' 0. " Not found - rs_result-style_open = abap_true. - ENDIF. - ENDIF. - IF lv_len >= 2 AND lv_line(2) = ' 0. - lv_x_str = repeat( val = ` ` occ = ( cs_context-indent - 1 ) * c_indent_size ). - cv_line = lv_x_str && cv_line. - ELSE. - cv_line = cs_context-indent_str && cv_line. - ENDIF. - - " Context status update - CASE abap_true. - WHEN ls_study-script_open. - cs_context-within_js = abap_true. - cs_context-within_style = abap_false. - WHEN ls_study-style_open. - cs_context-within_js = abap_false. - cs_context-within_style = abap_true. - WHEN ls_study-script_close OR ls_study-style_close. - cs_context-within_js = abap_false. - cs_context-within_style = abap_false. - ls_study-closings = ls_study-closings + 1. - ENDCASE. - - " More-less logic chosen due to possible double tags in a line '
' - IF ls_study-openings <> ls_study-closings. - IF ls_study-openings > ls_study-closings. - cs_context-indent = cs_context-indent + 1. - ELSEIF cs_context-indent > 0. " AND ls_study-openings < ls_study-closings - cs_context-indent = cs_context-indent - 1. - ENDIF. - cs_context-indent_str = repeat( val = ` ` occ = cs_context-indent * c_indent_size ). - ENDIF. - - ENDMETHOD. "indent_line - - METHOD render. - - DATA: ls_context TYPE ty_indent_context, - lt_temp TYPE string_table. - - FIELD-SYMBOLS: LIKE LINE OF lt_temp, - LIKE LINE OF lt_temp. - - ls_context-no_indent_jscss = iv_no_indent_jscss. - - LOOP AT mt_buffer ASSIGNING . - APPEND TO lt_temp ASSIGNING . - indent_line( CHANGING cs_context = ls_context cv_line = ). - ENDLOOP. - - CONCATENATE LINES OF lt_temp INTO rv_html SEPARATED BY zif_abapgit_definitions=>gc_newline. - - ENDMETHOD. "render - - METHOD add_a. - - add( a( iv_txt = iv_txt - iv_act = iv_act - iv_typ = iv_typ - iv_opt = iv_opt - iv_class = iv_class - iv_id = iv_id - iv_style = iv_style ) ). - - ENDMETHOD. "add_a - - METHOD a. - - DATA: lv_class TYPE string, - lv_href TYPE string, - lv_click TYPE string, - lv_id TYPE string, - lv_style TYPE string. - - lv_class = iv_class. - - IF iv_opt CA zif_abapgit_definitions=>gc_html_opt-strong. - lv_class = lv_class && ' emphasis' ##NO_TEXT. - ENDIF. - IF iv_opt CA zif_abapgit_definitions=>gc_html_opt-cancel. - lv_class = lv_class && ' attention' ##NO_TEXT. - ENDIF. - IF iv_opt CA zif_abapgit_definitions=>gc_html_opt-crossout. - lv_class = lv_class && ' crossout grey' ##NO_TEXT. - ENDIF. - IF lv_class IS NOT INITIAL. - SHIFT lv_class LEFT DELETING LEADING space. - lv_class = | class="{ lv_class }"|. - ENDIF. - - lv_href = ' href="#"'. " Default, dummy - IF iv_act IS NOT INITIAL OR iv_typ = zif_abapgit_definitions=>gc_action_type-dummy. - CASE iv_typ. - WHEN zif_abapgit_definitions=>gc_action_type-url. - lv_href = | href="{ iv_act }"|. - WHEN zif_abapgit_definitions=>gc_action_type-sapevent. - lv_href = | href="sapevent:{ iv_act }"|. - WHEN zif_abapgit_definitions=>gc_action_type-onclick. - lv_href = ' href="#"'. - lv_click = | onclick="{ iv_act }"|. - WHEN zif_abapgit_definitions=>gc_action_type-dummy. - lv_href = ' href="#"'. - ENDCASE. - ENDIF. - - IF iv_id IS NOT INITIAL. - lv_id = | id="{ iv_id }"|. - ENDIF. - - IF iv_style IS NOT INITIAL. - lv_style = | style="{ iv_style }"|. - ENDIF. - - rv_str = |{ iv_txt }|. - - ENDMETHOD. "a - - METHOD add_icon. - - add( icon( iv_name = iv_name - iv_class = iv_class - iv_hint = iv_hint ) ). - - ENDMETHOD. "add_icon - - METHOD icon. - - DATA: lv_hint TYPE string, - lv_name TYPE string, - lv_color TYPE string, - lv_class TYPE string. - - SPLIT iv_name AT '/' INTO lv_name lv_color. - - IF iv_hint IS NOT INITIAL. - lv_hint = | title="{ iv_hint }"|. - ENDIF. - IF iv_class IS NOT INITIAL. - lv_class = | { iv_class }|. - ENDIF. - IF lv_color IS NOT INITIAL. - lv_color = | { lv_color }|. - ENDIF. - - rv_str = ||. - - ENDMETHOD. "icon - -ENDCLASS. "lcl_html IMPLEMENTATION - *----------------------------------------------------------------------* * CLASS lcl_html_toolbar DEFINITION *----------------------------------------------------------------------* @@ -390,7 +31,7 @@ CLASS lcl_html_toolbar DEFINITION FINAL. iv_right TYPE abap_bool OPTIONAL iv_sort TYPE abap_bool OPTIONAL RETURNING - VALUE(ro_html) TYPE REF TO lcl_html, + VALUE(ro_html) TYPE REF TO zcl_abapgit_html, render_as_droplist IMPORTING iv_label TYPE string @@ -398,7 +39,7 @@ CLASS lcl_html_toolbar DEFINITION FINAL. iv_sort TYPE abap_bool OPTIONAL iv_corner TYPE abap_bool OPTIONAL RETURNING - VALUE(ro_html) TYPE REF TO lcl_html. + VALUE(ro_html) TYPE REF TO zcl_abapgit_html. PRIVATE SECTION. TYPES: @@ -425,7 +66,7 @@ CLASS lcl_html_toolbar DEFINITION FINAL. IMPORTING iv_sort TYPE abap_bool OPTIONAL RETURNING - VALUE(ro_html) TYPE REF TO lcl_html. + VALUE(ro_html) TYPE REF TO zcl_abapgit_html. ENDCLASS. "lcl_html_toolbar DEFINITION @@ -552,13 +193,13 @@ CLASS lcl_html_toolbar IMPLEMENTATION. IF lv_has_icons = abap_true. IF -chk = abap_true. - lv_icon = lcl_html=>icon( 'check/blue' ). + lv_icon = zcl_abapgit_html=>icon( 'check/blue' ). lv_check = ' data-check="X"'. ELSEIF -chk = abap_false. - lv_icon = lcl_html=>icon( 'check/grey' ). + lv_icon = zcl_abapgit_html=>icon( 'check/grey' ). lv_check = ' data-check=""'. ELSE. " abap_undefined -> not a check box - lv_icon = lcl_html=>icon( -ico ). + lv_icon = zcl_abapgit_html=>icon( -ico ). ENDIF. ENDIF. diff --git a/src/zabapgit_html_chunks.prog.abap b/src/zabapgit_html_chunks.prog.abap index e0ba6191e..a2df33fb0 100644 --- a/src/zabapgit_html_chunks.prog.abap +++ b/src/zabapgit_html_chunks.prog.abap @@ -9,7 +9,7 @@ CLASS lcl_gui_chunk_lib DEFINITION FINAL. CLASS-METHODS render_error IMPORTING ix_error TYPE REF TO zcx_abapgit_exception OPTIONAL iv_error TYPE string OPTIONAL - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. CLASS-METHODS render_repo_top IMPORTING io_repo TYPE REF TO lcl_repo @@ -18,7 +18,7 @@ CLASS lcl_gui_chunk_lib DEFINITION FINAL. iv_interactive_branch TYPE abap_bool DEFAULT abap_false iv_branch TYPE string OPTIONAL io_news TYPE REF TO lcl_news OPTIONAL - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. CLASS-METHODS render_item_state @@ -30,17 +30,17 @@ CLASS lcl_gui_chunk_lib DEFINITION FINAL. IMPORTING iv_branch TYPE string io_repo TYPE REF TO lcl_repo_online iv_interactive TYPE abap_bool - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. CLASS-METHODS render_js_error_banner - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. CLASS-METHODS render_news IMPORTING io_news TYPE REF TO lcl_news - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. ENDCLASS. "lcl_gui_chunk_lib @@ -87,9 +87,9 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION. ENDIF. ro_html->add_a( iv_act = 'displayNews()' iv_typ = zif_abapgit_definitions=>gc_action_type-onclick - iv_txt = lcl_html=>icon( iv_name = lv_icon - iv_class = 'pad-sides' - iv_hint = 'Display changelog' ) ). + iv_txt = zcl_abapgit_html=>icon( iv_name = lv_icon + iv_class = 'pad-sides' + iv_hint = 'Display changelog' ) ). ENDIF. ro_html->add( '' ). @@ -102,9 +102,9 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION. lv_icon = 'star/grey' ##NO_TEXT. ENDIF. ro_html->add_a( iv_act = |{ zif_abapgit_definitions=>gc_action-repo_toggle_fav }?{ io_repo->get_key( ) }| - iv_txt = lcl_html=>icon( iv_name = lv_icon - iv_class = 'pad-sides' - iv_hint = 'Click to toggle favorite' ) ). + iv_txt = zcl_abapgit_html=>icon( iv_name = lv_icon + iv_class = 'pad-sides' + iv_hint = 'Click to toggle favorite' ) ). " BG IF lo_pback->exists( io_repo->get_key( ) ) = abap_true. @@ -229,7 +229,7 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION. ENDIF. ro_html->add( '
' ). - ro_html->add( |{ lcl_html=>icon( 'alert/red' ) } Error: { lv_error }| ). + ro_html->add( |{ zcl_abapgit_html=>icon( 'alert/red' ) } Error: { lv_error }| ). ro_html->add( '
' ). ENDMETHOD. "render_error @@ -237,7 +237,7 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION. METHOD render_js_error_banner. CREATE OBJECT ro_html. ro_html->add( '
' ). - ro_html->add( |{ lcl_html=>icon( 'alert/red' ) }| && + ro_html->add( |{ zcl_abapgit_html=>icon( 'alert/red' ) }| && ' If this does not disappear soon,' && ' then there is a JS init error, please log an issue' ). ro_html->add( '
' ). @@ -267,7 +267,7 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION. ro_html->add( '
Announcement of the latest changes' && '
' - && lcl_html=>a( + && zcl_abapgit_html=>a( iv_txt = '❌' iv_typ = zif_abapgit_definitions=>gc_action_type-onclick iv_act = 'displayNews()' @@ -276,7 +276,7 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION. IF io_news->has_important( ) = abap_true. ro_html->add( '
' - && lcl_html=>icon( iv_name = 'alert' iv_class = 'pad-right' ) + && zcl_abapgit_html=>icon( iv_name = 'alert' iv_class = 'pad-right' ) && 'Please note changes marked with "!"' && '
' ). ENDIF. diff --git a/src/zabapgit_macros.prog.abap b/src/zabapgit_macros.prog.abap index cf9f033a1..4c2b39109 100644 --- a/src/zabapgit_macros.prog.abap +++ b/src/zabapgit_macros.prog.abap @@ -1,3 +1,5 @@ *&---------------------------------------------------------------------* *& Include ZABAPGIT_MACROS *&---------------------------------------------------------------------* + +* todo, include to be deleted diff --git a/src/zabapgit_page.prog.abap b/src/zabapgit_page.prog.abap index 4d3212766..4b5a14832 100644 --- a/src/zabapgit_page.prog.abap +++ b/src/zabapgit_page.prog.abap @@ -17,7 +17,7 @@ INTERFACE lif_gui_page. RAISING zcx_abapgit_exception zcx_abapgit_cancel. METHODS render - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. ENDINTERFACE. @@ -37,27 +37,27 @@ CLASS lcl_gui_page DEFINITION ABSTRACT. DATA: ms_control TYPE ty_control. METHODS render_content ABSTRACT - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. METHODS scripts - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. PRIVATE SECTION. METHODS html_head - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS title - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS footer - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS redirect - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. ENDCLASS. "lcl_gui_page @@ -90,8 +90,8 @@ CLASS lcl_gui_page IMPLEMENTATION. ro_html->add( '' ). "#EC NOTEXT ro_html->add( || ). "#EC NOTEXT ro_html->add( |
► { @@ -151,7 +151,7 @@ CLASS lcl_gui_page IMPLEMENTATION. METHOD lif_gui_page~render. - DATA lo_script TYPE REF TO lcl_html. + DATA lo_script TYPE REF TO zcl_abapgit_html. " Redirect IF ms_control-redirect_url IS NOT INITIAL. diff --git a/src/zabapgit_page_background.prog.abap b/src/zabapgit_page_background.prog.abap index da61c210d..689e2272f 100644 --- a/src/zabapgit_page_background.prog.abap +++ b/src/zabapgit_page_background.prog.abap @@ -91,7 +91,7 @@ CLASS lcl_gui_page_bkg DEFINITION FINAL build_menu RETURNING VALUE(ro_menu) TYPE REF TO lcl_html_toolbar, render_data - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. ENDCLASS. diff --git a/src/zabapgit_page_branch_overview.prog.abap b/src/zabapgit_page_branch_overview.prog.abap index e3b75244c..bd59eb37a 100644 --- a/src/zabapgit_page_branch_overview.prog.abap +++ b/src/zabapgit_page_branch_overview.prog.abap @@ -367,13 +367,13 @@ CLASS lcl_gui_page_boverview DEFINITION FINAL INHERITING FROM lcl_gui_page. refresh RAISING zcx_abapgit_exception, body - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception, form_select IMPORTING iv_name TYPE string - RETURNING VALUE(ro_html) TYPE REF TO lcl_html, + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html, render_merge - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception, decode_merge IMPORTING it_postdata TYPE cnht_post_data_tab diff --git a/src/zabapgit_page_commit.prog.abap b/src/zabapgit_page_commit.prog.abap index 45f551843..7d3d1fa98 100644 --- a/src/zabapgit_page_commit.prog.abap +++ b/src/zabapgit_page_commit.prog.abap @@ -29,19 +29,19 @@ CLASS lcl_gui_page_commit DEFINITION FINAL INHERITING FROM lcl_gui_page. METHODS: render_menu - RETURNING VALUE(ro_html) TYPE REF TO lcl_html, + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html, render_stage - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception, render_form - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception, render_text_input IMPORTING iv_name TYPE string iv_label TYPE string iv_value TYPE string OPTIONAL iv_max_length TYPE string OPTIONAL - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. ENDCLASS. diff --git a/src/zabapgit_page_debug.prog.abap b/src/zabapgit_page_debug.prog.abap index 6decabfed..c2ca6c9b0 100644 --- a/src/zabapgit_page_debug.prog.abap +++ b/src/zabapgit_page_debug.prog.abap @@ -13,7 +13,7 @@ CLASS lcl_gui_page_debuginfo DEFINITION FINAL INHERITING FROM lcl_gui_page. PRIVATE SECTION. METHODS render_debug_info - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. METHODS render_supported_object_types RETURNING VALUE(rv_html) TYPE string. diff --git a/src/zabapgit_page_diff.prog.abap b/src/zabapgit_page_diff.prog.abap index e3fe4d152..134e5410b 100644 --- a/src/zabapgit_page_diff.prog.abap +++ b/src/zabapgit_page_diff.prog.abap @@ -52,26 +52,26 @@ CLASS lcl_gui_page_diff DEFINITION FINAL INHERITING FROM lcl_gui_page. METHODS render_diff IMPORTING is_diff TYPE ty_file_diff - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_diff_head IMPORTING is_diff TYPE ty_file_diff - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_table_head - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_lines IMPORTING is_diff TYPE ty_file_diff - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_beacon IMPORTING is_diff_line TYPE zcl_abapgit_diff=>ty_diff is_diff TYPE ty_file_diff - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_line_split IMPORTING is_diff_line TYPE zcl_abapgit_diff=>ty_diff iv_fstate TYPE char1 - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_line_unified IMPORTING is_diff_line TYPE zcl_abapgit_diff=>ty_diff OPTIONAL - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS append_diff IMPORTING it_remote TYPE zif_abapgit_definitions=>ty_files_tt it_local TYPE zif_abapgit_definitions=>ty_files_item_tt diff --git a/src/zabapgit_page_main.prog.abap b/src/zabapgit_page_main.prog.abap index 5841010c7..97c9b7d91 100644 --- a/src/zabapgit_page_main.prog.abap +++ b/src/zabapgit_page_main.prog.abap @@ -29,13 +29,13 @@ CLASS lcl_gui_page_main DEFINITION FINAL INHERITING FROM lcl_gui_page. RAISING zcx_abapgit_exception, render_toc IMPORTING it_repo_list TYPE lcl_repo_srv=>ty_repo_tt - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception, build_main_menu RETURNING VALUE(ro_menu) TYPE REF TO lcl_html_toolbar, render_repo IMPORTING io_repo TYPE REF TO lcl_repo - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. ENDCLASS. @@ -267,7 +267,7 @@ CLASS lcl_gui_page_main IMPLEMENTATION. ro_html->add( '' ). ro_html->add( || ). ro_html->add( '' ). ro_html->add( '' ). diff --git a/src/zabapgit_page_settings.prog.abap b/src/zabapgit_page_settings.prog.abap index 7519d03c5..049d3e205 100644 --- a/src/zabapgit_page_settings.prog.abap +++ b/src/zabapgit_page_settings.prog.abap @@ -23,19 +23,19 @@ CLASS lcl_gui_page_settings DEFINITION FINAL INHERITING FROM lcl_gui_page. mv_error TYPE abap_bool. METHODS render_proxy - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_development_internals - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_form_begin - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_form_end - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_max_lines - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_adt_jump_enabled - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS render_commit_msg - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. METHODS build_settings IMPORTING it_post_fields TYPE tihttpnvp. diff --git a/src/zabapgit_page_stage.prog.abap b/src/zabapgit_page_stage.prog.abap index bc401a9e6..349cdf764 100644 --- a/src/zabapgit_page_stage.prog.abap +++ b/src/zabapgit_page_stage.prog.abap @@ -30,16 +30,16 @@ CLASS lcl_gui_page_stage DEFINITION FINAL INHERITING FROM lcl_gui_page. METHODS: render_list - RETURNING VALUE(ro_html) TYPE REF TO lcl_html, + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html, render_file IMPORTING iv_context TYPE string is_file TYPE zif_abapgit_definitions=>ty_file is_item TYPE zif_abapgit_definitions=>ty_item OPTIONAL - RETURNING VALUE(ro_html) TYPE REF TO lcl_html, + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html, render_actions - RETURNING VALUE(ro_html) TYPE REF TO lcl_html, + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html, read_last_changed_by IMPORTING is_file TYPE zif_abapgit_definitions=>ty_file @@ -248,8 +248,9 @@ CLASS lcl_gui_page_stage IMPLEMENTATION. WHEN 'local'. lv_param = lcl_html_action_utils=>file_encode( iv_key = mo_repo->get_key( ) ig_file = is_file ). - lv_filename = lcl_html=>a( iv_txt = lv_filename - iv_act = |{ zif_abapgit_definitions=>gc_action-go_diff }?{ lv_param }| ). + lv_filename = zcl_abapgit_html=>a( + iv_txt = lv_filename + iv_act = |{ zif_abapgit_definitions=>gc_action-go_diff }?{ lv_param }| ). ro_html->add( || ). ro_html->add( || ). ro_html->add( || ). diff --git a/src/zabapgit_unit_test.prog.abap b/src/zabapgit_unit_test.prog.abap index 54e8f87db..61946014b 100644 --- a/src/zabapgit_unit_test.prog.abap +++ b/src/zabapgit_unit_test.prog.abap @@ -925,128 +925,6 @@ CLASS ltcl_git_pack IMPLEMENTATION. ENDCLASS. "lcl_abap_unit IMPLEMENTATION -CLASS ltcl_html DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL. - - PRIVATE SECTION. - DATA: mo_html TYPE REF TO lcl_html. - - METHODS: - indent1 FOR TESTING RAISING zcx_abapgit_exception, - indent2 FOR TESTING RAISING zcx_abapgit_exception, - indent3 FOR TESTING RAISING zcx_abapgit_exception, - indent4 FOR TESTING RAISING zcx_abapgit_exception, - style1 FOR TESTING RAISING zcx_abapgit_exception. - - METHODS: - setup. - -ENDCLASS. "ltcl_html - -CLASS ltcl_html IMPLEMENTATION. - - METHOD setup. - CREATE OBJECT mo_html. - ENDMETHOD. - - METHOD indent1. - - DATA lv_exp TYPE string. - - mo_html->add( '' ). - - lv_exp = ''. - - cl_abap_unit_assert=>assert_equals( - act = mo_html->render( ) - exp = lv_exp ). - - ENDMETHOD. - - METHOD indent2. - - DATA lv_exp TYPE string. - - mo_html->add( '' ). - - lv_exp = ''. - - cl_abap_unit_assert=>assert_equals( - act = mo_html->render( ) - exp = lv_exp ). - - ENDMETHOD. - - METHOD indent3. - - DATA lv_exp TYPE string. - - mo_html->add( '' ). - - lv_exp = ''. - - cl_abap_unit_assert=>assert_equals( - act = mo_html->render( ) - exp = lv_exp ). - - ENDMETHOD. - - METHOD indent4. - - DATA lv_exp TYPE string. - - mo_html->add( '' ). - - lv_exp = ''. - - cl_abap_unit_assert=>assert_equals( - act = mo_html->render( ) - exp = lv_exp ). - - ENDMETHOD. - - METHOD style1. - - DATA lv_exp TYPE string. - - mo_html->add( '' ). - - lv_exp = ''. - - cl_abap_unit_assert=>assert_equals( - act = mo_html->render( ) - exp = lv_exp ). - - ENDMETHOD. - - -ENDCLASS. "ltcl_html - *----------------------------------------------------------------------* * CLASS ltcl_serialize DEFINITION *----------------------------------------------------------------------* diff --git a/src/zabapgit_util.prog.abap b/src/zabapgit_util.prog.abap index f1a38f6db..887403301 100644 --- a/src/zabapgit_util.prog.abap +++ b/src/zabapgit_util.prog.abap @@ -185,7 +185,7 @@ CLASS lcl_log DEFINITION FINAL. count RETURNING VALUE(rv_count) TYPE i, to_html - RETURNING VALUE(ro_html) TYPE REF TO lcl_html, + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html, clear, has_rc "For unit tests mainly IMPORTING iv_rc TYPE balsort diff --git a/src/zabapgit_view_repo.prog.abap b/src/zabapgit_view_repo.prog.abap index feca9b1aa..e9ba46a36 100644 --- a/src/zabapgit_view_repo.prog.abap +++ b/src/zabapgit_view_repo.prog.abap @@ -33,7 +33,7 @@ CLASS lcl_gui_view_repo DEFINITION FINAL. render_head_line IMPORTING iv_lstate TYPE char1 iv_rstate TYPE char1 - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception, build_head_menu IMPORTING iv_lstate TYPE char1 @@ -45,14 +45,14 @@ CLASS lcl_gui_view_repo DEFINITION FINAL. RAISING zcx_abapgit_exception, render_item IMPORTING is_item TYPE lcl_repo_content_list=>ty_repo_item - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception, render_item_files IMPORTING is_item TYPE lcl_repo_content_list=>ty_repo_item - RETURNING VALUE(ro_html) TYPE REF TO lcl_html, + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html, render_item_command IMPORTING is_item TYPE lcl_repo_content_list=>ty_repo_item - RETURNING VALUE(ro_html) TYPE REF TO lcl_html, + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html, get_item_class IMPORTING is_item TYPE lcl_repo_content_list=>ty_repo_item RETURNING VALUE(rv_html) TYPE string, @@ -62,7 +62,7 @@ CLASS lcl_gui_view_repo DEFINITION FINAL. render_empty_package RETURNING VALUE(rv_html) TYPE string, render_parent_dir - RETURNING VALUE(ro_html) TYPE REF TO lcl_html + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html RAISING zcx_abapgit_exception. METHODS: @@ -199,9 +199,9 @@ CLASS lcl_gui_view_repo IMPLEMENTATION. ENDIF. lv_add_str = |+{ mv_max_setting }|. ro_html->add( |Only { lv_max_str } shown in list. Display { - lcl_html=>a( iv_txt = lv_add_str iv_act = c_actions-display_more ) + zcl_abapgit_html=>a( iv_txt = lv_add_str iv_act = c_actions-display_more ) } more. (Set in Advanced > { - lcl_html=>a( iv_txt = 'Settings' iv_act = zif_abapgit_definitions=>gc_action-go_settings ) + zcl_abapgit_html=>a( iv_txt = 'Settings' iv_act = zif_abapgit_definitions=>gc_action-go_settings ) } )| ). ro_html->add( '' ). ENDIF. @@ -381,7 +381,7 @@ CLASS lcl_gui_view_repo IMPLEMENTATION. io_sub = lo_tb_advanced ) ##NO_TEXT. ro_toolbar->add( iv_txt = 'Refresh' iv_act = |{ zif_abapgit_definitions=>gc_action-repo_refresh }?{ lv_key }| ). - ro_toolbar->add( iv_txt = lcl_html=>icon( iv_name = 'settings/grey70' ) + ro_toolbar->add( iv_txt = zcl_abapgit_html=>icon( iv_name = 'settings/grey70' ) io_sub = build_grid_menu( ) ). ENDMETHOD. "build_head_menu @@ -408,17 +408,17 @@ CLASS lcl_gui_view_repo IMPLEMENTATION. CASE is_item-obj_type. WHEN 'PROG' OR 'CLAS' OR 'FUGR'. - rv_html = lcl_html=>icon( 'file-code/darkgrey' ). + rv_html = zcl_abapgit_html=>icon( 'file-code/darkgrey' ). WHEN 'W3MI' OR 'W3HT'. - rv_html = lcl_html=>icon( 'file-binary/darkgrey' ). + rv_html = zcl_abapgit_html=>icon( 'file-binary/darkgrey' ). WHEN ''. rv_html = space. " no icon WHEN OTHERS. - rv_html = lcl_html=>icon( 'file/darkgrey' ). + rv_html = zcl_abapgit_html=>icon( 'file/darkgrey' ). ENDCASE. IF is_item-is_dir = abap_true. - rv_html = lcl_html=>icon( 'file-directory/darkgrey' ). + rv_html = zcl_abapgit_html=>icon( 'file-directory/darkgrey' ). ENDIF. ENDMETHOD. "get_item_icon @@ -551,7 +551,7 @@ CLASS lcl_gui_view_repo IMPLEMENTATION. CREATE OBJECT ro_html. ro_html->add( '' ). - ro_html->add( || ). + ro_html->add( || ). ro_html->add( || ). IF mo_repo->is_offline( ) = abap_false. ro_html->add( || ). " Dummy for online @@ -569,8 +569,8 @@ CLASS lcl_gui_view_repo IMPLEMENTATION. REPLACE FIRST OCCURRENCE OF mv_cur_dir IN lv_path WITH ''. lv_encode = lcl_html_action_utils=>dir_encode( lv_path ). - rv_html = lcl_html=>a( iv_txt = lv_path - iv_act = |{ c_actions-change_dir }?{ lv_encode }| ). + rv_html = zcl_abapgit_html=>a( iv_txt = lv_path + iv_act = |{ c_actions-change_dir }?{ lv_encode }| ). ENDMETHOD. "build_dir_jump_link @@ -581,8 +581,8 @@ CLASS lcl_gui_view_repo IMPLEMENTATION. lv_encode = lcl_html_action_utils=>jump_encode( iv_obj_type = is_item-obj_type iv_obj_name = is_item-obj_name ). - rv_html = lcl_html=>a( iv_txt = |{ is_item-obj_name }| - iv_act = |{ zif_abapgit_definitions=>gc_action-jump }?{ lv_encode }| ). + rv_html = zcl_abapgit_html=>a( iv_txt = |{ is_item-obj_name }| + iv_act = |{ zif_abapgit_definitions=>gc_action-jump }?{ lv_encode }| ). ENDMETHOD. "build_obj_jump_link diff --git a/src/zabapgit_view_tutorial.prog.abap b/src/zabapgit_view_tutorial.prog.abap index 37e92acd5..afdf69757 100644 --- a/src/zabapgit_view_tutorial.prog.abap +++ b/src/zabapgit_view_tutorial.prog.abap @@ -9,7 +9,7 @@ CLASS lcl_gui_view_tutorial DEFINITION FINAL. PRIVATE SECTION. METHODS render_content - RETURNING VALUE(ro_html) TYPE REF TO lcl_html. + RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html. ENDCLASS. "lcl_gui_view_tutorial @@ -58,9 +58,9 @@ CLASS lcl_gui_view_tutorial IMPLEMENTATION. ro_html->add( '

Repository list and favorites

' ). ro_html->add( '

    ' ). ro_html->add( |
  • To choose a repo press { - lcl_html=>icon( 'three-bars/blue' ) } at the favorite bar.
  • | ). + zcl_abapgit_html=>icon( 'three-bars/blue' ) } at the favorite bar.| ). ro_html->add( |
  • To favorite a repo click { - lcl_html=>icon( 'star/darkgrey' ) } icon at repo toolbar.
  • | ). + zcl_abapgit_html=>icon( 'star/darkgrey' ) } icon at repo toolbar.| ). ro_html->add( '

' ). ro_html->add( '

abapGit related repositories

' ).
{ - lcl_html=>icon( iv_name = 'star/blue' iv_hint = 'Favorites' ) + zcl_abapgit_html=>icon( iv_name = 'star/blue' iv_hint = 'Favorites' ) }' ). " Maximize width @@ -275,14 +275,14 @@ CLASS lcl_gui_page_main IMPLEMENTATION. ro_html->add( lo_favbar->render( iv_sort = abap_true ) ). ELSE. ro_html->add( |No favorites so far. For more info please check { - lcl_html=>a( iv_txt = 'tutorial' iv_act = zif_abapgit_definitions=>gc_action-go_tutorial ) + zcl_abapgit_html=>a( iv_txt = 'tutorial' iv_act = zif_abapgit_definitions=>gc_action-go_tutorial ) }| ). ENDIF. ro_html->add( '' ). ro_html->add( lo_allbar->render_as_droplist( - iv_label = lcl_html=>icon( iv_name = 'three-bars/blue' ) + iv_label = zcl_abapgit_html=>icon( iv_name = 'three-bars/blue' ) iv_right = abap_true iv_sort = abap_true ) ). ro_html->add( '{ is_item-obj_type }{ lv_filename }{ read_last_changed_by( is_file ) }' ). - mo_html->add( 'hello world' ). - mo_html->add( '' && zif_abapgit_definitions=>gc_newline && - ' hello world' && zif_abapgit_definitions=>gc_newline && - '' ). - mo_html->add( '' ). - mo_html->add( '' && zif_abapgit_definitions=>gc_newline && - ' ' && zif_abapgit_definitions=>gc_newline && - '' ). - mo_html->add( '' ). - mo_html->add( '' && zif_abapgit_definitions=>gc_newline && - ' ' && zif_abapgit_definitions=>gc_newline && - '' ). - mo_html->add( 'foo
bar' ). - mo_html->add( '
' && zif_abapgit_definitions=>gc_newline && - ' foo
bar' && zif_abapgit_definitions=>gc_newline && - '
{ lcl_html=>icon( 'dir' ) }{ zcl_abapgit_html=>icon( 'dir' ) }{ build_dir_jump_link( '..' ) }