DBA Data[Home] [Help]

PACKAGE BODY: APPS.MSD_SSWA

Source


1 PACKAGE BODY MSD_SSWA AS
2 /* $Header: msddsplb.pls 120.2 2011/09/26 10:15:59 mpmurali ship $ */
3 
4 procedure display_plans is
5 begin
6   null;
7 end display_plans;
8 
9 
10 /**
11   * This procedure will render the header for the page, including
12   * product branding and user prompt.
13  */
14 procedure render_header is
15 begin
16    -- show copyright in source
17    icx_util.copyright;
18    htp.headOpen;
19    htp.title(fnd_message.get_string('MSD','APPLICATION.TITLE'));
20 
21    htp.p('<SCRIPT LANGUAGE="JavaScript">');
22    htp.p('<!-- Hide from old browsers');
23    icx_admin_sig.help_win_script('about',null,'MSD');
24 
25    -- define window launching javascript function
26    htp.p('function startPlan(_url)
27          {
28                 var _browser_name = navigator.appName;
29                 var _browser_ver = navigator.appVersion.substring(0, 3);
30 		var _screen_height = screen.availHeight - 50;
31 		var _screen_width  = screen.availWidth - 15;
32 
33            winParms="height="+screen.availHeight-50+",width="+screen.availWidth-15+",toolbar=no,status=yes,location=no,menubar=no,resizable=yes,scrollbars=yes,top=0,left=0,screenX=0,screenY=0";
34            _url = _url + "BRWS=" + _browser_name + "/BRWS_VER=" + _browser_ver + "/SCR_HT=" + _screen_height + "/SCR_WD=" + _screen_width  + "/DUMMY="+Math.random();
35            window.open(_url,"ODPwindow",winParms);
36           }');
37    htp.p('// -->');
38    htp.p('</SCRIPT>');
39    htp.headClose;
40 
41    htp.bodyOpen( cattributes => 'BGCOLOR=white');
42    htp.p(get_branding_html('Y'));
43 
44   -- display demand plan prompt
45   htp.p('<table cellpadding="0" cellspacing="0" border="0" width="100%">
46            <tr><td width="100%" class="OraHeaderSub">'||
47            fnd_message.get_string('MSD','MSD_DP_SELECTPLAN') ||
48           '</td></tr>
49            <tr><td class="OraBGAccentDark"></td></tr>
50          </table><br>');
51 
52 end render_header;
53 
54 
55 /**
56   * This function will return HTML for the standard Oracle BLAF top-level page header,
57   * with product branding. If the p_show_buttons parameter is Y, then standard action
58   * buttons (Return, Menu, Help) are also displayed.
59   *
60   * Called internally from render_header and from the DML procedure SW.GETJAVATB.
61  */
62 function get_branding_html(p_show_buttons varchar2 default 'N') return varchar2 is
63   v_ret varchar2(4000);
64   v_return varchar2(4000) := fnd_message.get_string('ICX','ICX_POR_TAB_MAIN_MENU');
65   v_help   varchar2(4000) := fnd_message.get_string('FND','HELP');
66   v_menu   varchar2(4000) := fnd_message.get_string('FND','MENU');
67 
68 begin
69   v_ret := '<link rel="stylesheet" type="text/css" href="/OA_HTML/cabo/styles/blaf.css">
70     <table border=0 cellspacing=0 cellpadding=0 width=100%>
71      <tr><td rowspan=2 valign=bottom width=371>
72      <table border=0 cellspacing=0 cellpadding=0 width=100%>
73      <tr align=left><td height=30><img src=/OA_MEDIA/bisorcl.gif border=no height=23 width=141></a></td>
74      <tr align=left> <td valign=bottom>
75        <table cellpadding="0" cellspacing="0" border="0" width="340" height="70"
76               background="/OA_MEDIA/biscollg.gif">
77          <tr>
78             <td width="30"></td>
79             <td valign="top" class="p_OraProductBrandingText">Demand Planning</td>
80          </tr>
81        </table>
82      </td></td></tr>
83      </table>
84      </td>';
85 
86      -- display buttons
87      if (p_show_buttons = 'Y') then
88        v_ret := v_ret || '<td colspan=2 rowspan=2 valign=bottom align=right>
89       <table border=0 cellpadding=0 align=right cellspacing=4>
90         <tr valign=bottom>
91           <td width=60 align=center><a href=Oraclemypage.home><img alt="'||v_return||'" src=/OA_MEDIA/bisrtrnp.gif width=32 border=0 height="32"></a></td>
92           <td width=60 align=center><a href=OracleNavigate.Responsibility><img alt="'||v_menu||'" src=/OA_MEDIA/bisnmenu.gif width="32" border=0 height=32></a></td>
93           <td width=60 align=center valign=bottom><a href="javascript:help_window()"><img alt="'||v_help||'" src=/OA_MEDIA/bisnhelp.gif border=0  width =32 height=32></a></td>
94         </tr>
95         <tr align=center valign=top>
96           <td width=60><a href=Oraclemypage.home><span class="OraGlobalButtonText">'||v_return||'</span></a></td>
97           <td width=60><a href=OracleNavigate.Responsibility><span class="OraGlobalButtonText">'||v_menu||'</span></a></td>
98           <td width=60><a href="javascript:help_window()"><span class="OraGlobalButtonText">'||v_help||'</span></a></td>
99         </tr></table>
100     </td>';
101     end if;
102 
103     v_ret := v_ret || '</tr></table>
104   <table Border=0 cellpadding=0 cellspacing=0 width=100%>
105   <tbody>
106   <tr><td bgcolor=#ffffff colspan=3 height=1><img height=1 src=/OA_MEDIA/bisspace.gif width=1></td>
107   </tr>
108   <tr>
109     <td bgcolor=#31659c colspan=2 height=21><img border=0 height=21 src=/OA_MEDIA/bisspace.gif width=1></td>
110     <td bgcolor=#31659c height=21> </td>
111     <td background=/OA_MEDIA/bisrhshd.gif height=21 width=5><img border=0 height=1 src=/OA_MEDIA/bisspace.gif width=1></td>
112   </tr>
113   <tr>
114     <td bgcolor=#31659c height=16 width=9><img border=0 height=1 src=/OA_MEDIA/bisspace.gif width=9></td>
115     <td bgcolor=#31659c height=16 width=5><img border=0 height=1 src=/OA_MEDIA/bisspace.gif width=5></td>
116     <td background=/OA_MEDIA/bisbot.gif width=1000><img align=top height=16 src=/OA_MEDIA/bistopar.gif width=26></td>
117     <td align=left valign=top width=5><img height=8 src=/OA_MEDIA/bisrend.gif width=8></td>
118   </tr>
119   <tr>
120     <td align=left background=/OA_MEDIA/bisbot.gif height=8 valign=top width=9><img height=8 src=/OA_MEDIA/bislend.gif width=10></td>
121     <td background=/OA_MEDIA/bisbot.gif height=8 width=5><img border=0 height=1 src=/OA_MEDIA/bisspace.gif width=1></td>
122     <td align=left valign=top width=1000><img height=8 src=/OA_MEDIA/bisarchc.gif width=9></td>
123     <td width=5></td>
124   </tr>
125   </tbody>
126 </table>';
127 
128   return v_ret;
129 
130 end get_branding_html;
131 
132 
133 /**
134  * This procedure will access the batch log for the given
135  * demand plan, and display it through htp.p calls.
136 */
137 procedure show_batch_log (p_path varchar2, p_id number) is
138   input_file   utl_file.file_type;
139   input_buffer varchar2(4000);
140   v_filename varchar2(4000);
141 
142 begin
143   v_filename := 'MSD' || p_id || '_dpbatch.html';
144   input_file := utl_file.fopen(p_path,v_filename, 'R');
145 
146   loop
147     utl_file.get_line (input_file, input_buffer);
148     htp.p(input_buffer);
149   end loop;
150 
151   EXCEPTION
152     WHEN OTHERS then
153       utl_file.fclose_all;
154 
155 end show_batch_log;
156 
157 
158 /**
159  * This procedure will access the batch log for the given
160  * demand plan, and display it through htp.p calls.
161 */
162 function get_batch_log (p_id number) return clob is
163   input_file   utl_file.file_type;
164   input_buffer varchar2(4000);
165   v_filename varchar2(4000);
166   v_clob clob;
167 
168 begin
169   dbms_lob.createtemporary(v_clob,TRUE);
170   v_filename := 'MSD' || p_id || '_dpbatch.html';
171   input_file := utl_file.fopen(fnd_profile.value('MSD_DIR_ALIAS'),v_filename, 'R');
172 
173   loop
174     utl_file.get_line(input_file, input_buffer);
175     if (length(input_buffer) > 0) then
176       dbms_lob.writeappend(v_clob,length(input_buffer),input_buffer);
177       --dbms_output.put_line(substr(input_buffer,1,100));
178     end if;
179   end loop;
180   return v_clob;
181 
182   EXCEPTION
183     WHEN OTHERS then
184       utl_file.fclose_all;
185       --dbms_output.put_line(substr(sqlerrm,1,250));
186       return v_clob;
187 
188 end get_batch_log;
189 
190 /**
191  * For Bug 13017878 - This procedure will update the ODPCODE AW variables related to the Java plugin details.
192  * This is called from DemandPlansCO.java
193 */
194 procedure update_plugin_details(sunplugintype varchar2,classid varchar2,codever varchar2,codebase varchar2) is
195 
196 	  v_jinit_classid varchar2(100);
197       v_jinit_executable varchar2(200);
198 	  v_jinit_mimetype varchar2(100);
199 	  v_jinit_codebase varchar2(100);
200 
201 begin
202 
203   --Generate the OLAP commands
204   v_jinit_classid:=concat('JINIT.CLASSID=',concat(concat('''',classid),''''));
205 
206   v_jinit_executable:=codebase||'#Version='||translate(codever,'._',',,');
207   v_jinit_executable:=concat('JINIT.EXECUTABLE=',concat(concat('''',v_jinit_executable),''''));
208 
209 
210   v_jinit_mimetype:=sunplugintype||';version='||codever;
211   v_jinit_mimetype:=concat('JINIT.MIMETYPE=',concat(concat('''',v_jinit_mimetype),''''));
212 
213   v_jinit_codebase:=codebase;
214   v_jinit_codebase:=concat('JINIT.CODEBASE=',concat(concat('''',v_jinit_codebase),''''));
215 
216 
217   dbms_aw.AW_ATTACH('ODPCODE',true,true,'wait');
218   dbms_aw.execute(v_jinit_classid);
219   dbms_aw.execute(v_jinit_executable);
220   dbms_aw.execute(v_jinit_mimetype);
221   dbms_aw.execute(v_jinit_codebase);
222   dbms_aw.execute('update');
223   dbms_aw.execute('commit');
224   dbms_aw.AW_DETACH('ODPCODE');
225 
226 exception
227 when others then
228 null;
229 
230 end UPDATE_PLUGIN_DETAILS;
231 
232 
233 end MSD_SSWA;