DBA Data[Home] [Help]

PACKAGE BODY: APPS.ICX_PAGE_WIDGET

Source


1 package body icx_page_widget as
2 /* $Header: ICXWIGB.pls 120.0 2005/10/07 12:21:43 gjimenez noship $ */
3 
4    function arraytocsv( p_array in icx_api_region.array ) return varchar2
5    as
6       v_csv varchar2(10000) := '';
7    begin
8       if p_array.count = 0 then
9          return '';
10       end if;
11       for i in 1 .. p_array.count loop
12          v_csv := v_csv || ',' || p_array(i);
13       end loop;
14       return substr( v_csv, 2 );
15    exception
16       when others then
17          htp.p(SQLERRM);
18    end;
19 
20    -- Required for padding strings with non-breaking spaces. Used in buildselectboxes
21    function nbsppad( p_string in varchar2, p_length in number ) return varchar2
22    as
23    begin
24       if p_string is null then
25          return(replace( rpad( ' ', p_length-1), ' ', '  ' ));
26       else
27          return(replace( rpad( p_string, p_length-length(p_string)), ' ', '  ' ));
28       end if;
29    exception
30    when others then
31         raise NBSPPAD_EXCEPTION;
32    end nbsppad;
33 
34 
35    procedure buildselectboxes(
36       p_leftnames  in icx_api_region.array,      --- list of names of available providers:portlets
37       p_leftids    in icx_api_region.array,      --- list of ids of available provider:portletids
38       p_rightnames in icx_api_region.array,      --- list of names of selected providers:portlets
39       p_rightids   in icx_api_region.array,      --- list of ids of selected providers:portletids:instanceids
40       p_pageid     in number,
41       p_regionid   in number
42       )
43    as
44       l_label varchar2(80);
45    begin
46       htp.tableRowOpen;
47       htp.prn( '<td rowspan=4 align="left">' );
48 
49       htp.formSelectOpen( 'p_leftselect', nsize => 8, cattributes=>'multiple');
50       for i in 1 .. p_leftids.count loop
51          -- if added to prevent truncation of strings longer than 32 from the rpad function
52          -- mputman 1420084
53          IF length(p_leftnames(i))<32 THEN
54          htp.formSelectOption( replace( rpad( p_leftnames(i), 32), ' ', '  ' ), cattributes => 'VALUE="'||p_leftids(i)||'"' );
55          ELSE
56          htp.formSelectOption( replace( p_leftnames(i), ' ', '  ' ), cattributes => 'VALUE="'||p_leftids(i)||'"' );
57          END IF;
58       end loop;
59 
60       if p_leftids.count = 0 then
61          htp.formSelectOption( nbsppad( null, 32 ), cattributes => 'VALUE=""' );
62       end if;
63       htp.formSelectClose;
64       htp.prn( '</td>' );
65 
66       select ATTRIBUTE_LABEL_LONG
67       into   l_label
68       from   AK_ATTRIBUTES_VL
69       where  ATTRIBUTE_CODE = 'CSI_SHTL_MOVEALL';
70 
71       htp.tableData( '<A HREF="javascript:copyAll(document.addPlugdlg.p_leftselect,document.addPlugdlg.p_rightselect,''right'', ''addPlugdlg'');">' ||
72              '<img src=' || '/OA_MEDIA/moverightall.gif' ||
73                 ' align=bottom border=0 alt="'|| l_label || '">' ||
74              '</A>' );
75 
76       htp.prn( '<td rowspan=4 align="left">' );
77       htp.formSelectOpen('p_rightselect', nsize => 8, cattributes=>'multiple');
78       for i in 1 .. p_rightids.count loop
79          -- if added to prevent truncation of strings longer than 32 from the rpad function
80          -- mputman 1420084
81          IF lengthb(p_rightnames(i))<32 THEN
82             htp.formSelectOption( replace( rpad( p_rightnames(i), 32), ' ', '  ' ), cattributes => 'VALUE="'||p_rightids(i)||'"' );
83          ELSE
84             htp.formSelectOption( replace( p_rightnames(i), ' ', '  ' ), cattributes => 'VALUE="'||p_rightids(i)||'"' );
85          END IF;
86       end loop;
87       if p_rightids.count = 0 then
88          htp.formSelectOption( nbsppad( null, 32 ), cattributes => 'VALUE=""' );
89       end if;
90       htp.formSelectClose;
91 
92 
93       htp.formHidden( 'p_selectedlist', arraytocsv(p_rightids));
94       htp.formHidden( 'p_region_id', p_regionid);
95       htp.formHidden( 'p_page_id', p_pageid);
96       htp.prn( '</td>' );
97 
98       select ATTRIBUTE_LABEL_LONG
99       into   l_label
100       from   AK_ATTRIBUTES_VL
101       where  ATTRIBUTE_CODE = 'JTFB_ADMIN_TOP';
102 
103       htp.tableData( '<A HREF="javascript:moveElementTop(document.addPlugdlg.p_rightselect, ''addPlugdlg'');">' ||
104          '<img src= /OA_MEDIA/movetop.gif' || ' align=bottom border=0 alt="'||
105               l_label || '">' ||
106          '</A>' );
107       htp.tableRowClose;
108 
109       htp.tableRowOpen;
110 
111       select ATTRIBUTE_LABEL_LONG
112       into   l_label
113       from   AK_ATTRIBUTES_VL
114       where  ATTRIBUTE_CODE = 'CSI_SHTL_MOVE';
115 
116       htp.tableData( '<A HREF="javascript:copyToList(document.addPlugdlg.p_leftselect,document.addPlugdlg.p_rightselect,''right'', ''addPlugdlg'');">' ||
117          '<img src= /OA_MEDIA/moveright.gif' || ' align=bottom border=0 alt="'||
118               l_label || '">' ||
119          '</A>' );
120 
121       select ATTRIBUTE_LABEL_LONG
122       into   l_label
123       from   AK_ATTRIBUTES_VL
124       where  ATTRIBUTE_CODE = 'BIS_UP';
125 
126       htp.tableData( '<A HREF="javascript:moveElementUp(document.addPlugdlg.p_rightselect, ''addPlugdlg'');">' ||
127          '<img src= /OA_MEDIA/moveup.gif' || ' align=bottom border=0 alt="'||
128               l_label || '">' ||
129          '</A>' );
130       htp.tableRowClose;
131 
132       htp.tableRowOpen;
133 
134       select ATTRIBUTE_LABEL_LONG
135       into   l_label
136       from   AK_ATTRIBUTES_VL
137       where  ATTRIBUTE_CODE = 'CSI_SHTL_REMOVE';
138 
139       htp.tableData( '<A HREF="javascript:copyToList(document.addPlugdlg.p_rightselect,document.addPlugdlg.p_leftselect,''left'', ''addPlugdlg'');">' ||
140              '<img src= /OA_MEDIA/moveleft.gif' || ' align=bottom border=0 alt="'||
141                   l_label || '">' ||
142              '</A>' );
143 
144       select ATTRIBUTE_LABEL_LONG
145       into   l_label
146       from   AK_ATTRIBUTES_VL
147       where  ATTRIBUTE_CODE = 'BIS_DOWN';
148 
149       htp.tableData( '<A HREF="javascript:moveElementDown(document.addPlugdlg.p_rightselect, ''addPlugdlg'');">' ||
150          '<img src= /OA_MEDIA/movedown.gif' || ' align=bottom border=0 alt="'||
151               l_label || '">' ||
152          '</A>' );
153       htp.tableRowClose;
154 
155       htp.tableRowOpen;
156 
157       select ATTRIBUTE_LABEL_LONG
158       into   l_label
159       from   AK_ATTRIBUTES_VL
160       where  ATTRIBUTE_CODE = 'CSI_SHTL_REMOVEALL';
161 
162       htp.tableData( '<A HREF="javascript:copyAll(document.addPlugdlg.p_rightselect,document.addPlugdlg.p_leftselect,''left'', ''addPlugdlg'');">' ||
163              '<img src= /OA_MEDIA/moveleftall.gif' || ' align=bottom border=0 alt="'||
164                   l_label || '">' ||
165              '</A>' );
166 
167       select ATTRIBUTE_LABEL_LONG
168       into   l_label
169       from   AK_ATTRIBUTES_VL
170       where  ATTRIBUTE_CODE = 'JTFB_ADMIN_BOTTOM';
171 
172       htp.tableData( '<A HREF="javascript:moveElementBottom(document.addPlugdlg.p_rightselect, ''addPlugdlg'');">' ||
173          '<img src= /OA_MEDIA/movebottom.gif' || ' align=bottom border=0 alt="'||
174               l_label || '">' ||
175          '</A>' );
176       htp.tableRowClose;
177    exception
178    when others then
179         raise BUILDSELECTBOXES_EXCEPTION;
180    end buildselectboxes;
181 
182 end icx_page_widget;