DBA Data[Home] [Help]

PACKAGE BODY: APPS.ORACLEMYPAGE

Source


1 package body OracleMyPage as
2 /* $Header: ICXSEMB.pls 120.0 2005/10/07 12:18:50 gjimenez noship $ */
3 
4 procedure timer(message VARCHAR2) is --defaulted to NULL, removed for GSCC
5 l_hsecs pls_integer;
6 begin
7   select HSECS into l_hsecs from V$TIMER;
8   htp.p('DEBUG ('||l_hsecs||') '||message);htp.nl;
9 htp.p('Debug');
10 end;
11 
12 function openHTML return varchar2 is
13 
14 l_HTML_tag varchar2(240);
15 begin
16 
17   if icx_sec.g_language_code in ('F')
18   then
19     l_HTML_tag := '<HTML DIR="RTL">';
20     OracleMyPage.g_start := 'RIGHT';
21     OracleMyPage.g_end := 'LEFT';
22   else
23     l_HTML_tag := '<HTML DIR="LTR">';
24     OracleMyPage.g_start := 'LEFT';
25     OracleMyPage.g_end := 'RIGHT';
26   end if;
27 
28   return l_HTML_tag;
29 end;
30 
31 function METAtag return varchar2 is
32 
33 begin
34   return '<META HTTP-EQUIV="Content-Type" CONTENT="text/html">';
35 end;
36 
37 function CSStag return varchar2 is
38 
39 begin
40   return '<LINK REL="STYLESHEET" HREF="/OA_HTML/US/ICXSTYLE.css" TYPE="text/css">';
41 end;
42 
43 procedure Regions is
44 
45 l_start                 number;
46 l_timer                 number;
47 l_hsecs                 number;
48 
49 l_page_id               pls_integer;
50 l_refresh_rate          pls_integer;
51 
52 l_known_as              varchar2(240);
53 l_user_name             varchar2(100);
54 l_customize_page        varchar2(340);
55 l_date                  varchar2(100);
56 l_title                 varchar2(340);
57 
58 l_stmt_str              varchar2(2000);
59 
60 cursor left is
61 select b.DISPLAY_SEQUENCE,b.PLUG_ID,b.RESPONSIBILITY_ID,
62        b.RESPONSIBILITY_APPLICATION_ID,b.SECURITY_GROUP_ID,
63        b.MENU_ID,b.ENTRY_SEQUENCE,nvl(b.DISPLAY_NAME,c.PROMPT) prompt,
64        c.DESCRIPTION,a.WEB_HTML_CALL
65 from   fnd_responsibility e,
66        FND_USER_RESP_GROUPS d,
67        FND_FORM_FUNCTIONS a,
68        FND_MENU_ENTRIES_VL c,
69        ICX_PAGE_PLUGS b
70 where  b.PAGE_ID = l_page_id
71 and   b.MENU_ID = c.MENU_ID
72 and    b.ENTRY_SEQUENCE = c.ENTRY_SEQUENCE
73 and    c.FUNCTION_ID = a.FUNCTION_ID
74 and    a.type in ('WWL','WWLG')
75 and    b.RESPONSIBILITY_ID = d.RESPONSIBILITY_ID
76 and    d.user_id = icx_sec.g_user_id
77 and    d.start_date <= sysdate
78 and    (d.end_date is null or d.end_date > sysdate)
79 and    b.RESPONSIBILITY_ID = e.RESPONSIBILITY_ID
80 and    e.start_date <= sysdate
81 and    (e.end_date is null or e.end_date > sysdate)
82 union all
83 select b.DISPLAY_SEQUENCE,b.PLUG_ID,b.RESPONSIBILITY_ID,
84        b.RESPONSIBILITY_APPLICATION_ID,b.SECURITY_GROUP_ID,
85        b.MENU_ID,b.ENTRY_SEQUENCE,
86        nvl(b.DISPLAY_NAME,a.USER_FUNCTION_NAME) prompt,
87        a.DESCRIPTION,a.WEB_HTML_CALL
88 from   FND_FORM_FUNCTIONS_VL a,
89        ICX_PAGE_PLUGS b
90 where  b.PAGE_ID = l_page_id
91 and    b.MENU_ID = -1
92 and    b.ENTRY_SEQUENCE = a.FUNCTION_ID
93 and    a.type in ('WWL','WWLG')
94 order by 1;
95 
96 cursor right is
97 select b.DISPLAY_SEQUENCE,b.PLUG_ID,b.RESPONSIBILITY_ID,
98        b.RESPONSIBILITY_APPLICATION_ID,b.SECURITY_GROUP_ID,
99        b.MENU_ID,b.ENTRY_SEQUENCE,nvl(b.DISPLAY_NAME,c.PROMPT) prompt,
100        c.DESCRIPTION,a.WEB_HTML_CALL
101 from   fnd_responsibility e,
102        FND_USER_RESP_GROUPS d,
103        FND_FORM_FUNCTIONS a,
104        FND_MENU_ENTRIES_VL c,
105        ICX_PAGE_PLUGS b
106 where  b.PAGE_ID = l_page_id
107 and    b.MENU_ID = c.MENU_ID
108 and    b.ENTRY_SEQUENCE = c.ENTRY_SEQUENCE
109 and    c.FUNCTION_ID = a.FUNCTION_ID
110 and    a.type in ('WWR','WWRG')
111 and    b.RESPONSIBILITY_ID = d.RESPONSIBILITY_ID
112 and    d.user_id = icx_sec.g_user_id
113 and    d.start_date <= sysdate
114 and    (d.end_date is null or d.end_date > sysdate)
115 and    b.RESPONSIBILITY_ID = e.RESPONSIBILITY_ID
116 and    e.start_date <= sysdate
117 and    (e.end_date is null or e.end_date > sysdate)
118 order by b.DISPLAY_SEQUENCE;
119 
120 begin
121 
122 select HSECS into l_start from V$TIMER;
123 l_hsecs := l_start;
124 
125 if (icx_sec.validateSession)
126 then
127     begin
128         select PAGE_ID,REFRESH_RATE
129         into   l_page_id,l_refresh_rate
130         from   ICX_PAGES
131         where  USER_ID = icx_sec.g_user_id;
132     exception
133           when NO_DATA_FOUND then
134             htp.p('Add page creation code here');
135     end;
136 
137     fnd_message.set_name('ICX','ICX_LOGIN_CUSTOMIZE');
138     l_customize_page := fnd_message.get;
139     l_date := to_char(sysdate,icx_sec.g_date_format);
140 
141     htp.p('<head>');
142     htp.p('<title>'||l_title||'</title>');
143     if l_refresh_rate > 0
144     then
145       htp.p('<META HTTP-EQUIV="Refresh" CONTENT="'||l_refresh_rate||'">');
146     end if;
147     htp.p('<SCRIPT LANGUAGE="JavaScript">');
148 
149     htp.p('window.name = "root"');
150     htp.p('var function_window = new Object();');
151     htp.p('var counter=0;');-- add support for unique window names 1812147
152     htp.p('var hostname="'||replace((replace(FND_WEB_CONFIG.DATABASE_ID,'-','_')),'.','_')||'";');
153     htp.p('function_window.open = false;');
154 
155 
156     --mputman added 1743710
157     htp.p('function icx_nav_window2(mode, url, resp_app, resp_key, secgrp_key, name){
158              counter=counter+1;
159              hostname=hostname;
160              resp_app=escape(unescape(resp_app));
161              resp_key=escape(unescape(resp_key));
162              secgrp_key=escape(unescape(secgrp_key));
163              url=url+"RESP_APP="+resp_app+"&RESP_KEY="+resp_key+"&SECGRP_KEY="+secgrp_key;
164              if (mode == "WWK" || mode == "FORM") {
165                attributes = "status=yes,resizable=yes,scrollbars=yes,menubar=no,toolbar=no";
166                function_window.win = window.open(url, "function_window"+counter+hostname, attributes);
167                if (function_window.win != null)
168                  if (function_window.win.opener == null)
169                    function_window.win.opener = self;
170                    function_window.win.focus();
171              }
172              else {
173                self.location = url;
174                };
175 
176 
177       };');
178 
179 
180     htp.p('function icx_nav_window(mode, url, name){
181           if (mode == "WWK" || mode == "FORM") {
182             attributes = "status=yes,resizable=yes,scrollbars=yes,menubar=no,toolbar=no";
183             function_window.win = window.open(url, "function_window", attributes);
184             if (function_window.win != null)
185               if (function_window.win.opener == null)
186                 function_window.win.opener = self;
187             function_window.win.focus();
188             }
189           else {
190             self.location = url;
191             };
192         };');
193 
194     htp.p('function topwindowfocus() {
195             if (document.functionwindowfocus.X.value == "TRUE") {
196                function_window.win.focus();
197             }
198           };');
199 
200     htp.p('</SCRIPT>');
201 
202     htp.p('</head>');
203     htp.p('<body bgcolor="'||icx_plug_utilities.bgcolor||'" onfocus="topwindowfocus()">');
204 
205     htp.p('<table border=0 cellspacing=0 cellpadding=0 width=101%>');
206     htp.p('<tr ><td><IMG SRC="/OA_MEDIA/FNDINVDT.gif" width="25" alt=""></td>');
207     htp.p('<td align="'||OracleMyPage.g_start||'">'||l_date||'</td>');
208     htp.p('<td align="'||OracleMyPage.g_end||'" NOWRAP>'||htf.anchor(curl => 'OraclePlugs.Customize?',
209                              ctext => l_customize_page)||'</td>');
210     htp.p('<td><IMG SRC="/OA_MEDIA/FNDINVDT.gif" width="25" alt=""></td></tr></table>');
211 
212     htp.formOpen(curl => 'XXX',
213                cattributes => 'NAME="functionwindowfocus"');
214     htp.formHidden('X','FALSE');
215     htp.formClose;
216 
217 select HSECS into l_timer from V$TIMER;
218 l_timer := (l_timer-l_hsecs)/100;
219 htp.p('<H1>Startup took '||l_timer||' seconds</H1>');
220 
221     htp.p('<table border=0 cellspacing=0 cellpadding=0 width=101%>');
222     htp.p('<tr><td valign="TOP">');
223     htp.p('<table>');
224 
225     for l in left loop
226       htp.p('<tr><td>');
227 
228 select HSECS into l_hsecs from V$TIMER;
229 
230       l_stmt_str := 'begin '||l.web_html_call||
231                     '(p_session_id => '||icx_sec.g_session_id||
232                     ',p_plug_id => '||l.plug_id||
233                     ',p_display_name => '''||replace(l.prompt,'''','''''')||''');'||
234                     ' end;';
235       execute immediate l_stmt_str;
236 
237 select HSECS into l_timer from V$TIMER;
238 l_timer := (l_timer-l_hsecs)/100;
239 htp.p('<H1>Region took '||l_timer||' seconds</H1>');
240 
241     htp.p('</td></tr>');
242     end loop;
243 
244     htp.p('</table>');
245     htp.p('</td><TD VALIGN=TOP BGCOLOR="'||icx_plug_utilities.toolbarcolor||'"><IMG SRC="/OA_MEDIA/FNDINVDT.gif" width="3" alt=""></TD><td valign="TOP">');
246     htp.p('<table>');
247 
248     for r in right loop
249       htp.p('<tr><td>');
250 
251 select HSECS into l_hsecs from V$TIMER;
252 
253       l_stmt_str := 'begin '||r.web_html_call||
254                     '(p_session_id => '||icx_sec.g_session_id||
255                     ',p_plug_id => '||r.plug_id||
256                     ',p_display_name => '''||replace(r.prompt,'''','''''')||''');'||
257                     ' end;';
258       execute immediate l_stmt_str;
259 
260 select HSECS into l_timer from V$TIMER;
261 l_timer := (l_timer-l_hsecs)/100;
262 htp.p('<H1>Region took '||l_timer||' seconds</H1>');
263 
264       htp.p('</td></tr>');
265     end loop;
266 
267     htp.p('</table>');
268     htp.p('</td></tr>');
269     htp.p('</table>');
270 
271 select HSECS into l_timer from V$TIMER;
272 l_timer := (l_timer-l_start)/100;
273 htp.p('<H1>Whole page took '||l_timer||' seconds</H1>');
274 
275     htp.p('</body>');
276     htp.p('</html>');
277 end if; -- vaildateSession
278 
279 end;
280 
281 procedure updateCurrentPageID(
282 	p_session_id	in	varchar2,
283 	p_page_id	in	varchar2
284 ) is
285 l_session_id	number;
286 l_page_id	number;
287 begin
288 	l_session_id := to_number(p_session_id);
289 	l_page_id := to_number(p_page_id);
290 
291 	update icx_sessions
292 	set page_id = p_page_id
293 	where session_id = p_session_id;
294 	commit;
295 exception
296   when no_data_found then
297 	htp.p('session_id = '||p_session_id ||' '||SQLERRM);
298   when others then
299     htp.p(SQLERRM);
300 
301 end updateCurrentPageID;
302 
303 
304 function getRegionURL(
305 	user_id		in	number,
306 	session_id	in	number,
307 	page_id		in	number
308 ) return varchar2 is
309 cursor plugInfo (p_page_id number, p_user_id number) is
310         select  fff.FUNCTION_NAME, fff.TYPE, fff.WEB_HOST_NAME,
311                 fff.WEB_HTML_CALL, fff.FUNCTION_ID, ipp.PLUG_ID,
312                 nvl(ipp.DISPLAY_NAME,fme.PROMPT) display, ipp.DISPLAY_SEQUENCE
313         from    fnd_responsibility fr, FND_USER_RESP_GROUPS furg,
314                 fnd_form_functions fff, fnd_menu_entries_vl fme,
315                 icx_page_plugs ipp
316         where   ipp.PAGE_ID = p_page_id and fme.MENU_ID = ipp.MENU_ID
317         and     fme.ENTRY_SEQUENCE = ipp.ENTRY_SEQUENCE
318         and     fff.FUNCTION_ID = fme.FUNCTION_ID
319         and     ipp.RESPONSIBILITY_ID = furg.RESPONSIBILITY_ID
320         and     ipp.RESPONSIBILITY_APPLICATION_ID = furg.RESPONSIBILITY_APPLICATION_ID
321         and     furg.user_id = p_user_id and furg.start_date <= sysdate
322         and     (furg.end_date is null or furg.end_date > sysdate)
323         and     ipp.RESPONSIBILITY_ID = fr.RESPONSIBILITY_ID
324         and     fr.start_date <= sysdate
325         and     (fr.end_date is null or fr.end_date > sysdate)
326         union
327         select  fff.FUNCTION_NAME, fff.TYPE, fff.WEB_HOST_NAME,
328                 fff.WEB_HTML_CALL, fff.FUNCTION_ID, ipp.PLUG_ID,
329                 nvl(ipp.DISPLAY_NAME,fff.USER_FUNCTION_NAME),
330                 ipp.DISPLAY_SEQUENCE
331         from    fnd_form_functions_vl fff, icx_page_plugs ipp
332         where   ipp.MENU_ID = -1 and ipp.ENTRY_SEQUENCE = fff.FUNCTION_ID
333         and     ipp.PAGE_ID = p_page_id
334 	order by 8;
335 
336 l_page_id       number;
337 l_plug_tab      plugTable;
338 i               number := 0;
339 l_host          varchar2(80) := null;
340 l_html_call     varchar2(240) := null;
341 l_plug_id       number;
342 l_display       varchar2(240) := null;
343 l_temp		varchar2(240);
344 l_url		varchar2(2000);
345 j		number := 0;
346 l_plugType	varchar2(30);
347 l_orientation   varchar2(4) := null;
348 
349 begin
350 
351 l_page_id := page_id;
352 for getPlug in plugInfo(l_page_id,user_id) loop
353         l_host := getPlug.WEB_HOST_NAME;
354         l_html_call := getPlug.WEB_HTML_CALL;
355         l_plug_id := getPlug.PLUG_ID;
356         l_display := getPlug.display;
357 	l_plugType := getPlug.TYPE;
358         if l_host is null then
359                 l_host := owa_util.get_cgi_env('SERVER_NAME');
360         end if;
361         if l_html_call is null then
362                 l_html_call := 'x';
363         end if;
364         if l_display is null then
365                 l_display := 'x';
366 	else
367 		l_temp := '';
368 		for j in 1 .. length(l_display) loop
369 			if ( substr(l_display,j,1) = ' ' ) then
370 				l_temp := l_temp||'%20';
371 			else
372 				l_temp := l_temp||substr(l_display,j,1);
373 			end if;
374 		end loop;
375 		l_display := l_temp;
376         end if;
377 
378 	if ( l_orientation is null ) then
379 		if ( l_plugType = 'WWL' or l_plugType = 'WWLG' ) then
380 			l_orientation := 'Lxx';
381 		else
382 			l_orientation := 'xCR';
383 		end if;
384 	end if;
385 	--
386 	-- %7E = ~, it's a delimiter here
387 	--
388         l_plug_tab(i):=getPlug.FUNCTION_NAME||'%7E'||l_orientation||'%7E'||
389                         l_host||'%7E'||l_html_call||
390                         '%7E'||to_char(getPlug.FUNCTION_ID)||'%7E'||
391                         to_char(l_plug_id)||'%7E'||l_display;
392         i := i + 1;
393 end loop;
394 l_url:= '/OA_JAVA_SERV/oracle.apps.icx.myPage.constructPage';
395 i := 0;
396 for i in 0 .. (l_plug_tab.count - 1) loop
397         if i = 0 then
398                 l_url := l_url||'?arg0='||l_plug_tab(i);
399         else
400                 l_url := l_url||'&'||'arg'||to_char(i)||'='||l_plug_tab(i);
401         end if;
402 end loop;
403 l_url := l_url||'&'||'session_id='||to_char(session_id)||'&'||
404 		'agent='||icx_plug_utilities.getPLSQLagent||'&'||
405 		'page_id='||to_char(l_page_id);
406 return l_url;
407 
408 end getRegionURL;
409 
410 
411 function getNewRegionURL(
412 	main_region_id	in	number,
413 	page_id		in	number,
414 	user_id		in	number,
415 	session_id	in	number
416 ) return varchar2 is
417 
418 l_page_id       number;
419 l_plug_tab      plugTable;
420 i               number := 0;
421 l_plug_id       number;
422 l_temp		varchar2(240);
423 l_url		varchar2(2000);
424 j		number := 0;
425 l_plugType	varchar2(30);
426 l_dbhost	varchar2(80);
427 l_agent		varchar2(80);
428 l_server_name	varchar2(1000);
429 l_server_port	varchar2(100);
430 l_dcd_name	varchar2(1000);
431 
432 begin
433 
434 /* Only support 115P
435     l_dbhost := FND_WEB_CONFIG.DATABASE_ID;
436 
437     --insert into icx_testing values ('g_rendering_mode ' || icx_sec.g_mode_code);
438     --insert into icx_testing values ('session id in getnewregionurl ' || to_char(session_id));
439 
440     if icx_sec.g_mode_code = '115J' then
441 
442 	l_agent := icx_plug_utilities.getPLSQLagent;
443 	-- OAS approach
444 --      l_url:= '/OA_JAVA_SERV/oracle.apps.icx.myPage.renderPage';
445         -- Below is for Servlet approach
446         l_url := fnd_profile.value('APPS_SERVLET_AGENT')||'oracle.apps.icx.myPage.renderPage';
447 	l_server_name := owa_util.get_cgi_env('SERVER_NAME');
448 	l_server_port := owa_util.get_cgi_env('SERVER_PORT');
449 
450       l_url:= l_url||'?db_host='||l_dbhost||'&'||'main_region_id='||to_char(main_region_id)||
451 		    '&'||'page_id='||to_char(page_id)||'&'||'user_id='||to_char(user_id)||
452 		    '&'||'session_id='||to_char(session_id)||'&'||'agent='||l_agent||
453 		    '&'||'server_name='||l_server_name||'&'||'port='||l_server_port;
454 
455 
456     elsif icx_sec.g_mode_code in  ('115P', 'SLAVE') then
457       l_agent := FND_WEB_CONFIG.WEB_SERVER || icx_plug_utilities.getPLSQLagent;
458       l_url := l_agent || 'OracleConfigure.render?p_page_id='||page_id||
459 				       '&'||'p_region_id='||main_region_id||
460 				       '&'||'p_mode=0';
461     end if;
462 */
463 
464       l_agent := FND_WEB_CONFIG.WEB_SERVER || icx_plug_utilities.getPLSQLagent;
465       l_url := l_agent || 'OracleConfigure.render?p_page_id='||page_id||
466                                        '&'||'p_region_id='||main_region_id||
467                                        '&'||'p_mode=0';
468 
469     return l_url;
470 
471 end getNewRegionURL;
472 
473 --************************************************************
474 --                  Home   (global layer)
475 --************************************************************
476 procedure Home(rmode       in     number,
477                i_1         in     VARCHAR2,
478                i_2         in     VARCHAR2,
479                home_url    in     VARCHAR2,
480                i_direct    IN     VARCHAR2,
481                c_sec_grp_id IN    VARCHAR2) IS --mputman hosted update
482 
483 l_user_id     number;
484 l_apps_sso    varchar2(30);
485 l_profile_defined boolean;
486 l_message     varchar2(80);
487 l_session_id  pls_integer;
488 l_mode_code   varchar2(30);
489 l_sgid        NUMBER;
490 e_no_sgid     exception;
491 l_resp_appl_id number;
492 l_responsibility_id number;
493 l_security_group_id number;
494 l_function_id number;
495 l_url         varchar2(2000);
496 c_error_msg		varchar2(2000);
497 c_login_msg		varchar2(2000);
498 b_hosted BOOLEAN DEFAULT NULL;
499 l_hosted_profile VARCHAR2(50);
500 l_expired varchar2(30);
501 
502 begin
503 --htp.p('home global');--mputman debug
504 
505  -- 2802333 nlbarlow APPS_SSO
506  BEGIN
507    SELECT user_id
508    INTO   l_user_id
509    FROM   fnd_user
510    WHERE  user_name = upper(i_1);
511  EXCEPTION
512    WHEN no_data_found  THEN
513      l_user_id := NULL;
514  END;
515 
516  IF l_user_id IS NOT NULL THEN
517    fnd_profile.get_specific
518                (name_z       => 'APPS_SSO',
519                 user_id_z    => l_user_id,
520                 val_z        => l_apps_sso,
521                 defined_z    => l_profile_defined);
522  ELSE
523    l_apps_sso := fnd_profile.value('APPS_SSO');
524  END IF;
525 
526  if l_apps_sso <> 'SSWA'
527  then
528 
529    l_url := fnd_sso_manager.getLoginUrl;
530 
531    owa_util.mime_header('text/html', FALSE);
532    owa_util.redirect_url(l_url);
533    owa_util.http_header_close;
534 
535  else
536 
537 /* Only support 115P
538    if rmode = JAVA_MODE then
539       l_mode_code := '115J';
540    elsif rmode = PLSQL_MODE then
541       l_mode_code := '115P';
542    end if;
543 */
544    l_mode_code := '115P';
545 
546    fnd_profile.get(name    => 'ENABLE_SECURITY_GROUPS',
547                    val     => l_hosted_profile);
548 
549    IF (upper(l_hosted_profile)='HOSTED') THEN
550       b_hosted:=TRUE;
551    END IF;
552 
553       IF b_hosted THEN
554 
555       BEGIN
556       SELECT security_group_id
557       INTO l_sgid
558       FROM fnd_security_groups
559       WHERE security_group_key=c_sec_grp_id;
560       EXCEPTION
561          WHEN no_data_found THEN
562          raise e_no_sgid;
563 
564       END;
565 
566       END IF;
567       icx_sec.g_security_group_id := l_sgid;
568 
569 
570    if i_1 is not null then
571       l_message := icx_sec.validatePassword(c_user_name     => i_1,
572 				   	    c_user_password => i_2,
573 					    n_session_id    => l_session_id,
574                                             c_validate_only => 'Y',
575 					    c_mode_code     => l_mode_code);
576        icx_sec.g_session_id:=l_session_id;--MPUTMAN ADDED 2456610
577        if home_url is not null
578        then
579          l_url := home_url;
580          update ICX_SESSIONS
581          set    HOME_URL = l_url
582          where  SESSION_ID = l_session_id;
583        end if;
584    else
585       l_session_id := icx_sec.getsessioncookie;
586    end if;
587 
588    if (l_session_id > 0
589    and icx_sec.validateSessionPrivate(c_session_id => l_session_id,
590                                       c_validate_only => 'Y'))
591    then
592 
593       -- 1588724 nlbarlow added flags
594       icx_sec.g_validateSession_flag := false;
595 
596       -- 2758891 nlbarlow APPLICATIONS_HOME_PAGE
597       if fnd_profile.value('APPLICATIONS_HOME_PAGE') = 'FWK'
598       then
599         select FUNCTION_ID
600         into   l_function_id
601         from   FND_FORM_FUNCTIONS
602         where  FUNCTION_NAME = 'OAHOMEPAGE';
603 
604         l_url := icx_portlet.createExecLink
605                 (p_application_id => nvl(icx_sec.g_resp_appl_id,'-1'),
606                  p_responsibility_id => nvl(icx_sec.g_responsibility_id,'-1'),
607                  p_security_group_id => nvl(icx_sec.g_security_group_id,'0'),
608                  p_function_id => l_function_id,
609                  p_url_only => 'Y');
610 
611         htp.p('<SCRIPT>');
612         htp.p('top.location="'||l_url||'"');
613         htp.p('</SCRIPT>');
614       ELSIF i_direct IS NOT NULL THEN
615          htp.p('<SCRIPT>');
616          htp.p('top.location="'||i_direct||'"');
617          htp.p('</SCRIPT>');
618       ELSE
619          htp.p('<SCRIPT>');
620          htp.p('top.location="OracleMyPage.home?home_url='||wfa_html.conv_special_url_chars(home_url)||'"');
621          htp.p('</SCRIPT>');
622       END IF; -- FWK
623 
624       icx_sec.g_validateSession_flag := true;
625 
626    else -- session fails
627 
628      begin
629          select 'Y'
630            into  l_expired
631            from  FND_USER
632           where  USER_NAME = UPPER(i_1)
633             and    (PASSWORD_DATE is NULL or
634                    (PASSWORD_LIFESPAN_ACCESSES is not NULL and
635                      nvl(PASSWORD_ACCESSES_LEFT, 0) < 1) or
636                    (PASSWORD_LIFESPAN_DAYS is not NULL and
637                    SYSDATE >= PASSWORD_DATE + PASSWORD_LIFESPAN_DAYS));
638      exception
639              when no_data_found then
640                 l_expired := 'N';
641      end;
642 
643      if l_expired = 'N'
644      then
645        raise e_no_sgid;  -- 2967196
646      elsif fnd_web_sec.validate_login(i_1, i_2) = 'N'
647      then
648        raise e_no_sgid;  -- 2973597
649      end if;
650 
651    end if; -- validateSessionPrivate
652 
653  end if; -- APPS_SSO
654 
655 exception
656 
657    WHEN e_no_sgid THEN
658     --display loginpage with invalid login error
659       fnd_message.set_name('ICX','ICX_SIGNIN_INVALID');
660       c_error_msg := fnd_message.get;
661       fnd_message.set_name('ICX','ICX_SIGNIN_AGAIN');
662       c_login_msg := fnd_message.get;
663       OracleApps.displayLogin
664         (c_message => c_error_msg||' '||c_login_msg,
665          p_home_url => home_url);
666     --
667     NULL;
668    when others then
669         icx_sec.g_validateSession_flag := true;
670         htp.p(SQLERRM);
671 
672 end;
673 
674 --************************************************************
675 --                  Home   (local layer)
676 --************************************************************
677 procedure Home(i_1           in     VARCHAR2,
678                i_2           in     VARCHAR2,
679                home_url      in     VARCHAR2,
680                validate_flag in     VARCHAR2) is
681 
682    --added for 1352780
683    --gets information on Web responsibilities
684    cursor responsibilities_W is
685 select  a.responsibility_id,
686         a.responsibility_name,
687         a.description,
688         a.version,
689         a.responsibility_key,
690         b.responsibility_application_id,
691         fsg.SECURITY_GROUP_NAME,
692         fsg.SECURITY_GROUP_ID,
693         fsg.security_group_key,
694         fa.application_short_name
695 from    FND_SECURITY_GROUPS_VL fsg,
696         fnd_responsibility_vl a,
697         FND_USER_RESP_GROUPS b,
698         FND_APPLICATION fa
699 where   b.user_id = icx_sec.g_user_id
700 and     b.start_date <= sysdate
701 and     (b.end_date is null or b.end_date > sysdate)
702 and     b.RESPONSIBILITY_id = a.responsibility_id
703 and     b.RESPONSIBILITY_application_id = a.application_id
704 and     a.application_id = fa.application_id
705 and     a.version in ('W')
706 and     a.start_date <= sysdate
707 and     (a.end_date is null or a.end_date > sysdate)
708 and     b.SECURITY_GROUP_ID = fsg.SECURITY_GROUP_ID
709 order by version desc,responsibility_name;
710 
711    --added for 1352780
712    -- gets info on Forms responsibilities
713    cursor responsibilities_4 is
714 select  a.responsibility_id,
715         a.responsibility_name,
716         a.description,
717         a.version,
718         a.responsibility_key,
719         b.responsibility_application_id,
720         fsg.SECURITY_GROUP_NAME,
721         fsg.SECURITY_GROUP_ID,
722         fsg.security_group_key,
723         fa.application_short_name
724 from    FND_SECURITY_GROUPS_VL fsg,
725         fnd_responsibility_vl a,
726         FND_USER_RESP_GROUPS b,
727         FND_APPLICATION fa
728 where   b.user_id = icx_sec.g_user_id
729 and     b.start_date <= sysdate
730 and     (b.end_date is null or b.end_date > sysdate)
731 and     b.RESPONSIBILITY_id = a.responsibility_id
732 and     b.RESPONSIBILITY_application_id = a.application_id
733 and     a.application_id = fa.application_id
734 and     a.version in ('4')
735 and     a.start_date <= sysdate
736 and     (a.end_date is null or a.end_date > sysdate)
737 and     b.SECURITY_GROUP_ID = fsg.SECURITY_GROUP_ID
738       order by version desc,responsibility_name;
739 
740 
741    cursor getPages (p_user_id number) is
742 	select ip.page_id, ipt.page_name, ip.main_region_id, ip.page_code, ip.page_type
743 	  from icx_pages ip,
744                icx_pages_tl ipt
745 	 where ip.user_id = p_user_id
746            and ipt.language = userenv('LANG')
747 	   and ip.page_id = ipt.page_id
748            and ip.page_type in ('USER', 'MAIN')
749 	order by ip.page_type desc, ip.sequence_number;
750 
751 l_start                 number;
752 l_timer                 number;
753 l_hsecs                 number;
754 
755 l_function_id           number;
756 l_home_url              varchar2(240);
757 l_message               varchar2(80);
758 l_session_id		pls_integer;
759 l_page_type             varchar2(5);
760 l_known_as		varchar2(240);
761 l_title			varchar2(240);
762 l_helpmsg		varchar2(240);
763 l_helptitle		varchar2(240);
764 l_tabs			icx_cabo.tabTable;
765 l_toolbar		icx_cabo.toolbar;
766 l_tabicons		icx_cabo.tabiconTable;
767 l_url			varchar2(2000);
768 l_page_count		number;
769 l_page_id		number;
770 l_page_index		number;
771 l_page_name		varchar2(80);--mputman reset from 30 to 80
772 l_main_region_id	number;
773 l_agent			varchar2(240);
774 l_host			varchar2(80);
775 l_port			varchar2(30);
776 l_tab_hint		varchar2(2000);
777 l_active_tab_index	number;
778 l_active_page_id	number;
779 --below added for 1352780
780 l_function_code NUMBER; --mputman
781 l_function_count NUMBER; --mputman
782 l_function_type VARCHAR2(30); --mputman
783 l_resps_count NUMBER; --mputman
784 l_resp_type VARCHAR2(10);--mputman
785 p_page_id NUMBER; --mputman
786 l_region_count NUMBER; --mputman
787 p_display_name VARCHAR2(80); --mputman
788 l_target VARCHAR2(30); --mputman
789 p_target_url VARCHAR2(640); --mputman
790 p_toggle VARCHAR2(10); --mputman
791 l_user_id NUMBER; -- mputman
792 l_prompts		icx_util.g_prompts_table; --mputman
793 l_menu_prompt  VARCHAR2(240); --mputman
794 l_menu_count   NUMBER; --mputman
795 l_menu_id NUMBER; --mputman
796 p_new_window VARCHAR2(2000); --mputman
797 -- end additions for 1352780
798 no_nls_exception EXCEPTION; -- mputman 1378862
799 temp_page_id NUMBER; --mputman
800 l_homepage_type         varchar2(10);
801 
802 
803 BEGIN
804 
805 -- nlbarlow null out ids on return to home
806 l_session_id := icx_sec.getsessioncookie;
807 
808 icx_sec.updateSessionContext(p_application_id => '',
809                              p_responsibility_id => '',
810                              p_security_group_id => '',
811                              p_session_id => l_session_id);
812 
813 if (icx_sec.validatesession) THEN --1503616 mputman
814  -- 2758891 nlbarlow APPLICATIONS_HOME_PAGE
815  if (icx_sec.g_mode_code = '115X') then -- Oracle Portal, nlbarlow
816 
817    fnd_profile.get(name => 'APPS_PORTAL',
818                     val => l_url);
819 
820    if l_url IS NULL Then
821       htp.p ('Please contact System Administrator. ');
822       htp.p ('Profile - APPS_PORTAL is null') ;
823    end If ;
824 
825    owa_util.mime_header('text/html', FALSE);
826    owa_util.redirect_url(l_url);
827    owa_util.http_header_close;
828 
829  elsif fnd_profile.value('APPLICATIONS_HOME_PAGE') = 'FWK'
830  then
831     select FUNCTION_ID
832     into   l_function_id
833     from   FND_FORM_FUNCTIONS
834     where  FUNCTION_NAME = 'OAHOMEPAGE';
835 
836     l_url := icx_portlet.createExecLink
837                 (p_application_id => nvl(icx_sec.g_resp_appl_id,'-1'),
838                  p_responsibility_id => nvl(icx_sec.g_responsibility_id,'-1'),
839                  p_security_group_id => nvl(icx_sec.g_security_group_id,'0'),
840                  p_function_id => l_function_id,
841                  p_url_only => 'Y');
842 
843     owa_util.mime_header('text/html', FALSE);
844     owa_util.redirect_url(l_url);
845     owa_util.http_header_close;
846 
847  else -- PHP
848    -- begin 1352780 block
849 
850    p_toggle:=''; --used to decide which cabo container call to use
851    l_function_code:=0;
852    l_target:='_top';
853    icx_util.getprompts(601, 'ICX_OBIS_NAVIGATE', l_title, l_prompts);
854 
855    p_display_name:=l_prompts(1);
856    l_user_id:=icx_sec.g_user_id;
857 
858    select count(*) into l_page_count
859        from icx_pages
860        where user_id = l_user_id;
861 
862    IF (l_page_count=1)THEN
863 
864       SELECT page_id
865         INTO l_page_id
866         FROM icx_pages
867         WHERE user_id = l_user_id;
868 
869       select  count(*)
870          INTO l_region_count
871          FROM icx_page_plugs
872          WHERE page_id=l_page_id;
873 
874 
875   END IF;
876 
877   -- how many valid resps?
878   -- 1584711 nlbarlow remove order by
879   select  count(*) INTO l_resps_count
880   from    FND_SECURITY_GROUPS_VL fsg,
881           FND_RESPONSIBILITY_VL a,
882           FND_USER_RESP_GROUPS b
883   where   b.user_id = l_user_id
884   and     b.start_date <= sysdate
885   and     (b.end_date is null or b.end_date > sysdate)
886   and     b.RESPONSIBILITY_id = a.responsibility_id
887   and     b.RESPONSIBILITY_application_id = a.application_id
888   and     a.start_date <= sysdate
889   and     (a.end_date is null or a.end_date > sysdate)
890   and     b.SECURITY_GROUP_ID = fsg.SECURITY_GROUP_ID;
891 
892   l_homepage_type :=  fnd_profile.value('APPLICATIONS_HOME_PAGE');
893 
894  IF (l_page_count=1) AND (l_resps_count=1) AND (l_region_count=1) AND (l_homepage_type = 'PHP')
895 
896 
897      THEN
898         p_toggle:='Y'; -- will use different call to cabo container
899         if (substr(icx_plug_utilities.getPLSQLagent, 1, 1) = '/') then
900 
901        l_agent := FND_WEB_CONFIG.WEB_SERVER||
902                   substr(icx_plug_utilities.getPLSQLagent,2);
903 
904     else
905        l_agent := FND_WEB_CONFIG.WEB_SERVER||icx_plug_utilities.getPLSQLagent;
906 
907     end if;
908     select  a.version INTO l_resp_type
909 from    FND_SECURITY_GROUPS_VL fsg,
910         FND_RESPONSIBILITY_VL a,
911         FND_USER_RESP_GROUPS b
912 where   b.user_id = l_user_id
913 and     b.start_date <= sysdate
914 and     (b.end_date is null or b.end_date > sysdate)
915 and     b.RESPONSIBILITY_id = a.responsibility_id
916 and     b.RESPONSIBILITY_application_id = a.application_id
917 and     a.start_date <= sysdate
918 and     (a.end_date is null or a.end_date > sysdate)
919 and     b.SECURITY_GROUP_ID = fsg.SECURITY_GROUP_ID
920 order by responsibility_name;
921 
922     IF l_resp_type='4' THEN  -- 4 is for forms
923 
924        FOR r IN responsibilities_4 LOOP
925 
926 
927 
928        p_target_url:=l_agent||'OracleNavigate.menuBypass?p_token='||icx_call.encrypt(r.application_short_name||'*'
929                                                                   ||r.responsibility_key||'*'
930                                                                   ||r.security_group_key||'*'
931                                                                   ||l_agent||'**]');
932        --p_target_url:=p_target_url||'*'||r.security_group_key||'*'||l_agent||'**]';
933 
934           -- p_target_url is the URL passed to cabo
935           -- in this case, it is passing to bypass to launch forms apps
936           -- with the only available responsibility.
937        END LOOP;  --r_4
938 
939     ELSE
940 
941         for r in responsibilities_W loop   -- w is for web
942            select count(*)
943            INTO l_function_count
944            from
945             fnd_responsibility_vl a,
946             fnd_menu_entries_vl b,
947             fnd_form_functions_vl c
948             where a.responsibility_id=r.responsibility_id
949             and a.menu_id=b.menu_id
950             and b.function_id=c.function_id
951             AND b.prompt IS NOT NULL
952             and c.type in ('WWW','WWK','SERVLET','JSP','FORM','INTEROPJSP')
953             and    nvl(c.FUNCTION_ID,-1) not in   -- menu exclusion support 1911095 mputman
954                 (select ACTION_ID
955                    from   FND_RESP_FUNCTIONS
956                    where  RESPONSIBILITY_ID = r.responsibility_id
957                    and    APPLICATION_ID    = r.responsibility_application_id);
958 
959 -- 2712250 nlbarlow
960            SELECT count(*)
961              INTO l_menu_count
962              FROM fnd_menu_entries_vl c
963              WHERE prompt IS NOT NULL
964              and menu_id=(SELECT menu_id
965                             FROM fnd_responsibility_vl
966                             WHERE responsibility_id = r.responsibility_id
967                             AND   APPLICATION_ID    = r.responsibility_application_id)
968              AND     nvl(c.FUNCTION_ID,-1) not in   -- menu exclusion support 1911095 mputman
969                 (select ACTION_ID
970                    from   FND_RESP_FUNCTIONS
971                    where  RESPONSIBILITY_ID = r.responsibility_id
972                    and    APPLICATION_ID    = r.responsibility_application_id)
973              AND nvl(c.SUB_MENU_ID,-1) not IN -- add support for submenu exclusions 2029055
974              (select ACTION_ID
975               from   FND_RESP_FUNCTIONS
976                    where  RESPONSIBILITY_ID = r.responsibility_id
977                    and    APPLICATION_ID    = r.responsibility_application_id);
978 
979 
980 
981            IF ((l_function_count=1) AND (l_menu_count=1)) THEN
982 
983 
984               SELECT c.function_id, nvl(b.prompt,c.user_function_name) prompt,c.TYPE,a.menu_id
985               INTO l_function_code, l_menu_prompt, l_function_type, l_menu_id
986            from
987             fnd_responsibility_vl a,
988             fnd_menu_entries_vl b,
989             fnd_form_functions_vl c
990             where a.responsibility_id=r.responsibility_id
991             and a.menu_id=b.menu_id
992             and b.function_id=c.function_id
993             and b.prompt is not null -- 3275654 nlbarlow
994             and c.type in ('WWW','WWK','SERVLET','JSP','FORM','INTEROPJSP')
995             and nvl(c.FUNCTION_ID,-1) not in -- 3275654 nlbarlow
996                   (select ACTION_ID
997                    from   FND_RESP_FUNCTIONS
998                    where  RESPONSIBILITY_ID = r.responsibility_id
999                    and    APPLICATION_ID    = r.responsibility_application_id);
1000 
1001               p_target_url:=l_agent||'OracleNavigate.menuBypass?p_token='||icx_call.encrypt(r.responsibility_application_id
1002                                                                          ||'*'||r.responsibility_id||'*'
1003                                                                          ||l_function_code||'*'
1004                                                                          ||r.security_group_id||'*'
1005                                                                          ||l_agent||'**]')||'&p_mode=W';
1006           ELSE
1007 
1008               p_target_url:=l_agent||'OracleNavigate.Responsibility?P='||icx_call.encrypt2(r.responsibility_id,icx_sec.g_session_id)||'&'
1009                                                                        ||'D='||wfa_html.conv_special_url_chars(p_display_name)||'&'
1010                                                                        ||'S='||r.security_group_id||'&'
1011                                                                        ||'tab_context_flag=OFF'||'&'
1012                                                                        ||'M=9999';
1013            END IF;
1014              -- p_target_url is the URL passed to cabo
1015              -- in this case, it is either calling menubypass to launch the only function available
1016              -- of it is callin responsibility to paint all of the functions available.
1017 
1018         end loop; -- r_w
1019         END IF;-- resp_type
1020         END IF; --pagecount
1021 --end 1352780 block
1022 
1023 
1024 
1025 
1026    select HSECS into l_start from V$TIMER;
1027    l_hsecs := l_start;
1028 
1029    if validate_flag = 'Y' then
1030       if (icx_sec.validatesession) then
1031           l_session_id := icx_sec.g_session_id;
1032       end if;
1033    else
1034       l_session_id := icx_sec.g_session_id;
1035    end if;
1036 
1037    if (l_session_id > 0) then
1038 
1039        --insert into icx_testing values ('session id  in Home ' || to_char(l_session_id));
1040        --insert into icx_testing values ('g_mode_code in Home *' || icx_sec.g_mode_code);
1041 
1042        l_agent := icx_plug_utilities.getPLSQLagent;
1043 
1044        if home_url is not null then
1045           l_home_url := home_url;
1046 	  update ICX_SESSIONS
1047 	     set HOME_URL = l_home_url
1048 	   where SESSION_ID = l_session_id;
1049           commit;
1050        end if;
1051 
1052 
1053        select substr(nvl(DESCRIPTION,USER_NAME),1,70)
1054          into l_known_as
1055          from FND_USER
1056         where USER_ID = icx_sec.g_user_id;
1057 
1058        -- get active page_id
1059        select page_id into l_active_page_id
1060          from icx_sessions
1061         where session_id = l_session_id;
1062 
1063        fnd_message.set_name('ICX','ICX_LOGIN_WELCOME');
1064        fnd_message.set_token('USER',l_known_as);
1065        l_toolbar.title := icx_util.replace_quotes(fnd_message.get); --added call to replace quotes 2637147
1066        l_toolbar.help_url := 'javascript:top.main.help_window()';
1067        fnd_message.set_name('ICX','ICX_HELP');
1068        l_toolbar.help_mouseover := FND_MESSAGE.GET;
1069        -- icon hint for Tab Adminstration
1070        l_tab_hint := wf_core.translate('ICX_TAB_ADMIN');
1071        l_toolbar.custom_option1_url := l_agent||'icx_define_pages.editpagelist';
1072        l_toolbar.custom_option1_mouseover := l_tab_hint;
1073        l_toolbar.custom_option1_gif := 'OA_MEDIA/FNDMANOP.gif';
1074        l_toolbar.custom_option1_mouseover_gif := 'OA_MEDIA/FNDMANOP.gif';
1075 
1076        l_helpmsg := '';
1077        l_helptitle := '';
1078 
1079        select count(*) into l_page_count
1080        from icx_pages
1081        where user_id = icx_sec.g_user_id
1082        and page_type = 'MAIN';
1083 
1084        if ( l_page_count = 0 ) then
1085 	   -- user has no MAIN page, create a page for user
1086 	       l_page_id := OracleConfigure.createPage(
1087 		     p_page_type => 'MAIN',
1088 		     p_page_name => wf_core.translate('MAIN_MENU'),
1089                      p_validate_flag => 'N');
1090           --add exception raise to prevent messy screen 1378862
1091           IF (l_page_id = 0) THEN
1092              RAISE no_nls_exception;
1093           END IF;
1094        end if;
1095        l_page_index := 0;
1096        for thisPage in getPages(icx_sec.g_user_id) loop
1097 	     l_page_id := thisPage.page_id;
1098 	     l_page_name := thisPage.page_name;
1099 	     l_main_region_id := thisPage.main_region_id;
1100              --htp.p(l_page_id);
1101              if thisPage.page_type <> 'MAIN' then
1102                 temp_page_id:=l_page_id;
1103 		l_tabicons(l_page_index).name := 'edit'||l_page_id;-- mputman added l_page_id for bug1340651
1104 		l_tabicons(l_page_index).iconname := 'OA_HTML/webtools/images/tab_edit_icon.gif';
1105 		l_tabicons(l_page_index).iconposition := 'right';
1106 		l_tabicons(l_page_index).hint := wf_core.translate('MODIFY_HOME');
1107 		l_tabicons(l_page_index).actiontype := 'url';
1108 		l_tabicons(l_page_index).url := l_agent||'OracleConfigure.customize?p_page_id='||l_page_id;--mputman added parameter for bug1340651
1109 		l_tabicons(l_page_index).targetframe := '_top';
1110 
1111                 l_tabs(l_page_index).iconobj := 'edit'||l_page_id;-- mputman added l_page_id for bug1340651
1112              ELSE
1113 
1114       l_page_name := substrb(wf_core.translate('MAIN_MENU'),1,80); --mputman added 1405228
1115 		l_tabicons(l_page_index).name := 'noedit';
1116 		l_tabicons(l_page_index).iconname := null;
1117 		l_tabicons(l_page_index).iconposition := null;
1118 		l_tabicons(l_page_index).hint := null;
1119 		l_tabicons(l_page_index).actiontype := null;
1120 		l_tabicons(l_page_index).url := null;
1121 		l_tabicons(l_page_index).targetframe := null;
1122 
1123                 l_tabs(l_page_index).iconobj := 'noedit';
1124              end if;
1125 
1126 
1127 	     l_tabs(l_page_index).name := thisPage.page_code;
1128 	     l_tabs(l_page_index).text := l_page_name;
1129 	     l_tabs(l_page_index).hint := l_page_name;
1130 	     l_tabs(l_page_index).visible := 'true';
1131 	     l_tabs(l_page_index).enabled := 'true';
1132 	     --l_url := getRegionURL(icx_sec.g_user_id, l_session_id, l_page_id);
1133 	     l_url := getNewRegionURL(l_main_region_id, l_page_id, icx_sec.g_user_id, l_session_id);
1134 	     l_tabs(l_page_index).url := l_url;
1135 
1136 
1137 	     l_page_index := l_page_index + 1;
1138 	     if l_active_page_id is null then
1139 		     l_active_tab_index := 1;
1140 	     else
1141 		     if l_active_page_id = l_page_id then
1142 			     l_active_tab_index := l_page_index;
1143                              l_page_type := thisPage.page_type;
1144 		     end if;
1145 	     end if;
1146        end loop;
1147 
1148        l_toolbar.custom_option3_url := l_agent || 'icx_admin_sig.Startover';
1149        l_toolbar.custom_option3_mouseover :=
1150                         icx_util.getprompt(601,'ICX_OBIS_TOOLBAR',178,'ICX_EXIT');
1151        l_toolbar.custom_option3_gif := 'OA_MEDIA/FNDEXIT.gif';
1152        l_toolbar.custom_option3_mouseover_gif := 'OA_MEDIA/FNDEXIT.gif';
1153        l_toolbar.custom_option3_disabled_gif := 'OA_MEDIA/FNDEXIT.gif';
1154 
1155 
1156 
1157        IF (p_toggle='Y') THEN     --added 1352780 mputman
1158           -- pass URL constructed above (p_target_url) to the cabo container
1159           -- to bypass normal menu painting if options are limited.
1160           icx_cabo.container(p_toolbar    => l_toolbar,
1161 			  p_helpmsg    => l_helpmsg,
1162 			  p_helptitle  => l_helptitle,
1163 			  p_tabicons   => l_tabicons,
1164 			  p_currenttab => l_active_tab_index,
1165 			  p_tabs       => l_tabs,
1166            p_url        => p_target_url);
1167 
1168        ELSE
1169           icx_cabo.container(p_toolbar    => l_toolbar,
1170  p_helpmsg    => l_helpmsg,
1171  p_helptitle  => l_helptitle,
1172  p_tabicons   => l_tabicons,
1173  p_currenttab => l_active_tab_index,
1174  p_tabs       => l_tabs);
1175          END IF;
1176 
1177 
1178    end if;  --l_session_id
1179  end if; -- PHP vs Portal
1180 END IF; --icx_sec.validatesession mputman 1503616
1181 
1182 EXCEPTION
1183    -- added 1378862 mputman
1184    WHEN no_nls_exception THEN
1185       htp.p('ERROR - Translation data has not been installed yet, please apply NLS patch.');htp.nl;
1186   when others then
1187     htp.p(SQLERRM);
1188 
1189 end;
1190 
1191 -- **************************************************************
1192 --               DrawTabContent
1193 -- **************************************************************
1194 procedure DrawTabContent is
1195 
1196 l_message               varchar2(80);
1197 l_session_id		pls_integer;
1198 l_page_type             varchar2(5);
1199 l_known_as		varchar2(240);
1200 l_title			varchar2(240);
1201 l_helpmsg		varchar2(240);
1202 l_helptitle		varchar2(240);
1203 l_tabs			icx_cabo.tabTable;
1204 l_toolbar		icx_cabo.toolbar;
1205 l_tabicons		icx_cabo.tabiconTable;
1206 l_url			varchar2(2000);
1207 l_page_count		number;
1208 l_page_id		number;
1209 l_page_index		number;
1210 l_page_name		varchar2(240);   --Bug 2076740
1211 l_main_region_id	number;
1212 l_agent			varchar2(240);
1213 l_host			varchar2(80);
1214 l_port			varchar2(30);
1215 l_tab_hint		varchar2(2000);
1216 l_active_tab_index	number;
1217 l_active_page_id	number;
1218 
1219      cursor getPages (p_user_id number) is
1220 	select ip.page_id, ipt.page_name, ip.main_region_id, ip.page_code, ip.page_type
1221 	  from icx_pages ip,
1222                icx_pages_tl ipt
1223 	 where ip.user_id = p_user_id
1224            and ipt.language = userenv('LANG')
1225 	   and ip.page_id = ipt.page_id
1226            and ip.page_type in ('USER', 'MAIN')
1227 	order by ip.page_type desc, ip.sequence_number;
1228 
1229 begin
1230 
1231 
1232    if (icx_sec.validatesession) then
1233 
1234        --insert into icx_testing values ('session id  in Home ' || to_char(l_session_id));
1235        --insert into icx_testing values ('g_mode_code in Home *' || icx_sec.g_mode_code);
1236 
1237        l_agent := icx_plug_utilities.getPLSQLagent;
1238 
1239        select substr(nvl(DESCRIPTION,USER_NAME),1,70)
1240          into l_known_as
1241          from FND_USER
1242         where USER_ID = icx_sec.g_user_id;
1243 
1244        -- get active page_id
1245        select page_id into l_active_page_id
1246          from icx_sessions
1247         where session_id = icx_sec.g_session_id;
1248 
1249        fnd_message.set_name('ICX','ICX_LOGIN_WELCOME');
1250        fnd_message.set_token('USER',l_known_as);
1251        l_toolbar.title := icx_util.replace_quotes(fnd_message.get); --added call to replace quotes 2637147
1252        l_toolbar.help_url := 'javascript:top.main.help_window()';
1253        fnd_message.set_name('ICX','ICX_HELP');
1254        l_toolbar.help_mouseover := FND_MESSAGE.GET;
1255        -- icon hint for Tab Adminstration
1256 
1257        l_tab_hint := wf_core.translate('ICX_TAB_ADMIN');
1258 
1259        l_toolbar.custom_option1_url := l_agent||'icx_define_pages.editpagelist';
1260        l_toolbar.custom_option1_mouseover := l_tab_hint;
1261        l_toolbar.custom_option1_gif := 'OA_MEDIA/FNDMANOP.gif';
1262        l_toolbar.custom_option1_disabled_gif := 'OA_MEDIA/FNDMANOP.gif';
1263        l_toolbar.custom_option1_mouseover_gif := 'OA_MEDIA/FNDMANOP.gif';
1264 
1265        l_helpmsg := '';
1266        l_helptitle := '';
1267 
1268        l_page_index := 0;
1269        for thisPage in getPages(icx_sec.g_user_id) loop
1270 	     l_page_id := thisPage.page_id;
1271 	     l_page_name := thisPage.page_name;
1272 	     l_main_region_id := thisPage.main_region_id;
1273 
1274 
1275              if thisPage.page_type <> 'MAIN' then
1276 		l_tabicons(l_page_index).name := 'edit'||l_page_id;-- mputman added l_page_id for bug1340651
1277 		l_tabicons(l_page_index).iconname := 'OA_HTML/webtools/images/tab_edit_icon.gif';
1278 		l_tabicons(l_page_index).iconposition := 'right';
1279 		l_tabicons(l_page_index).hint := wf_core.translate('MODIFY_HOME');
1280 		l_tabicons(l_page_index).actiontype := 'url';
1281 		l_tabicons(l_page_index).url := l_agent||'OracleConfigure.customize?p_page_id='||l_page_id;--mputman for bug1340651
1282 		l_tabicons(l_page_index).targetframe := '_top';
1283 
1284                 l_tabs(l_page_index).iconobj := 'edit'||l_page_id;-- mputman added l_page_id for bug1340651
1285              else
1286                 l_page_name := substrb(wf_core.translate('MAIN_MENU'),1,240);--added for bug 1516684
1287 		l_tabicons(l_page_index).name := 'noedit';
1288 		l_tabicons(l_page_index).iconname := null;
1289 		l_tabicons(l_page_index).iconposition := null;
1290 		l_tabicons(l_page_index).hint := null;
1291 		l_tabicons(l_page_index).actiontype := null;
1292 		l_tabicons(l_page_index).url := null;
1293 		l_tabicons(l_page_index).targetframe := null;
1294 
1295                 l_tabs(l_page_index).iconobj := 'noedit';
1296              end if;
1297 
1298 	     l_tabs(l_page_index).name := thisPage.page_code;
1299 	     l_tabs(l_page_index).text := l_page_name;
1300 	     l_tabs(l_page_index).hint := l_page_name;
1301 	     l_tabs(l_page_index).visible := 'true';
1302 	     l_tabs(l_page_index).enabled := 'true';
1303 
1304              l_url := getNewRegionURL(l_main_region_id, l_page_id, icx_sec.g_user_id, l_session_id);
1305 
1306 	     l_tabs(l_page_index).url := l_url;
1307 
1308 	     l_page_index := l_page_index + 1;
1309 	     if l_active_page_id is null then
1310 		     l_active_tab_index := 1;
1311 	     else
1312 		     if l_active_page_id = l_page_id then
1313 			     l_active_tab_index := l_page_index;
1314                              l_page_type := thisPage.page_type;
1315 		     end if;
1316 	     end if;
1317        end loop;
1318 
1319        l_toolbar.custom_option3_url := l_agent || 'icx_admin_sig.Startover';
1320        l_toolbar.custom_option3_mouseover := icx_util.getprompt(601,'ICX_OBIS_TOOLBAR',178,'ICX_EXIT');
1321        l_toolbar.custom_option3_gif := 'OA_MEDIA/FNDEXIT.gif';
1322        l_toolbar.custom_option3_mouseover_gif := 'OA_MEDIA/FNDEXIT.gif';
1323        l_toolbar.custom_option3_disabled_gif := 'OA_MEDIA/FNDEXIT.gif';
1324        icx_cabo.container(p_toolbar    => l_toolbar,
1325 			  p_helpmsg    => l_helpmsg,
1326 			  p_helptitle  => l_helptitle,
1327 			  p_tabicons   => l_tabicons,
1328 			  p_currenttab => l_active_tab_index,
1329 			  p_tabs       => l_tabs,
1330                           p_url        =>  l_agent || 'OracleNavigate.Responsibility?tab_context_flag=OFF?P='|| icx_call.encrypt2(icx_sec.g_responsibility_id));
1331 
1332    end if;  --icx_sec.validatesession
1333 
1334 end;
1335 
1336 
1337 end OracleMyPage;