2 * Copyright (C) 2005-2008 Atsushi Konno All rights reserved.
3 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include "chxj_hdml.h"
18 #include "chxj_tag_util.h"
19 #include "chxj_str_util.h"
21 #include "chxj_img_conv.h"
22 #include "chxj_dump.h"
23 #include "chxj_qr_code.h"
24 #include "chxj_encoding.h"
26 #define CHECK_BOX_PREFIX "_chxj_c_"
27 #define RADIO_BUTTON_PREFIX "_chxj_r_"
28 #define SUBMIT_BUTTON_PREFIX "_chxj_s_"
30 #define GET_HDML(X) ((hdml_t*)(X))
32 static void s_init_hdml (hdml_t* hdml, Doc* doc, request_rec* r, device_table* spec);
35 static char* s_hdml_start_html_tag (void* pdoc, Node* node);
36 static char* s_hdml_end_html_tag (void* pdoc, Node* node);
37 static char* s_hdml_start_meta_tag (void* pdoc, Node* node);
38 static char* s_hdml_end_meta_tag (void* pdoc, Node* node);
39 static char* s_hdml_start_li_tag (void* pdoc, Node* node);
40 static char* s_hdml_end_li_tag (void* pdoc, Node* node);
41 static char* s_hdml_start_head_tag (void* pdoc, Node* node);
42 static char* s_hdml_end_head_tag (void* pdoc, Node* node);
43 static char* s_hdml_start_title_tag (void* pdoc, Node* node);
44 static char* s_hdml_end_title_tag (void* pdoc, Node* node);
45 static char* s_hdml_start_base_tag (void* pdoc, Node* node);
46 static char* s_hdml_end_base_tag (void* pdoc, Node* node);
47 static char* s_hdml_start_body_tag (void* pdoc, Node* node);
48 static char* s_hdml_end_body_tag (void* pdoc, Node* node);
49 static char* s_hdml_start_a_tag (void* pdoc, Node* node);
50 static char* s_hdml_end_a_tag (void* pdoc, Node* node);
51 static char* s_hdml_start_br_tag (void* pdoc, Node* node);
52 static char* s_hdml_end_br_tag (void* pdoc, Node* node);
53 static char* s_hdml_start_tr_tag (void* pdoc, Node* node);
54 static char* s_hdml_end_tr_tag (void* pdoc, Node* node);
55 static char* s_hdml_start_font_tag (void* pdoc, Node* node);
56 static char* s_hdml_end_font_tag (void* pdoc, Node* node);
57 static char* s_hdml_start_form_tag (void* pdoc, Node* node);
58 static char* s_hdml_end_form_tag (void* pdoc, Node* node);
59 static char* s_hdml_start_input_tag (void* pdoc, Node* node);
60 static char* s_hdml_end_input_tag (void* pdoc, Node* node);
61 static char* s_hdml_start_select_tag (void* pdoc, Node* node);
62 static char* s_hdml_end_select_tag (void* pdoc, Node* node);
63 static char* s_hdml_start_option_tag (void* pdoc, Node* node);
64 static char* s_hdml_end_option_tag (void* pdoc, Node* node);
65 static char* s_hdml_start_center_tag (void* pdoc, Node* node);
66 static char* s_hdml_end_center_tag (void* pdoc, Node* node);
67 static char* s_hdml_start_hr_tag (void* pdoc, Node* node);
68 static char* s_hdml_end_hr_tag (void* pdoc, Node* node);
69 static char* s_hdml_start_img_tag (void* pdoc, Node* node);
70 static char* s_hdml_end_img_tag (void* pdoc, Node* node);
71 static char* s_hdml_start_div_tag (void* pdoc, Node* node);
72 static char* s_hdml_end_div_tag (void* pdoc, Node* node);
74 static char* s_get_form_no (request_rec* r, hdml_t* hdml);
76 static void s_hdml_count_radio_tag (hdml_t* hdml, Node* node) ;
78 static void s_hdml_do_input_text_tag (hdml_t* hdml, Node* tag);
79 static void s_hdml_do_input_password_tag(hdml_t* hdml, Node* tag);
80 static void s_hdml_do_input_submit_tag (hdml_t* hdml, Node* tag);
81 static void s_hdml_do_input_hidden_tag (hdml_t* hdml, Node* tag);
82 static void s_hdml_do_input_radio_tag (hdml_t* hdml, Node* tag);
83 static void s_hdml_do_input_checkbox_tag(hdml_t* hdml, Node* tag);
84 static void s_hdml_tag_output_upper_half(hdml_t* hdml, Node* node);
86 static hdml_t* s_output_to_hdml_out (hdml_t* hdml, char* s);
87 static hdml_t* s_output_to_hdml_card (hdml_t* hdml, char* s);
88 static void s_output_to_postdata (hdml_t* hdml, char* s);
89 static void s_output_to_init_vars (hdml_t* hdml, char* s);
90 static int s_hdml_search_emoji (hdml_t* hdml, char* txt, char** rslt);
92 static char* s_hdml_chxjif_tag (void* pdoc, Node* node);
93 static char* s_hdml_text_tag (void* pdoc, Node* node);
96 tag_handler hdml_handler[] = {
99 s_hdml_start_html_tag,
104 s_hdml_start_meta_tag,
169 s_hdml_start_head_tag,
174 s_hdml_start_title_tag,
175 s_hdml_end_title_tag,
179 s_hdml_start_base_tag,
184 s_hdml_start_body_tag,
219 s_hdml_start_font_tag,
224 s_hdml_start_form_tag,
229 s_hdml_start_input_tag,
230 s_hdml_end_input_tag,
234 s_hdml_start_center_tag,
235 s_hdml_end_center_tag,
244 s_hdml_start_img_tag,
249 s_hdml_start_select_tag,
250 s_hdml_end_select_tag,
254 s_hdml_start_option_tag,
255 s_hdml_end_option_tag,
259 s_hdml_start_div_tag,
340 * converts from CHTML to hdml.
342 * @param r [i] Requet_rec is appointed.
343 * @param spec [i] The result of the device specification processing which
344 * was done in advance is appointed.
345 * @param src [i] The character string before the converting is appointed.
346 * @return The character string after the converting is returned.
355 chxjconvrule_entry* entryp,
356 cookie_t* UNUSED(cookie)
367 /*--------------------------------------------------------------------------*/
369 /*--------------------------------------------------------------------------*/
371 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
373 DBG(r,"i found qrcode xml");
376 DBG(r,"not found qrcode xml");
378 /*--------------------------------------------------------------------------*/
379 /* initialize hdml structure */
380 /*--------------------------------------------------------------------------*/
381 s_init_hdml(&hdml,&doc,r, spec);
383 hdml.entryp = entryp;
385 chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
386 /*--------------------------------------------------------------------------*/
388 /*--------------------------------------------------------------------------*/
390 chxj_dump_out("[src] CHTML->HDML", src, srclen);
393 /*--------------------------------------------------------------------------*/
394 /* It is examined whether there is a location header. It ends without doing */
395 /* anything when is. */
396 /*--------------------------------------------------------------------------*/
397 buf = (char*)apr_table_get(r->headers_out, (const char*)"Location");
399 /*------------------------------------------------------------------------*/
400 /* The Location header generates tag in an initial HDML machine for the */
401 /* uncorrespon dence. */
402 /*------------------------------------------------------------------------*/
403 DBG(r, "Location is not null[Location:%s]", buf);
404 s_output_to_hdml_out(&hdml,
405 "<HDML VERSION=3.0 MARKABLE=TRUE PUBLIC=TRUE>\n"
406 "<NODISPLAY MARKABLE=TRUE PUBLIC=TRUE TITLE=\" \">\n"
407 "<ACTION TYPE=ACCEPT TASK=GO DEST=\""
409 s_output_to_hdml_out(&hdml, buf);
410 s_output_to_hdml_out(&hdml,
415 dst = apr_pstrdup(r->pool, hdml.out);
418 /*------------------------------------------------------------------------*/
419 /* Here, the parsing of the received character string is done */
420 /*------------------------------------------------------------------------*/
421 char *ss = apr_palloc(r->pool, srclen + 1);
422 memset(ss, 0, srclen + 1);
423 memcpy(ss, src, srclen);
425 DBG(r, "input strlen(src)=[%d]\n", (int)srclen);
426 DBG(r, "[[[[%s]]]\n", src);
428 qs_init_malloc(&doc);
429 qs_init_root_node(&doc);
431 qs_parse_string(&doc, ss, srclen);
433 /*------------------------------------------------------------------------*/
434 /* The number of radiobuttons is counted. */
435 /*------------------------------------------------------------------------*/
436 s_hdml_count_radio_tag(&hdml, qs_get_root(&doc));
438 chxj_node_exchange(spec,r,(void*)&hdml, &doc, qs_get_root(&doc), 0);
441 DBG(r,"tmp=[%s]", dst);
442 qs_all_free(&doc,QX_LOGMARK);
445 /*--------------------------------------------------------------------------*/
447 /*--------------------------------------------------------------------------*/
449 chxj_dump_out("[dst] CHTML->HDML", hdml.out, hdml.out_len);
452 /*--------------------------------------------------------------------------*/
453 /* When there is no processing result, former character string is copied */
454 /* and it returns it. */
455 /*--------------------------------------------------------------------------*/
458 return apr_pstrdup(r->pool,src);
461 *dstlen = hdml.out_len;
463 /*--------------------------------------------------------------------------*/
464 /* Null is set at the end of the character string to make sure. */
465 /*--------------------------------------------------------------------------*/
466 dst[hdml.out_len] = 0;
473 * The HDML structure is initialized.
475 * @param hdml [i/o] The pointer to the HDML structure that wants to be
476 * initialized is specified.
477 * @param doc [i] The Doc structure that should be set to the initialized
478 * HDML structure is specified.
479 * @param r [i] To use POOL, the pointer to request_rec is specified.
480 * @param spec [i] The pointer to the device_table
483 s_init_hdml(hdml_t* hdml, Doc* doc, request_rec* r, device_table* spec)
488 /*--------------------------------------------------------------------------*/
489 /* init hdml structure value */
490 /*--------------------------------------------------------------------------*/
491 memset(hdml, 0, sizeof(hdml_t));
493 hdml->card = qs_alloc_zero_byte_string(r);
495 hdml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
496 hdml->doc->parse_mode = PARSE_MODE_CHTML;
498 for (ii=0; ii<MAX_FORM_COUNT; ii++) {
499 hdml->var_cnt[ii] = 0;
500 hdml->postdata[ii] = qs_alloc_zero_byte_string(r);
503 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
504 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
505 hdml->radio_value_list[ii][jj] = NULL;
507 hdml->radio_name_list[ii] = NULL;
508 hdml->radio_out_cnt[ii] = 0;
509 hdml->radio_checked_value[ii] = NULL;
512 for (ii=0; ii<MAX_SUBMIT_BUTTON_COUNT; ii++)
513 hdml->submit_button[ii] = NULL;
515 hdml->init_vars = qs_alloc_zero_byte_string(r);
519 hdml->form_cnt = apr_time_now();
520 hdml->out = qs_alloc_zero_byte_string(r);
525 s_hdml_search_emoji(hdml_t* hdml, char* txt, char** rslt)
538 DBG(r,"spec is NULL");
540 for (ee = hdml->conf->emoji;
544 unsigned char hex1byte;
545 unsigned char hex2byte;
548 DBG(r, "emoji->imode is NULL");
552 hex1byte = ee->imode->hex1byte & 0xff;
553 hex2byte = ee->imode->hex2byte & 0xff;
555 if (ee->imode->string
556 && strlen(ee->imode->string) > 0
557 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
558 if (spec == NULL || spec->emoji_type == NULL) {
559 *rslt = apr_psprintf(r->pool,
562 return strlen(ee->imode->string);
565 if (strcasecmp(hdml->spec->emoji_type, "a") == 0) {
566 *rslt = apr_psprintf(r->pool,
569 return strlen(ee->imode->string);
572 if (strcasecmp(hdml->spec->emoji_type, "b") == 0) {
573 *rslt = apr_psprintf(r->pool,
576 return strlen(ee->imode->string);
579 if (strcasecmp(hdml->spec->emoji_type, "c") == 0) {
580 *rslt = apr_psprintf(r->pool,
583 return strlen(ee->imode->string);
586 if (strcasecmp(hdml->spec->emoji_type, "d") == 0) {
587 *rslt = apr_psprintf(r->pool,
590 return strlen(ee->imode->string);
593 *rslt = apr_psprintf(r->pool,
596 return strlen(ee->imode->string);
601 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
602 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
603 if (spec == NULL || spec->emoji_type == NULL) {
604 *rslt = apr_psprintf(r->pool,
610 if (strcasecmp(hdml->spec->emoji_type, "a") == 0) {
611 *rslt = apr_psprintf(r->pool,
617 if (strcasecmp(hdml->spec->emoji_type, "b") == 0) {
618 *rslt = apr_psprintf(r->pool,
624 if (strcasecmp(hdml->spec->emoji_type, "c") == 0) {
625 *rslt = apr_psprintf(r->pool,
631 if (strcasecmp(hdml->spec->emoji_type, "d") == 0) {
632 *rslt = apr_psprintf(r->pool,
638 *rslt = apr_psprintf(r->pool,
651 * It is a handler who processes the HTML tag.
653 * @param pdoc [i/o] The pointer to the HDML structure at the output
654 * destination is specified.
655 * @param node [i] The HTML tag node is specified.
656 * @return The conversion result is returned.
659 s_hdml_start_html_tag(void* pdoc, Node* UNUSED(node))
663 hdml = GET_HDML(pdoc);
665 s_output_to_hdml_out(hdml,
666 "<HDML VERSION=3.0 TTL=0 MARKABLE=TRUE>\n"
667 "<NODISPLAY NAME=D0>\n"
668 "<ACTION TYPE=ACCEPT TASK=GOSUB DEST=#D1 NEXT=#D2 CLEAR=TRUE>\n"
673 hdml->hdml_br_flag = 0;
680 * It is a handler who processes the HTML tag.
682 * @param pdoc [i/o] The pointer to the HDML structure at the output
683 * destination is specified.
684 * @param node [i] The HTML tag node is specified.
685 * @return The conversion result is returned.
688 s_hdml_end_html_tag(void* pdoc, Node* UNUSED(child))
692 hdml = GET_HDML(pdoc);
694 s_output_to_hdml_card(hdml,
695 "<NODISPLAY NAME=D1>\n"
696 "<ACTION TYPE=ACCEPT TASK=RETURN VARS=\""
699 if (strlen(hdml->init_vars))
700 s_output_to_hdml_card(hdml, hdml->init_vars );
702 s_output_to_hdml_card(hdml, "_chxj_dmy=" );
704 s_output_to_hdml_card(hdml,
709 s_output_to_hdml_out(hdml, hdml->card );
710 s_output_to_hdml_out(hdml, "</HDML>\n");
712 hdml->hdml_end_flag = 1;
719 * It is a handler who processes the META tag.
721 * @param pdoc [i/o] The pointer to the HDML structure at the output
722 * destination is specified.
723 * @param node [i] The META tag node is specified.
724 * @return The conversion result is returned.
727 s_hdml_start_meta_tag(void* pdoc, Node* UNUSED(node))
731 hdml = GET_HDML(pdoc);
733 hdml->hdml_br_flag = 0;
742 * It is a handler who processes the META tag.
744 * @param pdoc [i/o] The pointer to the HDML structure at the output
745 * destination is specified.
746 * @param node [i] The META tag node is specified.
747 * @return The conversion result is returned.
750 s_hdml_end_meta_tag(void* pdoc, Node* UNUSED(child))
754 hdml = GET_HDML(pdoc);
761 * It is a handler who processes the HEAD tag.
763 * @param pdoc [i/o] The pointer to the HDML structure at the output
764 * destination is specified.
765 * @param node [i] The HEAD tag node is specified.
766 * @return The conversion result is returned.
769 s_hdml_start_head_tag(void* pdoc, Node* UNUSED(node))
773 hdml = GET_HDML(pdoc);
777 hdml->hdml_br_flag = 0;
784 * It is a handler who processes the HEAD tag.
786 * @param pdoc [i/o] The pointer to the HDML structure at the output
787 * destination is specified.
788 * @param node [i] The HEAD tag node is specified.
789 * @return The conversion result is returned.
792 s_hdml_end_head_tag(void* pdoc, Node* UNUSED(child))
796 hdml = GET_HDML(pdoc);
804 * It is a handler who processes the TITLE tag.
806 * @param pdoc [i/o] The pointer to the HDML structure at the output
807 * destination is specified.
808 * @param node [i] The TITLE tag node is specified.
809 * @return The conversion result is returned.
812 s_hdml_start_title_tag(void* pdoc, Node* UNUSED(node))
816 hdml = GET_HDML(pdoc);
818 s_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"");
820 hdml->found_title = 1;
821 hdml->hdml_br_flag = 0;
828 * It is a handler who processes the TITLE tag.
830 * @param pdoc [i/o] The pointer to the HDML structure at the output
831 * destination is specified.
832 * @param node [i] The TITLE tag node is specified.
833 * @return The conversion result is returned.
836 s_hdml_end_title_tag(void* pdoc, Node* UNUSED(child))
840 hdml = GET_HDML(pdoc);
842 s_output_to_hdml_out(hdml, "\">\n");
849 * It is a handler who processes the BASE tag.
851 * @param pdoc [i/o] The pointer to the HDML structure at the output
852 * destination is specified.
853 * @param node [i] The BASE tag node is specified.
854 * @return The conversion result is returned.
857 s_hdml_start_base_tag(void* pdoc, Node* UNUSED(node))
861 hdml = GET_HDML(pdoc);
863 hdml->hdml_br_flag = 0;
870 * It is a handler who processes the BASE tag.
872 * @param pdoc [i/o] The pointer to the HDML structure at the output
873 * destination is specified.
874 * @param node [i] The BASE tag node is specified.
875 * @return The conversion result is returned.
878 s_hdml_end_base_tag(void* pdoc, Node* UNUSED(child))
882 hdml = GET_HDML(pdoc);
889 * It is a handler who processes the BODY tag.
891 * @param pdoc [i/o] The pointer to the HDML structure at the output
892 * destination is specified.
893 * @param node [i] The BODY tag node is specified.
894 * @return The conversion result is returned.
897 s_hdml_start_body_tag(void* pdoc, Node* node)
903 hdml = GET_HDML(pdoc);
907 if (hdml->found_title == 0)
908 s_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"NO TITLE\">\n");
910 s_output_to_hdml_out(hdml, "<ACTION TYPE=ACCEPT TASK=NOOP LABEL=\" \"");
912 /*--------------------------------*/
914 /*--------------------------------*/
915 for (attr = qs_get_attr(doc,node);
917 attr = qs_get_next_attr(doc,attr)) {
921 name = qs_get_attr_name(doc,attr);
923 if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
927 if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
931 if ((*name == 'l' || *name == 'L') && strcasecmp(name, "link") == 0) {
935 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alink") == 0) {
939 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vlink") == 0) {
944 s_output_to_hdml_out(hdml, ">\n");
946 hdml->hdml_br_flag = 0;
953 * It is a handler who processes the BODY tag.
955 * @param pdoc [i/o] The pointer to the HDML structure at the output
956 * destination is specified.
957 * @param node [i] The BODY tag node is specified.
958 * @return The conversion result is returned.
961 s_hdml_end_body_tag(void* pdoc, Node* UNUSED(child))
965 hdml = GET_HDML(pdoc);
967 s_output_to_hdml_out(hdml, "\n</DISPLAY>\n");
974 * It is a handler who processes the A tag.
976 * @param pdoc [i/o] The pointer to the HDML structure at the output
977 * destination is specified.
978 * @param node [i] The A tag node is specified.
979 * @return The conversion result is returned.
982 s_hdml_start_a_tag(void* pdoc, Node* node)
988 hdml = GET_HDML(pdoc);
991 s_hdml_tag_output_upper_half(hdml,node);
993 s_output_to_hdml_out(hdml, "<A");
996 /*------------------------------------*/
998 /*------------------------------------*/
999 for (attr = qs_get_attr(doc,node);
1001 attr = qs_get_next_attr(doc,attr)) {
1006 name = qs_get_attr_name(doc,attr);
1007 value = qs_get_attr_value(doc,attr);
1009 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
1013 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
1014 if ((*value == 'm' || *value == 'M')
1015 && strncasecmp(value, "mailto:", 7) == 0) {
1016 value = chxj_encoding_parameter(hdml->doc->r, value);
1017 s_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
1018 s_output_to_hdml_out(hdml, value );
1019 s_output_to_hdml_out(hdml, "\" " );
1022 if ((*value == 't' || *value == 'T')
1023 && strncasecmp(value, "tel:", 4) == 0) {
1025 s_output_to_hdml_out(hdml, " TASK=CALL NUMBER=\"");
1026 s_output_to_hdml_out(hdml, &value[4] );
1027 s_output_to_hdml_out(hdml, "\" " );
1030 s_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
1031 s_output_to_hdml_out(hdml, value );
1032 s_output_to_hdml_out(hdml, "\"" );
1036 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
1037 if (strcasecmp(value, "0") != 0) {
1038 s_output_to_hdml_out(hdml, " ACCESSKEY=" );
1039 s_output_to_hdml_out(hdml, value );
1040 s_output_to_hdml_out(hdml, "" );
1044 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cti") == 0) {
1048 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ijam") == 0) {
1052 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1056 if ((*name == 't' || *name == 'T') && strcasecmp(name, "telbook") == 0) {
1060 if ((*name == 'k' || *name == 'K') && strcasecmp(name, "kana") == 0) {
1064 if ((*name == 'e' || *name == 'E') && strcasecmp(name, "email") == 0) {
1068 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ista") == 0) {
1072 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ilet") == 0) {
1076 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "iswf") == 0) {
1080 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "irst") == 0) {
1084 s_output_to_hdml_out(hdml, ">" );
1086 hdml->hdml_a_flag = 1;
1088 hdml->hdml_br_flag = 0;
1095 * It is a handler who processes the A tag.
1097 * @param pdoc [i/o] The pointer to the HDML structure at the output
1098 * destination is specified.
1099 * @param node [i] The A tag node is specified.
1100 * @return The conversion result is returned.
1103 s_hdml_end_a_tag(void* pdoc, Node* UNUSED(child))
1107 hdml = GET_HDML(pdoc);
1109 s_output_to_hdml_out(hdml, "</A>\n");
1111 hdml->hdml_a_flag = 0;
1118 * It is a handler who processes the BR tag.
1120 * @param pdoc [i/o] The pointer to the HDML structure at the output
1121 * destination is specified.
1122 * @param node [i] The BR tag node is specified.
1123 * @return The conversion result is returned.
1126 s_hdml_start_br_tag(void* pdoc, Node* UNUSED(node))
1130 hdml = GET_HDML(pdoc);
1132 if (hdml->in_center > 0)
1133 hdml->in_center = 0;
1135 if (hdml->div_in_center > 0)
1136 hdml->div_in_center = 0;
1138 s_output_to_hdml_out(hdml, "<BR>\n");
1140 hdml->hdml_br_flag = 1;
1147 * It is a handler who processes the BR tag.
1149 * @param pdoc [i/o] The pointer to the HDML structure at the output
1150 * destination is specified.
1151 * @param node [i] The BR tag node is specified.
1152 * @return The conversion result is returned.
1155 s_hdml_end_br_tag(void* pdoc, Node* UNUSED(child))
1159 hdml = GET_HDML(pdoc);
1166 * It is a handler who processes the TR tag.
1168 * @param pdoc [i/o] The pointer to the HDML structure at the output
1169 * destination is specified.
1170 * @param node [i] The TR tag node is specified.
1171 * @return The conversion result is returned.
1174 s_hdml_start_tr_tag(void* pdoc, Node* UNUSED(node))
1178 hdml = GET_HDML(pdoc);
1180 if (hdml->in_center > 0)
1181 hdml->in_center = 0;
1183 if (hdml->div_in_center > 0)
1184 hdml->div_in_center = 0;
1186 s_output_to_hdml_out(hdml, "<BR>\n");
1188 hdml->hdml_br_flag = 1;
1195 * It is a handler who processes the TR tag.
1197 * @param pdoc [i/o] The pointer to the HDML structure at the output
1198 * destination is specified.
1199 * @param node [i] The TR tag node is specified.
1200 * @return The conversion result is returned.
1203 s_hdml_end_tr_tag(void* pdoc, Node* UNUSED(child))
1207 hdml = GET_HDML(pdoc);
1214 * It is a handler who processes the FONT tag.
1216 * @param pdoc [i/o] The pointer to the HDML structure at the output
1217 * destination is specified.
1218 * @param node [i] The FONT tag node is specified.
1219 * @return The conversion result is returned.
1222 s_hdml_start_font_tag(void* pdoc, Node* UNUSED(node))
1226 hdml = GET_HDML(pdoc);
1233 * It is a handler who processes the FONT tag.
1235 * @param pdoc [i/o] The pointer to the HDML structure at the output
1236 * destination is specified.
1237 * @param node [i] The FONT tag node is specified.
1238 * @return The conversion result is returned.
1241 s_hdml_end_font_tag(void* pdoc, Node* UNUSED(child))
1245 hdml = GET_HDML(pdoc);
1252 * It is a handler who processes the FORM tag.
1254 * @param pdoc [i/o] The pointer to the HDML structure at the output
1255 * destination is specified.
1256 * @param node [i] The FORM tag node is specified.
1257 * @return The conversion result is returned.
1260 s_hdml_start_form_tag(void* pdoc, Node* node)
1268 hdml = GET_HDML(pdoc);
1273 hdml->form_tmp = apr_psprintf(r->pool,
1274 "<NODISPLAY NAME=F%d>\n",
1275 hdml->pure_form_cnt);
1276 hdml->form_tmp = apr_pstrcat(r->pool,
1278 "<ACTION TYPE=ACCEPT TASK=GO METHOD=POST DEST=\"",
1280 /* Get Attributes */
1281 for (attr = qs_get_attr(doc,node);
1283 attr = qs_get_next_attr(doc,attr)) {
1288 name = qs_get_attr_name(doc,attr);
1289 value = qs_get_attr_value(doc,attr);
1291 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "action") == 0) {
1292 value = chxj_encoding_parameter(hdml->doc->r, value);
1293 act = apr_psprintf(r->pool, "%s", value);
1299 hdml->form_tmp = apr_pstrcat(r->pool,
1304 hdml->form_tmp = apr_pstrcat(r->pool,
1308 hdml->form_tmp = apr_pstrcat(r->pool,
1313 hdml->hdml_br_flag = 0;
1320 * handler of the form end tag.
1322 * @param pdoc [i/o] The pointer to the HDML structure at the output
1323 * destination is specified.
1324 * @param child [i] unused.
1325 * @return The HDML output result after it edits it is returned.
1328 s_hdml_end_form_tag(void* pdoc, Node* UNUSED(child))
1333 hdml = GET_HDML(pdoc);
1336 s_output_to_postdata(hdml, "_chxj_dmy=");
1338 hdml->form_tmp = apr_pstrcat(r->pool,
1340 hdml->postdata[hdml->pure_form_cnt],
1343 hdml->form_tmp = apr_pstrcat(r->pool,
1345 "\" CLEAR=TRUE >\n",
1347 hdml->form_tmp = apr_pstrcat(r->pool,
1352 s_output_to_hdml_card(hdml, hdml->form_tmp);
1354 hdml->form_tmp = NULL;
1355 hdml->pure_form_cnt++;
1362 * It is a handler that takes charge of the processing of the input tag.
1364 * @param pdoc [i/o] The pointer to the HDML structure at the output
1365 * destination is specified.
1366 * @param node [i] The tag node to be processed is specified.
1369 s_hdml_start_input_tag(void* pdoc, Node* node)
1375 hdml = GET_HDML(pdoc);
1378 /*--------------------------------------------------------------------------*/
1379 /* The attribute of the input tag is acquired. */
1380 /*--------------------------------------------------------------------------*/
1381 for (attr = qs_get_attr(doc,node);
1383 attr = qs_get_next_attr(doc,attr)) {
1388 name = qs_get_attr_name(doc,attr);
1389 value = qs_get_attr_value(doc,attr);
1391 if ((*name == 't'|| *name == 'T') && strcasecmp(name, "type") == 0) {
1392 if ((*value == 't' || *value == 'T') && strcasecmp(value, "text") == 0) {
1393 /*--------------------------------------------------------------------*/
1394 /* "input type ='text'" tag is processed. */
1395 /*--------------------------------------------------------------------*/
1396 s_hdml_do_input_text_tag(hdml, node);
1399 if ((*value == 'p' || *value == 'P') && strcasecmp(value, "password") == 0) {
1400 /*--------------------------------------------------------------------*/
1401 /* "input type='password'" tag is processed. */
1402 /*--------------------------------------------------------------------*/
1403 s_hdml_do_input_password_tag(hdml, node);
1406 if ((*value == 's' || *value == 'S') && strcasecmp(value, "submit") == 0) {
1407 /*--------------------------------------------------------------------*/
1408 /* "input type='submit'" tag is processed. */
1409 /*--------------------------------------------------------------------*/
1410 s_hdml_do_input_submit_tag(hdml, node);
1413 if ((*value == 'h' || *value == 'H') && strcasecmp(value, "hidden") == 0) {
1414 /*--------------------------------------------------------------------*/
1415 /* "input type='hidden'" tag is processed. */
1416 /*--------------------------------------------------------------------*/
1417 s_hdml_do_input_hidden_tag(hdml, node);
1420 if ((*value == 'r' || *value == 'R') && strcasecmp(value, "radio") == 0) {
1421 /*--------------------------------------------------------------------*/
1422 /* "input type='radio'" tag is processed. */
1423 /*--------------------------------------------------------------------*/
1424 s_hdml_do_input_radio_tag(hdml, node);
1427 if ((*value == 'c' || *value == 'C') && strcasecmp(value, "checkbox") == 0) {
1428 /*--------------------------------------------------------------------*/
1429 /* "input type='checkbox'" tag is processed. */
1430 /*--------------------------------------------------------------------*/
1431 s_hdml_do_input_checkbox_tag(hdml, node);
1435 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
1439 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "value") == 0) {
1443 if ((*name == 's' || *name == 'S') && strcasecmp(name, "size") == 0) {
1447 if ((*name == 'm' || *name == 'M') && strcasecmp(name, "maxlength") == 0) {
1451 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "checked") == 0) {
1455 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0) {
1459 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "istyle") == 0) {
1464 hdml->hdml_br_flag = 0;
1471 * The substitution processing of tag "input type = text" is done.
1473 * @param hdml [i/o] The pointer to the HDML structure at the output
1474 * destination is specified.
1475 * @param tag [i] The tag node of input type=text is specified.
1478 s_hdml_do_input_text_tag(hdml_t* hdml, Node* tag)
1492 s_hdml_tag_output_upper_half(hdml, tag);
1495 s_output_to_hdml_out(hdml,
1496 apr_psprintf(r->pool,
1497 "<A TASK=GOSUB LABEL=\x93\xfc\x97\xcd DEST=#D%d "
1498 "VARS=\"V=$%s%02d\" RECEIVE=%s%02d>",
1500 s_get_form_no(r, hdml),
1501 hdml->var_cnt[hdml->pure_form_cnt],
1502 s_get_form_no(r, hdml),
1503 hdml->var_cnt[hdml->pure_form_cnt]
1506 s_output_to_hdml_out(hdml,
1507 apr_psprintf(r->pool,
1509 s_get_form_no(r, hdml),
1510 hdml->var_cnt[hdml->pure_form_cnt]));
1512 /*--------------------------------------------------------------------------*/
1513 /* ENTRY CARD is output here. */
1514 /*--------------------------------------------------------------------------*/
1515 s_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1516 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1517 s_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1523 nm = qs_get_name_attr(doc, tag, r);
1525 nm = qs_alloc_zero_byte_string(r);
1528 s_output_to_postdata(hdml,
1529 apr_psprintf(r->pool,
1532 s_get_form_no(r, hdml),
1533 hdml->var_cnt[hdml->pure_form_cnt]));
1535 mlen = qs_get_maxlength_attr (doc, tag, r);
1536 is = qs_get_istyle_attr (doc, tag, r);
1537 val = qs_get_value_attr (doc, tag, r);
1539 fmt = qs_conv_istyle_to_format(r, is);
1540 DBG(r,"qs_conv_istyle_to_format end");
1544 for (ii=0; ii<strlen(mlen); ii++) {
1545 if (mlen[ii] < '0' || mlen[ii] > '9') {
1546 mlen = apr_psprintf(r->pool, "0");
1550 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=%d%s", atoi(mlen), fmt));
1553 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1556 s_output_to_hdml_card(hdml,
1557 " MARKABLE=FALSE>\n"
1558 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
1562 s_output_to_init_vars(hdml,
1563 apr_psprintf(r->pool,
1565 s_get_form_no(r, hdml),
1566 hdml->var_cnt[hdml->pure_form_cnt],
1567 chxj_escape_uri(r->pool,val)));
1569 s_output_to_init_vars(hdml,
1570 apr_psprintf(r->pool,
1572 s_get_form_no(r, hdml),
1573 hdml->var_cnt[hdml->pure_form_cnt]));
1575 hdml->var_cnt[hdml->pure_form_cnt]++;
1580 * The substitution processing of tag "input type = password" is done.
1582 * @param hdml [i/o] The pointer to the HDML structure at the output
1583 * destination is specified.
1584 * @param tag [i] The tag node of input type=password is specified.
1587 s_hdml_do_input_password_tag(hdml_t* hdml, Node* tag)
1600 s_hdml_tag_output_upper_half(hdml, tag);
1603 s_output_to_hdml_out(hdml, "<A TASK=GOSUB LABEL=\"\x93\xfc\x97\xcd\" DEST=");
1604 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "#D%d ", hdml->card_cnt));
1605 s_output_to_hdml_out(hdml,
1606 apr_psprintf(r->pool,
1607 "VARS=\"V=$%s%02d\" ",
1608 s_get_form_no(r, hdml),
1609 hdml->var_cnt[hdml->pure_form_cnt]));
1611 s_output_to_hdml_out(hdml,
1612 apr_psprintf(r->pool, "RECEIVE=%s%02d>" ,
1613 s_get_form_no(r, hdml),
1614 hdml->var_cnt[hdml->pure_form_cnt]));
1615 s_output_to_hdml_out(hdml,
1616 apr_psprintf(r->pool, "[$%s%02d]</A>\n" ,
1617 s_get_form_no(r, hdml),
1618 hdml->var_cnt[hdml->pure_form_cnt]));
1620 s_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1621 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1622 s_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1629 nm = qs_get_name_attr(doc, tag, r);
1631 nm = qs_alloc_zero_byte_string(r);
1633 s_output_to_postdata(hdml,
1634 apr_psprintf(r->pool,
1637 s_get_form_no(r, hdml),
1638 hdml->var_cnt[hdml->pure_form_cnt]));
1640 mlen = qs_get_maxlength_attr (doc, tag, r);
1641 val = qs_get_value_attr (doc, tag, r);
1642 /*--------------------------------------------------------------------------*/
1643 /* Default is a figure input. */
1644 /*--------------------------------------------------------------------------*/
1645 fmt = apr_psprintf(r->pool, "N");
1647 if (chxj_chk_numeric(mlen) != 0)
1648 mlen = apr_psprintf(r->pool, "0");
1649 s_output_to_hdml_card(hdml,
1650 apr_psprintf(r->pool, " FORMAT=%d%s", chxj_atoi(mlen), fmt));
1653 s_output_to_hdml_card(hdml,
1654 apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1656 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " NOECHO=TRUE "));
1658 s_output_to_hdml_card(hdml,
1659 " MARKABLE=FALSE>\n"
1660 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
1664 s_output_to_init_vars(hdml,
1665 apr_psprintf(r->pool, "%s%02d=%s",
1666 s_get_form_no(r, hdml),
1667 hdml->var_cnt[hdml->pure_form_cnt],
1668 chxj_escape_uri(r->pool,val)));
1670 s_output_to_init_vars(hdml,
1671 apr_psprintf(r->pool, "%s%02d=",
1672 s_get_form_no(r, hdml),
1673 hdml->var_cnt[hdml->pure_form_cnt]));
1675 hdml->var_cnt[hdml->pure_form_cnt]++;
1679 * The substitution processing of tag "input type = submit" is done.
1681 * @param hdml [i/o] The pointer to the HDML structure at the output
1682 * destination is specified.
1683 * @param tag [i] The tag node of input type=submit is specified.
1686 s_hdml_do_input_submit_tag(hdml_t* hdml, Node* tag)
1688 Doc* doc = hdml->doc;
1689 request_rec* r = doc->r;
1693 s_hdml_tag_output_upper_half(hdml, tag);
1695 s_output_to_hdml_out(hdml,
1696 apr_psprintf(r->pool,
1697 "<A TASK=GO LABEL=OK DEST=#F%d ",
1698 hdml->pure_form_cnt));
1700 /*--------------------------------------------------------------------------*/
1701 /* get name and value attribute */
1702 /*--------------------------------------------------------------------------*/
1703 nm = qs_get_name_attr (doc, tag, r);
1704 val = qs_get_value_attr (doc, tag, r);
1707 s_output_to_hdml_out(hdml,
1708 apr_psprintf(r->pool, "VARS=\"%s=%s\" ",
1710 chxj_escape_uri(r->pool,val)));
1711 if (strstr(hdml->postdata[hdml->pure_form_cnt], nm) == NULL) {
1712 s_output_to_postdata(hdml,
1713 apr_psprintf(r->pool,"%s%s=$%s",
1714 SUBMIT_BUTTON_PREFIX, nm, nm));
1717 s_output_to_hdml_out(hdml, ">" );
1718 s_output_to_hdml_out(hdml, val);
1719 s_output_to_hdml_out(hdml, "</A>\n" );
1723 * The substitution processing of tag "input type = hidden" is done.
1725 * @param hdml [i/o] The pointer to the HDML structure at the output
1726 * destination is specified.
1727 * @param tag [i] The tag node of input type=hidden is specified.
1730 s_hdml_do_input_hidden_tag(hdml_t* hdml, Node* tag)
1732 Doc* doc = hdml->doc;
1733 request_rec* r = doc->r;
1737 /*--------------------------------------------------------------------------*/
1738 /* get name and value attribute */
1739 /*--------------------------------------------------------------------------*/
1740 nm = qs_get_name_attr (doc, tag, r);
1741 val = qs_get_value_attr (doc, tag, r);
1744 s_output_to_postdata(hdml,
1745 apr_psprintf(r->pool,
1748 chxj_escape_uri(r->pool, val)));
1753 * The substitution processing of tag "input type = radio" is done.
1755 * @param hdml [i/o] The pointer to the HDML structure at the output
1756 * destination is specified.
1757 * @param tag [i] The tag node of input type=radio is specified.
1760 s_hdml_do_input_radio_tag(hdml_t* hdml, Node* tag)
1762 Doc* doc = hdml->doc;
1763 request_rec* r = doc->r;
1771 s_hdml_tag_output_upper_half(hdml, tag);
1773 /*--------------------------------------------------------------------------*/
1774 /* get name and value attribute */
1775 /*--------------------------------------------------------------------------*/
1776 nm = qs_get_name_attr (doc, tag, r);
1777 val = qs_get_value_attr (doc, tag, r);
1779 /*--------------------------------------------------------------------------*/
1780 /* The same name is searched out from the list made beforehand. */
1781 /*--------------------------------------------------------------------------*/
1782 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
1783 if (! hdml->radio_name_list[ii]) {
1785 DBG(r, "Oops... radio list is null[%d]", ii);
1786 /*----------------------------------------------------------------------*/
1787 /* Processing is ended because it doesn't happen off the fly. */
1788 /*----------------------------------------------------------------------*/
1792 if (strcasecmp(hdml->radio_name_list[ii], nm) == 0)
1795 if (ii == MAX_RADIO_COUNT) {
1797 DBG(r,"Oops... The same name was not in the list. ");
1798 /*------------------------------------------------------------------------*/
1799 /* Processing is ended because it doesn't happen off the fly. */
1800 /*------------------------------------------------------------------------*/
1804 s_output_to_hdml_out(hdml,
1805 apr_psprintf(r->pool,
1807 "LABEL=\"\x93\xfc\x97\xcd\" "
1808 "DEST=#R%d VARS=\"VAL=%s\" "
1814 if (hdml->radio_out_cnt[ii] == 0) {
1815 s_output_to_hdml_card(hdml,
1816 apr_psprintf(r->pool,
1817 "<NODISPLAY NAME=R%d>\n",
1819 s_output_to_hdml_card(hdml,
1820 apr_psprintf(r->pool,
1822 "TYPE=ACCEPT TASK=RETURN RETVALS=\"$VAL;"));
1825 kk = hdml->radio_out_cnt[ii];
1826 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
1827 if (! hdml->radio_value_list[ii][jj])
1832 for (jj=0; jj<r_cnt; jj++) {
1833 if (! hdml->radio_value_list[ii][jj])
1837 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, ";"));
1838 if (hdml->radio_out_cnt[ii] == 0)
1839 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, ";"));
1842 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "%s_%02d", nm, kk));
1843 if (hdml->radio_out_cnt[ii] == 0) {
1845 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "X"));
1847 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "_"));
1854 s_output_to_hdml_out(hdml,
1855 apr_psprintf(r->pool, "\" >$%s_%02d</A>",
1857 hdml->radio_out_cnt[ii]));
1858 if (! hdml->radio_out_cnt[ii]) {
1859 s_output_to_hdml_card(hdml, "\">\n" );
1860 s_output_to_hdml_card(hdml, "</NODISPLAY>\n");
1862 s_output_to_postdata(hdml, apr_psprintf(r->pool, "%s%s=$%s", RADIO_BUTTON_PREFIX, nm, nm));
1864 for (jj=0; jj<r_cnt; jj++) {
1865 if (hdml->radio_value_list[ii][jj] && hdml->radio_checked_value[ii]) {
1866 if (strcasecmp(hdml->radio_value_list[ii][jj],
1867 hdml->radio_checked_value[ii]) == 0) {
1868 s_output_to_init_vars(hdml,
1869 apr_psprintf(r->pool,
1875 s_output_to_init_vars(hdml,
1876 apr_psprintf(r->pool,
1883 s_output_to_init_vars(hdml,
1884 apr_psprintf(r->pool,
1891 if (hdml->radio_checked_value[ii]) {
1892 DBG(r,"radio button is checked. checked value is [%s]",
1893 hdml->radio_checked_value[ii]);
1894 s_output_to_init_vars(hdml,
1895 apr_psprintf(r->pool,
1898 hdml->radio_checked_value[ii]));
1901 DBG(r,"radio button is not checked. checked value is []");
1902 s_output_to_init_vars(hdml,
1903 apr_psprintf(r->pool,
1908 hdml->radio_out_cnt[ii]++;
1912 * The substitution processing of tag "input type = checkbox" is done.
1914 * @param hdml [i/o] The pointer to the HDML structure at the output
1915 * destination is specified.
1916 * @param tag [i] The tag node of input type=checkbox is specified.
1919 s_hdml_do_input_checkbox_tag(hdml_t* hdml, Node* tag)
1921 Doc* doc = hdml->doc;
1922 request_rec* r = doc->r;
1927 /*--------------------------------------------------------------------------*/
1928 /* It is posted to the one without the checked attribute. */
1929 /* However, they were able to be removed with INPUT FILTER. */
1930 /*--------------------------------------------------------------------------*/
1931 if (! hdml->has_checkbox) {
1932 hdml->has_checkbox++;
1933 s_output_to_hdml_card(hdml,
1934 "<NODISPLAY NAME=\"_chk\">\n"
1935 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
1936 "RETVALS=\"_uchk;$V;X\" >\n"
1938 "<NODISPLAY NAME=\"_uchk\">\n"
1939 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
1940 "RETVALS=\"_chk;;_\" >\n"
1943 DBG(r, "wrote checkbox hdml card.");
1946 /*--------------------------------------------------------------------------*/
1947 /* It is examined whether it is CHECKED. */
1948 /*--------------------------------------------------------------------------*/
1949 chk = qs_is_checked_checkbox_attr(doc, tag, r);
1951 /*--------------------------------------------------------------------------*/
1952 /* The value of the name attribute and the value attribute is acquired */
1954 /*--------------------------------------------------------------------------*/
1955 val = qs_get_value_attr(doc, tag, r);
1956 nm = qs_get_name_attr(doc, tag, r);
1959 val = qs_alloc_zero_byte_string(r);
1962 nm = qs_alloc_zero_byte_string(r);
1964 s_output_to_hdml_out(hdml, apr_psprintf(r->pool,
1965 "<A TASK=GOSUB LABEL=\"a\xaf\xb8\" "
1966 "DEST=\"#$%s%02d\" "
1968 "RECEIVE=\"%s%02d;%s%02d;%s%02d\">"
1970 s_get_form_no(r, hdml),
1971 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1973 s_get_form_no(r, hdml),
1974 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1975 s_get_form_no(r, hdml),
1976 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1977 s_get_form_no(r, hdml),
1978 hdml->var_cnt[hdml->pure_form_cnt] + 2,
1979 s_get_form_no(r, hdml),
1980 hdml->var_cnt[hdml->pure_form_cnt] + 2));
1982 s_output_to_init_vars(hdml,
1983 apr_psprintf(r->pool,
1984 "%s%02d=_uchk&%s%02d=%s&%s%02d=X",
1985 s_get_form_no(r, hdml),
1986 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1987 s_get_form_no(r, hdml),
1988 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1989 chxj_escape_uri(r->pool,val),
1990 s_get_form_no(r, hdml),
1991 hdml->var_cnt[hdml->pure_form_cnt] + 2
1995 s_output_to_init_vars(hdml,
1996 apr_psprintf(r->pool,
1997 "%s%02d=_chk&%s%02d=&%s%02d=_",
1998 s_get_form_no(r, hdml),
1999 hdml->var_cnt[hdml->pure_form_cnt] + 0,
2000 s_get_form_no(r, hdml),
2001 hdml->var_cnt[hdml->pure_form_cnt] + 1,
2002 s_get_form_no(r, hdml),
2003 hdml->var_cnt[hdml->pure_form_cnt] + 2
2007 s_output_to_postdata(hdml,
2008 apr_psprintf(r->pool, "%s%s=$%s%02d",
2011 s_get_form_no(r, hdml),
2012 hdml->var_cnt[hdml->pure_form_cnt] + 1));
2014 hdml->var_cnt[hdml->pure_form_cnt] += 3;
2018 * The ISTYLE attribute is converted into the HDML form.
2020 * @param r [i] To use POOL, the pointer to request_rec is specified.
2021 * @param is [i] The value of the ISTYLE attribute is specified.
2022 * @return The ISTYLE attribute converted into the HDML form is returned.
2025 qs_conv_istyle_to_format(request_rec* r, char* is)
2034 fmt = apr_psprintf(r->pool, "M");
2037 fmt = apr_psprintf(r->pool, "M");
2040 fmt = apr_psprintf(r->pool, "m");
2043 fmt = apr_psprintf(r->pool, "N");
2054 * It is a handler who processes the INPUT tag.
2056 * @param pdoc [i/o] The pointer to the HDML structure at the output
2057 * destination is specified.
2058 * @param node [i] The INPUT tag node is specified.
2059 * @return The conversion result is returned.
2062 s_hdml_end_input_tag(void* pdoc, Node* UNUSED(child))
2066 hdml = GET_HDML(pdoc);
2073 * It is a handler who processes the CENTER tag.
2075 * @param pdoc [i/o] The pointer to the HDML structure at the output
2076 * destination is specified.
2077 * @param node [i] The CENTER tag node is specified.
2078 * @return The conversion result is returned.
2081 s_hdml_start_center_tag(void* pdoc, Node* UNUSED(node))
2085 hdml = GET_HDML(pdoc);
2090 if (hdml->hdml_br_flag == 0)
2091 hdml = s_output_to_hdml_out(hdml, "<BR>\n");
2093 hdml = s_output_to_hdml_out(hdml, "<CENTER>");
2100 * It is a handler who processes the CENTER tag.
2102 * @param pdoc [i/o] The pointer to the HDML structure at the output
2103 * destination is specified.
2104 * @param node [i] The CENTER tag node is specified.
2105 * @return The conversion result is returned.
2108 s_hdml_end_center_tag(void* pdoc, Node* UNUSED(child))
2112 hdml = GET_HDML(pdoc);
2115 hdml->in_center = 0;
2117 hdml = s_output_to_hdml_out(hdml, "<BR>\n");
2118 hdml->hdml_br_flag = 1;
2125 * It is a handler who processes the HR tag.
2127 * @param pdoc [i/o] The pointer to the HDML structure at the output
2128 * destination is specified.
2129 * @param node [i] The HR tag node is specified.
2130 * @return The conversion result is returned.
2133 s_hdml_start_hr_tag(void* pdoc, Node* UNUSED(node))
2137 hdml = GET_HDML(pdoc);
2139 if (hdml->hdml_br_flag == 0) {
2140 s_output_to_hdml_out(hdml, "<BR>\n");
2141 if (hdml->in_center)
2144 if (hdml->div_in_center)
2145 hdml->div_in_center--;
2148 s_output_to_hdml_out(hdml, "<CENTER>\x81\x7c\x81\x7c\x81\x7c\x81\x7c\x81\x7c\x81\x7c\x81\x7c\x81\x7c\x81\x7c<BR>\n");
2150 hdml->hdml_br_flag = 1;
2157 * It is a handler who processes the HR tag.
2159 * @param pdoc [i/o] The pointer to the HDML structure at the output
2160 * destination is specified.
2161 * @param node [i] The HR tag node is specified.
2162 * @return The conversion result is returned.
2165 s_hdml_end_hr_tag(void* pdoc, Node* UNUSED(child))
2169 hdml = GET_HDML(pdoc);
2176 * It is a handler who processes the LI tag.
2178 * @param pdoc [i/o] The pointer to the HDML structure at the output
2179 * destination is specified.
2180 * @param node [i] The LI tag node is specified.
2181 * @return The conversion result is returned.
2184 s_hdml_start_li_tag(void* pdoc, Node* UNUSED(node))
2188 hdml = GET_HDML(pdoc);
2190 if (hdml->hdml_br_flag == 0) {
2191 s_output_to_hdml_out(hdml, "<BR>\n");
2192 if (hdml->in_center)
2195 if (hdml->div_in_center)
2196 hdml->div_in_center--;
2199 hdml->hdml_br_flag = 1;
2206 * It is a handler who processes the LI tag.
2208 * @param pdoc [i/o] The pointer to the HDML structure at the output
2209 * destination is specified.
2210 * @param node [i] The LI tag node is specified.
2211 * @return The conversion result is returned.
2214 s_hdml_end_li_tag(void* pdoc, Node* UNUSED(child))
2218 hdml = GET_HDML(pdoc);
2220 if (hdml->hdml_br_flag == 0) {
2221 s_output_to_hdml_out(hdml, "<BR>\n");
2222 if (hdml->in_center)
2225 if (hdml->div_in_center)
2226 hdml->div_in_center--;
2229 hdml->hdml_br_flag = 1;
2236 * It is a handler who processes the IMG tag.
2238 * @param pdoc [i/o] The pointer to the HDML structure at the output
2239 * destination is specified.
2240 * @param node [i] The IMG tag node is specified.
2241 * @return The conversion result is returned.
2244 s_hdml_start_img_tag(void* pdoc, Node* node)
2248 #ifndef IMG_NOT_CONVERT_FILENAME
2253 hdml = GET_HDML(pdoc);
2255 #ifndef IMG_NOT_CONVERT_FILENAME
2259 s_hdml_tag_output_upper_half(hdml, node);
2261 s_output_to_hdml_out(hdml, "<img");
2263 /* Get Attributes */
2264 for (attr = qs_get_attr(doc,node);
2266 attr = qs_get_next_attr(doc,attr)) {
2268 char* name = qs_get_attr_name(doc,attr);
2269 char* value = qs_get_attr_value(doc,attr);
2271 if ((*name == 's' || *name == 'S') && strcasecmp(name, "src") == 0) {
2272 value = chxj_encoding_parameter(hdml->doc->r, value);
2273 s_output_to_hdml_out(hdml, " src=\"");
2274 #ifdef IMG_NOT_CONVERT_FILENAME
2275 s_output_to_hdml_out(hdml, value );
2277 s_output_to_hdml_out(hdml, chxj_img_conv(doc->r, spec,value));
2279 s_output_to_hdml_out(hdml, "\"" );
2282 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align" ) == 0) {
2283 s_output_to_hdml_out(hdml, " align=\"" );
2284 s_output_to_hdml_out(hdml, value );
2285 s_output_to_hdml_out(hdml, "\"" );
2288 if ((*name == 'w' || *name == 'W') && strcasecmp(name, "width" ) == 0) {
2289 s_output_to_hdml_out(hdml, " width=\"");
2290 s_output_to_hdml_out(hdml, value );
2291 s_output_to_hdml_out(hdml, "\"" );
2294 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "height") == 0) {
2295 s_output_to_hdml_out(hdml, " height=\"");
2296 s_output_to_hdml_out(hdml, value );
2297 s_output_to_hdml_out(hdml, "\"" );
2300 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "hspace") == 0) {
2301 s_output_to_hdml_out(hdml, " hspace=\"");
2302 s_output_to_hdml_out(hdml, value );
2303 s_output_to_hdml_out(hdml, "\"" );
2306 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vspace") == 0) {
2307 s_output_to_hdml_out(hdml, " vspace=\"");
2308 s_output_to_hdml_out(hdml, value );
2309 s_output_to_hdml_out(hdml, "\"" );
2312 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alt" ) == 0) {
2313 s_output_to_hdml_out(hdml, " alt=\"" );
2314 s_output_to_hdml_out(hdml, value );
2315 s_output_to_hdml_out(hdml, "\"" );
2318 s_output_to_hdml_out(hdml, ">" );
2320 hdml->hdml_br_flag = 0;
2327 * It is a handler who processes the IMG tag.
2329 * @param pdoc [i/o] The pointer to the HDML structure at the output
2330 * destination is specified.
2331 * @param node [i] The IMG tag node is specified.
2332 * @return The conversion result is returned.
2335 s_hdml_end_img_tag(void* pdoc, Node* UNUSED(child))
2339 hdml = GET_HDML(pdoc);
2346 * It is a handler who processes the SELECT tag.
2348 * @param pdoc [i/o] The pointer to the HDML structure at the output
2349 * destination is specified.
2350 * @param node [i] The SELECT tag node is specified.
2351 * @return The conversion result is returned.
2354 s_hdml_start_select_tag(void* pdoc, Node* node)
2361 hdml = GET_HDML(pdoc);
2365 s_hdml_tag_output_upper_half(hdml, node);
2369 s_output_to_hdml_out(hdml, apr_psprintf(r->pool,
2370 "<A TASK=GOSUB LABEL=\x91\x49\x91\xf0 "
2371 "VARS=\"V=$%s%02d\" DEST=#D%d "
2372 "RECEIVE=\"%s%02d;%s%02d\">"
2374 s_get_form_no(r, hdml),
2375 hdml->var_cnt[hdml->pure_form_cnt]+0,
2377 s_get_form_no(r, hdml),
2378 hdml->var_cnt[hdml->pure_form_cnt]+0,
2379 s_get_form_no(r, hdml),
2380 hdml->var_cnt[hdml->pure_form_cnt]+1,
2381 s_get_form_no(r, hdml),
2382 hdml->var_cnt[hdml->pure_form_cnt]+1));
2384 s_output_to_hdml_card(hdml,
2385 apr_psprintf(r->pool,
2386 "<CHOICE KEY=V NAME=D%d ", hdml->card_cnt));
2387 s_output_to_hdml_card(hdml,
2388 apr_psprintf(r->pool,
2389 "DEFAULT=$V METHOD=ALPHA MARKABLE=FALSE>\n"));
2390 /*--------------------------------------------------------------------------*/
2391 /* Get Attributes */
2392 /*--------------------------------------------------------------------------*/
2393 for (attr = qs_get_attr(doc,node);
2395 attr=qs_get_next_attr(doc,attr)) {
2397 char* name = qs_get_attr_name(doc,attr);
2398 char* value = qs_get_attr_value(doc,attr);
2399 char* selval = NULL;
2400 char* selvaltxt = NULL;
2402 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2404 s_output_to_postdata(hdml,
2405 apr_psprintf(r->pool, "%s=$%s%02d",
2407 s_get_form_no(r, hdml),
2408 hdml->var_cnt[hdml->pure_form_cnt]));
2409 selval = qs_get_selected_value(doc, node, r);
2411 DBG(r, "selected value not found");
2412 selval = qs_alloc_zero_byte_string(r);
2415 DBG(r, "selected value found[%s]" , selval);
2417 selvaltxt = qs_get_selected_value_text(doc, node, r);
2419 selvaltxt = qs_alloc_zero_byte_string(r);
2421 DBG(r, "selvaltxt:[%s]" ,selvaltxt);
2423 s_output_to_init_vars(hdml,
2424 apr_psprintf(r->pool,
2425 "%s%02d=%s&%s%02d=%s",
2426 s_get_form_no(r, hdml),
2427 hdml->var_cnt[hdml->pure_form_cnt] + 0,
2429 s_get_form_no(r, hdml),
2430 hdml->var_cnt[hdml->pure_form_cnt] + 1,
2433 hdml->var_cnt[hdml->pure_form_cnt] += 2;
2438 hdml->hdml_br_flag = 0;
2444 * It is a handler who processes the SELECT tag.
2446 * @param pdoc [i/o] The pointer to the HDML structure at the output
2447 * destination is specified.
2448 * @param node [i] The SELECT tag node is specified.
2449 * @return The conversion result is returned.
2452 s_hdml_end_select_tag(void* pdoc, Node* UNUSED(node))
2456 hdml = GET_HDML(pdoc);
2458 s_output_to_hdml_card(hdml, "</CHOICE>\n");
2465 * It is a handler who processes the OPTION tag.
2467 * @param pdoc [i/o] The pointer to the HDML structure at the output
2468 * destination is specified.
2469 * @param node [i] The OPTION tag node is specified.
2470 * @return The conversion result is returned.
2473 s_hdml_start_option_tag(void* pdoc, Node* node)
2482 hdml = GET_HDML(pdoc);
2488 hdml->option_flag = 1;
2489 val = qs_get_value_attr(doc, node, r);
2491 /*--------------------------------------------------------------------------*/
2492 /* The child node of the object tag node acquires the value in assumption */
2493 /* that is the TEXT node. */
2494 /*--------------------------------------------------------------------------*/
2495 child = qs_get_child_node(doc, node);
2497 txtval = apr_palloc(r->pool, 1);
2501 txtval = qs_get_node_value(doc, child);
2503 DBG(r, "txtval:[%s]" , txtval);
2505 if (val && txtval) {
2506 s_output_to_hdml_card(hdml,
2507 apr_psprintf(r->pool,
2508 "<CE TASK=RETURN VALUE=\"%s\" "
2509 "RETVALS=\"$V;%s\">%s</CE>\n",
2511 qs_trim_string(r,txtval),
2512 qs_trim_string(r,txtval)));
2515 hdml->hdml_br_flag = 0;
2522 * It is a handler who processes the OPTION tag.
2524 * @param pdoc [i/o] The pointer to the HDML structure at the output
2525 * destination is specified.
2526 * @param node [i] The OPTION tag node is specified.
2527 * @return The conversion result is returned.
2530 s_hdml_end_option_tag(void* pdoc, Node* UNUSED(node))
2534 hdml = GET_HDML(pdoc);
2536 hdml->option_flag = 0;
2543 * It is a handler who processes the DIV tag.
2545 * @param pdoc [i/o] The pointer to the HDML structure at the output
2546 * destination is specified.
2547 * @param node [i] The DIV tag node is specified.
2548 * @return The conversion result is returned.
2551 s_hdml_start_div_tag(void* pdoc, Node* node)
2557 hdml = GET_HDML(pdoc);
2560 /*--------------------------------------------------------------------------*/
2561 /* If the br tag is not output immediately before the div tag appears, the */
2562 /* br tag is output. */
2563 /*--------------------------------------------------------------------------*/
2564 if (hdml->hdml_br_flag == 0) {
2565 hdml->hdml_br_flag = 1;
2566 s_output_to_hdml_out(hdml, "<BR>\n");
2569 /*--------------------------------------------------------------------------*/
2570 /* The object tag node is scanned. */
2571 /*--------------------------------------------------------------------------*/
2572 for (attr = qs_get_attr(doc,node);
2574 attr = qs_get_next_attr(doc,attr)) {
2575 char* name = qs_get_attr_name(doc,attr);
2576 char* value = qs_get_attr_value(doc,attr);
2578 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "align") == 0) {
2579 if ((*value == 'r' || *value == 'R') && strcasecmp(value, "right") == 0) {
2580 hdml->div_right_flag = 1;
2581 s_output_to_hdml_out(hdml, "<RIGHT>");
2582 hdml->hdml_br_flag = 0;
2586 if ((*value == 'c' || *value == 'C') && strcasecmp(value, "center") == 0) {
2587 hdml->div_center_flag = 1;
2588 s_output_to_hdml_out(hdml, "<CENTER>");
2589 hdml->hdml_br_flag = 0;
2594 hdml->hdml_br_flag = 0;
2601 * It is a handler who processes the DIV tag.
2603 * @param pdoc [i/o] The pointer to the HDML structure at the output
2604 * destination is specified.
2605 * @param node [i] The DIV tag node is specified.
2606 * @return The conversion result is returned.
2609 s_hdml_end_div_tag(void* pdoc, Node* UNUSED(node))
2614 hdml = GET_HDML(pdoc);
2617 if (hdml->div_right_flag == 1) {
2618 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
2619 hdml->div_right_flag = 0;
2621 if (hdml->div_center_flag == 1) {
2622 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
2623 hdml->div_center_flag = 0;
2624 hdml->div_in_center = 0;
2632 * It is a wrapper of the apr_pstrcat function.
2634 * @param r [i] To use POOL, the pointer to request_rec is specified.
2635 * @param o [i] The character string of connected origin is specified.
2636 * @param s [i] The character string connected with 'o' parameter is
2638 * @param len [i/o] The pointer to the area where the character string
2639 * length is stored is specified.
2640 * @return The character string after it connects it is returned.
2643 qs_out_apr_pstrcat(request_rec* r, char* o, char* s, int* len)
2645 *len = (strlen(s) + *len);
2646 return apr_pstrcat(r->pool, o, s, NULL);
2650 * The prepositive character string used to generate the variable for HDML is
2653 * @param r [i] To use POOL, the pointer to request_rec is specified.
2654 * @param hdml [i] The pointer to the HDML structure that maintains the seed
2655 * to generate it is specified.
2656 * @return The character string after it generates it is returned.
2659 s_get_form_no(request_rec* r, hdml_t* hdml)
2665 fc = hdml->form_cnt;
2667 apr_time_exp_tz(&tm, hdml->form_cnt, 0);
2669 result = apr_psprintf(r->pool, "%c",(int)('A' + ((fc / 100) % 26)));
2670 result = apr_pstrcat(r->pool, result,
2671 apr_psprintf(r->pool, "%02d%02d%02d",
2679 * The number of tag nodes .."Input type =' radio '".. is counted.
2681 * @param hdml [i] The pointer to the HDML structure is specified.
2682 * @param node [i] The first parents node that counts the radio tag node is
2686 s_hdml_count_radio_tag(hdml_t* hdml, Node* node)
2695 /*--------------------------------------------------------------------------*/
2696 /* All the child nodes of the specified node are scanned. */
2697 /*--------------------------------------------------------------------------*/
2698 for (child = qs_get_child_node(doc,node);
2700 child = qs_get_next_node(doc,child)) {
2711 name = qs_get_node_name(doc,child);
2712 if (strcasecmp(name, "input") != 0) {
2713 s_hdml_count_radio_tag(hdml, child);
2717 DBG(r,"found input tag");
2719 type = qs_get_type_attr(doc, child, r);
2721 ERR(r, "Oops! The input tag without the type attribute has been found.Please give a type.");
2725 if (strcasecmp(type, "radio") != 0)
2728 DBG(r, "found type=radio");
2730 rname = qs_get_name_attr (doc, child, r);
2731 rvalue = qs_get_value_attr(doc, child, r);
2734 /*----------------------------------------------------------------------*/
2735 /* Oops!. The input tag without the name attribute has been found. */
2736 /*----------------------------------------------------------------------*/
2737 DBG(r, "Oops!. The input tag without the name attribute has been found. Please give a name.");
2741 DBG(r, "found name attribute");
2743 /*------------------------------------------------------------------------*/
2744 /* It scans in radio_name_list. When the same value exists, the */
2745 /* value is overwrited. */
2746 /* The value is written in a new area when not is. */
2747 /*------------------------------------------------------------------------*/
2748 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
2749 if (! hdml->radio_name_list[ii]) {
2750 DBG(r, "new name:[%s]", rname);
2753 if (strcasecmp(hdml->radio_name_list[ii], rname) == 0) {
2754 DBG(r, "already registered name:[%s]", rname);
2758 if (ii == MAX_RADIO_COUNT) {
2759 DBG(r, apr_psprintf(r->pool,
2760 "I do not understand the name of the radiobutton "
2761 "of %d piece or more. Please decrease "
2762 "the number of radiobuttons.",
2767 DBG(r,"add radio name:[%s]" ,rname);
2769 hdml->radio_name_list[ii] = apr_pstrdup(r->pool, rname);
2771 /*------------------------------------------------------------------------*/
2772 /* It adds it to radio_value_list. */
2773 /*------------------------------------------------------------------------*/
2774 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++) {
2775 if (!hdml->radio_value_list[ii][jj])
2778 if (jj == MAX_RADIO_VALUE_COUNT) {
2779 DBG(r, apr_psprintf(r->pool,
2780 "I do not understand the value of the radiobutton "
2781 "of %d piece or more. Please decrease "
2782 "the number of radiobuttons.",
2783 MAX_RADIO_VALUE_COUNT));
2786 hdml->radio_value_list[ii][jj] = apr_pstrdup(r->pool, rvalue);
2788 /*------------------------------------------------------------------------*/
2789 /* Now let's be the checked attribute or scan. */
2790 /*------------------------------------------------------------------------*/
2791 chkd = qs_get_checked_attr(hdml->doc, child, hdml->doc->r);
2793 DBG(r,apr_psprintf(r->pool,
2794 "The tag scanned now had the checked "
2795 "attribute. The value is [%s].",
2797 hdml->radio_checked_value[ii] = apr_pstrdup(r->pool, rvalue);
2804 * The character string is added, and output to the out member of the HDML
2807 * @param hdml [i/o] The pointer to the HDML structure that maintains the out
2808 * member at the output destination is specified.
2809 * @param s [i] The character string that should be output is specified.
2810 * @return The pointer to the HDML structure after it processes it is returned.
2813 s_output_to_hdml_out(hdml_t* hdml, char* s)
2815 hdml->out = qs_out_apr_pstrcat(hdml->doc->r, hdml->out, s, &hdml->out_len);
2822 * The character string is added, and output to the card member of the HDML
2825 * @param hdml [i/o] The pointer to the HDML structure that maintains the
2826 * card member at the output destination is specified.
2827 * @param s [i] The character string that should be output is specified.
2828 * @return The pointer to the HDML structure after it processes it is returned.
2831 s_output_to_hdml_card(hdml_t* hdml, char* s)
2833 hdml->card = qs_out_apr_pstrcat(hdml->doc->r, hdml->card, s, &hdml->card_len);
2841 * The data for the post is added, and output.
2843 * @param hdml [i/o] The pointer to the HDML structure at the output
2844 * destination is specified.
2845 * @param s [i] The character string that wants to output to postdata is
2849 s_output_to_postdata(hdml_t* hdml, char* s)
2855 if (strlen(hdml->postdata[hdml->pure_form_cnt]))
2856 hdml->postdata[hdml->pure_form_cnt] =
2857 apr_pstrcat(r->pool,
2858 hdml->postdata[hdml->pure_form_cnt],
2862 hdml->postdata[hdml->pure_form_cnt] =
2863 apr_pstrcat(r->pool,
2864 hdml->postdata[hdml->pure_form_cnt],
2865 qs_trim_string(r, s),
2868 DBG(r, "POSTDATA:[%s]", hdml->postdata[hdml->pure_form_cnt] );
2874 * The tag output upper half.
2876 * @param hdml [i/o] The pointer to the HDML structure at the output
2877 * destination is specified.
2878 * @param node [i] The A tag node is specified.
2881 s_hdml_tag_output_upper_half(hdml_t* hdml, Node* UNUSED(node))
2883 if (hdml->hdml_br_flag == 1
2884 && hdml->div_right_flag == 1) {
2885 s_output_to_hdml_out(hdml, "<RIGHT>");
2886 hdml->hdml_br_flag = 0;
2889 if (hdml->hdml_br_flag == 1
2891 && hdml->in_center == 0) {
2892 s_output_to_hdml_out(hdml, "<CENTER>");
2894 hdml->hdml_br_flag = 0;
2897 if (hdml->hdml_br_flag == 1
2898 && hdml->div_center_flag > 0
2899 && hdml->div_in_center == 0) {
2900 s_output_to_hdml_out(hdml, "<CENTER>");
2901 hdml->div_in_center++;
2902 hdml->hdml_br_flag = 0;
2909 * The data for the init_vars is added, and output.
2911 * @param hdml [i/o] The pointer to the HDML structure at the output
2912 * destination is specified.
2913 * @param s [i] The character string that wants to output to postdata is
2917 s_output_to_init_vars(hdml_t* hdml, char* s)
2919 request_rec* r = hdml->doc->r;
2921 if (strlen(hdml->init_vars))
2922 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, "&", NULL);
2924 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, qs_trim_string(r,s), NULL);
2926 DBG(r, "INIT_VARS:[%s]", hdml->init_vars);
2932 s_hdml_chxjif_tag(void* pdoc, Node* node)
2938 hdml = GET_HDML(pdoc);
2941 for (child = qs_get_child_node(doc, node);
2943 child = qs_get_next_node(doc, child)) {
2944 s_output_to_hdml_out(hdml, child->otext);
2945 s_hdml_chxjif_tag(hdml, child);
2951 s_hdml_text_tag(void* pdoc, Node* child)
2963 hdml = GET_HDML(pdoc);
2967 textval = qs_get_node_value(doc,child);
2968 textval = qs_trim_string(r, textval);
2969 if (strlen(textval) == 0)
2972 if (hdml->option_flag == 1)
2975 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
2976 memset(tmp, 0, qs_get_node_size(doc,child)+1);
2977 tdst = apr_palloc(r->pool, 1);
2982 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
2984 int rtn = s_hdml_search_emoji(hdml, &textval[ii], &out);
2986 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
2990 if (is_sjis_kanji(textval[ii])) {
2991 one_byte[0] = textval[ii+0];
2992 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2993 one_byte[0] = textval[ii+1];
2994 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
2998 if (textval[ii] != '\r' && textval[ii] != '\n') {
2999 one_byte[0] = textval[ii+0];
3000 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3003 memcpy(tmp, textval, strlen(textval)-1);
3005 s_hdml_tag_output_upper_half(hdml, child->parent);
3006 s_output_to_hdml_out(hdml, tdst);
3007 hdml->hdml_br_flag = 0;