Commit 53941b2c9b9df7ecb991d606066fc3107c8c16a8

Authored by jarrett
2 parents af20b25e 6b7ad149

Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge

setup/upgrade/resources/graphics/loading.gif 0 → 100644

1.81 KB

setup/upgrade/steps/upgradeBackup.php
... ... @@ -57,7 +57,8 @@ class upgradeBackup extends Step {
57 57 protected $temp_variables = array();
58 58  
59 59 public function __construct() {
60   - $this->temp_variables = array("step_name"=>"backup", "silent"=>$this->silent);
  60 + $this->temp_variables = array("step_name"=>"backup", "silent"=>$this->silent,
  61 + "loadingText"=>"Your backup is under way. Please wait until it completes");
61 62 $this->_dbhandler = new UpgradedbUtil();
62 63 $this->util = new UpgradeUtil();
63 64 }
... ...
setup/upgrade/steps/upgradeDatabase.php
... ... @@ -121,7 +121,8 @@ class upgradeDatabase extends Step
121 121 * @param none
122 122 */
123 123 public function __construct() {
124   - $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent);
  124 + $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent,
  125 + "loadingText"=>"The database upgrade is under way. Please wait until it completes");
125 126 $this->_dbhandler = new UpgradedbUtil();
126 127 $this->_util = new UpgradeUtil();
127 128 if(WINDOWS_OS)
... ... @@ -195,8 +196,10 @@ class upgradeDatabase extends Step
195 196 else if ($action == 'runUpgrade') {
196 197 $this->temp_variables['title'] = 'Upgrade In Progress';
197 198 if (!$this->upgradeDatabase()) {
  199 + $this->temp_variables['backupSuccessful'] = false;
198 200 return false;
199 201 }
  202 + $this->temp_variables['backupSuccessful'] = true;
200 203 }
201 204  
202 205 return true;
... ... @@ -221,7 +224,7 @@ class upgradeDatabase extends Step
221 224 $ret .= "<tr bgcolor='darkgrey'><th width='10'>Code</th><th width='100%'>Description</th><th width='30'>Applied</th></tr>\n";
222 225 $i=0;
223 226 foreach ($upgrades as $upgrade) {
224   - $color=((($i++)%2)==0)?'white':'lightgrey';
  227 + $color = ((($i++)%2)==0) ? 'white' : 'lightgrey';
225 228 $ret .= sprintf("<tr bgcolor='$color'><td>%s</td><td>%s</td><td>%s</td></tr>\n",
226 229 htmlspecialchars($upgrade->getDescriptor()),
227 230 htmlspecialchars($upgrade->getDescription()),
... ... @@ -299,11 +302,14 @@ class upgradeDatabase extends Step
299 302 {
300 303 global $default;
301 304  
  305 + $errors = false;
  306 +
302 307 $this->temp_variables['detail'] = '<p>The table below describes the upgrades that have occurred to
303 308 upgrade your KnowledgeTree installation to <strong>' . $default->systemVersion . '</strong>';
304 309  
305 310 $pre_res = $this->performPreUpgradeActions();
306 311 if (PEAR::isError($pre_res)) {
  312 + $errors = true;
307 313 $this->temp_variables['preUpgrade'] = '<font color="red">Pre-Upgrade actions failed.</font>';
308 314 }
309 315 else {
... ... @@ -313,7 +319,8 @@ class upgradeDatabase extends Step
313 319  
314 320 $res = $this->performAllUpgrades();
315 321 if (PEAR::isError($res) || PEAR::isError($pres)) {
316   - // TODO instantiate error details hideable section
  322 + $errors = true;
  323 + // TODO instantiate error details hideable section?
317 324 $this->temp_variables['upgradeStatus'] = '<font color="red">Database upgrade failed</font>
318 325 <br/><br/>
319 326 Please restore from your backup and ensure that the database does not contain
... ... @@ -327,11 +334,14 @@ class upgradeDatabase extends Step
327 334  
328 335 $post_pres = $this->performPostUpgradeActions();
329 336 if (PEAR::isError($post_res)) {
  337 + $errors = true;
330 338 $this->temp_variables['postUpgrade'] = '<font color="red">Post-Upgrade actions failed.</font>';
331 339 }
332 340 else {
333 341 $this->temp_variables['postUpgrade'] = '<font color="green">Post-Upgrade actions succeeded.</font>';
334 342 }
  343 +
  344 + return !$errors;
335 345 }
336 346  
337 347 private function performPreUpgradeActions() {
... ... @@ -404,7 +414,7 @@ class upgradeDatabase extends Step
404 414 ++$row;
405 415 $res = $upgrade->performUpgrade();
406 416 $this->temp_variables['upgradeTable'] .= sprintf('<div class="bar">%s</div>', $this->showResult($res));
407   - $this->temp_variables['upgradeTable'] .= '<br style="clear: both">' . "\n";
  417 + $this->temp_variables['upgradeTable'] .= '<br>' . "\n";
408 418 $this->temp_variables['upgradeTable'] .= "</div>\n";
409 419 if (PEAR::isError($res)) {
410 420 if (!is_a($res, 'Upgrade_Already_Applied')) {
... ...
setup/upgrade/steps/upgradeRestore.php
... ... @@ -58,7 +58,8 @@ class upgradeRestore extends Step {
58 58 protected $util = null;
59 59  
60 60 public function __construct() {
61   - $this->temp_variables = array("step_name"=>"restore", "silent"=>$this->silent);
  61 + $this->temp_variables = array("step_name"=>"restore", "silent"=>$this->silent,
  62 + "loadingText"=>"The database restore is under way. Please wait until it completes");
62 63 $this->_dbhandler = new UpgradedbUtil();
63 64 $this->util = new UpgradeUtil();
64 65 }
... ...
setup/upgrade/templates/backup.tpl
1   -<form action="index.php?step_name=backup" method="post">
2   - <p class="title"><?php echo $title; ?></p>
  1 +<form action="index.php?step_name=backup" method="post" name="dbForm" id="dbForm">
  2 + <p class="title"><?php echo $title; ?></p>
3 3  
4   - <?php
5   - if($errors || $warnings){
6   - echo '<div>'
7   - . '<a href="http://wiki.knowledgetree.com/Web_Based_Upgrader#Post_Upgrade" target="_blank">'
8   - . 'Click Here for help on overcoming backup issues</a></div><br/>';
9   - }
10   - ?>
11   - <div id="step_content_complete" class="step">
12   - <br/><br/>
13   - <div>
  4 + <?php
  5 + if($errors || $warnings){
  6 + echo '<div>'
  7 + . '<a href="http://wiki.knowledgetree.com/Web_Based_Upgrader#Post_Upgrade" target="_blank">'
  8 + . 'Click Here for help on overcoming backup issues</a></div><br/>';
  9 + }
  10 + ?>
  11 + <div id="step_content_complete" class="step">
  12 + <br/><br/>
  13 + <div>
14 14 <?php
15 15 if ($dir != '') {
16 16 if (!$backupStatus) {
... ... @@ -44,23 +44,26 @@ You can continue to do the backup manually using the following process:
44 44 ?><nobr><?php echo $display; ?></nobr>
45 45 </table>
46 46 <P>
47   - </div>
48   - </div>
  47 + </div>
  48 + </div>
  49 + <?php include 'templates/loading.tpl'; ?>
  50 + <div id="buttonBar">
  51 + <input type="submit" name="Previous" value="Back" class="button_previous">
49 52 <?php
50 53 if ($dir != '')
51 54 {
52 55 if (($action == '') || ($action == 'confirm')) {
53   - ?><input type="submit" name="BackupNow" value="Next" class="button_next"><?php
  56 + ?><input type="button" name="BackupNow" value="Next" class="button_next" onclick="doSubmit(this);"><?php
54 57 }
55 58 else if ($backupStatus) {
56 59 ?><input type="submit" name="Next" value="Restore" class="button_next">
57 60 <input type="submit" name="Upgrade" value="Upgrade" class="button_next"><?php
58 61 }
59 62 else {
60   - ?><input type="submit" name="Next" value="Next" class="button_next"><?php
  63 + ?><input type="submit" name="Next" value="Next" class="button_next""><?php
61 64 }
62 65 }
63 66  
64 67 ?>
65   - <input type="submit" name="Previous" value="Back" class="button_previous">
  68 + </div>
66 69 </form>
67 70 \ No newline at end of file
... ...
setup/upgrade/templates/database.tpl
1   -<form id="dbsettings" action="index.php?step_name=database" method="post">
  1 +<form action="index.php?step_name=database" method="post" name="dbForm" id="dbForm">
2 2 <p class="title"><?php echo $title; ?></p>
3 3 <div id="database" class="step1" style="display:block;">
4 4 <div class="description">
... ... @@ -23,30 +23,42 @@
23 23 <?php } ?>
24 24 <?php }
25 25 else if ($action == 'runUpgrade') {
26   - echo $preUpgrade;
  26 + // hiding pre-upgrade notification
  27 + /*
  28 + echo $preUpgrade;
27 29 echo '<br/><br/>';
  30 + */
28 31 echo $upgradeTable;
29 32 echo '<br/><br/>';
30   - echo $postUpgrade;
  33 + // hiding pre-upgrade notification
  34 + /*
  35 + echo $postUpgrade;
31 36 echo '<br/><br/>';
  37 + */
32 38 echo $upgradeStatus;
33 39 echo '<br/><br/>';
34 40 }
35 41 ?>
36 42 </div>
37 43 </div>
  44 + <?php include 'templates/loading.tpl'; ?>
  45 + <div id="buttonBar">
38 46 <?php if (empty($action) || ($action == 'preview')) { ?>
39   - <input type="submit" name="Previous" value="previous" class="button_previous"/>
40   - <input type="submit" name="ConfirmUpgrade" value="next" class="button_next"/>
  47 + <input type="submit" name="Previous" value="Previous" class="button_previous"/>
  48 + <input type="submit" name="ConfirmUpgrade" value="Next" class="button_next"/>
41 49 <?php }
42 50 else if ($action == 'confirm') { ?>
43   - <input type="submit" name="Cancel" value="cancel" class="button_previous"/>
44   - <input type="submit" name="RunUpgrade" value="next" class="button_next"/>
  51 + <input type="submit" name="Cancel" value="Cancel" class="button_previous"/>
  52 + <input type="button" name="RunUpgrade" value="Next" class="button_next" onclick="doSubmit(this);"/>
45 53 <?php }
46 54 else if ($action == 'runUpgrade') { ?>
47   - <script type="text/javascript">
48   - alert("To complete the upgrade please do the following before continuing:\n\n1. Restart the services as appropriate for your environment.\n\n\nOn first run of your upgraded installaton please do the following:\n\n1. Hard refresh your bowser (CTRL-F5) on first view of the Dashboard.\n2. Enable the new plugins you wish to use.\n\n\nSelect 'next' at the bottom of this page to continue.")
  55 + <?php if ($backupSuccessful) { ?>
  56 + <script type="text/javascript">
  57 + alert("To complete the upgrade please do the following before continuing:\n\n1. Restart the services as appropriate for your environment.\n\n\nOn first run of your upgraded installaton please do the following:\n\n1. Hard refresh your bowser (CTRL-F5) on first view of the Dashboard.\n2. Enable the new plugins you wish to use.\n\n\nSelect 'Finish' at the bottom of this page to continue.")
49 58 </script>
50   - <input type="submit" name="Next" value="next" class="button_next"/>
  59 + <input type="submit" name="Next" value="Finish" class="button_next"/>
  60 + <?php }
  61 + else { ?><input type="submit" name="Previous" value="Restore" class="button_previous"/><?php } ?>
51 62 <?php } ?>
  63 + </div>
52 64 </form>
53 65 \ No newline at end of file
... ...
setup/upgrade/templates/loading.tpl 0 → 100644
  1 +<div id="loadingBar" style="display:none; text-align: center; padding: 4px;">
  2 + <img src="/setup/upgrade/resources/graphics/loading.gif">
  3 + <br/>
  4 + <?php echo $loadingText; ?>
  5 +</div>
  6 +<script>
  7 + function doSubmit(obj)
  8 + {
  9 + var e = document.createElement('input');
  10 + e.setAttribute('type','hidden');
  11 + e.setAttribute('name',obj.name);
  12 + e.setAttribute('value',obj.value);
  13 + document.getElementById('loadingBar').appendChild(e);
  14 +
  15 + $('#buttonBar').hide();
  16 + $('#loadingBar').show();
  17 + $('#dbForm').submit();
  18 + }
  19 +</script>
0 20 \ No newline at end of file
... ...
setup/upgrade/templates/restore.tpl
1   -<form action="index.php?step_name=restore" method="post">
  1 +<form action="index.php?step_name=restore" method="post" name="dbForm" id="dbForm">
2 2 <p class="title"><?php echo $title; ?></p>
3 3  
4 4 <?php
... ... @@ -92,11 +92,14 @@ Press &lt;i&gt;Next&lt;/i&gt; to attempt the command(s) above.
92 92 ?>
93 93 </div>
94 94 </div>
  95 + <?php include 'templates/loading.tpl'; ?>
  96 + <div id="buttonBar">
95 97 <input type="submit" name="Previous" value="Back" class="button_previous">
96 98 <?php if (($dir != '') && ($selected)) { ?>
97   - <input type="submit" name="RunRestore" value="Next" class="button_next">
  99 + <input type="button" name="RunRestore" value="Next" class="button_next" onclick="doSubmit(this);">
98 100 <?php }
99 101 else { ?>
100 102 <input type="submit" name="Next" value="Next" class="button_next">
101 103 <?php } ?>
  104 + </div>
102 105 </form>
103 106 \ No newline at end of file
... ...