create or replace package body odwasrch is /***************************************************************************************** Purpose Search the Repository and present results in result Frame Allow navigation from result frame to: - VHV - Report - Browser - ? Usage Remarks Revision history When Who Construct Revision What ------------------------------------------------------------------------------------------ $revision_history$ 10-Sep-2003 Kannan Parthasarathy - B2881790: Fixed GIF file name. 03-Feb-2003 Kannan Parthasarathy - B2822755: Fix improper tooltip. 25-Jan-2003 Kannan Parthasarathy - B2727189: Escape double quotes in JavaScript. 10-Dec-2002 Kannan Parthasarathy -B2701841 : Fixed. 28-nov-2002 Kannan Parthasarathy - B2688895 Fixed Javascript errors. 14-nov-2002 Kannan Parthasarathy - Fixed OAC p1 violations. 24-sep-2002 Kannan Parthasarathy - References to CDM are hidden from general users 31-jul-2001 Lucas Jellema 3.13 - include join with RM_REPOSITORIES to resolve NLS Issue (bug 1911520) in queries with RM$NLS_ELEMENT_TYPES 27-jul-2001 Lucas Jellema 3.12 - building up the Advanced tab page takes way too long, because of the long list of element type+global name domain names - support for file downloading using the download servlet changes in: * procedure js_dynamic_content 30-mar-2001 Lucas Jellema 3.11 - support Query Library - support search on Dependency Data 01-mar-2001 Lucas Jellema 3.10 - list UE element types 28-feb-2001 Lucas Jellema 3.9 - for a search for EMP% under Ton, no proper results are shown: instead a lot of JavaScript is displayed, without the opening '); end; -- js_showSql procedure js_saveQuery is begin htp.p(' '); end; -- js_saveQuery procedure js_openLibrary is begin htp.p(' '); end; -- js_openLibrary procedure queryFrame ( p_session_id in number , p_mode in varchar2 default 'BASIC' -- values: BASIC, ADVANCED ( ??AUDIT, VERSION) , qName in varchar2 default null -- BASIC , qCaseSensitive in varchar2 default null , qWorkareaIrid in varchar2 default null , qTipVersionsOnly in varchar2 default null , qFolderIrid in varchar2 default null , qFolderIvid in varchar2 default null , qIncludeNested in varchar2 default null , qElementType in varchar2 default null , qIvid in varchar2 default null -- ADVANCED , qIrid in varchar2 default null , qTxtType in varchar2 default null , qTxtContains in varchar2 default null , qFileContains in varchar2 default null , qDepType in varchar2 default null , qGlobalName in varchar2 default null , qGlobalNameType in varchar2 default null , qUsedByIvid in varchar2 default null , qCheckState in varchar2 default null -- VERSION , qRootVersionsOnly in varchar2 default null , qVersionLabel in varchar2 default null , qBranchIrid in varchar2 default null , qCfgIvid in varchar2 default null , qCheckNotesContain in varchar2 default null , qCheckOutUser in varchar2 default null , qCheckedOutAfter in varchar2 default null , qCheckedOutBefore in varchar2 default null , qCheckInUser in varchar2 default null , qCheckedInAfter in varchar2 default null , qCheckedInBefore in varchar2 default null , qCreatedBy in varchar2 default null -- AUDIT , qCreatedAfter in varchar2 default null , qCreatedBefore in varchar2 default null , qChangedBy in varchar2 default null , qChangedAfter in varchar2 default null , qChangedBefore in varchar2 default null , qWastebasket in varchar2 default null , qWhere in varchar2 default null , qQueryId in varchar2 default null , p_run_mode in varchar2 default 'search' -- search, show, saveQuery, execute ) is l_first boolean; l_menu_bar varchar2(4000); l_cdm_used varchar2(1); cursor c_wa is select wa.irid , wa.OWNER , wa.NAME , wa.KIND , wa.DESCRIPTION from sdd_workareas wa order by wa.name ; cursor c_usr is select usr.username , usr.full_user_name from sdw_users usr where usr.username <> 'PUBLIC' -- 1.7 PUBLIC is not a real user and usr.user_type = 1 -- 2.4 exclude Roles UNION select 'USER' username , 'USER' full_user_name from dual order by full_user_name ; cursor c_ete is select net.nls_name name , et.id irid , et.ivid from ci_element_types cet , rm_element_types et , rm$nls_element_types net , rm_repositories rep where cet.short_name = et.short_name and net.etid = et.irid and supertype in ('SHR', 'NSHR') and et.product = 'CI' and et.abstract = 'N' and net.nls_language = rep.nls_language --3.13 and exists ( select null from ck_product_elements pe where pe.element_name = et.name and pe.product_code = 'DESIGN' ) and et.irid not in (5052, 5055) -- filter out the element types that cannot truly serve as PAC -- Specific MCO and LOV union -- User Extended Types select net.nls_name name , et.id irid , et.ivid from rm_element_types et , rm$nls_element_types net , rm_repositories rep where net.etid = et.irid and et.product = 'CI' and et.abstract = 'N' and net.nls_language = rep.nls_language --3.13 and et.user_extension = 'YYY' order by 1 ; cursor c_brh is select brh.name , brh.branch_id irid from i$sdd_branches brh order by brh.name ; cursor c_gnt is select distinct net.nls_name type_name , et.id type_irid from ci_element_types cet , rm_element_types et , rm$nls_element_types net , sdd_global_names gne , rm_repositories rep where net.etid = et.irid and gne.type_id = et.irid and net.nls_language = rep.nls_language --3.13 UNION select distinct initcap(gnd.name) type_name , gnd.irid type_irid from sdd_global_name_domains gnd , sdd_global_names gne where gne.domain_irid = gnd.irid order by type_name ; procedure js_transferQueryForm ( p_mode in varchar2 default 'BASIC' ) is begin -- every field in the queryForm in queryFrame should be transfered to queryForm in resultFrame htp.p(' '); end; -- js_transferQueryForm procedure write_tabbar_image_map is begin -- BASIC htp.p ( ' ' ||'' ); -- ADVANCED htp.p ( '' ); -- VERSION htp.p ( '' ); -- AUDIT htp.p ( '' ||' ' ); end; --write_tabbar_image_map begin l_cdm_used := odwapref.get_value('use_cdm'); -- if an existing Query is indicated, call the procedure loadQueryCriteria that will -- retrieve the query criteria for this predefined query can call queryFrame again -- with proper values for all query parameters (and NULL for qQueryId) if qQueryId is not null then odwaslib.loadQueryCriteria ( p_session_id => p_session_id , p_qlb_id => to_number(qQueryId) ); else -- create session when necessary, refresh session cache, set workarea context -- from here on reference to odwactxt.get_... functions for any context value odwactxt.update_context ( p_session_id => p_session_id , p_package_name => PACKAGE_NAME , p_procedure_name=> 'queryFrame' , p_workarea_irid => to_number( qWorkareaIrid) , p_cfg_ivid => to_number( qCfgIvid) , p_folder_irid => to_number( qFolderIrid) , p_pac_irid => null , p_pac_ivid => null ); htp.htmlOpen; htp.headOpen; cdwp.write_about(package_name, revision_label); js_transferQueryForm( p_mode => p_mode ); odwarobs.js_invoke_robs ( p_type_id => 4845 -- 4844 = FOLDER, 4845 is supertype , p_form_name => 'queryForm' , p_ivid_field => 'qFolderIvid' , p_irid_field => 'qFolderIrid' , p_workarea_irid => to_number(qWorkareaIrid) , p_cfg_ivid => to_number(qCfgIvid) , p_folder_ivid => to_number(qFolderIvid) , p_function_name => 'invokeRobsFolderIrid' , p_wa_field => 'qWorkareaIrid' , p_cfg_field => 'qCfgIvid' ); odwarobs.js_invoke_robs ( p_type_id => 384781276385787681422765648005056569 -- Configuration , p_form_name => 'queryForm' , p_ivid_field => 'qCfgIvid' , p_irid_field => '' , p_function_name => 'invokeRobsCfgIvid' ); odwarobs.js_invoke_robs ( p_type_id => null -- any type , p_form_name => 'queryForm' , p_ivid_field => 'qUsedByIvid' , p_irid_field => '' , p_function_name => 'invokeRobsUsedByIvid' ); odwahelp.js_invoke_help; js_saveQuery; js_openLibrary; js_showSql; cdwp.include_report_styles; htp.headClose; -- -- body -- htp.bodyOpen ( Cattributes => cdwpbase.ifThenElse ( p_run_mode ='execute' , 'onLoad="transferQueryForm();' ||'top.resultFrame.document.queryForm.submit()"' ) ); write_tabbar_image_map; cdwp.tool_tab_header ( p_tool => 'search' , p_tabimage => 'tab_'||lower(p_mode)||'.jpg' , p_mapname => '#tabbarMap' ); -- open table with the Search Input fields cdwp.tableOpen ( p_parameters => 'ALIGN="LEFT" BORDER=0 CELLSPACING=4 ACOLS=4 WIDTH="100%" SUMMARY=""' ); htp.formopen ( curl => 'odwasrch.queryFrame' , cmethod => 'GET' , cattributes => 'NAME="queryForm" ' , ctarget => '' ); htp.p ( ' ' ); htp.p ( ' ' ); htp.p ( ' ' ); if p_mode='BASIC' then -- NAME cdwp.tableRowOpen; -- cdwp.TableDataHeading(p_Heading => 'Name',p_Attributes => 'WIDTH=80'); htp.tableData ( '' ,'RIGHT' , cattributes=> ' VALIGN="TOP" class="t2"' ); htp.p(''); htp.formText ( cname => 'qName' , cvalue => qName , csize => 30 , cmaxlength => 500 , cattributes => 'id=qName' ); htp.p(odwahelp.help_url( p_him_id => 51)); htp.p(''); htp.formCheckBox ( CNAME => 'qCaseSensitive' , CVALUE => 'YES' , CCHECKED => cdwpbase.ifThenElse( qCaseSensitive is not null, 'YES') , CATTRIBUTES => 'id=qCaseSensitive' ); htp.p(odwahelp.help_url( p_him_id => 69)); htp.p(''); -- Element Type htp.tableData (cdwp.add_images('{doc.gif}') ||' ' ,'RIGHT' , cattributes=> 'VALIGN="TOP" class="t2"' ); htp.p(''); htp.formselectopen ( cname => 'qElementType' , cprompt => '' , cattributes => 'id=qElementType' ); htp.p ( '