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
| wfprfb.pls
| DESCRIPTION
| PL/SQL body for package: WF_PREF
|
| MODIFICATION LOG:
| 01/2002 JWSMITH BUG 2001012 - Increased username, admin_role, l_username,
| to varchar2(320), display_name to 360
*=======================================================================*/
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_PREF as
/* $Header: wfprfb.pls 26.35 2005/03/11 06:21:27 anachatt ship $ */
--
-- Package Globals
--
--
-- 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);
begin
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);
-- Bug 4215720
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;
/*===========================================================================
Function get_open_lov_window_html
Purpose Get the javascript function to open a lov window based on
a url and a window size.
============================================================================*/
PROCEDURE get_open_lov_window_html IS
BEGIN
htp.p('');
htp.p('');
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('wf_pref',
'get_open_lov_window_html');
RAISE;
END get_open_lov_window_html;
-- Javascript function to validate new passwords
-- Bug# 2127392
PROCEDURE validate_password IS
BEGIN
htp.p('');
htp.p('');
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('wf_pref',
'validate_password');
RAISE;
END validate_password;
procedure create_reg_button (
when_pressed_url IN VARCHAR2,
onmouseover IN VARCHAR2,
icon_top IN VARCHAR2,
icon_name IN VARCHAR2,
show_text IN VARCHAR2)
IS
onmouseover_text varchar2(240) := null;
BEGIN
wfa_html.create_reg_button (when_pressed_url, onmouseover, icon_top, icon_name, show_text);
exception
when others then
rollback;
wf_core.context('Wf_Pref', 'create_reg_button',when_pressed_url,onmouseover,
icon_top,icon_name,show_text);
wf_pref.Error;
end create_reg_button;
--
-- Edit
-- Edit user preferences
--
procedure edit (edit_defaults in varchar2)
is
username varchar2(320); -- Username to query
realname varchar2(360); -- Display name of username
admin_role varchar2(320); -- Role for admin mode
admin_mode varchar2(1); -- Does user have admin privledges
s0 varchar2(2000);
language varchar2(30); -- Language preference
territory varchar2(30); -- Territory preference
mail_type varchar2(30); -- Email preference
text_signon varchar2(10); -- Text only signon
install_type varchar2(30); -- Embedded install vs standalone
date_format varchar2(40); -- date format preference
dm_node_id number; -- Document Management Home preference
dm_node_name varchar2(240);
l_checked varchar2(1);
l_media varchar2(240) := wfa_html.image_loc;
l_icon varchar2(30) := 'FNDILOV.gif';
l_message varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate ('WFPREF_LOV'));
l_text varchar2(30) := '';
l_onmouseover varchar2(240);
l_url varchar2(1000);
l_error_msg varchar2(2000) := null;
web_agent varchar2(2000); -- Web agent
/*
** Bug 2307342
classid varchar2(2000); -- Jinitiator Class id
plugin_loc varchar2(2000); -- Java Plugin (Jinitiator) Download Location
plugin_ver varchar2(2000); -- Java Plugin Version
*/
l_sguid raw(16); -- Local System GUID
l_sname varchar2(30); -- Local System Name
l_sdname varchar2(80); -- Local System Display Name
l_sstatus varchar2(240); -- Local System Status
l_ldap_host varchar2(240); -- LDAP host name
l_ldap_port varchar2(240); -- LDAP port number
l_ldap_user varchar2(240); -- LDAP username
l_ldap_pwd varchar2(240); -- LDAP password
l_ldap_log_base varchar2(240); -- LDAP directory containing change logs
l_ldap_user_base varchar2(240); -- LDAP directory containing user records
begin
-- Check session and current user
wfa_sec.GetSession(username);
username := upper(username);
wf_directory.GetRoleInfo(username, realname, s0, s0, s0, s0);
IF (edit_defaults = 'Y') THEN
admin_mode := 'N';
admin_role := wf_core.translate('WF_ADMIN_ROLE');
if (admin_role = '*' or
Wf_Directory.IsPerformer(username, admin_role)) then
admin_mode := 'Y';
username := '-WF_DEFAULT-';
else
-- cannot edit defaults unless you're the administrator
l_error_msg := wf_core.translate('WFPREF_INVALID_ADMIN');
end if;
-- get the default web agent
web_agent := wf_core.translate ('WF_WEB_AGENT');
/*
** Bug 2307342
** Jinitiator related info will no longer be
** displayed on the Global Preferences page
--get the Java Plugin (Jinitiator) related info
classid := wf_core.translate ('WF_CLASSID');
plugin_loc := wf_core.translate ('WF_PLUGIN_DOWNLOAD');
plugin_ver := wf_core.translate ('WF_PLUGIN_VERSION');
*/
-- get the local system info
--l_sguid := Wf_Setup.GetLocalSystemGUID;
if wf_core.translate('WF_SYSTEM_GUID') <> '[WF_SYSTEM_GUID]' then
l_sguid := hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
begin
select NAME
into l_sname
from WF_SYSTEMS
where GUID = l_sguid;
l_sdname := l_sname;
exception
when NO_DATA_FOUND then
wf_core.token('GUID', rawtohex(l_sguid));
l_sdname := wf_core.translate('WFE_SYSTEM_NOGUID');
end;
end if;
-- find out the system status
l_sstatus := substr(wf_core.translate('WF_SYSTEM_STATUS'), 1, 8);
if (l_sstatus = 'LOCAL') then
l_sstatus := wf_core.translate('LOCAL_ONLY');
elsif (l_sstatus = 'EXTERNAL') then
l_sstatus := wf_core.translate('EXTERNAL_ONLY');
else
l_sstatus := wf_core.translate(l_sstatus);
end if;
END IF;
-- Get the language preference
language := wf_pref.get_pref (username, 'LANGUAGE');
-- Get the terriory preference
territory := wf_pref.get_pref (username, 'TERRITORY');
-- get the mail preference
mail_type := wf_pref.get_pref (username, 'MAILTYPE');
-- get the text mail only preference
text_signon := wf_pref.get_pref (username, 'WF_SIG_TEXT_ONLY');
-- get the date format preference
date_format := wf_pref.get_pref (username, 'DATEFORMAT');
-- get the installation type (Embedded vs Standalone)
install_type := wf_core.translate ('WF_INSTALL');
-- get the document management home node information
fnd_document_management.get_dm_home (username, dm_node_id, dm_node_name);
-- get the LDAP related information
l_ldap_host := fnd_preference.get('#INTERNAL', 'LDAP_SYNCH', 'HOST');
l_ldap_port := fnd_preference.get('#INTERNAL', 'LDAP_SYNCH', 'PORT');
l_ldap_user := fnd_preference.get('#INTERNAL', 'LDAP_SYNCH', 'USERNAME');
-- Bug 2127392
-- commented password retrieval to avoid display in web page
-- l_ldap_pwd := fnd_preference.eget('#INTERNAL','LDAP_SYNCH', 'EPWD',
-- 'LDAP_PWD');
-- Bug3471734: Added token to translate the text "Not Shown"
-- l_ldap_pwd := 'Not Shown';
l_ldap_pwd := wf_core.translate('WFPREF_NOT_SHOWN');
l_ldap_log_base := fnd_preference.get('#INTERNAL','LDAP_SYNCH',
'CHANGELOG_DIR');
l_ldap_user_base := fnd_preference.get('#INTERNAL','LDAP_SYNCH','USER_DIR');
-- Set page title
htp.htmlOpen;
htp.headOpen;
if (edit_defaults = 'Y') THEN
htp.title(wf_core.translate('WFPREF_EDIT_DEF_PREFS_TITLE')|| ' - '||realname);
wfa_html.create_help_function('wf/links/gpr.htm?GPREF');
else
htp.title(wf_core.translate('WFPREF_EDIT_PREFS_TITLE')|| ' - '||realname);
wfa_html.create_help_function('wf/links/upr.htm?UPREF');
end if;
htp.headClose;
-- Page header
if (edit_defaults = 'Y') THEN
wfa_sec.Header(FALSE, '', wf_core.translate('WFPREF_EDIT_DEF_PREFS_TITLE'), TRUE);
else
wfa_sec.Header(FALSE, '', wf_core.translate('WFPREF_EDIT_PREFS_TITLE'), TRUE);
end if;
IF (l_error_msg IS NOT NULL) THEN
htp.center(htf.bold(l_error_msg));
return;
END IF;
htp.tableopen(calign=>'CENTER', cattributes=>'summary=""');
-- If you can edit the defaults then allow them to set the admin user
-- and the Web Agent
if (edit_defaults = 'Y') THEN
-- admin role title
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WF_ADMIN'),
calign=>'right',
cattributes=>'valign=middle');
if (admin_role <> '*') then
wf_directory.GetRoleInfo(admin_role, realname, s0, s0, s0, s0);
else
realname := '*';
end if;
htp.tabledata(''||realname||'');
htp.tableRowClose;
-- web agent
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFA_WEB_AGENT_DESC'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||web_agent||'');
htp.tableRowClose;
/*
** Bug 2307342
** JInitiator Info will no longer be displayed on the
** Global Preferences page
--jinitiator
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFA_CLASSID_DESC'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||classid||'');
htp.tableRowClose;
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFA_PLUGIN_DOWNLOAD_DESC'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||plugin_loc||'');
htp.tableRowClose;
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFA_PLUGIN_VERSION_DESC'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||plugin_ver||'');
htp.tableRowClose;
*/
htp.tableRowClose;
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('LOCAL_SYSTEM'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||l_sdname||'');
htp.tableRowClose;
htp.tableRowClose;
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('SYSTEM_STATUS'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||l_sstatus||'');
htp.tableRowClose;
htp.tableRowClose;
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFPREF_LDAP_HOST_PROMPT'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||l_ldap_host||'');
htp.tableRowClose;
htp.tableRowClose;
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFPREF_LDAP_PORT_PROMPT'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||l_ldap_port||'');
htp.tableRowClose;
htp.tableRowClose;
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFPREF_LDAP_USER_PROMPT'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||l_ldap_user||'');
htp.tableRowClose;
htp.tableRowClose;
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFPREF_LDAP_PASSWORD_PROMPT'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||l_ldap_pwd||'');
htp.tableRowClose;
htp.tableRowClose;
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate(
'WFPREF_LDAP_CHNGLOGDIR_PROMPT'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||l_ldap_log_base||'');
htp.tableRowClose;
htp.tableRowClose;
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFPREF_LDAP_USERDIR_PROMPT'),
calign=>'right',
cattributes=>'valign=middle');
htp.tableData(''||l_ldap_user_base||'');
htp.tableRowClose;
end if;
-- Only show language/territory/date format if this is standalone install
IF (install_type = 'STANDALONE') THEN
-- Language
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFPREF_LANGUAGE_PROMPT'),
calign=>'right');
htp.tableData(''||language||'');
htp.tableRowClose;
-- Territory
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFPREF_TERRITORY_PROMPT'),
calign=>'right');
htp.tableData(''||territory||'');
htp.tableRowClose;
-- Date Format
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFPREF_DATE_FORMAT'),
calign=>'right');
htp.tableData(''||date_format||'');
htp.tableRowClose;
END IF;
-- Document Management Home Node
htp.tableRowOpen;
htp.tableData(cvalue=>wf_core.translate('WFPREF_DMHOME_PROMPT'),
calign=>'right');
htp.tableData(''||dm_node_name||'');
htp.tableRowClose;
htp.tablerowopen;
htp.tableData(cvalue=>wf_core.translate('WFPREF_SENDEMAIL_PROMPT'),
calign=>'RIGHT');
-- Mail Type field
IF (mail_type = 'MAILHTML') THEN
htp.tableData(''||wf_core.translate('WFPREF_SENDHTML_PROMPT')||'');
ELSIF (mail_type = 'MAILTEXT') THEN
htp.tableData(''||wf_core.translate('WFPREF_SENDPLAIN_PROMPT')||'');
ELSIF (mail_type = 'MAILATTH') THEN
htp.tableData(''||wf_core.translate('WFPREF_SENDATTACH_PROMPT')||'');
ELSIF (mail_type = 'MAILTEXT') THEN
htp.tableData(''||wf_core.translate('WFPREF_SENDPLAIN_PROMPT')||'');
ELSIF (mail_type = 'SUMMARY') THEN
htp.tableData(''||wf_core.translate('WFPREF_SENDSUMMARY_PROMPT')||'');
ELSIF (mail_type = 'SUMHTML') THEN
htp.tableData(''||wf_core.translate('WFPREF_SENDSUMHTML_PROMPT')||'');
ELSIF (mail_type = 'QUERY' or mail_type IS NULL) THEN
htp.tableData(''||wf_core.translate('WFPREF_QUERYONLY_PROMPT')||'');
ELSIF (mail_type = 'MAILHTM2' or mail_type IS NULL) THEN
htp.tableData(''||wf_core.translate('WFPREF_SENDHTM2_PROMPT')||'');
ELSIF (mail_type = 'DISABLED' or mail_type IS NULL) THEN
htp.tableData(''||wf_core.translate('WFPREF_DISABLED_PROMPT')||'');
END IF;
htp.tablerowclose;
if (install_type = 'STANDALONE' and edit_defaults = 'Y') then
htp.tablerowopen;
htp.tableData(cvalue=>wf_core.translate('WFPREF_TEXT_SIGNON'),
calign=>'RIGHT');
IF (text_signon = 'Y') THEN
htp.tableData(''||wf_core.translate('YES')||'');
ELSE
htp.tableData(''||wf_core.translate('NO')||'');
END IF;
htp.tablerowclose;
end if;
htp.tableclose;
htp.br;
htp.tableopen(calign=>'CENTER');
--Submit Button
htp.tableRowOpen;
l_url := owa_util.get_owa_service_path||
'wf_pref.edit_form?edit_defaults='||edit_defaults;
l_icon := 'FNDJLFOK.gif';
l_text := wf_core.translate ('UPDATE');
l_onmouseover := wf_core.translate ('UPDATE');
htp.p('