DBA Data[Home] [Help]

PACKAGE BODY: APPS.FND_FILE_UPLOAD

Source


1 package body FND_FILE_UPLOAD as
2 /* $Header: AFAKFUPB.pls 120.5.12020000.2 2012/07/19 03:41:26 ctilley 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 9276419 '-3' is used to indicate a filetype has been restricted and
76     -- cannot be uploaded.
77     if l_file_id = -3 then
78        htp.p (
79          htf.bold(fnd_message.get_string('FND','FND_SECURITY_FILETYPE_RESTRICT')));
80     -- bug 3045375, added if to throw invalid file message when l_file_id=-2
81     --  '-2' indicates that the file size limit has been exceeded or the file
82     --  or the file has no size
83     elsif l_file_id = -2 then
84        htp.p (
85            htf.bold(fnd_message.get_string('FND','UPLOAD_FILESIZE_LIMIT')));
86     else
87        htp.p (
88            htf.bold(fnd_message.get_string('FND','FILE-UPLOAD FAILED')));
89     end if;
90     htp.br;
91     htp.bodyClose;
92     htp.htmlClose;
93   end if;
94 end if;
95 
96 end UploadCompleteMessage;
97 
98 -- CancelProcess
99 --    Displays the file upload cancel message page.
100 --  IN
101 --	file_id	- Unique process to autenticate the file upload process.
102 --
103 
104 procedure CancelProcess as
105 
106 begin
107 
108 if (icx_sec.ValidateSession) then
109 
110   -- Show a message page
111   htp.htmlOpen;
112   htp.headOpen;
113   htp.title(fnd_message.get_string('FND','FILE-UPLOAD PAGE TITLE'));
114   htp.headClose;
115   htp.bodyOpen;
116   htp.img2('/OA_MEDIA/FNDLOGOS.gif',calign => 'Left',calt => 'Logo');
117   htp.br;
118   htp.br;
119   htp.p('<h4>'||fnd_message.get_string('FND','FILE-UPLOAD PAGE HEADING')
120                                                                 ||'</h4>');
121   htp.hr;
122   htp.p (htf.bold(fnd_message.get_string('FND','FILE-UPLOAD CANCEL MESSAGE')));
123   htp.br;
124   htp.p ('<h4>'||fnd_message.get_string('FND','FILE-UPLOAD CLOSE WEB BROWSER')
125                                                                 ||'</h4>');
126   htp.p ('<h4>'|| fnd_message.get_string('FND','FILE-UPLOAD REJECT UPLOAD')
127                                                                 ||'</h4>');
128   htp.br;
129   htp.br;
130   htp.br;
131   htp.bodyClose;
132   htp.htmlClose;
133 
134 end if;
135 
136 end CancelProcess;
137 
138 --
139 -- DisplayGFMForm
140 --   access_id -  Access id for file in fnd_lobs
141 --   l_server_url - Obsolete, not used anymore
142 --
143 PROCEDURE DisplayGFMForm(access_id IN NUMBER, l_server_url VARCHAR2) IS
144   l_cancel_url VARCHAR2(255);
145   l_start_pos NUMBER := 1;
146   l_length NUMBER := 0;
147   upload_action VARCHAR2(2000);
148   l_language varchar2(80);
149 BEGIN
150 
151 if (icx_sec.ValidateSession) then
152 
153   -- Set the upload action
154   upload_action := fnd_gfm.construct_upload_url(fnd_web_config.gfm_agent,
155                                 'fnd_file_upload.uploadcompletemessage',
156                                 access_id);
157 
158   -- Set page title and toolbar.
159   htp.htmlOpen;
160   htp.headOpen;
161   htp.p( '<SCRIPT LANGUAGE="JavaScript">');
162   htp.p( ' function processclick (cancel_url) {
163                  if (confirm('||'"'||
164 		 fnd_message.get_string ('FND','FILE-UPLOAD CONFIRM CANCEL')
165 		 ||'"'||'))
166                  {
167                         parent.location=cancel_url
168                  }
169               }');
170   htp.print(  '</SCRIPT>' );
171   htp.title(fnd_message.get_string('FND','FILE-UPLOAD PAGE TITLE'));
172   htp.headClose;
173   htp.bodyOpen;
174   htp.img2('/OA_MEDIA/FNDLOGOS.gif',calign => 'Left',calt => 'Logo');
175   htp.br;
176   htp.br;
177   htp.p('<h4>'||fnd_message.get_string('FND','FILE-UPLOAD PAGE HEADING')
178                                                                 ||'</h4>');
179   htp.hr;
180   htp.br;
181   htp.print( '</LEFT>' );
182 
183   htp.formOpen( curl => upload_action, cmethod => 'POST',
184 		cenctype=> 'multipart/form-data');
185   htp.tableOpen(  cattributes => ' border=0 cellpadding=2 cellspacing=0' );
186   htp.tableRowOpen;
187   htp.tableRowClose;
188 
189   htp.tableRowOpen( cvalign => 'TOP' );
190   htp.p('<TD>');
191   htp.p('</TD>');
192   htp.p('<label> '||fnd_message.get_string('FND','ATCHMT-FILE-PROMPT')||' </label>');
193   htp.tableData( '<INPUT TYPE="File" NAME="file" SIZE="60">',
194                                                         calign => 'left');
195   htp.tableRowClose;
196   htp.tableClose;
197 
198   -- Send access is as a hidden value
199   htp.formHidden ( cname =>'access_id', cvalue=> to_char(access_id) );
200   -- Submit and Reset Buttons.
201 --   l_cancel_url := RTRIM(l_server_url, '/') ||
202 --                   '/fnd_file_upload.cancelprocess';
203   l_cancel_url := rtrim(fnd_web_config.plsql_agent, '/') ||
204                   '/fnd_file_upload.cancelprocess';
205 
206   htp.br;
207   htp.tableOpen(  cattributes => ' border=0 cellpadding=2 cellspacing=0' );
208   htp.tableRowOpen( cvalign => 'TOP' );
209   htp.tableData( '<INPUT TYPE="Submit" VALUE="' ||
210 		fnd_message.get_string('FND','OK')||
211 		'" SIZE="50">', calign => 'left');
212   htp.tableData( '<INPUT TYPE="Button" NAME="cancel" VALUE="' ||
213 	       fnd_message.get_string('FND','FILE-UPLOAD CANCEL BUTTON TEXT')||
214 	       '"' || ' onClick="processclick('''||l_cancel_url||
215 	       ''') " SIZE="50">', calign => 'left');
216   htp.tableRowClose;
217   htp.tableClose;
218   htp.formClose;
219 
220   htp.bodyClose;
221   htp.htmlClose;
222 END IF;
223 END;
224 
225 end FND_FILE_UPLOAD;