DBA Data[Home] [Help]

PACKAGE BODY: APPS.WF_LOV

Source


1 package body WF_LOV as
2 /* $Header: wflovb.pls 120.1 2005/07/02 03:49:13 appldev ship $ */
3 
4 --
5 -- Error (PRIVATE)
6 --   Print a page with an error message.
7 --   Errors are retrieved from these sources in order:
8 --     1. wf_core errors
9 --     2. Oracle errors
10 --     3. Unspecified INTERNAL error
11 --
12 procedure Error
13 as
14 
15 begin
16  null;
17 end Error;
18 
19 /*===========================================================================
20   PROCEDURE NAME:       OpenLovWinHtml
21 
22   DESCRIPTION:          Generates javascript required to run the HTML LOV.
23                         Insert the javascript statements in the header of
24                         the Document that will call the LOV window.
25 
26 ============================================================================*/
27 procedure OpenLovWinHtml(p_jscript_tag     IN Varchar2 ) is
28 
29 begin
30 
31    IF (p_jscript_tag = 'Y') THEN
32 
33       htp.p('<SCRIPT LANGUAGE="JavaScript"> <!-- hide the script''s contents from feeble browsers');
34 
35    END IF;
36 
37    htp.p('// global for brower version branching');
38    htp.p('var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))');
39    htp.p('var IELinkClicks');
40 
41    htp.p('// code for modal lov window');
42    htp.p('var FNDLOVwindow = new Object();');
43 
44    htp.p(
45       'function fnd_open_window(url,x,y)
46        {
47           var x1 = x - 16;
48           var y1 = y - 50;
49           var url2 = url + "&width=" + x1 + "&height=" + y1;
50 
51           var attributes=
52              "bgColor=red,resizable=yes,scrollbars=no,toolbar=no,menubar=no,width="+x+",height="+ y;
53 
54           FNDLOVwindow.win = window.open(url2, "FNDLOVwindow", attributes);
55 
56           FNDLOVwindow.win.focus();
57 
58           FNDLOVwindow.win.opener = self;
59 
60           FNDLOVwindow.open = true;
61        }'
62    );
63 
64     -- event handler to prevent any Navigator action when modal is active
65     htp.p('function deadend() {
66       if (FNDLOVwindow.win && !FNDLOVwindow.win.closed) {
67         FNDLOVwindow.win.focus()
68         return false
69       }
70     }');
71 
72     -- preserve IE link onclick event handlers while they're disabled
73     -- restore when re-enabling the main window
74     htp.p('function disableForms() {
75       IELinkClicks = new Array()
76       for (var h = 0; h < frames.length; h++) {
77         for (var i = 0; i < frames[h].document.forms.length; i++) {
78           for (var j = 0; j < frames[h].document.forms[i].elements.length; j++) {
79              frames[h].document.forms[i].elements[j].disabled = true
80           }
81         }
82         IELinkClicks[h] = new Array()
83         for (i = 0; i < frames[h].document.links.length; i++) {
84           IELinkClicks[h][i] = frames[h].document.links[i].onclick
85           frames[h].document.links[i].onclick = deadend
86         }
87       }
88     }');
89 
90     htp.p('function enableForms() {
91       for (var h = 0; h < frames.length; h++) {
92         for (var i = 0; i < frames[h].document.forms.length; i++) {
93           for (var j = 0; j < frames[h].document.forms[i].elements.length; j++) {
94             frames[h].document.forms[i].elements[j].disabled = false
95           }
96         }
97         for (i = 0; i < top.frames[h].document.links.length; i++) {
98             frames[h].document.links[i].onclick = IELinkClicks[h][i]
99         }
100       }
101     }');
102 
103     -- a little extra help for Navigator
104     htp.p('function blockEvents() {
105       if (Nav4) {
106         window.captureEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS)
107         window.onclick = deadend
108         window.onfocus = checkModal
109       } else {
110         disableForms()
111       }
112     }');
113 
114     htp.p('function unblockEvents() {
115       if (Nav4) {
116         window.releaseEvents(Event.CLICK | Event.MOUSEDOWN | Event.MOUSEUP | Event.FOCUS)
117         window.onclick = null
118         window.onfocus = null
119       } else {
120         enableForms()
121       }
122     }');
123 
124     -- invoked by onFocus event handler of EVERY frame's document
125     htp.p('function checkModal() {
126       if (FNDLOVwindow.open && FNDLOVwindow.win && !FNDLOVwindow.win.closed) {
127           FNDLOVwindow.win.focus()
128       }
129     }');
130 
131     -- clear 'opener' reference in a modal
132     htp.p('function cancelModal() {
133       if (FNDLOVwindow.win && !FNDLOVwindow.win.closed) {
134         FNDLOVwindow.win.opener = null;
135         FNDLOVwindow.open = false;
136       }
137     }');
138 
139     htp.p('// end of modal lov code');
140 
141    IF (p_jscript_tag = 'Y') THEN
142 
143       htp.p('<!-- done hiding from old browsers --> </SCRIPT>');
144       htp.p('<NOSCRIPT>' || WF_CORE.Translate('WFA_NOSCRIPT') || '</NOSCRIPT>');
145    END IF;
146 
147    exception
148    when others then
149       Wf_Core.Context('wf_lov', 'OpenLovWinHtml');
150       raise;
151 
152 end OpenLovWinHtml;
153 
154 /*===========================================================================
155   FUNCTION NAME:        GenerateLovURL
156 
157   DESCRIPTION:          Generates the URL syntax required to launch
158                         the lov window for the given field.
159 
160 ============================================================================*/
161 function GenerateLovURL (p_form_name       IN Varchar2,
162                          p_query_plsql     IN Varchar2,
163                          p_query_params    IN Varchar2,
164                          p_column_names    IN Varchar2,
165                          p_longlist        IN Varchar2,
166                          p_callback        IN Varchar2 ,
167                          p_callback_params IN Varchar2 ,
168                          p_init_find_field IN Varchar2 ,
169                          p_width           IN Varchar2,
170                          p_height          IN Varchar2,
171                          p_prompt          IN Varchar2 ,
172                          p_window_title    IN Varchar2 )
173 return VARCHAR2
174 IS
175 
176 l_url     VARCHAR2(4000);
177 
178 BEGIN
179 
180     l_url := '"javascript:fnd_open_window('||''''||
181                'wf_lov.lovapplet'||
182                '?doc_name='       ||p_form_name||
183                '&column_names='   ||p_column_names||
184                '&query_params='   ||p_query_params||
185                '&query_plsql='    ||p_query_plsql||
186                '&longlist='       ||p_longlist||
187                '&callback='       ||p_callback||
188                '&callback_params='||p_callback_params||
189                '&initial_find='   ||p_init_find_field||
190                '&window_title='   ||p_window_title||
191                ''''||
192                ','||p_width||','||p_height||')" ';
193 
194     if p_prompt is not null then
195        l_url := l_url|| ' OnMouseOver="window.status='''||p_prompt||
196                 ''';return true" ';
197     end if;
198 
199 
200     return (l_url);
201 
202 exception
203   when others then
204     rollback;
205     wf_core.context('Wf_Lov', 'GenerateLovURL',
206                          p_form_name    ,
207                          p_query_plsql  ,
208                          p_query_params ,
209                          p_column_names ,
210                          p_longlist     );
211 
212     wf_lov.Error;
213 END GenerateLovURL;
214 
215 procedure CreateButton (when_pressed_url in varchar2,
216                         onmouseover in varchar2,
217                         icon_top in varchar2,
218                         icon_name in varchar2,
219                         show_text in varchar2) is
220 begin
221 
222    htp.p('<TABLE border=0 cellpadding=0 cellspacing=0 align=right summary="">');
223 
224    htp.p('<TR> <TD align="right" height=22 rowspan=3 id=""><A href="'||when_pressed_url||'" '||
225          onmouseover||'>'||
226          '<IMG src="'||icon_top||'FNDJLFRL.gif" height=22 width=15 border=0 alt=""></A></TD>'||
227          '<TD height=1 bgcolor=#FFFFFF colspan=2><IMG src="'||icon_top||
228          'FNDINVDT.gif" height=1 width=1 alt=""></TD>'||
229          '<TD height=22 rowspan=3 id=""><A href="'||when_pressed_url||'" '||onmouseover||
230          '><IMG src="'||icon_top||'FNDJLFRR.gif" height=22 width=15 border=0 alt=""></A>'||
231          '</TD></TR>'||
232          '<TR> <TD height=20 bgcolor=#cccccc id=""><A href="'||when_pressed_url||
233          '" '||onmouseover||'><IMG src="'||icon_top||icon_name||'" border=0 alt="' || onmouseover || '"></A></TD>'||
234          '<TD id="" height=20 align=center valign=center bgcolor=#cccccc nowrap><A href="'||
235          when_pressed_url||'" style="text-decoration:none" '||onmouseover||
236          '><FONT size=2 face="Arial,Helvetica,Geneva"  color=#000000>'||show_text||
237          '</FONT></A></TD></TR>'||
238          '<TR> <TD height=1 bgcolor=#000000 colspan=2 id=""><IMG src="'||icon_top||
239          'FNDINVDT.gif" width=1 height=1></TD></TR>');
240 
241    htp.p('</TABLE>');
242 
243 exception
244   when others then
245     rollback;
246     wf_core.context('Wf_Lov', 'create_reg_button',when_pressed_url,onmouseover,
247                     icon_top,icon_name,show_text);
248     wf_lov.Error;
249 
250 end CreateButton;
251 
252 procedure LovApplet(doc_name        varchar2,
253                     column_names    varchar2,
254                     query_params    varchar2,
255                     query_plsql     varchar2,
256                     callback        varchar2 ,
257                     callback_params varchar2 ,
258                     longlist        varchar2,
259                     initial_find    varchar2 ,
260                     width           varchar2,
261                     height          varchar2,
262                     window_title    varchar2 ) IS
263 
264 username varchar2(320);   -- Username to query
265 lang_codeset varchar2(50);
266 col_num varchar2(20);
267 l_document_position number := 0;
268 i number;
269 l_url         varchar2(1000);
270 l_media       varchar2(240) := wfa_html.image_loc;
271 l_icon        varchar2(30);
272 l_text        varchar2(30) := '';
273 l_onmouseover varchar2(240);
274 l_params      varchar2(240) := callback_params;
275 l_window_name varchar2(240);
276 name          varchar2(1000);
277 buffer        varchar2(1000);
278 col_names     varchar2(1000) := column_names;
279 callback_str  varchar2(2000) := callback;
280 
281 
282 begin
283 
284   -- Check session and current user
285   wfa_sec.GetSession(username);
286 
287   lang_codeset := substr(userenv('LANGUAGE'),
288                          instr(userenv('LANGUAGE'),'.')+1,
289                          length(userenv('LANGUAGE')));
290 
291   l_document_position := INSTR(UPPER(doc_name), '.DOCUMENT');
292   /*
293   ** Strip off the document object information from the document hierarchy
294   ** so we can run javascript functions on the window and/or frame
295   */
296   l_window_name := SUBSTR(doc_name, 1, l_document_position-1);
297 
298 
299   htp.htmlOpen;
300   htp.headOpen;
301 
302   IF (window_title IS NOT NULL) THEN
303 
304      htp.title(window_title);
305 
306   ELSE
307 
308      htp.title(wf_core.translate('WFPREF_LOV'));
309 
310   END IF;
311 
312   htp.p('<SCRIPT LANGUAGE="JavaScript1.2"> <!-- hide the script''s contents from feeble browsers');
313 
314   if doc_name <> 'PRELOAD' then -- added to prevent js errors on lov preload
315 
316   htp.p(
317       'function set_value()
318        {');
319 
320   -- added for modal lov functionality
321   htp.p(l_window_name||'.unblockEvents();');
322 
323   name := col_names;
324   i := 0;
325 
326   /*
327   ** Loop through the fields to set and set the values based
328   ** on a hard coded field list lovValue0-15
329   */
330   while (instr(col_names, ',') <> 0) loop
331 
332       name := substr(col_names, 1, instr(col_names, ',')-1);
333       col_names := substr(col_names, instr(col_names, ',')+1,
334                          length(col_names)-length(name)-1);
335 
336       IF (name <> 'NULL') THEN
337 
338          htp.p(doc_name||'.'||name||'.value = top.parent.document.LovApplet.lovValue'||to_char(i)||';');
339 
340       END IF;
341 
342       i := i + 1;
343 
344   end loop;
345 
346   /*
347   ** Check to see if there's anything left after the loop to get.
348   ** there should be something left after the last comma.
349   */
350   IF (col_names <> 'NULL') THEN
351 
352      htp.p(doc_name||'.'||col_names||'.value = parent.document.LovApplet.lovValue'||i||';');
353 
354   end if;
355 
356 
357   /*
358   ** Create the callback function and callback parameters syntax
359   */
360   if (LENGTH(callback_str) > 0) then
361 
362       callback_str := callback_str || '(';
363 
364   end if;
365 
366   i := 0;
367 
368   while (instr(l_params, ',') <> 0) loop
369 
370       /*
371       ** If the buffer has at least one other field already then
372       ** add a comma to the string
373       */
374       IF (i > 0) THEN
375 
376          callback_str := callback_str || ',';
377 
378       END IF;
379 
380       col_num   := substr(l_params, 1, instr(l_params, ',')-1);
381 
382       l_params := substr(l_params, instr(l_params, ',')+1,
383                          length(l_params)-length(col_num)-1);
384 
385       callback_str := callback_str || 'parent.document.LovApplet.lovValue'||col_num;
386 
387       i := i + 1;
388 
389   end loop;
390 
391   /*
392   ** Check to see if there's anything left after the loop to get.
393   ** there should be something left after the last comma.
394   */
395   IF (LENGTH(l_params) > 0) THEN
396 
397       /*
398       ** If the buffer has at least one other field already then
399       ** add a comma to the string
400       */
401       IF (i > 0) THEN
402 
403          callback_str := callback_str || ',';
404 
405       END IF;
406 
407       callback_str := callback_str || 'parent.document.LovApplet.lovValue'||l_params;
408 
409   end if;
410 
411   if (LENGTH(callback_str) > 0) then
412 
413       callback_str := callback_str || ');';
414 
415   end if;
416 
417   htp.p(callback_str);
418 
419   htp.p(l_window_name||'.cancelModal();');
420 
421   htp.p('window.close();}');
422 
423   htp.p('<!-- done hiding from old browsers --> </SCRIPT>');
424   htp.p('<NOSCRIPT>' || WF_CORE.Translate('WFA_NOSCRIPT') || '</NOSCRIPT>');
425   htp.p('<SCRIPT LANGUAGE="JavaScript1.2"> <!-- hide the script''s contents from feeble browsers');
426 
427   -- added 'if (opener)...' line for modal lov functionality
428   htp.p(
429       'function cancel_lov()
430        {
431          if (opener.parent) {
432            '||l_window_name||'.unblockEvents();
433            '||l_window_name||'.cancelModal();
434          }
435 
436          window.close();
437 
438         }'
439   );
440   end if;  -- PRELOAD
441 
442   -- added for modal lov functionality
443   htp.p('var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))');
444 
445   htp.p('function forceFocus() {
446     if (!Nav4) {
447       window.focus();
448     }
449   }');
450 
451   htp.p('<!-- done hiding from old browsers --> </SCRIPT>');
452 
453   htp.p('<SCRIPT LANGUAGE="JavaScript1.2"> <!-- hide the script''s contents from feeble browsers');
454 
455   htp.p(
456       'function helper()
457        {
458          var encoded_value = '||initial_find|| '
459 
460          document.write("<applet code=\"oracle.apps.fnd.wf.LovApplet.class\" codebase=\"/OA_JAVA\" archive=\"/OA_JAVA/oracle/apps/fnd/wf/jar/wflov.jar\" width=100% height=90% name=LovApplet>");
461 
462          document.write("<param name=QUERY_PARAMS value='||query_params||'>")');
463 
464          htp.p('document.write("<param name=QUERY_URL value='||
465                wfa_html.base_url(get_from_resources=>TRUE)||
466                '/'||query_plsql||'>")');
467 
468          htp.p('document.write("<param name=LONGLIST value='||longlist||'>")');
469          htp.p('document.write("<param name=INITIAL_FIND value="+"\""+encoded_value+"\""+">")');
470          htp.p('document.write("<param name=LANGCODESET value='||lang_codeset||'>")');
471          htp.p('document.write("<param name=title value='||'LOV'||'>")');
472          htp.p('document.write("<\/applet>");');
473   htp.p('}');
474 
475   htp.p('<!-- done hiding from old browsers --> </SCRIPT>');
476 
477   htp.p('<NOSCRIPT>' || WF_CORE.Translate('WFA_NOSCRIPT') || '</NOSCRIPT>');
478 
479   htp.p('<param name=QUERY_URL value="' ||
480        wfa_html.base_url(get_from_resources=>TRUE)||
481        '/'|| query_plsql || '">');
482 
483   htp.p('<param name=LONGLIST value="' || longlist || '">');
484 
485   htp.headclose;
486 
487   if doc_name <> 'PRELOAD' then -- added to prevent js errors on lov preload
488     htp.p('<body BGCOLOR="#CCCCCC" onLoad="if (opener.parent) '||
489        l_window_name||'.blockEvents(); forceFocus()" onFocus="forceFocus()">');
490   else
491     htp.p('<body BGCOLOR="#FFFFFF">');
492   end if;
493 
494   htp.p('<form name="LOVWin">');
495 
496   htp.p('<SCRIPT LANGUAGE="JavaScript1.2"> <!-- hide the script''s contents from feeble browsers');
497 
498   htp.p('helper();');
499 
500   htp.p('<!-- done hiding from old browsers --> </SCRIPT>');
501   htp.p('<NOSCRIPT>' || WF_CORE.Translate('WFA_NOSCRIPT') || '</NOSCRIPT>');
502 
503   l_url         := 'javascript:cancel_lov()';
504   l_icon        := 'FNDJLFCN.gif';
505   l_text        := wf_core.translate ('CANCEL');
506   l_onmouseover := wf_core.translate ('CANCEL');
507 
508   CreateButton (l_url, l_onmouseover, l_media, l_icon, l_text);
509 
510   l_url         := 'javascript:set_value()';
511   l_icon        := 'FNDJLFOK.gif';
512   l_text        := wf_core.translate ('WFMON_OK');
513   l_onmouseover := wf_core.translate ('WFMON_OK');
514 
515   CreateButton (l_url, l_onmouseover, l_media, l_icon, l_text);
516 
517   htp.p('</form>');
518   htp.p('</body>');
519   htp.htmlclose;
520 
521 
522 exception
523   when others then
524     rollback;
525     wf_core.context('Wf_Pref', 'lang_lov_applet');
526     wf_lov.error;
527 
528 end LovApplet;
529 
530 
531 procedure display_lov
532 (
533 p_lov_name            in varchar2 ,
534 p_display_name        in varchar2 ,
535 p_validation_callback in varchar2 ,
536 p_dest_hidden_field   in varchar2 ,
537 p_dest_display_field  in varchar2 ,
538 p_current_value       in varchar2 ,
539 p_param1              in varchar2 ,
540 p_param2              in varchar2 ,
541 p_param3              in varchar2 ,
542 p_param4              in varchar2 ,
543 p_param5              in varchar2 ,
544 p_display_key         in varchar2
545 ) IS
546 
547 username	varchar2(320);
548 l_display_name  varchar2(360);
549 
550 BEGIN
551 
552   WFA_SEC.GetSession(username);
553 
554  /*  Check the display_key.  If 'Y' then translate p_display_name and store
555   *  in l_display_name
556   */
557 
558   if (p_display_key='Y') then
559      l_display_name := wf_core.translate(p_display_name);
560   end if;
561 
562   /*
563   ** Set the title for the window
564   **
565   ** Check to see if the key is passed, if yes then display the variable
566   ** storing the translated value.
567   */
568 if (p_display_key='Y') then
569   htp.title(l_display_name);
570 
571   /*
572   ** Now create the summary/detail frameset
573   */
574   htp.p ('<FRAMESET ROWS="75,*" BORDER=0 BGCOLOR="#CCCCCC" TITLE="' ||
575          l_display_name || '" LONGDESC="' || owa_util.get_owa_service_path ||
576          'wfa_html.LongDesc?p_token="' || p_lov_name || '">');
577 else
578    htp.title(p_display_name);
579 
580    htp.p ('<FRAMESET ROWS="75,*" BORDER=0 BGCOLOR="#CCCCCC" TITLE="' ||
581          p_display_name || '" LONGDESC="' || owa_util.get_owa_service_path ||
582          'wfa_html.LongDesc?p_token="' || p_lov_name || '">');
583 
584 end if;
585 
586   /*
587   ** Create the summary frame
588   */
589 
590   htp.p ('<FRAME NAME=FIND '||
591          'SRC='||
592          owa_util.get_owa_service_path||
593          'wf_lov.display_lov_find?p_lov_name='||
594          wfa_html.conv_special_url_chars(p_lov_name)||
595          '&p_display_name='||p_display_name||
596          '&p_validation_callback='|| p_validation_callback||
597          '&p_dest_hidden_field='||p_dest_hidden_field||
598          '&p_dest_display_field='||p_dest_display_field||
599          '&p_current_value='||
600          wfa_html.conv_special_url_chars(p_current_value)||
601          '&p_autoquery=Y'||'&p_display_key='||p_display_key||
602          ' MARGINHEIGHT=10 MARGINWIDTH=10 FRAMEBORDER=0 WRAP=OFF TITLE="' ||
603          p_display_name || '" LONGDESC="' || owa_util.get_owa_service_path ||
604          'wfa_html.LongDesc?p_token="' || p_lov_name || '">');
605 
606 
607   /*
608   ** Create the details frame
609   */
610 htp.p('details frame p_display_name is '||p_display_name);
611  htp.p ('<FRAME NAME=DETAILS '||
612          'SRC='||
613          owa_util.get_owa_service_path||
614          'wf_lov.display_lov_details?p_lov_name='||
615          wfa_html.conv_special_url_chars(p_lov_name)||
616          '&p_display_name='||p_display_name||
617          '&p_validation_callback='||p_validation_callback||
618         '&p_dest_hidden_field='||p_dest_hidden_field||
619          '&p_dest_display_field='||p_dest_display_field||
620          '&p_autoquery=Y'||
621          '&p_param1='||
622              wfa_html.conv_special_url_chars(p_param1)||
623          '&p_param2='||
624              wfa_html.conv_special_url_chars(p_param2)||
625          '&p_param3='||
626              wfa_html.conv_special_url_chars(p_param3)||
627          '&p_param4='||
628              wfa_html.conv_special_url_chars(p_param4)||
629          '&p_param5='||
630              wfa_html.conv_special_url_chars(p_param5)||
631          '&p_display_key='||p_display_key||
632          ' MARGINHEIGHT=10 MARGINWIDTH=10 FRAMEBORDER=YES TITLE="' ||
633          p_display_name || '" LONGDESC="' || owa_util.get_owa_service_path ||
634          'wfa_html.LongDesc?p_token="' || p_lov_name || '">');
635 
636   /*
637   ** Close the summary/details frameset
638   */
639   htp.p ('</FRAMESET>');
640 
641   htp.bodyclose;
642   htp.htmlclose;
643 
644 
645 exception
646   when others then
647     rollback;
648     wf_core.context('Wf_Lov', 'display_lov');
649     wf_lov.error;
650 
651 end display_lov;
652 
653 
654 procedure display_lov_find (
655 p_lov_name                in varchar2 ,
656 p_display_name            in varchar2 ,
657 p_validation_callback     in varchar2 ,
658 p_dest_hidden_field       in varchar2 ,
659 p_dest_display_field      in varchar2 ,
660 p_current_value           in varchar2 ,
661 p_autoquery               in varchar2 ,
662 p_display_key             in varchar2 )
663 
664 IS
665 
666 username	varchar2(320);
667 l_display_name  varchar2(360);
668 
669 BEGIN
670 
671   WFA_SEC.GetSession(username);
672 
673 if (p_display_key='Y') then
674    l_display_name := wf_core.translate(p_display_name);
675 end if;
676 
677   htp.headopen;
678 
679   htp.p ('<SCRIPT LANGUAGE="JavaScript">');
680 
681   htp.p('function LOV_submit()
682          {
683             parent.DETAILS.document.WF_DETAILS.p_lov_name.value = '||
684                ''''||p_lov_name||''''||';
685             parent.DETAILS.document.WF_DETAILS.p_display_name.value = '||
686                ''''||p_display_name||''''||';
687             parent.DETAILS.document.WF_DETAILS.p_validation_callback.value = '||
688                ''''||p_validation_callback||''''||';
689             parent.DETAILS.document.WF_DETAILS.p_dest_hidden_field.value = '||
690               ''''||p_dest_hidden_field||''''||';
691             parent.DETAILS.document.WF_DETAILS.p_dest_display_field.value = '||
692               ''''||p_dest_display_field||''''||';
693             parent.DETAILS.document.WF_DETAILS.p_current_value.value =
694                document.WF_FIND.p_current_value.value;
695             parent.DETAILS.document.WF_DETAILS.p_autoquery.value = '||
696               ''''||'N'||''''||';
697             parent.DETAILS.document.WF_DETAILS.p_start_row.value = 1;
698             parent.DETAILS.document.WF_DETAILS.submit();
699           }');
700 
701   htp.p('function fnd_get_searchtext()
702          {
703              if ('||p_current_value||'!= "")
704              {
705                  document.WF_FIND.p_current_value.value = '||
706                      p_current_value||';
707               }
708          }');
709 
710   htp.p('function fnd_launch_query()
711          {
712              if (document.WF_FIND.p_current_value.value == "")
713              {
714                 alert("'||wf_core.translate('WFLOV_NO_CRITERIA')||'");
715                 document.WF_FIND.p_current_value.focus();
716              }
717              else
718              {
719                   LOV_submit();
720               }
721           }');
722 
723   htp.p('function fnd_launch_query2()
724          {
725              fnd_launch_query();
726           }');
727 
728   htp.p('</SCRIPT>');
729 
730   htp.p('<NOSCRIPT>' || WF_CORE.Translate('WFA_NOSCRIPT') || '</NOSCRIPT>');
731 
732   htp.headclose;
733 
734   htp.p('<body bgcolor="#CCCCCC">');
735 
736   htp.formOpen(curl=>'javascript:fnd_launch_query();',
737                cmethod=>'POST', cattributes=>'NAME="WF_FIND"');
738 
739   htp.tableOpen(cattributes=>'summary=""');
740 
741   htp.tableRowOpen;
742   htp.tableData(cvalue=>'<LABEL FOR="i_current_value">' ||
743                         wf_core.translate('FIND') ||
744                         '</LABEL>',
745                 calign=>'right',
746                 cattributes=>'id=""');
747 
748   htp.tableData(htf.formText(cname=>'p_current_value', csize=>'30',
749                              cmaxlength=>'4000', cvalue=>'',
750                              cattributes=>'id="i_current_value"'),
751                 cattributes=>'id=""');
752 
753   htp.p ('<SCRIPT LANGUAGE="JavaScript"> fnd_get_searchtext(); </SCRIPT>');
754   htp.p('<NOSCRIPT>' || WF_CORE.Translate('WFA_NOSCRIPT') || '</NOSCRIPT>');
755 
756   htp.p('<TD id="">');
757 
758   wfa_html.create_reg_button ('javascript:fnd_launch_query();',
759                               wf_core.translate ('FIND'),
760                               wfa_html.image_loc,
761                               'fndfind.gif',
762                               wf_core.translate ('FIND'));
763 
764   htp.p('</TD>');
765 
766   htp.p('<TD id="">');
767 
768   wfa_html.create_reg_button ('javascript:document.WF_FIND.reset();',
769                               wf_core.translate ('CLEAR'),
770                               wfa_html.image_loc,
771                               'fndfind.gif',
772                               wf_core.translate ('CLEAR'));
773 
774   htp.p('</TD>');
775 
776   htp.tableRowClose;
777   htp.tableClose;
778   htp.formClose;
779 
780 
781 exception
782   when others then
783     rollback;
784     wf_core.context('Wf_Lov', 'display_lov_find');
785     wf_lov.error;
786 
787 end display_lov_find;
788 
789 
790 procedure display_lov_details   (
791 p_lov_name                in varchar2 ,
792 p_display_name            in varchar2 ,
793 p_validation_callback     in varchar2 ,
794 p_dest_hidden_field       in varchar2 ,
795 p_dest_display_field      in varchar2 ,
796 p_current_value           in varchar2 ,
797 p_start_row               in varchar2 ,
798 p_autoquery               in varchar2 ,
799 p_param1                  in varchar2 ,
800 p_param2                  in varchar2 ,
801 p_param3                  in varchar2 ,
802 p_param4                  in varchar2 ,
803 p_param5                  in varchar2 ,
804 p_display_key             in varchar2 )
805 
806 IS
807 
808 l_ncols          number := 0;
809 l_result         number := 0;
810 l_start_row      number := TO_NUMBER(p_start_row);
811 l_number_rows    number := 10;
812 l_call_method    varchar2(10) := 'LOV';
813 l_hidden_value   varchar2(240);
814 l_display_value  varchar2(4000) := p_current_value;
815 l_sql_stmt       varchar2(4000);
816 username	 varchar2(320);
817 l_display_name   varchar2(360) := NULL;
818 
819 l_cursorName     number;
820 l_cursorResult   number;
821 
822 BEGIN
823 
824   WFA_SEC.GetSession(username);
825 
826   htp.headopen;
827 
828   htp.p ('<SCRIPT LANGUAGE="JavaScript">');
829 
830 if (p_display_key='Y') then
831   l_display_name := wf_core.translate(p_display_name);
832 end if;
833 
834   if (p_autoquery = 'Y') then
835 
836      -- assigning the field values in javascript via autoquery function
837      -- note that in pl/sql, we only pass in the javascript field names,
838      -- not the values.
839      htp.p('function autoquery()
840             {
841                if ('||p_dest_display_field||' != "")
842                {
843                   document.WF_DETAILS.p_current_value.value = '||
844                       p_dest_display_field||';
845                   document.WF_DETAILS.p_autoquery.value = "N";');
846      if (p_param1 is not null) then
847        htp.p('    document.WF_DETAILS.p_param1.value = '||
848                       p_param1||';');
849      end if;
850      if (p_param2 is not null) then
851        htp.p('    document.WF_DETAILS.p_param2.value = '||
852                       p_param2||';');
853      end if;
854      if (p_param3 is not null) then
855        htp.p('    document.WF_DETAILS.p_param3.value = '||
856                       p_param3||';');
857      end if;
858      if (p_param4 is not null) then
859        htp.p('    document.WF_DETAILS.p_param4.value = '||
860                       p_param4||';');
861      end if;
862      if (p_param5 is not null) then
863        htp.p('    document.WF_DETAILS.p_param5.value = '||
864                       p_param5||';');
865      end if;
866      htp.p('      document.WF_DETAILS.submit();
867                }
868                else
869                {
870                   document.write("<CENTER><B>")
871                   document.write('||''''||
872                      wf_core.translate('WFLOV_CRITERIA')||''''||');
873                   document.write("</B></CENTER>")
874                   document.WF_DETAILS.p_autoquery.value = "N";');
875      if (p_param1 is not null) then
876        htp.p('    document.WF_DETAILS.p_param1.value = '||
877                       p_param1||';');
878      end if;
879      if (p_param2 is not null) then
880        htp.p('    document.WF_DETAILS.p_param2.value = '||
881                       p_param2||';');
882      end if;
883      if (p_param3 is not null) then
884        htp.p('    document.WF_DETAILS.p_param3.value = '||
885                       p_param3||';');
886      end if;
887      if (p_param4 is not null) then
888        htp.p('    document.WF_DETAILS.p_param4.value = '||
889                       p_param4||';');
890      end if;
891      if (p_param5 is not null) then
892        htp.p('    document.WF_DETAILS.p_param5.value = '||
893                       p_param5||';');
894      end if;
895 
896      htp.p('    }
897             }');
898 
899   else
900 
901       -- Javascript function to handle CD buttons
902       htp.p('function LOV_rows(start_num) {
903             document.WF_DETAILS.p_start_row.value = start_num;
904             document.WF_DETAILS.p_autoquery.value = "N";
905             document.WF_DETAILS.submit();
906             }');
907 
908   end if;
909 
910   htp.p('function LOV_copy(num) {
911         '||
912          p_dest_display_field||'=document.WF_LOV_FRM.h_display[num].value;
913         '||
914          p_dest_hidden_field||'=document.WF_LOV_FRM.h_hidden[num].value;
915          parent.self.close();
916          }');
917 
918   htp.p('</SCRIPT>');
919 
920   htp.p('<NOSCRIPT>' || WF_CORE.Translate('WFA_NOSCRIPT') || '</NOSCRIPT>');
921 
922   htp.headclose;
923 
924   htp.p('<body bgcolor="#CCCCCC">');
925 
926   htp.formOpen(curl=>owa_util.get_owa_service_path||
927                    'wf_lov.display_lov_details',
928              cmethod=>'POST', cattributes=>'NAME="WF_DETAILS"');
929 
930   htp.formhidden('p_lov_name', p_lov_name);
931   htp.formhidden('p_display_name', p_display_name);
932   htp.formhidden('p_validation_callback', p_validation_callback);
933   htp.formhidden('p_dest_hidden_field', p_dest_hidden_field);
934   htp.formhidden('p_dest_display_field',p_dest_display_field);
935   htp.formhidden('p_current_value',p_current_value);
936   htp.formhidden('p_start_row',p_start_row);
937   htp.formhidden('p_autoquery',p_autoquery);
938   htp.formhidden('p_param1',p_param1);
939   htp.formhidden('p_param2',p_param2);
940   htp.formhidden('p_param3',p_param3);
941   htp.formhidden('p_param4',p_param4);
942   htp.formhidden('p_param5',p_param5);
943   htp.formhidden('p_display_key',p_display_key);
944 
945   if (p_autoquery = 'Y') then
946 
947         -- Autoquery or Display hint about selection criteria
948         htp.p('<SCRIPT LANGUAGE="JavaScript">');
949         htp.p('autoquery()');
950         htp.p('</SCRIPT>');
951 
952   htp.p('<NOSCRIPT>' || WF_CORE.Translate('WFA_NOSCRIPT') || '</NOSCRIPT>');
953 
954   end if;
955 
956 
957   wf_lov.g_define_rec.total_rows := 0;
958   wf_lov.g_define_rec.add_attr1_title := null;
959   wf_lov.g_define_rec.add_attr2_title := null;
960   wf_lov.g_define_rec.add_attr3_title := null;
961   wf_lov.g_define_rec.add_attr4_title := null;
962   wf_lov.g_define_rec.add_attr5_title := null;
963   wf_lov.g_value_tbl.delete;
964 
965   if (p_autoquery <> 'Y') THEN
966     --<3310020:rwunderl>
967     --Validating that the callback is authorized.
968     if ((UPPER(p_validation_callback) = 'WFA_HTML.WF_USER_VAL') or
969         (UPPER(p_validation_callback) = 'WFA_HTML_JSP.WF_USER_VAL') or
970         (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_SYSTEM_VAL') or
971         (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_EVENT_VAL') or
972         (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_AGENT_VAL') or
973         (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_SYSTEM_VAL') or
974         (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_PROCESSNAME_VAL') or
975         (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_ITEMTYPE_VAL')) then
976        l_sql_stmt := 'BEGIN '||p_validation_callback||
977                '(:1, :2, :3, :4, :5, :6, :7';
978 
979        --Appending any optional parameter place holders to l_sql_stmt.
980        if (p_param1 is not null) then
981          l_sql_stmt := l_sql_stmt||', :8';
982        end if;
983        if (p_param2 is not null) then
984          l_sql_stmt := l_sql_stmt||', :9';
985        end if;
986        if (p_param3 is not null) then
987          l_sql_stmt := l_sql_stmt||', :10';
988        end if;
989        if (p_param4 is not null) then
990          l_sql_stmt := l_sql_stmt||', :11';
991        end if;
992        if (p_param5 is not null) then
993          l_sql_stmt := l_sql_stmt||', :12';
994        end if;
995        l_sql_stmt := l_sql_stmt||'); END;';
996 
997        --Opening the cursor and parsing
998        l_cursorName := DBMS_SQL.Open_Cursor;
999        DBMS_SQL.Parse(l_cursorName, l_sql_stmt, DBMS_SQL.NATIVE);
1000 
1001        --Binding the mandatory parameters.
1002        DBMS_SQL.Bind_Variable(l_cursorName, ':1', l_call_method);
1003        DBMS_SQL.Bind_Variable(l_cursorName, ':2', p_lov_name);
1004        DBMS_SQL.Bind_Variable(l_cursorName, ':3', l_start_row);
1005        DBMS_SQL.Bind_Variable(l_cursorName, ':4', l_number_rows);
1006        DBMS_SQL.Bind_Variable(l_cursorName, ':5', l_hidden_value);
1007        DBMS_SQL.Bind_Variable(l_cursorName, ':6', l_display_value);
1008        DBMS_SQL.Bind_Variable(l_cursorName, ':7', l_result);
1009 
1010        --Binding the optional parameters.
1011        if (p_param1 is not null) then
1012          DBMS_SQL.Bind_Variable(l_cursorName, ':8', p_param1);
1013        end if;
1014        if (p_param2 is not null) then
1015          DBMS_SQL.Bind_Variable(l_cursorName, ':9', p_param2);
1016        end if;
1017        if (p_param3 is not null) then
1018          DBMS_SQL.Bind_Variable(l_cursorName, ':10', p_param3);
1019        end if;
1020        if (p_param4 is not null) then
1021          DBMS_SQL.Bind_Variable(l_cursorName, ':11', p_param4);
1022        end if;
1023        if (p_param5 is not null) then
1024          DBMS_SQL.Bind_Variable(l_cursorName, ':12', p_param5);
1025        end if;
1026 
1027        --Executing the cursor.
1028        l_cursorResult := DBMS_SQL.Execute(l_cursorName);
1029 
1030        --Storing out variables into local variables.
1031        DBMS_SQL.Variable_Value(l_cursorName, ':5', l_hidden_value);
1032        DBMS_SQL.Variable_Value(l_cursorName, ':6', l_display_value);
1033        DBMS_SQL.Variable_Value(l_cursorName, ':7', l_result);
1034 
1035        --Closing the cursor
1036        DBMS_SQL.Close_Cursor(l_cursorName);
1037 
1038     end if;
1039 
1040   else
1041 
1042      l_result := 0;
1043 
1044   end if;
1045 
1046   if (l_result > 0) then
1047 
1048 
1049        /*
1050        ** Print out the row count for the results in the form of
1051        ** Records: 1 to 15 of 25
1052        */
1053        htp.tableOpen(cborder => 'BORDER=0', cattributes => 'WIDTH="100%" SUMMARY=""');
1054        htp.tableRowOpen;
1055 
1056        wf_core.clear;
1057        Wf_Core.Token('START_REC', p_start_row);
1058        Wf_Core.Token('END_REC', TO_CHAR(TO_NUMBER(p_start_row) + wf_lov.g_value_tbl.count - 1));
1059        Wf_Core.Token('TOTAL_REC', '<font color="ff0000">'||TO_CHAR(wf_lov.g_define_rec.total_rows)||'</font>');
1060 
1061        htp.tabledata('<font size=2>' || Wf_Core.Translate('RECORD_MSG') ||
1062                      '</font>', cattributes=>'id=""');
1063 
1064        htp.tableRowClose;
1065        htp.tableClose;
1066 
1067        -- display table header of LOV
1068        htp.p('<TABLE width=98% bgcolor=#999999 cellpadding=2'||
1069              ' cellspacing=0 border=0 summary="">');
1070        htp.p('<TR><TD>');
1071        htp.p('<TABLE width=100% cellpadding=2 cellspacing=1 border=0>');
1072 
1073        /*
1074        ** Print out the header
1075        */
1076        htp.p('<TR BGColor="336699">');
1077 
1078        /*
1079        ** get the display name for the attribute
1080        */
1081   if (p_display_key = 'Y') then
1082        htp.p('<TH align=center valign=bottom bgcolor="336699" id="'||
1083              p_display_name||'">'||
1084              '<FONT color=#FFFFFF>'||l_display_name||
1085              '</TH>');
1086   else
1087 
1088     htp.p('<TH align=center valign=bottom bgcolor="336699" id="' ||
1089              p_display_name || '">'||
1090              '<FONT color=#FFFFFF>'|| p_display_name ||
1091              '</TH>');
1092   end if;
1093        if (wf_lov.g_define_rec.add_attr1_title IS NOT NULL) then
1094 
1095           htp.p('<TH align=center valign=bottom bgcolor="336699" id="' ||
1096                 wf_lov.g_define_rec.add_attr1_title || '">'||
1097                 '<FONT color=#FFFFFF>'|| wf_lov.g_define_rec.add_attr1_title ||
1098                 '</TH>');
1099 
1100           l_ncols := l_ncols + 1;
1101 
1102        end if;
1103 
1104        if (wf_lov.g_define_rec.add_attr2_title IS NOT NULL) then
1105 
1106           htp.p('<TH align=center valign=bottom bgcolor="336699" id="' ||
1107                  wf_lov.g_define_rec.add_attr2_title || '">'||
1108                 '<FONT color=#FFFFFF>'|| wf_lov.g_define_rec.add_attr2_title ||
1109                 '</TH>');
1110 
1111           l_ncols := l_ncols + 1;
1112 
1113        end if;
1114 
1115        if (wf_lov.g_define_rec.add_attr3_title IS NOT NULL) then
1116 
1117           htp.p('<TH align=center valign=bottom bgcolor="336699" id="' ||
1118                 wf_lov.g_define_rec.add_attr3_title || '">'||
1119                 '<FONT color=#FFFFFF>'|| wf_lov.g_define_rec.add_attr3_title ||
1120                 '</TH>');
1121 
1122           l_ncols := l_ncols + 1;
1123 
1124        end if;
1125 
1126        if (wf_lov.g_define_rec.add_attr4_title IS NOT NULL) then
1127 
1128           htp.p('<TH align=center valign=bottom bgcolor="336699" id="' ||
1129                 wf_lov.g_define_rec.add_attr4_title || '">'||
1130                 '<FONT color=#FFFFFF>'|| wf_lov.g_define_rec.add_attr4_title ||
1131                 '</TH>');
1132 
1133           l_ncols := l_ncols + 1;
1134 
1135        end if;
1136 
1137        if (wf_lov.g_define_rec.add_attr5_title IS NOT NULL) then
1138 
1139           htp.p('<TH align=center valign=bottom bgcolor="336699" id="' ||
1140                 wf_lov.g_define_rec.add_attr5_title || '">'||
1141                 '<FONT color=#FFFFFF>'|| wf_lov.g_define_rec.add_attr5_title ||
1142                 '</TH>');
1143 
1144           l_ncols := l_ncols + 1;
1145 
1146        end if;
1147 
1148        htp.tablerowclose;
1149        /*
1150        ** Loop through the data
1151        */
1152        for ii in 1..wf_lov.g_value_tbl.count loop
1153 
1154           -- display one row of data
1155           if (round(ii/2) = ii/2) then
1156              htp.p('<TR BGColor="ffffff">');
1157           else
1158              htp.p('<TR BGColor="99ccff">');
1159           end if;
1160 
1161      if (p_display_key='Y') then
1162           htp.tabledata ('<A HREF="javascript:LOV_copy('||to_char(ii)||')">'||
1163                          wf_lov.g_value_tbl(ii).display_value||'</A>',
1164                          cattributes=>'headers="' || l_display_name || '"');
1165      else
1166           htp.tabledata ('<A HREF="javascript:LOV_copy('||to_char(ii)||')">'||
1167                          wf_lov.g_value_tbl(ii).display_value||'</A>',
1168                          cattributes=>'headers="' || p_display_name || '"');
1169      end if;
1170 
1171           if (l_ncols > 0) then
1172 
1173              htp.tabledata (wf_lov.g_value_tbl(ii).add_attr1_value,
1174                             cattributes=>'headers="' ||
1175                                       wf_lov.g_define_rec.add_attr1_title ||
1176                                       '"');
1177 
1178           end if;
1179           if (l_ncols > 1) then
1180 
1181              htp.tabledata (wf_lov.g_value_tbl(ii).add_attr2_value,
1182                             cattributes=>'headers="' ||
1183                                       wf_lov.g_define_rec.add_attr2_title ||
1184                                       '"');
1185 
1186           end if;
1187           if (l_ncols > 2) then
1188 
1189              htp.tabledata (wf_lov.g_value_tbl(ii).add_attr3_value,
1190                             cattributes=>'headers="' ||
1191                                       wf_lov.g_define_rec.add_attr3_title ||
1192                                       '"');
1193 
1194 
1195           end if;
1196           if (l_ncols > 3) then
1197 
1198              htp.tabledata (wf_lov.g_value_tbl(ii).add_attr4_value,
1199                             cattributes=>'headers="' ||
1200                                       wf_lov.g_define_rec.add_attr4_title ||
1201                                       '"');
1202 
1203 
1204           end if;
1205           if (l_ncols > 4) then
1206 
1207              htp.tabledata (wf_lov.g_value_tbl(ii).add_attr5_value,
1208                             cattributes=>'headers="' ||
1209                                       wf_lov.g_define_rec.add_attr5_title ||
1210                                       '"');
1211 
1212 
1213           end if;
1214 
1215           htp.tablerowclose;
1216 
1217        end loop;
1218 
1219        htp.tableClose;
1220 
1221        htp.p('</TD>');
1222        htp.p('</TR>');
1223        htp.p('</TABLE>');
1224 
1225        htp.tableOpen(calign=>'CENTER', cborder => 'BORDER=0',
1226                      cattributes=>'summary=""');
1227        htp.tableRowOpen;
1228 
1229        /*
1230        ** Check to see if you should create the PREVIOUS button
1231        */
1232        IF  (TO_NUMBER(p_start_row) >  1) THEN
1233 
1234           htp.p('<TD id="">');
1235 
1236           /*
1237           ** Make sure that your not going to go back past the first
1238           ** record.  Otherwise subtract the query set from the start
1239           */
1240           IF (TO_NUMBER(p_start_row) < 1) THEN
1241 
1242               l_start_row := 1;
1243 
1244           ELSE
1245 
1246               l_start_row := TO_NUMBER(p_start_row) - 10;
1247 
1248           END IF;
1249 
1250           htp.p('<A HREF="javascript:LOV_rows('||
1251                   TO_CHAR(l_start_row)||
1252                 ')">');
1253 
1254           htp.p('<IMG SRC="/OA_MEDIA/FNDIPRVB.gif" border=0 alt="' ||
1255                 WF_CORE.Translate('PREVIOUS') || '"></A>');
1256 
1257           htp.p('<font class=button>'||wf_core.translate('PREVIOUS')||'</font>');
1258 
1259           htp.p('</TD>');
1260 
1261        END IF;
1262 
1263 
1264        /*
1265        ** Check to see if you should create the Next button
1266        */
1267        IF  (wf_lov.g_value_tbl.count = 10) THEN
1268 
1269         l_start_row := TO_NUMBER(p_start_row) + 10;
1270         if (l_start_row <= wf_lov.g_define_rec.total_rows) then
1271 
1272           htp.p('<TD id="">');
1273 
1274           htp.p('<A HREF="javascript:LOV_rows('||
1275                   TO_CHAR(l_start_row)||
1276                 ')">');
1277 
1278           htp.p('<IMG SRC="/OA_MEDIA/FNDINXTB.gif" border=0 alt="' ||
1279                 WF_CORE.Translate('NEXT') || '"></A>');
1280 
1281           htp.p('<font class=button>'||wf_core.translate('NEXT')||'</font>');
1282 
1283           htp.p('</TD>');
1284         end if;
1285 
1286        END IF;
1287 
1288        htp.tableRowClose;
1289 
1290        htp.tableclose;
1291 
1292        htp.formclose;
1293 
1294        -- Form to hold the display value and hidden key for the javascript
1295        -- LOV_copy().  This is to fix the problem when either display_value
1296        -- or the hidden_key contain single quotes.
1297        htp.formOpen(curl=>null, cmethod=>'Post',
1298                     cattributes=>'NAME=WF_LOV_FRM');
1299 
1300        -- place dummy values in index 0
1301        htp.formHidden('h_display', 'xxx');
1302        htp.formHidden('h_hidden', 'xxx');
1303 
1304        for ii in 1..wf_lov.g_value_tbl.count loop
1305          htp.formHidden('h_display',wf_lov.g_value_tbl(ii).display_value);
1306 -- ### does not work for double quotes
1307 -- ###             replace(wf_lov.g_value_tbl(ii).display_value, '"', '\"'));
1308          htp.formHidden('h_hidden',wf_lov.g_value_tbl(ii).hidden_key);
1309 -- ###             replace(wf_lov.g_value_tbl(ii).hidden_key, '"', '\"'));
1310        end loop;
1311 
1312        htp.formClose;
1313 
1314        htp.bodyclose;
1315 
1316    end if;
1317 
1318 exception
1319   when others then
1320     rollback;
1321     wf_core.context('Wf_Lov', 'Display_Lov_Details' );
1322     raise;
1323 end display_lov_details;
1324 
1325 /*
1326 ** This procedure is a combination of display_lov, display_lov_find and
1327 ** display_lov_details for new UI design with no frame
1328  */
1329 procedure display_lov_no_frame
1330 (
1331 p_lov_name            in varchar2 ,
1332 p_display_name        in varchar2 ,
1333 p_validation_callback in varchar2 ,
1334 p_dest_hidden_field   in varchar2 ,
1335 p_dest_display_field  in varchar2 ,
1336 p_current_value       in varchar2 ,
1337 p_start_row           in varchar2 ,
1338 p_autoquery           in varchar2 ,
1339 p_language            in varchar2
1340 ) IS
1341 ii               number := 0;
1342 nn               number := 0;
1343 l_total_rows     number := 0;
1344 l_ncols          number := 0;
1345 l_result         number := 0;
1346 l_temp_start_row number := 0;
1347 l_start_row      number;
1348 l_end_row      number;
1349 l_number_rows    number := 10;
1350 l_call_method    varchar2(10) := 'LOV';
1351 l_hidden_value   varchar2(240);
1352 l_display_value  varchar2(4000) := p_current_value;
1353 l_sql_stmt       varchar2(4000);
1354 l_name       VARCHAR2 (320);
1355 l_display_name       VARCHAR2 (360);
1356 p_max_rows       number := 25;
1357 l_from           varchar2(10);
1358 l_to             varchar2(10);
1359 username	 varchar2(320);
1360 
1361   type NameList is table of wf_roles.name%type;
1362   type DNameList is table of wf_roles.display_name%type;
1363 
1364   names NameList;
1365   dnames DNameList;
1366 
1367 -- took away the function and wildcard in the cursor below,
1368 -- instead uses the following four plsql variables.
1369 --Bug 2342682
1370   criteria1  varchar2(12);
1371   criteria2  varchar2(12);
1372   criteria3  varchar2(12);
1373   criteria4  varchar2(12);
1374 
1375 CURSOR c_user_lov (c_find_criteria IN VARCHAR2) IS
1376   select NAME, DISPLAY_NAME
1377     from WF_ROLES
1378    where (DISPLAY_NAME  like criteria1
1379     or    DISPLAY_NAME  like criteria2
1380     or    DISPLAY_NAME  like criteria3
1381     or    DISPLAY_NAME  like criteria4)
1382     and  upper(DISPLAY_NAME) like upper(c_find_criteria)||'%'
1383     and status <> 'INACTIVE'
1384   union
1385   select NAME, DISPLAY_NAME
1386     from WF_ROLES
1387    where ORIG_SYSTEM not in ('HZ_PARTY','POS','ENG_LIST','AMV_CHN',
1388                              'HZ_GROUP','CUST_CONT')
1389      and upper(NAME) like upper(c_find_criteria)||'%'
1390      and (NAME  like criteria1
1391       or  NAME  like criteria2
1392       or  NAME  like criteria3
1393       or  NAME  like criteria4)
1394      and status <> 'INACTIVE'
1395    order by 2;
1396 
1397 BEGIN
1398 
1399   WFA_SEC.GetSession(username);
1400 
1401   /*
1402   ** Set the title for the window
1403   */
1404   htp.title(wf_core.translate('SELECT')||'&'||'nbsp;'||p_display_name);
1405 
1406   htp.headopen;
1407   -- hardcode to /OA_HTML/ for ssp
1408   htp.p('<link rel="stylesheet" href="/OA_HTML/PORSTYL2.css">');
1409 --  htp.p('<link rel="stylesheet" href="'||WFA_HTML.image_loc||'PORSTYL2.css">');
1410   htp.p ('<SCRIPT LANGUAGE="JavaScript">');
1411 
1412   htp.p('function LOV_submit()
1413          {
1414             document.WF_DETAILS.p_lov_name.value = '||
1415                ''''||p_lov_name||''''||';
1416             document.WF_DETAILS.p_display_name.value = '||
1417                ''''||p_display_name||''''||';
1418             document.WF_DETAILS.p_validation_callback.value = '||
1419                ''''||p_validation_callback||''''||';
1420             document.WF_DETAILS.p_dest_hidden_field.value = '||
1421               ''''||p_dest_hidden_field||''''||';
1422             document.WF_DETAILS.p_dest_display_field.value = '||
1423               ''''||p_dest_display_field||''''||';
1424             document.WF_DETAILS.p_current_value.value =
1425                document.WF_FIND.p_current_value.value;
1426             document.WF_DETAILS.p_autoquery.value = '||
1427               ''''||'N'||''''||';
1428             document.WF_DETAILS.p_start_row.value = 1;
1429             document.WF_DETAILS.p_language.value = '||
1430                ''''||p_language||''''||';
1431             document.WF_DETAILS.submit();
1432           }');
1433 
1434 
1435 
1436   htp.p('function fnd_get_searchtext()
1437          {');
1438          if (p_autoquery = 'Y') then
1439      htp.p('if ('||p_current_value||'!= "")
1440              {
1441                  document.WF_FIND.p_current_value.value = '||
1442                      p_current_value||';
1443               }');
1444          end if;
1445        htp.p('}');
1446 
1447   htp.p('function fnd_launch_query()
1448          {
1449              if (document.WF_FIND.p_current_value.value == "")
1450              {
1451                 alert("'||wf_core.translate('WFLOV_NO_CRITERIA')||'");
1452                 document.WF_FIND.p_current_value.focus();
1453              }
1454              else
1455              {
1456                   LOV_submit();
1457               }
1458           }');
1459 
1460   if (p_autoquery = 'Y') then
1461 
1462      htp.p('function autoquery()
1463             {
1464                if ('||p_dest_display_field||' != "")
1465                {
1466                   document.WF_DETAILS.p_current_value.value = '||
1467                       p_dest_display_field||';
1468                   document.WF_DETAILS.p_autoquery.value = "N";
1469                   document.WF_DETAILS.p_start_row.value = 1;
1470                   document.WF_DETAILS.submit();
1471                }
1472                else
1473                {
1474 
1475                   document.WF_DETAILS.p_autoquery.value = "N";
1476                }
1477           }');
1478   else
1479 
1480       -- Javascript function to handle CD buttons
1481       htp.p('function LOV_rows(start_num) {
1482             document.WF_DETAILS.p_start_row.value = start_num;
1483             document.WF_DETAILS.p_autoquery.value = "N";
1484             document.WF_DETAILS.submit();
1485             }');
1486 
1487   end if;
1488 
1489 
1490   htp.p('</SCRIPT>');
1491 
1492   htp.p('<NOSCRIPT>' || WF_CORE.Translate('WFA_NOSCRIPT') || '</NOSCRIPT>');
1493 
1494 
1495   htp.headclose;
1496 
1497   htp.p('<body>');
1498   htp.p('<BR>');
1499   htp.formOpen(curl=>'javascript:fnd_launch_query();',
1500                cmethod=>'POST', cattributes=>'NAME="WF_FIND"');
1501   htp.p('<TABLE width=100% cellpadding=0 cellspacing=0 border=0 id="">');
1502   htp.p('<TR>');
1503   htp.p('<TD id=""><IMG src='||WFA_HTML.image_loc||'FNDITPNT.gif width=15 height=1 alt=""></TD>');
1504   htp.p('<TD width=100% id="' || p_display_name || '"><SPAN class=header>');
1505   htp.p(wf_core.translate('SELECT')||'&'||'nbsp;'||p_display_name);
1506   htp.p('</SPAN></TD></TR>');
1507   htp.p('<TR><TD height=1><IMG src='||WFA_HTML.image_loc||'FNDITPNT.gif alt=""></TD>');
1508    htp.p('<TD height=1 bgcolor=#cccc99 id=""><IMG src='||WFA_HTML.image_loc||'FNDITPNT.gif alt=""><BR></TD></TR>');
1509    htp.p('<TR><TD id=""><IMG src=/OA_MEDIA/FNDITPNT.gif width=100% height=10 alt=""></TD></TR>');
1510    htp.p('<TR><TD id=""><IMG src=/OA_MEDIA/FNDITPNT.gif width=45 height=1 alt=""></TD><TD width=100%></TD></TR>');
1511 
1512   htp.tableRowOpen;
1513   htp.p('<TD height=1 id=""><IMG src='||WFA_HTML.image_loc||'FNDITPNT.gif width=15 height=1 alt=""></TD>');
1514   htp.p('<TD id=""><TABLE cellpadding=0 cellspacing=0 border=0 summary="">');
1515   htp.p('<TR>');
1516   htp.p('<TD id=""><B>'||wf_core.translate('WFLOV_SEARCH')||'</B>&'||'nbsp;<INPUT TYPE="text" NAME="p_current_value" SIZE="20" MAXLENGTH="4000">');
1517   htp.p ('<SCRIPT LANGUAGE="JavaScript"> fnd_get_searchtext(); </SCRIPT>');
1518   htp.p('<NOSCRIPT>' || WF_CORE.Translate('WFA_NOSCRIPT') || '</NOSCRIPT>');
1519 
1520   htp.p('<a href="javascript:fnd_launch_query()"><img src="'||WFA_HTML.image_loc||p_language||'/WFGOW.gif" align="absmiddle" alt="'||wf_core.translate('WFJSP_GO')||'" border="0"></a>');
1521 
1522 --  htp.p('<a href="javascript:fnd_launch_query()"><img src="'||WFA_HTML.image_loc||icx_sec.getID(21)||'/WFGOW.gif" align="absmiddle" alt="'||wf_core.translate('WFJSP_GO')||'" border="0"></a>');
1523 
1524 htp.p('</TD></TR></TABLE>');
1525 
1526   htp.p('</TD>');
1527   htp.p('</TR>');
1528 
1529 -- blue separator
1530 htp.p('<TR><TD class=contenttext colspan=1 id=""> </TD></TR>');
1531   htp.p('<TR>');
1532   htp.p('<TD id=""><IMG src='||WFA_HTML.image_loc||'FNDITPNT.gif width=15 height=1 alt=""></TD>');
1533   htp.p('<TD id=""><table width="100%" border="0" cellspacing="0" cellpadding="0" background="'||WFA_HTML.image_loc||'WFBLUES.jpg" summary="">');
1534   htp.p('<tr background="'||WFA_HTML.image_loc||'WFBLUES.jpg">');
1535   htp.p('<td height="1" background="'||WFA_HTML.image_loc||'WFBLUES.jpg" id=""><img src="'||WFA_HTML.image_loc||'WFBLUES.gif" width="6" height="1" alt=""></td></tr></table></TD>');
1536   htp.tableRowClose;
1537 
1538   htp.formClose;
1539   htp.formOpen(curl=>owa_util.get_owa_service_path||
1540                    'wf_lov.display_lov_no_frame',
1541              cmethod=>'POST', cattributes=>'NAME="WF_DETAILS"');
1542 
1543   htp.formhidden('p_lov_name', p_lov_name);
1544   htp.formhidden('p_display_name', p_display_name);
1545   htp.formhidden('p_validation_callback', p_validation_callback);
1546   htp.formhidden('p_dest_hidden_field', p_dest_hidden_field);
1547   htp.formhidden('p_dest_display_field',p_dest_display_field);
1548   htp.formhidden('p_current_value',p_current_value);
1549   htp.formhidden('p_start_row',p_start_row);
1550   htp.formhidden('p_autoquery',p_autoquery);
1551   htp.formhidden('p_language',p_language);
1552 
1553   if (p_autoquery = 'Y') then
1554 
1555         -- Autoquery or Display hint about selection criteria
1556         htp.p('<SCRIPT LANGUAGE="JavaScript">');
1557         htp.p('autoquery()');
1558         htp.p('</SCRIPT>');
1559 
1560   htp.p('<NOSCRIPT>' || WF_CORE.Translate('WFA_NOSCRIPT') || '</NOSCRIPT>');
1561 
1562   end if;
1563 
1564   wf_lov.g_define_rec.total_rows := 0;
1565   wf_lov.g_define_rec.add_attr1_title := null;
1566   wf_lov.g_define_rec.add_attr2_title := null;
1567   wf_lov.g_define_rec.add_attr3_title := null;
1568   wf_lov.g_define_rec.add_attr4_title := null;
1569   wf_lov.g_define_rec.add_attr5_title := null;
1570   wf_lov.g_value_tbl.delete;
1571 
1572   if (p_autoquery <> 'Y') THEN
1573 
1574    wf_lov.g_define_rec.add_attr1_title := wf_core.translate ('WFITD_INTERNAL_NAME');
1575 
1576    -- these 4 criteria variables were extracted from the sql in cursor
1577    -- c_user_lov.  Without doing this, the optimizer did not know to
1578    -- use indexes in the base tables.
1579    criteria1 := lower(substr(l_display_value, 1, 2))||'%';
1580    criteria2 := lower(substr(l_display_value, 1, 1))||
1581                 upper(substr(l_display_value, 2, 1))||'%';
1582    criteria3 := initcap(substr(l_display_value, 1, 2))||'%';
1583    criteria4 := upper(substr(l_display_value, 1, 2))||'%';
1584 
1585    open c_user_lov (l_display_value);
1586    -- use bulk collect to improve performance, also get the count
1587    -- while fetching the data
1588    fetch c_user_lov bulk collect into names, dnames;
1589    close c_user_lov;
1590 
1591    if (names is null) then
1592      l_total_rows := 0;
1593    else
1594      l_total_rows := names.COUNT;
1595      if (l_total_rows < (to_number(p_start_row)+p_max_rows-1)) then
1596        l_end_row := l_total_rows;
1597      else
1598        l_end_row := to_number(p_start_row)+p_max_rows-1;
1599      end if;
1600 
1601      for ii in to_number(p_start_row)..l_end_row loop
1602        nn := nn + 1;
1603        wf_lov.g_value_tbl(nn).hidden_key      := names(ii);
1604        wf_lov.g_value_tbl(nn).display_value   := dnames(ii);
1605        wf_lov.g_value_tbl(nn).add_attr1_value := names(ii);
1606      end loop;
1607    end if;
1608 
1609    wf_lov.g_define_rec.total_rows := l_total_rows;
1610 
1611    l_result := 1;
1612 
1613   else
1614 
1615      l_result := 0;
1616 
1617   end if;
1618 
1619 htp.p('<TR><TD class=contenttext colspan=1 id=""> </TD></TR>');
1620   htp.tableRowOpen;
1621   htp.p('<TD id=""><IMG src='||WFA_HTML.image_loc||'FNDITPNT.gif width=15 height=1 alt=""></TD>');
1622   if (p_autoquery='Y') then
1623 --    htp.p('<TD class=contenttext><B>'||wf_core.translate('WFLOV_GO')||'</B></TD>');
1624   htp.tableRowClose;
1625   htp.p('<TR><TD class=contenttext colspan=1 id=""> </TD></TR>');
1626   htp.p('<TR><TD class=contenttext colspan=1 id=""> </TD></TR>');
1627   htp.p('<TR><TD class=contenttext colspan=1 id=""> </TD></TR>');
1628   htp.p('<TR><TD class=contenttext colspan=1 id=""> </TD></TR>');
1629   htp.p('<TR><TD class=contenttext colspan=1 id=""> </TD></TR>');
1630   htp.p('<TR><TD class=contenttext colspan=1 id=""> </TD></TR>');
1631    elsif (wf_lov.g_define_rec.total_rows=0) then
1632        wf_core.clear;
1633        wf_core.token('NAME', p_display_name);
1634        wf_core.token('VALUE', p_current_value);
1635        htp.p('<TD class=contenttext id="">'||wf_core.translate('WFLOV_NO_MATCH')||'</TD></TR>');
1636    elsif (wf_lov.g_define_rec.total_rows>0) then
1637 
1638   if (l_result > 0) then
1639 
1640        /*
1641        ** Print out the row count for the results in the form of
1642        ** Records: 1 to 15 of 25
1643        */
1644 
1645     htp.p('<TD class=contenttext id=""><B>'||wf_core.translate('WFLOV_CLICK')||'</B></TD>');
1646   htp.tableRowClose;
1647        htp.tableRowOpen;
1648   htp.p('<TD height=1 id=""><IMG src='||WFA_HTML.image_loc||'FNDITPNT.gif width=15 height=1 alt=""></TD>');
1649        if (p_start_row is not null) then
1650          l_temp_start_row := to_number(p_start_row);
1651        end if;
1652          l_from := to_char(l_temp_start_row);
1653 
1654        if (l_temp_start_row =0) then
1655          l_to := TO_CHAR(l_temp_start_row + wf_lov.g_value_tbl.count);
1656 
1657        else
1658          l_to := TO_CHAR(l_temp_start_row + wf_lov.g_value_tbl.count -1);
1659        end if;
1660 
1661 
1662        htp.p('<TD align=right valign=top height=25 class=contenttext id="">');
1663        /*
1664        ** Check to see if you should create the PREVIOUS button
1665        */
1666        IF  (TO_NUMBER(p_start_row) >  1) THEN
1667 
1668 
1669           /*
1670           ** Make sure that your not going to go back past the first
1671           ** record.  Otherwise subtract the query set from the start
1672           */
1673           IF (TO_NUMBER(p_start_row) < 1) THEN
1674 
1675               l_start_row := 1;
1676 
1677           ELSE
1678 
1679               l_start_row := TO_NUMBER(p_start_row) - p_max_rows;
1680 
1681           END IF;
1682 
1683           htp.p('<IMG SRC="/OA_MEDIA/WFPREVEN.gif" align="absmiddle" border=0> alt=""');
1684 
1685           htp.p('<A HREF="javascript:LOV_rows('||
1686                   TO_CHAR(l_start_row)||
1687                 ')">');
1688           htp.p(wf_core.translate('PREVIOUS')||'</A>');
1689       ELSE
1690          htp.p('<SPAN class=disabledtext><img src="/OA_MEDIA/WFPREVDI.gif"  align="absmiddle" border="0" alt="' || WF_CORE.Translate('PREVIOUS') || '">&'||'nbsp;'||wf_core.translate('PREVIOUS')||'</SPAN>');
1691 
1692        END IF;
1693          Wf_Core.Clear;
1694          Wf_Core.Token('START_REC', l_from);
1695          Wf_Core.Token('END_REC', l_to);
1696          Wf_Core.Token('TOTAL_REC', TO_CHAR(wf_lov.g_define_rec.total_rows));
1697          htp.p('<span class=contenttext><B>'||Wf_Core.Translate('PAGE_MSG')||'</B></span>');
1698 
1699        /*
1700        ** Check to see if you should create the Next button
1701        */
1702        IF (p_start_row + p_max_rows - 1 < wf_lov.g_define_rec.total_rows) THEN
1703 --       IF  (wf_lov.g_value_tbl.count = p_max_rows) THEN
1704 
1705           l_start_row := TO_NUMBER(p_start_row) + p_max_rows;
1706 
1707            htp.p('<A HREF="javascript:LOV_rows('||
1708                   TO_CHAR(l_start_row)||
1709                 ')">');
1710 
1711           htp.p(wf_core.translate('NEXT')||'</A>');
1712 
1713           htp.p('<IMG SRC="/OA_MEDIA/WFNEXTEN.gif"  align="absbottom" border="0" alt="' || WF_CORE.Translate('NEXT') || '">');
1714 
1715      ELSE
1716          htp.p('<SPAN class=disabledtext><img src="/OA_MEDIA/WFNEXTDI.gif"  align="absbottom" border="0" alt="' || WF_CORE.Translate('NEXT') || '">&'||'nbsp;'||wf_core.translate('NEXT')||'</SPAN>');
1717 
1718        END IF;
1719 
1720        END IF;
1721           htp.p('</TD>');
1722 
1723        htp.tableRowClose;
1724 
1725 
1726        -- display table header of LOV
1727        htp.p('<TR>');
1728   htp.p('<TD height=1 id=""><IMG src='||WFA_HTML.image_loc||'FNDITPNT.gif width=15 height=1 alt=""></TD>');
1729        htp.p('<TD id="">');
1730       htp.p('<table width="100%" border="0" cellspacing="1" cellpadding="5">');
1731       htp.p('<tr>');
1732 
1733 
1734        /*
1735        ** Print out the header
1736        */
1737 
1738        /*
1739        ** get the display name for the attribute
1740        */
1741        htp.p('<TD class=tableheader id="">&'||'nbsp</TD>');
1742 
1743        htp.p('<TD class=tableheader id="">'|| p_display_name ||
1744              '</TD>');
1745 
1746        if (wf_lov.g_define_rec.add_attr1_title IS NOT NULL) then
1747 
1748        htp.p('<TD class=tableheader id="">'|| wf_lov.g_define_rec.add_attr1_title||
1749              '</TD>');
1750 
1751           l_ncols := l_ncols + 1;
1752 
1753        end if;
1754 
1755        if (wf_lov.g_define_rec.add_attr2_title IS NOT NULL) then
1756 
1757        htp.p('<TD class=tableheader id="">'|| wf_lov.g_define_rec.add_attr2_title||
1758              '</TD>');
1759 
1760           l_ncols := l_ncols + 1;
1761 
1762        end if;
1763 
1764        if (wf_lov.g_define_rec.add_attr3_title IS NOT NULL) then
1765 
1766        htp.p('<TD class=tableheader id="">'|| wf_lov.g_define_rec.add_attr3_title||
1767              '</TD>');
1768 
1769           l_ncols := l_ncols + 1;
1770 
1771        end if;
1772 
1773        if (wf_lov.g_define_rec.add_attr4_title IS NOT NULL) then
1774 
1775        htp.p('<TD class=tableheader id="">'|| wf_lov.g_define_rec.add_attr4_title||
1776              '</TD>');
1777 
1778           l_ncols := l_ncols + 1;
1779 
1780        end if;
1781 
1782        if (wf_lov.g_define_rec.add_attr5_title IS NOT NULL) then
1783 
1784        htp.p('<TD class=tableheader id="">'|| wf_lov.g_define_rec.add_attr5_title||
1785              '</TD>');
1786           l_ncols := l_ncols + 1;
1787 
1788        end if;
1789 
1790        htp.tablerowclose;
1791        /*
1792        ** Loop through the data
1793        */
1794        for ii in 1..wf_lov.g_value_tbl.count loop
1795 
1796           -- display one row of data
1797 
1798          htp.p('<TD class=tabledata VALIGN=CENTER ALIGN=LEFT id=""><A HREF="javascript:'||
1799                           p_dest_display_field||'='||''''||
1800                           replace(wf_lov.g_value_tbl(ii).display_value,
1801                           '''','\047')||''''||
1802                           ';'||p_dest_hidden_field||'='||''''||
1803                           replace(wf_lov.g_value_tbl(ii).hidden_key,
1804                           '''','\047')||''''||
1805                           ';parent.self.close();">'||wf_core.translate('SELECT')||'</A></TD><TD class=tabledata VALIGN=CENTER ALIGN=LEFT id="">'||wf_lov.g_value_tbl(ii).display_value||'</TD>');
1806 
1807           if (l_ncols > 0) then
1808              htp.p('<TD class=tabledata VALIGN=CENTER ALIGN=LEFT id="">'||wf_lov.g_value_tbl(ii).add_attr1_value||'</TD>');
1809 
1810           end if;
1811           if (l_ncols > 1) then
1812              htp.p('<TD class=tabledata VALIGN=CENTER ALIGN=LEFT id="">'||wf_lov.g_value_tbl(ii).add_attr2_value||'</TD>');
1813 
1814           end if;
1815           if (l_ncols > 2) then
1816               htp.p('<TD class=tabledata VALIGN=CENTER ALIGN=LEFT id="">'||wf_lov.g_value_tbl(ii).add_attr3_value||'</TD>');
1817 
1818           end if;
1819 
1820           if (l_ncols > 3) then
1821              htp.p('<TD class=tabledata VALIGN=CENTER ALIGN=LEFT id="">'||wf_lov.g_value_tbl(ii).add_attr4_value||'</TD>');
1822           end if;
1823 
1824           if (l_ncols > 4) then
1825              htp.p('<TD class=tabledata VALIGN=CENTER ALIGN=LEFT id="">'||wf_lov.g_value_tbl(ii).add_attr5_value||'</TD>');
1826 
1827           end if;
1828 
1829           htp.tablerowclose;
1830 
1831        end loop;
1832 
1833        htp.tableClose;
1834 
1835        htp.p('</TD>');
1836        htp.p('</TR>');
1837 
1838      if (wf_lov.g_value_tbl.count > 5) then
1839        htp.tableRowOpen;
1840   htp.p('<TD id=""><IMG src='||WFA_HTML.image_loc||'FNDITPNT.gif width=15 height=1 alt=""></TD>');
1841        htp.p('<TD align=right valign=top height=25 class=contenttext id="">');
1842        /*
1843        ** Check to see if you should create the PREVIOUS button
1844        */
1845        IF  (TO_NUMBER(p_start_row) >  1) THEN
1846 
1847 
1848           /*
1849           ** Make sure that your not going to go back past the first
1850           ** record.  Otherwise subtract the query set from the start
1851           */
1852           IF (TO_NUMBER(p_start_row) < 1) THEN
1853 
1854               l_start_row := 1;
1855 
1856           ELSE
1857 
1858               l_start_row := TO_NUMBER(p_start_row) - p_max_rows;
1859 
1860           END IF;
1861 
1862           htp.p('<IMG SRC="/OA_MEDIA/WFPREVEN.gif" align="absmiddle" border=0 alt="' || WF_CORE.Translate('PREVIOUS') || '">');
1863 
1864          htp.p('<A HREF="javascript:LOV_rows('||
1865                   TO_CHAR(l_start_row)||
1866                 ')">');
1867 
1868           htp.p(wf_core.translate('PREVIOUS')||'</A>');
1869       ELSE
1870          htp.p('<SPAN class=disabledtext><img src="/OA_MEDIA/WFPREVDI.gif"  align="absmiddle" border="0">&'||'nbsp;'||wf_core.translate('PREVIOUS')||'</SPAN>');
1871 
1872        END IF;
1873 
1874 
1875          Wf_Core.Clear;
1876          Wf_Core.Token('START_REC', l_from);
1877          Wf_Core.Token('END_REC', l_to);
1878          Wf_Core.Token('TOTAL_REC', TO_CHAR(wf_lov.g_define_rec.total_rows));
1879          htp.p('<span class=contenttext><B>'||Wf_Core.Translate('PAGE_MSG')||'</B></span>');
1880 
1881        /*
1882        ** Check to see if you should create the Next button
1883        */
1884        IF  (wf_lov.g_value_tbl.count = p_max_rows) THEN
1885 
1886 
1887           l_start_row := TO_NUMBER(p_start_row) + p_max_rows;
1888 
1889 
1890           htp.p('<A HREF="javascript:LOV_rows('||
1891                   TO_CHAR(l_start_row)||
1892                 ')">');
1893 
1894           htp.p(wf_core.translate('NEXT')||'</A>');
1895 
1896            htp.p('<IMG SRC="/OA_MEDIA/WFNEXTEN.gif"  align="absbottom" border="0" alt="' || WF_CORE.Translate('NEXT') || '">');
1897       ELSE
1898          htp.p('<SPAN class=disabledtext><img src="/OA_MEDIA/WFNEXTDI.gif"  align="absbottom" border="0" alt="' || WF_CORE.Translate('NEXT') || '">&'||
1899 'nbsp;'||wf_core.translate('NEXT')||'</SPAN>');
1900 
1901        END IF;
1902 
1903           htp.p('</TD>');
1904        htp.tableRowClose;
1905       end if;
1906     end if; -- if (wf_lov.g_define_rec.total_rows=0)
1907 --       htp.tableclose;
1908 
1909     -- blue separator
1910  --     htp.p('<table width="100%" border="0" cellspacing="1" cellpadding="5">');
1911 htp.p('<TR><TD class=contenttext colspan=1 id=""> </TD></TR>');
1912       htp.p('<TR>');
1913       htp.p('<TD id=""><IMG src='||WFA_HTML.image_loc||'FNDITPNT.gif width=15 height=1 alt=""></TD>');
1914       htp.p('<TD id=""><table width="100%" border="0" cellspacing="0" cellpadding="0" background="'||WFA_HTML.image_loc||'WFBLUES.jpg">');
1915       htp.p('<tr background="'||WFA_HTML.image_loc||'WFBLUES.jpg">');
1916       htp.p('<td height="1" id="" background="'||WFA_HTML.image_loc||'WFBLUES.jpg"><img src="'||WFA_HTML.image_loc||'WFBLUES.gif" width="6" height="1"></td></tr></table></TD>');
1917       htp.tableRowClose;
1918 htp.p('<TR><TD class=contenttext colspan=1 id=""> </TD></TR>');
1919 --      htp.p('<table width="100%" border="0" cellspacing="1" cellpadding="5">');
1920       htp.p('<tr valign=baseline>');
1921      htp.p('<TD height=1 valign=bottom id=""><IMG src='||WFA_HTML.image_loc||'FNDITPNT.gif width=15 height=1 alt=""></TD>');
1922       htp.p('<td align=right valign=bottom id=""><a href="javascript:parent.self.close();"><img src="'||WFA_HTML.image_loc||p_language||'/WFCANCEL.gif" align="absmiddle" alt="'||wf_core.translate('CANCEL')||'" border="0"></a></td></tr></table>');
1923 --      htp.p('<td align=right valign=bottom><a href="javascript:parent.self.close();"><img src="'||WFA_HTML.image_loc||icx_sec.getID(21)||'/WFCANCEL.gif" align="absmiddle" alt="'||wf_core.translate('CANCEL')||'" border="0"></a></td></tr></table>');
1924   htp.formClose;
1925   htp.bodyclose;
1926   htp.htmlclose;
1927 
1928 
1929 exception
1930   when others then
1931     rollback;
1932     wf_core.context('Wf_Lov', 'display_lov_no_frame');
1933     wf_lov.error;
1934 
1935 end display_lov_no_frame;
1936 
1937 /*
1938 ** Bug 1380107. Avoid problem with multibyte characters in ssp5 url
1939 ** getting corrupted. The URL is created when the select button on the
1940 ** right of the reassign-to field is clicked in the notification
1941 ** details -> Reassign page. Error only occurs with Netscape 4.7X.
1942 ** This procedure is created to workaround the issue where
1943 ** multibyte characters for the word User (Japanese) are garbled.
1944 ** We used to call wfcontext.getMessage("WFA_FIND_USER") in WFReassign.jsp
1945 ** Pass in the non-translated key p_display_name_key instead
1946 ** of the translated multibyte value in p_display_name.
1947 ** This routine will use the key to find the translated value and call
1948 ** the procedure display_lov_no_frame.
1949  */
1950 procedure display_lov_no_frame_key
1951 (
1952 p_lov_name            in varchar2 ,
1953 p_display_name_key    in varchar2 ,
1954 p_validation_callback in varchar2 ,
1955 p_dest_hidden_field   in varchar2 ,
1956 p_dest_display_field  in varchar2 ,
1957 p_current_value       in varchar2 ,
1958 p_start_row           in varchar2 ,
1959 p_autoquery           in varchar2 ,
1960 p_language            in varchar2
1961 ) IS
1962 
1963 l_display_name  varchar2(4000) := NULL;
1964 BEGIN
1965 
1966 -- From wf_core.get_message
1967   begin
1968     select TEXT
1969     into l_display_name
1970     from WF_RESOURCES
1971     where TYPE = 'WFTKN'
1972        and NAME = p_display_name_key
1973        and LANGUAGE = p_language
1974        and NAME not in ('WF_VERSION','WF_SYSTEM_GUID',
1975         'WF_SYSTEM_STATUS','WF_SCHEMA');
1976   exception
1977     when NO_DATA_FOUND then
1978       select TEXT
1979       into l_display_name
1980       from WF_RESOURCES
1981       where TYPE = 'WFTKN'
1982         and NAME = p_display_name_key
1983         and LANGUAGE = 'US'
1984         and NAME in ('WF_VERSION','WF_SYSTEM_GUID',
1985           'WF_SYSTEM_STATUS','WF_SCHEMA');
1986   end;
1987 
1988   display_lov_no_frame(p_lov_name, l_display_name,
1989     p_validation_callback, p_dest_hidden_field,
1990     p_dest_display_field, p_current_value, p_start_row,
1991     p_autoquery, p_language);
1992 
1993 exception
1994   when others then
1995     rollback;
1996     wf_core.context('Wf_Lov', 'display_lov_no_frame_key');
1997     wf_lov.error;
1998 
1999 end display_lov_no_frame_key;
2000 
2001 
2002 end WF_LOV;