Commit ddf03f98eb3e3fdfccb255ece9e3c5f91693b39d

Authored by Jarrett Jordaan
1 parent d5e8b53b

StoryId 778896:Automatic startup wizard

Committed by: Jarrett Jordaan

Reviewed by: Megan Watson
control.php
... ... @@ -38,7 +38,7 @@
38 38  
39 39 // main library routines and defaults
40 40 require_once('config/dmsDefaults.php');
41   -
  41 +require_once("setup/wizard/install_util.php");
42 42 /**
43 43 * Controller page -- controls the web application by responding to a set of
44 44 * defined actions. The controller performs session handling, page-level
... ... @@ -49,6 +49,12 @@ require_once('config/dmsDefaults.php');
49 49 // -------------------------------
50 50 // page start
51 51 // -------------------------------
  52 +// Check if system has been installed
  53 +$iu = new InstallUtil();
  54 +if(!$iu->isSystemInstalled()) {
  55 + redirect("setup/wizard");
  56 + exit(0);
  57 +}
52 58  
53 59 $action = $_REQUEST['action'];
54 60  
... ...
setup/wizard/index.php
... ... @@ -39,5 +39,12 @@
39 39 * @package Installer
40 40 * @version Version 0.1
41 41 */
42   - require("installer.php");
  42 + require_once("install_util.php");
  43 + $ui = new InstallUtil();
  44 + if(!$ui->isSystemInstalled()) {
  45 + require("installer.php");
  46 + } else {
  47 + echo "System has been installed <a href='../../'>Goto Login</a>";
  48 + }
  49 +
43 50 ?>
44 51 \ No newline at end of file
... ...
setup/wizard/install_util.php 0 → 100644
  1 +<?php
  2 +
  3 +class InstallUtil {
  4 +
  5 + public function __construct() {
  6 +
  7 + }
  8 +
  9 + public function isSystemInstalled() {
  10 + if (file_exists(dirname(__FILE__)."/install")) {
  11 + return false;
  12 + }
  13 +
  14 + return true;
  15 + }
  16 +}
  17 +?>
0 18 \ No newline at end of file
... ...
setup/wizard/installer.php
... ... @@ -439,6 +439,12 @@ class Installer {
439 439 for ($i=1; $i< count($steps)+1; $i++) {
440 440 $this->installHelper($steps[$i]);
441 441 }
  442 +
  443 + $this->completeInstall();
  444 + }
  445 +
  446 + private function completeInstall() {
  447 + unlink("install");
442 448 }
443 449  
444 450 /**
... ... @@ -457,8 +463,8 @@ class Installer {
457 463 $class->setDataFromSession($className); // Set Session Information
458 464 $class->setDBConfig(); // Set any posted variables
459 465 $response = $class->installStep(); // Run install step
460   - echo "$className==$response<br/>";
461   - echo "<pre>";print_r($_SESSION['database']);echo "</pre>";
  466 +// echo "$className==$response<br/>";
  467 +// echo "<pre>";print_r($_SESSION['database']);echo "</pre>";
462 468 // echo $response;
463 469 // if($response == 'error') {
464 470 // return $this->landing();
... ...
setup/wizard/resources/wizard.js
... ... @@ -10,8 +10,8 @@ wizard.prototype.doFormCheck = function() {
10 10 // Disable DnD on element
11 11 // Element has to have a readOnly status set to readonly
12 12 wizard.prototype.disableDnd = function(el_id) {
13   - el = document.getElementById(el_id);
14   - el.removeAttribute('readOnly');
  13 +// el = document.getElementById(el_id);
  14 +// el.removeAttribute('readOnly');
15 15 }
16 16  
17 17 // Add readOnly access on all inputs of a form
... ...
setup/wizard/steps/database.php
... ... @@ -740,17 +740,17 @@ class database extends Step
740 740 * @return boolean
741 741 */
742 742 public function doAjaxTest($host, $uname, $dname) {
743   - echo 'asd';
744   - die;
745   - if($this->dport == '')
746   - $con = $this->dbhandler->DBUtil($this->dhost, $this->duname, $this->dpassword, $this->dname);
747   - else
748   - $con = $this->dbhandler->DBUtil($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname);
749   - if (!$con) {
750   - return false;
751   - } else {
752   - return true;
753   - }
  743 +// echo 'asd';
  744 +// die;
  745 +// if($this->dport == '')
  746 +// $con = $this->dbhandler->DBUtil($this->dhost, $this->duname, $this->dpassword, $this->dname);
  747 +// else
  748 +// $con = $this->dbhandler->DBUtil($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname);
  749 +// if (!$con) {
  750 +// return false;
  751 +// } else {
  752 +// return true;
  753 +// }
754 754 }
755 755  
756 756 public function setPostValues() {
... ...
setup/wizard/templates/database.tpl
1 1 <h1>Database Configuration</h1>
2   -<!--onclick="javascript:{ldelim}disableDnd('input_period');{rdelim}" readOnly="readonly"-->
3 2  
4 3 <div class="errors">
5 4 <?php if(isset($errors)) {
... ...
setup/wizard/templates/wizard.tpl
... ... @@ -32,5 +32,4 @@
32 32 </html>
33 33 <script>
34 34 var w = new wizard();
35   - w.disableDnd();
36 35 </script>
37 36 \ No newline at end of file
... ...