REM dbdrv: sql ~PROD ~PATH ~FILE none none none package &phase=plb \
REM dbdrv: checkfile:~PROD:~PATH:~FILE
/*=======================================================================+
| Copyright (C) 1995 Oracle Corporation Redwood Shores, California, Usa|
| All Rights Reserved. |
+=======================================================================+
| FILENAME
| wflovb.sql
| DESCRIPTION
| PL/SQL body for package: WF_LOV
|
| MODIFICATION LOG:
| Bug 1380107 08/01 NLIU - Added the procedure display_lov_no_frame_key.
| This works around the Netscape 4.7X error with javascript
| and multibyte characters getting corrupted.
|
| Bug 1904844 12/03 CTILLEY - Added arg p_display_key to the procedures
| display_lov, display_lov_find, and
| display_lov_details to indicate the key is
| passed instead of the translated value.
|
| bug 2001012 01/2002 JWSMITH - Increased username, l_name to varchar2(320)
|
| Bug 2512800 11/02 NLIU - User with end date will not be present in
| forward to LOV in iProcurement.
|
| Bug 2669069 11/02 NLIU - Allow name with apostrophe to be selected in
| forward to LOV in iProcurement.
|
*=======================================================================*/
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
WHENEVER OSERROR EXIT FAILURE ROLLBACK
set arraysize 1
set scan off
create or replace package body WF_LOV as
/* $Header: wflovb.pls 26.22 2005/05/25 23:08:34 dlam ship $ */
--
-- Error (PRIVATE)
-- Print a page with an error message.
-- Errors are retrieved from these sources in order:
-- 1. wf_core errors
-- 2. Oracle errors
-- 3. Unspecified INTERNAL error
--
procedure Error
as
error_name varchar2(30);
error_message varchar2(2000);
error_stack varchar2(32000);
username varchar2(320);
begin
WFA_SEC.GetSession(username);
htp.htmlOpen;
htp.headOpen;
htp.title(wf_core.translate('ERROR'));
htp.headClose;
begin
wfa_sec.Header(background_only=>TRUE);
exception
when others then
htp.bodyOpen;
end;
htp.header(nsize=>1, cheader=>wf_core.translate('ERROR'));
wf_core.get_error(error_name, error_message, error_stack);
error_message := wf_core.substituteSpecialChars(error_message);
error_stack := wf_core.substituteSpecialChars(error_stack);
if (error_name is not null) then
htp.p(error_message);
else
htp.p(sqlerrm);
end if;
htp.hr;
htp.p(wf_core.translate('WFENG_ERRNAME')||': '||error_name);
htp.br;
htp.p(wf_core.translate('WFENG_ERRSTACK')||': '||
replace(error_stack,wf_core.newline,' '));
wfa_sec.Footer;
htp.htmlClose;
end Error;
/*===========================================================================
PROCEDURE NAME: OpenLovWinHtml
DESCRIPTION: Generates javascript required to run the HTML LOV.
Insert the javascript statements in the header of
the Document that will call the LOV window.
============================================================================*/
procedure OpenLovWinHtml(p_jscript_tag IN Varchar2 ) is
begin
IF (p_jscript_tag = 'Y') THEN
htp.p('');
htp.p('');
END IF;
exception
when others then
Wf_Core.Context('wf_lov', 'OpenLovWinHtml');
raise;
end OpenLovWinHtml;
/*===========================================================================
FUNCTION NAME: GenerateLovURL
DESCRIPTION: Generates the URL syntax required to launch
the lov window for the given field.
============================================================================*/
function GenerateLovURL (p_form_name IN Varchar2,
p_query_plsql IN Varchar2,
p_query_params IN Varchar2,
p_column_names IN Varchar2,
p_longlist IN Varchar2,
p_callback IN Varchar2 ,
p_callback_params IN Varchar2 ,
p_init_find_field IN Varchar2 ,
p_width IN Varchar2,
p_height IN Varchar2,
p_prompt IN Varchar2 ,
p_window_title IN Varchar2 )
return VARCHAR2
IS
l_url VARCHAR2(4000);
BEGIN
l_url := '"javascript:fnd_open_window('||''''||
'wf_lov.lovapplet'||
'?doc_name=' ||p_form_name||
'&column_names=' ||p_column_names||
'&query_params=' ||p_query_params||
'&query_plsql=' ||p_query_plsql||
'&longlist=' ||p_longlist||
'&callback=' ||p_callback||
'&callback_params='||p_callback_params||
'&initial_find=' ||p_init_find_field||
'&window_title=' ||p_window_title||
''''||
','||p_width||','||p_height||')" ';
if p_prompt is not null then
l_url := l_url|| ' OnMouseOver="window.status='''||p_prompt||
''';return true" ';
end if;
return (l_url);
exception
when others then
rollback;
wf_core.context('Wf_Lov', 'GenerateLovURL',
p_form_name ,
p_query_plsql ,
p_query_params ,
p_column_names ,
p_longlist );
wf_lov.Error;
END GenerateLovURL;
procedure CreateButton (when_pressed_url in varchar2,
onmouseover in varchar2,
icon_top in varchar2,
icon_name in varchar2,
show_text in varchar2) is
begin
htp.p('
');
exception
when others then
rollback;
wf_core.context('Wf_Lov', 'create_reg_button',when_pressed_url,onmouseover,
icon_top,icon_name,show_text);
wf_lov.Error;
end CreateButton;
procedure LovApplet(doc_name varchar2,
column_names varchar2,
query_params varchar2,
query_plsql varchar2,
callback varchar2 ,
callback_params varchar2 ,
longlist varchar2,
initial_find varchar2 ,
width varchar2,
height varchar2,
window_title varchar2 ) IS
username varchar2(320); -- Username to query
lang_codeset varchar2(50);
col_num varchar2(20);
l_document_position number := 0;
i number;
l_url varchar2(1000);
l_media varchar2(240) := wfa_html.image_loc;
l_icon varchar2(30);
l_text varchar2(30) := '';
l_onmouseover varchar2(240);
l_params varchar2(240) := callback_params;
l_window_name varchar2(240);
name varchar2(1000);
buffer varchar2(1000);
col_names varchar2(1000) := column_names;
callback_str varchar2(2000) := callback;
begin
-- Check session and current user
wfa_sec.GetSession(username);
lang_codeset := substr(userenv('LANGUAGE'),
instr(userenv('LANGUAGE'),'.')+1,
length(userenv('LANGUAGE')));
l_document_position := INSTR(UPPER(doc_name), '.DOCUMENT');
/*
** Strip off the document object information from the document hierarchy
** so we can run javascript functions on the window and/or frame
*/
l_window_name := SUBSTR(doc_name, 1, l_document_position-1);
htp.htmlOpen;
htp.headOpen;
IF (window_title IS NOT NULL) THEN
htp.title(window_title);
ELSE
htp.title(wf_core.translate('WFPREF_LOV'));
END IF;
htp.p('');
htp.p('');
htp.p('');
htp.p('');
htp.p('');
htp.p('');
htp.p('');
htp.headclose;
if doc_name <> 'PRELOAD' then -- added to prevent js errors on lov preload
htp.p('');
else
htp.p('');
end if;
htp.p('');
htp.p('');
htp.htmlclose;
exception
when others then
rollback;
wf_core.context('Wf_Pref', 'lang_lov_applet');
wf_lov.error;
end LovApplet;
procedure display_lov
(
p_lov_name in varchar2 ,
p_display_name in varchar2 ,
p_validation_callback in varchar2 ,
p_dest_hidden_field in varchar2 ,
p_dest_display_field in varchar2 ,
p_current_value in varchar2 ,
p_param1 in varchar2 ,
p_param2 in varchar2 ,
p_param3 in varchar2 ,
p_param4 in varchar2 ,
p_param5 in varchar2 ,
p_display_key in varchar2
) IS
username varchar2(320);
l_display_name varchar2(360);
l_dummy boolean;
BEGIN
WFA_SEC.GetSession(username);
/* Check the display_key. If 'Y' then translate p_display_name and store
* in l_display_name
*/
if (p_display_key='Y') then
l_display_name := wf_core.translate(p_display_name);
end if;
-- Check to verify each parameters
l_dummy := wf_core.CheckIllegalChars(l_display_name,true);
l_dummy := wf_core.CheckIllegalChars(p_display_name,true);
l_dummy := wf_core.CheckIllegalChars(p_lov_name,true);
l_dummy := wf_core.CheckIllegalChars(p_validation_callback,true);
l_dummy := wf_core.CheckIllegalChars(p_dest_hidden_field,true);
l_dummy := wf_core.CheckIllegalChars(p_dest_display_field,true);
l_dummy := wf_core.CheckIllegalChars(p_current_value,true);
l_dummy := wf_core.CheckIllegalChars(p_display_key,true);
l_dummy := wf_core.CheckIllegalChars(p_param1,true);
l_dummy := wf_core.CheckIllegalChars(p_param2,true);
l_dummy := wf_core.CheckIllegalChars(p_param3,true);
l_dummy := wf_core.CheckIllegalChars(p_param4,true);
l_dummy := wf_core.CheckIllegalChars(p_param5,true);
/*
** Set the title for the window
**
** Check to see if the key is passed, if yes then display the variable
** storing the translated value.
*/
if (p_display_key='Y') then
htp.title(l_display_name);
/*
** Now create the summary/detail frameset
*/
htp.p ('