DBA Data[Home] [Help]

PACKAGE BODY: APPS.ORACLEPLUGS

Source


1 package body OraclePlugs as
2 /* $Header: ICXSEPB.pls 120.1 2005/10/07 14:21:10 gjimenez noship $ */
3 
4 TYPE object IS RECORD (
5         location           varchar2(30),
6         display_sequence   pls_integer,
7         type               varchar2(30),
8         resp_appl_id       pls_integer,
9         security_group_id  pls_integer,
10         responsibility_id  pls_integer,
14         function_id        pls_integer,
11         parent_menu_id     pls_integer,
12         entry_sequence     pls_integer,
13         menu_id            pls_integer,
15         function_type      varchar2(30),
16         level              pls_integer,
17         prompt             varchar2(240),
18         description        varchar2(240));
19 
20 TYPE objectTable IS TABLE OF object index by binary_integer;
21 
22 type l_v80_table is table of varchar2(80) index by binary_integer;
23 
24 g_nulllist       objectTable;
25 g_list           objectTable;
26 g_executablelist objectTable;
27 
28 procedure timer(message varchar2 default NULL) is
29 l_hsecs pls_integer;
30 begin
31     select HSECS into l_hsecs from V$TIMER;
32     htp.p('DEBUG ('||l_hsecs||') '||message);htp.nl;
33 end;
34 
35 --  ***********************************************
36 --      Procedure listMenuEntries
37 --  ***********************************************
38 procedure listMenuEntries(p_object in object) is
39 
40 l_index         pls_integer;
41 l_object        object;
42 l_count		pls_integer;
43 
44 cursor  menuentries is
45 select  prompt,
46         description,
47         sub_menu_id,
48 	entry_sequence
49 from    fnd_menu_entries_vl
50 where   menu_id = p_object.parent_menu_id
51 and	sub_menu_id is not null
52 order by entry_sequence;
53 
54 cursor  functionentries is
55 select  b.prompt,
56         b.description,
57         b.function_id,
58         b.entry_sequence,
59 	a.type
60 from    fnd_form_functions a,
61 	fnd_menu_entries_vl b
62 where   b.menu_id = p_object.parent_menu_id
63 and	a.function_id = b.function_id
64 and     a.type = p_object.function_type
65 order by entry_sequence;
66 
67 begin
68 
69 select  count(*)
70 into    l_count
71 from    fnd_menu_entries
72 where   menu_id = p_object.parent_menu_id
73 and     sub_menu_id is not null;
74 
75 if l_count > 0
76 then
77     for m in menuentries loop
78         l_object.resp_appl_id := p_object.resp_appl_id;
79         l_object.security_group_id := p_object.security_group_id;
80         l_object.responsibility_id := p_object.responsibility_id;
81         l_object.parent_menu_id := m.sub_menu_id;
82         l_object.function_type := p_object.function_type;
83         l_object.level := p_object.level+1;
84         l_object.prompt := p_object.prompt;
85         l_object.description := p_object.description;
86         listMenuEntries(p_object =>l_object);
87     end loop; -- menuentries
88 end if;
89 
90 for f in functionentries loop
91     l_index := g_list.COUNT;
92     g_list(l_index).type := 'FUNCTION';
93     g_list(l_index).resp_appl_id := p_object.resp_appl_id;
94     g_list(l_index).security_group_id := p_object.security_group_id;
95     g_list(l_index).responsibility_id := p_object.responsibility_id;
96     g_list(l_index).parent_menu_id := p_object.parent_menu_id;
97     g_list(l_index).entry_sequence := f.entry_sequence;
98     g_list(l_index).function_id := f.function_id;
99     g_list(l_index).function_type := f.type;
100     g_list(l_index).level := p_object.level;
101     if f.prompt is not null
102     then
103         g_list(l_index).prompt := f.prompt;
104         if f.description is not null
105         then
106             g_list(l_index).description := f.description;
107         else
108             g_list(l_index).description := f.prompt;
109         end if;
110     else
111         g_list(l_index).prompt := f.description;
112         g_list(l_index).description := f.description;
113     end if;
114 end loop; -- menuentries
115 
116 exception
117     when others then
118         htp.p(SQLERRM);
119 
120 end;
121 
122 procedure listResponsibility(p_object in object) is
123 
124 l_object		object;
125 
126 begin
127 
128 l_object.resp_appl_id := p_object.resp_appl_id;
129 l_object.security_group_id := p_object.security_group_id;
130 l_object.responsibility_id := p_object.responsibility_id;
131 l_object.parent_menu_id := p_object.parent_menu_id;
132 l_object.function_type := p_object.function_type;
133 l_object.level := p_object.level+1;
134 l_object.prompt := p_object.prompt;
135 l_object.description := p_object.description;
136 listMenuEntries(p_object =>l_object);
137 
138 exception
139     when others then
140         htp.p(SQLERRM);
141 
142 end;
143 
144 procedure plugRename(Z in varchar2) is
145 
146 l_title varchar2(80);
147 l_prompts icx_util.g_prompts_table;
148 
149 begin
150 
151 if(icx_sec.validateSession)
152 then
153     icx_util.getprompts(601, 'ICX_OBIS_FAVORITE_RENAME', l_title, l_prompts);
154 
155     htp.p('<html>');
156     htp.p('<head>');
157     htp.p('<title>'||l_title||'</title>');
158     htp.p('</head>');
159     htp.p('<body bgcolor="'||icx_plug_utilities.bgcolor||'" onload="Javascrpit:window.focus()">');
160 
161     htp.p('<SCRIPT LANGUAGE="JavaScript">');
162 
163     htp.p('function loadName() {
164         var temp=parent.opener.parent.document.'||Z||'.C.selectedIndex;
165 
166         document.renamePlug.NAME.value = parent.opener.parent.document.'||Z||'.C.options[temp].text;
167         }');
168 
169     htp.p('function saveRename() {
170         var temp=parent.opener.parent.document.'||Z||'.C.selectedIndex;
171 
172 
173         if (document.renamePlug.NAME.value == "")
177         if instr(owa_util.get_cgi_env('HTTP_USER_AGENT'),'MSIE') = 0
174            alert("'||l_prompts(1)||'");
175         else {
176         parent.opener.parent.document.'||Z||'.C.options[temp].text = document.renamePlug.NAME.value;');
178         then
179             htp.p('parent.opener.parent.history.go(0);');
180         end if;
181         htp.p('window.close();
182         };
183         }');
184 
185     htp.p('</SCRIPT>');
186 
187     htp.formOpen('javascript:saveRename()','POST','','','NAME="renamePlug"');
188     htp.tableOpen;
189     htp.tableRowOpen;
190     htp.tableData(l_prompts(1), 'RIGHT');
191     htp.tableData(htf.formText(cname => 'NAME',
192                                csize => '35',
193                                cmaxlength => '50'), 'LEFT');
194     htp.tableRowClose;
195     htp.tableRowOpen;
196     htp.p('<td align=center colspan=2>');
197     htp.p('<table width="100%"><tr>');
198     htp.p('<td align="right" width="50%">');
199     icx_plug_utilities.buttonLeft(l_prompts(2),'javascript:saveRename()','FNDJLFOK.gif');
200     htp.p('</td><td align="right" width="50%">');
201     icx_plug_utilities.buttonRight(l_prompts(3),'javascript:window.close()','FNDJLFCN.gif');
202     htp.p('</td></tr></table>');
203     htp.p('</td>');
204     htp.tableRowClose;
205     htp.tableClose;
206     htp.formClose;
207 
208     htp.p('<SCRIPT LANGUAGE="JavaScript">loadName();</SCRIPT>');
209 
210     htp.bodyClose;
211     htp.htmlClose;
212 
213 end if;
214 
215 exception
216     when others then
217         htp.p(SQLERRM);
218 
219 end;
220 
221 procedure Colors(p_text in varchar2) is
222 
223 type varchar2table is table of varchar2(30) index by binary_integer;
224 
225 l_color_schemes varchar2table;
226 l_color_scheme varchar2(30);
227 
228 begin
229 
230 l_color_schemes(0) := 'BL';
231 l_color_schemes(1) := 'BR';
232 l_color_schemes(2) := 'GR';
233 l_color_schemes(3) := 'GY';
234 l_color_schemes(4) := 'YL';
235 l_color_schemes(5) := 'IN';
236 
237 select COLOR_SCHEME
238 into   l_color_scheme
239 from   ICX_PAGE_COLOR_SCHEME
240 where  USER_ID = icx_sec.g_user_id;
241 
242 htp.p('<table width="70%"><tr>');
243 
244 htp.p('<td align=right>'||p_text||'</td>');
245 
246 for i in l_color_schemes.FIRST..l_color_schemes.LAST loop
247   if l_color_schemes(i) = l_color_scheme
248   then
249     htp.p('<td width=20 align=right><input type=radio name="N" CHECKED value="'||l_color_schemes(i)||'" ></td>');
250   else
251     htp.p('<td width=20 align=right><input type=radio name="N" value="'||l_color_schemes(i)||'" ></td>');
252   end if;
253   htp.p('<td align=left><img src="/OA_MEDIA/FND'||l_color_schemes(i)||'CLR.gif"></td>');
254 end loop;
255 
256 htp.p('</tr></table>');
257 
258 end;
259 
260 procedure Refresh(p_page_id in number,
261                   p_refresh in varchar2) is
262 
263 l_lookup_codes icx_util.g_lookup_code_table;
264 l_lookup_meanings icx_util.g_lookup_meaning_table;
265 l_selected number;
266 
267 begin
268 
269 icx_util.getLookups('ICX_REFRESH', l_lookup_codes, l_lookup_meanings);
270 
271 select nvl(REFRESH_RATE,0)
272 into   l_selected
273 from   ICX_PAGES
274 where  USER_ID = icx_sec.g_user_id
275 and    PAGE_ID = p_page_id;
276 
277 htp.p('<table><tr><td>'||p_refresh||'</td><td>');
278 htp.formSelectOpen('O');
279 for i in 1..l_lookup_codes.COUNT-2 loop
280   if l_selected = l_lookup_codes(i)
281   then
282     htp.formSelectOption(l_lookup_meanings(i),'CHECKED','VALUE="'||l_lookup_codes(i)||'"');
283   else
284     htp.formSelectOption(l_lookup_meanings(i),'','VALUE="'||l_lookup_codes(i)||'"');
285   end if;
286 end loop;
287 htp.formSelectClose;
288 htp.p('</td></tr></table>');
289 
290 end;
291 
292 procedure Customize(p_session_id pls_integer default null,
293                     p_page_id    pls_integer default null) is
294 
295 TYPE entry IS RECORD (
296         resp_appl_id        number,
297         security_group_id   number,
298         responsibility_id   number,
299         responsibility_name varchar2(100),
300         menu_id             number,
301         entry_sequence      number,
302         prompt              varchar2(240),
303         description         varchar2(240),
304         function_id         number,
305         type                varchar2(30));
306 
307 TYPE entryTable IS TABLE OF entry index by binary_integer;
308 
309 l_session_id pls_integer;
310 l_page_id    pls_integer;
311 l_language_code varchar2(30);
312 l_counter               pls_integer;
313 l_object		object;
314 l_left_names            l_v80_table;
315 l_left_ids              l_v80_table;
316 l_right_names           l_v80_table;
317 l_right_ids             l_v80_table;
318 l_title varchar2(80);
319 l_prompts icx_util.g_prompts_table;
320 l_message varchar2(2000);
321 l_initialize varchar2(80);
322 r_initialize varchar2(80);
323 l_history varchar2(240);
324 l_resp_counter number;
325 l_prompt_length number;
326 l_index number;
327 l_entries entryTable;
328 l_entries_null entryTable;
329 
330 cursor  left_menu_entries is
331 select  b.responsibility_application_id,
332         b.security_group_id,
333         a.responsibility_id,
334         a.responsibility_name,
335 	a.menu_id,
336         c.entry_sequence,
337         c.prompt,
338         c.description,
339         d.function_id,
340         d.type
341 from    fnd_form_functions d,
342         fnd_menu_entries_vl c,
346 and     b.start_date <= sysdate
343         fnd_responsibility_vl a,
344         FND_USER_RESP_GROUPS b
345 where   b.user_id = icx_sec.g_user_id
347 and     (b.end_date is null or b.end_date > sysdate)
348 and     b.RESPONSIBILITY_application_id = a.application_id
349 and     b.responsibility_id = a.responsibility_id
350 and     a.version = 'W'
351 and     a.start_date <= sysdate
352 and     (a.end_date is null or a.end_date > sysdate)
353 and     a.menu_id = c.menu_id
354 and     c.function_id = d.function_id
355 and     d.type in ('WWL','WWLG')
356 and     d.function_name <> 'ICX_NAVIGATE_PLUG'
357 order by prompt;
358 
359 cursor  right_menu_entries is
360 select  b.responsibility_application_id,
361         b.security_group_id,
362         a.responsibility_id,
363         a.responsibility_name,
364         a.menu_id,
365         c.entry_sequence,
366         c.prompt,
367         c.description,
368         d.function_id,
369         d.type
370 from    fnd_form_functions d,
371         fnd_menu_entries_vl c,
372         fnd_responsibility_vl a,
373         FND_USER_RESP_GROUPS b
374 where   b.user_id = icx_sec.g_user_id
375 and     b.start_date <= sysdate
376 and     (b.end_date is null or b.end_date > sysdate)
377 and     b.RESPONSIBILITY_application_id = a.application_id
378 and     b.responsibility_id = a.responsibility_id
379 and     a.version = 'W'
380 and     a.start_date <= sysdate
381 and     (a.end_date is null or a.end_date > sysdate)
382 and     a.menu_id = c.menu_id
383 and     c.function_id = d.function_id
384 and     d.type in ('WWR','WWRG')
385 order by prompt;
386 
387 cursor left is
388 select b.DISPLAY_SEQUENCE,b.PLUG_ID,b.RESPONSIBILITY_ID,
389        b.RESPONSIBILITY_APPLICATION_ID,b.SECURITY_GROUP_ID,
390        b.MENU_ID,b.ENTRY_SEQUENCE,nvl(b.DISPLAY_NAME,c.PROMPT) prompt,
391        c.DESCRIPTION
392 from   fnd_responsibility e,
393        FND_USER_RESP_GROUPS d,
394        FND_FORM_FUNCTIONS a,
395        FND_MENU_ENTRIES_VL c,
396        ICX_PAGE_PLUGS b
397 where  b.PAGE_ID = l_page_id
398 and   b.MENU_ID = c.MENU_ID
399 and    b.ENTRY_SEQUENCE = c.ENTRY_SEQUENCE
400 and    c.FUNCTION_ID = a.FUNCTION_ID
401 and    a.type in ('WWL','WWLG')
402 and    b.RESPONSIBILITY_ID = d.RESPONSIBILITY_ID
403 and    d.user_id = icx_sec.g_user_id
404 and    d.start_date <= sysdate
405 and    (d.end_date is null or d.end_date > sysdate)
406 and    b.RESPONSIBILITY_ID = e.RESPONSIBILITY_ID
407 and    e.start_date <= sysdate
408 and    (e.end_date is null or e.end_date > sysdate)
409 union all
410 select b.DISPLAY_SEQUENCE,b.PLUG_ID,b.RESPONSIBILITY_ID,
411        b.RESPONSIBILITY_APPLICATION_ID,b.SECURITY_GROUP_ID,
412        b.MENU_ID,b.ENTRY_SEQUENCE,nvl(b.DISPLAY_NAME,a.USER_FUNCTION_NAME) prompt,
413        a.DESCRIPTION
414 from   FND_FORM_FUNCTIONS_VL a,
415        ICX_PAGE_PLUGS b
416 where  b.PAGE_ID = l_page_id
417 and    b.MENU_ID = -1
418 and    b.ENTRY_SEQUENCE = a.FUNCTION_ID
419 and    a.type in ('WWL','WWLG')
420 order by 1;
421 
422 cursor right is
423 select b.DISPLAY_SEQUENCE,b.PLUG_ID,b.RESPONSIBILITY_ID,
424        b.RESPONSIBILITY_APPLICATION_ID,b.SECURITY_GROUP_ID,
425        b.MENU_ID,b.ENTRY_SEQUENCE,nvl(b.DISPLAY_NAME,c.PROMPT) prompt,
426        c.DESCRIPTION
427 from   fnd_responsibility e,
428        FND_USER_RESP_GROUPS d,
429        FND_FORM_FUNCTIONS a,
430        FND_MENU_ENTRIES_VL c,
431        ICX_PAGE_PLUGS b
432 where  b.PAGE_ID = l_page_id
433 and    b.MENU_ID = c.MENU_ID
434 and    b.ENTRY_SEQUENCE = c.ENTRY_SEQUENCE
435 and    c.FUNCTION_ID = a.FUNCTION_ID
436 and    a.type in ('WWR','WWRG')
437 and    b.RESPONSIBILITY_ID = d.RESPONSIBILITY_ID
438 and    d.user_id = icx_sec.g_user_id
439 and    d.start_date <= sysdate
440 and    (d.end_date is null or d.end_date > sysdate)
441 and    b.RESPONSIBILITY_ID = e.RESPONSIBILITY_ID
442 and    e.start_date <= sysdate
443 and    (e.end_date is null or e.end_date > sysdate)
444 order by b.DISPLAY_SEQUENCE;
445 
446 begin
447 
448 if p_session_id is null
449 then
450     l_session_id := icx_sec.getsessioncookie;
451 else
452     l_session_id := p_session_id;
453 end if;
454 
455 if icx_sec.validateSessionPrivate(l_session_id)
456 then
457 
458     if p_page_id is null
459     then
460         select PAGE_ID
461         into   l_page_id
462         from   ICX_PAGES
463         where  USER_ID = icx_sec.g_user_id;
464     else
465         l_page_id := p_page_id;
466     end if;
467 
468     l_initialize := '1234567890123456789012345678901234567890';
469     r_initialize := '1234567890123456789012345678901234567890';
470 
471     if instr(owa_util.get_cgi_env('HTTP_USER_AGENT'),'MSIE') > 0
472     then
473         l_history := '';
474     else
475         l_history := 'history.go(0);';
476     end if;
477 
478     icx_util.getprompts(601, 'ICX_OBIS_CUSTOMIZATION', l_title, l_prompts);
479 
480     htp.p('<html>');
481     htp.p('<head>');
482     htp.p('<title>'||l_title||'</title>');
483     htp.p('</head>');
484     htp.p('<body bgcolor="'||icx_plug_utilities.bgcolor||'">');
485 
486     htp.p('<SCRIPT LANGUAGE="JavaScript">');
487 
488     fnd_message.set_name('ICX','ICX_OBIS_SELECT_OPTION');
489     l_message := icx_util.replace_quotes(fnd_message.get);
490 
491     htp.p('function selectFrom() {
492         alert("'||l_message||'")
493         }');
494 
495     htp.p('function addLeftTo() {
496         var temp=document.Left.B.selectedIndex;
497 
498         if (temp < 0)
499           selectFrom();
500         else {
504               if (document.Left.C.options[end-1].value == "")
501           if (document.Left.B[temp].value != "") {
502             var end=document.Left.C.length;
503             if (end > 0)
505                 end = end - 1;
506             var totext=document.Left.B[temp].text;;
507             var tovalue=document.Left.B[temp].value + "@!$#";
508 	    document.Left.C.options[end] = new Option(totext,tovalue);
509             document.Left.C.selectedIndex = end;
510             '||l_history||'
511             }
512           }
513         }');
514 
515     htp.p('function addRightTo() {
516         var temp=document.Right.B.selectedIndex;
517 
518         if (temp < 0)
519           selectFrom();
520         else {
521           if (document.Right.B[temp].value != "") {
522             var end=document.Right.C.length;
523             if (end > 0)
524               if (document.Right.C.options[end-1].value == "")
525                 end = end - 1;
526             var totext=document.Right.B[temp].text;;
527             var tovalue=document.Right.B[temp].value + "@!$#";
528             document.Right.C.options[end] = new Option(totext,tovalue);
529             document.Right.C.selectedIndex = end;
530             '||l_history||'
531             }
532           }
533         }');
534 
535 
536     fnd_message.set_name('ICX','ICX_OBIS_SELECT_SELECTION');
537     l_message := icx_util.replace_quotes(fnd_message.get);
538 
539     htp.p('function selectTo() {
540         alert("'||l_message||'")
541         }');
542 
543     htp.p('function upLeftTo() {
544         var temp=document.Left.C.selectedIndex;
545         var end=document.Left.C.length;
546         if (document.Left.C.options[end-1].value == "")
547             end = end - 1;
548 
549         if (temp < 0)
550 	  selectTo();
551         else
552 	  if (temp != 0) {
553           document.Left.C.options[end] = new Option(document.Left.C.options[temp].text,document.Left.C.options[temp].value);
554           document.Left.C.options[temp] = new Option(document.Left.C.options[temp-1].text,document.Left.C.options[temp-1].value);
555           document.Left.C.options[temp-1] = new Option(document.Left.C.options[end].text,document.Left.C.options[end].value);
556           document.Left.C.options[end] = null;
557           document.Left.C.selectedIndex = temp-1;
558           };
559         }');
560 
561     htp.p('function upRightTo() {
562         var temp=document.Right.C.selectedIndex;
563         var end=document.Right.C.length;
564         if (document.Right.C.options[end-1].value == "")
565             end = end - 1;
566 
567         if (temp < 0)
568           selectTo();
569         else
570           if (temp != 0) {
571           document.Right.C.options[end] = new Option(document.Right.C.options[temp].text,document.Right.C.options[temp].value);
572           document.Right.C.options[temp] = new Option(document.Right.C.options[temp-1].text,document.Right.C.options[temp-1].value);
573           document.Right.C.options[temp-1] = new Option(document.Right.C.options[end].text,document.Right.C.options[end].value);
574           document.Right.C.options[end] = null;
575           document.Right.C.selectedIndex = temp-1;
576           };
577         }');
578 
579     htp.p('function downLeftTo() {
580         var temp=document.Left.C.selectedIndex;
581         var end=document.Left.C.length;
582         if (document.Left.C.options[end-1].value == "")
583             end = end - 1;
584 
585         if (temp < 0)
586           selectTo();
587         else
588           if (temp != end-1) {
589           document.Left.C.options[end] = new Option(document.Left.C.options[temp].text,document.Left.C.options[temp].value);
590           document.Left.C.options[temp] = new Option(document.Left.C.options[temp+1].text,document.Left.C.options[temp+1].value);
591           document.Left.C.options[temp+1] = new Option(document.Left.C.options[end].text,document.Left.C.options[end].value);
592           document.Left.C.options[end] = null;
593           document.Left.C.selectedIndex = temp+1;
594           };
595         }');
596 
597     htp.p('function downRightTo() {
598         var temp=document.Right.C.selectedIndex;
599         var end=document.Right.C.length;
600         if (document.Right.C.options[end-1].value == "")
601             end = end - 1;
602 
603         if (temp < 0)
604           selectTo();
605         else
606           if (temp != end-1) {
607           document.Right.C.options[end] = new Option(document.Right.C.options[temp].text,document.Right.C.options[temp].value);
608           document.Right.C.options[temp] = new Option(document.Right.C.options[temp+1].text,document.Right.C.options[temp+1].value);
609           document.Right.C.options[temp+1] = new Option(document.Right.C.options[end].text,document.Right.C.options[end].value);
610           document.Right.C.options[end] = null;
611           document.Right.C.selectedIndex = temp+1;
612           };
613         }');
614 
615     l_message := icx_util.replace_quotes(l_prompts(11))||': ';
616 
617     htp.p('function open_new_browser(url,x,y){
618         var attributes = "resizable=yes,scrollbars=yes,toolbar=no,width="+x+",height="+ y;
619         var new_browser = window.open(url, "new_browser", attributes);
620         if (new_browser != null) {
621             if (new_browser.opener == null)
622                 new_browser.opener = self;
623             window.name = ''OracleCustomizationroot'';
624             new_browser.location.href = url;
625             }
626         }');
627 
628     htp.p('function renameLeftTo() {
629         var temp=document.Left.C.selectedIndex;
630 
631         if (temp < 0)
632           selectTo();
633         else
637     fnd_message.set_name('ICX','ICX_CANNOT_DELETE_PLUG');
634           open_new_browser(''OraclePlugs.plugRename?Z=Left'',400,110);
635         }');
636 
638     l_message := icx_util.replace_quotes(fnd_message.get);
639 
640     htp.p('function deleteLeftTo() {
641         var temp=document.Left.C.selectedIndex;
642 
643         if (temp < 0)
644           selectTo();
645         else {
646          var nav=document.Left.C.options[temp].value;
647          nav = nav.split("@!$#");
648          if (nav[2] != "-1") {
649           document.Left.C.options[temp] = null;
650           '||l_history||'
651          }
652          else
653           alert("'||l_message||'");
654         };
655         }');
656 
657     htp.p('function renameRightTo() {
658         var temp=document.Right.C.selectedIndex;
659 
660         if (temp < 0)
661           selectTo();
662         else
663           open_new_browser(''OraclePlugs.plugRename?Z=Right'',400,110);
664         }');
665 
666 
667     htp.p('function deleteRightTo() {
668         var temp=document.Right.C.selectedIndex;
669 
670         if (temp < 0)
671           selectTo();
672         else {
673             document.Right.C.options[temp] = null;
674             '||l_history||'
675             };
676         }');
677 
678     htp.p('function saveCustomization() {
679         var endLeft=document.Left.C.length;
680         var endRight=document.Right.C.length;
681         var refresh=document.Right.O.selectedIndex;
682 
683         for (var i=0; i<endLeft; i++)
684             document.updateCustomization.X.value = document.updateCustomization.X.value + "+" + document.Left.C.options[i].value + "@!$#" + document.Left.C.options[i].text;
685 
686 	document.updateCustomization.X.value = document.updateCustomization.X.value + "+";
687 
688         for (var i=0; i<endRight; i++)
689             document.updateCustomization.Y.value = document.updateCustomization.Y.value + "+" + document.Right.C.options[i].value + "@!$#" + document.Right.C.options[i].text;
690 
691         document.updateCustomization.Y.value = document.updateCustomization.Y.value + "+";
692 
693         for (var i=0; i<document.Right.N.length; i++)
694             if (document.Right.N[i].checked)
695                document.updateCustomization.N.value = document.Right.N[i].value;
696 
697         document.updateCustomization.O.value = document.Right.O.options[refresh].value;
698 
699         document.updateCustomization.submit();
700         }');
701 
702         icx_admin_sig.help_win_script('ICXPHP', null, 'FND');
703 
704     htp.p('</SCRIPT>');
705 
706     icx_plug_utilities.toolbar(p_text => l_title,
707                                p_language_code => icx_sec.g_language_code,
708                                p_disp_help => 'Y',
709                                p_disp_mainmenu => 'N',
710                                p_disp_menu => 'N');
711 
712     htp.formOpen('OraclePlugs.updateCustomization','POST','','','NAME="updateCustomization"');
713     htp.formHidden('X');
714     htp.formHidden('Y');
715     htp.formHidden('Z',icx_call.encrypt2(l_page_id,l_session_id));
716     htp.formHidden('N');
717     htp.formHidden('O');
718     htp.formClose;
719 
720     fnd_message.set_name('ICX','ICX_CUSTOMIZE_HOME_PAGE');
721     l_message := fnd_message.get;
722 
723     htp.p('<table width="100%" border=0 cellspacing=0 cellpadding=0>');
724     htp.p('<tr><td width=5%></td><td width=90%><I>'||l_message||'</I></td><td width=5%></td></tr>');
725     htp.p('</table>');
726 
727   htp.formOpen('','POST','','','NAME="Left"');
728   htp.p('<table width="100%" border=0 cellspacing=0 cellpadding=0>');  -- Main
729   htp.tableRowOpen;
730   htp.p('<td align=center valign=top>');
731     htp.p('<table width="10%" border=0 cellspacing=0 cellpadding=0 valign=top>'); -- Left
732     htp.p('<tr><td colspan=2 align=center>');
733     htp.p('<B>'||l_prompts(13)||'</B>');
734     htp.p('</td></tr>');
735     htp.p('<tr><td>');
736     htp.p(l_prompts(2));
737     htp.p('</td><td>');
738     htp.p(l_prompts(3));
739     htp.p('</td></tr>');
740     htp.p('<tr><td>');
741     htp.p('<table border=0 cellspacing=0 cellpadding=0><tr><td>');  -- Options
742     htp.p('<select name="B" size=10>');
743     l_index := 0;
744     l_entries := l_entries_null;
745     for l in left_menu_entries loop
746         l_entries(l_index).prompt := nvl(l.prompt,l.description);
747         l_entries(l_index).description := l.description;
748         l_entries(l_index).responsibility_name := l.responsibility_name;
749         l_entries(l_index).resp_appl_id := l.responsibility_application_id;
750         l_entries(l_index).security_group_id := l.security_group_id;
751         l_entries(l_index).responsibility_id := l.responsibility_id;
752         l_entries(l_index).menu_id:= l.menu_id;
753         l_entries(l_index).entry_sequence := l.entry_sequence;
754         l_entries(l_index).function_id := l.function_id;
755         l_entries(l_index).type := l.type;
756         l_index := l_index + 1;
757     end loop;
758     if l_entries.COUNT > 0 then
759     for i in l_entries.FIRST..l_entries.LAST loop
760       if (i > l_entries.FIRST and l_entries(i).prompt = l_entries(i-1).prompt)
761       then
762         if l_entries(i).type <> 'WWLG'
763         then
764           htp.formSelectOption(cvalue => l_entries(i).prompt||' ('||l_entries(i).responsibility_name||')',
765                                cattributes => 'VALUE = "'||l_entries(i).resp_appl_id||'@!$#'||l_entries(i).security_group_id||'@!$#'||
766           l_entries(i).responsibility_id||'@!$#'||l_entries(i).menu_id||'@!$#'||l_entries(i).entry_sequence||'@!$#'||l_entries(i).prompt||'"');
767         end if;
771         then
768       elsif (i < l_entries.LAST and l_entries(i).prompt = l_entries(i+1).prompt)
769       then
770         if l_entries(i).type = 'WWLG'
772           htp.formSelectOption(cvalue => l_entries(i).prompt,
773                                cattributes => 'VALUE = "'||l_entries(i).resp_appl_id||'@!$#'||l_entries(i).security_group_id||'@!$#'||
774           l_entries(i).responsibility_id||'@!$#'||l_entries(i).menu_id||'@!$#'||l_entries(i).entry_sequence||'@!$#'||l_entries(i).prompt||'"');
775         else
776           htp.formSelectOption(cvalue => l_entries(i).prompt||' ('||l_entries(i).responsibility_name||')',
777                                cattributes => 'VALUE = "'||l_entries(i).resp_appl_id||'@!$#'||l_entries(i).security_group_id||'@!$#'||
778           l_entries(i).responsibility_id||'@!$#'||l_entries(i).menu_id||'@!$#'||l_entries(i).entry_sequence||'@!$#'||l_entries(i).prompt||'"');
779         end if;
780       else
781         htp.formSelectOption(cvalue => l_entries(i).prompt,
782                              cattributes => 'VALUE = "'||l_entries(i).resp_appl_id||'@!$#'||l_entries(i).security_group_id||'@!$#'||
783         l_entries(i).responsibility_id||'@!$#'||l_entries(i).menu_id||'@!$#'||l_entries(i).entry_sequence||'@!$#'||l_entries(i).prompt||'"');
784       end if;
785     end loop;
786     end if;
787     htp.formSelectClose;
788     htp.p('</td><td align="left">');
789     htp.p('<table><tr><td>'); -- Add
790     htp.p('<A HREF="javascript:addLeftTo()" onMouseOver="window.status='''||icx_util.replace_onMouseOver_quotes(l_prompts(4))||''';return true">
791            <image src="/OA_MEDIA/FNDRTARW.gif" alt="'||icx_util.replace_alt_quotes(l_prompts(4))||'" BORDER="0"></A>');
792     htp.p('</td></tr></table>'); -- Add
793     htp.p('</td></tr></table>'); -- Options
794     htp.p('</td><td>');
795     htp.p('<table border=0 cellspacing=0 cellpadding=0><tr><td>'); -- Selection
796     htp.p('<select name="C" size=10>');
797     for l in left loop
798         htp.formSelectOption(cvalue => nvl(l.prompt,l.description),
799                              cattributes => 'VALUE = "'||l.responsibility_application_id||'@!$#'||l.security_group_id||'@!$#'||l.responsibility_id||'@!$#'||l.menu_id||'@!$#'||l.entry_sequence||'@!$#'||l.prompt||'@!$#'||l.plug_id||'"');
800     end loop;
801     htp.formSelectClose;
802     htp.p('</td><td align="left">');
803     htp.p('<table><tr><td align="left" valign="bottom">'); -- Up and Down
804     htp.p('<A HREF="javascript:upLeftTo()" onMouseOver="window.status='''||icx_util.replace_onMouseOver_quotes(l_prompts(5))||''';return true">
805            <image src="/OA_MEDIA/FNDUPARW.gif" alt="'||icx_util.replace_alt_quotes(l_prompts(5))||'" BORDER="0"></A>');
806     htp.p('</td></tr><tr><td align="left" valign="top">');
807     htp.p('<A HREF="javascript:downLeftTo()" onMouseOver="window.status='''||icx_util.replace_onMouseOver_quotes(l_prompts(6))||''';return true">
808            <image src="/OA_MEDIA/FNDDNARW.gif" alt="'||icx_util.replace_alt_quotes(l_prompts(6))||'" BORDER="0"></A>');
809     htp.p('</td></tr></table>'); -- Up and Down
810     htp.p('</td></tr></table>'); -- Selection
811     htp.p('</td></tr>');
812     htp.p('<tr><td></td><td>');
813     htp.p('<table><tr><td>');  -- Buttons
814     icx_plug_utilities.buttonBoth(l_prompts(10),'javascript:renameLeftTo()');
815     htp.p('</td><td>');
816     icx_plug_utilities.buttonBoth(l_prompts(11),'javascript:deleteLeftTo()');
817     htp.p('</td></tr></table>');  -- Buttons
818     htp.p('</td></tr>');
819     htp.p('</table>');  -- Left
820     htp.formClose;
821 
822   htp.p('</td><td width=1 bgcolor=#000000><IMG src="/OA_MEDIA/FNDINVDT.gif" width=1></td><td></td><td align=center valign=top>');
823 
824     htp.formOpen('','POST','','','NAME="Right"');
825     htp.p('<table width="10%" border=0 cellspacing=0 cellpadding=0 valign=top>'); -- right
826     htp.p('<tr><td colspan=2 align=center>');
827     htp.p('<B>'||l_prompts(14)||'</B>');
828     htp.p('</td></tr>');
829 
830     htp.p('<tr><td>');
831     htp.p(l_prompts(2));
832     htp.p('</td><td>');
833     htp.p(l_prompts(3));
834     htp.p('</td></tr>');
835     htp.p('<tr><td>');
836     htp.p('<table border=0 cellspacing=0 cellpadding=0><tr><td>');  -- Options
837     htp.p('<select name="B" size=10>');
838     l_index := 0;
839     l_entries := l_entries_null;
840     for r in right_menu_entries loop
841         l_entries(l_index).prompt := nvl(r.prompt,r.description);
842         l_entries(l_index).description := r.description;
843         l_entries(l_index).responsibility_name := r.responsibility_name;
844         l_entries(l_index).resp_appl_id := r.responsibility_application_id;
845         l_entries(l_index).security_group_id := r.security_group_id;
846         l_entries(l_index).responsibility_id := r.responsibility_id;
847         l_entries(l_index).menu_id:= r.menu_id;
848         l_entries(l_index).entry_sequence := r.entry_sequence;
849         l_entries(l_index).function_id := r.function_id;
850         l_entries(l_index).type := r.type;
851         l_index := l_index + 1;
852     end loop;
853     if l_entries.COUNT > 0 then
854     for i in l_entries.FIRST..l_entries.LAST loop
855       if (i > l_entries.FIRST and l_entries(i).prompt = l_entries(i-1).prompt)
856       then
857         if l_entries(i).type <> 'WWRG'
858         then
859           htp.formSelectOption(cvalue => l_entries(i).prompt||' ('||l_entries(i).responsibility_name||')',
860                                cattributes => 'VALUE = "'||l_entries(i).resp_appl_id||'@!$#'||l_entries(i).security_group_id||'@!$#'||
861           l_entries(i).responsibility_id||'@!$#'||l_entries(i).menu_id||'@!$#'||l_entries(i).entry_sequence||'@!$#'||l_entries(i).prompt||'"');
862         end if;
863       elsif (i < l_entries.LAST and l_entries(i).prompt = l_entries(i+1).prompt)
864       then
865         if l_entries(i).type = 'WWRG'
866         then
867           htp.formSelectOption(cvalue => l_entries(i).prompt,
871           htp.formSelectOption(cvalue => l_entries(i).prompt||' ('||l_entries(i).responsibility_name||')',
868                                cattributes => 'VALUE = "'||l_entries(i).resp_appl_id||'@!$#'||l_entries(i).security_group_id||'@!$#'||
869           l_entries(i).responsibility_id||'@!$#'||l_entries(i).menu_id||'@!$#'||l_entries(i).entry_sequence||'@!$#'||l_entries(i).prompt||'"');
870         else
872                                cattributes => 'VALUE = "'||l_entries(i).resp_appl_id||'@!$#'||l_entries(i).security_group_id||'@!$#'||
873           l_entries(i).responsibility_id||'@!$#'||l_entries(i).menu_id||'@!$#'||l_entries(i).entry_sequence||'@!$#'||l_entries(i).prompt||'"');
874         end if;
875       else
876         htp.formSelectOption(cvalue => l_entries(i).prompt,
877                              cattributes => 'VALUE = "'||l_entries(i).resp_appl_id||'@!$#'||l_entries(i).security_group_id||'@!$#'||
878           l_entries(i).responsibility_id||'@!$#'||l_entries(i).menu_id||'@!$#'||l_entries(i).entry_sequence||'@!$#'||l_entries(i).prompt||'"');
879       end if;
880     end loop;
881     end if;
882     htp.formSelectClose;
883     htp.p('</td><td align="left">');
884     htp.p('<table><tr><td>'); -- Add
885     htp.p('<A HREF="javascript:addRightTo()" onMouseOver="window.status='''||icx_util.replace_onMouseOver_quotes(l_prompts(4))||''';return true">
886            <image src="/OA_MEDIA/FNDRTARW.gif" alt="'||icx_util.replace_alt_quotes(l_prompts(4))||'" BORDER="0"></A>');
887     htp.p('</td></tr></table>'); -- Add
888     htp.p('</td></tr></table>'); -- Options
889     htp.p('</td><td>');
890     htp.p('<table border=0 cellspacing=0 cellpadding=0><tr><td>'); -- Selection
891     htp.p('<select name="C" size=10>');
892     for r in right loop
893         htp.formSelectOption(cvalue => nvl(r.prompt,r.description),
894                              cattributes => 'VALUE = "'||r.responsibility_application_id||'@!$#'||r.security_group_id||'@!$#'||r.responsibility_id||'@!$#'||r.menu_id||'@!$#'||r.entry_sequence||'@!$#'||r.prompt||'@!$#'||r.plug_id||'"');
895     end loop;
896     htp.formSelectClose;
897     htp.p('</td><td align="left">');
898     htp.p('<table><tr><td align="left" valign="bottom">'); -- Up and Down
899     htp.p('<A HREF="javascript:upRightTo()" onMouseOver="window.status='''||icx_util.replace_onMouseOver_quotes(l_prompts(5))||''';return true">
900            <image src="/OA_MEDIA/FNDUPARW.gif" alt="'||icx_util.replace_alt_quotes(l_prompts(5))||'" BORDER="0"></A>');
901     htp.p('</td></tr><tr><td align="left" valign="top">');
902     htp.p('<A HREF="javascript:downRightTo()" onMouseOver="window.status='''||icx_util.replace_onMouseOver_quotes(l_prompts(6))||''';return true">
903            <image src="/OA_MEDIA/FNDDNARW.gif" alt="'||icx_util.replace_alt_quotes(l_prompts(6))||'" BORDER="0"></A>');
904     htp.p('</td></tr></table>'); -- Up and Down
905     htp.p('</td></tr></table>'); -- Selection
906     htp.p('</td></tr>');
907     htp.p('<tr><td></td><td>');
908     htp.p('<table><tr><td>');  -- Buttons
909     icx_plug_utilities.buttonBoth(l_prompts(10),'javascript:renameRightTo()');
910     htp.p('</td><td>');
911     icx_plug_utilities.buttonBoth(l_prompts(11),'javascript:deleteRightTo()');
912     htp.p('</td></tr></table>');  -- Buttons
913     htp.p('</td><td></td></tr>');
914     htp.p('</table>');  -- right
915 
916 
917   htp.p('</td></tr>');
918 
919   htp.p('<tr>
920   <td height=1 bgcolor=#000000><IMG src="/OA_MEDIA/FNDINVDT.gif" height=1></td>
921   <td height=1 bgcolor=#000000><IMG src="/OA_MEDIA/FNDINVDT.gif" height=1></td>
922   <td height=1 width=10 bgcolor=#000000><IMG src="/OA_MEDIA/FNDINVDT.gif" height=1 width=10></td>
923   <td height=1 bgcolor=#000000><IMG src="/OA_MEDIA/FNDINVDT.gif" height=1></td>
924   </tr>');
925 
926   htp.p('<tr><td colspan="4"><BR></td></tr>');
927 
928   htp.p('<tr><td align=center colspan=4>');
929 
930     Colors(l_prompts(15));
931 
932   htp.p('</td></tr>');
933 
934   htp.p('<tr><td colspan="4"><BR></td></tr>');
935 
936   htp.p('<tr><td align=center colspan=4>');
937 
938     Refresh(l_page_id,l_prompts(12));
939 
940   htp.p('</td></tr>');
941 
942   htp.p('<tr><td colspan="4"><BR></td></tr>');
943 
944   htp.p('<tr><td colspan=4>');
945 
946     htp.p('<table width="100%"><tr>');
947     htp.p('<td align="right" width="50%">');
948     icx_plug_utilities.buttonLeft(l_prompts(7),'javascript:saveCustomization()','FNDJLFOK.gif');
949     htp.p('</td><td align="right" width="50%">');
950     icx_plug_utilities.buttonRight(l_prompts(8),'javascript:history.go(-1)','FNDJLFCN.gif');
951     htp.p('</td></tr></table>');
952 
953   htp.p('</td></tr>');
954   htp.tableClose;
955   htp.formClose;
956 
957     htp.bodyClose;
958     htp.htmlClose;
959 
960 end if;
961 
962 exception
963     when others then
964         htp.p(SQLERRM);
965 
966 end;
967 
968 procedure updateCustomization(X in varchar2,
969                               Y in varchar2,
970                               Z in pls_integer,
971                               N in varchar2 default NULL,
972                               O in pls_integer default 0) is
973 
974 type integerTable is table of number index by binary_integer;
975 
976 type varchar2Table is table of varchar2(240) index by binary_integer;
977 
978 l_session_id            pls_integer;
979 l_user_id		pls_integer;
980 l_page_id               pls_integer;
981 l_plug_id               integerTable;
982 l_resp_appl_id          integerTable;
983 l_security_group_id     integerTable;
984 l_responsibility_id	integerTable;
985 l_menu_id               integerTable;
986 l_entry_sequence	integerTable;
987 l_display_name_old      varchar2Table;
988 l_display_name          varchar2Table;
992 r_responsibility_id     integerTable;
989 r_plug_id               integerTable;
990 r_resp_appl_id          integerTable;
991 r_security_group_id     integerTable;
993 r_menu_id               integerTable;
994 r_entry_sequence        integerTable;
995 r_display_name_old      varchar2Table;
996 r_display_name          varchar2Table;
997 l_line			varchar2(240);
998 l_line_length		pls_integer;
999 l_point1		pls_integer;
1000 l_point2		pls_integer;
1001 l_point3		pls_integer;
1002 l_point4		pls_integer;
1003 l_point5		pls_integer;
1004 l_point6		pls_integer;
1005 l_point7		pls_integer;
1006 l_point_1_2		pls_integer;
1007 l_point_2_3		pls_integer;
1008 l_point_3_4		pls_integer;
1009 l_point_4_5		pls_integer;
1010 l_point_5_6		pls_integer;
1011 l_point_6_7		pls_integer;
1012 l_length		pls_integer;
1013 l_index			pls_integer;
1014 l_count                 pls_integer;
1015 l_nextcount		pls_integer;
1016 l_lastcount		pls_integer;
1017 l_occurence		pls_integer;
1018 l_function_id		pls_integer;
1019 l_function_type         varchar2(30);
1020 l_prompt		varchar2(80);
1021 l_url			varchar2(240);
1022 l_plsql_call		varchar2(2000);
1023 l_call                  pls_integer;
1024 l_dummy                 pls_integer;
1025 l_toolbar               varchar2(30);
1026 l_banner                varchar2(30);
1027 l_heading               varchar2(30);
1028 l_background            varchar2(30);
1029 
1030 cursor plugs is
1031 select *
1032 from   ICX_PAGE_PLUGS
1033 where  PAGE_ID = l_page_id;
1034 
1035 begin
1036 
1037 if icx_sec.validateSession
1038 then
1039     l_session_id := icx_sec.getID(icx_sec.PV_SESSION_ID);
1040     l_user_id := icx_sec.getID(icx_sec.PV_USER_ID);
1041     l_page_id := icx_call.decrypt2(Z);
1042 
1043     l_length := length(X);
1044     l_index := 0;
1045     l_occurence := 1;
1046     l_lastcount := 1;
1047     while l_lastcount <= l_length loop
1048 	l_nextcount := instr(X,'+',1,l_occurence);
1049         if l_lastcount <> l_nextcount
1050 	then
1051 	  l_line_length := l_nextcount-l_lastcount;
1052           l_line := substr(X,l_lastcount,l_line_length);
1053 	  l_point1 := instr(l_line,'@!$#',1,1);
1054 	  l_point2 := instr(l_line,'@!$#',1,2);
1055 	  l_point3 := instr(l_line,'@!$#',1,3);
1056 	  l_point4 := instr(l_line,'@!$#',1,4);
1057 	  l_point5 := instr(l_line,'@!$#',1,5);
1058 	  l_point6 := instr(l_line,'@!$#',1,6);
1059 	  l_point7 := instr(l_line,'@!$#',1,7);
1060 	  l_point_1_2 := l_point2 - l_point1 - 4;
1061 	  l_point_2_3 := l_point3 - l_point2 - 4;
1062 	  l_point_3_4 := l_point4 - l_point3 - 4;
1063 	  l_point_4_5 := l_point5 - l_point4 - 4;
1064 	  l_point_5_6 := l_point6 - l_point5 - 4;
1065 	  l_point_6_7 := l_point7 - l_point6 - 4;
1066 
1067           l_resp_appl_id(l_index) := substr(l_line,1,l_point1-1);
1068           l_security_group_id(l_index) := substr(l_line,l_point1+4,l_point_1_2);
1069           l_responsibility_id(l_index) := substr(l_line,l_point2+4,l_point_2_3);
1070           l_menu_id(l_index) := substr(l_line,l_point3+4,l_point_3_4);
1071           l_entry_sequence(l_index) := substr(l_line,l_point4+4,l_point_4_5);
1072           l_display_name_old(l_index) := substr(l_line,l_point5+4,l_point_5_6);
1073           l_plug_id(l_index) := substr(l_line,l_point6+4,l_point_6_7);
1074           l_display_name(l_index) := substr(l_line,l_point7+4,length(l_line));
1075 
1076           if l_responsibility_id(l_index) is not null
1077           then
1078            if l_plug_id(l_index) is null
1079            then
1080             select ICX_PAGE_PLUGS_S.nextval
1081             into   l_plug_id(l_index)
1082             from   sys.dual;
1083 
1084             if l_display_name(l_index) = l_display_name_old(l_index)
1085             then
1086                 l_display_name(l_index) := '';
1087             end if;
1088 
1089             insert into ICX_PAGE_PLUGS
1090             (PLUG_ID,
1091              PAGE_ID,
1092              DISPLAY_SEQUENCE,
1093              RESPONSIBILITY_APPLICATION_ID,
1094              SECURITY_GROUP_ID,
1095              RESPONSIBILITY_ID,
1096              MENU_ID,
1097              ENTRY_SEQUENCE,
1098              DISPLAY_NAME,
1099              CREATION_DATE,CREATED_BY,
1100              LAST_UPDATE_DATE,LAST_UPDATED_BY,LAST_UPDATE_LOGIN)
1101             values
1102             (l_plug_id(l_index),
1103              l_page_id,
1104              l_index,
1105              l_resp_appl_id(l_index),
1106              l_security_group_id(l_index),
1107              l_responsibility_id(l_index),
1108              l_menu_id(l_index),
1109              l_entry_sequence(l_index),
1110              l_display_name(l_index),
1111              sysdate,1,
1112              sysdate,1,1);
1113            else
1114             if l_display_name(l_index) = l_display_name_old(l_index)
1115             then
1116               update ICX_PAGE_PLUGS
1117               set DISPLAY_SEQUENCE = l_index,
1118                   RESPONSIBILITY_APPLICATION_ID = l_resp_appl_id(l_index),
1119                   SECURITY_GROUP_ID = l_security_group_id(l_index),
1120                   RESPONSIBILITY_ID = l_responsibility_id(l_index),
1121                   MENU_ID = l_menu_id(l_index),
1122                   ENTRY_SEQUENCE = l_entry_sequence(l_index)
1123               where PAGE_ID = l_page_id
1124               and   PLUG_ID = l_plug_id(l_index);
1125             else
1126               update ICX_PAGE_PLUGS
1127               set DISPLAY_SEQUENCE = l_index,
1128                   RESPONSIBILITY_APPLICATION_ID = l_resp_appl_id(l_index),
1129                   SECURITY_GROUP_ID = l_security_group_id(l_index),
1133                   DISPLAY_NAME = l_display_name(l_index)
1130                   RESPONSIBILITY_ID = l_responsibility_id(l_index),
1131                   MENU_ID = l_menu_id(l_index),
1132                   ENTRY_SEQUENCE = l_entry_sequence(l_index),
1134               where PAGE_ID = l_page_id
1135               and   PLUG_ID = l_plug_id(l_index);
1136             end if;
1137            end if;
1138           end if;
1139 
1140           l_index := l_index + 1;
1141         end if;
1142 
1143         l_lastcount := l_nextcount + 1;
1144         l_occurence := l_occurence + 1;
1145     end loop;
1146 
1147     l_length := length(Y);
1148     l_index := 0;
1149     l_occurence := 1;
1150     l_lastcount := 1;
1151     while l_lastcount <= l_length loop
1152         l_nextcount := instr(Y,'+',1,l_occurence);
1153         if l_lastcount <> l_nextcount
1154         then
1155           l_line_length := l_nextcount-l_lastcount;
1156           l_line := substr(Y,l_lastcount,l_line_length);
1157           l_point1 := instr(l_line,'@!$#',1,1);
1158           l_point2 := instr(l_line,'@!$#',1,2);
1159           l_point3 := instr(l_line,'@!$#',1,3);
1160           l_point4 := instr(l_line,'@!$#',1,4);
1161           l_point5 := instr(l_line,'@!$#',1,5);
1162           l_point6 := instr(l_line,'@!$#',1,6);
1163           l_point7 := instr(l_line,'@!$#',1,7);
1164           l_point_1_2 := l_point2 - l_point1 - 4;
1165           l_point_2_3 := l_point3 - l_point2 - 4;
1166           l_point_3_4 := l_point4 - l_point3 - 4;
1167           l_point_4_5 := l_point5 - l_point4 - 4;
1168           l_point_5_6 := l_point6 - l_point5 - 4;
1169           l_point_6_7 := l_point7 - l_point6 - 4;
1170 
1171           r_resp_appl_id(l_index) := substr(l_line,1,l_point1-1);
1172           r_security_group_id(l_index) := substr(l_line,l_point1+4,l_point_1_2);
1173           r_responsibility_id(l_index) := substr(l_line,l_point2+4,l_point_2_3);
1174           r_menu_id(l_index) := substr(l_line,l_point3+4,l_point_3_4);
1175           r_entry_sequence(l_index) := substr(l_line,l_point4+4,l_point_4_5);
1176           r_display_name_old(l_index) := substr(l_line,l_point5+4,l_point_5_6);
1177           r_plug_id(l_index) := substr(l_line,l_point6+4,l_point_6_7);
1178           r_display_name(l_index) := substr(l_line,l_point7+4,length(l_line));
1179 
1180           if r_responsibility_id(l_index) is not null
1181           then
1182            if r_plug_id(l_index) is null
1183            then
1184             select ICX_PAGE_PLUGS_S.nextval
1185             into   r_plug_id(l_index)
1186             from   sys.dual;
1187 
1188             if r_display_name(l_index) = r_display_name_old(l_index)
1189             then
1190                 r_display_name(l_index) := '';
1191             end if;
1192 
1193             insert into ICX_PAGE_PLUGS
1194             (PLUG_ID,
1195              PAGE_ID,
1196              DISPLAY_SEQUENCE,
1197              RESPONSIBILITY_APPLICATION_ID,
1198              SECURITY_GROUP_ID,
1199              RESPONSIBILITY_ID,
1200              MENU_ID,
1201              ENTRY_SEQUENCE,
1202              DISPLAY_NAME,
1203              CREATION_DATE,CREATED_BY,
1204              LAST_UPDATE_DATE,LAST_UPDATED_BY,LAST_UPDATE_LOGIN)
1205             values
1206             (r_plug_id(l_index),
1207              l_page_id,
1208              l_index,
1209              r_resp_appl_id(l_index),
1210              r_security_group_id(l_index),
1211              r_responsibility_id(l_index),
1212              r_menu_id(l_index),
1213              r_entry_sequence(l_index),
1214              r_display_name(l_index),
1215              sysdate,1,
1216              sysdate,1,1);
1217            else
1218             if r_display_name(l_index) = r_display_name_old(l_index)
1219             then
1220               update ICX_PAGE_PLUGS
1221               set DISPLAY_SEQUENCE = l_index,
1222                   RESPONSIBILITY_APPLICATION_ID = r_resp_appl_id(l_index),
1223                   SECURITY_GROUP_ID = r_security_group_id(l_index),
1224                   RESPONSIBILITY_ID = r_responsibility_id(l_index),
1225                   MENU_ID = r_menu_id(l_index),
1226                   ENTRY_SEQUENCE = r_entry_sequence(l_index)
1227               where PAGE_ID = l_page_id
1228               and   PLUG_ID = r_plug_id(l_index);
1229             else
1230               update ICX_PAGE_PLUGS
1231               set DISPLAY_SEQUENCE = l_index,
1232                   RESPONSIBILITY_APPLICATION_ID = r_resp_appl_id(l_index),
1233                   SECURITY_GROUP_ID = r_security_group_id(l_index),
1234                   RESPONSIBILITY_ID = r_responsibility_id(l_index),
1235                   MENU_ID = r_menu_id(l_index),
1236                   ENTRY_SEQUENCE = r_entry_sequence(l_index),
1237                   DISPLAY_NAME = r_display_name(l_index)
1238               where PAGE_ID = l_page_id
1239               and   PLUG_ID = r_plug_id(l_index);
1240             end if;
1241            end if;
1242           end if;
1243 
1244           l_index := l_index + 1;
1245         end if;
1246 
1247         l_lastcount := l_nextcount + 1;
1248         l_occurence := l_occurence + 1;
1249     end loop;
1250 
1251     for p in plugs loop
1252       l_count := 0;
1253       if l_plug_id.COUNT > 0
1254       then
1255         for i in l_plug_id.FIRST..l_plug_id.LAST loop
1256           if p.plug_id = l_plug_id(i)
1257           then
1258             l_count := 1;
1259           end if;
1260         end loop;
1261       end if;
1262       if r_plug_id.COUNT > 0
1263       then
1264         for i in r_plug_id.FIRST..r_plug_id.LAST loop
1265           if p.plug_id = r_plug_id(i)
1266           then
1267             l_count := 1;
1268           end if;
1269         end loop;
1270       end if;
1271 
1272       if l_count = 0
1273       then
1274 
1275         begin
1276           select WEB_HTML_CALL
1277           into   l_plsql_call
1278           from   FND_FORM_FUNCTIONS a,
1279                  FND_MENU_ENTRIES b
1280           where  b.MENU_ID = p.MENU_ID
1281           and    b.ENTRY_SEQUENCE = p.ENTRY_SEQUENCE
1282           and    a.FUNCTION_ID = b.FUNCTION_ID;
1283         exception
1284           when others then
1285             l_plsql_call := '';
1286         end;
1287 
1288         if l_plsql_call is not null
1289         then
1290          begin
1291           l_plsql_call := l_plsql_call||'(p_session_id => '||l_session_id||', p_plug_id => '||p.plug_id||', p_delete => ''Y'')';
1292           l_call := dbms_sql.open_cursor;
1293           dbms_sql.parse(l_call,'begin '||l_plsql_call||'; end;',dbms_sql.native);
1294           l_dummy := dbms_sql.execute(l_call);
1295           dbms_sql.close_cursor(l_call);
1296          exception
1297           when others then
1298             l_count := l_count;
1299          end;
1300         end if;
1301 
1302         delete ICX_PAGE_PLUGS
1303         where  PAGE_ID = l_page_id
1304         and    PLUG_ID = p.plug_id;
1305 
1306       end if;
1307     end loop;
1308 
1309     if N = 'BL'
1310     then
1311       l_toolbar    := '#0000CC';
1312       l_heading    := '#99CCFF';
1313       l_banner     := '#99CCFF';
1314       l_background := '#FFFFFF';
1315     elsif N = 'BR'
1316     then
1317       l_toolbar    := '#993300';
1318       l_heading    := '#FFCC99';
1319       l_banner     := '#CC6600';
1320       l_background := '#FFCC99';
1321     elsif N = 'GR'
1322     then
1323       l_toolbar    := '#006666';
1324       l_heading    := '#99CCCC';
1325       l_banner     := '#99CCCC';
1326       l_background := '#FFFBF0';
1327     elsif N = 'GY'
1328     then
1329       l_toolbar    := '#663399';
1330       l_heading    := '#CC99FF';
1331       l_banner     := '#CC99FF';
1332       l_background := '#CCCCCC';
1333     elsif N = 'YL'
1334     then
1335       l_toolbar    := '#666666';
1336       l_heading    := '#FFFFCC';
1337       l_banner     := '#CCCCCC';
1338       l_background := '#FFFFCC';
1339     elsif N = 'IN'
1340     then
1341       l_toolbar    := '#333366';
1342       l_heading    := '#CCCCCC';
1343       l_banner     := '#9999CC';
1344       l_background := '#CCCCCC';
1345     else
1346       l_toolbar    := '#0000CC';
1347       l_heading    := '#99CCFF';
1348       l_banner     := '#99CCFF';
1349       l_background := '#FFFFFF';
1350     end if;
1351 
1352     update ICX_PAGE_COLOR_SCHEME
1353     set TOOLBAR_COLOR = l_toolbar,
1354         HEADING_COLOR = l_heading,
1355         BANNER_COLOR = l_banner,
1356         BACKGROUND_COLOR = l_background,
1357         COLOR_SCHEME = N
1358     where USER_ID = l_user_id;
1359 
1360     update ICX_PAGES
1361     set REFRESH_RATE = O
1362     where USER_ID = l_user_id
1363     and   PAGE_ID = l_page_id;
1364 
1365     icx_plug_utilities.gotoMainMenu;
1366 
1367 end if; -- validateSession
1368 
1369 exception
1370     when others then
1371         htp.p(SQLERRM);
1372 
1373 end;
1374 
1375 end OraclePlugs;