DBA Data[Home] [Help]

PACKAGE BODY: APPS.WF_FORMS

Source


1 package body WF_FORMS as
2 /* $Header: wffrmb.pls 120.3 2005/10/04 05:19:04 rtodi ship $ */
3 
4 --
5 -- Applet
6 --   Generate the applet tag for WFForms
7 -- IN
8 --   fname - form function with format 'func1:PARAM1="&ID" PARAM2="&NAME"'
9 --   port - port listened by the socket listener
10 --   codebase - where the java classes can be located
11 --   code - name for the class
12 --   archive  - first looks for java classes at this archive
13 --
14 -- OUT
15 --   status - true if is permitted to launch, false otherwise
16 --
17 procedure Applet(fname    in  varchar2,
18                  dispname in  varchar2 ,
19                  port     in  varchar2 ,
20                  codebase in  varchar2 ,
21                  code     in  varchar2 ,
22                  archive  in  varchar2 ,
23                  status   out nocopy boolean)
24 is
25   l_func  varchar2(240);
26   l_colon pls_integer;
27 begin
28   l_colon := instr(fname, ':');
29   if (l_colon <> 0) then
30     l_func := substr(fname, 1, l_colon - 1);
31   else
32     l_func := fname;
33   end if;
34 
35   if (Fnd_Function.Test(l_func)) then
36     htp.p('<A HREF="javascript:window.open(''wf_forms.AppletWindow?fname='
37           ||wfa_html.conv_special_url_chars(fname)
38           ||'&port='||port||'&codebase='||codebase||'&code='||code
39           ||'&archive='||archive||''',''formapplet'','||
40           '''toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=250,height=100'''
41           ||');window.history.go(0);" >'||
42           '<IMG SRC="'||wfa_html.image_loc||'wffrmdoc.gif" ALT="'||
43           dispname||'" BORDER=no></A>');
44     status := TRUE;
45   else
46     htp.p('<IMG SRC="'||wfa_html.image_loc||'wfdc_off.gif" ALT="">');
47     status := FALSE;
48   end if;
49 exception
50   when others then
51     status := FALSE;
52     wf_core.context('Wf_Forms', 'Applet', fname, port);
53     raise;
54 end Applet;
55 
56 --
57 -- AppletWindow
58 --   Generate the applet window to call up a form
59 -- IN
60 --   fname - form function with format 'func1:PARAM1="&ID" PARAM2="&NAME"'
61 --   port - port listened by the socket listener
62 --   codebase - where the java classes can be located
63 --   code - name for the class
64 --   archive  - first looks for java classes at this archive
65 --
66 procedure AppletWindow(fname    in  varchar2,
67                        port     in  varchar2 ,
68                        codebase in  varchar2 ,
69                        code     in  varchar2,
70                        archive  in  varchar2 )
71 is
72   l_archive varchar2(2000) := Wf_Forms.java_loc||
73                      'oracle/apps/fnd/jar/wffrm.jar,'||
74                      Wf_Forms.java_loc||'oracle/apps/fnd/jar/fndewt.jar,'||
75                      Wf_Forms.java_loc||'oracle/apps/fnd/jar/fndswing.jar,'||
76                      Wf_Forms.java_loc||'oracle/apps/fnd/jar/fndbalishare.jar';
77   l_func  varchar2(240);
78   l_colon pls_integer;
79   l_ie_plugin_ver varchar2(80);  -- IE version is delimited by ','
80 begin
81   if (archive is not null) then
82     l_archive := archive;
83   end if;
84 
85   l_colon := instr(fname, ':');
86   if (l_colon <> 0) then
87     l_func := substr(fname, 1, l_colon - 1);
88   else
89     l_func := fname;
90   end if;
91 
92   htp.p('<HTML><META HTTP-EQUIV="expires" CONTENT="0">');
93   htp.p('<HEAD>');
94   htp.p('<TITLE>'||wf_core.translate('WFFRM_LAUNCHING')||'</TITLE>');
95   htp.p('</HEAD>');
96 
97   htp.p('<!-- debug info -->');
98   htp.p('<!-- fname : '||fname||' -->');
99   htp.p('<!-- l_func: '||l_func||' -->');
100 
101   htp.p('<BODY>');
102 
103   -- ### maybe we need to make the window closing time a configurable
104   -- ### parameter in the future
105   htp.p('<Script> dontclose = setTimeout("window.close()",30000) </Script>');
106   htp.p('<NoScript><p>'||wf_core.translate('WFFRM_CLOSE_WINDOW')||'</NoScript>');
107 -- ### we cannot retest in this window, so commented it out.
108 --  if (Fnd_Function.Test(l_func)) then
109 
110   htp.p('<TABLE summary="" width=100% border=0><TR><TD>');
111 
112   l_ie_plugin_ver := replace(Wf_Core.translate('WF_PLUGIN_VERSION'),
113                               '.', ',');
114 
115   if (instr(UPPER(owa_util.get_cgi_env('HTTP_USER_AGENT')), 'WIN') > 0) then
116     htp.p('<OBJECT classid="clsid:'||Wf_Core.translate('WF_CLASSID')||'" '||
117              'WIDTH="36" HEIGHT="40" '||
118              'CODEBASE="'||Wf_Core.translate('WF_PLUGIN_DOWNLOAD')||
119              '#Version='||l_ie_plugin_ver||'">'||
120            '<PARAM NAME="jinit_appletcache" VALUE="off">'||
121            '<PARAM NAME="CODE"     VALUE="'||code||'">'||
122            '<PARAM NAME="CODEBASE" VALUE="'||codebase||'">'||
123            '<PARAM NAME="ARCHIVE"  VALUE="'||l_archive||'">' ||
124            '<PARAM NAME="type"     VALUE="'||
125                         'application/x-jinit-applet;version='||
126                         Wf_Core.translate('WF_PLUGIN_VERSION')||'">');
127     if (port <> '0') then
128       htp.p('<PARAM NAME="PORT"     VALUE="'||port||'">');
129     end if;
130     htp.p('<PARAM NAME="COMM"     VALUE='''||fname||'''>');
131     htp.p('<COMMENT>'||
132           '<EMBED type="application/x-jinit-applet;version='||
133              Wf_Core.translate('WF_PLUGIN_VERSION')||'"'||
134              ' WIDTH="36" HEIGHT="40"'||
135              ' jinit_appletcache="off"'||
136              ' java_CODE="'||code||'"'||
137              ' java_CODEBASE="'||codebase||'"'||
138              ' java_ARCHIVE="'||l_archive||'"');
139     if (port <> '0') then
140       htp.p(' Port='||port);
141     end if;
142     htp.p(   ' COMM='''||fname||''''||
143              ' pluginurl="'||
144              Wf_Core.translate('WF_PLUGIN_DOWNLOAD')||'">'||
145            '<NOEMBED></COMMENT></NOEMBED></EMBED></OBJECT>');
146   else
147     -- Client is not Windows, so we don't want to call Jinitiator.
148     htp.p('<applet code='||code||' codebase="'||codebase||'"');
149     htp.p('archive="'||l_archive||'"');
150     htp.p(' width="36" height="40">');
151     if (port <> '0') then
152       htp.p('<param name=Port value="'||port||'">');
153     end if;
154     htp.p('<PARAM NAME="COMM"     VALUE='''||fname||'''>');
155     htp.p('</applet>');
156   end if;
157 
158     htp.p('</TD>');
159     htp.p('<TD>'||wf_core.translate('WFFRM_LOOK_IN_NAVIGATOR')||'</TD>');
160     htp.p('</TR><TR><TD align=CENTER colspan=2>');
161     htp.p('<FORM METHOD=POST ACTION="javascript:clearTimeout(dontclose);">');
162     htp.p('<INPUT TYPE=SUBMIT VALUE="'||wf_core.translate('WFFRM_KEEP_WINDOW')
163           ||'">');
164     htp.p('</FORM>');
165     htp.p('</TD>');
166     htp.p('</TR></TABLE>');
167 
168 --  else
169     -- ADA: do not show anything here
170 --    htp.p('<IMG SRC="'||wfa_html.image_loc||'wfdc_off.gif" ALT="">');
171 --  end if;
172 
173   htp.p('</BODY>');
174   htp.p('</HTML>');
175 exception
176   when others then
177     wf_core.context('Wf_Forms', 'AppletWindow', fname, port);
178     raise;
179 end AppletWindow;
180 
181 end WF_FORMS;