1 package body WFE_HTML_UTIL as
2 /* $Header: wfehtmb.pls 120.4 2005/11/08 00:43:44 nravindr ship $ */
3
4 -- Private Type
5 type spanRecType is record (
6 level number,
7 span number
8 );
9
10 type spanTabType is table of spanRecType index by binary_integer;
11
12 --
13 -- Error (PRIVATE)
14 -- Print a page with an error message.
15 -- Errors are retrieved from these sources in order:
16 -- 1. wf_core errors
17 -- 2. Oracle errors
18 -- 3. Unspecified INTERNAL error
19 --
20 procedure Error
21 as
22 begin
23 null;
24 end Error;
25
26
27 --
28 -- RenderTitle (PRIVATE)
29 -- print out html code for the title
30 --
31 procedure RenderTitle (
32 headerTab headerTabType,
33 spanTab spanTabType,
34 include_select boolean,
35 include_delete boolean,
36 detail_index pls_integer default 0,
37 edit_index pls_integer default 0,
38 title_start pls_integer default 0,
39 level number default null
40 )
41 is
42 i pls_integer;
43 k pls_integer;
44
45 prev_level pls_integer;
46
47 include_edit boolean;
48 include_detail boolean;
49
50 openrowcount pls_integer := 0;
51
52 begin
53 if (headerTab.COUNT = 0) then
54 return; -- do not do anything if nothing to render
55 end if;
56
57 include_edit := (edit_index > 0);
58 include_detail := (detail_index > 0);
59
60 if (spanTab.COUNT = 0) then
61 -- simple table
62 openrowcount := openrowcount + 1;
63
64 for i in title_start..headerTab.COUNT loop
65 -- include the row attribute here for the first data
66 if (i=title_start) then
67 if (headerTab(i).trattr is null) then
68 htp.tableRowOpen(cattributes=>'bgcolor=#006699');
69 else
70 htp.p('<TR '||headerTab(i).trattr||'>');
71 end if;
72 end if;
73
74 -- only include select before the first column
75 if (i=title_start and include_select) then
76 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
77 wf_core.translate('SELECT')||'</font>',
78 calign=>'Center',
79 cattributes=>'ID="' || wf_core.translate('SELECT') || '"');
80 end if;
81
82 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
83 headerTab(i).value||'</font>',
84 calign=>'Center',
85 cattributes=>'ID="' || headerTab(i).value || '"');
86 end loop;
87 else
88 prev_level := -1;
89 k := 0;
90 -- group by table
91 for i in title_start..headerTab.COUNT loop
92 if (level is null or headerTab(i).level is null or
93 level = headerTab(i).level) then
94 if (headerTab(i).level is null or headerTab(i).level = 0) then
95 if (prev_level = -1 or prev_level <> headerTab(i).level) then
96 -- multi level
97 if (prev_level <> -1) then
98 htp.tableRowClose;
99 openrowcount := openrowcount - 1;
100 end if;
101 prev_level := headerTab(i).level;
102
103 if (headerTab(i).trattr is null) then
104 htp.tableRowOpen(cattributes=>'bgcolor=#006699');
105 else
106 htp.p('<TR '||headerTab(i).trattr||'>');
107 end if;
108 openrowcount := openrowcount + 1;
109
110 -- only include select before the first column
111 if (include_select) then
112 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
113 wf_core.translate('SELECT')||'</font>',
114 calign=>'Center',
115 cattributes=>'id="' || wf_core.translate('SELECT') ||'"');
116 end if;
117 end if;
118
119 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
120 headerTab(i).value||'</font>',
121 calign=>'Center',
122 cattributes=>headerTab(i).attr);
123 elsif (headerTab(i).level <= 0 or
124 headerTab(i).level > spanTab.COUNT) then
125 null; -- ignore such data
126 else
127 k := k+1;
128
129 -- this is first multi level
130 if (prev_level <> headerTab(i).level) then
131 -- close the previous level row
132 if (prev_level <> -1) then
133 htp.tableRowClose;
134 openrowcount := openrowcount - 1;
135 end if;
136
137 if (headerTab(i).trattr is null) then
138 htp.tableRowOpen(cattributes=>'bgcolor=#006699');
139 else
140 htp.p('<TR '||headerTab(i).trattr||'>');
141 end if;
142
143 openrowcount := openrowcount + 1;
144 prev_level := headerTab(i).level;
145 end if;
146 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
147 headerTab(i).value||'</font>',
148 calign=>'Center',
149 ccolspan=>to_char(spanTab(k).span),
150 cattributes=>headerTab(i).attr);
151 end if;
152 end if; -- level matched
153 end loop;
154 end if;
155
156 -- if show all levels or show level 0
157 if (level is null or level = 0) then
158 -- place these titles at the end
159 if (include_detail) then
160 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
161 headerTab(detail_index).value||'</font>',
162 calign=>'Center',
163 cattributes=>'id="' || headerTab(detail_index).value || '"');
164 end if;
165
166 -- include the edit title
167 if (include_edit) then
168 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
169 headerTab(edit_index).value||'</font>',
170 calign=>'Center',
171 cattributes=>'id="' || headerTab(edit_index).value || '"');
172 end if;
173
174 -- place the delete to the very end
175 if (include_delete) then
176 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
177 wf_core.translate('DELETE')||'</font>',
178 calign=>'Center',
179 cattributes=>'id="' || wf_core.translate('DELETE') ||'"');
180 end if;
181 end if;
182
183 if (openrowcount > 0) then
184 htp.tableRowClose;
185 openrowcount := openrowcount - 1;
186 end if;
187
188 exception
189 when OTHERS then
190 rollback;
191 wf_core.context('WFE_HTML_UTIL', 'RenderTitle');
192 wfe_html_util.Error;
193 end RenderTitle;
194
195 --
196 -- headerTab orders
197 -- FUNCTION
198 -- 1. Delete
199 -- 2. Detail
200 -- 3. Edit
201 -- TITLE
202 -- 1. Title for Detail Column
203 -- 2. Title for Edit Column (if func_edit is defined, otherwise it is
204 -- the beginning of the rest of the titles)
205 -- 3-X. Rest of the titles with descending level (e.g. 2, 1, 0)
206 --
207 -- NOTE
208 -- Set the color for the row in trattr
209 -- For headers, it tooks the definition for the first column not
210 -- counting the special columns above.
211 --
212 -- Set showtitle to TRUE if you want to show the title instead of a data
213 --
214 --
215 -- MODIFICATION LOG:
216 -- 06-JUN-2001 JWSMITH BUG 1819232 - ADA Enhancement
217 -- - Added alt attr for IMG tag for ADA
218 -- - Added component to dataTable - tdattr to pass in table data
219 -- tag attributes.
220 --
221 procedure Simple_Table (
222 headerTab headerTabType,
223 dataTab dataTabType,
224 tabattr varchar2 default null,
225 show_1st_title boolean default TRUE,
226 show_level number default null
227 )
228 is
229 i pls_integer;
230 j pls_integer;
231 k pls_integer;
232 m pls_integer;
233
234 funccnt pls_integer := 0;
235 colmcnt pls_integer := 0;
236 colmcnt2 pls_integer := 0;
237 title_start pls_integer;
238 func_delete varchar2(4000);
239 func_detail varchar2(4000);
240 func_edit varchar2(4000);
241 include_select boolean := FALSE;
242 include_delete boolean := FALSE;
243 include_detail boolean := TRUE; -- always include detail now
244
245 detail_index pls_integer := 0;
246 edit_index pls_integer := 0;
247
248 spanTab spanTabType;
249 totalcol pls_integer := 0;
250 prev_level pls_integer;
251 show boolean := TRUE;
252 hascspan boolean := FALSE;
253 l_td varchar2(240); -- table data tag content
254
255 l_tabattr varchar2(2000); -- table attributes
256 begin
257 -- do not render table if both header and data are empty
258 if (headerTab.COUNT = 0 and dataTab.COUNT = 0) then
259 return;
260 end if;
261
262 -- calculate the function, column count and initial spancol values from
263 -- the header table
264 --
265 -- Example
266 -- | Del F | Dtl F | Edt F | Dtl T | Edt T | T | T | T |
267 -- ^
268 -- title_start
269 -- funccnt = 1 2 3
270 -- colmcnt = 0 -1 -2 -1 0 1 2 3
271 --
272 k := 0;
273 if (headerTab.COUNT <> 0) then
274 for i in 1..headerTab.COUNT loop
275 if (headerTab(i).def_type = 'FUNCTION') then
276 funccnt := funccnt + 1;
277 if (funccnt = 1) then
278 func_delete := headerTab(i).value;
279 elsif (funccnt = 2) then
280 func_detail := headerTab(i).value;
281 colmcnt := -1; -- remove Detail column title
282 elsif (funccnt = 3) then
283 func_edit := headerTab(i).value;
284 colmcnt := -2; -- remove both Detail and Edit column titles
285 else
286 colmcnt := 1 - funccnt; -- remove defined and custom function titles
287 end if;
288 elsif (headerTab(i).def_type = 'TITLE') then
289 colmcnt := colmcnt + 1;
290
291 if (title_start is null) then
292 title_start := i;
293 end if;
294
295 -- record the initial colspan value
296 if (headerTab(i).level is null or headerTab(i).level > 0) then
297 k := k+1;
298 spanTab(k).level := headerTab(i).level;
299 spanTab(k).span := nvl(headerTab(i).span, 0);
300
301 -- record the total level 0 column count
302 else
303 totalcol := totalcol + 1;
304 end if;
305 end if;
306 end loop;
307 end if;
308
309 -- Determine what titles should be included
310 if (dataTab.COUNT <> 0) then
311 for i in 1..dataTab.COUNT loop
312 if (dataTab(i).selectable) then
313 include_select := TRUE;
314 end if;
315 if (dataTab(i).deletable) then
316 include_delete := TRUE;
317 end if;
318
319 exit when (include_select and include_delete and include_detail);
320 end loop;
321 end if;
322
323 -- no detail is no detail function
324 if (func_detail is null) then
325 include_detail := FALSE;
326 end if;
327
328 -- now we resolve all the include criteria, we can update the spanTab
329 --
330 -- +----------------+--
331 -- | colspan=span+1 | ... when select is included
332 -- +----------------+--
333 --
334 if (spanTab.COUNT <> 0) then
335 prev_level := -1;
336 for k in 1..spanTab.COUNT loop
337 i := 0; -- index of last column of previous level.
338 -- 0 means it is not the last column
339
340 -- add 1 to the colspan of the first column if select is included
341 if (spanTab(k).level <> prev_level) then
342 if (include_select) then
343 spanTab(k).span := spanTab(k).span + 1;
344 end if;
345 prev_level := spanTab(k).level;
346
347 if (k <> 1) then
348 i := k-1; -- index of last column of previous level
349
350 -- handle a corner case when this is the only element
351 elsif (k = 1 and k = spanTab.COUNT) then
352 i := k;
353 end if;
354
355 -- also handle a corner case if this is the last element
356 elsif (k = spanTab.COUNT) then
357 i := k;
358 end if;
359
360 -- For the last column
361 -- --+--------------------+
362 -- ... | colspan = span + x | where x is sum of detail, delete and edit
363 -- --+--------------------+ columns.
364 --
365 -- update the colspan of the last column
366 if (i <> 0) then
367 if (include_detail) then
368 spanTab(i).span := spanTab(i).span + 1;
369 end if;
370 if (include_delete) then
371 spanTab(i).span := spanTab(i).span + 1;
372 end if;
373 if (func_edit is not null) then
374 spanTab(i).span := spanTab(i).span + 1;
375 end if;
376 end if;
377
378 end loop; -- for spanTab
379 end if;
380
381 -- Render the Table
382 if (tabattr is not null) then
383 l_tabattr := tabattr;
384 else
385 l_tabattr := 'border=1 cellpadding=3 bgcolor=white width=100% summary=""';
386 end if;
387
388 htp.tableOpen(cattributes=>l_tabattr);
389
390 -- calculate the title_start
391 -- 1. Have nothing
392 -- title_start is correct, no recalculation
393 --
394 -- 2. Have Detail
395 -- |Detail| | ...
396 -- ^
397 -- title start here
398 --
399 -- 3. Have Edit but detail function is null
400 -- funccnt > 2, because it has at least "Delete" and "Detail", even
401 -- though detail_func is null.
402 -- ... |Edit| | ...
403 -- ^
404 -- title start here
405 --
406 -- Column headers
407 if (headerTab.COUNT <> 0) then
408 if (include_detail) then
409 detail_index := title_start;
410 title_start := title_start + 1;
411
412 -- detail_func is null, but there is edit
413 elsif (funccnt > 2) then
414 title_start := title_start + 1;
415 end if;
416
417 if (func_edit is not null) then
418 edit_index := title_start;
419 title_start := title_start + 1; -- may not have edit title
420 end if;
421 end if;
422
423 -- Render title
424 if (show_1st_title) then
425 Wfe_Html_Util.RenderTitle(headerTab, spanTab,
426 include_select, include_delete,
427 detail_index, edit_index,
428 title_start, show_level);
429 end if;
430
431 prev_level := -1;
432 -- render the data portion only if there are rows.
433 if (dataTab.COUNT <> 0) then
434 for i in 1..dataTab.COUNT loop
435 -- render title here
436 if (dataTab(i).showtitle is not null and dataTab(i).showtitle) then
437 Wfe_Html_Util.RenderTitle(headerTab, spanTab,
438 include_select, include_delete,
439 detail_index, edit_index,
440 title_start, dataTab(i).level);
441
442 -- normal data
443 else
444
445 -- if attribute for TR tag is defined, use it.
446 if (dataTab(i).trattr is null) then
447 htp.tableRowOpen(null, 'TOP');
448 else
449 htp.p('<TR '||dataTab(i).trattr||'>');
450 end if;
451
452 if (spanTab.COUNT = 0 or dataTab(i).level is null or
453 dataTab(i).level = 0) then
454
455 if (include_select) then
456 if (dataTab(i).selectable) then
457 htp.tableData(htf.formCheckbox(cname=>'h_guids',
458 cvalue=>dataTab(i).guid,
459 cattributes=>'id="i_select'||i||'"'),
460 'CENTER',cattributes=>'id=""');
461 else
462 htp.tableData(' ',cattributes=>'id=""');
463 end if;
464 end if;
465 hascspan := FALSE;
466 show := TRUE;
467 elsif (dataTab(i).level <= 0) then
468 show := FALSE; -- ignore such data
469 hascspan := FALSE;
470 else
471 hascspan := TRUE;
472 show := TRUE;
473 end if;
474
475 if (show) then
476 -- set k to the index before the firs spanTab item on the same level
477 k := 0;
478 for j in 1..spanTab.COUNT loop
479 if (dataTab(i).level = spanTab(j).level) then
480 k := j-1;
481 exit;
482 end if;
483 end loop;
484
485 -- align the attribute column with level
486 -- m will eventually be the real starting column
487 j := 1;
488 m := title_start+j-1;
489
490 while (headerTab(m).level is not null and
491 dataTab(i).level is not null and
492 headerTab(m).level > dataTab(i).level) loop
493 m := m+1;
494 end loop;
495
496 -- adjust the column count as well, so it won't overflow
497 colmcnt2 := colmcnt - (m - (title_start+j-1));
498
499 for j in 1..colmcnt2 loop
500 l_td := '<TD ';
501
502 -- JWSMITH bug 1819232 ADA Enhancement, add tdattr
503 if (headerTab(m+j-1).attr is null) then
504 l_td := l_td||'ALIGN=LEFT' || dataTab(i).tdattr;
505 else
506 l_td := REPLACE(UPPER(l_td||headerTab(m+j-1).attr),
507 'ID=', 'HEADERS=') || ' ' || dataTab(i).tdattr;
508 end if;
509
510
511 -- allow null col01 for indentation
512 if (j = 1 /* and dataTab(i).col01 */) then
513 if (hascspan) then
514 k := k+1;
515 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span);
516 end if;
517 l_td := l_td||'>';
518 htp.p(l_td);
519 htp.p(dataTab(i).col01);
520 htp.p('</TD>');
521 elsif (j = 2 and dataTab(i).col02 is not null) then
522 if (hascspan) then
523 k := k+1;
524 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span);
525 end if;
526 l_td := l_td||'>';
527 htp.p(l_td);
528 htp.p(dataTab(i).col02);
529 htp.p('</TD>');
530 elsif (j = 3 and dataTab(i).col03 is not null) then
531 if (hascspan) then
532 k := k+1;
533 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
534 ' BGCOLOR=#99CCFF';
535 end if;
536 l_td := l_td||'>';
537 htp.p(l_td);
538 htp.p(dataTab(i).col03);
539 htp.p('</TD>');
540 elsif (j = 4 and dataTab(i).col04 is not null) then
541 if (hascspan) then
542 k := k+1;
543 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
544 ' BGCOLOR=#99CCFF';
545 end if;
546 l_td := l_td||'>';
547 htp.p(l_td);
548 htp.p(dataTab(i).col04);
549 htp.p('</TD>');
550 elsif (j = 5 and dataTab(i).col05 is not null) then
551 if (hascspan) then
552 k := k+1;
553 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
554 ' BGCOLOR=#99CCFF';
555 end if;
556 l_td := l_td||'>';
557 htp.p(l_td);
558 htp.p(dataTab(i).col05);
559 htp.p('</TD>');
560 elsif (j = 6 and dataTab(i).col06 is not null) then
561 if (hascspan) then
562 k := k+1;
563 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
564 ' BGCOLOR=#99CCFF';
565 end if;
566 l_td := l_td||'>';
567 htp.p(l_td);
568 htp.p(dataTab(i).col06);
569 htp.p('</TD>');
570 elsif (j = 7 and dataTab(i).col07 is not null) then
571 if (hascspan) then
572 k := k+1;
573 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
574 ' BGCOLOR=#99CCFF';
575 end if;
576 l_td := l_td||'>';
577 htp.p(l_td);
578 htp.p(dataTab(i).col07);
579 htp.p('</TD>');
580 elsif (j = 8 and dataTab(i).col08 is not null) then
581 if (hascspan) then
582 k := k+1;
583 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
584 ' BGCOLOR=#99CCFF';
585 end if;
586 l_td := l_td||'>';
587 htp.p(l_td);
588 htp.p(dataTab(i).col08);
589 htp.p('</TD>');
590 elsif (j = 9 and dataTab(i).col09 is not null) then
591 if (hascspan) then
592 k := k+1;
593 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
594 ' BGCOLOR=#99CCFF';
595 end if;
596 l_td := l_td||'>';
597 htp.p(l_td);
598 htp.p(dataTab(i).col09);
599 htp.p('</TD>');
600 elsif (j = 10 and dataTab(i).col10 is not null) then
601 if (hascspan) then
602 k := k+1;
603 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
604 ' BGCOLOR=#99CCFF';
605 end if;
606 l_td := l_td||'>';
607 htp.p(l_td);
608 htp.p(dataTab(i).col10);
609 htp.p('</TD>');
610 elsif (j = 11 and dataTab(i).col11 is not null) then
611 if (hascspan) then
612 k := k+1;
613 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
614 ' BGCOLOR=#99CCFF';
615 end if;
616 l_td := l_td||'>';
617 htp.p(l_td);
618 htp.p(dataTab(i).col11);
619 htp.p('</TD>');
620 elsif (j = 12 and dataTab(i).col12 is not null) then
621 if (hascspan) then
622 k := k+1;
623 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
624 ' BGCOLOR=#99CCFF';
625 end if;
626 l_td := l_td||'>';
627 htp.p(l_td);
628 htp.p(dataTab(i).col12);
629 htp.p('</TD>');
630 elsif (j = 13 and dataTab(i).col13 is not null) then
631 if (hascspan) then
632 k := k+1;
633 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
634 ' BGCOLOR=#99CCFF';
635 end if;
636 l_td := l_td||'>';
637 htp.p(l_td);
638 htp.p(dataTab(i).col13);
639 htp.p('</TD>');
640 elsif (j = 14 and dataTab(i).col14 is not null) then
641 if (hascspan) then
642 k := k+1;
643 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
644 ' BGCOLOR=#99CCFF';
645 end if;
646 l_td := l_td||'>';
647 htp.p(l_td);
648 htp.p(dataTab(i).col14);
649 htp.p('</TD>');
650 elsif (j = 15 and dataTab(i).col15 is not null) then
651 if (hascspan) then
652 k := k+1;
653 l_td := l_td||' COLSPAN='||to_char(spanTab(k).span)||
654 ' BGCOLOR=#99CCFF';
655 end if;
656 l_td := l_td||'>';
657 htp.p(l_td);
658 htp.p(dataTab(i).col15);
659 htp.p('</TD>');
660 end if;
661 end loop;
662 end if; -- show
663
664 -- Place these columns at the end
665 -- Detail (subscription) Column
666 if (spanTab.COUNT = 0 or dataTab(i).level is null or
667 dataTab(i).level = 0) then
668 if (include_detail) then
669 if (dataTab(i).hasdetail) then
670 htp.tableData(htf.anchor2(
671 curl=>wfa_html.base_url||'/'||func_detail||
672 rawtohex(dataTab(i).guid),
673 ctext=>'<IMG SRC="'||
674 wfa_html.image_loc||'i_evsub.gif"
675 alt="' || wf_core.translate('WFE_EDIT_SUBSC_TITLE') || '"
676 BORDER=0>'),
677 'CENTER', cattributes=>'valign="MIDDLE" id=""');
678 else
679 htp.tableData(htf.anchor2(
680 curl=>wfa_html.base_url||'/'||func_detail||
681 rawtohex(dataTab(i).guid),
682 ctext=>'<IMG SRC="'||
683 wfa_html.image_loc||'i_evsub2.gif"
684 alt="' || wf_core.translate('WFE_ADD_SUBSCRIPTION') || '"
685 BORDER=0>'),
686 'CENTER', cattributes=>'valign="MIDDLE" id=""');
687 end if;
688 end if;
689
690 -- Edit Column
691 if (func_edit is not null) then
692 htp.tableData(htf.anchor2(
693 curl=>wfa_html.base_url||'/'||func_edit||
694 rawtohex(dataTab(i).guid),
695 ctext=>'<IMG SRC="'||
696 wfa_html.image_loc||'i_edit.gif"
697 alt="' || wf_core.translate('EDIT') || '" BORDER=0>'),
698 'CENTER', cattributes=>'valign="MIDDLE" id=""');
699
700 end if;
701
702 -- place the delete at the very end
703 if (include_delete) then
704 if (dataTab(i).deletable) then
705 htp.tableData(htf.anchor2(
706 curl=>'javascript:confirm_url('''||
707 wf_core.translate('WFE_OK_DELETE')||''','''||
708 wfa_html.base_url||'/'||func_delete||
709 rawtohex(dataTab(i).guid)||''')',
710 ctext=>'<IMG SRC="'||
711 wfa_html.image_loc||'i_del.gif"
712 alt="' || wf_core.translate('DELETE') || '"BORDER=0>'),
713 'CENTER', cattributes=>'valign="MIDDLE" id=""');
714 else
715 htp.tableData(' ',cattributes=>'id=""');
716 end if;
717 end if; -- include_delete
718
719 end if; -- spanTab
720
721 htp.tableRowClose;
722
723 end if; -- title/normal data
724
725 end loop; -- dataTab
726
727 end if; -- dataTab has rows
728
729 htp.tableClose;
730
731 -- if no row, put a page break here
732 if (dataTab.COUNT = 0) then
733 htp.br;
734 end if;
735
736 exception
737 when OTHERS then
738 rollback;
739 wf_core.context('WFE_HTML_UTIL', 'Simple_Table');
740 wfe_html_util.Error;
741 end Simple_Table;
742
743
744 --
745 -- generate_check_all
746 -- generate the javascript to check all the check boxes
747 -- IN
748 -- p_jscript_tag - if 'Y' generate the SCRIPT tag
749 --
750 procedure generate_check_all (
751 p_jscript_tag in varchar2 default 'Y'
752 )
753 is
754 begin
755 if (p_jscript_tag = 'Y') then
756 htp.p('<SCRIPT LANGUAGE="JavaScript">');
757 htp.p('<!-- Hide from old browsers');
758 end if;
759
760 htp.p('function checkAll(field) {
761 for (i = 0; i < field.length; i++)
762 field[i].checked = true;
763 }');
764
765 htp.p('function uncheckAll(field) {
766 for (i = 0; i < field.length; i++)
767 field[i].checked = false;
768 }');
769
770 if (p_jscript_tag = 'Y') then
771 htp.p('<!-- done hiding from old browsers -->');
772 htp.p('</SCRIPT>');
773 end if;
774 end generate_check_all;
775
776 --
777 -- generate_confirm
778 -- generate the javascript to do the confirm box
779 -- IN
780 -- p_jscript_tag - if 'Y' generate the SCRIPT tag
781 --
782 procedure generate_confirm (
783 p_jscript_tag in varchar2 default 'Y'
784 )
785 is
786 begin
787 if (p_jscript_tag = 'Y') then
788 htp.p('<SCRIPT LANGUAGE="JavaScript">');
789 htp.p('<!-- Hide from old browsers');
790 end if;
791
792 htp.p('function confirm_url(msg, url) {
793 if (window.confirm(msg)) {
794 window.document.write("<html><!-- empty page --></html>");
795 window.location.replace(url);
796 }
797 }');
798
799 if (p_jscript_tag = 'Y') then
800 htp.p('<!-- done hiding from old browsers -->');
801 htp.p('</SCRIPT>');
802 end if;
803 end generate_confirm;
804
805 -- gotoURL
806 -- javascript script implementation of go to an url
807 -- IN
808 -- p_url - the url provided
809 --
810 procedure gotoURL (
811 p_url in varchar2,
812 p_noblankpage in varchar2 default null
813 )
814 is
815 begin
816 if (p_url is null) then
817 return; -- do not go to a blank url
818 end if;
819 htp.p('<SCRIPT>');
820 if (p_noblankpage is null) then
821 -- place a blank page before replace it.
822 htp.p('window.document.write("<html></html>")');
823 end if;
824 htp.p(' window.location.replace("'||p_url||'")');
825 htp.p('</SCRIPT>');
826 end;
827
828 procedure test
829 is
830 hTab headerTabType;
831 dTab dataTabType;
832 i pls_integer;
833 begin
834 -- populate the values
835 i := 1;
836 hTab(i).def_type := 'FUNCTION';
837 hTab(i).value := 'wf_event_html.DeleteEvent?h_guid=';
838 i := i+1;
839 hTab(i).def_type := 'FUNCTION';
840 hTab(i).value := 'wf_event_html.ListSubscriptions';
841 i := i+1;
842 hTab(i).def_type := 'FUNCTION';
843 hTab(i).value := 'wf_event_html.EditEvent?h_guid=';
844 i := i+1;
845 hTab(i).def_type := 'TITLE';
846 hTab(i).value := wf_core.translate('SUBSCRIPTIONS');
847 hTab(i).level := 0;
848 hTab(i).attr := 'id="'||wf_core.translate('SUBSCRIPTIONS')||'"';
849 i := i+1;
850 hTab(i).def_type := 'TITLE';
851 hTab(i).value := wf_core.translate('EDIT');
852 hTab(i).level := 0;
853 i := i+1;
854 hTab(i).def_type := 'TITLE';
855 hTab(i).value := wf_core.translate('SYSTEM');
856 hTab(i).level := 2;
857 hTab(i).span := 3;
858 hTab(i).trattr := 'bgcolor=#069CCC';
859 hTab(i).attr := 'bgcolor=#ACCCCC';
860 i := i+1;
861 hTab(i).def_type := 'TITLE';
862 hTab(i).value := null; -- indentation
863 hTab(i).level := 1;
864 hTab(i).span := 1;
865 hTab(i).trattr := 'bgcolor=#069CCC';
866 hTab(i).attr := 'bgcolor=#BCCCCC';
867 i := i+1;
868 hTab(i).def_type := 'TITLE';
869 hTab(i).value := wf_core.translate('EVENT');
870 hTab(i).level := 1;
871 hTab(i).span := 2;
872 hTab(i).attr := 'id="'||wf_core.translate('EVENT')||'"';
873 i := i+1;
874 hTab(i).def_type := 'TITLE';
875 hTab(i).value := null; -- indentation
876 hTab(i).level := 0;
877 hTab(i).trattr := 'bgcolor=#069CCC';
878 hTab(i).attr := 'bgcolor=#ABCCCC';
879 i := i+1;
880 hTab(i).def_type := 'TITLE';
881 hTab(i).value := wf_core.translate('DISPLAY_NAME');
882 hTab(i).level := 0;
883 hTab(i).attr := 'id="'||wf_core.translate('DISPLAY_NAME')||'"';
884 i := i+1;
885 hTab(i).def_type := 'TITLE';
886 hTab(i).value := wf_core.translate('NAME');
887 hTab(i).level := 0;
888 hTab(i).attr := 'id="'||wf_core.translate('NAME')||'"';
889
890 i := 1;
891 dTab(i).guid := hextoraw('64F1FCEF78EE5934E0340800208ACA52');
892 dTab(i).level:= 2;
893 dTab(i).selectable := FALSE;
894 dTab(i).deletable := FALSE;
895 dTab(i).hasdetail := FALSE;
896 dTab(i).trattr := 'VALIGN=TOP bgcolor=#CCCCCC';
897 dTab(i).col01 := 'system ora816';
898 i := i+1;
899 dTab(i).guid := hextoraw('64F1FCEF78EE5934E0340800208ACA52');
900 dTab(i).level:= 1;
901 dTab(i).selectable := FALSE;
902 dTab(i).deletable := FALSE;
903 dTab(i).hasdetail := FALSE;
904 dTab(i).trattr := 'VALIGN=TOP bgcolor=#CCCCCC';
905 dTab(i).col01 := '';
906 dTab(i).col02 := 'event.testing';
907 i := i+1;
908 dTab(i).guid := hextoraw('64F1FCEF78EE5934E0340800208ACA52');
909 dTab(i).level:= 0;
910 dTab(i).showtitle := TRUE;
911 i := i+1;
912 dTab(i).guid := hextoraw('64F1FCEF78EE5934E0340800208ACA52');
913 dTab(i).level:= 0;
914 dTab(i).selectable := FALSE;
915 dTab(i).deletable := TRUE;
916 dTab(i).hasdetail := TRUE;
917 dTab(i).trattr := 'VALIGN=TOP bgcolor=white';
918 dTab(i).col01 := '';
919 dTab(i).col02 := 'Test Event 1';
920 dTab(i).col03 := 'TEST_EVENT1';
921 i := i+1;
922 dTab(i).guid := hextoraw('64F1FCEF78EE5934E0340800208ACA55');
923 dTab(i).level:= 0;
924 dTab(i).selectable := FALSE;
925 dTab(i).deletable := TRUE;
926 dTab(i).hasdetail := TRUE;
927 dTab(i).trattr := 'VALIGN=TOP bgcolor=white';
928 dTab(i).col01 := '';
929 dTab(i).col02 := 'Test Event 2';
930 dTab(i).col03 := 'TEST_EVENT2';
931
932 -- Render Page
933 htp.htmlOpen;
934 htp.p('<BODY bgcolor=#CCCCCC>');
935 Wfe_Html_Util.Simple_Table(hTab, dTab,
936 tabattr=>'border=0 cellpadding=3 cellspacing=2 bgcolor=#CCCCCC width=100%',
937 show_1st_title=>FALSE);
938 htp.bodyClose;
939 htp.htmlClose;
940 end Test;
941
942 end WFE_HTML_UTIL;