[Home] [Help]
PACKAGE BODY: APPS.ADI_BINARY_FILE
Source
1 PACKAGE BODY ADI_Binary_File AS
2 /* $Header: frmdimgb.pls 120.0.12000000.3 2007/03/01 20:13:17 ghooker ship $ */
3 --------------------------------------------------------------------------------
4 -- PACKAGE: ADI_Image --
5 -- --
6 -- DESCRIPTION: Displays an image embedded within an HTML file. Images --
7 -- will be displayed as part of the HTML file, whilst Xcel --
8 -- files, word documents, etc will be downloaded onto the --
9 -- file system (if the link is clicked on). --
10 -- --
11 -- MODIFICATION HISTORY --
12 -- Date Username Description --
13 -- 23-JUN-99 CCLYDE Initial Creation --
14 -- 07-AUG-99 CCLYDE Added Function GetFileListenerAddress --
15 -- 28-AUG-99 CCLYDE Added Exception clauses to all procedures which --
16 -- contained a SQL statement. (Task: 3275) --
17 -- 22-NOV-99 CCLYDE Added a test for the trailing '/' at the end of the --
18 -- File Listener declaration. (Task: 3757) --
19 -- (GetFileListenerAddress) --
20 -- 16-FEB-00 CCLYDE Added Package_Revision procedure to see if we can --
21 -- capture the revision number of the package during --
22 -- runtime. (Task: 3858) --
23 -- 12-Mar-00 DJANCIS Modified SHOW to get data from fnd_lobs table in --
24 -- addition to the fnd_document_long_raw table. --
25 -- (TASK: 3769 ) --
26 -- 16-MAY-00 GSANAP Moved the $Header comment from the top to under --
27 -- the CREATE OR REPLACE PACKAGE stmt. --
28 -- 29-JUN-00 GSANAP Modified Debug statements to include package names --
29 -- Task 4425 --
30 -- 13-NOV-02 GHOOKER Bugs 2279439, 2618782 Images not displayed in RM8 --
31 -- 09-MAY-02 GHOOKER SQL Bind Compliance - update Show Procedure --
32 -- 28-JUN-06 GHOOKER Stubbed out GetFileListenerAddress --
33 --------------------------------------------------------------------------------
34
35 --------------------------------------------------------------------------------
36 -- PROCEDURE: Show --
37 -- --
38 -- DESCRIPTION: Displays an image embedded within an HTML file. Images --
39 -- will be displayed as part of the HTML file, whilst Xcel --
40 -- files, word documents, etc will be downloaded onto the --
41 -- file system (if the link is clicked on). --
42 -- --
43 -- PARAMETERS: Media Id Unique identified from FND_DOCUMENT_LONG_RAW --
44 -- File File name stored in FND_DOCUMENTS_TL.file_name --
45 -- (potentially, there may be multiple files with --
46 -- the same file name, so calling ADI_Image with --
47 -- the file name is not a good idea. If multiple --
48 -- files exist, the procedure will only display --
49 -- the first retrieved file, based on update --
50 -- date). --
51 -- --
52 -- MODIFICATION HISTORY --
53 -- Date Username Description --
54 -- 23-JUN-99 CCLYDE Initial Creation --
55 -- 12-Mar-00 DJANCIS Modified to get data from fnd_lobs table in --
56 -- addition to the fnd_document_long_raw table. --
57 -- (Task: 3769 ) --
58 -- 29-JUN-00 GSANAP Modified Debug statements to include package names --
59 -- Task 4425 --
60 -- 14-NOV-02 GHOOKER Bugs 2279439, 2618782 Images not displayed RM8 --
61 -- 27-JUN-06 GHOOKER Bug 5127461 Sec Updates in 11.5.10 --
62 --------------------------------------------------------------------------------
63 PROCEDURE Show (p_documentId IN NUMBER DEFAULT 0,
64 p_file IN VARCHAR2 DEFAULT '') IS
65 v_query VARCHAR2 (3000);
66 v_cursor NUMBER;
67 v_dummy NUMBER;
68 v_file VARCHAR2(350);
69 v_media_id NUMBER;
70 v_datatype_id NUMBER;
71 v_descr VARCHAR2(255);
72 v_file_name VARCHAR2(2048);
73 v_cat_appid NUMBER;
74 v_cat_name VARCHAR2(255);
75 v_display_flag BOOLEAN;
76 v_function_name VARCHAR2(255);
77 v_access NUMBER;
78
79 BEGIN
80 v_query := '';
81 v_query := v_query || 'SELECT DOCS.DOCUMENT_ID || ''_'' || DOCS.FILE_NAME ';
82 v_query := v_query || ', MEDIA_ID, DATATYPE_ID ';
83 v_query := v_query || ', DESCRIPTION, FILE_NAME ';
84 v_query := v_query || ', CATEGORY_APPLICATION_ID, CATEGORY_DESCRIPTION ';
85 v_query := v_query || 'FROM FND_DOCUMENTS_VL DOCS ';
86
87 IF (p_file IS NOT NULL) THEN
88 v_query := v_query || 'WHERE LOWER (DOCS.FILE_NAME) = LOWER (:pfile) ';
89 ELSE
90 v_query := v_query || 'WHERE DOCS.DOCUMENT_ID = :docId ';
91 END IF;
92 v_cursor := DBMS_SQL.OPEN_CURSOR;
93 DBMS_SQL.PARSE (v_cursor, v_query, DBMS_SQL.NATIVE);
94 -- G HOOKER 09-May-2003 SQL Bind Compliance
95 IF (p_file IS NOT NULL) THEN
96 DBMS_SQL.BIND_VARIABLE(v_cursor, ':pfile', P_FILE);
97 ELSE
98 DBMS_SQL.BIND_VARIABLE(v_cursor, ':docId', P_DOCUMENTID);
99 END IF;
100
101 DBMS_SQL.DEFINE_COLUMN (v_cursor, 1, v_file, 350);
102 DBMS_SQL.DEFINE_COLUMN (v_cursor, 2, v_media_id);
103 DBMS_SQL.DEFINE_COLUMN (v_cursor, 3, v_datatype_id);
104 DBMS_SQL.DEFINE_COLUMN (v_cursor, 4, v_descr, 255);
105 DBMS_SQL.DEFINE_COLUMN (v_cursor, 5, v_file_name, 2048);
106 DBMS_SQL.DEFINE_COLUMN (v_cursor, 6, v_cat_appid);
107 DBMS_SQL.DEFINE_COLUMN (v_cursor, 7, v_cat_name, 255);
108
109 v_dummy := DBMS_SQL.EXECUTE (v_cursor);
110 v_dummy := DBMS_SQL.fetch_rows (v_cursor);
111 DBMS_SQL.column_value (v_cursor, 1, v_file);
112
113 -- Added items for fnd_lobs changes
114 DBMS_SQL.column_value (v_cursor, 2, v_media_id);
115 DBMS_SQL.column_value (v_cursor, 3, v_datatype_id);
116 DBMS_SQL.column_value (v_cursor, 4, v_descr);
117 DBMS_SQL.column_value (v_cursor, 5, v_file_name);
118 DBMS_SQL.column_value (v_cursor, 6, v_cat_appid);
119 DBMS_SQL.column_value (v_cursor, 7, v_cat_name);
120
121 DBMS_SQL.close_cursor(v_cursor);
122
123 if (icx_sec.validateSession) then
124 if (v_datatype_id = 6) then
125 v_display_flag := FALSE;
126 -- ghooker 27-JUN-06 Bug 5127461
127 -- adding our extra checks here only.
128 if ((v_cat_appid = 265) AND (v_cat_name = 'ADI Kiosk Image')) then
129 if (v_descr = 'image/gif') then
130 -- file is a seeded gif file and can be displayed without further
131 -- checks.
132 v_display_flag := TRUE;
133 else
134 -- now we go and retrieve the function name from the file_name
135 -- test if it is an xls file, then do the function security check.
136 if (v_descr = 'application/vnd.ms-excel') then
137 v_function_name := substr(v_file_name, 1, instr(v_file_name, '_', 1, 1) -1);
138 if (v_function_name is NULL) then
139 v_function_name := v_file_name;
140 end if;
141 else
142 -- ghooker 26-FEB-07 bug 5873313
143 -- now it is possible that this is a 3rd party file upload and we still have a form
144 -- funtions to enable us to display the file.
145 v_function_name := v_file_name;
146 end if;
147 -- ghooker 26-FEB-07 bug 5873313
148 if (fnd_function.test(v_function_name)) then
149 v_display_flag := TRUE;
150 end if;
151 end if;
152 end if;
153 if (v_display_flag) then
154 v_access := fnd_gfm.authorize(v_media_id);
155 fnd_gfm.download(v_media_id, v_access);
156 else
157 -- using -1 to force a access denied error message to be returned to
158 -- calling page.
159 v_access := fnd_gfm.authorize(-1);
160 fnd_gfm.download(v_media_id, v_access);
161 end if;
162 else
163 -- -- ghooker 26-FEB-07 bug 5873313
164 -- As all this is for 11i and abover all files should be coming from
165 -- fnd_lobs in ADI and RM we will fail any file that does not meet
166 -- the criteria above.
167 -- using -1 to force a access denied error message to be returned to
168 -- calling page.
169 v_access := fnd_gfm.authorize(-1);
170 fnd_gfm.download(v_media_id, v_access);
171 end if;
172
173 end if;
174 EXCEPTION
175 WHEN OTHERS THEN
176 ICX_UTIL.Add_Error ('ADI_Binary_File.Show - ' || SQLERRM);
177 ICX_ADMIN_SIG.Error_Screen ('ADI_Binary_File.Show - ' || SQLERRM);
178 END Show;
179
180 --------------------------------------------------------------------------------
181 -- PROCEDURE: PackageRevision --
182 -- --
183 -- DESCRIPTION: Checks the revision number of the package during runtime. --
184 -- --
185 -- Modification History --
186 -- Date Username Description --
187 -- 16-FEB-00 CCLYDE Initial Creation --
188 --------------------------------------------------------------------------------
189 PROCEDURE PackageRevision (p_showOwner IN VARCHAR2 DEFAULT '') IS
190 v_revisionDetails VARCHAR2(100);
191 v_firstDelimLoc NUMBER;
192 v_secondDelimLoc NUMBER;
193 v_packageName VARCHAR2(40) DEFAULT 'ADI_Binary_File';
194 v_fileName VARCHAR2(20);
195 v_versionNumber NUMBER;
196 v_dateCheckedIn VARCHAR2(30);
197 v_shipStatus VARCHAR2(10);
198 v_developer VARCHAR2(15);
199 v_testRevision VARCHAR2(30);
200 BEGIN
201 v_testRevision := '$Revision: 120.0.12000000.3 $';
202 v_revisionDetails := '$Header: frmdimgb.pls 120.0.12000000.3 2007/03/01 20:13:17 ghooker ship $';
203
204 -- Retrieving the filename
205 v_firstDelimLoc := INSTR (v_revisionDetails, ' ', 1, 1);
206 v_secondDelimLoc := INSTR (v_revisionDetails, ' ', 1, 2);
207 v_fileName := SUBSTR (v_revisionDetails, (v_firstDelimLoc + 1), ((v_secondDelimLoc)-(v_firstDelimLoc + 1)));
208
209 -- Retrieving the version number
210 v_firstDelimLoc := INSTR (v_revisionDetails, ' ', 1, 2);
211 v_secondDelimLoc := INSTR (v_revisionDetails, ' ', 1, 3);
212 v_versionNumber := SUBSTR (v_revisionDetails, (v_firstDelimLoc + 1), ((v_secondDelimLoc)-(v_firstDelimLoc + 1)));
213
214 -- Retrieving the Checked in Date
215 v_firstDelimLoc := INSTR (v_revisionDetails, ' ', 1, 3);
216 v_secondDelimLoc := INSTR (v_revisionDetails, ' ', 1, 5);
217 v_dateCheckedIn := SUBSTR (v_revisionDetails, (v_firstDelimLoc + 1), ((v_secondDelimLoc)-(v_firstDelimLoc + 1)));
218
219 -- Retrieving Shipped Status
220 v_firstDelimLoc := INSTR (v_revisionDetails, ' ', 1, 5);
221 v_secondDelimLoc := INSTR (v_revisionDetails, ' ', 1, 6);
222 v_developer := SUBSTR (v_revisionDetails, (v_firstDelimLoc + 1), ((v_secondDelimLoc)-(v_firstDelimLoc + 1)));
223
224 -- Retrieving Shipped Status
225 v_firstDelimLoc := INSTR (v_revisionDetails, ' ', 1, 6);
226 v_secondDelimLoc := INSTR (v_revisionDetails, ' ', 1, 7);
227 v_shipStatus := SUBSTR (v_revisionDetails, (v_firstDelimLoc + 1), ((v_secondDelimLoc)-(v_firstDelimLoc + 1)));
228
229 -- Building the table of revision information
230 htp.htmlOpen;
231 -- ADI_Header_Footer.htmlhead ('Revision: ' || v_packageName);
232 htp.bodyOpen;
233 -- ADI_Header_Footer.pagebanner ('Package Revision Details', 'WEBR.REVI');
234 htp.para;
235
236 htp.tableOpen ('BORDER=1', null, null, null, 'CELLPADDING=6');
237
238 htp.tableRowOpen;
239 htp.tableHeader ('<FONT COLOR=#FFFFFF> Package Revision Details <FONT>', 'CENTER', null, 'NOWRAP', null, 2, 'BGCOLOR=#336699');
240 htp.tableRowClose;
241
242 htp.tableRowOpen;
243 htp.tableData (htf.strong ('Filename'), 'LEFT', null, 'NOWRAP', null, null, null);
244 htp.tableData (v_fileName, 'LEFT', null, 'NOWRAP', null, null, null);
245 htp.tableRowClose;
246
247 htp.tableRowOpen;
248 htp.tableData (htf.strong ('Package'), 'LEFT', null, 'NOWRAP', null, null, null);
249 htp.tableData (v_packageName, 'LEFT', null, 'NOWRAP', null, null, null);
250 htp.tableRowClose;
251
252 htp.tableRowOpen;
253 htp.tableData (htf.strong ('Version'), 'LEFT', null, 'NOWRAP', null, null, null);
254 htp.tableData (v_versionNumber, 'LEFT', null, 'NOWRAP', null, null, null);
255 htp.tableRowClose;
256
257 htp.tableRowOpen;
258 htp.tableData (htf.strong ('Checked In'), 'LEFT', null, 'NOWRAP', null, null, null);
259 htp.tableData (v_dateCheckedIn, 'LEFT', null, 'NOWRAP', null, null, null);
260 htp.tableRowClose;
261
262 htp.tableRowOpen;
263 htp.tableData (htf.strong ('Ship Status'), 'LEFT', null, 'NOWRAP', null, null, null);
264 htp.tableData (v_shipStatus, 'LEFT', null, 'NOWRAP', null, null, null);
268 htp.tableRowOpen;
265 htp.tableRowClose;
266
267 IF (LOWER (p_showOwner) = 'big_cheese') THEN
269 htp.tableData (htf.strong ('Developer'), 'LEFT', null, 'NOWRAP', null, null, null);
270 htp.tableData (v_developer, 'LEFT', null, 'NOWRAP', null, null, null);
271 htp.tableRowClose;
272 END IF;
273
274 htp.tableClose;
275
276 -- ADI_Header_Footer.pagefoot;
277
278 END PackageRevision;
279
280 ---------------------------------------------------------------------------
281 END ADI_Binary_File;