2 /*********************************************************************************
3 * SugarCRM is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Affero General Public License version 3 as published by the
8 * Free Software Foundation with the addition of the following permission added
9 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18 * You should have received a copy of the GNU Affero General Public License along with
19 * this program; if not, see http://www.gnu.org/licenses or write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU Affero General Public License version 3.
30 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33 * technical reasons, the Appropriate Legal Notices must display the words
34 * "Powered by SugarCRM".
35 ********************************************************************************/
41 <script type="text/javascript" language="Javascript" src="modules/UpgradeWizard/upgradeWizard.js"></script>
49 <div id="progress" style="display:none;">
53 <div id="message" style="display:none;">
58 <table width="100%" cellpadding="0" cellspacing="0" border="0">
61 <form action="index.php" method="post" name="UpgradeWizardForm" id="form">
62 <input type="hidden" name="module" value="UpgradeWizard">
63 <input type="hidden" name="action" value="index">
64 <input type="hidden" name="step" id="step" value="{$UW_STEP}">
65 <input type="hidden" name="overwrite_files" id="over">
66 <input type="hidden" name="schema_change" id="schema">
67 <input type="hidden" name="schema_drop" id="schema_drop">
68 <input type="hidden" name="overwrite_files_serial" id="overwrite_files_serial">
69 <input type="hidden" name="addTaskReminder" id="addTaskReminder">
70 <input type="hidden" name="addEmailReminder" id="addEmailReminder">
71 {if !isset($includeContainerCSS) || $includeContainerCSS}
72 <link rel='stylesheet' type='text/css' href='include/javascript/yui/assets/container.css' />
73 {if $step == 'commit'}
74 <link rel='stylesheet' type='text/css' href='include/javascript/yui/build/container/assets/container.css'/>
75 <link rel='stylesheet' type='text/css' href='themes/default/css/yui.css'/>
79 <input title = "{$MOD.LBL_BUTTON_BACK}"
81 onclick = "document.getElementById('form').step.value='{$STEP_BACK}';"
83 value = " {$MOD.LBL_BUTTON_BACK} ">
86 <input title = "{$MOD.LBL_BUTTON_NEXT}"
88 {$disableNextForLicense}
89 onclick = " handleUploadCheck('{$step}', {$u_allow}); if(!{$u_allow}) return; upgradeP('{$step}', false);document.getElementById('form').step.value='{$STEP_NEXT}'; handlePreflight('{$step}'); document.getElementById('form').submit();"
91 value = " {$MOD.LBL_BUTTON_NEXT} "
95 <input title = "{$MOD.LBL_BUTTON_CANCEL}"
98 {**** if this is the first step, cancel should take you to administration screen ****}
99 onclick = "document.location.href='index.php?module=Administration&action=index';"
102 onclick = "cancelUpgrade();document.getElementById('form').step.value='{$STEP_CANCEL}';"
105 value = " {$MOD.LBL_BUTTON_CANCEL} ">
108 <input title = "{$MOD.LBL_BUTTON_RECHECK}"
110 onclick = "upgradeP('{$step}', true);document.getElementById('form').step.value='{$STEP_RECHECK}';"
112 value = " {$MOD.LBL_BUTTON_RECHECK} ">
115 <input title = "{$MOD.LBL_BUTTON_DONE}"
117 onclick = "deleteCacheAjax();window.location.href='index.php?module=Home&action=About';"
119 value = " {$MOD.LBL_BUTTON_DONE} ">
122 <input title = "{$MOD.LBL_BUTTON_EXIT}"
124 onclick = "window.location.href='index.php?module=Administration&action=index';"
126 value = " {$MOD.LBL_BUTTON_EXIT} ">
136 <table width="100%" border="0" cellpadding="0" cellpadding="0"
137 class="{if !isset($includeContainerCSS) || $includeContainerCSS}tabDetailView{else}detail view small{/if}">
138 {if $step != "start" && $step != "cancel" && $step != "end"}
140 <td id=error_messages colspan="2">
141 <div id="top_message">{$top_message}</div>
146 <td width="25%" rowspan="2" {if !isset($includeContainerCSS) || $includeContainerCSS}class="tabDetailViewDL"{else}scope="row"{/if}><slot>
149 <td width="75%" {if !isset($includeContainerCSS) || $includeContainerCSS}class="tabDetailViewDF"{/if}><slot>
153 {if $step == "upload"}
155 <td valign="top" {if !isset($includeContainerCSS) || $includeContainerCSS}class="tabDetailViewDF"{/if}>
164 <table width="100%" cellpadding="0" cellspacing="0" border="0">
167 <form action="index.php" method="post" name="UpgradeWizardForm" id="form">
168 <input type="hidden" name="module" value="UpgradeWizard">
169 <input type="hidden" name="action" value="index">
170 <input type="hidden" name="step" value="{$UW_STEP}">
171 <input type="hidden" name="overwrite_files" id="over">
172 <input type="hidden" name="schema_change" id="schema">
173 <input type="hidden" name="schema_drop" id="schema_drop">
174 <input type="hidden" name="overwrite_files_serial" id="overwrite_files_serial">
175 <input type="hidden" name="addTaskReminder" id="addTaskReminder">
176 <input type="hidden" name="addEmailReminder" id="addEmailReminder">
177 {if !isset($includeContainerCSS) || $includeContainerCSS}
178 <link rel='stylesheet' type='text/css' href='include/javascript/yui/assets/container.css' />
179 {if $step == 'commit'}
180 <link rel='stylesheet' type='text/css' href='include/javascript/yui/build/container/assets/container.css'/>
181 <link rel='stylesheet' type='text/css' href='themes/default/css/yui.css'/>
185 <input title = "{$MOD.LBL_BUTTON_BACK}"
187 onclick = "document.getElementById('form').step.value='{$STEP_BACK}';"
189 value = " {$MOD.LBL_BUTTON_BACK} ">
192 <input title = "{$MOD.LBL_BUTTON_NEXT}"
194 {$disableNextForLicense}
195 onclick = " handleUploadCheck('{$step}', {$u_allow}); if(!{$u_allow}) return; upgradeP('{$step}', false);document.getElementById('form').step.value='{$STEP_NEXT}'; handlePreflight('{$step}'); document.getElementById('form').submit();"
197 value = " {$MOD.LBL_BUTTON_NEXT} "
201 <input title = "{$MOD.LBL_BUTTON_CANCEL}"
203 {if $step == 'start'}
204 {**** if this is the first step, cancel should take you to administration screen ****}
205 onclick = "document.location.href='index.php?module=Administration&action=index';"
208 onclick = "cancelUpgrade();document.getElementById('form').step.value='{$STEP_CANCEL}';"
211 value = " {$MOD.LBL_BUTTON_CANCEL} ">
214 <input title = "{$MOD.LBL_BUTTON_RECHECK}"
216 onclick = "upgradeP('{$step}', true);document.getElementById('form').step.value='{$STEP_RECHECK}';"
218 value = " {$MOD.LBL_BUTTON_RECHECK} ">
221 <input title = "{$MOD.LBL_BUTTON_DONE}"
223 onclick = "deleteCacheAjax();window.location.href='index.php?module=Home&action=About';"
225 value = " {$MOD.LBL_BUTTON_DONE} ">
228 <input title = "{$MOD.LBL_BUTTON_EXIT}"
230 onclick = "window.location.href='index.php?module=Administration&action=index';"
232 value = " {$MOD.LBL_BUTTON_EXIT} ">
243 UPGRADE_PROGRESS = '{$MOD.LBL_UPGRADE_IN_PROGRESS}';
244 TIME_ELAPSED = "{$MOD.LBL_UPGRADE_TIME_ELAPSED}";
245 START_IN_PROGRESS = "{$MOD.LBL_START_UPGRADE_IN_PROGRESS}";
246 SYSTEM_CHECK_IN_PROGRESS = "{$MOD.LBL_SYSTEM_CHECKS_IN_PROGRESS}";
247 LICENSE_CHECK_IN_PROGRESS = "{$MOD.LBL_LICENSE_CHECK_IN_PROGRESS}";
248 PREFLIGHT_CHECK_IN_PROGRESS ="{$MOD.LBL_PREFLIGHT_CHECK_IN_PROGRESS}";
249 COMMIT_UPGRADE_IN_PROGRESS ="{$MOD.LBL_COMMIT_UPGRADE_IN_PROGRESS}";
250 UPGRADE_SUMMARY_IN_PROGRESS ="{$MOD.LBL_UPGRADE_SUMMARY_IN_PROGRESS}";
251 UPGRADE_SCRIPTS_IN_PROGRESS ="{$MOD.LBL_UPGRADE_SCRIPTS_IN_PROGRESS}";
252 SET_STEP_TO_COMPLETE = "{$MOD.LBL_UW_COMPLETE}";
253 UPLOADE_UPGRADE_IN_PROGRESS= "{$MOD.LBL_UPLOADE_UPGRADE_IN_PROGRESS}";
254 UPLOADING_UPGRADE_PACKAGE = "{$MOD.LBL_UPLOADING_UPGRADE_PACKAGE}";
255 UPGRADE_CANCEL_IN_PROGRESS ="{$MOD.LBL_UPGRADE_CANCEL_IN_PROGRESS}";
256 PREFLIGHT_FILE_COPYING_PROGRESS = "{$MOD.LBL_PREFLIGHT_FILE_COPYING_PROGRESS}";
263 var timeOutWindowMultiplier = 1
264 var timeOutWindow = 60
265 function upgradeP(step, recheck){
266 //if(step == 'systemCheck'){
270 if(document.getElementById("upgradeDiv") != null){
271 var args = { width:"300px",
275 constraintoviewport: false,
279 effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:.5}
281 msg_panel = new YAHOO.widget.Panel('p_msg', args);
282 //If we haven't built our panel using existing markup,
283 //we can set its content via script:
285 if(step == 'start' || step == 'systemCheck'){
286 //currStage = START_IN_PROGRESS;
287 currStage = SYSTEM_CHECK_IN_PROGRESS;
289 /* removed window from system check. if you need to add back, remove check at the top
290 * of this function as well
291 if(step == 'systemCheck'){
292 currStage = UPLOADE_UPGRADE_IN_PROGRESS;
293 //document.getElementById(step).innerHTML='<i>'+SET_STEP_TO_COMPLETE+'</i>'
296 if(step == 'uploadingUpgradePackage'){
297 currStage = UPLOADING_UPGRADE_PACKAGE;
299 if(step == 'license_fiveO'){
300 //currStage = LICENSE_CHECK_IN_PROGRESS;
301 currStage = PREFLIGHT_CHECK_IN_PROGRESS;
302 //document.getElementById(step).innerHTML='<i>'+SET_STEP_TO_COMPLETE+'</i>'
304 if(step == 'upload'){
305 //currStage = LICENSE_CHECK_IN_PROGRESS;
306 currStage = PREFLIGHT_CHECK_IN_PROGRESS;
307 //document.getElementById(step).innerHTML='<i>'+SET_STEP_TO_COMPLETE+'</i>'
309 if(step == 'preflight'){
311 currStage = PREFLIGHT_CHECK_IN_PROGRESS;
314 currStage = PREFLIGHT_FILE_COPYING_PROGRESS;
316 //document.getElementById(step).innerHTML='<i>'+SET_STEP_TO_COMPLETE+'</i>'
318 if(step == 'commit'){
319 currStage = UPGRADE_SCRIPTS_IN_PROGRESS;
320 //document.getElementById(step).innerHTML='<i>'+SET_STEP_TO_COMPLETE+'</i>'
322 if(step == 'layouts'){
323 currStage = UPGRADE_SUMMARY_IN_PROGRESS;
324 //document.getElementById(step).innerHTML='<i>'+SET_STEP_TO_COMPLETE+'</i>'
326 msg_panel.setHeader(currStage);
327 msg_panel.setBody(document.getElementById("upgradeDiv").innerHTML);
328 //timedCount(currStage);
329 //msg_panel.setFooter('Time Elapsed '+s);
330 msg_panel.render(document.body);
331 msgPanel = msg_panel;
337 function cancelUpgrade(){
338 if(document.getElementById("upgradeDiv") != null){
339 var args = { width:"300px",
343 constraintoviewport: false,
347 effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:.5}
349 msg_panel = new YAHOO.widget.Panel('p_msg', args);
350 //If we haven't built our panel using existing markup,
351 //we can set its content via script:
353 currStage = UPGRADE_CANCEL_IN_PROGRESS;
354 //document.getElementById(step).innerHTML='<i>'+SET_STEP_TO_COMPLETE+'</i>'
355 msg_panel.setHeader(currStage);
356 msg_panel.setBody(document.getElementById("upgradeDiv").innerHTML);
357 //timedCount(currStage);
358 //msg_panel.setFooter('Time Elapsed '+s);
359 msg_panel.render(document.body);
360 msgPanel = msg_panel;
366 function timedCount(currStage)
368 msg_panel.setFooter(TIME_ELAPSED+' '+s);
369 currStage = currStage+' '+s;
370 msg_panel.setHeader(currStage);
374 timeOutWindowMultiples = timeOutWindowMultiplier*timeOutWindow
375 if(c == timeOutWindowMultiples){
376 updateUpgradeStepTime(timeOutWindow)
377 timeOutWindowMultiplier = timeOutWindowMultiplier+1
386 while(c>=((m+1)*60)){
400 while(c>=((h+1)*3600)){
408 while(r>=((m+1)*60)){
424 t=setTimeout("timedCount(currStage)",1000)
426 function updateUpgradeStepTime(ts){
427 success = function(r) {
428 //making ajax call every three minutes to make sure the browser
431 postData = 'upgradeStepTime=' + ts + '&module=UpgradeWizard&action=upgradeTimeCounter&to_pdf=1&sugar_body_only=1';
432 var ajxProgress = YAHOO.util.Connect.asyncRequest('POST','index.php', {success: success, failure: success}, postData);