[Home] [Help]
PACKAGE BODY: APPS.ORACLECONFIGURE
Source
1 package body OracleConfigure as
2 /* $Header: ICXCNFGB.pls 120.0 2005/10/07 12:13:26 gjimenez noship $ */
3
4 -- ***********************************************
5 -- procedure createPage
6 -- ***********************************************
7
8 function createPage(p_page_type in varchar2,
9 p_page_name in varchar2,
10 p_page_description in varchar2,
11 p_validate_flag in varchar2) return number is
12
13 l_main_region_id number;
14 l_page_id number;
15 l_plug_id number;
16 l_function_id number;
17 l_display_name varchar2(80);
18 l_sequence_number number;
19 l_language_code varchar2(30);
20 l_rowid varchar2(30);
21 l_session_id number;
22 e_nls_not_installed EXCEPTION; --1378862 mputman
23
24 begin
25 if p_validate_flag = 'Y' then
26 if (icx_sec.validatesession) then
27 l_session_id := icx_sec.g_session_id;
28 end if;
29 else
30 l_session_id := icx_sec.g_session_id;
31 end if;
32
33 if (l_session_id > 0) then
34
35 select nvl(max(sequence_number),1)
36 into l_sequence_number
37 from icx_pages
38 where user_id = icx_sec.g_user_id;
39
40 select icx_pages_s.nextval
41 into l_page_id
42 from sys.dual;
43
44 l_main_region_id := icx_api_region.create_main_region;
45 --added substr() to p_page_name 1388074 mputman
46 ICX_PAGES_PKG.INSERT_ROW(
47 x_rowid => l_rowid,
48 x_page_id => l_page_id,
49 x_page_code => 'ICX_PAGE_' || to_char(l_page_id),
50 x_main_region_id => l_main_region_id,
51 x_sequence_number => l_sequence_number + 1,
52 x_page_type => upper(p_page_type),
53 x_user_id => icx_sec.g_user_id,
54 x_refresh_rate => null,
55 x_page_name => substrb(p_page_name,1,80),
56 x_page_description => p_page_description,
57 x_creation_date => sysdate,
58 x_created_by => icx_sec.g_user_id,
59 x_last_update_date => sysdate,
60 x_last_updated_by => icx_sec.g_user_id,
61 x_last_update_login => icx_sec.g_user_id);
62
63 update icx_sessions
64 set page_id = l_page_id
65 where session_id = icx_sec.g_session_id;
66
67 if (p_page_type = 'MAIN') then
68
69 select icx_page_plugs_s.nextval
70 into l_plug_id
71 from sys.dual;
72
73 BEGIN
74 select function_id, user_function_name
75 into l_function_id, l_display_name
76 from fnd_form_functions_vl
77 where function_name = 'ICX_NAVIGATE_PLUG';
78 /* added for 1378862 mputman
79 NO_DATA_FOUND Exception means
80 that the NLS patch was not applied
81 before the first login attempt and
82 there is no translated value for
83 the Navigate plug and an invalid
84 Main page will be created. This
85 catches the exception and the
86 exception deletes the page and
87 informs the user. */
88 EXCEPTION --added 1378862 mputman
89 when NO_DATA_FOUND then
90 RAISE e_nls_not_installed;
91
92 END;
93 l_display_name:=NULL; -- mputman added 1405228
94 insert into icx_page_plugs
95 (plug_id,
96 page_id,
97 display_sequence,
98 responsibility_id,
99 menu_id,
100 entry_sequence,
101 display_name,
102 region_id,
103 last_update_date,
104 last_updated_by,
105 creation_date,
106 created_by)
107 values(
108 l_plug_id,
109 l_page_id,
110 0,
111 -1,
112 -1,
113 l_function_id,
114 l_display_name,
115 l_main_region_id,
116 sysdate, icx_sec.g_user_id,
117 sysdate, icx_sec.g_user_id);
118 end if;
119
120 end if;
121
122 commit;
123 return l_page_id;
124 EXCEPTION --added 1378862 mputman
125 WHEN e_nls_not_installed THEN
126 deletepage(l_page_id);
127 COMMIT;
128 RETURN 0;
129 end;
130
131
132 -- ***********************************************
133 -- procedure copyPage
134 -- ***********************************************
135
136 function copyPage(p_page_id in number,
137 p_page_name in varchar2) return number is
138
139 l_to_page_id number;
140 l_from_page_id number;
141 l_sequence_number number;
142 l_from_main_region_id number;
143 l_to_main_region_id number;
144 l_language_code varchar2(30);
145 l_rowid varchar2(30);
146 begin
147
148 if (icx_sec.validatesession) then
149
150 begin
151 select nvl(max(sequence_number),1)
152 into l_sequence_number
153 from icx_pages
154 where user_id = icx_sec.g_user_id;
155 exception
156 when no_data_found then
157 htp.p(SQLERRM);
158 end;
159
160 begin
164 where page_id = p_page_id;
161 select main_region_id
162 into l_from_main_region_id
163 from icx_pages
165 exception
166 when no_data_found then
167 htp.p(SQLERRM);
168 end;
169
170 select icx_pages_s.nextval
171 into l_to_page_id
172 from sys.dual;
173
174 l_to_main_region_id := icx_api_region.create_main_region;
175
176 ICX_PAGES_PKG.INSERT_ROW(
177 x_rowid => l_rowid,
178 x_page_id => l_to_page_id,
179 x_page_code => 'ICX_PAGE_' || to_char(l_to_page_id),
180 x_main_region_id => l_to_main_region_id,
181 x_sequence_number => l_sequence_number + 1,
182 x_page_type => 'USER',
183 x_user_id => icx_sec.g_user_id,
184 x_refresh_rate => null,
185 x_page_name => p_page_name,
186 x_page_description => null,
187 x_creation_date => sysdate,
188 x_created_by => icx_sec.g_user_id,
189 x_last_update_date => sysdate,
190 x_last_updated_by => icx_sec.g_user_id,
191 x_last_update_login => icx_sec.g_user_id);
192
193 copyPagePrivate(l_from_main_region_id, l_to_main_region_id, l_to_page_id);
194
195 update icx_sessions
196 set page_id = l_to_page_id
197 where session_id = icx_sec.g_session_id;
198
199 end if;
200
201 commit;
202 return l_to_page_id;
203
204 end copyPage;
205
206
207
208 -- ***********************************************
209 -- procedure copypageprivate
210 -- ***********************************************
211
212 procedure copyPagePrivate(p_from_main_region_id in number,
213 p_to_main_region_id in number,
214 p_to_page_id in number) is
215
216 l_from_region icx_api_region.region_record;
217 l_to_region icx_api_region.region_record;
218 l_child_region_count number;
219
220 begin
221
222 l_from_region := icx_api_region.get_main_region_record(p_from_main_region_id);
223 l_to_region := icx_api_region.get_main_region_record(p_to_main_region_id);
224
225 l_to_region.split_mode := l_from_region.split_mode;
226 l_to_region.width := l_from_region.width;
227 l_to_region.height := l_from_region.height;
228 l_to_region.portlet_alignment := l_from_region.portlet_alignment;
229 l_to_region.width_restrict := l_from_region.width_restrict;
230 l_to_region.portlet_flow := l_from_region.portlet_flow;
231 l_to_region.navwidget_id := l_from_region.navwidget_id;
232
233 icx_api_region.edit_region(l_to_region);
234
235 icx_api_region.copy_child_regions(l_from_region.region_id,
236 l_to_region.region_id,
237 p_to_page_id);
238 end copyPageprivate;
239
240
241 -- ***********************************************
242 -- procedure renamePage
243 -- ***********************************************
244
245 procedure renamePage (p_page_id in number,
246 p_page_name in varchar2) is
247
248 begin
249
250 update icx_pages_tl
251 set page_name = p_page_name
252 where page_id = p_page_id
253 and language = userenv('LANG');
254
255 update icx_pages
256 set page_name = p_page_name
257 where page_id = p_page_id;
258
259 exception
260 when others then
261 htp.p(SQLERRM);
262 end;
263
264
265 -- ***********************************************
266 -- procedure deletePagePrivate
267 -- ***********************************************
268
269 procedure deletePagePrivate(p_region_id in number) is
270
271 l_region_child_count number;
272
273 begin
274
275 for x in (select * from icx_regions where parent_region_id = p_region_id) loop
276
277 deletePagePrivate(x.region_id);
278
279 end loop;
280
281 delete from icx_regions
282 where region_id = p_region_id;
283
284 end deletePagePrivate;
285
286
287 -- ***********************************************
288 -- procedure deletePage
289 -- ***********************************************
290
291 procedure deletePage (p_page_id in number) is
292
293 l_main_region_id number;
294 l_current_page_id number;
295 l_main_page_id number;
296 l_web_html_call varchar2(2000);
297
298 cursor pluglist is
299 select *
300 from icx_page_plugs
301 where page_id = p_page_id;
302
303 begin
304
305 if (icx_sec.validatesession) then
306
307 begin
308 select main_region_id
309 into l_main_region_id
310 from icx_pages
311 where page_id = p_page_id;
312 exception
313 when no_data_found then
314 htp.p(SQLERRM);
315 end;
316
317 begin
318 select page_id
319 into l_current_page_id -- id for the page user has active on OracleMyPage
320 from icx_sessions
321 where session_id = icx_sec.g_session_id;
322 exception
323 when no_data_found then
324 htp.p(SQLERRM);
325 end;
326
327 deletePagePrivate(l_main_region_id); -- deletes all child regions
328
329 for thisplug in pluglist loop
330
331 if thisplug.menu_id <> -1 then -- we only want to do this for customizable plugs.
332
333 begin
334 select WEB_HTML_CALL
338 where b.MENU_ID = thisplug.MENU_ID
335 into l_web_html_call
336 from FND_FORM_FUNCTIONS a,
337 FND_MENU_ENTRIES b
339 and a.FUNCTION_ID = b.FUNCTION_ID
340 and b.ENTRY_SEQUENCE = thisplug.entry_sequence;
341 exception
342 when others then
343 l_web_html_call := '';
344 end;
345
346 execute immediate 'begin '
347 || l_web_html_call
348 || '(:session_id, :plug_id, null, ''Y''); end;'
349 using in icx_sec.g_session_id, in thisplug.plug_id;
350
351 end if; --thisplug.menu_id <> -1
352
353 end loop;
354
355 delete from icx_page_plugs
356 where page_id = p_page_id;
357
358 delete from icx_pages
359 where page_id = p_page_id;
360
361 delete from icx_pages_tl
362 where page_id = p_page_id;
363
364 if (l_current_page_id = p_page_id) then --the page the user was on has been deleted
365 --return to the Main Page.
366 begin
367 select page_id into l_main_page_id
368 from icx_pages
369 where page_type = 'MAIN'
370 and user_id = icx_sec.g_user_id;
371 exception
372 when no_data_found then
373 htp.p(SQLERRM);
374 end;
375
376 update icx_sessions
377 set page_id = l_main_page_id
378 where session_id = icx_sec.g_session_id;
379 end if;
380
381 commit;
382
383 end if;
384 end deletePage;
385
386
387 -- ***********************************************
388 -- procedure Customize
389 -- ***********************************************
390
391 procedure Customize(p_page_id in number) is
392
393
394 l_start number;
395 l_timer number;
396 l_hsecs number;
397
398 l_index number;
399 l_message varchar2(80); -- 1388074 increased from 30 to 80 mputman
400 l_session_id pls_integer;
401
402 l_known_as varchar2(240);
403 l_title varchar2(240);
404 l_helpmsg varchar2(240);
405 l_helptitle varchar2(240);
406 l_tabs icx_cabo.tabTable;
407 l_toolbar icx_cabo.toolbar;
408 l_page_id number;
409 l_page_name varchar2(80);
410
411 begin
412
413 if (icx_sec.validatesession) then
414
415 if (p_page_id is not null) then
416 l_page_id := p_page_id;
417 else
418 begin
419 select page_id
420 into l_page_id
421 from icx_sessions
422 where session_id = icx_sec.g_session_id;
423 exception
424 when no_data_found then
425 htp.p(SQLERRM);
426 end;
427 end if;
428
429 begin
430 select page_name
431 into l_page_name
432 from icx_pages_tl
433 where page_id = l_page_id
434 and language = userenv('LANG');
435 exception
436 when no_data_found then
437 htp.p(SQLERRM);
438 end;
439
440 fnd_message.set_name('ICX','ICX_LOGIN_CUSTOMIZE');
441 l_toolbar.title := fnd_message.get;
442 l_toolbar.help_url := 'javascript:top.main.help_window()';
443 fnd_message.set_name('ICX','ICX_HELP');
444 l_toolbar.help_mouseover := FND_MESSAGE.GET;
445 l_toolbar.custom_option1_url := icx_plug_utilities.getPLSQLagent ||
446 'OracleMyPage.Home';
447
448 l_toolbar.custom_option1_mouseover := wf_core.translate('RETURN_TO_HOME');
449 l_toolbar.custom_option1_gif := '/OA_MEDIA/FNDHOME.gif';
450 l_toolbar.custom_option1_mouseover_gif := '/OA_MEDIA/FNDHOME.gif';
451
452 icx_cabo.container(p_toolbar => l_toolbar,
453 p_helpmsg => wf_core.translate('MODIFY_HOME'),
454 p_helptitle => l_page_name ,
455 p_url => owa_util.get_cgi_env('SCRIPT_NAME')||
456 '/OracleConfigure.displayCustomize?p_page_id='||l_page_id,
457 p_action => TRUE);
458
459 end if;
460
461 exception
462 when others then
463 htp.p(SQLERRM);
464
465 end Customize;
466
467
468 -- ***********************************************
469 -- procedure displayCustomize
470 -- ***********************************************
471
472 procedure displayCustomize (p_page_id in number ) is
473
474 l_main_region_id number;
475 l_actions icx_cabo.actionTable;
476 l_agent varchar2(80);
477
478 begin
479
480 if icx_sec.validateSession
481 then
482
483 begin
484 select main_region_id
485 into l_main_region_id
486 from icx_pages
487 where page_id = p_page_id;
488 exception
489 when NO_DATA_FOUND then
490 htp.p(SQLERRM);
491 end;
492
493 l_agent := FND_WEB_CONFIG.WEB_SERVER || icx_plug_utilities.getPLSQLagent;
494
495 htp.p('<BASE HREF="'||FND_WEB_CONFIG.WEB_SERVER||'">');
496
497 icx_javascript.open_script;
498
499 htp.p (' function customedit(pageid,regionid)
500 {
501 popupWin = window.open("'||l_agent||'OracleConfigure.addPlugDlg?p_page_id=" +
502 pageid + "'||'&'||'p_region_id=" + regionid
503 , "Add", "status=no,resizable,scrollbars=yes,width=650,height=300");
504 }
505 '); -- 1420084 mputman changed open window params to allow scrollbars
506
510 regionid + "'||'&'||'p_page_id=" + pageid,
507 htp.p (' function openWindow(regionid,pageid)
508 {
509 popupWin = window.open("'||l_agent||'OracleConfigure.draw_editregion?p_region_id=" +
511 "EditRegion", "statusbar=Y,resizable,width=575,height=300");
512 }
513 ');
514
515 htp.p (' function rename(plugid)
516 {
517 popupWin = window.open("'||l_agent||'OracleConfigure.renamePlugDlg?p_plug_id=" +
518 plugid
519 , "Rename", "status=no,resizable,scrollbars=yes,width=650,height=175");
520 }
521 '); -- 1420084 mputman changed open window params to allow scrollbars and shorten box from 300 to 175
522
523 htp.p (' function deleteRegion(url) {
524 location.href = url;
525 } ');
526
527
528 htp.p (' function splitRegion(url) {
529 location.href = url;
530 } ');
531
532 htp.p('function cancelPage() {
533 top.location.href = "'||wfa_html.base_url ||'/oraclemypage.home";
534 } ');
535
536 icx_javascript.close_script;
537
538 htp.centerOpen;
539 htp.p('<BR>');
540 htp.p('<BR>');
541 htp.p('<table border="0" bgcolor="#FFFFFF" width="80%" cellpadding="0" cellspacing="0">');
542 htp.p('<tr><td>');
543
544 render( p_page_id => p_page_id,
545 p_region_id => l_main_region_id,
546 p_mode => 2,
547 p_height => '300');
548
549 htp.p('</td></tr>');
550 htp.tableClose;
551 htp.centerClose;
552
553 l_actions(0).name := 'Done';
554 l_actions(0).text := wf_core.translate('WFMON_DONE');
555 l_actions(0).actiontype := 'function';
556 l_actions(0).action := 'top.main.cancelPage()'; -- put your own commands here
557 l_actions(0).targetframe := 'main';
558 l_actions(0).enabled := 'b_enabled';
559 l_actions(0).gap := 'b_narrow_gap';
560
561 icx_cabo.buttons(l_actions);
562
563 end if;
564
565 exception
566 when others then
567 htp.p(SQLERRM);
568 end displayCustomize;
569
570
571 ------------------------------------------------------------------------------
572 -- Do we really need the arrays?
573 -- Do we need the p_mode?
574 -- remove style id
575 ------------------------------------------------------------------------------
576 procedure render( p_page_id in number,
577 p_region_id in number,
578 p_user in number,
579 p_regionid in icx_api_region.array,
580 p_portletid in icx_api_region.array,
581 p_mode in number,
582 p_height in number,
583 p_width in number)
584
585 as
586 l_region icx_api_region.region_record;
587 l_style_id number := -1;
588 start_time number;
589 end_time number;
590
591 begin
592
593 if (icx_sec.validatesession) then
594
595 --select HSECS into start_time from V$TIMER;
596
597 if icx_cabo.g_base_href is null
598 then
599 htp.p('<BASE HREF="'||FND_WEB_CONFIG.WEB_SERVER||'">');
600 else
601 htp.p('<BASE HREF="'||icx_cabo.g_base_href||'">');
602 end if;
603
604
605 htp.p('<SCRIPT LANGUAGE="JavaScript">');
606
607 htp.p('top.name = "root";');
608 if p_mode = DISPLAY_PORTLETS then -- we need to print javascript for kiosk mode
609
610 htp.p('var function_window = new Object();');
611 htp.p('function_window.open = false;');
612 htp.p('function icx_nav_window(mode, url, name){
613 if (mode == "WWK" || mode == "FORM") {
614 attributes = "status=yes,resizable=yes,scrollbars=yes,menubar=no,toolbar=no";
615 function_window.win = window.open(url, "function_window", attributes);
616
617 if (function_window.win != null)
618 if (function_window.win.opener == null)
619 function_window.win.opener = self;
620 function_window.win.focus();
621 }
622 else {
623 top.location = url;
624 };
625 };');
626 --mputman added new js function 1743710
627 htp.p('var counter=0;'); -- add support for unique window names 1812147
628 htp.p('var hostname="'||replace((replace(FND_WEB_CONFIG.DATABASE_ID,'-','_')),'.','_')||'";');
629 htp.p('function icx_nav_window2(mode, url, resp_app, resp_key, secgrp_key, name){
630 counter=counter+1;
631 hostname=hostname;
632 resp_app=escape(unescape(resp_app));
633 resp_key=escape(unescape(resp_key));
634 secgrp_key=escape(unescape(secgrp_key));
635 url=url+"RESP_APP="+resp_app+"&RESP_KEY="+resp_key+"&SECGRP_KEY="+secgrp_key;
636 if (mode == "WWK" || mode == "FORM") {
637 attributes = "status=yes,resizable=yes,scrollbars=yes,menubar=no,toolbar=no";
638 function_window.win = window.open(url, "function_window"+counter+hostname, attributes); //Bug 3038486
639
640 function_window.win.close(); //Bug 3038486
641
642 function_window.win = window.open(url, "function_window"+counter+hostname, attributes);
643
644
645 if (function_window.win != null)
646 if (function_window.win.opener == null)
647 function_window.win.opener = self;
648 function_window.win.focus();
649 }
650 else {
654
651 self.location = url;
652 };
653
655 };');
656
657
658
659 htp.p('function topwindowfocus() {
660 if (document.functionwindowfocus.X.value == "TRUE") {
661 function_window.win.focus();
662 }
663 };');
664
665 end if;
666
667 icx_admin_sig.help_win_script('ICXPHP', null, 'FND');
668 htp.p('</SCRIPT>');
669
670 if p_mode = DISPLAY_PORTLETS then
671 htp.p('<body bgcolor="#CCCCCC" onfocus="topwindowfocus()">');
672 else
673 htp.p('<body bgcolor="#CCCCCC" >');
674 end if;
675
676 --insert into icx_testing values ('made it to render');
677 --commit;
678
679 if p_mode = DISPLAY_PORTLETS then -- render page in plsql mode + draw form for kiosk mode
680
681 htp.formOpen(curl => 'XXX',
682 cattributes => 'NAME="functionwindowfocus"');
683 htp.formHidden('X','FALSE');
684 htp.formClose;
685
686 update icx_sessions
687 set page_id = p_page_id
688 where session_id = icx_sec.g_session_id;
689 commit;
690 end if;
691
692 l_region := icx_api_region.get_main_region_record(p_region_id);
693
694 --insert into icx_testing values ('region record id ' || to_char(l_region.region_id));
695 --commit;
696
697 htp.p('<!--------- Begin Rendering Main Region -------------------->');
698
699 renderregion(l_region, p_page_id, l_style_id, p_user, p_regionid, p_portletid,
700 p_mode, p_height, p_width);
701
702 htp.p('<!--------- End Rendering Main Region ---------------------->');
703
704 --select HSECS into end_time from V$TIMER;
705 --htp.p('Elapsed Time = '|| TO_CHAR(end_time - start_time));
706
707 end if;
708
709 end render;
710
711 -- ***********************************************
712 -- procedure renderregion
713 -- ***********************************************
714 procedure renderregion (p_region in icx_api_region.region_record,
715 p_page_id in number,
716 p_styleid in number,
717 p_user in varchar2,
718 p_regionid in icx_api_region.array ,
719 p_portletid in icx_api_region.array ,
720 p_mode in number ,
721 p_height in number ,
722 p_width in number ) as
723
724 l_height number := p_height;
725 l_border number := 0;
726 l_cellspacing number := BORDER_WIDTH;
727 l_cellpadding number := CELL_PADDING;
728 l_region_list icx_api_region.region_table;
729 l_str varchar2(32767) := null;
730 l_agent varchar2(80);
731 l_start number;
732
733 cursor instance_list is
734 select ipp.plug_id,
735 nvl(ipp.DISPLAY_NAME, fme.PROMPT) portlet_name,
736 fff.function_id,
737 fff.web_html_call,
738 ipp.display_sequence,
739 fme.menu_id
740 from icx_page_plugs ipp,
741 fnd_menu_entries_vl fme,
742 fnd_form_functions fff
743 where ipp.region_id = p_region.region_id
744 and ipp.page_id = p_page_id
745 and ipp.menu_id = fme.menu_id
746 and ipp.entry_sequence = fme.entry_sequence
747 and fff.function_id = fme.function_id
748 union all
749 select b.PLUG_ID,
750 nvl(b.DISPLAY_NAME,a.USER_FUNCTION_NAME) portlet_name,
751 a.function_id,
752 a.web_html_call,
753 b.display_sequence,
754 b.menu_id
755 from FND_FORM_FUNCTIONS_VL a,
756 ICX_PAGE_PLUGS b
757 where b.PAGE_ID = p_page_id
758 and b.MENU_ID = -1
759 and b.ENTRY_SEQUENCE = a.FUNCTION_ID
760 and a.type in ('WWL','WWLG', 'WWR', 'WWRG')
761 and b.region_id = p_region.region_id
762 order by 5; --mputman fix 2632382
763
764 begin
765
766 l_agent := FND_WEB_CONFIG.WEB_SERVER || icx_plug_utilities.getPLSQLagent;
767
768 if p_mode in (DISPLAY_PORTLETS_EDIT) then
769 l_height := p_height;
770 l_border := 1;
771 l_cellspacing := 0;
772 l_cellpadding := 0;
773 end if;
774
775 --insert into icx_testing values ('rendering region id ' || to_char(p_region.region_id));
776 --insert into icx_testing values ('rendering region page id' || to_char(p_page_id));
777
778 htp.p('<!---- Begin Region ' || p_region.region_id || ' -------->');
779
780 -- REGION IS SPLIT HORIZONTALLY, SO DRAW ROWS FOR EACH CHILD
781 -- AND THEN CALL RENDERREGION FOR EACH CHILD
782 ------------------------------------------------------------
783
784 if (p_region.split_mode = ICX_API_REGION.REGION_HORIZONTAL_SPLIT) then
785
786 if (p_mode = DISPLAY_PORTLETS) then
787
788 l_region_list := icx_api_region.get_child_region_list(p_region.region_id);
789 for i in 1..l_region_list.count
790 loop
791 renderregion(l_region_list(i), p_page_id, p_styleid, p_user,
792 p_regionid, p_portletid, p_mode, l_height, p_width);
793 end loop;
794 else
795
796 l_region_list := icx_api_region.get_child_region_list(p_region.region_id);
797 htp.p('<TABLE border="' || l_border||'" width="100%" height="'||
798 l_height ||'" cellspacing="0" cellpadding="0">');
799 for i in 1..l_region_list.count
800 loop
801 htp.p('<TR><TD height="' || l_height/l_region_list.count ||'" valign="top">');
805 end loop;
802 renderregion(l_region_list(i), p_page_id, p_styleid, p_user, p_regionid, p_portletid,
803 p_mode, l_height/l_region_list.count, p_width);
804 htp.p('</TD></TR>');
806 htp.p('</TABLE>');
807 end if;
808
809
810 -- REGION IS SPLIT VERTICALLY, SO DRAW CELLS FOR EACH CHILD
811 -- AND THEN CALL RENDERREGION FOR EACH CHILD
812 ------------------------------------------------------------
813 elsif (p_region.split_mode = ICX_API_REGION.REGION_VERTICAL_SPLIT) then
814
815 htp.p('<TABLE border="' || l_border||'" width="100%" height="'||
816 l_height || ' cellspacing="'|| 0 ||'" cellpadding="'||CELL_PADDING||'">');
817 htp.tableRowOpen;
818 l_region_list := icx_api_region.get_child_region_list(p_region.region_id);
819 for i in 1..l_region_list.count
820 loop
821 htp.p('<TD valign="top" width="'|| l_region_list(i).width || '%">');
822 renderregion(l_region_list(i), p_page_id, p_styleid, p_user, p_regionid, p_portletid,
823 p_mode, p_height, p_width);
824 htp.p('</TD>');
825 end loop;
826 htp.tableRowClose;
827 htp.p('</TABLE>');
828
829 -- REGION IS NOT SPLIT SO DRAW THE CONTENT
830 -----------------------------------------------
831 else
832 if (p_mode = DISPLAY_PORTLETS_EDIT) then
833 -- When displaying only the main region the region requires a border and the
834 -- delete button should not appear in the admin links
835
836 if (p_region.parent_region_id = ICX_API_REGION.MAIN_REGION) then
837 htp.p('<TABLE border="' || l_border ||'" width="100%" height="' ||
838 p_height || '" cellspacing="0" cellpadding="0"><TR>');
839 htp.p('<TD valign="top">');
840 end if;
841
842 htp.p('&'||'nbsp;');
843
844 -- the parameter p_mode for showconfigurelinks should be obsoleted.
845
846 if (p_region.parent_region_id = ICX_API_REGION.MAIN_REGION) then
847 showconfigurelinks(p_region.region_id, 1, 2, p_page_id);
848 else
849 showconfigurelinks(p_region.region_id, 0, 2, p_page_id);
850 end if;
851
852 for rec in instance_list
853 loop
854 begin
855
856 l_str := '<BR> <A HREF="javascript:rename('|| rec.plug_id ||')"><IMG SRC="'||
857 '/OA_MEDIA/afedit.gif'||
858 '" BORDER="0" ALIGN="MIDDLE" ALT="'||
859 wf_core.translate('RENAME')||'"></A>';
860
861 l_str := l_str || ('<A HREF="'||l_agent||'OracleConfigure.deletePlugInstance?p_page_id=' ||
862 p_page_id || '&'|| 'p_instanceid=' || rec.plug_id || '&' ||
863 'p_web_html_call=' || rec.function_id ||
864 '"><IMG BORDER="0" ALIGN="TOP" SRC="' ||
865 '/OA_MEDIA/icxdel.gif' || '" ALT="'||
866 wf_core.translate('DELETE')||'"></A>');
867
868 htp.p(l_str);
869 htp.p('&'||'nbsp;<font size="-2" face="Arial">'
870 || rec.portlet_name
871 || '</font>'
872 );
873
874 exception
875 when others then
876 htp.p(SQLERRM);
877 end;
878 end loop;
879
880 if (p_region.parent_region_id = ICX_API_REGION.MAIN_REGION) then
881 htp.p('</TD>');
882 htp.p('</TR></TABLE>');
883 end if;
884
885
886 -- IF WE ARE DISPLAYING THE PORTLETS
887 ------------------------------------
888
889 elsif p_mode in (DISPLAY_PORTLETS) then
890
891 for rec in instance_list
892 loop
893 l_cellspacing := 0;
894 l_cellpadding := 2;
895 if p_region.border = 'Y' then
896 l_border := BORDER_WIDTH;
897 else
898 l_border := 0;
899 end if;
900
901 begin
902
903 --select HSECS into l_start from V$TIMER;
904
905 htp.p('<TABLE border="'||l_border || '" bordercolor="#FFFFFF" ' ||
906 ' cellspacing="0" cellpadding="'||
907 l_cellpadding||'" width="100%">');
908 htp.p('<TR width="100%" bgcolor="#FFFFFF" ><TD width="100%" bordercolor='||
909 BORDER_COLOR||' vAlign="top"> <font face="Arial">');
910
911 --insert into icx_testing values ('v portlet name ====> ' || rec.portlet_name);
912
913 execute immediate 'begin '
914 || rec.web_html_call
915 || '(:session_id, :plug_id, :display_name); end;'
916 using in icx_sec.g_session_id, in rec.plug_id, in rec.portlet_name;
917
918 htp.p('</FONT></TD></TR></TABLE>');
919
920 htp.p('<TABLE border="0" cellspacing="0" cellpadding="0" width="100%">');
921 htp.tableRowOpen;
922 htp.p('<TD width="100%"><img src="' || '/OA_MEDIA/pobtrans.gif' ||
923 '" border="0" height="'|| CELL_PADDING ||'"></TD>');
924 htp.tableRowClose;
925 htp.tableClose;
926
927 --select HSECS - l_start into l_start from V$TIMER;
928
929 --htp.p('Execution Time: '||to_char(l_start));
930
931 exception
932 when others then
933 htp.p(SQLERRM);
934 end;
935 end loop;
936
937
938 end if; --p_mode DISPLAY_PORTLETS or DISPLAY_PORTLETS_EDIT
939
940 end if; -- draw content
941
942 htp.p('<!---- End Region ' || p_region.region_id || ' -------->');
943
947 -- ***********************************************
944 end renderregion;
945
946
948 -- procedure showconfigurelinks
949 -- ***********************************************
950 procedure showconfigurelinks( p_region_id number ,
951 p_show number ,
952 p_mode number ,
953 p_page_id number ) is
954
955 l_url varchar2(1000) := null;
956 l_str varchar2(32767) := null;
957 l_region icx_api_region.region_record;
958 l_agent varchar2(80);
959
960 begin
961
962 l_agent := FND_WEB_CONFIG.WEB_SERVER || icx_plug_utilities.getPLSQLagent;
963
964 l_str := '<A HREF="javascript:customedit('|| p_page_id || ',' || p_region_id || ')"><IMG SRC="'||'/OA_MEDIA/FNDIDETL.gif'||'" BORDER="0" ALIGN="MIDDLE" ALT="'||wf_core.translate('EDIT_CONTENT')||'"></A>';
965
966 l_str := l_str || '<A HREF="javascript:openWindow('|| p_region_id || ',' || p_page_id || ')"><IMG SRC="'||'/OA_MEDIA/aztskinc.gif'||'"BORDER="0" ALIGN="MIDDLE" ALT="'||wf_core.translate('EDIT_APPEARANCE')||'"></A>';
967
968
969 -- Split Horizontal Link
970 l_url := ''||l_agent||'OracleConfigure.split_region'||'?p_split_mode=1'||'&'||'p_region_id='||p_region_id||'&'||'p_page_id='||p_page_id;
971
972 l_str := l_str || '<A HREF="javascript:splitRegion('''||l_url||''')"><IMG SRC="'||'/OA_MEDIA/icxmovdn.gif'||'" BORDER="0" ALIGN="MIDDLE" ALT="'||wf_core.translate('ADD_ROW')||'"></A>';
973
974 -- Split Vertical Link
975 l_url := ''||l_agent||'OracleConfigure.split_region'||'?p_split_mode=0'||'&'||'p_region_id='||p_region_id||'&'||'p_page_id='||p_page_id;
976
977 l_str := l_str || '<A HREF="javascript:splitRegion('''||l_url||''')"><IMG SRC="'||'/OA_MEDIA/icxmovrt.gif'||'" BORDER="0" ALIGN="MIDDLE" ALT="'||wf_core.translate('ADD_COLUMN')||'"></A>';
978
979 -- Delete Link
980 -- Do not show the delete link for the main region - when p_show is 1
981 if ( p_show = 0 ) then
982 l_url := ''||l_agent||'OracleConfigure.delete_region'||'?p_region_id='||p_region_id||'&'||'p_page_id='||p_page_id;
983
984 l_str := l_str || '<A HREF="javascript:deleteRegion('''||l_url||''')"><IMG SRC="'||'/OA_MEDIA/delete.gif'||'" BORDER="0" ALIGN="MIDDLE" ALT="'||wf_core.translate('DELETE_REGION')||'"></A>';
985
986 end if;
987
988 htp.p(l_str);
989
990 end showconfigurelinks;
991
992
993 -- ***********************************************
994 -- procedure draw_editregion
995 -- ***********************************************
996 procedure draw_editregion
997 (
998 p_region_id in number
999 , p_action in varchar2
1000 , p_region_align in varchar2
1001 , p_region_width in varchar2
1002 , p_region_restrict in varchar2
1003 , p_region_flow in varchar2
1004 , p_page_id in number
1005 )
1006 is
1007
1008 l_dialog icxui_api_dialog;
1009 l_button1 icxui_api_button;
1010 l_button2 icxui_api_button;
1011 l_button_list icxui_api_button_list;
1012
1013 l_region icx_api_region.region_record;
1014 l_agent varchar2(80);
1015 l_prompt varchar2(240);
1016
1017 begin
1018
1019 if icx_sec.validateSession
1020 then
1021 l_agent := FND_WEB_CONFIG.WEB_SERVER || icx_plug_utilities.getPLSQLagent;
1022 -- Get the region properties
1023 l_region := icx_api_region.get_region(p_region_id);
1024
1025 -- HTML Open
1026 htp.htmlOpen;
1027
1028 -- HTML Header Open
1029 htp.headOpen;
1030 htp.p('<BASE HREF="'||icx_cabo.g_base_href||'">');
1031 --htp.title('EditRegion');
1032
1033 -- Javascript Functions
1034 icx_javascript.open_script;
1035
1036 htp.p (' function cancelsubmit()
1037 {
1038 self.close();
1039 } ');
1040
1041 htp.p (' function applySubmit(url)
1042 {
1043 var v_region_id = document.editregionform.p_region_id.value;
1044 var v_border = document.editregionform.p_region_border.options[document.editregionform.p_region_border.selectedIndex].value;
1045 var v_width = document.editregionform.p_region_width.value;
1046 var v_page_id = document.editregionform.p_page_id.value;
1047
1048 // Construct the URL
1049 url = url + "?p_region_id=" + v_region_id + "&p_region_width=" + v_width + "&p_action=Apply" + "&p_region_border=" + v_border + "&p_page_id=" + v_page_id;
1050 window.opener.location = url;
1051
1052 // Close the window
1053 window.close();
1054
1055 }
1056 ');
1057 icx_javascript.close_script;
1058
1059 -- HTML Head Close
1060 htp.headClose;
1061
1062 -- Construct the Button and the Button list
1063 l_button1 := icxui_api_button.create_button( p_button_name => wf_core.translate('APPLY'),
1064 p_button_url => 'javascript:applySubmit('''||l_agent||'OracleConfigure.save_editregion'||''')');
1065 l_button2 := icxui_api_button.create_button(p_button_name => wf_core.translate('CANCEL'),
1066 p_button_url => 'javascript:cancelsubmit()');
1067
1068 l_button_list := icxui_api_button_list(l_button1, l_button2);
1069
1070 -- Construct the Dialog
1071 l_dialog := icxui_api_dialog.create_dialog(
1072 p_title => wf_core.translate('EDIT_REGION'),
1073 p_subheader_text => wf_core.translate('REGION_PROPERTIES'),
1074 p_buttons => l_button_list);
1075
1076 -- HTML Body Open
1077 htp.p('<BODY bgcolor="#CCCCCC" >');
1078
1079 htp.centerOpen;
1080
1081 -- Form Open
1085 cattributes => 'NAME="editregionform"');
1082 htp.formOpen(curl => l_agent||'OracleConfigure.draw_editregion',
1083 cmethod => 'POST',
1084 cenctype => 'multipart/form-data',
1086
1087
1088 -- Hidden Form Elements
1089 htp.formHidden(cname => 'p_action');
1090 htp.formHidden(cname => 'p_region_id', cvalue => p_region_id);
1091 htp.formHidden(cname => 'p_screen', cvalue => 'editregion');
1092 htp.formHidden(cname => 'p_page_id', cvalue => p_page_id);
1093
1094 -- Draw the Dialog Title Bar
1095 l_dialog.open_dialog;
1096
1097 -- TABLE FOR THE FORM ELEMENTS
1098 -- htp.tableRowOpen;
1099 -- wwutl_htp.tableDataOpen;
1100 htp.tableOpen(cattributes=>'cellspacing="0" cellpadding="0" border="0" width="80%"');
1101 -- Width
1102 htp.tableRowOpen;
1103 htp.tableData(wf_core.translate('WIDTH'),
1104 cattributes => 'VALIGN="MIDDLE"');
1105
1106 htp.tableData(htf.fontOpen(cface => 'arial,helvetica')
1107 || htf.formText(cname => 'p_region_width', csize => '3', cmaxlength => '3',
1108 cattributes => 'VALUE="'||l_region.width||'" onChange="javascript:applySubmit('''||l_agent||'OracleConfigure.save_editregion'||''')"')
1109 || htf.fontClose,
1110 cattributes => 'VALIGN="MIDDLE"');
1111 htp.tableRowClose;
1112
1113 -- border
1114 fnd_message.set_name('ICX','ICX_SHOW_BORDER');
1115 l_prompt := fnd_message.get;
1116
1117 htp.tableRowOpen;
1118 htp.tableData(l_prompt,
1119 cattributes => 'VALIGN="MIDDLE"');
1120
1121 -- The Drop Down List of Region Alignments
1122 htp.p('<TD VALIGN=MIDDLE>');
1123 htp.formSelectOpen(cname => 'p_region_border');
1124 htp.fontOpen(cface => 'arial,helvetica', csize => '-1');
1125
1126 if l_region.border = 'Y' then
1127 htp.p('<OPTION SELECTED VALUE=Y>');
1128 else
1129 htp.p('<OPTION VALUE=Y>');
1130 end if;
1131 htp.p(wf_core.translate('WFMON_YES'));
1132 htp.p('</OPTION>');
1133 if l_region.border = 'N' then
1134 htp.p('<OPTION SELECTED VALUE=N>');
1135 else
1136 htp.p('<OPTION VALUE=N>');
1137 end if;
1138 htp.p(wf_core.translate('WFMON_NO'));
1139 htp.p('</OPTION>');
1140 htp.fontClose;
1141 htp.formSelectClose;
1142 htp.p('</TD>');
1143 htp.tableRowClose;
1144
1145 -- CLOSE THE TABLE FOR THE FORM ELEMENTS
1146 htp.tableClose;
1147
1148 -- Draw the dialog footer
1149 l_dialog.close_dialog;
1150
1151 -- CLOSE FORM
1152 htp.formClose;
1153 htp.centerClose;
1154
1155 -- Close Body
1156 htp.bodyClose;
1157
1158 -- Close HTML
1159 htp.htmlClose;
1160 end if;
1161 end;
1162
1163 -- ***********************************************
1164 -- procedure save_editregion
1165 -- ***********************************************
1166
1167 procedure save_editregion
1168 (
1169 p_region_id in number
1170 , p_action in varchar2
1171 , p_region_width in varchar2
1172 , p_region_restrict in varchar2
1173 , p_region_flow in varchar2
1174 , p_region_border in varchar2
1175 , p_page_id in number
1176 )
1177
1178 is
1179
1180 l_region icx_api_region.region_record;
1181 l_width_num number := 0;
1182
1183 begin
1184
1185 if UPPER(p_action) = 'APPLY' then
1186
1187 l_region := icx_api_region.get_region(p_region_id);
1188
1189 -- Region width needs to a numeric value
1190 begin
1191 l_width_num := to_number(p_region_width);
1192 exception
1193 when VALUE_ERROR then
1194 -- Display error message
1195 htp.p(SQLERRM);
1196
1197 -- Return to the screen
1198 OracleConfigure.displayCustomize(p_page_id);
1199
1200 return;
1201 end;
1202
1203 --l_region.height := p_region_height;
1204 l_region.width := p_region_width;
1205 l_region.width_restrict := p_region_restrict;
1206 l_region.portlet_flow := p_region_flow;
1207 l_region.border := p_region_border;
1208
1209 -- Edit the region properties
1210 begin
1211 icx_api_region.edit_region(l_region);
1212 exception
1213 when OTHERS then
1214 htp.p(SQLERRM);
1215 end;
1216
1217 end if;
1218
1219 OracleConfigure.displayCustomize(p_page_id);
1220
1221 end save_editregion;
1222
1223
1224 -- ***********************************************
1225 -- procedure split_region
1226 -- ***********************************************
1227
1228 procedure split_region ( p_region_id in number
1229 , p_split_mode in number
1230 , p_page_id in number
1231 )
1232 is
1233
1234 begin
1235
1236 --insert into icx_testing values ('region id ' || to_char(p_region_id));
1237 --insert into icx_testing values ('split mode ' || to_char(p_split_mode));
1238 --insert into icx_testing values ('page id ' || to_char(p_page_id));
1239
1240 begin
1241 icx_api_region.split_region(p_region_id, p_split_mode);
1242 exception
1243 when OTHERS then
1244 htp.p(SQLERRM);
1245 end;
1246
1247 OracleConfigure.displayCustomize(p_page_id);
1248
1249 end split_region;
1253 -- procedure split_region
1250
1251
1252 -- ***********************************************
1254 -- ***********************************************
1255
1256 procedure delete_region
1257 (
1258 p_region_id in number
1259 , p_page_id in number
1260 )
1261 is
1262
1263 begin
1264
1265 -- Delete the Region
1266 begin
1267 icx_api_region.delete_region(p_region_id);
1268 exception
1269 when OTHERS then
1270 htp.p(SQLERRM);
1271 end;
1272
1273 OracleConfigure.displayCustomize(p_page_id);
1274
1275 end delete_region;
1276
1277
1278
1279 -- ***********************************************
1280 -- procedure renamePlugDlg
1281 -- ***********************************************
1282
1283 procedure renamePlugDlg(p_plug_id in number)
1284
1285 is
1286
1287 l_dlg icxui_api_dialog;
1288 l_btn1 icxui_api_button;
1289 l_btn2 icxui_api_button;
1290 l_btn_list icxui_api_button_list;
1291
1292 l_plug_name varchar2(80);
1293 l_agent varchar2(80);
1294
1295 begin
1296
1297 if (icx_sec.validatesession) then
1298
1299 l_agent := FND_WEB_CONFIG.WEB_SERVER || icx_plug_utilities.getPLSQLagent;
1300
1301 begin
1302 select nvl(ipp.DISPLAY_NAME, fme.PROMPT)
1303 into l_plug_name
1304 from icx_page_plugs ipp,
1305 fnd_menu_entries_vl fme,
1306 fnd_form_functions fff
1307 where ipp.plug_id = p_plug_id
1308 and ipp.menu_id = fme.menu_id
1309 and ipp.entry_sequence = fme.entry_sequence
1310 and fff.function_id = fme.function_id;
1311 exception
1312 when no_data_found then
1313 htp.p(SQLERRM);
1314 end;
1315
1316 if l_plug_name is null then
1317 begin
1318 select nvl(b.DISPLAY_NAME,a.USER_FUNCTION_NAME)
1319 into l_plug_name
1320 from FND_FORM_FUNCTIONS_VL a,
1321 ICX_PAGE_PLUGS b
1322 where b.plug_id = p_plug_id
1323 and b.MENU_ID = -1
1324 and b.ENTRY_SEQUENCE = a.FUNCTION_ID;
1325 exception
1326 when no_data_found then
1327 htp.p(SQLERRM);
1328 end;
1329 end if;
1330
1331 htp.htmlOpen;
1332 htp.headOpen;
1333 htp.p('<BASE HREF="'||icx_cabo.g_base_href||'">');
1334
1335 -- javaScript
1336 icx_javascript.open_script;
1337
1338 htp.p (' function cancelsubmit()
1339 {
1340 self.close();
1341 } ');
1342
1343
1344 htp.p ('function applysubmit() {');
1345 if instr(owa_util.get_cgi_env('HTTP_USER_AGENT'),'MSIE') > 0
1346 then
1347 htp.p('document.new_plugname.submit();');
1348 htp.p('parent.opener.parent.history.go(0);');
1349 else
1350 htp.p(' document.new_plugname.target=top.opener.parent.name;');
1351 htp.p('document.new_plugname.submit();');
1352 end if;
1353 htp.p('window.close(); }' );
1354
1355 icx_javascript.close_script;
1356 htp.headClose;
1357 htp.p('<BODY bgcolor="#CCCCCC">');
1358 htp.centerOpen;
1359
1360 htp.formOpen(curl => l_agent||'OracleConfigure.renamePlug',
1361 cmethod => 'POST',
1362 cenctype => 'multipart/form-data',
1363 cattributes => 'NAME="new_plugname"');
1364
1365
1366
1367 -- BUTTON AND DIALOG CONSTRUCTION
1368 ----------------------------------
1369 l_btn1 := icxui_api_button.create_button(p_button_name => wf_core.translate('APPLY'),
1370 p_button_url => 'javascript:applysubmit()');
1371 l_btn2 := icxui_api_button.create_button(p_button_name => wf_core.translate('CANCEL'),
1372 p_button_url => 'javascript:cancelsubmit()');
1373 l_btn_list := icxui_api_button_list(l_btn1, l_btn2);
1374
1375 l_dlg := icxui_api_dialog.create_dialog(p_title => wf_core.translate('RENAME'),
1376 p_buttons => l_btn_list);
1377
1378 -- Draw the Dialog
1379 l_dlg.open_dialog;
1380
1381 htp.p('<table border="0" width="100%" cellpadding="0" cellspacing="0">');
1382
1383
1384 htp.tableRowOpen;
1385 htp.tableData(cvalue=>wf_core.translate('PLUG_NAME'),cattributes => 'VALIGN="MIDDLE"');
1386 htp.tableData('<B>'||l_plug_name||'</B>', cattributes => 'VALIGN="MIDDLE"');
1387 htp.tableRowClose;
1388
1389
1390 htp.tableRowOpen;
1391 htp.tableData(cvalue=>wf_core.translate('NEW_PLUG_NAME'), cattributes => 'VALIGN="MIDDLE"');
1392 htp.tableData(htf.fontOpen(cface => 'arial,helvetica')
1393 || htf.formText(cname => 'p_plug_name', csize => '20', cmaxlength => '80',
1394 cattributes => 'VALUE="'||l_plug_name||'"')||
1395 htf.fontClose, cattributes => 'VALIGN="MIDDLE"');
1396 htp.tableRowClose;
1397
1398 htp.formhidden('p_plug_id', p_plug_id);
1399 htp.p('<BR>');
1400
1401
1402 htp.tableClose;
1403 l_dlg.close_dialog;
1404 htp.formClose;
1405 htp.centerClose;
1406
1407 htp.bodyClose;
1408 htp.htmlClose;
1409
1410 end if;
1411
1412 end renamePlugDlg;
1413
1414 -- ***********************************************
1415 -- procedure renamePlug
1416 -- ***********************************************
1417
1418 procedure renamePlug (p_request in varchar2,
1422 begin
1419 p_plug_id in number,
1420 p_plug_name in varchar2) is
1421
1423
1424 update icx_page_plugs
1425 set display_name = p_plug_name
1426 where plug_id = p_plug_id;
1427
1428 if instr(owa_util.get_cgi_env('HTTP_USER_AGENT'),'MSIE') = 0
1429 then
1430 OracleConfigure.Customize;
1431 end if;
1432
1433 exception
1434 when others then
1435 htp.p(SQLERRM);
1436 end;
1437
1438 -- ***********************************************
1439 -- procedure addPlugDlg
1440 -- ***********************************************
1441
1442 procedure addPlugDlg(p_page_id in number,
1443 p_region_id in number)
1444 is
1445
1446 l_dlg icxui_api_dialog;
1447 l_btn1 icxui_api_button;
1448 l_btn2 icxui_api_button;
1449 l_btn_list icxui_api_button_list;
1450
1451 l_index number := 1;
1452
1453 -- type icx_api_region.array is table of varchar2(2000)
1454 l_leftnames icx_api_region.array := icx_api_region.empty;
1455 l_leftids icx_api_region.array := icx_api_region.empty;
1456 l_rightnames icx_api_region.array := icx_api_region.empty;
1457 l_rightids icx_api_region.array := icx_api_region.empty;
1458
1459 l_agent varchar2(80);
1460
1461 cursor options is
1462 select b.responsibility_application_id,
1463 b.security_group_id,
1464 a.responsibility_id,
1465 a.responsibility_name,
1466 a.menu_id,
1467 c.entry_sequence,
1468 c.prompt,
1469 c.description,
1470 d.function_id,
1471 d.type
1472 from fnd_form_functions d,
1473 fnd_menu_entries_vl c,
1474 fnd_responsibility_vl a,
1475 FND_USER_RESP_GROUPS b
1476 where b.user_id = icx_sec.g_user_id
1477 and b.start_date <= sysdate
1478 and (b.end_date is null or b.end_date > sysdate)
1479 and b.RESPONSIBILITY_application_id = a.application_id
1480 and b.responsibility_id = a.responsibility_id
1481 and a.version = 'W'
1482 and a.start_date <= sysdate
1483 and (a.end_date is null or a.end_date > sysdate)
1484 and a.menu_id = c.menu_id
1485 and c.grant_flag = 'Y'
1486 and c.function_id = d.function_id
1487 and d.type in ('WWL','WWLG','WWR','WWRG')
1488 and c.prompt is not null
1489 order by prompt;
1490
1491 cursor selections is
1492 select fff.function_id,
1493 ipp.plug_id,
1494 nvl(ipp.DISPLAY_NAME, fme.PROMPT) plug_name,
1495 fff.web_html_call,
1496 ipp.display_sequence
1497 from icx_page_plugs ipp,
1498 fnd_menu_entries_vl fme,
1499 fnd_form_functions fff
1500 where ipp.region_id = p_region_id
1501 and ipp.page_id = p_page_id
1502 and ipp.menu_id = fme.menu_id
1503 and ipp.entry_sequence = fme.entry_sequence
1504 and fff.function_id = fme.function_id
1505 union
1506 select a.function_id,
1507 b.PLUG_ID,
1508 nvl(b.DISPLAY_NAME,a.USER_FUNCTION_NAME) plug_name,
1509 a.web_html_call,
1510 b.display_sequence
1511 from FND_FORM_FUNCTIONS_VL a,
1512 ICX_PAGE_PLUGS b
1513 where b.PAGE_ID = p_page_id
1514 and b.MENU_ID = -1
1515 and b.ENTRY_SEQUENCE = a.FUNCTION_ID
1516 and a.type in ('WWL','WWLG', 'WWR', 'WWRG')
1517 and b.region_id = p_region_id
1518 order by 5;
1519
1520 begin
1521
1522 if (icx_sec.validatesession) then
1523
1524 l_agent := FND_WEB_CONFIG.WEB_SERVER || icx_plug_utilities.getPLSQLagent;
1525
1526 htp.htmlOpen;
1527 htp.headOpen;
1528 htp.p('<BASE HREF="'||icx_cabo.g_base_href||'">');
1529
1530 -- javaScript
1531 icx_javascript.open_script;
1532 icx_javascript.swap;
1533 icx_javascript.delete_blank_row;
1534 icx_javascript.move_element_up;
1535 icx_javascript.move_element_down;
1536 icx_javascript.move_element_top;
1537 icx_javascript.move_element_bottom;
1538 icx_javascript.select_all;
1539 icx_javascript.unselect_all;
1540 icx_javascript.clear_list;
1541 icx_javascript.copy_to_list;
1542 icx_javascript.copy_all;
1543
1544 htp.p (' function cancelsubmit()
1545 {
1546 self.close();
1547 }
1548
1549 function finishsubmit()
1550 {
1551 var url;
1552
1553 document.addPlugdlg.p_selectedlist.value = "";
1554 for (var i = 0; i <= document.addPlugdlg.p_rightselect.length - 1; i++){
1555 if (document.addPlugdlg.p_rightselect.options[i].value != "")
1556 {
1557 document.addPlugdlg.p_selectedlist.value += document.addPlugdlg.p_rightselect.options[i].value;
1558 if (i < document.addPlugdlg.p_rightselect.length - 1 '||'&&'||' document.addPlugdlg.p_rightselect.options[i+1].value != "")
1559 document.addPlugdlg.p_selectedlist.value += ",";
1560 }
1561 }
1562 ');
1563
1564 htp.p(' url = "'||l_agent||'OracleConfigure.savepage?p_region_id="+document.addPlugdlg.p_region_id.value+"'||'&'||'p_page_id="+document.addPlugdlg.p_page_id.value+"'||'&'||'p_selectedlist="+document.addPlugdlg.p_selectedlist.value;
1565
1566 window.opener.location= url;
1567 ');
1568
1569 htp.p(' self.close();
1570 return true;
1571 }
1572 ');
1573
1574 icx_javascript.close_script;
1575 htp.headClose;
1576 htp.p('<BODY bgcolor="#CCCCCC">');
1577 htp.centerOpen;
1578 htp.p('<form name="addPlugdlg"
1582 begin
1579 action="'||l_agent||'OracleConfigure.addPlugDlg' || '" method="POST"
1580 enctype="multipart/form-data">');
1581
1583 l_index := 1;
1584 for available_portlets in options loop
1585
1586 l_leftids(l_index) := to_char(available_portlets.function_id)||':'||
1587 to_char(available_portlets.responsibility_application_id)||':'||
1588 to_char(available_portlets.security_group_id)||':'||
1589 to_char(available_portlets.responsibility_id)||':'||
1590 to_char(available_portlets.menu_id)||':'||
1591 to_char(available_portlets.entry_sequence);
1592
1593 l_leftnames (l_index) := available_portlets.prompt;
1594 l_index := l_index + 1;
1595 end loop;
1596 end;
1597
1598 begin
1599 l_index := 1;
1600 for selected_portlets in selections loop
1601 l_rightids(l_index) := '*' || selected_portlets.plug_id;
1602 l_rightnames (l_index) := selected_portlets.plug_name;
1603 l_index := l_index + 1;
1604 end loop;
1605 end;
1606
1607 -- BUTTON AND DIALOG CONSTRUCTION
1608 ----------------------------------
1609 l_btn1 := icxui_api_button.create_button(p_button_name => wf_core.translate('WFMON_DONE'),
1610 p_button_url => 'javascript:finishsubmit()');
1611 l_btn2 := icxui_api_button.create_button(p_button_name => wf_core.translate('CANCEL'),
1612 p_button_url => 'javascript:cancelsubmit()');
1613 l_btn_list := icxui_api_button_list(l_btn1, l_btn2);
1614
1615 l_dlg := icxui_api_dialog.create_dialog(p_title => wf_core.translate('EDIT_CONTENT') ,
1616 p_buttons => l_btn_list);
1617
1618 -- Draw the Dialog
1619 l_dlg.open_dialog;
1620
1621 htp.p('<table border="0" width="100%" cellpadding="0" cellspacing="0">');
1622 htp.tableRowOpen;
1623 htp.p('<TD> '||wf_core.translate('AVAILABLE_PLUGS')||' </TD> <TD> </TD> <TD>'||wf_core.translate('PLUGS_IN_REGION')||'</TD>');
1624 htp.tableRowClose;
1625 htp.p('<BR>');
1626
1627 icx_page_widget.buildselectboxes(
1628 p_leftnames => l_leftnames,
1629 p_leftids => l_leftids,
1630 p_rightnames => l_rightnames,
1631 p_rightids => l_rightids,
1632 p_pageid => p_page_id,
1633 p_regionid => p_region_id
1634 );
1635
1636 htp.tableClose;
1637
1638 l_dlg.close_dialog;
1639 htp.formClose;
1640 htp.centerClose;
1641
1642 htp.bodyClose;
1643 htp.htmlClose;
1644
1645 end if;
1646
1647 end addPlugDlg;
1648
1649
1650 -- ***********************************************
1651 -- procedure savepage
1652 -- ***********************************************
1653 procedure savepage( p_page_id in number ,
1654 p_region_id in number ,
1655 p_selectedlist in varchar2
1656 )
1657 as
1658
1659 l_rightids icx_api_region.array := icx_api_region.empty;
1660 l_rightid_details icx_api_region.array := icx_api_region.empty;
1661 l_instanceid number;
1662 l_old_plug_indicator varchar2(30);
1663 l_oldrightids icx_api_region.array := icx_api_region.empty;
1664 l_index number;
1665 l_old_plug_id number;
1666 l_preserve_plug boolean := FALSE;
1667 temp_str varchar2(2000);
1668 temp_str1 varchar2(2000);
1669 l_end boolean;
1670 l_begin_index number;
1671 l_end_index number;
1672 l_count number;
1673 l_function_id number;
1674 l_resp_appl_id number;
1675 l_security_group_id number;
1676 l_responsibility_id number;
1677 l_menu_id number;
1678 l_entry_sequence number;
1679
1680 begin
1681
1682 l_index := 1;
1683 -- construct the list of plugs current in the db for this region
1684 for x in (select * from icx_page_plugs where region_id = p_region_id) loop
1685 l_oldrightids(l_index) := '*' || x.plug_id;
1686 l_index := l_index + 1;
1687 end loop;
1688
1689 -- construct the list of plugs currently in the selections box
1690 l_rightids := OracleConfigure.csvtoarray(p_selectedlist);
1691
1692 for i in 1..l_rightids.count loop
1693 if (substr(l_rightids(i),1,1) <> '*') then
1694 l_rightid_details(i) := substr(l_rightids(i), instr(l_rightids(i), ':', 1, 1) + 1, length(l_rightids(i)) );
1695 l_rightids(i) := substr(l_rightids(i), 1, instr(l_rightids(i), ':', 1, 1) - 1);
1696 else
1697 l_rightid_details(i) := null;
1698 l_rightids(i) := l_rightids(i);
1699 end if;
1700
1701 end loop;
1702
1703 -- remove plugs from db if they are not in the current selections box
1704 for i in 1..l_oldrightids.count loop
1705
1706 for j in 1..l_rightids.count loop
1707
1708 if l_rightids(j) = l_oldrightids(i) then --plug is still in selections do not delete
1709 l_preserve_plug := TRUE;
1710 exit;
1711 end if;
1712 end loop;
1713
1714 if (not l_preserve_plug) then --plug is no longer in the selections, delete it
1715 delete from icx_page_plugs
1716 where plug_id = substr(l_oldrightids(i), 2, length(l_oldrightids(i)) );
1717
1718 delete from icx_custom_menu_entries
1719 where plug_id = substr(l_oldrightids(i), 2, length(l_oldrightids(i)) );
1720 end if;
1721
1722 l_preserve_plug := FALSE;
1723
1724 end loop;
1725
1726
1727
1728 -- create plugs for newly added selections
1729 for k in 1..l_rightids.count loop
1730
1731 l_old_plug_indicator := substr(l_rightids(k),1,1);
1732
1733 --insert into icx_testing values ('rightids ' || l_rightids(k));
1734 --insert into icx_testing values ('rightid_details ' || l_rightid_details(k));
1735
1736 if (l_old_plug_indicator <> '*') then
1737
1738 temp_str := l_rightid_details(k);
1739 l_end := false;
1740 l_begin_index := 1;
1741 l_end_index := 0;
1742 l_count := 0;
1743
1744 while (l_end = false) loop
1745
1746 l_begin_index := l_end_index + 1;
1747 l_index := INSTR(temp_str,':', l_begin_index);
1748 l_end_index := l_index;
1749 l_count := l_count + 1;
1750
1751 if ( l_count = 1 ) then
1752 l_resp_appl_id := to_number(substr(temp_str,l_begin_index, l_end_index - l_begin_index));
1753 elsif ( l_count = 2 ) then
1754 l_security_group_id := to_number(substr(temp_str, l_begin_index, l_end_index - l_begin_index));
1755 elsif ( l_count = 3 ) then
1756 l_responsibility_id := to_number(substr(temp_str, l_begin_index, l_end_index - l_begin_index));
1757 elsif ( l_count = 4 ) then
1758 l_menu_id := to_number(substr(temp_str, l_begin_index, l_end_index - l_begin_index));
1759 elsif ( l_count = 5 ) then
1760 l_entry_sequence := to_number(substr(temp_str, l_begin_index));
1761 l_end := TRUE;
1762 end if;
1763
1764 end loop;
1765
1766 l_instanceid := OracleConfigure.addPlug(
1767 p_resp_appl_id => l_resp_appl_id,
1768 p_security_group_id => l_security_group_id,
1769 p_responsibility_id => l_responsibility_id,
1770 p_menu_id => l_menu_id,
1771 p_entry_sequence => l_entry_sequence,
1772 p_function_id => to_number(l_rightids(k)),
1773 p_page_id => p_page_id,
1774 p_region_id => p_region_id,
1775 p_display_sequence => k
1776 );
1777
1778 else
1779
1780 updatePlugSequence(substr(l_rightids(k), instr(l_rightids(k),'*',1,1) + 1, length(l_rightids(k)) )
1781 , k);
1782 end if;
1783
1784 end loop;
1785
1786 OracleConfigure.displayCustomize(p_page_id);
1787
1788 end savepage;
1789
1790 -- ***********************************************
1791 -- procedure addPlug
1792 -- ***********************************************
1793
1794 function addPlug( p_resp_appl_id in number,
1795 p_security_group_id in number,
1796 p_responsibility_id in number,
1797 p_menu_id in number,
1798 p_entry_sequence in number,
1799 p_function_id in number,
1800 p_page_id in number,
1801 p_region_id in number,
1802 p_display_sequence in number)
1803 return number as
1804
1805 l_entry_sequence number;
1806 l_plug_id number;
1807 l_display_name varchar2(100);
1808
1809 begin
1810
1811
1812 if (icx_sec.validatesession) then
1813
1814 begin
1815 --mputman commented out for 1405228
1816 /*
1817 select c.prompt
1818 into l_display_name
1819 from fnd_menu_entries_vl c
1820 where c.menu_id = p_menu_id
1821 and c.entry_sequence = p_entry_sequence;
1822 */
1823 l_display_name:=NULL;--mputman added 1405228
1824 select icx_page_plugs_s.nextval into l_plug_id from dual;
1825
1826 insert into ICX_PAGE_PLUGS
1827 (PLUG_ID,
1828 PAGE_ID,
1829 DISPLAY_SEQUENCE,
1830 RESPONSIBILITY_APPLICATION_ID,
1831 SECURITY_GROUP_ID,
1832 RESPONSIBILITY_ID,
1833 MENU_ID,
1834 ENTRY_SEQUENCE,
1835 DISPLAY_NAME,
1836 REGION_ID)
1837 values
1838 (l_plug_id,
1839 p_page_id,
1840 p_display_sequence,
1841 p_resp_appl_id,
1842 p_security_group_id,
1843 p_responsibility_id,
1844 p_menu_id,
1845 p_entry_sequence,
1846 l_display_name,
1847 p_region_id);
1848
1849 commit;
1850 return l_plug_id;
1851
1852 exception
1853 when no_data_found then
1854 htp.p('no data found');
1855 when others then
1856 rollback;
1857 htp.p(SQLERRM);
1858 end;
1859 end if;
1860
1861 end addPlug;
1862
1863
1864 -- ***********************************************
1865 -- procedure updatePlugSequence
1866 -- ***********************************************
1867 procedure updatePlugsequence(
1868 p_instanceid in number,
1869 p_display_sequence in number)
1870 as
1871 begin
1872 begin
1873
1874 update icx_page_plugs set display_sequence = p_display_sequence
1875 where plug_id = p_instanceid;
1876 commit;
1877 exception
1878 when others then
1879 null;
1880 end;
1881 end updatePlugsequence;
1882
1883
1884 -- ***********************************************
1885 -- procedure deletePlugInstance
1886 -- ***********************************************
1887 procedure deletePlugInstance(p_instanceid in number,
1888 p_page_id in number,
1889 p_web_html_call in varchar2 )
1890 as
1891 l_web_html_call VARCHAR2(400);
1892
1893 begin
1894 if icx_sec.validatesession then
1895 begin
1896
1897 if (p_web_html_call is not null) then
1898
1899 SELECT web_html_call
1900 INTO l_web_html_call
1901 FROM fnd_form_functions
1902 WHERE function_id=p_web_html_call;
1903
1904 execute immediate 'begin '
1905 || l_web_html_call
1906 || '(:session_id, :plug_id, null, ''Y''); end;'
1907 using in icx_sec.g_session_id, in p_instanceid;
1908 end if;
1909
1910 delete from icx_page_plugs where plug_id = p_instanceid;
1911 commit;
1912
1913 exception
1914 when others then
1915 null;
1916 end;
1917
1918 OracleConfigure.displayCustomize(p_page_id);
1919
1920 end if; -- validatesession
1921 end deletePlugInstance;
1922
1923
1924 -- *********************************************************
1925 -- csvtoarray
1926 -- *********************************************************
1927
1928 -- splits a comma-separated variable list into a icx_api_region.array
1929 -- e.g. 'value,value,value,value'
1930 function csvtoarray( p_variables in varchar2 ) return icx_api_region.array
1931 as
1932 v_start number;
1933 v_end number;
1934 v_index number;
1935 v_variables icx_api_region.array;
1936 begin
1937 v_index := 1;
1938 v_start := 1;
1939 if p_variables is null then
1940 return icx_api_region.empty;
1941 end if;
1942 loop
1943 v_end := instr( p_variables, ',', 1, v_index );
1944 if v_end = 0 then
1945 v_variables( v_index ) := substr( p_variables, v_start );
1946 end if;
1947 exit when v_end = 0 or v_end is null;
1948 v_variables( v_index ) :=
1949 substr( p_variables, v_start, v_end - v_start);
1950 v_index := v_index + 1;
1951 v_start := v_end + 1;
1952 end loop;
1953
1954 return v_variables;
1955 exception
1956 when others then
1957 htp.p(SQLERRM);
1958 end;
1959
1960 -- *********************************************************
1961 -- arraytocsv
1962 -- *********************************************************
1963
1964 -- converts a table of varchars to a list of comma-separated items
1965 -- e.g. 'value,value,value,value'
1966 function arraytocsv( p_array in icx_api_region.array ) return varchar2
1967 as
1968 v_csv varchar2(10000) := '';
1969 begin
1970 if p_array.count = 0 then
1971 return '';
1972 end if;
1973 for i in 1 .. p_array.count loop
1974 v_csv := v_csv || ',' || p_array(i);
1975 end loop;
1976 return substr( v_csv, 2 );
1977 exception
1978 when others then
1979 htp.p(SQLERRM);
1980 end;
1981
1982 end OracleConfigure;