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);
33 static char *s_s_get_form_no(request_rec *r, hdml_t *hdml);
36 static char *s_hdml_start_html_tag (void *pdoc, Node *node);
37 static char *s_hdml_end_html_tag (void *pdoc, Node *node);
38 static char *s_hdml_start_meta_tag (void *pdoc, Node *node);
39 static char *s_hdml_end_meta_tag (void *pdoc, Node *node);
40 static char *s_hdml_start_li_tag (void *pdoc, Node *node);
41 static char *s_hdml_end_li_tag (void *pdoc, Node *node);
42 static char *s_hdml_start_head_tag (void *pdoc, Node *node);
43 static char *s_hdml_end_head_tag (void *pdoc, Node *node);
44 static char *s_hdml_start_title_tag (void *pdoc, Node *node);
45 static char *s_hdml_end_title_tag (void *pdoc, Node *node);
46 static char *s_hdml_start_base_tag (void *pdoc, Node *node);
47 static char *s_hdml_end_base_tag (void *pdoc, Node *node);
48 static char *s_hdml_start_body_tag (void *pdoc, Node *node);
49 static char *s_hdml_end_body_tag (void *pdoc, Node *node);
50 static char *s_hdml_start_a_tag (void *pdoc, Node *node);
51 static char *s_hdml_end_a_tag (void *pdoc, Node *node);
52 static char *s_hdml_start_br_tag (void *pdoc, Node *node);
53 static char *s_hdml_end_br_tag (void *pdoc, Node *node);
54 static char *s_hdml_start_tr_tag (void *pdoc, Node *node);
55 static char *s_hdml_end_tr_tag (void *pdoc, Node *node);
56 static char *s_hdml_start_font_tag (void *pdoc, Node *node);
57 static char *s_hdml_end_font_tag (void *pdoc, Node *node);
58 static char *s_hdml_start_form_tag (void *pdoc, Node *node);
59 static char *s_hdml_end_form_tag (void *pdoc, Node *node);
60 static char *s_hdml_start_input_tag (void *pdoc, Node *node);
61 static char *s_hdml_end_input_tag (void *pdoc, Node *node);
62 static char *s_hdml_start_select_tag (void *pdoc, Node *node);
63 static char *s_hdml_end_select_tag (void *pdoc, Node *node);
64 static char *s_hdml_start_option_tag (void *pdoc, Node *node);
65 static char *s_hdml_end_option_tag (void *pdoc, Node *node);
66 static char *s_hdml_start_center_tag (void *pdoc, Node *node);
67 static char *s_hdml_end_center_tag (void *pdoc, Node *node);
68 static char *s_hdml_start_hr_tag (void *pdoc, Node *node);
69 static char *s_hdml_end_hr_tag (void *pdoc, Node *node);
70 static char *s_hdml_start_img_tag (void *pdoc, Node *node);
71 static char *s_hdml_end_img_tag (void *pdoc, Node *node);
72 static char *s_hdml_start_div_tag (void *pdoc, Node *node);
73 static char *s_hdml_end_div_tag (void *pdoc, Node *node);
74 static char *s_hdml_start_blockquote_tag(void *pdoc, Node *node);
75 static char *s_hdml_end_blockquote_tag (void *pdoc, Node *node);
76 static char *s_hdml_start_dir_tag (void *pdoc, Node *node);
77 static char *s_hdml_end_dir_tag (void *pdoc, Node *node);
78 static char *s_hdml_start_dt_tag (void *pdoc, Node *node);
79 static char *s_hdml_end_dt_tag (void *pdoc, Node *node);
80 static char *s_hdml_start_dd_tag (void *pdoc, Node *node);
81 static char *s_hdml_end_dd_tag (void *pdoc, Node *node);
83 static char *((*s_get_form_no)(request_rec* r, hdml_t* hdml)) = s_s_get_form_no;
85 static void s_hdml_count_radio_tag (hdml_t* hdml, Node* node) ;
87 static void s_hdml_do_input_text_tag (hdml_t *hdml, Node *tag);
88 static void s_hdml_do_input_password_tag(hdml_t *hdml, Node *tag);
89 static void s_hdml_do_input_submit_tag (hdml_t *hdml, Node *tag);
90 static void s_hdml_do_input_reset_tag (hdml_t *hdml, Node *tag);
91 static void s_hdml_do_input_hidden_tag (hdml_t *hdml, Node *tag);
92 static void s_hdml_do_input_radio_tag (hdml_t *hdml, Node *tag);
93 static void s_hdml_do_input_checkbox_tag(hdml_t *hdml, Node *tag);
94 static void s_hdml_tag_output_upper_half(hdml_t *hdml, Node* node);
96 static hdml_t *s_output_to_hdml_out (hdml_t *hdml, char *s);
97 static hdml_t *s_output_to_hdml_card (hdml_t *hdml, char *s);
98 static void s_output_to_postdata (hdml_t *hdml, char *s);
99 static void s_output_to_init_vars (hdml_t *hdml, char *s);
100 static int s_hdml_search_emoji (hdml_t *hdml, char *txt, char **rslt);
102 static char *s_hdml_chxjif_tag (void *pdoc, Node *node);
103 static char *s_hdml_text_tag (void *pdoc, Node *node);
106 tag_handler hdml_handler[] = {
109 s_hdml_start_html_tag,
114 s_hdml_start_meta_tag,
144 s_hdml_start_dir_tag,
149 s_hdml_start_div_tag,
154 s_hdml_start_div_tag,
159 s_hdml_start_div_tag,
164 s_hdml_start_div_tag,
169 s_hdml_start_div_tag,
174 s_hdml_start_div_tag,
179 s_hdml_start_head_tag,
184 s_hdml_start_title_tag,
185 s_hdml_end_title_tag,
189 s_hdml_start_base_tag,
194 s_hdml_start_body_tag,
229 s_hdml_start_font_tag,
234 s_hdml_start_form_tag,
239 s_hdml_start_input_tag,
240 s_hdml_end_input_tag,
244 s_hdml_start_center_tag,
245 s_hdml_end_center_tag,
254 s_hdml_start_img_tag,
259 s_hdml_start_select_tag,
260 s_hdml_end_select_tag,
264 s_hdml_start_option_tag,
265 s_hdml_end_option_tag,
269 s_hdml_start_div_tag,
334 s_hdml_start_blockquote_tag,
335 s_hdml_end_blockquote_tag,
339 s_hdml_start_dir_tag,
354 s_hdml_start_dir_tag,
375 * converts from CHTML to hdml.
377 * @param r [i] Requet_rec is appointed.
378 * @param spec [i] The result of the device specification processing which
379 * was done in advance is appointed.
380 * @param src [i] The character string before the converting is appointed.
381 * @return The character string after the converting is returned.
390 chxjconvrule_entry* entryp,
391 cookie_t* UNUSED(cookie)
402 /*--------------------------------------------------------------------------*/
404 /*--------------------------------------------------------------------------*/
406 dst = chxj_qr_code_blob_handler(r, src, (size_t*)dstlen);
408 DBG(r,"i found qrcode xml");
411 DBG(r,"not found qrcode xml");
413 /*--------------------------------------------------------------------------*/
414 /* initialize hdml structure */
415 /*--------------------------------------------------------------------------*/
416 s_init_hdml(&hdml,&doc,r, spec);
418 hdml.entryp = entryp;
420 chxj_set_content_type(r, "text/x-hdml; charset=Shift_JIS");
421 /*--------------------------------------------------------------------------*/
423 /*--------------------------------------------------------------------------*/
425 chxj_dump_out("[src] CHTML->HDML", src, srclen);
428 /*--------------------------------------------------------------------------*/
429 /* It is examined whether there is a location header. It ends without doing */
430 /* anything when is. */
431 /*--------------------------------------------------------------------------*/
432 buf = (char*)apr_table_get(r->headers_out, (const char*)"Location");
434 /*------------------------------------------------------------------------*/
435 /* The Location header generates tag in an initial HDML machine for the */
436 /* uncorrespon dence. */
437 /*------------------------------------------------------------------------*/
438 DBG(r, "Location is not null[Location:%s]", buf);
439 s_output_to_hdml_out(&hdml,
440 "<HDML VERSION=3.0 MARKABLE=TRUE PUBLIC=TRUE>\r\n"
441 "<NODISPLAY MARKABLE=TRUE PUBLIC=TRUE TITLE=\" \">\r\n"
442 "<ACTION TYPE=ACCEPT TASK=GO DEST=\""
444 s_output_to_hdml_out(&hdml, buf);
445 s_output_to_hdml_out(&hdml,
450 dst = apr_pstrdup(r->pool, hdml.out);
453 /*------------------------------------------------------------------------*/
454 /* Here, the parsing of the received character string is done */
455 /*------------------------------------------------------------------------*/
456 char *ss = apr_palloc(r->pool, srclen + 1);
457 memset(ss, 0, srclen + 1);
458 memcpy(ss, src, srclen);
460 DBG(r, "input strlen(src)=[%d]", (int)srclen);
461 DBG(r, "[[[[%s]]]", src);
463 qs_init_malloc(&doc);
464 qs_init_root_node(&doc);
466 qs_parse_string(&doc, ss, srclen);
468 /*------------------------------------------------------------------------*/
469 /* The number of radiobuttons is counted. */
470 /*------------------------------------------------------------------------*/
471 s_hdml_count_radio_tag(&hdml, qs_get_root(&doc));
473 chxj_node_exchange(spec,r,(void*)&hdml, &doc, qs_get_root(&doc), 0);
476 DBG(r,"tmp=[%s]", dst);
477 qs_all_free(&doc,QX_LOGMARK);
480 /*--------------------------------------------------------------------------*/
482 /*--------------------------------------------------------------------------*/
484 chxj_dump_out("[dst] CHTML->HDML", hdml.out, hdml.out_len);
487 /*--------------------------------------------------------------------------*/
488 /* When there is no processing result, former character string is copied */
489 /* and it returns it. */
490 /*--------------------------------------------------------------------------*/
493 return apr_pstrdup(r->pool,src);
496 *dstlen = hdml.out_len;
498 /*--------------------------------------------------------------------------*/
499 /* Null is set at the end of the character string to make sure. */
500 /*--------------------------------------------------------------------------*/
501 dst[hdml.out_len] = 0;
508 * The HDML structure is initialized.
510 * @param hdml [i/o] The pointer to the HDML structure that wants to be
511 * initialized is specified.
512 * @param doc [i] The Doc structure that should be set to the initialized
513 * HDML structure is specified.
514 * @param r [i] To use POOL, the pointer to request_rec is specified.
515 * @param spec [i] The pointer to the device_table
518 s_init_hdml(hdml_t *hdml, Doc *doc, request_rec *r, device_table *spec)
523 /*--------------------------------------------------------------------------*/
524 /* init hdml structure value */
525 /*--------------------------------------------------------------------------*/
526 memset(hdml, 0, sizeof(hdml_t));
528 hdml->card = qs_alloc_zero_byte_string(r);
530 hdml->conf = chxj_get_module_config(r->per_dir_config, &chxj_module);
531 hdml->doc->parse_mode = PARSE_MODE_CHTML;
533 for (ii=0; ii<MAX_FORM_COUNT; ii++) {
534 hdml->var_cnt[ii] = 0;
535 hdml->postdata[ii] = qs_alloc_zero_byte_string(r);
538 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
539 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
540 hdml->radio_value_list[ii][jj] = NULL;
542 hdml->radio_name_list[ii] = NULL;
543 hdml->radio_out_cnt[ii] = 0;
544 hdml->radio_checked_value[ii] = NULL;
547 for (ii=0; ii<MAX_SUBMIT_BUTTON_COUNT; ii++)
548 hdml->submit_button[ii] = NULL;
550 hdml->init_vars = qs_alloc_zero_byte_string(r);
554 hdml->form_cnt = apr_time_now();
555 hdml->out = qs_alloc_zero_byte_string(r);
560 s_hdml_search_emoji(hdml_t* hdml, char* txt, char** rslt)
573 DBG(r,"spec is NULL");
575 for (ee = hdml->conf->emoji;
579 unsigned char hex1byte;
580 unsigned char hex2byte;
583 DBG(r, "emoji->imode is NULL");
587 hex1byte = ee->imode->hex1byte & 0xff;
588 hex2byte = ee->imode->hex2byte & 0xff;
590 if (ee->imode->string
591 && strlen(ee->imode->string) > 0
592 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0) {
593 if (spec == NULL || spec->emoji_type == NULL) {
594 *rslt = apr_psprintf(r->pool,
597 return strlen(ee->imode->string);
600 if (strcasecmp(hdml->spec->emoji_type, "a") == 0) {
601 *rslt = apr_psprintf(r->pool,
604 return strlen(ee->imode->string);
607 if (strcasecmp(hdml->spec->emoji_type, "b") == 0) {
608 *rslt = apr_psprintf(r->pool,
611 return strlen(ee->imode->string);
614 if (strcasecmp(hdml->spec->emoji_type, "c") == 0) {
615 *rslt = apr_psprintf(r->pool,
618 return strlen(ee->imode->string);
621 if (strcasecmp(hdml->spec->emoji_type, "d") == 0) {
622 *rslt = apr_psprintf(r->pool,
625 return strlen(ee->imode->string);
628 *rslt = apr_psprintf(r->pool,
631 return strlen(ee->imode->string);
636 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
637 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte)) {
638 if (spec == NULL || spec->emoji_type == NULL) {
639 *rslt = apr_psprintf(r->pool,
645 if (strcasecmp(hdml->spec->emoji_type, "a") == 0) {
646 *rslt = apr_psprintf(r->pool,
652 if (strcasecmp(hdml->spec->emoji_type, "b") == 0) {
653 *rslt = apr_psprintf(r->pool,
659 if (strcasecmp(hdml->spec->emoji_type, "c") == 0) {
660 *rslt = apr_psprintf(r->pool,
666 if (strcasecmp(hdml->spec->emoji_type, "d") == 0) {
667 *rslt = apr_psprintf(r->pool,
673 *rslt = apr_psprintf(r->pool,
686 * It is a handler who processes the HTML tag.
688 * @param pdoc [i/o] The pointer to the HDML structure at the output
689 * destination is specified.
690 * @param node [i] The HTML tag node is specified.
691 * @return The conversion result is returned.
694 s_hdml_start_html_tag(void* pdoc, Node* UNUSED(node))
698 hdml = GET_HDML(pdoc);
700 s_output_to_hdml_out(hdml,
701 "<HDML VERSION=3.0 TTL=0 MARKABLE=TRUE>\r\n"
702 "<NODISPLAY NAME=D0>\r\n"
703 "<ACTION TYPE=ACCEPT TASK=GOSUB DEST=#D1 NEXT=#D2 CLEAR=TRUE>\r\n"
708 hdml->hdml_br_flag = 0;
715 * It is a handler who processes the HTML tag.
717 * @param pdoc [i/o] The pointer to the HDML structure at the output
718 * destination is specified.
719 * @param node [i] The HTML tag node is specified.
720 * @return The conversion result is returned.
723 s_hdml_end_html_tag(void* pdoc, Node* UNUSED(child))
727 hdml = GET_HDML(pdoc);
729 s_output_to_hdml_card(hdml,
730 "<NODISPLAY NAME=D1>\r\n"
731 "<ACTION TYPE=ACCEPT TASK=RETURN VARS=\""
734 if (strlen(hdml->init_vars))
735 s_output_to_hdml_card(hdml, hdml->init_vars );
737 s_output_to_hdml_card(hdml, "_chxj_dmy=" );
739 s_output_to_hdml_card(hdml,
744 s_output_to_hdml_out(hdml, hdml->card );
745 s_output_to_hdml_out(hdml, "</HDML>\r\n");
747 hdml->hdml_end_flag = 1;
754 * It is a handler who processes the META tag.
756 * @param pdoc [i/o] The pointer to the HDML structure at the output
757 * destination is specified.
758 * @param node [i] The META tag node is specified.
759 * @return The conversion result is returned.
762 s_hdml_start_meta_tag(void* pdoc, Node* UNUSED(node))
766 hdml = GET_HDML(pdoc);
768 hdml->hdml_br_flag = 0;
777 * It is a handler who processes the META tag.
779 * @param pdoc [i/o] The pointer to the HDML structure at the output
780 * destination is specified.
781 * @param node [i] The META tag node is specified.
782 * @return The conversion result is returned.
785 s_hdml_end_meta_tag(void* pdoc, Node* UNUSED(child))
789 hdml = GET_HDML(pdoc);
796 * It is a handler who processes the HEAD tag.
798 * @param pdoc [i/o] The pointer to the HDML structure at the output
799 * destination is specified.
800 * @param node [i] The HEAD tag node is specified.
801 * @return The conversion result is returned.
804 s_hdml_start_head_tag(void* pdoc, Node* UNUSED(node))
808 hdml = GET_HDML(pdoc);
812 hdml->hdml_br_flag = 0;
819 * It is a handler who processes the HEAD tag.
821 * @param pdoc [i/o] The pointer to the HDML structure at the output
822 * destination is specified.
823 * @param node [i] The HEAD tag node is specified.
824 * @return The conversion result is returned.
827 s_hdml_end_head_tag(void* pdoc, Node* UNUSED(child))
831 hdml = GET_HDML(pdoc);
839 * It is a handler who processes the TITLE tag.
841 * @param pdoc [i/o] The pointer to the HDML structure at the output
842 * destination is specified.
843 * @param node [i] The TITLE tag node is specified.
844 * @return The conversion result is returned.
847 s_hdml_start_title_tag(void* pdoc, Node* UNUSED(node))
851 hdml = GET_HDML(pdoc);
853 s_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"");
855 hdml->found_title = 1;
856 hdml->hdml_br_flag = 0;
863 * It is a handler who processes the TITLE tag.
865 * @param pdoc [i/o] The pointer to the HDML structure at the output
866 * destination is specified.
867 * @param node [i] The TITLE tag node is specified.
868 * @return The conversion result is returned.
871 s_hdml_end_title_tag(void* pdoc, Node* UNUSED(child))
875 hdml = GET_HDML(pdoc);
877 s_output_to_hdml_out(hdml, "\">\r\n");
884 * It is a handler who processes the BASE tag.
886 * @param pdoc [i/o] The pointer to the HDML structure at the output
887 * destination is specified.
888 * @param node [i] The BASE tag node is specified.
889 * @return The conversion result is returned.
892 s_hdml_start_base_tag(void* pdoc, Node* UNUSED(node))
896 hdml = GET_HDML(pdoc);
898 hdml->hdml_br_flag = 0;
905 * It is a handler who processes the BASE tag.
907 * @param pdoc [i/o] The pointer to the HDML structure at the output
908 * destination is specified.
909 * @param node [i] The BASE tag node is specified.
910 * @return The conversion result is returned.
913 s_hdml_end_base_tag(void* pdoc, Node* UNUSED(child))
917 hdml = GET_HDML(pdoc);
924 * It is a handler who processes the BODY tag.
926 * @param pdoc [i/o] The pointer to the HDML structure at the output
927 * destination is specified.
928 * @param node [i] The BODY tag node is specified.
929 * @return The conversion result is returned.
932 s_hdml_start_body_tag(void* pdoc, Node* node)
938 hdml = GET_HDML(pdoc);
942 if (hdml->found_title == 0)
943 s_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"NO TITLE\">\r\n");
945 s_output_to_hdml_out(hdml, "<ACTION TYPE=ACCEPT TASK=NOOP LABEL=\" \"");
947 /*--------------------------------*/
949 /*--------------------------------*/
950 for (attr = qs_get_attr(doc,node);
952 attr = qs_get_next_attr(doc,attr)) {
956 name = qs_get_attr_name(doc,attr);
958 if ((*name == 'b' || *name == 'B') && strcasecmp(name, "bgcolor") == 0) {
962 if ((*name == 't' || *name == 'T') && strcasecmp(name, "text") == 0) {
966 if ((*name == 'l' || *name == 'L') && strcasecmp(name, "link") == 0) {
970 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "alink") == 0) {
974 if ((*name == 'v' || *name == 'V') && strcasecmp(name, "vlink") == 0) {
979 s_output_to_hdml_out(hdml, ">\r\n");
981 hdml->hdml_br_flag = 0;
988 * It is a handler who processes the BODY tag.
990 * @param pdoc [i/o] The pointer to the HDML structure at the output
991 * destination is specified.
992 * @param node [i] The BODY tag node is specified.
993 * @return The conversion result is returned.
996 s_hdml_end_body_tag(void* pdoc, Node* UNUSED(child))
1000 hdml = GET_HDML(pdoc);
1002 s_output_to_hdml_out(hdml, "\r\n</DISPLAY>\r\n");
1009 * It is a handler who processes the A tag.
1011 * @param pdoc [i/o] The pointer to the HDML structure at the output
1012 * destination is specified.
1013 * @param node [i] The A tag node is specified.
1014 * @return The conversion result is returned.
1017 s_hdml_start_a_tag(void* pdoc, Node* node)
1023 hdml = GET_HDML(pdoc);
1026 s_hdml_tag_output_upper_half(hdml,node);
1028 s_output_to_hdml_out(hdml, "<A");
1031 /*------------------------------------*/
1032 /* Get Attributes */
1033 /*------------------------------------*/
1034 for (attr = qs_get_attr(doc,node);
1036 attr = qs_get_next_attr(doc,attr)) {
1041 name = qs_get_attr_name(doc,attr);
1042 value = qs_get_attr_value(doc,attr);
1044 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
1048 if ((*name == 'h' || *name == 'H') && strcasecmp(name, "href") == 0) {
1049 if ((*value == 'm' || *value == 'M')
1050 && strncasecmp(value, "mailto:", 7) == 0) {
1051 value = chxj_encoding_parameter(hdml->doc->r, value);
1052 s_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
1053 s_output_to_hdml_out(hdml, value );
1054 s_output_to_hdml_out(hdml, "\" " );
1057 if ((*value == 't' || *value == 'T')
1058 && strncasecmp(value, "tel:", 4) == 0) {
1060 s_output_to_hdml_out(hdml, " TASK=CALL NUMBER=\"");
1061 s_output_to_hdml_out(hdml, &value[4] );
1062 s_output_to_hdml_out(hdml, "\" " );
1065 s_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
1066 s_output_to_hdml_out(hdml, value );
1067 s_output_to_hdml_out(hdml, "\"" );
1071 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "accesskey") == 0 && value && *value) {
1072 if (strcasecmp(value, "0") != 0) {
1073 s_output_to_hdml_out(hdml, " ACCESSKEY=" );
1074 s_output_to_hdml_out(hdml, value );
1075 s_output_to_hdml_out(hdml, "" );
1079 if ((*name == 'c' || *name == 'C') && strcasecmp(name, "cti") == 0) {
1083 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ijam") == 0) {
1087 if ((*name == 'u' || *name == 'U') && strcasecmp(name, "utn") == 0) {
1091 if ((*name == 't' || *name == 'T') && strcasecmp(name, "telbook") == 0) {
1095 if ((*name == 'k' || *name == 'K') && strcasecmp(name, "kana") == 0) {
1099 if ((*name == 'e' || *name == 'E') && strcasecmp(name, "email") == 0) {
1103 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ista") == 0) {
1107 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "ilet") == 0) {
1111 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "iswf") == 0) {
1115 if ((*name == 'i' || *name == 'I') && strcasecmp(name, "irst") == 0) {
1119 s_output_to_hdml_out(hdml, ">" );
1121 hdml->hdml_a_flag = 1;
1123 hdml->hdml_br_flag = 0;
1130 * It is a handler who processes the A tag.
1132 * @param pdoc [i/o] The pointer to the HDML structure at the output
1133 * destination is specified.
1134 * @param node [i] The A tag node is specified.
1135 * @return The conversion result is returned.
1138 s_hdml_end_a_tag(void* pdoc, Node* UNUSED(child))
1142 hdml = GET_HDML(pdoc);
1144 s_output_to_hdml_out(hdml, "</A>\r\n");
1146 hdml->hdml_a_flag = 0;
1153 * It is a handler who processes the BR tag.
1155 * @param pdoc [i/o] The pointer to the HDML structure at the output
1156 * destination is specified.
1157 * @param node [i] The BR tag node is specified.
1158 * @return The conversion result is returned.
1161 s_hdml_start_br_tag(void* pdoc, Node* UNUSED(node))
1165 hdml = GET_HDML(pdoc);
1167 if (hdml->in_center > 0)
1168 hdml->in_center = 0;
1170 if (hdml->div_in_center > 0)
1171 hdml->div_in_center = 0;
1173 s_output_to_hdml_out(hdml, "<BR>\r\n");
1175 hdml->hdml_br_flag = 1;
1182 * It is a handler who processes the BR tag.
1184 * @param pdoc [i/o] The pointer to the HDML structure at the output
1185 * destination is specified.
1186 * @param node [i] The BR tag node is specified.
1187 * @return The conversion result is returned.
1190 s_hdml_end_br_tag(void* pdoc, Node* UNUSED(child))
1194 hdml = GET_HDML(pdoc);
1201 * It is a handler who processes the TR tag.
1203 * @param pdoc [i/o] The pointer to the HDML structure at the output
1204 * destination is specified.
1205 * @param node [i] The TR tag node is specified.
1206 * @return The conversion result is returned.
1209 s_hdml_start_tr_tag(void* pdoc, Node* UNUSED(node))
1213 hdml = GET_HDML(pdoc);
1215 if (hdml->in_center > 0)
1216 hdml->in_center = 0;
1218 if (hdml->div_in_center > 0)
1219 hdml->div_in_center = 0;
1221 s_output_to_hdml_out(hdml, "<BR>\r\n");
1223 hdml->hdml_br_flag = 1;
1230 * It is a handler who processes the TR tag.
1232 * @param pdoc [i/o] The pointer to the HDML structure at the output
1233 * destination is specified.
1234 * @param node [i] The TR tag node is specified.
1235 * @return The conversion result is returned.
1238 s_hdml_end_tr_tag(void* pdoc, Node* UNUSED(child))
1242 hdml = GET_HDML(pdoc);
1249 * It is a handler who processes the FONT tag.
1251 * @param pdoc [i/o] The pointer to the HDML structure at the output
1252 * destination is specified.
1253 * @param node [i] The FONT tag node is specified.
1254 * @return The conversion result is returned.
1257 s_hdml_start_font_tag(void* pdoc, Node* UNUSED(node))
1261 hdml = GET_HDML(pdoc);
1268 * It is a handler who processes the FONT tag.
1270 * @param pdoc [i/o] The pointer to the HDML structure at the output
1271 * destination is specified.
1272 * @param node [i] The FONT tag node is specified.
1273 * @return The conversion result is returned.
1276 s_hdml_end_font_tag(void* pdoc, Node* UNUSED(child))
1280 hdml = GET_HDML(pdoc);
1287 * It is a handler who processes the FORM tag.
1289 * @param pdoc [i/o] The pointer to the HDML structure at the output
1290 * destination is specified.
1291 * @param node [i] The FORM tag node is specified.
1292 * @return The conversion result is returned.
1295 s_hdml_start_form_tag(void* pdoc, Node* node)
1303 hdml = GET_HDML(pdoc);
1308 hdml->form_tmp = apr_psprintf(r->pool,
1309 "<NODISPLAY NAME=F%d>\r\n",
1310 hdml->pure_form_cnt);
1311 hdml->form_tmp = apr_pstrcat(r->pool,
1313 "<ACTION TYPE=ACCEPT TASK=GO METHOD=POST DEST=\"",
1315 /* Get Attributes */
1316 for (attr = qs_get_attr(doc,node);
1318 attr = qs_get_next_attr(doc,attr)) {
1323 name = qs_get_attr_name(doc,attr);
1324 value = qs_get_attr_value(doc,attr);
1326 if ((*name == 'a' || *name == 'A') && strcasecmp(name, "action") == 0) {
1327 value = chxj_encoding_parameter(hdml->doc->r, value);
1328 act = apr_psprintf(r->pool, "%s", value);
1334 hdml->form_tmp = apr_pstrcat(r->pool,
1339 hdml->form_tmp = apr_pstrcat(r->pool,
1343 hdml->form_tmp = apr_pstrcat(r->pool,
1348 hdml->hdml_br_flag = 0;
1355 * handler of the form end tag.
1357 * @param pdoc [i/o] The pointer to the HDML structure at the output
1358 * destination is specified.
1359 * @param child [i] unused.
1360 * @return The HDML output result after it edits it is returned.
1363 s_hdml_end_form_tag(void* pdoc, Node* UNUSED(child))
1368 hdml = GET_HDML(pdoc);
1371 s_output_to_postdata(hdml, "_chxj_dmy=");
1373 hdml->form_tmp = apr_pstrcat(r->pool,
1375 hdml->postdata[hdml->pure_form_cnt],
1378 hdml->form_tmp = apr_pstrcat(r->pool,
1380 "\" CLEAR=TRUE >\r\n",
1382 hdml->form_tmp = apr_pstrcat(r->pool,
1387 s_output_to_hdml_card(hdml, hdml->form_tmp);
1389 hdml->form_tmp = NULL;
1390 hdml->pure_form_cnt++;
1397 * It is a handler that takes charge of the processing of the input tag.
1399 * @param pdoc [i/o] The pointer to the HDML structure at the output
1400 * destination is specified.
1401 * @param node [i] The tag node to be processed is specified.
1404 s_hdml_start_input_tag(void* pdoc, Node* node)
1410 hdml = GET_HDML(pdoc);
1413 /*--------------------------------------------------------------------------*/
1414 /* The attribute of the input tag is acquired. */
1415 /*--------------------------------------------------------------------------*/
1416 for (attr = qs_get_attr(doc,node);
1418 attr = qs_get_next_attr(doc,attr)) {
1423 name = qs_get_attr_name(doc,attr);
1424 value = qs_get_attr_value(doc,attr);
1426 if (STRCASEEQ('t','T',"type",name)) {
1427 if (STRCASEEQ('t','T',"text",value)) {
1428 /*--------------------------------------------------------------------*/
1429 /* "input type ='text'" tag is processed. */
1430 /*--------------------------------------------------------------------*/
1431 s_hdml_do_input_text_tag(hdml, node);
1433 else if (STRCASEEQ('p','P',"password",value)) {
1434 /*--------------------------------------------------------------------*/
1435 /* "input type='password'" tag is processed. */
1436 /*--------------------------------------------------------------------*/
1437 s_hdml_do_input_password_tag(hdml, node);
1439 else if (STRCASEEQ('s','S',"submit",value)) {
1440 /*--------------------------------------------------------------------*/
1441 /* "input type='submit'" tag is processed. */
1442 /*--------------------------------------------------------------------*/
1443 s_hdml_do_input_submit_tag(hdml, node);
1445 else if (STRCASEEQ('h','H',"hidden",value)) {
1446 /*--------------------------------------------------------------------*/
1447 /* "input type='hidden'" tag is processed. */
1448 /*--------------------------------------------------------------------*/
1449 s_hdml_do_input_hidden_tag(hdml, node);
1451 else if (STRCASEEQ('r','R',"radio",value)) {
1452 /*--------------------------------------------------------------------*/
1453 /* "input type='radio'" tag is processed. */
1454 /*--------------------------------------------------------------------*/
1455 s_hdml_do_input_radio_tag(hdml, node);
1457 else if (STRCASEEQ('c','C',"checkbox",value)) {
1458 /*--------------------------------------------------------------------*/
1459 /* "input type='checkbox'" tag is processed. */
1460 /*--------------------------------------------------------------------*/
1461 s_hdml_do_input_checkbox_tag(hdml, node);
1463 else if (STRCASEEQ('r','R',"reset",value)) {
1464 /*--------------------------------------------------------------------*/
1465 /* "input type='reset'" tag is processed. */
1466 /*--------------------------------------------------------------------*/
1467 s_hdml_do_input_reset_tag(hdml, node);
1470 else if (STRCASEEQ('n','N',"name",name)) {
1473 else if (STRCASEEQ('v','V',"value",name)) {
1476 else if (STRCASEEQ('s','S',"size",name)) {
1479 else if (STRCASEEQ('m','M',"maxlength",name)) {
1482 else if (STRCASEEQ('c','C',"checked",name)) {
1485 else if (STRCASEEQ('a','A',"accesskey",name)) {
1488 else if (STRCASEEQ('i','I',"istyle",name)) {
1493 hdml->hdml_br_flag = 0;
1500 * The substitution processing of tag "input type = text" is done.
1502 * @param hdml [i/o] The pointer to the HDML structure at the output
1503 * destination is specified.
1504 * @param tag [i] The tag node of input type=text is specified.
1507 s_hdml_do_input_text_tag(hdml_t* hdml, Node* tag)
1521 s_hdml_tag_output_upper_half(hdml, tag);
1524 s_output_to_hdml_out(hdml,
1525 apr_psprintf(r->pool,
1526 "<A TASK=GOSUB LABEL=\x93\xfc\x97\xcd DEST=#D%d "
1527 "VARS=\"V=$%s%02d\" RECEIVE=%s%02d>",
1529 s_get_form_no(r, hdml),
1530 hdml->var_cnt[hdml->pure_form_cnt],
1531 s_get_form_no(r, hdml),
1532 hdml->var_cnt[hdml->pure_form_cnt]
1535 s_output_to_hdml_out(hdml,
1536 apr_psprintf(r->pool,
1537 "[$%s%02d]</A>\r\n" ,
1538 s_get_form_no(r, hdml),
1539 hdml->var_cnt[hdml->pure_form_cnt]));
1541 /*--------------------------------------------------------------------------*/
1542 /* ENTRY CARD is output here. */
1543 /*--------------------------------------------------------------------------*/
1544 s_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1545 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1546 s_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1552 nm = qs_get_name_attr(doc, tag, r);
1554 nm = qs_alloc_zero_byte_string(r);
1557 s_output_to_postdata(hdml,
1558 apr_psprintf(r->pool,
1561 s_get_form_no(r, hdml),
1562 hdml->var_cnt[hdml->pure_form_cnt]));
1564 mlen = qs_get_maxlength_attr (doc, tag, r);
1565 is = qs_get_istyle_attr (doc, tag, r);
1566 val = qs_get_value_attr (doc, tag, r);
1568 fmt = qs_conv_istyle_to_format(r, is);
1569 DBG(r,"qs_conv_istyle_to_format end");
1573 for (ii=0; ii<strlen(mlen); ii++) {
1574 if (mlen[ii] < '0' || mlen[ii] > '9') {
1575 mlen = apr_psprintf(r->pool, "0");
1579 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=%d%s", atoi(mlen), fmt));
1582 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1585 s_output_to_hdml_card(hdml,
1586 " MARKABLE=FALSE>\r\n"
1587 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\r\n"
1591 s_output_to_init_vars(hdml,
1592 apr_psprintf(r->pool,
1594 s_get_form_no(r, hdml),
1595 hdml->var_cnt[hdml->pure_form_cnt],
1596 chxj_escape_uri(r->pool,val)));
1598 s_output_to_init_vars(hdml,
1599 apr_psprintf(r->pool,
1601 s_get_form_no(r, hdml),
1602 hdml->var_cnt[hdml->pure_form_cnt]));
1604 hdml->var_cnt[hdml->pure_form_cnt]++;
1609 * The substitution processing of tag "input type = password" is done.
1611 * @param hdml [i/o] The pointer to the HDML structure at the output
1612 * destination is specified.
1613 * @param tag [i] The tag node of input type=password is specified.
1616 s_hdml_do_input_password_tag(hdml_t* hdml, Node* tag)
1629 s_hdml_tag_output_upper_half(hdml, tag);
1632 s_output_to_hdml_out(hdml, "<A TASK=GOSUB LABEL=\"\x93\xfc\x97\xcd\" DEST=");
1633 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "#D%d ", hdml->card_cnt));
1634 s_output_to_hdml_out(hdml,
1635 apr_psprintf(r->pool,
1636 "VARS=\"V=$%s%02d\" ",
1637 s_get_form_no(r, hdml),
1638 hdml->var_cnt[hdml->pure_form_cnt]));
1640 s_output_to_hdml_out(hdml,
1641 apr_psprintf(r->pool, "RECEIVE=%s%02d>" ,
1642 s_get_form_no(r, hdml),
1643 hdml->var_cnt[hdml->pure_form_cnt]));
1644 s_output_to_hdml_out(hdml,
1645 apr_psprintf(r->pool, "[$%s%02d]</A>\r\n" ,
1646 s_get_form_no(r, hdml),
1647 hdml->var_cnt[hdml->pure_form_cnt]));
1649 s_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1650 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1651 s_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1658 nm = qs_get_name_attr(doc, tag, r);
1660 nm = qs_alloc_zero_byte_string(r);
1662 s_output_to_postdata(hdml,
1663 apr_psprintf(r->pool,
1666 s_get_form_no(r, hdml),
1667 hdml->var_cnt[hdml->pure_form_cnt]));
1669 mlen = qs_get_maxlength_attr (doc, tag, r);
1670 val = qs_get_value_attr (doc, tag, r);
1671 /*--------------------------------------------------------------------------*/
1672 /* Default is a figure input. */
1673 /*--------------------------------------------------------------------------*/
1674 fmt = apr_psprintf(r->pool, "N");
1676 if (chxj_chk_numeric(mlen) != 0)
1677 mlen = apr_psprintf(r->pool, "0");
1678 s_output_to_hdml_card(hdml,
1679 apr_psprintf(r->pool, " FORMAT=%d%s", chxj_atoi(mlen), fmt));
1682 s_output_to_hdml_card(hdml,
1683 apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1685 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, " NOECHO=TRUE "));
1687 s_output_to_hdml_card(hdml,
1688 " MARKABLE=FALSE>\r\n"
1689 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\r\n"
1693 s_output_to_init_vars(hdml,
1694 apr_psprintf(r->pool, "%s%02d=%s",
1695 s_get_form_no(r, hdml),
1696 hdml->var_cnt[hdml->pure_form_cnt],
1697 chxj_escape_uri(r->pool,val)));
1699 s_output_to_init_vars(hdml,
1700 apr_psprintf(r->pool, "%s%02d=",
1701 s_get_form_no(r, hdml),
1702 hdml->var_cnt[hdml->pure_form_cnt]));
1704 hdml->var_cnt[hdml->pure_form_cnt]++;
1708 * The substitution processing of tag "input type = submit" is done.
1710 * @param hdml [i/o] The pointer to the HDML structure at the output
1711 * destination is specified.
1712 * @param tag [i] The tag node of input type=submit is specified.
1715 s_hdml_do_input_submit_tag(hdml_t* hdml, Node* tag)
1717 Doc* doc = hdml->doc;
1718 request_rec* r = doc->r;
1722 s_hdml_tag_output_upper_half(hdml, tag);
1724 s_output_to_hdml_out(hdml,
1725 apr_psprintf(r->pool,
1726 "<A TASK=GO LABEL=OK DEST=#F%d ",
1727 hdml->pure_form_cnt));
1729 /*--------------------------------------------------------------------------*/
1730 /* get name and value attribute */
1731 /*--------------------------------------------------------------------------*/
1732 nm = qs_get_name_attr (doc, tag, r);
1733 val = qs_get_value_attr (doc, tag, r);
1736 s_output_to_hdml_out(hdml,
1737 apr_psprintf(r->pool, "VARS=\"%s=%s\" ",
1739 chxj_escape_uri(r->pool,val)));
1740 if (strstr(hdml->postdata[hdml->pure_form_cnt], nm) == NULL) {
1741 s_output_to_postdata(hdml,
1742 apr_psprintf(r->pool,"%s%s=$%s",
1743 SUBMIT_BUTTON_PREFIX, nm, nm));
1746 s_output_to_hdml_out(hdml, ">" );
1748 s_output_to_hdml_out(hdml, val);
1750 s_output_to_hdml_out(hdml, "</A>\r\n" );
1755 * The substitution processing of tag "input type = reset" is done.
1757 * @param hdml [i/o] The pointer to the HDML structure at the output
1758 * destination is specified.
1759 * @param tag [i] The tag node of input type=submit is specified.
1762 s_hdml_do_input_reset_tag(hdml_t *hdml, Node *tag)
1764 Doc *doc = hdml->doc;
1765 request_rec *r = doc->r;
1769 s_hdml_tag_output_upper_half(hdml, tag);
1771 s_output_to_hdml_out(hdml,
1772 apr_psprintf(r->pool,
1773 "<A TASK=GO LABEL=OK DEST=#D0>"));
1775 /*--------------------------------------------------------------------------*/
1776 /* get name and value attribute */
1777 /*--------------------------------------------------------------------------*/
1778 nm = qs_get_name_attr (doc, tag, r);
1779 val = qs_get_value_attr (doc, tag, r);
1781 s_output_to_hdml_out(hdml, val);
1783 s_output_to_hdml_out(hdml, "</A>\r\n" );
1788 * The substitution processing of tag "input type = hidden" is done.
1790 * @param hdml [i/o] The pointer to the HDML structure at the output
1791 * destination is specified.
1792 * @param tag [i] The tag node of input type=hidden is specified.
1795 s_hdml_do_input_hidden_tag(hdml_t* hdml, Node* tag)
1797 Doc* doc = hdml->doc;
1798 request_rec* r = doc->r;
1802 /*--------------------------------------------------------------------------*/
1803 /* get name and value attribute */
1804 /*--------------------------------------------------------------------------*/
1805 nm = qs_get_name_attr (doc, tag, r);
1806 val = qs_get_value_attr (doc, tag, r);
1809 s_output_to_postdata(hdml,
1810 apr_psprintf(r->pool,
1813 chxj_escape_uri(r->pool, val)));
1818 * The substitution processing of tag "input type = radio" is done.
1820 * @param hdml [i/o] The pointer to the HDML structure at the output
1821 * destination is specified.
1822 * @param tag [i] The tag node of input type=radio is specified.
1825 s_hdml_do_input_radio_tag(hdml_t* hdml, Node* tag)
1827 Doc* doc = hdml->doc;
1828 request_rec* r = doc->r;
1836 s_hdml_tag_output_upper_half(hdml, tag);
1838 /*--------------------------------------------------------------------------*/
1839 /* get name and value attribute */
1840 /*--------------------------------------------------------------------------*/
1841 nm = qs_get_name_attr (doc, tag, r);
1842 val = qs_get_value_attr (doc, tag, r);
1844 /*--------------------------------------------------------------------------*/
1845 /* The same name is searched out from the list made beforehand. */
1846 /*--------------------------------------------------------------------------*/
1847 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
1848 if (! hdml->radio_name_list[ii]) {
1850 DBG(r, "Oops... radio list is null[%d]", ii);
1851 /*----------------------------------------------------------------------*/
1852 /* Processing is ended because it doesn't happen off the fly. */
1853 /*----------------------------------------------------------------------*/
1857 if (strcasecmp(hdml->radio_name_list[ii], nm) == 0)
1860 if (ii == MAX_RADIO_COUNT) {
1862 DBG(r,"Oops... The same name was not in the list. ");
1863 /*------------------------------------------------------------------------*/
1864 /* Processing is ended because it doesn't happen off the fly. */
1865 /*------------------------------------------------------------------------*/
1869 s_output_to_hdml_out(hdml,
1870 apr_psprintf(r->pool,
1872 "LABEL=\"\x93\xfc\x97\xcd\" "
1873 "DEST=#R%d VARS=\"VAL=%s\" "
1879 if (hdml->radio_out_cnt[ii] == 0) {
1880 s_output_to_hdml_card(hdml,
1881 apr_psprintf(r->pool,
1882 "<NODISPLAY NAME=R%d>\r\n",
1884 s_output_to_hdml_card(hdml,
1885 apr_psprintf(r->pool,
1887 "TYPE=ACCEPT TASK=RETURN RETVALS=\"$VAL;"));
1890 kk = hdml->radio_out_cnt[ii];
1891 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
1892 if (! hdml->radio_value_list[ii][jj])
1897 for (jj=0; jj<r_cnt; jj++) {
1898 if (! hdml->radio_value_list[ii][jj])
1902 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, ";"));
1903 if (hdml->radio_out_cnt[ii] == 0)
1904 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, ";"));
1907 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "%s_%02d", nm, kk));
1908 if (hdml->radio_out_cnt[ii] == 0) {
1910 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "X"));
1912 s_output_to_hdml_card(hdml, apr_psprintf(r->pool, "_"));
1919 s_output_to_hdml_out(hdml,
1920 apr_psprintf(r->pool, "\" >$%s_%02d</A>",
1922 hdml->radio_out_cnt[ii]));
1923 if (! hdml->radio_out_cnt[ii]) {
1924 s_output_to_hdml_card(hdml, "\">\r\n" );
1925 s_output_to_hdml_card(hdml, "</NODISPLAY>\r\n");
1927 s_output_to_postdata(hdml, apr_psprintf(r->pool, "%s%s=$%s", RADIO_BUTTON_PREFIX, nm, nm));
1929 for (jj=0; jj<r_cnt; jj++) {
1930 if (hdml->radio_value_list[ii][jj] && hdml->radio_checked_value[ii]) {
1931 if (strcasecmp(hdml->radio_value_list[ii][jj],
1932 hdml->radio_checked_value[ii]) == 0) {
1933 s_output_to_init_vars(hdml,
1934 apr_psprintf(r->pool,
1940 s_output_to_init_vars(hdml,
1941 apr_psprintf(r->pool,
1948 s_output_to_init_vars(hdml,
1949 apr_psprintf(r->pool,
1956 if (hdml->radio_checked_value[ii]) {
1957 DBG(r,"radio button is checked. checked value is [%s]",
1958 hdml->radio_checked_value[ii]);
1959 s_output_to_init_vars(hdml,
1960 apr_psprintf(r->pool,
1963 hdml->radio_checked_value[ii]));
1966 DBG(r,"radio button is not checked. checked value is []");
1967 s_output_to_init_vars(hdml,
1968 apr_psprintf(r->pool,
1973 hdml->radio_out_cnt[ii]++;
1977 * The substitution processing of tag "input type = checkbox" is done.
1979 * @param hdml [i/o] The pointer to the HDML structure at the output
1980 * destination is specified.
1981 * @param tag [i] The tag node of input type=checkbox is specified.
1984 s_hdml_do_input_checkbox_tag(hdml_t* hdml, Node* tag)
1986 Doc* doc = hdml->doc;
1987 request_rec* r = doc->r;
1992 /*--------------------------------------------------------------------------*/
1993 /* It is posted to the one without the checked attribute. */
1994 /* However, they were able to be removed with INPUT FILTER. */
1995 /*--------------------------------------------------------------------------*/
1996 if (! hdml->has_checkbox) {
1997 hdml->has_checkbox++;
1998 s_output_to_hdml_card(hdml,
1999 "<NODISPLAY NAME=\"_chk\">\r\n"
2000 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
2001 "RETVALS=\"_uchk;$V;X\" >\r\n"
2003 "<NODISPLAY NAME=\"_uchk\">\r\n"
2004 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
2005 "RETVALS=\"_chk;;_\" >\r\n"
2008 DBG(r, "wrote checkbox hdml card.");
2011 /*--------------------------------------------------------------------------*/
2012 /* It is examined whether it is CHECKED. */
2013 /*--------------------------------------------------------------------------*/
2014 chk = qs_is_checked_checkbox_attr(doc, tag, r);
2016 /*--------------------------------------------------------------------------*/
2017 /* The value of the name attribute and the value attribute is acquired */
2019 /*--------------------------------------------------------------------------*/
2020 val = qs_get_value_attr(doc, tag, r);
2021 nm = qs_get_name_attr(doc, tag, r);
2024 val = qs_alloc_zero_byte_string(r);
2027 nm = qs_alloc_zero_byte_string(r);
2029 s_output_to_hdml_out(hdml, apr_psprintf(r->pool,
2030 "<A TASK=GOSUB LABEL=\"a\xaf\xb8\" "
2031 "DEST=\"#$%s%02d\" "
2033 "RECEIVE=\"%s%02d;%s%02d;%s%02d\">"
2035 s_get_form_no(r, hdml),
2036 hdml->var_cnt[hdml->pure_form_cnt] + 0,
2038 s_get_form_no(r, hdml),
2039 hdml->var_cnt[hdml->pure_form_cnt] + 0,
2040 s_get_form_no(r, hdml),
2041 hdml->var_cnt[hdml->pure_form_cnt] + 1,
2042 s_get_form_no(r, hdml),
2043 hdml->var_cnt[hdml->pure_form_cnt] + 2,
2044 s_get_form_no(r, hdml),
2045 hdml->var_cnt[hdml->pure_form_cnt] + 2));
2047 s_output_to_init_vars(hdml,
2048 apr_psprintf(r->pool,
2049 "%s%02d=_uchk&%s%02d=%s&%s%02d=X",
2050 s_get_form_no(r, hdml),
2051 hdml->var_cnt[hdml->pure_form_cnt] + 0,
2052 s_get_form_no(r, hdml),
2053 hdml->var_cnt[hdml->pure_form_cnt] + 1,
2054 chxj_escape_uri(r->pool,val),
2055 s_get_form_no(r, hdml),
2056 hdml->var_cnt[hdml->pure_form_cnt] + 2
2060 s_output_to_init_vars(hdml,
2061 apr_psprintf(r->pool,
2062 "%s%02d=_chk&%s%02d=&%s%02d=_",
2063 s_get_form_no(r, hdml),
2064 hdml->var_cnt[hdml->pure_form_cnt] + 0,
2065 s_get_form_no(r, hdml),
2066 hdml->var_cnt[hdml->pure_form_cnt] + 1,
2067 s_get_form_no(r, hdml),
2068 hdml->var_cnt[hdml->pure_form_cnt] + 2
2072 s_output_to_postdata(hdml,
2073 apr_psprintf(r->pool, "%s%s=$%s%02d",
2076 s_get_form_no(r, hdml),
2077 hdml->var_cnt[hdml->pure_form_cnt] + 1));
2079 hdml->var_cnt[hdml->pure_form_cnt] += 3;
2083 * The ISTYLE attribute is converted into the HDML form.
2085 * @param r [i] To use POOL, the pointer to request_rec is specified.
2086 * @param is [i] The value of the ISTYLE attribute is specified.
2087 * @return The ISTYLE attribute converted into the HDML form is returned.
2090 qs_conv_istyle_to_format(request_rec* r, char* is)
2099 fmt = apr_psprintf(r->pool, "M");
2102 fmt = apr_psprintf(r->pool, "M");
2105 fmt = apr_psprintf(r->pool, "m");
2108 fmt = apr_psprintf(r->pool, "N");
2119 * It is a handler who processes the INPUT tag.
2121 * @param pdoc [i/o] The pointer to the HDML structure at the output
2122 * destination is specified.
2123 * @param node [i] The INPUT tag node is specified.
2124 * @return The conversion result is returned.
2127 s_hdml_end_input_tag(void* pdoc, Node* UNUSED(child))
2131 hdml = GET_HDML(pdoc);
2138 * It is a handler who processes the CENTER tag.
2140 * @param pdoc [i/o] The pointer to the HDML structure at the output
2141 * destination is specified.
2142 * @param node [i] The CENTER tag node is specified.
2143 * @return The conversion result is returned.
2146 s_hdml_start_center_tag(void* pdoc, Node* UNUSED(node))
2150 hdml = GET_HDML(pdoc);
2155 if (hdml->hdml_br_flag == 0)
2156 hdml = s_output_to_hdml_out(hdml, "<BR>\r\n");
2158 hdml = s_output_to_hdml_out(hdml, "<CENTER>");
2165 * It is a handler who processes the CENTER tag.
2167 * @param pdoc [i/o] The pointer to the HDML structure at the output
2168 * destination is specified.
2169 * @param node [i] The CENTER tag node is specified.
2170 * @return The conversion result is returned.
2173 s_hdml_end_center_tag(void* pdoc, Node* UNUSED(child))
2177 hdml = GET_HDML(pdoc);
2180 hdml->in_center = 0;
2182 hdml = s_output_to_hdml_out(hdml, "<BR>\r\n");
2183 hdml->hdml_br_flag = 1;
2190 * It is a handler who processes the HR tag.
2192 * @param pdoc [i/o] The pointer to the HDML structure at the output
2193 * destination is specified.
2194 * @param node [i] The HR tag node is specified.
2195 * @return The conversion result is returned.
2198 s_hdml_start_hr_tag(void* pdoc, Node* UNUSED(node))
2202 hdml = GET_HDML(pdoc);
2204 if (hdml->hdml_br_flag == 0) {
2205 s_output_to_hdml_out(hdml, "<BR>\r\n");
2206 if (hdml->in_center)
2209 if (hdml->div_in_center)
2210 hdml->div_in_center--;
2213 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>\r\n");
2215 hdml->hdml_br_flag = 1;
2222 * It is a handler who processes the HR tag.
2224 * @param pdoc [i/o] The pointer to the HDML structure at the output
2225 * destination is specified.
2226 * @param node [i] The HR tag node is specified.
2227 * @return The conversion result is returned.
2230 s_hdml_end_hr_tag(void* pdoc, Node* UNUSED(child))
2234 hdml = GET_HDML(pdoc);
2241 * It is a handler who processes the LI tag.
2243 * @param pdoc [i/o] The pointer to the HDML structure at the output
2244 * destination is specified.
2245 * @param node [i] The LI tag node is specified.
2246 * @return The conversion result is returned.
2249 s_hdml_start_li_tag(void *pdoc, Node *UNUSED(node))
2251 hdml_t *hdml = GET_HDML(pdoc);
2254 if (hdml->hdml_br_flag == 0) {
2255 s_output_to_hdml_out(hdml, "<BR>\r\n");
2256 if (hdml->in_center)
2259 if (hdml->div_in_center)
2260 hdml->div_in_center--;
2262 s_output_to_hdml_out(hdml, "<WRAP>");
2263 for (i=0; i<hdml->dir_level; i++) {
2264 s_output_to_hdml_out(hdml, " ");
2266 hdml->hdml_br_flag = 1;
2272 * It is a handler who processes the LI tag.
2274 * @param pdoc [i/o] The pointer to the HDML structure at the output
2275 * destination is specified.
2276 * @param node [i] The LI tag node is specified.
2277 * @return The conversion result is returned.
2280 s_hdml_end_li_tag(void *pdoc, Node *UNUSED(child))
2282 hdml_t *hdml = GET_HDML(pdoc);
2283 if (hdml->hdml_br_flag == 0) {
2284 s_output_to_hdml_out(hdml, "<BR>\r\n");
2285 if (hdml->in_center)
2288 if (hdml->div_in_center)
2289 hdml->div_in_center--;
2291 hdml->hdml_br_flag = 1;
2297 * It is a handler who processes the IMG tag.
2299 * @param pdoc [i/o] The pointer to the HDML structure at the output
2300 * destination is specified.
2301 * @param node [i] The IMG tag node is specified.
2302 * @return The conversion result is returned.
2305 s_hdml_start_img_tag(void *pdoc, Node *node)
2309 #ifndef IMG_NOT_CONVERT_FILENAME
2314 hdml = GET_HDML(pdoc);
2316 #ifndef IMG_NOT_CONVERT_FILENAME
2320 s_hdml_tag_output_upper_half(hdml, node);
2322 s_output_to_hdml_out(hdml, "<img");
2324 /* Get Attributes */
2325 for (attr = qs_get_attr(doc,node);
2327 attr = qs_get_next_attr(doc,attr)) {
2329 char *name = qs_get_attr_name(doc,attr);
2330 char *value = qs_get_attr_value(doc,attr);
2331 if (STRCASEEQ('s','S',"src",name) && value && *value) {
2332 value = chxj_encoding_parameter(hdml->doc->r, value);
2333 s_output_to_hdml_out(hdml, " src=\"");
2334 #ifdef IMG_NOT_CONVERT_FILENAME
2335 s_output_to_hdml_out(hdml, value );
2337 s_output_to_hdml_out(hdml, chxj_img_conv(doc->r, spec,value));
2339 s_output_to_hdml_out(hdml, "\"" );
2341 else if (STRCASEEQ('a','A',"align",name)) {
2342 if (value && (STRCASEEQ('t','T',"top", value) ||
2343 STRCASEEQ('m','M',"middle",value) ||
2344 STRCASEEQ('b','B',"bottom",value) ||
2345 STRCASEEQ('l','L',"left", value) ||
2346 STRCASEEQ('r','R',"right", value))) {
2347 s_output_to_hdml_out(hdml, " align=\"" );
2348 s_output_to_hdml_out(hdml, value );
2349 s_output_to_hdml_out(hdml, "\"" );
2352 else if (STRCASEEQ('w','W',"width",name) && value && *value) {
2353 s_output_to_hdml_out(hdml, " width=\"");
2354 s_output_to_hdml_out(hdml, value );
2355 s_output_to_hdml_out(hdml, "\"" );
2357 else if (STRCASEEQ('h','H',"height",name) && value && *value) {
2358 s_output_to_hdml_out(hdml, " height=\"");
2359 s_output_to_hdml_out(hdml, value );
2360 s_output_to_hdml_out(hdml, "\"" );
2362 else if (STRCASEEQ('h','H',"hspace", name) && value && *value) {
2363 s_output_to_hdml_out(hdml, " hspace=\"");
2364 s_output_to_hdml_out(hdml, value );
2365 s_output_to_hdml_out(hdml, "\"" );
2367 else if (STRCASEEQ('v','V',"vspace",name) && value && *value) {
2368 s_output_to_hdml_out(hdml, " vspace=\"");
2369 s_output_to_hdml_out(hdml, value );
2370 s_output_to_hdml_out(hdml, "\"" );
2372 else if (STRCASEEQ('a','A',"alt",name) && value && *value) {
2373 s_output_to_hdml_out(hdml, " alt=\"" );
2374 s_output_to_hdml_out(hdml, value );
2375 s_output_to_hdml_out(hdml, "\"" );
2378 s_output_to_hdml_out(hdml, ">" );
2380 hdml->hdml_br_flag = 0;
2387 * It is a handler who processes the IMG tag.
2389 * @param pdoc [i/o] The pointer to the HDML structure at the output
2390 * destination is specified.
2391 * @param node [i] The IMG tag node is specified.
2392 * @return The conversion result is returned.
2395 s_hdml_end_img_tag(void *pdoc, Node *UNUSED(child))
2397 hdml_t *hdml = GET_HDML(pdoc);
2403 * It is a handler who processes the SELECT tag.
2405 * @param pdoc [i/o] The pointer to the HDML structure at the output
2406 * destination is specified.
2407 * @param node [i] The SELECT tag node is specified.
2408 * @return The conversion result is returned.
2411 s_hdml_start_select_tag(void* pdoc, Node* node)
2418 hdml = GET_HDML(pdoc);
2422 s_hdml_tag_output_upper_half(hdml, node);
2426 s_output_to_hdml_out(hdml, apr_psprintf(r->pool,
2427 "<A TASK=GOSUB LABEL=\x91\x49\x91\xf0 "
2428 "VARS=\"V=$%s%02d\" DEST=#D%d "
2429 "RECEIVE=\"%s%02d;%s%02d\">"
2431 s_get_form_no(r, hdml),
2432 hdml->var_cnt[hdml->pure_form_cnt]+0,
2434 s_get_form_no(r, hdml),
2435 hdml->var_cnt[hdml->pure_form_cnt]+0,
2436 s_get_form_no(r, hdml),
2437 hdml->var_cnt[hdml->pure_form_cnt]+1,
2438 s_get_form_no(r, hdml),
2439 hdml->var_cnt[hdml->pure_form_cnt]+1));
2441 s_output_to_hdml_card(hdml,
2442 apr_psprintf(r->pool,
2443 "<CHOICE KEY=V NAME=D%d ", hdml->card_cnt));
2444 s_output_to_hdml_card(hdml,
2445 apr_psprintf(r->pool,
2446 "DEFAULT=$V METHOD=ALPHA MARKABLE=FALSE>\r\n"));
2447 /*--------------------------------------------------------------------------*/
2448 /* Get Attributes */
2449 /*--------------------------------------------------------------------------*/
2450 for (attr = qs_get_attr(doc,node);
2452 attr=qs_get_next_attr(doc,attr)) {
2454 char* name = qs_get_attr_name(doc,attr);
2455 char* value = qs_get_attr_value(doc,attr);
2456 char* selval = NULL;
2457 char* selvaltxt = NULL;
2459 if ((*name == 'n' || *name == 'N') && strcasecmp(name, "name") == 0) {
2461 s_output_to_postdata(hdml,
2462 apr_psprintf(r->pool, "%s=$%s%02d",
2464 s_get_form_no(r, hdml),
2465 hdml->var_cnt[hdml->pure_form_cnt]));
2466 selval = qs_get_selected_value(doc, node, r);
2468 DBG(r, "selected value not found");
2469 selval = qs_alloc_zero_byte_string(r);
2472 DBG(r, "selected value found[%s]" , selval);
2474 selvaltxt = qs_get_selected_value_text(doc, node, r);
2476 selvaltxt = qs_alloc_zero_byte_string(r);
2478 DBG(r, "selvaltxt:[%s]" ,selvaltxt);
2480 s_output_to_init_vars(hdml,
2481 apr_psprintf(r->pool,
2482 "%s%02d=%s&%s%02d=%s",
2483 s_get_form_no(r, hdml),
2484 hdml->var_cnt[hdml->pure_form_cnt] + 0,
2486 s_get_form_no(r, hdml),
2487 hdml->var_cnt[hdml->pure_form_cnt] + 1,
2490 hdml->var_cnt[hdml->pure_form_cnt] += 2;
2495 hdml->hdml_br_flag = 0;
2501 * It is a handler who processes the SELECT tag.
2503 * @param pdoc [i/o] The pointer to the HDML structure at the output
2504 * destination is specified.
2505 * @param node [i] The SELECT tag node is specified.
2506 * @return The conversion result is returned.
2509 s_hdml_end_select_tag(void* pdoc, Node* UNUSED(node))
2513 hdml = GET_HDML(pdoc);
2515 s_output_to_hdml_card(hdml, "</CHOICE>\r\n");
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_start_option_tag(void* pdoc, Node* node)
2539 hdml = GET_HDML(pdoc);
2545 hdml->option_flag = 1;
2546 val = qs_get_value_attr(doc, node, r);
2548 /*--------------------------------------------------------------------------*/
2549 /* The child node of the object tag node acquires the value in assumption */
2550 /* that is the TEXT node. */
2551 /*--------------------------------------------------------------------------*/
2552 child = qs_get_child_node(doc, node);
2554 txtval = apr_palloc(r->pool, 1);
2558 txtval = qs_get_node_value(doc, child);
2560 DBG(r, "txtval:[%s]" , txtval);
2562 if (val && txtval) {
2563 s_output_to_hdml_card(hdml,
2564 apr_psprintf(r->pool,
2565 "<CE TASK=RETURN VALUE=\"%s\" "
2566 "RETVALS=\"$V;%s\">%s</CE>\r\n",
2568 qs_trim_string(r->pool,txtval),
2569 qs_trim_string(r->pool,txtval)));
2572 hdml->hdml_br_flag = 0;
2579 * It is a handler who processes the OPTION tag.
2581 * @param pdoc [i/o] The pointer to the HDML structure at the output
2582 * destination is specified.
2583 * @param node [i] The OPTION tag node is specified.
2584 * @return The conversion result is returned.
2587 s_hdml_end_option_tag(void* pdoc, Node* UNUSED(node))
2591 hdml = GET_HDML(pdoc);
2593 hdml->option_flag = 0;
2600 * It is a handler who processes the DIV tag.
2602 * @param pdoc [i/o] The pointer to the HDML structure at the output
2603 * destination is specified.
2604 * @param node [i] The DIV tag node is specified.
2605 * @return The conversion result is returned.
2608 s_hdml_start_div_tag(void *pdoc, Node *node)
2614 hdml = GET_HDML(pdoc);
2617 /*--------------------------------------------------------------------------*/
2618 /* If the br tag is not output immediately before the div tag appears, the */
2619 /* br tag is output. */
2620 /*--------------------------------------------------------------------------*/
2621 if (hdml->hdml_br_flag == 0) {
2622 hdml->hdml_br_flag = 1;
2623 s_output_to_hdml_out(hdml, "<BR>\r\n");
2626 /*--------------------------------------------------------------------------*/
2627 /* The object tag node is scanned. */
2628 /*--------------------------------------------------------------------------*/
2629 for (attr = qs_get_attr(doc,node);
2631 attr = qs_get_next_attr(doc,attr)) {
2632 char *name = qs_get_attr_name(doc,attr);
2633 char *value = qs_get_attr_value(doc,attr);
2634 if (STRCASEEQ('a','A',"align",name)) {
2635 if (STRCASEEQ('r','R',"right",value)) {
2636 hdml->div_right_flag = 1;
2637 s_output_to_hdml_out(hdml, "<RIGHT>");
2638 hdml->hdml_br_flag = 0;
2641 else if (STRCASEEQ('c','C',"center",value)) {
2642 hdml->div_center_flag = 1;
2643 s_output_to_hdml_out(hdml, "<CENTER>");
2644 hdml->hdml_br_flag = 0;
2649 hdml->hdml_br_flag = 0;
2656 * It is a handler who processes the DIV tag.
2658 * @param pdoc [i/o] The pointer to the HDML structure at the output
2659 * destination is specified.
2660 * @param node [i] The DIV tag node is specified.
2661 * @return The conversion result is returned.
2664 s_hdml_end_div_tag(void *pdoc, Node *UNUSED(node))
2669 hdml = GET_HDML(pdoc);
2672 if (hdml->div_right_flag == 1) {
2673 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\r\n"));
2674 hdml->div_right_flag = 0;
2676 if (hdml->div_center_flag == 1) {
2677 s_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\r\n"));
2678 hdml->div_center_flag = 0;
2679 hdml->div_in_center = 0;
2687 * It is a wrapper of the apr_pstrcat function.
2689 * @param r [i] To use POOL, the pointer to request_rec is specified.
2690 * @param o [i] The character string of connected origin is specified.
2691 * @param s [i] The character string connected with 'o' parameter is
2693 * @param len [i/o] The pointer to the area where the character string
2694 * length is stored is specified.
2695 * @return The character string after it connects it is returned.
2698 qs_out_apr_pstrcat(request_rec *r, char *o, char *s, int *len)
2700 *len = (strlen(s) + *len);
2701 return apr_pstrcat(r->pool, o, s, NULL);
2705 * The prepositive character string used to generate the variable for HDML is
2708 * @param r [i] To use POOL, the pointer to request_rec is specified.
2709 * @param hdml [i] The pointer to the HDML structure that maintains the seed
2710 * to generate it is specified.
2711 * @return The character string after it generates it is returned.
2714 s_s_get_form_no(request_rec *r, hdml_t *hdml)
2720 fc = hdml->form_cnt;
2722 apr_time_exp_tz(&tm, hdml->form_cnt, 0);
2724 result = apr_psprintf(r->pool, "%c",(int)('A' + ((fc / 100) % 26)));
2725 result = apr_pstrcat(r->pool, result,
2726 apr_psprintf(r->pool, "%02d%02d%02d",
2734 * The number of tag nodes .."Input type =' radio '".. is counted.
2736 * @param hdml [i] The pointer to the HDML structure is specified.
2737 * @param node [i] The first parents node that counts the radio tag node is
2741 s_hdml_count_radio_tag(hdml_t* hdml, Node* node)
2750 /*--------------------------------------------------------------------------*/
2751 /* All the child nodes of the specified node are scanned. */
2752 /*--------------------------------------------------------------------------*/
2753 for (child = qs_get_child_node(doc,node);
2755 child = qs_get_next_node(doc,child)) {
2766 name = qs_get_node_name(doc,child);
2767 if (strcasecmp(name, "input") != 0) {
2768 s_hdml_count_radio_tag(hdml, child);
2772 DBG(r,"found input tag");
2774 type = qs_get_type_attr(doc, child, r);
2776 ERR(r, "Oops! The input tag without the type attribute has been found.Please give a type.");
2780 if (strcasecmp(type, "radio") != 0)
2783 DBG(r, "found type=radio");
2785 rname = qs_get_name_attr (doc, child, r);
2786 rvalue = qs_get_value_attr(doc, child, r);
2789 /*----------------------------------------------------------------------*/
2790 /* Oops!. The input tag without the name attribute has been found. */
2791 /*----------------------------------------------------------------------*/
2792 DBG(r, "Oops!. The input tag without the name attribute has been found. Please give a name.");
2796 DBG(r, "found name attribute");
2798 /*------------------------------------------------------------------------*/
2799 /* It scans in radio_name_list. When the same value exists, the */
2800 /* value is overwrited. */
2801 /* The value is written in a new area when not is. */
2802 /*------------------------------------------------------------------------*/
2803 for (ii=0; ii<MAX_RADIO_COUNT; ii++) {
2804 if (! hdml->radio_name_list[ii]) {
2805 DBG(r, "new name:[%s]", rname);
2808 if (strcasecmp(hdml->radio_name_list[ii], rname) == 0) {
2809 DBG(r, "already registered name:[%s]", rname);
2813 if (ii == MAX_RADIO_COUNT) {
2814 DBG(r, apr_psprintf(r->pool,
2815 "I do not understand the name of the radiobutton "
2816 "of %d piece or more. Please decrease "
2817 "the number of radiobuttons.",
2822 DBG(r,"add radio name:[%s]" ,rname);
2824 hdml->radio_name_list[ii] = apr_pstrdup(r->pool, rname);
2826 /*------------------------------------------------------------------------*/
2827 /* It adds it to radio_value_list. */
2828 /*------------------------------------------------------------------------*/
2829 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++) {
2830 if (!hdml->radio_value_list[ii][jj])
2833 if (jj == MAX_RADIO_VALUE_COUNT) {
2834 DBG(r, apr_psprintf(r->pool,
2835 "I do not understand the value of the radiobutton "
2836 "of %d piece or more. Please decrease "
2837 "the number of radiobuttons.",
2838 MAX_RADIO_VALUE_COUNT));
2841 hdml->radio_value_list[ii][jj] = apr_pstrdup(r->pool, rvalue);
2843 /*------------------------------------------------------------------------*/
2844 /* Now let's be the checked attribute or scan. */
2845 /*------------------------------------------------------------------------*/
2846 chkd = qs_get_checked_attr(hdml->doc, child, hdml->doc->r);
2848 DBG(r,apr_psprintf(r->pool,
2849 "The tag scanned now had the checked "
2850 "attribute. The value is [%s].",
2852 hdml->radio_checked_value[ii] = apr_pstrdup(r->pool, rvalue);
2859 * The character string is added, and output to the out member of the HDML
2862 * @param hdml [i/o] The pointer to the HDML structure that maintains the out
2863 * member at the output destination is specified.
2864 * @param s [i] The character string that should be output is specified.
2865 * @return The pointer to the HDML structure after it processes it is returned.
2868 s_output_to_hdml_out(hdml_t *hdml, char *s)
2870 hdml->out = qs_out_apr_pstrcat(hdml->doc->r, hdml->out, s, &hdml->out_len);
2877 * The character string is added, and output to the card member of the HDML
2880 * @param hdml [i/o] The pointer to the HDML structure that maintains the
2881 * card member at the output destination is specified.
2882 * @param s [i] The character string that should be output is specified.
2883 * @return The pointer to the HDML structure after it processes it is returned.
2886 s_output_to_hdml_card(hdml_t* hdml, char* s)
2888 hdml->card = qs_out_apr_pstrcat(hdml->doc->r, hdml->card, s, &hdml->card_len);
2896 * The data for the post is added, and output.
2898 * @param hdml [i/o] The pointer to the HDML structure at the output
2899 * destination is specified.
2900 * @param s [i] The character string that wants to output to postdata is
2904 s_output_to_postdata(hdml_t* hdml, char* s)
2910 if (strlen(hdml->postdata[hdml->pure_form_cnt]))
2911 hdml->postdata[hdml->pure_form_cnt] =
2912 apr_pstrcat(r->pool,
2913 hdml->postdata[hdml->pure_form_cnt],
2917 hdml->postdata[hdml->pure_form_cnt] =
2918 apr_pstrcat(r->pool,
2919 hdml->postdata[hdml->pure_form_cnt],
2920 qs_trim_string(r->pool, s),
2923 DBG(r, "POSTDATA:[%s]", hdml->postdata[hdml->pure_form_cnt] );
2929 * The tag output upper half.
2931 * @param hdml [i/o] The pointer to the HDML structure at the output
2932 * destination is specified.
2933 * @param node [i] The A tag node is specified.
2936 s_hdml_tag_output_upper_half(hdml_t* hdml, Node* UNUSED(node))
2938 if (hdml->hdml_br_flag == 1
2939 && hdml->div_right_flag == 1) {
2940 s_output_to_hdml_out(hdml, "<RIGHT>");
2941 hdml->hdml_br_flag = 0;
2944 if (hdml->hdml_br_flag == 1
2946 && hdml->in_center == 0) {
2947 s_output_to_hdml_out(hdml, "<CENTER>");
2949 hdml->hdml_br_flag = 0;
2952 if (hdml->hdml_br_flag == 1
2953 && hdml->div_center_flag > 0
2954 && hdml->div_in_center == 0) {
2955 s_output_to_hdml_out(hdml, "<CENTER>");
2956 hdml->div_in_center++;
2957 hdml->hdml_br_flag = 0;
2964 * The data for the init_vars is added, and output.
2966 * @param hdml [i/o] The pointer to the HDML structure at the output
2967 * destination is specified.
2968 * @param s [i] The character string that wants to output to postdata is
2972 s_output_to_init_vars(hdml_t* hdml, char* s)
2974 request_rec* r = hdml->doc->r;
2976 if (strlen(hdml->init_vars))
2977 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, "&", NULL);
2979 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, qs_trim_string(r->pool,s), NULL);
2981 DBG(r, "INIT_VARS:[%s]", hdml->init_vars);
2987 s_hdml_chxjif_tag(void* pdoc, Node* node)
2993 hdml = GET_HDML(pdoc);
2996 for (child = qs_get_child_node(doc, node);
2998 child = qs_get_next_node(doc, child)) {
2999 s_output_to_hdml_out(hdml, child->otext);
3000 s_hdml_chxjif_tag(hdml, child);
3006 s_hdml_text_tag(void* pdoc, Node* child)
3016 int one_line_count = 0;
3019 hdml = GET_HDML(pdoc);
3023 textval = qs_get_node_value(doc,child);
3024 if (strlen(textval) == 0) {
3028 if (hdml->option_flag == 1) {
3032 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
3033 memset(tmp, 0, qs_get_node_size(doc,child)+1);
3034 tdst = apr_palloc(r->pool, 1);
3040 for (ii=0; ii<qs_get_node_size(doc,child); ii++) {
3042 int rtn = s_hdml_search_emoji(hdml, &textval[ii], &out);
3044 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
3046 one_line_count+=(rtn-1);
3049 if (hdml->hdml_blockquote_flag) {
3050 if (one_line_count == 0) {
3051 tdst = qs_out_apr_pstrcat(r, tdst, "<WRAP> <TAB>", &tdst_len);
3053 if (is_sjis_kanji(textval[ii])) {
3054 one_byte[0] = textval[ii+0];
3055 one_byte[1] = textval[ii+1];
3057 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3062 one_byte[0] = textval[ii+0];
3064 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3066 if (one_byte[0] == '\n') {
3072 if (is_sjis_kanji(textval[ii])) {
3073 one_byte[0] = textval[ii+0];
3074 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3075 one_byte[0] = textval[ii+1];
3076 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3080 else if (textval[ii] != '\r' && textval[ii] != '\n') {
3081 one_byte[0] = textval[ii+0];
3082 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
3085 memcpy(tmp, textval, strlen(textval)-1);
3087 s_hdml_tag_output_upper_half(hdml, child->parent);
3088 s_output_to_hdml_out(hdml, tdst);
3089 hdml->hdml_br_flag = 0;
3096 * It is a handler who processes the BLOCKQUOTE tag.
3098 * @param pdoc [i/o] The pointer to the HDML structure at the output
3099 * destination is specified.
3100 * @param node [i] The BLOCKQUOTE tag node is specified.
3101 * @return The conversion result is returned.
3104 s_hdml_start_blockquote_tag(void *pdoc, Node *UNUSED(child))
3106 hdml_t *hdml = GET_HDML(pdoc);
3107 hdml->hdml_blockquote_flag++;
3113 * It is a handler who processes the BLOCKQUOTE tag.
3115 * @param pdoc [i/o] The pointer to the HDML structure at the output
3116 * destination is specified.
3117 * @param node [i] The BLOCKQUOTE tag node is specified.
3118 * @return The conversion result is returned.
3121 s_hdml_end_blockquote_tag(void *pdoc, Node *UNUSED(child))
3123 hdml_t *hdml = GET_HDML(pdoc);
3124 hdml->hdml_blockquote_flag--;
3125 s_output_to_hdml_out(hdml, "\r\n");
3131 * It is a handler who processes the DIR tag.
3133 * @param pdoc [i/o] The pointer to the HDML structure at the output
3134 * destination is specified.
3135 * @param node [i] The DIR tag node is specified.
3136 * @return The conversion result is returned.
3139 s_hdml_start_dir_tag(void *pdoc, Node *UNUSED(child))
3141 hdml_t *hdml = GET_HDML(pdoc);
3148 * It is a handler who processes the DIR tag.
3150 * @param pdoc [i/o] The pointer to the HDML structure at the output
3151 * destination is specified.
3152 * @param node [i] The DIR tag node is specified.
3153 * @return The conversion result is returned.
3156 s_hdml_end_dir_tag(void *pdoc, Node *UNUSED(child))
3158 hdml_t *hdml = GET_HDML(pdoc);
3165 * It is a handler who processes the DT tag.
3167 * @param pdoc [i/o] The pointer to the HDML structure at the output
3168 * destination is specified.
3169 * @param node [i] The DT tag node is specified.
3170 * @return The conversion result is returned.
3173 s_hdml_start_dt_tag(void *pdoc, Node *UNUSED(child))
3175 hdml_t *hdml = GET_HDML(pdoc);
3176 s_output_to_hdml_out(hdml, "<LINE>");
3182 * It is a handler who processes the DT tag.
3184 * @param pdoc [i/o] The pointer to the HDML structure at the output
3185 * destination is specified.
3186 * @param node [i] The DT tag node is specified.
3187 * @return The conversion result is returned.
3190 s_hdml_end_dt_tag(void *pdoc, Node *UNUSED(child))
3192 hdml_t *hdml = GET_HDML(pdoc);
3193 s_output_to_hdml_out(hdml, "\r\n");
3199 * It is a handler who processes the DD tag.
3201 * @param pdoc [i/o] The pointer to the HDML structure at the output
3202 * destination is specified.
3203 * @param node [i] The DD tag node is specified.
3204 * @return The conversion result is returned.
3207 s_hdml_start_dd_tag(void *pdoc, Node *UNUSED(child))
3209 hdml_t *hdml = GET_HDML(pdoc);
3210 s_output_to_hdml_out(hdml, "<WRAP> <TAB>");
3216 * It is a handler who processes the DD tag.
3218 * @param pdoc [i/o] The pointer to the HDML structure at the output
3219 * destination is specified.
3220 * @param node [i] The DD tag node is specified.
3221 * @return The conversion result is returned.
3224 s_hdml_end_dd_tag(void *pdoc, Node *UNUSED(child))
3226 hdml_t *hdml = GET_HDML(pdoc);
3227 s_output_to_hdml_out(hdml, "\r\n");