NB. create_response_message_to_GET_method_jconsole.ijs
NB. 02_05_demo_number_list_reformat_with_table_title_option_added
NB. multiple numbers in the textarea will be reformatted. Select table column number, number of total digit including decimal point  and number of decimal digit. Reformatted result file save option available. Table title checkbox is available.

NB. create_response_message_to_GET_method_part_1_jconsole.ijs (encoding_code: UTF-8, 2023_09_14)

NB. fixed part 1 start

NB. クライアントからのHTTPリクエスト GET method に応答するHTTPレスポンスメッセージを用意する

NB. ====================================================================================================
NB. クライアントのGET methodへの応答として HTTP レスポンスメッセージを作成する
prepare_http_response_message_to_GET_method =: 3 : 0

NB. HTTPのステータスラインとレスポンスヘッダーフィールドを作る

http_response_status_and_header_field =. prepare_http_response_status_and_header_field 0

NB. HTTPのボディをhtml form documentとして用意する

NB. fixed part 1 end

TEXTAREA_00_VALUE =: '1.1 20.5 30 40.8 5.5 7.8 80.2'
DROPDOWN_00_VALUE =: '6'
CHECKLIST_00_VALUE =: '6'
CHECKLIST_01_VALUE =: '0'
TEXTBOX_00_VALUE =: ''
TEXTBOX_01_VALUE =: 'reformatted_result.txt'
CHECKBOX_00_VALUE =: ''
TEXTBOX_02_VALUE =: 'reformatted table title'
RADIO_00_VALUE =: 'none'

NB. create_response_message_to_GET_method_part_2_jconsole.ijs (encoding_code: UTF-8, 2023_09_14)

NB. fixed part 2 start

NB.MSG_FROM_SERVER =: '漢字コード(Kanji code) ->', ENCODING_CODE, ' '
MSG_FROM_SERVER =: 'character encoding code: ', ENCODING_CODE, ' '

html_form_doc =. make_html_form_doc 0

NB. 完成した html_docのバイト数を数える
byteCount =. $ html_form_doc

NB. クライントへ送信するレスポンスhttpメッセージを完成させる
NB. HTTPプロトコル上、html_docの前に空行が必要
http_response_status_and_header_field, (":byteCount), CRLF, CRLF, html_form_doc
)

NB. ====================================================================================================
NB. httpメッセージに添付するhtml_form_docの作成
NB. この関数をコールする前に、テキストボックス、テキストエリアの値の設定は必須

make_html_form_doc =: 3 : 0

NB. まずHTMLのヘッダー部分 HTML_HEADER_PART を作成
make_html_header_part 0

NB. フォーム部品を記述

NB. fixed part 2 end


NB. create_response_message_to_GET_method_part_3_jconsole.ijs (encoding_code: UTF-8, 2023_09_04)

NB. fixed part 3 start

NB. 以上でフォーム部品の定義完了

NB. html_docの生成

html_doc =. ''
html_doc =. html_doc, HTML_HEADER_PART

define_html_code_for_controls_based_on_plan_ijs 0

NB. fixed part 3 end
html_doc =. html_doc, rff NEW_APP_DIR, '/', 'auto_written_html_src_jconsole.ijs'
NB. create_response_message_to_GET_method_part_4_jconsole.ijs (encoding_code: UTF-8, 2023_09_04)

NB. fixed part 4 start

NB. add response_image.bmp link ... for possible expressiion of form result as bmp image
NB. default response_image.bmp is always initialized as orange dot at the beginning of execute_your_job function

NB.if. (RESPONSE_IMG_FLG = 1) *. (USER_AGENT_FIREFOX = 1) do.
if. (RESPONSE_IMG_FLG = 1) do.
    if. RESPONSE_IMG_TYP -: 'PNG' do.
      IMAGE_BMP =: '<hr>server response image display region<br><iframe id="iftest" title="img" width="', IFRAME_SIZE_W, '" height="', IFRAME_SIZE_H, '" frameborder="', IFRAME_BORDER, '" src="response_image.png" ></iframe>', CRLF
    end.
    if. RESPONSE_IMG_TYP -: 'BMP' do.
      IMAGE_BMP =: '<hr>server response image display region<br><iframe id="iftest" title="img" width="', IFRAME_SIZE_W, '" height="', IFRAME_SIZE_H, '" frameborder="', IFRAME_BORDER, '" src="response_image.bmp" ></iframe>', CRLF
    end.
    NB. IMAGE_BMP =: '<hr>サーバー応答イメージ表示エリア<br><iframe id="iftest" title="img" width="', IFRAME_SIZE_W, '" height="', IFRAME_SIZE_H, '" frameborder="', IFRAME_BORDER, '" src="response_image.bmp" ></iframe>', CRLF
    NB. IMAGE_BMP =: '<img src="response_image.bmp" border="2" alt="Response_Image"><hr>', CRLF
    NB. IMAGE_BMP =: '<img src="response_image.bmp" width="1000" height="1000" border="2" alt="Response_Image"><hr>', CRLF
    NB. IMAGE_BMP =: IMAGE_BMP, '<a href="/response_image.bmp" target="_blank">別タブで表示</a>',CRLF
else.
    IMAGE_BMP =: ''
end.

TXA_99 =: '<hr>server reply message display region<hr><textarea name="textarea99" cols="100" rows="5">'
NB. TXA_99 =: '<hr>サーバーメッセージ表示エリア<hr><textarea name="textarea99" cols="100" rows="5">'
TXA_99 =: TXA_99, MSG_FROM_SERVER, '</textarea>', CRLF

NB.PRE_00 =: '<hr><PRE>サーバーメッセージ表示エリア', CRLF, CRLF, MSG_FROM_SERVER, '</PRE><hr>', CRLF
PRE_00 =: '<hr><PRE>server reply message display region', CRLF, CRLF, MSG_FROM_SERVER, '</PRE><hr>', CRLF

if. MSG_FROM_SERVER_FLG -: 'TXA_99' do.
    html_doc =. html_doc, IMAGE_BMP, RADIO_99, SEND_BUTTON, TXA_99
    NB. html_doc =. html_doc, TXA_99, RADIO_99, SEND_BUTTON, IMAGE_BMP
    NB. html_doc =. html_doc, TXA_99, IMAGE_BMP, RADIO_99, SEND_BUTTON
    NB. html_doc =. html_doc, TXA_99, RADIO_99, SEND_BUTTON
end.
if. MSG_FROM_SERVER_FLG -: 'PRE_00' do.
    html_doc =. html_doc, IMAGE_BMP, RADIO_99, SEND_BUTTON, PRE_00
    NB. html_doc =. html_doc, PRE_00, RADIO_99, SEND_BUTTON, IMAGE_BMP
    NB. html_doc =. html_doc, PRE_00, IMAGE_BMP, RADIO_99, SEND_BUTTON
    NB. html_doc =. html_doc, PRE_00, RADIO_99, SEND_BUTTON
end.

NB. 合体時は、RADIO_99(サーバー制御用ラジオボタン)とSEND_BUTTON(送信ボタン)は必須

html_doc =. html_doc, FORM_END, BODY_END, HTML_END
)

NB. End of file

NB. fixed part 4 end
