1 PACKAGE BODY wf_item_definition_util_pub AS
2 /* $Header: wfdefb.pls 120.1 2005/07/02 03:43:48 appldev ship $ */
3
4 /*===========================================================================
5 PACKAGE NAME: wf_item_definition_util_pub
6
7 DESCRIPTION:
8
9 OWNER: GKELLNER
10
11 TABLES/RECORDS:
12
13 PROCEDURES/FUNCTIONS:
14
15 ============================================================================*/
16
17 /*===========================================================================
18 PROCEDURE NAME: draw_custom_protect_details
19
20 DESCRIPTION: Writes out the custom and protect prompts and values
21 for a detailed listing of a workflow object.
22
23 ============================================================================*/
24 PROCEDURE draw_custom_protect_details
25 (p_customization_level IN VARCHAR2,
26 p_protection_level IN VARCHAR2) IS
27
28
29 BEGIN
30
31 /*
32 ** Create the customization row in the table
33 */
34 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
35 wf_core.translate('WFITD_CUSTOMIZATION_LEVEL'),
36 p_customization_level);
37
38 /*
39 ** Create the protection level row in the table
40 */
41 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
42 wf_core.translate('WFITD_PROTECTION_LEVEL'),
43 p_protection_level);
44
45 EXCEPTION
46 WHEN OTHERS THEN
47 Wf_Core.Context('wf_item_definition_util_pub',
48 'draw_custom_protect_details',
49 p_customization_level,
50 p_protection_level);
51
52 wf_item_definition.Error;
53
54 END draw_custom_protect_details;
55
56 /*===========================================================================
57 PROCEDURE NAME: draw_read_write_exe_details
58
59 DESCRIPTION: Writes out the read, write, execute role prompts
60 and values for a detailed listing of a workflow object.
61
62 ============================================================================*/
63 PROCEDURE draw_read_write_exe_details
64 (p_read_role IN VARCHAR2,
65 p_write_role IN VARCHAR2,
66 p_execute_role IN VARCHAR2,
67 p_draw_execute_role IN BOOLEAN) IS
68
69 BEGIN
70
71 /*
72 ** Create the read role row in the table
73 */
74 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
75 wf_core.translate('WFITD_READ_ROLE'),
76 p_read_role);
77
78 /*
79 ** Create the write role row in the table
80 */
81 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
82 wf_core.translate('WFITD_WRITE_ROLE'),
83 p_write_role);
84
85 IF (p_draw_execute_role = TRUE) THEN
86
87 /*
88 ** Create the execute role row in the table
89 */
90 wf_item_definition_util_pub.draw_detail_prompt_value_pair (
91 wf_core.translate('WFITD_EXECUTE_ROLE'),
92 p_execute_role);
93
94 END IF;
95
96 EXCEPTION
97 WHEN OTHERS THEN
98 Wf_Core.Context('wf_item_definition_util_pub',
99 'draw_read_write_exe_details',
100 p_read_role,
101 p_write_role,
102 p_execute_role);
103
104 wf_item_definition.Error;
105
106 END draw_read_write_exe_details;
107
108 /*===========================================================================
109 PROCEDURE NAME: create_hotlink_to_details
110
111 DESCRIPTION:
112
113 The creation of the anchor from the summary frame to the detail
114 frame was very complex so I've extracted the function into its
115 own routine. I used the straight tabledata call rather than
116 the htf.anchor2 web server call because the anchor2 created an
117 HREF string that would never seem to create the proper syntax
118
119 How this call works is that the A HREF is preceeded by the indent
120 characters. This is so the indent characters are not part of the
121 anchor and therefore do not appear as underlined text. The second
122 component is the link to the url for the details frame. When using
123 frames and anchors you must provide the full url that was used to
124 create the frame including all the parameters. Since I don't store
125 this parameter in any of my pl*sql tables, I had to add this parameter
126 to all the procedures so I could pass it through.
127 The next component is the tag within the detail frame that you
128 are going to navigate to. The tag is composed of two parts.
129 The first part is the object_type_prefix
130 (ATTRIBUTE, PROCESS, NOTIFICATION, MESSAGE, MESSAGE_ATTR, etc.)
131 with a '#' in front of it to tell it that its a local
132 link in the existing frame. The second part is the internal name
133 of the object. This is followed by the frame target which is
134 DETAILS, and then the name that is displayed to the user
135 as the link name which is the display name for the object.
136 The alignment is always left and I prevented wrapping so you
137 don't get every line being double spaced if one attribute or
138 some other object is a bit longer than what fits in the summary
139 frame. This is especially effective if the user resizes the
140 summary frame down to something small.
141
142 ============================================================================*/
143 PROCEDURE create_hotlink_to_details (
144 p_item_type IN VARCHAR2,
145 p_effective_date IN DATE,
146 p_object_type_prefix IN VARCHAR2,
147 p_internal_name IN VARCHAR2,
148 p_display_name IN VARCHAR2,
149 p_detail_prompt IN VARCHAR2,
150 p_indent_level IN NUMBER) IS
151
152 l_indent_string VARCHAR2(80) := '';
153 ii NUMBER := 0;
154
155 BEGIN
156
157 /*
158 ** Add three blank spaces for every indent level to preceed the
159 ** link with
160 */
161 FOR ii IN 1..p_indent_level LOOP
162
163 l_indent_string := l_indent_string || '      ';
164
165 END LOOP;
166
167 htp.tableRowOpen(calign=>'left', cvalign=>'top');
168
169 /*
170 ** If this is a all from the detail region then you'll have a two
171 ** column format and you need to put this prompt on. Otherwise it's
172 ** a one column table for the summary frame.
173 */
174 IF (p_detail_prompt IS NOT NULL) THEN
175
176 wf_item_definition_util_pub.draw_detail_prompt(
177 p_detail_prompt);
178
179 END IF;
180
181 htp.tableData(
182 cvalue=>l_indent_string||
183 '<A HREF="'||
184 owa_util.get_owa_service_path||
185 'wf_item_definition.draw_item_details?p_item_type='||
186 wfa_html.conv_special_url_chars(p_item_type)||
187 '&p_effective_date='||
188 TO_CHAR(p_effective_date)||
189 TO_CHAR(p_effective_date,'+hh24:mi:ss')||
190 '#'||p_object_type_prefix||':'||
191 p_internal_name||
192 '" TARGET="DETAILS">'||
193 p_display_name||
194 '</A>',
195 calign=>'Left',
196 cnowrap=>'NOWRAP');
197
198 htp.tableRowClose;
199
200 EXCEPTION
201 WHEN OTHERS THEN
202 Wf_Core.Context('wf_item_definition_util_pub',
203 'create_hotlink_to_details',
204 p_item_type,
205 TO_CHAR(p_effective_date),
206 p_object_type_prefix,
207 p_internal_name,
208 p_display_name);
209 wf_item_definition.Error;
210
211 END create_hotlink_to_details;
212
213
214 /*===========================================================================
215 PROCEDURE NAME: create_details_hotlink_target
216
217 DESCRIPTION:
218 Creates the destination target in the detail frame for a hotlink.
219 The destination target name is based on the a name comprised of
220 two parts. The first part is the object_type_prefix
221 (ATTRIBUTE, PROCESS, NOTIFICATION, MESSAGE, MESSAGE_ATTR, etc.)
222 The second part is the internal name of the object.
223
224 ============================================================================*/
225 PROCEDURE create_details_hotlink_target (
226 p_object_type_prefix IN VARCHAR2,
227 p_internal_name IN VARCHAR2,
228 p_display_name IN VARCHAR2,
229 p_display_prompt IN VARCHAR2,
230 p_indent_level IN NUMBER) IS
231
232 l_indent_string VARCHAR2(80) := '';
233 ii NUMBER := 0;
234
235 BEGIN
236
237 /*
238 ** Add three blank spaces for every indent level to preceed the
239 ** link with
240 */
241 FOR ii IN 1..p_indent_level LOOP
242
243 l_indent_string := l_indent_string || '      ';
244
245 END LOOP;
246
247 /*
248 ** Create the display name row in the table
249 */
250 htp.tableRowOpen(calign=>'middle', cvalign=>'top');
251
252 /*
253 ** The destination target name is based on the a name comprised of
254 ** two parts. The first part is the object_type_prefix
255 ** (ATTRIBUTE, PROCESS, NOTIFICATION, MESSAGE, MESSAGE_ATTR, etc.)
256 ** The second part is the internal name of the object.
257 */
258 htp.p('<A NAME='||
259 '"'||p_object_type_prefix||
260 ':'||p_internal_name||'"'||
261 '>');
262
263 wf_item_definition_util_pub.draw_detail_prompt(p_display_prompt);
264
265 htp.p ('</A>');
266
267 wf_item_definition_util_pub.draw_detail_value(p_display_name);
268
269 htp.tableRowClose;
270
271 EXCEPTION
272 WHEN OTHERS THEN
273 Wf_Core.Context('wf_item_definition_util_pub',
274 'create_details_hotlink_target',
275 p_object_type_prefix,
276 p_internal_name,
277 p_display_name,
278 p_display_prompt);
279
280 wf_item_definition.Error;
281
282 END create_details_hotlink_target;
283
284
285 /*===========================================================================
286 PROCEDURE NAME: draw_summary_section_title
287
288 DESCRIPTION:
289 Draws the bold section title for an object type
290 in the summary frame.
291
292 ============================================================================*/
293 PROCEDURE draw_summary_section_title (
294 p_section_title IN VARCHAR2,
295 p_indent_level IN NUMBER) IS
296
297 l_indent_string VARCHAR2(80) := '';
298 ii NUMBER := 0;
299
300 BEGIN
301
302 /*
303 ** Add three blank spaces for every indent level to preceed the
304 ** link with
305 */
306 FOR ii IN 1..p_indent_level LOOP
307
308 l_indent_string := l_indent_string || '      ';
309
310 END LOOP;
311
312 /*
313 ** Open a row in the summary table, put on the the section title.
314 ** and then close the row.
315 */
316 htp.tableRowOpen(calign=>'left', cvalign=>'top');
317
318 htp.tableData(
319 cvalue=>l_indent_string||'<B>'||p_section_title||'</B>',
320 calign=>'Left',
321 cnowrap=>'NOWRAP');
322
323 htp.tableRowClose;
324
325 EXCEPTION
326 WHEN OTHERS THEN
327 Wf_Core.Context('wf_item_definition_util_pub',
328 'draw_summary_section_title',
329 p_section_title,
330 p_indent_level);
331
332 wf_item_definition.Error;
333
334 END draw_summary_section_title;
335
336 /*===========================================================================
337 PROCEDURE NAME: draw_detail_section_title
338
339 DESCRIPTION:
340 Draws the bold section title and the thick line
341 for an object type in the detail frame.
342
343 ============================================================================*/
344 PROCEDURE draw_detail_section_title (
345 p_section_title IN VARCHAR2,
346 p_indent_level IN NUMBER) IS
347
348 BEGIN
349
350 /*
351 ** Draw the detail section title
352 */
353 htp.bold(p_section_title);
354
355 /*
356 ** Put a line across the form
357 */
358 htp.p('<BR><HR size="2">');
359
360 EXCEPTION
361 WHEN OTHERS THEN
362 Wf_Core.Context('wf_item_definition_util_pub',
363 'draw_detail_section_title',
364 p_section_title);
365
366
367 wf_item_definition.Error;
368
369 END draw_detail_section_title;
370
371 /*===========================================================================
372 PROCEDURE NAME: draw_detail_prompt_value_pair
373
374 DESCRIPTION:
375 Draws the bold detail section prompt and its
376 corresponding value in the detail frame
377
378 ============================================================================*/
379 PROCEDURE draw_detail_prompt_value_pair
380 (p_prompt IN VARCHAR2,
381 p_value IN VARCHAR2) IS
382
383 BEGIN
384
385 htp.tableRowOpen(calign=>'middle', cvalign=>'top');
386
387 htp.tableData(cvalue=>p_prompt||' ',
388 calign=>'Right',
389 cnowrap=>'NOWRAP');
390
391 htp.tableData('<B>'||p_value||'</B>', 'Left');
392
393 htp.tableRowClose;
394
395 EXCEPTION
396 WHEN OTHERS THEN
397 Wf_Core.Context('wf_item_definition_util_pub',
398 'draw_detail_prompt_value_pair',
399 p_prompt,
400 p_value);
401
402 wf_item_definition.Error;
403
404 END draw_detail_prompt_value_pair;
405
406 /*===========================================================================
407 PROCEDURE NAME: draw_detail_prompt
408
409 DESCRIPTION:
410 Draws the bold detail section prompt
411
412 ============================================================================*/
413 PROCEDURE draw_detail_prompt
414 (p_prompt IN VARCHAR2) IS
415
416 BEGIN
417
418 htp.tableData(p_prompt||' ', 'Right');
419
420 EXCEPTION
421 WHEN OTHERS THEN
422 Wf_Core.Context('wf_item_definition_util_pub',
423 'draw_detail_prompt',
424 p_prompt);
425 wf_item_definition.Error;
426
427 END draw_detail_prompt;
428
429 /*===========================================================================
430 PROCEDURE NAME: draw_detail_value
431
432 DESCRIPTION:
436 PROCEDURE draw_detail_value
433 Draws the value of an attribute
434
435 ============================================================================*/
437 (p_value IN VARCHAR2) IS
438
439 BEGIN
440
441 htp.tableData('<B>'||p_value||'</B>', 'Left');
442
443 EXCEPTION
444 WHEN OTHERS THEN
445 Wf_Core.Context('wf_item_definition_util_pub',
446 'draw_detail_value',
447 p_value);
448 wf_item_definition.Error;
449
450 END draw_detail_value;
451
452 /*===========================================================================
453 PROCEDURE NAME: activity_titles_list
454
455 DESCRIPTION:
456 Check how many activity types got printed. If the list didn't
457 to one of the activity types because there weren't any of that
458 then catch it here and print it.
459
460
461 PARAMETERS:
462
463
464 ============================================================================*/
465 PROCEDURE activity_titles_list (
466 p_highest_level IN NUMBER,
467 p_current_level IN NUMBER,
468 p_indent_level IN NUMBER
469 ) IS
470
471 ii NUMBER := 0;
472 l_summary_section_title VARCHAR2(240);
473
474 BEGIN
475
476 /*
477 ** Check how many activity types got printed. If the list didn't
478 ** to one of the activity types because there weren't any of that
479 ** then catch it here and print it. Subtract 1 from the current
480 ** level since the index is 1 and the current is always going to be
481 ** one higher than the starting point in the for loop.
482 */
483 FOR ii IN p_highest_level..p_current_level - 1 LOOP
484
485 IF (ii = 1) THEN
486
487 /*
488 ** Set the the processes title.
489 */
490 l_summary_section_title := wf_core.translate('PROCESSES');
491
492 wf_item_definition_util_pub.draw_summary_section_title(
493 l_summary_section_title,
494 p_indent_level);
495
496
497 ELSIF (ii = 2) THEN
498
499 /*
500 ** Set the the notifications title.
501 */
502 l_summary_section_title := wf_core.translate('WFITD_NOTIFICATIONS');
503
504 wf_item_definition_util_pub.draw_summary_section_title(
505 l_summary_section_title,
506 p_indent_level);
507
508
509 ELSIF (ii = 3) THEN
510
511 /*
512 ** Set the functions title.
513 */
514 l_summary_section_title := wf_core.translate('WFITD_FUNCTIONS');
515
516 wf_item_definition_util_pub.draw_summary_section_title(
517 l_summary_section_title,
518 p_indent_level);
519
520 END IF;
521
522 END LOOP;
523
524 EXCEPTION
525 WHEN OTHERS THEN
526 Wf_Core.Context('wf_item_definition_util_pub',
527 'activity_titles_list');
528
529 wf_item_definition.Error;
530
531 END activity_titles_list;
532
533 /*===========================================================================
534 PROCEDURE NAME: activity_titles_details
535
536 DESCRIPTION:
537 Check how many activity types got printed. If the list didn't
538 to one of the activity types because there weren't any of that
539 then catch it here and print it.
540
541
542 PARAMETERS:
543
544
545 ============================================================================*/
546 PROCEDURE activity_titles_details (
547 p_highest_level IN NUMBER,
548 p_current_level IN NUMBER
549 ) IS
550
551 ii NUMBER := 0;
552 l_detail_section_title VARCHAR2(240);
553
554 BEGIN
555
556 /*
557 ** Check how many activity types got printed. If the list didn't
558 ** to one of the activity types because there weren't any of that
559 ** then catch it here and print it. Subtract 1 from the current
560 ** level since the index is 1 and the current is always going to be
561 ** one higher than the starting point in the for loop.
562 */
563 FOR ii IN p_highest_level..p_current_level - 1 LOOP
564
565 IF (ii = 1) THEN
566
567 /*
568 ** Set the the processes title.
569 */
570 l_detail_section_title := wf_core.translate('WFITD_PROCESS_DETAILS');
571
572 wf_item_definition_util_pub.draw_detail_section_title(
573 l_detail_section_title,
574 0);
575
576 /*
577 ** Create some blank space around the title
578 */
579 htp.p ('<BR><BR>');
580
581
582 ELSIF (ii = 2) THEN
583
584 /*
585 ** Set the the notifications title.
586 */
587 l_detail_section_title := wf_core.translate('WFITD_NOTIFICATION_DETAILS');
588
589 wf_item_definition_util_pub.draw_detail_section_title(
590 l_detail_section_title,
591 0);
592
593 /*
597
594 ** Create some blank space around the title
595 */
596 htp.p ('<BR><BR>');
598
599 ELSIF (ii = 3) THEN
600
601 /*
602 ** Set the functions title.
603 */
604 l_detail_section_title := wf_core.translate('WFITD_FUNCTION_DETAILS');
605
606 wf_item_definition_util_pub.draw_detail_section_title(
607 l_detail_section_title,
608 0);
609
610 END IF;
611
612 END LOOP;
613
614 EXCEPTION
615 WHEN OTHERS THEN
616 Wf_Core.Context('wf_item_definition_util_pub',
617 'activity_titles_details');
618
619 wf_item_definition.Error;
620
621 END activity_titles_details;
622
623 /*===========================================================================
624 PROCEDURE NAME: validate date
625
626 DESCRIPTION:
627 Validates and converts a char datatype date string
628 to a date datatype that the user has entered
629 is in a valid format based on the NLS_DATE_FORMAT
630 parameter.
631
632 ============================================================================*/
633 PROCEDURE validate_date (p_char_date IN VARCHAR2,
634 p_date_date OUT NOCOPY DATE,
635 p_valid_date OUT NOCOPY BOOLEAN,
636 p_expected_format OUT NOCOPY VARCHAR2) IS
637
638 l_nls_date_format VARCHAR2(80);
639 l_date_date DATE;
640
641 BEGIN
642
643 /*
644 ** Set the l_date_date to null
645 */
646 l_date_date := NULL;
647
648 /*
649 ** Get the current date format from the v$nls_parameters view
650 */
651 SELECT MAX(value)
652 INTO l_nls_date_format
653 FROM v$nls_parameters
654 WHERE parameter = 'NLS_DATE_FORMAT';
655
656 /*
657 ** If no parameter can be found then set it to something
658 */
659 IF (l_nls_date_format IS NULL) THEN
660
661 l_nls_date_format := 'DD-MON-RRRR';
662
663 END IF;
664
665 /*
666 ** Convert YY or YYYY in the l_nls_date_format to RRRR since
667 ** this is the most flexible format
668 */
669 l_nls_date_format := REPLACE (l_nls_date_format, 'YYYY', 'RRRR');
670 l_nls_date_format := REPLACE (l_nls_date_format, 'YY', 'RRRR');
671
672 /*
673 ** Check to see if you need to add the time to the date format in case
674 ** the char string has a time element on it. This check
675 ** is based on having a ':' in the date value string and not having a ':'
676 ** in the nls string
677 */
678 IF (INSTR(p_char_date, ':') > 0 AND INSTR(l_nls_date_format, ':') = 0) THEN
679
680 l_nls_date_format := l_nls_date_format || ' HH24:MI:SS';
681
682 END IF;
683
684 /*
685 ** Now try to convert the char date string to a date datatype. If any
686 ** exception occurs then tell the caller that the
687 */
688 p_valid_date := TRUE;
689
690 BEGIN
691
692 SELECT TO_DATE(p_char_date, l_nls_date_format)
693 INTO l_date_date
694 FROM dual;
695
696 EXCEPTION
697 WHEN OTHERS THEN
698 p_valid_date := FALSE;
699 END;
700
701 p_date_date := l_date_date;
702 p_expected_format := l_nls_date_format;
703
704 EXCEPTION
705 WHEN OTHERS THEN
706 Wf_Core.Context('wf_item_definition_util_pub',
707 'validate_date');
708
709 wf_item_definition.Error;
710
711 END validate_date;
712
713
714 /*===========================================================================
715 PROCEDURE NAME: create_checkbox
716
717 DESCRIPTION:
718 Create a checkbox entry in a table
719
720 ============================================================================*/
721 PROCEDURE create_checkbox (
722 p_name IN VARCHAR2,
723 p_value IN VARCHAR2,
724 p_checked IN VARCHAR2,
725 p_prompt IN VARCHAR2,
726 p_image_name IN VARCHAR2 ,
727 p_new_row IN BOOLEAN
728 ) IS
729
730 BEGIN
731
732 IF (p_new_row = TRUE) THEN
733
734 /*
735 ** Open the checkboxes row
736 */
737 htp.tableRowOpen;
738
739 END IF;
740
741 /*
742 ** Create the checkbox for Top Level Process Only List
743 ** add nbsp; to space out the checkboxes
744 */
745 IF (p_image_name IS NOT NULL) THEN
746 htp.tableData(
747 cvalue=>
748 htf.formcheckbox(
749 cname=>p_name,
750 cvalue=>p_value,
751 cchecked=>p_checked,
752 cattributes=>NULL)||' '||
753 htf.img(
754 curl=>wfa_html.image_loc||p_image_name,
755 calign=>'absmiddle',
756 calt=>null,
757 cismap=>null,
758 cattributes=>'height=26')||
759 ' '||p_prompt||' ',
760 calign=>'left');
761
762 ELSE
763
764 htp.tableData(
765 cvalue=>
766 htf.formcheckbox(
767 cname=>p_name,
768 cvalue=>p_value,
769 cchecked=>p_checked,
770 cattributes=>NULL)||
771 ' '||p_prompt||' ',
772 calign=>'left',
773 cattributes=>'valign="TOP"');
774
775 END IF;
776
777 IF (p_new_row = TRUE) THEN
778
779 /*
780 ** Close the checkboxes row
781 */
782 htp.tableRowClose;
783
784 END IF;
785
786 EXCEPTION
787 WHEN OTHERS THEN
788 Wf_Core.Context('wf_item_definition_util_pub',
789 'create_checkbox',
790 p_name,
791 p_value,
792 p_checked,
793 p_prompt);
794
795 wf_item_definition.Error;
796
797 END create_checkbox;
798
799 END wf_item_definition_util_pub;