DBA Data[Home] [Help]

PACKAGE BODY: APPS.BIS_GRAPH_REGION_UI

Source


1 PACKAGE BODY BIS_GRAPH_REGION_UI AS
2 /* $Header: BISCHRUB.pls 120.1 2006/02/02 02:07:27 nbarik noship $ */
3 ---  Copyright (c) 2000 Oracle Corporation, Redwood Shores, CA, USA
4 ---  All rights reserved.
5 ---
6 ---==========================================================================
7 ---  FILENAME
8 ---
9 ---     BISCHRUB.pls
10 ---
11 ---  DESCRIPTION
12 ---     Package Body File for displaying the three
13 ---     html forms in which to
14 ---     enter parameters to be stored for a PHP Chart
15 ---
16 ---  NOTES
17 ---
18 ---  HISTORY
19 ---
20 ---  20-Jun-2000 Walid.Nasrallah Created
21 ---  05-Oct-2000 Walid.Nasrallah moved "WHO" column defintion to database
22 ---  09-Oct-2000 Walid.Nasrallah modfied review_chart_action to use
23 ---              sql@notfound instead of an explicit cursor
24 ---  12-Oct-2000 Walid.Nasrallah comented out first database commit
25 ---
26 ---  22-Jan-2001 Ganesh.Sanap Removed all commented out code from prev ver.
27 ---===========================================================================
28 
29 
30 -- *********************************************
31 -- PROCEDURES to preserve session_user state
32 -- *****************************************
33 
34 ---===============================================================
35 --- Function def_mode_query returns true if there exists
36 --- a well-formed cookie named g_cookie_name and encrypted by current session
37 ---=============================================================================
38 g_len     constant pls_integer := length(g_sep);
39 
40 FUNCTION def_mode_query
41   return boolean
42 
43   is
44      l_cookie      owa_cookie.cookie;
45      l_value       varchar2(4096);
46      l_code        pls_integer;
47      l_session_id  pls_integer;
48 begin
49 ---   return false;
50    l_cookie := owa_cookie.get(g_cookie_name);
51    for i in 1..l_cookie.num_vals loop
52       l_value := l_cookie.vals(i);
53       if (instr(l_value,g_sep) > 0)
54 	then
55 	 l_code := to_number(substr(l_value
56 				  ,1
57 				  ,instr(l_value,g_sep)-1
58 				  )
59 			   );
60 ---	 def_mode_clear(l_value);
61 
62        else
63 	 l_code := to_number(l_value);
64       end if;
65 ---      htp.p(substr(icx_call.decrypt2(l_code), 1,11));
66       if(substr(icx_call.decrypt2(l_code), 1,length(g_cookie_prefix))
67 	 =
68 	 g_cookie_prefix)
69 	then
70 ---	 htp.p('true');
71 	 return true;
72       end if;
73    end loop;
74 
75    ---- IF we get to the end of the loop without inding a suitable value,
76 ---   htp.p('NOT ');
77    return false;
78 exception
79    when others then
80      return false;
81 
82 end def_mode_query ;
83 
84 ---=====================================================================
85 --- Procedure def_mode_get re-parses the graph_region cookie into a
86 --- BIS_ESER_TREND_PLUG record
87 ---==========================================================================
88 PROCEDURE def_mode_get
89   (p_session_id  IN PLS_INTEGER
90    ,x_record     OUT NOCOPY BIS_USER_TREND_PLUGS%ROWTYPE
91     )
92   is
93      l_code            PLS_INTEGER;
94      l_point1          PLS_INTEGER;
95      l_point2          PLS_INTEGER;
96      l_decoded         VARCHAR2(4096);
97      l_string          VARCHAR2(4096);
98      l_cookie          owa_cookie.cookie;
99 begin
100    l_cookie := owa_cookie.get(g_cookie_name);
101 
102    for i in 1..l_cookie.num_vals loop
103       l_string := l_cookie.vals(i);
104       if (instr(l_string,g_sep) > 0)
105 	then
106 	 --- l_code gets the first half and l_string gets the last half
107 	 --- (any middle portion is discarded)
108 	 l_code := to_number(substr(l_string, 1, instr(l_string,g_sep)-1));
109 
110 	 l_string := substr(l_string, instr(l_string, g_sep,-1) + 1);
111        else
112 	 l_code := to_number(l_string);
113 	 l_string := '';
114       end if;
115 
116       l_decoded := icx_call.decrypt2(l_code,p_session_id);
117       if (substr(l_decoded, 1, length(g_cookie_prefix)) = g_cookie_prefix)
118 	then
119 	 --- We have found the right cookie and can exit the loop
120 	 --- after loading up the values
121 	 x_record.chart_user_title :=
122 	   replace
123 	      (replace
124 	          (replace
125 	              (replace(l_string
126 			       ,'%20'
127 			       ,' '
128 			       )
129 		       ,'%2A'
130 		       ,'*'
131 		       )
132 		   ,'%2C'
133 		   ,','
134 		   )
135 	       ,'%3B'
136 	       ,';'
137 	       );
138 	 l_point1 := instr(l_decoded,g_sep,1,1) + g_len;
139 	 l_point2 := instr(l_decoded,g_sep,l_point1,1);
140 	 x_record.plug_id := substr(l_decoded,l_point1,l_point2-l_point1);
141 	 l_point1 := l_point2 + g_len;
142 	 l_point2 := instr(l_decoded,g_sep,l_point1);
143 	 x_record.user_id := substr(l_decoded,l_point1,l_point2-l_point1);
144 	 l_point1 := l_point2 + g_len;
145 	 l_point2 := instr(l_decoded,g_sep,l_point1);
146 	 x_record.function_id := substr(l_decoded,l_point1,l_point2-l_point1);
147 	 l_point1 := l_point2 + g_len;
148 	 l_point2 := instr(l_decoded,g_sep,l_point1);
149 	 x_record.responsibility_id := substr(l_decoded,l_point1,l_point2-l_point1);
150 	 exit;
151 	 ----else loop again
152       end if;
153    end loop;
154 exception
155    when others
156      then
157       null;
158 end def_mode_get;
159 
160 
161 ---=======================================================================
162 --- The following two procedures are not in use.  owa_cookie does not perform as expected
163 ---========================================================================
164 PROCEDURE def_mode_set  ( cookie_code IN pls_integer)
165   is
166      mycookie  owa_cookie.cookie;
167      code      pls_integer;
168 begin
169    owa_cookie.send(g_cookie_name,to_char(cookie_code));
170 
171 end def_mode_set;
172 
173 
174 PROCEDURE def_mode_clear
175  (p_coded_string  IN  varchar2)
176    is
177 begin
178    owa_cookie.remove(g_cookie_name,p_coded_string);
179 end def_mode_clear;
180 
181 
182 PROCEDURE Review_Chart_Action
183   (  p_where               in  PLS_INTEGER
184    , p_plug_id             in  PLS_INTEGER
185    , p_user_id             in  PLS_INTEGER
186    , p_function_id         in  PLS_INTEGER
187    , p_responsibility_id   in  PLS_INTEGER
188    , p_chart_user_title    in  VARCHAR2
189    , p_parameter_string    in  VARCHAR2
190     )
191   is
192      l_plug_id            pls_integer;
193      l_user_id            pls_integer;
194      l_session_id         pls_integer;
195      l_home_url           varchar2(240);
196      l_parm_url           varchar2(1000);
197      l_img_html           varchar2(32000);
198      hu_instr             number;
199      pTrendParam          number;
200      TrendType            varchar2(5000);
201 
202      BEGIN
203 
204 
205      if icx_sec.validateSession
206        then
207 
208 	l_session_id :=  icx_sec.getID(icx_sec.PV_session_ID);
209 
210 	l_plug_id := icx_call.decrypt2(p_plug_id, l_session_id);
211 	l_user_id := icx_call.decrypt2(p_user_id,l_session_id);
212 
213     l_home_url := bis_report_util_pvt.get_home_url;
214 
215     hu_instr  := instr(l_home_url,'oraclemyPage.home');
216 
217     l_home_url := substr(l_home_url,1,hu_instr-1);
218 
219     l_parm_url := l_home_url||p_parameter_string;
220 
221     ptrendParam := instr(l_parm_url,'&pTrendType=');
222 
223     if pTrendParam > 0 then
224        TrendType   := substr(l_parm_url,pTrendParam+12,1);
225     end if;
226 
227 
228     bis_trend_plug.get_graph_from_URL(TrendType,l_parm_url, l_img_html);
229 
230 
231 	UPDATE
232 	  bis_user_trend_plugs
233 	  SET FUNCTION_ID = icx_call.decrypt2(p_function_id,l_session_id)
234 	  ,   RESPONSIBILITY_ID  = p_responsibility_id
235 	  ,   CHART_USER_TITLE = p_chart_user_title
236 --	  ,   PARAMETER_STRING = replace(p_parameter_string,'=','~')||'*]'
237 	  ,   PARAMETER_STRING = p_parameter_string
238       ,   CACHED_GRAPH     = l_img_html
239 	  ,   LAST_UPDATE_DATE = sysdate
240 	  ,   LAST_UPDATED_BY  =  l_user_id
241 	  ,   last_update_login = fnd_global.login_id
242 	  WHERE user_id = l_user_id
243 	  and   plug_id = l_plug_id ;
244 
245 	IF SQL%notfound THEN
246 	   insert into BIS_USER_TREND_PLUGS
247 	     (  plug_id
248 		, user_id
249 		, function_id
250 		, responsibility_id
251 		, chart_user_title
252 		, parameter_string
253 		, graph_sequence
254 		, cached_graph
255 		, creation_date
256 		, created_by
257 		, last_update_date
258 		, last_updated_by
259 		, last_update_login
260 		)
261 	     values (l_plug_id
262 		     , l_user_id
263 		     , icx_call.decrypt2(p_function_id,l_session_id)
264 		     , p_responsibility_id
265 		     , p_chart_user_title
266 --		     , replace(p_parameter_string,'=','~')||'*]'
267 		     , p_parameter_string
268 		     , 1
269              , l_img_html
270 		     , sysdate
271 		     , l_user_id
272 		     , sysdate
273 		     , l_user_id
274 		     , fnd_global.login_id
275 		     );
276 
277 	end if; --- NOTFOUND
278 
279 
280 --- Note: delay commit to keep the plug locked just in case two sessions
281 ---       try to customize the same graphs region
282 ---	commit;
283 
284      end if; --- Validate Session
285 
286      owa_util.redirect_url(icx_call.decrypt2(p_where));
287 
288 exception
289    when others then
290       htp.p(SQLERRM);
291 end Review_Chart_Action;
292 
293 
294 END BIS_GRAPH_REGION_UI;