Commit ddf03f98eb3e3fdfccb255ece9e3c5f91693b39d
1 parent
d5e8b53b
StoryId 778896:Automatic startup wizard
Committed by: Jarrett Jordaan Reviewed by: Megan Watson
Showing
8 changed files
with
53 additions
and
19 deletions
control.php
| @@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
| 38 | 38 | ||
| 39 | // main library routines and defaults | 39 | // main library routines and defaults |
| 40 | require_once('config/dmsDefaults.php'); | 40 | require_once('config/dmsDefaults.php'); |
| 41 | - | 41 | +require_once("setup/wizard/install_util.php"); |
| 42 | /** | 42 | /** |
| 43 | * Controller page -- controls the web application by responding to a set of | 43 | * Controller page -- controls the web application by responding to a set of |
| 44 | * defined actions. The controller performs session handling, page-level | 44 | * defined actions. The controller performs session handling, page-level |
| @@ -49,6 +49,12 @@ require_once('config/dmsDefaults.php'); | @@ -49,6 +49,12 @@ require_once('config/dmsDefaults.php'); | ||
| 49 | // ------------------------------- | 49 | // ------------------------------- |
| 50 | // page start | 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 | $action = $_REQUEST['action']; | 59 | $action = $_REQUEST['action']; |
| 54 | 60 |
setup/wizard/index.php
| @@ -39,5 +39,12 @@ | @@ -39,5 +39,12 @@ | ||
| 39 | * @package Installer | 39 | * @package Installer |
| 40 | * @version Version 0.1 | 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 | \ No newline at end of file | 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 | \ No newline at end of file | 18 | \ No newline at end of file |
setup/wizard/installer.php
| @@ -439,6 +439,12 @@ class Installer { | @@ -439,6 +439,12 @@ class Installer { | ||
| 439 | for ($i=1; $i< count($steps)+1; $i++) { | 439 | for ($i=1; $i< count($steps)+1; $i++) { |
| 440 | $this->installHelper($steps[$i]); | 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,8 +463,8 @@ class Installer { | ||
| 457 | $class->setDataFromSession($className); // Set Session Information | 463 | $class->setDataFromSession($className); // Set Session Information |
| 458 | $class->setDBConfig(); // Set any posted variables | 464 | $class->setDBConfig(); // Set any posted variables |
| 459 | $response = $class->installStep(); // Run install step | 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 | // echo $response; | 468 | // echo $response; |
| 463 | // if($response == 'error') { | 469 | // if($response == 'error') { |
| 464 | // return $this->landing(); | 470 | // return $this->landing(); |
setup/wizard/resources/wizard.js
| @@ -10,8 +10,8 @@ wizard.prototype.doFormCheck = function() { | @@ -10,8 +10,8 @@ wizard.prototype.doFormCheck = function() { | ||
| 10 | // Disable DnD on element | 10 | // Disable DnD on element |
| 11 | // Element has to have a readOnly status set to readonly | 11 | // Element has to have a readOnly status set to readonly |
| 12 | wizard.prototype.disableDnd = function(el_id) { | 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 | // Add readOnly access on all inputs of a form | 17 | // Add readOnly access on all inputs of a form |
setup/wizard/steps/database.php
| @@ -740,17 +740,17 @@ class database extends Step | @@ -740,17 +740,17 @@ class database extends Step | ||
| 740 | * @return boolean | 740 | * @return boolean |
| 741 | */ | 741 | */ |
| 742 | public function doAjaxTest($host, $uname, $dname) { | 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 | public function setPostValues() { | 756 | public function setPostValues() { |
setup/wizard/templates/database.tpl