DBA Data[Home] [Help]

PACKAGE BODY: APPS.ICX_LOGIN

Source


1 package body icx_login as
2 /* $Header: ICXLOGIB.pls 120.1 2005/10/07 13:33:18 gjimenez noship $ */
3 
4 
5 
6 function validateSession(session_id in number) return number is
7 begin
8   if icx_sec.validateSessionPrivate(session_id) then
9     return 1;
10   else
11     return 0;
12   end if;
13 end;
14 
15 
16 function get_fnd_message(application_code in varchar2,
17                          message_name in varchar2,
18                          message_token_name in varchar2 default null,
19                          message_token_value in varchar2 default null)
20          return varchar2 is
21 
22 begin
23 
24   fnd_message.set_name(application_code, message_name);
25   if message_token_name is not null then
26     fnd_message.set_token(message_token_name, message_token_value);
27   end if;
28 
29   return fnd_message.get;
30 
31 
32 end;
33 
34 procedure getMenuEntries(p_sub_menu_id in number,
35                          p_menu_id in out nocopy number,
36                          p_entry_sequence out nocopy number) is
37 
38 l_sub_menu_id number;
39 l_menu_id number;
40 l_entry_sequence number;
41 
42 cursor  menuentries is
43 select  sub_menu_id
44 from    fnd_menu_entries
45 where   menu_id = p_sub_menu_id
46 and     sub_menu_id is not null
47 order by entry_sequence;
48 
49 begin
50 
51   begin
52     select menu_id, entry_sequence
53     into   l_menu_id, l_entry_sequence
54     from   fnd_form_functions a,
55            fnd_menu_entries b
56     where b.menu_id = p_sub_menu_id
57     and   b.function_id = a.function_id
58     and   a.function_name = 'ICX_NAVIGATE_PLUG';
59   exception
60     when NO_DATA_FOUND then
61       l_menu_id := '';
62       l_entry_sequence := '';
63   end;
64 
65   if l_entry_sequence is null
66   then
67     for m in menuentries loop
68       if l_menu_id is null
69       then
70         l_sub_menu_id := m.sub_menu_id;
71         getMenuEntries(l_sub_menu_id, l_menu_id, l_entry_sequence);
72       end if;
73     end loop;
74   end if;
75 
76   p_menu_id := l_menu_id;
77   p_entry_sequence := l_entry_sequence;
78 
79 end;
80 
81 function get_page_id(p_user_id in number)
82          return number is
83 
84 l_count			number := 0;
85 l_page_id		varchar2(30);
86 l_plug_id		number;
87 l_responsibility_id	number;
88 l_sub_menu_id		number;
89 l_menu_id		number;
90 l_entry_sequence	number;
91 l_function_id		number;
92 l_display_name		varchar2(80);
93 l_rowid			varchar2(30);
94 l_main_region_id        number;
95 l_sequence_number	number;
96 
97 cursor responsibilities is
98 select  a.responsibility_id,
99         a.menu_id
100 from    fnd_responsibility_vl a,
101         FND_USER_RESP_GROUPS b
102 where   b.user_id = p_user_id
103 and     b.start_date <= sysdate
104 and     (b.end_date is null or b.end_date > sysdate)
105 and     b.RESPONSIBILITY_application_id = a.responsibility_id
106 and     a.version = 'W'
107 and     a.start_date <= sysdate
108 and     (a.end_date is null or a.end_date > sysdate)
109 order by responsibility_name;
110 
111 begin
112 
113   begin
114     select min(PAGE_ID)
115     into   l_page_id
116     from   icx_pages
117     where user_id = p_user_id
118     and PAGE_TYPE = 'USER';
119   exception
120     when NO_DATA_FOUND then
121       l_page_id := '';
122   end;
123 
124   if l_page_id is null
125   then
126 
127     select icx_pages_s.nextval, icx_page_plugs_s.nextval
128     into   l_page_id,l_plug_id
129     from sys.dual;
130 
131     select nvl(max(sequence_number),1)
132       into l_sequence_number
133       from icx_pages
134      where user_id = icx_sec.g_user_id;
135 
136     l_main_region_id := icx_api_region.create_main_region;
137 
138     -- to make old PHP user data compatible with new PHP we need to insert
139     -- rows in icx_pages as wells as icx_pages_tl
140     --
141     -- 1388074 mputman added substrb to wf_core call
142 
143     ICX_PAGES_PKG.INSERT_ROW(
144                 x_rowid                 => l_rowid,
145 		x_page_id		=> l_page_id,
146 		x_page_code		=>  'ICX_PAGE_' || l_page_id,
147 		x_main_region_id	=> l_main_region_id,
148 		x_sequence_number	=> l_sequence_number + 1,
149 		x_page_type		=> 'USER',
150 		x_user_id		=> icx_sec.g_user_id,
151 		x_refresh_rate		=> 0,
152 		x_page_name		=> substrb(wf_core.translate('ICX_MY_HOME'),1,80),
153 		x_page_description	=> p_user_id,
154                 x_creation_date		=> sysdate,
155 		x_created_by		=> p_user_id,
156 		x_last_update_date	=> sysdate,
157 		x_last_updated_by	=> 1,
158 		x_last_update_login	=> 1);
159 
160     --insert into icx_pages
161     --(page_id,
162     -- page_name,
163     -- page_type,
164     -- page_description,
165     -- user_id,
166     -- refresh_rate,
167     -- creation_date,
168     -- created_by,
169     -- last_update_date,
170     -- last_updated_by,
171     -- last_update_login)
172     --values
173     --(l_page_id,
174     -- wf_core.translate('MAIN_MENU'),
175     -- 'MAIN',
176     -- null,
177     -- p_user_id,
178     -- 0,
179     -- sysdate,1,sysdate,1,1);
180 
181 
182     select count(*) into l_count
183     from icx_page_color_scheme
184     where user_id = p_user_id;
185     if ( l_count = 0 ) then
186       insert into icx_page_color_scheme
187       (user_id,
188        toolbar_color,
189        heading_color,
190        banner_color,
191        background_color,
192        color_scheme,
193        creation_date,
194        created_by,
195        last_update_date,
196        last_updated_by,
197        last_update_login)
198        values
199       (p_user_id,
200        '#0000CC',
201        '#99CCFF',
202        '#99CCFF',
203        '#FFFFFF',
204        'BL',
205        sysdate,1,sysdate,1,1);
206     end if;
207 
208 /* used to find if user has navigate function
209     l_responsibility_id := '';
210     l_menu_id := '';
211     l_entry_sequence := '';
212     for r in responsibilities loop
213       if l_menu_id is null
214       then
215         l_sub_menu_id := r.menu_id;
216         getMenuEntries(l_sub_menu_id, l_menu_id, l_entry_sequence);
217         l_responsibility_id := r.responsibility_id;
218       end if;
219     end loop;
220 */
221 
222     select function_id, user_function_name
223     into   l_function_id, l_display_name
224     from   fnd_form_functions_vl
225     where  function_name = 'ICX_NAVIGATE_PLUG';
226 
227     insert into icx_page_plugs
228     (plug_id,
229      page_id,
230      display_sequence,
231      responsibility_id,
232      menu_id,
233      entry_sequence,
234      display_name,
235      region_id,
236      creation_date,
237      created_by,
238      last_update_date,
239      last_updated_by,
240      last_update_login)
241     values
242     (l_plug_id,
243      l_page_id,
244      0,
245      -1,
246      -1,
247      l_function_id,
248      l_display_name,
249      l_main_region_id,
250      sysdate,1,sysdate,1,1);
251 
252   end if;
253 
254   /*
255   ** Now get the minimum page id for user to show the proper
256   ** page
257   */
258   select MIN(page_id)
259   into   l_page_id
260   from   ICX_PAGES
261   where user_id = p_user_id
262   and   page_type = 'USER';
263 
264 return l_page_id;
265 
266 end;
267 
268 
269 function replace_onMouseOver_quotes(p_string in varchar2,
270                                     p_browser in varchar2) return varchar2 is
271 temp_string varchar2(2000);
272 
273 begin
274   -- replace single quotes
275   temp_string := replace(p_string,'''','\''');
276 
277   -- replace double quotes
278   if (instr(p_browser, 'MSIE') <> 0) then
279     temp_string := replace(temp_string,'"','\''');
280   else
281     temp_string := replace(temp_string,'"','"');
282   end if;
283 
284   -- check for double escapes
285   temp_string := replace(temp_string,'\\','\');
286 
287   return temp_string;
288 
289 end replace_onMouseOver_quotes;
290 
291 end icx_login;