105 |
char *hr = "<hr>"; |
char *hr = "<hr>"; |
106 |
char *br = "<br>"; |
char *br = "<br>"; |
107 |
char *empty_element = ""; |
char *empty_element = ""; |
108 |
|
char *noframes_begin = "<noframes>"; |
109 |
|
char *noframes_end = "</noframes>"; |
110 |
|
|
111 |
/* |
/* |
112 |
* XHTML support. |
* XHTML support. |
174 |
hr = "<hr />"; |
hr = "<hr />"; |
175 |
br = "<br />"; |
br = "<br />"; |
176 |
empty_element = " /"; |
empty_element = " /"; |
177 |
|
noframes_begin = "<noframes>"; |
178 |
|
noframes_end = "</noframes>"; |
179 |
} |
} |
180 |
/* |
/* |
181 |
* Generate upper directory. |
* Generate upper directory. |
533 |
{ |
{ |
534 |
return "</div>"; |
return "</div>"; |
535 |
} |
} |
536 |
|
/* |
537 |
|
* Generate beginning of form |
538 |
|
* |
539 |
|
* i) target target |
540 |
|
*/ |
541 |
|
char * |
542 |
|
gen_form_begin(target) |
543 |
|
const char *target; |
544 |
|
{ |
545 |
|
STATIC_STRBUF(sb); |
546 |
|
|
547 |
|
strbuf_init(sb); |
548 |
|
strbuf_sprintf(sb, "<form method='get' action='%s'", action); |
549 |
|
if (target) |
550 |
|
strbuf_sprintf(sb, " target='%s'", target); |
551 |
|
strbuf_sprintf(sb, "%s>", empty_element); |
552 |
|
return strbuf_value(sb); |
553 |
|
} |
554 |
|
/* |
555 |
|
* Generate end of form |
556 |
|
*/ |
557 |
|
char * |
558 |
|
gen_form_end() |
559 |
|
{ |
560 |
|
return "</form>"; |
561 |
|
} |
562 |
|
/* |
563 |
|
* Generate input tag |
564 |
|
*/ |
565 |
|
char * |
566 |
|
gen_input(name, value, type) |
567 |
|
const char *name; |
568 |
|
const char *value; |
569 |
|
const char *type; |
570 |
|
{ |
571 |
|
return gen_input_with_title_checked(name, value, type, NULL, 0); |
572 |
|
} |
573 |
|
/* |
574 |
|
* Generate input radiobox tag |
575 |
|
*/ |
576 |
|
char * |
577 |
|
gen_input_radio(name, value, checked, title) |
578 |
|
const char *name; |
579 |
|
const char *value; |
580 |
|
int checked; |
581 |
|
const char *title; |
582 |
|
{ |
583 |
|
return gen_input_with_title_checked(name, value, "radio", checked, title); |
584 |
|
} |
585 |
|
/* |
586 |
|
* Generate input checkbox tag |
587 |
|
*/ |
588 |
|
char * |
589 |
|
gen_input_checkbox(name, value, title) |
590 |
|
const char *name; |
591 |
|
const char *value; |
592 |
|
const char *title; |
593 |
|
{ |
594 |
|
return gen_input_with_title_checked(name, value, "checkbox", 0, title); |
595 |
|
} |
596 |
|
/* |
597 |
|
* Generate input radio tag |
598 |
|
*/ |
599 |
|
char * |
600 |
|
gen_input_with_title_checked(name, value, type, checked, title) |
601 |
|
const char *name; |
602 |
|
const char *value; |
603 |
|
const char *type; |
604 |
|
int checked; |
605 |
|
const char *title; |
606 |
|
{ |
607 |
|
STATIC_STRBUF(sb); |
608 |
|
|
609 |
|
strbuf_init(sb); |
610 |
|
strbuf_puts(sb, "<input"); |
611 |
|
if (type) |
612 |
|
strbuf_sprintf(sb, " type='%s'", type); |
613 |
|
if (name) |
614 |
|
strbuf_sprintf(sb, " name='%s'", name); |
615 |
|
if (value) |
616 |
|
strbuf_sprintf(sb, " value='%s'", value); |
617 |
|
if (checked) |
618 |
|
strbuf_puts(sb, " checked"); |
619 |
|
if (title) |
620 |
|
strbuf_sprintf(sb, " title='%s'", title); |
621 |
|
strbuf_sprintf(sb, "%s>", empty_element); |
622 |
|
return strbuf_value(sb); |
623 |
|
} |
624 |
|
/* |
625 |
|
* Generate beginning of frameset |
626 |
|
* |
627 |
|
* i) target target |
628 |
|
*/ |
629 |
|
char * |
630 |
|
gen_frameset_begin(contents) |
631 |
|
const char *contents; |
632 |
|
{ |
633 |
|
static char buf[128]; |
634 |
|
|
635 |
|
snprintf(buf, sizeof(buf), "<frameset %s%s>", contents, empty_element); |
636 |
|
return buf; |
637 |
|
} |
638 |
|
/* |
639 |
|
* Generate end of frameset |
640 |
|
*/ |
641 |
|
char * |
642 |
|
gen_frameset_end() |
643 |
|
{ |
644 |
|
return "</frameset>"; |
645 |
|
} |
646 |
|
/* |
647 |
|
* Generate beginning of frame |
648 |
|
* |
649 |
|
* i) target target |
650 |
|
*/ |
651 |
|
char * |
652 |
|
gen_frame(name, src) |
653 |
|
const char *name; |
654 |
|
const char *src; |
655 |
|
{ |
656 |
|
STATIC_STRBUF(sb); |
657 |
|
|
658 |
|
strbuf_init(sb); |
659 |
|
strbuf_sprintf(sb, "<frame name='%s' id='%s' src='%s'%s>", name, name, src, empty_element); |
660 |
|
return strbuf_value(sb); |
661 |
|
} |