[Home] [Help]
PACKAGE BODY: APPS.ICX_CABO
Source
1 package body icx_cabo as
2 /* $Header: ICXCABOB.pls 120.1 2005/10/07 13:20:44 gjimenez noship $ */
3
4 procedure toolbarJavascript(p_toolbar in icx_cabo.toolbar) is
5
6 begin
7
8 htp.p('<script language="javascript">');
9 htp.p('top.t = new top.toolbar();');
10
11 if p_toolbar.menu_url is not null and g_display_menu_icon
12 then
13 htp.p('top.t.addButton("menu","url:'||p_toolbar.menu_url||';helptext:'||p_toolbar.menu_mouseover||'");');
14 end if;
15
16 if p_toolbar.down_arrow_url is not null
17 then
18 htp.p('top.t.addButton("down","url:'||p_toolbar.down_arrow_url||';helptext:'||p_toolbar.down_arrow_mouseover||'");');
19 end if;
20
21 if (p_toolbar.menu_url is not null and g_display_menu_icon) or p_toolbar.down_arrow_url is not null
22 then
23 htp.p('top.t.addDivider();');
24 end if;
25
26 htp.p('top.t.addTitle("'||p_toolbar.title||'");');
27
28 if p_toolbar.save_url is not null or p_toolbar.print_frame is not null
29 then
30 htp.p('top.t.addDivider();');
31 end if;
32
33 if p_toolbar.save_url is not null
34 then
35 htp.p('top.t.addButton("save","function:'||p_toolbar.menu_url||';helptext:'||p_toolbar.menu_mouseover||'");');
36 end if;
37
38 if p_toolbar.print_frame is not null
39 then
40 htp.p('top.t.addButton("print","frame:'||p_toolbar.print_frame||';helptext:'||p_toolbar.print_mouseover||'");');
41 end if;
42
43 if p_toolbar.reload_frame is not null or p_toolbar.stop_mouseover is not null
44 then
45 htp.p('top.t.addDivider();');
46 end if;
47
48 if p_toolbar.reload_frame is not null
49 then
50 htp.p('top.t.addButton("reload","frame:'||p_toolbar.reload_frame||';helptext:'||p_toolbar.reload_mouseover||'");');
51 end if;
52
53 if p_toolbar.stop_mouseover is not null
54 then
55 htp.p('top.t.addButton("stop","helptext:'||p_toolbar.stop_mouseover||'");');
56 end if;
57
58 if p_toolbar.help_url is not null
59 or p_toolbar.personal_options_url is not null
60 or p_toolbar.custom_option1_url is not null
61 or p_toolbar.custom_option2_url is not null
62 or p_toolbar.custom_option3_url is not null
63 or p_toolbar.custom_option4_url is not null
64 or p_toolbar.custom_option5_url is not null
65 or p_toolbar.custom_option6_url is not null
66 then
67 htp.p('top.t.addDivider();');
68 end if;
69
70 if p_toolbar.help_url is not null
71 then
72 htp.p('top.t.addButton("help","url:'||p_toolbar.help_url||';helptext:'||p_toolbar.help_mouseover||'");');
73 end if;
74
75 if p_toolbar.personal_options_url is not null
76 then
77 htp.p('top.t.addButton("persopt","url:'||p_toolbar.personal_options_url||';helptext:'||p_toolbar.personal_options_mouseover||'");');
78 end if;
79
80 if p_toolbar.custom_option1_url is not null
81 then
82 htp.p('top.t.addButton("custom","url:'||p_toolbar.custom_option1_url||';helptext:'||p_toolbar.custom_option1_mouseover||
83 ';default-image:'||p_toolbar.custom_option1_gif||';rollover-image:'||p_toolbar.custom_option1_mouseover_gif||';disabled-image:'||p_toolbar.custom_option1_disabled_gif||'");');
84 end if;
85
86 if p_toolbar.custom_option2_url is not null
87 then
88 htp.p('top.t.addButton("custom","url:'||p_toolbar.custom_option2_url||';helptext:'||p_toolbar.custom_option2_mouseover||
89 ';default-image:'||p_toolbar.custom_option2_gif||';rollover-image:'||p_toolbar.custom_option2_mouseover_gif||';disabled-image:'||p_toolbar.custom_option2_disabled_gif||'");');
90 end if;
91
92 if p_toolbar.custom_option3_url is not null
93 then
94 htp.p('top.t.addButton("custom","url:'||p_toolbar.custom_option3_url||';helptext:'||p_toolbar.custom_option3_mouseover||
95 ';default-image:'||p_toolbar.custom_option3_gif||';rollover-image:'||p_toolbar.custom_option3_mouseover_gif||';disabled-image:'||p_toolbar.custom_option3_disabled_gif||'");');
96 end if;
97
98 if p_toolbar.custom_option4_url is not null
99 then
100 htp.p('top.t.addButton("custom","url:'||p_toolbar.custom_option4_url||';helptext:'||p_toolbar.custom_option4_mouseover||
101 ';default-image:'||p_toolbar.custom_option4_gif||';rollover-image:'||p_toolbar.custom_option4_mouseover_gif||';disabled-image:'||p_toolbar.custom_option4_disabled_gif||'");');
102 end if;
103
104 if p_toolbar.custom_option5_url is not null
105 then
106 htp.p('top.t.addButton("custom","url:'||p_toolbar.custom_option5_url||';helptext:'||p_toolbar.custom_option5_mouseover||
107 ';default-image:'||p_toolbar.custom_option5_gif||';rollover-image:'||p_toolbar.custom_option5_mouseover_gif||';disabled-image:'||p_toolbar.custom_option5_disabled_gif||'");');
108 end if;
109
110 if p_toolbar.custom_option6_url is not null
111 then
112 htp.p('top.t.addButton("custom","url:'||p_toolbar.custom_option6_url||';helptext:'||p_toolbar.custom_option6_mouseover||
113 ';default-image:'||p_toolbar.custom_option6_gif||';rollover-image:'||p_toolbar.custom_option6_mouseover_gif||';disabled-image:'||p_toolbar.custom_option6_disabled_gif||'");');
114 end if;
115
116 htp.p('</script>');
117
118 end;
119
120 procedure tabiconsJavascript(p_tabicons in tabiconTable) is
121
122 begin
123
124 if p_tabicons.COUNT > 0
125 then
126 htp.p('<script language="javascript">');
127
128 for i in p_tabicons.FIRST..p_tabicons.LAST loop
129 htp.p(p_tabicons(i).name||' = new tabicon("iconname:'||p_tabicons(i).iconname||'; disablediconname:'||p_tabicons(i).disablediconname||'; iconposition:'||p_tabicons(i).iconposition||
130 '; hint:'||p_tabicons(i).hint||'; disabledhint:'||p_tabicons(i).disabledhint||'; actiontype:'||p_tabicons(i).actiontype||'; url:'||p_tabicons(i).url||'; targetframe:'||p_tabicons(i).targetframe||'; action:'||p_tabicons(i).action||
131 '; enabled:'||p_tabicons(i).enabled||'; showcurrentonly:'||p_tabicons(i).showcurrentonly||';");');
132 end loop;
133
134 htp.p('</script>');
135 end if;
136
137 end;
138
139 function tabsJavascript(p_helpmsg in varchar2,
140 p_helptitle in varchar2,
141 p_currenttab in number,
142 p_tabs in tabTable) return varchar2 is
143
144 l_html varchar2(240);
145
146 begin
147
148 htp.p('<script language="javascript">
149 var helptitle = "'||nvl(p_helptitle,'<BR>')||'";
150 var helpmsg = "'||nvl(p_helpmsg,'<BR>')||'";
151 var currenttab = "'||p_currenttab||'";');
152
153 if p_tabs.COUNT > 0
154 then
155
156 htp.p('//Define the tab control object.
157
158 tc = new tabcontrol("title:"+helptitle+"; helptext:"+helpmsg+"; objectref:tc; targetframe:main; initialtab:"+currenttab);');
159
160 for i in p_tabs.FIRST..p_tabs.LAST loop
161 htp.p(p_tabs(i).name||' = new tab("name:'||p_tabs(i).name||'; text:'||p_tabs(i).text||'; hint:'||p_tabs(i).hint||'; disablehint:'||p_tabs(i).disablehint||'; enabled:'||p_tabs(i).enabled||'; visible:'||p_tabs(i).visible||
162 '; url:'||p_tabs(i).url||'; alwaysactive:'||p_tabs(i).alwaysactive||'; iconobj:'||p_tabs(i).iconobj||';");');
163 htp.p('tc.addtab('||p_tabs(i).name||');');
164 end loop;
165
166 l_html := 'container_tabs.html';
167 else
168
169 htp.p('//Define the container top object.
170 ntc = new notabcontrol(
171 "title:"+helptitle+"; helptext:"+helpmsg);');
172
173 l_html := 'container_notabs.html';
174 end if;
175
176 htp.p('</script>');
177
178 return l_html;
179
180 end;
181
182 procedure show_tableJavascript(p_tablename in varchar2) is
183
184 begin
185
186 htp.p('<script src="OA_HTML/webtools/jslib/table_constructor.js" language="javascript"></script>
187 <script src="OA_HTML/webtools/jslib/data_constructor.js" language="javascript"></script>
188
189 <script language="javascript">
190 //define a simple display table
191
192 //First, the cells objects since they need to be referenced into the column objects
193 tcell = new displayTextCell("align:right");
194 dcell = new displayTextCell();
195 lcell = new displayLinkCell();
196 icell = new displayIconCell("dataitems:3; textposition:after; align:left; wrap:true; iconname:OA_HTML/webtools/images/happyd.gif; actiontype:none")
197
198 //Second, the column objects since they need to be referenced into the table object
199 column1 = new column("cellobject:tcell; text:Time")
200 column2 = new column("cellobject:dcell; text:Day")
201 column3 = new column("cellobject:lcell; text:Program")
202 column4 = new column("cellobject:icell; text:Rating")
203
204 //third, the table object...,
205 '||p_tablename||' = new table("name:'||p_tablename||'; widthpercent:50; grid:both;");
206
207 //...and add the columns to it
208 '||p_tablename||'.addColumn(column1);
209 '||p_tablename||'.addColumn(column2);
210 '||p_tablename||'.addColumn(column3);
211 '||p_tablename||'.addColumn(column4);
212
213 </script>');
214
215 end;
216 procedure actionsJavascript(p_actions actionTable,
217 p_actiontext varchar2 default null) is
218 l_buttonRow varchar2(2000);
219 begin
220
221 htp.p('<script language="javascript">');
222
223 if p_actions.COUNT > 0
224 then
225 htp.p('//Define the action buttons.');
226
227 l_buttonRow := 'top.a = new top.buttonRow(';
228 for i in p_actions.FIRST..p_actions.LAST loop
229 htp.p(p_actions(i).name||' = new top.button("shape:'||p_actions(i).shape||'; text:'||p_actions(i).text||'; actiontype:'||p_actions(i).actiontype||'; action:'||p_actions(i).action||'; targetframe:'||p_actions(i).targetframe||';");');
230
231 l_buttonRow := l_buttonRow||p_actions(i).name;
232 if i < p_actions.LAST
233 then
234 l_buttonRow := l_buttonRow||',';
235 end if;
236 end loop;
237 l_buttonRow := l_buttonRow||');';
238 htp.p(l_buttonRow);
239 else
240 htp.p('//No action buttons.
241 top.a = new Object;
242 top.a.render = top.renderhtml;
243 top.a.htmlstring = "";');
244 end if;
245
246 if p_actiontext is not null
247 then
248 htp.p('top.at.htmlstring = "<font class=datablack>'||p_actiontext||'</font>";');
249 else
250 htp.p('top.at.htmlstring = "";');
251 end if;
252
253 htp.p('</script>');
254
255 end;
256
257 procedure locatorJavascript(p_locator in boolean) is
258
259 begin
260
261 htp.p('<script language="javascript">');
262
263 if p_locator
264 then
265
266 htp.p('//variables for this version to support the demonstration of the locator bar.
267
268 var prevenabled = false
269 var nextenabled=true
270 var wherenow = 1;
271 var totalsteps = 6;
272
273 //create an object for the lower set of buttons - the navigation and locator bar set.
274
275 var b = new Object;
276 b.render = renderhtml;
277 setup_b();
278
279 //temporary function that calls the procedural makebutton function and assigns the html string attached
280 //to the navigation button object ("b"). This is re-generated when the navigati on buttons and locator
281 //bar are re-drawn in response to clicking the back and next buttons. This code will be replaced with
282 //calls to the button object method to set button enabled conditions or text when the object version of
283 //the button constructor library is completed.
284
285 function setup_b () {
286 b.htmlstring = makebuttons(
287 "RR","Cancel","doc/index.html target=_top",b_enabled,b_normal,b_wide_gap
288 ,
289 "RS","Back","top.doprev",prevenabled,b_normal,b_narrow_gap,
290 b_locator,"Spring - Rain>Rain>Summer>Drizzle and Fog>Fall>Winter - Rain",top.wherenow,
291 "SR","Next","top.donext",nextenabled,b_default,b_no_gap);
292 }
293
294 //custom functions to process through the locator bar. When the object version of the button constructor
295 //library is complete, there will be method calls to control the advancement of the locator navigation.
296
297 function donext() {
298 if (wherenow < totalsteps) {
299 wherenow++
300 prevenabled = true;
301 setup_b();
302 top.buttons.location.reload();
303 }
304 if (wherenow == totalsteps) {
305 nextenabled = false;
306 setup_b();
307 top.buttons.location.reload();
308 }
309 };
310 function doprev() {
311 if (wherenow > 1) {
312 wherenow--
313 nextenabled = true;
314 setup_b();
315 top.buttons.location.reload();
316 }
317 if (wherenow == 1) {
318 prevenabled = false;
319 setup_b();
320 top.buttons.location.reload();
321 }
322 };');
323
324 else
325 htp.p('//Dummy locator goes here');
326 end if;
327
328 htp.p('</script>');
329
330 end;
331
332 procedure displaytoolbar(p_toolbar in icx_cabo.toolbar) is
333
334 begin
335
336 icx_cabo.toolbarJavascript(p_toolbar);
337
338 htp.p('<script language="javascript">');
339 -- htp.p('top.header.location = "OA_HTML/webtools/container_top.html";');
340 htp.p('top.header.location.reload();');
341 htp.p('</script>');
342
343 end;
344
345 procedure hidden_dataJavascript(p_tablename in varchar2) is
346
347 l_table_data_name varchar2(80);
348
349 begin
350
351 l_table_data_name := p_tablename||'data';
352
353 htp.p('<script src="OA_HTML/webtools/jslib/data_constructor.js" language="javascript"></script>
354
355 <script language="javascript">
356 //array of data, consisting of data only. For simple display table
357 '||l_table_data_name||' = new dispArray();
358
359 //adding using "array.length" automatically adds new lines to the next');
360
361 htp.p(l_table_data_name||'['||l_table_data_name||'.length] = new Array("8:00","Tuesday","Dilbert","http://www.upn.com/shows/dilbert/dilbert.htm","OA_HTML/webtools/images/happy.gif","","Fun");');
362
363 htp.p(l_table_data_name||'['||l_table_data_name||'.length] = new Array("8:30","Tuesday","Red Handed","http://www.upn.com/shows/red/redhanded.htm","OA_HTML/webtools/images/happy1.gif","","Looks Stupid");');
364
365 htp.p(l_table_data_name||'['||l_table_data_name||'.length] = new Array("9:00","Wednesday","Star Trek - Voyager","http://www.upn.com/shows/voyager/voyager.htm","OA_HTML/webtools/images/happy.gif","","Great, of course");');
366
367 htp.p(l_table_data_name||'['||l_table_data_name||'.length] = new Array("9:30","Thursday","Shasta McNasty","http://www.upn.com/launch/html/shasta/shasta.htm","","","unknown");');
368
369 htp.p(p_tablename||'.setDataSource('||l_table_data_name||')
370 </script>');
371
372 end;
373
374 procedure show_table is
375
376 l_tablename varchar2(80);
377
378 begin
379
380 htp.p('<html>
381 <link rel=stylesheet type="text/css" href="OA_HTML/webtools/images/cabo_styles.css">
382
383 <body class=panel>
384 <script src = "OA_HTML/webtools/jslib/cabo_utilities.js" language="javascript"></script>');
385
386 l_tablename := 'region1';
387
388 icx_cabo.show_tableJavascript(l_tablename);
389 icx_cabo.hidden_dataJavascript(l_tablename);
390
391 htp.p('<center>
392 <script language="javascript">
393 '||l_tablename||'.render(window);
394 </script>
395 </center>');
396
397 htp.p('</body>
398 </html>');
399
400 end;
401
402 procedure nobuttons is
403
404 begin
405
406 htp.p('<script language="javascript">');
407 htp.p('top.buttons.location = "OA_HTML/webtools/container_nobottom.html";');
408 htp.p('</script>');
409
410 end;
411
412 procedure buttons(p_actiontext in varchar2 default null) is
413
414 l_actions icx_cabo.actionTable;
415
416 begin
417
421
418 icx_cabo.buttons(p_actions => l_actions,
419 p_actiontext => p_actiontext);
420 end;
422 procedure buttons(p_actions in icx_cabo.actionTable,
423 p_actiontext in varchar2 default null,
424 p_locator in boolean default FALSE) is
425
426 l_bottom_html varchar2(240);
427 l_bottom_height varchar2(30);
428
429 begin
430
431 actionsJavascript(p_actions,p_actiontext);
432
433 if p_locator
434 then
435 locatorJavascript(p_locator);
436 end if;
437
438 htp.p('<script language="javascript">');
439 htp.p('top.buttons.location.reload();');
440 htp.p('</script>');
441
442 end;
443
444 procedure container(p_toolbar in icx_cabo.toolbar,
445 p_helpmsg in varchar2,
446 p_helptitle in varchar2,
447 p_tabicons in icx_cabo.tabiconTable,
448 p_currenttab in number default 1,
449 p_tabs in icx_cabo.tabTable,
450 p_url in varchar2 default null,
451 p_action in boolean default FALSE,
452 p_locator in boolean default FALSE) is
453
454 l_tab_html varchar2(240);
455 l_main_url varchar2(2000);
456 l_bottom_html varchar2(240);
457 l_bottom_height varchar2(30);
458
459 l_toolbar icx_cabo.toolbar;
460
461 begin
462
463 if icx_cabo.g_base_href is null
464 then
465 htp.p('<BASE HREF="'||FND_WEB_CONFIG.WEB_SERVER||'">');
466 else
467 htp.p('<BASE HREF="'||icx_cabo.g_base_href||'">');
468 end if;
469
470 htp.p('<link rel=stylesheet type="text/css" href="OA_HTML/webtools/images/cabo_styles.css">');
471
472 htp.p('<script language="javascript">
473 var baseHref = document.location.protocol + "//" + document.location.host + "/";
474 </script>');
475
476 htp.p('<script src="OA_HTML/webtools/jslib/cabo_utilities.js" language="javascript"></script>');
477 htp.p('<script src="OA_HTML/webtools/jslib/container_constructor.js" language="javascript"></script>');
478 htp.p('<script src="OA_HTML/webtools/jslib/toolbar_constructor.js" language="javascript"></script>');
479 htp.p('<script src="OA_HTML/webtools/jslib/button_constructor.js" language="javascript"></script>');
480
481 htp.p('<script language="javascript">
482
483 function renderhtml (window_ref) {
484 if (this.htmlstring != "") {
485 window_ref.document.write(this.htmlstring);
486 }
487 else {
488 window_ref.document.write("<BR>");
489 };
490 };
491
492 </script>');
493
494 icx_cabo.toolbarJavascript(p_toolbar);
495
496 icx_cabo.tabiconsJavascript(p_tabicons);
497
498 l_tab_html := 'OA_HTML/webtools/'||icx_cabo.tabsJavascript(p_helpmsg => p_helpmsg,
499 p_helptitle => p_helptitle,
500 p_currenttab => p_currenttab,
501 p_tabs => p_tabs);
502 if p_url is null
503 then
504 l_main_url := p_tabs(p_currenttab-1).url;
505 else
506 l_main_url := p_url;
507 end if;
508
509 if p_action and p_locator
510 then
511 l_bottom_html := 'OA_HTML/webtools/container_bottom.html';
512 l_bottom_height := '75';
513 elsif p_action
514 then
515 l_bottom_html := 'OA_HTML/webtools/container_actions_bottom.html';
516 l_bottom_height := '40';
517 htp.p('<script language="javascript">');
518
519 htp.p('
520 //Action actions
521 top.a = new Object;
522 top.a.render = top.renderhtml;
523 top.a.htmlstring = "";
524
525 //Action text
526 top.at = new Object;
527 top.at.render = top.renderhtml;
528 top.at.htmlstring = "";');
529
530 htp.p('</script>');
531
532 elsif p_locator
533 then
534 l_bottom_html := 'OA_HTML/webtools/container_locator_bottom.html';
535 l_bottom_height := '40';
536 else
537 l_bottom_html := 'OA_HTML/webtools/container_nobottom.html';
538 l_bottom_height := '40';
539 end if;
540
541 htp.p('<frameset cols="3,*,3" frameborder=no border=0>
542
543 <frame');
544 -- src="javascript:top.blankframe()"
545 htp.p('
546 src="OA_HTML/webtools/blank.html"
547 name=border1
548 marginwidth=0
549 marginheight=0
550 scrolling=no>
551
552 <frameset rows="50,50,*,'||l_bottom_height||'" framespacing=0>
553 <frame
554 src="OA_HTML/webtools/container_top.html"
555 name="header"
556 marginwidth=0
557 marginheight=2
558 scrolling=no>
559 <frame
560 src="'||l_tab_html||'"
561 name="tabs"
562 marginwidth=0
563 scrolling=no>
564
565 <frame
566 src="'||l_main_url||'"
567 name="main"
568 marginwidth=3
569 scrolling=auto>
570 <frame
571 src="'||l_bottom_html||'"
572 name="buttons"
573 marginwidth=0
574 scrolling=no>
575
576 </frameset>
577
578 <frame');
579 -- src="javascript:top.blankframe()"
580 htp.p('
581 src="OA_HTML/webtools/blank.html"
582 name=border2
583 marginwidth=0
584 marginheight=0
585 scrolling=no>
586
587 </frameset>');
588
589 exception
590 when others then
591 htp.p(SQLERRM);
592 end;
593
594 procedure container(p_toolbar in icx_cabo.toolbar,
595 p_helpmsg in varchar2,
596 p_helptitle in varchar2,
597 p_url in varchar2 default null,
598 p_action in boolean default FALSE,
599 p_locator in boolean default FALSE) is
600
601 l_tabicons tabiconTable;
602 l_currenttab number;
603 l_tabs tabTable;
604
605 begin
606
607 l_currenttab := 1;
608
609 container(p_toolbar => p_toolbar,
610 p_helpmsg => p_helpmsg,
611 p_helptitle => p_helptitle,
612 p_tabicons => l_tabicons,
613 p_currenttab => l_currenttab,
614 p_tabs => l_tabs,
615 p_url => p_url,
616 p_action => p_action,
617 p_locator => p_locator);
618
619 end;
620
621 procedure container(p_toolbar in icx_cabo.toolbar,
622 p_helpmsg in varchar2,
623 p_helptitle in varchar2,
624 p_currenttab in number default 1,
625 p_tabs in icx_cabo.tabTable,
626 p_url in varchar2 default null,
627 p_action in boolean default FALSE,
628 p_locator in boolean default FALSE) is
629
630 l_tabicons tabiconTable;
631
632 begin
633
634 container(p_toolbar => p_toolbar,
635 p_helpmsg => p_helpmsg,
636 p_helptitle => p_helptitle,
637 p_tabicons => l_tabicons,
638 p_currenttab => p_currenttab,
639 p_tabs => p_tabs,
640 p_url => p_url,
641 p_action => p_action,
642 p_locator => p_locator);
643
644 end;
645
646 function plsqlagent return varchar2 is
647
648 l_agent varchar2(240);
649 begin
650
651 l_agent := ltrim(owa_util.get_cgi_env('SCRIPT_NAME'),'/')||'/';
652
653 return l_agent;
654
655 end;
656
657 end icx_cabo;