anchor.diff:  ENDCLASS.                    "lcl_pack IMPLEMENTATION
   
   *----------------------------------------------------------------------*
  +*       CLASS lcl_persistence DEFINITION
  +*----------------------------------------------------------------------*
  +*
  +*----------------------------------------------------------------------*
  +CLASS lcl_persistence DEFINITION FINAL.
  +
  +  PUBLIC SECTION.
  +    CLASS-METHODS add IMPORTING iv_repo TYPE string.
  +    CLASS-METHODS list RETURNING value(rt_repos) TYPE tt_string.
  +
  +ENDCLASS.                    "lcl_persistence DEFINITION
  +
  +*----------------------------------------------------------------------*
  +*       CLASS lcl_persistence IMPLEMENTATION
  +*----------------------------------------------------------------------*
  +*
  +*----------------------------------------------------------------------*
  +CLASS lcl_persistence IMPLEMENTATION.
  +
  +  METHOD add.
  +* todo
  +    RETURN.
  +  ENDMETHOD.                    "add
  +
  +  METHOD list.
  +* todo
  +    APPEND 'https://github.com/larshp/Foobar.git' TO rt_repos.
  +  ENDMETHOD.                    "list
  +
  +ENDCLASS.                    "lcl_persistence IMPLEMENTATION
  +
  +*----------------------------------------------------------------------*
  +*       CLASS lcl_view DEFINITION
  +*----------------------------------------------------------------------*
  +*
  +*----------------------------------------------------------------------*
  +CLASS lcl_gui DEFINITION FINAL.
  +
  +  PUBLIC SECTION.
  +    CLASS-METHODS: init.
  +
  +    CLASS-METHODS: on_sapevent
  +                      FOR EVENT sapevent OF cl_gui_html_viewer
  +                      IMPORTING action frame getdata postdata query_table. "#EC NEEDED
  +
  +  PRIVATE SECTION.
  +    CLASS-DATA go_html_viewer TYPE REF TO cl_gui_html_viewer.
  +
  +    CLASS-METHODS: view
  +                      IMPORTING iv_html TYPE string.
  +
  +    CLASS-METHODS: render
  +                      RETURNING value(rv_html) TYPE string.
  +
  +    CLASS-METHODS: render_css
  +                      RETURNING value(rv_html) TYPE string.
  +
  +    CLASS-METHODS: render_repo
  +                      IMPORTING iv_repo TYPE string
  +                      RETURNING value(rv_html) TYPE string.
  +
  +    CLASS-METHODS: short_name
  +                      IMPORTING iv_repo TYPE string
  +                      RETURNING value(rv_short) TYPE string.
  +
  +    CLASS-METHODS: install.
  +
  +    CLASS-METHODS: add.
  +
  +ENDCLASS.                    "lcl_view DEFINITION
  +
  +*----------------------------------------------------------------------*
  +*       CLASS lcl_view IMPLEMENTATION
  +*----------------------------------------------------------------------*
  +*
  +*----------------------------------------------------------------------*
  +CLASS lcl_gui IMPLEMENTATION.
  +
  +  METHOD on_sapevent.
  +
  +    CASE action.
  +      WHEN 'install'.
  +        install( ).
  +      WHEN 'explore'.
  +* todo
  +        BREAK-POINT.
  +      WHEN 'abapgithome'.
  +        cl_gui_frontend_services=>execute(
  +            document = 'https://github.com/larshp/abapGit' ).
  +      WHEN 'add'.
  +        add( ).
  +      WHEN OTHERS.
  +        BREAK-POINT.
  +    ENDCASE.
  +
  +  ENDMETHOD.                    "on_sapevent
  +
  +  METHOD add.
  +
  +    DATA: lv_obj_type TYPE rseuap-obj_type,
  +          lv_obj_name TYPE rseuap-obj_name.
  +
  +
  +    CALL FUNCTION 'WB_TREE_OBJECT_CHOICE'
  +      IMPORTING
  +        obj_type = lv_obj_type
  +        obj_name = lv_obj_name.
  +    IF lv_obj_type IS INITIAL.
  +      RETURN.
  +    ENDIF.
  +
  +    BREAK-POINT.
  +
  +  ENDMETHOD.                    "add
  +
  +  METHOD install.
  +
  +* todo, let user choose
  +* lcl_persistence=>add( ).
  +    RETURN.
  +
  +  ENDMETHOD.                    "install
  +
  +  METHOD render_css.
  +
  +    rv_html = '<style type="text/css">' &&
  +          'body {' &&
  +          'font-family: verdana;' &&
  +          '}' &&
  +          'a:link {' &&
  +          'color: blue;' &&
  +          '}' &&
  +          'a:visited {' &&
  +          'color: blue;' &&
  +          '}' &&
  +          'a.grey:link {' &&
  +          'color: grey;' &&
  +          'font-size: smaller;' &&
  +          '}' &&
  +          'a.grey:visited {' &&
  +          'color: grey;' &&
  +          'font-size: smaller;' &&
  +          '}' &&
  +          'h1 {' &&
  +          'display: inline;' &&
  +          '}' &&
  +          'h2 {' &&
  +          'display: inline;' &&
  +          '}' &&
  +          '</style>'.
  +
  +  ENDMETHOD.                    "render_css
  +
  +  METHOD render.
  +
  +    DATA: lt_repos TYPE tt_string,
  +          lv_repo  LIKE LINE OF lt_repos.
  +
  +
  +    lt_repos = lcl_persistence=>list( ).
  +
  +    rv_html = '<html>' &&
  +      '<head>' &&
  +      '<title>My first styled page</title>' &&
  +      render_css( ) &&
  +      '</head>' &&
  +      '<body>' &&
  +      '<b><h1>abapGit</h1></b>&nbsp;' &&
  +      '<a href="sapevent:install">Clone/Install/Start/New</a>&nbsp;' &&
  +      '<a href="sapevent:explore">Explore</a>&nbsp;' &&
  +      '<a href="sapevent:abapgithome">abapGit@GitHub</a>&nbsp;' &&
  +      '<hr>'.
  +
  +    LOOP AT lt_repos INTO lv_repo.
  +      rv_html = rv_html &&
  +        '<a href="#' &&
  +        short_name( lv_repo ) &&
  +        '" class="grey">' &&
  +        short_name( lv_repo ) &&
  +        '</a>&nbsp;'.
  +    ENDLOOP.
  +
  +    rv_html = rv_html && '<br><br><br>'.
  +
  +    LOOP AT lt_repos INTO lv_repo.
  +      rv_html = rv_html && render_repo( lv_repo ).
  +    ENDLOOP.
  +
  +    rv_html = rv_html && '</body></html>'.
  +
  +  ENDMETHOD.                    "render
  +
  +  METHOD render_repo.
  +
  +    rv_html = rv_html &&
  +      '<a id="' &&
  +      short_name( iv_repo ) &&
  +      '"></a><h2>' &&
  +      short_name( iv_repo ) &&
  +      '</h2>&nbsp;' &&
  +      iv_repo &&
  +      '<br>'.
  +
  +    rv_html = rv_html && 'todo<br><a href="sapevent:add">add</a>'.
  +
  +  ENDMETHOD.                    "render_repo
  +
  +  METHOD short_name.
  +
  +*todo
  +    rv_short = 'Foobar'.                                    "#EC NOTEXT
  +
  +  ENDMETHOD.                    "short_name
  +
  +  METHOD init.
  +
  +    DATA: lt_events TYPE cntl_simple_events,
  +          ls_event  LIKE LINE OF lt_events.
  +
  +
  +    CREATE OBJECT go_html_viewer
  +      EXPORTING
  +        parent = cl_gui_container=>screen0.
  +
  +    CLEAR ls_event.
  +    ls_event-eventid = go_html_viewer->m_id_sapevent.
  +    ls_event-appl_event = 'x'.
  +    APPEND ls_event TO lt_events.
  +    CALL METHOD go_html_viewer->set_registered_events
  +      EXPORTING
  +        events = lt_events.
  +
  +    SET HANDLER lcl_gui=>on_sapevent FOR go_html_viewer.
  +
  +    view( render( ) ).
  +
  +  ENDMETHOD.                    "init
  +
  +  METHOD view.
  +
  +    DATA: lt_data TYPE TABLE OF text200,
  +          lv_html TYPE string,
  +          lv_url  TYPE text200.
  +
  +
  +    lv_html = iv_html.
  +
  +    WHILE strlen( lv_html ) > 0.
  +      IF strlen( lv_html ) < 200.
  +        APPEND lv_html TO lt_data.
  +        CLEAR lv_html.
  +      ELSE.
  +        APPEND lv_html(200) TO lt_data.
  +        lv_html = lv_html+200.
  +      ENDIF.
  +    ENDWHILE.
  +
  +    CALL METHOD go_html_viewer->load_data
  +      IMPORTING
  +        assigned_url = lv_url
  +      CHANGING
  +        data_table   = lt_data.
  +
  +    CALL METHOD go_html_viewer->show_url
  +      EXPORTING
  +        url = lv_url.
  +
  +  ENDMETHOD.                    "view
  +
  +ENDCLASS.                    "lcl_view IMPLEMENTATION
  +
  +*----------------------------------------------------------------------*
   *       CLASS lcl_transport DEFINITION
   *----------------------------------------------------------------------*
   *
  
positive.code: 
    METHOD xstring_to_int.
  
      DATA: lv_string TYPE string.
  
  * todo, this can be done a lot easier
  
      lv_string = iv_xstring.
      WHILE strlen( lv_string ) > 0.
        rv_i = rv_i * 16.
        CASE lv_string(1).
          WHEN '0'.
          WHEN '1'.
            rv_i = rv_i + 1.
          WHEN '2'.
            rv_i = rv_i + 2.
          WHEN '3'.
            rv_i = rv_i + 3.
          WHEN '4'.
            rv_i = rv_i + 4.
          WHEN '5'.
            rv_i = rv_i + 5.
          WHEN '6'.
            rv_i = rv_i + 6.
          WHEN '7'.
            rv_i = rv_i + 7.
          WHEN '8'.
            rv_i = rv_i + 8.
          WHEN '9'.
            rv_i = rv_i + 9.
          WHEN 'A'.
            rv_i = rv_i + 10.
          WHEN 'B'.
            rv_i = rv_i + 11.
          WHEN 'C'.
            rv_i = rv_i + 12.
          WHEN 'D'.
            rv_i = rv_i + 13.
          WHEN 'E'.
            rv_i = rv_i + 14.
          WHEN 'F'.
            rv_i = rv_i + 15.
          WHEN OTHERS.
            RAISE EXCEPTION TYPE lcx_exception
              EXPORTING
                iv_text = 'Unexpected character'.             "#EC NOTEXT
        ENDCASE.
        lv_string = lv_string+1.
      ENDWHILE.
  
    ENDMETHOD.                    "xstring_to_int
  
negative.code:           lv_repo    TYPE string.
  
  
      IF NOT iv_repo CP '*Foobar*'. " temp guard
        BREAK-POINT.
        RETURN.
      ENDIF.
  