[Home] [Help]
PACKAGE BODY: APPS.PON_FORMS_JRAD_PVT
Source
1 PACKAGE BODY PON_FORMS_JRAD_PVT AS
2 -- $Header: PONFMJRB.pls 120.5 2007/09/03 05:48:10 adsahay ship $
3
4 -- we will switch between 2 regions, created for LOVs
5 -- 1st region will be used for LOVs with value-set validation list type set to 'Independent' or
6 -- 'Translatable Independent'
7 -- the 2nd region will be used for LOVs with value-set validation list type set to 'table'
8
9 g_jrad_lov_path_sql CONSTANT VARCHAR2(60) := '/oracle/apps/pon/forms/jrad/webui/ponFormsSqlBasedLovRN';
10 g_jrad_lov_path_tab CONSTANT VARCHAR2(60) := '/oracle/apps/pon/forms/jrad/webui/ponFormsTableBasedLovRN';
11 g_jrad_rgn_pkg_name CONSTANT VARCHAR2(50) := '/oracle/apps/pon/forms/jrad/webui/';
12 g_jrad_ext_poplist CONSTANT VARCHAR2(60) := '/oracle/apps/pon/forms/jrad/webui/ponExtAbsPoplistRG';
13 g_jrad_ext_page_path CONSTANT VARCHAR2(60) := '/oracle/apps/pon/forms/jrad/webui/ponExtAbstractTableRG';
14 g_jrad_long_tip_rgn CONSTANT VARCHAR2(60) := '/oracle/apps/pon/forms/jrad/webui/ponFormsJradLongTipRN';
15
16 g_ext_abs_vo_name CONSTANT VARCHAR2(50) := 'AbstractFieldsTableVO';
17
18 g_lov_code CONSTANT VARCHAR2(20) := 'Code';
19 g_lov_description CONSTANT VARCHAR2(20) := 'Description';
20 g_lov_meaning CONSTANT VARCHAR2(20) := 'Meaning';
21 g_lov_vset_name CONSTANT VARCHAR2(20) := 'ValueSetName';
22 g_values_viewName CONSTANT VARCHAR2(20) := 'FormFieldValuesVO';
23 g_sql_poplist_view_name CONSTANT VARCHAR2(20) := 'SqlBasedPoplistVO';
24 g_tab_poplist_view_name CONSTANT VARCHAR2(20) := 'TableBasedPoplistVO';
25
26
27 g_fnd_debug CONSTANT VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
28 g_pkg_name CONSTANT VARCHAR2(30) := 'PON_FORMS_JRAD_PVT';
29 g_module_prefix CONSTANT VARCHAR2(50) := 'pon.plsql.' || g_pkg_name || '.';
30
31 g_app_module CONSTANT VARCHAR2(60) := 'oracle.apps.pon.forms.jrad.server.FormsDynamicJradAM';
32 g_controller CONSTANT VARCHAR2(60) := 'oracle.apps.pon.forms.jrad.webui.FormsDynamicJradCO';
33 g_ext_app_module CONSTANT VARCHAR2(60) := 'oracle.apps.pon.forms.jrad.server.FormsExtAbstractTableAM';
34 g_ext_controller CONSTANT VARCHAR2(60) := 'oracle.apps.pon.forms.jrad.webui.FormsExtAbstractTableCO';
35
36 g_spacer CONSTANT VARCHAR2(3) := '---';
37 g_under_score CONSTANT VARCHAR2(3) := '_';
38
39 g_sql_pop_list_count INTEGER;
40 g_table_pop_list_count INTEGER;
41 g_lov_map_count INTEGER;
42 g_pop_list_count INTEGER;
43 g_total_image_count INTEGER;
44 g_total_element_count INTEGER;
45 g_base_language VARCHAR2(4);
46 v_date_list_count INTEGER;
47 v_table_vo_count INTEGER;
48
49
50 /*======================================================================
51 FUNCTION: ISLOVVALUESET PRIVATE
52 PARAMETERS: NONE
53 COMMENT : This function is used to escape special characters in the
54 the prompts for various fields/sections.
55 ======================================================================*/
56
57 FUNCTION isLovValueSet(p_field_code IN VARCHAR2) RETURN VARCHAR2 IS
58
59 v_ret_value VARCHAR2(1);
60 l_api_name CONSTANT VARCHAR2(30) := 'ISLOVVALUESET';
61
62 BEGIN
63 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'BEGIN');
64
65 v_ret_value := 'N';
66
67 BEGIN
68 select decode(fnd_flex_value_sets.longlist_flag, 'X', 'N', 'Y') isLov
69 into v_ret_value
70 from pon_fields,
71 fnd_flex_value_sets
72 where pon_fields.value_set_name = fnd_flex_value_sets.flex_value_set_name
73 and pon_fields.value_set_name is not null
74 and pon_fields.field_code = p_field_code;
75
76 EXCEPTION
77 WHEN OTHERS THEN
78 v_ret_value := 'N';
79 END;
80
81
82 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'RETURN VALUE=' || v_ret_value);
83
84 RETURN v_ret_value;
85
86 END isLovValueSet;
87
88
89
90 /*======================================================================
91 FUNCTION: ESCAPESPECIALCHAR PRIVATE
92 PARAMETERS: NONE
93 COMMENT : This function is used to escape special characters in the
94 the prompts for various fields/sections.
95 ======================================================================*/
96
97 FUNCTION escapeSpecialChar(p_prompt IN VARCHAR2) RETURN VARCHAR2 IS
98
99 v_ret_value VARCHAR2(120);
100 l_api_name CONSTANT VARCHAR2(30) := 'ESCAPESPECIALCHAR';
101
102 BEGIN
103 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'BEGIN');
104
105 v_ret_value := replace(p_prompt, '&', '&'||'amp;');
106
107 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'RETURN VALUE=' || v_ret_value);
108
109 RETURN v_ret_value;
110
111 END escapeSpecialChar;
112
113
114 /*======================================================================
115 FUNCTION: GETPARENTELEMENTINDEX PRIVATE
116 PARAMETERS: NONE
117 COMMENT : This function is used to determine the index of the parent
118 item in the tree of region items while creating the JRAD
119 for a form.
120 ======================================================================*/
121
122 FUNCTION getParentElementIndex (p_type IN VARCHAR2,
123 p_form_id IN NUMBER,
124 p_section_id IN NUMBER,
125 p_incl_sec_id IN NUMBER,
126 p_rept_sec_id IN NUMBER,
127 p_field_code IN VARCHAR2) RETURN VARCHAR2 IS
128
129 v_ret_value VARCHAR2(120);
130 l_api_name CONSTANT VARCHAR2(30) := 'GETPARENTELEMENTINDEX';
131
132 BEGIN
133 IF (p_type = 'FORM') THEN
134 -- no parent
135 null;
136 ELSIF (p_type = 'FORM_FIELD') THEN
137 -- parent is form
138 v_ret_value := 'FORM' || g_spacer || p_form_id || g_spacer || 0
139 || g_spacer || 0 || g_spacer || 0
140 || g_spacer || to_char(null);
141
142 ELSIF (p_type = 'NORMAL_SECTION') THEN
143 -- parent is form
144 v_ret_value := 'FORM' || g_spacer || p_form_id || g_spacer || 0
145 || g_spacer || 0 || g_spacer || 0
146 || g_spacer|| to_char(null);
147
148 ELSIF (p_type = 'SECTION_FIELD') THEN
149 -- parent is normal_section
150 v_ret_value := 'NORMAL_SECTION'
151 || g_spacer || p_form_id || g_spacer || p_section_id
152 || g_spacer || 0 || g_spacer || 0
153 || g_spacer|| to_char(null);
154
155 ELSIF (p_type = 'INNER_NORMAL_SECTION') THEN
156 -- parent is normal_section
157 v_ret_value := 'NORMAL_SECTION'
158 || g_spacer || p_form_id || g_spacer || p_section_id
159 || g_spacer || 0 || g_spacer || 0
160 || g_spacer || to_char(null);
161
162 ELSIF (p_type = 'INNER_SECTION_FIELD') THEN
163 -- parent is inner_normal_section
164 v_ret_value := 'INNER_NORMAL_SECTION'
165 || g_spacer || p_form_id || g_spacer || p_section_id
166 || g_spacer || p_incl_sec_id || g_spacer || 0
167 || g_spacer || to_char(null);
168
169 ELSIF (p_type = 'REPEAT_SECTION') THEN
170 -- parent is form
171 v_ret_value := 'FORM' || g_spacer || p_form_id || g_spacer || 0
172 || g_spacer || 0 || g_spacer || 0
173 || g_spacer || to_char(null);
174
175 ELSIF (p_type = 'INNER_REPEAT_SECTION') THEN
176 -- parent is normal_section
177 v_ret_value := 'NORMAL_SECTION'
178 || g_spacer || p_form_id || g_spacer || p_section_id
179 || g_spacer || 0 || g_spacer || 0
180 || g_spacer || to_char(null);
181
182 ELSIF (p_type = 'INNER_SECTION_REPEAT_SECTION') THEN
183 -- parent is inner_normal_section
184 v_ret_value := 'INNER_NORMAL_SECTION'
185 || g_spacer || p_form_id || g_spacer || p_section_id
186 || g_spacer || p_incl_sec_id || g_spacer || 0
187 || g_spacer || to_char(null);
188 END IF;
189
190 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'RETURN VALUE=' || v_ret_value);
191
192 RETURN v_ret_value;
193
194 END getparentelementindex;
195
196
197
198 /*======================================================================
199 FUNCTION: GETCURRENTELEMENTINDEX PRIVATE
200 PARAMETERS: NONE
201 COMMENT : This function is used to return the index of the current
202 region item or region in the entire tree of JRAD items
203 while constructing the JRAD for a given form.
204 ======================================================================*/
205
206 FUNCTION getCurrentElementIndex(p_type IN VARCHAR2,
207 p_form_id IN NUMBER,
208 p_section_id IN NUMBER,
209 p_incl_sec_id IN NUMBER,
210 p_rept_sec_id IN NUMBER,
211 p_field_code IN VARCHAR2) RETURN VARCHAR2 IS
212
213 v_ret_value VARCHAR2(120);
214 l_api_name CONSTANT VARCHAR2(30) := 'GETCURRENTELEMENTINDEX';
215
216 BEGIN
217 v_ret_value := p_type || g_spacer || p_form_id || g_spacer || p_section_id
218 || g_spacer || p_incl_sec_id || g_spacer || p_rept_sec_id
219 || g_spacer || to_char(null);
220
221 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'RETURN VALUE=' || v_ret_value);
222
223 RETURN v_ret_value;
224
225 END getCurrentElementIndex;
226
227 /*======================================================================
228 FUNCTION: GETDISPLAYTYPE PRIVATE
229 PARAMETERS: NONE
230 COMMENT : Since we have restrictions on the number of characters
231 that we can have in a JRAD id, we will follow a certain
232 convention to construct each JRAD element
233
234 ======================================================================*/
235
236 FUNCTION getDisplayType (p_type IN VARCHAR2) RETURN VARCHAR2 IS
237
238 v_ret_value VARCHAR2(2);
239 l_api_name CONSTANT VARCHAR2(30) := 'GETDISPLAYTYPE';
240
241 BEGIN
242
243 -- we do have the following restrictions -
244 -- we cannot have variable names starting with a number
245 -- we cannot have variables names with dashes
246 -- i.e. only alpha-numeric characters and underscores
247 -- max length for a JRAD id in PL/SQL is 60 characters
248 -- i think there's no max length for a java variable name (or atleast < 60 characters)
249
250 IF (p_type = 'FORM') THEN
251 v_ret_value := 't1';
252 ELSIF (p_type = 'FORM_FIELD') THEN
253 v_ret_value := 't2';
254 ELSIF (p_type = 'NORMAL_SECTION') THEN
255 v_ret_value := 't3';
256 ELSIF (p_type = 'SECTION_FIELD') THEN
257 v_ret_value := 't4';
258 ELSIF (p_type = 'INNER_NORMAL_SECTION') THEN
259 v_ret_value := 't5';
260 ELSIF (p_type = 'INNER_SECTION_FIELD') THEN
261 v_ret_value := 't6';
262 ELSIF (p_type = 'REPEAT_SECTION') THEN
263 v_ret_value := 't7';
264 ELSIF (p_type = 'INNER_REPEAT_SECTION') THEN
265 v_ret_value := 't8';
266 ELSIF (p_type = 'INNER_SECTION_REPEAT_SECTION') THEN
267 v_ret_value := 't9';
268 ELSE
269 v_ret_value := 't0';
270 END IF;
271
272 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'RETURN VALUE=' || v_ret_value);
273
274 RETURN v_ret_value;
275
276 END getdisplaytype;
277
278
279 /*======================================================================
280 FUNCTION: GETDISPLAYID PRIVATE
281
282 PARAMETERS: NONE
283 COMMENT : This function simply returns the passed value or a null
284 value if the passed value is a -1
285
286 ======================================================================*/
287
288 FUNCTION getDisplayId(p_id IN NUMBER ) RETURN VARCHAR2 IS
289
290 v_ret_value VARCHAR2(10);
291 l_api_name CONSTANT VARCHAR2(30) := 'GETDISPLAYID';
292
293 BEGIN
294 IF(p_id = -1) THEN
295 v_ret_value := to_char(null);
296 ELSE
297 v_ret_value := to_char(p_id);
298 END IF;
299
300 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'RETURN VALUE=' || v_ret_value);
301
302 RETURN v_ret_value;
303
304 END getDisplayId;
305
306
307
308 /*======================================================================
309 FUNCTION: GETJRADID PRIVATE
310 PARAMETERS: NONE
311 COMMENT : This function returns the actual JRAD id to be used while
312 creating the JRAD for a form in such a way that it will
313 always be unique in the entire hierarchy
314
315 ======================================================================*/
316
317 FUNCTION getJradId(p_type IN VARCHAR2,
318 p_form_id IN NUMBER,
319 p_section_id IN NUMBER,
320 p_incl_sec_id IN NUMBER,
321 p_rept_sec_id IN NUMBER,
322 p_field_code IN VARCHAR2) RETURN VARCHAR2 IS
323
324 -- JDR_COMPONENTS.comp_id%TYPE;
325 -- max max 60 characters
326
327 v_ret_value VARCHAR2(60);
328 l_api_name CONSTANT VARCHAR2(30) := 'GETJRADID';
329
330 BEGIN
331 v_ret_value := getDisplayType(p_type)
332 || 'FM_' || getDisplayId(p_form_id)
333 || 'TS_' || getDisplayId(p_section_id)
334 || 'IS_' || getDisplayId(p_incl_sec_id)
335 || 'RS_' || getDisplayId(p_rept_sec_id)
336 || 'FD_' || p_field_code;
337
338
339 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'RETURN VALUE=' || v_ret_value);
340
341 RETURN v_ret_value;
342
343 END getJradId;
344
345
346
347 /*======================================================================
348 PROCEDURE: CREATE_LOV PRIVATE
349 PARAMETERS:
350 COMMENT : This procedure will create an LOV map for a messageLovInput
351 field.
352 ======================================================================*/
353
354 PROCEDURE CREATE_LOV(
355 p_field_code IN VARCHAR2,
356 p_vset_name IN VARCHAR2,
357 p_mapping_field IN VARCHAR2,
358 p_validation_type IN VARCHAR2,
359 p_jrad_field_id IN VARCHAR2,
360 p_input_elem IN jdr_docbuilder.Element) IS
361
362 err_num NUMBER;
363 err_msg VARCHAR2(100);
364 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_LOV';
365 lovMap jdr_docbuilder.ELEMENT;
366
367 BEGIN
368 /*
369 we want the lookup_type to be transferred from the generated page to the lov region
370 we want the meaning to be transferred from the lov region to the generated page
371 here's how our lovMappings shud look like
372 */
373
374 -- from Meaning resultTo _NAME
375
376 lovMap := jdr_docbuilder.createElement(jdr_docbuilder.JRAD_NS, 'lovMap');
377 jdr_docbuilder.setAttribute(lovMap, 'id', 'lovMap' || g_lov_map_count);
378 jdr_docbuilder.setAttribute(lovMap, 'lovItem', g_lov_meaning);
379 jdr_docbuilder.setAttribute(lovMap, 'resultTo', p_jrad_field_id);
380 jdr_docbuilder.setAttribute(lovMap, 'criteriaFrom', p_jrad_field_id);
381 jdr_docbuilder.addChild(p_input_elem, jdr_docbuilder.JRAD_NS, 'lovMappings',lovMap);
382 g_lov_map_count := g_lov_map_count + 1;
383
384 lovMap := jdr_docbuilder.createElement(jdr_docbuilder.JRAD_NS, 'lovMap');
385 jdr_docbuilder.setAttribute(lovMap, 'id', 'lovMap' || g_lov_map_count);
386 jdr_docbuilder.setAttribute(lovMap, 'lovItem', g_lov_code);
387 jdr_docbuilder.setAttribute(lovMap, 'resultTo', p_jrad_field_id || '_FORM');
388 jdr_docbuilder.addChild(p_input_elem, jdr_docbuilder.JRAD_NS, 'lovMappings',lovMap);
389 g_lov_map_count := g_lov_map_count + 1;
390
391
392 -- from base-page EO-based VO attribute to lovItem Code
393 /*
394 lovMap := jdr_docbuilder.createElement(jdr_docbuilder.JRAD_NS, 'lovMap');
395 jdr_docbuilder.setAttribute(lovMap, 'id', 'lovMap' || g_lov_map_count);
396 jdr_docbuilder.setAttribute(lovMap, 'lovItem', g_lov_code);
397 jdr_docbuilder.setAttribute(lovMap, 'resultTo', p_mapping_field);
398 jdr_docbuilder.addChild(p_input_elem, jdr_docbuilder.JRAD_NS, 'lovMappings',lovMap);
399 g_lov_map_count := g_lov_map_count + 1;
400 */
401
402 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'END');
403
404 EXCEPTION
405 WHEN OTHERS THEN
406 PON_FORMS_UTIL_PVT.print_error_log(l_api_name, 'EXCEPTION');
407 err_num := SQLCODE;
408 err_msg := SUBSTR(SQLERRM, 1, 100);
409
410 END CREATE_LOV;
411
412
413 /*======================================================================
414 FUNCTION: GETBASELANGUAGE PRIVATE
415 PARAMETERS: NONE
416 COMMENT : This function will get the base language of the instance,
417 We will use this base language to create the default
418 JRAD XML, although the prompts will be set dynamically
419 at run time.
420 ======================================================================*/
421
422 FUNCTION getBaseLanguage RETURN VARCHAR2 IS
423
424 v_base_language FND_LANGUAGES.LANGUAGE_CODE%TYPE;
425 l_api_name CONSTANT VARCHAR2(30) := 'GETBASELANGUAGE';
426
427 BEGIN
428 -- just initialize this local variable to a default value
429
430 V_BASE_LANGUAGE := g_base_language;
431
432 SELECT LANGUAGE_CODE
433 INTO V_BASE_LANGUAGE
434 FROM FND_LANGUAGES
435 WHERE NVL(INSTALLED_FLAG, 'X') = 'B';
436
437 RETURN V_BASE_LANGUAGE;
438
439 EXCEPTION
440 WHEN OTHERS THEN
441 PON_FORMS_UTIL_PVT.print_error_log(l_api_name, 'EXCEPTION');
442 RETURN V_BASE_LANGUAGE;
443
444 END getBaseLanguage;
445
446
447 /*======================================================================
448 FUNCTION: CREATE_ELEMENT PRIVATE
449 PARAMETERS:
450 COMMENT : Generic function to create any type of element
451 ======================================================================*/
452
453 FUNCTION CREATE_ELEMENT (
454 p_element_type IN VARCHAR2,
455 p_element_id IN VARCHAR2,
456 p_element_prompt IN VARCHAR2,
457 p_element_dataType IN VARCHAR2,
458 p_element_tipType IN VARCHAR2,
459 p_element_viewAttr IN VARCHAR2) RETURN JDR_DOCBUILDER.ELEMENT IS
460
461 v_return_jrad_element JDR_DOCBUILDER.ELEMENT;
462 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_ELEMENT';
463
464 BEGIN
465
466 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'BEGIN '
467 || p_element_type || ' ' || p_element_id || ' '
468 || p_element_dataType || ' ' || p_element_viewAttr);
469
470 v_return_jrad_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, p_element_type);
471 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'id', p_element_id);
472 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'viewAttr', p_element_viewAttr);
473
474 if(p_element_type <> 'formValue') then
475 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'prompt', escapespecialchar(p_element_prompt));
476 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'dataType', p_element_dataType);
477 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'cellNoWrapFormat', 'true');
478 end if;
479
480
481 if(p_element_type = 'messageStyledText') then
482 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'styleClass', 'OraDataText');
483 else
484 if(p_element_tipType = 'dateFormat') then
485 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'tipType', p_element_tipType);
486 elsif (p_element_tipType = 'longMessage') then
487 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'tipType', 'longMessage');
488 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'longTipRegion', g_jrad_long_tip_rgn);
489 end if;
490 end if;
491
492 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'END');
493
494 return v_return_jrad_element;
495
496 END CREATE_ELEMENT;
497
498
499 /*======================================================================
500 FUNCTION: CREATE_TABLE_ELEMENT PRIVATE
501 PARAMETERS:
502 COMMENT : Generic function to create a display-only element in
503 a table
504 ======================================================================*/
505
506 FUNCTION CREATE_TABLE_ELEMENT (
507 p_element_type IN VARCHAR2,
508 p_element_id IN VARCHAR2,
509 p_element_prompt IN VARCHAR2,
510 p_element_dataType IN VARCHAR2,
511 p_element_tipType IN VARCHAR2,
512 p_element_viewAttr IN VARCHAR2) RETURN JDR_DOCBUILDER.ELEMENT IS
513
514 v_return_jrad_element JDR_DOCBUILDER.ELEMENT;
515 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TABLE_ELEMENT';
516
517 BEGIN
518
519 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'BEGIN '
520 || p_element_type || ' ' || p_element_id || ' '
521 || p_element_dataType || ' ' || p_element_viewAttr);
522
523 v_return_jrad_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, p_element_type);
524 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'id', p_element_id);
525 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'viewAttr', p_element_viewAttr);
526
527 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'prompt', escapespecialchar(p_element_prompt));
528 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'dataType', p_element_dataType);
529 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'cellNoWrapFormat', 'true');
530
531 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'END');
532
533 return v_return_jrad_element;
534
535 END CREATE_TABLE_ELEMENT;
536
537
538 /*======================================================================
539 FUNCTION: CREATE_VSET_ELEMENT PRIVATE
540 PARAMETERS:
541 COMMENT : Function to create any value-set based element in the
542 JRAD. i.e. either a messageChoice or a messageLovInput
543 Depending upon the vset definition, we will create the
544 corresponding JRAD UI element.
545 ======================================================================*/
546
547 FUNCTION create_vset_element (p_field_jrad_id IN VARCHAR2,
548 p_field_code IN VARCHAR2,
549 p_field_name IN VARCHAR2,
550 p_field_desc IN VARCHAR2,
551 p_mapping_field IN VARCHAR2,
552 p_value_set_name IN VARCHAR2,
553 p_in_table IN VARCHAR2) RETURN JDR_DOCBUILDER.ELEMENT IS
554
555 v_return_jrad_element JDR_DOCBUILDER.ELEMENT;
556 v_display_type VARCHAR2(1);
557 v_validation_type VARCHAR2(1);
558 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_VSET_ELEMENT';
559 FND_FLEX_EXCEPTION EXCEPTION;
560
561 BEGIN
562
563 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'BEGIN -'
564 || p_field_jrad_id || ' ' || p_field_code || ' '
565 || p_mapping_field || ' ' || p_value_set_name);
566
567 BEGIN
568
569 SELECT fnd_flex_value_sets.LONGLIST_FLAG, fnd_flex_value_sets.VALIDATION_TYPE
570 INTO v_display_type, v_validation_type
571 FROM fnd_flex_value_sets
572 WHERE fnd_flex_value_sets.FLEX_VALUE_SET_NAME = p_value_set_name;
573
574 EXCEPTION
575 WHEN OTHERS THEN
576 RAISE FND_FLEX_EXCEPTION;
577 END;
578
579 if(v_display_type = 'X') then --{
580
581 -- create a poplist
582
583 if(p_in_table = 'Y' OR nvl(p_field_desc, 'x@Y#z') = 'x@Y#z' ) then
584
585 v_return_jrad_element := create_element ('messageChoice', p_field_jrad_id,
586 p_field_name, 'VARCHAR2','none',
587 p_mapping_field);
588
589 else
590 v_return_jrad_element := create_element ('messageChoice', p_field_jrad_id,
591 p_field_name, 'VARCHAR2','longMessage',
592 p_mapping_field);
593
594
595 end if;
596
597 if((v_validation_type = 'I') OR (v_validation_type = 'X')) then --{
598 -- independent or translatable independent
599 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'pickListViewName',g_sql_poplist_view_name || g_sql_pop_list_count);
600 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'pickListDispAttr','Meaning');
601 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'pickListValAttr','Code');
602 g_sql_pop_list_count := g_sql_pop_list_count + 1;
603
604 --}
605
606 elsif ((v_validation_type = 'F')) then --{
607
608 -- poplist based on a table-based validation set
609 -- need to create this VO in the middle tier, and associate that VOs attributes here
610 -- 'Code' is VALUE_COLUMN, 'Meaning' is ID_COLUMN
611
612 JDR_DOCBUILDER.setAttribute (v_return_jrad_element,'pickListViewName',g_tab_poplist_view_name||g_table_pop_list_count);
613
614 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'pickListDispAttr','ID_COLUMN');
615 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'pickListValAttr','VALUE_COLUMN');
616 g_table_pop_list_count := g_table_pop_list_count + 1;
617
618 end if; -- bad type done
619
620 --} -- done creating a poplist
621
622 elsif( (v_display_type = 'Y' ) OR (v_display_type = 'N')) then --{
623
624 -- list of values OR long list of values
625
626 if(p_in_table = 'Y' OR nvl(p_field_desc, 'x@Y#z') = 'x@Y#z') then
627
628 -- here we should have the JRAD field Id as the VO attribute
629 -- by default, the user will be able to search on the 'meaning' or
630 -- user-displayed value
631 -- the '_FORM' JRAD element will be based on p_mapping_field
632 v_return_jrad_element := create_element ('messageLovInput', p_field_jrad_id,
633 p_field_name, 'VARCHAR2', 'none', p_field_jrad_id || '_NAME');
634 else
635 v_return_jrad_element := create_element ('messageLovInput', p_field_jrad_id,
636 p_field_name, 'VARCHAR2', 'longMessage', p_field_jrad_id || '_NAME');
637 end if;
638
639 -- depending upon the validation_type, we will associate this lov, with a different region
640
641 if((v_validation_type = 'I') OR (v_validation_type = 'X')) then --{
642 -- refer to direct sql query
643 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'externalListOfValues', g_jrad_lov_path_sql);
644 --}
645 elsif ((v_validation_type = 'F')) then --{
646 -- create a sql query, and then create a vo
647 JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'externalListOfValues', g_jrad_lov_path_tab);
648 end if;
649 --}
650
651 -- JDR_DOCBUILDER.setAttribute (v_return_jrad_element, 'unvalidated', 'false');
652
653 -- need to construct an LOV for v_form_fields_row.field_name
654 create_lov(p_field_code, p_value_set_name, p_mapping_field,
655 v_validation_type, p_field_jrad_id, v_return_jrad_element);
656 end if; --}
657
658 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'END');
659 return v_return_jrad_element;
660
661 EXCEPTION
662 WHEN FND_FLEX_EXCEPTION THEN
663 RAISE_APPLICATION_ERROR(-20010, 'ERROR: FND FLEXFIELD VALIDATION SETS ERRROR FOR VALUE-SET ' || p_value_set_name);
664 END CREATE_VSET_ELEMENT;
665
666
667 /*======================================================================
668 FUNCTION: CREATE_TABLE PRIVATE
669 PARAMETERS:
670 COMMENT : This function is used to add all the columns to the table
671 of repeating section.
672 ======================================================================*/
673
674 FUNCTION CREATE_TABLE(
675 section_id IN NUMBER,
676 v_section_layout_element IN JDR_DOCBUILDER.ELEMENT,
677 p_form_ID IN NUMBER,
678 p_vocount IN INTEGER,
679 p_readonly_flag IN VARCHAR2,
680 p_row_seq_num IN NUMBER)
681 RETURN JDR_DOCBUILDER.ELEMENT IS
682
683 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TABLE';
684
685 CURSOR V_FORM_FIELDS_CURSOR(p_form_id NUMBER) is
686
687 SELECT pon_form_section_compiled.FORM_ID,
688 pon_form_section_compiled.TYPE,
689 pon_form_section_compiled.FIELD_CODE,
690 pon_form_section_compiled.MAPPING_FIELD_VALUE_COLUMN,
691 pon_form_section_compiled.REQUIRED,
692 NVL (pon_form_section_compiled.LEVEL1_SECTION_ID, -1) LEVEL1_SECTION_ID,
693 pon_forms_sections.FORM_CODE SECTION_CODE,
694 pon_fields.DATATYPE ,
695 pon_fields.VALUE_SET_NAME,
696 pon_fields.SYSTEM_FLAG,
697 pon_fields_tl.FIELD_NAME,
698 pon_fields_tl.DESCRIPTION FIELD_DESCRIPTION,
699 pon_form_section_compiled.INTERNAL_SEQUENCE_NUMBER,
700 NVL(pon_form_section_compiled.LEVEL2_SECTION_ID, -1) LEVEL2_SECTION_ID,
701 NVL(pon_form_section_compiled.REPEATING_SECTION_ID, -1) SECTION_ID
702 FROM PON_FORM_SECTION_COMPILED,
703 PON_FIELDS,
704 PON_FIELDS_TL,
705 PON_FORMS_SECTIONS
706 WHERE pon_form_section_compiled.FIELD_CODE = pon_fields.FIELD_CODE(+)
707 AND pon_form_section_compiled.FIELD_CODE = pon_fields_tl.FIELD_CODE(+)
708 AND pon_forms_sections.FORM_ID = P_FORM_ID
709 AND pon_form_section_compiled.FORM_ID = P_FORM_ID
710 AND pon_form_section_compiled.TYPE IN ('FORM_FIELD', 'REPEAT_SECTION')
711 AND pon_fields_tl.LANGUAGE(+) = g_base_language
712 ORDER BY
713 INTERNAL_SEQUENCE_NUMBER;
714
715 v_section_field_element JDR_DOCBUILDER.ELEMENT;
716 v_message_layout_element JDR_DOCBUILDER.ELEMENT;
717 v_temp_element JDR_DOCBUILDER.ELEMENT;
718 v_column_header_element JDR_DOCBUILDER.ELEMENT;
719 v_form_fields_row V_FORM_FIELDS_CURSOR%ROWTYPE;
720 v_section_title PON_FORMS_SECTIONS_TL.FORM_NAME%TYPE;
721 v_section_code PON_FORMS_SECTIONS.FORM_CODE%TYPE;
722 v_action_parameters JDR_DOCBUILDER.ELEMENT;
723 v_action_parameter JDR_DOCBUILDER.ELEMENT;
724 v_curr_formfieldvaluesvo_name VARCHAR2(20);
725 v_display_type VARCHAR2(1);
726 v_validation_type VARCHAR2(1);
727 v_jrad_field_id VARCHAR2(200);
728 v_jrad_element_id VARCHAR2(200);
729 v_LEVEL1_SECTION_ID NUMBER;
730 v_incl_section_id NUMBER;
731 v_parent_row_type PON_FORM_SECTION_COMPILED.TYPE%TYPE;
732 v_vset_element_created VARCHAR2(1);
733
734 BEGIN
735
736 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'BEGIN -' || section_id);
737
738 v_curr_formfieldvaluesvo_name := g_values_viewName || p_vocount;
739
740 --
741 v_LEVEL1_SECTION_ID := -1;
742 v_incl_section_id := -1;
743 v_vset_element_created := 'N';
744
745 IF(section_id <> p_form_id) THEN
746
747 /*
748 This means we are creating the MDS region for the table associated with
749 the form
750 */
751
752 select LEVEL1_SECTION_ID , LEVEL2_SECTION_ID, type
753 into v_LEVEL1_SECTION_ID, v_incl_section_id, v_parent_row_type
754 from pon_form_section_compiled
755 where form_id = p_form_id
756 and repeating_section_id = section_id
757 and internal_sequence_number = p_row_seq_num;
758
759 END IF;
760
761 for v_form_fields_row in V_FORM_FIELDS_CURSOR(section_id) LOOP
762
763 -- repeating section within repeating section
764
765 IF (v_form_fields_row.TYPE = 'REPEAT_SECTION') THEN
766
767 /*CASE I : REPEATING SECTION WITHIN REPEATING SECTION*/
768
769 v_jrad_element_id := getJradId (v_form_fields_row.type,
770 p_form_id,
771 v_LEVEL1_SECTION_ID,
772 v_incl_section_id,
773 v_form_fields_row.section_id, -- pass the inner repeating section id
774 v_form_fields_row.field_code);
775
776 ELSE
777
778 IF(section_id <> p_form_id) THEN
779
780 /* CASE II : WE ARE GENERATING THE JRAD FOR A FORM, BUT NOW WE ARE IN THE
781 C ONTEXT OF GENERATING THE TABLE FOR A REPEATING SECTION WHICH
782 IS DIRECTLY ATTACHED TO A FORM - I.E. DISPLAYED ON THE MAIN
783 PAGE OF THE FORM - WE PASS THE FORM-ID AS THE DRIVING KEY
784 */
785
786 v_jrad_element_id := getJradId (v_form_fields_row.type,
787 p_form_id,
788 v_LEVEL1_SECTION_ID,
789 v_incl_section_id,
790 section_id,
791 v_form_fields_row.field_code);
792
793 v_jrad_field_id := v_jrad_element_id;
794
795 ELSE
796
797 /* CASE III : WE ARE GENERATING THE JRAD FOR A REPEATING SECTION - A STAND ALONE
798 JRAD: WE ARE IN THE CONTEXT OF GENERATING THE TABLE FOR A REPEATING SECTION WHICH
799 IS INSIDE ANOTHER REPEATING SECTION ATTACHED TO A FORM -
800 I.E. DISPLAYED ON A SEPARATE DRILL-DOWN PAGE OF THE FORM -
801 WE PASS THE SECTION-ID AS THE DRIVING KEY
802 */
803
804 v_jrad_element_id := getJradId (v_form_fields_row.type,
805 SECTION_ID,
806 v_LEVEL1_SECTION_ID,
807 v_incl_section_id,
808 -1,
809 v_form_fields_row.field_code);
810
811 v_jrad_field_id := v_jrad_element_id;
812
813
814 END IF;
815 END IF;
816
817 IF (v_form_fields_row.type='REPEAT_SECTION') then --{
818
819 SELECT
820 forms_tl.form_name , forms.form_code
821 INTO
822 v_section_title, v_section_code
823 FROM
824 pon_forms_sections forms,
825 pon_forms_sections_tl forms_tl
826 WHERE
827 forms.form_id = forms_tl.form_id AND
828 forms.form_id = v_form_fields_row.section_id AND
829 forms_tl.LANGUAGE = g_base_language;
830
831 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'Creat image for inner repeating section '
832 || v_form_fields_row.section_id || ' ' || v_section_title);
833
834 v_section_field_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'image');
835 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'id', v_jrad_element_id || 'IMG' || g_total_image_count);
836 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'serverUnvalidated', 'true');
837 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'warnAboutChanges', 'false');
838
839 if(nvl(p_readonly_flag, 'N') = 'Y') then
840 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'source', 'eyeglasses_24x24_transparent.gif');
841 else
842 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'source', 'rework_enabled.gif');
843 end if;
844
845
846 v_action_parameters := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'fireAction');
847 JDR_DOCBUILDER.setAttribute (v_action_parameters, 'event', 'DetailsIconClicked');
848
849 -- add all the parameters we want to pass to the details page
850
851 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
852 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'FORM_FIELD_VALUES_ID');
853 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value',
854 '${oa.encrypt.' || v_curr_formfieldvaluesvo_name || '.FormFieldValueId}');
855 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
856
857 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
858 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'FORM_ID');
859 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value',
860 '${oa.encrypt.' || v_curr_formfieldvaluesvo_name || '.FormId}');
861 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
862
863
864 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
865 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'OWNING_ENTITY_CODE');
866 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value',
867 '${oa.encrypt.' || v_curr_formfieldvaluesvo_name || '.OwningEntityCode}');
868 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
869
870
871 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
872 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'ENTITY_PK1');
873 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value',
874 '${oa.encrypt.' || v_curr_formfieldvaluesvo_name || '.EntityPk1}');
875 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
876
877 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
878 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'SECTION_ID');
879 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value',
880 '${oa.encrypt.' || v_curr_formfieldvaluesvo_name || '.SectionId}');
881 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
882
883 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
884 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'PARENT_FIELD_VALUES_FK');
885 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value',
886 '${oa.encrypt.' || v_curr_formfieldvaluesvo_name || '.ParentFieldValuesFk}');
887 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
888
889 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
890 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'DETAIL_SECTION_CODE');
891 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value', v_section_code);
892 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
893
894
895 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
896 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'DETAIL_SECTION_ID');
897 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value', v_form_fields_row.section_id);
898 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
899
900
901 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
902 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'DETAIL_JRAD_PAGE_MODE');
903
904 if(nvl(p_readonly_flag, 'N') = 'Y') then
905 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value', 'SECTION_READ_ONLY');
906 else
907 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value', 'SECTION_DATA_ENTRY');
908 end if;
909
910 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
911
912
913 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
914 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'FROM_PAGE');
915 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value', 'PON_FORMS_JRAD_GENX');
916 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
917
918 JDR_DOCBUILDER.addChild (v_section_field_element, JDR_DOCBUILDER.UI_NS,
919 'primaryClientAction', v_action_parameters);
920 --}
921
922 elsIF (v_form_fields_row.datatype='LONGTEXT') then --{
923
924 IF(p_readonly_flag = 'N') THEN
925
926 v_section_field_element := create_element ('messageTextInput', v_form_fields_row.field_code,
927 v_form_fields_row.field_name, 'VARCHAR2',
928 'none',v_form_fields_row.mapping_field_value_column);
929
930 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'maximumLength', 2000);
931 ELSE
932 v_section_field_element := create_table_element ('messageStyledText', v_form_fields_row.field_code,
933 v_form_fields_row.field_name, 'VARCHAR2',
934 'none',v_form_fields_row.mapping_field_value_column);
935
936
937 END IF;
938 --}
939 ELSIF (v_form_fields_row.datatype='DATE') then --{
940
941 IF(p_readonly_flag = 'N') THEN
942
943 v_section_field_element := create_element ('messageTextInput', v_jrad_field_id,
944 v_form_fields_row.field_name, 'DATE', 'dateFormat',
945 v_form_fields_row.mapping_field_value_column);
946
947 v_date_list_count := v_date_list_count + 1;
948
949 ELSE
950 v_section_field_element := create_table_element ('messageStyledText', v_jrad_field_id,
951 v_form_fields_row.field_name, 'DATE', 'dateFormat',
952 v_form_fields_row.mapping_field_value_column);
953
954 END IF;
955 --}
956 ELSIF (v_form_fields_row.datatype='DATETIME') then --{
957
958 IF(p_readonly_flag = 'N') THEN
959
960 v_section_field_element := create_element ('messageTextInput', v_jrad_field_id,
961 v_form_fields_row.field_name, 'DATETIME','dateFormat',
962 v_form_fields_row.mapping_field_value_column);
963
964 ELSE
965
966 v_section_field_element := create_table_element ('messageStyledText', v_jrad_field_id,
967 v_form_fields_row.field_name, 'DATETIME','dateFormat',
968 v_form_fields_row.mapping_field_value_column);
969
970
971 END IF;
972 --}
973 ELSIF (v_form_fields_row.datatype='AMOUNT') then --{
974
975 IF(p_readonly_flag = 'N') THEN
976
977 v_section_field_element := create_element ('messageTextInput', v_jrad_field_id,
978 v_form_fields_row.field_name, 'NUMBER', 'none',
979 v_form_fields_row.mapping_field_value_column);
980
981 ELSE
982
983 v_section_field_element := create_table_element ('messageStyledText', v_jrad_field_id,
984 v_form_fields_row.field_name, 'NUMBER', 'none',
985 v_form_fields_row.mapping_field_value_column);
986
987 END IF;
988 --}
989 ELSIF (v_form_fields_row.datatype='NUMBER') then --{
990
991 IF(p_readonly_flag = 'N') THEN
992
993 v_section_field_element := create_element ('messageTextInput', v_jrad_field_id,
994 v_form_fields_row.field_name, 'NUMBER', 'none',
995 v_form_fields_row.mapping_field_value_column);
996 ELSE
997 v_section_field_element := create_table_element ('messageStyledText', v_jrad_field_id,
998 v_form_fields_row.field_name, 'NUMBER', 'none',
999 v_form_fields_row.mapping_field_value_column);
1000 END IF;
1001
1002 --}
1003 ELSIF (v_form_fields_row.datatype='TEXT' AND v_form_fields_row.value_set_name is not null) then --{
1004
1005 IF(p_readonly_flag = 'Y') THEN
1006
1007 v_section_field_element := create_table_element ('messageStyledText', v_jrad_field_id,
1008 v_form_fields_row.field_name, 'VARCHAR2','none',
1009 v_jrad_field_id || '_NAME');
1010 --v_form_fields_row.field_code || '_NAME');
1011
1012 ELSE
1013 v_section_field_element := create_vset_element (v_jrad_field_id,
1014 v_form_fields_row.field_code,
1015 v_form_fields_row.field_name,
1016 v_form_fields_row.field_description,
1017 v_form_fields_row.mapping_field_value_column,
1018 v_form_fields_row.value_set_name,
1019 'Y');
1020
1021 v_vset_element_created := 'Y';
1022
1023 END IF;
1024 --}
1025 ELSE -- TBD: Unrecognized field --{
1026
1027 IF(p_readonly_flag = 'N') THEN
1028
1029 v_section_field_element := create_element ('messageTextInput', v_jrad_field_id,
1030 v_form_fields_row.field_name, 'VARCHAR2','none',
1031 v_form_fields_row.mapping_field_value_column);
1032 ELSE
1033
1034 v_section_field_element := create_table_element ('messageStyledText', v_jrad_field_id,
1035 v_form_fields_row.field_name, 'VARCHAR2','none',
1036 v_form_fields_row.mapping_field_value_column);
1037
1038 END IF;
1039
1040 --}
1041 END IF;
1042
1043 IF (v_form_fields_row.required='Y') THEN
1044 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'required', 'yes');
1045 END IF;
1046
1047 IF (v_form_fields_row.type='REPEAT_SECTION') then
1048
1049 v_temp_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'column');
1050 JDR_DOCBUILDER.setAttribute (v_temp_element, 'id', v_jrad_element_id || '_COL');
1051 JDR_DOCBUILDER.setAttribute (v_temp_element, 'columnDataFormat', 'iconButtonFormat');
1052
1053 JDR_DOCBUILDER.addChild (v_section_layout_element, JDR_DOCBUILDER.UI_NS, 'contents', v_temp_element);
1054
1055 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'contents', v_section_field_element);
1056
1057 v_column_header_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'sortableHeader');
1058 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'id', v_jrad_element_id || '_SCLHDR');
1059 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'prompt', escapespecialchar(v_section_title));
1060 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'columnHeader', v_column_header_element);
1061 ELSE
1062 v_temp_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'column');
1063 JDR_DOCBUILDER.setAttribute (v_temp_element, 'id', v_jrad_element_id || '_COL');
1064
1065 -- need to set the column format for a 'NUMBER'
1066
1067 if ((v_form_fields_row.datatype='NUMBER') OR (v_form_fields_row.datatype='AMOUNT') ) then
1068 JDR_DOCBUILDER.setAttribute (v_temp_element, 'columnDataFormat', 'numberFormat');
1069 end if;
1070
1071 JDR_DOCBUILDER.addChild (v_section_layout_element, JDR_DOCBUILDER.UI_NS, 'contents', v_temp_element);
1072
1073 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'contents', v_section_field_element);
1074
1075 ---- need to create a formValue element for this LOV
1076
1077 if(v_vset_element_created = 'Y' and isLovValueSet(v_form_fields_row.field_code) = 'Y') then
1078
1079 v_vset_element_created := 'N';
1080
1081 v_section_field_element := create_element ('formValue', v_jrad_element_id || '_FORM',
1082 v_form_fields_row.field_name, 'VARCHAR2', 'none',
1083 v_form_fields_row.mapping_field_value_column);
1084
1085 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'viewName', v_curr_formfieldvaluesvo_name);
1086 JDR_DOCBUILDER.addChild (v_temp_element,jdr_docbuilder.UI_NS,'contents',v_section_field_element);
1087
1088 end if;
1089 --
1090
1091 v_column_header_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'sortableHeader');
1092 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'id', v_jrad_element_id || '_SCLHDR');
1093 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'prompt', escapespecialchar(v_form_fields_row.field_name));
1094
1095 IF (v_form_fields_row.required='Y') THEN
1096 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'required', 'yes');
1097 END IF;
1098 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'columnHeader', v_column_header_element);
1099 END IF;
1100
1101 END LOOP;
1102
1103 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'END');
1104
1105 return v_section_layout_element;
1106
1107 END CREATE_TABLE;
1108
1109 /*======================================================================
1110 PROCEDURE: CREATE_REPEATING_SECTION PRIVATE
1111 PARAMETERS:
1112 COMMENT : This procedure is invoked when a repeating section is
1113 made active, in order to generate the JRAD regions for
1114 that section
1115 ======================================================================*/
1116
1117 PROCEDURE CREATE_REPEATING_SECTION(p_section_id IN NUMBER,
1118 x_result OUT NOCOPY VARCHAR2,
1119 x_error_code OUT NOCOPY VARCHAR2,
1120 x_error_message OUT NOCOPY VARCHAR2) IS
1121 rval INTEGER;
1122
1123 v_section_title PON_FORMS_SECTIONS_TL.FORM_NAME%TYPE;
1124
1125 v_section_code PON_FORMS_SECTIONS.FORM_CODE%TYPE;
1126 v_section_entry_path PON_FORMS_SECTIONS.JRAD_XML_REGION_NAME%TYPE;
1127 v_section_read_path PON_FORMS_SECTIONS.JRAD_XML_REGION_NAME_DISP%TYPE;
1128
1129
1130 v_section_element JDR_DOCBUILDER.ELEMENT;
1131 v_section_layout_element JDR_DOCBUILDER.ELEMENT;
1132 v_delete_field_element JDR_DOCBUILDER.ELEMENT;
1133 v_delete_parameter JDR_DOCBUILDER.ELEMENT;
1134 v_delete_parameters JDR_DOCBUILDER.ELEMENT;
1135 v_add_table_row_element JDR_DOCBUILDER.ELEMENT;
1136 v_table_footer_element JDR_DOCBUILDER.ELEMENT;
1137 v_section_element_rd JDR_DOCBUILDER.ELEMENT;
1138 v_section_layout_element_rd JDR_DOCBUILDER.ELEMENT;
1139 v_table_footer_element_rd JDR_DOCBUILDER.ELEMENT;
1140 v_temp_element JDR_DOCBUILDER.ELEMENT;
1141 v_column_header_element JDR_DOCBUILDER.ELEMENT;
1142 v_section_tip_element JDR_DOCBUILDER.ELEMENT;
1143 v_section_desc PON_FORMS_SECTIONS_TL.FORM_DESCRIPTION%TYPE;
1144
1145 v_view_name VARCHAR2(30);
1146
1147 mainDocBuyerEntry JDR_DOCBUILDER.DOCUMENT;
1148 mainDocReadOnly JDR_DOCBUILDER.DOCUMENT;
1149
1150 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_REPEATING_SECTION';
1151
1152 BEGIN
1153 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'BEGIN-');
1154
1155 -- initialize to error
1156 x_result := fnd_api.g_ret_sts_error;
1157
1158 -- always use VO1 for independent repeating section
1159 v_view_name := g_values_viewName || '1';
1160
1161 v_section_entry_path := PON_FORMS_UTIL_PVT.getDataEntryRegionName(p_section_id);
1162 v_section_read_path := PON_FORMS_UTIL_PVT.getReadOnlyRegionName(p_section_id);
1163
1164
1165 IF (JDR_DOCBUILDER.DOCUMENTEXISTS(v_section_entry_path)=TRUE) THEN
1166 JDR_DOCBUILDER.DELETEDOCUMENT (v_section_entry_path);
1167 END IF;
1168
1169
1170 IF (JDR_DOCBUILDER.DOCUMENTEXISTS(v_section_read_path)=TRUE) THEN
1171 JDR_DOCBUILDER.DELETEDOCUMENT (v_section_read_path);
1172 END IF;
1173
1174 -- reset the top level documents
1175 mainDocBuyerEntry := NULL;
1176 mainDocReadOnly := NULL;
1177
1178
1179 -- initialize the mainDoc
1180 mainDocBuyerEntry := JDR_DOCBUILDER.createDocument (v_section_entry_path,'en-US');
1181
1182 mainDocReadOnly := JDR_DOCBUILDER.createDocument (v_section_read_path,'en-US');
1183
1184 -- initialize a few global variables
1185 g_sql_pop_list_count := 1; -- display a poplist, vo-based on direct sql query (eg. SqlPopListVO1)
1186 g_table_pop_list_count := 1; -- display a poplist, vo based on a generated sql query (eg. TablePopListVO1)
1187 g_lov_map_count := 1; -- display a lov, total number of LOVs displayed on page
1188 g_pop_list_count := 1;
1189
1190 SELECT
1191 forms_tl.form_name, forms.form_code, forms_tl.tip_text
1192 INTO v_section_title, v_section_code, v_section_desc
1193 FROM
1194 pon_forms_sections forms,
1195 pon_forms_sections_tl forms_tl
1196 WHERE
1197 forms.form_id = forms_tl.form_id AND
1198 forms.form_id = p_section_id AND
1199 forms_tl.LANGUAGE = g_base_language;
1200
1201 v_section_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
1202 JDR_DOCBUILDER.setAttribute (v_section_element, 'id', v_section_code);
1203 JDR_DOCBUILDER.setAttribute (v_section_element, 'text', escapespecialchar(v_section_title));
1204
1205 -- add a small tip element if description has been entered
1206 if(nvl(v_section_desc, 'E') <> 'E') then
1207 v_section_tip_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'tip');
1208 JDR_DOCBUILDER.setAttribute (v_section_tip_element, 'id', v_section_code || '_TIP');
1209 JDR_DOCBUILDER.setAttribute (v_section_tip_element, 'text', escapespecialchar(v_section_desc));
1210 JDR_DOCBUILDER.addChild(v_section_element, jdr_docbuilder.UI_NS,'contents',v_section_tip_element);
1211 end if;
1212
1213 v_section_layout_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'advancedTable');
1214 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'id', v_section_code||'_table');
1215 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'viewName', v_view_name);
1216 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'width', '100%');
1217
1218 v_table_footer_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'tableFooter');
1219 JDR_DOCBUILDER.setAttribute (v_table_footer_element, 'id', v_section_code|| '_TABFTR');
1220 JDR_DOCBUILDER.addChild (v_section_layout_element, JDR_DOCBUILDER.UI_NS, 'footer', v_table_footer_element);
1221
1222 v_add_table_row_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'addTableRow');
1223 JDR_DOCBUILDER.setAttribute (v_add_table_row_element, 'id', v_section_code||'_ADDBTN');
1224 JDR_DOCBUILDER.setAttribute (v_add_table_row_element, 'autoInsertion', 'false');
1225 JDR_DOCBUILDER.addChild (v_table_footer_element, JDR_DOCBUILDER.UI_NS, 'contents', v_add_table_row_element);
1226
1227 -- add all the remaining columns to this table
1228 v_section_layout_element := CREATE_TABLE(p_section_id, v_section_layout_element,p_section_id, 1, 'N', -1);
1229
1230 v_temp_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'column');
1231 JDR_DOCBUILDER.setAttribute (v_temp_element, 'id', 'columnDelete' || v_section_code);
1232 JDR_DOCBUILDER.setAttribute (v_temp_element, 'columnDataFormat', 'iconButtonFormat');
1233 JDR_DOCBUILDER.addChild (v_section_layout_element, JDR_DOCBUILDER.UI_NS, 'contents', v_temp_element);
1234
1235 v_column_header_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'sortableHeader');
1236 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'id', 'columnHeader' || v_section_code);
1237 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'prompt', 'Delete');
1238 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'columnHeader', v_column_header_element);
1239
1240 -- add a delete image
1241 v_delete_field_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,'image');
1242 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'id', 'deleteImage' || v_section_code);
1243 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'source', 'deleteicon_enabled.gif');
1244 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'warnAboutChanges', 'false');
1245 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'serverUnvalidated', 'true');
1246 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'unvalidated', 'true');
1247
1248 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'contents', v_delete_field_element);
1249
1250 v_delete_parameters := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'fireAction');
1251 JDR_DOCBUILDER.setAttribute (v_delete_parameters, 'event', 'Delete');
1252 JDR_DOCBUILDER.setAttribute (v_delete_parameters, 'unvalidated', 'true');
1253 v_delete_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
1254 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'key', 'Id');
1255 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'value', '${oa.encrypt.' || v_view_name ||'.FormFieldValueId}');
1256 JDR_DOCBUILDER.addChild (v_delete_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_delete_parameter);
1257 v_delete_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
1258 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'key', 'ViewName');
1259 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'value', v_view_name);
1260 JDR_DOCBUILDER.addChild (v_delete_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_delete_parameter);
1261 JDR_DOCBUILDER.addChild (v_delete_field_element, JDR_DOCBUILDER.UI_NS, 'primaryClientAction', v_delete_parameters);
1262
1263
1264 JDR_DOCBUILDER.addChild (v_section_element, jdr_docbuilder.UI_NS,'contents',v_section_layout_element);
1265
1266 JDR_DOCBUILDER.setTopLevelElement(mainDocBuyerEntry, v_section_element);
1267
1268 --------------------------------------
1269 -----READ--ONLY--REGION---START-------
1270 --------------------------------------
1271
1272 v_section_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
1273 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'id', v_section_code);
1274 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'text', escapespecialchar(v_section_title));
1275
1276 v_section_layout_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'advancedTable');
1277 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'id', v_section_code||'table1');
1278 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'viewName', v_view_name);
1279 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'width', '100%');
1280
1281 v_table_footer_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'tableFooter');
1282 JDR_DOCBUILDER.setAttribute (v_table_footer_element_rd, 'id', v_section_code|| '_TABFTR');
1283 JDR_DOCBUILDER.addChild (v_section_layout_element_rd, JDR_DOCBUILDER.UI_NS, 'footer', v_table_footer_element_rd);
1284
1285 -- add all the remaining columns to this table
1286 v_section_layout_element_rd := CREATE_TABLE(p_section_id, v_section_layout_element_rd,p_section_id, 1, 'Y', -1);
1287 -- add the table as a child of the header section
1288 JDR_DOCBUILDER.addChild (v_section_element_rd, jdr_docbuilder.UI_NS,'contents',v_section_layout_element_rd);
1289
1290 JDR_DOCBUILDER.setTopLevelElement(mainDocReadOnly, v_section_element_rd);
1291
1292 --------------------------------------
1293 -----READ--ONLY--REGION---END---------
1294 --------------------------------------
1295
1296 rval := JDR_DOCBUILDER.save;
1297
1298 x_result := fnd_api.g_ret_sts_success;
1299
1300 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'END');
1301
1302 EXCEPTION
1303 WHEN OTHERS THEN
1304 x_result := fnd_api.g_ret_sts_error;
1305 x_error_code := SQLCODE;
1306 x_error_message := SUBSTR(SQLERRM, 1, 100);
1307 PON_FORMS_UTIL_PVT.print_error_log(l_api_name, 'EXCEPTION - x_result=' || x_result || ' x_error_code=' || x_error_code || ' x_error_message=' || x_error_message || ' SQLERRM=' || SQLERRM);
1308
1309 end CREATE_REPEATING_SECTION;
1310
1311
1312
1313 /*=======================================================
1314 PROCEDURE: CREATE_ABSTRACT_TABLE PRIVATE
1315 PARAMETERS:
1316 COMMENT : This procedure is invoked when a abstract
1317 is made active. Using this procedure, we will
1318 generate the table to be displayed on the external
1319 supplier page containing all the negotiations with
1320 abstracts.
1321 ========================================================*/
1322 PROCEDURE CREATE_ABSTRACT_TABLE(p_form_id IN NUMBER,
1323 x_result OUT NOCOPY VARCHAR2,
1324 x_error_code OUT NOCOPY VARCHAR2,
1325 x_error_message OUT NOCOPY VARCHAR2
1326 ) IS
1327
1328 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_ABSTRACT_TABLE';
1329
1330 CURSOR V_ABSTRACT_FIELDS_CURSOR IS
1331
1332 select pon_fields.field_code,
1333 pon_form_section_compiled.mapping_field_value_column,
1334 pon_fields.datatype,
1335 pon_fields.value_set_name,
1336 pon_fields.system_flag,
1337 pon_fields.system_field_lov_flag,
1338 pon_fields_tl.field_name,
1339 pon_fields_tl.description field_description,
1340 pon_forms_sections.form_id,
1341 pon_forms_sections.form_code,
1342 pon_forms_sections_tl.form_name,
1343 pon_forms_sections_tl.form_description,
1344 pon_form_section_compiled.display_on_main_page,
1345 pon_form_section_compiled.internal_sequence_number
1346 from pon_fields,
1347 pon_fields_tl,
1348 pon_forms_sections,
1349 pon_forms_sections_tl,
1350 pon_form_section_compiled
1351 where
1352 pon_forms_sections.FORM_CODE = 'ABSTRACT'
1353 and pon_forms_sections.STATUS = 'ACTIVE'
1354 and pon_forms_sections.FORM_ID = pon_form_section_compiled.FORM_ID
1355 and pon_forms_sections.FORM_ID = pon_forms_sections_tl.FORM_ID
1356 and pon_form_section_compiled.TYPE = 'FORM_FIELD'
1357 and pon_form_section_compiled.FIELD_CODE is not null
1358 and pon_form_section_compiled.FIELD_CODE = pon_fields.FIELD_CODE
1359 and pon_fields.FIELD_CODE = pon_fields_tl.FIELD_CODE
1360 and pon_fields_tl.LANGUAGE = g_base_language
1361 and pon_forms_sections_tl.LANGUAGE = g_base_language
1362 and nvl(pon_form_section_compiled.display_on_main_page, 'N') = 'Y'
1363 order by
1364 internal_sequence_number;
1365
1366 mainDoc JDR_DOCBUILDER.DOCUMENT;
1367 v_section_element JDR_DOCBUILDER.ELEMENT;
1368 v_section_layout_element JDR_DOCBUILDER.ELEMENT;
1369 v_section_field_element JDR_DOCBUILDER.ELEMENT;
1370 v_table_footer_element JDR_DOCBUILDER.ELEMENT;
1371 v_action_parameters JDR_DOCBUILDER.ELEMENT;
1372 v_action_parameter JDR_DOCBUILDER.ELEMENT;
1373 v_section_case_element JDR_DOCBUILDER.ELEMENT;
1374 v_section_link_element JDR_DOCBUILDER.ELEMENT;
1375 v_section_img_element JDR_DOCBUILDER.ELEMENT;
1376
1377 v_abstract_fields_row V_ABSTRACT_FIELDS_CURSOR%ROWTYPE;
1378 v_section_code PON_FORMS_SECTIONS.FORM_CODE%TYPE;
1379 v_curr_vo_name VARCHAR2(100);
1380 rval INTEGER;
1381
1382 BEGIN
1383
1384 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'BEGIN-');
1385
1386 IF (JDR_DOCBUILDER.DOCUMENTEXISTS(g_jrad_ext_page_path)=TRUE) THEN
1387 JDR_DOCBUILDER.DELETEDOCUMENT (g_jrad_ext_page_path);
1388 END IF;
1389
1390 v_section_code := 'ABSTRACT';
1391 v_curr_vo_name := g_ext_abs_vo_name;
1392
1393 mainDoc := NULL;
1394
1395 mainDoc := JDR_DOCBUILDER.createDocument(g_jrad_ext_page_path,'en-US');
1396
1397 v_section_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'flowLayout');
1398 JDR_DOCBUILDER.setAttribute (v_section_element, 'id', v_section_code);
1399 JDR_DOCBUILDER.setAttribute (v_section_element, 'amDefName', g_ext_app_module);
1400 JDR_DOCBUILDER.setAttribute (v_section_element, 'controllerClass', g_ext_controller);
1401 JDR_DOCBUILDER.setAttribute (v_section_element, 'headerDisabled', 'true');
1402
1403 JDR_DOCBUILDER.setTopLevelElement(mainDoc, v_section_element);
1404
1405 /*v_section_layout_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'tableLayout');
1406 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'id', v_section_code || '_TAB_LAYOUT');
1407 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'extends', g_jrad_ext_poplist);
1408 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'headerDisabled', 'true');
1409
1410 JDR_DOCBUILDER.addChild (v_section_element, jdr_docbuilder.UI_NS,'contents',v_section_layout_element);*/
1411
1412 v_section_layout_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'table');
1413 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'id', v_section_code||'_table');
1414 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'width', '100%');
1415 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'shortDesc', fnd_message.get_string ('PON', 'PON_EXT_ABSTRACT_TBL_SHORTDESC'));
1416
1417 FOR v_abstract_fields_row in V_ABSTRACT_FIELDS_CURSOR LOOP --{
1418
1419 v_section_field_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'messageStyledText');
1420 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'id', v_abstract_fields_row.field_code);
1421 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'prompt', escapespecialchar(v_abstract_fields_row.field_name));
1422 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'dataType', 'VARCHAR2');
1423 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'viewAttr', v_abstract_fields_row.field_code || '_NAME');
1424 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'viewName', v_curr_vo_name);
1425 JDR_DOCBUILDER.addChild (v_section_layout_element, jdr_docbuilder.UI_NS,
1426 'contents',v_section_field_element);
1427
1428 END LOOP; --}
1429
1430
1431 -- after adding all the columns in the table, we need to add the following columns as well
1432 -- 'details' icon
1433 v_section_field_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'image');
1434
1435 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'id', 'detailImage');
1436
1437 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'source', 'eyeglasses_24x24_transparent.gif');
1438 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'warnAboutChanges', 'false');
1439 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'prompt', 'Details');
1440
1441 v_action_parameters := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'fireAction');
1442 JDR_DOCBUILDER.setAttribute (v_action_parameters, 'event', 'DetailsIconClicked');
1443
1444 -- add all the parameters we want to pass to the details page
1445
1446 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
1447 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'FORM_ID');
1448 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value', p_form_id);
1449 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
1450
1451
1452 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
1453 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'OWNING_ENTITY_CODE');
1454 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value', 'PON_AUCTION_HEADERS_ALL');
1455 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
1456
1457
1458 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
1459 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'ENTITY_PK1');
1460 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value',
1461 '${oa.encrypt.' || v_curr_vo_name || '.AUCTION_HEADER_ID}');
1462 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
1463
1464 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
1465 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'ABSTRACT_AUCTION_STATUS');
1466 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value',
1467 '${oa.encrypt.' || v_curr_vo_name || '.NEGOTIATION_STATUS}');
1468 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
1469
1470
1471 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
1472 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'JRAD_PAGE_MODE');
1473 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value', 'FORM_READ_ONLY');
1474 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
1475
1476 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
1477 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'ABSTRACT_PDF_FLAG');
1478 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value',
1479 '${oa.encrypt.' || v_curr_vo_name || '.ABSTRACT_PDF_FLAG}');
1480 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
1481
1482 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
1483 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'ORG_ID');
1484 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value',
1485 '${oa.encrypt.' || v_curr_vo_name || '.ORG_ID}');
1486 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
1487
1488 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
1489 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'DOCTYPE_ID');
1490 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value',
1491 '${oa.encrypt.' || v_curr_vo_name || '.DOCTYPE_ID}');
1492 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
1493
1494 v_action_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
1495 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'key', 'FROM_PAGE');
1496 JDR_DOCBUILDER.setAttribute (v_action_parameter, 'value', 'PON_FORMS_JRAD_GENX');
1497
1498 JDR_DOCBUILDER.addChild (v_action_parameters, JDR_DOCBUILDER.UI_NS, 'parameters', v_action_parameter);
1499
1500 JDR_DOCBUILDER.addChild (v_section_field_element, JDR_DOCBUILDER.UI_NS, 'primaryClientAction', v_action_parameters);
1501
1502 JDR_DOCBUILDER.addChild (v_section_layout_element, jdr_docbuilder.UI_NS, 'contents',v_section_field_element);
1503
1504 JDR_DOCBUILDER.addChild (v_section_element, jdr_docbuilder.UI_NS, 'contents',v_section_layout_element);
1505
1506 JDR_DOCBUILDER.setTopLevelElement(mainDoc, v_section_element);
1507
1508 rval := JDR_DOCBUILDER.save;
1509
1510 x_result := fnd_api.g_ret_sts_success;
1511
1512 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'END');
1513
1514 EXCEPTION
1515 WHEN OTHERS THEN
1516 x_result := fnd_api.g_ret_sts_error;
1517 x_error_code := SQLCODE;
1518 x_error_message := SUBSTR(SQLERRM, 1, 100);
1519 PON_FORMS_UTIL_PVT.print_error_log(l_api_name, 'EXCEPTION - x_result=' || x_result || ' x_error_code=' || x_error_code || ' x_error_message=' || x_error_message || ' SQLERRM=' || SQLERRM);
1520
1521 END CREATE_ABSTRACT_TABLE;
1522
1523 /*======================================================================
1524 PROCEDURE : CREATE_FORM PRIVATE
1525 PARAMETERS:
1526 COMMENT : This is the mother of all procedures to actually generate
1527 the JRAD for the corresponding form_id.
1528 ======================================================================*/
1529
1530 PROCEDURE CREATE_FORM(p_form_id IN NUMBER,
1531 x_result OUT NOCOPY VARCHAR2,
1532 x_error_code OUT NOCOPY VARCHAR2,
1533 x_error_message OUT NOCOPY VARCHAR2) IS
1534
1535 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_FORM';
1536
1537 CURSOR V_FORM_FIELDS_CURSOR(p_form_id NUMBER) is
1538
1539 SELECT pon_form_section_compiled.FORM_ID,
1540 pon_form_section_compiled.TYPE,
1541 pon_form_section_compiled.FIELD_CODE,
1542 pon_form_section_compiled.MAPPING_FIELD_VALUE_COLUMN,
1543 pon_form_section_compiled.REQUIRED,
1544 NVL (pon_form_section_compiled.LEVEL1_SECTION_ID, -1) SECTION_ID,
1545 pon_forms_sections.FORM_CODE SECTION_CODE,
1546 pon_fields.DATATYPE,
1547 pon_fields.SYSTEM_FLAG,
1548 pon_fields.VALUE_SET_NAME,
1549 pon_fields_tl.FIELD_NAME,
1550 pon_fields_tl.DESCRIPTION FIELD_DESCRIPTION,
1551 pon_form_section_compiled.INTERNAL_SEQUENCE_NUMBER,
1552 NVL(pon_form_section_compiled.LEVEL2_SECTION_ID, -1) LEVEL2_SECTION_ID,
1553 NVL(pon_form_section_compiled.REPEATING_SECTION_ID, -1) REPEATING_SECTION_ID
1554 FROM PON_FORM_SECTION_COMPILED,
1555 PON_FIELDS,
1556 PON_FIELDS_TL,
1557 PON_FORMS_SECTIONS
1558 WHERE pon_form_section_compiled.FIELD_CODE = pon_fields.FIELD_CODE(+)
1559 AND pon_form_section_compiled.FIELD_CODE = pon_fields_tl.FIELD_CODE(+)
1560 AND pon_forms_sections.FORM_ID = pon_form_section_compiled.FORM_ID
1561 AND pon_form_section_compiled.FORM_ID = P_FORM_ID
1562 AND NVL(pon_form_section_compiled.ENABLED, 'Y') = 'Y'
1563 AND pon_fields_tl.LANGUAGE(+) = g_base_language
1564 ORDER BY
1565 INTERNAL_SEQUENCE_NUMBER;
1566
1567
1568 TYPE SECTION_LAYOUT_ELEMENTS_TABLE IS TABLE OF JDR_DOCBUILDER.ELEMENT INDEX BY BINARY_INTEGER;
1569
1570 TYPE SECTION_LAYOUT_TABLE IS TABLE OF JDR_DOCBUILDER.ELEMENT INDEX BY VARCHAR2(120);
1571
1572 v_section_layout_array SECTION_LAYOUT_TABLE;
1573 v_section_layout_array_rd SECTION_LAYOUT_TABLE;
1574 v_parent_layout_array_index VARCHAR2(120);
1575 v_current_layout_array_index VARCHAR2(120);
1576
1577 v_form_fields_row V_FORM_FIELDS_CURSOR%ROWTYPE;
1578
1579 v_section_layout_element_array SECTION_LAYOUT_ELEMENTS_TABLE;
1580
1581 v_current_layout_element_index BINARY_INTEGER;
1582
1583 v_section_element_array_rd SECTION_LAYOUT_ELEMENTS_TABLE;
1584
1585 v_current_element_index_rd BINARY_INTEGER;
1586
1587
1588 v_section_element JDR_DOCBUILDER.ELEMENT;
1589 v_section_layout_element JDR_DOCBUILDER.ELEMENT;
1590 v_message_layout_element JDR_DOCBUILDER.ELEMENT;
1591 v_section_field_element JDR_DOCBUILDER.ELEMENT;
1592 v_section_tip_element JDR_DOCBUILDER.ELEMENT;
1593 v_section_tip_element_rd JDR_DOCBUILDER.ELEMENT;
1594 v_delete_field_element JDR_DOCBUILDER.ELEMENT;
1595 v_delete_parameter JDR_DOCBUILDER.ELEMENT;
1596 v_delete_parameters JDR_DOCBUILDER.ELEMENT;
1597 v_temp_element JDR_DOCBUILDER.ELEMENT;
1598 v_column_header_element JDR_DOCBUILDER.ELEMENT;
1599 v_add_table_row_element JDR_DOCBUILDER.ELEMENT;
1600 v_table_footer_element JDR_DOCBUILDER.ELEMENT;
1601
1602
1603 v_section_element_rd JDR_DOCBUILDER.ELEMENT;
1604 v_section_layout_element_rd JDR_DOCBUILDER.ELEMENT;
1605 v_section_field_element_rd JDR_DOCBUILDER.ELEMENT;
1606
1607
1608 v_section_title PON_FORMS_SECTIONS_TL.FORM_NAME%TYPE;
1609 v_parent_section_code PON_FORMS_SECTIONS.FORM_CODE%TYPE;
1610 v_section_code PON_FORMS_SECTIONS.FORM_CODE%TYPE;
1611 v_section_desc PON_FORMS_SECTIONS_TL.FORM_DESCRIPTION%TYPE;
1612 v_field_jrad_id VARCHAR2(200);
1613 v_jrad_element_id VARCHAR2(200);
1614 v_section_id PON_FORMS_SECTIONS.FORM_ID%TYPE;
1615
1616 v_LEVEL1_SECTION_ID PON_FORMS_SECTIONS.FORM_ID%TYPE;
1617 v_parent_section_id PON_FORMS_SECTIONS.FORM_ID%TYPE;
1618 v_current_section_id PON_FORMS_SECTIONS.FORM_ID%TYPE;
1619
1620 v_formfieldvaluesvo_list_count INTEGER;
1621 v_form_mcl_count INTEGER;
1622 v_section_mcl_count INTEGER;
1623
1624 v_formfieldvaluesvo_name VARCHAR2(100);
1625 v_curr_formfieldvaluesvo_name VARCHAR2(100);
1626 v_top_formfieldvaluesvo_name VARCHAR2(100);
1627 v_display_type VARCHAR2(1);
1628 v_validation_type VARCHAR2(1);
1629 v_prev_record_type PON_FORM_SECTION_COMPILED.TYPE%TYPE;
1630
1631 rval INTEGER;
1632 dataEntryRegion JDR_DOCBUILDER.DOCUMENT := NULL;
1633 readOnlyRegion JDR_DOCBUILDER.DOCUMENT := NULL;
1634
1635 v_data_entry_rgn_name VARCHAR2(250);
1636 v_read_only_rgn_name VARCHAR2(250);
1637 v_vset_element_created VARCHAR2(1);
1638
1639 BEGIN
1640 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'BEGIN-');
1641
1642 -- we dont need to pass the fullPathName to this procedure
1643 -- we can generate the region name here
1644
1645 v_data_entry_rgn_name := PON_FORMS_UTIL_PVT.getDataEntryRegionName(p_form_id);
1646 v_read_only_rgn_name := PON_FORMS_UTIL_PVT.getReadOnlyRegionName(p_form_id);
1647
1648 IF (JDR_DOCBUILDER.DOCUMENTEXISTS(v_data_entry_rgn_name)=TRUE) THEN --{
1649 JDR_DOCBUILDER.DELETEDOCUMENT(v_data_entry_rgn_name);
1650 END IF; --}
1651
1652 IF (JDR_DOCBUILDER.DOCUMENTEXISTS(v_read_only_rgn_name)=TRUE) THEN --{
1653 JDR_DOCBUILDER.DELETEDOCUMENT(v_read_only_rgn_name);
1654 END IF; --}
1655
1656 -- initialize the dataEntryRegion
1657 dataEntryRegion := JDR_DOCBUILDER.createDocument(v_data_entry_rgn_name,'en-US');
1658 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'Step 1 - create data-entry region' || v_data_entry_rgn_name);
1659
1660 readOnlyRegion := JDR_DOCBUILDER.createDocument(v_read_only_rgn_name,'en-US');
1661
1662 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'Step 2 - create read-entry region' || v_read_only_rgn_name);
1663
1664 v_current_layout_element_index := 0;
1665 v_parent_section_code := NULL;
1666 v_section_code := NULL;
1667
1668 -- initialize a few local variables
1669 v_date_list_count := 1;
1670 v_table_vo_count := 1;
1671 v_formfieldvaluesvo_list_count := 1;
1672 v_form_mcl_count := 0;
1673 v_section_mcl_count := 0;
1674 v_parent_section_id := -9999;
1675 v_LEVEL1_SECTION_ID := -9999;
1676 v_current_section_id := -9999;
1677 v_prev_record_type := 'DUMMY';
1678 v_vset_element_created := 'N';
1679
1680 v_formfieldvaluesvo_name := 'FormFieldValuesVO';
1681 v_top_formfieldvaluesvo_name := 'FormFieldValuesVO1';
1682 v_curr_formfieldvaluesvo_name := 'FormFieldValuesVO1';
1683
1684 FOR v_form_fields_row in V_FORM_FIELDS_CURSOR (p_form_id) LOOP --{
1685
1686 v_jrad_element_id := getJradId (v_form_fields_row.type,
1687 v_form_fields_row.form_id,
1688 v_form_fields_row.section_id,
1689 v_form_fields_row.LEVEL2_SECTION_ID,
1690 v_form_fields_row.repeating_section_id,
1691 v_form_fields_row.field_code);
1692
1693 IF(v_form_fields_row.type='FORM') THEN --{
1694
1695 v_parent_section_id := -1;
1696 v_current_section_id := v_form_fields_row.form_id;
1697 v_LEVEL1_SECTION_ID := -1;
1698
1699 --Create a new header section
1700 v_section_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
1701 --Create a new header section for read only region
1702 v_section_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
1703
1704 --get the section title
1705
1706 SELECT
1707 forms_tl.form_name, forms.form_code
1708 INTO
1709 v_section_title, v_section_code
1710 FROM
1711 pon_forms_sections forms,
1712 pon_forms_sections_tl forms_tl
1713 WHERE
1714 forms.form_id = forms_tl.form_id AND
1715 forms.form_id = v_current_section_id AND
1716 forms_tl.LANGUAGE = g_base_language;
1717
1718 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 1+ : create header region for section ' || v_section_code);
1719
1720 JDR_DOCBUILDER.setAttribute (v_section_element, 'id', v_jrad_element_id);
1721
1722 JDR_DOCBUILDER.setAttribute (v_section_element, 'text', escapespecialchar(v_section_title));
1723
1724 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'id', v_jrad_element_id);
1725
1726 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'text', escapespecialchar(v_section_title));
1727
1728 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 1+ - top level element is ' || v_current_section_id);
1729
1730 JDR_DOCBUILDER.setTopLevelElement(dataEntryRegion, v_section_element);
1731
1732 JDR_DOCBUILDER.setTopLevelElement(readOnlyRegion, v_section_element_rd);
1733
1734 --add the layout to the array
1735 ---
1736 v_current_layout_array_index := getCurrentElementIndex(v_form_fields_row.type, p_form_id, 0, 0, 0, null);
1737 v_section_layout_array(v_current_layout_array_index) := v_section_element;
1738
1739 ----------------------------------------------------------------------------------------
1740 -----READ-ONLY-REGION-START-------------------------------------------------------------
1741 ----------------------------------------------------------------------------------------
1742 v_section_layout_array_rd(v_current_layout_array_index) := v_section_element_rd;
1743 ----------------------------------------------------------------------------------------
1744 -----READ-ONLY-REGION-END---------------------------------------------------------------
1745 ----------------------------------------------------------------------------------------
1746
1747
1748 --}
1749
1750 ELSIF (v_form_fields_row.type='FORM_FIELD') THEN
1751 --{
1752
1753 IF(v_prev_record_type <> 'FORM_FIELD') THEN --{
1754
1755 v_parent_section_id := v_form_fields_row.form_id;
1756 v_current_section_id := v_form_fields_row.form_id;
1757 v_LEVEL1_SECTION_ID := -1;
1758
1759 --create a section layout(MCL) and add it to the new section
1760 -- create a MCL
1761 v_form_mcl_count := v_form_mcl_count + 1;
1762 v_section_layout_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,
1763 'messageComponentLayout');
1764
1765 v_section_layout_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,
1766 'messageComponentLayout');
1767
1768 v_section_mcl_count := v_section_mcl_count + 1;
1769
1770 v_curr_formfieldvaluesvo_name := v_top_formfieldvaluesvo_name;
1771
1772 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'id',
1773 v_section_code||'_MCL'|| v_section_mcl_count);
1774
1775 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'columns', '2');
1776 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'rows', '1');
1777
1778 v_parent_layout_array_index := getParentElementIndex(v_form_fields_row.type, p_form_id, 0, 0, 0, null);
1779
1780 JDR_DOCBUILDER.addChild (v_section_layout_array(v_parent_layout_array_index),jdr_docbuilder.UI_NS,
1781 'contents',v_section_layout_element);
1782
1783 --------------------------------------------
1784 -----READ-ONLY-REGION-START-----------------
1785 --------------------------------------------
1786
1787 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'id',
1788 v_section_code||'_MCL'|| v_section_mcl_count);
1789
1790 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'columns', '2');
1791 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'rows', '1');
1792
1793 -- add the MCL region as a child of the top-level header region
1794
1795 JDR_DOCBUILDER.addChild (v_section_layout_array_rd(v_parent_layout_array_index),jdr_docbuilder.UI_NS,
1796 'contents', v_section_layout_element_rd);
1797
1798 --------------------------------------------
1799 -----READ-ONLY-REGION-END-------------------
1800 --------------------------------------------
1801
1802
1803 END IF; --}
1804
1805 --}
1806
1807 ELSIF (v_form_fields_row.type='NORMAL_SECTION') THEN
1808 --{
1809
1810 -- this is the 1st occurence of the section_field
1811
1812 v_parent_section_id := v_form_fields_row.form_id;
1813 v_current_section_id := v_form_fields_row.section_id;
1814 v_LEVEL1_SECTION_ID := v_current_section_id;
1815
1816 -- add the mcl as a child of the header region
1817
1818 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 2+ : v_parent_section_id = '
1819 || v_parent_section_id || ' v_current_section_id = '
1820 || v_current_section_id || ' v_LEVEL1_SECTION_ID = ' || v_LEVEL1_SECTION_ID);
1821
1822 --Create a new header section
1823 v_section_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
1824 --Create a new header section for the readonly region as well
1825 v_section_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
1826
1827 --get the section title
1828
1829 SELECT
1830 forms_tl.form_name, forms.form_code, forms_tl.tip_text
1831 INTO
1832 v_section_title, v_section_code, v_section_desc
1833 FROM
1834 pon_forms_sections forms,
1835 pon_forms_sections_tl forms_tl
1836 WHERE
1837 forms.form_id = forms_tl.form_id AND
1838 forms.form_id = v_current_section_id AND
1839 forms_tl.LANGUAGE = g_base_language;
1840
1841 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 2+ - create header region for section ' || v_section_code);
1842
1843 JDR_DOCBUILDER.setAttribute (v_section_element, 'id', v_jrad_element_id);
1844 JDR_DOCBUILDER.setAttribute (v_section_element, 'text', escapespecialchar(v_section_title));
1845 g_total_element_count := g_total_element_count + 1;
1846
1847 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'id', v_jrad_element_id);
1848 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'text', escapespecialchar(v_section_title));
1849
1850 -- add the header region of the section as a child of the toplevel header region of the form
1851 v_current_layout_array_index := getCurrentElementIndex (v_form_fields_row.type,p_form_id,v_current_section_id,
1852 0,0,null);
1853
1854 v_parent_layout_array_index := getParentElementIndex (v_form_fields_row.type,p_form_id,v_current_section_id,
1855 0,0,null);
1856 --add the layout to the array
1857 JDR_DOCBUILDER.addChild(v_section_layout_array(v_parent_layout_array_index),
1858 jdr_docbuilder.UI_NS,'contents',v_section_element);
1859
1860 v_section_layout_array(v_current_layout_array_index) := v_section_element;
1861
1862 -- add a small tip element if description has been entered
1863 if(nvl(v_section_desc, 'E') <> 'E') then
1864 v_section_tip_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,
1865 'tip');
1866
1867 JDR_DOCBUILDER.setAttribute (v_section_tip_element, 'id', v_jrad_element_id || '_TIP');
1868 JDR_DOCBUILDER.setAttribute (v_section_tip_element, 'text', escapespecialchar(v_section_desc));
1869 JDR_DOCBUILDER.addChild(v_section_element,
1870 jdr_docbuilder.UI_NS,'contents',v_section_tip_element);
1871
1872 else
1873 v_section_desc := to_char(null);
1874 end if;
1875
1876 ------------------------------------------
1877 ---READONLY--REGION--START----------------
1878 ------------------------------------------
1879
1880 JDR_DOCBUILDER.addChild(v_section_layout_array_rd(v_parent_layout_array_index),
1881 jdr_docbuilder.UI_NS,'contents',v_section_element_rd);
1882
1883 v_section_layout_array_rd(v_current_layout_array_index) := v_section_element_rd;
1884
1885 if(nvl(v_section_desc, 'E') <> 'E') then
1886 v_section_tip_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'tip');
1887 JDR_DOCBUILDER.setAttribute (v_section_tip_element_rd, 'id', v_jrad_element_id || '_TIP');
1888 JDR_DOCBUILDER.setAttribute (v_section_tip_element_rd, 'text', escapespecialchar(v_section_desc));
1889 JDR_DOCBUILDER.addChild(v_section_element_rd,
1890 jdr_docbuilder.UI_NS,'contents',v_section_tip_element_rd);
1891 else
1892 v_section_desc := to_char(null);
1893 end if;
1894
1895 --------------------------------------------
1896 -----READ-ONLY-REGION-END-------------------
1897 --------------------------------------------
1898 --}
1899
1900 ELSIF (v_form_fields_row.type='SECTION_FIELD') THEN
1901 --{
1902 -- if this is the 1st occurence of a section field, then we will need
1903 -- to create a MCL OR
1904 -- if we haven't previously created an MCL for this section
1905 -- normal adding of fields to an MCL for a section will be handled below,
1906 -- here, we will determine whether or not this field appears in a section
1907 -- apart from the remaining group of fields in the section
1908
1909 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case ' || v_form_fields_row.type || ' :-: ' || v_prev_record_type);
1910
1911 IF(v_prev_record_type <> 'SECTION_FIELD') THEN
1912 --{
1913 v_parent_section_id := v_form_fields_row.form_id;
1914 v_current_section_id := v_form_fields_row.section_id;
1915 v_LEVEL1_SECTION_ID := v_current_section_id;
1916
1917 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case '|| v_form_fields_row.type ||':+:'
1918 || v_current_section_id);
1919
1920 -- we have already created a oa:header region for this section
1921 -- but just that this field has been added to this section out-of-order
1922 -- so create a MCL
1923 v_section_layout_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,
1924 'messageComponentLayout');
1925
1926
1927 v_section_layout_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,
1928 'messageComponentLayout');
1929
1930
1931 v_section_mcl_count := v_section_mcl_count + 1;
1932
1933 v_curr_formfieldvaluesvo_name := v_top_formfieldvaluesvo_name;
1934
1935
1936 SELECT
1937 forms_tl.form_name, forms.form_code, forms_tl.tip_text
1938 INTO
1939 v_section_title, v_section_code, v_section_desc
1940 FROM
1941 pon_forms_sections forms,
1942 pon_forms_sections_tl forms_tl
1943 WHERE
1944 forms.form_id = forms_tl.form_id AND
1945 forms.form_id = v_current_section_id AND
1946 forms_tl.LANGUAGE = g_base_language;
1947
1948
1949 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'id',
1950 v_section_code||'_MCL'|| v_section_mcl_count);
1951
1952 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'columns', '2');
1953 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'rows', '1');
1954
1955 -- add the MCL as a child of the header region of the section
1956 -- we have already created that oa:header region before in type='normal-section'
1957 ------------------------------------------------------------------------------------
1958 v_parent_layout_array_index :=getParentElementIndex(v_form_fields_row.type,p_form_id,v_current_section_id,
1959 0,0,null);
1960
1961 JDR_DOCBUILDER.addChild(v_section_layout_array(v_parent_layout_array_index),
1962 jdr_docbuilder.UI_NS,'contents',v_section_layout_element);
1963 ------------------------------------------------------------------------------------
1964
1965 -------------------------------------------
1966 -- READONLY--REGION--START-----------------
1967 -------------------------------------------
1968 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'id',
1969 v_section_code||'_MCL'|| v_section_mcl_count);
1970
1971 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'columns', '2');
1972 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'rows', '1');
1973
1974 JDR_DOCBUILDER.addChild(v_section_layout_array_rd(v_parent_layout_array_index),
1975 jdr_docbuilder.UI_NS,'contents',v_section_layout_element_rd);
1976
1977 --------------------------------------------
1978 -- READONLY--REGION--END--------------------
1979 --------------------------------------------
1980
1981 END IF;
1982 --}
1983 --}
1984
1985 ELSIF (v_form_fields_row.type='INNER_NORMAL_SECTION') THEN
1986 --{
1987
1988 v_parent_section_id := v_form_fields_row.section_id;
1989 v_current_section_id := v_form_fields_row.LEVEL2_SECTION_ID;
1990 v_LEVEL1_SECTION_ID := v_parent_section_id;
1991
1992 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 3+ : v_parent_section_id = '
1993 || v_parent_section_id || ' v_current_section_id = '
1994 || v_current_section_id || ' v_LEVEL1_SECTION_ID = ' || v_LEVEL1_SECTION_ID);
1995
1996 --Create a new header section
1997 v_section_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
1998
1999
2000 --Create a new header section
2001 v_section_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
2002
2003 --get the section title
2004
2005 SELECT
2006 forms_tl.form_name, forms.form_code, forms_tl.tip_text
2007 INTO
2008 v_section_title, v_section_code, v_section_desc
2009 FROM
2010 pon_forms_sections forms,
2011 pon_forms_sections_tl forms_tl
2012 WHERE
2013 forms.form_id = forms_tl.form_id AND
2014 forms.form_id = v_current_section_id AND
2015 forms_tl.LANGUAGE = g_base_language;
2016
2017 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 3+ : create header region for section ' || v_section_code);
2018
2019 JDR_DOCBUILDER.setAttribute (v_section_element, 'id', v_jrad_element_id);
2020 JDR_DOCBUILDER.setAttribute (v_section_element, 'text', escapespecialchar(v_section_title));
2021
2022 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'id', v_jrad_element_id);
2023 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'text', escapespecialchar(v_section_title));
2024
2025 ------------------------------------------------------------------------------------
2026 v_current_layout_array_index := getCurrentElementIndex(v_form_fields_row.type,p_form_id,v_parent_section_id,
2027 v_current_section_id,0,null);
2028
2029 v_parent_layout_array_index := getParentElementIndex(v_form_fields_row.type,p_form_id,v_parent_section_id,
2030 v_current_section_id,0,null);
2031
2032 JDR_DOCBUILDER.addChild(v_section_layout_array(v_parent_layout_array_index),
2033 jdr_docbuilder.UI_NS,'contents',v_section_element);
2034
2035 v_section_layout_array(v_current_layout_array_index) := v_section_element;
2036
2037 ------------------------------------------------------------------------------------
2038
2039 -- add a small tip element if description has been entered
2040 if(nvl(v_section_desc, 'E') <> 'E') then
2041 v_section_tip_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'tip');
2042 JDR_DOCBUILDER.setAttribute (v_section_tip_element, 'id', v_jrad_element_id || '_TIP');
2043 JDR_DOCBUILDER.setAttribute (v_section_tip_element, 'text', escapespecialchar(v_section_desc));
2044 JDR_DOCBUILDER.addChild(v_section_element,
2045 jdr_docbuilder.UI_NS,'contents',v_section_tip_element);
2046
2047 else
2048 v_section_desc := to_char(null);
2049 end if;
2050 ---------------------------------------
2051 --- READ-ONLY-REGION-START-------------
2052 ---------------------------------------
2053
2054 JDR_DOCBUILDER.addChild(v_section_layout_array_rd(v_parent_layout_array_index),
2055 jdr_docbuilder.UI_NS,'contents',v_section_element_rd);
2056
2057 v_section_layout_array_rd(v_current_layout_array_index) := v_section_element_rd;
2058
2059 if(nvl(v_section_desc, 'E') <> 'E') then
2060 v_section_tip_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,'tip');
2061 JDR_DOCBUILDER.setAttribute (v_section_tip_element_rd, 'id', v_jrad_element_id || '_TIP');
2062 JDR_DOCBUILDER.setAttribute (v_section_tip_element_rd, 'text', escapespecialchar(v_section_desc));
2063 JDR_DOCBUILDER.addChild(v_section_element_rd,
2064 jdr_docbuilder.UI_NS,'contents',v_section_tip_element_rd);
2065 else
2066 v_section_desc := to_char(null);
2067 end if;
2068 ---------------------------------------
2069 --- READ-ONLY-REGION-END-------------
2070 ---------------------------------------
2071 --}
2072
2073 ELSIF (v_form_fields_row.type='INNER_SECTION_FIELD') THEN
2074 --{
2075 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case ' || v_form_fields_row.type || ' :-: ' || v_prev_record_type);
2076
2077 IF(v_prev_record_type <> 'INNER_SECTION_FIELD') THEN
2078 --{
2079
2080 v_parent_section_id := v_form_fields_row.section_id;
2081 v_current_section_id := v_form_fields_row.LEVEL2_SECTION_ID;
2082 v_LEVEL1_SECTION_ID := v_parent_section_id;
2083
2084 -- we have encountered a field inside a inner section, which was
2085 -- added out-of-order from the original set of fields directly
2086 -- inside the
2087
2088 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case'||v_form_fields_row.type||':+:'||v_current_section_id);
2089
2090 --create a section layout(MCL) and add it to the new section
2091 v_section_layout_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,
2092 'messageComponentLayout');
2093
2094 --create a section layout(MCL) and add it to the new section
2095 v_section_layout_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,
2096 'messageComponentLayout');
2097 -- increment the total number of MCLs we have created so far
2098 v_section_mcl_count := v_section_mcl_count + 1;
2099
2100 -- since we are creating a MCL for the main page normal section, the top-level
2101 -- view object should be used
2102 v_curr_formfieldvaluesvo_name := v_top_formfieldvaluesvo_name;
2103
2104 SELECT
2105 forms_tl.form_name, forms.form_code, forms_tl.tip_text
2106 INTO
2107 v_section_title, v_section_code, v_section_desc
2108 FROM
2109 pon_forms_sections forms,
2110 pon_forms_sections_tl forms_tl
2111 WHERE
2112 forms.form_id = forms_tl.form_id AND
2113 forms.form_id = v_current_section_id AND
2114 forms_tl.LANGUAGE = g_base_language;
2115
2116 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'id',
2117 v_section_code||'_MCL' || v_section_mcl_count);
2118
2119 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'columns', '2');
2120 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'rows', '1');
2121
2122 ------------------------------------------------------------------------------------
2123 v_parent_layout_array_index :=getParentElementIndex(v_form_fields_row.type,p_form_id,v_parent_section_id,
2124 v_current_section_id,0,null);
2125
2126 JDR_DOCBUILDER.addChild(v_section_layout_array(v_parent_layout_array_index),
2127 jdr_docbuilder.UI_NS,'contents',v_section_layout_element);
2128 ------------------------------------------------------------------------------------
2129
2130 -----------------------------------
2131 -----READ-ONLY-REGION-START--------
2132 -----------------------------------
2133
2134 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'id',
2135 v_section_code||'_MCL' || v_section_mcl_count);
2136
2137 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'columns', '2');
2138 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'rows', '1');
2139 JDR_DOCBUILDER.addChild(v_section_layout_array_rd(v_parent_layout_array_index),
2140 jdr_docbuilder.UI_NS,'contents',v_section_layout_element_rd);
2141
2142 -----------------------------------
2143 -----READ-ONLY-REGION-END----------
2144 -----------------------------------
2145
2146 END IF;
2147 --}
2148
2149 --}
2150
2151 ELSIF (v_form_fields_row.type='REPEAT_SECTION') THEN
2152 --{
2153
2154 -- this is a repeating section inside the form
2155
2156 v_parent_section_id := v_form_fields_row.form_id;
2157 v_current_section_id := v_form_fields_row.repeating_section_id;
2158 v_LEVEL1_SECTION_ID := v_current_section_id;
2159
2160 -- create a header section
2161
2162 v_section_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
2163
2164 v_section_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
2165
2166 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 4+ : v_parent_section_id = '
2167 || v_parent_section_id || ' v_current_section_id = '
2168 || v_current_section_id || ' v_LEVEL1_SECTION_ID = '
2169 || v_LEVEL1_SECTION_ID);
2170
2171 -- get the section title
2172 SELECT
2173 forms_tl.form_name, forms.form_code
2174 INTO
2175 v_section_title, v_section_code
2176 FROM
2177 pon_forms_sections forms,
2178 pon_forms_sections_tl forms_tl
2179 WHERE
2180 forms.form_id = forms_tl.form_id AND
2181 forms.form_id = v_current_section_id AND
2182 forms_tl.LANGUAGE = g_base_language;
2183
2184 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 4+ : create header region for section - '
2185 || v_section_code );
2186
2187 JDR_DOCBUILDER.setAttribute (v_section_element, 'id', v_jrad_element_id);
2188 JDR_DOCBUILDER.setAttribute (v_section_element, 'text', escapespecialchar(v_section_title));
2189
2190 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'id', v_jrad_element_id);
2191 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'text', escapespecialchar(v_section_title));
2192
2193 -- set all table-level JRAD attributes
2194 v_section_layout_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'advancedTable');
2195 v_section_layout_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'advancedTable');
2196 -- increment the VO count by one
2197 v_formfieldvaluesvo_list_count := v_formfieldvaluesvo_list_count + 1;
2198 v_curr_formfieldvaluesvo_name := v_formfieldvaluesvo_name || v_formfieldvaluesvo_list_count;
2199
2200 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'id', v_jrad_element_id ||'_table');
2201 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'viewName', v_curr_formfieldvaluesvo_name);
2202 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'width', '100%');
2203
2204 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'id', v_jrad_element_id ||'_table');
2205 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'viewName',
2206 v_curr_formfieldvaluesvo_name);
2207
2208 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'Setting viewName for ' || v_section_code
2209 ||'_table' || ' ' || v_curr_formfieldvaluesvo_name);
2210
2211 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'width', '100%');
2212
2213 -- create a table footer, and this footer as a child of the table region
2214 v_table_footer_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'tableFooter');
2215 JDR_DOCBUILDER.setAttribute (v_table_footer_element, 'id', v_jrad_element_id ||'_TABFTR');
2216 JDR_DOCBUILDER.addChild (v_section_layout_element, JDR_DOCBUILDER.UI_NS, 'footer',
2217 v_table_footer_element);
2218
2219 v_add_table_row_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'addTableRow');
2220 JDR_DOCBUILDER.setAttribute (v_add_table_row_element, 'id', v_jrad_element_id ||'_ADDBTN');
2221 JDR_DOCBUILDER.setAttribute (v_add_table_row_element, 'autoInsertion', 'false');
2222 JDR_DOCBUILDER.addChild (v_table_footer_element, JDR_DOCBUILDER.UI_NS, 'contents',
2223 v_add_table_row_element);
2224
2225 -- add all the rows in the table
2226 -- create a repeating section directly inside a form
2227
2228 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'Invoke CREATE_TABLE with '
2229 || v_current_section_id || ' ' || p_form_id || ' '
2230 || v_formfieldvaluesvo_list_count);
2231
2232 v_section_layout_element := CREATE_TABLE(v_current_section_id, v_section_layout_element,
2233 p_form_id, v_formfieldvaluesvo_list_count, 'N',
2234 v_form_fields_row.internal_sequence_number);
2235
2236 v_section_layout_element_rd := CREATE_TABLE(v_current_section_id,
2237 v_section_layout_element_rd,
2238 p_form_id,
2239 v_formfieldvaluesvo_list_count,
2240 'Y', v_form_fields_row.internal_sequence_number);
2241
2242
2243 /** Adding the delete column **/
2244 v_temp_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'column');
2245 JDR_DOCBUILDER.setAttribute (v_temp_element, 'id', v_jrad_element_id || '_COLDEL');
2246 JDR_DOCBUILDER.setAttribute (v_temp_element, 'columnDataFormat', 'iconButtonFormat');
2247 JDR_DOCBUILDER.addChild (v_section_layout_element, JDR_DOCBUILDER.UI_NS,
2248 'contents', v_temp_element);
2249
2250 v_column_header_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'sortableHeader');
2251
2252 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'id', v_jrad_element_id || '_SCLHDR');
2253 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'prompt', 'Delete');
2254 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'columnHeader',
2255 v_column_header_element);
2256
2257 v_delete_field_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,'image');
2258 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'id', v_jrad_element_id || '_DELIMG');
2259 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'source', 'deleteicon_enabled.gif');
2260 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'warnAboutChanges', 'false');
2261 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'serverUnvalidated', 'true');
2262 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'unvalidated', 'true');
2263 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'contents',
2264 v_delete_field_element);
2265
2266 v_delete_parameters := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'fireAction');
2267 JDR_DOCBUILDER.setAttribute (v_delete_parameters, 'event', 'Delete');
2268 JDR_DOCBUILDER.setAttribute (v_delete_parameters, 'unvalidated', 'true');
2269 v_delete_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
2270 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'key', 'Id');
2271
2272 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'value',
2273 '${oa.encrypt.' || v_curr_formfieldvaluesvo_name || '.FormFieldValueId}');
2274
2275 JDR_DOCBUILDER.addChild (v_delete_parameters, JDR_DOCBUILDER.UI_NS,
2276 'parameters', v_delete_parameter);
2277
2278 v_delete_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
2279
2280 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'key', 'ViewName');
2281
2282 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'value', v_curr_formfieldvaluesvo_name);
2283 JDR_DOCBUILDER.addChild (v_delete_parameters, JDR_DOCBUILDER.UI_NS,
2284 'parameters', v_delete_parameter);
2285
2286 JDR_DOCBUILDER.addChild (v_delete_field_element, JDR_DOCBUILDER.UI_NS,
2287 'primaryClientAction', v_delete_parameters);
2288
2289 /** Done: Adding delete colmn */
2290
2291 -- add the table into the header region
2292 JDR_DOCBUILDER.addChild (v_section_element, jdr_docbuilder.UI_NS,'contents',
2293 v_section_layout_element);
2294
2295 -- add the header region to its parent, since this is type='repeating_section'
2296 -- we can rest assured that the parent of this section is the top-level form
2297
2298 ---------------------------------------------------------------------------------------------------------------
2299 v_current_layout_array_index := getCurrentElementIndex(v_form_fields_row.type,p_form_id,0,0,
2300 v_current_section_id,null);
2301
2302 v_parent_layout_array_index := getParentElementIndex(v_form_fields_row.type,p_form_id,0,0,
2303 v_current_section_id,null);
2304
2305 JDR_DOCBUILDER.addChild(v_section_layout_array(v_parent_layout_array_index),
2306 jdr_docbuilder.UI_NS,'contents',v_section_element);
2307
2308 v_section_layout_array(v_current_layout_array_index) := v_section_element;
2309 ---------------------------------------------------------------------------------------------------------------
2310
2311 -------------------------------------
2312 -----READ-ONLY-REGION-START----------
2313 -------------------------------------
2314 JDR_DOCBUILDER.addChild (v_section_element_rd, jdr_docbuilder.UI_NS,'contents',
2315 v_section_layout_element_rd);
2316
2317
2318 JDR_DOCBUILDER.addChild(v_section_layout_array_rd(v_parent_layout_array_index),
2319 jdr_docbuilder.UI_NS,'contents',v_section_element_rd);
2320
2321 v_section_layout_array_rd(v_current_layout_array_index) := v_section_element_rd;
2322
2323 -------------------------------------
2324 -----READ-ONLY-REGION-END------------
2325 -------------------------------------
2326 --}
2327
2328 ELSIF (v_form_fields_row.type='INNER_REPEAT_SECTION') THEN
2329 --{
2330
2331
2332 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 5- : v_parent_section_id = '
2333 || v_parent_section_id || ' v_current_section_id = '
2334 || v_current_section_id || ' v_LEVEL1_SECTION_ID = '
2335 || v_LEVEL1_SECTION_ID);
2336
2337 -- this is a repeating section inside a normal section
2338
2339 v_parent_section_id := v_form_fields_row.section_id;
2340 v_current_section_id := v_form_fields_row.repeating_section_id;
2341 v_LEVEL1_SECTION_ID := v_parent_section_id;
2342
2343 -- create a header region
2344 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 5+ : v_parent_section_id = '
2345 || v_parent_section_id || ' v_current_section_id = '
2346 || v_current_section_id || ' v_LEVEL1_SECTION_ID = '
2347 || v_LEVEL1_SECTION_ID);
2348
2349 -- create a table region
2350
2351 -- create a header section
2352 v_section_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
2353
2354 -- create a header section
2355 v_section_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
2356
2357 -- get the section title
2358
2359 SELECT
2360 forms_tl.form_name, forms.form_code
2361 INTO
2362 v_section_title, v_section_code
2363 FROM
2364 pon_forms_sections forms,
2365 pon_forms_sections_tl forms_tl
2366 WHERE
2367 forms.form_id = forms_tl.form_id AND
2368 forms.form_id = v_current_section_id AND
2369 forms_tl.LANGUAGE = g_base_language;
2370
2371 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 5+ : create header region for section - '
2372 || v_section_code );
2373
2374 JDR_DOCBUILDER.setAttribute (v_section_element, 'id', v_jrad_element_id);
2375 JDR_DOCBUILDER.setAttribute (v_section_element, 'text', escapespecialchar(v_section_title));
2376
2377 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'id', v_jrad_element_id);
2378 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'text', escapespecialchar(v_section_title));
2379
2380 -- set all table-level JRAD attributes
2381 v_section_layout_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'advancedTable');
2382
2383 -- set all table-level JRAD attributes
2384 v_section_layout_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'advancedTable');
2385
2386 -- increment the VO count by one
2387 v_formfieldvaluesvo_list_count := v_formfieldvaluesvo_list_count + 1;
2388 v_curr_formfieldvaluesvo_name := v_formfieldvaluesvo_name || v_formfieldvaluesvo_list_count;
2389
2390 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'id', v_jrad_element_id ||'_table');
2391 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'viewName', v_curr_formfieldvaluesvo_name);
2392 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'width', '100%');
2393
2394 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'id', v_jrad_element_id ||'_table');
2395 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'viewName',
2396 v_curr_formfieldvaluesvo_name);
2397
2398 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'Setting viewName for ' || v_section_code
2399 ||'_table' || ' as ' || v_curr_formfieldvaluesvo_name);
2400
2401
2402 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'width', '100%');
2403
2404
2405 -- create a table footer, and this footer as a child of the table region
2406 v_table_footer_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'tableFooter');
2407 JDR_DOCBUILDER.setAttribute (v_table_footer_element, 'id', v_jrad_element_id ||'_TABFTR');
2408
2409 JDR_DOCBUILDER.addChild (v_section_layout_element, JDR_DOCBUILDER.UI_NS, 'footer',
2410 v_table_footer_element);
2411
2412 v_add_table_row_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'addTableRow');
2413 JDR_DOCBUILDER.setAttribute (v_add_table_row_element, 'id', v_jrad_element_id || '_ADDBTN');
2414 JDR_DOCBUILDER.setAttribute (v_add_table_row_element, 'autoInsertion', 'false');
2415 JDR_DOCBUILDER.addChild (v_table_footer_element, JDR_DOCBUILDER.UI_NS, 'contents',
2416 v_add_table_row_element);
2417
2418 -- add all the rows in the table
2419 -- create a repeating section directly inside a form
2420 -- originally passed 'v_section_code' as the 1st param
2421 v_section_layout_element := CREATE_TABLE(v_current_section_id,
2422 v_section_layout_element,
2423 p_form_id,
2424 v_formfieldvaluesvo_list_count,
2425 'N', v_form_fields_row.internal_sequence_number);
2426
2427
2428 v_section_layout_element_rd := CREATE_TABLE(v_current_section_id,
2429 v_section_layout_element_rd,
2430 p_form_id,
2431 v_formfieldvaluesvo_list_count,
2432 'Y', v_form_fields_row.internal_sequence_number);
2433
2434
2435 /** Adding the delete column **/
2436 v_temp_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'column');
2437 JDR_DOCBUILDER.setAttribute (v_temp_element, 'id', v_jrad_element_id || '_COLDEL');
2438 JDR_DOCBUILDER.setAttribute (v_temp_element, 'columnDataFormat', 'iconButtonFormat');
2439 JDR_DOCBUILDER.addChild (v_section_layout_element, JDR_DOCBUILDER.UI_NS, 'contents', v_temp_element);
2440
2441 v_column_header_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'sortableHeader');
2442
2443 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'id', v_jrad_element_id || '_SCLHDR');
2444 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'prompt', 'Delete');
2445 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'columnHeader',
2446 v_column_header_element);
2447
2448 v_delete_field_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,'image');
2449 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'id', v_jrad_element_id || '_DELIMG');
2450 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'source', 'deleteicon_enabled.gif');
2451 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'warnAboutChanges', 'false');
2452 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'serverUnvalidated', 'true');
2453 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'unvalidated', 'true');
2454
2455
2456
2457 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'contents',
2458 v_delete_field_element);
2459
2460 v_delete_parameters := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'fireAction');
2461 JDR_DOCBUILDER.setAttribute (v_delete_parameters, 'event', 'Delete');
2462 JDR_DOCBUILDER.setAttribute (v_delete_parameters, 'unvalidated', 'true');
2463 v_delete_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
2464 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'key', 'Id');
2465
2466 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'value',
2467 '${oa.encrypt.' || v_curr_formfieldvaluesvo_name || '.FormFieldValueId}');
2468
2469 JDR_DOCBUILDER.addChild (v_delete_parameters, JDR_DOCBUILDER.UI_NS,
2470 'parameters', v_delete_parameter);
2471
2472 v_delete_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
2473
2474 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'key', 'ViewName');
2475
2476 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'value', v_curr_formfieldvaluesvo_name);
2477 JDR_DOCBUILDER.addChild (v_delete_parameters, JDR_DOCBUILDER.UI_NS,
2478 'parameters', v_delete_parameter);
2479
2480 JDR_DOCBUILDER.addChild (v_delete_field_element, JDR_DOCBUILDER.UI_NS,
2481 'primaryClientAction', v_delete_parameters);
2482
2483 /** Done: Adding delete colmn */
2484
2485 -- add the table into the header region
2486 JDR_DOCBUILDER.addChild (v_section_element, jdr_docbuilder.UI_NS,'contents',
2487 v_section_layout_element);
2488
2489 -- add the header region to its parent, since this is type='repeating_section'
2490 -- we can rest assured that the parent of this section is the top-level form
2491
2492 ---------------------------------------------------------------------------------------------------------------
2493 v_current_layout_array_index := getCurrentElementIndex(v_form_fields_row.type,p_form_id,v_parent_section_id,0,
2494 v_current_section_id,null);
2495 v_parent_layout_array_index := getParentElementIndex (v_form_fields_row.type,p_form_id,v_parent_section_id,0,
2496 v_current_section_id,null);
2497
2498 JDR_DOCBUILDER.addChild(v_section_layout_array(v_parent_layout_array_index),
2499 jdr_docbuilder.UI_NS,'contents',v_section_element);
2500
2501 v_section_layout_array(v_current_layout_array_index) := v_section_element;
2502 ---------------------------------------------------------------------------------------------------------------
2503
2504 -------------------------------------
2505 -----READ-ONLY-REGION-START----------
2506 -------------------------------------
2507
2508 JDR_DOCBUILDER.addChild (v_section_element_rd, jdr_docbuilder.UI_NS,'contents',
2509 v_section_layout_element_rd);
2510
2511 JDR_DOCBUILDER.addChild(v_section_layout_array_rd(v_parent_layout_array_index),
2512 jdr_docbuilder.UI_NS,'contents',v_section_element_rd);
2513
2514 v_section_layout_array_rd(v_current_layout_array_index) := v_section_element_rd;
2515
2516 -------------------------------------
2517 -----READ-ONLY-REGION-END------------
2518 -------------------------------------
2519
2520
2521 --}
2522 ELSIF (v_form_fields_row.type='INNER_SECTION_REPEAT_SECTION') THEN
2523 --{
2524
2525 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 6- : v_parent_section_id = '
2526 || v_parent_section_id || ' v_current_section_id = '
2527 || v_current_section_id || ' v_LEVEL1_SECTION_ID = '
2528 || v_LEVEL1_SECTION_ID);
2529
2530 -- this is a repeating section inside a normal section which itself
2531 -- is inside another normal section
2532
2533 v_parent_section_id := v_form_fields_row.LEVEL2_SECTION_ID;
2534 v_current_section_id := v_form_fields_row.repeating_section_id;
2535 v_LEVEL1_SECTION_ID := v_form_fields_row.section_id;
2536 -- create a header region
2537
2538 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 6+ : v_parent_section_id = '
2539 || v_parent_section_id || ' v_current_section_id = '
2540 || v_current_section_id || ' v_LEVEL1_SECTION_ID = '
2541 || v_LEVEL1_SECTION_ID);
2542
2543 v_section_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
2544
2545 v_section_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'header');
2546
2547 -- get the section title
2548
2549 SELECT
2550 forms_tl.form_name, forms.form_code
2551 INTO
2552 v_section_title, v_section_code
2553 FROM
2554 pon_forms_sections forms,
2555 pon_forms_sections_tl forms_tl
2556 WHERE
2557 forms.form_id = forms_tl.form_id AND
2558 forms.form_id = v_current_section_id AND
2559 forms_tl.LANGUAGE = g_base_language;
2560
2561 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'case 4+ : create header region for section - ' || v_section_code );
2562
2563 JDR_DOCBUILDER.setAttribute (v_section_element, 'id', v_jrad_element_id);
2564 JDR_DOCBUILDER.setAttribute (v_section_element, 'text', escapespecialchar(v_section_title));
2565
2566 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'id', v_jrad_element_id);
2567 JDR_DOCBUILDER.setAttribute (v_section_element_rd, 'text', escapespecialchar(v_section_title));
2568
2569 -- set all table-level JRAD attributes
2570 v_section_layout_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'advancedTable');
2571
2572 v_section_layout_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'advancedTable');
2573
2574
2575
2576 -- increment the VO count by one
2577 v_formfieldvaluesvo_list_count := v_formfieldvaluesvo_list_count + 1;
2578 v_curr_formfieldvaluesvo_name := v_formfieldvaluesvo_name || v_formfieldvaluesvo_list_count;
2579
2580 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'id', v_jrad_element_id ||'_table' );
2581 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'viewName', v_curr_formfieldvaluesvo_name);
2582 JDR_DOCBUILDER.setAttribute (v_section_layout_element, 'width', '100%');
2583
2584
2585 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'id', v_jrad_element_id ||'_table');
2586 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'viewName', v_curr_formfieldvaluesvo_name);
2587
2588 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'Setting viewName for ' || v_section_code||'_table' || ' as ' || v_curr_formfieldvaluesvo_name);
2589 JDR_DOCBUILDER.setAttribute (v_section_layout_element_rd, 'width', '100%');
2590
2591 -- create a table footer, and this footer as a child of the table region
2592 v_table_footer_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'tableFooter');
2593 JDR_DOCBUILDER.setAttribute (v_table_footer_element, 'id', v_jrad_element_id || '_TABFTR');
2594
2595 JDR_DOCBUILDER.addChild (v_section_layout_element, JDR_DOCBUILDER.UI_NS, 'footer',
2596 v_table_footer_element);
2597
2598 v_add_table_row_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'addTableRow');
2599 JDR_DOCBUILDER.setAttribute (v_add_table_row_element, 'id', v_jrad_element_id ||'_ADDBTN');
2600 JDR_DOCBUILDER.setAttribute (v_add_table_row_element, 'autoInsertion', 'false');
2601 JDR_DOCBUILDER.addChild (v_table_footer_element, JDR_DOCBUILDER.UI_NS, 'contents',
2602 v_add_table_row_element);
2603
2604 -- add all the 'columns' in the table
2605 -- create a repeating section directly inside a form
2606 -- originally passed 'v_section_code' as the 1st param
2607 v_section_layout_element := CREATE_TABLE(v_current_section_id,
2608 v_section_layout_element,
2609 p_form_id,
2610 v_formfieldvaluesvo_list_count,
2611 'N', v_form_fields_row.internal_sequence_number);
2612
2613 v_section_layout_element_rd := CREATE_TABLE(v_current_section_id,
2614 v_section_layout_element_rd,
2615 p_form_id,
2616 v_formfieldvaluesvo_list_count,
2617 'Y', v_form_fields_row.internal_sequence_number);
2618
2619 /** Adding the delete column **/
2620 v_temp_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'column');
2621 JDR_DOCBUILDER.setAttribute (v_temp_element, 'id', v_jrad_element_id || '_COLDEL');
2622 JDR_DOCBUILDER.setAttribute (v_temp_element, 'columnDataFormat', 'iconButtonFormat');
2623 JDR_DOCBUILDER.addChild (v_section_layout_element, JDR_DOCBUILDER.UI_NS,
2624 'contents', v_temp_element);
2625
2626 v_column_header_element := JDR_DOCBUILDER.CREATEELEMENT (JDR_DOCBUILDER.OA_NS, 'sortableHeader');
2627
2628 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'id', v_jrad_element_id || '_SCLHDR');
2629 JDR_DOCBUILDER.setAttribute (v_column_header_element, 'prompt', 'Delete');
2630 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'columnHeader',
2631 v_column_header_element);
2632
2633 v_delete_field_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS,'image');
2634 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'id', v_jrad_element_id || '_DELIMG');
2635 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'source', 'deleteicon_enabled.gif');
2636 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'warnAboutChanges', 'false');
2637 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'serverUnvalidated', 'true');
2638 JDR_DOCBUILDER.setAttribute (v_delete_field_element, 'unvalidated', 'true');
2639 JDR_DOCBUILDER.addChild (v_temp_element, JDR_DOCBUILDER.UI_NS, 'contents', v_delete_field_element);
2640
2641 v_delete_parameters := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'fireAction');
2642 JDR_DOCBUILDER.setAttribute (v_delete_parameters, 'event', 'Delete');
2643 JDR_DOCBUILDER.setAttribute (v_delete_parameters, 'unvalidated', 'true');
2644 v_delete_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
2645 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'key', 'Id');
2646
2647 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'value',
2648 '${oa.encrypt.' || v_curr_formfieldvaluesvo_name || '.FormFieldValueId}');
2649
2650 JDR_DOCBUILDER.addChild (v_delete_parameters, JDR_DOCBUILDER.UI_NS,
2651 'parameters', v_delete_parameter);
2652
2653 v_delete_parameter := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.UI_NS, 'parameter');
2654
2655 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'key', 'ViewName');
2656
2657 JDR_DOCBUILDER.setAttribute (v_delete_parameter, 'value', v_curr_formfieldvaluesvo_name);
2658 JDR_DOCBUILDER.addChild (v_delete_parameters, JDR_DOCBUILDER.UI_NS,
2659 'parameters', v_delete_parameter);
2660
2661 JDR_DOCBUILDER.addChild (v_delete_field_element, JDR_DOCBUILDER.UI_NS,
2662 'primaryClientAction', v_delete_parameters);
2663
2664 /** Done: Adding delete colmn */
2665
2666 -- add the table into the header region
2667 JDR_DOCBUILDER.addChild (v_section_element, jdr_docbuilder.UI_NS,'contents',
2668 v_section_layout_element);
2669
2670 -- add the header region to its parent, since this is type='repeating_section'
2671 -- we can rest assured that the parent of this section is the top-level form
2672
2673 ---------------------------------------------------------------------------------------------------------------
2674 v_current_layout_array_index := getCurrentElementIndex(v_form_fields_row.type,p_form_id,v_LEVEL1_SECTION_ID,
2675 v_parent_section_id,v_current_section_id,null);
2676
2677 v_parent_layout_array_index := getParentElementIndex(v_form_fields_row.type,p_form_id,v_LEVEL1_SECTION_ID,
2678 v_parent_section_id,v_current_section_id,null);
2679
2680 JDR_DOCBUILDER.addChild(v_section_layout_array(v_parent_layout_array_index),
2681 jdr_docbuilder.UI_NS,'contents',v_section_element);
2682
2683 v_section_layout_array(v_current_layout_array_index) := v_section_element;
2684 ---------------------------------------------------------------------------------------------------------------
2685
2686 -------------------------------------
2687 -----READ-ONLY-REGION-START----------
2688 -------------------------------------
2689
2690 JDR_DOCBUILDER.addChild (v_section_element_rd, jdr_docbuilder.UI_NS,'contents',
2691 v_section_layout_element_rd);
2692
2693 JDR_DOCBUILDER.addChild(v_section_layout_array_rd(v_parent_layout_array_index),
2694 jdr_docbuilder.UI_NS,'contents',v_section_element_rd);
2695
2696 v_section_layout_array_rd(v_current_layout_array_index) := v_section_element_rd;
2697
2698 -------------------------------------
2699 -----READ-ONLY-REGION-END------------
2700 -------------------------------------
2701
2702
2703 --}
2704
2705 ELSE
2706 --{
2707 -- something really bad has happened
2708 -- do we need to take some drastic action or simply ignore this error silently
2709 null;
2710 END IF;
2711 --}
2712
2713
2714 IF (v_form_fields_row.type <>'FORM' AND
2715 v_form_fields_row.type <>'REPEAT_SECTION' AND
2716 v_form_fields_row.type <>'INNER_REPEAT_SECTION' AND
2717 v_form_fields_row.type <>'INNER_SECTION_REPEAT_SECTION' AND
2718 v_form_fields_row.type <>'NORMAL_SECTION' AND
2719 v_form_fields_row.type <>'INNER_NORMAL_SECTION' AND
2720 nvl(v_form_fields_row.field_code, 'x$#$y') <> 'x$#$y' ) THEN
2721 --{
2722
2723 -- v_field_jrad_id := v_section_code || '_' || v_form_fields_row.field_code;
2724 v_field_jrad_id := v_jrad_element_id;
2725
2726 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'Creating field ' || v_field_jrad_id);
2727
2728 IF(NVL( v_form_fields_row.SYSTEM_FLAG, 'N') = 'Y' ) THEN
2729 --{
2730 /* Bug 6050403: For the TWO_PART_FLAG system field there is need to
2731 * have a checkbox instead of a text field. So we handle it separately
2732 */
2733 IF (v_form_fields_row.FIELD_CODE <> 'TWO_PART_FLAG') THEN -- {
2734 v_section_field_element := create_element ('messageStyledText', v_field_jrad_id,
2735 v_form_fields_row.field_name, 'VARCHAR2', 'none',
2736 v_form_fields_row.field_code || '_NAME');
2737
2738 v_section_field_element_rd := create_element ('messageStyledText', v_field_jrad_id,
2739 v_form_fields_row.field_name, 'VARCHAR2', 'none',
2740 v_form_fields_row.field_code || '_NAME');
2741 ELSE -- } {
2742 v_section_field_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'messageCheckBox');
2743 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'id', v_field_jrad_id);
2744 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'defaultValue', 'Y');
2745 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'readOnly', 'true');
2746 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'prompt', v_form_fields_row.field_name);
2747 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'rendered', 'true');
2748
2749 v_section_field_element_rd := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'messageCheckBox');
2750 JDR_DOCBUILDER.setAttribute (v_section_field_element_rd, 'id', v_field_jrad_id);
2751 JDR_DOCBUILDER.setAttribute (v_section_field_element_rd, 'defaultValue', 'Y');
2752 JDR_DOCBUILDER.setAttribute (v_section_field_element_rd, 'readOnly', 'true');
2753 JDR_DOCBUILDER.setAttribute (v_section_field_element_rd, 'prompt', v_form_fields_row.field_name);
2754 JDR_DOCBUILDER.setAttribute (v_section_field_element_rd, 'rendered', 'true');
2755 END IF; --}
2756 --}
2757
2758 ELSE
2759 --{
2760
2761 IF (v_form_fields_row.datatype='LONGTEXT') then
2762 v_section_field_element := create_element ('messageTextInput', v_field_jrad_id,
2763 v_form_fields_row.field_name, 'VARCHAR2', 'none',
2764 v_form_fields_row.mapping_field_value_column);
2765
2766
2767 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'maximumLength', 2000);
2768
2769 v_section_field_element_rd := create_element ('messageStyledText', v_field_jrad_id,
2770 v_form_fields_row.field_name, 'VARCHAR2', 'none',
2771 v_form_fields_row.mapping_field_value_column);
2772
2773
2774
2775 ELSIF (v_form_fields_row.datatype='DATE') then
2776 v_section_field_element := create_element ('messageTextInput', v_field_jrad_id,
2777 v_form_fields_row.field_name, 'DATE', 'dateFormat',
2778 v_form_fields_row.mapping_field_value_column);
2779
2780 v_section_field_element_rd := create_element ('messageStyledText', v_field_jrad_id,
2781 v_form_fields_row.field_name, 'DATE', 'none',
2782 v_form_fields_row.mapping_field_value_column);
2783
2784 ELSIF (v_form_fields_row.datatype='DATETIME') then
2785
2786 v_section_field_element := create_element ('messageTextInput', v_field_jrad_id,
2787 v_form_fields_row.field_name, 'DATETIME','dateFormat',
2788 v_form_fields_row.mapping_field_value_column);
2789
2790 v_section_field_element_rd := create_element ('messageStyledText', v_field_jrad_id,
2791 v_form_fields_row.field_name, 'DATETIME', 'dateFormat',
2792 v_form_fields_row.mapping_field_value_column);
2793
2794 ELSIF (v_form_fields_row.datatype='AMOUNT') then
2795 v_section_field_element := create_element ('messageTextInput', v_field_jrad_id,
2796 v_form_fields_row.field_name, 'NUMBER', 'none',
2797 v_form_fields_row.mapping_field_value_column);
2798
2799 v_section_field_element_rd := create_element ('messageStyledText', v_field_jrad_id,
2800 v_form_fields_row.field_name, 'NUMBER', 'none',
2801 v_form_fields_row.mapping_field_value_column);
2802 ELSIF (v_form_fields_row.datatype='NUMBER') then
2803
2804 IF(nvl(v_form_fields_row.field_description, 'x@Y#z') = 'x@Y#z' ) THEN
2805
2806 v_section_field_element := create_element ('messageTextInput', v_field_jrad_id,
2807 v_form_fields_row.field_name, 'NUMBER', 'none',
2808 v_form_fields_row.mapping_field_value_column);
2809
2810 v_section_field_element_rd := create_element ('messageStyledText', v_field_jrad_id,
2811 v_form_fields_row.field_name, 'NUMBER', 'none',
2812 v_form_fields_row.mapping_field_value_column);
2813
2814 ELSE
2815 v_section_field_element := create_element ('messageTextInput', v_field_jrad_id,
2816 v_form_fields_row.field_name, 'NUMBER', 'longMessage',
2817 v_form_fields_row.mapping_field_value_column);
2818
2819 v_section_field_element_rd := create_element ('messageStyledText', v_field_jrad_id,
2820 v_form_fields_row.field_name, 'NUMBER', 'longMessage',
2821 v_form_fields_row.mapping_field_value_column);
2822
2823
2824 END IF;
2825
2826 ELSIF ( (v_form_fields_row.datatype='TEXT') AND (v_form_fields_row.value_set_name is not null)) then
2827
2828 v_section_field_element_rd := create_element ('messageStyledText', v_field_jrad_id,
2829 v_form_fields_row.field_name, 'VARCHAR2', 'none',
2830 v_field_jrad_id || '_NAME');
2831
2832 v_section_field_element := create_vset_element (v_field_jrad_id, v_form_fields_row.field_code,
2833 v_form_fields_row.field_name,
2834 v_form_fields_row.field_description,
2835 v_form_fields_row.mapping_field_value_column,
2836 v_form_fields_row.value_set_name, 'N');
2837 v_vset_element_created := 'Y';
2838
2839
2840 ELSE -- TBD: Unrecognized field
2841
2842 IF(nvl(v_form_fields_row.field_description, 'x@Y#z') = 'x@Y#z' ) THEN
2843
2844 v_section_field_element := create_element ('messageTextInput', v_field_jrad_id,
2845 v_form_fields_row.field_name, 'VARCHAR2','none',
2846 v_form_fields_row.mapping_field_value_column);
2847 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'maximumLength', 2000);
2848
2849 v_section_field_element_rd := create_element ('messageStyledText', v_field_jrad_id,
2850 v_form_fields_row.field_name, 'VARCHAR2','none',
2851 v_form_fields_row.mapping_field_value_column);
2852 ELSE
2853 v_section_field_element := create_element ('messageTextInput', v_field_jrad_id,
2854 v_form_fields_row.field_name, 'VARCHAR2','longMessage',
2855 v_form_fields_row.mapping_field_value_column);
2856 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'maximumLength', 2000);
2857
2858 v_section_field_element_rd := create_element ('messageStyledText', v_field_jrad_id,
2859 v_form_fields_row.field_name, 'VARCHAR2','longMessage',
2860 v_form_fields_row.mapping_field_value_column);
2861
2862
2863 END IF;
2864
2865 END IF;
2866
2867 --If the field is a required field then set it accordingly.
2868 IF (v_form_fields_row.required='Y') THEN
2869 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'required','yes');
2870 END IF;
2871
2872 END IF;
2873 --} -- end if this field is not a system field
2874
2875 /*
2876 * Bug 6050403: We do not need a viewname for the two_part_flag field as the
2877 * checkbox will always remain checked. The rendered attribute will ensure that
2878 * the checkbox does not appear for non-two part rfqs
2879 */
2880 IF (v_form_fields_row.FIELD_CODE <> 'TWO_PART_FLAG') THEN -- {
2881 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'viewName', v_curr_formfieldvaluesvo_name);
2882 END IF;
2883 JDR_DOCBUILDER.addChild (v_section_layout_element,jdr_docbuilder.UI_NS,'contents',v_section_field_element);
2884 ---- need to create a formValue element for this LOV
2885
2886 if(v_vset_element_created = 'Y' and isLovValueSet(v_form_fields_row.field_code) = 'Y') then
2887
2888 v_vset_element_created := 'N';
2889
2890 -- encapsulate the formValue bean inside a messageLayout bean as
2891 -- we cannot have a formValue directly inside a messageComponentLayout
2892
2893 v_message_layout_element := JDR_DOCBUILDER.createElement (JDR_DOCBUILDER.OA_NS, 'messageLayout');
2894 JDR_DOCBUILDER.setAttribute (v_message_layout_element, 'id', v_field_jrad_id || '_MSL');
2895 JDR_DOCBUILDER.addChild (v_section_layout_element,jdr_docbuilder.UI_NS,'contents',v_message_layout_element);
2896
2897 v_section_field_element := create_element ('formValue', v_field_jrad_id || '_FORM',
2898 v_form_fields_row.field_name, 'VARCHAR2', 'none',
2899 v_form_fields_row.mapping_field_value_column);
2900
2901 JDR_DOCBUILDER.setAttribute (v_section_field_element, 'viewName', v_curr_formfieldvaluesvo_name);
2902 JDR_DOCBUILDER.addChild (v_message_layout_element,jdr_docbuilder.UI_NS,'contents',v_section_field_element);
2903
2904 end if;
2905
2906
2907 /*
2908 * Bug 6050403: We do not need a viewname for the two_part_flag field as the
2909 * checkbox will always remain checked. The rendered attribute will ensure that
2910 * the checkbox does not appear for non-two part rfqs
2911 */
2912 IF (v_form_fields_row.FIELD_CODE <> 'TWO_PART_FLAG') THEN -- {
2913 JDR_DOCBUILDER.setAttribute (v_section_field_element_rd, 'viewName', v_curr_formfieldvaluesvo_name);
2914 END IF;
2915 JDR_DOCBUILDER.addChild (v_section_layout_element_rd,jdr_docbuilder.UI_NS,'contents',v_section_field_element_rd);
2916
2917 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'Setting viewname for ' || v_form_fields_row.field_code || ' as ' || v_curr_formfieldvaluesvo_name);
2918
2919 END IF; --}
2920
2921 v_prev_record_type := v_form_fields_row.type;
2922
2923 END LOOP; --}
2924
2925 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'JRAD created, now saving to JDR repository');
2926
2927 rval := JDR_DOCBUILDER.save;
2928
2929 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'Finished saving to JDR repository');
2930
2931 x_result :=fnd_api.g_ret_sts_success;
2932
2933 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'END');
2934
2935 EXCEPTION
2936 WHEN OTHERS THEN
2937 x_result := fnd_api.g_ret_sts_error;
2938 x_error_code := SQLCODE;
2939 x_error_message := SUBSTR(SQLERRM, 1, 100);
2940 PON_FORMS_UTIL_PVT.print_error_log(l_api_name, 'EXCEPTION - x_result=' || x_result || ' x_error_code=' || x_error_code || ' x_error_message=' || x_error_message || ' SQLERRM=' || SQLERRM);
2941
2942 END CREATE_FORM;
2943
2944 /*======================================================================
2945 PROCEDURE: CREATE_ABSTRACT PRIVATE
2946 PARAMETERS:
2947 COMMENT : This procedure generates the following 3 JRAD regions for
2948 a abstract -
2949 ** Buyer entry abstract region
2950 ** Read-only abstract region
2951 ** External supplier table region
2952 This procedure is invoked when the abstract is made active
2953 ======================================================================*/
2954
2955 PROCEDURE CREATE_ABSTRACT(p_form_id IN NUMBER,
2956 x_result OUT NOCOPY VARCHAR2,
2957 x_error_code OUT NOCOPY VARCHAR2,
2958 x_error_message OUT NOCOPY VARCHAR2) IS
2959
2960 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_ABSTRACT';
2961
2962 BEGIN
2963 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'BEGIN-');
2964
2965 create_form(p_form_id, x_result, x_error_code, x_error_message);
2966
2967 create_abstract_table(p_form_id, x_result, x_error_code, x_error_message);
2968
2969 x_result :=fnd_api.g_ret_sts_success;
2970
2971 EXCEPTION
2972 WHEN OTHERS THEN
2973 x_result := fnd_api.g_ret_sts_error;
2974 x_error_code := SQLCODE;
2975 x_error_message := SUBSTR(SQLERRM, 1, 100);
2976 PON_FORMS_UTIL_PVT.print_error_log(l_api_name, 'EXCEPTION - x_result=' || x_result || ' x_error_code=' || x_error_code || ' x_error_message=' || x_error_message || ' SQLERRM=' || SQLERRM);
2977
2978 END;
2979
2980 /*======================================================================
2981 PROCEDURE: CREATE_JRAD PUBLIC
2982 PARAMETERS:
2983 COMMENT : Wrapper public procedure to all internal procedures. This
2984 procedure is called from the middle-tier when a form or
2985 a section or abstract is made active.
2986 ======================================================================*/
2987 PROCEDURE CREATE_JRAD( p_form_id IN NUMBER,
2988 x_result OUT NOCOPY VARCHAR2,
2989 x_error_code OUT NOCOPY VARCHAR2,
2990 x_error_message OUT NOCOPY VARCHAR2
2991 ) IS
2992
2993 v_form_type PON_FORMS_SECTIONS.TYPE%TYPE;
2994 v_is_repeating_section_flag PON_FORMS_SECTIONS.IS_REPEATING_SECTION_FLAG%TYPE;
2995 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_JRAD';
2996
2997 BEGIN
2998 -- initialize to error
2999 x_result := fnd_api.g_ret_sts_error;
3000
3001 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'BEGIN-');
3002
3003 -- the overall logic to generate jrad is as follows -
3004 -- determine whether the type is 'SECTION' or 'ABSTRACT' or 'FORM'
3005
3006 select
3007 type,
3008 nvl(is_repeating_section_flag,'N')
3009 into
3010 v_form_type,
3011 v_is_repeating_section_flag
3012 from pon_forms_sections where form_id = p_form_id;
3013
3014 -- generate the buyer data-entry page
3015 -- generate the buyer view-only page
3016
3017 -- if this is an abstract, generate the supplier external table
3018 -- initialize a few global variables
3019 g_sql_pop_list_count := 1;
3020 g_table_pop_list_count := 1;
3021 g_lov_map_count := 1;
3022 g_pop_list_count := 1;
3023 g_total_image_count := 1;
3024 g_base_language := getBaseLanguage();
3025
3026 if(v_form_type = 'FORM') then
3027 create_form(p_form_id, x_result, x_error_code, x_error_message);
3028 elsif(v_form_type = 'SECTION') then
3029 if (v_is_repeating_section_flag = 'Y') then
3030 create_repeating_section(p_form_id , x_result, x_error_code, x_error_message);
3031 else
3032 create_form(p_form_id, x_result, x_error_code, x_error_message);
3033 end if;
3034 elsif (v_form_type = 'ABSTRACT') then
3035 create_abstract(p_form_id, x_result, x_error_code, x_error_message);
3036 end if;
3037
3038 x_result := fnd_api.g_ret_sts_success;
3039
3040 PON_FORMS_UTIL_PVT.print_debug_log(l_api_name, 'END');
3041
3042 EXCEPTION
3043 WHEN OTHERS THEN
3044 x_result := fnd_api.g_ret_sts_error;
3045 x_error_code := SQLCODE;
3046 x_error_message := SUBSTR(SQLERRM, 1, 100);
3047 PON_FORMS_UTIL_PVT.print_error_log(l_api_name, 'EXCEPTION - x_result=' || x_result || ' x_error_code=' || x_error_code || ' x_error_message=' || x_error_message || ' SQLERRM=' || SQLERRM);
3048
3049 END CREATE_JRAD;
3050
3051
3052 END PON_FORMS_JRAD_PVT;