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
| AFWFDMGB.pls
| DESCRIPTION
| PL/SQL body for package: FND_DOCUMENT_MANAGEMENT
| MODIFICATION LOG:
| 01/2002 JWSMITH BUG 2001012 - increase username,email,admin_role,
| l_username to varchar2(320), increase realname to 360
*=======================================================================*/
SET VERIFY OFF
WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
WHENEVER OSERROR EXIT FAILURE ROLLBACK;
set escape '*'
set escape '\'
set array 1
set scan off
CREATE OR REPLACE PACKAGE BODY fnd_document_management AS
/* $Header: AFWFDMGB.pls 26.7 2002/11/11 03:04:22 rosthoma ship $ */
/*
** We need need to fetch URL prefix from WF_WEB_AGENT in wf_resources
** since this function gets called from the forms environment
** which doesn't know anything about the cgi variables.
*/
dm_base_url varchar2(240) := wf_core.translate('WF_WEB_AGENT');
--
-- 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);
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 get_product_parameter_list
Purpose Retrieves the parameters for a specific implementation for
a function and product
============================================================================*/
PROCEDURE get_product_parameter_list
(product_function_id IN NUMBER,
parameter_list OUT fnd_document_management.fnd_dm_product_parms_tbl_type
)
IS
/*
** c_fetch_function_parameters fetches the parameters for a specific
** implementation of a function by a DM vendor
*/
CURSOR c_fetch_function_parameters
(c_product_function_id IN Number) IS
SELECT dmparm.parameter_name,
dmprod.parameter_syntax
FROM fnd_dm_function_parameters dmparm,
fnd_dm_product_parm_syntax dmprod
WHERE dmprod.product_function_id = c_product_function_id
AND dmprod.parameter_id = dmparm.parameter_id
ORDER BY dmparm.parameter_name;
l_record_num NUMBER := 0;
BEGIN
/*
** Fetch the parameters for the display function for the vendor
** that is installed on the selected node
*/
OPEN c_fetch_function_parameters(product_function_id);
/*
** Loop through all the parameters for the given function
** building the l_parameter_list variable
*/
LOOP
l_record_num := l_record_num + 1;
FETCH c_fetch_function_parameters INTO
parameter_list(l_record_num);
EXIT WHEN c_fetch_function_parameters%NOTFOUND;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_product_parameter_list',
to_char(product_function_id));
RAISE;
END get_product_parameter_list;
/*===========================================================================
Procedure get_function_definition
Purpose Retrieves the node and function definition for a give node
function and vendor who is servicing that node.
============================================================================*/
PROCEDURE get_function_definition
(p_node_id IN NUMBER,
p_function_name IN VARCHAR2,
p_node_syntax OUT VARCHAR2,
p_product_id OUT NUMBER,
p_function_syntax OUT VARCHAR2,
p_product_function_id OUT NUMBER,
p_icon_name OUT VARCHAR2)
IS
BEGIN
/*
** See if you can find the name in the document management reference system
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a display function for the vendor
** that is servicing this particular node.
*/
BEGIN
SELECT dmnode.connect_syntax,
dmnode.product_id,
dmprod.function_syntax,
dmprod.product_function_id,
dmfunc.icon_name
INTO p_node_syntax,
p_product_id,
p_function_syntax,
p_product_function_id,
p_icon_name
FROM fnd_dm_product_function_syntax dmprod,
fnd_dm_functions dmfunc,
fnd_dm_nodes dmnode
WHERE dmnode.node_id = p_node_id
AND dmnode.product_id = dmprod.product_id
AND dmfunc.function_name = p_function_name
AND dmprod.function_id = dmfunc.function_id;
/*
** No data found is an exceptable response for this query. It means that
** the fetch function is not supported by the particular dm vendor
** software. I can't imagine what vendor would not support a fetch
** function but who knows. Set the display_document_URL to null in
** this case.
*/
EXCEPTION
WHEN no_data_found THEN
p_node_syntax := NULL;
p_product_id := 0;
p_function_syntax := NULL;
p_product_function_id := 0;
p_icon_name := NULL;
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_function_defintion',
to_char(p_node_id),
p_function_name);
RAISE;
END;
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_function_defintion',
to_char(p_node_id),
p_function_name);
RAISE;
END get_function_definition;
/*===========================================================================
Procedure create_html_syntax
Purpose Create the proper syntax for displaying the function
and the associate icon with proper HTML syntax.
============================================================================*/
PROCEDURE create_html_syntax
(p_html_formatting IN BOOLEAN,
p_function_name IN VARCHAR2,
p_node_connect_syntax IN VARCHAR2,
p_function_syntax IN VARCHAR2,
p_parameter_syntax IN VARCHAR2,
p_resource_name IN VARCHAR2,
p_icon_name IN VARCHAR2,
p_document_html OUT VARCHAR2)
IS
BEGIN
/*
** Check if the caller wishes to construct html syntax that includes
** the appropriate icon and tranlated function name for this URL.
*/
IF (p_html_formatting = TRUE AND p_function_syntax IS NOT NULL) THEN
/*
** Populate the display_document_URL with the full HTML syntax to
** draw and icon and a function name for the display function.
** Also get the translated string for the function display name
*/
if (p_function_name IN ('get_search_document_url',
'get_create_document_url',
'get_browse_document_url')) THEN
p_document_html :=
''||
''||
p_resource_name ||
' ';
else
p_document_html :=
''||
''||
p_resource_name ||
' ';
end if;
ELSIF (p_function_syntax IS NOT NULL) THEN
/*
** Populate the display_document_URL with just the sting for the URL
** and leave the formatting up to the caller.
*/
p_document_html :=
p_node_connect_syntax||p_function_syntax||p_parameter_syntax;
ELSE
p_document_html := null;
END IF;
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'create_html_syntax',
p_function_name,
p_node_connect_syntax,
p_function_syntax,
p_parameter_syntax,
p_resource_name);
RAISE;
END create_html_syntax;
/*===========================================================================
Function get_launch_document_url
Purpose Set up the anchor to launch a new window with a frameset
with two frames. The upper frame has all the controls.
The lower frame displays the document.
============================================================================*/
PROCEDURE get_launch_document_url
(username IN Varchar2,
document_identifier IN Varchar2,
display_icon IN Boolean,
launch_document_URL OUT Varchar2) IS
l_product_id Number := 0;
l_dm_node_id Number := 0;
l_document_id Varchar2(30) := NULL;
l_version Varchar2(10) := NULL;
l_document_name Varchar2(240) := NULL;
l_username Varchar2(320); -- Username to query /*Bug2001012*/
l_document_url Varchar2(4000) := NULL;
l_document_attributes fnd_document_management.fnd_document_attributes;
BEGIN
l_username := upper(username);
/*
** get all the components of the document attribute
*/
fnd_document_management.ParseDocInfo(document_identifier,
l_dm_node_id,
l_document_id,
l_version);
/*
** get the product that is installed for that dm node
*/
SELECT MAX(PRODUCT_ID)
INTO l_product_id
FROM fnd_dm_nodes
WHERE node_id = l_dm_node_id;
/*
** get all the components of the document anchor
*/
IF (display_icon = FALSE) THEN
/*
** If the product id = 1 then this is an Internet Documents install
** We do not display the multiframe window in this case with the
** control bar on top. Internet documents has their own toolbar and
** has their own mechanism for controlling the DM options.
*/
IF (l_product_id = 1) THEN
/*
** Get the HTML text for displaying the document
*/
fnd_document_management.get_display_document_url (
l_username,
document_identifier,
FALSE,
FALSE,
l_document_url);
launch_document_URL := l_document_url;
ELSE
launch_document_URL := dm_base_url||
'/fnd_document_management.create_display_document_url?'||
'document_identifier='||
wfa_html.conv_special_url_chars(document_identifier)||
'&username='||l_username;
END IF;
ELSE
/*
** get the document name
*/
fnd_document_management.get_document_attributes(l_username,
document_identifier,
l_document_attributes);
l_document_name := l_document_attributes.document_name;
/*
** If the product id = 1 then this is an Internet Documents install
** We do not display the multiframe window in this case with the
** control bar on top. Internet documents has their own toolbar and
** has their own mechanism for controlling the DM options.
*/
IF (l_product_id = 1) THEN
/*
** Get the HTML text for displaying the document
*/
fnd_document_management.get_display_document_url (
l_username,
document_identifier,
FALSE,
FALSE,
l_document_url);
launch_document_URL :=
''||
l_document_name||
' ';
ELSE
launch_document_URL :=
''||
l_document_name||
' ';
END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_launch_document_url',
document_identifier);
RAISE;
END get_launch_document_url;
/*===========================================================================
Function create_display_document_url
Purpose Launches the toolbar in one frame for the document
operations and then creates another frame to display
the document.
============================================================================*/
PROCEDURE create_display_document_url
(username IN Varchar2,
document_identifier IN Varchar2) IS
l_dm_node_id Number := 0;
l_document_id Varchar2(30) := NULL;
l_version Varchar2(10) := NULL;
l_document_url Varchar2(2000) := NULL;
BEGIN
/*
** Create the top header frameset and the bottom summary/detail frameset
*/
htp.p ('
');
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'create_display_document_url',
document_identifier);
RAISE;
END create_display_document_url;
/*===========================================================================
Function get_search_document_url
Purpose Bring up a search window to allow the user to find a
document in their document management system. The function
does not take a document system argument because you'll
be first asked to choose which document management
system to search before given the actual search criteria.
The challenge here is to return the DM system id, the
document id, and the document name for the document that
you've selected during your search process. We'll likely
need our DM software partners to add new arguments to their
standard URL syntax to allow for extra url links/icons that
refer to Oracle Application functions that will allow us to
return the selected documents that you wish to attach to your
application business objects. The extra arguments would be
pushed into the standard HTML templates so you can execute
these functions when you've selected the appropriate document.
============================================================================*/
PROCEDURE get_search_document_url
(username IN Varchar2,
callback_function IN Varchar2,
html_formatting IN Boolean,
search_document_URL OUT Varchar2) IS
l_product_id Number := 0;
l_product_function_id Number := 0;
l_record_num Number := 0;
l_node_connect_syntax Varchar2(240) := '';
l_parameter_str Varchar2(4000) := '';
l_function_syntax Varchar2(4000) := '';
l_icon_name Varchar2(40) := '';
l_parameter_list fnd_document_management.fnd_dm_product_parms_tbl_type;
l_username Varchar2(320); -- Username to query
l_dm_node_id Number; -- Document Management Home preference
l_dm_node_name Varchar2(240);
BEGIN
l_username := upper(username);
-- get the document management home node information
fnd_document_management.get_dm_home (l_username, l_dm_node_id, l_dm_node_name);
/*
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a search function for the vendor
** that is servicing this particular node.
*/
get_function_definition (l_dm_node_id,
'get_search_document_url',
l_node_connect_syntax,
l_product_id,
l_function_syntax,
l_product_function_id,
l_icon_name);
/*
** Go get the parameters for this function for the specific
** vendor software that is servicing this particular node
*/
IF (l_function_syntax IS NOT NULL) THEN
/*
** Get the parameters for the search function
*/
get_product_parameter_list (l_product_function_id,
l_parameter_list);
/*
** Loop through the parameter list filling in the corresponding
** values
*/
FOR l_record_num IN 1..l_parameter_list.count LOOP
/*
** Determine which argument separator to add
*/
IF (INSTR(l_parameter_str, '?') > 0 OR
INSTR(l_function_syntax, '?') > 0) THEN
l_parameter_str := l_parameter_str || '&';
ELSE
l_parameter_str := l_parameter_str || '?';
END IF;
IF (l_parameter_list(l_record_num).parameter_name = 'CALLBACK') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
callback_function;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'USERNAME') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
username;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'TICKET') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
fnd_document_management.get_ticket(username);
END IF;
END LOOP;
END IF;
/*
** Create the proper html syntax for the document function
*/
create_html_syntax (html_formatting,
'get_search_document_url',
l_node_connect_syntax,
l_function_syntax,
l_parameter_str,
'WFDM_SEARCH',
l_icon_name,
search_document_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_search_document_url');
RAISE;
END get_search_document_url;
/*===========================================================================
Function get_create_document_url
Purpose Create a new document in your Document Management System
for a local file stored on your file system.
The challenge here is to return the DM system name and the
document id/name for the document that you've just added to
the DM system. If your in the attachments form and you've
attached a file, you may wish to add that file to a DM
system by clicking on the Create New link. Once you provide
all the meta data for that document in the DM system we'll
need to push the document information back to the creating
application object. We'll likely need our DM software
partners to add new arguments to their standard URL
syntax to allow for extra url links/icons that refer to
Oracle Application functions that will allow us to return
the selected document id information once you've created
your document. The extra arguments would be pushed into
the standard HTML templates so you can execute these
functions when you've selected the created the document.
============================================================================*/
PROCEDURE get_create_document_url
(username IN Varchar2,
callback_function IN Varchar2,
html_formatting IN Boolean,
create_document_URL OUT Varchar2) IS
l_product_id Number := 0;
l_product_function_id Number := 0;
l_record_num Number := 0;
l_node_connect_syntax Varchar2(240) := '';
l_parameter_str Varchar2(4000) := '';
l_function_syntax Varchar2(4000) := '';
l_icon_name Varchar2(40) := '';
l_parameter_list fnd_document_management.fnd_dm_product_parms_tbl_type;
l_username Varchar2(320); -- Username to query
l_dm_node_id Number; -- Document Management Home preference
l_dm_node_name Varchar2(240);
l_browser varchar2(400);
l_callback_function Varchar2(4000);
BEGIN
/*
** The forms attachments interface calls this same function to
** get the proper url to attach a document to a business object.
** Since the forms launch process is not within a browser the
** owa_util variables will not be available when this string
** gets created. We check here whether your calling this from
** a web interface or a forms interface.
*/
IF (html_formatting = TRUE) THEN
l_browser := owa_util.get_cgi_env('HTTP_USER_AGENT');
ELSE
l_browser := 'NETSCAPE';
END IF;
l_username := upper(username);
-- get the document management home node information
fnd_document_management.get_dm_home (l_username, l_dm_node_id, l_dm_node_name);
/*
** This is a total hack but it must be done for now for simplicity of
** the interface. Netscape has another layer of objects that must
** be referenced when calling it through javascript. Thus if you
** are not using IE then add another opener.parent to the hierarchy.
** We have two different calls because it depends if you are calling
** this from the multiframe response window or from a single frame window.
*/
IF (instr(owa_util.get_cgi_env('HTTP_USER_AGENT'), 'MSIE') = 0) THEN
l_callback_function := REPLACE(callback_function,
'opener.parent.bottom.document',
'opener.parent.opener.parent.bottom.document');
l_callback_function := REPLACE(l_callback_function,
'top.opener.parent.document',
'top.parent.opener.parent.opener.document');
ELSE
l_callback_function := callback_function;
END IF;
/*
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a create function for the vendor
** that is servicing this particular node.
*/
get_function_definition (l_dm_node_id,
'get_create_document_url',
l_node_connect_syntax,
l_product_id,
l_function_syntax,
l_product_function_id,
l_icon_name);
/*
** Go get the parameters for this function for the specific
** vendor software that is servicing this particular node
*/
IF (l_function_syntax IS NOT NULL) THEN
/*
** Get the parameters for the create function
*/
get_product_parameter_list (l_product_function_id,
l_parameter_list);
/*
** Loop through the parameter list filling in the corresponding
** values
*/
/*
** Loop through the parameter list filling in the corresponding
** values
*/
FOR l_record_num IN 1..l_parameter_list.count LOOP
/*
** Determine which argument separator to add
*/
IF (INSTR(l_parameter_str, '?') > 0 OR
INSTR(l_function_syntax, '?') > 0) THEN
l_parameter_str := l_parameter_str || '&';
ELSE
l_parameter_str := l_parameter_str || '?';
END IF;
IF (l_parameter_list(l_record_num).parameter_name = 'CALLBACK') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_callback_function;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'USERNAME') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
username;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'TICKET') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
fnd_document_management.get_ticket(username);
END IF;
END LOOP;
END IF;
/*
** Create the proper html syntax for the document function
*/
create_html_syntax (html_formatting,
'get_create_document_url',
l_node_connect_syntax,
l_function_syntax,
l_parameter_str,
'WFDM_CREATE',
l_icon_name,
create_document_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_create_document_url',
callback_function);
RAISE;
END get_create_document_url;
/*===========================================================================
Function get_browse_document_url
Purpose Browse through a folder hierarchy and choose the document
you wish to attach then return that document to the calling
application.
The challenge here is to return the DM system name and the
document id/name for the document that you've selected in
the DM system. If your in the attachments form and you've
attached a file, you may wish to select a file using the
browse feature. Once you select a document in the DM
system we'll need to push the document information
back to the creating application object. We'll likely
need our DM software
partners to add new arguments to their standard URL
syntax to allow for extra url links/icons that refer to
Oracle Application functions that will allow us to return
the selected document id information once you've created
your document. The extra arguments would be pushed into
the standard HTML templates so you can execute these
functions when you've selected the created the document.
============================================================================*/
PROCEDURE get_browse_document_url
(username IN Varchar2,
callback_function IN Varchar2,
html_formatting IN Boolean,
browse_document_URL OUT Varchar2) IS
l_product_id Number := 0;
l_product_function_id Number := 0;
l_record_num Number := 0;
l_node_connect_syntax Varchar2(240) := '';
l_parameter_str Varchar2(4000) := '';
l_function_syntax Varchar2(4000) := '';
l_icon_name Varchar2(40) := '';
l_parameter_list fnd_document_management.fnd_dm_product_parms_tbl_type;
l_username Varchar2(320); -- Username to query
l_dm_node_id Number; -- Document Management Home preference
l_dm_node_name Varchar2(240);
BEGIN
l_username := upper(username);
-- get the document management home node information
fnd_document_management.get_dm_home (l_username, l_dm_node_id, l_dm_node_name);
/*
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a create function for the vendor
** that is servicing this particular node.
*/
get_function_definition (l_dm_node_id,
'get_browse_document_url',
l_node_connect_syntax,
l_product_id,
l_function_syntax,
l_product_function_id,
l_icon_name);
/*
** Go get the parameters for this function for the specific
** vendor software that is servicing this particular node
*/
IF (l_function_syntax IS NOT NULL) THEN
/*
** Get the parameters for the create function
*/
get_product_parameter_list (l_product_function_id,
l_parameter_list);
/*
** Loop through the parameter list filling in the corresponding
** values
*/
/*
** Loop through the parameter list filling in the corresponding
** values
*/
FOR l_record_num IN 1..l_parameter_list.count LOOP
/*
** Determine which argument separator to add
*/
IF (INSTR(l_parameter_str, '?') > 0 OR
INSTR(l_function_syntax, '?') > 0) THEN
l_parameter_str := l_parameter_str || '&';
ELSE
l_parameter_str := l_parameter_str || '?';
END IF;
IF (l_parameter_list(l_record_num).parameter_name = 'CALLBACK') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
callback_function;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'USERNAME') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
username;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'TICKET') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
fnd_document_management.get_ticket(username);
END IF;
END LOOP;
END IF;
/*
** Create the proper html syntax for the document function
*/
create_html_syntax (html_formatting,
'get_browse_document_url',
l_node_connect_syntax,
l_function_syntax,
l_parameter_str,
'WFDM_BROWSE',
l_icon_name,
browse_document_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_browse_document_url',
callback_function);
RAISE;
END get_browse_document_url;
/*===========================================================================
Function get_display_document_url
Purpose Invoke the appropriate document viewer for the selected
document. This function will show the latest document version
for the item selected. Most document management systems
support a wide range of document formats for viewing.
We will rely on the document management system to
display the document in it's native format whenever possible.
============================================================================*/
PROCEDURE get_display_document_url
(username IN Varchar2,
document_identifier IN Varchar2,
show_document_icon IN Boolean,
html_formatting IN Boolean,
display_document_URL OUT Varchar2) IS
l_dm_node_id Number := 0;
l_document_id Varchar2(30) := NULL;
l_version Varchar2(10) := NULL;
l_document_name Varchar2(240) := NULL;
l_product_id Number := 0;
l_product_function_id Number := 0;
l_record_num Number := 0;
l_node_connect_syntax Varchar2(240) := NULL;
l_parameter_str Varchar2(4000) := NULL;
l_function_syntax Varchar2(4000) := NULL;
l_icon_name Varchar2(40) := NULL;
l_parameter_list fnd_document_management.fnd_dm_product_parms_tbl_type;
l_document_attributes fnd_document_management.fnd_document_attributes;
l_username VARCHAR2(320) := NULL;
BEGIN
l_username := upper(username);
/*
** get all the components of the document attribute
*/
fnd_document_management.ParseDocInfo(document_identifier,
l_dm_node_id,
l_document_id,
l_version);
/*
** If you're calling this with full html formatting to include the
** document title in the link then go get the document title from
** the dm system. This is a very expensive operation and is not
** recommended
*/
IF (html_formatting = TRUE) THEN
/*
** get the document name
*/
fnd_document_management.get_document_attributes(l_username,
document_identifier,
l_document_attributes);
l_document_name := l_document_attributes.document_name;
ELSE
l_document_name := NULL;
END IF;
/*
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a display function for the vendor
** that is servicing this particular node.
*/
get_function_definition (l_dm_node_id,
'get_display_document_url',
l_node_connect_syntax,
l_product_id,
l_function_syntax,
l_product_function_id,
l_icon_name);
/*
** Go get the parameters for this function for the specific
** vendor software that is servicing this particular node
*/
IF (l_function_syntax IS NOT NULL) THEN
/*
** Get the parameters for the search function
*/
get_product_parameter_list (l_product_function_id,
l_parameter_list);
/*
** Loop through the parameter list filling in the corresponding
** values
*/
FOR l_record_num IN 1..l_parameter_list.count LOOP
/*
** Determine which argument separator to add
*/
IF (INSTR(l_parameter_str, '?') > 0 OR
INSTR(l_function_syntax, '?') > 0) THEN
l_parameter_str := l_parameter_str || '&';
ELSE
l_parameter_str := l_parameter_str || '?';
END IF;
IF (l_parameter_list(l_record_num).parameter_name = 'DOCUMENT_ID') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_document_id;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'USERNAME') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_username;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'TICKET') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
fnd_document_management.get_ticket(l_username);
END IF;
END LOOP;
END IF;
/*
** Create the proper html syntax for the document function
*/
create_html_syntax (html_formatting,
'get_display_document_url',
l_node_connect_syntax,
l_function_syntax,
l_parameter_str,
l_document_name,
l_icon_name,
display_document_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_display_document_url',
document_identifier);
RAISE;
END get_display_document_url;
/*===========================================================================
Function get_original_document_url
Purpose Invoke the appropriate document viewer for the original version
of the selected document. The default operation of the DM
system is to show the latest version of the document that
was attached to the item.
We are providing another function here to show the original
version of the document.
Most document management systems
support a wide range of document formats for viewing.
We will rely on the document management system to
display the document in it's native format whenever possible.
============================================================================*/
PROCEDURE get_original_document_url
(username IN Varchar2,
document_identifier IN Varchar2,
show_document_icon IN Boolean,
html_formatting IN Boolean,
original_document_URL OUT Varchar2) IS
l_dm_node_id Number := 0;
l_document_id Varchar2(30) := NULL;
l_version Varchar2(10) := NULL;
l_document_name Varchar2(240) := NULL;
l_product_id Number := 0;
l_product_function_id Number := 0;
l_record_num Number := 0;
l_node_connect_syntax Varchar2(240) := NULL;
l_parameter_str Varchar2(4000) := NULL;
l_function_syntax Varchar2(4000) := NULL;
l_icon_name Varchar2(40) := NULL;
l_parameter_list fnd_document_management.fnd_dm_product_parms_tbl_type;
l_document_attributes fnd_document_management.fnd_document_attributes;
l_username VARCHAR2(320) := NULL;
BEGIN
l_username := upper(username);
/*
** get all the components of the document attribute
*/
fnd_document_management.ParseDocInfo(document_identifier,
l_dm_node_id,
l_document_id,
l_version);
/*
** If you're calling this with full html formatting to include the
** document title in the link then go get the document title from
** the dm system. This is a very expensive operation and is not
** recommended
*/
IF (html_formatting = TRUE) THEN
/*
** get the document name
*/
fnd_document_management.get_document_attributes(l_username,
document_identifier,
l_document_attributes);
l_document_name := l_document_attributes.document_name;
ELSE
l_document_name := NULL;
END IF;
/*
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a display function for the vendor
** that is servicing this particular node.
*/
get_function_definition (l_dm_node_id,
'get_display_document_url',
l_node_connect_syntax,
l_product_id,
l_function_syntax,
l_product_function_id,
l_icon_name);
/*
** Go get the parameters for this function for the specific
** vendor software that is servicing this particular node
*/
IF (l_function_syntax IS NOT NULL) THEN
/*
** Get the parameters for the search function
*/
get_product_parameter_list (l_product_function_id,
l_parameter_list);
/*
** Loop through the parameter list filling in the corresponding
** values
*/
FOR l_record_num IN 1..l_parameter_list.count LOOP
/*
** Determine which argument separator to add
*/
IF (INSTR(l_parameter_str, '?') > 0 OR
INSTR(l_function_syntax, '?') > 0) THEN
l_parameter_str := l_parameter_str || '&';
ELSE
l_parameter_str := l_parameter_str || '?';
END IF;
/*
** The only difference in the syntax from the
** get_display_document_url is to drop the version parameter
*/
IF (l_parameter_list(l_record_num).parameter_name = 'DOCUMENT_ID') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_document_id;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'VERSION') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_version;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'USERNAME') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_username;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'TICKET') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
fnd_document_management.get_ticket(l_username);
END IF;
END LOOP;
END IF;
/*
** Create the proper html syntax for the document function
*/
create_html_syntax (html_formatting,
'get_display_document_url',
l_node_connect_syntax,
l_function_syntax,
l_parameter_str,
l_document_name,
l_icon_name,
original_document_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_original_document_url',
document_identifier);
RAISE;
END get_original_document_url;
/*===========================================================================
Function get_fetch_document_url
Purpose Fetch a copy of a document from a document management system
and place it on the local system. Always fetch the latest
version of the document
============================================================================*/
PROCEDURE get_fetch_document_url
(username IN Varchar2,
document_identifier IN Varchar2,
html_formatting IN Boolean,
fetch_document_URL OUT Varchar2) IS
l_dm_node_id Number := 0;
l_document_id Varchar2(30) := NULL;
l_version Varchar2(10) := NULL;
l_product_id Number := 0;
l_product_function_id Number := 0;
l_record_num Number := 0;
l_node_connect_syntax Varchar2(240) := '';
l_parameter_str Varchar2(4000) := '';
l_function_syntax Varchar2(4000) := '';
l_icon_name Varchar2(40) := '';
l_parameter_list fnd_document_management.fnd_dm_product_parms_tbl_type;
l_username Varchar2(320) := NULL;
BEGIN
l_username := upper(username);
/*
** get all the components of the document attribute
*/
fnd_document_management.ParseDocInfo(document_identifier,
l_dm_node_id,
l_document_id,
l_version);
/*
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a fetch function for the vendor
** that is servicing this particular node.
*/
get_function_definition (l_dm_node_id,
'get_fetch_document_url',
l_node_connect_syntax,
l_product_id,
l_function_syntax,
l_product_function_id,
l_icon_name);
/*
** Go get the parameters for this function for the specific
** vendor software that is servicing this particular node
*/
IF (l_function_syntax IS NOT NULL) THEN
/*
** Get the parameters for the search function
*/
get_product_parameter_list (l_product_function_id,
l_parameter_list);
/*
** Loop through the parameter list filling in the corresponding
** values
*/
FOR l_record_num IN 1..l_parameter_list.count LOOP
/*
** Determine which argument separator to add
*/
IF (INSTR(l_parameter_str, '?') > 0 OR
INSTR(l_function_syntax, '?') > 0) THEN
l_parameter_str := l_parameter_str || '&';
ELSE
l_parameter_str := l_parameter_str || '?';
END IF;
IF (l_parameter_list(l_record_num).parameter_name = 'DOCUMENT_ID') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_document_id;
/* Always fetch the latest version rather than the original version
ELSIF (l_parameter_list(l_record_num).parameter_name = 'VERSION') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_version;
*/
ELSIF (l_parameter_list(l_record_num).parameter_name = 'USERNAME') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_username;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'TICKET') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
fnd_document_management.get_ticket(l_username);
END IF;
END LOOP;
END IF;
/*
** Create the proper html syntax for the document function
*/
create_html_syntax (html_formatting,
'get_fetch_document_url',
l_node_connect_syntax,
l_function_syntax,
l_parameter_str,
'WFDM_FETCH',
l_icon_name,
fetch_document_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_fetch_document_url',
document_identifier);
RAISE;
END get_fetch_document_url;
/*===========================================================================
Function get_check_out_document_url
Purpose Lock the document in the DM system so that no other user can
check in a new revision of the document while you
hold the lock. This function will also allow you to create
a local copy of the document on your file system.
============================================================================*/
PROCEDURE get_check_out_document_url
(username IN Varchar2,
document_identifier IN Varchar2,
html_formatting IN Boolean,
check_out_document_URL OUT Varchar2) IS
l_dm_node_id Number := 0;
l_document_id Varchar2(30) := NULL;
l_version Varchar2(10) := NULL;
l_product_id Number := 0;
l_product_function_id Number := 0;
l_record_num Number := 0;
l_node_connect_syntax Varchar2(240) := '';
l_display_document_url Varchar2(2000) := '';
l_function_syntax Varchar2(4000) := '';
l_parameter_str Varchar2(4000) := '';
l_icon_name Varchar2(40) := '';
l_parameter_list fnd_document_management.fnd_dm_product_parms_tbl_type;
l_username Varchar2(320):= NULL;
BEGIN
l_username := upper(username);
/*
** get all the components of the document attribute
*/
fnd_document_management.ParseDocInfo(document_identifier,
l_dm_node_id,
l_document_id,
l_version);
/*
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a check out function for the
** vendor that is servicing this particular node.
*/
get_function_definition (l_dm_node_id,
'get_check_out_document_url',
l_node_connect_syntax,
l_product_id,
l_function_syntax,
l_product_function_id,
l_icon_name);
/*
** Go get the parameters for this function for the specific
** vendor software that is servicing this particular node
*/
IF (l_function_syntax IS NOT NULL) THEN
/*
** Get the parameters for the search function
*/
get_product_parameter_list (l_product_function_id,
l_parameter_list);
/*
** Loop through the parameter list filling in the corresponding
** values
*/
FOR l_record_num IN 1..l_parameter_list.count LOOP
/*
** Determine which argument separator to add
*/
IF (INSTR(l_parameter_str, '?') > 0 OR
INSTR(l_function_syntax, '?') > 0) THEN
l_parameter_str := l_parameter_str || '&';
ELSE
l_parameter_str := l_parameter_str || '?';
END IF;
IF (l_parameter_list(l_record_num).parameter_name = 'DOCUMENT_ID') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_document_id;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'CALLBACK') THEN
fnd_document_management.get_display_document_url (
l_username,
document_identifier,
FALSE,
FALSE,
l_display_document_url);
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
wfa_html.conv_special_url_chars(l_display_document_url);
ELSIF (l_parameter_list(l_record_num).parameter_name = 'USERNAME') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_username;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'TICKET') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
fnd_document_management.get_ticket(l_username);
END IF;
END LOOP;
END IF;
/*
** Create the proper html syntax for the document function
*/
create_html_syntax (html_formatting,
'get_check_out_document_url',
l_node_connect_syntax,
l_function_syntax,
l_parameter_str,
'WFDM_CHECK_OUT',
l_icon_name,
check_out_document_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_check_out_document_url',
document_identifier);
RAISE;
END get_check_out_document_url;
/*===========================================================================
Function get_check_in_document_url
Purpose Copy a new version of a file from your local file system
back into the document management system. UnLock the
document in the DM system so that other users can work
on the document.
============================================================================*/
PROCEDURE get_check_in_document_url
(username IN Varchar2,
document_identifier IN Varchar2,
html_formatting IN Boolean,
check_in_document_URL OUT Varchar2) IS
l_dm_node_id Number := 0;
l_document_id Varchar2(30) := NULL;
l_version Varchar2(10) := NULL;
l_product_id Number := 0;
l_product_function_id Number := 0;
l_record_num Number := 0;
l_node_connect_syntax Varchar2(240) := '';
l_display_document_url Varchar2(2000) := '';
l_function_syntax Varchar2(4000) := '';
l_parameter_str Varchar2(4000) := '';
l_icon_name Varchar2(40) := '';
l_parameter_list fnd_document_management.fnd_dm_product_parms_tbl_type;
l_username Varchar2(320) := NULL;
BEGIN
l_username := upper(username);
/*
** get all the components of the document attribute
*/
fnd_document_management.ParseDocInfo(document_identifier,
l_dm_node_id,
l_document_id,
l_version);
/*
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a check in function for the vendor
** that is servicing this particular node.
*/
get_function_definition (l_dm_node_id,
'get_check_in_document_url',
l_node_connect_syntax,
l_product_id,
l_function_syntax,
l_product_function_id,
l_icon_name);
/*
** Go get the parameters for this function for the specific
** vendor software that is servicing this particular node
*/
IF (l_function_syntax IS NOT NULL) THEN
/*
** Get the parameters for the search function
*/
get_product_parameter_list (l_product_function_id,
l_parameter_list);
/*
** Loop through the parameter list filling in the corresponding
** values
*/
FOR l_record_num IN 1..l_parameter_list.count LOOP
/*
** Determine which argument separator to add
*/
IF (INSTR(l_parameter_str, '?') > 0 OR
INSTR(l_function_syntax, '?') > 0) THEN
l_parameter_str := l_parameter_str || '&';
ELSE
l_parameter_str := l_parameter_str || '?';
END IF;
IF (l_parameter_list(l_record_num).parameter_name = 'DOCUMENT_ID') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_document_id;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'CALLBACK') THEN
fnd_document_management.get_display_document_url (
l_username,
document_identifier,
FALSE,
FALSE,
l_display_document_url);
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
wfa_html.conv_special_url_chars(l_display_document_url);
ELSIF (l_parameter_list(l_record_num).parameter_name = 'USERNAME') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_username;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'TICKET') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
fnd_document_management.get_ticket(l_username);
END IF;
END LOOP;
END IF;
/*
** Create the proper html syntax for the document function
*/
create_html_syntax (html_formatting,
'get_check_in_document_url',
l_node_connect_syntax,
l_function_syntax,
l_parameter_str,
'WFDM_CHECK_IN',
l_icon_name,
check_in_document_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_check_in_document_url',
document_identifier);
RAISE;
END get_check_in_document_url;
/*===========================================================================
Function get_lock_document_url
Purpose Lock the document in the DM system so that no other
user can check in a new revision of the document while
you hold the lock.
============================================================================*/
PROCEDURE get_lock_document_url
(username IN Varchar2,
document_identifier IN Varchar2,
html_formatting IN Boolean,
lock_document_URL OUT Varchar2) IS
l_dm_node_id Number := 0;
l_document_id Varchar2(30) := NULL;
l_version Varchar2(10) := NULL;
l_product_id Number := 0;
l_product_function_id Number := 0;
l_record_num Number := 0;
l_node_connect_syntax Varchar2(240) := '';
l_display_document_url Varchar2(2000) := '';
l_function_syntax Varchar2(4000) := '';
l_parameter_str Varchar2(4000) := '';
l_icon_name Varchar2(40) := '';
l_parameter_list fnd_document_management.fnd_dm_product_parms_tbl_type;
l_username Varchar2(320) := NULL;
BEGIN
l_username := upper(username);
/*
** get all the components of the document attribute
*/
fnd_document_management.ParseDocInfo(document_identifier,
l_dm_node_id,
l_document_id,
l_version);
/*
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a lock function for the vendor
** that is servicing this particular node.
*/
get_function_definition (l_dm_node_id,
'get_lock_document_url',
l_node_connect_syntax,
l_product_id,
l_function_syntax,
l_product_function_id,
l_icon_name);
/*
** Go get the parameters for this function for the specific
** vendor software that is servicing this particular node
*/
IF (l_function_syntax IS NOT NULL) THEN
/*
** Get the parameters for the search function
*/
get_product_parameter_list (l_product_function_id,
l_parameter_list);
/*
** Loop through the parameter list filling in the corresponding
** values
*/
FOR l_record_num IN 1..l_parameter_list.count LOOP
/*
** Determine which argument separator to add
*/
IF (INSTR(l_parameter_str, '?') > 0 OR
INSTR(l_function_syntax, '?') > 0) THEN
l_parameter_str := l_parameter_str || '&';
ELSE
l_parameter_str := l_parameter_str || '?';
END IF;
IF (l_parameter_list(l_record_num).parameter_name = 'DOCUMENT_ID') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_document_id;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'CALLBACK') THEN
fnd_document_management.get_display_document_url (
l_username,
document_identifier,
FALSE,
FALSE,
l_display_document_url);
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
wfa_html.conv_special_url_chars(l_display_document_url);
ELSIF (l_parameter_list(l_record_num).parameter_name = 'USERNAME') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_username;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'TICKET') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
fnd_document_management.get_ticket(l_username);
END IF;
END LOOP;
END IF;
/*
** Create the proper html syntax for the document function
*/
create_html_syntax (html_formatting,
'get_lock_document_url',
l_node_connect_syntax,
l_function_syntax,
l_parameter_str,
'WFDM_LOCK',
l_icon_name,
lock_document_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_lock_document_url',
document_identifier);
RAISE;
END get_lock_document_url;
/*===========================================================================
Function get_unlock_document_url
Purpose Unlock the document in the DM system without checking
in a new version of the document so that other users
can check in new revisions of the document.
============================================================================*/
PROCEDURE get_unlock_document_url
(username IN Varchar2,
document_identifier IN Varchar2,
html_formatting IN Boolean,
unlock_document_URL OUT Varchar2) IS
l_dm_node_id Number := 0;
l_document_id Varchar2(30) := NULL;
l_version Varchar2(10) := NULL;
l_product_id Number := 0;
l_product_function_id Number := 0;
l_record_num Number := 0;
l_node_connect_syntax Varchar2(240) := '';
l_display_document_url Varchar2(2000) := '';
l_function_syntax Varchar2(4000) := '';
l_parameter_str Varchar2(4000) := '';
l_icon_name Varchar2(40) := '';
l_parameter_list fnd_document_management.fnd_dm_product_parms_tbl_type;
l_username Varchar2(320):= NULL;
BEGIN
l_username := upper(username);
/*
** get all the components of the document attribute
*/
fnd_document_management.ParseDocInfo(document_identifier,
l_dm_node_id,
l_document_id,
l_version);
/*
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a unlock function for the vendor
** that is servicing this particular node.
*/
get_function_definition (l_dm_node_id,
'get_unlock_document_url',
l_node_connect_syntax,
l_product_id,
l_function_syntax,
l_product_function_id,
l_icon_name);
/*
** Go get the parameters for this function for the specific
** vendor software that is servicing this particular node
*/
IF (l_function_syntax IS NOT NULL) THEN
/*
** Get the parameters for the search function
*/
get_product_parameter_list (l_product_function_id,
l_parameter_list);
/*
** Loop through the parameter list filling in the corresponding
** values
*/
FOR l_record_num IN 1..l_parameter_list.count LOOP
/*
** Determine which argument separator to add
*/
IF (INSTR(l_parameter_str, '?') > 0 OR
INSTR(l_function_syntax, '?') > 0) THEN
l_parameter_str := l_parameter_str || '&';
ELSE
l_parameter_str := l_parameter_str || '?';
END IF;
IF (l_parameter_list(l_record_num).parameter_name = 'DOCUMENT_ID') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_document_id;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'CALLBACK') THEN
fnd_document_management.get_display_document_url (
l_username,
document_identifier,
FALSE,
FALSE,
l_display_document_url);
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
wfa_html.conv_special_url_chars(l_display_document_url);
ELSIF (l_parameter_list(l_record_num).parameter_name = 'USERNAME') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_username;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'TICKET') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
fnd_document_management.get_ticket(l_username);
END IF;
END LOOP;
END IF;
/*
** Create the proper html syntax for the document function
*/
create_html_syntax (html_formatting,
'get_unlock_document_url',
l_node_connect_syntax,
l_function_syntax,
l_parameter_str,
'WFDM_UNLOCK',
l_icon_name,
unlock_document_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_unlock_document_url',
document_identifier);
RAISE;
END get_unlock_document_url;
/*===========================================================================
Function get_display_history_url
Purpose Display the file history for the document in the Document
Management System. Display the document title, type, size,
whether the document is locked and if so by who, who has
edited the document and when, etc.
============================================================================*/
PROCEDURE get_display_history_url
(username IN Varchar2,
document_identifier IN Varchar2,
html_formatting IN Boolean,
display_history_URL OUT Varchar2) IS
l_dm_node_id Number := 0;
l_document_id Varchar2(30) := NULL;
l_version Varchar2(10) := NULL;
l_product_id Number := 0;
l_product_function_id Number := 0;
l_record_num Number := 0;
l_node_connect_syntax Varchar2(240) := '';
l_display_document_url Varchar2(2000) := '';
l_function_syntax Varchar2(4000) := '';
l_parameter_str Varchar2(4000) := '';
l_icon_name Varchar2(40) := '';
l_parameter_list fnd_document_management.fnd_dm_product_parms_tbl_type;
l_username Varchar2(320):= NULL;
BEGIN
l_username := upper(username);
/*
** get all the components of the document attribute
*/
fnd_document_management.ParseDocInfo(document_identifier,
l_dm_node_id,
l_document_id,
l_version);
/*
** Get the URL prefix for the route to the DM host and the product id
** Also get the appropriate syntax for a display function for the vendor
** that is servicing this particular node.
*/
get_function_definition (l_dm_node_id,
'get_display_history_url',
l_node_connect_syntax,
l_product_id,
l_function_syntax,
l_product_function_id,
l_icon_name);
/*
** Go get the parameters for this function for the specific
** vendor software that is servicing this particular node
*/
IF (l_function_syntax IS NOT NULL) THEN
/*
** Get the parameters for the search function
*/
get_product_parameter_list (l_product_function_id,
l_parameter_list);
/*
** Loop through the parameter list filling in the corresponding
** values
*/
FOR l_record_num IN 1..l_parameter_list.count LOOP
/*
** Determine which argument separator to add
*/
IF (INSTR(l_parameter_str, '?') > 0 OR
INSTR(l_function_syntax, '?') > 0) THEN
l_parameter_str := l_parameter_str || '&';
ELSE
l_parameter_str := l_parameter_str || '?';
END IF;
IF (l_parameter_list(l_record_num).parameter_name = 'DOCUMENT_ID') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_document_id;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'CALLBACK') THEN
fnd_document_management.get_display_document_url (
l_username,
document_identifier,
FALSE,
FALSE,
l_display_document_url);
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
wfa_html.conv_special_url_chars(l_display_document_url);
ELSIF (l_parameter_list(l_record_num).parameter_name = 'USERNAME') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
l_username;
ELSIF (l_parameter_list(l_record_num).parameter_name = 'TICKET') THEN
l_parameter_str := l_parameter_str ||
l_parameter_list(l_record_num).parameter_syntax ||
fnd_document_management.get_ticket(l_username);
END IF;
END LOOP;
END IF;
/*
** Create the proper html syntax for the document function
*/
create_html_syntax (html_formatting,
'get_display_history_url',
l_node_connect_syntax,
l_function_syntax,
l_parameter_str,
'WFDM_DISPLAY_HISTORY',
l_icon_name,
display_history_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_display_history_url',
document_identifier);
RAISE;
END get_display_history_url;
/*===========================================================================
Function get_open_dm_display_window
Purpose Get the javascript function to open a dm window based on
a url and a window size. This java script function will
be used by all the DM display functions to open the
appropriate DM window. This function also gives the
current window a name so that the dm window can call
back to the javascript functions in the current window.
============================================================================*/
PROCEDURE get_open_dm_display_window IS
BEGIN
htp.p('');
htp.p('');
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_open_dm_display_window');
RAISE;
END get_open_dm_display_window;
/*===========================================================================
Function get_open_dm_attach_window
Purpose Get the javascript function to open a dm window based on
a url and a window size. This java script function will
be used by all the DM functions to open the appropriate DM
window when attaching a new document to a business object.
This function also gives the current window
a name so that the dm window can call back to the javascript
functions in the current window.
============================================================================*/
PROCEDURE get_open_dm_attach_window IS
BEGIN
htp.p('');
htp.p('');
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_open_dm_attach_window');
RAISE;
END get_open_dm_attach_window;
/*===========================================================================
Function set_document_id_html
Purpose Get the javascript function to set the appropriate
destination field on your html form from the document
management select function.
============================================================================*/
PROCEDURE set_document_id_html
(
frame_name IN VARCHAR2,
form_name IN VARCHAR2,
document_id_field_name IN VARCHAR2,
document_name_field_name IN VARCHAR2,
callback_url OUT VARCHAR2
) IS
l_attributes VARCHAR2(1000) := NULL;
l_callback_url VARCHAR2(5000) := NULL;
l_browser varchar2(400) := owa_util.get_cgi_env('HTTP_USER_AGENT');
BEGIN
l_attributes := '"location=no,resizable=no,scrollbars=no,toolbar=no,menubar=no,'||
'width=300,height=100"';
IF (frame_name is not null) THEN
l_callback_url := '"'||dm_base_url||
'/fnd_document_management.set_document_form_fields'||
'?document_identifier='||
'DM:-NodeId-:-ObjectId-:-Version-'||
'^document_name=-ObjectName-'||
'^document_name_field=top.opener.parent.'||frame_name||
'.document.'||
form_name||'.'||document_name_field_name||'.value'||
'^document_id_field=top.opener.parent.'||frame_name||
'.document.'||
form_name||'.'||document_id_field_name||'.value" TARGET="FNDDMCopywindow"';
ELSE
l_callback_url := '"'||dm_base_url||
'/fnd_document_management.set_document_form_fields'||
'?document_identifier='||
'DM:-NodeId-:-ObjectId-:-Version-'||
'^document_name=-ObjectName-'||
'^document_name_field=top.opener.parent.document.'||
form_name||'.'||document_name_field_name||'.value'||
'^document_id_field=top.opener.parent.document.'||
form_name||'.'||document_id_field_name||'.value" TARGET="FNDDMCopywindow"';
END IF;
callback_url := wfa_html.conv_special_url_chars(l_callback_url);
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'set_document_id_html',
form_name,
document_id_field_name,
document_name_field_name);
RAISE;
END set_document_id_html;
--
-- PackDocInfo
-- Pack together the document components out of a document type
-- attribute.
--
-- dm_node_id - Id for of the dm system where the document is
-- maintained
--
-- document_id - Identifier for the document for the particular dm node
--
-- version - Version of Document that was selected
--
-- document_info - Concatenated string of characters that includes the
-- nodeid, document id, version, and
-- document name in the following format:
--
-- nodeid:documentid:version
--
--
procedure PackDocInfo(dm_node_id in number,
document_id in varchar2,
version in varchar2,
document_info out varchar2) IS
BEGIN
document_info := 'DM:'||
TO_CHAR(dm_node_id) || ':' ||
document_id || ':' ||
version;
END PackDocInfo;
--
-- ParseDocInfo
-- Parse out the document components out of a document type
-- attribute.
--
-- document_info - Concatenated string of characters that includes the
-- nodeid, document id, version, and
-- document name in the following format:
--
-- nodeid:document id:version
--
-- dm_node_id - Id for of the dm system where the document is
-- maintained
--
-- document_id - Identifier for the document for the particular dm node
--
-- version - Version of Document that was selected
--
--
procedure ParseDocInfo(document_info in varchar2,
dm_node_id out number,
document_id out varchar2,
version out varchar2)
is
colon pls_integer;
doc_str varchar2(2000);
begin
-- Parse DM: from document information
doc_str := substrb(document_info, 4);
-- Parse dm_node_id from document information
colon := instr(doc_str, ':');
if ((colon <> 0) and (colon < 80)) then
dm_node_id := to_number(substrb(doc_str, 1, colon-1));
-- get the document id and name off the rest of the string
doc_str := substrb(doc_str, colon+1);
end if;
-- Parse document_id from document information
colon := instr(doc_str, ':');
if ((colon <> 0) and (colon < 80)) then
document_id := substrb(doc_str, 1, colon-1);
-- get the document id and name off the rest of the string
doc_str := substrb(doc_str, colon+1);
end if;
-- Parse document id from document information
colon := instr(doc_str, ':');
version := substrb(doc_str, colon+1);
exception
when others then
raise;
end ParseDocInfo;
/*===========================================================================
Function create_document_toolbar
Purpose create the toolbar for checking in/checking out etc.
documents based on the document identifier
============================================================================*/
PROCEDURE create_document_toolbar
(
username IN VARCHAR2,
document_identifier IN VARCHAR2) IS
l_dm_node_id Number := 0;
l_document_id Varchar2(30) := NULL;
l_version Varchar2(10) := NULL;
l_username Varchar2(320) := NULL;
l_document_name Varchar2(240) := NULL;
c_title Varchar2(240) := NULL;
l_toolbar_color Varchar2(10) := '#0000cc';
l_url_syntax Varchar2(2000) := NULL;
l_document_attributes fnd_document_management.fnd_document_attributes;
BEGIN
l_username := upper(username);
/*
** get all the components of the document attribute
*/
fnd_document_management.ParseDocInfo(document_identifier,
l_dm_node_id,
l_document_id,
l_version);
/*
** get the document name
*/
fnd_document_management.get_document_attributes(l_username,
document_identifier,
l_document_attributes);
l_document_name := SUBSTR (l_document_attributes.document_name, 1, 25);
/*
** Create main table for toolbar and icon
*/
htp.p('
summary=""');
htp.p('
');
/*
** Put some space on the side
*/
htp.p('
');
htp.p('
');
/*
** inner table to define toolbar
*/
htp.p('
');
/*
** Left rounded icon for toolbar
*/
htp.p('
');
/*
** White line on top of toolbar
*/
htp.p('
');
/*
** Right rounded icon for toolbar
*/
htp.p('
');
/*
** End the table row for the icons that surround the real toolbar
*/
htp.p('');
/*
** Start the table for the real controls
*/
htp.p('
');
/*
** Create the page title.
*/
htp.p('
');
htp.p(' '||l_document_name||' ');
htp.p('
');
/*
** Create the dividing line
*/
htp.p('
');
htp.p('');
/*
** Create the display document icon control
*/
fnd_document_management.get_display_document_url (
l_username,
document_identifier,
FALSE,
FALSE,
l_url_syntax);
htp.p(''||
'');
/*
** Create the display latest version document icon control
*/
fnd_document_management.get_original_document_url (
l_username,
document_identifier,
FALSE,
FALSE,
l_url_syntax);
htp.p(''||
'');
/*
** Create the fetch document icon control
*/
fnd_document_management.get_fetch_document_url (
l_username,
document_identifier,
FALSE,
l_url_syntax);
htp.p(''||
'');
/*
** Create a dividing line
*/
htp.p('');
/*
** Create the check out icon control
*/
fnd_document_management.get_check_out_document_url (
l_username,
document_identifier,
FALSE,
l_url_syntax);
htp.p(''||
'');
/*
** Create the check in icon control
*/
fnd_document_management.get_check_in_document_url (
l_username,
document_identifier,
FALSE,
l_url_syntax);
htp.p(''||
'');
/*
** Create the unlock icon control
*/
fnd_document_management.get_unlock_document_url (
l_username,
document_identifier,
FALSE,
l_url_syntax);
htp.p(''||
'');
/*
** Create a dividing line
*/
htp.p('');
/*
** Create the show history icon
*/
fnd_document_management.get_display_history_url (
l_username,
document_identifier,
FALSE,
l_url_syntax);
htp.p(''||
'');
htp.p('');
/*
** Create the help icon
*/
htp.p('
');
htp.p('
');
/*
** Create the black border under the toolbar and close the icon table
*/
htp.p('
');
htp.p('
');
/*
** Close the toolbar table data
*/
htp.p('
');
/*
** Create the logo and close the toolbar and logo table
*/
htp.p('
');
exception
when others then
wf_core.context('fnd_document_management',
'create_document_toolbar',
document_identifier);
raise;
end create_document_toolbar;
/*===========================================================================
Function get_launch_attach_url
Purpose Set up the anchor to launch a new window with a frameset
with two frames. The upper frame has all the controls.
The lower frame displays the document.
============================================================================*/
PROCEDURE get_launch_attach_url
(username IN Varchar2,
callback_function IN Varchar2,
display_icon IN Boolean,
launch_attach_URL OUT Varchar2) IS
l_product_id NUMBER;
l_dm_node_id NUMBER;
l_username Varchar2(320); -- Username to query
l_dm_node_name Varchar2(240);
l_attach_url VARCHAR2(4000);
l_browser varchar2(400);
l_callback_function VARCHAR2(4000);
BEGIN
/*
** The forms attachments interface calls this same function to
** get the proper url to attach a document to a business object.
** Since the forms launch process is not within a browser the
** owa_util variables will not be available when this string
** gets created. We check here whether your calling this from
** a web interface (the display_icon parameter should be changed
** to html_interface) or a forms interface.
*/
IF (display_icon = TRUE) THEN
l_browser := owa_util.get_cgi_env('HTTP_USER_AGENT');
ELSE
l_browser := 'NETSCAPE';
END IF;
/*
** Get the home node id for this user. If that home is an Internet
** Documents home based on
** the product id = 1 then this is an Internet Documents install
** We do not display the multiframe window in this case with the
** control bar on top. Internet documents has their own toolbar and
** has their own mechanism for controlling the DM options.
*/
l_username := upper(username);
-- get the document management home node information
fnd_document_management.get_dm_home (l_username, l_dm_node_id, l_dm_node_name);
/*
** get the product that is installed for that dm node
*/
SELECT MAX(PRODUCT_ID)
INTO l_product_id
FROM fnd_dm_nodes
WHERE node_id = l_dm_node_id;
/*
** get all the components of the document anchor
*/
IF (display_icon = FALSE) THEN
/*
** If the product id = 1 then this is an Internet Documents install
** We do not display the multiframe window in this case with the
** control bar on top. Internet documents has their own toolbar and
** has their own mechanism for controlling the DM options.
*/
IF (l_product_id = 1) THEN
/*
** Get the HTML text for displaying the document
*/
fnd_document_management.get_search_document_url (
username,
callback_function,
FALSE,
l_attach_URL);
/*
** Replace the NodeId token with the current dm home node id for
** this user
*/
launch_attach_URL := REPLACE(l_attach_URL, '-NodeId-',
TO_CHAR(l_dm_node_id));
ELSE
launch_attach_URL :=
dm_base_url||
'/fnd_document_management.create_attach_document_url?'||
'username='||username||
'&callback_function='||
callback_function;
END IF;
ELSE
/*
** If the product id = 1 then this is an Internet Documents install
** We do not display the multiframe window in this case with the
** control bar on top. Internet documents has their own toolbar and
** has their own mechanism for controlling the DM options.
*/
IF (l_product_id = 1) THEN
/*
** This is a total hack but it must be done for now for simplicity of
** the interface. The response notification frame is called bottom.
** This does not exist in the javascript object hierarchy when
** executing an onload event when creating a new document in the
** DM system using Netscape. So we must check for this very
** special case and
** remove bottom from the hierarchy. This could be an issue for
** any UI that uses our attach interface when the field is in a frame.
** This same REPLACE function is in the get_search_document_url but
** since we always start at the search screen with Inter Docs we
** need the same replacement here.
*/
IF (instr(l_browser, 'MSIE') = 0) then
l_callback_function := REPLACE(callback_function,
'opener.bottom.document',
'opener.document');
ELSE
l_callback_function := callback_function;
END IF;
/*
** Get the HTML text for displaying the document
*/
fnd_document_management.get_search_document_url (
username,
l_callback_function,
FALSE,
l_attach_URL);
/*
** Replace the NodeId token with the current dm home node id for
** this user
*/
l_attach_URL := REPLACE(l_attach_URL, '-NodeId-',
TO_CHAR(l_dm_node_id));
/*
** Get the HTML text for displaying the document
*/
launch_attach_URL :=
''||
''||
'';
ELSE
/*
** We need need to fetch URL prefix from WF_WEB_AGENT in wf_resources
** since this function gets called from the forms environment
** which doesn't know anything about the cgi variables.
*/
launch_attach_URL :=
''||
''||
' ';
END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'get_launch_attach_url',
callback_function);
RAISE;
END get_launch_attach_url;
/*===========================================================================
Function create_display_document_url
Purpose Launches the toolbar in one frame for the document
operations and then creates another frame to display
the document.
============================================================================*/
PROCEDURE create_attach_document_url
(username IN Varchar2,
callback_function IN Varchar2) IS
l_username Varchar2 (320);
l_document_url Varchar2 (4000);
l_dm_node_id Number; -- Document Management Home preference
l_dm_node_name Varchar2(240);
l_callback_function Varchar2 (2000);
BEGIN
l_username := upper(username);
-- get the document management home node information
fnd_document_management.get_dm_home (l_username, l_dm_node_id, l_dm_node_name);
-- If no document nodes are available then show an error message
IF (l_dm_node_id IS NULL) THEN
htp.htmlOpen;
htp.headOpen;
htp.title(wf_core.translate('WF_WORKFLOW_TITLE'));
htp.headClose;
htp.p ('');
htp.tableOpen(cattributes=>'summary=""');
htp.tableRowOpen;
htp.tabledata('');
htp.tabledata(''||wf_core.translate('WFDM_NO_NODES')||'');
htp.tableRowClose;
htp.tableClose;
htp.bodyClose;
htp.htmlclose;
return;
END IF;
-- Check to see if the callback function special url characters have been
-- converted. If they have not then convert.
IF (INSTR(callback_function, '%') = 0) THEN
l_callback_function := wfa_html.conv_special_url_chars(callback_function);
ELSE
l_callback_function := callback_function;
END IF;
l_dm_node_name := SUBSTR (l_dm_node_name , 1, 30);
htp.htmlOpen;
htp.headOpen;
htp.title(l_dm_node_name);
htp.headClose;
/*
** Create the top header frameset and the bottom summary/detail frameset
*/
htp.p ('');
EXCEPTION
WHEN OTHERS THEN
Wf_Core.Context('fnd_document_management',
'create_attach_document_url',
callback_function);
RAISE;
END create_attach_document_url;
/*===========================================================================
Function create_attach_toolbar
Purpose create the toolbar for attaching a document to a business
object
============================================================================*/
PROCEDURE create_attach_toolbar
(
username IN VARCHAR2,
callback_function IN VARCHAR2) IS
c_title Varchar2(240) := NULL;
l_toolbar_color Varchar2(10) := '#0000cc';
l_username Varchar2(320); -- Username to query
l_dm_node_id Number; -- Document Management Home preference
l_dm_node_name Varchar2(240);
l_callback_function Varchar2(2000);
l_url_syntax Varchar2(4000) := NULL;
BEGIN
l_username := upper(username);
-- get the document management home node information
fnd_document_management.get_dm_home (l_username, l_dm_node_id, l_dm_node_name);
l_dm_node_name := SUBSTR (l_dm_node_name , 1, 30);
/*
** Create main table for toolbar and icon
*/
htp.p('
');
htp.p('
');
/*
** Put some space on the side
*/
htp.p('
');
htp.p('
');
/*
** inner table to define toolbar
*/
htp.p('
');
/*
** Left rounded icon for toolbar
*/
htp.p('
');
/*
** White line on top of toolbar
*/
htp.p('
');
/*
** Right rounded icon for toolbar
*/
htp.p('
');
/*
** End the table row for the icons that surround the real toolbar
*/
htp.p('');
/*
** Start the table for the real controls
*/
htp.p('
');
htp.p('');
/*
** Update the node id token for the search add and browse icons
** so they point at the current node. You don't want to replace it
** for the change home icon since you want to preserve the NodeId
** token syntax
*/
l_callback_function := REPLACE(callback_function, '-NodeId-',
TO_CHAR(l_dm_node_id));
/*
** Create the search document icon control
*/
fnd_document_management.get_search_document_url (
username,
wfa_html.conv_special_url_chars(l_callback_function),
FALSE,
l_url_syntax);
htp.p(''||
'');
/*
** Create the add document icon control
*/
fnd_document_management.get_create_document_url (
username,
wfa_html.conv_special_url_chars(l_callback_function),
FALSE,
l_url_syntax);
htp.p(''||
'');
/*
** Create the browse icon control
*/
fnd_document_management.get_browse_document_url (
username,
wfa_html.conv_special_url_chars(l_callback_function),
FALSE,
l_url_syntax);
htp.p(''||
'');
htp.p('');
/*
** Create the help icon
*/
htp.p('
');
htp.p('
');
/*
** Create the black border under the toolbar and close the icon table
*/
htp.p('
');
htp.p('
');
/*
** Close the toolbar table data
*/
htp.p('
');
/*
** Create the logo and close the toolbar and logo table
*/
htp.p('
');
exception
when others then
wf_core.context('fnd_document_management',
'create_attach_toolbar',
callback_function);
raise;
end create_attach_toolbar;
/*===========================================================================
Function get_dm_home
Purpose fetch the document management home preference for a given
user. If there is no home defined for a user then go
check the default. If there is no default defined then
get the first dm_node in the list.
============================================================================*/
procedure get_dm_home (
username IN VARCHAR2,
dm_node_id OUT VARCHAR2,
dm_node_name OUT VARCHAR2) IS
l_dm_node_id NUMBER := NULL;
BEGIN
/*
** Check for the user default value
*/
l_dm_node_id := TO_NUMBER(fnd_preference.get (username, 'WF', 'DMHOME'));
/*
** If there was no user default then try to get the system default
*/
IF (l_dm_node_id IS NULL) THEN
l_dm_node_id := TO_NUMBER(fnd_preference.get ('-WF_DEFAULT-', 'WF', 'DMHOME'));
END IF;
/*
** If there was no system default then get the first node in the list
*/
IF (l_dm_node_id IS NULL) THEN
/*
** Make sure to check for no data found in case there are no
** nodes defined.
*/
BEGIN
SELECT MAX(node_id)
INTO l_dm_node_id
FROM fnd_dm_nodes;
EXCEPTION
/*
** If there are no rows defined then set the output variables
** to null
*/
WHEN NO_DATA_FOUND THEN
l_dm_node_id := NULL;
dm_node_id := NULL;
dm_node_name := NULL;
WHEN OTHERS THEN
RAISE;
END;
END IF;
/*
** If you have the node id then populate the node name and node id
** output variables
*/
IF (l_dm_node_id IS NOT NULL) THEN
BEGIN
/*
** Make sure the node hasn't been deleted since the preference
** was created by having a no data found exception handler.
*/
SELECT node_id, node_name
INTO dm_node_id, dm_node_name
FROM fnd_dm_nodes
WHERE node_id = l_dm_node_id;
EXCEPTION
/*
** If there are no rows defined then set the output variables
** to null
*/
WHEN NO_DATA_FOUND THEN
l_dm_node_id := NULL;
dm_node_id := NULL;
dm_node_name := NULL;
WHEN OTHERS THEN
RAISE;
END;
END IF;
exception
when others then
wf_core.context('fnd_document_management',
'get_dm_home',
username);
raise;
end get_dm_home;
/*===========================================================================
Function set_dm_home
Purpose set the document management home preference for a given
user.
============================================================================*/
procedure set_dm_home (
username IN VARCHAR2,
dm_node_id IN VARCHAR2) IS
BEGIN
/*
** Set the user default value
*/
fnd_preference.put (username, 'WF', 'DMHOME', dm_node_id);
exception
when others then
wf_core.context('fnd_document_management',
'set_dm_home',
username,
dm_node_id);
raise;
end set_dm_home;
/*===========================================================================
Function set_dm_home_html
Purpose set the document management home preference for a given
user throught the html interface
============================================================================*/
procedure set_dm_home_html (
dm_node_id IN VARCHAR2,
username IN VARCHAR2,
callback IN VARCHAR2) IS
l_product_id NUMBER;
l_username VARCHAR2(320);
l_attach_URL VARCHAR2(4000);
BEGIN
l_username := upper(username);
/*
** Set the user default value
*/
fnd_document_management.set_dm_home (l_username, dm_node_id);
/*
** get the product that is installed for that dm node
*/
SELECT MAX(PRODUCT_ID)
INTO l_product_id
FROM fnd_dm_nodes
WHERE node_id = TO_NUMBER(dm_node_id);
IF (l_product_id = 1) THEN
/*
** Get the HTML text for displaying the document
*/
fnd_document_management.get_search_document_url (
username,
wfa_html.conv_special_url_chars(callback),
FALSE,
l_attach_URL);
/*
** Replace the NodeId token with the current dm home node id for
** this user
*/
l_attach_URL := REPLACE(l_attach_URL, '-NodeId-',
dm_node_id);
-- use owa_util.redirect_url to redirect the URL to the home page
owa_util.redirect_url(curl=>l_attach_URL, bclose_header=>TRUE);
ELSE
-- use owa_util.redirect_url to redirect the URL to the home page
owa_util.redirect_url(curl=>dm_base_url ||
'/fnd_document_management.create_attach_document_url'||
'?username='||l_username||
'&callback_function='||
wfa_html.conv_special_url_chars(callback),
bclose_header=>TRUE);
END IF;
exception
when others then
wf_core.context('fnd_document_management',
'set_dm_home_html',
dm_node_id, username, callback);
raise;
end set_dm_home_html;
--
-- Dm_Nodes
-- Produce list of dm_nodes
--
procedure Dm_Nodes_Display
is
username varchar2(320); -- Username to query
admin_role varchar2(320); -- Role for admin mode
admin_mode varchar2(1) := 'N';
realname varchar2(360); -- Display name of username
s0 varchar2(2000); -- Dummy
l_error_msg varchar2(240);
l_url varchar2(240);
l_media varchar2(240) := wfa_html.image_loc;
l_icon varchar2(40);
l_text varchar2(240);
l_onmouseover varchar2(240);
cursor nodes_cursor is
select dmn.node_id,
dmn.node_name,
dmn.node_description,
dmn.connect_syntax,
dmn.product_id,
dmp.product_name,
dmp.vendor_name,
dmp.version
from fnd_dm_nodes dmn, fnd_dm_products dmp
where dmn.product_id = dmp.product_id;
rowcount number;
att_tvalue varchar2(2000) default null;
begin
-- Check current user has admin authority
wfa_sec.GetSession(username);
username := upper(username);
wf_directory.GetRoleInfo(username, realname, s0, s0, s0, s0);
admin_role := wf_core.translate('WF_ADMIN_ROLE');
if (admin_role = '*' or
Wf_Directory.IsPerformer(username, admin_role)) then
admin_mode := 'Y';
else
l_error_msg := wf_core.translate('WFPREF_INVALID_ADMIN');
end if;
-- Set page title
htp.htmlOpen;
htp.headOpen;
htp.p('');
htp.title(wf_core.translate('WFDM_NODES_TITLE'));
wfa_html.create_help_function('wf/links/dmr.htm?DMREP');
htp.headClose;
wfa_sec.Header(FALSE, '',wf_core.translate('WFDM_NODES_TITLE'), FALSE);
htp.br;
IF (admin_mode = 'N') THEN
htp.center(htf.bold(l_error_msg));
return;
END IF;
-- Column headers
htp.tableOpen('border=1 cellpadding=3 bgcolor=white width="100%" summary=""');
htp.tableRowOpen(cattributes=>'bgcolor=#006699');
htp.tableHeader(cvalue=>''||
wf_core.translate('NAME')||'',
calign=>'Center', cattributes=>'id="t_name"');
htp.tableHeader(cvalue=>''||
wf_core.translate('DESCRIPTION')||'',
calign=>'Center', cattributes=>'id="t_node_description"');
htp.tableHeader(cvalue=>''
|| wf_core.translate('WFDM_WEB_AGENT')||'',
calign=>'Center', cattributes=>'id="t_connect_syntax"');
htp.tableHeader(cvalue=>''||
wf_core.translate('PRODUCT')||'',
calign=>'Center', cattributes=>'id="t_product_name"');
htp.tableHeader(cvalue=>''||
wf_core.translate('VENDOR')||'',
calign=>'Center', cattributes=>'id="t_vendor_name"');
htp.tableHeader(cvalue=>''||
wf_core.translate('VERSION')||'',
calign=>'Center', cattributes=>'id="t_version"');
htp.tableHeader(cvalue=>''||
wf_core.translate('WFDM_NODE_ID')||'',
calign=>'Center', cattributes=>'id="t_node_id"');
htp.tableHeader(cvalue=>''||
wf_core.translate('DELETE')||'',
calign=>'Center', cattributes=>'id="t_delete"');
htp.tableRowClose;
htp.tableRowOpen;
htp.tableRowClose;
-- Show all nodes
for nodes in nodes_cursor loop
htp.tableRowOpen(null, 'TOP');
htp.tableData(htf.anchor2(
curl=>wfa_html.base_url||
'/fnd_document_management.dm_nodes_edit?p_node_id='||
to_char(nodes.node_id),
ctext=>nodes.node_name, ctarget=>'_top'),
'Left', cattributes=>'headers="t_name"');
htp.tableData(nodes.node_description, 'left',
cattributes=>'headers="t_node_description"');
htp.tableData(nodes.connect_syntax, 'left',
cattributes=>'headers="t_connect_syntax"');
htp.tableData(nodes.product_name, 'left',
cattributes=>'headers="t_product_name"');
htp.tableData(nodes.vendor_name, 'left',
cattributes=>'headers="t_vendor_name"');
htp.tableData(nodes.version, 'left',
cattributes=>'headers="t_version"');
htp.tableData(nodes.node_id, 'left',
cattributes=>'headers="t_node_id"');
htp.tableData(htf.anchor2(curl=>wfa_html.base_url||
'/fnd_document_management.dm_nodes_confirm_delete?p_node_id='||
nodes.node_id,
ctext=>''),
'center', cattributes=>'valign="MIDDLE" headers="t_delete"');
end loop;
htp.tableclose;
htp.br;
htp.tableopen(calign=>'CENTER', cattributes=>'summary=""');
--Add new node Button
htp.tableRowOpen;
l_url := wfa_html.base_url||'/fnd_document_management.dm_nodes_edit';
l_icon := 'FNDJLFOK.gif';
l_text := wf_core.translate ('WFDM_CREATE');
l_onmouseover := wf_core.translate ('WFDM_CREATE');
htp.p('
');
htp.tableRowClose;
htp.tableclose;
wfa_sec.Footer;
htp.htmlClose;
exception
when others then
wf_core.context('FND_DOCUMENT_MANAGEMENT', 'Dm_Nodes_Display');
fnd_document_management.error;
end Dm_Nodes_Display;
procedure Dm_Nodes_Edit (
p_node_id IN VARCHAR2
) IS
username varchar2(320); -- Username to query
admin_role varchar2(320); -- Role for admin mode
admin_mode varchar2(1) := 'N';
l_node_id NUMBER;
l_node_name VARCHAR2(240);
l_node_description VARCHAR2(240);
l_connect_syntax VARCHAR2(240);
l_product_id NUMBER;
l_product_name VARCHAR2(80);
l_vendor_name VARCHAR2(80);
l_version VARCHAR2(20);
l_media varchar2(240) := wfa_html.image_loc;
l_icon varchar2(40) := 'FNDILOV.gif';
l_text varchar2(240) := '';
l_onmouseover varchar2(240) := wf_core.translate ('WFPREF_LOV');
l_url varchar2(4000);
l_error_msg varchar2(240);
cursor nodes_cursor (c_node_id NUMBER) is
select dmn.node_id,
dmn.node_name,
dmn.node_description,
dmn.connect_syntax,
dmn.product_id,
dmp.product_name,
dmp.vendor_name,
dmp.version
from fnd_dm_nodes dmn, fnd_dm_products dmp
where dmn.node_id = c_node_id
and dmn.product_id = dmp.product_id;
CURSOR c_product_list IS
SELECT
PRODUCT_ID ,
PRODUCT_NAME ,
VENDOR_NAME ,
VERSION
FROM fnd_dm_products
ORDER BY product_name;
BEGIN
-- Check current user has admin authority
wfa_sec.GetSession(username);
username := upper(username);
admin_role := wf_core.translate('WF_ADMIN_ROLE');
if (admin_role = '*' or
Wf_Directory.IsPerformer(username, admin_role)) then
admin_mode := 'Y';
else
l_error_msg := wf_core.translate('WFPREF_INVALID_ADMIN');
end if;
/*
** If this node already exists then go fetch the definition
*/
IF (p_node_id IS NOT NULL) THEN
OPEN nodes_cursor (p_node_id);
/*
** go fetch the definition of the node
*/
FETCH nodes_cursor INTO
l_node_id ,
l_node_name ,
l_node_description,
l_connect_syntax ,
l_product_id ,
l_product_name ,
l_vendor_name ,
l_version ;
CLOSE nodes_cursor;
END IF;
-- Set page title
htp.htmlOpen;
htp.headOpen;
htp.title(wf_core.translate('WFDM_EDIT_NODE_TITLE'));
wfa_html.create_help_function('wf/links/dmr.htm?DMREP');
wf_lov.OpenLovWinHtml;
htp.headClose;
-- Page header
wfa_sec.Header(FALSE, '', wf_core.translate('WFDM_EDIT_NODE_TITLE'), TRUE);
IF (admin_mode = 'N') THEN
htp.center(htf.bold(l_error_msg));
return;
END IF;
htp.tableopen(calign=>'CENTER', cattributes=>'summary=""');
htp.p('