create or replace package body wmp_portal as function get_nls_language return varchar2 is l_lang varchar2(128) := null; begin if wmp_mode.isClient = true then l_lang := 'us'; else begin execute immediate 'select ~portalSchema.wwctx_api.get_nls_language from dual' into l_lang; exception when others then l_lang := 'us'; end; end if; return l_lang; end; function get_proc_path ( p_url in varchar2, p_schema in varchar2 := wmp_constants.USER_SCHEMA ) return varchar2 is l_schema varchar2(128) := p_schema; l_url varchar2(4000) := p_url; l_path varchar2(4000) := null; begin if wmp_mode.isClient = true then l_schema := get_user; l_path := l_schema || '.' || l_url; else begin execute immediate 'select ~portalSchema.wwctx_api.get_proc_path(:1, :2) from dual' into l_path using l_url, l_schema; exception when others then l_path := null; end; end if; return l_path; end; function get_product_version return varchar2 is l_name varchar2(128) := null; begin if wmp_mode.isClient = false then begin execute immediate 'select ~portalSchema.wwctx_api.get_product_version from dual' into l_name; exception when others then l_name := null; end; end if; return l_name; end; /* wwui_api_portlet.portlet_text( '' , 1) htp.p(wwui_api_portlet.portlet_heading(wmp_api_nls.get_string('50017','50000'), 1)); */ function user_name ( p_id in number ) return varchar2 is l_id number := p_id; l_text varchar2(4000) := null; begin if wmp_mode.isClient = true then return get_user; end if; execute immediate ' declare l_string varchar2(4000) := null; begin l_string := ~portalSchema.wwsec_api.user_name(:1); :2 := l_string; exception when others then null; end; ' using in l_id, out l_text; return l_text; end; function group_name ( p_group_id in number ) return varchar2 is l_id number := p_group_id; l_text varchar2(4000) := null; begin if wmp_mode.isClient = true then return CLIENTGROUPNAME; end if; execute immediate ' declare l_string varchar2(4000) := null; begin l_string := ~portalSchema.wwsec_api.group_name(:1); :2 := l_string; exception when others then null; end; ' using in l_id, out l_text; return l_text; end; function portlet_heading ( p_string in varchar2, p_level in number ) return varchar2 is l_string varchar2(4000) := p_string; l_level number := p_level; l_text varchar2(4000) := null; begin if wmp_mode.isClient = true then return '' || l_string || ''; end if; execute immediate ' declare l_string varchar2(4000) := null; begin l_string := ~portalSchema.wwui_api_portlet.portlet_heading(:1, :2); :3 := l_string; exception when others then null; end; ' using in l_string, in l_level, out l_text; return l_text; end; function portlet_text ( p_string in varchar2, p_level in number ) return varchar2 is l_string varchar2(4000) := p_string; l_level number := p_level; l_text varchar2(4000) := null; begin if wmp_mode.isClient = true then return '' || l_string || ''; end if; execute immediate ' declare l_string varchar2(4000) := null; begin l_string := ~portalSchema.wwui_api_portlet.portlet_text(:1, :2); :3 := l_string; exception when others then null; end; ' using in l_string, in l_level, out l_text; return l_text; end; function group_id( p_name in varchar2 := null ) return number is l_name varchar2(128) := p_name; l_id number := null; begin if wmp_mode.isClient = true then l_id := CLIENTGROUPID; else begin execute immediate 'select ~portalSchema.wwsec_api.group_id(:1) from dual' into l_id using l_name; exception when others then l_id := null; end; end if; return l_id; end; function id( p_user_name in varchar2 := null ) return number is l_user_name varchar2(128) := p_user_name; l_id number := null; begin if wmp_mode.isClient = true then l_id := CLIENTUSERID; else begin execute immediate 'select ~portalSchema.wwsec_api.id(:1) from dual' into l_id using l_user_name; exception when others then l_id := null; end; end if; return l_id; end; procedure set_value ( p_name in varchar2, p_value in varchar2 ) is l_count number := 0; begin select count(*) into l_count from wmp_preferences where path = 'OWBREPOSITORY' and name = lower(p_name); if l_count = 0 then insert into wmp_preferences (PATH, LEVEL_TYPE, LEVEL_ID, NAME, VALUE) values ( 'OWBREPOSITORY', 'S', 0, lower(p_name), p_value ); else update wmp_preferences set value = p_value where path = 'OWBREPOSITORY' and level_type = 'S' and level_id = 0 and name = lower(p_name); end if; commit; exception when others then return; end; function get_value ( p_name in varchar2 ) return varchar2 is l_value varchar2(256) := null; begin select value into l_value from wmp_preferences where path = 'OWBREPOSITORY' and level_type = 'S' and level_id = 0 and name = lower(p_name); return l_value; exception when others then return null; end; function get_user return varchar2 is l_name varchar2(128) := null; begin if wmp_mode.isClient = true then l_name := '%user'; --l_name := get_value('OWBREPOSITORY'); if l_name is null then select user into l_name from dual; end if; else begin execute immediate 'select ~portalSchema.wwctx_api.get_user from dual' into l_name; exception when others then l_name := null; end; end if; return l_name; end; function get_sessionid return NUMBER is l_id number := null; begin if wmp_mode.isClient = true then l_id := CLIENTSESSIONID; else begin execute immediate 'select ~portalSchema.wwctx_api.get_sessionid from dual' into l_id; exception when others then l_id := null; end; end if; return l_id; end; function get_user_id return number is l_id number := null; begin if wmp_mode.isClient = true then l_id := CLIENTUSERID; else begin execute immediate 'select ~portalSchema.wwctx_api.get_user_id from dual' into l_id; exception when others then l_id := null; end; end if; return l_id; end; function group_exists(p_group_id in number) return boolean is l_count number := 0; l_group_id number := p_group_id; begin if wmp_mode.isClient = true then return true; end if; execute immediate ' declare l_group ~portalSchema.wwsec_group$%rowtype; begin l_group := ~portalSchema.wwsec_api.group_info(:1); :2 := 1; exception when others then :2 := 0; end; ' using in l_group_id, out l_count; if l_count> 0 then return true; else return false; end if; end; function is_user_in_group(p_user_id in number, p_group_id in number) return boolean is l_count number := 0; l_user_id number := p_user_id; l_group_id number := p_group_id; begin if wmp_mode.isClient = true then return true; end if; execute immediate ' declare l_count number := 0; begin if ~portalSchema.wwsec_api.is_user_in_group(:1, :2) then l_count := 1; end if; :3 := l_count; end; ' using in l_user_id, in l_group_id, out l_count; if l_count> 0 then return true; else return false; end if; end; function user_exists(p_user_id in number) return boolean is l_count number := 0; l_user_id number := p_user_id; begin if wmp_mode.isClient = true then return true; end if; execute immediate ' declare l_person ~portalSchema.wwsec_person%rowtype; begin l_person := ~portalSchema.wwsec_api.person_info(:1); :2 := 1; exception when others then :2 := 0; end; ' using in l_user_id, out l_count; if l_count> 0 then return true; else return false; end if; end; function get_string ( p_domain in varchar2, p_sub_domain varchar2 default 'all', p_name in varchar2, p_language in varchar2 ) return varchar2 is l_string varchar2(4000) := null; l_domain varchar2(128) := p_domain; l_sub_domain varchar2(128) := p_sub_domain; l_name varchar2(128) := p_name; l_language varchar2(128) := p_language; begin if wmp_mode.isClient = true then select TEXT_STRING into l_string from wwnls_strings$ where lower(domain) = lower(p_domain) and lower(SUB_DOMAIN) = lower(p_sub_domain) and (lower(NAME) = lower(p_name) or lower(NAME) = lower(get_user||'.'||p_name)) and lower(LANGUAGE) = lower(p_language) ; else execute immediate ' declare l_string varchar2(4000); begin l_string := ~portalSchema.wwnls_api.get_string ( p_domain=> :1, p_sub_domain=> :2, p_name=> :3, p_language=> :4 ); :5 := l_string; exception when others then :5 := null; end; ' using in l_domain, in l_sub_domain, in l_name, in l_language, out l_string; end if; return l_string; end; /* if p_language = ENGLISH then l_id := wwnls_api.remove_string(p_domain, l_sub_domain, l_name, p_language); l_id := wwnls_api.add_string(p_domain, l_sub_domain, l_name, p_language, p_value); else wwnls_api.set_string(p_domain, l_sub_domain, l_name, p_language, p_value); end if; */ function add_string ( p_domain in varchar2, p_sub_domain in varchar2 default 'all', p_name in varchar2, p_language in varchar2, p_text in varchar2 ) return number is l_id number; l_string varchar2(4000) := p_text; l_domain varchar2(128) := p_domain; l_sub_domain varchar2(128) := p_sub_domain; l_name varchar2(128) := p_name; l_language varchar2(128) := p_language; begin if wmp_mode.isClient = true then begin insert into wwnls_strings$ ( DOMAIN, SUB_DOMAIN, NAME, LANGUAGE, TEXT_STRING ) values ( l_domain, l_sub_domain, l_name, l_language, l_string ); commit; exception when others then null; end; else execute immediate ' declare l_id number := null; begin l_id := ~portalSchema.wwnls_api.add_string ( p_domain=> :1, p_sub_domain=> :2, p_name=> :3, p_language=> :4, p_text=> :5 ); :6 := l_id; exception when others then :6 := null; end; ' using in l_domain, in l_sub_domain, in l_name, in l_language, in l_string, out l_id; end if; return l_id; end; procedure set_string ( p_domain in varchar2, p_sub_domain in varchar2 default 'all', p_name in varchar2, p_language in varchar2, p_text in varchar2 ) is l_string varchar2(4000) := p_text; l_domain varchar2(128) := p_domain; l_sub_domain varchar2(128) := p_sub_domain; l_name varchar2(128) := p_name; l_language varchar2(128) := p_language; begin if wmp_mode.isClient = true then update wwnls_strings$ set text_string = l_string where lower(domain) = lower(p_domain) and lower(SUB_DOMAIN) = lower(p_sub_domain) and lower(NAME) = lower(p_name) and lower(LANGUAGE) = lower(p_language) ; commit; else execute immediate ' begin ~portalSchema.wwnls_api.set_string ( p_domain=> :1, p_sub_domain=> :2, p_name=> :3, p_language=> :4, p_text=> :5 ); exception when others then null; end; ' using in l_domain, in l_sub_domain, in l_name, in l_language, in l_string; end if; end; procedure remove_string ( p_domain in varchar2, p_sub_domain in varchar2 default 'all', p_name in varchar2, p_language in varchar2 ) is l_domain varchar2(128) := p_domain; l_sub_domain varchar2(128) := p_sub_domain; l_name varchar2(128) := p_name; l_language varchar2(128) := p_language; begin if wmp_mode.isClient = true then delete from wwnls_strings$ where lower(domain) = lower(p_domain) and lower(SUB_DOMAIN) = lower(p_sub_domain) and lower(NAME) = lower(p_name) and lower(LANGUAGE) = lower(p_language) ; commit; else execute immediate ' declare l_row_count number; begin l_row_count := ~portalSchema.wwnls_api.remove_string ( p_domain=> :1, p_sub_domain=> :2, p_name=> :3, p_language=> :4 ); exception when others then null; end; ' using in l_domain, in l_sub_domain, in l_name, in l_language; end if; end; function group_id_list(p_user_name in varchar2) return varchar2 is l_user_name varchar2(128) := p_user_name; l_result varchar2(4000); begin if wmp_mode.isClient = true then return '''' || CLIENTGROUPID || ''''; end if; execute immediate ' declare l_groupid_array wwsec_api.idarray; l_group_name varchar2(250); l_result varchar2(4000); begin l_groupid_array := ~portalSchema.wwsec_api.user_in_groups(p_user_name=>:1); l_result := '''''''' || l_groupid_array(1) || ''''''''; for g in 2..l_groupid_array.count loop l_result := l_result || '','''''' || l_groupid_array(g) || ''''''''; end loop; :2 := l_result; exception when others then null; end; ' using in l_user_name, out l_result; return l_result; end; function is_logged_on return Boolean is l_count number := 0; begin if wmp_mode.isClient = true then return true; end if; execute immediate ' declare l_count number := 0; begin if ~portalSchema.wwctx_api.is_logged_on = true then l_count := 1; end if; :2 := l_count; exception when others then null; end; ' using out l_count; if l_count> 0 then return true; else return false; end if; end; function check_if_logged_on ( p_requested_url in varchar2 := null ) return boolean is l_requested_url varchar2(4000) := p_requested_url; l_count number := 0; begin if wmp_mode.isClient = true then return true; end if; execute immediate ' declare l_count number := 0; begin if ~portalSchema.wwsec_app_priv.check_if_logged_on(:1) = true then l_count := 1; end if; :2 := l_count; exception when others then null; end; ' using in l_requested_url, out l_count; if l_count> 0 then return true; else return false; end if; end; procedure render_css is begin htp.p(' .GroupHeaderid1siteid0{ Background-Color : #336699 ; Height : 20 ; Text-Align : Left ; } .GroupHeaderLinkid1siteid0{ Color : #FFFFFF ; Font-Family : Arial, Helvetica ; Font-Size : 9pt ; Font-Weight : Bold ; } .GroupHeaderTextid1siteid0{ Color : #FFFFFF ; Font-Weight : Bold ; Font-Size : 9pt ; Font-Family : Arial, Helvetica ; } .RegionHeaderid1siteid0{ Background-Color : #336699 ; Height : 20 ; Text-Align : Left ; } .RegionHeaderTextid1siteid0{ Color : #FFFFFF ; Font-Family : Arial, Helvetica ; Font-Size : 9pt ; Font-Weight : Bold ; } .Bodyid1siteid0{ Background-Color : #FFFFFF ; } .applicationtypeid1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .authorid1siteid0{ Font-Size : 8pt ; Font-Family : Arial, Helvetica ; Color : #000000 ; } .createdateid1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .creatorid1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .defaultattributeid1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .descriptionid1siteid0{ Color : #000000 ; Font-Size : 8pt ; Font-Family : Arial, Helvetica ; } .documentsizeid1siteid0{ Font-Family : Arial, Helvetica ; Font-Size : 8pt ; Color : #000000 ; } .expiredateid1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .help_urlid1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .initialpagenameid1siteid0{ Font-Family : Arial, Helvetica ; Font-Size : 8pt ; Color : #000000 ; } .inplacedisplayid1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .itemfunctionid1siteid0{ Color : #000000 ; Font-Size : 8pt ; Font-Family : Arial, Helvetica ; } .keywordsid1siteid0{ Color : #000000 ; Font-Size : 8pt ; Font-Family : Arial, Helvetica ; } .perspectivesid1siteid0{ Color : #000000 ; Font-Size : 8pt ; Font-Family : Arial, Helvetica ; } .portletidid1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .provideridid1siteid0{ Color : #000000 ; Font-Size : 8pt ; Font-Family : Arial, Helvetica ; } .providernameid1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .titleid1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; Font-Weight : Bold ; } .titleorimageid1siteid0{ Color : #336699 ; Font-Family : Arial, Helvetica ; Font-Size : 9pt ; Font-Weight : Bold ; Text-Decoration : Underline ; } .wwsbr_category_id1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .wwsbr_expirationperiod_id1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .wwsbr_itemtype_id1siteid0{ Color : #000000 ; Font-Size : 8pt ; Font-Family : Arial, Helvetica ; } .wwsbr_page_id1siteid0{ Color : #000000 ; Font-Size : 8pt ; Font-Family : Arial, Helvetica ; } .wwsbr_pagegroup_id1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .wwsbr_portletname_id1siteid0{ Font-Family : Arial, Helvetica ; Font-Size : 8pt ; Color : #000000 ; } .wwsbr_updatedate_id1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .wwsbr_updator_id1siteid0{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .LeftCurve{ Background-Attachment : scroll ; Background-Position : left top ; Background-Repeat : no-repeat ; Background-Image : url(' || get_proc_path('wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=FFFFFFl.gif', get_user) ||') ; } .PortletBodyColor{ Background-Color : #FFFFFF ; } .PortletHeaderColor{ Background-Color : #336699 ; } .PortletHeaderLink{ Color : #FFFFFF ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .PortletHeaderStyle{ } .PortletHeaderText{ Color : #FFFFFF ; Font-Family : Arial, Helvetica ; Font-Weight : Bold ; Font-Size : 10pt ; } .PortletHeading1{ Color : #336699 ; Font-Weight : Bold ; Font-Family : Arial, Helvetica ; Font-Size : 9pt ; } .PortletHeading2{ Font-Size : 8pt ; Font-Weight : Bold ; Font-Family : Arial, Helvetica ; Color : #336699 ; } .PortletHeading3{ Color : #336699 ; Font-Family : Arial, Helvetica ; Font-Weight : Bold ; Font-Size : 7pt ; } .PortletHeading4{ Color : #336699 ; Font-Size : 7pt ; Font-Weight : Bold ; Font-Family : Arial, Helvetica ; } .PortletSubHeaderColor{ Background-Color : #EEEEDD ; } .PortletSubHeaderLink{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 9pt ; } .PortletSubHeaderText{ Color : #000000 ; Font-Size : 9pt ; Font-Family : Arial, Helvetica ; } .PortletText1{ Color : #000000 ; Font-Size : 8pt ; Font-Family : Arial, Helvetica ; } .PortletText2{ Color : #000000 ; Font-Family : Arial, Helvetica ; Font-Size : 8pt ; } .PortletText3{ Color : #000000 ; Font-Size : 7pt ; Font-Family : Arial, Helvetica ; } .PortletText4{ Font-Size : 7pt ; Color : #000000 ; Font-Family : Arial, Helvetica ; } .RightCurve{ Background-Attachment : scroll ; Background-Image : url(' || get_proc_path('wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=FFFFFFr.gif', get_user) ||') ; Background-Position : right top ; Background-Repeat : no-repeat ; } .LeftSubTabid1siteid0{ Background-Image : url(' || get_proc_path('wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=FFFFFFsl.gif', get_user) ||') ; Background-Repeat : no-repeat ; Background-Attachment : scroll ; Background-Color : #336699 ; Background-Position : left top ; } .LeftTabBgSlantid1siteid0{ Background-Image : url(' || get_proc_path('wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=FFFFFFtl.gif', get_user) ||') ; Background-Attachment : scroll ; Background-Color : #CCCC99 ; Background-Position : left top ; Background-Repeat : no-repeat ; } .LeftTabForeSlantid1siteid0{ Background-Position : left top ; Background-Repeat : no-repeat ; Background-Image : url(' || get_proc_path('wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=FFFFFFtl.gif', get_user) ||') ; Background-Attachment : scroll ; Background-Color : #336699 ; } .RightSubTabid1siteid0{ Background-Image : url(' || get_proc_path('wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=FFFFFFsr.gif', get_user) ||') ; Background-Position : right top ; Background-Repeat : no-repeat ; Background-Attachment : scroll ; Background-Color : #336699 ; } .RightTabBgCurveid1siteid0{ Background-Color : #CCCC99 ; Background-Position : right top ; Background-Attachment : scroll ; Background-Repeat : no-repeat ; Background-Image : url(' || get_proc_path('wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=FFFFFFtr.gif', get_user) ||') ; } .RightTabForeCurveid1siteid0{ Background-Image : url(' || get_proc_path('wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=FFFFFFtr.gif', get_user) ||') ; Background-Attachment : scroll ; Background-Color : #336699 ; Background-Position : right top ; Background-Repeat : no-repeat ; } .SubTabBgTextid1siteid0{ Font-Size : 11pt ; Font-Weight : Bold ; Color : #CCCC99 ; Font-Family : Arial, Helvetica ; Text-Decoration : none ; } .TabBackgroundColorid1siteid0{ Background-Color : #CCCC99 ; } .TabBackgroundTextid1siteid0{ Color : #003366 ; Font-Size : 10pt ; Font-Family : Arial, Helvetica ; Text-Decoration : none ; } .TabForegroundColorid1siteid0{ Background-Color : #336699 ; } .TabForegroundTextid1siteid0{ Font-Family : Arial, Helvetica ; Font-Size : 10pt ; Font-Weight : Bold ; Text-Decoration : none ; Color : #FFFFFF ; } .RegionNoBorder{} .RegionBorder { border:#336699 1px solid; } .RegionHeaderColor { background-color:#FFFFFF; border:#336699 0px solid } .PageColor { background-color:#FFFFFF} '); end; function get_background_image return varchar2 is begin if wmp_mode.isClient = true then return get_user || '.wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=opbgimg.gif'; else return '/images/opbgimg.gif'; end if; end; function get_pobtrans_image return varchar2 is begin if wmp_mode.isClient = true then return get_user || '.wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=pobtrans.gif'; else return '/images/pobtrans.gif'; end if; end; function get_home_image return varchar2 is begin if wmp_mode.isClient = true then return get_user || '.wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=home.gif'; else return '/images/home.gif'; end if; end; function get_help_image return varchar2 is begin if wmp_mode.isClient = true then return get_user || '.wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=helpl.gif'; else return '/images/helpl.gif'; end if; end; function get_home_url return varchar2 is begin if wmp_mode.isClient = true then return get_user || '.wmp_api_call.home' ; else return wmp_constants.PORTAL_SCHEMA || '.home'; end if; end; function get_logout_url return varchar2 is l_url varchar2(4000) := null; begin if wmp_mode.isClient = true then l_url := 'logmeoff'; else begin execute immediate 'select ~portalSchema.wwsec_app_priv.get_logout_url from dual' into l_url; exception when others then l_url := null; end; end if; return l_url; end; procedure logout is begin owa_sec.set_protection_realm(get_home_url); end; function get_image (p_image in varchar2) return varchar2 is begin if wmp_mode.isClient = true then return get_user || '.wmp_api_doc.show_binary_doc' || chr(63) || 'p_doc_name=' || p_image; else return '/images/' || p_image; end if; end; function get_browser_schema return varchar2 is l_name varchar2(128) := null; begin if wmp_mode.isClient = true then l_name := get_user; else l_name := wmp_constants.USER_SCHEMA; end if; return l_name; end; end wmp_portal;