REM dbdrv: sql ~PROD ~PATH ~FILE none none none package &phase=plb \ REM dbdrv: checkfile:~PROD:~PATH:~FILE /*=======================================================================+ | Copyright (C) 1995 Oracle Corporation Redwood Shores, California, Usa| | All Rights Reserved. | +=======================================================================+ | FILENAME | wflovb.sql | DESCRIPTION | PL/SQL body for package: WF_LOV | | MODIFICATION LOG: | Bug 1380107 08/01 NLIU - Added the procedure display_lov_no_frame_key. | This works around the Netscape 4.7X error with javascript | and multibyte characters getting corrupted. | | Bug 1904844 12/03 CTILLEY - Added arg p_display_key to the procedures | display_lov, display_lov_find, and | display_lov_details to indicate the key is | passed instead of the translated value. | | bug 2001012 01/2002 JWSMITH - Increased username, l_name to varchar2(320) | | Bug 2512800 11/02 NLIU - User with end date will not be present in | forward to LOV in iProcurement. | | Bug 2669069 11/02 NLIU - Allow name with apostrophe to be selected in | forward to LOV in iProcurement. | *=======================================================================*/ SET VERIFY OFF WHENEVER SQLERROR EXIT FAILURE ROLLBACK; WHENEVER OSERROR EXIT FAILURE ROLLBACK set arraysize 1 set scan off create or replace package body WF_LOV as /* $Header: wflovb.pls 26.22 2005/05/25 23:08:34 dlam ship $ */ -- -- Error (PRIVATE) -- Print a page with an error message. -- Errors are retrieved from these sources in order: -- 1. wf_core errors -- 2. Oracle errors -- 3. Unspecified INTERNAL error -- procedure Error as error_name varchar2(30); error_message varchar2(2000); error_stack varchar2(32000); username varchar2(320); begin WFA_SEC.GetSession(username); htp.htmlOpen; htp.headOpen; htp.title(wf_core.translate('ERROR')); htp.headClose; begin wfa_sec.Header(background_only=>TRUE); exception when others then htp.bodyOpen; end; htp.header(nsize=>1, cheader=>wf_core.translate('ERROR')); wf_core.get_error(error_name, error_message, error_stack); error_message := wf_core.substituteSpecialChars(error_message); error_stack := wf_core.substituteSpecialChars(error_stack); if (error_name is not null) then htp.p(error_message); else htp.p(sqlerrm); end if; htp.hr; htp.p(wf_core.translate('WFENG_ERRNAME')||': '||error_name); htp.br; htp.p(wf_core.translate('WFENG_ERRSTACK')||': '|| replace(error_stack,wf_core.newline,'
')); wfa_sec.Footer; htp.htmlClose; end Error; /*=========================================================================== PROCEDURE NAME: OpenLovWinHtml DESCRIPTION: Generates javascript required to run the HTML LOV. Insert the javascript statements in the header of the Document that will call the LOV window. ============================================================================*/ procedure OpenLovWinHtml(p_jscript_tag IN Varchar2 ) is begin IF (p_jscript_tag = 'Y') THEN htp.p(''); htp.p(''); END IF; exception when others then Wf_Core.Context('wf_lov', 'OpenLovWinHtml'); raise; end OpenLovWinHtml; /*=========================================================================== FUNCTION NAME: GenerateLovURL DESCRIPTION: Generates the URL syntax required to launch the lov window for the given field. ============================================================================*/ function GenerateLovURL (p_form_name IN Varchar2, p_query_plsql IN Varchar2, p_query_params IN Varchar2, p_column_names IN Varchar2, p_longlist IN Varchar2, p_callback IN Varchar2 , p_callback_params IN Varchar2 , p_init_find_field IN Varchar2 , p_width IN Varchar2, p_height IN Varchar2, p_prompt IN Varchar2 , p_window_title IN Varchar2 ) return VARCHAR2 IS l_url VARCHAR2(4000); BEGIN l_url := '"javascript:fnd_open_window('||''''|| 'wf_lov.lovapplet'|| '?doc_name=' ||p_form_name|| '&column_names=' ||p_column_names|| '&query_params=' ||p_query_params|| '&query_plsql=' ||p_query_plsql|| '&longlist=' ||p_longlist|| '&callback=' ||p_callback|| '&callback_params='||p_callback_params|| '&initial_find=' ||p_init_find_field|| '&window_title=' ||p_window_title|| ''''|| ','||p_width||','||p_height||')" '; if p_prompt is not null then l_url := l_url|| ' OnMouseOver="window.status='''||p_prompt|| ''';return true" '; end if; return (l_url); exception when others then rollback; wf_core.context('Wf_Lov', 'GenerateLovURL', p_form_name , p_query_plsql , p_query_params , p_column_names , p_longlist ); wf_lov.Error; END GenerateLovURL; procedure CreateButton (when_pressed_url in varchar2, onmouseover in varchar2, icon_top in varchar2, icon_name in varchar2, show_text in varchar2) is begin htp.p(''); htp.p(''|| ''|| ''|| ''|| ''|| ''); htp.p('
'|| ''|| '
' || onmouseover || ''||show_text|| '
'); exception when others then rollback; wf_core.context('Wf_Lov', 'create_reg_button',when_pressed_url,onmouseover, icon_top,icon_name,show_text); wf_lov.Error; end CreateButton; procedure LovApplet(doc_name varchar2, column_names varchar2, query_params varchar2, query_plsql varchar2, callback varchar2 , callback_params varchar2 , longlist varchar2, initial_find varchar2 , width varchar2, height varchar2, window_title varchar2 ) IS username varchar2(320); -- Username to query lang_codeset varchar2(50); col_num varchar2(20); l_document_position number := 0; i number; l_url varchar2(1000); l_media varchar2(240) := wfa_html.image_loc; l_icon varchar2(30); l_text varchar2(30) := ''; l_onmouseover varchar2(240); l_params varchar2(240) := callback_params; l_window_name varchar2(240); name varchar2(1000); buffer varchar2(1000); col_names varchar2(1000) := column_names; callback_str varchar2(2000) := callback; begin -- Check session and current user wfa_sec.GetSession(username); lang_codeset := substr(userenv('LANGUAGE'), instr(userenv('LANGUAGE'),'.')+1, length(userenv('LANGUAGE'))); l_document_position := INSTR(UPPER(doc_name), '.DOCUMENT'); /* ** Strip off the document object information from the document hierarchy ** so we can run javascript functions on the window and/or frame */ l_window_name := SUBSTR(doc_name, 1, l_document_position-1); htp.htmlOpen; htp.headOpen; IF (window_title IS NOT NULL) THEN htp.title(window_title); ELSE htp.title(wf_core.translate('WFPREF_LOV')); END IF; htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.headclose; if doc_name <> 'PRELOAD' then -- added to prevent js errors on lov preload htp.p(''); else htp.p(''); end if; htp.p('
'); htp.p(''); htp.p(''); l_url := 'javascript:cancel_lov()'; l_icon := 'FNDJLFCN.gif'; l_text := wf_core.translate ('CANCEL'); l_onmouseover := wf_core.translate ('CANCEL'); CreateButton (l_url, l_onmouseover, l_media, l_icon, l_text); l_url := 'javascript:set_value()'; l_icon := 'FNDJLFOK.gif'; l_text := wf_core.translate ('WFMON_OK'); l_onmouseover := wf_core.translate ('WFMON_OK'); CreateButton (l_url, l_onmouseover, l_media, l_icon, l_text); htp.p('
'); htp.p(''); htp.htmlclose; exception when others then rollback; wf_core.context('Wf_Pref', 'lang_lov_applet'); wf_lov.error; end LovApplet; procedure display_lov ( p_lov_name in varchar2 , p_display_name in varchar2 , p_validation_callback in varchar2 , p_dest_hidden_field in varchar2 , p_dest_display_field in varchar2 , p_current_value in varchar2 , p_param1 in varchar2 , p_param2 in varchar2 , p_param3 in varchar2 , p_param4 in varchar2 , p_param5 in varchar2 , p_display_key in varchar2 ) IS username varchar2(320); l_display_name varchar2(360); l_dummy boolean; BEGIN WFA_SEC.GetSession(username); /* Check the display_key. If 'Y' then translate p_display_name and store * in l_display_name */ if (p_display_key='Y') then l_display_name := wf_core.translate(p_display_name); end if; -- Check to verify each parameters l_dummy := wf_core.CheckIllegalChars(l_display_name,true); l_dummy := wf_core.CheckIllegalChars(p_display_name,true); l_dummy := wf_core.CheckIllegalChars(p_lov_name,true); l_dummy := wf_core.CheckIllegalChars(p_validation_callback,true); l_dummy := wf_core.CheckIllegalChars(p_dest_hidden_field,true); l_dummy := wf_core.CheckIllegalChars(p_dest_display_field,true); l_dummy := wf_core.CheckIllegalChars(p_current_value,true); l_dummy := wf_core.CheckIllegalChars(p_display_key,true); l_dummy := wf_core.CheckIllegalChars(p_param1,true); l_dummy := wf_core.CheckIllegalChars(p_param2,true); l_dummy := wf_core.CheckIllegalChars(p_param3,true); l_dummy := wf_core.CheckIllegalChars(p_param4,true); l_dummy := wf_core.CheckIllegalChars(p_param5,true); /* ** Set the title for the window ** ** Check to see if the key is passed, if yes then display the variable ** storing the translated value. */ if (p_display_key='Y') then htp.title(l_display_name); /* ** Now create the summary/detail frameset */ htp.p (''); else htp.title(p_display_name); htp.p (''); end if; /* ** Create the summary frame */ htp.p (''); /* ** Create the details frame */ htp.p (''); /* ** Close the summary/details frameset */ htp.p (''); htp.bodyclose; htp.htmlclose; exception when others then rollback; wf_core.context('Wf_Lov', 'display_lov'); wf_lov.error; end display_lov; procedure display_lov_find ( p_lov_name in varchar2 , p_display_name in varchar2 , p_validation_callback in varchar2 , p_dest_hidden_field in varchar2 , p_dest_display_field in varchar2 , p_current_value in varchar2 , p_autoquery in varchar2 , p_display_key in varchar2 ) IS username varchar2(320); l_display_name varchar2(360); l_dummy boolean; BEGIN WFA_SEC.GetSession(username); if (p_display_key='Y') then l_display_name := wf_core.translate(p_display_name); end if; -- Check to verify each parameters l_dummy := wf_core.CheckIllegalChars(l_display_name,true); l_dummy := wf_core.CheckIllegalChars(p_display_name,true); l_dummy := wf_core.CheckIllegalChars(p_lov_name,true); l_dummy := wf_core.CheckIllegalChars(p_validation_callback,true); l_dummy := wf_core.CheckIllegalChars(p_dest_hidden_field,true); l_dummy := wf_core.CheckIllegalChars(p_dest_display_field,true); l_dummy := wf_core.CheckIllegalChars(p_current_value,true); l_dummy := wf_core.CheckIllegalChars(p_display_key,true); htp.headopen; htp.p (''); htp.p(''); htp.headclose; htp.p(''); htp.formOpen(curl=>'javascript:fnd_launch_query();', cmethod=>'POST', cattributes=>'NAME="WF_FIND"'); htp.tableOpen(cattributes=>'summary=""'); htp.tableRowOpen; htp.tableData(cvalue=>'', calign=>'right', cattributes=>'id=""'); htp.tableData(htf.formText(cname=>'p_current_value', csize=>'30', cmaxlength=>'4000', cvalue=>'', cattributes=>'id="i_current_value"'), cattributes=>'id=""'); htp.p (''); htp.p(''); htp.p(''); wfa_html.create_reg_button ('javascript:fnd_launch_query();', wf_core.translate ('FIND'), wfa_html.image_loc, 'fndfind.gif', wf_core.translate ('FIND')); htp.p(''); htp.p(''); wfa_html.create_reg_button ('javascript:document.WF_FIND.reset();', wf_core.translate ('CLEAR'), wfa_html.image_loc, 'fndfind.gif', wf_core.translate ('CLEAR')); htp.p(''); htp.tableRowClose; htp.tableClose; htp.formClose; exception when others then rollback; wf_core.context('Wf_Lov', 'display_lov_find'); wf_lov.error; end display_lov_find; procedure display_lov_details ( p_lov_name in varchar2 , p_display_name in varchar2 , p_validation_callback in varchar2 , p_dest_hidden_field in varchar2 , p_dest_display_field in varchar2 , p_current_value in varchar2 , p_start_row in varchar2 , p_autoquery in varchar2 , p_param1 in varchar2 , p_param2 in varchar2 , p_param3 in varchar2 , p_param4 in varchar2 , p_param5 in varchar2 , p_display_key in varchar2 ) IS l_ncols number := 0; l_result number := 0; l_start_row number := TO_NUMBER(p_start_row); l_number_rows number := 10; l_call_method varchar2(10) := 'LOV'; l_hidden_value varchar2(240); l_display_value varchar2(4000) := p_current_value; l_sql_stmt varchar2(4000); username varchar2(320); l_display_name varchar2(360); l_cursorName number; l_cursorResult number; l_dummy boolean; BEGIN WFA_SEC.GetSession(username); htp.headopen; htp.p (''); htp.p(''); htp.headclose; htp.p(''); htp.formOpen(curl=>owa_util.get_owa_service_path|| 'wf_lov.display_lov_details', cmethod=>'POST', cattributes=>'NAME="WF_DETAILS"'); htp.formhidden('p_lov_name', p_lov_name); htp.formhidden('p_display_name', p_display_name); htp.formhidden('p_validation_callback', p_validation_callback); htp.formhidden('p_dest_hidden_field', p_dest_hidden_field); htp.formhidden('p_dest_display_field',p_dest_display_field); htp.formhidden('p_current_value',p_current_value); htp.formhidden('p_start_row',p_start_row); htp.formhidden('p_autoquery',p_autoquery); htp.formhidden('p_param1',p_param1); htp.formhidden('p_param2',p_param2); htp.formhidden('p_param3',p_param3); htp.formhidden('p_param4',p_param4); htp.formhidden('p_param5',p_param5); htp.formhidden('p_display_key',p_display_key); if (p_autoquery = 'Y') then -- Autoquery or Display hint about selection criteria htp.p(''); htp.p(''); end if; wf_lov.g_define_rec.total_rows := 0; wf_lov.g_define_rec.add_attr1_title := null; wf_lov.g_define_rec.add_attr2_title := null; wf_lov.g_define_rec.add_attr3_title := null; wf_lov.g_define_rec.add_attr4_title := null; wf_lov.g_define_rec.add_attr5_title := null; wf_lov.g_value_tbl.delete; if (p_autoquery <> 'Y') THEN --<3310020:rwunderl> --Validating that the callback is authorized. if ((UPPER(p_validation_callback) = 'WFA_HTML.WF_USER_VAL') or (UPPER(p_validation_callback) = 'WFA_HTML_JSP.WF_USER_VAL') or (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_SYSTEM_VAL') or (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_EVENT_VAL') or (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_AGENT_VAL') or (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_SYSTEM_VAL') or (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_PROCESSNAME_VAL') or (UPPER(p_validation_callback) = 'WF_EVENT_HTML.WF_ITEMTYPE_VAL')) then l_sql_stmt := 'BEGIN '||p_validation_callback|| '(:1, :2, :3, :4, :5, :6, :7'; --Appending any optional parameter place holders to l_sql_stmt. if (p_param1 is not null) then l_sql_stmt := l_sql_stmt||', :8'; end if; if (p_param2 is not null) then l_sql_stmt := l_sql_stmt||', :9'; end if; if (p_param3 is not null) then l_sql_stmt := l_sql_stmt||', :10'; end if; if (p_param4 is not null) then l_sql_stmt := l_sql_stmt||', :11'; end if; if (p_param5 is not null) then l_sql_stmt := l_sql_stmt||', :12'; end if; l_sql_stmt := l_sql_stmt||'); END;'; --Opening the cursor and parsing l_cursorName := DBMS_SQL.Open_Cursor; DBMS_SQL.Parse(l_cursorName, l_sql_stmt, DBMS_SQL.NATIVE); --Binding the mandatory parameters. DBMS_SQL.Bind_Variable(l_cursorName, ':1', l_call_method); DBMS_SQL.Bind_Variable(l_cursorName, ':2', p_lov_name); DBMS_SQL.Bind_Variable(l_cursorName, ':3', l_start_row); DBMS_SQL.Bind_Variable(l_cursorName, ':4', l_number_rows); DBMS_SQL.Bind_Variable(l_cursorName, ':5', l_hidden_value); DBMS_SQL.Bind_Variable(l_cursorName, ':6', l_display_value); DBMS_SQL.Bind_Variable(l_cursorName, ':7', l_result); --Binding the optional parameters. if (p_param1 is not null) then DBMS_SQL.Bind_Variable(l_cursorName, ':8', p_param1); end if; if (p_param2 is not null) then DBMS_SQL.Bind_Variable(l_cursorName, ':9', p_param2); end if; if (p_param3 is not null) then DBMS_SQL.Bind_Variable(l_cursorName, ':10', p_param3); end if; if (p_param4 is not null) then DBMS_SQL.Bind_Variable(l_cursorName, ':11', p_param4); end if; if (p_param5 is not null) then DBMS_SQL.Bind_Variable(l_cursorName, ':12', p_param5); end if; --Executing the cursor. l_cursorResult := DBMS_SQL.Execute(l_cursorName); --Storing out variables into local variables. DBMS_SQL.Variable_Value(l_cursorName, ':5', l_hidden_value); DBMS_SQL.Variable_Value(l_cursorName, ':6', l_display_value); DBMS_SQL.Variable_Value(l_cursorName, ':7', l_result); --Closing the cursor DBMS_SQL.Close_Cursor(l_cursorName); end if; else l_result := 0; end if; if (l_result > 0) then /* ** Print out the row count for the results in the form of ** Records: 1 to 15 of 25 */ htp.tableOpen(cborder => 'BORDER=0', cattributes => 'WIDTH="100%" SUMMARY=""'); htp.tableRowOpen; wf_core.clear; Wf_Core.Token('START_REC', p_start_row); Wf_Core.Token('END_REC', TO_CHAR(TO_NUMBER(p_start_row) + wf_lov.g_value_tbl.count - 1)); Wf_Core.Token('TOTAL_REC', ''||TO_CHAR(wf_lov.g_define_rec.total_rows)||''); htp.tabledata('' || Wf_Core.Translate('RECORD_MSG') || '', cattributes=>'id=""'); htp.tableRowClose; htp.tableClose; -- display table header of LOV htp.p(''); htp.p(''); END IF; /* ** Check to see if you should create the Next button */ IF (wf_lov.g_value_tbl.count = 10) THEN l_start_row := TO_NUMBER(p_start_row) + 10; if (l_start_row <= wf_lov.g_define_rec.total_rows) then htp.p(''); end if; END IF; htp.tableRowClose; htp.tableclose; htp.formclose; -- Form to hold the display value and hidden key for the javascript -- LOV_copy(). This is to fix the problem when either display_value -- or the hidden_key contain single quotes. htp.formOpen(curl=>null, cmethod=>'Post', cattributes=>'NAME=WF_LOV_FRM'); -- place dummy values in index 0 htp.formHidden('h_display', 'xxx'); htp.formHidden('h_hidden', 'xxx'); for ii in 1..wf_lov.g_value_tbl.count loop htp.formHidden('h_display',wf_lov.g_value_tbl(ii).display_value); -- ### does not work for double quotes -- ### replace(wf_lov.g_value_tbl(ii).display_value, '"', '\"')); htp.formHidden('h_hidden',wf_lov.g_value_tbl(ii).hidden_key); -- ### replace(wf_lov.g_value_tbl(ii).hidden_key, '"', '\"')); end loop; htp.formClose; htp.bodyclose; end if; exception when others then rollback; wf_core.context('Wf_Lov', 'Display_Lov_Details' ); raise; end display_lov_details; /* ** This procedure is a combination of display_lov, display_lov_find and ** display_lov_details for new UI design with no frame */ procedure display_lov_no_frame ( p_lov_name in varchar2 , p_display_name in varchar2 , p_validation_callback in varchar2 , p_dest_hidden_field in varchar2 , p_dest_display_field in varchar2 , p_current_value in varchar2 , p_start_row in varchar2 , p_autoquery in varchar2 , p_language in varchar2 ) IS ii number := 0; nn number := 0; l_total_rows number := 0; l_ncols number := 0; l_result number := 0; l_temp_start_row number := 0; l_start_row number; l_end_row number; l_number_rows number := 10; l_call_method varchar2(10) := 'LOV'; l_hidden_value varchar2(240); l_display_value varchar2(4000) := p_current_value; l_sql_stmt varchar2(4000); l_name VARCHAR2 (320); l_display_name VARCHAR2 (360); p_max_rows number := 25; l_from varchar2(10); l_to varchar2(10); username varchar2(320); type NameList is table of wf_roles.name%type; type DNameList is table of wf_roles.display_name%type; names NameList; dnames DNameList; -- took away the function and wildcard in the cursor below, -- instead uses the following four plsql variables. --Bug 2342682 criteria1 varchar2(12); criteria2 varchar2(12); criteria3 varchar2(12); criteria4 varchar2(12); CURSOR c_user_lov (c_find_criteria IN VARCHAR2) IS select NAME, DISPLAY_NAME from WF_ROLES where (DISPLAY_NAME like criteria1 or DISPLAY_NAME like criteria2 or DISPLAY_NAME like criteria3 or DISPLAY_NAME like criteria4) and upper(DISPLAY_NAME) like upper(c_find_criteria)||'%' and status <> 'INACTIVE' union select NAME, DISPLAY_NAME from WF_ROLES where ORIG_SYSTEM not in ('HZ_PARTY','POS','ENG_LIST','AMV_CHN', 'HZ_GROUP','CUST_CONT') and upper(NAME) like upper(c_find_criteria)||'%' and (NAME like criteria1 or NAME like criteria2 or NAME like criteria3 or NAME like criteria4) and status <> 'INACTIVE' order by 2; BEGIN WFA_SEC.GetSession(username); /* ** Set the title for the window */ htp.title(wf_core.translate('SELECT')||'&'||'nbsp;'||p_display_name); htp.headopen; -- hardcode to /OA_HTML/ for ssp htp.p(''); -- htp.p(''); htp.p (''); htp.p(''); htp.headclose; htp.p(''); htp.p('
'); htp.formOpen(curl=>'javascript:fnd_launch_query();', cmethod=>'POST', cattributes=>'NAME="WF_FIND"'); htp.p('
'); htp.p(''); /* ** Print out the header */ htp.p(''); /* ** get the display name for the attribute */ if (p_display_key = 'Y') then htp.p(''); else htp.p(''); end if; if (wf_lov.g_define_rec.add_attr1_title IS NOT NULL) then htp.p(''); l_ncols := l_ncols + 1; end if; if (wf_lov.g_define_rec.add_attr2_title IS NOT NULL) then htp.p(''); l_ncols := l_ncols + 1; end if; if (wf_lov.g_define_rec.add_attr3_title IS NOT NULL) then htp.p(''); l_ncols := l_ncols + 1; end if; if (wf_lov.g_define_rec.add_attr4_title IS NOT NULL) then htp.p(''); l_ncols := l_ncols + 1; end if; if (wf_lov.g_define_rec.add_attr5_title IS NOT NULL) then htp.p(''); l_ncols := l_ncols + 1; end if; htp.tablerowclose; /* ** Loop through the data */ for ii in 1..wf_lov.g_value_tbl.count loop -- display one row of data if (round(ii/2) = ii/2) then htp.p(''); else htp.p(''); end if; if (p_display_key='Y') then htp.tabledata (''|| wf_lov.g_value_tbl(ii).display_value||'', cattributes=>'headers="' || l_display_name || '"'); else htp.tabledata (''|| wf_lov.g_value_tbl(ii).display_value||'', cattributes=>'headers="' || p_display_name || '"'); end if; if (l_ncols > 0) then htp.tabledata (wf_lov.g_value_tbl(ii).add_attr1_value, cattributes=>'headers="' || wf_lov.g_define_rec.add_attr1_title || '"'); end if; if (l_ncols > 1) then htp.tabledata (wf_lov.g_value_tbl(ii).add_attr2_value, cattributes=>'headers="' || wf_lov.g_define_rec.add_attr2_title || '"'); end if; if (l_ncols > 2) then htp.tabledata (wf_lov.g_value_tbl(ii).add_attr3_value, cattributes=>'headers="' || wf_lov.g_define_rec.add_attr3_title || '"'); end if; if (l_ncols > 3) then htp.tabledata (wf_lov.g_value_tbl(ii).add_attr4_value, cattributes=>'headers="' || wf_lov.g_define_rec.add_attr4_title || '"'); end if; if (l_ncols > 4) then htp.tabledata (wf_lov.g_value_tbl(ii).add_attr5_value, cattributes=>'headers="' || wf_lov.g_define_rec.add_attr5_title || '"'); end if; htp.tablerowclose; end loop; htp.tableClose; htp.p(''); htp.p(''); htp.p('
'|| ''||l_display_name|| ''|| ''|| p_display_name || ''|| ''|| wf_lov.g_define_rec.add_attr1_title || ''|| ''|| wf_lov.g_define_rec.add_attr2_title || ''|| ''|| wf_lov.g_define_rec.add_attr3_title || ''|| ''|| wf_lov.g_define_rec.add_attr4_title || ''|| ''|| wf_lov.g_define_rec.add_attr5_title || '
'); htp.tableOpen(calign=>'CENTER', cborder => 'BORDER=0', cattributes=>'summary=""'); htp.tableRowOpen; /* ** Check to see if you should create the PREVIOUS button */ IF (TO_NUMBER(p_start_row) > 1) THEN htp.p('
'); /* ** Make sure that your not going to go back past the first ** record. Otherwise subtract the query set from the start */ IF (TO_NUMBER(p_start_row) < 1) THEN l_start_row := 1; ELSE l_start_row := TO_NUMBER(p_start_row) - 10; END IF; htp.p(''); htp.p('' ||
                WF_CORE.Translate('PREVIOUS') || ''); htp.p(''||wf_core.translate('PREVIOUS')||''); htp.p(''); htp.p(''); htp.p('' ||
                WF_CORE.Translate('NEXT') || ''); htp.p(''||wf_core.translate('NEXT')||''); htp.p('
'); htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.tableRowOpen; htp.p(''); htp.p(''); htp.p(''); -- blue separator htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.tableRowClose; htp.formClose; htp.formOpen(curl=>owa_util.get_owa_service_path|| 'wf_lov.display_lov_no_frame', cmethod=>'POST', cattributes=>'NAME="WF_DETAILS"'); htp.formhidden('p_lov_name', p_lov_name); htp.formhidden('p_display_name', p_display_name); htp.formhidden('p_validation_callback', p_validation_callback); htp.formhidden('p_dest_hidden_field', p_dest_hidden_field); htp.formhidden('p_dest_display_field',p_dest_display_field); htp.formhidden('p_current_value',p_current_value); htp.formhidden('p_start_row',p_start_row); htp.formhidden('p_autoquery',p_autoquery); htp.formhidden('p_language',p_language); if (p_autoquery = 'Y') then -- Autoquery or Display hint about selection criteria htp.p(''); htp.p(''); end if; wf_lov.g_define_rec.total_rows := 0; wf_lov.g_define_rec.add_attr1_title := null; wf_lov.g_define_rec.add_attr2_title := null; wf_lov.g_define_rec.add_attr3_title := null; wf_lov.g_define_rec.add_attr4_title := null; wf_lov.g_define_rec.add_attr5_title := null; wf_lov.g_value_tbl.delete; if (p_autoquery <> 'Y') THEN wf_lov.g_define_rec.add_attr1_title := wf_core.translate ('WFITD_INTERNAL_NAME'); -- these 4 criteria variables were extracted from the sql in cursor -- c_user_lov. Without doing this, the optimizer did not know to -- use indexes in the base tables. criteria1 := lower(substr(l_display_value, 1, 2))||'%'; criteria2 := lower(substr(l_display_value, 1, 1))|| upper(substr(l_display_value, 2, 1))||'%'; criteria3 := initcap(substr(l_display_value, 1, 2))||'%'; criteria4 := upper(substr(l_display_value, 1, 2))||'%'; open c_user_lov (l_display_value); -- use bulk collect to improve performance, also get the count -- while fetching the data fetch c_user_lov bulk collect into names, dnames; close c_user_lov; if (names is null) then l_total_rows := 0; else l_total_rows := names.COUNT; if (l_total_rows < (to_number(p_start_row)+p_max_rows-1)) then l_end_row := l_total_rows; else l_end_row := to_number(p_start_row)+p_max_rows-1; end if; for ii in to_number(p_start_row)..l_end_row loop nn := nn + 1; wf_lov.g_value_tbl(nn).hidden_key := names(ii); wf_lov.g_value_tbl(nn).display_value := dnames(ii); wf_lov.g_value_tbl(nn).add_attr1_value := names(ii); end loop; end if; wf_lov.g_define_rec.total_rows := l_total_rows; l_result := 1; else l_result := 0; end if; htp.p(''); htp.tableRowOpen; htp.p(''); if (p_autoquery='Y') then -- htp.p(''); htp.tableRowClose; htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.p(''); elsif (wf_lov.g_define_rec.total_rows=0) then wf_core.clear; wf_core.token('NAME', p_display_name); wf_core.token('VALUE', p_current_value); htp.p(''); elsif (wf_lov.g_define_rec.total_rows>0) then if (l_result > 0) then /* ** Print out the row count for the results in the form of ** Records: 1 to 15 of 25 */ htp.p(''); htp.tableRowClose; htp.tableRowOpen; htp.p(''); if (p_start_row is not null) then l_temp_start_row := to_number(p_start_row); end if; l_from := to_char(l_temp_start_row); if (l_temp_start_row =0) then l_to := TO_CHAR(l_temp_start_row + wf_lov.g_value_tbl.count); else l_to := TO_CHAR(l_temp_start_row + wf_lov.g_value_tbl.count -1); end if; htp.p(''); htp.tableRowClose; -- display table header of LOV htp.p(''); htp.p(''); htp.p('
'); htp.p(wf_core.translate('SELECT')||'&'||'nbsp;'||p_display_name); htp.p('

'); htp.p(''); htp.p('
'||wf_core.translate('WFLOV_SEARCH')||'&'||'nbsp;'); htp.p (''); htp.p(''); htp.p(''||wf_core.translate('WFJSP_GO')||''); -- htp.p(''||wf_core.translate('WFJSP_GO')||''); htp.p('
'); htp.p('
 
'); htp.p(''); htp.p('
 
'||wf_core.translate('WFLOV_GO')||'
 
 
 
 
 
 
'||wf_core.translate('WFLOV_NO_MATCH')||'
'||wf_core.translate('WFLOV_CLICK')||''); /* ** Check to see if you should create the PREVIOUS button */ IF (TO_NUMBER(p_start_row) > 1) THEN /* ** Make sure that your not going to go back past the first ** record. Otherwise subtract the query set from the start */ IF (TO_NUMBER(p_start_row) < 1) THEN l_start_row := 1; ELSE l_start_row := TO_NUMBER(p_start_row) - p_max_rows; END IF; htp.p(' alt=""'); htp.p(''); htp.p(wf_core.translate('PREVIOUS')||''); ELSE htp.p('' || WF_CORE.Translate('PREVIOUS') || '&'||'nbsp;'||wf_core.translate('PREVIOUS')||''); END IF; Wf_Core.Clear; Wf_Core.Token('START_REC', l_from); Wf_Core.Token('END_REC', l_to); Wf_Core.Token('TOTAL_REC', TO_CHAR(wf_lov.g_define_rec.total_rows)); htp.p(''||Wf_Core.Translate('PAGE_MSG')||''); /* ** Check to see if you should create the Next button */ IF (p_start_row + p_max_rows - 1 < wf_lov.g_define_rec.total_rows) THEN -- IF (wf_lov.g_value_tbl.count = p_max_rows) THEN l_start_row := TO_NUMBER(p_start_row) + p_max_rows; htp.p(''); htp.p(wf_core.translate('NEXT')||''); htp.p('' || WF_CORE.Translate('NEXT') || ''); ELSE htp.p('' || WF_CORE.Translate('NEXT') || '&'||'nbsp;'||wf_core.translate('NEXT')||''); END IF; END IF; htp.p('
'); htp.p(''); htp.p(''); /* ** Print out the header */ /* ** get the display name for the attribute */ htp.p(''); htp.p(''); if (wf_lov.g_define_rec.add_attr1_title IS NOT NULL) then htp.p(''); l_ncols := l_ncols + 1; end if; if (wf_lov.g_define_rec.add_attr2_title IS NOT NULL) then htp.p(''); l_ncols := l_ncols + 1; end if; if (wf_lov.g_define_rec.add_attr3_title IS NOT NULL) then htp.p(''); l_ncols := l_ncols + 1; end if; if (wf_lov.g_define_rec.add_attr4_title IS NOT NULL) then htp.p(''); l_ncols := l_ncols + 1; end if; if (wf_lov.g_define_rec.add_attr5_title IS NOT NULL) then htp.p(''); l_ncols := l_ncols + 1; end if; htp.tablerowclose; /* ** Loop through the data */ for ii in 1..wf_lov.g_value_tbl.count loop -- display one row of data htp.p(''); if (l_ncols > 0) then htp.p(''); end if; if (l_ncols > 1) then htp.p(''); end if; if (l_ncols > 2) then htp.p(''); end if; if (l_ncols > 3) then htp.p(''); end if; if (l_ncols > 4) then htp.p(''); end if; htp.tablerowclose; end loop; htp.tableClose; htp.p(''); htp.p(''); if (wf_lov.g_value_tbl.count > 5) then htp.tableRowOpen; htp.p(''); htp.p(''); htp.tableRowClose; end if; end if; -- if (wf_lov.g_define_rec.total_rows=0) -- htp.tableclose; -- blue separator -- htp.p('
&'||'nbsp'|| p_display_name || ''|| wf_lov.g_define_rec.add_attr1_title|| ''|| wf_lov.g_define_rec.add_attr2_title|| ''|| wf_lov.g_define_rec.add_attr3_title|| ''|| wf_lov.g_define_rec.add_attr4_title|| ''|| wf_lov.g_define_rec.add_attr5_title|| ''||wf_core.translate('SELECT')||''||wf_lov.g_value_tbl(ii).display_value||''||wf_lov.g_value_tbl(ii).add_attr1_value||''||wf_lov.g_value_tbl(ii).add_attr2_value||''||wf_lov.g_value_tbl(ii).add_attr3_value||''||wf_lov.g_value_tbl(ii).add_attr4_value||''||wf_lov.g_value_tbl(ii).add_attr5_value||'
'); /* ** Check to see if you should create the PREVIOUS button */ IF (TO_NUMBER(p_start_row) > 1) THEN /* ** Make sure that your not going to go back past the first ** record. Otherwise subtract the query set from the start */ IF (TO_NUMBER(p_start_row) < 1) THEN l_start_row := 1; ELSE l_start_row := TO_NUMBER(p_start_row) - p_max_rows; END IF; htp.p('' || WF_CORE.Translate('PREVIOUS') || ''); htp.p(''); htp.p(wf_core.translate('PREVIOUS')||''); ELSE htp.p('&'||'nbsp;'||wf_core.translate('PREVIOUS')||''); END IF; Wf_Core.Clear; Wf_Core.Token('START_REC', l_from); Wf_Core.Token('END_REC', l_to); Wf_Core.Token('TOTAL_REC', TO_CHAR(wf_lov.g_define_rec.total_rows)); htp.p(''||Wf_Core.Translate('PAGE_MSG')||''); /* ** Check to see if you should create the Next button */ IF (wf_lov.g_value_tbl.count = p_max_rows) THEN l_start_row := TO_NUMBER(p_start_row) + p_max_rows; htp.p(''); htp.p(wf_core.translate('NEXT')||''); htp.p('' || WF_CORE.Translate('NEXT') || ''); ELSE htp.p('' || WF_CORE.Translate('NEXT') || '&'|| 'nbsp;'||wf_core.translate('NEXT')||''); END IF; htp.p('
'); htp.p(''); htp.p(''); htp.p(''); htp.p(''); htp.tableRowClose; htp.p(''); -- htp.p('
 
'); htp.p(''); htp.p('
 
'); htp.p(''); htp.p(''); htp.p('
'||wf_core.translate('CANCEL')||'
'); -- htp.p('
'||wf_core.translate('CANCEL')||'
'); htp.formClose; htp.bodyclose; htp.htmlclose; exception when others then rollback; wf_core.context('Wf_Lov', 'display_lov_no_frame'); wf_lov.error; end display_lov_no_frame; /* ** Bug 1380107. Avoid problem with multibyte characters in ssp5 url ** getting corrupted. The URL is created when the select button on the ** right of the reassign-to field is clicked in the notification ** details -> Reassign page. Error only occurs with Netscape 4.7X. ** This procedure is created to workaround the issue where ** multibyte characters for the word User (Japanese) are garbled. ** We used to call wfcontext.getMessage("WFA_FIND_USER") in WFReassign.jsp ** Pass in the non-translated key p_display_name_key instead ** of the translated multibyte value in p_display_name. ** This routine will use the key to find the translated value and call ** the procedure display_lov_no_frame. */ procedure display_lov_no_frame_key ( p_lov_name in varchar2 , p_display_name_key in varchar2 , p_validation_callback in varchar2 , p_dest_hidden_field in varchar2 , p_dest_display_field in varchar2 , p_current_value in varchar2 , p_start_row in varchar2 , p_autoquery in varchar2 , p_language in varchar2 ) IS l_display_name varchar2(4000) := NULL; BEGIN -- From wf_core.get_message begin select TEXT into l_display_name from WF_RESOURCES where TYPE = 'WFTKN' and NAME = p_display_name_key and LANGUAGE = p_language and NAME not in ('WF_VERSION','WF_SYSTEM_GUID', 'WF_SYSTEM_STATUS','WF_SCHEMA'); exception when NO_DATA_FOUND then select TEXT into l_display_name from WF_RESOURCES where TYPE = 'WFTKN' and NAME = p_display_name_key and LANGUAGE = 'US' and NAME in ('WF_VERSION','WF_SYSTEM_GUID', 'WF_SYSTEM_STATUS','WF_SCHEMA'); end; display_lov_no_frame(p_lov_name, l_display_name, p_validation_callback, p_dest_hidden_field, p_dest_display_field, p_current_value, p_start_row, p_autoquery, p_language); exception when others then rollback; wf_core.context('Wf_Lov', 'display_lov_no_frame_key'); wf_lov.error; end display_lov_no_frame_key; end WF_LOV; / --show errors package body WF_LOV; commit; exit;