[Home] [Help]
PACKAGE BODY: APPS.WF_EVENT_HTML
Source
1 package body WF_EVENT_HTML as
2 /* $Header: wfehtmb.pls 120.4 2005/11/08 00:43:44 nravindr ship $ */
3
4 --
5 -- isDeletable
6 -- Find out if a particular entity is deletable or not
7 -- IN
8 -- x_guid - global unique id for that entity
9 -- x_type - type of such entity 'EVENT|GROUP|SYSTEM|AGENT|SUBSCRIP'
10 -- RET
11 -- True if it is ok to delete.
12 -- False otherwise.
13 --
14 function isDeletable (
15 x_guid in raw,
16 x_type in varchar2
17 ) return boolean
18 is
19 member_count pls_integer := 0;
20 begin
21 if (x_type = 'EVENT_S' or x_type = 'EVENT') then
22 -- If the Event is of a Custom Level of Core or Limit you cannot delete it
23 select count(1) into member_count
24 from WF_EVENTS
25 where GUID = x_guid
26 and CUSTOMIZATION_LEVEL in ('C','L');
27
28 -- do not bother to check further if the event is of type Core/Limit
29 if (member_count > 0) then
30 return(FALSE);
31 end if;
32
33 -- if there is any subscription, it has detail and is not deletable.
34 select count(1) into member_count
35 from WF_EVENT_SUBSCRIPTIONS
36 where EVENT_FILTER_GUID = x_guid;
37
38 -- do not bother to check further if there are subscriptions.
39 if (member_count > 0) then
40 return(FALSE);
41 end if;
42
43 elsif (x_type = 'SYSTEM_S' or x_type = 'SYSTEM') then
44 -- SYSTEM_S is for checking subscription only.
45 -- if there is any subscrption, it is not deletable.
46 select count(1) into member_count
47 from WF_EVENT_SUBSCRIPTIONS
48 where SYSTEM_GUID = x_guid;
49
50 -- SYSTEM_S also needs to check the new MASTER requirement
51 -- to see if it is a master of some body else
52 if (member_count = 0) then
53 select count(1) into member_count
54 from WF_SYSTEMS
55 where MASTER_GUID = x_guid;
56 end if;
57
58 if (member_count > 0) then
59 return(FALSE); -- do not bother to check further if there are members.
60 end if;
61
62 elsif (x_type = 'AGENT') then
63 select count(1) into member_count
64 from WF_EVENT_SUBSCRIPTIONS
65 where SOURCE_AGENT_GUID = x_guid
66 or OUT_AGENT_GUID = x_guid
67 or TO_AGENT_GUID = x_guid;
68
69 elsif (x_type = 'SUBSCRIPTION') then
70 -- there is no dependency at this moment
71 -- but later on, we may check the runtime table
72 select count(1) into member_count
73 from WF_EVENT_SUBSCRIPTIONS
74 where GUID = x_guid
75 and CUSTOMIZATION_LEVEL in ('C','L');
76
77 -- do not bother to check further if the event is of type Core/Limit
78 if (member_count > 0) then
79 return(FALSE);
80 end if;
81
82 return TRUE;
83 end if;
84
85 -- also check the following if type is SYSTEM
86 if (x_type = 'SYSTEM') then
87 -- if there is any agent reference, it is not deletable.
88 select count(1) into member_count
89 from WF_AGENTS
90 where SYSTEM_GUID = x_guid;
91 end if;
92
93 -- also check if it is the Local System
94 if (x_type = 'SYSTEM') then
95 -- Compare the GUID against the Local System GUID
96 if x_guid = hextoraw(wf_core.translate('WF_SYSTEM_GUID')) then
97 return false;
98 end if;
99 end if;
100
101 -- Need to also check if the Event is part of an Event Group
102 if (x_type = 'EVENT') then
103 -- if it is part of a event group, it is not deletable
104 select count(1) into member_count
105 from wf_event_groups
106 where member_guid = x_guid;
107 end if;
108
109 if (member_count > 0) then
110 return FALSE;
111 end if;
112
113 return TRUE;
114
115 exception
116 when OTHERS then
117 wf_core.context('WF_EVENT_HTML', 'isDeletable', rawtohex(x_guid), x_type);
118 raise;
119 end isDeletable;
120 --
121 -- isAccessible
122 -- Determines if Screen is accessible
123 -- IN
124 -- x_type: SYSTEM, AGENTS, EVENTS, SUBSCRIPTIONS
125 -- NOTE
126 --
127 procedure isAccessible (
128 x_type in varchar2)
129 is
130 l_count number := 0;
131 begin
132 -- check there is a record in the system table
133 -- that matched the WF_SYSTEM_GUID
134 -- this is always checked
135 select count(*) into l_count
136 from wf_systems
137 where guid = hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
138
139 if l_count = 0 then
140 wf_core.raise('WFE_NO_SYSTEM');
141 end if;
142
143 -- SYSTEM: in case we think of any additional checks
144 if x_type = 'SYSTEM' then
145 null;
146 end if;
147
148 -- AGENTS: check if any exist for Local System
149 if x_type = 'AGENTS' then
150 select count(*) into l_count
151 from wf_agents
152 where system_guid = hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
153 end if;
154
155 -- EVENTS: check if any events
156 if x_type = 'EVENTS' then
157 select count(*) into l_count
158 from wf_events;
159 end if;
160
161 -- SUBSCRIPTIONS: check if any event subscriptions for LOCAL
162 if x_type = 'SUBSCRIPTIONS' then
163 select count(*) into l_count
164 from wf_event_subscriptions
165 where system_guid = hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
166 end if;
167
168 -- If the count is zero, we didn't find what we were looking for
169 if l_count = 0 then
170 wf_core.raise('WFE_NO_SEEDDATA_LOADED');
171 end if;
172
173 exception
174 when OTHERS then
175 wf_core.context('WF_EVENT_HTML', 'isAccessible', x_type);
176 raise;
177 end isAccessible;
178
179 -- ListEvents
180 -- List events
181 -- NOTE
182 --
183 procedure ListEvents (
184 h_display_name in varchar2 default null,
185 h_name in varchar2 default null,
186 h_status in varchar2 default '*',
187 h_type in varchar2 default '*',
188 resetcookie in varchar2 default 'F')
189 is
190 cursor evcurs(xn varchar2, xdn varchar2, xt varchar2, xs varchar2) is
191 select GUID, DISPLAY_NAME, NAME, TYPE, STATUS
192 from WF_EVENTS_VL
193 where (xt = '*' or TYPE = xt)
194 and (xdn is null or lower(DISPLAY_NAME) like '%'||lower(xdn)||'%')
195 and (xn is null or lower(NAME) like '%'||lower(xn)||'%')
196 and (xs = '*' or STATUS = xs)
197 order by NAME;
198
199 hTab wfe_html_util.headerTabType;
200 dTab wfe_html_util.dataTabType;
201 i pls_integer;
202
203 username varchar2(320); -- Username to query
204 admin_role varchar2(320); -- Role for admin mode
205
206 c pls_integer;
207 c2 pls_integer;
208 cookie owa_cookie.cookie;
209 l_name varchar2(240);
210 l_display_name varchar2(80);
211 l_type varchar2(8);
212 l_status varchar2(8);
213
214 begin
215 -- Check session and current user
216 wfa_sec.GetSession(username);
217 username := upper(username);
218 wf_events_pkg.setMode;
219
220 -- Check Admin Priviledge
221 admin_role := wf_core.translate('WF_ADMIN_ROLE');
222 if (admin_role = '*' or
223 Wf_Directory.IsPerformer(username, admin_role)) then
224 -- Have admin privledge, do nothing.
225 null;
226 else
227 wf_core.raise('WF_NOTADMIN');
228 end if;
229
230 -- Check if Accessible
231 wf_event_html.isAccessible('EVENTS');
232
233 l_name := h_name;
234 l_display_name := h_display_name;
235 l_type := h_type;
236 l_status := h_status;
237
238 -- try to get the values from cookie if nothing is set
239 if (resetcookie='F' and l_name is null and l_display_name is null and
240 l_type = '*' and l_status = '*') then
241 cookie := owa_cookie.get('WF_EVENT_COOKIE');
242
243 -- ignore if more than one value was set
244 if (cookie.num_vals = 1) then
245 c := instr(cookie.vals(1), ':');
246 if (c <= 1) then
247 l_name := null;
248 else
249 l_name := substr(cookie.vals(1), 1, c-1);
250 end if;
251 c2:= instr(cookie.vals(1), ':', 1, 2);
252 if (c2-c <= 1) then
253 l_display_name := null;
254 else
255 l_display_name := substr(cookie.vals(1), c+1, c2-c-1);
256 end if;
257 c := c2;
258 c2:= instr(cookie.vals(1), ':', 1, 3);
259 if (c2-c <= 1) then
260 l_type := '*';
261 else
262 l_type := substr(cookie.vals(1), c+1, c2-c-1);
263 end if;
264 l_status := substr(cookie.vals(1), c2+1);
265 if (l_status = '') then
266 l_status := '*';
267 end if;
268 end if;
269
270 -- set cookie
271 else
272 owa_util.mime_header('text/html', FALSE);
273 owa_cookie.send('WF_EVENT_COOKIE',
274 l_name||':'||
275 l_display_name||':'||
276 l_type||':'||
277 l_status);
278 owa_util.http_header_close;
279 end if;
280
281 -- populate the data table
282 i := 0;
283 for event in evcurs(l_name, l_display_name, l_type, l_status) loop
284 i := i+1;
285 dTab(i).guid := event.guid;
286 dTab(i).col01:= event.name;
287 dTab(i).col02:= event.display_name;
288 dTab(i).col03:= wf_core.translate(event.type);
289 dTab(i).col04:= wf_core.translate(event.status);
290
291 dTab(i).selectable := FALSE;
292
293 dTab(i).hasdetail := not Wf_Event_Html.isDeletable(event.guid, 'EVENT_S');
294
295 -- when there is subscription, it is not deletable
296 if (dTab(i).hasdetail) then
297 dTab(i).deletable := FALSE;
298
299 -- otherwise, we need to check further
300 else
301 dTab(i).deletable := Wf_Event_Html.isDeletable(event.guid, 'EVENT');
302 end if;
303
304 end loop;
305
306 -- Render page
307 htp.htmlOpen;
308
309 -- Set page title
310 htp.headOpen;
311
312 -- list does not get updated after editevent, so we add the
313 -- following tag to force the reload of page.
314 htp.p('<META HTTP-EQUIV=expires CONTENT="no-cache">');
315
316 htp.title(wf_core.translate('WFE_LIST_EVENTS_TITLE'));
317 wfa_html.create_help_function('wf/links/def.htm?'||'DEFEVT');
318 fnd_document_management.get_open_dm_display_window;
319
320 Wfe_Html_Util.generate_confirm;
321
322 htp.headClose;
323
324 -- Page header
325 wfa_sec.Header(FALSE,
326 owa_util.get_owa_service_path||'wf_event_html.FindEvent',
327 wf_core.translate('WFE_LIST_EVENTS_TITLE'),
328 TRUE);
329
330 htp.br; -- add some space between header and table
331
332 -- populate the header table
333 i := 1;
334 hTab(i).def_type := 'FUNCTION';
335 hTab(i).value := 'Wf_Event_Html.DeleteEvent?h_guid=';
336 i := i+1;
337 hTab(i).def_type := 'FUNCTION';
338 hTab(i).value := 'Wf_Event_Html.ListSubscriptions?use_guid_only=T&'||
339 'h_event_guid=';
340 i := i+1;
341 hTab(i).def_type := 'FUNCTION';
342 hTab(i).value := 'Wf_Event_Html.EditEvent?h_guid=';
343 i := i+1;
344 hTab(i).def_type := 'TITLE';
345 hTab(i).value := wf_core.translate('SUBSCRIPTIONS');
346 hTab(i).attr := 'id="'||wf_core.translate('SUBSCRIPTIONS')||'"';
347 i := i+1;
348 hTab(i).def_type := 'TITLE';
349 hTab(i).value := wf_core.translate('EDIT');
350 i := i+1;
351 hTab(i).def_type := 'TITLE';
352 hTab(i).value := wf_core.translate('NAME');
353 hTab(i).attr := 'id="'||wf_core.translate('NAME')||'"';
354 i := i+1;
355 hTab(i).def_type := 'TITLE';
356 hTab(i).value := wf_core.translate('DISPLAY_NAME');
357 hTab(i).attr := 'id="'||wf_core.translate('DISPLAY_NAME')||'"';
358 i := i+1;
359 hTab(i).def_type := 'TITLE';
360 hTab(i).value := wf_core.translate('TYPE');
361 hTab(i).attr := 'id="'||wf_core.translate('TYPE')||'"';
362 i := i+1;
363 hTab(i).def_type := 'TITLE';
364 hTab(i).value := wf_core.translate('STATUS');
365 hTab(i).attr := 'id="'||wf_core.translate('STATUS')||'"';
366
367 -- render table
368 Wfe_Html_Util.Simple_Table(hTab, dTab);
369
370 htp.tableopen (calign=>'CENTER ', cattributes=>'summary""');
371 htp.tableRowOpen;
372 htp.p('<TD ID="">');
373 wfa_html.create_reg_button (wfa_html.base_url||'/Wf_Event_Html.EditEvent',
374 wf_core.translate('WFE_ADD_EVENT'),
375 wfa_html.image_loc,
376 null,
377 wf_core.translate('WFE_ADD_EVENT'));
378 htp.p('</TD>');
379 htp.p('<TD ID="">');
380 wfa_html.create_reg_button (wfa_html.base_url||
381 '/Wf_Event_Html.EditEvent?h_type=GROUP',
382 wf_core.translate('WFE_ADD_GROUP'),
383 wfa_html.image_loc,
384 null,
385 wf_core.translate('WFE_ADD_GROUP'));
386 htp.p('</TD>');
387 htp.tableRowClose;
388 htp.tableClose;
389
390 wfa_sec.Footer;
391 htp.htmlClose;
392
393 exception
394 when OTHERS then
395 rollback;
396 wf_core.context('WF_EVENT_HTML', 'ListEvents');
397 wfe_html_util.Error;
398 end ListEvents;
399
400 --
401 -- ListSystems
402 -- List systems
403 -- NOTE
404 --
405 procedure ListSystems (
406 h_display_name in varchar2 default null,
407 h_name in varchar2 default null,
408 display_master in varchar2 default null,
409 h_master_guid in varchar2 default null,
410 resetcookie in varchar2 default 'F'
411 )
412 is
413 cursor syscurs(mguid raw, xn varchar2, xdn varchar2) is
414 select GUID, DISPLAY_NAME, NAME, MASTER_GUID
415 from WF_SYSTEMS
416 where (xdn is null or lower(DISPLAY_NAME) like '%'||lower(xdn)||'%')
417 and (xn is null or lower(NAME) like '%'||lower(xn)||'%')
418 and (mguid is null or MASTER_GUID = mguid)
419 order by NAME;
420
421 hTab wfe_html_util.headerTabType;
422 dTab wfe_html_util.dataTabType;
423 i pls_integer;
424
425 username varchar2(320); -- Username to query
426 admin_role varchar2(320); -- Role for admin mode
427
428 acnt number; -- counter for something
429
430 l_mguid raw(16); -- master guid
431 l_mname varchar2(80); -- master name
432
433 l_message varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate('WFPREF_LOV'));
434 l_url varchar2(1000);
435 l_media varchar2(240) := wfa_html.image_loc;
436 l_icon varchar2(30) := 'FNDILOV.gif';
437 l_localsys raw(16);
438
439 c pls_integer;
440 c2 pls_integer;
441 cookie owa_cookie.cookie;
442 l_name varchar2(30);
443 l_display_name varchar2(80);
444
445 begin
446 -- Check session and current user
447 wfa_sec.GetSession(username);
448 username := upper(username);
449 wf_events_pkg.setMode;
450
451 -- Check Admin Priviledge
452 admin_role := wf_core.translate('WF_ADMIN_ROLE');
453 if (admin_role = '*' or
454 Wf_Directory.IsPerformer(username, admin_role)) then
455 -- Have admin privledge, do nothing.
456 null;
457 else
458 wf_core.raise('WF_NOTADMIN');
459 end if;
460
461 -- Check if Accessible
462 wf_event_html.isAccessible('SYSTEM');
463
464 l_mguid := hextoraw(h_master_guid);
465 Wf_Event_Html.Validate_System_Name(display_master, l_mguid);
466
467 -- find the local system guid
468 begin
469 select hextoraw(TEXT)
470 into l_localsys
471 from WF_RESOURCES
472 where NAME = 'WF_SYSTEM_GUID'
473 and LANGUAGE = userenv('LANG');
474 exception
475 when NO_DATA_FOUND then
476 l_localsys := null;
477 end;
478
479 l_name := h_name;
480 l_display_name := h_display_name;
481
482 -- try to get the values from cookie if nothing is set
483 if (resetcookie='F' and l_mguid is null and l_name is null and
484 l_display_name is null) then
485 cookie := owa_cookie.get('WF_SYSTEM_COOKIE');
486
487 -- ignore if more than one value was set
488 if (cookie.num_vals = 1) then
489 c := instr(cookie.vals(1), ':');
490 if (c <= 1) then
491 l_mguid := hextoraw(null);
492 else
493 l_mguid := hextoraw(substr(cookie.vals(1), 1, c-1));
494 end if;
495 c2:= instr(cookie.vals(1), ':', 1, 2);
496 if (c2-c <= 1) then
497 l_name := null;
498 else
499 l_name := substr(cookie.vals(1), c+1, c2-c-1);
500 end if;
501 l_display_name := substr(cookie.vals(1), c2+1);
502 if (l_display_name = '') then
503 l_display_name := null;
504 end if;
505
506 end if;
507
508 -- set cookie
509 else
510 owa_util.mime_header('text/html', FALSE);
511 owa_cookie.send('WF_SYSTEM_COOKIE',
512 rawtohex(l_mguid)||':'||
513 l_name||':'||
514 l_display_name);
515 owa_util.http_header_close;
516 end if;
517
518 -- populate the data table
519 i := 0;
520 for asystem in syscurs(l_mguid, l_name, l_display_name) loop
521 i := i+1;
522 dTab(i).guid := asystem.guid;
523 dTab(i).col01:= asystem.name;
524
525 -- this is a local system
526 if (l_localsys = dTab(i).guid) then
527 dTab(i).col01 := dTab(i).col01||'*';
528 end if;
529
530 dTab(i).col02:= asystem.display_name;
531
532 -- find out the master display name
533 if (asystem.master_guid is not null) then
534 -- do the following select only if
535 -- l_mguid is null, that is a general query
536 -- or
537 -- l_mname is null, that query is being run the first time
538 --
539 if (l_mguid is null or l_mname is null) then
540 begin
541 select NAME
542 into l_mname
543 from WF_SYSTEMS
544 where GUID = asystem.master_guid;
545 exception
546 when NO_DATA_FOUND then
547 wf_core.token('GUID', rawtohex(asystem.master_guid));
548 l_mname := wf_core.translate('WFE_SYSTEM_NOGUID');
549 end;
550 end if;
551 dTab(i).col03 := l_mname;
552
553 -- put a space there, if no master
554 else
555 dTab(i).col03 := ' ';
556 end if;
557
558 dTab(i).selectable := FALSE;
559
560 select count(1) into acnt
561 from WF_EVENT_SUBSCRIPTIONS
562 where SYSTEM_GUID = asystem.guid;
563
564 if (acnt = 0) then
565 dTab(i).deletable := Wf_Event_Html.isDeletable(asystem.guid, 'SYSTEM');
566 dTab(i).hasdetail := FALSE;
567 else
568 dTab(i).deletable := FALSE; -- has reference from subscriptions
569 dTab(i).hasdetail := TRUE;
570 end if;
571 end loop;
572 -- Render page
573 htp.htmlOpen;
574
575 -- Set page title
576 htp.headOpen;
577
578 -- list does not get updated after editevent, so we add the
579 -- following tag to force the reload of page.
580 htp.p('<META HTTP-EQUIV=expires CONTENT="no-cache">');
581
582 htp.title(wf_core.translate('WFE_LIST_SYSTEMS_TITLE'));
583 wfa_html.create_help_function('wf/links/def.htm?'||'DEFEVSYS');
584 fnd_document_management.get_open_dm_display_window;
585
586 Wfe_Html_Util.generate_confirm;
587
588 htp.headClose;
589
590 -- Page header
591 wfa_sec.Header(FALSE,
592 owa_util.get_owa_service_path||'wf_event_html.FindSystem',
593 wf_core.translate('WFE_LIST_SYSTEMS_TITLE'),
594 TRUE);
595
596 htp.br; -- add some space between header and table
597
598 -- popluate the header table
599 i := 1;
600 hTab(i).def_type := 'FUNCTION';
601 hTab(i).value := 'Wf_Event_Html.DeleteSystem?h_guid=';
602 i := i+1;
603 hTab(i).def_type := 'FUNCTION';
604 hTab(i).value := 'Wf_Event_Html.ListSubscriptions?use_guid_only=T&h_system_guid=';
605 i := i+1;
606 hTab(i).def_type := 'FUNCTION';
607 hTab(i).value := 'Wf_Event_Html.EditSystem?h_guid=';
608 i := i+1;
609 hTab(i).def_type := 'TITLE';
610 hTab(i).value := wf_core.translate('SUBSCRIPTIONS');
611 hTab(i).attr := 'id="'||wf_core.translate('SUBSCRIPTIONS')||'"';
612 i := i+1;
613 hTab(i).def_type := 'TITLE';
614 hTab(i).value := wf_core.translate('EDIT');
615 i := i+1;
616 hTab(i).def_type := 'TITLE';
617 hTab(i).value := wf_core.translate('NAME');
618 hTab(i).attr := 'id="'||wf_core.translate('NAME')||'"';
619 i := i+1;
620 hTab(i).def_type := 'TITLE';
621 hTab(i).value := wf_core.translate('DISPLAY_NAME');
622 hTab(i).attr := 'id="'||wf_core.translate('DISPLAY_NAME')||'"';
623 i := i+1;
624 hTab(i).def_type := 'TITLE';
625 hTab(i).value := wf_core.translate('MASTER');
626 hTab(i).attr := 'id="'||wf_core.translate('MASTER')||'"';
627
628 -- render table
629
630 Wfe_Html_Util.Simple_Table(headerTab=>hTab, dataTab=>dTab,
631 tabattr=>'border=1 cellpadding=3 bgcolor=white width=100% summary="' ||
632 wf_core.translate('WFE_LIST_SYSTEMS_TITLE') || '"');
633
634 -- message to indicate local system
635 htp.tableopen(calign=>'CENTER', cattributes=>'WIDTH=100%
636 summary="' || wf_core.translate('WFE_INDICATE_LOCAL_SYS') || '"');
637 htp.tableRowOpen;
638 htp.p('<TD ID="'|| wf_core.translate('WFE_INDICATE_LOCAL_SYS') || '" align="LEFT">');
639 htp.p('* - '||wf_core.translate('WFE_INDICATE_LOCAL_SYS'));
640 htp.p('</TD>');
641 htp.tableRowClose;
642 htp.tableClose;
643
644 htp.tableopen (calign=>'CENTER', cattributes=>'summary=""');
645 htp.tableRowOpen;
646 htp.p('<TD ID="">');
647 wfa_html.create_reg_button (wfa_html.base_url||'/Wf_Event_Html.EditSystem',
648 wf_core.translate('WFE_ADD_SYSTEM'),
649 wfa_html.image_loc,
650 null,
651 wf_core.translate('WFE_ADD_SYSTEM'));
652 htp.p('</TD>');
653 htp.tableRowClose;
654 htp.tableClose;
655
656 wfa_sec.Footer;
657 htp.htmlClose;
658
659 exception
660 when OTHERS then
661 rollback;
662 wf_core.context('WF_EVENT_HTML', 'ListSystems');
663 wfe_html_util.Error;
664 end ListSystems;
665
666 --
667 -- ListAgents
668 -- List agents
669 -- NOTE
670 --
671 procedure ListAgents (
672 h_name in varchar2 default null,
673 h_protocol in varchar2 default null,
674 h_address in varchar2 default null,
675 display_system in varchar2 default null,
676 h_system_guid in varchar2 default null,
677 h_direction in varchar2 default '*',
678 h_status in varchar2 default '*',
679 use_guid_only in varchar2 default 'F',
680 resetcookie in varchar2 default 'F'
681 )
682 is
683 cursor agcurs(sguid raw, xn varchar2, xp varchar2, xa varchar2,
684 xd varchar2, xs varchar2) is
685 select A.GUID, A.NAME, A.PROTOCOL, A.ADDRESS,
686 S.NAME SYSTEM_NAME,
687 A.DIRECTION, A.STATUS
688 from WF_AGENTS A, WF_SYSTEMS S
689 where (xn is null or lower(A.NAME) like '%'||lower(xn)||'%')
690 and (xp is null or A.PROTOCOL = xp)
691 and (xa is null or A.ADDRESS = xa)
692 and (sguid is null or S.GUID = sguid)
693 and A.SYSTEM_GUID = S.GUID
694 and (xd = '*' or A.DIRECTION = xd)
695 and (xs = '*' or A.STATUS = xs)
696 order by SYSTEM_NAME, A.NAME, A.ADDRESS, A.PROTOCOL;
697
698 hTab wfe_html_util.headerTabType;
699 dTab wfe_html_util.dataTabType;
700 i pls_integer;
701
702 username varchar2(320); -- Username to query
703 admin_role varchar2(320); -- Role for admin mode
704
705 l_sguid raw(16); -- system guid
706 l_sname varchar2(80); -- system name
707 prev_sname varchar2(80); -- previous system name
708
709 c pls_integer;
710 c2 pls_integer;
711 cookie owa_cookie.cookie;
712
713 l_name varchar2(30);
714 l_protocol varchar2(30);
715 l_address varchar2(240);
716 l_direction varchar2(8);
717 l_status varchar2(8);
718
719 begin
720 -- Check session and current user
721 wfa_sec.GetSession(username);
722 username := upper(username);
723 wf_events_pkg.setMode;
724
725 -- Check Admin Priviledge
726 admin_role := wf_core.translate('WF_ADMIN_ROLE');
727 if (admin_role = '*' or
728 Wf_Directory.IsPerformer(username, admin_role)) then
729 -- Have admin privledge, do nothing.
730 null;
731 else
732 wf_core.raise('WF_NOTADMIN');
733 end if;
734
735 -- Check if Accessible
736 wf_event_html.isAccessible('AGENTS');
737
738 l_sguid := hextoraw(h_system_guid);
739 if (use_guid_only = 'F') then
740 Wf_Event_Html.Validate_System_Name(display_system, l_sguid);
741 end if;
742
743 l_name := h_name;
744 l_protocol := h_protocol;
745 l_address := h_address;
746 l_direction:= h_direction;
747 l_status := h_status;
748
749 -- try to get the values from cookie if nothing is set
750 if (resetcookie='F' and l_sguid is null and l_name is null and
751 l_protocol is null and l_direction = '*' and l_status = '*') then
752 cookie := owa_cookie.get('WF_AGENT_COOKIE');
753
754 -- ignore if more than one value was set
755 if (cookie.num_vals = 1) then
756 c := instr(cookie.vals(1), ':');
757 if (c <= 1) then
758 l_sguid := hextoraw(null);
759 else
760 l_sguid := hextoraw(substr(cookie.vals(1), 1, c-1));
761 end if;
762 c2:= instr(cookie.vals(1), ':', 1, 2);
763 if (c2-c <= 1) then
764 l_name := null;
765 else
766 l_name := substr(cookie.vals(1), c+1, c2-c-1);
767 end if;
768 c := c2;
769 c2:= instr(cookie.vals(1), ':', 1, 3);
770 if (c2-c <= 1) then
771 l_protocol := null;
772 else
773 l_protocol := substr(cookie.vals(1), c+1, c2-c-1);
774 end if;
775 c := c2;
776 c2:= instr(cookie.vals(1), ':', 1, 4);
777 if (c2-c <= 1) then
778 l_address := null;
779 else
780 l_address := substr(cookie.vals(1), c+1, c2-c-1);
781 end if;
782 c := c2;
783 c2:= instr(cookie.vals(1), ':', 1, 5);
784 if (c2-c <= 1) then
785 l_direction := '*';
786 else
787 l_direction := substr(cookie.vals(1), c+1, c2-c-1);
788 end if;
789 l_status := substr(cookie.vals(1), c2+1);
790 if (l_status = '') then
791 l_status := '*';
792 end if;
793
794 end if;
795
796 -- set cookie
797 else
798 owa_util.mime_header('text/html', FALSE);
799 owa_cookie.send('WF_AGENT_COOKIE',
800 rawtohex(l_sguid)||':'||
801 l_name||':'||
802 l_protocol||':'||
803 l_address||':'||
804 l_direction||':'||
805 l_status);
806 owa_util.http_header_close;
807 end if;
808
809 -- populate the data table
810 prev_sname := null;
811 i := 0;
812 for agent in agcurs(l_sguid,l_name,l_protocol,l_address,
813 l_direction,l_status) loop
814 if (prev_sname is null or prev_sname <> agent.system_name) then
815
816 -- add a blank row
817 if (prev_sname is not null) then
818 i := i+1;
819 dTab(i).guid := agent.guid;
820
821 dTab(i).level := 1;
822 dTab(i).trattr := 'VALIGN=TOP bgcolor=#CCCCCC';
823 dTab(i).col01 := ' ';
824 end if;
825
826 i := i+1;
827 dTab(i).guid := agent.guid;
828
829 dTab(i).level := 1;
830 dTab(i).trattr := 'VALIGN=TOP bgcolor=#CCCCCC';
831 dTab(i).col01 := '<B>'||wf_core.translate('SYSTEM')||': '||
832 agent.system_name||'</B>';
833 dTab(i).tdattr := 'id="' || WF_CORE.Translate('SYSTEM') || '"';
834
835 prev_sname := agent.system_name;
836
837 -- print title here
838 i := i+1;
839 dTab(i).guid := agent.guid;
840 dTab(i).level:= 0;
841 dTab(i).showtitle := TRUE;
842
843 end if;
844
845 i := i+1;
846 dTab(i).guid := agent.guid;
847
848 dTab(i).level := 0;
849 dTab(i).trattr := 'VALIGN=TOP bgcolor=white';
850
851 dTab(i).col01:= agent.name;
852
853 if (agent.address is null) then
854 dTab(i).col02:= ' ';
855 else
856 dTab(i).col02:= agent.address;
857 end if;
858 dTab(i).col03:= agent.protocol;
859 dTab(i).col04:= wf_core.translate(agent.direction);
860 dTab(i).col05:= wf_core.translate(agent.status);
861
862 dTab(i).selectable := FALSE;
863
864 dTab(i).deletable := Wf_Event_Html.isDeletable(agent.guid, 'AGENT');
865
866 dTab(i).hasdetail := FALSE;
867
868 end loop;
869
870 -- Render page
871 htp.htmlOpen;
872
873 -- Set page title
874 htp.headOpen;
875
876 -- list does not get updated after editevent, so we add the
877 -- following tag to force the reload of page.
878 htp.p('<META HTTP-EQUIV=expires CONTENT="no-cache">');
879
880 htp.title(wf_core.translate('WFE_LIST_AGENTS_TITLE'));
881 wfa_html.create_help_function('wf/links/def.htm?'||'DEFEVAGT');
882 fnd_document_management.get_open_dm_display_window;
883
884 Wfe_Html_Util.generate_confirm;
885
886 htp.headClose;
887
888 -- Page header
889 wfa_sec.Header(FALSE,
890 owa_util.get_owa_service_path||'wf_event_html.FindAgent',
891 wf_core.translate('WFE_LIST_AGENTS_TITLE'),
892 TRUE);
893
894 htp.br; -- add some space between header and table
895
896 -- popluate the header table
897 i := 1;
898 hTab(i).def_type := 'FUNCTION';
899 hTab(i).value := 'Wf_Event_Html.DeleteAgent?h_guid=';
900 i := i+1;
901 hTab(i).def_type := 'FUNCTION';
902 hTab(i).value := null; -- never has detail page
903 i := i+1;
904 hTab(i).def_type := 'FUNCTION';
905 hTab(i).value := 'Wf_Event_Html.EditAgent?h_guid=';
906 i := i+1;
907 hTab(i).def_type := 'TITLE';
908 hTab(i).value := null; -- no detail title
909 hTab(i).level := 0;
910 i := i+1;
911 hTab(i).def_type := 'TITLE';
912 hTab(i).value := wf_core.translate('EDIT');
913 hTab(i).level := 0;
914 i := i+1;
915 hTab(i).def_type := 'TITLE';
916 hTab(i).value := wf_core.translate('SYSTEM');
917 hTab(i).level := 1;
918 hTab(i).span := 5;
919 hTab(i).trattr := 'bgcolor=#006699';
920 hTab(i).attr := 'bgcolor=#CCCCCC';
921 i := i+1;
922 hTab(i).def_type := 'TITLE';
923 hTab(i).value := wf_core.translate('NAME');
924 hTab(i).level := 0;
925 hTab(i).attr := 'id="'||wf_core.translate('NAME')||'"';
926 i := i+1;
927 hTab(i).def_type := 'TITLE';
928 hTab(i).value := wf_core.translate('ADDRESS');
929 hTab(i).level := 0;
930 hTab(i).attr := 'id="'||wf_core.translate('ADDRESS')||'"';
931 i := i+1;
932 hTab(i).def_type := 'TITLE';
933 hTab(i).value := wf_core.translate('PROTOCOL');
934 hTab(i).level := 0;
935 hTab(i).attr := 'id="'||wf_core.translate('PROTOCOL')||'"';
936 i := i+1;
937 hTab(i).def_type := 'TITLE';
938 hTab(i).value := wf_core.translate('DIRECTION');
939 hTab(i).level := 0;
940 hTab(i).attr := 'id="'||wf_core.translate('DIRECTION')||'"';
941 i := i+1;
942 hTab(i).def_type := 'TITLE';
943 hTab(i).value := wf_core.translate('STATUS');
944 hTab(i).level := 0;
945 hTab(i).attr := 'id="'||wf_core.translate('STATUS')||'"';
946
947 -- render table
948 -- for an empty table, show only the level 0 title
949 if (dTab.COUNT = 0) then
950 Wfe_Html_Util.Simple_Table(headerTab=>hTab, dataTab=>dTab,
951 tabattr=>'border=0 cellpadding=3 cellspacing=2 bgcolor=#CCCCCC
952 width=100%
953 summary="' || wf_core.translate('WFE_LIST_AGENTS_TITLE') || '"',
954 show_1st_title=>TRUE, show_level=>0);
955
956 -- show the full table
957 else
958 Wfe_Html_Util.Simple_Table(headerTab=>hTab, dataTab=>dTab,
959 tabattr=>'border=0 cellpadding=3 cellspacing=2 bgcolor=#CCCCCC
960 width=100%
961 summary="' || wf_core.translate('WFE_LIST_AGENTS_TITLE') || '"',
962 show_1st_title=>FALSE);
963 end if;
964
965 htp.tableopen (calign=>'CENTER', cattributes=>'summary=""');
966 htp.tableRowOpen;
967 htp.p('<TD ID="">');
968 wfa_html.create_reg_button (wfa_html.base_url||'/Wf_Event_Html.EditAgent',
969 wf_core.translate('WFE_ADD_AGENT'),
970 wfa_html.image_loc,
971 null,
972 wf_core.translate('WFE_ADD_AGENT'));
973 htp.p('</TD>');
974 htp.tableRowClose;
975 htp.tableClose;
976
977 wfa_sec.Footer;
978 htp.htmlClose;
979
980 exception
981 when OTHERS then
982 rollback;
983 wf_core.context('WF_EVENT_HTML', 'ListAgents');
984 wfe_html_util.Error;
985 end ListAgents;
986
987 --
988 -- ListSubscriptions
989 -- List subscriptions
990 -- NOTE
991 --
992 procedure ListSubscriptions (
993 display_event in varchar2 default null,
994 h_event_guid in varchar2 default null,
995 h_source_type in varchar2 default '*',
996 display_system in varchar2 default null,
997 h_system_guid in varchar2 default null,
998 h_status in varchar2 default '*',
999 use_guid_only in varchar2 default 'F',
1000 resetcookie in varchar2 default 'F'
1001 )
1002 is
1003 cursor sscurs(eguid raw, sguid raw, xt varchar2, xs varchar2) is
1004 select ES.GUID,
1005 ES.SYSTEM_GUID, ES.SOURCE_TYPE, ES.EVENT_FILTER_GUID,
1006 ES.STATUS,
1007 ES.OUT_AGENT_GUID, ES.TO_AGENT_GUID,
1008 ES.RULE_FUNCTION, ES.WF_PROCESS_TYPE, ES.WF_PROCESS_NAME,
1009 SY.NAME SYSTEM_NAME, E.NAME EVENT_NAME
1010 from WF_EVENT_SUBSCRIPTIONS ES, WF_EVENTS E, WF_SYSTEMS SY
1011 where (eguid is null or ES.EVENT_FILTER_GUID = eguid)
1012 and (xt = '*' or ES.SOURCE_TYPE = xt)
1013 and (sguid is null or ES.SYSTEM_GUID = sguid)
1014 and (xs = '*' or ES.STATUS = xs)
1015 and E.GUID (+)= ES.EVENT_FILTER_GUID
1016 and SY.GUID (+)= ES.SYSTEM_GUID
1017 order by SYSTEM_NAME, EVENT_NAME, ES.PHASE;
1018
1019 hTab wfe_html_util.headerTabType;
1020 dTab wfe_html_util.dataTabType;
1021 cTab wfe_html_util.tmpTabType; -- temporary column table
1022
1023 i pls_integer;
1024 j pls_integer;
1025
1026 username varchar2(320); -- Username to query
1027 admin_role varchar2(320); -- Role for admin mode
1028
1029 l_eguid raw(16); -- event guid
1030 l_ename varchar2(240); -- event name
1031 l_sguid raw(16); -- system guid
1032 l_sname varchar2(80); -- system name
1033
1034 l_name varchar2(240); -- internal name for event/system
1035
1036 from_system boolean := FALSE;
1037 from_event boolean := FALSE;
1038
1039 l_url varchar2(3200);
1040
1041 prev_sguid raw(16); -- previous system guid
1042 prev_eguid raw(16); -- previous event guid
1043
1044 c pls_integer;
1045 c2 pls_integer;
1046 cookie owa_cookie.cookie;
1047 l_source_type varchar2(8);
1048 l_status varchar2(8);
1049
1050 begin
1051 -- Check session and current user
1052 wfa_sec.GetSession(username);
1053 username := upper(username);
1054 wf_events_pkg.setMode;
1055
1056 -- Check Admin Priviledge
1057 admin_role := wf_core.translate('WF_ADMIN_ROLE');
1058 if (admin_role = '*' or
1059 Wf_Directory.IsPerformer(username, admin_role)) then
1060 -- Have admin privledge, do nothing.
1061 null;
1062 else
1063 wf_core.raise('WF_NOTADMIN');
1064 end if;
1065
1066 -- Check if Accessible
1067 wf_event_html.isAccessible('SUBSCRIPTIONS');
1068
1069 l_eguid := hextoraw(h_event_guid);
1070 l_sguid := hextoraw(h_system_guid);
1071 if (use_guid_only = 'F') then
1072 Wf_Event_Html.Validate_Event_Name(display_event, l_eguid);
1073 Wf_Event_Html.Validate_System_Name(display_system, l_sguid);
1074 end if;
1075
1076 l_source_type := h_source_type;
1077 l_status := h_status;
1078
1079 -- try to get the values from cookie if nothing is set
1080 if (resetcookie='F' and l_eguid is null and l_sguid is null and
1081 l_source_type = '*' and l_status = '*') then
1082 cookie := owa_cookie.get('WF_SUBSCRIPTION_COOKIE');
1083
1084 -- ignore if more than one value was set
1085 if (cookie.num_vals = 1) then
1086 c := instr(cookie.vals(1), ':');
1087 if (c <= 1) then
1088 l_eguid := hextoraw(null);
1089 else
1090 l_eguid := hextoraw(substr(cookie.vals(1), 1, c-1));
1091 end if;
1092 c2:= instr(cookie.vals(1), ':', 1, 2);
1093 if (c2-c <= 1) then
1094 l_sguid := hextoraw(null);
1095 else
1096 l_sguid := hextoraw(substr(cookie.vals(1), c+1, c2-c-1));
1097 end if;
1098 c := c2;
1099 c2:= instr(cookie.vals(1), ':', 1, 3);
1100 if (c2-c <= 1) then
1101 l_source_type := '*';
1102 else
1103 l_source_type := substr(cookie.vals(1), c+1, c2-c-1);
1104 end if;
1105 l_status := substr(cookie.vals(1), c2+1);
1106 if (l_status = '') then
1107 l_status := '*';
1108 end if;
1109
1110 end if;
1111
1112 -- set cookie to event and system guid
1113 else
1114 owa_util.mime_header('text/html', FALSE);
1115 owa_cookie.send('WF_SUBSCRIPTION_COOKIE',
1116 rawtohex(l_eguid)||':'||
1117 rawtohex(l_sguid)||':'||
1118 l_source_type||':'||
1119 l_status);
1120 owa_util.http_header_close;
1121 end if;
1122
1123 -- determine if this is from system or from event
1124 if (l_sguid is not null) then
1125 -- from system
1126 begin
1127 select NAME
1128 into l_name
1129 from WF_SYSTEMS
1130 where GUID = l_sguid;
1131 exception
1132 when OTHERS then
1133 l_name := null;
1134 end;
1135
1136 from_system := TRUE;
1137
1138 end if;
1139 if (l_eguid is not null) then
1140 -- from event
1141 begin
1142 select NAME
1143 into l_name
1144 from WF_EVENTS
1145 where GUID = l_eguid;
1146 exception
1147 when OTHERS then
1148 l_name := null;
1149 end;
1150
1151 from_event := TRUE;
1152 end if;
1153
1154 -- populate the data table
1155 prev_sguid := null;
1156 prev_eguid := null;
1157 i := 0;
1158 for ssr in sscurs(l_eguid, l_sguid, l_source_type, l_status) loop
1159 if (prev_sguid is null or prev_sguid <> ssr.system_guid) then
1160
1161 -- add a blank row
1162 if (prev_sguid is not null and prev_eguid is not null) then
1163 i := i+1;
1164 dTab(i).guid := ssr.guid;
1165
1166 dTab(i).level := 2;
1167 dTab(i).trattr := 'VALIGN=TOP bgcolor=#CCCCCC';
1168 dTab(i).col01 := ' ';
1169 end if;
1170
1171 -- System Name (level 2)
1172 i := i+1;
1173 dTab(i).guid := ssr.guid;
1174
1175 dTab(i).level := 2;
1176 dTab(i).trattr := 'VALIGN=TOP bgcolor=#CCCCCC';
1177 -- put a space there if no system is defined
1178 if (ssr.system_guid is null) then
1179 dTab(i).col01 := '<B>'||wf_core.translate('SYSTEM')||':  </B>';
1180
1181 -- find the system name
1182 else
1183 if (ssr.system_name is null) then
1184 wf_core.token('GUID', rawtohex(ssr.system_guid));
1185 dTab(i).col01 := wf_core.translate('WFE_SYSTEM_NOGUID');
1186 else
1187 dTab(i).col01 := '<B>'||wf_core.translate('SYSTEM')||':'||
1188 ssr.system_name||'</B>';
1189 end if;
1190
1191 prev_sguid := ssr.system_guid;
1192 end if;
1193
1194 prev_eguid := null; -- reset this with a new system
1195
1196 end if;
1197
1198 if (prev_eguid is null or prev_eguid <> ssr.event_filter_guid) then
1199
1200 -- add a blank row
1201 if (prev_eguid is not null) then
1202 i := i+1;
1203 dTab(i).guid := ssr.guid;
1204
1205 dTab(i).level := 1;
1206 dTab(i).trattr := 'VALIGN=TOP bgcolor=#CCCCCC';
1207 dTab(i).col01 := ''; -- indentation
1208 dTab(i).col02 := ' ';
1209 end if;
1210
1211 -- Event Name (level 1)
1212 i := i+1;
1213 dTab(i).guid := ssr.guid;
1214
1215 dTab(i).level := 1;
1216
1217 -- indentation
1218 dTab(i).col01 := '';
1219
1220 -- put a space there if no event filter is defined
1221 if (ssr.event_filter_guid is null) then
1222 dTab(i).col02 := '<B>'||wf_core.translate('EVENT')||':  </B>';
1223
1224 -- find the event name
1225 else
1226 if (ssr.event_name is null) then
1227 wf_core.token('GUID', rawtohex(ssr.event_filter_guid));
1228 dTab(i).col02 := wf_core.translate('WFE_EVENT_NOGUID');
1229 else
1230 dTab(i).col02 := '<B>'||wf_core.translate('EVENT')||': '||
1231 ssr.event_name||'</B>';
1232 end if;
1233
1234 prev_eguid := ssr.event_filter_guid;
1235 end if;
1236
1237 -- print title here
1238 i := i+1;
1239 dTab(i).guid := ssr.guid;
1240 dTab(i).level:= 0;
1241 dTab(i).showtitle := TRUE;
1242
1243 end if;
1244
1245 i := i+1;
1246 dTab(i).guid := ssr.guid;
1247 dTab(i).level := 0;
1248 dTab(i).trattr := 'VALIGN=TOP bgcolor=white';
1249
1250 -- indentation
1251 dTab(i).col01 := '';
1252
1253 -- source type
1254 if (ssr.source_type is null) then
1255 dTab(i).col02 := ' ';
1256 else
1257 dTab(i).col02 := wf_core.translate(ssr.source_type);
1258 end if;
1259
1260 -- put a space there if no "out agent" is defined
1261 if (ssr.out_agent_guid is null) then
1262 dTab(i).col03 := ' ';
1263
1264 -- find the agent name
1265 else
1266 -- find the system name
1267 begin
1268 select S.NAME
1269 into dTab(i).col03
1270 from WF_AGENTS A, WF_SYSTEMS S
1271 where A.GUID = ssr.out_agent_guid
1272 and A.SYSTEM_GUID = S.GUID;
1273 exception
1274 when OTHERS then
1275 dTab(i).col03 := null;
1276 end;
1277
1278 begin
1279 if (dTab(i).col03 is null) then
1280 select NAME
1281 into dTab(i).col03
1282 from WF_AGENTS
1283 where GUID = ssr.out_agent_guid;
1284 else
1285 select A.NAME||'@'||dTab(i).col03
1286 into dTab(i).col03
1287 from WF_AGENTS A
1288 where A.GUID = ssr.out_agent_guid;
1289
1290 end if;
1291
1292 exception
1293 when NO_DATA_FOUND then
1294 wf_core.token('GUID', rawtohex(ssr.out_agent_guid));
1295 dTab(i).col03 := wf_core.translate('WFE_AGENT_NOGUID');
1296 end;
1297 end if;
1298
1299 -- put a space there if no "to agent" is defined
1300 if (ssr.to_agent_guid is null) then
1301 dTab(i).col04 := ' ';
1302
1303 -- find the agent name
1304 else
1305 -- find the system name
1306 begin
1307 select S.NAME
1308 into dTab(i).col04
1309 from WF_AGENTS A, WF_SYSTEMS S
1310 where A.GUID = ssr.to_agent_guid
1311 and A.SYSTEM_GUID = S.GUID;
1312 exception
1313 when OTHERS then
1314 dTab(i).col04 := null;
1315 end;
1316
1317 begin
1318 if (dTab(i).col04 is null) then
1319 select A.NAME
1320 into dTab(i).col04
1321 from WF_AGENTS A
1322 where A.GUID = ssr.to_agent_guid;
1323 else
1324 select A.NAME||'@'||dTab(i).col04
1325 into dTab(i).col04
1326 from WF_AGENTS A
1327 where A.GUID = ssr.to_agent_guid;
1328 end if;
1329
1330 exception
1331 when NO_DATA_FOUND then
1332 wf_core.token('GUID', rawtohex(ssr.to_agent_guid));
1333 dTab(i).col04 := wf_core.translate('WFE_AGENT_NOGUID');
1334 end;
1335 end if;
1336
1337 -- function
1338 if (ssr.rule_function is not null) then
1339 dTab(i).col05 := ssr.rule_function;
1340 else
1341 dTab(i).col05 := ' ';
1342 end if;
1343
1344 -- Workflow process
1345 if (ssr.wf_process_type is null and ssr.wf_process_name is null) then
1346 dTab(i).col06 := ' ';
1347 else
1348 dTab(i).col06 := ssr.wf_process_type||'/'||ssr.wf_process_name;
1349 end if;
1350
1351 dTab(i).col07 := wf_core.translate(ssr.status);
1352
1353 dTab(i).selectable := FALSE;
1354 -- dTab(i).deletable := TRUE;
1355 dTab(i).deletable := Wf_Event_Html.isDeletable(ssr.guid, 'SUBSCRIPTION');
1356 dTab(i).hasdetail := FALSE;
1357
1358 end loop;
1359
1360 -- Render page
1361 htp.htmlOpen;
1362
1363 -- Set page title
1364 htp.headOpen;
1365
1366 -- list does not get updated after editevent, so we add the
1367 -- following tag to force the reload of page.
1368 htp.p('<META HTTP-EQUIV=expires CONTENT="no-cache">');
1369
1370 htp.title(wf_core.translate('WFE_LIST_SUBSC_TITLE'));
1371 wfa_html.create_help_function('wf/links/def.htm?'||'DEFEVSUB');
1372 fnd_document_management.get_open_dm_display_window;
1373
1374 Wfe_Html_Util.generate_confirm;
1375
1376 htp.headClose;
1377
1378 -- Page header
1379 wfa_sec.Header(FALSE,
1380 owa_util.get_owa_service_path||'wf_event_html.FindSubscription',
1381 wf_core.translate('WFE_LIST_SUBSC_TITLE'),
1382 TRUE);
1383
1384 htp.br; -- add some space between header and table
1385
1386 -- popluate the header table
1387 i := 1;
1388 hTab(i).def_type := 'FUNCTION';
1389 hTab(i).value := 'Wf_Event_Html.DeleteSubscription?h_guid=';
1390 i := i+1;
1391 hTab(i).def_type := 'FUNCTION';
1392 hTab(i).value := null; -- never has detail page
1393 i := i+1;
1394 hTab(i).def_type := 'FUNCTION';
1395 hTab(i).value := 'Wf_Event_Html.EditSubscription?h_guid=';
1396 i := i+1;
1397 hTab(i).def_type := 'TITLE';
1398 hTab(i).value := null; -- no detail title
1399 hTab(i).level := 0;
1400 i := i+1;
1401 hTab(i).def_type := 'TITLE';
1402 hTab(i).value := wf_core.translate('EDIT');
1403 hTab(i).level := 0;
1404 -- if (not from_system) then
1405 i := i+1;
1406 hTab(i).def_type := 'TITLE';
1407 hTab(i).value := wf_core.translate('SYSTEM');
1408 hTab(i).level := 2;
1409 hTab(i).span := 7;
1410 hTab(i).trattr := 'bgcolor=#006699';
1411 hTab(i).attr := 'bgcolor=#CCCCCC';
1412 -- end if;
1413 -- if (not from_event) then
1414 i := i+1;
1415 hTab(i).def_type := 'TITLE';
1416 hTab(i).value := null; -- indentation
1417 hTab(i).level := 1;
1418 hTab(i).span := 1;
1419 hTab(i).trattr := 'bgcolor=#006699';
1420 hTab(i).attr := 'bgcolor=#CCCCCC';
1421 i := i+1;
1422 hTab(i).def_type := 'TITLE';
1423 hTab(i).value := wf_core.translate('EVENT');
1424 hTab(i).level := 1;
1425 hTab(i).span := 6;
1426 hTab(i).attr := 'id="'||wf_core.translate('EVENT')||'"';
1427 -- end if;
1428 i := i+1;
1429 hTab(i).def_type := 'TITLE';
1430 hTab(i).value := null; -- indentation
1431 hTab(i).level := 0;
1432 hTab(i).trattr := 'bgcolor=#006699';
1433 hTab(i).attr := 'bgcolor=#CCCCCC';
1434 i := i+1;
1435 hTab(i).def_type := 'TITLE';
1436 hTab(i).value := wf_core.translate('SOURCE_TYPE');
1437 hTab(i).level := 0;
1438 hTab(i).attr := 'id="'||wf_core.translate('SOURCE_TYPE')||'"';
1439 i := i+1;
1440 hTab(i).def_type := 'TITLE';
1441 hTab(i).value := wf_core.translate('OUT_AGENT');
1442 hTab(i).level := 0;
1443 hTab(i).attr := 'id="'||wf_core.translate('OUT_AGENT')||'"';
1444 i := i+1;
1445 hTab(i).def_type := 'TITLE';
1446 hTab(i).value := wf_core.translate('TO_AGENT');
1447 hTab(i).level := 0;
1448 hTab(i).attr := 'id="'||wf_core.translate('TO_AGENT')||'"';
1449 i := i+1;
1450 hTab(i).def_type := 'TITLE';
1451 hTab(i).value := wf_core.translate('FUNCTION');
1452 hTab(i).level := 0;
1453 hTab(i).attr := 'id="'||wf_core.translate('FUNCTION')||'"';
1454 i := i+1;
1455 hTab(i).def_type := 'TITLE';
1456 hTab(i).value := wf_core.translate('WORKFLOW');
1457 hTab(i).level := 0;
1458 hTab(i).attr := 'id="'||wf_core.translate('WORKFLOW')||'"';
1459 i := i+1;
1460 hTab(i).def_type := 'TITLE';
1461 hTab(i).value := wf_core.translate('STATUS');
1462 hTab(i).level := 0;
1463 hTab(i).attr := 'id="'||wf_core.translate('STATUS')||'"';
1464
1465 -- render table
1466 if (dTab.COUNT = 0) then
1467 Wfe_Html_Util.Simple_Table(headerTab=>hTab, dataTab=>dTab,
1468 tabattr=>'border=0 cellpadding=3 cellspacing=2 bgcolor=#CCCCCC
1469 width=100% summary="' ||
1470 wf_core.translate('WFE_LIST_SUBSC_TITLE') || '"',
1471 show_1st_title=>TRUE, show_level=>0);
1472
1473 -- show the full table
1474 else
1475 Wfe_Html_Util.Simple_Table(headerTab=>hTab, dataTab=>dTab,
1476 tabattr=>'border=0 cellpadding=3 cellspacing=2 bgcolor=#CCCCCC
1477 width=100% summary="' ||
1478 wf_core.translate('WFE_LIST_SUBSC_TITLE') || '"',
1479 show_1st_title=>FALSE);
1480 end if;
1481
1482 htp.tableopen (calign=>'CENTER', cattributes=>'summary=""');
1483 htp.tableRowOpen;
1484 htp.p('<TD ID="'|| wf_core.translate('WFE_ADD_SUBSCRIPTION') ||'">');
1485
1486 -- construct the url for add subscription
1487 l_url := wfa_html.base_url||'/Wf_Event_Html.EditSubscription';
1488 if (from_system) then
1489 l_url := l_url||'?h_sguid='||rawtohex(l_sguid);
1490 if (from_event) then
1491 l_url := l_url||'&h_eguid='||rawtohex(l_eguid); -- both system & event
1492 end if;
1493 elsif (from_event) then
1494 l_url := l_url||'?h_eguid='||rawtohex(l_eguid);
1495 end if;
1496
1497 wfa_html.create_reg_button (l_url,
1498 wf_core.translate('WFE_ADD_SUBSCRIPTION'),
1499 wfa_html.image_loc,
1500 null,
1501 wf_core.translate('WFE_ADD_SUBSCRIPTION'));
1502 htp.p('</TD>');
1503 htp.tableRowClose;
1504 htp.tableClose;
1505
1506 wfa_sec.Footer;
1507 htp.htmlClose;
1508
1509 exception
1510 when OTHERS then
1511 rollback;
1512 wf_core.context('WF_EVENT_HTML', 'ListSubscriptions');
1513 wfe_html_util.Error;
1514 end ListSubscriptions;
1515
1516 --
1517 -- EditEvent
1518 -- Create/Update an event
1519 -- IN
1520 -- h_guid - Global unique id for an event
1521 -- NOTE
1522 --
1523 procedure EditEvent(
1524 h_guid in raw default null,
1525 h_type in varchar2 default 'EVENT'
1526 )
1527 is
1528 username varchar2(320); -- Username to query
1529 admin_role varchar2(320); -- Role for admin mode
1530 template varchar2(4000); -- Use for construct form select list
1531
1532 l_name varchar2(240);
1533 l_type varchar2(8);
1534 l_status varchar2(8);
1535 l_gfunc varchar2(240);
1536 l_ownname varchar2(30);
1537 l_owntag varchar2(30);
1538 l_dname varchar2(80);
1539 l_desc varchar2(2000);
1540 l_customization_level varchar2(1);
1541
1542 select_enable varchar2(8);
1543 select_disable varchar2(8);
1544 select_event varchar2(8) := 'SELECTED';
1545 select_group varchar2(8);
1546 select_custom_core varchar2(8);
1547 select_custom_limit varchar2(8);
1548 select_custom_extend varchar2(8);
1549 select_custom_user varchar2(8);
1550
1551 eventcount pls_integer;
1552 edittype boolean := TRUE;
1553
1554 -- deletable event cursor
1555 -- all events belong to the group
1556 cursor devcurs is
1557 select E.GUID, E.DISPLAY_NAME, E.NAME, E.STATUS
1558 from WF_EVENTS_VL E, WF_EVENT_GROUPS EG
1559 where EG.GROUP_GUID = h_guid
1560 and E.GUID = EG.MEMBER_GUID;
1561
1562
1563 hTab wfe_html_util.headerTabType;
1564 dTab wfe_html_util.dataTabType;
1565 i pls_integer;
1566
1567 aligntext varchar2(240);
1568
1569 begin
1570 -- Check session and current user
1571 wfa_sec.GetSession(username);
1572 username := upper(username);
1573 wf_events_pkg.setMode;
1574
1575 -- Check Admin Priviledge
1576 admin_role := wf_core.translate('WF_ADMIN_ROLE');
1577 if (admin_role = '*' or
1578 Wf_Directory.IsPerformer(username, admin_role)) then
1579 -- Have admin privledge, do nothing.
1580 null;
1581 else
1582 wf_core.raise('WF_NOTADMIN');
1583 end if;
1584
1585 -- Check if Accessible
1586 wf_event_html.isAccessible('EVENTS');
1587
1588
1589 -- populate the appropriate values in the form if editing an exist guid
1590 if (h_guid is not null) then
1591 begin
1592 select NAME, DISPLAY_NAME, DESCRIPTION, TYPE, STATUS,
1593 GENERATE_FUNCTION, OWNER_NAME, OWNER_TAG, NVL(CUSTOMIZATION_LEVEL, 'L')
1594 into l_name, l_dname, l_desc, l_type, l_status,
1595 l_gfunc, l_ownname, l_owntag, l_customization_level
1596 from WF_EVENTS_VL
1597 where GUID = h_guid;
1598
1599 -- take care of the double quote problem
1600 -- There should be no any kind of quote for name and generate_function.
1601 -- Description is handle entirely differently, no need for substitution.
1602 -- Single quote is ok becuase html does not treat it special.
1603 l_dname := replace(l_dname, '"', '\"');
1604 l_ownname := replace(l_ownname, '"', '\"');
1605 l_owntag := replace(l_owntag, '"', '\"');
1606
1607 if (l_status = 'ENABLED') then
1608 select_enable := 'SELECTED';
1609 select_disable := null;
1610 else
1611 select_enable := null;
1612 select_disable := 'SELECTED';
1613 end if;
1614
1615 -- Stuff for Customization Level
1616 if l_customization_level = 'C' then
1617 select_custom_core := 'SELECTED';
1618 select_custom_limit := null;
1619 select_custom_extend := null;
1620 select_custom_user := null;
1621 elsif l_customization_level = 'L' then
1622 select_custom_core := null;
1623 select_custom_limit := 'SELECTED';
1624 select_custom_extend := null;
1625 select_custom_user := null;
1626 elsif l_customization_level = 'U' then
1627 select_custom_core := null;
1628 select_custom_limit := null;
1629 select_custom_extend := null;
1630 select_custom_user := 'SELECTED';
1631 end if;
1632
1633 if (l_type = 'GROUP') then
1634 select_group := 'SELECTED';
1635 select_event := null;
1636
1637 -- check if we can change a group type to an event type
1638 -- allow this only when a group does not has any child event.
1639 select count(1) into eventcount
1640 from WF_EVENT_GROUPS
1641 where GROUP_GUID = h_guid;
1642
1643 if (eventcount > 0) then
1644 edittype := FALSE;
1645 end if;
1646 end if;
1647
1648 exception
1649 when NO_DATA_FOUND then
1650 wf_core.raise('WFE_EVENT_NOTEXIST');
1651 end;
1652
1653 else
1654 if (h_type <> 'EVENT') then
1655 l_type := 'GROUP';
1656 else
1657 l_type := 'EVENT';
1658 end if;
1659 l_customization_level := 'U';
1660 end if;
1661
1662 -- Set page title
1663 htp.htmlOpen;
1664 htp.headOpen;
1665
1666 -- list does not get updated after editevent, so we add the
1667 -- following tag to force the reload of page.
1668 htp.p('<META HTTP-EQUIV=expires CONTENT="no-cache">');
1669
1670 htp.title(wf_core.translate('WFE_EDIT_'||l_type||'_TITLE'));
1671 if (l_type <> 'EVENT') then
1672 wfa_html.create_help_function('wf/links/t_d.htm?T_DEFEVGPM');
1673 else
1674 wfa_html.create_help_function('wf/links/t_d.htm?T_DEFEVT');
1675 end if;
1676
1677 fnd_document_management.get_open_dm_display_window;
1678
1679 Wfe_Html_Util.generate_check_all;
1680
1681 htp.headClose;
1682
1683 -- Page header
1684 wfa_sec.Header(FALSE,
1685 owa_util.get_owa_service_path||'wf_event_html.FindEvent',
1686 wf_core.translate('WFE_EDIT_'||l_type||'_TITLE'),
1687 TRUE);
1688
1689 -- Form
1690 htp.formOpen(curl=>owa_util.get_owa_service_path||
1691 'wf_event_html.SubmitEvent',
1692 cmethod=>'Get',
1693 cattributes=>'TARGET="_top" NAME="WF_EVENT_EDIT"');
1694
1695 -- GUID
1696 -- do not display it if it is null
1697 if (h_guid is not null) then
1698 htp.p('<!-- GUID: '||rawtohex(h_guid)||' -->');
1699 end if;
1700 htp.formHidden('h_guid', rawtohex(h_guid));
1701
1702 htp.tableOpen(calign=>'CENTER', cattributes=>'border=0 summary=""');
1703
1704 -- Name
1705 htp.tableRowOpen;
1706 htp.tableData(cvalue=>'<LABEL FOR="i_name">' ||
1707 wf_core.translate('NAME') ||
1708 '</LABEL>', calign=>'Right',
1709 cattributes=>'id=""');
1710 htp.tableData(cvalue=>htf.formText(cname=>'h_name', csize=>40,
1711 cmaxlength=>240,
1712 cvalue=>l_name,
1713 cattributes=>'id="i_name"'),
1714 calign=>'Left',
1715 cattributes=>'id=""');
1716
1717 htp.tableRowClose;
1718
1719 -- Display Name
1720 htp.tableRowOpen;
1721 htp.tableData(cvalue=>'<LABEL FOR="i_display_name">' ||
1722 wf_core.translate('DISPLAY_NAME') || '</LABEL>',
1723 calign=>'Right', cattributes=>'id=""');
1724 htp.tableData(cvalue=>htf.formText(cname=>'h_display_name', csize=>60,
1725 cmaxlength=>80,
1726 cattributes=>'id="i_display_name"'),
1727 calign=>'Left',cattributes=>'id=""');
1728 htp.tableRowClose;
1729
1730 -- Description
1731 htp.tableRowOpen;
1732 htp.tableData(cvalue=>'<LABEL FOR="i_description">' ||
1733 wf_core.translate('DESCRIPTION') || '</LABEL>', calign=>'Right',
1734 cattributes=>'id=""');
1735 htp.tableData(cvalue=>htf.formTextareaOpen2(
1736 cname=>'h_description',
1737 nrows=>2,
1738 ncolumns=>60,
1739 cwrap=>'SOFT',
1740 cattributes=>'maxlength=2000 id="i_description"')
1741 ||l_desc
1742 ||htf.formTextareaClose,
1743 calign=>'Left',cattributes=>'id=""');
1744 htp.tableRowClose;
1745
1746 -- Type
1747 template := wf_core.translate(l_type);
1748 htp.formHidden('h_type', l_type);
1749
1750 -- Status
1751 template := htf.formSelectOpen('h_status',cattributes=>'id="i_status"')
1752 ||wf_core.newline||
1753 htf.formSelectOption(wf_core.translate('ENABLED'),
1754 select_enable,'VALUE="ENABLED"')
1755 ||wf_core.newline||
1756 htf.formSelectOption(wf_core.translate('DISABLED'),
1757 select_disable,'VALUE="DISABLED"')
1758 ||wf_core.newline||
1759 htf.formSelectClose;
1760 htp.tableRowOpen;
1761 htp.tableData(cvalue=>'<LABEL FOR="i_status">' ||
1762 wf_core.translate('STATUS') || '</LABEL>',
1763 calign=>'Right',cattributes=>'id=""');
1764 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
1765 htp.tableRowClose;
1766
1767 -- Generate Function
1768 -- no generate function for group
1769 if (l_type <> 'GROUP') then
1770 htp.tableRowOpen;
1771 htp.tableData(cvalue=>'<LABEL FOR="i_generate_function">' ||
1772 wf_core.translate('GENERATE_FUNCTION') || '</LABEL>',
1773 calign=>'Right',cattributes=>'id=""');
1774 htp.tableData(cvalue=>htf.formText(cname=>'h_generate_function', csize=>60,
1775 cmaxlength=>240, cvalue=>l_gfunc,
1776 cattributes=>'id="i_generate_function"'),
1777 calign=>'Left',cattributes=>'id=""');
1778 htp.tableRowClose;
1779 else
1780 htp.formHidden('h_generate_function', null);
1781 end if;
1782
1783 -- Owner Name
1784 htp.tableRowOpen;
1785 htp.tableData(cvalue=>'<LABEL FOR="i_owner_name">' ||
1786 wf_core.translate('OWNER_NAME') || '</LABEL>',
1787 calign=>'Right',cattributes=>'id=""');
1788 htp.tableData(cvalue=>htf.formText(cname=>'h_owner_name', csize=>30,
1789 cmaxlength=>30,
1790 cattributes=>'id="i_owner_name"'),
1791 calign=>'Left',cattributes=>'id=""');
1792 htp.tableRowClose;
1793
1794 -- Owner Tag
1795 htp.tableRowOpen;
1796 htp.tableData(cvalue=>'<LABEL FOR="i_owner_tag">' ||
1797 wf_core.translate('OWNER_TAG') || '</LABEL>',
1798 calign=>'Right',cattributes=>'id=""');
1799 htp.tableData(cvalue=>htf.formText(cname=>'h_owner_tag', csize=>30,
1800 cmaxlength=>30,
1801 cattributes=>'id="i_owner_tag"'),
1802 calign=>'Left',cattributes=>'id=""');
1803 htp.tableRowClose;
1804
1805 -- Customization Level
1806 if wf_events_pkg.g_Mode = 'FORCE' then
1807 template := htf.formSelectOpen('h_custom_level',cattributes=>'id="i_custom_level"')
1808 ||wf_core.newline||
1809 htf.formSelectOption(wf_core.translate('WFE_CUSTOM_LEVEL_C'),
1810 select_custom_core,'VALUE="C"')
1811 ||wf_core.newline||
1812 htf.formSelectOption(wf_core.translate('WFE_CUSTOM_LEVEL_L'),
1813 select_custom_limit,'VALUE="L"')
1814 ||wf_core.newline||
1815 htf.formSelectOption(wf_core.translate('WFE_CUSTOM_LEVEL_U'),
1816 select_custom_user,'VALUE="U"')
1817 ||wf_core.newline||
1818 htf.formSelectClose;
1819 htp.tableRowOpen;
1820 htp.tableData(cvalue=>'<LABEL FOR="i_custom_level">' ||
1821 wf_core.translate('WFE_CUSTOM_LEVEL') || '</LABEL>',
1822 calign=>'Right',cattributes=>'id=""');
1823 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
1824 htp.tableRowClose;
1825
1826 else
1827 htp.tableRowOpen;
1828 htp.tableData(cvalue=>wf_core.translate('WFE_CUSTOM_LEVEL'),
1829 calign=>'Right',cattributes=>'id=""');
1830 htp.tableData(cvalue=>wf_core.translate('WFE_CUSTOM_LEVEL_'||l_customization_level), calign=>'Left',cattributes=>'id=""');
1831 htp.formHidden('h_custom_level', l_customization_level);
1832 end if;
1833
1834 -- URL to go back to
1835 if (h_guid is null and l_type = 'GROUP') then
1836 htp.formHidden('url', ''); -- signal the coming back to this screen
1837 else
1838 htp.formHidden('url', 'Wf_Event_Html.ListEvents');
1839 end if;
1840
1841 htp.tableClose;
1842 htp.formClose;
1843
1844 -- add values that may contain double quote back through javascript
1845 if (h_guid is not null) then
1846 htp.p('<SCRIPT>');
1847 htp.p(' document.WF_EVENT_EDIT.h_display_name.value="'||l_dname||'"');
1848 htp.p(' document.WF_EVENT_EDIT.h_owner_name.value="'||l_ownname||'"');
1849 htp.p(' document.WF_EVENT_EDIT.h_owner_tag.value="'||l_owntag||'"');
1850 htp.p('</SCRIPT>');
1851 end if;
1852
1853 -- if is group, display events for deletion
1854 if (h_guid is not null and l_type = 'GROUP') then
1855 i := 0;
1856 for event in devcurs loop
1857 i := i+1;
1858 dTab(i).guid := event.guid;
1859 dTab(i).col01:= '<LABEL FOR="i_select'||i||'">' || event.name || '</LABEL>';
1860 dTab(i).col02:= event.display_name;
1861 dTab(i).col03:= event.status;
1862
1863 dTab(i).selectable := TRUE;
1864 dTab(i).deletable := FALSE; -- do not allow deletion
1865
1866 -- it is deletable when there is no subscription; that is,
1867 -- there is no detail.
1868 dTab(i).hasdetail := not Wf_Event_Html.isDeletable(event.guid, 'EVENT');
1869 end loop;
1870
1871 htp.p(wf_core.translate('WFE_EVENTS_IN_GROUP'));
1872
1873 -- Submit Form for Add/Delete
1874 htp.formOpen(curl=>owa_util.get_owa_service_path||
1875 'Wf_Event_Html.SubmitSelectedGEvents',
1876 cmethod=>'Post',
1877 cattributes=>'TARGET="_top" NAME="WF_GROUP_EDIT"');
1878 htp.formHidden('h_gguid', rawtohex(h_guid));
1879
1880 -- Hide the fields for which option you selected. ADD or DELETE
1881 htp.formHidden(cname=>'action', cvalue=>'');
1882
1883 -- Url to come back to later
1884 htp.formHidden(cname=>'url',
1885 cvalue=>'Wf_Event_Html.EditEvent?h_guid='||rawtohex(h_guid));
1886
1887 -- Add dummy fields to start both array-type input fields.
1888 -- These dummy values are needed so that the array parameters to
1889 -- the submit procedure will not be null even if there are no real
1890 -- response fields. This would cause a pl/sql error, because array
1891 -- parameters can't be defaulted.
1892 htp.formHidden('h_guids', '-1');
1893
1894 -- popluate the header table
1895 i := 1;
1896 hTab(i).def_type := 'FUNCTION';
1897 hTab(i).value := null; -- delete is not allowed here
1898 i := i+1;
1899 hTab(i).def_type := 'FUNCTION';
1900 hTab(i).value := 'Wf_Event_Html.ListSubscriptions?use_guid_only=T&'||
1901 'h_event_guid=';
1902 i := i+1;
1903 hTab(i).def_type := 'FUNCTION';
1904 hTab(i).value := 'Wf_Event_Html.EditEvent?h_guid=';
1905 i := i+1;
1906 hTab(i).def_type := 'TITLE';
1907 hTab(i).value := wf_core.translate('SUBSCRIPTIONS');
1908 hTab(i).attr := 'id="'||wf_core.translate('SUBSCRIPTIONS')||'"';
1909 i := i+1;
1910 hTab(i).def_type := 'TITLE';
1911 hTab(i).value := wf_core.translate('EDIT');
1912 i := i+1;
1913 hTab(i).def_type := 'TITLE';
1914 hTab(i).value := wf_core.translate('NAME');
1915 hTab(i).attr := 'id="'||wf_core.translate('NAME')||'"';
1916 i := i+1;
1917 hTab(i).def_type := 'TITLE';
1918 hTab(i).value := wf_core.translate('DISPLAY_NAME');
1919 hTab(i).attr := 'id="'||wf_core.translate('DISPLAY_NAME')||'"';
1920 i := i+1;
1921 hTab(i).def_type := 'TITLE';
1922 hTab(i).value := wf_core.translate('STATUS');
1923 hTab(i).attr := 'id="'||wf_core.translate('STATUS')||'"';
1924
1925 -- render table
1926 Wfe_Html_Util.Simple_Table(hTab, dTab);
1927
1928 htp.formClose;
1929
1930 htp.tableOpen(cattributes=>'WIDTH=100%
1931 summary="' || wf_core.translate('WFE_EVENTS_IN_GROUP') || '"');
1932 htp.tableRowOpen;
1933 htp.p('<TD ID="'|| wf_core.translate('WFE_EVENTS_IN_GROUP') || '">');
1934
1935 htp.tableOpen (calign=>'RIGHT', cattributes=>'summary=""');
1936 htp.tableRowOpen;
1937 -- If table is not empty, we allow check/uncheck all/delete.
1938 if (dTab.COUNT > 0) then
1939 htp.p('<TD ID="">');
1940 wfa_html.create_reg_button (
1941 'javascript:checkAll(document.WF_GROUP_EDIT.h_guids)',
1942 wf_core.translate('SELECT_ALL'),
1943 wfa_html.image_loc,
1944 null,
1945 wf_core.translate('SELECT_ALL'));
1946 htp.p('</TD>');
1947 htp.p('<TD ID="">');
1948 wfa_html.create_reg_button (
1949 'javascript:uncheckAll(document.WF_GROUP_EDIT.h_guids)',
1950 wf_core.translate('UNSELECT_ALL'),
1951 wfa_html.image_loc,
1952 null,
1953 wf_core.translate('UNSELECT_ALL'));
1954 htp.p('</TD>');
1955 -- Delete Screen
1956 -- Allow user to delete selected events
1957 -- or add some more event through the find screen.
1958 htp.p('<TD ID="">');
1959 wfa_html.create_reg_button (
1960 'javascript:document.WF_GROUP_EDIT.action.value=''DELETE'';'||
1961 'document.WF_GROUP_EDIT.submit()',
1962 wf_core.translate('DELETE'),
1963 wfa_html.image_loc,
1964 null,
1965 wf_core.translate('DELETE'));
1966 htp.p('</TD>');
1967 end if;
1968 htp.p('<TD ID="">');
1969 wfa_html.create_reg_button (
1970 'javascript:document.WF_GROUP_EDIT.action.value=''FIND'';'||
1971 'document.WF_GROUP_EDIT.submit()',
1972 wf_core.translate('WFE_ADD_EVENT'),
1973 wfa_html.image_loc,
1974 null,
1975 wf_core.translate('WFE_ADD_EVENT'));
1976 htp.p('</TD>');
1977
1978 htp.tableRowClose;
1979 htp.tableClose;
1980
1981 htp.p('</TD>');
1982 htp.tableRowClose;
1983
1984 htp.tableRowOpen;
1985 htp.p('<TD ID="">');
1986
1987 -- Add submit button
1988 htp.tableopen (calign=>'RIGHT', cattributes=>'summary=""');
1989 htp.tableRowOpen;
1990
1991 htp.p('<TD ID="">');
1992 wfa_html.create_reg_button ('javascript:document.WF_EVENT_EDIT.submit()',
1993 wf_core.translate('SUBMIT'),
1994 wfa_html.image_loc,
1995 null,
1996 wf_core.translate('SUBMIT'));
1997 htp.p('</TD>');
1998 htp.p('<TD ID="">');
1999 wfa_html.create_reg_button ('javascript:history.back()',
2000 wf_core.translate ('CANCEL'),
2001 wfa_html.image_loc,
2002 null,
2003 wf_core.translate ('CANCEL'));
2004 htp.p('</TD>');
2005
2006 htp.tableRowClose;
2007 htp.tableClose;
2008
2009 htp.p('</TD>');
2010 htp.tableRowClose;
2011 htp.tableClose;
2012 else
2013
2014 aligntext := 'CENTER';
2015
2016 -- Add submit button
2017 htp.tableopen (calign=>aligntext, cattributes=>'summary=""');
2018 htp.tableRowOpen;
2019
2020 htp.p('<TD ID="">');
2021
2022 wfa_html.create_reg_button ('javascript:document.WF_EVENT_EDIT.submit()',
2023 wf_core.translate('SUBMIT'),
2024 wfa_html.image_loc,
2025 null,
2026 wf_core.translate('SUBMIT'));
2027
2028 htp.p('</TD>');
2029 htp.p('<TD ID="">');
2030 wfa_html.create_reg_button ('javascript:history.back()',
2031 wf_core.translate ('CANCEL'),
2032 wfa_html.image_loc,
2033 null,
2034 wf_core.translate ('CANCEL'));
2035
2036 htp.p('</TD>');
2037
2038 htp.tableRowClose;
2039 htp.tableClose;
2040 end if;
2041
2042 wfa_sec.Footer;
2043 htp.htmlClose;
2044
2045 exception
2046 when others then
2047 rollback;
2048 wf_core.context('WF_EVENT_HTML', 'EditEvent', h_guid);
2049 wfe_html_util.Error;
2050 end EditEvent;
2051
2052 --
2053 -- EditGroup
2054 -- Delete/Add events from/to group
2055 -- IN
2056 -- h_guid - Global unique id for an event
2057 -- h_func - DELETE|ADD
2058 -- NOTE
2059 --
2060 procedure EditGroup(
2061 h_guid in raw,
2062 h_func in varchar2 default 'DELETE',
2063 h_display_name in varchar2 default null,
2064 h_name in varchar2 default null,
2065 h_status in varchar2 default '*',
2066 h_type in varchar2 default '*'
2067 )
2068 is
2069 -- addable event cursor
2070 -- all events meet the query criteria excluding the group itself
2071 cursor aevcurs is
2072 select GUID, DISPLAY_NAME, NAME, TYPE, STATUS
2073 from WF_EVENTS_VL
2074 where (h_type = '*' or TYPE = h_type)
2075 and (h_display_name is null or lower(DISPLAY_NAME) like
2076 '%'||lower(h_display_name)||'%')
2077 and (h_name is null or lower(NAME) like '%'||lower(h_name)||'%')
2078 and (h_status = '*' or STATUS = h_status)
2079 and GUID <> h_guid
2080 order by NAME;
2081
2082 -- deletable event cursor
2083 -- all events belong to the group
2084 cursor devcurs is
2085 select E.GUID, E.DISPLAY_NAME, E.NAME, E.STATUS
2086 from WF_EVENTS_VL E, WF_EVENT_GROUPS EG
2087 where EG.GROUP_GUID = h_guid
2088 and E.GUID = EG.MEMBER_GUID;
2089
2090
2091 hTab wfe_html_util.headerTabType;
2092 dTab wfe_html_util.dataTabType;
2093 i pls_integer;
2094
2095 username varchar2(320); -- Username to query
2096 admin_role varchar2(320); -- Role for admin mode
2097
2098 l_name varchar2(240);
2099 l_dname varchar2(80);
2100
2101 begin
2102 -- Check session and current user
2103 wfa_sec.GetSession(username);
2104 username := upper(username);
2105 wf_events_pkg.setMode;
2106
2107 -- Check Admin Priviledge
2108 admin_role := wf_core.translate('WF_ADMIN_ROLE');
2109 if (admin_role = '*' or
2110 Wf_Directory.IsPerformer(username, admin_role)) then
2111 -- Have admin privledge, do nothing.
2112 null;
2113 else
2114 wf_core.raise('WF_NOTADMIN');
2115 end if;
2116
2117 -- Check if Accessible
2118 wf_event_html.isAccessible('EVENTS');
2119
2120
2121 -- Render page
2122 htp.htmlOpen;
2123
2124 -- Set page title
2125 htp.headOpen;
2126
2127 -- list does not get updated after edit, so we add the
2128 -- following tag to force the reload of page.
2129 htp.p('<META HTTP-EQUIV=expires CONTENT="no-cache">');
2130
2131 htp.title(wf_core.translate('WFE_EDIT_GROUP_TITLE'));
2132 wfa_html.create_help_function('wf/links/t_d.htm?T_DEFEVGPM');
2133 fnd_document_management.get_open_dm_display_window;
2134
2135 Wfe_Html_Util.generate_check_all;
2136
2137 htp.headClose;
2138
2139 -- Page header
2140 wfa_sec.Header(FALSE, null,
2141 wf_core.translate('WFE_EDIT_GROUP_TITLE'),
2142 TRUE);
2143
2144 -- Group to edit
2145 begin
2146 select NAME, DISPLAY_NAME
2147 into l_name, l_dname
2148 from WF_EVENTS_VL
2149 where GUID = h_guid;
2150
2151 -- take care of the double quote problem
2152 -- l_dname := replace(l_dname, '"', '\"');
2153
2154 exception
2155 when NO_DATA_FOUND then
2156 wf_core.raise('WFE_EVENT_NOTEXIST');
2157 end;
2158
2159 htp.tableOpen(calign=>'CENTER',cattributes=>'WIDTH=100% summary=""');
2160
2161 htp.tableRowOpen;
2162 wf_core.token('GROUP','<B>'||l_name||'</B>');
2163 htp.tableData(cvalue=>wf_core.translate('WFE_ADD_SELECTED_TO_GRP'),
2164 calign=>'Left',cattributes=>'id=""');
2165 htp.tableRowClose;
2166
2167 htp.tableClose;
2168
2169 -- populate the data table
2170 i := 0;
2171
2172 if (h_func = 'DELETE') then
2173 for event in devcurs loop
2174 i := i+1;
2175 dTab(i).guid := event.guid;
2176 dTab(i).col01:= event.display_name;
2177 dTab(i).col02:= event.name;
2178 dTab(i).col03:= event.status;
2179
2180 dTab(i).selectable := TRUE;
2181 dTab(i).deletable := FALSE;
2182 dTab(i).hasdetail := FALSE;
2183 end loop;
2184
2185 else
2186 for event in aevcurs loop
2187 i := i+1;
2188 dTab(i).guid := event.guid;
2189 dTab(i).col01:= event.display_name;
2190 dTab(i).col02:= event.name;
2191 dTab(i).col03:= event.status;
2192
2193 dTab(i).selectable := TRUE;
2194 dTab(i).deletable := FALSE;
2195 dTab(i).hasdetail := FALSE;
2196 end loop;
2197 end if;
2198
2199 -- Submit Form for Add/Delete
2200 htp.formOpen(curl=>owa_util.get_owa_service_path||
2201 'Wf_Event_Html.SubmitSelectedGEvents',
2202 cmethod=>'Get',
2203 cattributes=>'TARGET="_top" NAME="WF_GROUP_EDIT"');
2204 htp.formHidden('h_gguid', rawtohex(h_guid));
2205
2206 -- Hide the fields for which option you selected. ADD or DELETE
2207 htp.formHidden(cname=>'action', cvalue=>'');
2208
2209 -- Url to come back to later
2210 htp.formHidden(cname=>'url',
2211 cvalue=>'Wf_Event_Html.EditEvent?h_guid='||rawtohex(h_guid));
2212
2213 -- Add dummy fields to start both array-type input fields.
2214 -- These dummy values are needed so that the array parameters to
2215 -- the submit procedure will not be null even if there are no real
2216 -- response fields. This would cause a pl/sql error, because array
2217 -- parameters can't be defaulted.
2218 htp.formHidden('h_guids', '-1');
2219
2220 -- popluate the header table
2221 i := 1;
2222 hTab(i).def_type := 'TITLE';
2223 hTab(i).value := wf_core.translate('DISPLAY_NAME');
2224 hTab(i).attr := 'id="'||wf_core.translate('DISPLAY_NAME')||'"';
2225 i := i+1;
2226 hTab(i).def_type := 'TITLE';
2227 hTab(i).value := wf_core.translate('NAME');
2228 hTab(i).attr := 'id="'||wf_core.translate('NAME')||'"';
2229 i := i+1;
2230 hTab(i).def_type := 'TITLE';
2231 hTab(i).value := wf_core.translate('STATUS');
2232 hTab(i).attr := 'id="'||wf_core.translate('STATUS')||'"';
2233
2234 -- render table
2235 Wfe_Html_Util.Simple_Table(hTab, dTab);
2236
2237 htp.formClose;
2238
2239 -- If we generate simple table, we create this check/uncheck all.
2240 if (i > 0) then
2241 htp.tableOpen (calign=>'CENTER',cattributes=>'WIDTH=100% summary=""');
2242 htp.tableRowOpen;
2243 htp.p('<TD ID="" align="LEFT">');
2244 htp.anchor('javascript:checkAll(document.WF_GROUP_EDIT.h_guids)',
2245 wf_core.translate('SELECT_ALL'), null);
2246 htp.anchor('javascript:uncheckAll(document.WF_GROUP_EDIT.h_guids)',
2247 wf_core.translate('UNSELECT_ALL'), null);
2248 htp.p('</TD>');
2249 htp.tableRowClose;
2250 htp.tableClose;
2251 end if;
2252
2253 htp.tableOpen (calign=>'CENTER', cattributes=>'summary=""');
2254 htp.tableRowOpen;
2255 if (h_func = 'DELETE') then
2256
2257 -- Delete Screen
2258 -- Allow user to delete selected events
2259 -- or add some more event through the find screen.
2260 htp.p('<TD ID="">');
2261 wfa_html.create_reg_button (
2262 'javascript:document.WF_GROUP_EDIT.action.value=''DELETE'';'||
2263 'document.WF_GROUP_EDIT.submit()',
2264 wf_core.translate('DELETE_SELECTED'),
2265 wfa_html.image_loc,
2266 null,
2267 wf_core.translate('DELETE_SELECTED'));
2268 htp.p('</TD>');
2269 htp.p('<TD "">');
2270 wfa_html.create_reg_button (
2271 'javascript:document.WF_GROUP_EDIT.action.value=''FIND'';'||
2272 'document.WF_GROUP_EDIT.submit()',
2273 wf_core.translate('ADD'),
2274 wfa_html.image_loc,
2275 null,
2276 wf_core.translate('ADD'));
2277 htp.p('</TD>');
2278 else
2279
2280 -- Add screen
2281 -- Come back from the Find, now you can add selected events to the group.
2282 htp.p('<TD ID"">');
2283 wfa_html.create_reg_button (
2284 'javascript:document.WF_GROUP_EDIT.action.value=''ADD'';'||
2285 'document.WF_GROUP_EDIT.submit()',
2286 wf_core.translate('ADD_SELECTED'),
2287 wfa_html.image_loc,
2288 null,
2289 wf_core.translate('ADD_SELECTED'));
2290 htp.p('</TD>');
2291 htp.p('<TD ID="">');
2292 wfa_html.create_reg_button ('javascript:history.back()',
2293 wf_core.translate ('CANCEL'),
2294 wfa_html.image_loc,
2295 null,
2296 wf_core.translate ('CANCEL'));
2297
2298 htp.p('</TD>');
2299 end if;
2300 htp.tableRowClose;
2301 htp.tableClose;
2302
2303 wfa_sec.Footer;
2304 htp.htmlClose;
2305 exception
2306 when others then
2307 rollback;
2308 wf_core.context('WF_EVENT_HTML', 'EditGroup', rawtohex(h_guid));
2309 wfe_html_util.Error;
2310 end EditGroup;
2311
2312 --
2313 -- EditSystem
2314 -- Create/Update an event
2315 -- IN
2316 -- h_guid - Global unique id for a system
2317 -- NOTE
2318 --
2319 procedure EditSystem(
2320 h_guid in raw default null)
2321 is
2322 username varchar2(320); -- Username to query
2323 admin_role varchar2(320); -- Role for admin mode
2324 template varchar2(4000); -- Use for construct form select list
2325
2326 l_name varchar2(240);
2327 l_dname varchar2(80);
2328 l_desc varchar2(2000);
2329 l_mname varchar2(80);
2330 l_mguid raw(16);
2331
2332 l_message varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate('WFPREF_LOV'));
2333 l_url varchar2(1000);
2334 l_media varchar2(240) := wfa_html.image_loc;
2335 l_icon varchar2(30) := 'FNDILOV.gif';
2336 begin
2337 -- Check session and current user
2338 wfa_sec.GetSession(username);
2339 username := upper(username);
2340 wf_events_pkg.setMode;
2341
2342 -- Check Admin Priviledge
2343 admin_role := wf_core.translate('WF_ADMIN_ROLE');
2344 if (admin_role = '*' or
2345 Wf_Directory.IsPerformer(username, admin_role)) then
2346 -- Have admin privledge, do nothing.
2347 null;
2348 else
2349 wf_core.raise('WF_NOTADMIN');
2350 end if;
2351
2352 -- Check if Accessible
2353 wf_event_html.isAccessible('SYSTEM');
2354
2355 -- Set page title
2356 htp.htmlOpen;
2357 htp.headOpen;
2358
2359 htp.title(wf_core.translate('WFE_EDIT_SYSTEM_TITLE'));
2360 wfa_html.create_help_function('wf/links/t_d.htm?T_DEFEVSYS');
2361 fnd_document_management.get_open_dm_display_window;
2362
2363 htp.headClose;
2364
2365 -- Page header
2366 wfa_sec.Header(FALSE,
2367 owa_util.get_owa_service_path||'wf_event_html.FindEvent',
2368 wf_core.translate('WFE_EDIT_SYSTEM_TITLE'),
2369 TRUE);
2370
2371 -- populate the appropriate values in the form if editing an exist guid
2372 if (h_guid is not null) then
2373 begin
2374 select NAME, DISPLAY_NAME, DESCRIPTION, MASTER_GUID
2375 into l_name, l_dname, l_desc, l_mguid
2376 from WF_SYSTEMS
2377 where GUID = h_guid;
2378
2379 exception
2380 when NO_DATA_FOUND then
2381 wf_core.raise('WFE_SYSTEM_NOTEXIST');
2382 end;
2383
2384 if (l_mguid is not null) then
2385 begin
2386 select NAME
2387 into l_mname
2388 from WF_SYSTEMS
2389 where GUID = l_mguid;
2390 exception
2391 when NO_DATA_FOUND then
2392 wf_core.token('GUID', rawtohex(l_mguid));
2393 l_mname := wf_core.translate('WFE_EVENT_NOGUID');
2394 end;
2395 end if;
2396
2397 -- take care of the double quote problem
2398 -- There should be no any kind of quote for name and generate_function.
2399 -- Description is handle entirely differently, no need for substitution.
2400 -- Single quote is ok becuase html does not treat it special.
2401 l_dname := replace(l_dname, '"', '\"');
2402 l_mname := replace(l_mname, '"', '\"');
2403
2404
2405 end if;
2406 -- Form
2407 htp.formOpen(curl=>owa_util.get_owa_service_path||
2408 'wf_event_html.SubmitSystem',
2409 cmethod=>'Get',
2410 cattributes=>'TARGET="_top" NAME="WF_SYSTEM_EDIT"');
2411
2412 -- GUID
2413 -- do not display it if it is null
2414 if (h_guid is not null) then
2415 htp.p('<!-- GUID: '||rawtohex(h_guid)||' -->');
2416 end if;
2417 htp.formHidden('h_guid', rawtohex(h_guid));
2418
2419 htp.tableOpen(calign=>'CENTER', cattributes=>'border=0 summary=""');
2420
2421 -- Name
2422 htp.tableRowOpen;
2423 htp.tableData(cvalue=>'<LABEL FOR="i_name">' ||
2424 wf_core.translate('NAME') || '</LABEL>',
2425 calign=>'Right', cattributes=>'id=""');
2426 htp.tableData(cvalue=>htf.formText(cname=>'h_name', csize=>40,
2427 cmaxlength=>240, cvalue=>l_name,
2428 cattributes=>'id="i_name"'),
2429 calign=>'Left',cattributes=>'id=""');
2430 htp.tableRowClose;
2431
2432 -- Display Name
2433 htp.tableRowOpen;
2434 htp.tableData(cvalue=>'<LABEL FOR="i_display_name">' ||
2435 wf_core.translate('DISPLAY_NAME') || '</LABEL>',
2436 calign=>'Right', cattributes=>'id=""');
2437 htp.tableData(cvalue=>htf.formText(cname=>'h_display_name', csize=>60,
2438 cmaxlength=>80,
2439 cattributes=>'id="i_display_name"'),
2440 calign=>'Left', cattributes=>'id=""');
2441 htp.tableRowClose;
2442
2443 -- Description
2444 htp.tableRowOpen;
2445 htp.tableData(cvalue=>'<LABEL FOR="i_description">' ||
2446 wf_core.translate('DESCRIPTION') || '</LABEL>',
2447 calign=>'Right', cattributes=>'id=""');
2448 htp.tableData(cvalue=>htf.formTextareaOpen2(
2449 cname=>'h_description',
2450 nrows=>2,
2451 ncolumns=>60,
2452 cwrap=>'SOFT',
2453 cattributes=>'maxlength=2000
2454 id="i_description"')
2455 ||l_desc
2456 ||htf.formTextareaClose,
2457 calign=>'Left',
2458 cattributes=>'id=""');
2459 htp.tableRowClose;
2460
2461 -- Master GUID
2462 htp.tableRowOpen;
2463 htp.tableData(cvalue=>'<LABEL FOR="i_master">' ||
2464 wf_core.translate('MASTER') || '</LABEL>',
2465 calign=>'right',cattributes=>'id=""');
2466 htp.formHidden('h_master_guid', l_mguid);
2467 -- add LOV here:
2468 -- Note: The REPLACE function replaces all the space characters with
2469 -- the proper escape sequence.
2470 l_url := 'javascript:fnd_open_dm_display_window('||''''||
2471 REPLACE('wf_lov.display_lov?p_lov_name='||'h_master_guid'||
2472 '&p_display_name='||'SYSTEM'||
2473 '&p_validation_callback=wf_event_html.wf_system_val'||
2474 '&p_dest_hidden_field=top.opener.parent.document.WF_SYSTEM_EDIT.h_master_guid.value'||
2475 '&p_current_value=top.opener.parent.document.WF_SYSTEM_EDIT.display_master.value'||
2476 '&p_display_key='||'Y'||
2477 '&p_dest_display_field=top.opener.parent.document.WF_SYSTEM_EDIT.display_master.value',
2478 ' ', '%20')||''''||',500,500)';
2479
2480 -- print everything together so there is no gap.
2481 htp.tabledata(htf.formText(cname=>'display_master', csize=>32,
2482 cmaxlength=>240,
2483 cattributes=>'id="i_master"')||
2484 '<A href='||l_url||'>'||
2485 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
2486 l_message||'" onmouseover="window.status='||''''||
2487 l_message||''''||';return true"></A>',
2488 cattributes=>'id=""');
2489
2490 htp.tableRowClose;
2491
2492 -- URL to go back to
2493 htp.formHidden('url', 'Wf_Event_Html.ListSystems');
2494
2495 htp.tableClose;
2496 htp.formClose;
2497
2498 -- add values that may contain double quote back through javascript
2499 if (h_guid is not null) then
2500 htp.p('<SCRIPT>');
2501 htp.p(' document.WF_SYSTEM_EDIT.h_display_name.value="'||l_dname||'"');
2502 htp.p(' document.WF_SYSTEM_EDIT.display_master.value="'||l_mname||'"');
2503 htp.p('</SCRIPT>');
2504 end if;
2505
2506 -- Add submit button
2507 htp.tableopen (calign=>'CENTER', cattributes=>'summary=""');
2508 htp.tableRowOpen;
2509
2510 htp.p('<TD "" id="">');
2511
2512 wfa_html.create_reg_button ('javascript:document.WF_SYSTEM_EDIT.submit()',
2513 wf_core.translate('SUBMIT'),
2514 wfa_html.image_loc,
2515 null,
2516 wf_core.translate('SUBMIT'));
2517
2518 htp.p('</TD>');
2519 htp.p('<TD ID="">');
2520 wfa_html.create_reg_button ('javascript:history.back()',
2521 wf_core.translate ('CANCEL'),
2522 wfa_html.image_loc,
2523 null,
2524 wf_core.translate ('CANCEL'));
2525
2526 htp.p('</TD>');
2527
2528 htp.tableRowClose;
2529 htp.tableClose;
2530
2531 wfa_sec.Footer;
2532 htp.htmlClose;
2533
2534 exception
2535 when others then
2536 rollback;
2537 wf_core.context('WF_EVENT_HTML', 'EditSystem', h_guid);
2538 wfe_html_util.Error;
2539 end EditSystem;
2540
2541 --
2542 -- EditAgent
2543 -- Create/Update an agent
2544 -- IN
2545 -- h_guid - Global unique id for an agent
2546 -- NOTE
2547 --
2548 procedure EditAgent(
2549 h_guid in raw default null)
2550 is
2551 username varchar2(320); -- Username to query
2552 admin_role varchar2(320); -- Role for admin mode
2553 template varchar2(4000); -- Use for construct form select list
2554
2555 l_name varchar2(80);
2556 l_dname varchar2(80);
2557 l_desc varchar2(2000);
2558 l_protocol varchar2(8);
2559 l_address varchar2(80);
2560 l_system varchar2(80); -- display_system
2561 l_sysguid raw(16);
2562 l_qhandler varchar2(240);
2563 l_qname varchar2(80);
2564 l_direction varchar2(8);
2565 l_status varchar2(8);
2566
2567 l_message varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate('WFPREF_LOV'));
2568 l_url varchar2(1000);
2569 l_media varchar2(240) := wfa_html.image_loc;
2570 l_icon varchar2(30) := 'FNDILOV.gif';
2571 l_onmouseover varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate('FIND'));
2572
2573 select_in varchar2(8);
2574 select_out varchar2(8);
2575 select_enable varchar2(8);
2576 select_disable varchar2(8);
2577
2578 cursor protocurs is
2579 select LOOKUP_CODE, MEANING
2580 from WF_LOOKUPS
2581 where LOOKUP_TYPE = 'WF_AQ_PROTOCOLS'
2582 order by lookup_code desc;
2583
2584 selected boolean := FALSE; -- indicator if a lookup has been selected.
2585 begin
2586 -- Check session and current user
2587 wfa_sec.GetSession(username);
2588 username := upper(username);
2589 wf_events_pkg.setMode;
2590
2591 -- Check Admin Priviledge
2592 admin_role := wf_core.translate('WF_ADMIN_ROLE');
2593 if (admin_role = '*' or
2594 Wf_Directory.IsPerformer(username, admin_role)) then
2595 -- Have admin privledge, do nothing.
2596 null;
2597 else
2598 wf_core.raise('WF_NOTADMIN');
2599 end if;
2600
2601 -- Check if Accessible
2602 wf_event_html.isAccessible('AGENTS');
2603
2604 -- Set page title
2605 htp.htmlOpen;
2606 htp.headOpen;
2607
2608 htp.title(wf_core.translate('WFE_EDIT_AGENT_TITLE'));
2609 wfa_html.create_help_function('wf/links/t_d.htm?T_DEFEVAGT');
2610 fnd_document_management.get_open_dm_display_window;
2611
2612 htp.headClose;
2613
2614 -- Page header
2615 wfa_sec.Header(FALSE,
2616 owa_util.get_owa_service_path||'wf_event_html.FindAgent',
2617 wf_core.translate('WFE_EDIT_AGENT_TITLE'),
2618 TRUE);
2619
2620 -- populate the appropriate values in the form if editing an exist guid
2621 if (h_guid is not null) then
2622 begin
2623 select A.NAME, A.DISPLAY_NAME, A.DESCRIPTION, A.PROTOCOL, A.ADDRESS,
2624 A.SYSTEM_GUID, A.QUEUE_HANDLER, A.QUEUE_NAME,
2625 A.DIRECTION, A.STATUS, S.NAME
2626 into l_name, l_dname, l_desc, l_protocol, l_address,
2627 l_sysguid, l_qhandler, l_qname,
2628 l_direction, l_status, l_system
2629 from WF_AGENTS A, WF_SYSTEMS S
2630 where A.GUID = h_guid
2631 and A.SYSTEM_GUID = S.GUID;
2632
2633 -- take care of the double quote problem
2634 -- Description is handle entirely differently, no need for substitution.
2635 -- Single quote is ok becuase html does not treat it special.
2636 l_dname := replace(l_dname, '"', '\"');
2637 l_system := replace(l_system, '"', '\"');
2638
2639 if (l_direction = 'IN') then
2640 select_in := 'SELECTED';
2641 -- elsif (l_direction = 'OUT') then
2642 else
2643 select_out := 'SELECTED';
2644 -- else
2645 -- select_any := 'SELECTED';
2646 end if;
2647
2648 if (l_status = 'ENABLED') then
2649 select_enable := 'SELECTED';
2650 select_disable := null;
2651 else
2652 select_enable := null;
2653 select_disable := 'SELECTED';
2654 end if;
2655 exception
2656 when NO_DATA_FOUND then
2657 wf_core.raise('WFE_AGENT_NOTEXIST');
2658 end;
2659
2660 end if;
2661
2662 -- Form
2663 htp.formOpen(curl=>owa_util.get_owa_service_path||
2664 'wf_event_html.SubmitAgent',
2665 cmethod=>'Get',
2666 cattributes=>'TARGET="_top" NAME="WF_AGENT_EDIT"');
2667
2668 -- GUID
2669 -- do not display it if it is null
2670 if (h_guid is not null) then
2671 htp.p('<!-- GUID: '||rawtohex(h_guid)||' -->');
2672 end if;
2673 htp.formHidden('h_guid', rawtohex(h_guid));
2674
2675 htp.tableOpen(calign=>'CENTER', cattributes=>'border=0 summary=""');
2676
2677 -- Name
2678 htp.tableRowOpen;
2679 htp.tableData(cvalue=>'<LABEL FOR="i_name">' ||
2680 wf_core.translate('NAME') || '</LABEL>',
2681 calign=>'Right',cattributes=>'id=""');
2682 htp.tableData(cvalue=>htf.formText(cname=>'h_name', csize=>60,
2683 cmaxlength=>80, cvalue=>l_name,
2684 cattributes=>'id="i_name"'),
2685 calign=>'Left',cattributes=>'id=""');
2686 htp.tableRowClose;
2687
2688 -- Display Name
2689 htp.tableRowOpen;
2690 htp.tableData(cvalue=>'<LABEL FOR="i_display_name">' ||
2691 wf_core.translate('DISPLAY_NAME') || '</LABEL>',
2692 calign=>'Right',cattributes=>'id=""');
2693 htp.tableData(cvalue=>htf.formText(cname=>'h_display_name', csize=>60,
2694 cmaxlength=>80,
2695 cattributes=>'id="i_display_name"'),
2696 calign=>'Left',cattributes=>'id=""');
2697 htp.tableRowClose;
2698
2699 -- Description
2700 htp.tableRowOpen;
2701 htp.tableData(cvalue=>'<LABEL FOR="i_description">' ||
2702 wf_core.translate('DESCRIPTION') || '</LABEL>',
2703 calign=>'Right', cattributes=>'id=""');
2704 htp.tableData(cvalue=>htf.formTextareaOpen2(
2705 cname=>'h_description',
2706 nrows=>2,
2707 ncolumns=>60,
2708 cwrap=>'SOFT',
2709 cattributes=>'maxlength=2000 id="i_description"')
2710 ||l_desc
2711 ||htf.formTextareaClose,
2712 calign=>'Left',cattributes=>'id=""');
2713 htp.tableRowClose;
2714
2715 -- Protocol
2716 template := htf.formSelectOpen('h_protocol',cattributes=>'id="i_protocol"')
2717 ||wf_core.newline;
2718 for prtr in protocurs loop
2719 if (h_guid is not null and l_protocol is not null) then
2720 if (prtr.lookup_code = l_protocol) then
2721 template := template||htf.formSelectOption(prtr.meaning, 'SELECTED',
2722 'VALUE="'||prtr.lookup_code||'"')||wf_core.newline;
2723 selected := TRUE;
2724 else
2725 template := template||htf.formSelectOption(prtr.meaning, '',
2726 'VALUE="'||prtr.lookup_code||'"')||wf_core.newline;
2727 end if;
2728 else
2729 if (not selected) then
2730 template := template||htf.formSelectOption(prtr.meaning, 'SELECTED',
2731 'VALUE="'||prtr.lookup_code||'"')||wf_core.newline;
2732 selected := TRUE;
2733 else
2734 template := template||htf.formSelectOption(prtr.meaning, '',
2735 'VALUE="'||prtr.lookup_code||'"')||wf_core.newline;
2736 end if;
2737 end if;
2738 end loop;
2739 -- if it is still not selected, this must be a custom code not yet in
2740 -- WF_AQ_PROTOCOLS, preserve it.
2741 if (not selected) then
2742 template := template||htf.formSelectOption(l_protocol, 'SELECTED',
2743 'VALUE="'||l_protocol||'"')||wf_core.newline;
2744 selected := TRUE;
2745 end if;
2746 template := template||htf.formSelectClose;
2747
2748 htp.tableRowOpen;
2749 htp.tableData(cvalue=>'<LABEL FOR="i_protocol">' ||
2750 wf_core.translate('PROTOCOL') || '</LABEL>',
2751 calign=>'Right', cattributes=>'id=""');
2752 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
2753 -- htp.tableData(cvalue=>htf.formText(cname=>'h_protocol', csize=>8,
2754 -- cmaxlength=>8, cvalue=>l_protocol),
2755 -- calign=>'Left',cattributes=>'id=""');
2756 htp.tableRowClose;
2757
2758 -- Address
2759 htp.tableRowOpen;
2760 htp.tableData(cvalue=>'<LABEL FOR="i_address">' ||
2761 wf_core.translate('ADDRESS') || '</LABEL>',
2762 calign=>'Right',cattributes=>'id=""');
2763 htp.tableData(cvalue=>htf.formText(cname=>'h_address', csize=>80,
2764 cmaxlength=>240, cvalue=>l_address,
2765 cattributes=>'id="i_address"'),
2766 calign=>'Left',cattributes=>'id=""');
2767 htp.tableRowClose;
2768
2769 -- System
2770 htp.tableRowOpen;
2771 htp.tableData(cvalue=>'<LABEL FOR="i_system">' ||
2772 wf_core.translate('SYSTEM') || '</LABEL>',
2773 calign=>'right',cattributes=>'id=""');
2774 htp.formHidden('h_system_guid', null);
2775 -- add LOV here:
2776 -- Note: The REPLACE function replaces all the space characters with
2777 -- the proper escape sequence.
2778 l_url := 'javascript:fnd_open_dm_display_window('||''''||
2779 REPLACE('wf_lov.display_lov?p_lov_name='||'h_system_guid'||
2780 '&p_display_name='||'SYSTEM'||
2781 '&p_validation_callback=wf_event_html.wf_system_val'||
2782 '&p_dest_hidden_field=top.opener.parent.document.WF_AGENT_EDIT.h_system_guid.value'||
2783 '&p_current_value=top.opener.parent.document.WF_AGENT_EDIT.display_system.value'||
2784 '&p_display_key='||'Y'||
2785 '&p_dest_display_field=top.opener.parent.document.WF_AGENT_EDIT.display_system.value',
2786 ' ', '%20')||''''||',500,500)';
2787
2788 -- print everything together so there is no gap.
2789 htp.tabledata(htf.formText(cname=>'display_system', csize=>32,
2790 cmaxlength=>240,cattributes=>'id="i_system"')||
2791 '<A href='||l_url||'>'||
2792 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
2793 l_message||'" onmouseover="window.status='||''''||
2794 l_message||''''||';return true"></A>',
2795 cattributes=>'id=""');
2796
2797 htp.tableRowClose;
2798
2799 -- Queue Handler
2800 htp.tableRowOpen;
2801 htp.tableData(cvalue=>'<LABEL FOR="i_queue_handler">' ||
2802 wf_core.translate('QUEUE_HANDLER') || '</LABEL>',
2803 calign=>'Right',cattributes=>'id=""');
2804 htp.tableData(cvalue=>htf.formText(cname=>'h_qhandler', csize=>60,
2805 cmaxlength=>240, cvalue=>l_qhandler,
2806 cattributes=>'id="i_queue_handler"'),
2807 calign=>'Left',cattributes=>'id=""');
2808 htp.tableRowClose;
2809
2810 -- Queue Name
2811 htp.tableRowOpen;
2812 htp.tableData(cvalue=>'<LABEL FOR="i_queue_name">' ||
2813 wf_core.translate('QUEUE_NAME') || '</LABEL>', calign=>'Right',
2814 cattributes=>'id=""');
2815 htp.tableData(cvalue=>htf.formText(cname=>'h_qname', csize=>60,
2816 cmaxlength=>80, cvalue=>l_qname,
2817 cattributes=>'id="i_queue_name"'),
2818 calign=>'Left',cattributes=>'id=""');
2819 htp.tableRowClose;
2820
2821 -- Direction
2822 template := htf.formSelectOpen('h_direction', cattributes=>'id="i_direction"')||wf_core.newline||
2823 /*
2824 htf.formSelectOption(wf_core.translate('ANY'),
2825 select_any,'VALUE="ANY"')
2826 ||wf_core.newline||
2827 */
2828 htf.formSelectOption(wf_core.translate('IN'),
2829 select_in,'VALUE="IN"')
2830 ||wf_core.newline||
2831 htf.formSelectOption(wf_core.translate('OUT'),
2832 select_out,'VALUE="OUT"')
2833 ||wf_core.newline||
2834 htf.formSelectClose;
2835 htp.tableRowOpen;
2836 htp.tableData(cvalue=>'<LABEL FOR="i_direction">' ||
2837 wf_core.translate('DIRECTION') || '</LABEL>',
2838 calign=>'Right',cattributes=>'id=""');
2839 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
2840 htp.tableRowClose;
2841
2842 -- Status
2843 template := htf.formSelectOpen('h_status',cattributes=>'id="i_status"')
2844 ||wf_core.newline||
2845 htf.formSelectOption(wf_core.translate('ENABLED'),
2846 select_enable,'VALUE="ENABLED"')||
2847 wf_core.newline||
2848 htf.formSelectOption(wf_core.translate('DISABLED'),
2849 select_disable,'VALUE="DISABLED"')
2850 ||wf_core.newline||
2851 htf.formSelectClose;
2852 htp.tableRowOpen;
2853 htp.tableData(cvalue=>'<LABEL FOR="i_status">' ||
2854 wf_core.translate('STATUS') || '</LABEL>',
2855 calign=>'Right',cattributes=>'id=""');
2856 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
2857 htp.tableRowClose;
2858
2859 -- URL to go back to
2860 htp.formHidden('url', 'Wf_Event_Html.ListAgents');
2861
2862 htp.tableClose;
2863 htp.formClose;
2864
2865 -- add values that may contain double quote back through javascript
2866 if (h_guid is not null) then
2867 htp.p('<SCRIPT>');
2868 htp.p(' document.WF_AGENT_EDIT.h_display_name.value="'||l_dname||'"');
2869 htp.p(' document.WF_AGENT_EDIT.display_system.value="'||l_system||'"');
2870 htp.p('</SCRIPT>');
2871 end if;
2872
2873 -- Add submit button
2874 htp.tableopen (calign=>'CENTER', cattributes=>'summary=""');
2875 htp.tableRowOpen;
2876
2877 htp.p('<TD ID="">');
2878
2879 wfa_html.create_reg_button ('javascript:document.WF_AGENT_EDIT.submit()',
2880 wf_core.translate('SUBMIT'),
2881 wfa_html.image_loc,
2882 null,
2883 wf_core.translate('SUBMIT'));
2884
2885 htp.p('</TD>');
2886 htp.p('<TD ID="">');
2887 wfa_html.create_reg_button ('javascript:history.back()',
2888 wf_core.translate ('CANCEL'),
2889 wfa_html.image_loc,
2890 null,
2891 wf_core.translate ('CANCEL'));
2892
2893 htp.p('</TD>');
2894
2895 htp.tableRowClose;
2896 htp.tableClose;
2897
2898 wfa_sec.Footer;
2899 htp.htmlClose;
2900
2901 exception
2902 when others then
2903 rollback;
2904 wf_core.context('WF_EVENT_HTML', 'EditAgent', h_guid);
2905 wfe_html_util.Error;
2906 end EditAgent;
2907
2908 --
2909 -- EditSubscription
2910 -- Create/Update a subscription
2911 -- IN
2912 -- h_guid - Global unique id for a subscription
2913 -- NOTE
2914 --
2915 procedure EditSubscription(
2916 h_guid in raw default null,
2917 h_sguid in raw default null,
2918 h_eguid in raw default null)
2919 is
2920 username varchar2(320); -- Username to query
2921 admin_role varchar2(320); -- Role for admin mode
2922 template varchar2(4000); -- Use for construct form select list
2923
2924 l_sysguid raw(16);
2925 l_srctype varchar2(8);
2926 l_srcagnguid raw(16);
2927 l_evtguid raw(16);
2928 l_phase number;
2929 l_status varchar2(8);
2930 l_ruled varchar2(8);
2931 l_outagnguid raw(16);
2932 l_toagnguid raw(16);
2933 l_priority number;
2934 l_rulef varchar2(240);
2935 l_wfptype varchar2(30);
2936 l_wfpname varchar2(30);
2937 l_param varchar2(4000);
2938 l_ownname varchar2(30);
2939 l_owntag varchar2(30);
2940 l_customization_level varchar2(1);
2941 l_desc varchar2(240);
2942
2943 l_system_name varchar2(80);
2944 l_event_name varchar2(240);
2945 l_srcagn_dname varchar2(240);
2946 l_outagn_dname varchar2(240);
2947 l_toagn_dname varchar2(240);
2948 l_wfptype_dname varchar2(80);
2949 l_wfpname_dname varchar2(80);
2950
2951 select_enable varchar2(8);
2952 select_disable varchar2(8);
2953 select_any varchar2(8);
2954 select_local varchar2(8);
2955 select_external varchar2(8);
2956 select_error varchar2(8);
2957 select_key varchar2(8);
2958 select_message varchar2(8);
2959 select_function varchar2(8);
2960 select_agent varchar2(8);
2961 select_workflow varchar2(8);
2962 select_low varchar2(8);
2963 select_high varchar2(8);
2964 select_normal varchar2(8);
2965
2966 select_custom_core varchar2(8);
2967 select_custom_limit varchar2(8);
2968 select_custom_extend varchar2(8);
2969 select_custom_user varchar2(8);
2970
2971 -- priority values
2972 l_low varchar2(6) := '99';
2973 l_normal varchar2(6) := '50';
2974 l_high varchar2(6) := '1';
2975
2976 l_message varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate('WFPREF_LOV'));
2977 l_url varchar2(1000);
2978 l_media varchar2(240) := wfa_html.image_loc;
2979 l_icon varchar2(30) := 'FNDILOV.gif';
2980 l_onmouseover varchar2(240) := wfa_html.replace_onMouseOver_quotes(wf_core.translate('FIND'));
2981
2982 begin
2983 -- Check session and current user
2984 wfa_sec.GetSession(username);
2985 username := upper(username);
2986 wf_events_pkg.setMode;
2987
2988 -- Check Admin Priviledge
2989 admin_role := wf_core.translate('WF_ADMIN_ROLE');
2990 if (admin_role = '*' or
2991 Wf_Directory.IsPerformer(username, admin_role)) then
2992 -- Have admin privledge, do nothing.
2993 null;
2994 else
2995 wf_core.raise('WF_NOTADMIN');
2996 end if;
2997
2998 -- Check if Accessible
2999 wf_event_html.isAccessible('SUBSCRIPTIONS');
3000
3001 -- Set page title
3002 htp.headOpen;
3003
3004 htp.title(wf_core.translate('WFE_EDIT_SUBSC_TITLE'));
3005 wfa_html.create_help_function('wf/links/t_d.htm?'||'T_DEFEVSUB');
3006 fnd_document_management.get_open_dm_display_window;
3007
3008 -- JavaScript for checkagent
3009 /** No longer required - XML Gateway has single consumer queues
3010 which do not require a To Agent
3011 htp.p('<SCRIPT LANGUAGE="JavaScript">');
3012 htp.p('<!-- Hide from old browsers');
3013 htp.p('function checkagentsubmit() {
3014 if (document.WF_SUBSC_EDIT.display_out_agent.value !'||'= "" &&
3015 document.WF_SUBSC_EDIT.display_to_agent.value == "") {
3016 window.alert('''||wf_core.translate('WFE_CHECKAGENT_ERROR')||''');
3017 } else {
3018 document.WF_SUBSC_EDIT.submit();
3019 }
3020 }'
3021 );
3022 htp.p('<!-- done hiding from old browsers -->');
3023 htp.p('</SCRIPT>');
3024 **/
3025
3026 htp.headClose;
3027
3028 -- Page header
3029 wfa_sec.Header(FALSE,
3030 owa_util.get_owa_service_path||'wf_event_html.FindSubscription',
3031 wf_core.translate('WFE_EDIT_SUBSC_TITLE'),
3032 TRUE);
3033
3034 -- populate the appropriate values in the form if editing an exist guid
3035 if (h_guid is not null) then
3036 begin
3037 select SYSTEM_GUID,
3038 SOURCE_TYPE,
3039 SOURCE_AGENT_GUID,
3040 EVENT_FILTER_GUID,
3041 PHASE,
3042 STATUS,
3043 OWNER_NAME,
3044 OWNER_TAG,
3045 RULE_DATA,
3046 RULE_FUNCTION,
3047 OUT_AGENT_GUID,
3048 TO_AGENT_GUID,
3049 PRIORITY,
3050 WF_PROCESS_TYPE,
3051 WF_PROCESS_NAME,
3052 PARAMETERS,
3053 CUSTOMIZATION_LEVEL,
3054 DESCRIPTION
3055 into l_sysguid,
3056 l_srctype,
3057 l_srcagnguid,
3058 l_evtguid,
3059 l_phase,
3060 l_status,
3061 l_ownname,
3062 l_owntag,
3063 l_ruled,
3064 l_rulef,
3065 l_outagnguid,
3066 l_toagnguid,
3067 l_priority,
3068 l_wfptype,
3069 l_wfpname,
3070 l_param,
3071 l_customization_level,
3072 l_desc
3073 from WF_EVENT_SUBSCRIPTIONS
3074 where GUID = h_guid;
3075
3076 -- take care of the double quote problem
3077 -- Description is handle entirely differently, no need for substitution.
3078 -- Single quote is ok becuase html does not treat it special.
3079 l_ownname := replace(l_ownname, '"', '\"');
3080 l_owntag := replace(l_owntag, '"', '\"');
3081
3082 -- Select From System
3083 if (l_srctype = 'EXTERNAL') then
3084 select_external := 'SELECTED';
3085 elsif (l_srctype = 'LOCAL') then
3086 select_local := 'SELECTED';
3087 else
3088 select_error := 'SELECTED';
3089 end if;
3090
3091 -- Select Status
3092 if (l_status = 'ENABLED') then
3093 select_enable := 'SELECTED';
3094 else
3095 select_disable := 'SELECTED';
3096 end if;
3097
3098 -- Select Rule Data
3099 if (l_ruled = 'MESSAGE') then
3100 select_message := 'SELECTED';
3101 else
3102 select_key := 'SELECTED';
3103 end if;
3104
3105 -- Stuff for Customization Level
3106 if l_customization_level = 'C' then
3107 select_custom_core := 'SELECTED';
3108 select_custom_limit := null;
3109 select_custom_extend := null;
3110 select_custom_user := null;
3111 elsif l_customization_level = 'L' then
3112 select_custom_core := null;
3113 select_custom_limit := 'SELECTED';
3114 select_custom_extend := null;
3115 select_custom_user := null;
3116 elsif l_customization_level = 'U' then
3117 select_custom_core := null;
3118 select_custom_limit := null;
3119 select_custom_extend := null;
3120 select_custom_user := 'SELECTED';
3121 end if;
3122
3123 -- Use the same priority criteria as in notification
3124 if (l_priority < 34) then
3125 select_high := 'SELECTED';
3126 l_high := to_char(l_priority); -- to preserve the priority
3127 elsif (l_priority > 67) then
3128 select_low := 'SELECTED';
3129 l_low := to_char(l_priority);
3130 else
3131 select_normal := 'SELECTED';
3132 l_normal := to_char(l_priority);
3133 end if;
3134
3135 exception
3136 when NO_DATA_FOUND then
3137 wf_core.raise('WFE_SUBSC_NOTEXIST');
3138 end;
3139
3140 -- Get System Name
3141 if (l_sysguid is not null) then
3142 begin
3143 select NAME
3144 into l_system_name
3145 from WF_SYSTEMS
3146 where GUID = l_sysguid;
3147
3148 exception
3149 when NO_DATA_FOUND then
3150 wf_core.token('GUID', rawtohex(l_sysguid));
3151 l_system_name := wf_core.translate('WFE_SYSTEM_NOGUID');
3152 end;
3153
3154 l_system_name := replace(l_system_name, '"', '\"');
3155 end if;
3156
3157 -- Get Event Name
3158 if (l_evtguid is not null) then
3159 begin
3160 select NAME
3161 into l_event_name
3162 from WF_EVENTS_VL
3163 where GUID = l_evtguid;
3164
3165 exception
3166 when NO_DATA_FOUND then
3167 wf_core.token('GUID', rawtohex(l_evtguid));
3168 l_event_name := wf_core.translate('WFE_EVENT_NOGUID');
3169 end;
3170
3171 end if;
3172
3173 -- Get Agent Name
3174 if (l_srcagnguid is not null) then
3175 begin
3176 select A.NAME||'@'||S.NAME
3177 into l_srcagn_dname
3178 from WF_AGENTS A, WF_SYSTEMS S
3179 where A.GUID = l_srcagnguid
3180 and A.SYSTEM_GUID (+)= S.GUID;
3181
3182 exception
3183 when NO_DATA_FOUND then
3184 wf_core.token('GUID', rawtohex(l_srcagnguid));
3185 l_srcagn_dname := wf_core.translate('WFE_AGENT_NOGUID');
3186 end;
3187
3188 end if;
3189
3190 if (l_outagnguid is not null) then
3191 begin
3192 select A.NAME||'@'||S.NAME
3193 into l_outagn_dname
3194 from WF_AGENTS A, WF_SYSTEMS S
3195 where A.GUID = l_outagnguid
3196 and A.SYSTEM_GUID (+)= S.GUID;
3197
3198 exception
3199 when NO_DATA_FOUND then
3200 wf_core.token('GUID', rawtohex(l_outagnguid));
3201 l_outagn_dname := wf_core.translate('WFE_AGENT_NOGUID');
3202 end;
3203
3204 end if;
3205
3206 if (l_toagnguid is not null) then
3207 begin
3208 select A.NAME||'@'||S.NAME
3209 into l_toagn_dname
3210 from WF_AGENTS A, WF_SYSTEMS S
3211 where A.GUID = l_toagnguid
3212 and A.SYSTEM_GUID (+)= S.GUID;
3213
3214 exception
3215 when NO_DATA_FOUND then
3216 wf_core.token('GUID', rawtohex(l_toagnguid));
3217 l_toagn_dname := wf_core.translate('WFE_AGENT_NOGUID');
3218 end;
3219
3220 end if;
3221
3222 -- Get WF Process Type Name
3223 if (l_wfptype is not null) then
3224 begin
3225 select DISPLAY_NAME
3226 into l_wfptype_dname
3227 from WF_ITEM_TYPES_VL
3228 where NAME = l_wfptype;
3229
3230 exception
3231 when NO_DATA_FOUND then
3232 l_wfptype_dname := NULL;
3233 -- it is ok if this process does not exist in the local system
3234 end;
3235
3236 l_wfptype_dname := replace(l_wfptype_dname, '"', '\"');
3237 end if;
3238
3239 -- new subscription, default some values
3240 else
3241
3242 l_customization_level := 'U';
3243 select_local := 'SELECTED';
3244 select_enable := 'SELECTED';
3245 select_normal := 'SELECTED';
3246
3247 -- populate the system info
3248 if (h_sguid is not null) then
3249 begin
3250 select NAME
3251 into l_system_name
3252 from WF_SYSTEMS
3253 where GUID = h_sguid;
3254
3255 exception
3256 when NO_DATA_FOUND then
3257 null; -- do not do anything
3258 end;
3259
3260 l_system_name := replace(l_system_name, '"', '\"');
3261 end if;
3262
3263 -- populate the event filter info
3264 if (h_eguid is not null) then
3265 begin
3266 select NAME
3267 into l_event_name
3268 from WF_EVENTS_VL
3269 where GUID = h_eguid;
3270
3271 exception
3272 when NO_DATA_FOUND then
3273 null; -- do not do anything
3274 end;
3275 end if;
3276 end if;
3277
3278 -- Hidden Form
3279 htp.p('<FORM NAME="WF_HIDDEN">');
3280 htp.formHidden('h_out', 'OUT');
3281 htp.formHidden('h_in', 'IN');
3282 htp.formClose;
3283
3284 -- Form
3285 htp.formOpen(curl=>owa_util.get_owa_service_path||
3286 'wf_event_html.SubmitSubscription',
3287 cmethod=>'Get',
3288 cattributes=>'TARGET="_top" NAME="WF_SUBSC_EDIT"');
3289
3290 -- GUID
3291 -- do not display
3292 if (h_guid is not null) then
3293 htp.p('<!-- GUID: '||rawtohex(h_guid)||' -->');
3294 end if;
3295 htp.formHidden('h_guid', rawtohex(h_guid));
3296
3297 htp.tableOpen(calign=>'CENTER', cattributes=>'border=0 width=100%
3298 summary=""');
3299
3300 -- Subscriber
3301 htp.tableRowOpen;
3302 htp.tableData(cvalue=>'<B>'||wf_core.translate('SUBSCRIBER')||'</B>',
3303 calign=>'Left',
3304 ccolspan=>'2',
3305 cattributes=>'id=""');
3306 htp.tableRowClose;
3307
3308 -- System GUID
3309 htp.tableRowOpen;
3310 htp.tableData(cvalue=>'<LABEL FOR="i_system">' ||
3311 wf_core.translate('SYSTEM') || '</LABEL>',
3312 calign=>'Right',cattributes=>'id=""');
3313 htp.formHidden('h_system_guid', l_sysguid);
3314 -- add LOV here:
3315 -- Note: The REPLACE function replaces all the space characters with
3316 -- the proper escape sequence.
3317 l_url := 'javascript:fnd_open_dm_display_window('||''''||
3318 REPLACE('wf_lov.display_lov?p_lov_name='||'h_system_guid'||
3319 '&p_display_name='||'SYSTEM'||
3320 '&p_validation_callback=wf_event_html.wf_system_val'||
3321 '&p_dest_hidden_field=top.opener.parent.document.WF_SUBSC_EDIT.h_system_guid.value'||
3322 '&p_current_value=top.opener.parent.document.WF_SUBSC_EDIT.display_system.value'||
3323 '&p_display_key='||'Y'||
3324 '&p_dest_display_field=top.opener.parent.document.WF_SUBSC_EDIT.display_system.value',
3325 ' ', '%20')||''''||',500,500)';
3326
3327 -- print everything together so there is no gap.
3328 htp.tabledata(htf.formText(cname=>'display_system', csize=>32,
3329 cmaxlength=>240,cattributes=>'id="i_system"')||
3330 '<A href='||l_url||'>'||
3331 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
3332 l_message||'" onmouseover="window.status='||''''||
3333 l_message||''''||';return true"></A>',
3334 cattributes=>'id=""');
3335
3336 htp.tableRowClose;
3337
3338 -- Trigger
3339 htp.tableRowOpen;
3340 htp.tableData(cvalue=>'<B>'||wf_core.translate('TRIGGER')||'</B>',
3341 calign=>'Left',
3342 ccolspan=>'2',cattributes=>'id=""');
3343 htp.tableRowClose;
3344
3345 -- Source Type
3346 template := htf.formSelectOpen('h_source_type',cattributes=>'id="i_source_type"')
3347 ||wf_core.newline||
3348 htf.formSelectOption(wf_core.translate('LOCAL'),
3349 select_local,'VALUE="LOCAL"')
3350 ||wf_core.newline||
3351 htf.formSelectOption(wf_core.translate('EXTERNAL'),
3352 select_external,'VALUE="EXTERNAL"')
3353 ||wf_core.newline||
3354 htf.formSelectOption(wf_core.translate('ERROR'),
3355 select_error,'VALUE="ERROR"')
3356 ||wf_core.newline||
3357 htf.formSelectClose;
3358 htp.tableRowOpen;
3359 htp.tableData(cvalue=>'<LABEL FOR="i_source_type">' ||
3360 wf_core.translate('SOURCE_TYPE') || '</LABEL>',
3361 calign=>'Right',cattributes=>'id=""');
3362 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
3363 htp.tableRowClose;
3364
3365 -- Event Filter GUID
3366 htp.tableRowOpen;
3367 htp.tableData(cvalue=>'<LABEL FOR="i_event">' ||
3368 wf_core.translate('EVENT_FILTER') || '</LABEL>',
3369 calign=>'right',cattributes=>'id=""');
3370 htp.formHidden('h_event_guid', l_evtguid);
3371
3372 -- add LOV here:
3373 -- Note: The REPLACE function replaces all the space characters with
3374 -- the proper escape sequence.
3375 l_url := 'javascript:fnd_open_dm_display_window('||''''||
3376 REPLACE('wf_lov.display_lov?p_lov_name='||'h_event_guid'||
3377 '&p_display_name='||'WFE_FIND_EVENT'||
3378 '&p_validation_callback=wf_event_html.wf_event_val'||
3379 '&p_dest_hidden_field=top.opener.parent.document.WF_SUBSC_EDIT.h_event_guid.value'||
3380 '&p_current_value=top.opener.parent.document.WF_SUBSC_EDIT.display_event.value'||
3381 '&p_display_key='||'Y'||
3382 '&p_dest_display_field=top.opener.parent.document.WF_SUBSC_EDIT.display_event.value',
3383 ' ', '%20')||''''||',500,500)';
3384
3385 -- print everything together so there is no gap.
3386 htp.tabledata(htf.formText(cname=>'display_event', csize=>60,
3387 cmaxlength=>240,cattributes=>'id="i_event"')||
3388 '<A href='||l_url||'>'||
3389 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
3390 l_message||'" onmouseover="window.status='||''''||
3391 l_message||''''||';return true"></A>',
3392 cattributes=>'id=""');
3393
3394 htp.tableRowClose;
3395
3396 -- Source Agent GUID
3397 htp.tableRowOpen;
3398 htp.tableData(cvalue=>'<LABEL FOR="i_source_agent">' ||
3399 wf_core.translate('SOURCE_AGENT') || '</LABEL>',
3400 calign=>'right',cattributes=>'id=""');
3401 htp.formHidden('h_source_agent_guid', l_srcagnguid);
3402
3403 -- add LOV here:
3404 -- Note: The REPLACE function replaces all the space characters with
3405 -- the proper escape sequence.
3406 l_url := 'javascript:fnd_open_dm_display_window('||''''||
3407 REPLACE('wf_lov.display_lov?p_lov_name='||'h_source_agent_guid'||
3408 '&p_display_name='||'WFE_FIND_AGENT'||
3409 '&p_validation_callback=wf_event_html.wf_agent_val'||
3410 '&p_dest_hidden_field=top.opener.parent.document.WF_SUBSC_EDIT.h_source_agent_guid.value'||
3411 '&p_current_value=top.opener.parent.document.WF_SUBSC_EDIT.display_source_agent.value'||
3412 '&p_display_key='||'Y'||
3413 '&p_dest_display_field=top.opener.parent.document.WF_SUBSC_EDIT.display_source_agent.value',
3414 ' ', '%20')||''''||',500,500)';
3415
3416 -- print everything together so there is no gap.
3417 htp.tabledata(htf.formText(cname=>'display_source_agent', csize=>60,
3418 cmaxlength=>240,cattributes=>'id="i_source_agent"')||
3419 '<A href='||l_url||'>'||
3420 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
3421 l_message||'" onmouseover="window.status='||''''||
3422 l_message||''''||';return true"></A>',
3423 cattributes=>'id=""');
3424
3425 htp.tableRowClose;
3426
3427 -- Execution Control
3428 htp.tableRowOpen;
3429 htp.tableData(cvalue=>'<B>'||wf_core.translate('EXECUTION_CONTROL')||'</B>',
3430 calign=>'Left',
3431 ccolspan=>'2',cattributes=>'id=""');
3432 htp.tableRowClose;
3433
3434 -- Phase
3435 htp.tableRowOpen;
3436 htp.tableData(cvalue=>'<LABEL FOR="i_phase">' ||
3437 wf_core.translate('PHASE') || '</LABEL>',
3438 calign=>'Right',cattributes=>'id=""');
3439 htp.tableData(cvalue=>htf.formText(cname=>'h_phase', csize=>16,
3440 cmaxlength=>16, cvalue=>to_char(l_phase),
3441 cattributes=>'id="i_phase"'),
3442 calign=>'Left',cattributes=>'id=""');
3443 htp.tableRowClose;
3444
3445 -- Status
3446 template := htf.formSelectOpen('h_status',cattributes=>'id="i_status"')
3447 ||wf_core.newline||
3448 htf.formSelectOption(wf_core.translate('ENABLED'),
3449 select_enable,'VALUE="ENABLED"')
3450 ||wf_core.newline||
3451 htf.formSelectOption(wf_core.translate('DISABLED'),
3452 select_disable,'VALUE="DISABLED"')
3453 ||wf_core.newline||
3454 htf.formSelectClose;
3455 htp.tableRowOpen;
3456 htp.tableData(cvalue=>'<LABEL FOR="i_status">' ||
3457 wf_core.translate('STATUS') || '</LABEL>',
3458 calign=>'Right',cattributes=>'id=""');
3459 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
3460 htp.tableRowClose;
3461
3462 -- Rule Data
3463 template := htf.formSelectOpen('h_rule_data',cattributes=>'id="i_rule_data"')
3464 ||wf_core.newline||
3465 htf.formSelectOption(wf_core.translate('KEY'),
3466 select_key,'VALUE="KEY"')
3467 ||wf_core.newline||
3468 htf.formSelectOption(wf_core.translate('MESSAGE'),
3469 select_message,'VALUE="MESSAGE"')
3470 ||wf_core.newline||
3471 htf.formSelectClose;
3472 htp.tableRowOpen;
3473 htp.tableData(cvalue=>'<LABEL FOR="i_rule_data">' ||
3474 wf_core.translate('RULE_DATA') || '</LABEL>',
3475 calign=>'Right', cattributes=>'id=""');
3476 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
3477 htp.tableRowClose;
3478
3479 -- Action
3480 htp.tableRowOpen;
3481 htp.tableData(cvalue=>'<B>'||wf_core.translate('ACTION')||'</B>',
3482 calign=>'Left',
3483 ccolspan=>'2',cattributes=>'id=""');
3484 htp.tableRowClose;
3485
3486 -- Rule Function
3487 htp.tableRowOpen;
3488 htp.tableData(cvalue=>'<LABEL FOR="i_rule_function">' ||
3489 wf_core.translate('RULE_FUNCTION') || '</LABEL>',
3490 calign=>'Right',cattributes=>'id=""');
3491 htp.tableData(cvalue=>htf.formText(cname=>'h_rule_function', csize=>60,
3492 cmaxlength=>240, cvalue=>l_rulef,
3493 cattributes=>'id="i_rule_function"' ),
3494 calign=>'Left',cattributes=>'id=""');
3495 htp.tableRowClose;
3496
3497 -- WF Process Type
3498 htp.tableRowOpen;
3499 htp.tableData(cvalue=>'<LABEL FOR="i_process_type">' ||
3500 wf_core.translate('WF_PROCESS_TYPE') || '</LABEL>',
3501 calign=>'Right',cattributes=>'id=""');
3502 htp.formHidden('h_wfptype_dname', l_wfptype_dname);
3503
3504 -- add LOV here:
3505 -- Note: The REPLACE function replaces all the space characters with
3506 -- the proper escape sequence.
3507 l_url := 'javascript:fnd_open_dm_display_window('||''''||
3508 REPLACE('wf_lov.display_lov?p_lov_name='||'h_wfptype_dname'||
3509 '&p_display_name='||'ITEMTYPE'||
3510 '&p_validation_callback=wf_event_html.wf_itemtype_val'||
3511 '&p_dest_hidden_field=top.opener.parent.document.WF_SUBSC_EDIT.h_wfptype_dname.value'||
3512 '&p_current_value=top.opener.parent.document.WF_SUBSC_EDIT.h_wfptype.value'||
3513 '&p_display_key='||'Y'||
3514 '&p_dest_display_field=top.opener.parent.document.WF_SUBSC_EDIT.h_wfptype.value',
3515 ' ', '%20')||''''||',500,500)';
3516
3517 -- print everything together so there is no gap.
3518 htp.tableData(cvalue=>htf.formText(cname=>'h_wfptype', csize=>30,
3519 cmaxlength=>30, cvalue=>l_wfptype,
3520 cattributes=>'id="i_process_type"')||
3521 '<A href='||l_url||'>'||
3522 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
3523 l_message||'" onmouseover="window.status='||''''||
3524 l_message||''''||';return true"></A>',
3525 calign=>'Left',cattributes=>'id=""');
3526 htp.tableRowClose;
3527
3528 -- WF Process Name
3529 htp.tableRowOpen;
3530 htp.tableData(cvalue=>'<LABEL FOR="i_process_name">' ||
3531 wf_core.translate('WF_PROCESS_NAME') || '</LABEL>',
3532 calign=>'Right',cattributes=>'id=""');
3533 htp.formHidden('h_wfptn'); -- holding the hidden field value
3534
3535 -- add LOV here:
3536 -- Note: The REPLACE function replaces all the space characters with
3537 -- the proper escape sequence.
3538 l_url := 'javascript:fnd_open_dm_display_window('||''''||
3539 REPLACE('wf_lov.display_lov?p_lov_name='||'h_wfpname'||
3540 '&p_display_name='||'PROCESS'||
3541 '&p_validation_callback=wf_event_html.wf_processname_val'||
3542 '&p_dest_hidden_field=top.opener.parent.document.WF_SUBSC_EDIT.h_wfptn.value'||
3543 '&p_current_value=top.opener.parent.document.WF_SUBSC_EDIT.h_wfpname.value'||
3544 '&p_dest_display_field=top.opener.parent.document.WF_SUBSC_EDIT.h_wfpname.value'||
3545 '&p_display_key='||'Y'||
3546 '&p_param1=top.opener.parent.document.WF_SUBSC_EDIT.h_wfptype.value',
3547 ' ', '%20')||''''||',500,500)';
3548
3549 -- print everything together so there is no gap.
3550 htp.tableData(cvalue=>htf.formText(cname=>'h_wfpname', csize=>30,
3551 cmaxlength=>30, cvalue=>l_wfpname,
3552 cattributes=>'id="i_process_name"')||
3553 '<A href='||l_url||'>'||
3554 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
3555 l_message||'" onmouseover="window.status='||''''||
3556 l_message||''''||';return true"></A>',
3557 calign=>'Left',cattributes=>'id=""');
3558
3559 htp.tableRowClose;
3560
3561 -- Out Agent GUID
3562 htp.tableRowOpen;
3563 htp.tableData(cvalue=>'<LABEL FOR="i_out_agent">' ||
3564 wf_core.translate('OUT_AGENT') || '</LABEL>',
3565 calign=>'right',cattributes=>'id=""');
3566 htp.formHidden('h_out_agent_guid', l_outagnguid);
3567
3568 -- add LOV here:
3569 -- Note: The REPLACE function replaces all the space characters with
3570 -- the proper escape sequence.
3571 l_url := 'javascript:fnd_open_dm_display_window('||''''||
3572 REPLACE('wf_lov.display_lov?p_lov_name='||'h_out_agent_guid'||
3573 '&p_display_name='||'AGENT'||
3574 '&p_validation_callback=wf_event_html.wf_agent_val'||
3575 '&p_dest_hidden_field=top.opener.parent.document.WF_SUBSC_EDIT.h_out_agent_guid.value'||
3576 '&p_current_value=top.opener.parent.document.WF_SUBSC_EDIT.display_out_agent.value'||
3577 '&p_dest_display_field=top.opener.parent.document.WF_SUBSC_EDIT.display_out_agent.value'||
3578 '&p_display_key='||'Y'||
3579 '&p_param1=top.opener.parent.document.WF_HIDDEN.h_out.value'||
3580 '&p_param2=top.opener.parent.document.WF_SUBSC_EDIT.display_system.value',
3581 ' ', '%20')||''''||',500,500)';
3582
3583 -- print everything together so there is no gap.
3584 htp.tabledata(htf.formText(cname=>'display_out_agent', csize=>60,
3585 cmaxlength=>240,
3586 cattributes=>'id="i_out_agent"')||
3587 '<A href='||l_url||'>'||
3588 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
3589 l_message||'" onmouseover="window.status='||''''||
3590 l_message||''''||';return true"></A>',
3591 cattributes=>'id=""');
3592
3593 htp.tableRowClose;
3594
3595 -- To Agent GUID
3596 htp.tableRowOpen;
3597 htp.tableData(cvalue=>'<LABEL FOR="i_to_agent">'
3598 ||wf_core.translate('TO_AGENT') || '</LABEL>',
3599 calign=>'right',cattributes=>'id=""');
3600 htp.formHidden('h_to_agent_guid', l_toagnguid);
3601
3602 -- add LOV here:
3603 -- Note: The REPLACE function replaces all the space characters with
3604 -- the proper escape sequence.
3605 l_url := 'javascript:fnd_open_dm_display_window('||''''||
3606 REPLACE('wf_lov.display_lov?p_lov_name='||'h_to_agent_guid'||
3607 '&p_display_name='||'AGENT'||
3608 '&p_validation_callback=wf_event_html.wf_agent_val'||
3609 '&p_dest_hidden_field=top.opener.parent.document.WF_SUBSC_EDIT.h_to_agent_guid.value'||
3610 '&p_current_value=top.opener.parent.document.WF_SUBSC_EDIT.display_to_agent.value'||
3611 '&p_dest_display_field=top.opener.parent.document.WF_SUBSC_EDIT.display_to_agent.value'||
3612 '&p_display_key='||'Y'||
3613 '&p_param1=top.opener.parent.document.WF_HIDDEN.h_in.value',
3614 ' ', '%20')||''''||',500,500)';
3615
3616 -- print everything together so there is no gap.
3617 htp.tabledata(htf.formText(cname=>'display_to_agent', csize=>60,
3618 cmaxlength=>240,
3619 cattributes=>'id="i_to_agent"')||
3620 '<A href='||l_url||'>'||
3621 '<IMG src="'||l_media||l_icon||'" border=0 alt="'||
3622 l_message||'" onmouseover="window.status='||''''||
3623 l_message||''''||';return true"></A>',
3624 cattributes=>'id=""');
3625
3626 htp.tableRowClose;
3627
3628 -- Priority
3629 template := htf.formSelectOpen('h_priority',cattributes=>'id="i_priority"')
3630 ||wf_core.newline||
3631 htf.formSelectOption(wf_core.translate('NORMAL'),
3632 select_normal,'VALUE='||l_normal)
3633 ||wf_core.newline||
3634 htf.formSelectOption(wf_core.translate('HIGH'),
3635 select_high,'VALUE='||l_high)
3636 ||wf_core.newline||
3637 htf.formSelectOption(wf_core.translate('LOW'),
3638 select_low,'VALUE='||l_low)
3639 ||wf_core.newline||
3640 htf.formSelectClose;
3641 htp.tableRowOpen;
3642 htp.tableData(cvalue=>'<LABEL FOR="i_priority">' ||
3643 wf_core.translate('PRIORITY') || '</LABEL>',
3644 calign=>'Right',cattributes=>'id=""');
3645 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
3646 htp.tableRowClose;
3647
3648 -- Parameters
3649 htp.tableRowOpen;
3650 htp.tableData(cvalue=>'<LABEL FOR="i_parameters">' ||
3651 wf_core.translate('PARAMETERS') || '</LABEL>',
3652 calign=>'Right',cattributes=>'id=""');
3653 htp.tableData(cvalue=>htf.formTextareaOpen2(
3654 cname=>'h_parameters',
3655 nrows=>2,
3656 ncolumns=>60,
3657 cwrap=>'SOFT',
3658 cattributes=>'maxlength=4000
3659 id="i_parameters"')
3660 ||l_param
3661 ||htf.formTextareaClose,
3662 calign=>'Left',cattributes=>'id=""');
3663 htp.tableRowClose;
3664
3665 -- Documentation
3666 htp.tableRowOpen;
3667 htp.tableData(cvalue=>'<B>'||wf_core.translate('DOCUMENTATION')||'</B>',
3668 calign=>'Left',
3669 ccolspan=>'2',cattributes=>'id=""');
3670 htp.tableRowClose;
3671
3672 -- Owner Name
3673 htp.tableRowOpen;
3674 htp.tableData(cvalue=>'<LABEL FOR="i_owner_name">' ||
3675 wf_core.translate('OWNER_NAME') || '</LABEL>',
3676 calign=>'Right',cattributes=>'id=""');
3677 htp.tableData(cvalue=>htf.formText(cname=>'h_owner_name', csize=>30,
3678 cmaxlength=>30,
3679 cattributes=>'id="i_owner_name"'),
3680 calign=>'Left',cattributes=>'id=""');
3681 htp.tableRowClose;
3682
3683 -- Owner Tag
3684 htp.tableRowOpen;
3685 htp.tableData(cvalue=>'<LABEL FOR="i_owner_tag">' ||
3686 wf_core.translate('OWNER_TAG') || '</LABEL>',
3687 calign=>'Right',cattributes=>'id=""');
3688 htp.tableData(cvalue=>htf.formText(cname=>'h_owner_tag', csize=>30,
3689 cmaxlength=>30,
3690 cattributes=>'id="i_owner_tag"'),
3691 calign=>'Left',cattributes=>'id=""');
3692 htp.tableRowClose;
3693
3694 -- Customization Level
3695 if wf_events_pkg.g_Mode = 'FORCE' then
3696 template := htf.formSelectOpen('h_custom_level',cattributes=>'id="i_custom_level"')
3697 ||wf_core.newline||
3698 htf.formSelectOption(wf_core.translate('WFE_CUSTOM_LEVEL_C'),
3699 select_custom_core,'VALUE="C"')
3700 ||wf_core.newline||
3701 htf.formSelectOption(wf_core.translate('WFE_CUSTOM_LEVEL_L'),
3702 select_custom_limit,'VALUE="L"')
3703 ||wf_core.newline||
3704 htf.formSelectOption(wf_core.translate('WFE_CUSTOM_LEVEL_U'),
3705 select_custom_user,'VALUE="U"')
3706 ||wf_core.newline||
3707 htf.formSelectClose;
3708 htp.tableRowOpen;
3709 htp.tableData(cvalue=>'<LABEL FOR="i_custom_level">' ||
3710 wf_core.translate('WFE_CUSTOM_LEVEL') || '</LABEL>',
3711 calign=>'Right',cattributes=>'id=""');
3712 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
3713 htp.tableRowClose;
3714 else
3715 if l_customization_level='L' then -- Bug 2756800
3716 template := htf.formSelectOpen('h_custom_level',cattributes=>'id="i_custom_level"')
3717 ||wf_core.newline||
3718 htf.formSelectOption(wf_core.translate('WFE_CUSTOM_LEVEL_C'),
3719 select_custom_core,'VALUE="C"')
3720 ||wf_core.newline||
3721 htf.formSelectOption(wf_core.translate('WFE_CUSTOM_LEVEL_L'),
3722 select_custom_limit,'VALUE="L"')
3723 ||wf_core.newline||
3724 htf.formSelectClose;
3725 htp.tableRowOpen;
3726 htp.tableData(cvalue=>'<LABEL FOR="i_custom_level">' ||
3727 wf_core.translate('WFE_CUSTOM_LEVEL') || '</LABEL>',
3728 calign=>'Right',cattributes=>'id=""');
3729 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
3730 htp.tableRowClose;
3731 else
3732 htp.tableRowOpen;
3733 htp.tableData(cvalue=>wf_core.translate('WFE_CUSTOM_LEVEL'),
3734 calign=>'Right',cattributes=>'id=""');
3735 htp.tableData(cvalue=>wf_core.translate('WFE_CUSTOM_LEVEL_'||l_customization_level),
3736 calign=>'Left',cattributes=>'id=""');
3737 htp.formHidden('h_custom_level', l_customization_level);
3738 end if; -- Bug 2756800
3739 end if;
3740
3741 -- Description
3742 htp.tableRowOpen;
3743 htp.tableData(cvalue=>'<LABEL FOR="i_description">' ||
3744 wf_core.translate('DESCRIPTION') || '</LABEL>',
3745 calign=>'Right',cattributes=>'id=""');
3746 htp.tableData(cvalue=>htf.formTextareaOpen2(
3747 cname=>'h_description',
3748 nrows=>2,
3749 ncolumns=>60,
3750 cwrap=>'SOFT',
3751 cattributes=>'maxlength=240 id="i_description"')
3752 ||l_desc
3753 ||htf.formTextareaClose,
3754 calign=>'Left',cattributes=>'id=""');
3755 htp.tableRowClose;
3756
3757 -- URL to go back to
3758 htp.formHidden('url', 'Wf_Event_Html.ListSubscriptions');
3759
3760 htp.tableClose;
3761 htp.formClose;
3762
3763 -- add values that may contain double quote back through javascript
3764 -- ### although some of the values are now the internal name; hence,
3765 -- ### no more double quote for them, but we left this mechanism behind
3766 -- ### for now.
3767 --
3768 htp.p('<SCRIPT>');
3769 htp.p(' document.WF_SUBSC_EDIT.h_owner_name.value="'||l_ownname||'"');
3770 htp.p(' document.WF_SUBSC_EDIT.h_owner_tag.value="'||l_owntag||'"');
3771 htp.p(' document.WF_SUBSC_EDIT.display_event.value="'||l_event_name||'"');
3772 htp.p(' document.WF_SUBSC_EDIT.display_system.value="'||
3773 l_system_name||'"');
3774 htp.p(' document.WF_SUBSC_EDIT.display_source_agent.value="'||
3775 l_srcagn_dname||'"');
3776 htp.p(' document.WF_SUBSC_EDIT.display_out_agent.value="'||
3777 l_outagn_dname||'"');
3778 htp.p(' document.WF_SUBSC_EDIT.display_to_agent.value="'||
3779 l_toagn_dname||'"');
3780 htp.p('</SCRIPT>');
3781
3782 -- Add submit button
3783 htp.tableopen (calign=>'CENTER', cattributes=>'summary=""');
3784 htp.tableRowOpen;
3785
3786 htp.p('<TD ID="">');
3787
3788 wfa_html.create_reg_button ('javascript:document.WF_SUBSC_EDIT.submit()',
3789 wf_core.translate('SUBMIT'),
3790 wfa_html.image_loc,
3791 null,
3792 wf_core.translate('SUBMIT'));
3793
3794 htp.p('</TD>');
3795 htp.p('<TD ID="">');
3796 wfa_html.create_reg_button ('javascript:history.back()',
3797 wf_core.translate ('CANCEL'),
3798 wfa_html.image_loc,
3799 null,
3800 wf_core.translate ('CANCEL'));
3801
3802 htp.p('</TD>');
3803
3804 htp.tableRowClose;
3805 htp.tableClose;
3806
3807 wfa_sec.Footer;
3808 htp.htmlClose;
3809
3810 exception
3811 when OTHERS then
3812 rollback;
3813 wf_core.context('WF_EVENT_HTML', 'EditSubscription');
3814 wfe_html_util.Error;
3815 end EditSubscription;
3816
3817 --
3818 -- SubmitEvent
3819 -- Submit an event to database
3820 -- IN
3821 -- h_guid - Global unique id for an event
3822 -- h_name - Event name
3823 -- h_type - Event type: EVENT|GROUP
3824 -- h_status - Event status: ENABLED|DISABLED
3825 -- h_generate_function - Event function
3826 -- h_owner_name
3827 -- h_owner_tag
3828 -- h_display_name
3829 -- h_description
3830 -- h_custom_level
3831 -- NOTE
3832 --
3833 procedure SubmitEvent(
3834 h_guid in varchar2,
3835 h_name in varchar2,
3836 h_display_name in varchar2,
3837 h_description in varchar2,
3838 h_type in varchar2,
3839 h_status in varchar2,
3840 h_generate_function in varchar2,
3841 h_owner_name in varchar2,
3842 h_owner_tag in varchar2,
3843 h_custom_level in varchar2,
3844 url in varchar2)
3845 is
3846 username varchar2(320); -- Username to query
3847 admin_role varchar2(320); -- Role for admin mode
3848
3849 l_guid raw(16);
3850 row_id varchar2(30);
3851 begin
3852 -- Check session and current user
3853 wfa_sec.GetSession(username);
3854 username := upper(username);
3855 wf_events_pkg.setMode;
3856
3857 -- Check Admin Priviledge
3858 admin_role := wf_core.translate('WF_ADMIN_ROLE');
3859 if (admin_role = '*' or
3860 Wf_Directory.IsPerformer(username, admin_role)) then
3861 -- Have admin privledge, do nothing.
3862 null;
3863 else
3864 wf_core.raise('WF_NOTADMIN');
3865 end if;
3866
3867 if (h_guid is not null) then
3868 l_guid := hextoraw(h_guid);
3869
3870 -- update
3871 Wf_Events_Pkg.Update_Row(
3872 X_GUID=>l_guid,
3873 X_NAME=>h_name,
3874 X_TYPE=>h_type,
3875 X_STATUS=>h_status,
3876 X_GENERATE_FUNCTION=>h_generate_function,
3877 X_OWNER_NAME=>h_owner_name,
3878 X_OWNER_TAG=>h_owner_tag,
3879 X_DISPLAY_NAME=>h_display_name,
3880 X_DESCRIPTION=>h_description,
3881 X_CUSTOMIZATION_LEVEL=>h_custom_level,
3882 X_LICENSED_FLAG=>'N'
3883 );
3884
3885 else
3886 l_guid := sys_guid();
3887
3888 -- insert
3889 Wf_Events_Pkg.Insert_Row(
3890 X_ROWID=>row_id,
3891 X_GUID=>l_guid,
3892 X_NAME=>h_name,
3893 X_TYPE=>h_type,
3894 X_STATUS=>h_status,
3895 X_GENERATE_FUNCTION=>h_generate_function,
3896 X_OWNER_NAME=>h_owner_name,
3897 X_OWNER_TAG=>h_owner_tag,
3898 X_DISPLAY_NAME=>h_display_name,
3899 X_DESCRIPTION=>h_description,
3900 X_CUSTOMIZATION_LEVEL=>h_custom_level,
3901 X_LICENSED_FLAG=>'N'
3902 );
3903
3904 end if;
3905
3906 -- If url is not specified, we know that it is from the edit event screen
3907 -- for group, so return to that screen with the newly created event guid.
3908 if (url is null or url = '') then
3909 Wf_Event_Html.EditEvent(l_guid);
3910
3911 -- Go to a specific url
3912 else
3913 Wfe_Html_Util.gotoURL(url);
3914 end if;
3915
3916 exception
3917 when OTHERS then
3918 rollback;
3919 wf_core.context('WF_EVENT_HTML', 'SubmitEvent', rawtohex(l_guid));
3920 wfe_html_util.Error;
3921 end SubmitEvent;
3922
3923 --
3924 -- SubmitSelectedGEvents
3925 -- Process selected events from group for deletion or addition
3926 -- IN
3927 -- h_gguid - Global unique id for the group event
3928 -- h_guids - Array of global unique id of events
3929 -- action - DELETE|ADD|FIND
3930 -- NOTE
3931 --
3932 procedure SubmitSelectedGEvents(
3933 h_gguid in raw,
3934 h_guids in hguid_array,
3935 action in varchar2,
3936 url in varchar2)
3937 is
3938 l_guid raw(16);
3939 begin
3940 if (h_guids.COUNT = 1 and (action = 'DELETE' or action = 'ADD')) then
3941 wf_core.raise('WFE_EVENT_NOVALUE');
3942 elsif (action = 'FIND') then
3943 -- action is FIND
3944 -- so find event for EditGroup
3945 -- ignore hguid_array
3946 Wf_Event_Html.FindEvent(h_gguid);
3947 return;
3948 elsif (action = 'DELETE') then
3949 l_guid := hextoraw(h_guids(2));
3950 Wf_Event_Html.DeleteSelectedGEvents(h_gguid, h_guids);
3951 elsif (action = 'ADD') then
3952 Wf_Event_Html.AddSelectedGEvents(h_gguid, h_guids);
3953 end if;
3954
3955 Wfe_Html_Util.gotoURL(url);
3956
3957 exception
3958 when OTHERS then
3959 rollback;
3960 wf_core.context('WF_EVENT_HTML', 'SubmitSelectedGEvents',
3961 rawtohex(h_gguid), url);
3962 wfe_html_util.Error;
3963 end SubmitSelectedGEvents;
3964
3965 --
3966 -- SubmitSystem
3967 -- Submit an system to database
3968 -- IN
3969 -- h_guid - Global unique id for system
3970 -- h_name - System name
3971 -- h_display_name
3972 -- h_description
3973 -- NOTE
3974 --
3975 procedure SubmitSystem(
3976 h_guid in varchar2,
3977 h_name in varchar2,
3978 h_display_name in varchar2,
3979 h_description in varchar2,
3980 display_master in varchar2,
3981 h_master_guid in varchar2,
3982 url in varchar2)
3983 is
3984 username varchar2(320); -- Username to query
3985 admin_role varchar2(320); -- Role for admin mode
3986
3987 l_guid raw(16);
3988 l_mguid raw(16);
3989 row_id varchar2(30);
3990 begin
3991 -- Check session and current user
3992 wfa_sec.GetSession(username);
3993 username := upper(username);
3994 wf_events_pkg.setMode;
3995
3996 -- Check Admin Priviledge
3997 admin_role := wf_core.translate('WF_ADMIN_ROLE');
3998 if (admin_role = '*' or
3999 Wf_Directory.IsPerformer(username, admin_role)) then
4000 -- Have admin privledge, do nothing.
4001 null;
4002 else
4003 wf_core.raise('WF_NOTADMIN');
4004 end if;
4005
4006 l_mguid := hextoraw(h_master_guid);
4007 Wf_Event_Html.Validate_System_Name(display_master, l_mguid);
4008
4009 if (h_guid is not null) then
4010 l_guid := hextoraw(h_guid);
4011
4012 -- update
4013 Wf_Systems_Pkg.Update_Row(
4014 X_GUID=>l_guid,
4015 X_NAME=>h_name,
4016 X_MASTER_GUID=>l_mguid,
4017 X_DISPLAY_NAME=>h_display_name,
4018 X_DESCRIPTION=>h_description
4019 );
4020
4021 else
4022 l_guid := sys_guid();
4023
4024 -- insert
4025 Wf_Systems_Pkg.Insert_Row(
4026 X_ROWID=>row_id,
4027 X_GUID=>l_guid,
4028 X_NAME=>h_name,
4029 X_MASTER_GUID=>l_mguid,
4030 X_DISPLAY_NAME=>h_display_name,
4031 X_DESCRIPTION=>h_description
4032 );
4033
4034 end if;
4035
4036 -- all done go to a predetermined screen like ListSystems
4037 Wfa_Html.GotoURL(url, '_top');
4038
4039 exception
4040 when OTHERS then
4041 rollback;
4042 wf_core.context('WF_EVENT_HTML', 'SubmitSystem', rawtohex(l_guid));
4043 wfe_html_util.Error;
4044 end SubmitSystem;
4045
4046 --
4047 -- SubmitAgent
4048 -- Submit an agent to database
4049 -- IN
4050 -- h_guid - Global unique id for an agent
4051 -- h_display_name
4052 -- h_description
4053 -- h_protocol
4054 -- h_address
4055 -- display_system
4056 -- h_system_guid
4057 -- h_direction
4058 -- h_status - Agent status: ENABLED|DISABLED
4059 -- NOTE
4060 --
4061 procedure SubmitAgent(
4062 h_guid in varchar2,
4063 h_name in varchar2,
4064 h_display_name in varchar2,
4065 h_description in varchar2,
4066 h_protocol in varchar2,
4067 h_address in varchar2,
4068 display_system in varchar2,
4069 h_system_guid in varchar2,
4070 h_qhandler in varchar2,
4071 h_qname in varchar2,
4072 h_direction in varchar2,
4073 h_status in varchar2,
4074 url in varchar2)
4075 is
4076 username varchar2(320); -- Username to query
4077 admin_role varchar2(320); -- Role for admin mode
4078
4079 l_guid raw(16);
4080 l_system_guid raw(16);
4081 row_id varchar2(30);
4082 begin
4083 -- Check session and current user
4084 wfa_sec.GetSession(username);
4085 username := upper(username);
4086 wf_events_pkg.setMode;
4087
4088 -- Check Admin Priviledge
4089 admin_role := wf_core.translate('WF_ADMIN_ROLE');
4090 if (admin_role = '*' or
4091 Wf_Directory.IsPerformer(username, admin_role)) then
4092 -- Have admin privledge, do nothing.
4093 null;
4094 else
4095 wf_core.raise('WF_NOTADMIN');
4096 end if;
4097
4098 l_system_guid := hextoraw(h_system_guid);
4099 Wf_Event_Html.Validate_System_Name(display_system, l_system_guid);
4100
4101 if (h_guid is not null) then
4102 l_guid := hextoraw(h_guid);
4103
4104 -- update
4105 Wf_Agents_Pkg.Update_Row (
4106 X_GUID=>l_guid,
4107 X_NAME=>upper(h_name),
4108 X_SYSTEM_GUID=>l_system_guid,
4109 X_PROTOCOL=>h_protocol,
4110 X_ADDRESS=>h_address,
4111 X_QUEUE_HANDLER=>upper(h_qhandler),
4112 X_QUEUE_NAME=>upper(h_qname),
4113 X_DIRECTION=>h_direction,
4114 X_STATUS=>h_status,
4115 X_DISPLAY_NAME=>h_display_name,
4116 X_DESCRIPTION=>h_description
4117 );
4118
4119 else
4120 l_guid := sys_guid();
4121
4122 -- insert
4123 Wf_Agents_Pkg.Insert_Row (
4124 X_ROWID=>row_id,
4125 X_GUID=>l_guid,
4126 X_NAME=>upper(h_name),
4127 X_SYSTEM_GUID=>l_system_guid,
4128 X_PROTOCOL=>h_protocol,
4129 X_ADDRESS=>h_address,
4130 X_QUEUE_HANDLER=>upper(h_qhandler),
4131 X_QUEUE_NAME=>upper(h_qname),
4132 X_DIRECTION=>h_direction,
4133 X_STATUS=>h_status,
4134 X_DISPLAY_NAME=>h_display_name,
4135 X_DESCRIPTION=>h_description
4136 );
4137 end if;
4138
4139 -- all done go to a predetermined screen like ListAgents
4140 Wfa_Html.GotoURL(url, '_top');
4141
4142 exception
4143 when OTHERS then
4144 rollback;
4145 wf_core.context('WF_EVENT_HTML', 'SubmitAgent', rawtohex(l_guid));
4146 wfe_html_util.Error;
4147 end SubmitAgent;
4148
4149 --
4150 -- SubmitSubscription
4151 -- Submit a subscription to database
4152 -- IN
4153 -- h_guid - Global unique id for an agent
4154 -- h_display_name
4155 -- h_description
4156 -- h_protocol
4157 -- h_address
4158 -- h_system_guid
4159 -- h_direction
4160 -- h_status - Agent status: ENABLED|DISABLED
4161 -- NOTE
4162 --
4163 procedure SubmitSubscription(
4164 h_guid in varchar2,
4165 h_description in varchar2,
4166 display_system in varchar2,
4167 h_system_guid in varchar2,
4168 h_source_type in varchar2,
4169 display_source_agent in varchar2,
4170 h_source_agent_guid in varchar2,
4171 display_event in varchar2,
4172 h_event_guid in varchar2,
4173 h_phase in varchar2,
4174 h_status in varchar2,
4175 h_owner_name in varchar2,
4176 h_owner_tag in varchar2,
4177 h_rule_data in varchar2,
4178 h_rule_function in varchar2,
4179 display_out_agent in varchar2,
4180 h_out_agent_guid in varchar2,
4181 display_to_agent in varchar2,
4182 h_to_agent_guid in varchar2,
4183 h_priority in varchar2,
4184 h_wfptype in varchar2,
4185 h_wfptype_dname in varchar2,
4186 h_wfpname in varchar2,
4187 h_wfptn in varchar2,
4188 h_parameters in varchar2,
4189 h_custom_level in varchar2,
4190 url in varchar2)
4191 is
4192 username varchar2(320); -- Username to query
4193 admin_role varchar2(320); -- Role for admin mode
4194
4195 l_guid raw(16);
4196 row_id varchar2(30);
4197
4198 l_sysguid raw(16);
4199 l_evtguid raw(16);
4200 l_fagnguid raw(16);
4201 l_oagnguid raw(16);
4202 l_tagnguid raw(16);
4203
4204 l_phase number;
4205 l_priority number;
4206
4207 begin
4208 -- Check session and current user
4209 wfa_sec.GetSession(username);
4210 username := upper(username);
4211 wf_events_pkg.setMode;
4212
4213 -- Check Admin Priviledge
4214 admin_role := wf_core.translate('WF_ADMIN_ROLE');
4215 if (admin_role = '*' or
4216 Wf_Directory.IsPerformer(username, admin_role)) then
4217 -- Have admin privledge, do nothing.
4218 null;
4219 else
4220 wf_core.raise('WF_NOTADMIN');
4221 end if;
4222
4223 -- validate LOVs
4224 l_sysguid := hextoraw(h_system_guid);
4225 Wf_Event_Html.Validate_System_Name(display_system, l_sysguid);
4226
4227 l_evtguid := hextoraw(h_event_guid);
4228 Wf_Event_Html.Validate_Event_Name(display_event, l_evtguid);
4229
4230 l_fagnguid := hextoraw(h_source_agent_guid);
4231 Wf_Event_Html.Validate_Agent_Name(display_source_agent, l_fagnguid);
4232
4233 l_oagnguid := hextoraw(h_out_agent_guid);
4234 Wf_Event_Html.Validate_Agent_Name(display_out_agent, l_oagnguid);
4235
4236 l_tagnguid := hextoraw(h_to_agent_guid);
4237 Wf_Event_Html.Validate_Agent_Name(display_to_agent, l_tagnguid);
4238
4239 l_phase := to_number(h_phase);
4240 l_priority := to_number(h_priority);
4241
4242 if (h_guid is not null) then
4243 l_guid := hextoraw(h_guid);
4244
4245 -- update
4246 Wf_Event_Subscriptions_Pkg.Update_Row (
4247 X_GUID=>l_guid,
4248 X_SYSTEM_GUID=>l_sysguid,
4249 X_SOURCE_TYPE=>h_source_type,
4250 X_SOURCE_AGENT_GUID=>l_fagnguid,
4251 X_EVENT_FILTER_GUID=>l_evtguid,
4252 X_PHASE=>l_phase,
4253 X_STATUS=>h_status,
4254 X_RULE_DATA=>h_rule_data,
4255 X_OUT_AGENT_GUID=>l_oagnguid,
4256 X_TO_AGENT_GUID=>l_tagnguid,
4257 X_PRIORITY=>l_priority,
4258 X_RULE_FUNCTION=>h_rule_function,
4259 X_WF_PROCESS_TYPE=>h_wfptype,
4260 X_WF_PROCESS_NAME=>h_wfpname,
4261 X_PARAMETERS=>h_parameters,
4262 X_OWNER_NAME=>h_owner_name,
4263 X_OWNER_TAG=>h_owner_tag,
4264 X_CUSTOMIZATION_LEVEL=>h_custom_level,
4265 X_DESCRIPTION=>h_description
4266 );
4267 else
4268 l_guid := sys_guid();
4269
4270 -- insert
4271 Wf_Event_Subscriptions_Pkg.Insert_Row (
4272 X_ROWID=>row_id,
4273 X_GUID=>l_guid,
4274 X_SYSTEM_GUID=>l_sysguid,
4275 X_SOURCE_TYPE=>h_source_type,
4276 X_SOURCE_AGENT_GUID=>l_fagnguid,
4277 X_EVENT_FILTER_GUID=>l_evtguid,
4278 X_PHASE=>l_phase,
4279 X_STATUS=>h_status,
4280 X_RULE_DATA=>h_rule_data,
4281 X_OUT_AGENT_GUID=>l_oagnguid,
4282 X_TO_AGENT_GUID=>l_tagnguid,
4283 X_PRIORITY=>l_priority,
4284 X_RULE_FUNCTION=>h_rule_function,
4285 X_WF_PROCESS_TYPE=>h_wfptype,
4286 X_WF_PROCESS_NAME=>h_wfpname,
4287 X_PARAMETERS=>h_parameters,
4288 X_OWNER_NAME=>h_owner_name,
4289 X_OWNER_TAG=>h_owner_tag,
4290 X_CUSTOMIZATION_LEVEL=>h_custom_level,
4291 X_DESCRIPTION=>h_description
4292 );
4293 end if;
4294
4295 -- all done go to a predetermined screen like ListSubscriptions
4296 Wfa_Html.GotoURL(url, '_top');
4297
4298 exception
4299 when OTHERS then
4300 rollback;
4301 wf_core.context('WF_EVENT_HTML', 'SubmitSubscription', rawtohex(l_guid));
4302 wfe_html_util.Error;
4303 end SubmitSubscription;
4304
4305 --
4306 -- FindEvent
4307 -- Filter page to find event
4308 --
4309 procedure FindEvent (
4310 x_gguid in raw default null,
4311 h_guid in raw default null,
4312 h_display_name in varchar2 default null,
4313 h_name in varchar2 default null,
4314 h_status in varchar2 default '*'
4315 )
4316 is
4317 username varchar2(320); -- Username to query
4318 admin_role varchar2(320); -- Role for admin mode
4319 template varchar2(4000); -- Use for construct form select list
4320 l_url varchar2(240); -- url for form
4321
4322 l_name varchar2(240);
4323
4324 -- addable event cursor
4325 -- all events meet the query criteria
4326 cursor aevcurs is
4327 select GUID, DISPLAY_NAME, NAME, TYPE, STATUS
4328 from WF_EVENTS_VL
4329 where TYPE = 'EVENT'
4330 and (h_display_name is null or lower(DISPLAY_NAME) like
4331 '%'||lower(h_display_name)||'%')
4332 and (h_name is null or lower(NAME) like '%'||lower(h_name)||'%')
4333 and (h_status = '*' or STATUS = h_status)
4334 order by NAME;
4335
4336 hTab wfe_html_util.headerTabType;
4337 dTab wfe_html_util.dataTabType;
4338 i pls_integer;
4339 title varchar2(2000);
4340 helptext varchar2(2000);
4341 selected boolean := FALSE;
4342 begin
4343 -- Check session and current user
4344 wfa_sec.GetSession(username);
4345 username := upper(username);
4346 wf_events_pkg.setMode;
4347
4348 -- Check Admin Priviledge
4349 admin_role := wf_core.translate('WF_ADMIN_ROLE');
4350 if (admin_role = '*' or
4351 Wf_Directory.IsPerformer(username, admin_role)) then
4352 -- Have admin privledge, do nothing.
4353 null;
4354 else
4355 wf_core.raise('WF_NOTADMIN');
4356 end if;
4357
4358 -- Check if Accessible
4359 wf_event_html.isAccessible('EVENTS');
4360
4361 -- Determine if this is for group addition or not
4362 if (x_gguid is not null) then
4363 l_url := 'Wf_Event_Html.FindEvent';
4364
4365 begin
4366 select NAME into l_name
4367 from WF_EVENTS
4368 where GUID = x_gguid;
4369 exception
4370 when NO_DATA_FOUND then
4371 wf_core.raise('WFE_EVENT_NOTEXIST');
4372 end;
4373
4374 -- also print a message about adding to group
4375 -- E.g. Narrow selection for adding to group
4376 -- htp.p(wf_core.translate('WFE_FIND_FOR_GROUP'));
4377
4378 title := wf_core.translate('WFE_ADD_TO_GROUP')||': '||l_name;
4379 helptext := 'wf/links/t_d.htm?T_DEFEVGPM';
4380 else
4381 l_url := 'Wf_Event_Html.ListEvents';
4382 title := wf_core.translate('WFE_FIND_EVENT_TITLE');
4383 helptext := 'wf/links/t_f.htm?T_FDEVT';
4384 end if;
4385
4386 -- Render page
4387 htp.htmlOpen;
4388
4389 -- Set page title
4390 htp.headOpen;
4391
4392 -- only expire page if there is potential of having a list
4393
4394 if (x_gguid is not null and h_guid is not null) then
4395 -- list does not get updated after edit, so we add the
4396 -- following tag to force the reload of page.
4397 htp.p('<META HTTP-EQUIV=expires CONTENT="no-cache">');
4398 end if;
4399
4400 htp.title(title);
4401 wfa_html.create_help_function(helptext);
4402 fnd_document_management.get_open_dm_display_window;
4403
4404 Wfe_Html_Util.generate_check_all;
4405
4406 htp.headClose;
4407
4408 -- Page header
4409 wfa_sec.Header(FALSE, null, title, TRUE);
4410
4411 -- Form
4412 htp.formOpen(curl=>owa_util.get_owa_service_path||l_url,
4413 cmethod=>'Get',
4414 cattributes=>'TARGET="_top" NAME="WF_EVENT_FIND"');
4415
4416 htp.tableOpen(calign=>'CENTER', cattributes=>'border=0 summary=""');
4417
4418 -- hidden attribute for FindEvent
4419 if (x_gguid is not null) then
4420 htp.formHidden('x_gguid', x_gguid);
4421 htp.formHidden('h_guid', x_gguid);
4422 end if;
4423
4424 -- Name
4425 htp.tableRowOpen;
4426 htp.tableData(cvalue=>'<LABEL FOR="i_name">' ||
4427 wf_core.translate('NAME') || '</LABEL>',
4428 calign=>'Right', cattributes=>'id=""');
4429 htp.tableData(cvalue=>htf.formText(cname=>'h_name', csize=>40,
4430 cmaxlength=>240,
4431 cattributes=>'id="i_name"'),
4432 calign=>'Left',cattributes=>'id=""');
4433 htp.tableRowClose;
4434
4435 -- Display Name
4436 htp.tableRowOpen;
4437 htp.tableData(cvalue=>'<LABEL FOR="i_display_name">' ||
4438 wf_core.translate('DISPLAY_NAME') || '</LABEL>',
4439 calign=>'Right',cattributes=>'id=""');
4440 htp.tableData(cvalue=>htf.formText(cname=>'h_display_name', csize=>60,
4441 cmaxlength=>80,
4442 cattributes=>'id="i_display_name"'),
4443 calign=>'Left',cattributes=>'id=""');
4444 htp.tableRowClose;
4445
4446 -- Status
4447 template := htf.formSelectOpen('h_status',cattributes=>'id="i_status"')
4448 ||wf_core.newline;
4449
4450 if (h_status = '*') then
4451 template := template||htf.formSelectOption(wf_core.translate('ANY'),
4452 'SELECTED','VALUE="*"')||wf_core.newline;
4453 selected := TRUE;
4454 else
4455 template := template||htf.formSelectOption(wf_core.translate('ANY'),
4456 null,'VALUE="*"')||wf_core.newline;
4457 end if;
4458 if (h_status = 'ENABLED') then
4459 template := template||htf.formSelectOption(wf_core.translate('ENABLED'),
4460 'SELECTED','VALUE="ENABLED"')||wf_core.newline;
4461 selected := TRUE;
4462 else
4463 template := template||htf.formSelectOption(wf_core.translate('ENABLED'),
4464 null,'VALUE="ENABLED"')||wf_core.newline;
4465 end if;
4466 if (selected) then
4467 template := template||htf.formSelectOption(wf_core.translate('DISABLED'),
4468 null,'VALUE="DISABLED"');
4469 else
4470 template := template||htf.formSelectOption(wf_core.translate('DISABLED'),
4471 'SELECTED','VALUE="DISABLED"');
4472 selected := TRUE;
4473 end if;
4474 template := template||wf_core.newline||htf.formSelectClose;
4475
4476 htp.tableRowOpen;
4477 htp.tableData(cvalue=>'<LABEL FOR="i_status">' ||
4478 wf_core.translate('STATUS') || '</LABEL>',
4479 calign=>'Right',cattributes=>'id=""');
4480 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
4481 htp.tableRowClose;
4482
4483 -- Type
4484 -- This is a regular find, allow select of type.
4485 -- Type can only be EVENT for "Add to Group".
4486 if (x_gguid is null) then
4487 template := htf.formSelectOpen('h_type',cattributes=>'id="i_type"')
4488 ||wf_core.newline||
4489 htf.formSelectOption(wf_core.translate('ANY'),
4490 'SELECTED','VALUE="*"')
4491 ||wf_core.newline||
4492 htf.formSelectOption(wf_core.translate('EVENT'),
4493 null,'VALUE="EVENT"')
4494 ||wf_core.newline||
4495 htf.formSelectOption(wf_core.translate('GROUP'),
4496 null,'VALUE="GROUP"')
4497 ||wf_core.newline||
4498 htf.formSelectClose;
4499 htp.tableRowOpen;
4500 htp.tableData(cvalue=>'<LABEL FOR="i_type">' ||
4501 wf_core.translate('TYPE') || '</LABEL>',
4502 calign=>'Right',cattributes=>'id=""');
4503 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
4504 htp.tableRowClose;
4505 end if;
4506
4507 htp.tableClose;
4508
4509 if (x_gguid is null) then
4510 htp.formHidden('resetcookie','T');
4511 end if;
4512 htp.formClose;
4513
4514 -- Add submit button
4515 htp.tableopen (calign=>'CENTER', cattributes=>'summary=""');
4516 htp.tableRowOpen;
4517
4518 htp.p('<TD ID="">');
4519
4520 wfa_html.create_reg_button ('javascript:document.WF_EVENT_FIND.submit()',
4521 wf_core.translate('GO'),
4522 wfa_html.image_loc,
4523 null,
4524 wf_core.translate('GO'));
4525
4526 htp.p('</TD>');
4527
4528 htp.tableRowClose;
4529 htp.tableClose;
4530
4531 -- if a find condition is entered, populate the search fields and
4532 -- run the query to generate the event list.
4533 if (h_guid is not null) then
4534 -- populate the search fields
4535 htp.p('<SCRIPT>');
4536 htp.p(' document.WF_EVENT_FIND.h_name.value="'||h_name||'"');
4537 htp.p(' document.WF_EVENT_FIND.h_display_name.value="'
4538 ||h_display_name||'"');
4539 htp.p('</SCRIPT>');
4540
4541 -- populate the data table
4542 i := 0;
4543 for event in aevcurs loop
4544 i := i+1;
4545 dTab(i).guid := event.guid;
4546 dTab(i).col01:= event.display_name;
4547 dTab(i).col02:= event.name;
4548 dTab(i).col03:= event.status;
4549
4550 dTab(i).selectable := TRUE;
4551 dTab(i).deletable := FALSE;
4552 dTab(i).hasdetail := FALSE;
4553 end loop;
4554
4555 -- Submit Form for Add/Delete
4556 htp.formOpen(curl=>owa_util.get_owa_service_path||
4557 'Wf_Event_Html.SubmitSelectedGEvents',
4558 cmethod=>'Post',
4559 cattributes=>'TARGET="_top" NAME="WF_GROUP_EDIT"');
4560 htp.formHidden('h_gguid', rawtohex(h_guid));
4561
4562 -- Hide the fields for which option you selected. Must be ADD here.
4563 htp.formHidden(cname=>'action', cvalue=>'');
4564
4565 -- Url to come back to later
4566 htp.formHidden(cname=>'url',
4567 cvalue=>'Wf_Event_Html.EditEvent?h_guid='||rawtohex(h_guid));
4568
4569 -- Add dummy fields to start both array-type input fields.
4570 -- These dummy values are needed so that the array parameters to
4571 -- the submit procedure will not be null even if there are no real
4572 -- response fields. This would cause a pl/sql error, because array
4573 -- parameters can't be defaulted.
4574 htp.formHidden('h_guids', '-1');
4575
4576 -- popluate the header table
4577 i := 1;
4578 hTab(i).def_type := 'TITLE';
4579 hTab(i).value := wf_core.translate('DISPLAY_NAME');
4580 hTab(i).attr := 'id="'||wf_core.translate('DISPLAY_NAME')||'"';
4581 i := i+1;
4582 hTab(i).def_type := 'TITLE';
4583 hTab(i).value := wf_core.translate('NAME');
4584 hTab(i).attr := 'id="'||wf_core.translate('NAME')||'"';
4585 i := i+1;
4586 hTab(i).def_type := 'TITLE';
4587 hTab(i).value := wf_core.translate('STATUS');
4588 hTab(i).attr := 'id="'||wf_core.translate('STATUS')||'"';
4589
4590 -- render table
4591 Wfe_Html_Util.Simple_Table(hTab, dTab);
4592
4593 htp.formClose;
4594
4595 -- Buttons Area
4596 htp.tableOpen (calign=>'RIGHT',cattributes=>'summary=""');
4597 htp.tableRowOpen;
4598 -- If table is not empty, we allow check/uncheck all/delete.
4599 if (dTab.COUNT > 0) then
4600 htp.p('<TD ID="">');
4601 wfa_html.create_reg_button (
4602 'javascript:checkAll(document.WF_GROUP_EDIT.h_guids)',
4603 wf_core.translate('SELECT_ALL'),
4604 wfa_html.image_loc,
4605 null,
4606 wf_core.translate('SELECT_ALL'));
4607 htp.p('</TD>');
4608 htp.p('<TD ID="">');
4609 wfa_html.create_reg_button (
4610 'javascript:uncheckAll(document.WF_GROUP_EDIT.h_guids)',
4611 wf_core.translate('UNSELECT_ALL'),
4612 wfa_html.image_loc,
4613 null,
4614 wf_core.translate('UNSELECT_ALL'));
4615 htp.p('</TD>');
4616 htp.p('<TD ID="">');
4617 wfa_html.create_reg_button (
4618 'javascript:document.WF_GROUP_EDIT.action.value=''ADD'';'||
4619 'document.WF_GROUP_EDIT.submit()',
4620 wf_core.translate('ADD'),
4621 wfa_html.image_loc,
4622 null,
4623 wf_core.translate('ADD'));
4624 htp.p('</TD>');
4625 end if;
4626 htp.p('<TD ID="">');
4627 wfa_html.create_reg_button ('javascript:history.back()',
4628 wf_core.translate ('CANCEL'),
4629 wfa_html.image_loc,
4630 null,
4631 wf_core.translate ('CANCEL'));
4632 htp.p('</TD>');
4633 htp.tableRowClose;
4634 htp.tableClose;
4635
4636 end if; -- end generating the event list for adding to group
4637
4638 wfa_sec.Footer;
4639 htp.htmlClose;
4640
4641 exception
4642 when others then
4643 rollback;
4644 wf_core.context('WF_EVENT_HTML', 'FindEvent', rawtohex(x_gguid));
4645 wfe_html_util.Error;
4646 end FindEvent;
4647
4648 --
4649 -- FindSystem
4650 -- Filter page to find systems
4651 --
4652 procedure FindSystem
4653 is
4654 begin
4655 null;
4656 end FindSystem;
4657
4658 --
4659 -- FindAgent
4660 -- Filter page to find agents
4661 --
4662 procedure FindAgent
4663 is
4664 begin
4665 null;
4666 end FindAgent;
4667
4668 --
4669 -- FindSubscription
4670 -- Filter page to find subscriptions
4671 --
4672 procedure FindSubscription
4673 is
4674 begin
4675 null;
4676 end FindSubscription;
4677
4678
4679 --
4680 -- DeleteEvent
4681 -- Delete an event
4682 -- IN
4683 -- h_guid - Global unique id for an event
4684 -- NOTE
4685 --
4686 procedure DeleteEvent(
4687 h_guid in raw default null)
4688 is
4689 l_type varchar2(8);
4690
4691 cursor evtc(xguid in raw) is
4692 select MEMBER_GUID
4693 from WF_EVENT_GROUPS
4694 where GROUP_GUID = xguid;
4695
4696 begin
4697 if (isDeletable(h_guid, 'EVENT')) then
4698 begin
4699 select TYPE into l_type
4700 from WF_EVENTS
4701 where GUID = h_guid
4702 and TYPE = 'EVENT';
4703 exception
4704 -- if it is a group, delete all the child events
4705 when NO_DATA_FOUND then
4706 for evtr in evtc(h_guid) loop
4707 Wf_Event_Groups_Pkg.Delete_Row(
4708 x_group_guid=>h_guid,
4709 x_member_guid=>evtr.MEMBER_GUID
4710 );
4711 end loop;
4712 end;
4713
4714 Wf_Events_Pkg.Delete_Row(h_guid);
4715 end if;
4716
4717 -- go back to ListEvents
4718 Wfe_Html_Util.gotoURL(wfa_html.base_url||'/Wf_Event_Html.ListEvents');
4719
4720 exception
4721 when others then
4722 rollback;
4723 wf_core.context('WF_EVENT_HTML', 'DeleteEvent', rawtohex(h_guid));
4724 wfe_html_util.Error;
4725 end DeleteEvent;
4726
4727 --
4728 -- DeleteSystem
4729 -- Delete a system
4730 -- IN
4731 -- h_guid - Global unique id for a system
4732 -- NOTE
4733 --
4734 procedure DeleteSystem(
4735 h_guid in raw default null)
4736 is
4737 begin
4738 if (isDeletable(h_guid, 'SYSTEM')) then
4739 Wf_Systems_Pkg.Delete_Row(h_guid);
4740 end if;
4741
4742 -- go back to ListSystems
4743 htp.p('<SCRIPT>');
4744 htp.p(' window.location.replace("'||
4745 wfa_html.base_url||'/Wf_Event_Html.ListSystems")');
4746 htp.p('</SCRIPT>');
4747
4748 exception
4749 when others then
4750 rollback;
4751 wf_core.context('WF_EVENT_HTML', 'DeleteSystem', rawtohex(h_guid));
4752 wfe_html_util.Error;
4753 end DeleteSystem;
4754
4755 --
4756 -- DeleteAgent
4757 -- Delete an agent
4758 -- IN
4759 -- h_guid - Global unique id for an agent
4760 -- NOTE
4761 --
4762 procedure DeleteAgent(
4763 h_guid in raw default null)
4764 is
4765 begin
4766 if (isDeletable(h_guid, 'AGENT')) then
4767 Wf_Agents_Pkg.Delete_Row(h_guid);
4768 end if;
4769
4770 -- go back to ListAgents
4771 htp.p('<SCRIPT>');
4772 htp.p(' window.location.replace("'||
4773 wfa_html.base_url||'/Wf_Event_Html.ListAgents")');
4774 htp.p('</SCRIPT>');
4775
4776 exception
4777 when others then
4778 rollback;
4779 wf_core.context('WF_EVENT_HTML', 'DeleteAgent', rawtohex(h_guid));
4780 wfe_html_util.Error;
4781 end DeleteAgent;
4782
4783 -- DeleteSubscription
4784 -- Delete a subscription
4785 -- IN
4786 -- h_guid - Global unique id for a subscription
4787 -- NOTE
4788 --
4789 procedure DeleteSubscription(
4790 h_guid in raw default null)
4791 is
4792 begin
4793 if (isDeletable(h_guid, 'SUBSCRIPTION')) then
4794 Wf_Event_Subscriptions_Pkg.Delete_Row(h_guid);
4795 end if;
4796
4797 -- go back to ListSubscriptions
4798 htp.p('<SCRIPT>');
4799 htp.p(' window.location.replace("'||
4800 wfa_html.base_url||'/Wf_Event_Html.ListSubscriptions")');
4801 htp.p('</SCRIPT>');
4802
4803 exception
4804 when others then
4805 rollback;
4806 wf_core.context('WF_EVENT_HTML', 'DeleteSubscription', rawtohex(h_guid));
4807 wfe_html_util.Error;
4808 end DeleteSubscription;
4809
4810 --
4811 -- wf_event_val
4812 -- Create the lov content for our event lov. This function
4813 -- is called by the generic lov function
4814 -- IN
4815 -- RETURNS
4816 --
4817 procedure wf_event_val (
4818 p_mode in varchar2,
4819 p_lov_name in varchar2,
4820 p_start_row in number,
4821 p_max_rows in number,
4822 p_hidden_value in out nocopy varchar2,
4823 p_display_value in out nocopy varchar2,
4824 p_result out nocopy number)
4825 is
4826
4827 cursor evcurs (c_find_criteria in varchar2) is
4828 select GUID, NAME, DISPLAY_NAME
4829 from WF_EVENTS_VL
4830 where (UPPER(display_name) LIKE UPPER(c_find_criteria)||'%'
4831 and (display_name LIKE LOWER(SUBSTR(c_find_criteria, 1, 2))||'%'
4832 or display_name LIKE LOWER(SUBSTR(c_find_criteria, 1, 1))||
4833 UPPER(SUBSTR(c_find_criteria, 2, 1))||'%'
4834 or display_name LIKE INITCAP(SUBSTR(c_find_criteria, 1, 2))||'%'
4835 or display_name LIKE UPPER(SUBSTR(c_find_criteria, 1, 2))||'%'))
4836 or
4837 (UPPER(name) LIKE UPPER(c_find_criteria)||'%'
4838 and (name LIKE LOWER(SUBSTR(c_find_criteria, 1, 2))||'%'
4839 or name LIKE LOWER(SUBSTR(c_find_criteria, 1, 1))||
4840 UPPER(SUBSTR(c_find_criteria, 2, 1))||'%'
4841 or name LIKE INITCAP(SUBSTR(c_find_criteria, 1, 2))||'%'
4842 or name LIKE UPPER(SUBSTR(c_find_criteria, 1, 2))||'%'))
4843 order by NAME;
4844
4845 ii pls_integer := 0;
4846 nn pls_integer := 0;
4847 l_total_rows pls_integer := 0;
4848 l_id pls_integer;
4849 l_guid raw(16);
4850 l_name varchar2 (240);
4851 l_display_name varchar2 (240);
4852 l_result number := 1; -- This is the return value for each mode
4853
4854 begin
4855 if (p_mode = 'LOV') then
4856
4857 /*
4858 ** Need to get a count on the number of rows that will meet the
4859 ** criteria before actually executing the fetch to show the user
4860 ** how many matches are available.
4861 */
4862 select count(*) into l_total_rows
4863 from WF_EVENTS_VL
4864 where (upper(DISPLAY_NAME) like upper(p_display_value)||'%'
4865 and (DISPLAY_NAME like lower(substr(p_display_value, 1, 2))||'%'
4866 or DISPLAY_NAME like lower(substr(p_display_value, 1, 1))||
4867 upper(SUBSTR(p_display_value, 2, 1))||'%'
4868 or DISPLAY_NAME like initcap(substr(p_display_value, 1, 2))||'%'
4869 or DISPLAY_NAME like upper(substr(p_display_value, 1, 2))||'%'))
4870 or
4871 (upper(NAME) like upper(p_display_value)||'%'
4872 and (NAME like lower(substr(p_display_value, 1, 2))||'%'
4873 or NAME like lower(substr(p_display_value, 1, 1))||
4874 upper(substr(p_display_value, 2, 1))||'%'
4875 or NAME like initcap(substr(p_display_value, 1, 2))||'%'
4876 or NAME like upper(substr(p_display_value, 1, 2))||'%'));
4877
4878 wf_lov.g_define_rec.total_rows := l_total_rows;
4879 wf_lov.g_define_rec.add_attr1_title := wf_core.translate('DISPLAY_NAME');
4880
4881 open evcurs (p_display_value);
4882 loop
4883 fetch evcurs into l_guid, l_name, l_display_name;
4884 exit when evcurs%NOTFOUND or nn >= p_max_rows;
4885
4886 ii := ii + 1;
4887
4888 if (ii >= p_start_row) then
4889
4890 nn := nn + 1;
4891 wf_lov.g_value_tbl(nn).hidden_key := l_guid;
4892 wf_lov.g_value_tbl(nn).display_value := l_name;
4893 wf_lov.g_value_tbl(nn).add_attr1_value := l_display_name;
4894 end if;
4895 end loop;
4896 l_result := 1;
4897
4898 elsif (p_mode = 'GET_DISPLAY_VAL') THEN
4899 select GUID, NAME, DISPLAY_NAME
4900 into l_guid, l_name, l_display_name
4901 from WF_EVENTS_VL
4902 where GUID = p_hidden_value;
4903
4904 p_display_value := l_name;
4905
4906 l_result := 1;
4907
4908 elsif (p_mode = 'VALIDATE') THEN
4909 /*
4910 ** If mode = VALIDATE then see how many rows match the criteria
4911 ** If its 0 then thats not good. Raise an error and tell them to use LOV
4912 ** If its 1 then thats great.
4913 ** If its more than 1 then check to see if they used the LOV to select
4914 ** the value
4915 */
4916 open evcurs (p_display_value);
4917
4918 loop
4919
4920 fetch evcurs into l_guid, l_name, l_display_name;
4921
4922 exit when evcurs%NOTFOUND OR ii = 2;
4923
4924 ii := ii + 1;
4925
4926 p_hidden_value := l_guid;
4927
4928 end loop;
4929
4930 /*
4931 ** If ii=0 then no rows were found and you have an error in the value
4932 ** entered so present a no rows found and use the lov icon to select
4933 ** value
4934 ** If ii=1 then one row is found then you've got the right value
4935 ** If ii=2 then more than one row was found so check to see if the display
4936 ** value taht was selected is not unique in the LOV (Person Name) and
4937 ** that the LOV was used so the Hidden value has been set to a unique
4938 ** value. If it comes up with more than 1 in this case then present
4939 ** the please use lov icon to select value.
4940 */
4941 if (ii = 2) then
4942
4943 select count(*)
4944 into ii
4945 from WF_EVENTS_VL
4946 where NAME = p_display_value;
4947
4948 end if;
4949
4950 l_result := ii;
4951
4952 end if;
4953 p_result := l_result;
4954 exception
4955 when OTHERS then
4956 rollback;
4957 wf_core.context('WF_EVENT_HTML', 'Wf_Event_Val');
4958 raise;
4959 end Wf_Event_Val;
4960
4961 --
4962 -- wf_system_val
4963 -- Create the lov content for our system lov. This function
4964 -- is called by the generic lov function
4965 -- IN
4966 -- RETURNS
4967 --
4968 procedure wf_system_val (
4969 p_mode in varchar2,
4970 p_lov_name in varchar2,
4971 p_start_row in number,
4972 p_max_rows in number,
4973 p_hidden_value in out nocopy varchar2,
4974 p_display_value in out nocopy varchar2,
4975 p_result out nocopy number)
4976 is
4977
4978 cursor mycurs (c_find_criteria in varchar2) is
4979 select GUID, NAME, DISPLAY_NAME
4980 from WF_SYSTEMS
4981 where UPPER(display_name) LIKE UPPER(c_find_criteria)||'%'
4982 or
4983 UPPER(name) LIKE UPPER(c_find_criteria)||'%'
4984 order by NAME;
4985
4986 ii pls_integer := 0;
4987 nn pls_integer := 0;
4988 l_total_rows pls_integer := 0;
4989 l_id pls_integer;
4990 l_guid raw(16);
4991 l_name varchar2 (240);
4992 l_display_name varchar2 (240);
4993 l_result number := 1; -- This is the return value for each mode
4994
4995 begin
4996 if (p_mode = 'LOV') then
4997
4998 /*
4999 ** Need to get a count on the number of rows that will meet the
5000 ** criteria before actually executing the fetch to show the user
5001 ** how many matches are available.
5002 */
5003 select count(*) into l_total_rows
5004 from WF_SYSTEMS
5005 where upper(DISPLAY_NAME) like upper(p_display_value)||'%'
5006 or
5007 upper(NAME) like upper(p_display_value)||'%';
5008
5009 wf_lov.g_define_rec.total_rows := l_total_rows;
5010 wf_lov.g_define_rec.add_attr1_title := wf_core.translate('DISPLAY_NAME');
5011
5012 open mycurs (p_display_value);
5013 loop
5014 fetch mycurs into l_guid, l_name, l_display_name;
5015 exit when mycurs%NOTFOUND or nn >= p_max_rows;
5016
5017 ii := ii + 1;
5018
5019 if (ii >= p_start_row) then
5020
5021 nn := nn + 1;
5022 wf_lov.g_value_tbl(nn).hidden_key := l_guid;
5023 wf_lov.g_value_tbl(nn).display_value := l_name;
5024 wf_lov.g_value_tbl(nn).add_attr1_value := l_display_name;
5025 end if;
5026 end loop;
5027 l_result := 1;
5028
5029 elsif (p_mode = 'GET_DISPLAY_VAL') THEN
5030 select GUID, NAME, DISPLAY_NAME
5031 into l_guid, l_name, l_display_name
5032 from WF_SYSTEMS
5033 where GUID = p_hidden_value;
5034
5035 p_display_value := l_name;
5036
5037 l_result := 1;
5038
5039 elsif (p_mode = 'VALIDATE') THEN
5040 /*
5041 ** If mode = VALIDATE then see how many rows match the criteria
5042 ** If its 0 then thats not good. Raise an error and tell them to use LOV
5043 ** If its 1 then thats great.
5044 ** If its more than 1 then check to see if they used the LOV to select
5045 ** the value
5046 */
5047 open mycurs (p_display_value);
5048
5049 loop
5050
5051 fetch mycurs into l_guid, l_name, l_display_name;
5052
5053 exit when mycurs%NOTFOUND OR ii = 2;
5054
5055 ii := ii + 1;
5056
5057 p_hidden_value := l_guid;
5058
5059 end loop;
5060
5061 /*
5062 ** If ii=0 then no rows were found and you have an error in the value
5063 ** entered so present a no rows found and use the lov icon to select
5064 ** value
5065 ** If ii=1 then one row is found then you've got the right value
5066 ** If ii=2 then more than one row was found so check to see if the display
5067 ** value taht was selected is not unique in the LOV (Person Name) and
5068 ** that the LOV was used so the Hidden value has been set to a unique
5069 ** value. If it comes up with more than 1 in this case then present
5070 ** the please use lov icon to select value.
5071 */
5072 if (ii = 2) then
5073
5074 select count(*)
5075 into ii
5076 from WF_SYSTEMS
5077 where NAME = p_display_value;
5078
5079 end if;
5080
5081 l_result := ii;
5082
5083 end if;
5084 p_result := l_result;
5085 exception
5086 when OTHERS then
5087 rollback;
5088 wf_core.context('WF_EVENT_HTML', 'Wf_System_Val');
5089 raise;
5090 end Wf_System_Val;
5091
5092 --
5093 -- wf_agent_val
5094 -- Create the lov content for our agent lov. This function
5095 -- is called by the generic lov function
5096 -- IN
5097 -- RETURNS
5098 --
5099 procedure wf_agent_val (
5100 p_mode in varchar2,
5101 p_lov_name in varchar2,
5102 p_start_row in number,
5103 p_max_rows in number,
5104 p_hidden_value in out nocopy varchar2,
5105 p_display_value in out nocopy varchar2,
5106 p_result out nocopy number,
5107 p_param1 in varchar2 default null,
5108 p_param2 in varchar2 default null)
5109 is
5110 -- JWSMITH, BUG 1831892
5111 -- added and UPPER(a.name) <> 'WF_DEFERRED' in following select stmt
5112 cursor mycurs (c_find_criteria in varchar2, sguid in raw) is
5113 select A.GUID, A.DISPLAY_NAME, A.NAME||'@'||S.NAME
5114 from WF_AGENTS A, WF_SYSTEMS S
5115 where UPPER(a.name) LIKE UPPER(c_find_criteria)||'%'
5116 and UPPER(a.name) <> 'WF_DEFERRED'
5117 and A.SYSTEM_GUID = S.GUID
5118 and (p_param1 is null or direction = p_param1 or direction = 'ANY')
5119 and (sguid is null or system_guid = sguid)
5120 order by ADDRESS;
5121
5122 ii pls_integer := 0;
5123 nn pls_integer := 0;
5124 l_total_rows pls_integer := 0;
5125 l_id pls_integer;
5126 l_guid raw(16);
5127 l_dname varchar2 (80);
5128 l_disp varchar2 (161); -- name@system
5129 l_result number := 1; -- This is the return value for each mode
5130 l_sguid raw(16);
5131
5132 colon number;
5133 l_aname varchar2(80);
5134 l_sname varchar2(80);
5135 begin
5136 colon := instr(p_display_value, '@');
5137 if (colon <> 0) then
5138 l_aname := substr(p_display_value, 1, colon-1);
5139 l_sname := substr(p_display_value, colon+1);
5140 else
5141 l_aname := p_display_value;
5142 l_sname := p_param2;
5143 end if;
5144
5145 if (l_sname is not null) then
5146 select min(GUID) into l_sguid
5147 from WF_SYSTEMS
5148 where NAME = l_sname;
5149 else
5150 l_sguid := hextoraw(null);
5151 end if;
5152
5153 if (p_mode = 'LOV') then
5154
5155 /*
5156 ** Need to get a count on the number of rows that will meet the
5157 ** criteria before actually executing the fetch to show the user
5158 ** how many matches are available.
5159 */
5160 select count(*) into l_total_rows
5161 from WF_AGENTS A, WF_SYSTEMS S
5162 where upper(A.NAME) like upper(l_aname)||'%'
5163 and A.SYSTEM_GUID = S.GUID
5164 and (p_param1 is null or A.DIRECTION = p_param1)
5165 and (l_sguid is null or A.SYSTEM_GUID = l_sguid);
5166
5167 wf_lov.g_define_rec.total_rows := l_total_rows;
5168 wf_lov.g_define_rec.add_attr1_title := wf_core.translate('DISPLAY_NAME');
5169
5170 open mycurs (l_aname, l_sguid);
5171 loop
5172 fetch mycurs into l_guid, l_dname, l_disp;
5173 exit when mycurs%NOTFOUND or nn >= p_max_rows;
5174
5175 ii := ii + 1;
5176
5177 if (ii >= p_start_row) then
5178
5179 nn := nn + 1;
5180 wf_lov.g_value_tbl(nn).hidden_key := l_guid;
5181 wf_lov.g_value_tbl(nn).display_value := l_disp;
5182 wf_lov.g_value_tbl(nn).add_attr1_value := l_dname;
5183 end if;
5184 end loop;
5185 l_result := 1;
5186
5187 elsif (p_mode = 'GET_DISPLAY_VAL') THEN
5188 select A.GUID, A.DISPLAY_NAME, A.NAME||'@'||S.NAME
5189 into l_guid, l_dname, l_disp
5190 from WF_AGENTS A, WF_SYSTEMS S
5191 where A.GUID = p_hidden_value
5192 and A.SYSTEM_GUID (+)= S.GUID;
5193
5194 p_display_value := l_disp;
5195
5196 l_result := 1;
5197
5198 elsif (p_mode = 'VALIDATE') THEN
5199 /*
5200 ** If mode = VALIDATE then see how many rows match the criteria
5201 ** If its 0 then thats not good. Raise an error and tell them to use LOV
5202 ** If its 1 then thats great.
5203 ** If its more than 1 then check to see if they used the LOV to select
5204 ** the value
5205 */
5206 open mycurs (l_aname, l_sguid);
5207
5208 loop
5209
5210 fetch mycurs into l_guid, l_dname, l_disp;
5211
5212 exit when mycurs%NOTFOUND OR ii = 2;
5213
5214 ii := ii + 1;
5215
5216 p_hidden_value := l_guid;
5217
5218 end loop;
5219
5220 /*
5221 ** If ii=0 then no rows were found and you have an error in the value
5222 ** entered so present a no rows found and use the lov icon to select
5223 ** value
5224 ** If ii=1 then one row is found then you've got the right value
5225 ** If ii=2 then more than one row was found so check to see if the display
5226 ** value taht was selected is not unique in the LOV (Person Name) and
5227 ** that the LOV was used so the Hidden value has been set to a unique
5228 ** value. If it comes up with more than 1 in this case then present
5229 ** the please use lov icon to select value.
5230 */
5231 if (ii = 2) then
5232
5233 select count(*)
5234 into ii
5235 from WF_AGENTS
5236 where NAME = l_aname;
5237
5238 end if;
5239
5240 l_result := ii;
5241
5242 end if;
5243 p_result := l_result;
5244 exception
5245 when OTHERS then
5246 rollback;
5247 wf_core.context('WF_EVENT_HTML', 'Wf_Agent_Val');
5248 raise;
5249 end Wf_Agent_Val;
5250
5251 --
5252 -- wf_itemtype_val
5253 -- Create the lov content for wf item type lov. This function
5254 -- is called by the generic lov function
5255 -- IN
5256 -- RETURNS
5257 --
5258 procedure wf_itemtype_val (
5259 p_mode in varchar2,
5260 p_lov_name in varchar2,
5261 p_start_row in number,
5262 p_max_rows in number,
5263 p_hidden_value in out nocopy varchar2,
5264 p_display_value in out nocopy varchar2,
5265 p_result out nocopy number)
5266 is
5267
5268 cursor mycurs (c_find_criteria in varchar2) is
5269 select NAME, DISPLAY_NAME
5270 from WF_ITEM_TYPES_VL
5271 where (UPPER(DISPLAY_NAME) LIKE UPPER(c_find_criteria)||'%'
5272 or
5273 NAME LIKE UPPER(c_find_criteria)||'%')
5274 and NAME not in ('WFSTD','WFMAIL', 'SYSERROR')
5275 order by NAME;
5276
5277 ii pls_integer := 0;
5278 nn pls_integer := 0;
5279 l_total_rows pls_integer := 0;
5280 l_id pls_integer;
5281 l_name varchar2 (8);
5282 l_display_name varchar2 (240);
5283 l_result number := 1; -- This is the return value for each mode
5284
5285 begin
5286 if (p_mode = 'LOV') then
5287
5288 /*
5289 ** Need to get a count on the number of rows that will meet the
5290 ** criteria before actually executing the fetch to show the user
5291 ** how many matches are available.
5292 */
5293 select count(*) into l_total_rows
5294 from WF_ITEM_TYPES_VL
5295 where (upper(DISPLAY_NAME) like upper(p_display_value)||'%'
5296 or
5297 NAME like upper(p_display_value)||'%')
5298 and NAME not in ('WFSTD', 'WFERROR', 'WFMAIL', 'SYSERROR');
5299
5300 wf_lov.g_define_rec.total_rows := l_total_rows;
5301 wf_lov.g_define_rec.add_attr1_title := wf_core.translate('DISPLAY_NAME');
5302
5303 open mycurs (p_display_value);
5304 loop
5305 fetch mycurs into l_name, l_display_name;
5306 exit when mycurs%NOTFOUND or nn >= p_max_rows;
5307
5308 ii := ii + 1;
5309
5310 if (ii >= p_start_row) then
5311
5312 nn := nn + 1;
5313 wf_lov.g_value_tbl(nn).hidden_key := l_display_name;
5314 wf_lov.g_value_tbl(nn).display_value := l_name;
5315 wf_lov.g_value_tbl(nn).add_attr1_value := l_display_name;
5316 end if;
5317 end loop;
5318 l_result := 1;
5319
5320 elsif (p_mode = 'GET_DISPLAY_VAL') THEN
5321 select NAME, DISPLAY_NAME
5322 into l_name, l_display_name
5323 from WF_ITEM_TYPES_VL
5324 where upper(DISPLAY_NAME) = upper(p_hidden_value);
5325
5326 p_display_value := l_name;
5327
5328 l_result := 1;
5329
5330 elsif (p_mode = 'VALIDATE') THEN
5331 /*
5332 ** If mode = VALIDATE then see how many rows match the criteria
5333 ** If its 0 then thats not good. Raise an error and tell them to use LOV
5334 ** If its 1 then thats great.
5335 ** If its more than 1 then check to see if they used the LOV to select
5336 ** the value
5337 */
5338 open mycurs (p_display_value);
5339
5340 loop
5341
5342 fetch mycurs into l_name, l_display_name;
5343
5344 exit when mycurs%NOTFOUND OR ii = 2;
5345
5346 ii := ii + 1;
5347
5348 p_hidden_value := l_display_name;
5349
5350 end loop;
5351
5352 /*
5353 ** If ii=0 then no rows were found and you have an error in the value
5354 ** entered so present a no rows found and use the lov icon to select
5355 ** value
5356 ** If ii=1 then one row is found then you've got the right value
5357 ** If ii=2 then more than one row was found so check to see if the display
5358 ** value taht was selected is not unique in the LOV (Person Name) and
5359 ** that the LOV was used so the Hidden value has been set to a unique
5360 ** value. If it comes up with more than 1 in this case then present
5361 ** the please use lov icon to select value.
5362 */
5363 if (ii = 2) then
5364
5365 select count(*)
5366 into ii
5367 from WF_ITEM_TYPES_VL
5368 where NAME = p_display_value;
5369
5370 end if;
5371
5372 l_result := ii;
5373
5374 end if;
5375 p_result := l_result;
5376 exception
5377 when OTHERS then
5378 rollback;
5379 wf_core.context('WF_EVENT_HTML', 'Wf_ItemType_Val');
5380 raise;
5381 end Wf_ItemType_Val;
5382
5383 --
5384 -- wf_processname_val
5385 -- Create the lov content for wf process name lov. This function
5386 -- is called by the generic lov function
5387 -- IN
5388 -- RETURNS
5389 --
5390 procedure wf_processname_val (
5391 p_mode in varchar2,
5392 p_lov_name in varchar2,
5393 p_start_row in number,
5394 p_max_rows in number,
5395 p_hidden_value in out nocopy varchar2,
5396 p_display_value in out nocopy varchar2,
5397 p_result out nocopy number,
5398 p_param1 in varchar2 default null)
5399 is
5400
5401 cursor mycurs (c_find_criteria in varchar2) is
5402 select PROCESS_NAME, DISPLAY_NAME
5403 from WF_RUNNABLE_PROCESSES_V
5404 where PROCESS_NAME LIKE UPPER(c_find_criteria)||'%'
5405 and ITEM_TYPE = p_param1
5406 order by PROCESS_NAME;
5407
5408 ii pls_integer := 0;
5409 nn pls_integer := 0;
5410 l_total_rows pls_integer := 0;
5411 l_id pls_integer;
5412 l_name varchar2 (61);
5413 l_display_name varchar2 (61);
5414 l_result number := 1; -- This is the return value for each mode
5415
5416 colon pls_integer;
5417
5418 begin
5419
5420 if (p_mode = 'LOV') then
5421
5422 /*
5423 ** Need to get a count on the number of rows that will meet the
5424 ** criteria before actually executing the fetch to show the user
5425 ** how many matches are available.
5426 */
5427 select count(*) into l_total_rows
5428 from WF_RUNNABLE_PROCESSES_V
5429 where PROCESS_NAME like upper(p_display_value)||'%'
5430 and ITEM_TYPE = p_param1;
5431
5432 wf_lov.g_define_rec.total_rows := l_total_rows;
5433 wf_lov.g_define_rec.add_attr1_title := wf_core.translate('DISPLAY_NAME');
5434
5435 open mycurs (p_display_value);
5436 loop
5437 fetch mycurs into l_name, l_display_name;
5438 exit when mycurs%NOTFOUND or nn >= p_max_rows;
5439
5440 ii := ii + 1;
5441
5442 if (ii >= p_start_row) then
5443
5444 nn := nn + 1;
5445 wf_lov.g_value_tbl(nn).hidden_key := p_hidden_value;
5446 wf_lov.g_value_tbl(nn).display_value := l_name;
5447 wf_lov.g_value_tbl(nn).add_attr1_value := l_display_name;
5448 end if;
5449 end loop;
5450 l_result := 1;
5451
5452 elsif (p_mode = 'GET_DISPLAY_VAL') THEN
5453 select PROCESS_NAME, DISPLAY_NAME
5454 into l_name, l_display_name
5455 from WF_RUNNABLE_PROCESSES_V
5456 where PROCESS_NAME = upper(p_display_value)
5457 and ITEM_TYPE = p_param1;
5458
5459 p_display_value := l_name;
5460
5461 l_result := 1;
5462
5463 elsif (p_mode = 'VALIDATE') THEN
5464 /*
5465 ** If mode = VALIDATE then see how many rows match the criteria
5466 ** If its 0 then thats not good. Raise an error and tell them to use LOV
5467 ** If its 1 then thats great.
5468 ** If its more than 1 then check to see if they used the LOV to select
5469 ** the value
5470 */
5471 open mycurs (p_display_value);
5472
5473 loop
5474
5475 fetch mycurs into l_name, l_display_name;
5476
5477 exit when mycurs%NOTFOUND OR ii = 2;
5478
5479 ii := ii + 1;
5480
5481 -- p_hidden_value := l_display_name;
5482
5483 end loop;
5484
5485 /*
5486 ** If ii=0 then no rows were found and you have an error in the value
5487 ** entered so present a no rows found and use the lov icon to select
5488 ** value
5489 ** If ii=1 then one row is found then you've got the right value
5490 ** If ii=2 then more than one row was found so check to see if the display
5491 ** value taht was selected is not unique in the LOV (Person Name) and
5492 ** that the LOV was used so the Hidden value has been set to a unique
5493 ** value. If it comes up with more than 1 in this case then present
5494 ** the please use lov icon to select value.
5495 */
5496 if (ii = 2) then
5497
5498 select count(*)
5499 into ii
5500 from WF_RUNNABLE_PROCESSES_V
5501 where PROCESS_NAME = p_display_value
5502 and ITEM_TYPE = p_param1;
5503
5504 end if;
5505
5506 l_result := ii;
5507
5508 end if;
5509 p_result := l_result;
5510 exception
5511 when OTHERS then
5512 rollback;
5513 wf_core.context('WF_EVENT_HTML', 'Wf_ProcessName_Val');
5514 raise;
5515 end Wf_ProcessName_Val;
5516
5517 --
5518 -- Validate_Event_Name
5519 -- Find out if there is an unique match. Return if all fine, otherwise
5520 -- raise an error.
5521 -- NOTE
5522 -- p_name has precedence over p_guid in matching.
5523 --
5524 procedure validate_event_name (
5525 p_name in varchar2,
5526 p_guid in out nocopy raw)
5527 is
5528 l_names_count number := 0;
5529 l_dnames_count number := 0;
5530 l_guid raw(16);
5531 l_upper_name varchar2(240);
5532 begin
5533
5534 -- Make sure to blank out the guid if the user originally
5535 -- used the LOV to select the guid and then blanked out the display
5536 -- name then make sure here to blank out the guid and return
5537 if (p_name is null) then
5538 p_guid := NULL;
5539 return;
5540 end if;
5541
5542 -- First match against GUID. There shoul not be any duplicate, but
5543 -- if there is, go ahead and pick the min value so you may return
5544 -- something.
5545 l_upper_name := upper(p_name);
5546
5547 select min(GUID)
5548 into l_guid
5549 from WF_EVENTS
5550 where GUID = l_upper_name;
5551
5552 -- If you found a match, set p_guid accordingly.
5553 if (l_guid is not null) then
5554 p_guid := l_guid;
5555
5556 return;
5557
5558 -- check NAME next
5559 else
5560 -- Count how many match the NAME
5561 select count(1)
5562 into l_names_count
5563 from WF_EVENTS
5564 where NAME = p_name;
5565
5566 -- If you find a match, set p_guid accordingly.
5567 if (l_names_count = 1) then
5568 select GUID
5569 into p_guid
5570 from WF_EVENTS
5571 where NAME = p_name;
5572
5573 return;
5574
5575 -- Count how many match the DISPLAY_NAME
5576 else
5577 select count(1)
5578 into l_dnames_count
5579 from WF_EVENTS_VL
5580 where DISPLAY_NAME = p_name;
5581
5582 -- If you find a match, set p_guid accordingly.
5583 if (l_dnames_count = 1) then
5584 select GUID
5585 into p_guid
5586 from WF_EVENTS_VL
5587 where DISPLAY_NAME = p_name;
5588
5589 return;
5590
5591 end if;
5592 end if;
5593
5594 -- No match
5595 if (l_names_count = 0 and l_dnames_count = 0) then
5596
5597 wf_core.token('EVENT', p_name);
5598 wf_core.raise('WFE_EVENT_NOMATCH');
5599 -- ### '&EVENT' is not a valid event guid, name, or display name.
5600
5601 -- Multiple matches
5602 else
5603 wf_core.token('NAME', p_name);
5604 wf_core.raise('WFE_NOTUNIQUE');
5605 -- ### '&NAME' is not unique. Please use the List of Values option
5606 -- ### to select the entity.
5607
5608 end if;
5609 end if;
5610
5611 exception
5612 when OTHERS then
5613 wf_core.context('Wf_Event_Html', 'Validate_Event_Name', p_name,
5614 rawtohex(p_guid));
5615 raise;
5616 end Validate_Event_Name;
5617
5618 --
5619 -- Validate_System_Name
5620 -- Find out if there is an unique match. Return if all fine, otherwise
5621 -- raise an error.
5622 -- NOTE
5623 -- p_name has precedence over p_guid in matching.
5624 --
5625 procedure validate_system_name (
5626 p_name in varchar2,
5627 p_guid in out nocopy raw)
5628 is
5629 l_names_count number := 0;
5630 l_dnames_count number := 0;
5631 l_guid raw(16);
5632 l_upper_name varchar2(240);
5633 begin
5634
5635 -- Make sure to blank out the guid if the user originally
5636 -- used the LOV to select the guid and then blanked out the display
5637 -- name then make sure here to blank out the guid and return
5638 if (p_name is null) then
5639 p_guid := NULL;
5640 return;
5641 end if;
5642
5643 -- First match against GUID. There shoul not be any duplicate, but
5644 -- if there is, go ahead and pick the min value so you may return
5645 -- something.
5646 l_upper_name := upper(p_name);
5647
5648 select min(GUID)
5649 into l_guid
5650 from WF_SYSTEMS
5651 where GUID = l_upper_name;
5652
5653 -- If you found a match, set p_guid accordingly.
5654 if (l_guid is not null) then
5655 p_guid := l_guid;
5656
5657 return;
5658
5659 -- check NAME next
5660 else
5661 -- Count how many match the NAME
5662 select count(1)
5663 into l_names_count
5664 from WF_SYSTEMS
5665 where NAME = p_name;
5666
5667 -- If you find a match, set p_guid accordingly.
5668 if (l_names_count = 1) then
5669 select GUID
5670 into p_guid
5671 from WF_SYSTEMS
5672 where NAME = p_name;
5673
5674 return;
5675
5676 -- Count how many match the DISPLAY_NAME
5677 else
5678 select count(1)
5679 into l_dnames_count
5680 from WF_SYSTEMS
5681 where DISPLAY_NAME = p_name;
5682
5683 -- If you find a match, set p_guid accordingly.
5684 if (l_dnames_count = 1) then
5685 select GUID
5686 into p_guid
5687 from WF_SYSTEMS
5688 where DISPLAY_NAME = p_name;
5689
5690 return;
5691
5692 end if;
5693 end if;
5694
5695 -- No match
5696 if (l_names_count = 0 and l_dnames_count = 0) then
5697
5698 wf_core.token('SYSTEM', p_name);
5699 wf_core.raise('WFE_SYSTEM_NOMATCH');
5700 -- ### '&SYSTEM' is not a valid system guid, name, or display name.
5701
5702 -- Multiple matches
5703 else
5704 wf_core.token('NAME', p_name);
5705 wf_core.raise('WFE_NOTUNIQUE');
5706 -- ### '&NAME' is not unique. Please use the List of Values option
5707 -- ### to select the entity.
5708
5709 end if;
5710 end if;
5711
5712 exception
5713 when OTHERS then
5714 wf_core.context('Wf_Event_Html', 'Validate_System_Name', p_name,
5715 rawtohex(p_guid));
5716 raise;
5717 end Validate_System_Name;
5718
5719 --
5720 -- Validate_Agent_Name
5721 -- Find out if there is an unique match. Return if all fine, otherwise
5722 -- raise an error.
5723 -- NOTE
5724 -- p_name has precedence over p_guid in matching.
5725 --
5726 procedure Validate_Agent_Name (
5727 p_name in varchar2,
5728 p_guid in out nocopy raw)
5729 is
5730 l_names_count number := 0;
5731 l_guid raw(16);
5732 l_sguid raw(16);
5733 l_upper_name varchar2(240);
5734 l_system_name varchar2(80);
5735 delimiter number;
5736 begin
5737
5738 -- Make sure to blank out the guid if the user originally
5739 -- used the LOV to select the guid and then blanked out the display
5740 -- name then make sure here to blank out the guid and return
5741 if (p_name is null) then
5742 p_guid := NULL;
5743 return;
5744 end if;
5745
5746 -- First match against NAME. There shoul not be any duplicate, but
5747 -- if there is, go ahead and pick the min value so you may return
5748 -- something.
5749 delimiter := instr(p_name, '@');
5750 if (delimiter <> 0) then
5751 l_upper_name := upper(substr(p_name,1,delimiter-1));
5752 l_system_name := substr(p_name,delimiter+1);
5753 begin
5754 select GUID
5755 into l_sguid
5756 from WF_SYSTEMS
5757 where NAME = l_system_name;
5758 exception
5759 when OTHERS then
5760 l_sguid := null;
5761 end;
5762 else
5763 l_upper_name := upper(p_name);
5764 l_system_name := null;
5765 l_sguid := null;
5766 end if;
5767
5768 select min(GUID)
5769 into l_guid
5770 from WF_AGENTS
5771 where NAME = l_upper_name
5772 and (l_sguid is null or SYSTEM_GUID = l_sguid);
5773
5774 -- If you found a match, set p_guid accordingly.
5775 if (l_guid is not null) then
5776 p_guid := l_guid;
5777
5778 return;
5779
5780 -- check DISPLAY_NAME next
5781 else
5782 -- Count how many match the NAME
5783 select count(1)
5784 into l_names_count
5785 from WF_AGENTS
5786 where NAME = l_upper_name
5787 and (l_sguid is null or SYSTEM_GUID = l_sguid);
5788
5789 -- If you find a match, set p_guid accordingly.
5790 if (l_names_count = 1) then
5791 select GUID
5792 into p_guid
5793 from WF_AGENTS
5794 where NAME = l_upper_name
5795 and (l_sguid is null or SYSTEM_GUID = l_sguid);
5796
5797 return;
5798
5799 -- No match
5800 elsif (l_names_count = 0) then
5801
5802 wf_core.token('AGENT', p_name);
5803 wf_core.raise('WFE_AGENT_NOMATCH');
5804 -- ### '&AGENT' is not a valid agent guid, or display name.
5805
5806 -- Multiple matches
5807 else
5808 wf_core.token('NAME', p_name);
5809 wf_core.raise('WFE_NOTUNIQUE');
5810 -- ### '&NAME' is not unique. Please use the List of Values option
5811 -- ### to select the entity.
5812 end if;
5813 end if;
5814
5815 exception
5816 when OTHERS then
5817 wf_core.context('Wf_Event_Html', 'Validate_Agent_Name', p_name,
5818 rawtohex(p_guid));
5819 raise;
5820 end Validate_Agent_Name;
5821
5822 --
5823 -- AddSelectedGEvents
5824 -- Add selected events to group
5825 -- IN
5826 -- h_gguid - Global unique id for the group event
5827 -- h_guids - Array of global unique id of events
5828 -- NOTE
5829 --
5830 procedure AddSelectedGEvents(
5831 h_gguid in raw,
5832 h_guids in hguid_array)
5833 is
5834 cnt number;
5835 i pls_integer;
5836 row_id varchar2(30);
5837 begin
5838 -- check group guid is indeed a group
5839 select count(1) into cnt
5840 from WF_EVENTS
5841 where GUID = h_gguid
5842 and TYPE = 'GROUP';
5843
5844 if (cnt = 0) then
5845 wf_core.token('GUID', rawtohex(h_gguid));
5846 wf_core.raise('WFE_NOT_GGUID');
5847 end if;
5848
5849 -- add
5850 begin
5851 for i in 2..h_guids.LAST loop
5852 Wf_Event_Groups_Pkg.Insert_Row(
5853 x_rowid=>row_id,
5854 x_group_guid=>h_gguid,
5855 x_member_guid=>hextoraw(h_guids(i))
5856 );
5857 end loop;
5858 exception
5859 when OTHERS then
5860 wf_core.token('GGUID', rawtohex(h_gguid));
5861 wf_core.token('MGUID', h_guids(i));
5862 wf_core.raise('WFE_ADD_FAIL');
5863 end;
5864
5865 exception
5866 when OTHERS then
5867 wf_core.context('WF_EVENT_HTML', 'AddSelectedGEvents', rawtohex(h_gguid));
5868 raise;
5869 end AddSelectedGEvents;
5870
5871 --
5872 -- DeleteSelectedGEvents
5873 -- Delete selected events from group
5874 -- IN
5875 -- h_gguid - Global unique id for the group event
5876 -- h_guids - Array of global unique id of events
5877 -- NOTE
5878 --
5879 procedure DeleteSelectedGEvents(
5880 h_gguid in raw,
5881 h_guids in hguid_array)
5882 is
5883 i pls_integer;
5884 begin
5885 -- delete
5886 begin
5887 for i in 2..h_guids.LAST loop
5888 Wf_Event_Groups_Pkg.Delete_Row(
5889 x_group_guid=>h_gguid,
5890 x_member_guid=>hextoraw(h_guids(i))
5891 );
5892 end loop;
5893 exception
5894 when OTHERS then
5895 wf_core.token('GGUID', rawtohex(h_gguid));
5896 wf_core.token('MGUID', h_guids(i));
5897 wf_core.raise('WFE_DELETE_FAIL');
5898 end;
5899
5900 exception
5901 when OTHERS then
5902 wf_core.context('WF_EVENT_HTML','DeleteSelectedGEvents',rawtohex(h_gguid));
5903 raise;
5904 end DeleteSelectedGEvents;
5905 -- EnterEventDetails
5906 -- Enter Event Name, Event Key, Event Data to raise business event
5907 -- IN
5908 -- p_event_name - event name or part thereof
5909 procedure EnterEventDetails(
5910 P_EVENT_NAME in varchar2 default '%')
5911 is
5912 begin
5913 null;
5914 end EnterEventDetails;
5915 -- RaiseEvent
5916 -- Called from EnterEventDetails, calls wf_event.raise
5917 -- IN
5918 -- p_event_name - event name
5919 -- p_event_key - event key
5920 -- p_event_data - event data
5921 procedure RaiseEvent(
5922 P_EVENT_NAME in varchar2 default null,
5923 P_EVENT_KEY in varchar2 default null,
5924 P_EVENT_DATA in varchar2 default null
5925 ) is
5926
5927 username varchar2(320); -- Username to query
5928 admin_role varchar2(320); -- Role for admin mode
5929
5930 l_event_data clob;
5931 begin
5932
5933 -- Check session and current user
5934 wfa_sec.GetSession(username);
5935 username := upper(username);
5936 wf_events_pkg.setMode;
5937
5938 -- Check Admin Priviledge
5939 admin_role := wf_core.translate('WF_ADMIN_ROLE');
5940 if (admin_role = '*' or
5941 Wf_Directory.IsPerformer(username, admin_role)) then
5942 -- Have admin privledge, do nothing.
5943 null;
5944 else
5945 wf_core.raise('WF_NOTADMIN');
5946 end if;
5947
5948 if p_event_data is null then
5949 wf_event.raise(p_event_name, p_event_key);
5950 else
5951 dbms_lob.createtemporary(l_event_data, FALSE, DBMS_LOB.CALL);
5952 dbms_lob.write(l_event_data, length(p_event_data), 1 , p_event_data);
5953 wf_event.raise(p_event_name, p_event_key, l_event_data);
5954 end if;
5955
5956 owa_util.redirect_url(curl=> wfa_html.base_url||'/wf_event_html.RaiseEventConfirm?p_event_name='||p_event_name||'&p_event_key='||p_event_key);
5957
5958 exception
5959 when OTHERS then
5960 rollback;
5961 wf_core.context('WF_EVENT_HTML', 'RaiseEvent', p_event_name, p_event_key);
5962 wfe_html_util.Error;
5963 --raise;
5964 end RaiseEvent;
5965 -- RaiseEventConfirm
5966 -- Screen which confirms to user that event was raised.
5967 procedure RaiseEventConfirm(
5968 P_EVENT_NAME in varchar2 default null,
5969 P_EVENT_KEY in varchar2 default null)
5970
5971 is
5972 username varchar2(320); -- Username to query
5973 admin_role varchar2(320); -- Role for admin mode
5974 template varchar2(4000); -- Use for construct form select list
5975 begin
5976 -- Check session and current user
5977 wfa_sec.GetSession(username);
5978 username := upper(username);
5979 wf_events_pkg.setMode;
5980
5981 -- Check Admin Priviledge
5982 admin_role := wf_core.translate('WF_ADMIN_ROLE');
5983 if (admin_role = '*' or
5984 Wf_Directory.IsPerformer(username, admin_role)) then
5985 -- Have admin privledge, do nothing.
5986 null;
5987 else
5988 wf_core.raise('WF_NOTADMIN');
5989 end if;
5990
5991 htp.htmlOpen;
5992 htp.headOpen;
5993 htp.title(wf_core.translate('WFE_RAISE_EVENT_SUBMITTED'));
5994 wfa_html.create_help_function('wf/links/t_r.htm?T_RAISEVNT');
5995 wfa_sec.header(background_only=>FALSE,
5996 page_title=>wf_core.translate('WFE_RAISE_EVENT_SUBMITTED'));
5997 htp.headClose;
5998
5999 htp.br;
6000 htp.br;
6001 htp.br;
6002 htp.tableOpen(calign=>'CENTER', cattributes=>'border=0 summary=""');
6003 htp.tableRowOpen;
6004 htp.p('<TD ID="">');
6005 htp.bold(wf_core.translate('WFE_RAISE_EVENT_SUBMITTED')||': '||p_event_name
6006 ||' / '||p_event_key);
6007 htp.p('</TD>');
6008 htp.tableRowClose;
6009 htp.tableClose;
6010
6011 htp.br;
6012
6013 htp.tableopen (cattributes =>'align=CENTER border=0 summary=""');
6014 htp.tableRowOpen;
6015 htp.p('<TD ID="">');
6016 wfa_html.create_reg_button (wfa_html.base_url||
6017 '/Wf_Event_Html.entereventdetails'||
6018 '?p_event_name=%',
6019 wf_core.translate('WFMON_OK'),
6020 wfa_html.image_loc,
6021 null,
6022 wf_core.translate('WFMON_OK'));
6023
6024 htp.p('</TD>');
6025 htp.tableRowClose;
6026 htp.tableClose;
6027
6028 wfa_sec.Footer;
6029 htp.htmlClose;
6030 exception
6031 when OTHERS then
6032 rollback;
6033 wf_core.context('WF_EVENT_HTML', 'RaiseEventConfirm');
6034 wfe_html_util.Error;
6035 --raise;
6036 end RaiseEventConfirm;
6037 -- GetSystemIdentifier
6038 -- Returns xml document which contains Local System and In Agent details
6039 procedure GetSystemIdentifier
6040 is
6041
6042 username varchar2(320); -- Username to query
6043 admin_role varchar2(320); -- Role for admin mode
6044
6045 l_system_guid raw(16);
6046 l_agent_guid raw(16);
6047
6048 l_begin_dtd varchar2(240) := '<oracle.apps.wf.event.all.sync>';
6049 l_end_dtd varchar2(240) := '</oracle.apps.wf.event.all.sync>';
6050
6051 l_dtd varchar2(32000);
6052 l_systems number;
6053
6054 cursor agent is
6055 select guid
6056 from wf_agents
6057 where system_guid = l_system_guid
6058 and direction = 'IN'
6059 and status = 'ENABLED';
6060
6061 begin
6062 -- Check session and current user
6063 wfa_sec.GetSession(username);
6064 username := upper(username);
6065 wf_events_pkg.setMode;
6066
6067 -- Check Admin Priviledge
6068 admin_role := wf_core.translate('WF_ADMIN_ROLE');
6069 if (admin_role = '*' or
6070 Wf_Directory.IsPerformer(username, admin_role)) then
6071 -- Have admin privledge, do nothing.
6072 null;
6073 else
6074 wf_core.raise('WF_NOTADMIN');
6075 end if;
6076
6077 -- Check if Accessible
6078 wf_event_html.isAccessible('AGENTS');
6079
6080 -- Get Local System GUID
6081 l_system_guid := hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
6082
6083 -- Build XML Document
6084 l_dtd := l_begin_dtd;
6085
6086 l_dtd := l_dtd||wf_systems_pkg.generate(l_system_guid);
6087
6088 open agent;
6089 loop
6090 fetch agent into l_agent_guid;
6091 exit when agent%notfound;
6092 if l_agent_guid is not null then
6093 l_dtd := substr(l_dtd||wf_agents_pkg.generate(l_agent_guid),1,32000);
6094 end if;
6095 end loop;
6096 close agent;
6097
6098 l_dtd := substr(l_dtd||l_end_dtd,1,32000);
6099
6100 owa_util.mime_header('text/xml', TRUE);
6101
6102 owa_util.http_header_close;
6103
6104 htp.p(l_dtd);
6105
6106 exception
6107 when OTHERS then
6108 rollback;
6109 wf_core.context('WF_EVENT_HTML', 'GetSystemIdentifier');
6110 wfe_html_util.Error;
6111 --raise;
6112 end GetSystemIdentifier;
6113
6114 -- Event Queue Display
6115 -- Shows all event queues and message count that use WF_EVENT_QH queue
6116 -- handler
6117 -- MODIFICATION LOG:
6118 -- 06-JUN-2001 JWSMITH BUG 1819232 - Added alt attr for IMG tag for ADA
6119 --
6120 procedure EventQueueDisplay
6121 is
6122 username varchar2(320); -- Username to query
6123 admin_role varchar2(320); -- Role for admin mode
6124 admin_mode varchar2(1) := 'N';
6125 realname varchar2(360); -- Display name of username
6126 s0 varchar2(2000); -- Dummy
6127 l_error_msg varchar2(240);
6128 l_url varchar2(240);
6129 l_media varchar2(240) := wfa_html.image_loc;
6130 l_icon varchar2(40);
6131 l_text varchar2(240);
6132 l_onmouseover varchar2(240);
6133 l_sqlstmt varchar2(240);
6134 l_count number;
6135 l_default_queue varchar2(80);
6136 l_rc binary_integer;
6137 l_knowndatatype boolean := FALSE;
6138
6139 cursor queues_cursor is
6140 select wfa.protocol,
6141 wfa.direction,
6142 wfa.display_name,
6143 substr(wfa.queue_name,instr(wfa.queue_name,'.',1)+1) QUEUE_NAME,
6144 wfa.queue_name SCHEMA_QUEUE_NAME,
6145 aq.queue_table QUEUE_TABLE,
6146 upper(wfa.queue_handler) QUEUE_HANDLER
6147 from wf_agents wfa ,
6148 all_queues aq
6149 where wfa.system_guid = hextoraw(wf_core.translate('WF_SYSTEM_GUID'))
6150 --and upper(wfa.queue_handler) = 'WF_EVENT_QH'
6151 and aq.name = substr(wfa.queue_name,instr(wfa.queue_name,'.',1)+1)
6152 and aq.owner = substr(wfa.queue_name,1,instr(wfa.queue_name,'.',1)-1)
6153 order by queue_name;
6154
6155 rowcount number;
6156
6157 begin
6158 -- Check current user has admin authority
6159 wfa_sec.GetSession(username);
6160 username := upper(username);
6161 wf_events_pkg.setMode;
6162
6163 wf_directory.GetRoleInfo(username, realname, s0, s0, s0, s0);
6164
6165 admin_role := wf_core.translate('WF_ADMIN_ROLE');
6166 if (admin_role = '*' or
6167 Wf_Directory.IsPerformer(username, admin_role)) then
6168 admin_mode := 'Y';
6169 else
6170
6171 l_error_msg := wf_core.translate('WFPREF_INVALID_ADMIN');
6172
6173 end if;
6174
6175 -- Check if Accessible
6176 wf_event_html.isAccessible('AGENTS');
6177
6178 -- Set page title
6179 htp.htmlOpen;
6180 htp.headOpen;
6181 htp.p('<BASE TARGET="_top">');
6182 htp.title(wf_core.translate('WFGENERIC_QUEUE_TITLE'));
6183 wfa_html.create_help_function('wf/links/t_r.htm?T_REVQUE');
6184 htp.headClose;
6185 wfa_sec.Header(FALSE, '',wf_core.translate('WFGENERIC_QUEUE_TITLE'), FALSE);
6186 htp.br;
6187
6188 -- This page is deprecated since Agent Activity link in Workflow Manager also shows the
6189 -- same details
6190 htp.center(Wf_Core.Translate('WFE_QUEUEPAGE_DEPRECATED'));
6191 htp.htmlClose;
6192 return;
6193
6194 IF (admin_mode = 'N') THEN
6195
6196 htp.center(htf.bold(l_error_msg));
6197 return;
6198
6199 END IF;
6200
6201 -- Column headers
6202 htp.tableOpen('border=1 cellpadding=3 bgcolor=white width="100%"
6203 summary="' || wf_core.translate('WFGENERIC_QUEUE_TITLE') || '"');
6204 htp.tableRowOpen(cattributes=>'bgcolor=#006699');
6205
6206 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6207 wf_core.translate('PROTOCOL')||'</font>',
6208 calign=>'Center',
6209 cattributes=>'id="' ||
6210 wf_core.translate('PROTOCOL') || '"');
6211 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6212 wf_core.translate('AGENT_NAME')||'</font>',
6213 calign=>'Center',
6214 cattributes=>'id="' ||
6215 wf_core.translate('AGENT_NAME') || '"');
6216 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6217 wf_core.translate('INBOUND_PROMPT')||'</font>',
6218 calign=>'Center',
6219 cattributes=>'id="' ||
6220 wf_core.translate('INBOUND_PROMPT') || '"');
6221 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6222 wf_core.translate('QUEUE_COUNT')||'</font>',
6223 calign=>'Center',
6224 cattributes=>'id="' ||
6225 wf_core.translate('QUEUE_COUNT') || '"');
6226 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6227 wf_core.translate('VIEW_DETAIL')||'</font>',
6228 calign=>'Center',
6229 cattributes=>'id="' ||
6230 wf_core.translate('VIEW_DETAIL') || '"');
6231
6232 htp.tableRowClose;
6233 htp.tableRowOpen;
6234 htp.tableRowClose;
6235
6236 -- Show all nodes
6237 for queues in queues_cursor loop
6238 l_sqlstmt := 'SELECT COUNT(*) FROM '||queues.queue_table||
6239 ' WHERE Q_NAME = :b1';
6240
6241 EXECUTE IMMEDIATE l_sqlstmt INTO l_count USING queues.queue_name;
6242
6243 htp.tableRowOpen(null, 'TOP');
6244
6245 htp.tableData(queues.protocol, 'center',
6246 cattributes=>'headers="' ||
6247 wf_core.translate('PROTOCOL') || '"');
6248
6249 htp.tableData(nvl(queues.display_name,'&'||'nbsp'), 'left',
6250 cattributes=>'headers="' ||
6251 wf_core.translate('AGENT_NAME') || '"');
6252
6253 htp.tableData(queues.direction, 'center',
6254 cattributes=>'headers="' ||
6255 wf_core.translate('INBOUND_PROMPT') || '"');
6256
6257 htp.tableData(nvl(l_count,0), 'center',
6258 cattributes=>'headers="' ||
6259 wf_core.translate('QUEUE_COUNT') || '"');
6260
6261 --
6262 -- Check if queue type matches default event queue WF_ERROR
6263 -- If it does, then we can allow drill down on wf_event_t
6264 --
6265 begin
6266 SELECT queue_name
6267 INTO l_default_queue
6268 FROM wf_agents
6269 WHERE name = 'WF_ERROR'
6270 AND system_guid = hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
6271
6272 dbms_aqadm.verify_queue_types(l_default_queue,
6273 queues.schema_queue_name,
6274 '',
6275 l_rc);
6276 IF l_rc = 1 then
6277 htp.tableData(htf.anchor2(curl=>wfa_html.base_url||
6278 '/wf_event_html.FindQueueMessage?p_queue_name='||
6279 queues.queue_name||'&p_type=WF_EVENT_T',
6280 ctext=>'<IMG SRC="'||wfa_html.image_loc
6281 ||'affind.gif" alt="' ||
6282 wf_core.translate('FIND') || '" BORDER=0>'),
6283 'center', cattributes=>'valign="MIDDLE" id=""');
6284 l_knowndatatype := TRUE;
6285 END IF;
6286
6287 IF l_knowndatatype = FALSE then
6288 SELECT queue_name
6289 INTO l_default_queue
6290 FROM wf_agents
6291 WHERE name = 'ECX_INBOUND'
6292 AND system_guid = hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
6293
6294 dbms_aqadm.verify_queue_types(l_default_queue,
6295 queues.schema_queue_name,
6296 '',
6297 l_rc);
6298
6299 IF l_rc = 1 then
6300 htp.tableData(htf.anchor2(curl=>wfa_html.base_url||
6301 '/wf_event_html.FindECXMSGQueueMessage?p_queue_name='||
6302 queues.queue_name||'&p_type=ECX_MSG',
6303 ctext=>'<IMG SRC="'||wfa_html.image_loc
6304 ||'affind.gif" alt="' ||
6305 wf_core.translate('FIND') || '" BORDER=0>'),
6306 'center', cattributes=>'valign="MIDDLE" id=""');
6307 l_knowndatatype := TRUE;
6308 END IF;
6309 END IF;
6310
6311 IF l_knowndatatype = FALSE then
6312 SELECT queue_name
6313 INTO l_default_queue
6314 FROM wf_agents
6315 WHERE name = 'ECX_TRANSACTION'
6316 AND system_guid = hextoraw(wf_core.translate('WF_SYSTEM_GUID'));
6317
6318 dbms_aqadm.verify_queue_types(l_default_queue,
6319 queues.schema_queue_name,
6320 '',
6321 l_rc);
6322
6323 IF l_rc = 1 then
6324 htp.tableData(htf.anchor2(curl=>wfa_html.base_url||
6325 '/wf_event_html.FindECX_INENGOBJQueueMessage?p_queue_name='||
6326 queues.queue_name||'&p_type=INENGOBJ',
6327 ctext=>'<IMG SRC="'||wfa_html.image_loc
6328 ||'affind.gif" alt="' ||
6329 wf_core.translate('FIND') || '" BORDER=0>'),
6330 'center', cattributes=>'valign="MIDDLE" id=""');
6331 l_knowndatatype := TRUE;
6332 END IF;
6333 END IF;
6334
6335 IF l_knowndatatype = FALSE then
6336 htp.tableData(wf_core.translate('WFE_NOT_AVAILABLE'),'center',
6337 cattributes=>'id=""');
6338 END IF;
6339
6340 exception
6341 when others then
6342 htp.tableData(wf_core.translate('WFE_NOT_AVAILABLE'),'center',
6343 cattributes=>'id=""');
6344 end;
6345 l_knowndatatype := FALSE;
6346 end loop;
6347
6348 htp.tableclose;
6349
6350 htp.br;
6351
6352 wfa_sec.Footer;
6353 htp.htmlClose;
6354
6355 exception
6356 when others then
6357 rollback;
6358 wf_core.context('WF_EVENT_HTML', 'EventQueueDisplay');
6359 wfe_html_util.Error;
6360 --raise;
6361 end EventQueueDisplay;
6362 -- FindQueueMessage
6363 -- Filter Screen over Queue Messages
6364 -- IN
6365 -- Queue Name - used if called from EventQueueDisplay
6366 procedure FindQueueMessage (
6367 P_QUEUE_NAME in varchar2 default null,
6368 P_TYPE in varchar2 default null
6369 )
6370 is
6371 username varchar2(320); -- Username to query
6372 admin_role varchar2(320); -- Role for admin mode
6373 template varchar2(4000); -- Use for construct form select list
6374 l_url varchar2(240); -- url for form
6375 title varchar2(2000);
6376 helptext varchar2(2000);
6377
6378
6379 cursor queues_cursor is
6380 select
6381 substr(wfa.queue_name,instr(wfa.queue_name,'.',1)+1) QUEUE_NAME
6382 from wf_agents wfa ,
6383 all_queues aq
6384 where wfa.system_guid = hextoraw(wf_core.translate('WF_SYSTEM_GUID'))
6385 and aq.name = substr(wfa.queue_name,instr(wfa.queue_name,'.',1)+1)
6386 and aq.name like nvl(p_queue_name,'%')
6387 and aq.owner = substr(wfa.queue_name,1,instr(wfa.queue_name,'.',1)-1)
6388 order by queue_name;
6389
6390 -- addable event cursor
6391 -- all events meet the query criteria
6392 cursor aevcurs is
6393 select GUID, DISPLAY_NAME, NAME, TYPE, STATUS
6394 from WF_EVENTS_VL
6395 where TYPE = 'EVENT'
6396 order by NAME;
6397
6398 begin
6399 -- Check session and current user
6400 wfa_sec.GetSession(username);
6401 username := upper(username);
6402 wf_events_pkg.setMode;
6403
6404 -- Check Admin Priviledge
6405 admin_role := wf_core.translate('WF_ADMIN_ROLE');
6406 if (admin_role = '*' or
6407 Wf_Directory.IsPerformer(username, admin_role)) then
6408 -- Have admin privledge, do nothing.
6409 null;
6410 else
6411 wf_core.raise('WF_NOTADMIN');
6412 end if;
6413
6414 -- Check if Accessible
6415 wf_event_html.isAccessible('AGENTS');
6416
6417 l_url := 'Wf_Event_Html.ListQueueMessages';
6418 title := wf_core.translate('WFE_FIND_QUEUE_MESSAGES_TITLE');
6419 helptext := 'wf/links/t_f.htm?T_FDQMSG';
6420
6421 -- Render page
6422 htp.htmlOpen;
6423
6424 -- Set page title
6425 htp.headOpen;
6426 htp.title(title);
6427 wfa_html.create_help_function(helptext);
6428 fnd_document_management.get_open_dm_display_window;
6429 htp.headClose;
6430
6431 -- Page header
6432 wfa_sec.Header(FALSE, null, title, TRUE);
6433
6434 -- Form
6435 htp.formOpen(curl=>l_url,
6436 cmethod=>'Post',
6437 cattributes=>'NAME="WF_QUEUE_MESSAGE_FIND"');
6438 htp.tableOpen(calign=>'CENTER', cattributes=>'border=0 summary=""');
6439
6440 -- Queue Name (pulldown list of Queue Names)
6441 htp.tableRowOpen;
6442 htp.tableData(cvalue=>'<LABEL FOR="i_queue_name">' ||
6443 wf_core.translate('QUEUE_NAME') || '</LABEL>',
6444 calign=>'right',
6445 cattributes=>'valign=middle id=""');
6446 htp.p('<TD ID="' || wf_core.translate('QUEUE_NAME') || '">');
6447 htp.formSelectOpen(cname=>'p_queue_name',cattributes=>'id="i_queue_name"');
6448 for i in queues_cursor loop
6449 htp.formSelectOption(cvalue=>i.queue_name
6450 ,cattributes=>'value='||i.queue_name);
6451 end loop;
6452 htp.formSelectClose;
6453 htp.p('</TD>');
6454 htp.tableRowClose;
6455
6456 -- Event Name
6457 htp.tableRowOpen;
6458 htp.tableData(cvalue=>'<LABEL FOR="i_event_name">' ||
6459 wf_core.translate('EVENT_NAME') || '</LABEL>',
6460 calign=>'Right', cattributes=>'id=""');
6461 htp.tableData(cvalue=>htf.formText(cname=>'p_event_name', csize=>40,
6462 cmaxlength=>240,
6463 cattributes=>'id="i_event_name"'),
6464 calign=>'Left', cattributes=>'id=""');
6465 htp.tableRowClose;
6466
6467 -- Event Key
6468 htp.tableRowOpen;
6469 htp.tableData(cvalue=>'<LABEL FOR="i_event_key">' ||
6470 wf_core.translate('EVENT_KEY') || '</LABEL>',
6471 calign=>'Right',cattributes=>'id=""');
6472 htp.tableData(cvalue=>htf.formText(cname=>'p_event_key', csize=>40,
6473 cmaxlength=>240,
6474 cattributes=>'id="i_event_key"'),
6475 calign=>'Left',cattributes=>'id=""');
6476 htp.tableRowClose;
6477
6478 -- Message Status
6479 template := htf.formSelectOpen('p_message_status',
6480 cattributes=>'id="i_message_status"')||wf_core.newline;
6481
6482 template := template||htf.formSelectOption(wf_core.translate('ANY'),
6483 null,'VALUE="ANY"')||wf_core.newline||
6484 htf.formSelectOption(wf_core.translate('READY'),
6485 'SELECTED','VALUE="READY"')||wf_core.newline||
6486 htf.formSelectOption(wf_core.translate('WAIT'),
6487 null,'VALUE="WAIT"')||wf_core.newline||
6488 htf.formSelectOption(wf_core.translate('PROCESSED'),
6489 null,'VALUE="PROCESSED"')||wf_core.newline||
6490 htf.formSelectOption(wf_core.translate('EXPIRED'),
6491 null,'VALUE="EXPIRED"');
6492 template := template||wf_core.newline||htf.formSelectClose;
6493
6494 htp.tableRowOpen;
6495 htp.tableData(cvalue=>'<LABEL FOR="i_message_status">' ||
6496 wf_core.translate('STATUS') || '</LABEL>',
6497 calign=>'Right',cattributes=>'id=""');
6498 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
6499 htp.tableRowClose;
6500
6501 htp.tableClose;
6502 htp.formClose;
6503 -- Add submit button
6504 htp.tableopen (calign=>'CENTER', cattributes=>'summary=""');
6505 htp.tableRowOpen;
6506
6507 htp.p('<TD ID="">');
6508
6509 wfa_html.create_reg_button ('javascript:document.WF_QUEUE_MESSAGE_FIND.submit()',
6510 wf_core.translate('GO'),
6511 wfa_html.image_loc,
6512 null,
6513 wf_core.translate('GO'));
6514
6515 htp.p('</TD>');
6516
6517 htp.tableRowClose;
6518 htp.tableClose;
6519
6520 wfa_sec.Footer;
6521 htp.htmlClose;
6522
6523 exception
6524 when others then
6525 rollback;
6526 wf_core.context('WF_EVENT_HTML', 'FindQueueMessage');
6527 wfe_html_util.Error;
6528 end;
6529 -- FindECXMSGQueueMessage
6530 -- Filter Screen over Queue Messages
6531 -- IN
6532 -- Queue Name - used if called from EventQueueDisplay
6533 procedure FindECXMSGQueueMessage(
6534 P_QUEUE_NAME in varchar2 default null,
6535 P_TYPE in varchar2 default null
6536 )
6537 is
6538 username varchar2(320); -- Username to query
6539 admin_role varchar2(320); -- Role for admin mode
6540 template varchar2(4000); -- Use for construct form select list
6541 l_url varchar2(240); -- url for form
6542 title varchar2(2000);
6543 helptext varchar2(2000);
6544
6545 cursor queues_cursor is
6546 select
6547 substr(wfa.queue_name,instr(wfa.queue_name,'.',1)+1) QUEUE_NAME
6548 from wf_agents wfa ,
6549 all_queues aq
6550 where wfa.system_guid = hextoraw(wf_core.translate('WF_SYSTEM_GUID'))
6551 and aq.name = substr(wfa.queue_name,instr(wfa.queue_name,'.',1)+1)
6552 and aq.name like nvl(p_queue_name,'%')
6553 and aq.owner = substr(wfa.queue_name,1,instr(wfa.queue_name,'.',1)-1)
6554 order by queue_name;
6555
6556 begin
6557 -- Check session and current user
6558 wfa_sec.GetSession(username);
6559 username := upper(username);
6560 wf_events_pkg.setMode;
6561
6562 -- Check Admin Priviledge
6563 admin_role := wf_core.translate('WF_ADMIN_ROLE');
6564 if (admin_role = '*' or
6565 Wf_Directory.IsPerformer(username, admin_role)) then
6566 -- Have admin privledge, do nothing.
6567 null;
6568 else
6569 wf_core.raise('WF_NOTADMIN');
6570 end if;
6571
6572 -- Check if Accessible
6573 wf_event_html.isAccessible('AGENTS');
6574
6575 l_url := 'ecx_workflow_html.ListECXMSGQueueMessages';
6576 title := wf_core.translate('WFE_FIND_QUEUE_MESSAGES_TITLE');
6577 helptext := 'wf/links/t_f.htm?T_FDQMSG';
6578
6579 -- Render page
6580 htp.htmlOpen;
6581
6582 -- Set page title
6583 htp.headOpen;
6584 htp.title(title);
6585 wfa_html.create_help_function(helptext);
6586 fnd_document_management.get_open_dm_display_window;
6587 htp.headClose;
6588
6589 -- Page header
6590 wfa_sec.Header(FALSE, null, title, TRUE);
6591
6592 -- Form
6593 htp.formOpen(curl=>l_url,
6594 cmethod=>'Post',
6595 cattributes=>'NAME="WF_QUEUE_MESSAGE_FIND"');
6596 htp.tableOpen(calign=>'CENTER', cattributes=>'border=0 summary=""');
6597
6598 -- Queue Name (pulldown list of Queue Names)
6599 htp.tableRowOpen;
6600 htp.tableData(cvalue=>'<LABEL FOR="i_queue_name">' ||
6601 wf_core.translate('QUEUE_NAME') || '</LABEL>',
6602 calign=>'right',
6603 cattributes=>'valign=middle id=""');
6604 htp.p('<TD ID="' || wf_core.translate('QUEUE_NAME') || '">');
6605 htp.formSelectOpen(cname=>'p_queue_name',cattributes=>'id="i_queue_name"');
6606 for i in queues_cursor loop
6607 htp.formSelectOption(cvalue=>i.queue_name
6608 ,cattributes=>'value='||i.queue_name);
6609 end loop;
6610 htp.formSelectClose;
6611 htp.p('</TD>');
6612 htp.tableRowClose;
6613
6614 -- Transaction Type
6615 htp.tableRowOpen;
6616 htp.tableData(cvalue=>'<LABEL FOR="i_transaction_type">' ||
6617 wf_core.translate('TRANSACTIONTYPE') || '</LABEL>',
6618 calign=>'Right', cattributes=>'id=""');
6619 htp.tableData(cvalue=>htf.formText(cname=>'p_transaction_type', csize=>40,
6620 cmaxlength=>240,
6621 cattributes=>'id="i_transaction_type"'),
6622 calign=>'Left', cattributes=>'id=""');
6623 htp.tableRowClose;
6624
6625 -- Document Number
6626 htp.tableRowOpen;
6627 htp.tableData(cvalue=>'<LABEL FOR="i_document_number">' ||
6628 wf_core.translate('DOCUMENTNUMBER') || '</LABEL>',
6629 calign=>'Right',cattributes=>'id=""');
6630 htp.tableData(cvalue=>htf.formText(cname=>'p_document_number', csize=>40,
6631 cmaxlength=>240,
6632 cattributes=>'id="i_document_number"'),
6633 calign=>'Left',cattributes=>'id=""');
6634 htp.tableRowClose;
6635
6636 -- Party Site ID
6637 htp.tableRowOpen;
6638 htp.tableData(cvalue=>'<LABEL FOR="i_party_site_id">' ||
6639 wf_core.translate('PARTYSITEID') || '</LABEL>',
6640 calign=>'Right',cattributes=>'id=""');
6641 htp.tableData(cvalue=>htf.formText(cname=>'p_party_site_id', csize=>40,
6642 cmaxlength=>240,
6643 cattributes=>'id="i_party_site_id"'),
6644 calign=>'Left',cattributes=>'id=""');
6645 htp.tableRowClose;
6646
6647 -- Message Status
6648 template := htf.formSelectOpen('p_message_status',
6649 cattributes=>'id="i_message_status"')||wf_core.newline;
6650
6651 template := template||htf.formSelectOption(wf_core.translate('ANY'),
6652 null,'VALUE="ANY"')||wf_core.newline||
6653 htf.formSelectOption(wf_core.translate('READY'),
6654 'SELECTED','VALUE="READY"')||wf_core.newline||
6655 htf.formSelectOption(wf_core.translate('WAIT'),
6656 null,'VALUE="WAIT"')||wf_core.newline||
6657 htf.formSelectOption(wf_core.translate('PROCESSED'),
6658 null,'VALUE="PROCESSED"')||wf_core.newline||
6659 htf.formSelectOption(wf_core.translate('EXPIRED'),
6660 null,'VALUE="EXPIRED"');
6661 template := template||wf_core.newline||htf.formSelectClose;
6662
6663 htp.tableRowOpen;
6664 htp.tableData(cvalue=>'<LABEL FOR="i_message_status">' ||
6665 wf_core.translate('STATUS') || '</LABEL>',
6666 calign=>'Right',cattributes=>'id=""');
6667 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
6668 htp.tableRowClose;
6669
6670 htp.tableClose;
6671 htp.formClose;
6672 -- Add submit button
6673 htp.tableopen (calign=>'CENTER', cattributes=>'summary=""');
6674 htp.tableRowOpen;
6675
6676 htp.p('<TD ID="">');
6677
6678 wfa_html.create_reg_button ('javascript:document.WF_QUEUE_MESSAGE_FIND.submit(
6679 )',
6680 wf_core.translate('GO'),
6681 wfa_html.image_loc,
6682 null,
6683 wf_core.translate('GO'));
6684
6685 htp.p('</TD>');
6686
6687 htp.tableRowClose;
6688 htp.tableClose;
6689 wfa_sec.Footer;
6690 htp.htmlClose;
6691
6692 exception
6693 when others then
6694 rollback;
6695 wf_core.context('WF_EVENT_HTML', 'FindECXMSGQueueMessage');
6696 wfe_html_util.Error;
6697 end;
6698 -- FindECXMSGQueueMessage
6699 -- Filter Screen over Queue Messages
6700 -- IN
6701 -- Queue Name - used if called from EventQueueDisplay
6702 procedure FindECX_INENGOBJQueueMessage(
6703 P_QUEUE_NAME in varchar2 default null,
6704 P_TYPE in varchar2 default null
6705 )
6706 is
6707 username varchar2(320); -- Username to query
6708 admin_role varchar2(320); -- Role for admin mode
6709 template varchar2(4000); -- Use for construct form select list
6710 l_url varchar2(240); -- url for form
6711 title varchar2(2000);
6712 helptext varchar2(2000);
6713
6714 cursor queues_cursor is
6715 select
6716 substr(wfa.queue_name,instr(wfa.queue_name,'.',1)+1) QUEUE_NAME
6717 from wf_agents wfa ,
6718 all_queues aq
6719 where wfa.system_guid = hextoraw(wf_core.translate('WF_SYSTEM_GUID'))
6720 and aq.name = substr(wfa.queue_name,instr(wfa.queue_name,'.',1)+1)
6721 and aq.name like nvl(p_queue_name,'%')
6722 and aq.owner = substr(wfa.queue_name,1,instr(wfa.queue_name,'.',1)-1)
6723 order by queue_name;
6724
6725 begin
6726 -- Check session and current user
6727 wfa_sec.GetSession(username);
6728 username := upper(username);
6729 wf_events_pkg.setMode;
6730
6731 -- Check Admin Priviledge
6732 admin_role := wf_core.translate('WF_ADMIN_ROLE');
6733 if (admin_role = '*' or
6734 Wf_Directory.IsPerformer(username, admin_role)) then
6735 -- Have admin privledge, do nothing.
6736 null;
6737 else
6738 wf_core.raise('WF_NOTADMIN');
6739 end if;
6740
6741 -- Check if Accessible
6742 wf_event_html.isAccessible('AGENTS');
6743
6744 l_url := 'ecx_workflow_html.ListECX_INENGOBJQueueMessages';
6745 title := wf_core.translate('WFE_FIND_QUEUE_MESSAGES_TITLE');
6746 helptext := 'wf/links/t_f.htm?T_FDQMSG';
6747
6748 -- Render page
6749 htp.htmlOpen;
6750
6751 -- Set page title
6752 htp.headOpen;
6753 htp.title(title);
6754 wfa_html.create_help_function(helptext);
6755 fnd_document_management.get_open_dm_display_window;
6756 htp.headClose;
6757
6758 -- Page header
6759 wfa_sec.Header(FALSE, null, title, TRUE);
6760
6761 -- Form
6762 htp.formOpen(curl=>l_url,
6763 cmethod=>'Post',
6764 cattributes=>'NAME="WF_QUEUE_MESSAGE_FIND"');
6765 htp.tableOpen(calign=>'CENTER', cattributes=>'border=0 summary=""');
6766
6767 -- Queue Name (pulldown list of Queue Names)
6768 htp.tableRowOpen;
6769 htp.tableData(cvalue=>'<LABEL FOR="i_queue_name">' ||
6770 wf_core.translate('QUEUE_NAME') || '</LABEL>',
6771 calign=>'right',
6772 cattributes=>'valign=middle id=""');
6773 htp.p('<TD ID="' || wf_core.translate('QUEUE_NAME') || '">');
6774 htp.formSelectOpen(cname=>'p_queue_name',cattributes=>'id="i_queue_name"');
6775 for i in queues_cursor loop
6776 htp.formSelectOption(cvalue=>i.queue_name
6777 ,cattributes=>'value='||i.queue_name);
6778 end loop;
6779 htp.formSelectClose;
6780 htp.p('</TD>');
6781 htp.tableRowClose;
6782
6783 -- Message Id
6784 htp.tableRowOpen;
6785 htp.tableData(cvalue=>'<LABEL FOR="i_message_id">' ||
6786 wf_core.translate('MESSAGEID') || '</LABEL>',
6787 calign=>'Right', cattributes=>'id=""');
6788 htp.tableData(cvalue=>htf.formText(cname=>'p_message_id', csize=>40,
6789 cmaxlength=>240,
6790 cattributes=>'id="i_message_id"'),
6791 calign=>'Left', cattributes=>'id=""');
6792 htp.tableRowClose;
6793
6794 -- Message Status
6795 template := htf.formSelectOpen('p_message_status',
6796 cattributes=>'id="i_message_status"')||wf_core.newline;
6797
6798 template := template||htf.formSelectOption(wf_core.translate('ANY'),
6799 null,'VALUE="ANY"')||wf_core.newline||
6800 htf.formSelectOption(wf_core.translate('READY'),
6801 'SELECTED','VALUE="READY"')||wf_core.newline||
6802 htf.formSelectOption(wf_core.translate('WAIT'),
6803 null,'VALUE="WAIT"')||wf_core.newline||
6804 htf.formSelectOption(wf_core.translate('PROCESSED'),
6805 null,'VALUE="PROCESSED"')||wf_core.newline||
6806 htf.formSelectOption(wf_core.translate('EXPIRED'),
6807 null,'VALUE="EXPIRED"');
6808 template := template||wf_core.newline||htf.formSelectClose;
6809
6810 htp.tableRowOpen;
6811 htp.tableData(cvalue=>'<LABEL FOR="i_message_status">' ||
6812 wf_core.translate('STATUS') || '</LABEL>',
6813 calign=>'Right',cattributes=>'id=""');
6814 htp.tableData(cvalue=>template, calign=>'Left',cattributes=>'id=""');
6815 htp.tableRowClose;
6816
6817 htp.tableClose;
6818 htp.formClose;
6819 -- Add submit button
6820 htp.tableopen (calign=>'CENTER', cattributes=>'summary=""');
6821 htp.tableRowOpen;
6822
6823 htp.p('<TD ID="">');
6824
6825 wfa_html.create_reg_button ('javascript:document.WF_QUEUE_MESSAGE_FIND.submit(
6826 )',
6827 wf_core.translate('GO'),
6828 wfa_html.image_loc,
6829 null,
6830 wf_core.translate('GO'));
6831
6832 htp.p('</TD>');
6833
6834 htp.tableRowClose;
6835 htp.tableClose;
6836 wfa_sec.Footer;
6837 htp.htmlClose;
6838
6839 exception
6840 when others then
6841 rollback;
6842 wf_core.context('WF_EVENT_HTML', 'FindECX_INENGOBJQueueMessage');
6843 wfe_html_util.Error;
6844 end;
6845
6846
6847
6848
6849 -- ListQueueMessages
6850 -- Queue Messages after Filter applied
6851 -- IN
6852 -- Queue Name
6853 -- Event Name
6854 -- Event Key
6855 -- Message Status
6856 -- MODIFICATION LOG:
6857 -- 06-JUN-2001 JWSMITH BUG 1819232 - Added alt attr for IMG tag for ADA
6858 -- -added label tags to form input fields
6859 --
6860 procedure ListQueueMessages (
6861 P_QUEUE_NAME in varchar2 default null,
6862 P_EVENT_NAME in varchar2 default null,
6863 P_EVENT_KEY in varchar2 default null,
6864 P_MESSAGE_STATUS in varchar2 default 'ANY',
6865 P_MESSAGE_ID in varchar2 default null
6866 ) is
6867 username varchar2(320); -- Username to query
6868 admin_role varchar2(320); -- Role for admin mode
6869 realname varchar2(360); -- Display name of username
6870 s0 varchar2(2000); -- Dummy
6871 admin_mode varchar2(1) := 'N';
6872 l_media varchar2(240) := wfa_html.image_loc;
6873 l_icon varchar2(40) := 'FNDILOV.gif';
6874 l_text varchar2(240) := '';
6875 l_onmouseover varchar2(240) := wf_core.translate ('WFPREF_LOV');
6876 l_url varchar2(4000);
6877 l_error_msg varchar2(240);
6878 l_more_data BOOLEAN := TRUE;
6879 l_queue_table varchar2(30);
6880 l_parameters varchar2(32000);
6881 i binary_integer;
6882 l_exceptionQueue VARCHAR2(40);
6883
6884 /*
6885 ** Added to display Queue Table USER_DATA field
6886 */
6887 TYPE queue_contents_t IS REF CURSOR;
6888 l_qcontents queue_contents_t;
6889 l_msgstate number;
6890 l_charmsgstate varchar2(240);
6891 l_msg_id RAW(16);
6892 l_fromagent varchar2(30);
6893 l_fromsystem varchar2(30);
6894 l_eventname varchar2(240);
6895 l_eventkey varchar2(240);
6896 l_string varchar2(240);
6897 l_message wf_event_t;
6898 l_sqlstmt varchar2(240);
6899 l_eventdata clob;
6900 l_state number;
6901 l_qtable varchar2(240);
6902 l_likeeventname varchar2(240);
6903 l_likeeventkey varchar2(240);
6904 l_errmsg varchar2(4000);
6905 l_errstack varchar2(4000);
6906 l_parmlist_t wf_parameter_list_t;
6907
6908 begin
6909 -- Check current user has admin authority
6910 wfa_sec.GetSession(username);
6911 username := upper(username);
6912 wf_events_pkg.setMode;
6913
6914 wf_directory.GetRoleInfo(username, realname, s0, s0, s0, s0);
6915
6916 admin_role := wf_core.translate('WF_ADMIN_ROLE');
6917 if (admin_role = '*' or
6918 Wf_Directory.IsPerformer(username, admin_role)) then
6919 admin_mode := 'Y';
6920 else
6921
6922 l_error_msg := wf_core.translate('WFPREF_INVALID_ADMIN');
6923
6924 end if;
6925
6926 -- Check if Accessible
6927 wf_event_html.isAccessible('AGENTS');
6928
6929 -- Set page title
6930 htp.htmlOpen;
6931 htp.headOpen;
6932 htp.p('<BASE TARGET="_top">');
6933 htp.title(wf_core.translate('WFQUEUE_MESSAGE_TITLE'));
6934 wfa_html.create_help_function('wf/links/t_l.htm?T_LQUEM');
6935 htp.headClose;
6936 wfa_sec.Header(FALSE, owa_util.get_owa_service_path ||'wf_event_html.FindQueueMessage?p_queue_name='||p_queue_name||'&p_type=WF_EVENT_T', wf_core.translate('WFQUEUE_MESSAGE_TITLE'), TRUE);
6937 htp.br;
6938
6939 IF (admin_mode = 'N') THEN
6940 htp.center(htf.bold(l_error_msg));
6941 return;
6942 END IF;
6943
6944 -- Column headers
6945 htp.tableOpen('border=1 cellpadding=3 bgcolor=white width="100%"
6946 summary="' || wf_core.translate('WFQUEUE_MESSAGE_TITLE') || '"');
6947 htp.tableRowOpen(cattributes=>'bgcolor=#006699');
6948
6949
6950 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6951 wf_core.translate('EVENTNAME')||'</font>',
6952 calign=>'Center',
6953 cattributes=>'id="' ||
6954 wf_core.translate('EVENTNAME') || '"');
6955 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6956 wf_core.translate('EVENTKEY')||'</font>',
6957 calign=>'Center',
6958 cattributes=>'id="' ||
6959 wf_core.translate('EVENTKEY') || '"');
6960 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6961 wf_core.translate('WF_CORRELATION')||'</font>',
6962 calign=>'Center',
6963 cattributes=>'id="' ||
6964 wf_core.translate('WF_CORRELATION') || '"');
6965 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6966 wf_core.translate('PARAMETERS')||'</font>',
6967 calign=>'Center',
6968 cattributes=>'id="' ||
6969 wf_core.translate('PARAMETERS') || '"');
6970 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6971 wf_core.translate('FROMAGENTSYSTEM')||'</font>',
6972 calign=>'Center',
6973 cattributes=>'id="' ||
6974 wf_core.translate('FROMAGENTSYSTEM') || '"');
6975 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6976 wf_core.translate('TOAGENTSYSTEM')||'</font>',
6977 calign=>'Center',
6978 cattributes=>'id="' ||
6979 wf_core.translate('TOAGENTSYSTEM') || '"');
6980 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6981 wf_core.translate('WF_SEND_DATE')||'</font>',
6982 calign=>'Center',
6983 cattributes=>'id="' ||
6984 wf_core.translate('WF_SEND_DATE') || '"');
6985 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6986 wf_core.translate('WFMON_ERROR_MESSAGE')||'</font>',
6987 calign=>'Center',
6988 cattributes=>'id="' ||
6989 wf_core.translate('WFMON_ERROR_MESSAGE') || '"');
6990 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6991 wf_core.translate('WFMON_ERROR_STACK')||'</font>',
6992 calign=>'Center',
6993 cattributes=>'id="' ||
6994 wf_core.translate('WFMON_ERROR_STACK') || '"');
6995 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
6996 wf_core.translate('MESSAGESTATE')||'</font>',
6997 calign=>'Center',
6998 cattributes=>'id="' ||
6999 wf_core.translate('MESSAGESTATE') || '"');
7000 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
7001 wf_core.translate('XMLEVENTDATA')||'</font>',
7002 calign=>'Center',
7003 cattributes=>'id="' ||
7004 wf_core.translate('XMLEVENTDATA') || '"');
7005
7006 htp.tableHeader(cvalue=>'<font color=#FFFFFF>'||
7007 wf_core.translate('TXTEVENTDATA')||'</font>',
7008 calign=>'Center',
7009 cattributes=>'id="' ||
7010 wf_core.translate('TXTEVENTDATA') || '"');
7011 htp.tableRowClose;
7012 htp.tableRowOpen;
7013 htp.tableRowClose;
7014
7015 -- As per review comment running the sql for
7016 -- wf_agent wqueues alone
7017
7018 -- Determine the Queue Table based on the Queue Name
7019 -- First check if its registered in wf_agents then use the
7020 -- info from wf_agents
7021 -- begin
7022 select aq.queue_table
7023 into l_qtable
7024 from wf_agents wfa ,
7025 all_queues aq
7026 where aq.name = p_queue_name
7027 and substr(wfa.queue_name,instr(wfa.queue_name,'.',1)+1) = aq.name
7028 and aq.owner = substr(wfa.queue_name,1,instr(wfa.queue_name,'.',1)-1);
7029 -- exception
7030 -- when no_data_found then
7031 --use the direct query on all_queues
7032 --with rownum = 1 to take the first hit
7033 --SELECT queue_table INTO l_qtable
7034 --FROM all_queues
7035 --WHERE name = p_queue_name
7036 --AND rownum = 1;
7037 -- end;
7038
7039 l_exceptionQueue := 'AQ$_'||l_qtable||'_E';
7040
7041 -- Convert the character message state to numbers
7042 IF p_message_status = 'READY' THEN
7043 l_state := 0;
7044 ELSIF p_message_status = 'WAIT' THEN
7045 l_state := 1;
7046 ELSIF p_message_status = 'PROCESSED' THEN
7047 l_state := 2;
7048 ELSIF p_message_status = 'EXPIRED' THEN
7049 l_state := 3;
7050 ELSIF p_message_status = 'ANY' THEN
7051 l_state := 100;
7052 END IF;
7053
7054 -- Create Filters for Event Name and Event Key
7055 IF p_event_name IS NULL THEN
7056 l_likeeventname := '%';
7057 ELSE
7058 l_likeeventname := '%'||upper(p_event_name)||'%';
7059 END IF;
7060
7061 IF p_event_key IS NULL THEN
7062 l_likeeventkey := '%';
7063 ELSE
7064 l_likeeventkey := '%'||upper(p_event_key)||'%';
7065 END IF;
7066
7067 -- Show rows that match our criteria
7068
7069 if l_state=100 then
7070 OPEN l_qcontents FOR
7071 'SELECT msgid, state, user_data FROM '||l_qtable||
7072 ' WHERE q_name in(:1,:2)'
7073 using p_queue_name, l_exceptionQueue;
7074 else
7075 OPEN l_qcontents FOR
7076 'SELECT msgid, state, user_data FROM '||l_qtable||
7077 ' WHERE STATE = :1 AND q_name in (:2,:3)'
7078 using l_state,p_queue_name, l_exceptionQueue;
7079 end if;
7080 LOOP
7081 FETCH l_qcontents INTO l_msg_id,
7082 l_msgstate,
7083 l_message;
7084
7085 EXIT WHEN l_qcontents%NOTFOUND;
7086
7087 -- Convert Numeric Message State to characters
7088 IF l_msgstate = 0 THEN
7089 l_charmsgstate := (wf_core.translate('READY'));
7090 ELSIF l_msgstate = 1 THEN
7091 l_charmsgstate := (wf_core.translate('WAIT'));
7092 ELSIF l_msgstate = 2 THEN
7093 l_charmsgstate := (wf_core.translate('PROCESSED'));
7094 ELSIF l_msgstate = 3 THEN
7095 l_charmsgstate := (wf_core.translate('EXPIRED'));
7096 ELSE
7097 l_charmsgstate := (wf_core.translate('UNKNOWN'));
7098 END IF;
7099
7100 l_eventname := l_message.GetEventName();
7101 l_eventkey := l_message.GetEventKey();
7102
7103 IF (upper(l_eventname) LIKE l_likeeventname
7104 OR l_eventname IS NULL)
7105 AND ( upper(l_eventkey) LIKE l_likeeventkey
7106 OR l_eventkey IS NULL ) THEN
7107
7108 htp.tableRowOpen(null, 'TOP');
7109
7110 htp.p('<!-- Msg Id '||l_msg_id||' -->');
7111
7112 IF l_EventName IS NULL THEN
7113 l_EventName := ' ';
7114 END IF;
7115
7116 htp.tableData(l_EventName, 'left', cattributes=>'headers="' ||
7117 wf_core.translate('EVENTNAME') || '"');
7118
7119 IF l_eventkey IS NULL THEN
7120 l_eventkey := ' ';
7121 END IF;
7122
7123 htp.tableData(l_EventKey, 'left', cattributes=>'headers="' ||
7124 wf_core.translate('EVENTKEY') || '"');
7125
7126 if l_message.Correlation_Id is not null then
7127 htp.tableData(l_message.GetCorrelationId(),'left', cattributes=>'headers="' || wf_core.translate('WF_CORRELATION') || '"');
7128 else
7129 htp.tableData('&'||'nbsp','left',cattributes=>'headers=""');
7130 end if;
7131
7132 -- Display the Parameter List
7133 l_parmlist_t := l_message.getParameterList();
7134 if (l_parmlist_t is not null) then
7135 i := l_parmlist_t.FIRST;
7136 while (i <= l_parmlist_t.LAST) loop
7137 l_parameters := l_parameters||l_parmlist_t(i).getName()||'='||
7138 l_parmlist_t(i).getValue()||' ';
7139 i := l_parmlist_t.NEXT(i);
7140 end loop;
7141 htp.tableData(l_parameters,'left',
7142 cattributes=>'headers="' ||
7143 wf_core.translate('PARAMETERS') || '"');
7144 else
7145 htp.tableData('&'||'nbsp','left',cattributes=>'headers=""');
7146 end if;
7147
7148
7149 if l_message.From_Agent is not null then
7150 htp.tableData(l_message.GetFromAgent().GetName()||'@'
7151 ||l_message.GetFromAgent().GetSystem(), 'left',
7152 cattributes=>'headers="' ||
7153 wf_core.translate('FROMAGENTSYSTEM') || '"');
7154 else
7155 htp.tableData('&'||'nbsp','left',cattributes=>'headers=""');
7156 end if;
7157
7158 if l_message.To_Agent is not null then
7159 htp.tableData(l_message.GetToAgent().GetName()||'@'
7160 ||l_message.GetToAgent().GetSystem(), 'left',
7161 cattributes=>'headers="' ||
7162 wf_core.translate('TOAGENTSYSTEM') || '"');
7163 else
7164 htp.tableData('&'||'nbsp','left',cattributes=>'headers=""');
7165 end if;
7166
7167 if l_message.Send_Date is not null then
7168 htp.tableData(to_char(l_message.GetSendDate(),'DD-MON-YYYY HH24:MI:SS'),'left', cattributes=>'headers="' ||
7169 wf_core.translate('WF_SEND_DATE') || '"');
7170 else
7171 htp.tableData('&'||'nbsp','left',cattributes=>'headers=""');
7172 end if;
7173
7174 if l_message.error_message is not null then
7175 htp.tableData(l_message.GetErrorMessage(),
7176 'left', cattributes=>'headers="' ||
7177 wf_core.translate('WFMON_ERROR_MESSAGE') || '"');
7178 else
7179 htp.tableData('&'||'nbsp','left',cattributes=>'headers=""');
7180 end if;
7181
7182 if l_message.error_stack is not null then
7183 htp.tableData(l_message.GetErrorStack(),
7184 'left', cattributes=>'headers="' ||
7185 wf_core.translate('WFMON_ERROR_STACK') || '"');
7186 else
7187 htp.tableData('&'||'nbsp','left',cattributes=>'headers=""');
7188 end if;
7189
7190 htp.tableData(l_charmsgstate,'center', cattributes=>'headers="' ||
7191 wf_core.translate('MESSAGESTATE') || '"');
7192
7193 l_eventdata := l_message.GetEventData();
7194
7195 htp.tableData(htf.anchor2(curl=>wfa_html.base_url||
7196 '/wf_event_html.EventDataContents?p_message_id='||l_msg_id
7197 ||'&p_queue_table='||l_qtable||'&p_mimetype=text/xml',
7198 ctext=>'<IMG SRC="'||wfa_html.image_loc||'affind.gif" alt="' || wf_core.translate('FIND') || '"
7199 BORDER=0>'),
7200 'center', cattributes=>'valign="MIDDLE"
7201 headers="' || wf_core.translate('XMLEVENTDATA') || '"');
7202 htp.tableData(htf.anchor2(curl=>wfa_html.base_url||
7203 '/wf_event_html.EventDataContents?p_message_id='||l_msg_id
7204 ||'&p_queue_table='||l_qtable||'&p_mimetype=text',
7205 ctext=>'<IMG SRC="'||wfa_html.image_loc||'affind.gif" alt="' || wf_core.translate('FIND') || '"
7206 BORDER=0>'),
7207 'center', cattributes=>'valign="MIDDLE"
7208 headers="' || wf_core.translate('TXTEVENTDATA') || '"');
7209 END IF;
7210 l_parameters := null;
7211
7212 END LOOP;
7213 CLOSE l_qcontents;
7214
7215 htp.tableclose;
7216
7217 htp.br;
7218
7219 wfa_sec.Footer;
7220
7221 htp.htmlClose;
7222
7223 exception
7224 when others then
7225 rollback;
7226 Wf_Core.Context('WF_EVENT_HTML', 'ListQueueMessages',
7227 p_queue_name);
7228 wfe_html_util.Error;
7229 --raise;
7230 end ListQueueMessages;
7231 -- EventDataContents
7232 -- Shows clob contents in XML format
7233 -- IN
7234 -- Message ID
7235 -- Queue Table
7236 procedure EventDataContents (
7237 P_MESSAGE_ID in varchar2,
7238 P_QUEUE_TABLE in varchar2,
7239 P_MIMETYPE in varchar2 default 'text/xml'
7240 ) is
7241
7242 username varchar2(320); -- Username to query
7243 admin_role varchar2(320); -- Role for admin mode
7244
7245 TYPE queue_contents_t IS REF CURSOR;
7246 l_qcontents queue_contents_t;
7247 l_sqlstmt varchar2(32000);
7248 l_message wf_event_t;
7249 l_clob clob;
7250 l_splice_size integer := 100;
7251 l_current_position integer := 1;
7252 l_amount_to_read integer :=0;
7253 l_clobsize integer := 0;
7254 l_messagedata varchar2(32000);
7255 l_counter integer :=0;
7256 l_beginposition integer :=1;
7257 l_endposition integer :=0;
7258 l_amounttoread integer :=0;
7259 l_begintagpos integer :=0;
7260 l_endtagpos integer :=0;
7261 l_doclength integer :=0;
7262 l_char varchar2(4);
7263 l_owner varchar2(30);
7264 l_queue_table varchar2(30);
7265 l_dummy number;
7266 begin
7267 -- Check current user has admin authority
7268 wfa_sec.GetSession(username);
7269 username := upper(username);
7270 wf_events_pkg.setMode;
7271
7272 -- Check Admin Priviledge
7273 admin_role := wf_core.translate('WF_ADMIN_ROLE');
7274 if (admin_role = '*' or
7275 Wf_Directory.IsPerformer(username, admin_role)) then
7276 -- Have admin privledge, do nothing.
7277 null;
7278 else
7279 wf_core.raise('WF_NOTADMIN');
7280 end if;
7281
7282 -- Validate the MIME type
7283 if (instr(p_mimetype, '<', 1) > 0 or instr(p_mimetype, '>', 1) > 0) then
7284 Wf_Core.Raise('WF_INVALID_MIME');
7285 end if;
7286
7287 -- Validate the Queue Table
7288 if (instr(p_queue_table, '.', 1) > 0) then
7289 l_owner := substr(p_queue_table, 1, instr(p_queue_table, '.', 1)-1);
7290 l_queue_table := substr(p_queue_table, instr(p_queue_table, '.', 1)+1);
7291 else
7292 l_owner := Wf_Core.Translate('WF_SCHEMA');
7293 l_queue_table := p_queue_table;
7294 end if;
7295
7296 begin
7297 SELECT 1
7298 INTO l_dummy
7299 FROM all_queue_tables
7300 WHERE owner = l_owner
7301 AND queue_table = l_queue_table
7302 AND rownum = 1;
7303 exception
7304 when no_data_found then
7305 -- mostly no_data_found error
7306 Wf_Core.Token('OWNER', l_owner);
7307 Wf_Core.Token('QUEUE', l_queue_table);
7308 Wf_Core.Raise('WFE_QUEUE_NOTEXIST');
7309 end;
7310
7311 -- Get the Clob
7312 l_sqlstmt := 'SELECT user_data FROM '||p_queue_table
7313 ||' WHERE MSGID = :b';
7314
7315 OPEN l_qcontents FOR l_sqlstmt USING p_message_id;
7316 LOOP
7317 FETCH l_qcontents INTO l_message;
7318
7319 l_clob := l_message.GetEventData();
7320
7321 EXIT WHEN l_qcontents%NOTFOUND;
7322
7323 END LOOP;
7324
7325 --
7326 -- Set the Mime type to be text/xml
7327 --
7328
7329 -- bug 2640742
7330 l_doclength := dbms_lob.getlength(l_clob);
7331
7332 IF (l_clob IS NOT NULL and l_doclength > 0) THEN
7333 --owa_util.mime_header('text/xml', TRUE);
7334 owa_util.mime_header(p_mimetype, TRUE);
7335
7336 owa_util.http_header_close;
7337
7338 -- Check for the presence of '<' in the beginning of clob. Leading white spaces
7339 -- in the XML document are ignored.
7340 l_counter := 1;
7341 loop
7342 l_char := dbms_lob.substr(l_clob, 1, l_counter);
7343 if (l_char = wf_core.tab or l_char = ' ') then
7344 l_counter := l_counter + 1;
7345 elsif (l_char = '<') then
7346 l_begintagpos := l_counter;
7347 exit;
7348 else
7349 l_begintagpos := 0;
7350 exit;
7351 end if;
7352 end loop;
7353
7354 -- Check for the presence of '>' in the end of clob. Trailing white spaces in the
7355 -- the XML document are ignored
7356 l_counter := l_doclength;
7357 loop
7358 l_char := dbms_lob.substr(l_clob, 1, l_counter);
7359 if (l_char = wf_core.tab or l_char = ' ') then
7360 l_counter := l_counter - 1;
7361 elsif (l_char = '>') then
7362 l_endtagpos := l_counter;
7363 exit;
7364 else
7365 l_endtagpos := 0;
7366 exit;
7367 end if;
7368 end loop;
7369
7370 l_counter:=0;
7371
7372 --
7373 -- Write out the Clob
7374 --
7375 -- Check if clob contains a xml or text data.
7376
7377 IF (l_begintagpos > 0 AND l_endtagpos > 0) THEN
7378 LOOP
7379
7380 l_counter := l_counter + 1;
7381
7382 l_endposition := dbms_lob.instr(l_clob,'>',1,l_counter);
7383
7384 EXIT when l_endposition = 0;
7385
7386 l_amounttoread := l_endposition - l_beginposition + 1;
7387
7388 l_messagedata := dbms_lob.substr(l_clob, l_amounttoread,
7389 l_beginposition);
7390
7391 htp.p(l_messagedata);
7392
7393 l_beginposition := l_endposition + 1;
7394
7395 END LOOP;
7396 ELSE
7397 l_amounttoread:=16000;
7398 LOOP
7399 l_counter := l_counter + 1;
7400
7401 begin
7402 dbms_lob.read(
7403 l_clob,
7404 l_amounttoread,
7405 l_beginposition,
7406 l_messagedata
7407 );
7408
7409 exception
7410 when NO_DATA_FOUND then
7411 exit;
7412 end;
7413 htp.p(l_messagedata);
7414 l_beginposition := (l_amounttoread*l_counter) + 1;
7415 END LOOP;
7416 END IF;
7417 ELSE
7418 htp.p(wf_Core.translate('NO_MESSAGE_FOUND'));
7419 END IF;
7420 exception
7421 when others then
7422 rollback;
7423 Wf_Core.Context('WF_EVENT_HTML', 'EventDataContents',
7424 p_queue_table,p_message_id);
7425 wfe_html_util.Error;
7426 --raise;
7427 end EventDataContents;
7428 procedure EventDataContents (
7429 P_EVENTATTRIBUTE in varchar2,
7430 P_ITEMTYPE in varchar2,
7431 P_ITEMKEY in varchar2,
7432 P_MIME_TYPE in varchar2 default 'text/xml') IS
7433
7434 l_event_t wf_event_t;
7435 l_eventdata clob;
7436 l_splice_size integer := 100;
7437 l_current_position integer := 1;
7438 l_amount_to_read integer :=0;
7439 l_clobsize integer := 0;
7440 l_messagedata varchar2(32000);
7441 l_counter integer :=0;
7442 l_beginposition integer :=1;
7443 l_endposition integer :=0;
7444 l_amounttoread integer :=0;
7445 l_begintagpos integer :=0;
7446 l_endtagpos integer :=0;
7447 l_doclength integer :=0;
7448
7449 begin
7450
7451 wf_event_t.Initialize(l_event_t);
7452
7453 l_event_t := wf_engine.GetItemAttrEvent(
7454 itemtype => P_ItemType,
7455 itemkey => P_ItemKey,
7456 name => P_EventAttribute);
7457
7458 l_eventdata := l_event_t.GetEventData();
7459
7460 IF l_eventdata IS NOT NULL THEN
7461 owa_util.mime_header(p_mime_type, TRUE);
7462
7463 owa_util.http_header_close;
7464
7465 -- bug 2640742
7466 l_doclength := dbms_lob.getlength(l_eventdata);
7467
7468 -- Check for the presence of '>' in the begin of clob.
7469 Loop
7470 l_counter := l_counter + 1;
7471 l_begintagpos := dbms_lob.instr(l_eventdata,'<',1,l_counter);
7472 EXIT when l_begintagpos>0 or l_counter=l_doclength;
7473 END loop;
7474 l_counter:=0;
7475
7476 -- Check for the presence of '<' in the end of clob.
7477 Loop
7478 l_counter := l_counter + 1;
7479 l_endtagpos := dbms_lob.instr(l_eventdata,'>',1,l_doclength-l_counter);
7480 EXIT when l_endtagpos>0 or l_counter=l_doclength ;
7481 END loop;
7482 l_counter:=0;
7483
7484 --
7485 -- Write out the Clob
7486 --
7487 -- Check if clob contains a xml or text data.
7488
7489 IF l_begintagpos <> 0 AND l_endtagpos <> 0 THEN
7490 LOOP
7491
7492 l_counter := l_counter + 1;
7493
7494 l_endposition := dbms_lob.instr(l_eventdata,'>',1,l_counter);
7495
7496 EXIT when l_endposition = 0;
7497
7498 l_amounttoread := l_endposition - l_beginposition + 1;
7499
7500 l_messagedata := dbms_lob.substr(l_eventdata, l_amounttoread,
7501 l_beginposition);
7502
7503 htp.p(l_messagedata);
7504
7505 l_beginposition := l_endposition + 1;
7506
7507 END LOOP;
7508 ELSE
7509 l_amounttoread:=16000;
7510 LOOP
7511 l_counter := l_counter + 1;
7512
7513 begin
7514 dbms_lob.read(
7515 l_eventdata,
7516 l_amounttoread,
7517 l_beginposition,
7518 l_messagedata
7519 );
7520
7521 exception
7522 when NO_DATA_FOUND then
7523 exit;
7524 end;
7525 htp.p(l_messagedata);
7526 l_beginposition := (l_amounttoread*l_counter) + 1;
7527 END LOOP;
7528 END IF;
7529 ELSE
7530 htp.p(wf_Core.translate('NO_MESSAGE_FOUND'));
7531 END IF;
7532
7533 EXCEPTION
7534 WHEN OTHERS THEN
7535 rollback;
7536 WF_CORE.Context('WF_STANDARD', 'EventDataContents',
7537 P_EventAttribute, P_ItemType, P_ItemKey);
7538 wfe_html_util.Error;
7539 --RAISE;
7540 end EventDataContents;
7541
7542
7543 /** Returns Event Edit Subscription URL constructed in the RF.jsp format. For invalid function the
7544 * URL returned will be NULL
7545 */
7546 PROCEDURE getFWKEvtSubscriptionUrl(guid in varchar2 default null,
7547 l_lurl out nocopy varchar2) is
7548
7549 l_function varchar2(4000);
7550 l_params varchar2(4000);
7551 functionId number;
7552
7553 begin
7554
7555 l_function := 'WF_EDIT_SUBSCRIPTION';
7556 if(guid is not null) then
7557 functionId := fnd_function.get_function_id (l_function);
7558 l_params := 'Guid='||guid||'&'||'Mode=U';
7559 l_lurl := fnd_run_function.get_run_function_url( p_function_id => functionId,
7560 p_resp_appl_id => -1,
7561 p_resp_id => -1,
7562 p_security_group_id => null,
7563 p_parameters => l_params);
7564 end if;
7565 end getFWKEvtSubscriptionUrl;
7566
7567
7568 /**Gets old Event Subscription URL's of the form
7569 host:port/pls/<sid>/Wf_Event_Html.EditSubscription?<params>
7570 and converts it to a URL of the form RF.jsp so that the
7571 event subscription page is directly accessed
7572 without the using PL/SQL catridge.Returns following error code
7573 0 - Success
7574 1 - failure
7575 */
7576 PROCEDURE updateToFWKEvtSubscriptionUrl(oldUrl in varchar2,
7577 newUrl out nocopy varchar2,
7578 errorCode out nocopy pls_integer) is
7579 guid varchar2(4000);
7580 l_oldUrl varchar2(4000);
7581 begin
7582 errorCode := 1;
7583 l_oldUrl := oldUrl;
7584 WF_MONITOR.parseUrlForParams('h_guid', l_oldUrl, guid);
7585 getFWKEvtSubscriptionUrl(guid,newUrl);
7586 if (newUrl is not null) then
7587 errorCode := 0; --success
7588 end if;
7589 end updateToFWKEvtSubscriptionUrl;
7590
7591
7592 /**Gets old Event Data URL's of the form
7593 host:port/pls/<sid>/Wf_Event_Html.EventDataContents?<params>
7594 and converts it to a URL of the form RF.jsp so that the
7595 event data page is directly accessed
7596 without the using PL/SQL catridge.Returns following error code
7597 0 - Success
7598 1 - failure
7599 */
7600 PROCEDURE updateToFWKEvtDataUrl(oldUrl in varchar2,
7601 newUrl out nocopy varchar2,
7602 errorCode out nocopy pls_integer) is
7603 eventAttribute varchar2(4000);
7604 itemType varchar2(4000);
7605 itemKey varchar2(4000);
7606 l_oldUrl varchar2(4000);
7607 begin
7608 errorCode := 1;
7609 l_oldUrl := oldUrl;
7610
7611 WF_MONITOR.parseUrlForParams('P_EventAttribute', l_oldUrl, eventAttribute);
7612 WF_MONITOR.parseUrlForParams('P_ItemType', l_oldUrl, itemType);
7613 WF_MONITOR.parseUrlForParams('P_ItemKey', l_oldUrl, itemKey);
7614
7615 newUrl := WF_OAM_UTIL.getViewXMLURL(p_eventattribute => eventAttribute,
7616 p_itemtype => itemType,
7617 p_itemkey => itemkey);
7618 if (newUrl is not null) then
7619 errorCode := 0; --success
7620 end if;
7621 end updateToFWKEvtDataUrl;
7622
7623
7624 end WF_EVENT_HTML;
7625