1 package body htp as
2
3 /* The broken line below is intentional */
4 NL_CHAR constant varchar2(1) := '
5 ';
6 NLNL_CHAR constant varchar2(2) := '
7
8 ';
9 htcurline varchar2(256) := ''; -- htbuf_arr element size
10 htbuf htbuf_arr;
11 rows_in number;
12 rows_out number;
13 pack_after constant number := 60;
14
15 sContentType constant varchar2(16) := 'CONTENT-TYPE:';
16 sContentLength constant varchar2(16) := 'CONTENT-LENGTH:';
17 sLocation constant varchar2(16) := 'LOCATION:';
18 sStatus constant varchar2(16) := 'STATUS:';
19 sTextHtml constant varchar2(16) := 'text/html';
20
21 nContentTypeLen constant number := length(sContentType);
22 nContentLengthLen constant number := length(sContentLength);
23 nLocationLen constant number := length(sLocation);
24 nStatusLen constant number := length(sStatus);
25
26 bAddDefaultHTMLHdr boolean := TRUE;
27 bHTMLPageReady boolean := FALSE;
28 bHasHTMLHdr boolean := FALSE;
29 bHasContentLength boolean := FALSE;
30 nEndOfHdrIx binary_integer := -1;
31 nContentLengthIx binary_integer := -1;
32
33 sDownloadFilesList varchar2(256); -- for file download feature
34 nCompressDownloadFiles binary_integer;
35
36 /* STRUCTURE tags */
37 procedure htmlOpen is
38 begin p(htf.htmlOpen); end;
39
40 procedure htmlClose is
41 begin p(htf.htmlClose); end;
42
43 procedure headOpen is
44 begin p(htf.headOpen); end;
45
46 procedure headClose is
47 begin p(htf.headClose); end;
48
49 procedure bodyOpen(cbackground in varchar2 DEFAULT NULL,
50 cattributes in varchar2 DEFAULT NULL) is
51 begin p(htf.bodyOpen(cbackground,cattributes)); end;
52
53 procedure bodyClose is
54 begin p(htf.bodyClose); end;
55 /* END STRUCTURE tags */
56
57 /* HEAD Related elements tags */
58 procedure title (ctitle in varchar2) is
59 begin p(htf.title(ctitle)); end;
60
61 procedure htitle(ctitle in varchar2,
62 nsize in integer DEFAULT 1,
63 calign in varchar2 DEFAULT NULL,
64 cnowrap in varchar2 DEFAULT NULL,
65 cclear in varchar2 DEFAULT NULL,
66 cattributes in varchar2 DEFAULT NULL) is
67 begin p(htf.htitle(ctitle,nsize,calign,cnowrap,cclear,cattributes)); end;
68
69 procedure base( ctarget in varchar2 DEFAULT NULL,
70 cattributes in varchar2 DEFAULT NULL) is
71 begin p(htf.base(ctarget,cattributes)); end;
72
73 procedure isindex(cprompt in varchar2 DEFAULT NULL,
74 curl in varchar2 DEFAULT NULL) is
75 begin p(htf.isindex(cprompt, curl)); end;
76
77 procedure linkRel(crel in varchar2,
78 curl in varchar2,
79 ctitle in varchar2 DEFAULT NULL) is
80 begin p(htf.linkRel(crel, curl, ctitle)); end;
81
82 procedure linkRev(crev in varchar2,
83 curl in varchar2,
84 ctitle in varchar2 DEFAULT NULL) is
85 begin p(htf.linkRev(crev, curl, ctitle)); end;
86
87 procedure meta(chttp_equiv in varchar2,
88 cname in varchar2,
89 ccontent in varchar2) is
90 begin p(htf.meta(chttp_equiv, cname, ccontent)); end;
91
92 procedure nextid(cidentifier in varchar2) is
93 begin p(htf.nextid(cidentifier)); end;
94
95 procedure style(cstyle in varchar2) is
96 begin p(htf.style(cstyle)); end;
97
98 procedure script(cscript in varchar2,
99 clanguage in varchar2 DEFAULT NULL) is
100 begin p(htf.script(cscript, clanguage)); end;
101
102 /* END HEAD Related elements tags */
103
104 /* BODY ELEMENT tags */
105 procedure hr (cclear in varchar2 DEFAULT NULL,
106 csrc in varchar2 DEFAULT NULL,
107 cattributes in varchar2 DEFAULT NULL) is
108 begin p(htf.hr(cclear, csrc, cattributes)); end;
109
110 procedure line(cclear in varchar2 DEFAULT NULL,
111 csrc in varchar2 DEFAULT NULL,
112 cattributes in varchar2 DEFAULT NULL) is
113 begin htp.hr(cclear, csrc, cattributes); end;
114
115 procedure nl (cclear in varchar2 DEFAULT NULL,
116 cattributes in varchar2 DEFAULT NULL) is
117 begin p(htf.nl(cclear,cattributes)); end;
118
119 procedure br (cclear in varchar2 DEFAULT NULL,
120 cattributes in varchar2 DEFAULT NULL) is
121 begin htp.nl(cclear,cattributes); end;
122
123 procedure header(nsize in integer,
124 cheader in varchar2,
125 calign in varchar2 DEFAULT NULL,
126 cnowrap in varchar2 DEFAULT NULL,
127 cclear in varchar2 DEFAULT NULL,
128 cattributes in varchar2 DEFAULT NULL) is
129 begin p(htf.header(nsize,cheader,calign,cnowrap,cclear,cattributes)); end;
130
131 procedure anchor(curl in varchar2,
132 ctext in varchar2,
133 cname in varchar2 DEFAULT NULL,
134 cattributes in varchar2 DEFAULT NULL) is
135 begin p(htf.anchor(curl,ctext,cname,cattributes)); end;
136
137 procedure anchor2(curl in varchar2,
138 ctext in varchar2,
139 cname in varchar2 DEFAULT NULL,
140 ctarget in varchar2 DEFAULT NULL,
141 cattributes in varchar2 DEFAULT NULL) is
142 begin p(htf.anchor2(curl,ctext,cname,ctarget,cattributes)); end;
143
144 procedure mailto(caddress in varchar2,
145 ctext in varchar2,
146 cname in varchar2 DEFAULT NULL,
147 cattributes in varchar2 DEFAULT NULL) is
148 begin p(htf.mailto(caddress,ctext,cname,cattributes)); end;
149
150 procedure img(curl in varchar2,
151 calign in varchar2 DEFAULT NULL,
152 calt in varchar2 DEFAULT NULL,
153 cismap in varchar2 DEFAULT NULL,
154 cattributes in varchar2 DEFAULT NULL) is
155 begin p(htf.img(curl,calign,calt,cismap,cattributes)); end;
156
157 procedure img2(curl in varchar2,
158 calign in varchar2 DEFAULT NULL,
159 calt in varchar2 DEFAULT NULL,
160 cismap in varchar2 DEFAULT NULL,
161 cusemap in varchar2 DEFAULT NULL,
162 cattributes in varchar2 DEFAULT NULL) is
163 begin p(htf.img2(curl,calign,calt,cismap,cusemap,cattributes)); end;
164
165 procedure area( ccoords in varchar2,
166 cshape in varchar2 DEFAULT NULL,
167 chref in varchar2 DEFAULT NULL,
168 cnohref in varchar2 DEFAULT NULL,
169 ctarget in varchar2 DEFAULT NULL,
170 cattributes in varchar2 DEFAULT NULL) is
171 begin p(htf.area(ccoords,cshape,chref,cnohref,ctarget,cattributes));end;
172
173 procedure mapOpen(cname in varchar2,cattributes in varchar2 DEFAULT NULL) is
174 begin p(htf.mapOpen(cname,cattributes)); end;
175 procedure mapClose is
176 begin p(htf.mapClose); end;
177
178 procedure bgsound(csrc in varchar2,
179 cloop in varchar2 DEFAULT NULL,
180 cattributes in varchar2 DEFAULT NULL) is
181 begin p(htf.bgsound(csrc,cloop,cattributes));end;
182
183 procedure para is
184 begin p(htf.para); end;
185
186 procedure paragraph(calign in varchar2 DEFAULT NULL,
187 cnowrap in varchar2 DEFAULT NULL,
188 cclear in varchar2 DEFAULT NULL,
189 cattributes in varchar2 DEFAULT NULL) is
190 begin p(htf.paragraph(calign,cnowrap,cclear,cattributes)); end;
191
192 procedure div( calign in varchar2 DEFAULT NULL,
193 cattributes in varchar2 DEFAULT NULL) is
194 begin p(htf.div(calign,cattributes)); end;
195
196 procedure address(cvalue in varchar2,
197 cnowrap in varchar2 DEFAULT NULL,
198 cclear in varchar2 DEFAULT NULL,
199 cattributes in varchar2 DEFAULT NULL) is
200 begin p(htf.address(cvalue, cnowrap, cclear, cattributes)); end;
201
202 procedure comment(ctext in varchar2) is
203 begin p(htf.comment(ctext)); end;
204
205 procedure preOpen(cclear in varchar2 DEFAULT NULL,
206 cwidth in varchar2 DEFAULT NULL,
207 cattributes in varchar2 DEFAULT NULL) is
208 begin p(htf.preOpen(cclear,cwidth,cattributes)); end;
209
210 procedure preClose is
211 begin p(htf.preClose); end;
212
213 procedure listingOpen is
214 begin p(htf.listingOpen); end;
215 procedure listingClose is
216 begin p(htf.listingClose); end;
217
218 procedure nobr(ctext in varchar2) is
219 begin p(htf.nobr(ctext)); end;
220 procedure wbr is
221 begin p(htf.wbr); end;
222
223 procedure center(ctext in varchar2) is
224 begin p(htf.center(ctext)); end;
225
226 procedure centerOpen is
227 begin p(htf.centerOpen); end;
228
229 procedure centerClose is
230 begin p(htf.centerClose); end;
231
232
233
234 procedure blockquoteOpen(cnowrap in varchar2 DEFAULT NULL,
235 cclear in varchar2 DEFAULT NULL,
236 cattributes in varchar2 DEFAULT NULL) is
237 begin p(htf.blockquoteOpen(cnowrap,cclear,cattributes)); end;
238
239 procedure blockquoteClose is
240 begin p(htf.blockquoteClose); end;
241
242 /* LIST tags */
243 procedure listHeader(ctext in varchar2,
244 cattributes in varchar2 DEFAULT NULL) is
245 begin p(htf.listHeader(ctext,cattributes)); end;
246
247 procedure listItem(ctext in varchar2 DEFAULT NULL,
248 cclear in varchar2 DEFAULT NULL,
249 cdingbat in varchar2 DEFAULT NULL,
250 csrc in varchar2 DEFAULT NULL,
251 cattributes in varchar2 DEFAULT NULL) is
252 begin p(htf.listItem(ctext,cclear,cdingbat,csrc,cattributes)); end;
253
254 procedure ulistOpen(cclear in varchar2 DEFAULT NULL,
255 cwrap in varchar2 DEFAULT NULL,
256 cdingbat in varchar2 DEFAULT NULL,
257 csrc in varchar2 DEFAULT NULL,
258 cattributes in varchar2 DEFAULT NULL) is
259 begin p(htf.ulistOpen(cclear,cwrap,cdingbat,csrc,cattributes)); end;
260
261 procedure ulistClose is
262 begin p(htf.ulistClose); end;
263
264 procedure olistOpen(cclear in varchar2 DEFAULT NULL,
265 cwrap in varchar2 DEFAULT NULL,
266 cattributes in varchar2 DEFAULT NULL) is
267 begin p(htf.olistOpen(cclear,cwrap,cattributes)); end;
268
269 procedure olistClose is
270 begin p(htf.olistClose); end;
271
272 procedure dlistOpen(cclear in varchar2 DEFAULT NULL,
273 cattributes in varchar2 DEFAULT NULL) is
274 begin p(htf.dlistOpen(cclear,cattributes)); end;
275
276 procedure dlistTerm(ctext in varchar2 DEFAULT NULL,
277 cclear in varchar2 DEFAULT NULL,
278 cattributes in varchar2 DEFAULT NULL) is
279 begin p(htf.dlistTerm(ctext,cclear,cattributes)); end;
280
281 procedure dlistDef(ctext in varchar2 DEFAULT NULL,
282 cclear in varchar2 DEFAULT NULL,
283 cattributes in varchar2 DEFAULT NULL) is
284 begin p(htf.dlistDef(ctext,cclear,cattributes)); end;
285
286 procedure dlistClose is
287 begin p(htf.dlistClose); end;
288
289 procedure menulistOpen is
290 begin p(htf.menulistOpen); end;
291
292 procedure menulistClose is
293 begin p(htf.menulistClose); end;
294
295 procedure dirlistOpen is
296 begin p(htf.dirlistOpen); end;
297
298 procedure dirlistClose is
299 begin p(htf.dirlistClose); end;
300 /* END LIST tags */
301
302 /* SEMANTIC FORMAT ELEMENTS */
303 procedure dfn(ctext in varchar2,
304 cattributes in varchar2 DEFAULT NULL) is
305 begin p(htf.dfn(ctext,cattributes)); end;
306
307 procedure cite(ctext in varchar2,
308 cattributes in varchar2 DEFAULT NULL) is
309 begin p(htf.cite(ctext,cattributes)); end;
310
311 procedure code(ctext in varchar2,
312 cattributes in varchar2 DEFAULT NULL) is
313 begin p(htf.code(ctext,cattributes)); end;
314
315 procedure em(ctext in varchar2,
316 cattributes in varchar2 DEFAULT NULL) is
317 begin p(htf.em(ctext,cattributes)); end;
318
319 procedure emphasis(ctext in varchar2,
320 cattributes in varchar2 DEFAULT NULL) is
321 begin p(htf.emphasis(ctext,cattributes)); end;
322
323 procedure kbd(ctext in varchar2,
324 cattributes in varchar2 DEFAULT NULL) is
325 begin p(htf.kbd(ctext,cattributes)); end;
326
327 procedure keyboard(ctext in varchar2,
328 cattributes in varchar2 DEFAULT NULL) is
329 begin p(htf.keyboard(ctext,cattributes)); end;
330
331 procedure sample(ctext in varchar2,
332 cattributes in varchar2 DEFAULT NULL) is
333 begin p(htf.sample(ctext,cattributes)); end;
334
335 procedure strong (ctext in varchar2,
336 cattributes in varchar2 DEFAULT NULL) is
337 begin p(htf.strong(ctext,cattributes)); end;
338
339 procedure variable(ctext in varchar2,
340 cattributes in varchar2 DEFAULT NULL) is
341 begin p(htf.variable(ctext,cattributes)); end;
342
343 procedure big( ctext in varchar2,
344 cattributes in varchar2 DEFAULT NULL) is
345 begin p(htf.big(ctext,cattributes)); end;
346
347 procedure small(ctext in varchar2,
348 cattributes in varchar2 DEFAULT NULL) is
349 begin p(htf.small(ctext,cattributes)); end;
350
351 procedure sub( ctext in varchar2,
352 calign in varchar2 DEFAULT NULL,
353 cattributes in varchar2 DEFAULT NULL) is
354 begin p(htf.sub(ctext,calign,cattributes)); end;
355
356 procedure sup( ctext in varchar2,
357 calign in varchar2 DEFAULT NULL,
358 cattributes in varchar2 DEFAULT NULL) is
359 begin p(htf.sup(ctext,calign,cattributes)); end;
360
361
362 /* END SEMANTIC FORMAT ELEMENTS */
363
364 /* PHYSICAL FORMAT ELEMENTS */
365 procedure basefont(nsize in integer) is
366 begin p(htf.basefont(nsize));end;
367
368 procedure fontOpen(ccolor in varchar2 DEFAULT NULL,
369 cface in varchar2 DEFAULT NULL,
370 csize in varchar2 DEFAULT NULL,
371 cattributes in varchar2 DEFAULT NULL) is
372 begin p(htf.fontOpen(ccolor,cface,csize,cattributes)); end;
373
374 procedure fontClose is
375 begin p(htf.fontClose); end;
376
377 procedure bold (ctext in varchar2,
378 cattributes in varchar2 DEFAULT NULL) is
379 begin p(htf.bold(ctext,cattributes)); end;
380
381 procedure italic (ctext in varchar2,
382 cattributes in varchar2 DEFAULT NULL) is
383 begin p(htf.italic(ctext,cattributes)); end;
384
385 procedure teletype(ctext in varchar2,
386 cattributes in varchar2 DEFAULT NULL) is
387 begin p(htf.teletype(ctext,cattributes)); end;
388
389 procedure plaintext(ctext in varchar2,
390 cattributes in varchar2 DEFAULT NULL) is
391 begin p(htf.plaintext(ctext,cattributes)); end;
392
393 procedure s(ctext in varchar2,
394 cattributes in varchar2 DEFAULT NULL) is
395 begin p(htf.s(ctext,cattributes)); end;
396
397 procedure strike (ctext in varchar2,
398 cattributes in varchar2 DEFAULT NULL) is
399 begin p(htf.strike(ctext,cattributes)); end;
400
401 procedure underline (ctext in varchar2,
402 cattributes in varchar2 DEFAULT NULL) is
403 begin p(htf.underline(ctext,cattributes)); end;
404
405 /* END PHYSICAL FORMAT ELEMENTS */
406
407 /* HTML FORMS */
408
409 procedure formOpen(curl in varchar2,
410 cmethod in varchar2 DEFAULT 'POST',
411 ctarget in varchar2 DEFAULT NULL,
412 cenctype in varchar2 DEFAULT NULL,
413 cattributes in varchar2 DEFAULT NULL) is
414 begin p(htf.formOpen(curl,cmethod,ctarget,cenctype,cattributes)); end;
415
416 procedure formCheckbox(cname in varchar2,
417 cvalue in varchar2 DEFAULT 'on',
418 cchecked in varchar2 DEFAULT NULL,
419 cattributes in varchar2 DEFAULT NULL) is
420 begin p(htf.formCheckbox(cname,cvalue,cchecked,cattributes)); end;
421
422 procedure formFile(cname in varchar2,
423 caccept in varchar2 DEFAULT NULL,
424 cattributes in varchar2 DEFAULT NULL) is
425 begin p(htf.formFile(cname,caccept,cattributes)); end;
426
427 procedure formHidden(cname in varchar2,
428 cvalue in varchar2 DEFAULT NULL,
429 cattributes in varchar2 DEFAULT NULL) is
430 begin p(htf.formHidden(cname,cvalue,cattributes)); end;
431
435 cattributes in varchar2 DEFAULT NULL) is
432 procedure formImage(cname in varchar2,
433 csrc in varchar2,
434 calign in varchar2 DEFAULT NULL,
436 begin p(htf.formImage(cname,csrc,calign,cattributes)); end;
437
438 procedure formPassword(cname in varchar2,
439 csize in varchar2 DEFAULT NULL,
440 cmaxlength in varchar2 DEFAULT NULL,
441 cvalue in varchar2 DEFAULT NULL,
442 cattributes in varchar2 DEFAULT NULL) is
443 begin p(htf.formPassword(cname,csize,cmaxlength,cvalue,cattributes)); end;
444
445 procedure formRadio(cname in varchar2,
446 cvalue in varchar2,
447 cchecked in varchar2 DEFAULT NULL,
448 cattributes in varchar2 DEFAULT NULL) is
449 begin p(htf.formRadio(cname,cvalue,cchecked,cattributes)); end;
450
451 procedure formReset(cvalue in varchar2 DEFAULT 'Reset',
452 cattributes in varchar2 DEFAULT NULL) is
453 begin p(htf.formReset(cvalue,cattributes)); end;
454
455 procedure formSubmit(cname in varchar2 DEFAULT NULL,
456 cvalue in varchar2 DEFAULT 'Submit',
457 cattributes in varchar2 DEFAULT NULL) is
458 begin p(htf.formSubmit(cname,cvalue,cattributes)); end;
459
460 procedure formText(cname in varchar2,
461 csize in varchar2 DEFAULT NULL,
462 cmaxlength in varchar2 DEFAULT NULL,
463 cvalue in varchar2 DEFAULT NULL,
464 cattributes in varchar2 DEFAULT NULL) is
465 begin p(htf.formText(cname,csize,cmaxlength,cvalue,cattributes)); end;
466
467 procedure formSelectOpen(cname in varchar2,
468 cprompt in varchar2 DEFAULT NULL,
469 nsize in integer DEFAULT NULL,
470 cattributes in varchar2 DEFAULT NULL) is
471 begin p(htf.formSelectOpen(cname,cprompt,nsize,cattributes)); end;
472
473 procedure formSelectOption(cvalue in varchar2,
474 cselected in varchar2 DEFAULT NULL,
475 cattributes in varchar2 DEFAULT NULL) is
476 begin p(htf.formSelectOption(cvalue,cselected,cattributes)); end;
477
478 procedure formSelectClose is
479 begin p(htf.formSelectClose); end;
480
481 procedure formTextarea(cname in varchar2,
482 nrows in integer,
483 ncolumns in integer,
484 calign in varchar2 DEFAULT NULL,
485 cattributes in varchar2 DEFAULT NULL) is
486 begin p(htf.formTextarea(cname,nrows,ncolumns,calign,cattributes)); end;
487
488
489 procedure formTextarea2(cname in varchar2,
490 nrows in integer,
491 ncolumns in integer,
492 calign in varchar2 DEFAULT NULL,
493 cwrap in varchar2 DEFAULT NULL,
494 cattributes in varchar2 DEFAULT NULL) is
495 begin p(htf.formTextarea2(cname,nrows,ncolumns,calign,cwrap,cattributes)); end;
496
497
498 procedure formTextareaOpen(cname in varchar2,
499 nrows in integer,
500 ncolumns in integer,
501 calign in varchar2 DEFAULT NULL,
502 cattributes in varchar2 DEFAULT NULL) is
503 begin p(htf.formTextareaOpen(cname,nrows,ncolumns,calign,cattributes)); end;
504
505
506 procedure formTextareaOpen2(cname in varchar2,
507 nrows in integer,
508 ncolumns in integer,
509 calign in varchar2 DEFAULT NULL,
510 cwrap in varchar2 DEFAULT NULL,
511 cattributes in varchar2 DEFAULT NULL) is
512 begin p(htf.formTextareaOpen2(cname,nrows,ncolumns,calign,cwrap,cattributes)); end;
513
514 procedure formTextareaClose is
515 begin p(htf.formTextareaClose); end;
516
517 procedure formClose is
518 begin p(htf.formClose); end;
519 /* END HTML FORMS */
520
521 /* HTML TABLES */
522 procedure tableOpen(cborder in varchar2 DEFAULT NULL,
523 calign in varchar2 DEFAULT NULL,
524 cnowrap in varchar2 DEFAULT NULL,
525 cclear in varchar2 DEFAULT NULL,
526 cattributes in varchar2 DEFAULT NULL) is
527 begin p(htf.tableOpen(cborder,calign,cnowrap,cclear,cattributes)); end;
528
529 procedure tableCaption(ccaption in varchar2,
530 calign in varchar2 DEFAULT NULL,
531 cattributes in varchar2 DEFAULT NULL) is
532 begin p(htf.tableCaption(ccaption,calign,cattributes)); end;
533
534 procedure tableRowOpen(calign in varchar2 DEFAULT NULL,
535 cvalign in varchar2 DEFAULT NULL,
536 cdp in varchar2 DEFAULT NULL,
537 cnowrap in varchar2 DEFAULT NULL,
538 cattributes in varchar2 DEFAULT NULL) is
539 begin p(htf.tableRowOpen(calign,cvalign,cdp,cnowrap,cattributes)); end;
540
541 procedure tableHeader(cvalue in varchar2 DEFAULT NULL,
542 calign in varchar2 DEFAULT NULL,
543 cdp in varchar2 DEFAULT NULL,
544 cnowrap in varchar2 DEFAULT NULL,
545 crowspan in varchar2 DEFAULT NULL,
546 ccolspan in varchar2 DEFAULT NULL,
547 cattributes in varchar2 DEFAULT NULL) is
548 begin p(htf.tableHeader(cvalue,calign,cdp,cnowrap,
552 calign in varchar2 DEFAULT NULL,
549 crowspan,ccolspan,cattributes)); end;
550
551 procedure tableData(cvalue in varchar2 DEFAULT NULL,
553 cdp in varchar2 DEFAULT NULL,
554 cnowrap in varchar2 DEFAULT NULL,
555 crowspan in varchar2 DEFAULT NULL,
556 ccolspan in varchar2 DEFAULT NULL,
557 cattributes in varchar2 DEFAULT NULL) is
558 begin p(htf.tableData(cvalue,calign,cdp,cnowrap,
559 crowspan,ccolspan,cattributes)); end;
560
561 procedure tableRowClose is
562 begin p(htf.tableRowClose); end;
563
564 procedure tableClose is
565 begin p(htf.tableClose); end;
566 /* END HTML TABLES */
567
568 /* BEGIN HTML FRAMES - Netscape Extensions FRAMESET, FRAME tags */
569 procedure framesetOpen( crows in varchar2 DEFAULT NULL, /* row height value list */
570 ccols in varchar2 DEFAULT NULL,
571 cattributes in varchar2 DEFAULT NULL) is /* column width list */
572 begin
573 p(htf.framesetOpen( crows, ccols, cattributes ));
574 end framesetOpen;
575
576 procedure framesetClose is
577 begin
578 p(htf.framesetClose);
579 end framesetClose;
580
581 procedure frame( csrc in varchar2, /* URL */
582 cname in varchar2 DEFAULT NULL, /* Window Name */
583 cmarginwidth in varchar2 DEFAULT NULL, /* Value in pixels */
584 cmarginheight in varchar2 DEFAULT NULL, /* Value in pixels */
585 cscrolling in varchar2 DEFAULT NULL, /* yes | no | auto */
586 cnoresize in varchar2 DEFAULT NULL,
587 cattributes in varchar2 DEFAULT NULL) is /* Not resizable by user */
588 begin
589 p(htf.frame( csrc, cname, cmarginwidth, cmarginheight, cscrolling, cnoresize, cattributes ));
590 end frame;
591
592 procedure noframesOpen is
593 begin
594 p(htf.noframesOpen);
595 end noframesOpen;
596
597 procedure noframesClose is
598 begin
599 p(htf.noframesClose);
600 end noframesClose;
601
602 /* END HTML FRAMES */
603
604 /* SPECIAL HTML TAGS */
605 procedure appletOpen( ccode in varchar2,
606 cwidth in integer,
607 cheight in integer,
608 cattributes in varchar2 DEFAULT NULL) is
609 begin p(htf.appletOpen(ccode,cwidth,cheight,cattributes));end;
610
611 procedure param( cname in varchar2,
612 cvalue in varchar2) is
613 begin p(htf.param(cname,cvalue));end;
614
615 procedure appletClose is
616 begin p(htf.appletClose);end;
617
618 /* END SPECIAL HTML TAGS */
619
620
621 /* SPECIAL PROCEDURES */
622 function getContentLength return number is
623 len binary_integer := 0;
624 nFromIx binary_integer;
625 begin
626 nFromIx := nEndOfHdrIx + 1;
627 for nIx in nFromIx..rows_in
628 loop
629 len := len + lengthb(htbuf(nIx)); -- use lengthb to get in bytes
630 end loop;
631 return(len);
632 end getContentLength;
633
634 procedure init is
635 begin
636 rows_in := 0;
637 rows_out := 0;
638 htbuf.delete;
639 htcurline := '';
640
641 bAddDefaultHTMLHdr := TRUE;
642 bHTMLPageReady := FALSE;
643 bHasHTMLHdr := FALSE;
644 bHasContentLength := FALSE;
645 nEndOfHdrIx := -1;
646 nContentLengthIx := -1;
647
648 sDownloadFilesList := '';
649 nCompressDownloadFiles := 0;
650
651 addDefaultHTMLHdr(TRUE);
652 end init;
653
654 procedure flush is
655 begin
656 if (htcurline is not null)
657 then
658 rows_in := rows_in + 1;
659 htbuf(rows_in) := htcurline;
660 htcurline := '';
661 end if;
662 if (not bHTMLPageReady)
663 then
664 if (nEndOfHdrIx < 0) -- how come?
665 then
666 nEndOfHdrIx := rows_in;
667 end if;
668 if (nContentLengthIx > 0)
669 then
670 htbuf(nContentLengthIx) := 'Content-length: '
671 || getContentLength || NL_CHAR;
672 end if;
673 bHTMLPageReady := TRUE;
674 end if;
675 end flush;
676
677 function get_line (irows out integer) return varchar2 is
678 cnt number;
679 begin
680 flush;
681
682 cnt := rows_in - rows_out;
683
684 if (cnt > 1)
685 then
686 irows := 1;
687 else
688 irows := 0;
689 if (cnt < 1)
690 then
691 return(NULL);
692 end if;
693 end if;
694
695 rows_out := rows_out + 1;
696 return(htbuf(rows_out));
697 end;
698
699 procedure get_page (thepage out htbuf_arr,
700 irows in out integer ) is
701 begin
702 flush;
703
704 irows := least(irows, rows_in - rows_out);
705 if (irows = 0)
706 then
707 return;
708 end if;
709
710 for i in 1..irows
711 loop
712 thepage(i) := htbuf(rows_out + i);
713 end loop;
714
715 rows_out := rows_out + irows;
716 end;
717
718 procedure showpage is
719 dbms_buf_size integer;
720
721 buffer varchar2(510); /* size = 255 * 2 */
722 i integer;
723
724 sp_loc integer;
725 nl_loc integer;
726 begin
727 /* First figure out how large to make the dbms_output buffer */
728 dbms_buf_size := (rows_in - rows_out)*255;
729 if (dbms_buf_size > 1000000)
730 then
731 dbms_output.enable(1000000);
732 else
733 dbms_output.enable(dbms_buf_size);
737 /* never getting larger than 510 characters. */
734 end if;
735
736 /* Now, loop through, adding lines from htbuf, but */
738 /* If a newline is found, print everything and clear */
739 /* the buffer, otherwise, break on the last space */
740 /* possible. If the last space is past 255 chars, */
741 /* or there is no space at all, then break on 255. */
742 flush;
743
744 buffer := NULL;
745 i := rows_out + 1;
746 while (i <= rows_in)
747 loop
748 if (nvl(length(buffer),0) <= 255)
749 then
750 buffer := buffer || htbuf(i);
751 i := i + 1;
752 end if;
753
754 nl_loc := instr(buffer, NL_CHAR, -1);
755 if (nl_loc = 0)
756 then
757 sp_loc := instr(buffer, ' ', -1);
758 if (sp_loc = 0)
759 then
760 dbms_output.put_line(substr(buffer, 1, 255));
761 buffer := substr(buffer,256);
762 else
763 if (sp_loc <= 255)
764 then
765 dbms_output.put_line(substr(buffer, 1, sp_loc - 1));
766 buffer := substr(buffer, sp_loc + 1);
767 else /* sp_loc > 255 */
768 dbms_output.put_line(substr(buffer, 1, 255));
769 buffer := substr(buffer, 256);
770 end if;
771 end if;
772 else
773 /* Always strip out the newlines */
774 /* PUT_LINE will put them in. */
775 if (nl_loc <= 255)
776 then
777 dbms_output.put_line(substr(buffer, 1, nl_loc - 1));
778 buffer := substr(buffer, nl_loc + 1);
779 else /* nl_loc > 255 */
780 dbms_output.put_line(substr(buffer, 1, 255));
781 buffer := substr(buffer, 256);
782 end if;
783 end if;
784 end loop;
785
786 rows_out := rows_in;
787 end;
788
789 procedure download_file(sFileName in varchar2,
790 bCompress in boolean default false) is
791 begin
792 if (sDownloadFilesList is NULL)
793 then
794 sDownLoadFilesList := sFileName;
795 if (bCompress)
796 then
797 nCompressDownloadFiles := 1;
798 else
799 nCompressDownloadFiles := 0;
800 end if;
801 end if;
802 end;
803
804 procedure get_download_files_list(sFilesList out varchar2,
805 nCompress out binary_integer) is
806 begin
807 sFilesList := sDownloadFilesList;
808 nCompress := nCompressDownloadFiles;
809 end;
810
811 function isHTMLHdr(cbuf in varchar2) return boolean is
812 len number := length(cbuf);
813 begin
814 return
815 ((len >= nContentTypeLen
816 and sContentType = substr(cbuf, 1, nContentTypeLen))
817 or (len >= nContentLengthLen
818 and sContentLength = substr(cbuf, 1, nContentLengthLen))
819 or (len >= nLocationLen
820 and sLocation = substr(cbuf, 1, nLocationLen))
821 or (len >= nStatusLen
822 and sStatus = substr(cbuf, 1, nStatusLen))
823 );
824 end isHTMLHdr;
825
826 procedure addDefaultHTMLHdr(bAddHTMLHdr boolean) is
827 begin
828 bAddDefaultHTMLHdr := bAddHTMLHdr;
829 end addDefaultHTMLHdr;
830
831 procedure prn(cbuf in varchar2 DEFAULT NULL) is
832 bSeenNL boolean;
833 loc number;
834 len number;
835 tlen number;
836 begin
837 if (cbuf is NULL)
838 then
839 return;
840 end if;
841
842 if (rows_in = 0)
843 then
844 if (bAddDefaultHTMLHdr)
845 then
846 bHTMLPageReady := FALSE;
847 bHasContentLength := FALSE;
848 nEndOfHdrIx := -1;
849 nContentLengthIx := -1;
850 -- Check for HTML headers
851 bHasHTMLHdr := isHTMLHdr(upper(cbuf));
852 if (not bHasHTMLHdr)
853 then
854 -- add Content-type: text/html; charset=
855 rows_in := rows_in + 1;
856 htbuf(rows_in) := 'Content-type: ' || sTextHtml || '; charset=' ||
857 owa_util.get_cgi_env('REQUEST_IANA_CHARSET') || NL_CHAR;
858 -- reserve space for Content-length: header
859 rows_in := rows_in + 1;
860 nContentLengthIx := rows_in;
861 rows_in := rows_in + 1;
862 htbuf(rows_in) := NL_CHAR;
863 nEndOfHdrIx := rows_in;
864 bHasContentLength := TRUE;
865 end if;
866 else
867 bHTMLPageReady := TRUE;
868 end if;
869 end if;
870
871 len := length(cbuf);
872 if (not bHTMLPageReady)
873 then
874 -- We assume that 'pack_after' is sufficiently large that we won't be
875 -- packing HTML headers.
876 -- We also assume that end of headers request will be by itself
877 if (nEndOfHdrIx < 0) -- we have not seen end of headers yet
878 then
879 if (len >= nContentLengthLen
880 and sContentLength = substr(upper(cbuf), 1, nContentLengthLen))
881 then
882 bHasContentLength := TRUE;
883 end if;
884 if ((cbuf = NL_CHAR
885 and (rows_in > 0
886 and substr(htbuf(rows_in), length(htbuf(rows_in)), 1)
890 if (not bHasContentLength)
887 = NL_CHAR)
888 ) or (instr(cbuf, NLNL_CHAR, -1) != 0))
889 then -- we now have seen!
891 then
892 -- reserve space for Content-length: header
893 rows_in := rows_in + 1;
894 nContentLengthIx := rows_in;
895 end if;
896 nEndOfHdrIx := (rows_in + 1);
897 bHasContentLength := TRUE;
898 end if;
899 end if;
900 end if;
901
902 loc := 0;
903 if (rows_in < pack_after) then
904 while ((len - loc) >= HTBUF_LEN)
905 loop
906 rows_in := rows_in + 1;
907 htbuf(rows_in) := substr(cbuf, loc + 1, HTBUF_LEN);
908 loc := loc + HTBUF_LEN;
909 end loop;
910 if (loc < len)
911 then
912 rows_in := rows_in + 1;
913 htbuf(rows_in) := substr(cbuf, loc + 1);
914 end if;
915 return;
916 end if;
917
918 -- calculate remaining buffer size
919 if (htcurline is null)
920 then
921 tlen := HTBUF_LEN;
922 else
923 tlen := HTBUF_LEN - length(htcurline);
924 end if;
925
926 while (loc < len)
927 loop
928 if ((len - loc) <= tlen)
929 then
930 if (loc = 0)
931 then
932 htcurline := htcurline || cbuf;
933 else
934 htcurline := htcurline || substr(cbuf, loc + 1);
935 end if;
936 exit;
937 end if;
938 rows_in := rows_in + 1;
939 htbuf(rows_in) := htcurline || substr(cbuf, loc + 1, tlen);
940 htcurline := '';
941 loc := loc + tlen;
942 tlen := HTBUF_LEN; -- remaining buffer size
943 end loop;
944 end;
945
946 procedure print (cbuf in varchar2 DEFAULT NULL) is
947 begin
948 prn(cbuf || '
949 ');
950 /* The above broken line is intentional. Do not modify */
951 end;
952
953 procedure print (dbuf in date) is
954 begin print(to_char(dbuf)); end;
955
956 procedure print (nbuf in number) is
957 begin print(to_char(nbuf)); end;
958
959 procedure prn (dbuf in date) is
960 begin prn(to_char(dbuf)); end;
961
962 procedure prn (nbuf in number) is
963 begin prn(to_char(nbuf)); end;
964
965 procedure p (cbuf in varchar2 DEFAULT NULL) is
966 begin print(cbuf); end;
967
968 procedure p (dbuf in date) is
969 begin print(to_char(dbuf)); end;
970
971 procedure p (nbuf in number) is
972 begin print(to_char(nbuf)); end;
973
974 procedure prints(ctext in varchar2) is
975 begin p(htf.escape_sc(ctext)); end;
976
977 procedure ps(ctext in varchar2) is
978 begin p(htf.escape_sc(ctext)); end;
979
980 procedure escape_sc(ctext in varchar2) is
981 begin p(htf.escape_sc(ctext)); end;
982 /* END SPECIAL PROCEDURES */
983
984 begin
985 init;
986 end;