[Home] [Help]
PACKAGE BODY: APPS.ICX_SETUP
Source
1 PACKAGE BODY ICX_SETUP as
2 /* $Header: ICXDPARB.pls 120.0 2005/10/07 12:14:05 gjimenez noship $ */
3
4 -- Create a page for user to input post-install setup info
5 -- Store it in icx_parameters
6 --
7 PROCEDURE get_parameters is
8 v_query_set number;
9 v_home_url varchar2(240);
10 v_webmaster_email varchar2(80);
11 v_max_rows number;
12 v_language varchar2(30);
13 PV_LANGUAGE_CODE number := 21; -- parameter value for calling getID
14 v_web_user varchar2(30);
15 PV_WEB_USER_ID number := 10; -- parameter value for calling getID
16
17 -- variables used to build path for images, static html
18 v_help_html varchar2(150);
19 v_bkgrd_image varchar2(150);
20 v_gap_image varchar2(150);
21
22 -- variables used to get prompts from Object Navigator
23 v_appl_id number := 601; -- application_id
24 v_page_code varchar2(30) := 'ICX_SETUP'; -- page code as defined in ON
25 v_title varchar2(80); -- page title
26 v_prompt_tab icx_util.g_prompts_table; -- PL/SQL table of prompts
27 v_save_label varchar2(50) := null;
28 v_revert_label varchar2(50) := null;
29 v_lines_page varchar2(50) := null;
30 v_start_url varchar2(50) := null;
31 v_web_email varchar2(50) := null;
32 v_max_rows_returned varchar2(50) := null;
33
34 l_save_url varchar2(1000);
35 l_revert_url varchar2(1000);
36
37 -- variables for messages, hints
38 v_set_req varchar2(240);
39 -- v_url_req varchar2(240); bug 2565837
40 v_email_req varchar2(240);
41
42 c_browser varchar2(400) := owa_util.get_cgi_env('HTTP_USER_AGENT');
43
44 begin
45 if (icx_sec.validateSession('ICX_SETUP')) then
46
47 -- need the language code to find any images or static html
48 v_language := icx_sec.getID(PV_LANGUAGE_CODE);
49 v_web_user := icx_sec.getID(PV_WEB_USER_ID);
50
51 select query_set,
52 home_url,
53 webmaster_email,
54 max_rows
55 into v_query_set,
56 v_home_url,
57 v_webmaster_email,
58 v_max_rows
59 from icx_parameters;
60
61 -- get the title and prompts from Object Navigator
62 icx_util.getPrompts(v_appl_id, v_page_code, v_title, v_prompt_tab);
63 v_save_label := v_prompt_tab(1);
64 v_revert_label := v_prompt_tab(2);
65 v_lines_page := v_prompt_tab(3);
66 v_start_url := v_prompt_tab(4);
67 v_web_email := v_prompt_tab(5);
68 v_max_rows_returned := v_prompt_tab(6);
69
70 -- get error messages from Message Dictionary
71 fnd_message.set_name('ICX', 'ICX_LINES_PAGE_REQUIRED');
72 v_set_req := fnd_message.get;
73 -- fnd_message.set_name('ICX', 'ICX_HOME_URL_REQUIRED');
74 -- v_url_req := fnd_message.get;
75 fnd_message.set_name('ICX', 'ICX_WEB_EMAIL_REQUIRED');
76 v_email_req := fnd_message.get;
77
78 htp.htmlOpen;
79 -- show copyright in source
80 icx_util.copyright;
81 htp.headOpen;
82 htp.title(v_title);
83 htp.p('<SCRIPT LANGUAGE="JavaScript">');
84 htp.p('<!-- hide from old browsers');
85 -- creates javascript function to check if value is a number
86 js.checkNumber;
87 js.null_alert;
88
89 v_help_html := '/OA_DOC/'||v_language||'/aic/icxhlpst.htm';
90 icx_admin_sig.help_win_script(v_help_html, v_language);
91
92 fnd_message.set_name('CS','CS_ALL_GREATER_THAN_ZERO');
93 htp.p('function checkNonZero(input) {
94 var msg = "'||icx_util.replace_quotes(fnd_message.get)||'";
95 var str = input.value;
96 var count = 0;
97
98 for (var i = 0; i< str.length; i++) {
99 var ch = str.substring(i,i+1);
100 if (ch == "0") {
101 count++;
102 }
103 }
104 if (count==str.length) {
105 alert(msg);
106 return false;
107 }
108 return true;
109 }
110 ');
111 htp.p('function update_param(set_req, email_req) {
112 if (checkNumber(document.define_param.QuerySet) &&
113 (checkNonZero(document.define_param.QuerySet)) &&
114 (!null_alert(document.define_param.QuerySet.value, set_req)) &&
115 (!null_alert(document.define_param.WebEmail.value, email_req)))
116 document.define_param.submit();
117 } ');
118 htp.p('function restore_param() {
119 document.define_param.QuerySet.value = document.define_param.QuerySet.defaultValue;
120 document.define_param.HomeUrl.value = document.define_param.HomeUrl.defaultValue;
121 document.define_param.WebEmail.value = document.define_param.WebEmail.defaultValue;
122 } ');
123
124 htp.p('// done hiding from old browsers -->');
125 htp.p('</SCRIPT>');
126 htp.headClose;
127
128 -- Display logo, toolbar
129
130 icx_admin_sig.toolbar(v_language);
131
132 htp.header(2, v_title);
133 htp.para;
134 htp.formOpen('icx_setup.update_parameters', 'POST', '','', 'NAME="define_param" ');
135 htp.tableOpen;
136 htp.tableRowOpen;
137 htp.tableData(v_lines_page, 'RIGHT');
138 htp.tableData(htf.formText('QuerySet', 10, 10, v_query_set));
139 htp.tableRowClose;
140
141 htp.tableRowOpen;
142 htp.tableData(v_max_rows_returned, 'RIGHT');
143 htp.tableData(htf.formText('MaxRows', 10, 10, v_max_rows));
144 htp.tableRowClose;
145
146 htp.tableRowOpen;
147 htp.tableData(v_start_url, 'RIGHT');
148 htp.tableData(htf.formText('HomeUrl', 45, 240, icx_util.replace_alt_quotes(v_home_url)));
149 htp.tableRowClose;
150
151 htp.tableRowOpen;
152 htp.tableData(v_web_email, 'RIGHT');
153 htp.tableData(htf.formText('WebEmail', 45, 80, icx_util.replace_alt_quotes(v_webmaster_email)));
154 htp.tableRowClose;
155
156 htp.tableClose;
157 -- keep the web user id in a hidden field for last_updated_by
158 htp.formHidden('WebUser', icx_util.replace_alt_quotes(v_web_user));
159
160 htp.formClose;
161
162 l_save_url := 'javascript:update_param('''||icx_util.replace_onMouseOver_quotes(v_set_req)||''','''||icx_util.replace_onMouseOver_quotes(v_email_req)||''')';
163
164 icx_util.DynamicButton(P_ButtonText => v_save_label,
165 P_ImageFileName => 'FNDBSBMT',
166 P_OnMouseOverText => v_save_label,
167 P_HyperTextCall => l_save_url,
168 P_LanguageCode => v_language,
169 P_JavaScriptFlag => FALSE);
170
171 htp.tableRowClose;
172 htp.tableClose;
173
174 htp.bodyClose;
175 icx_sig.footer;
176 htp.htmlClose;
177
178 end if;
179
180 exception
181 when OTHERS then
182 htp.p(sqlerrm);
183
184 end get_parameters;
185
186 PROCEDURE update_parameters(QuerySet in number,
187 HomeUrl in varchar2,
188 WebEmail in varchar2,
189 MaxRows in number,
190 WebUser in number) is
191
192 begin
193
194 if (icx_sec.validateSession('ICX_SETUP')) then
195
196 update icx_parameters
197 set query_set = QuerySet,
198 home_url = HomeUrl,
199 webmaster_email = WebEmail,
200 max_rows = MaxRows,
201 last_updated_by = WebUser,
202 last_update_date = sysdate
203 ;
204
205 -- redisplay setup page
206 icx_setup.get_parameters;
207
208 end if;
209
210 end update_parameters;
211
212 END ICX_SETUP;