DBA Data[Home] [Help]

PACKAGE BODY: APPS.FND_FILE_UPLOAD

Source


1 package body FND_FILE_UPLOAD as
2 /* $Header: AFAKFUPB.pls 120.5 2006/03/13 10:58:54 blash ship $ */
3 
4 
5 -- UploadCompleteMessage
6 --
7 --    Displays file upload compelte message.
8 --
9 
10 procedure UploadCompleteMessage( file	varchar2,
11 				 access_id	number)
12 is
13   l_file_id	number;
14   invchr        number;
15   fn            varchar2(256);
16 begin
17 if (icx_sec.ValidateSession) then
18   l_file_id := fnd_gfm.confirm_upload(access_id    => access_id,
19 				      file_name	   => file,
20 				      program_name => 'FNDATTCH');
21 
22   fn := SUBSTR(file, INSTR(file,'/')+1);
23 
24 /*  Backed out the change for invalid characters per bug 47309
25 
26   invchr := INSTR(fn,'&');
27   if invchr > 0 then
28      l_file_id := -2;
29   end if;
30   invchr := INSTR(fn,'%');
31   if invchr > 0 then
32      l_file_id := -2;
33   end if;
34   invchr := INSTR(fn,'?');
35   if invchr > 0 then
36      l_file_id := -2;
37   end if;
38  */
39 
40     -- bug 3045375, changed <> to > so <0 l_file_id goes to else.
41   if (l_file_id > -1) then -- File upload completed
42     htp.htmlOpen;
43     htp.headOpen;
44     htp.title(fnd_message.get_string('FND','FILE-UPLOAD PAGE TITLE'));
45     htp.headClose;
46     htp.bodyOpen;
47     htp.img2('/OA_MEDIA/FNDLOGOS.gif',calign => 'Left',calt => 'Logo');
48     htp.br;
49     htp.br;
50     htp.p('<h4>'||fnd_message.get_string('FND','FILE-UPLOAD PAGE HEADING')
51                                                                 ||'</h4>');
52     htp.hr;
53     htp.p (
54        htf.bold(fnd_message.get_string('FND','FILE-UPLOAD COMPLETED MESSAGE')));
55     htp.br;
56     htp.p ('<h4>'||fnd_message.get_string('FND','FILE-UPLOAD CLOSE WEB BROWSER')
57                                                                 ||'</h4>');
58     htp.p ('<h4>'||fnd_message.get_string('FND','FILE-UPLOAD CONFIRM UPLOAD')
59                                                                 ||'</h4>');
60     htp.br;
61     htp.bodyClose;
62     htp.htmlClose;
63   else -- File upload failed.
64     htp.htmlOpen;
65     htp.headOpen;
66     htp.title(fnd_message.get_string('FND','FILE-UPLOAD PAGE TITLE'));
67     htp.headClose;
68     htp.bodyOpen;
69     htp.img2('/OA_MEDIA/FNDLOGOS.gif',calign => 'Left',calt => 'Logo');
70     htp.br;
71     htp.br;
72     htp.p('<h4>'||fnd_message.get_string('FND','FILE-UPLOAD PAGE HEADING')
73                                                                 ||'</h4>');
74     htp.hr;
75     -- bug 3045375, added if to throw invalid file message when l_file_id=-2
76     if l_file_id <> -2 then
77        htp.p (
78          htf.bold(fnd_message.get_string('FND','FILE-UPLOAD FAILED')));
79     else
80        htp.p (
81          htf.bold(fnd_message.get_string('FND','UPLOAD_FILESIZE_LIMIT')));
82     end if;
83     htp.br;
84     htp.bodyClose;
85     htp.htmlClose;
86   end if;
87 end if;
88 
89 end UploadCompleteMessage;
90 
91 -- CancelProcess
92 --    Displays the file upload cancel message page.
93 --  IN
94 --	file_id	- Unique process to autenticate the file upload process.
95 --
96 
97 procedure CancelProcess as
98 
99 begin
100 
101 if (icx_sec.ValidateSession) then
102 
103   -- Show a message page
104   htp.htmlOpen;
105   htp.headOpen;
106   htp.title(fnd_message.get_string('FND','FILE-UPLOAD PAGE TITLE'));
107   htp.headClose;
108   htp.bodyOpen;
109   htp.img2('/OA_MEDIA/FNDLOGOS.gif',calign => 'Left',calt => 'Logo');
110   htp.br;
111   htp.br;
112   htp.p('<h4>'||fnd_message.get_string('FND','FILE-UPLOAD PAGE HEADING')
113                                                                 ||'</h4>');
114   htp.hr;
115   htp.p (htf.bold(fnd_message.get_string('FND','FILE-UPLOAD CANCEL MESSAGE')));
116   htp.br;
117   htp.p ('<h4>'||fnd_message.get_string('FND','FILE-UPLOAD CLOSE WEB BROWSER')
118                                                                 ||'</h4>');
119   htp.p ('<h4>'|| fnd_message.get_string('FND','FILE-UPLOAD REJECT UPLOAD')
120                                                                 ||'</h4>');
121   htp.br;
122   htp.br;
123   htp.br;
124   htp.bodyClose;
125   htp.htmlClose;
126 
127 end if;
128 
129 end CancelProcess;
130 
131 --
132 -- DisplayGFMForm
133 --   access_id -  Access id for file in fnd_lobs
134 --   l_server_url - Obsolete, not used anymore
135 --
136 PROCEDURE DisplayGFMForm(access_id IN NUMBER, l_server_url VARCHAR2) IS
137   l_cancel_url VARCHAR2(255);
138   l_start_pos NUMBER := 1;
139   l_length NUMBER := 0;
140   upload_action VARCHAR2(2000);
141   l_language varchar2(80);
142 BEGIN
143 
144 if (icx_sec.ValidateSession) then
145 
146   -- Set the upload action
147   upload_action := fnd_gfm.construct_upload_url(fnd_web_config.gfm_agent,
148                                 'fnd_file_upload.uploadcompletemessage',
149                                 access_id);
150 
151   -- Set page title and toolbar.
152   htp.htmlOpen;
153   htp.headOpen;
154   htp.p( '<SCRIPT LANGUAGE="JavaScript">');
155   htp.p( ' function processclick (cancel_url) {
156                  if (confirm('||'"'||
157 		 fnd_message.get_string ('FND','FILE-UPLOAD CONFIRM CANCEL')
158 		 ||'"'||'))
159                  {
160                         parent.location=cancel_url
161                  }
162               }');
163   htp.print(  '</SCRIPT>' );
164   htp.title(fnd_message.get_string('FND','FILE-UPLOAD PAGE TITLE'));
165   htp.headClose;
166   htp.bodyOpen;
167   htp.img2('/OA_MEDIA/FNDLOGOS.gif',calign => 'Left',calt => 'Logo');
168   htp.br;
169   htp.br;
170   htp.p('<h4>'||fnd_message.get_string('FND','FILE-UPLOAD PAGE HEADING')
171                                                                 ||'</h4>');
172   htp.hr;
173   htp.br;
174   htp.print( '</LEFT>' );
175 
176   htp.formOpen( curl => upload_action, cmethod => 'POST',
177 		cenctype=> 'multipart/form-data');
178   htp.tableOpen(  cattributes => ' border=0 cellpadding=2 cellspacing=0' );
179   htp.tableRowOpen;
180   htp.tableRowClose;
181 
182   htp.tableRowOpen( cvalign => 'TOP' );
183   htp.p('<TD>');
184   htp.p('</TD>');
185   htp.p('<label> '||fnd_message.get_string('FND','ATCHMT-FILE-PROMPT')||' </label>');
186   htp.tableData( '<INPUT TYPE="File" NAME="file" SIZE="60">',
187                                                         calign => 'left');
188   htp.tableRowClose;
189   htp.tableClose;
190 
191   -- Send access is as a hidden value
192   htp.formHidden ( cname =>'access_id', cvalue=> to_char(access_id) );
193   -- Submit and Reset Buttons.
194 --   l_cancel_url := RTRIM(l_server_url, '/') ||
195 --                   '/fnd_file_upload.cancelprocess';
196   l_cancel_url := rtrim(fnd_web_config.plsql_agent, '/') ||
197                   '/fnd_file_upload.cancelprocess';
198 
199   htp.br;
200   htp.tableOpen(  cattributes => ' border=0 cellpadding=2 cellspacing=0' );
201   htp.tableRowOpen( cvalign => 'TOP' );
202   htp.tableData( '<INPUT TYPE="Submit" VALUE="' ||
203 		fnd_message.get_string('FND','OK')||
204 		'" SIZE="50">', calign => 'left');
205   htp.tableData( '<INPUT TYPE="Button" NAME="cancel" VALUE="' ||
206 	       fnd_message.get_string('FND','FILE-UPLOAD CANCEL BUTTON TEXT')||
207 	       '"' || ' onClick="processclick('''||l_cancel_url||
208 	       ''') " SIZE="50">', calign => 'left');
209   htp.tableRowClose;
210   htp.tableClose;
211   htp.formClose;
212 
213   htp.bodyClose;
214   htp.htmlClose;
215 END IF;
216 END;
217 
218 end FND_FILE_UPLOAD;