DBA Data[Home] [Help]

PACKAGE BODY: APPS.WF_MESSAGES_VL_PUB

Source


1 PACKAGE BODY wf_messages_vl_pub AS
2 /* $Header: wfdefb.pls 120.1 2005/07/02 03:43:48 appldev ship $  */
3 
4 /*===========================================================================
5   PACKAGE NAME:         wf_messages_vl_pub
6 
7   DESCRIPTION:
8 
9   OWNER:                GKELLNER
10 
11   TABLES/RECORDS:
12 
13   PROCEDURES/FUNCTIONS:
14 
15 ============================================================================*/
16 
17 /*===========================================================================
18   PROCEDURE NAME:       fetch_messages
19 
20   DESCRIPTION:          Fetches all the messages and each message
21                         associate attributes for a given item type
22                         into a p_wf_messages_vl_tbl table and a
23                         p_wf_message_attr_vl_tbl table based on the
24                         item type internal eight character name. This
25                         function can retrieve a single message
26                         definition if the internal name along with the
27                         item type name is provided.  This is especially
28                         useful if you wish to display the details for a
29                         single message when it is referenced from some
30                         drilldown mechanism.
31 
32                         The p_wf_messages_vl_tbl table and the
33                         p_wf_message_attr_vl_tbl table are synchronized by
34                         the select order of both queries.  The
35                         draw_message_list and draw_message_details functions
36                         take advantage of this ordering for performance reasons
37                         so they can walk these lists in parallel.
38                         When we find an attribute that matches
39                         the current message, we copy that attribute to a temp
40                         list until we find a new message in the attribute
41                         list.  When this happens we write out the attribute
42                         temp list and move to the next activity.
43 
44 ============================================================================*/
45 PROCEDURE fetch_messages
46      (p_item_type          IN  VARCHAR2,
47       p_name               IN  VARCHAR2,
48       p_wf_messages_vl_tbl OUT NOCOPY wf_messages_vl_pub.wf_messages_vl_tbl_type,
49       p_wf_message_attr_vl_tbl OUT NOCOPY wf_messages_vl_pub.wf_message_attr_vl_tbl_type) IS
50 
51 CURSOR fetch_messages (c_item_type IN VARCHAR2) IS
52 SELECT row_id,
53        type,
54        name,
55        protect_level,
56        custom_level,
57        default_priority,
58        read_role,
59        write_role,
60        display_name,
61        description,
62        subject,
63        html_body,
64        body
65 FROM   wf_messages_vl
66 WHERE  type = c_item_type
67 ORDER  BY display_name;
68 
69 /*===========================================================================
70 
71   CURSOR NAME:          fetch_message_attributes
72 
73   DESCRIPTION:          Fetches all message attributes for the given
74                         item_type.
75 
76                         You'll notice that the select orders the
77                         results by message display name, and then
78                         by attribute sequence.  The criteria is based
79                         on the requirement to synchronize the
80                         attribute list with the message list.  The
81                         message list is ordered by display name.
82                         When we list the messages and their
83                         corresponding attributes we walk these lists
84                         in parallel.  When we find an attribute that matches
85                         the current message, we copy that attribute to a temp
86                         list until we find a new message in the attribute
87                         list.  When this happens we write out the attribute
88                         temp list and move to the next message.  Thus the need
89                         for the special order criteria.
90 
91                         You might also notice that we are selecting the message
92                         display name four times.  The second is a placeholder
93                         used when the default value is based on an
94                         item attribute. The third occurrence is a
95                         placeholder in the record so that I can fill in that column
96                         with the lookup type display name if this attribute is
97                         validated based on a lookup type.  The fourth occurence
98                         is later populated with the lookup code display name
99                         if the default value is based on a lookup type.
100 
101   PARAMETERS:
102 
103         c_item_type IN  Internal name of the item type
104 
105 ============================================================================*/
106 CURSOR fetch_message_attributes (c_item_type IN VARCHAR2) IS
107  SELECT
108  wm.display_name message_display_name,
109  wm.display_name attr_default_display_name,
110  wm.display_name lookup_type_display_name,
111  wm.display_name lookup_code_display_name,
112  wma.row_id,
113  wma.message_type,
114  wma.message_name,
115  wma.name,
116  wma.sequence,
117  wma.type,
118  wma.subtype,
119  wma.attach,
120  wma.value_type,
121  wma.protect_level,
122  wma.custom_level,
123  wma.format,
124  wma.text_default,
125  wma.number_default,
126  wma.date_default,
127  wma.display_name,
128  wma.description
129  FROM   wf_message_attributes_vl wma, wf_messages_vl wm
130  WHERE  wma.message_type = c_item_type
131  AND    wm.type = c_item_type
132  AND    wm.name = wma.message_name
133  ORDER  BY wm.display_name, wma.sequence;
134 
135 l_record_num               NUMBER  := 0;
136 
137 BEGIN
138 
139    /*
140    ** Make sure all the required parameters are set
141    */
142    IF (p_item_type IS NULL) THEN
143 
144       return;
145 
146    END IF;
147 
148    /*
149    ** Check if the caller has passed a specific attribute_name to search for.
150    ** If so then just get the row corresponding to that item_type and
151    ** attribute_name.  If not then get all rows for that item_type.
152    */
153    IF (p_name IS NOT NULL) THEN
154 
155        SELECT row_id,
156               type,
157               name,
158               protect_level,
159               custom_level,
160               default_priority,
161               read_role,
162               write_role,
163               display_name,
164               description,
165               subject,
166               html_body,
167               body
168        INTO   p_wf_messages_vl_tbl(1)
169        FROM   wf_messages_vl
170        WHERE  type = p_item_type
171        AND    name = p_name;
172 
173     ELSE
174 
175        OPEN fetch_messages (p_item_type);
176 
177        /*
178        ** Loop through all the lookup_code rows for the given message
179        ** filling in the p_wf_messages_vl_tbl
180        */
181        LOOP
182 
183            l_record_num := l_record_num + 1;
184 
185            FETCH fetch_messages INTO p_wf_messages_vl_tbl(l_record_num);
186 
187            EXIT WHEN fetch_messages%NOTFOUND;
188 
189        END LOOP;
190 
191        CLOSE   fetch_messages;
192 
193        l_record_num := 0;
194 
195        OPEN fetch_message_attributes (p_item_type);
196 
197        LOOP
198 
199           l_record_num := l_record_num + 1;
200 
201           FETCH fetch_message_attributes INTO p_wf_message_attr_vl_tbl(
202              l_record_num);
203 
204           EXIT WHEN fetch_message_attributes%NOTFOUND;
205 
206            /*
207            ** If the validation for this attribute is a lookup then go get the
208            ** display name for that lookup and put it in the
209            ** lookup_type_display_name record element
210            */
211            IF (p_wf_message_attr_vl_tbl(l_record_num).type = 'LOOKUP') THEN
212 
213                wf_lookup_types_pub.fetch_lookup_display(
214                   p_wf_message_attr_vl_tbl(l_record_num).format,
215                   p_wf_message_attr_vl_tbl(l_record_num).text_default,
216                   p_wf_message_attr_vl_tbl(l_record_num).lookup_type_display_name,
217                   p_wf_message_attr_vl_tbl(l_record_num).lookup_code_display_name);
218 
219           END IF;
220 
221           /*
222           ** If the default value for this attribute is an item attribute then
223           ** populate the attr_default_display_name with the item attribute display
224           ** name
225           */
226           IF (p_wf_message_attr_vl_tbl(l_record_num).value_type = 'ITEMATTR') THEN
227 
228                wf_item_attributes_vl_pub.fetch_item_attribute_display(
229                   p_wf_message_attr_vl_tbl(l_record_num).message_type,
230                   p_wf_message_attr_vl_tbl(l_record_num).text_default,
231                   p_wf_message_attr_vl_tbl(l_record_num).attr_default_display_name);
232 
233           END IF;
234 
235        END LOOP;
236 
237        CLOSE fetch_message_attributes;
238 
239     END IF;
240 
241     EXCEPTION
242     WHEN OTHERS THEN
243        Wf_Core.Context('wf_messages_vl_pub',
244            'fetch_messages',
245            p_item_type,
246            p_name);
247 
248        wf_item_definition.Error;
249 
250 END  fetch_messages;
251 
252 /*===========================================================================
253   PROCEDURE NAME:       fetch_message_display
254 
255   DESCRIPTION:          fetch the messagedisplay name based on a item
256                         type name and an internal item message name
257 
258 ============================================================================*/
259 PROCEDURE fetch_message_display        (p_item_type     IN VARCHAR2,
260                                         p_internal_name IN VARCHAR2,
261                                         p_display_name  OUT NOCOPY VARCHAR2) IS
262 
263 l_display_name           VARCHAR2(80);
264 l_wf_messages_vl_tbl     wf_messages_vl_pub.wf_messages_vl_tbl_type;
265 l_wf_message_attr_vl_tbl wf_messages_vl_pub.wf_message_attr_vl_tbl_type;
266 
267 BEGIN
268 
269   /*
270   ** Fetch the message record associated with this internal name
271   */
272   fetch_messages (p_item_type,
273      p_internal_name,
274      l_wf_messages_vl_tbl,
275      l_wf_message_attr_vl_tbl);
276 
277    /*
278    ** See if you found a row.  If not, proide the user with feedback
279    */
280    IF (l_wf_messages_vl_tbl.count < 1) THEN
281 
282       l_display_name := p_internal_name||' '||
283          '<B> -- '||UPPER(wf_core.translate ('WFITD_UNDEFINED'))||'</B>';
284 
285    ELSE
286 
287       l_display_name := l_wf_messages_vl_tbl(1).display_name;
288 
289    END IF;
290 
291    p_display_name := l_display_name;
292 
293    EXCEPTION
294    WHEN OTHERS THEN
295       Wf_Core.Context('wf_messages_pub',
296          'fetch_message_display',
297          p_internal_name);
298 
299 END fetch_message_display;
300 
301 /*===========================================================================
302   PROCEDURE NAME:       draw_message_list
303 
304   DESCRIPTION:          Shows the display name of a message along with
305                         any message attributes for that message that
306                         have been passed in as a html view as a part of
307                         a hierical summary list of an item type.
308                         This function uses the htp to generate its html
309                         output.
310 
311                         When we find an attribute that matches
312                         the message activity, we copy that attribute and all
313                         that follow for that message to a temp
314                         list until we find a new activity in the attribute
315                         list.  When this happens we write out the attributes
316                         using the draw_message_attr_list.
317 
318 ============================================================================*/
319 PROCEDURE draw_message_list
320      (p_wf_messages_vl_tbl IN wf_messages_vl_pub.wf_messages_vl_tbl_type,
321       p_wf_message_attr_vl_tbl IN wf_messages_vl_pub.wf_message_attr_vl_tbl_type,
322       p_effective_date     IN DATE,
323       p_indent_level       IN NUMBER) IS
324 
325 l_message_record_num         NUMBER;
326 l_attr_record_num            NUMBER  := 1;
327 ii                           NUMBER  := 0;
328 l_cur_attr_record_num        NUMBER  := 1;
329 l_wf_message_attr_vl_tbl     wf_messages_vl_pub.wf_message_attr_vl_tbl_type;
330 
331 BEGIN
332 
333   /*
334   ** Create the the messages title.  Indent it to the level specified
335   */
336   wf_item_definition_util_pub.draw_summary_section_title(
337        wf_core.translate('WFITD_MESSAGES'),
338        p_indent_level);
339 
340   /*
341   **  Print out all message display names in the pl*sql table
342   */
343   FOR l_message_record_num IN 1..p_wf_messages_vl_tbl.count LOOP
344 
345       /*
346       ** The creation of the anchor from the summary frame to the detail
347       ** frame was very complex so I've extracted the function into its
348       ** own routine.
349       */
350       wf_item_definition_util_pub.create_hotlink_to_details (
351             p_wf_messages_vl_tbl(l_message_record_num).type,
352             p_effective_date,
353             'MESSAGE',
354             p_wf_messages_vl_tbl(l_message_record_num).name,
355             p_wf_messages_vl_tbl(l_message_record_num).display_name,
356             NULL,
357             p_indent_level+1);
358 
359       /*
360       ** Here we look for all the message attributes that are related to the
361       ** current message.  The p_wf_message_attr_vl_tbl is ordered by display
362       ** name and then by message attribute display name.  As long as we stay
363       ** in sync we should be able to correctly create the temp attribute list
364       ** for the current message.  We could create a cursor here for the child
365       ** attributes but that would break the rule of separating the UI layer
366       ** and the data layer
367       */
368       l_wf_message_attr_vl_tbl.delete;
369       l_cur_attr_record_num := 1;
370 
371       /*
372       ** Make sure there is at least on record in the message attribute
373       ** list.  If there is not then the l_attr_record_num index of 1
374       ** will cause a 6502-PL*SQL numeric or value error exception.
375       */
376       WHILE (
377          l_attr_record_num <=  p_wf_message_attr_vl_tbl.count AND
378          p_wf_messages_vl_tbl(l_message_record_num).display_name =
379             p_wf_message_attr_vl_tbl(l_attr_record_num).message_display_name
380          ) LOOP
381 
382          /*
383          ** We have found an attribute for the current message.  Copy the
384          ** contents of that list to a temp attr list and then pass the
385          ** temp list to the message_attribute display function to display
386          ** the results.
387          */
388          l_wf_message_attr_vl_tbl(l_cur_attr_record_num) :=
389              p_wf_message_attr_vl_tbl(l_attr_record_num);
390 
391          l_attr_record_num := l_attr_record_num + 1;
392          l_cur_attr_record_num := l_cur_attr_record_num + 1;
393 
394       END LOOP;
395 
396       /*
397       ** If the l_cur_attr_record_num is greater than 1 then you
398       ** must have found an attribute for this message.  Copy that
399       ** set of attributes to a temporary pl*sql table and then
400       ** print it out.
401       */
402       IF (l_cur_attr_record_num > 1) THEN
403 
404         /*
405         ** List all the message attribute details for this message that
406         ** we found above.  Add two to the current indent level so it
407         ** is pushed in past the start of the message list.
408         */
409         wf_messages_vl_pub.draw_message_attr_list (
410            l_wf_message_attr_vl_tbl,
411            p_effective_date,
412            p_indent_level + 2);
413 
414       END IF;
415 
416   END LOOP;
417 
418   EXCEPTION
419   WHEN OTHERS THEN
420       Wf_Core.Context('wf_messages_vl_pub', 'draw_message_list');
421       wf_item_definition.Error;
422 
423 END draw_message_list;
424 
425 /*===========================================================================
426   PROCEDURE NAME:       draw_message_attr_list
427 
428   DESCRIPTION:          Shows the display names of message attributes for
429                         a given message as a html view as a part of
430                         a hierical summary list of an item type.
431                         This function uses the htp to generate its html
432                         output.
433 
434 ============================================================================*/
435 PROCEDURE draw_message_attr_list
436      (p_wf_message_attr_vl_tbl IN wf_messages_vl_pub.wf_message_attr_vl_tbl_type,
437       p_effective_date     IN DATE,
438       p_indent_level       IN NUMBER) IS
439 
440 l_record_num              NUMBER;
441 ii                        NUMBER  := 0;
442 
443 BEGIN
444 
445   /*
446   ** Create the the messages title.  Indent it to the level specified
447   */
448   wf_item_definition_util_pub.draw_summary_section_title(
449        wf_core.translate('WFITD_MESSAGE_ATTRS'),
450        p_indent_level);
451 
452   /*
453   **  Print out all message display names in the pl*sql table
454   */
455   FOR l_record_num IN 1..p_wf_message_attr_vl_tbl.count LOOP
456 
457       /*
458       ** The creation of the anchor from the summary frame to the detail
459       ** frame was very complex so I've extracted the function into its
460       ** own routine.
461       */
462       IF (p_wf_message_attr_vl_tbl(l_record_num).name <> 'RESULT') THEN
463 
464          wf_item_definition_util_pub.create_hotlink_to_details (
465             p_wf_message_attr_vl_tbl(l_record_num).message_type,
466             p_effective_date,
467             'MESSAGE_ATTR',
468             p_wf_message_attr_vl_tbl(l_record_num).message_name||':'||
469             p_wf_message_attr_vl_tbl(l_record_num).name,
470             p_wf_message_attr_vl_tbl(l_record_num).display_name,
471             NULL,
472             p_indent_level+1);
473 
474       END IF;
475 
476   END LOOP;
477 
478   EXCEPTION
479   WHEN OTHERS THEN
480       Wf_Core.Context('wf_messages_vl_pub', 'draw_message_attr_list');
481       wf_item_definition.Error;
482 
483 END draw_message_attr_list;
484 
485 /*===========================================================================
486   PROCEDURE NAME:       draw_message_details
487 
488   DESCRIPTION:          Shows all of the details for a list of messages
489                         along with any message attribute details for that
490                         message that have been passed in.  The listing is
491                         shown as message detail and then corresponding
492                         attributes and then another message and then its detail
493 
494                         When we find an attribute that matches
495                         the current message, we copy that attribute and all
496                         that follow for that message to a temp
497                         list until we find a new message in the attribute
498                         list.  When this happens we write out the attributes
499                         using the draw_message_attr_details function.
500 
501   MODIFICATION LOG:
502    06-JUN-2001 JWSMITH BUG 1819232 - added summary attr for table tag for ADA
503 ============================================================================*/
504 PROCEDURE draw_message_details
505      (p_wf_messages_vl_tbl IN wf_messages_vl_pub.wf_messages_vl_tbl_type,
506       p_wf_message_attr_vl_tbl IN wf_messages_vl_pub.wf_message_attr_vl_tbl_type,
507       p_indent_level       IN NUMBER) IS
508 
509 l_message_record_num       NUMBER  := 1;
510 l_attr_record_num          NUMBER  := 1;
511 l_attr_marker              NUMBER  := 1;
512 l_cur_attr_record_num      NUMBER  := 1;
513 ii                         NUMBER  := 0;
514 pri                        VARCHAR2(80) := NULL;
515 l_wf_message_attr_vl_tbl     wf_messages_vl_pub.wf_message_attr_vl_tbl_type;
516 
517 BEGIN
518 
519   /*
520   ** Draw the section title for the Message detail section
521   */
522   wf_item_definition_util_pub.draw_detail_section_title (
523      wf_core.translate('WFITD_MESSAGE_DETAILS'),
524      0);
525 
526   /*
527   **  Print out all item attribute display names in the pl*sql table
528   */
529   FOR l_message_record_num IN 1..p_wf_messages_vl_tbl.count LOOP
530 
531       /*
532       ** Open a new table for each attribute so you can control the spacing
533       ** between each attribute
534       */
535       htp.tableOpen(cattributes=>'border=0 cellpadding=2 cellspacing=0
536                  summary=""');
537 
538       /*
539       ** Create the target for the hotlink from the summary view. Also
540       ** create the first row in the table which is always the display
541       ** name for the object.
542       */
543       wf_item_definition_util_pub.create_details_hotlink_target (
544         'MESSAGE',
545         p_wf_messages_vl_tbl(l_message_record_num).name,
546         p_wf_messages_vl_tbl(l_message_record_num).display_name,
547         wf_core.translate('WFITD_MESSAGE_NAME'),
548         0);
549 
550       /*
551       ** Create the internal name row in the table.
552       */
553       wf_item_definition_util_pub.draw_detail_prompt_value_pair (
554          wf_core.translate('WFITD_INTERNAL_NAME'),
555          p_wf_messages_vl_tbl(l_message_record_num).name);
556 
557       /*
558       ** Create the description row in the table
559       */
560       wf_item_definition_util_pub.draw_detail_prompt_value_pair (
561          wf_core.translate('DESCRIPTION'),
562          p_wf_messages_vl_tbl(l_message_record_num).description);
563 
564 
565       IF (p_wf_messages_vl_tbl(l_message_record_num).default_priority < 34) THEN
566           pri := wf_core.translate('HIGH');
567 
568       ELSIF (p_wf_messages_vl_tbl(l_message_record_num).default_priority > 66) THEN
569           pri := wf_core.translate('LOW');
570 
571       ELSE
572 
573           pri := wf_core.translate('MEDIUM');
574 
575       END IF;
576 
577       /*
578       ** Create the priority row in the table
579       */
580       wf_item_definition_util_pub.draw_detail_prompt_value_pair (
581          wf_core.translate('PRIORITY'), pri);
582 
583       /*
584       ** Create the Subject row in the table
585       */
586       wf_item_definition_util_pub.draw_detail_prompt_value_pair (
587          wf_core.translate('SUBJECT'),
588          p_wf_messages_vl_tbl(l_message_record_num).subject);
589 
590       /*
591       ** Create the html body row in the table
592       */
593       wf_item_definition_util_pub.draw_detail_prompt_value_pair (
594          wf_core.translate('WFITD_HTML_BODY'),
595          p_wf_messages_vl_tbl(l_message_record_num).html_body);
596 
597       /*
598       ** Create the text body row in the table
599       */
600       wf_item_definition_util_pub.draw_detail_prompt_value_pair (
601          wf_core.translate('WFITD_TEXT_BODY'),
602          p_wf_messages_vl_tbl(l_message_record_num).body);
603 
604       /*
605       ** Call function to print the read/write/execute roles
606       */
607       wf_item_definition_util_pub.draw_read_write_exe_details(
608          p_wf_messages_vl_tbl(l_message_record_num).read_role,
609          p_wf_messages_vl_tbl(l_message_record_num).write_role,
610          null,
611          FALSE);
612 
613       /*
614       ** Call function to print the customization/protection levels
615       */
616       wf_item_definition_util_pub.draw_custom_protect_details(
617          p_wf_messages_vl_tbl(l_message_record_num).custom_level,
618          p_wf_messages_vl_tbl(l_message_record_num).protect_level);
619 
620 
621       /*
622       ** Go find  the result attribute in the list of attributes
623       ** for this message
624       */
625       l_wf_message_attr_vl_tbl.delete;
626       l_cur_attr_record_num := 1;
627       l_attr_marker :=  l_attr_record_num;
628 
629       /*
630       ** Make sure there is at least on record in the message attribute
631       ** list.  If there is not then the l_attr_record_num index of 1
632       ** will cause a 6502-PL*SQL numeric or value error exception.
633       ** There is only ever 1 result attribute so once l_cur_attr_record_num
634       ** incremented then exit the loop.
635       */
636       WHILE (
637           l_cur_attr_record_num  = 1 AND
638           l_attr_marker  <=  p_wf_message_attr_vl_tbl.count AND
639           p_wf_messages_vl_tbl(l_message_record_num).display_name =
640              p_wf_message_attr_vl_tbl(l_attr_marker).message_display_name
641           ) LOOP
642 
643          /*
644          ** We have found an attribute for the current message.  Check to
645          ** see if this is the RESULT attribute.  If it is then copy the
646          ** contents of that list to a temp attr list and then pass the
647          ** temp list to the message_attribute display function to display
648          ** the result.
649          */
650          IF (p_wf_message_attr_vl_tbl(l_attr_marker).name = 'RESULT') THEN
651 
652 
653             l_wf_message_attr_vl_tbl(l_cur_attr_record_num) :=
654                 p_wf_message_attr_vl_tbl(l_attr_marker);
655 
656             l_cur_attr_record_num := l_cur_attr_record_num + 1;
657 
658             l_attr_marker := l_attr_marker + 1;
659 
660          END IF;
661 
662          l_attr_marker := l_attr_marker + 1;
663 
664       END LOOP;
665 
666       /*
667       ** If you've found a result attribute then display it.  We pass a
668       ** special value for the p_indent_level to tell it to not show
669       ** certain pieces of the attribute
670       */
671       IF (l_cur_attr_record_num > 1) THEN
672 
673           wf_messages_vl_pub.draw_message_attr_details (
674              l_wf_message_attr_vl_tbl,
675              -1);
676 
677       END IF;
678 
679       /*
680       ** Table is created so close it out
681       */
682       htp.tableClose;
683 
684       /*
685       ** Here we look for all the message attributes that are related to the
686       ** current message.  The p_wf_message_attr_vl_tbl is ordered by display
687       ** name and then by message attribute display name.  As long as we stay
688       ** in sync we should be able to correctly create the temp attribute list
689       ** for the current message.  We could create a cursor here for the child
690       ** attributes but that would break the rule of separating the UI layer
691       ** and the data layer
692       */
693       l_wf_message_attr_vl_tbl.delete;
694       l_cur_attr_record_num := 1;
695 
696       /*
697       ** Make sure there is at least on record in the message attribute
698       ** list.  If there is not then the l_attr_record_num index of 1
699       ** will cause a 6502-PL*SQL numeric or value error exception.
700       */
701       WHILE (
702           l_attr_record_num <=  p_wf_message_attr_vl_tbl.count AND
703           p_wf_messages_vl_tbl(l_message_record_num).display_name =
704              p_wf_message_attr_vl_tbl(l_attr_record_num).message_display_name
705           ) LOOP
706 
707          /*
708          ** We have found an attribute for the current message.  Copy the
709          ** contents of that list to a temp attr list and then pass the
710          ** temp list to the message_attribute display function to display
711          ** the results.  If the message attribute is named RESULT then
712          ** Skip it since it will be displayed as part of the message
713          ** definition
714          */
715          IF (p_wf_message_attr_vl_tbl(l_attr_record_num).name <> 'RESULT') THEN
716 
717             l_wf_message_attr_vl_tbl(l_cur_attr_record_num) :=
718                 p_wf_message_attr_vl_tbl(l_attr_record_num);
719             l_cur_attr_record_num := l_cur_attr_record_num + 1;
720 
721          END IF;
722 
723          l_attr_record_num := l_attr_record_num + 1;
724 
725       END LOOP;
726 
727       /*
728       ** If the l_cur_attr_record_num is greater than 1 then you
729       ** must have found an attribute for this message.  Copy that
730       ** set of attributes to a temporary pl*sql table and then
731       ** print it out.
732       */
733       IF (l_cur_attr_record_num > 1) THEN
734 
735         /*
736         ** Put in a couple of blank lines between the current message
737         ** and its attributes
738         */
739         htp.p('<BR><BR>');
740 
741         /*
742         ** List all the message attribute details for this message that
743         ** we found above.
744         */
745         wf_messages_vl_pub.draw_message_attr_details (
746            l_wf_message_attr_vl_tbl,
747            1);
748 
749         /*
750         ** If you still have more messages to process then put in a
751         ** few blank lines and put in another Message Details Header
752         */
753         IF (l_message_record_num < p_wf_messages_vl_tbl.count) THEN
754 
755            /*
756            ** Put in a couple of blank lines between the current message
757            ** attributes and the next message
758            */
759            htp.p('<BR><BR>');
760 
761            /*
762            ** Draw the section title for the Message detail section
763            */
764            wf_item_definition_util_pub.draw_detail_section_title (
765               wf_core.translate('WFITD_MESSAGE_DETAILS'),
766               0);
767 
768         END IF;
769 
770      END IF;
771 
772 
773      /*
774      ** Draw a line between each message definition
775      ** if this is not the last item in the list and if there
776      ** are no attributes in the attribute list for this message.
777      */
778      IF (l_message_record_num < p_wf_messages_vl_tbl.count AND
779          l_cur_attr_record_num = 1) THEN
780 
781          htp.p ('<HR noshade size="1">');
782 
783      END IF;
784 
785   END LOOP;
786 
787   EXCEPTION
788   WHEN OTHERS THEN
789       Wf_Core.Context('wf_messages_vl_pub', 'draw_message_details');
790       wf_item_definition.Error;
791 
792 END draw_message_details;
793 
794 /*===========================================================================
795   PROCEDURE NAME:       draw_message_attr_details
796 
797   DESCRIPTION:          Shows all of the details for a list of
798                         message attributes for that have been passed
799                         in.
800 
801   MODIFICATION LOG:
802    06-JUN-2001 JWSMITH BUG 1819232 - added summary attr for table tag for ADA
803 ============================================================================*/
804 PROCEDURE draw_message_attr_details
805      (p_wf_message_attr_vl_tbl IN wf_messages_vl_pub.wf_message_attr_vl_tbl_type,
806       p_indent_level              IN NUMBER) IS
807 
808 l_record_num       NUMBER;
809 ii                 NUMBER  := 0;
810 
811 BEGIN
812 
813   /*
814   ** Draw the section title for the message attribute detail section
815   ** If p_indent_level is = -1 then you are printing some special component
816   ** of the parent object that is stored as an attribute but really is
817   ** shown as part of the parent item in the builder
818   */
819   IF (p_indent_level <> -1) THEN
820 
821      wf_item_definition_util_pub.draw_detail_section_title (
822         wf_core.translate('WFITD_MESSAGE_ATTR_DETAILS'),
823         0);
824 
825   END IF;
826 
827   /*
828   **  Print out all meesage attribute display names in the pl*sql table
829   */
830   FOR l_record_num IN 1..p_wf_message_attr_vl_tbl.count LOOP
831 
832       IF (p_indent_level <> -1) THEN
833 
834          /*
835          ** Open a new table for each attribute so you can control the spacing
836          ** between each attribute
837          */
838          htp.tableOpen(cattributes=>'border=0 cellpadding=2 cellspacing=0
839                summary=""');
840 
841          /*
842          ** Create the target for the hotlink from the summary view. Also
843          ** create the first row in the table which is always the display
844          ** name for the object.
845          */
846          wf_item_definition_util_pub.create_details_hotlink_target (
847            'MESSAGE_ATTR',
848            p_wf_message_attr_vl_tbl(l_record_num).message_name||':'||
849                 p_wf_message_attr_vl_tbl(l_record_num).name,
850            p_wf_message_attr_vl_tbl(l_record_num).display_name,
851            wf_core.translate('WFITD_MESSAGE_ATTR_NAME'),
852            0);
853 
854          /*
855          ** Create the internal name row in the table.
856          */
857          wf_item_definition_util_pub.draw_detail_prompt_value_pair (
858             wf_core.translate('WFITD_INTERNAL_NAME'),
859             p_wf_message_attr_vl_tbl(l_record_num).name);
860 
861          /*
862          ** Create the message display name row in the table.
863          */
864          wf_item_definition_util_pub.draw_detail_prompt_value_pair (
865             wf_core.translate('WFITD_MESSAGE_NAME'),
866             p_wf_message_attr_vl_tbl(l_record_num).message_display_name);
867 
868       ELSE
869 
870          /*
871          ** Create the attribute display name row in the table.
872          */
873          wf_item_definition_util_pub.draw_detail_prompt_value_pair (
874             wf_core.translate('WFITD_RESULT_DISPLAY_NAME'),
875             p_wf_message_attr_vl_tbl(l_record_num).display_name);
876 
877       END IF;
878 
879       /*
880       ** Create the description row in the table
881       */
882       wf_item_definition_util_pub.draw_detail_prompt_value_pair (
883          wf_core.translate('DESCRIPTION'),
884          p_wf_message_attr_vl_tbl(l_record_num).description);
885 
886       /*
887       ** Create the attribute type row in the table
888       */
889       wf_item_definition_util_pub.draw_detail_prompt_value_pair (
890             wf_core.translate('WFITD_ATTRIBUTE_TYPE'),
891             wf_core.translate('WFITD_ATTR_TYPE_'||
892             p_wf_message_attr_vl_tbl(l_record_num).type));
893 
894       /*
895       ** Create the length/format/lookup type row in the table.
896       ** If the type is VARCHAR2 then show a length prompt
897       ** If the type is NUMBER/DATE then show format prompt
898       ** If the type is LOOKUP then show lookup type prompt
899       ** If it is any other type then don't show the row at all
900       */
901       IF (p_wf_message_attr_vl_tbl(l_record_num).type = 'VARCHAR2') THEN
902 
903          wf_item_definition_util_pub.draw_detail_prompt_value_pair (
904             wf_core.translate('LENGTH'),
905             p_wf_message_attr_vl_tbl(l_record_num).format);
906 
907       ELSIF (p_wf_message_attr_vl_tbl(l_record_num).type IN ('NUMBER', 'DATE')) THEN
908 
909          wf_item_definition_util_pub.draw_detail_prompt_value_pair (
910             wf_core.translate('FORMAT'),
911             p_wf_message_attr_vl_tbl(l_record_num).format);
912 
913       ELSIF (p_wf_message_attr_vl_tbl(l_record_num).type = 'LOOKUP') THEN
914 
915          wf_item_definition_util_pub.draw_detail_prompt_value_pair (
916             wf_core.translate('LOOKUP'),
917             p_wf_message_attr_vl_tbl(l_record_num).lookup_type_display_name);
918 
919       ELSIF (p_wf_message_attr_vl_tbl(l_record_num).type IN ('URL','DOCUMENT')) THEN
920          /*
921          ** If it is URL or DOCUMENT, indicate where the resulting page should be displayed
922          */
923          IF (NVL(p_wf_message_attr_vl_tbl(l_record_num).format, '_top') = '_top') THEN
924             wf_item_definition_util_pub.draw_detail_prompt_value_pair
925                    (wf_core.translate('WFITD_FRAME_TARGET'), wf_core.translate('WFITD_TOP'));
926          ELSIF (p_wf_message_attr_vl_tbl(l_record_num).format = '_blank') THEN
927             wf_item_definition_util_pub.draw_detail_prompt_value_pair
928                    (wf_core.translate('WFITD_FRAME_TARGET'), wf_core.translate('WFITD_BLANK'));
929          ELSIF (p_wf_message_attr_vl_tbl(l_record_num).format = '_self') THEN
930             wf_item_definition_util_pub.draw_detail_prompt_value_pair
931                    (wf_core.translate('WFITD_FRAME_TARGET'), wf_core.translate('WFITD_SELF'));
932          ELSIF (p_wf_message_attr_vl_tbl(l_record_num).format = '_parent') THEN
933             wf_item_definition_util_pub.draw_detail_prompt_value_pair
934                    (wf_core.translate('WFITD_FRAME_TARGET'), wf_core.translate('WFITD_PARENT'));
935          END IF;
936 
937          /*
938          ** If the message attribute is a send, then display the attachment
939          ** preference.
940          */
941          IF p_wf_message_attr_vl_tbl(l_record_num).subtype = 'SEND' THEN
942             IF NVL(p_wf_message_attr_vl_tbl(l_record_num).attach, 'N') = 'Y' THEN
943                wf_item_definition_util_pub.draw_detail_prompt_value_pair (
944                   wf_core.translate('WFITD_ATTACH'),
945                   wf_core.translate('WFITD_YES'));
946             ELSE
947                wf_item_definition_util_pub.draw_detail_prompt_value_pair (
948                   wf_core.translate('WFITD_ATTACH'),
949                   wf_core.translate('WFITD_NO'));
950             END iF;
951 
952          END IF;
953       END IF;
954 
955       /*
956       ** Create the source row in the table
957       */
958       IF (p_indent_level <> -1) THEN
959 
960          wf_item_definition_util_pub.draw_detail_prompt_value_pair (
961             wf_core.translate('WFITD_SOURCE'),
962             wf_core.translate('WFITD_MSG_SOURCE_TYPE_'||
963                p_wf_message_attr_vl_tbl(l_record_num).subtype));
964 
965       END IF;
966 
967       /*
968       ** Create the default type row
969       */
970       wf_item_definition_util_pub.draw_detail_prompt_value_pair (
971          wf_core.translate('WFITD_DEFAULT_TYPE'),
972          wf_core.translate('WFITD_DEFAULT_TYPE_'||
973             p_wf_message_attr_vl_tbl(l_record_num).value_type));
974 
975       /*
976       ** If the default value is a constant then show the default value type
977       ** that is not null. If the default value is based on an item attribute
978       ** then show the attr_default_display_name.
979       */
980       IF (p_wf_message_attr_vl_tbl(l_record_num).value_type = 'ITEMATTR') THEN
981 
982          /*
983          ** Create the default item attribute row in the table. This is based on the
984          ** p_wf_message_attr_vl_tbl(l_record_num).attr_default_display_name
985          */
986          wf_item_definition_util_pub.draw_detail_prompt_value_pair (
987             wf_core.translate('WFITD_DEFAULT_VALUE'),
988             p_wf_message_attr_vl_tbl(l_record_num).attr_default_display_name);
989 
990 
991       /*
992       ** Create the default value row in the table.   If the attribute type is based on
993       ** a lookup then the default value must be one of the lookup codes.  If so print
994       ** the lookup code that was fetch.
995       */
996       ELSIF (p_wf_message_attr_vl_tbl(l_record_num).type = 'LOOKUP') THEN
997 
998          wf_item_definition_util_pub.draw_detail_prompt_value_pair (
999             wf_core.translate('WFITD_DEFAULT_VALUE'),
1000             p_wf_message_attr_vl_tbl(l_record_num).lookup_code_display_name);
1001 
1002       /*
1003       ** If this is any other attribute type then
1004       ** nvl on text value.  If there is no text value then try the number
1005       ** default.  If there is no number default then try the date.
1006       */
1007       ELSE
1008 
1009          wf_item_definition_util_pub.draw_detail_prompt_value_pair (
1010             wf_core.translate('WFITD_DEFAULT_VALUE'),
1011             NVL(p_wf_message_attr_vl_tbl(l_record_num).text_default,
1012                NVL(TO_CHAR(p_wf_message_attr_vl_tbl(l_record_num).number_default),
1013                   TO_CHAR(p_wf_message_attr_vl_tbl(l_record_num).date_default))));
1014 
1015       END IF;
1016       /*
1017       ** Table is created so close it out
1018       */
1019       htp.tableClose;
1020 
1021       /*
1022       ** Draw a line between each message attribute definition
1023       ** if this is not the last item in the list
1024       */
1025       IF (l_record_num <> p_wf_message_attr_vl_tbl.count AND
1026           p_indent_level <> -1) THEN
1027 
1028          htp.p ('<HR noshade size="1">');
1029 
1030       END IF;
1031 
1032   END LOOP;
1033 
1034   EXCEPTION
1035   WHEN OTHERS THEN
1036       Wf_Core.Context('wf_messages_vl_pub', 'draw_message_attr_details');
1037       wf_item_definition.Error;
1038 
1039 END draw_message_attr_details;
1040 
1041 END wf_messages_vl_pub;