2 * Copyright (C) 2005 QSDN,Inc. All rights reserved.
3 * Copyright (C) 2005 Atsushi Konno 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"
24 #define CHECK_BOX_PREFIX "_chxj_c_"
25 #define RADIO_BUTTON_PREFIX "_chxj_r_"
26 #define SUBMIT_BUTTON_PREFIX "_chxj_s_"
28 static void chxj_init_hdml(Hdml* hdml, Doc* doc, request_rec* r, device_table* spec);
29 static char* hdml_1_0_node_exchange (Hdml* doc, Node* node, int indent);
30 static char* hdml_1_0_start_html_tag (Hdml* doc, Node* child) ;
31 static char* hdml_1_0_end_html_tag (Hdml* doc, Node* child) ;
32 static char* hdml_1_0_start_meta_tag (Hdml* doc, Node* node) ;
33 static char* hdml_1_0_end_meta_tag (Hdml* doc, Node* node) ;
34 static char* hdml_1_0_start_head_tag (Hdml* doc, Node* node) ;
35 static char* hdml_1_0_end_head_tag (Hdml* doc, Node* node) ;
36 static char* hdml_1_0_start_title_tag (Hdml* doc, Node* node) ;
37 static char* hdml_1_0_end_title_tag (Hdml* doc, Node* node) ;
38 static char* hdml_1_0_start_base_tag (Hdml* doc, Node* node) ;
39 static char* hdml_1_0_end_base_tag (Hdml* doc, Node* node) ;
40 static char* hdml_1_0_start_body_tag (Hdml* doc, Node* node) ;
41 static char* hdml_1_0_end_body_tag (Hdml* doc, Node* node) ;
42 static char* hdml_1_0_start_a_tag (Hdml* doc, Node* node) ;
43 static char* hdml_1_0_end_a_tag (Hdml* doc, Node* node) ;
44 static char* hdml_1_0_start_br_tag (Hdml* doc, Node* node) ;
45 static char* hdml_1_0_end_br_tag (Hdml* doc, Node* node) ;
46 static char* hdml_1_0_start_font_tag (Hdml* doc, Node* node) ;
47 static char* hdml_1_0_end_font_tag (Hdml* doc, Node* node) ;
48 static char* hdml_1_0_start_form_tag (Hdml* doc, Node* node) ;
49 static char* hdml_1_0_end_form_tag (Hdml* doc, Node* node) ;
50 static char* hdml_1_0_start_input_tag (Hdml* doc, Node* node) ;
51 static char* hdml_1_0_end_input_tag (Hdml* doc, Node* node) ;
52 static char* hdml_1_0_start_select_tag(Hdml* doc, Node* node) ;
53 static char* hdml_1_0_end_select_tag (Hdml* doc, Node* node) ;
54 static char* hdml_1_0_start_option_tag(Hdml* doc, Node* node) ;
55 static char* hdml_1_0_end_option_tag (Hdml* doc, Node* node) ;
56 static char* hdml_1_0_start_center_tag(Hdml* doc, Node* node) ;
57 static char* hdml_1_0_end_center_tag (Hdml* doc, Node* node) ;
58 static char* hdml_1_0_start_hr_tag (Hdml* doc, Node* node) ;
59 static char* hdml_1_0_end_hr_tag (Hdml* doc, Node* node) ;
60 static char* hdml_1_0_start_img_tag (Hdml* doc, Node* node) ;
61 static char* hdml_1_0_end_img_tag (Hdml* doc, Node* node) ;
62 static char* hdml_1_0_start_div_tag (Hdml* doc, Node* node) ;
63 static char* hdml_1_0_end_div_tag (Hdml* doc, Node* node) ;
64 static char* qs_get_form_no(request_rec* r, Hdml* hdml);
65 static void hdml_1_0_count_radio_tag (Hdml* hdml, Node* node) ;
66 static void hdml_do_input_text_tag (Hdml* hdml, Node* tag);
67 static void hdml_do_input_password_tag(Hdml* hdml, Node* tag);
68 static void hdml_do_input_submit_tag (Hdml* hdml, Node* tag);
69 static void hdml_do_input_hidden_tag (Hdml* hdml, Node* tag);
70 static void hdml_do_input_radio_tag (Hdml* hdml, Node* tag);
71 static void hdml_do_input_checkbox_tag(Hdml* hdml, Node* tag);
72 static void hdml_tag_output_upper_half(Hdml* hdml, Node* node);
73 static Hdml* qs_output_to_hdml_out (Hdml* hdml, char* s);
74 static Hdml* qs_output_to_hdml_card (Hdml* hdml, char* s);
75 static void qs_output_to_postdata (Hdml* hdml, char* s);
76 static void qs_output_to_init_vars (Hdml* hdml, char* s);
77 static int hdml_search_emoji (Hdml* hdml, char* txt, char** rslt);
78 static void hdml_1_0_chxjif_tag (Hdml* hdml, Node* node);
80 * converts from CHTML to hdml.
82 * @param r [i] Requet_rec is appointed.
83 * @param spec [i] The result of the device specification processing which
84 * was done in advance is appointed.
85 * @param src [i] The character string before the converting is appointed.
86 * @return The character string after the converting is returned.
89 chxj_exchange_hdml(request_rec* r,
100 /*--------------------------------------------------------------------------*/
101 /* initialize hdml structure */
102 /*--------------------------------------------------------------------------*/
103 chxj_init_hdml(&hdml,&doc,r, spec);
105 /*--------------------------------------------------------------------------*/
107 /*--------------------------------------------------------------------------*/
109 chxj_dump_out("[src] CHTML->HDML", src, srclen);
113 /*--------------------------------------------------------------------------*/
114 /* It is examined whether there is a location header. It ends without doing */
115 /* anything when is. */
116 /*--------------------------------------------------------------------------*/
117 buf = (char*)apr_table_get(r->headers_out, (const char*)"Location");
120 /*------------------------------------------------------------------------*/
121 /* The Location header generates tag in an initial HDML machine for the */
122 /* uncorrespon dence. */
123 /*------------------------------------------------------------------------*/
124 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
125 "Location is not null[Location:%s]", buf);
126 qs_output_to_hdml_out(&hdml,
127 "<HDML VERSION=3.0 MARKABLE=TRUE PUBLIC=TRUE>\n"
128 "<NODISPLAY MARKABLE=TRUE PUBLIC=TRUE TITLE=\" \">\n"
129 "<ACTION TYPE=ACCEPT TASK=GO DEST=\""
131 qs_output_to_hdml_out(&hdml, buf);
132 qs_output_to_hdml_out(&hdml,
137 dst = apr_pstrdup(r->pool, hdml.out);
141 /*------------------------------------------------------------------------*/
142 /* Here, the parsing of the received character string is done */
143 /*------------------------------------------------------------------------*/
144 char *ss = apr_pstrdup(r->pool, src);
145 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
146 "input srclen=[%d]\n", srclen);
147 qs_init_malloc(&doc);
148 qs_init_root_node(&doc);
150 qs_parse_string(&doc, ss, srclen);
152 /*------------------------------------------------------------------------*/
153 /* The number of radiobuttons is counted. */
154 /*------------------------------------------------------------------------*/
155 hdml_1_0_count_radio_tag(&hdml, qs_get_root(&doc));
157 dst = hdml_1_0_node_exchange(&hdml, qs_get_root(&doc), 0);
158 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "tmp=[%s]", dst);
159 qs_all_free(&doc,QX_LOGMARK);
162 /*--------------------------------------------------------------------------*/
164 /*--------------------------------------------------------------------------*/
166 chxj_dump_out("[dst] CHTML->HDML", hdml.out, hdml.out_len);
169 /*--------------------------------------------------------------------------*/
170 /* When there is no processing result, former character string is copied */
171 /* and it returns it. */
172 /*--------------------------------------------------------------------------*/
176 return apr_pstrdup(r->pool,src);
179 *dstlen = hdml.out_len;
181 /*--------------------------------------------------------------------------*/
182 /* Null is set at the end of the character string to make sure. */
183 /*--------------------------------------------------------------------------*/
184 dst[hdml.out_len] = 0;
189 * The HDML structure is initialized.
191 * @param hdml [i/o] The pointer to the HDML structure that wants to be
192 * initialized is specified.
193 * @param doc [i] The Doc structure that should be set to the initialized
194 * HDML structure is specified.
195 * @param r [i] To use POOL, the pointer to request_rec is specified.
196 * @param spec [i] The pointer to the device_table
199 chxj_init_hdml(Hdml* hdml, Doc* doc, request_rec* r, device_table* spec)
204 /*--------------------------------------------------------------------------*/
205 /* init hdml structure value */
206 /*--------------------------------------------------------------------------*/
207 memset(hdml, 0, sizeof(Hdml));
209 hdml->card = qs_alloc_zero_byte_string(r);
211 hdml->conf = ap_get_module_config(r->per_dir_config, &chxj_module);
212 hdml->doc->parse_mode = PARSE_MODE_CHTML;
214 for (ii=0; ii<MAX_FORM_COUNT; ii++)
216 hdml->var_cnt[ii] = 0;
217 hdml->postdata[ii] = qs_alloc_zero_byte_string(r);
220 for (ii=0; ii<MAX_RADIO_COUNT; ii++)
222 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
224 hdml->radio_value_list[ii][jj] = NULL;
226 hdml->radio_name_list[ii] = NULL;
227 hdml->radio_out_cnt[ii] = 0;
228 hdml->radio_checked_value[ii] = NULL;
231 for (ii=0; ii<MAX_SUBMIT_BUTTON_COUNT; ii++)
233 hdml->submit_button[ii] = NULL;
235 hdml->init_vars = qs_alloc_zero_byte_string(r);
239 hdml->form_cnt = apr_time_now();
240 hdml->out = qs_alloc_zero_byte_string(r);
244 * It is main processing converted from CHTML to HDML.
246 * @param hdml [i/o] The pointer to the HDML structure at the output
247 * destination is specified.
248 * @param node [i] The route node is specified.
249 * @param indent [i] Depth from the route node is specified. At present,
250 * other use doesn't exist.
251 * @return The conversion result is returned.
254 hdml_1_0_node_exchange(Hdml* hdml, Node* node, int indent)
257 Doc* doc = hdml->doc;
258 request_rec* r = doc->r;
260 for (child = qs_get_child_node(doc,node); child != NULL; child = qs_get_next_node(doc,child))
262 char* name = qs_get_node_name(doc,child);
264 /*----------------------------------------------------------------------*/
265 /* When </ HDML > tag has already been output, it doesn't process it. */
266 /*----------------------------------------------------------------------*/
267 if (hdml->hdml_end_flag == 1)
272 /*------------------------------------------------------------------------*/
274 /*------------------------------------------------------------------------*/
275 if (strcasecmp(name, "html") == 0)
277 hdml->out = hdml_1_0_start_html_tag(hdml, child);
278 hdml->hdml_br_flag = 0;
279 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
280 hdml->out = hdml_1_0_end_html_tag(hdml, child);
282 /*------------------------------------------------------------------------*/
284 /*------------------------------------------------------------------------*/
286 if (strcasecmp(name, "meta") == 0)
288 hdml->out = hdml_1_0_start_meta_tag(hdml, child);
289 hdml->hdml_br_flag = 0;
290 hdml->out = hdml_1_0_end_meta_tag(hdml, child);
292 /*------------------------------------------------------------------------*/
294 /*------------------------------------------------------------------------*/
296 if (strcasecmp(name, "head") == 0)
298 hdml->out = hdml_1_0_start_head_tag(hdml, child);
299 hdml->hdml_br_flag = 0;
300 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
301 hdml->out = hdml_1_0_end_head_tag(hdml, child);
303 /*------------------------------------------------------------------------*/
305 /*------------------------------------------------------------------------*/
307 if (strcasecmp(name, "title") == 0)
309 hdml->out = hdml_1_0_start_title_tag(hdml, child);
310 hdml->hdml_br_flag = 0;
311 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
312 hdml->out = hdml_1_0_end_title_tag(hdml, child);
314 /*------------------------------------------------------------------------*/
316 /*------------------------------------------------------------------------*/
318 if (strcasecmp(name, "base") == 0)
320 hdml->out = hdml_1_0_start_base_tag(hdml, child);
321 hdml->hdml_br_flag = 0;
322 hdml->out = hdml_1_0_end_base_tag(hdml, child);
324 /*------------------------------------------------------------------------*/
326 /*------------------------------------------------------------------------*/
328 if (strcasecmp(name, "body") == 0)
330 hdml->out = hdml_1_0_start_body_tag(hdml, child);
331 hdml->hdml_br_flag = 0;
332 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
333 hdml->out = hdml_1_0_end_body_tag(hdml, child);
335 /*------------------------------------------------------------------------*/
337 /*------------------------------------------------------------------------*/
339 if (strcasecmp(name, "a") == 0)
341 hdml->out = hdml_1_0_start_a_tag(hdml, child);
342 hdml->hdml_br_flag = 0;
343 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
344 hdml->out = hdml_1_0_end_a_tag(hdml, child);
346 /*------------------------------------------------------------------------*/
348 /*------------------------------------------------------------------------*/
350 if (strcasecmp(name, "br") == 0)
352 hdml->out = hdml_1_0_start_br_tag(hdml, child);
353 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
354 hdml->out = hdml_1_0_end_br_tag(hdml, child);
356 /*------------------------------------------------------------------------*/
358 /*------------------------------------------------------------------------*/
360 if (strcasecmp(name, "font") == 0)
362 hdml->out = hdml_1_0_start_font_tag(hdml, child);
363 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
364 hdml->out = hdml_1_0_end_font_tag(hdml, child);
366 /*------------------------------------------------------------------------*/
368 /*------------------------------------------------------------------------*/
370 if (strcasecmp(name, "form") == 0)
372 hdml->out = hdml_1_0_start_form_tag(hdml, child);
373 hdml->hdml_br_flag = 0;
374 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
375 hdml->out = hdml_1_0_end_form_tag(hdml, child);
377 /*------------------------------------------------------------------------*/
379 /*------------------------------------------------------------------------*/
381 if (strcasecmp(name, "input") == 0)
383 hdml->out = hdml_1_0_start_input_tag(hdml, child);
384 hdml->hdml_br_flag = 0;
385 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
386 hdml->out = hdml_1_0_end_input_tag(hdml, child);
388 /*------------------------------------------------------------------------*/
390 /*------------------------------------------------------------------------*/
392 if (strcasecmp(name, "select") == 0)
394 hdml->out = hdml_1_0_start_select_tag(hdml, child);
395 hdml->hdml_br_flag = 0;
396 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
397 hdml->out = hdml_1_0_end_select_tag(hdml, child);
399 /*------------------------------------------------------------------------*/
401 /*------------------------------------------------------------------------*/
403 if (strcasecmp(name, "option") == 0)
405 hdml->out = hdml_1_0_start_option_tag(hdml, child);
406 hdml->hdml_br_flag = 0;
407 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
408 hdml->out = hdml_1_0_end_option_tag(hdml, child);
410 /*------------------------------------------------------------------------*/
412 /*------------------------------------------------------------------------*/
414 if (strcasecmp(name, "div") == 0)
416 hdml->out = hdml_1_0_start_div_tag(hdml, child);
417 hdml->hdml_br_flag = 0;
418 hdml->out = hdml_1_0_node_exchange(hdml, child, indent+1);
419 hdml->out = hdml_1_0_end_div_tag(hdml, child);
421 /*------------------------------------------------------------------------*/
423 /*------------------------------------------------------------------------*/
425 if (strcasecmp(name, "hr") == 0)
427 hdml->out = hdml_1_0_start_hr_tag(hdml, child);
428 hdml->out = hdml_1_0_end_hr_tag(hdml, child);
430 /*------------------------------------------------------------------------*/
432 /*------------------------------------------------------------------------*/
434 if (strcasecmp(name, "center") == 0)
436 hdml->out = hdml_1_0_start_center_tag(hdml, child);
437 hdml->out = hdml_1_0_node_exchange(hdml, child,indent+1);
438 hdml->out = hdml_1_0_end_center_tag(hdml, child);
440 /*------------------------------------------------------------------------*/
442 /*------------------------------------------------------------------------*/
444 if (strcasecmp(name, "img") == 0)
446 hdml->out = hdml_1_0_start_img_tag(hdml, child);
447 hdml->hdml_br_flag = 0;
448 hdml->out = hdml_1_0_end_img_tag (hdml, child);
450 /*------------------------------------------------------------------------*/
452 /*------------------------------------------------------------------------*/
454 if (strcasecmp(name, "chxj:if") == 0)
456 ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag found");
457 if (chxj_chxjif_is_mine(hdml->spec, doc, child))
459 ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "chxj:if tag is mine");
460 hdml_1_0_chxjif_tag(hdml, child);
463 /*------------------------------------------------------------------------*/
465 /*------------------------------------------------------------------------*/
467 if (strcasecmp(name, "text") == 0)
476 textval = qs_get_node_value(doc,child);
477 textval = qs_trim_string(r, textval);
478 if (strlen(textval) == 0)
483 if (hdml->option_flag == 1)
488 tmp = apr_palloc(r->pool, qs_get_node_size(doc,child)+1);
489 memset(tmp, 0, qs_get_node_size(doc,child)+1);
490 tdst = apr_palloc(r->pool, 1);
495 for (ii=0; ii<qs_get_node_size(doc,child); ii++)
498 int rtn = hdml_search_emoji(hdml, &textval[ii], &out);
501 tdst = qs_out_apr_pstrcat(r, tdst, out, &tdst_len);
505 if (is_sjis_kanji(textval[ii]))
507 one_byte[0] = textval[ii+0];
508 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
509 one_byte[0] = textval[ii+1];
510 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
513 else if (textval[ii] != '\r' && textval[ii] != '\n')
515 one_byte[0] = textval[ii+0];
516 tdst = qs_out_apr_pstrcat(r, tdst, one_byte, &tdst_len);
519 memcpy(tmp, textval, strlen(textval)-1);
521 hdml_tag_output_upper_half(hdml, node);
522 qs_output_to_hdml_out(hdml, tdst);
523 hdml->hdml_br_flag = 0;
526 hdml->out[hdml->out_len] = 0;
531 hdml_search_emoji(Hdml* hdml, char* txt, char** rslt)
545 ap_log_rerror(APLOG_MARK, APLOG_DEBUG,0,r, "spec is NULL");
548 for (ee = hdml->conf->emoji;
552 unsigned char hex1byte;
553 unsigned char hex2byte;
554 if (ee->imode == NULL)
556 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
557 "emoji->imode is NULL");
560 hex1byte = ee->imode->hex1byte & 0xff;
561 hex2byte = ee->imode->hex2byte & 0xff;
563 if (ee->imode->string != NULL
564 && strlen(ee->imode->string) > 0
565 && strncasecmp(ee->imode->string, txt, strlen(ee->imode->string)) == 0)
567 if (spec == NULL || spec->emoji_type == NULL)
569 *rslt = apr_psprintf(r->pool,
572 return strlen(ee->imode->string);
575 if (strcasecmp(hdml->spec->emoji_type, "a") == 0)
577 *rslt = apr_psprintf(r->pool,
580 return strlen(ee->imode->string);
583 if (strcasecmp(hdml->spec->emoji_type, "b") == 0)
585 *rslt = apr_psprintf(r->pool,
588 return strlen(ee->imode->string);
591 if (strcasecmp(hdml->spec->emoji_type, "c") == 0)
593 *rslt = apr_psprintf(r->pool,
596 return strlen(ee->imode->string);
599 if (strcasecmp(hdml->spec->emoji_type, "d") == 0)
601 *rslt = apr_psprintf(r->pool,
604 return strlen(ee->imode->string);
608 *rslt = apr_psprintf(r->pool,
611 return strlen(ee->imode->string);
616 && ((unsigned char)txt[0] & 0xff) == ((unsigned char)hex1byte)
617 && ((unsigned char)txt[1] & 0xff) == ((unsigned char)hex2byte))
619 if (spec == NULL || spec->emoji_type == NULL)
621 *rslt = apr_psprintf(r->pool,
627 if (strcasecmp(hdml->spec->emoji_type, "a") == 0)
629 *rslt = apr_psprintf(r->pool,
635 if (strcasecmp(hdml->spec->emoji_type, "b") == 0)
637 *rslt = apr_psprintf(r->pool,
643 if (strcasecmp(hdml->spec->emoji_type, "c") == 0)
645 *rslt = apr_psprintf(r->pool,
651 if (strcasecmp(hdml->spec->emoji_type, "d") == 0)
653 *rslt = apr_psprintf(r->pool,
660 *rslt = apr_psprintf(r->pool,
671 * It is a handler who processes the HTML tag.
673 * @param hdml [i/o] The pointer to the HDML structure at the output
674 * destination is specified.
675 * @param node [i] The HTML tag node is specified.
676 * @return The conversion result is returned.
679 hdml_1_0_start_html_tag(Hdml* hdml, Node* node)
681 qs_output_to_hdml_out(hdml,
682 "<HDML VERSION=3.0 TTL=0 MARKABLE=TRUE>\n"
683 "<NODISPLAY NAME=D0>\n"
684 "<ACTION TYPE=ACCEPT TASK=GOSUB DEST=#D1 NEXT=#D2 CLEAR=TRUE>\n"
694 * It is a handler who processes the HTML tag.
696 * @param hdml [i/o] The pointer to the HDML structure at the output
697 * destination is specified.
698 * @param node [i] The HTML tag node is specified.
699 * @return The conversion result is returned.
702 hdml_1_0_end_html_tag(Hdml* hdml, Node* child)
704 qs_output_to_hdml_card(hdml,
705 "<NODISPLAY NAME=D1>\n"
706 "<ACTION TYPE=ACCEPT TASK=RETURN VARS=\""
709 if (strlen(hdml->init_vars) != 0)
711 qs_output_to_hdml_card(hdml, hdml->init_vars );
715 qs_output_to_hdml_card(hdml, "_chxj_dmy=" );
718 qs_output_to_hdml_card(hdml,
723 qs_output_to_hdml_out(hdml, hdml->card );
724 qs_output_to_hdml_out(hdml, "</HDML>\n");
726 hdml->hdml_end_flag = 1;
732 * It is a handler who processes the META tag.
734 * @param hdml [i/o] The pointer to the HDML structure at the output
735 * destination is specified.
736 * @param node [i] The META tag node is specified.
737 * @return The conversion result is returned.
740 hdml_1_0_start_meta_tag(Hdml* hdml, Node* node)
747 * It is a handler who processes the META tag.
749 * @param hdml [i/o] The pointer to the HDML structure at the output
750 * destination is specified.
751 * @param node [i] The META tag node is specified.
752 * @return The conversion result is returned.
755 hdml_1_0_end_meta_tag(Hdml* hdml, Node* child)
761 * It is a handler who processes the HEAD tag.
763 * @param hdml [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 hdml_1_0_start_head_tag(Hdml* hdml, Node* node)
776 * It is a handler who processes the HEAD tag.
778 * @param hdml [i/o] The pointer to the HDML structure at the output
779 * destination is specified.
780 * @param node [i] The HEAD tag node is specified.
781 * @return The conversion result is returned.
784 hdml_1_0_end_head_tag(Hdml* hdml, Node* child)
791 * It is a handler who processes the TITLE tag.
793 * @param hdml [i/o] The pointer to the HDML structure at the output
794 * destination is specified.
795 * @param node [i] The TITLE tag node is specified.
796 * @return The conversion result is returned.
799 hdml_1_0_start_title_tag(Hdml* hdml, Node* node)
801 qs_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"");
802 hdml->found_title = 1;
808 * It is a handler who processes the TITLE tag.
810 * @param hdml [i/o] The pointer to the HDML structure at the output
811 * destination is specified.
812 * @param node [i] The TITLE tag node is specified.
813 * @return The conversion result is returned.
816 hdml_1_0_end_title_tag(Hdml* hdml, Node* child)
818 qs_output_to_hdml_out(hdml, "\">\n");
824 * It is a handler who processes the BASE tag.
826 * @param hdml [i/o] The pointer to the HDML structure at the output
827 * destination is specified.
828 * @param node [i] The BASE tag node is specified.
829 * @return The conversion result is returned.
832 hdml_1_0_start_base_tag(Hdml* hdml, Node* node)
839 * It is a handler who processes the BASE tag.
841 * @param hdml [i/o] The pointer to the HDML structure at the output
842 * destination is specified.
843 * @param node [i] The BASE tag node is specified.
844 * @return The conversion result is returned.
847 hdml_1_0_end_base_tag(Hdml* hdml, Node* child)
853 * It is a handler who processes the BODY tag.
855 * @param hdml [i/o] The pointer to the HDML structure at the output
856 * destination is specified.
857 * @param node [i] The BODY tag node is specified.
858 * @return The conversion result is returned.
861 hdml_1_0_start_body_tag(Hdml* hdml, Node* node)
863 Doc* doc = hdml->doc;
866 if (hdml->found_title == 0)
868 qs_output_to_hdml_out(hdml, "<DISPLAY NAME=D2 TITLE=\"NO TITLE\">\n");
870 qs_output_to_hdml_out(hdml, "<ACTION TYPE=ACCEPT TASK=NOOP LABEL=\" \"");
872 /*--------------------------------*/
874 /*--------------------------------*/
875 for (attr = qs_get_attr(doc,node); attr != NULL; attr = qs_get_next_attr(doc,attr))
877 char* name = qs_get_attr_name(doc,attr);
878 if (strcasecmp(name, "bgcolor") == 0)
882 else if (strcasecmp(name, "text") == 0)
886 else if (strcasecmp(name, "link") == 0)
890 else if (strcasecmp(name, "alink") == 0)
894 else if (strcasecmp(name, "vlink") == 0)
900 qs_output_to_hdml_out(hdml, ">\n");
906 * It is a handler who processes the BODY tag.
908 * @param hdml [i/o] The pointer to the HDML structure at the output
909 * destination is specified.
910 * @param node [i] The BODY tag node is specified.
911 * @return The conversion result is returned.
914 hdml_1_0_end_body_tag(Hdml* hdml, Node* child)
916 qs_output_to_hdml_out(hdml, "\n</DISPLAY>\n");
922 * It is a handler who processes the A tag.
924 * @param hdml [i/o] The pointer to the HDML structure at the output
925 * destination is specified.
926 * @param node [i] The A tag node is specified.
927 * @return The conversion result is returned.
930 hdml_1_0_start_a_tag(Hdml* hdml, Node* node)
932 Doc* doc = hdml->doc;
935 hdml_tag_output_upper_half(hdml,node);
937 qs_output_to_hdml_out(hdml, "<A");
940 /*------------------------------------*/
942 /*------------------------------------*/
943 for (attr = qs_get_attr(doc,node);
945 attr = qs_get_next_attr(doc,attr))
947 char* name = qs_get_attr_name(doc,attr);
948 char* value = qs_get_attr_value(doc,attr);
949 if (strcasecmp(name, "name") == 0)
953 else if (strcasecmp(name, "href") == 0)
955 if (strncasecmp(value, "mailto:", 7) == 0)
957 qs_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
958 qs_output_to_hdml_out(hdml, value );
959 qs_output_to_hdml_out(hdml, "\" " );
962 if (strncasecmp(value, "tel:", 4) == 0)
965 qs_output_to_hdml_out(hdml, " TASK=CALL NUMBER=\"");
966 qs_output_to_hdml_out(hdml, &value[4] );
967 qs_output_to_hdml_out(hdml, "\" " );
971 qs_output_to_hdml_out(hdml, " TASK=GO DEST=\"" );
972 qs_output_to_hdml_out(hdml, value );
973 qs_output_to_hdml_out(hdml, "\"" );
977 if (strcasecmp(name, "accesskey") == 0)
979 if (strcasecmp(value, "0") != 0) {
980 qs_output_to_hdml_out(hdml, " ACCESSKEY=" );
981 qs_output_to_hdml_out(hdml, value );
982 qs_output_to_hdml_out(hdml, "" );
986 if (strcasecmp(name, "cti") == 0)
991 if (strcasecmp(name, "ijam") == 0)
996 if (strcasecmp(name, "utn") == 0)
1001 if (strcasecmp(name, "telbook") == 0)
1006 if (strcasecmp(name, "kana") == 0)
1011 if (strcasecmp(name, "email") == 0)
1016 if (strcasecmp(name, "ista") == 0)
1021 if (strcasecmp(name, "ilet") == 0)
1026 if (strcasecmp(name, "iswf") == 0)
1031 if (strcasecmp(name, "irst") == 0)
1036 qs_output_to_hdml_out(hdml, ">" );
1038 hdml->hdml_a_flag = 1;
1044 * It is a handler who processes the A tag.
1046 * @param hdml [i/o] The pointer to the HDML structure at the output
1047 * destination is specified.
1048 * @param node [i] The A tag node is specified.
1049 * @return The conversion result is returned.
1052 hdml_1_0_end_a_tag(Hdml* hdml, Node* child)
1054 qs_output_to_hdml_out(hdml, "</A>\n");
1056 hdml->hdml_a_flag = 0;
1062 * It is a handler who processes the BR tag.
1064 * @param hdml [i/o] The pointer to the HDML structure at the output
1065 * destination is specified.
1066 * @param node [i] The BR tag node is specified.
1067 * @return The conversion result is returned.
1070 hdml_1_0_start_br_tag(Hdml* hdml, Node* node)
1072 if (hdml->in_center > 0)
1074 hdml->in_center = 0;
1076 if (hdml->div_in_center > 0)
1078 hdml->div_in_center = 0;
1081 qs_output_to_hdml_out(hdml, "<BR>\n");
1083 hdml->hdml_br_flag = 1;
1089 * It is a handler who processes the BR tag.
1091 * @param hdml [i/o] The pointer to the HDML structure at the output
1092 * destination is specified.
1093 * @param node [i] The BR tag node is specified.
1094 * @return The conversion result is returned.
1097 hdml_1_0_end_br_tag(Hdml* hdml, Node* child)
1103 * It is a handler who processes the FONT tag.
1105 * @param hdml [i/o] The pointer to the HDML structure at the output
1106 * destination is specified.
1107 * @param node [i] The FONT tag node is specified.
1108 * @return The conversion result is returned.
1111 hdml_1_0_start_font_tag(Hdml* hdml, Node* node)
1117 * It is a handler who processes the FONT tag.
1119 * @param hdml [i/o] The pointer to the HDML structure at the output
1120 * destination is specified.
1121 * @param node [i] The FONT tag node is specified.
1122 * @return The conversion result is returned.
1125 hdml_1_0_end_font_tag(Hdml* hdml, Node* child)
1131 * It is a handler who processes the FORM tag.
1133 * @param hdml [i/o] The pointer to the HDML structure at the output
1134 * destination is specified.
1135 * @param node [i] The FORM tag node is specified.
1136 * @return The conversion result is returned.
1139 hdml_1_0_start_form_tag(Hdml* hdml, Node* node)
1141 request_rec* r = hdml->doc->r;
1143 Doc* doc = hdml->doc;
1146 hdml->form_tmp = apr_psprintf(r->pool,
1147 "<NODISPLAY NAME=F%d>\n",
1148 hdml->pure_form_cnt);
1149 hdml->form_tmp = apr_pstrcat(r->pool,
1151 "<ACTION TYPE=ACCEPT TASK=GO METHOD=POST DEST=\"",NULL);
1152 /* Get Attributes */
1153 for (attr = qs_get_attr(doc,node); attr != NULL; attr = qs_get_next_attr(doc,attr))
1155 char* name = qs_get_attr_name(doc,attr);
1156 char* value = qs_get_attr_value(doc,attr);
1157 if (strcasecmp(name, "action") == 0)
1159 act = apr_psprintf(r->pool, "%s", value);
1165 hdml->form_tmp = apr_pstrcat(r->pool,
1170 hdml->form_tmp = apr_pstrcat(r->pool,
1173 hdml->form_tmp = apr_pstrcat(r->pool,
1175 "POSTDATA=\"", NULL);
1181 * handler of the form end tag.
1183 * @param hdml [i/o] The pointer to the HDML structure at the output
1184 * destination is specified.
1185 * @param child [i] unused.
1186 * @return The HDML output result after it edits it is returned.
1189 hdml_1_0_end_form_tag(Hdml* hdml, Node* child)
1191 request_rec* r = hdml->doc->r;
1193 qs_output_to_postdata(hdml, "_chxj_dmy=");
1195 hdml->form_tmp = apr_pstrcat(r->pool,
1197 hdml->postdata[hdml->pure_form_cnt],
1200 hdml->form_tmp = apr_pstrcat(r->pool,
1202 "\" CLEAR=TRUE >\n",
1204 hdml->form_tmp = apr_pstrcat(r->pool,
1209 qs_output_to_hdml_card(hdml, hdml->form_tmp);
1211 hdml->form_tmp = NULL;
1212 hdml->pure_form_cnt++;
1218 * It is a handler that takes charge of the processing of the input tag.
1220 * @param hdml [i/o] The pointer to the HDML structure at the output
1221 * destination is specified.
1222 * @param node [i] The tag node to be processed is specified.
1225 hdml_1_0_start_input_tag(Hdml* hdml, Node* node)
1227 Doc* doc = hdml->doc;
1230 /*--------------------------------------------------------------------------*/
1231 /* The attribute of the input tag is acquired. */
1232 /*--------------------------------------------------------------------------*/
1233 for (attr = qs_get_attr(doc,node); attr != NULL; attr = qs_get_next_attr(doc,attr))
1235 char* name = qs_get_attr_name(doc,attr);
1236 char* value = qs_get_attr_value(doc,attr);
1237 if (strcasecmp(name, "type") == 0)
1239 if (strcasecmp(value, "text") == 0)
1241 /*--------------------------------------------------------------------*/
1242 /* "input type ='text'" tag is processed. */
1243 /*--------------------------------------------------------------------*/
1244 hdml_do_input_text_tag(hdml, node);
1246 if (strcasecmp(value, "password") == 0)
1248 /*--------------------------------------------------------------------*/
1249 /* "input type='password'" tag is processed. */
1250 /*--------------------------------------------------------------------*/
1251 hdml_do_input_password_tag(hdml, node);
1254 if (strcasecmp(value, "submit") == 0)
1256 /*--------------------------------------------------------------------*/
1257 /* "input type='submit'" tag is processed. */
1258 /*--------------------------------------------------------------------*/
1259 hdml_do_input_submit_tag(hdml, node);
1262 if (strcasecmp(value, "hidden") == 0)
1264 /*--------------------------------------------------------------------*/
1265 /* "input type='hidden'" tag is processed. */
1266 /*--------------------------------------------------------------------*/
1267 hdml_do_input_hidden_tag(hdml, node);
1270 if (strcasecmp(value, "radio") == 0)
1272 /*--------------------------------------------------------------------*/
1273 /* "input type='radio'" tag is processed. */
1274 /*--------------------------------------------------------------------*/
1275 hdml_do_input_radio_tag(hdml, node);
1278 if (strcasecmp(value, "checkbox") == 0)
1280 /*--------------------------------------------------------------------*/
1281 /* "input type='checkbox'" tag is processed. */
1282 /*--------------------------------------------------------------------*/
1283 hdml_do_input_checkbox_tag(hdml, node);
1287 if (strcasecmp(name, "name") == 0)
1292 if (strcasecmp(name, "value") == 0)
1297 if (strcasecmp(name, "size") == 0)
1302 if (strcasecmp(name, "maxlength") == 0)
1307 if (strcasecmp(name, "checked") == 0)
1312 if (strcasecmp(name, "accesskey") == 0)
1317 if (strcasecmp(name, "istyle") == 0)
1326 * The substitution processing of tag "input type = text" is done.
1328 * @param hdml [i/o] The pointer to the HDML structure at the output
1329 * destination is specified.
1330 * @param tag [i] The tag node of input type=text is specified.
1333 hdml_do_input_text_tag(Hdml* hdml, Node* tag)
1335 Doc* doc = hdml->doc;
1336 request_rec* r = doc->r;
1343 hdml_tag_output_upper_half(hdml, tag);
1346 qs_output_to_hdml_out(hdml,
1347 apr_psprintf(r->pool,
1348 "<A TASK=GOSUB LABEL=
\93ü
\97Í DEST=#D%d "
1349 "VARS=\"V=$%s%02d\" RECEIVE=%s%02d>",
1351 qs_get_form_no(r, hdml),
1352 hdml->var_cnt[hdml->pure_form_cnt],
1353 qs_get_form_no(r, hdml),
1354 hdml->var_cnt[hdml->pure_form_cnt]
1357 qs_output_to_hdml_out(hdml,
1358 apr_psprintf(r->pool, "[$%s%02d]</A>\n" ,
1359 qs_get_form_no(r, hdml),
1360 hdml->var_cnt[hdml->pure_form_cnt]));
1362 /*--------------------------------------------------------------------------*/
1363 /* ENTRY CARD is output here. */
1364 /*--------------------------------------------------------------------------*/
1365 qs_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1366 qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1367 qs_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1373 nm = qs_get_name_attr(doc, tag, r);
1376 nm = qs_alloc_zero_byte_string(r);
1379 qs_output_to_postdata(hdml,
1380 apr_psprintf(r->pool,
1383 qs_get_form_no(r, hdml),
1384 hdml->var_cnt[hdml->pure_form_cnt]));
1386 mlen = qs_get_maxlength_attr (doc, tag, r);
1387 is = qs_get_istyle_attr (doc, tag, r);
1388 val = qs_get_value_attr (doc, tag, r);
1390 fmt = qs_conv_istyle_to_format(r, is);
1391 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "qs_conv_istyle_to_format end");
1397 for (ii=0; ii<strlen(mlen); ii++)
1399 if (mlen[ii] < '0' || mlen[ii] > '9')
1401 mlen = apr_psprintf(r->pool, "0");
1405 qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=%d%s", atoi(mlen), fmt));
1409 qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1413 qs_output_to_hdml_card(hdml,
1414 " MARKABLE=FALSE>\n"
1415 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
1420 qs_output_to_init_vars(hdml,
1421 apr_psprintf(r->pool, "%s%02d=%s",
1422 qs_get_form_no(r, hdml),
1423 hdml->var_cnt[hdml->pure_form_cnt],
1424 ap_escape_uri(r->pool,val)));
1428 qs_output_to_init_vars(hdml,
1429 apr_psprintf(r->pool, "%s%02d=",
1430 qs_get_form_no(r, hdml),
1431 hdml->var_cnt[hdml->pure_form_cnt]));
1433 hdml->var_cnt[hdml->pure_form_cnt]++;
1437 * The substitution processing of tag "input type = password" is done.
1439 * @param hdml [i/o] The pointer to the HDML structure at the output
1440 * destination is specified.
1441 * @param tag [i] The tag node of input type=password is specified.
1444 hdml_do_input_password_tag(Hdml* hdml, Node* tag)
1446 Doc* doc = hdml->doc;
1447 request_rec* r = doc->r;
1453 hdml_tag_output_upper_half(hdml, tag);
1456 qs_output_to_hdml_out(hdml, "<A TASK=GOSUB LABEL=
\93ü
\97Í DEST=" );
1457 qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, "#D%d ", hdml->card_cnt));
1458 qs_output_to_hdml_out(hdml,
1459 apr_psprintf(r->pool, "VARS=\"V=$%s%02d\" ",
1460 qs_get_form_no(r, hdml),
1461 hdml->var_cnt[hdml->pure_form_cnt]));
1463 qs_output_to_hdml_out(hdml,
1464 apr_psprintf(r->pool, "RECEIVE=%s%02d>" ,
1465 qs_get_form_no(r, hdml),
1466 hdml->var_cnt[hdml->pure_form_cnt]));
1467 qs_output_to_hdml_out(hdml, "[****]</A>\n" );
1469 qs_output_to_hdml_card(hdml, "<ENTRY NAME=" );
1470 qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, "D%d ", hdml->card_cnt));
1471 qs_output_to_hdml_card(hdml, " KEY=V DEFAULT=$V " );
1478 nm = qs_get_name_attr(doc, tag, r);
1481 nm = qs_alloc_zero_byte_string(r);
1483 qs_output_to_postdata(hdml,
1484 apr_psprintf(r->pool,
1487 qs_get_form_no(r, hdml),
1488 hdml->var_cnt[hdml->pure_form_cnt]));
1490 mlen = qs_get_maxlength_attr (doc, tag, r);
1491 val = qs_get_value_attr (doc, tag, r);
1492 /*--------------------------------------------------------------------------*/
1493 /* Default is a figure input. */
1494 /*--------------------------------------------------------------------------*/
1495 fmt = apr_psprintf(r->pool, "N");
1498 if (chxj_chk_numeric(mlen) != 0)
1500 mlen = apr_psprintf(r->pool, "0");
1502 qs_output_to_hdml_card(hdml,
1503 apr_psprintf(r->pool, " FORMAT=%d%s", chxj_atoi(mlen), fmt));
1507 qs_output_to_hdml_card(hdml,
1508 apr_psprintf(r->pool, " FORMAT=*%s", fmt) );
1510 qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, " NOECHO=TRUE "));
1512 qs_output_to_hdml_card(hdml,
1513 " MARKABLE=FALSE>\n"
1514 "<ACTION TYPE=ACCEPT TASK=RETURN RETVALS=$V>\n"
1519 qs_output_to_init_vars(hdml,
1520 apr_psprintf(r->pool, "%s%02d=%s",
1521 qs_get_form_no(r, hdml),
1522 hdml->var_cnt[hdml->pure_form_cnt],
1523 ap_escape_uri(r->pool,val)));
1527 qs_output_to_init_vars(hdml,
1528 apr_psprintf(r->pool, "%s%02d=",
1529 qs_get_form_no(r, hdml),
1530 hdml->var_cnt[hdml->pure_form_cnt]));
1532 hdml->var_cnt[hdml->pure_form_cnt]++;
1536 * The substitution processing of tag "input type = submit" is done.
1538 * @param hdml [i/o] The pointer to the HDML structure at the output
1539 * destination is specified.
1540 * @param tag [i] The tag node of input type=submit is specified.
1543 hdml_do_input_submit_tag(Hdml* hdml, Node* tag)
1545 Doc* doc = hdml->doc;
1546 request_rec* r = doc->r;
1549 hdml_tag_output_upper_half(hdml, tag);
1551 qs_output_to_hdml_out(hdml,
1552 apr_psprintf(r->pool,
1553 "<A TASK=GO LABEL=OK DEST=#F%d ",
1554 hdml->pure_form_cnt));
1556 /*--------------------------------------------------------------------------*/
1557 /* get name and value attribute */
1558 /*--------------------------------------------------------------------------*/
1559 nm = qs_get_name_attr (doc, tag, r);
1560 val = qs_get_value_attr (doc, tag, r);
1562 if (nm != NULL && val != NULL)
1564 qs_output_to_hdml_out(hdml,
1565 apr_psprintf(r->pool, "VARS=\"%s=%s\" ",
1567 ap_escape_uri(r->pool,val)));
1568 if (strstr(hdml->postdata[hdml->pure_form_cnt], nm) == NULL)
1570 qs_output_to_postdata(hdml,
1571 apr_psprintf(r->pool,"%s%s=$%s",
1572 SUBMIT_BUTTON_PREFIX, nm, nm));
1575 qs_output_to_hdml_out(hdml, ">" );
1576 qs_output_to_hdml_out(hdml, val);
1577 qs_output_to_hdml_out(hdml, "</A>\n" );
1581 * The substitution processing of tag "input type = hidden" is done.
1583 * @param hdml [i/o] The pointer to the HDML structure at the output
1584 * destination is specified.
1585 * @param tag [i] The tag node of input type=hidden is specified.
1588 hdml_do_input_hidden_tag(Hdml* hdml, Node* tag)
1590 Doc* doc = hdml->doc;
1591 request_rec* r = doc->r;
1595 /*--------------------------------------------------------------------------*/
1596 /* get name and value attribute */
1597 /*--------------------------------------------------------------------------*/
1598 nm = qs_get_name_attr (doc, tag, r);
1599 val = qs_get_value_attr (doc, tag, r);
1601 if (nm != NULL && val != NULL)
1603 qs_output_to_postdata(hdml,
1604 apr_psprintf(r->pool,
1607 ap_escape_uri(r->pool, val)));
1612 * The substitution processing of tag "input type = radio" is done.
1614 * @param hdml [i/o] The pointer to the HDML structure at the output
1615 * destination is specified.
1616 * @param tag [i] The tag node of input type=radio is specified.
1619 hdml_do_input_radio_tag(Hdml* hdml, Node* tag)
1621 Doc* doc = hdml->doc;
1622 request_rec* r = doc->r;
1629 hdml_tag_output_upper_half(hdml, tag);
1631 /*--------------------------------------------------------------------------*/
1632 /* get name and value attribute */
1633 /*--------------------------------------------------------------------------*/
1634 nm = qs_get_name_attr (doc, tag, r);
1635 val = qs_get_value_attr (doc, tag, r);
1637 /*--------------------------------------------------------------------------*/
1638 /* The same name is searched out from the list made beforehand. */
1639 /*--------------------------------------------------------------------------*/
1640 for (ii=0; ii<MAX_RADIO_COUNT; ii++)
1642 if (hdml->radio_name_list[ii] == NULL)
1645 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
1646 "%s:%d Oops... radio list is null",
1648 /*----------------------------------------------------------------------*/
1649 /* Processing is ended because it doesn't happen off the fly. */
1650 /*----------------------------------------------------------------------*/
1654 if (strcasecmp(hdml->radio_name_list[ii], nm) == 0)
1659 if (ii == MAX_RADIO_COUNT)
1662 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
1663 "%s:%d Oops... The same name was not in the list. ",
1665 /*------------------------------------------------------------------------*/
1666 /* Processing is ended because it doesn't happen off the fly. */
1667 /*------------------------------------------------------------------------*/
1671 qs_output_to_hdml_out(hdml,
1672 apr_psprintf(r->pool,
1674 "LABEL=\"
\93ü
\97Í\" "
1675 "DEST=#R%d VARS=\"VAL=%s\" "
1681 if (hdml->radio_out_cnt[ii] == 0)
1683 qs_output_to_hdml_card(hdml,
1684 apr_psprintf(r->pool,
1685 "<NODISPLAY NAME=R%d>\n",
1687 qs_output_to_hdml_card(hdml,
1688 apr_psprintf(r->pool,
1690 "TYPE=ACCEPT TASK=RETURN RETVALS=\"$VAL;"));
1693 kk = hdml->radio_out_cnt[ii];
1694 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
1696 if (hdml->radio_value_list[ii][jj] == NULL)
1703 for (jj=0; jj<r_cnt; jj++)
1705 if (hdml->radio_value_list[ii][jj] == NULL)
1711 qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, ";"));
1712 if (hdml->radio_out_cnt[ii] == 0)
1714 qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, ";"));
1718 qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, "%s_%02d", nm, kk));
1719 if (hdml->radio_out_cnt[ii] == 0)
1723 qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, "X"));
1727 qs_output_to_hdml_card(hdml, apr_psprintf(r->pool, "_"));
1736 qs_output_to_hdml_out(hdml,
1737 apr_psprintf(r->pool, "\" >$%s_%02d</A>",
1739 hdml->radio_out_cnt[ii]));
1740 if (hdml->radio_out_cnt[ii] == 0)
1742 qs_output_to_hdml_card(hdml, "\">\n" );
1743 qs_output_to_hdml_card(hdml, "</NODISPLAY>\n");
1745 qs_output_to_postdata(hdml, apr_psprintf(r->pool, "%s%s=$%s", RADIO_BUTTON_PREFIX, nm, nm));
1747 for (jj=0; jj<r_cnt; jj++)
1749 if (hdml->radio_value_list[ii][jj] != NULL
1750 && hdml->radio_checked_value[ii] != NULL)
1752 if (strcasecmp(hdml->radio_value_list[ii][jj],
1753 hdml->radio_checked_value[ii]) == 0)
1755 qs_output_to_init_vars(hdml,
1756 apr_psprintf(r->pool,
1763 qs_output_to_init_vars(hdml,
1764 apr_psprintf(r->pool,
1772 qs_output_to_init_vars(hdml,
1773 apr_psprintf(r->pool,
1780 if (hdml->radio_checked_value[ii] != NULL)
1782 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
1783 "radio button is checked. checked value is [%s]",
1784 hdml->radio_checked_value[ii]);
1785 qs_output_to_init_vars(hdml,
1786 apr_psprintf(r->pool,
1789 hdml->radio_checked_value[ii]));
1793 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
1794 "radio button is not checked. checked value is []");
1795 qs_output_to_init_vars(hdml,
1796 apr_psprintf(r->pool,
1801 hdml->radio_out_cnt[ii]++;
1805 * The substitution processing of tag "input type = checkbox" is done.
1807 * @param hdml [i/o] The pointer to the HDML structure at the output
1808 * destination is specified.
1809 * @param tag [i] The tag node of input type=checkbox is specified.
1812 hdml_do_input_checkbox_tag(Hdml* hdml, Node* tag)
1814 Doc* doc = hdml->doc;
1815 request_rec* r = doc->r;
1820 /*--------------------------------------------------------------------------*/
1821 /* It is posted to the one without the checked attribute. */
1822 /* However, they were able to be removed with INPUT FILTER. */
1823 /*--------------------------------------------------------------------------*/
1824 if (hdml->has_checkbox == 0)
1826 hdml->has_checkbox++;
1827 qs_output_to_hdml_card(hdml,
1828 "<NODISPLAY NAME=\"_chk\">\n"
1829 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
1830 "RETVALS=\"_uchk;$V;X\" >\n"
1832 "<NODISPLAY NAME=\"_uchk\">\n"
1833 "<ACTION TYPE=\"ACCEPT\" TASK=\"RETURN\" "
1834 "RETVALS=\"_chk;;_\" >\n"
1839 /*--------------------------------------------------------------------------*/
1840 /* It is examined whether it is CHECKED. */
1841 /*--------------------------------------------------------------------------*/
1842 chk = qs_is_checked_checkbox_attr(doc, tag, r);
1844 /*--------------------------------------------------------------------------*/
1845 /* The value of the name attribute and the value attribute is acquired */
1847 /*--------------------------------------------------------------------------*/
1848 val = qs_get_value_attr(doc, tag, r);
1849 nm = qs_get_name_attr(doc, tag, r);
1853 val = qs_alloc_zero_byte_string(r);
1857 nm = qs_alloc_zero_byte_string(r);
1859 qs_output_to_hdml_out(hdml, apr_psprintf(r->pool,
1860 "<A TASK=GOSUB LABEL=\"Áª¯¸\" "
1861 "DEST=\"#$%s%02d\" "
1863 "RECEIVE=\"%s%02d;%s%02d;%s%02d\">"
1865 qs_get_form_no(r, hdml),
1866 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1868 qs_get_form_no(r, hdml),
1869 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1870 qs_get_form_no(r, hdml),
1871 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1872 qs_get_form_no(r, hdml),
1873 hdml->var_cnt[hdml->pure_form_cnt] + 2,
1874 qs_get_form_no(r, hdml),
1875 hdml->var_cnt[hdml->pure_form_cnt] + 2));
1878 qs_output_to_init_vars(hdml,
1879 apr_psprintf(r->pool,
1880 "%s%02d=_uchk&%s%02d=%s&%s%02d=X",
1881 qs_get_form_no(r, hdml),
1882 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1883 qs_get_form_no(r, hdml),
1884 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1885 ap_escape_uri(r->pool,val),
1886 qs_get_form_no(r, hdml),
1887 hdml->var_cnt[hdml->pure_form_cnt] + 2
1892 qs_output_to_init_vars(hdml,
1893 apr_psprintf(r->pool,
1894 "%s%02d=_chk&%s%02d=&%s%02d=_",
1895 qs_get_form_no(r, hdml),
1896 hdml->var_cnt[hdml->pure_form_cnt] + 0,
1897 qs_get_form_no(r, hdml),
1898 hdml->var_cnt[hdml->pure_form_cnt] + 1,
1899 qs_get_form_no(r, hdml),
1900 hdml->var_cnt[hdml->pure_form_cnt] + 2
1904 qs_output_to_postdata(hdml,
1905 apr_psprintf(r->pool, "%s%s=$%s%02d",
1908 qs_get_form_no(r, hdml),
1909 hdml->var_cnt[hdml->pure_form_cnt] + 1));
1910 hdml->var_cnt[hdml->pure_form_cnt] += 3;
1914 * The ISTYLE attribute is converted into the HDML form.
1916 * @param r [i] To use POOL, the pointer to request_rec is specified.
1917 * @param is [i] The value of the ISTYLE attribute is specified.
1918 * @return The ISTYLE attribute converted into the HDML form is returned.
1921 qs_conv_istyle_to_format(request_rec* r, char* is)
1929 if (strcasecmp(is, "1") == 0)
1931 fmt = apr_psprintf(r->pool, "M");
1934 if (strcasecmp(is, "2") == 0)
1936 fmt = apr_psprintf(r->pool, "M");
1939 if (strcasecmp(is, "3") == 0)
1941 fmt = apr_psprintf(r->pool, "m");
1944 if (strcasecmp(is, "4") == 0)
1946 fmt = apr_psprintf(r->pool, "N");
1956 * It is a handler who processes the INPUT tag.
1958 * @param hdml [i/o] The pointer to the HDML structure at the output
1959 * destination is specified.
1960 * @param node [i] The INPUT tag node is specified.
1961 * @return The conversion result is returned.
1964 hdml_1_0_end_input_tag(Hdml* hdml, Node* child)
1970 * It is a handler who processes the CENTER tag.
1972 * @param hdml [i/o] The pointer to the HDML structure at the output
1973 * destination is specified.
1974 * @param node [i] The CENTER tag node is specified.
1975 * @return The conversion result is returned.
1978 hdml_1_0_start_center_tag(Hdml* hdml, Node* node)
1983 if (hdml->hdml_br_flag == 0)
1985 hdml = qs_output_to_hdml_out(hdml, "<BR>\n");
1987 hdml = qs_output_to_hdml_out(hdml, "<CENTER>");
1993 * It is a handler who processes the CENTER tag.
1995 * @param hdml [i/o] The pointer to the HDML structure at the output
1996 * destination is specified.
1997 * @param node [i] The CENTER tag node is specified.
1998 * @return The conversion result is returned.
2001 hdml_1_0_end_center_tag(Hdml* hdml, Node* child)
2004 hdml->in_center = 0;
2006 hdml = qs_output_to_hdml_out(hdml, "<BR>\n");
2007 hdml->hdml_br_flag = 1;
2013 * It is a handler who processes the HR tag.
2015 * @param hdml [i/o] The pointer to the HDML structure at the output
2016 * destination is specified.
2017 * @param node [i] The HR tag node is specified.
2018 * @return The conversion result is returned.
2021 hdml_1_0_start_hr_tag(Hdml* hdml, Node* node)
2023 if (hdml->hdml_br_flag == 0)
2025 qs_output_to_hdml_out(hdml, "<BR>\n");
2026 if (hdml->in_center > 0)
2031 if (hdml->div_in_center > 0)
2033 hdml->div_in_center--;
2037 qs_output_to_hdml_out(hdml, "<CENTER>
\84\9f\84\9f\84\9f\84\9f\84\9f\84\9f\84\9f\84\9f<BR>\n");
2039 hdml->hdml_br_flag = 1;
2045 * It is a handler who processes the HR tag.
2047 * @param hdml [i/o] The pointer to the HDML structure at the output
2048 * destination is specified.
2049 * @param node [i] The HR tag node is specified.
2050 * @return The conversion result is returned.
2053 hdml_1_0_end_hr_tag(Hdml* hdml, Node* child)
2059 * It is a handler who processes the IMG tag.
2061 * @param hdml [i/o] The pointer to the HDML structure at the output
2062 * destination is specified.
2063 * @param node [i] The IMG tag node is specified.
2064 * @return The conversion result is returned.
2067 hdml_1_0_start_img_tag(Hdml* hdml, Node* node)
2069 Doc* doc = hdml->doc;
2070 #ifndef IMG_NOT_CONVERT_FILENAME
2071 device_table* spec = hdml->spec;
2075 hdml_tag_output_upper_half(hdml, node);
2077 qs_output_to_hdml_out(hdml, "<img");
2079 /* Get Attributes */
2080 for (attr = qs_get_attr(doc,node); attr != NULL; attr = qs_get_next_attr(doc,attr))
2082 char* name = qs_get_attr_name(doc,attr);
2083 char* value = qs_get_attr_value(doc,attr);
2085 if (strcasecmp(name, "src") == 0)
2087 qs_output_to_hdml_out(hdml, " src=\"");
2088 #ifdef IMG_NOT_CONVERT_FILENAME
2089 qs_output_to_hdml_out(hdml, value );
2091 qs_output_to_hdml_out(hdml, chxj_img_conv(doc->r, spec,value));
2093 qs_output_to_hdml_out(hdml, "\"" );
2096 if (strcasecmp(name, "align" ) == 0)
2098 qs_output_to_hdml_out(hdml, " align=\"" );
2099 qs_output_to_hdml_out(hdml, value );
2100 qs_output_to_hdml_out(hdml, "\"" );
2103 if (strcasecmp(name, "width" ) == 0)
2105 qs_output_to_hdml_out(hdml, " width=\"");
2106 qs_output_to_hdml_out(hdml, value );
2107 qs_output_to_hdml_out(hdml, "\"" );
2110 if (strcasecmp(name, "height") == 0)
2112 qs_output_to_hdml_out(hdml, " height=\"");
2113 qs_output_to_hdml_out(hdml, value );
2114 qs_output_to_hdml_out(hdml, "\"" );
2117 if (strcasecmp(name, "hspace") == 0)
2119 qs_output_to_hdml_out(hdml, " hspace=\"");
2120 qs_output_to_hdml_out(hdml, value );
2121 qs_output_to_hdml_out(hdml, "\"" );
2124 if (strcasecmp(name, "vspace") == 0)
2126 qs_output_to_hdml_out(hdml, " vspace=\"");
2127 qs_output_to_hdml_out(hdml, value );
2128 qs_output_to_hdml_out(hdml, "\"" );
2131 if (strcasecmp(name, "alt" ) == 0)
2133 qs_output_to_hdml_out(hdml, " alt=\"" );
2134 qs_output_to_hdml_out(hdml, value );
2135 qs_output_to_hdml_out(hdml, "\"" );
2138 qs_output_to_hdml_out(hdml, ">" );
2144 * It is a handler who processes the IMG tag.
2146 * @param hdml [i/o] The pointer to the HDML structure at the output
2147 * destination is specified.
2148 * @param node [i] The IMG tag node is specified.
2149 * @return The conversion result is returned.
2152 hdml_1_0_end_img_tag(Hdml* hdml, Node* child)
2158 * It is a handler who processes the SELECT tag.
2160 * @param hdml [i/o] The pointer to the HDML structure at the output
2161 * destination is specified.
2162 * @param node [i] The SELECT tag node is specified.
2163 * @return The conversion result is returned.
2166 hdml_1_0_start_select_tag(Hdml* hdml, Node* node)
2168 Doc* doc = hdml->doc;
2169 request_rec* r = doc->r;
2172 hdml_tag_output_upper_half(hdml, node);
2176 qs_output_to_hdml_out(hdml, apr_psprintf(r->pool,
2177 "<A TASK=GOSUB LABEL=
\91I
\91ð "
2178 "VARS=\"V=$%s%02d\" DEST=#D%d "
2179 "RECEIVE=\"%s%02d;%s%02d\">"
2181 qs_get_form_no(r, hdml),
2182 hdml->var_cnt[hdml->pure_form_cnt]+0,
2184 qs_get_form_no(r, hdml),
2185 hdml->var_cnt[hdml->pure_form_cnt]+0,
2186 qs_get_form_no(r, hdml),
2187 hdml->var_cnt[hdml->pure_form_cnt]+1,
2188 qs_get_form_no(r, hdml),
2189 hdml->var_cnt[hdml->pure_form_cnt]+1));
2191 qs_output_to_hdml_card(hdml,
2192 apr_psprintf(r->pool,
2193 "<CHOICE KEY=V NAME=D%d ", hdml->card_cnt));
2194 qs_output_to_hdml_card(hdml,
2195 apr_psprintf(r->pool,
2196 "DEFAULT=$V METHOD=ALPHA MARKABLE=FALSE>\n"));
2197 /*--------------------------------------------------------------------------*/
2198 /* Get Attributes */
2199 /*--------------------------------------------------------------------------*/
2200 for (attr = qs_get_attr(doc,node);
2202 attr=qs_get_next_attr(doc,attr))
2204 char* name = qs_get_attr_name(doc,attr);
2205 char* value = qs_get_attr_value(doc,attr);
2206 char* selval = NULL;
2207 char* selvaltxt = NULL;
2208 if (strcasecmp(name, "name") == 0)
2211 qs_output_to_postdata(hdml,
2212 apr_psprintf(r->pool, "%s=$%s%02d",
2214 qs_get_form_no(r, hdml),
2215 hdml->var_cnt[hdml->pure_form_cnt]));
2216 selval = qs_get_selected_value(doc, node, r);
2219 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
2220 "selected value not found");
2221 selval = qs_alloc_zero_byte_string(r);
2225 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
2226 "selected value found[%s]" , selval);
2228 selvaltxt = qs_get_selected_value_text(doc, node, r);
2229 if (selvaltxt == NULL)
2231 selvaltxt = qs_alloc_zero_byte_string(r);
2233 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "selvaltxt:[%s]" ,selvaltxt);
2235 qs_output_to_init_vars(hdml,
2236 apr_psprintf(r->pool,
2237 "%s%02d=%s&%s%02d=%s",
2238 qs_get_form_no(r, hdml),
2239 hdml->var_cnt[hdml->pure_form_cnt] + 0,
2241 qs_get_form_no(r, hdml),
2242 hdml->var_cnt[hdml->pure_form_cnt] + 1,
2245 hdml->var_cnt[hdml->pure_form_cnt] += 2;
2253 * It is a handler who processes the SELECT tag.
2255 * @param hdml [i/o] The pointer to the HDML structure at the output
2256 * destination is specified.
2257 * @param node [i] The SELECT tag node is specified.
2258 * @return The conversion result is returned.
2261 hdml_1_0_end_select_tag(Hdml* hdml, Node* node)
2263 qs_output_to_hdml_card(hdml, "</CHOICE>\n");
2269 * It is a handler who processes the OPTION tag.
2271 * @param hdml [i/o] The pointer to the HDML structure at the output
2272 * destination is specified.
2273 * @param node [i] The OPTION tag node is specified.
2274 * @return The conversion result is returned.
2277 hdml_1_0_start_option_tag(Hdml* hdml, Node* node)
2279 request_rec* r = hdml->doc->r;
2280 Doc* doc = hdml->doc;
2287 hdml->option_flag = 1;
2288 val = qs_get_value_attr(doc, node, r);
2290 /*--------------------------------------------------------------------------*/
2291 /* The child node of the object tag node acquires the value in assumption */
2292 /* that is the TEXT node. */
2293 /*--------------------------------------------------------------------------*/
2294 child = qs_get_child_node(doc, node);
2297 txtval = apr_palloc(r->pool, 1);
2302 txtval = qs_get_node_value(doc, child);
2304 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "txtval:[%s]" , txtval);
2306 if (val != NULL && txtval != NULL)
2308 qs_output_to_hdml_card(hdml,
2309 apr_psprintf(r->pool,
2310 "<CE TASK=RETURN VALUE=\"%s\" "
2311 "RETVALS=\"$V;%s\">%s</CE>\n",
2313 qs_trim_string(r,txtval),
2314 qs_trim_string(r,txtval)));
2321 * It is a handler who processes the OPTION tag.
2323 * @param hdml [i/o] The pointer to the HDML structure at the output
2324 * destination is specified.
2325 * @param node [i] The OPTION tag node is specified.
2326 * @return The conversion result is returned.
2329 hdml_1_0_end_option_tag(Hdml* hdml, Node* node)
2331 hdml->option_flag = 0;
2336 * It is a handler who processes the DIV tag.
2338 * @param hdml [i/o] The pointer to the HDML structure at the output
2339 * destination is specified.
2340 * @param node [i] The DIV tag node is specified.
2341 * @return The conversion result is returned.
2344 hdml_1_0_start_div_tag(Hdml* hdml, Node* node)
2346 Doc* doc = hdml->doc;
2349 /*--------------------------------------------------------------------------*/
2350 /* If the br tag is not output immediately before the div tag appears, the */
2351 /* br tag is output. */
2352 /*--------------------------------------------------------------------------*/
2353 if (hdml->hdml_br_flag == 0)
2355 hdml->hdml_br_flag = 1;
2356 qs_output_to_hdml_out(hdml, "<BR>\n");
2359 /*--------------------------------------------------------------------------*/
2360 /* The object tag node is scanned. */
2361 /*--------------------------------------------------------------------------*/
2362 for (attr = qs_get_attr(doc,node);
2364 attr = qs_get_next_attr(doc,attr))
2366 char* name = qs_get_attr_name(doc,attr);
2367 char* value = qs_get_attr_value(doc,attr);
2368 if (strcasecmp(name, "align") == 0)
2370 if (strcasecmp(value, "right") == 0)
2372 hdml->div_right_flag = 1;
2373 qs_output_to_hdml_out(hdml, "<RIGHT>");
2374 hdml->hdml_br_flag = 0;
2377 else if (strcasecmp(value, "center") == 0)
2379 hdml->div_center_flag = 1;
2380 qs_output_to_hdml_out(hdml, "<CENTER>");
2381 hdml->hdml_br_flag = 0;
2391 * It is a handler who processes the DIV tag.
2393 * @param hdml [i/o] The pointer to the HDML structure at the output
2394 * destination is specified.
2395 * @param node [i] The DIV tag node is specified.
2396 * @return The conversion result is returned.
2399 hdml_1_0_end_div_tag(Hdml* hdml, Node* node)
2401 request_rec* r = hdml->doc->r;
2404 if (hdml->div_right_flag == 1)
2406 qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
2407 hdml->div_right_flag = 0;
2409 if (hdml->div_center_flag == 1)
2411 qs_output_to_hdml_out(hdml, apr_psprintf(r->pool, "<BR>\n"));
2412 hdml->div_center_flag = 0;
2413 hdml->div_in_center = 0;
2420 * It is a wrapper of the apr_pstrcat function.
2422 * @param r [i] To use POOL, the pointer to request_rec is specified.
2423 * @param o [i] The character string of connected origin is specified.
2424 * @param s [i] The character string connected with 'o' parameter is
2426 * @param len [i/o] The pointer to the area where the character string
2427 * length is stored is specified.
2428 * @return The character string after it connects it is returned.
2431 qs_out_apr_pstrcat(request_rec* r, char* o, char* s, int* len)
2433 *len = (strlen(s) + *len);
2434 return apr_pstrcat(r->pool, o, s, NULL);
2438 * The prepositive character string used to generate the variable for HDML is
2441 * @param r [i] To use POOL, the pointer to request_rec is specified.
2442 * @param hdml [i] The pointer to the HDML structure that maintains the seed
2443 * to generate it is specified.
2444 * @return The character string after it generates it is returned.
2447 qs_get_form_no(request_rec* r, Hdml* hdml)
2451 unsigned long fc = hdml->form_cnt;
2453 apr_time_exp_tz(&tm, hdml->form_cnt, 0);
2455 result = apr_psprintf(r->pool, "%c",(int)('A' + ((fc / 100) % 26)));
2456 result = apr_pstrcat(r->pool, result,
2457 apr_psprintf(r->pool, "%02d%02d%02d",
2465 * The number of tag nodes .."Input type =' radio '".. is counted.
2467 * @param hdml [i] The pointer to the HDML structure is specified.
2468 * @param node [i] The first parents node that counts the radio tag node is
2472 hdml_1_0_count_radio_tag(Hdml* hdml, Node* node)
2475 Doc* doc = hdml->doc;
2476 request_rec* r = doc->r;
2478 /*--------------------------------------------------------------------------*/
2479 /* All the child nodes of the specified node are scanned. */
2480 /*--------------------------------------------------------------------------*/
2481 for (child = qs_get_child_node(doc,node);
2483 child = qs_get_next_node(doc,child))
2493 name = qs_get_node_name(doc,child);
2494 if (strcasecmp(name, "input") != 0)
2496 hdml_1_0_count_radio_tag(hdml, child);
2500 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "found input tag");
2501 type = qs_get_type_attr(doc, child, r);
2504 ap_log_rerror(APLOG_MARK, APLOG_ERR,0,r,
2505 "Oops! The input tag without the type attribute has been found."
2506 "Please give a type.");
2509 if (strcasecmp(type, "radio") != 0)
2514 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "found type=radio");
2515 rname = qs_get_name_attr (doc, child, r);
2516 rvalue = qs_get_value_attr(doc, child, r);
2519 /*----------------------------------------------------------------------*/
2520 /* Oops!. The input tag without the name attribute has been found. */
2521 /*----------------------------------------------------------------------*/
2522 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
2523 "Oops!. The input tag without the name attribute has been found."
2524 "Please give a name.");
2528 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "found name attribute");
2529 /*------------------------------------------------------------------------*/
2530 /* It scans in radio_name_list. When the same value exists, the */
2531 /* value is overwrited. */
2532 /* The value is written in a new area when not is. */
2533 /*------------------------------------------------------------------------*/
2534 for (ii=0; ii<MAX_RADIO_COUNT; ii++)
2536 if (hdml->radio_name_list[ii] == NULL)
2538 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
2539 "new name:[%s]", rname);
2542 if (strcasecmp(hdml->radio_name_list[ii], rname) == 0)
2544 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
2545 "already registered name:[%s]", rname);
2549 if (ii == MAX_RADIO_COUNT)
2551 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
2552 apr_psprintf(r->pool,
2553 "I do not understand the name of the radiobutton "
2554 "of %d piece or more. Please decrease "
2555 "the number of radiobuttons.",
2559 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "add radio name:[%s]" ,rname);
2560 hdml->radio_name_list[ii] = apr_pstrdup(r->pool, rname);
2562 /*------------------------------------------------------------------------*/
2563 /* It adds it to radio_value_list. */
2564 /*------------------------------------------------------------------------*/
2565 for (jj=0; jj<MAX_RADIO_VALUE_COUNT; jj++)
2567 if (hdml->radio_value_list[ii][jj] == NULL)
2572 if (jj == MAX_RADIO_VALUE_COUNT)
2574 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
2575 apr_psprintf(r->pool,
2576 "I do not understand the value of the radiobutton "
2577 "of %d piece or more. Please decrease "
2578 "the number of radiobuttons.",
2579 MAX_RADIO_VALUE_COUNT));
2582 hdml->radio_value_list[ii][jj] = apr_pstrdup(r->pool, rvalue);
2584 /*------------------------------------------------------------------------*/
2585 /* Now let's be the checked attribute or scan. */
2586 /*------------------------------------------------------------------------*/
2587 chkd = qs_get_checked_attr(hdml->doc, child, hdml->doc->r);
2590 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
2591 apr_psprintf(r->pool,
2592 "The tag scanned now had the checked "
2593 "attribute. The value is [%s].",
2595 hdml->radio_checked_value[ii] = apr_pstrdup(r->pool, rvalue);
2601 * The character string is added, and output to the out member of the HDML
2604 * @param hdml [i/o] The pointer to the HDML structure that maintains the out
2605 * member at the output destination is specified.
2606 * @param s [i] The character string that should be output is specified.
2607 * @return The pointer to the HDML structure after it processes it is returned.
2610 qs_output_to_hdml_out(Hdml* hdml, char* s)
2612 hdml->out = qs_out_apr_pstrcat(hdml->doc->r, hdml->out, s, &hdml->out_len);
2617 * The character string is added, and output to the card member of the HDML
2620 * @param hdml [i/o] The pointer to the HDML structure that maintains the
2621 * card member at the output destination is specified.
2622 * @param s [i] The character string that should be output is specified.
2623 * @return The pointer to the HDML structure after it processes it is returned.
2626 qs_output_to_hdml_card(Hdml* hdml, char* s)
2628 hdml->card = qs_out_apr_pstrcat(hdml->doc->r, hdml->card, s, &hdml->card_len);
2633 * The data for the post is added, and output.
2635 * @param hdml [i/o] The pointer to the HDML structure at the output
2636 * destination is specified.
2637 * @param s [i] The character string that wants to output to postdata is
2641 qs_output_to_postdata(Hdml* hdml, char* s)
2643 request_rec* r = hdml->doc->r;
2645 if (strlen(hdml->postdata[hdml->pure_form_cnt]) != 0)
2647 hdml->postdata[hdml->pure_form_cnt] =
2648 apr_pstrcat(r->pool,
2649 hdml->postdata[hdml->pure_form_cnt],
2653 hdml->postdata[hdml->pure_form_cnt] =
2654 apr_pstrcat(r->pool,
2655 hdml->postdata[hdml->pure_form_cnt],
2656 qs_trim_string(r, s),
2658 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
2660 hdml->postdata[hdml->pure_form_cnt] );
2664 * The tag output upper half.
2666 * @param hdml [i/o] The pointer to the HDML structure at the output
2667 * destination is specified.
2668 * @param node [i] The A tag node is specified.
2671 hdml_tag_output_upper_half(Hdml* hdml, Node* node)
2673 if (hdml->hdml_br_flag == 1
2674 && hdml->div_right_flag == 1)
2676 qs_output_to_hdml_out(hdml, "<RIGHT>");
2677 hdml->hdml_br_flag = 0;
2680 if (hdml->hdml_br_flag == 1
2682 && hdml->in_center == 0)
2684 qs_output_to_hdml_out(hdml, "<CENTER>");
2686 hdml->hdml_br_flag = 0;
2689 if (hdml->hdml_br_flag == 1
2690 && hdml->div_center_flag > 0
2691 && hdml->div_in_center == 0)
2693 qs_output_to_hdml_out(hdml, "<CENTER>");
2694 hdml->div_in_center++;
2695 hdml->hdml_br_flag = 0;
2700 * The data for the init_vars is added, and output.
2702 * @param hdml [i/o] The pointer to the HDML structure at the output
2703 * destination is specified.
2704 * @param s [i] The character string that wants to output to postdata is
2708 qs_output_to_init_vars(Hdml* hdml, char* s)
2710 request_rec* r = hdml->doc->r;
2712 if (strlen(hdml->init_vars) > 0)
2714 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, "&", NULL);
2716 hdml->init_vars = apr_pstrcat(r->pool, hdml->init_vars, qs_trim_string(r,s), NULL);
2717 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
2723 hdml_1_0_chxjif_tag(Hdml* hdml, Node* node)
2725 Doc* doc = hdml->doc;
2728 for (child = qs_get_child_node(doc, node);
2730 child = qs_get_next_node(doc, child))
2732 qs_output_to_hdml_out(hdml, child->otext);
2733 hdml_1_0_chxjif_tag(hdml, child);