Commit d5e8b53b7282e71ba9dc1fabbc19b118b6781689

Authored by Jarrett Jordaan
1 parent fa2790b7

StoryId 778896:Centralizaed Javascript

Committed by: Jarrett Jordaan

Reviewed by: Megan Watson
setup/wizard/installer.php
@@ -457,6 +457,12 @@ class Installer { @@ -457,6 +457,12 @@ class Installer {
457 $class->setDataFromSession($className); // Set Session Information 457 $class->setDataFromSession($className); // Set Session Information
458 $class->setDBConfig(); // Set any posted variables 458 $class->setDBConfig(); // Set any posted variables
459 $response = $class->installStep(); // Run install step 459 $response = $class->installStep(); // Run install step
  460 + echo "$className==$response<br/>";
  461 + echo "<pre>";print_r($_SESSION['database']);echo "</pre>";
  462 +// echo $response;
  463 +// if($response == 'error') {
  464 +// return $this->landing();
  465 +// }
460 } 466 }
461 } else { 467 } else {
462 die("$className : Class Files Missing"); 468 die("$className : Class Files Missing");
setup/wizard/resources/wizard.css
@@ -118,8 +118,8 @@ td { @@ -118,8 +118,8 @@ td {
118 118
119 .indicator { 119 .indicator {
120 background: url("graphics/indicator.png") no-repeat; 120 background: url("graphics/indicator.png") no-repeat;
121 - height: 15px;  
122 - width: 15px; 121 + height: 16px;
  122 + width: 16px;
123 padding-left: 20px; 123 padding-left: 20px;
124 } 124 }
125 125
@@ -129,35 +129,35 @@ td { @@ -129,35 +129,35 @@ td {
129 129
130 .active { 130 .active {
131 background: url("graphics/active.png") no-repeat; 131 background: url("graphics/active.png") no-repeat;
132 - height: 15px;  
133 - width: 15px; 132 + height: 16px;
  133 + width: 16px;
134 padding-left: 20px; 134 padding-left: 20px;
135 } 135 }
136 136
137 .inactive { 137 .inactive {
138 background: url("graphics/inactive.png") no-repeat; 138 background: url("graphics/inactive.png") no-repeat;
139 - height: 15px;  
140 - width: 15px; 139 + height: 16px;
  140 + width: 16px;
141 padding-left: 20px; 141 padding-left: 20px;
142 color: #919191; 142 color: #919191;
143 } 143 }
144 144
145 .tick { 145 .tick {
146 background: url("graphics/tick.png") no-repeat; 146 background: url("graphics/tick.png") no-repeat;
147 - height: 15px;  
148 - width: 15px; 147 + height: 16px;
  148 + width: 16px;
149 } 149 }
150 150
151 .cross { 151 .cross {
152 background: url("graphics/cross.png") no-repeat; 152 background: url("graphics/cross.png") no-repeat;
153 - height: 15px;  
154 - width: 15px; 153 + height: 16px;
  154 + width: 16px;
155 } 155 }
156 156
157 .cross_orange { 157 .cross_orange {
158 background: url("graphics/cross_orange.png") no-repeat; 158 background: url("graphics/cross_orange.png") no-repeat;
159 - height: 15px;  
160 - width: 15px; 159 + height: 16px;
  160 + width: 16px;
161 } 161 }
162 162
163 .green { 163 .green {
@@ -232,3 +232,19 @@ td { @@ -232,3 +232,19 @@ td {
232 .right_top { 232 .right_top {
233 height:45px; 233 height:45px;
234 } 234 }
  235 +
  236 +table#dbconf tr td {
  237 + width:50%;
  238 +}
  239 +
  240 +input#dname {
  241 + size:40px;
  242 +}
  243 +
  244 +.options {
  245 + width:15%;
  246 +}
  247 +
  248 +.adv_options {
  249 + padding: 5px 8px;
  250 +}
235 \ No newline at end of file 251 \ No newline at end of file
setup/wizard/resources/wizard.js 0 โ†’ 100644
  1 +// Class Wizard
  2 +function wizard() {
  3 +}
  4 +
  5 +// Does a form check on every new page load
  6 +wizard.prototype.doFormCheck = function() {
  7 + w.addReadOnly();
  8 +}
  9 +
  10 +// Disable DnD on element
  11 +// Element has to have a readOnly status set to readonly
  12 +wizard.prototype.disableDnd = function(el_id) {
  13 + el = document.getElementById(el_id);
  14 + el.removeAttribute('readOnly');
  15 +}
  16 +
  17 +// Add readOnly access on all inputs of a form
  18 +wizard.prototype.addReadOnly = function() {
  19 + inputs = document.getElementsByTagName('input');
  20 + for(i=0;i<inputs.length;i++) {
  21 + var input_id = inputs[i].id;
  22 + if(input_id != '') {
  23 +// inputs[i].setAttribute('readOnly', 'readonly');
  24 +// inputs[i].setAttribute('onfocus', "javascript:{w.disableDnd('"+ input_id +"')}");
  25 +// inputs[i].focus();
  26 +// w.focusElement(inputs[i]);
  27 + }
  28 + }
  29 +}
  30 +
  31 +// Toggle Advance Database options
  32 +wizard.prototype.showAO = function() {
  33 + var el = document.getElementsByClassName("adv_options");
  34 + if(el[0].style.display == 'none')
  35 + el[0].style.display = 'block';
  36 + else
  37 + el[0].style.display = 'none';
  38 +}
  39 +
  40 +// Toggle display of an element
  41 +wizard.prototype.toggleElement = function(el) {
  42 + if(el.style.display == 'none')
  43 + el.style.display = 'block';
  44 + else
  45 + el.style.display = 'none';
  46 +}
  47 +
  48 +// Handle steps within database page
  49 + wizard.prototype.showStep = function(p, d) {
  50 + // Don't check if previous is clicked
  51 + if(d != 'p') {
  52 + // Check for errors
  53 + var ueq = 0;
  54 + if(p == 2) {
  55 + ueq = w.validateUsers('dmsname', 'dmspassword', 'dmspassword2');
  56 + } else if(p == 3) {
  57 + ueq = w.validateUsers('dmsusername', 'dmsuserpassword', 'dmsuserpassword2');
  58 + }
  59 + if(ueq != 0) {
  60 + return w.display("error_"+ ueq + "_" + p) ;
  61 + }
  62 + }
  63 + w.hideErrors(); // If theres no errors, hide the ones displaying
  64 + var el = document.getElementsByClassName("step"+p);
  65 + el[0].style.display = 'none';
  66 + if(d == "n") {
  67 + var j = p+1;
  68 + } else if(d == "p") {
  69 + var j = p-1;
  70 + }
  71 + var el = document.getElementsByClassName("step"+j);
  72 + el[0].style.display = 'block';
  73 +
  74 + return true;
  75 +}
  76 +
  77 +// Validate Users
  78 + wizard.prototype.validateUsers = function(id1, id2, id3) {
  79 + var el1 = document.getElementById(id1);
  80 + var el2 = document.getElementById(id2);
  81 + var el3 = document.getElementById(id3);
  82 + var elVal1 = el1.value;
  83 + var elVal2 = el2.value;
  84 + var elVal3 = el3.value;
  85 + if(elVal1 == '') { // User name empty
  86 + w.focusElement(el1);
  87 + return 1;
  88 + } else if(elVal2 == '') { // Empty Password
  89 + w.focusElement(el2);
  90 + return 2;
  91 + } else if(elVal3 == '') { // Empty Confirmation Password
  92 + w.focusElement(el3);
  93 + return 3;
  94 + } else if(elVal2 != elVal3) { // Passwords not equal
  95 + w.focusElement(el2);
  96 + return 4;
  97 + } else {
  98 + return 0;
  99 + }
  100 +}
  101 +
  102 +// Display Errors
  103 +wizard.prototype.display = function(elname, er) {
  104 + var el = document.getElementById(elname);
  105 + w.showElement(el);
  106 +}
  107 +
  108 +// Hide Errors
  109 +wizard.prototype.hideErrors = function() {
  110 + var errors = document.getElementsByClassName('error');
  111 + var i;
  112 + for(i=0;i<errors.length;i++) {
  113 + w.hideElement(errors[i]);
  114 + }
  115 + return true;
  116 +}
  117 +
  118 +// Hide an element
  119 +wizard.prototype.hideElement = function(el) {
  120 + if(el.style.display == 'block')
  121 + el.style.display = 'none';
  122 +}
  123 +
  124 +// Show an element
  125 +wizard.prototype.showElement = function(el) {
  126 + if(el.style.display == 'none')
  127 + el.style.display = 'block';
  128 +}
  129 +
  130 +// Focus on element
  131 +wizard.prototype.focusElement = function(el) {
  132 + el.focus();
  133 +}
  134 +
  135 +// Catch form submit and validate
  136 +wizard.prototype.onSubmitValidate = function() {
  137 + var response = w.showStep(3, 'n');
  138 + if(response == true) {
  139 + document.getElementById('sendAll').name = 'Next'; // Force the next step
  140 + document.getElementById('sendAll').value = 'next';
  141 + document.getElementById('dbsettings').submit();
  142 + }
  143 +}
0 \ No newline at end of file 144 \ No newline at end of file
setup/wizard/step_action.php
@@ -333,7 +333,6 @@ class stepAction { @@ -333,7 +333,6 @@ class stepAction {
333 $this->loadValueToSession($this->stepName, $key, $value); 333 $this->loadValueToSession($this->stepName, $key, $value);
334 } 334 }
335 } 335 }
336 -  
337 $content = $step_tpl->fetch(); 336 $content = $step_tpl->fetch();
338 $tpl = new Template("templates/wizard.tpl"); 337 $tpl = new Template("templates/wizard.tpl");
339 $tpl->set('content', $content); 338 $tpl->set('content', $content);
setup/wizard/steps/database.php
@@ -292,11 +292,11 @@ class database extends Step @@ -292,11 +292,11 @@ class database extends Step
292 */ 292 */
293 public function doTest() { 293 public function doTest() {
294 if($this->match($this->dmspassword, $this->getPassword1()) != 0) { 294 if($this->match($this->dmspassword, $this->getPassword1()) != 0) {
295 - $this->error = array("19"=>"Passwords do not match: " . $this->dmspassword." ". $this->getPassword1()); 295 + $this->error[] = "Passwords do not match: " . $this->dmspassword." ". $this->getPassword1();
296 return false; 296 return false;
297 } 297 }
298 if($this->match($this->dmsuserpassword, $this->getPassword2()) != 0) { 298 if($this->match($this->dmsuserpassword, $this->getPassword2()) != 0) {
299 - $this->error = array("17"=>"Passwords do not match: " . $this->dmsuserpassword." ". $this->getPassword2()); 299 + $this->error[] = "Passwords do not match: " . $this->dmsuserpassword." ". $this->getPassword2();
300 return false; 300 return false;
301 } 301 }
302 if($this->dport == '') 302 if($this->dport == '')
@@ -304,7 +304,7 @@ class database extends Step @@ -304,7 +304,7 @@ class database extends Step
304 else 304 else
305 $con = $this->dbhandler->DBUtil($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname); 305 $con = $this->dbhandler->DBUtil($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname);
306 if (!$con) { 306 if (!$con) {
307 - $this->error = array("1"=>"Could not connect: " . $this->dbhandler->getErrors()); 307 + $this->error[] = "Could not connect: " . $this->dbhandler->getErrors();
308 return false; 308 return false;
309 } else { 309 } else {
310 return true; 310 return true;
@@ -500,7 +500,9 @@ class database extends Step @@ -500,7 +500,9 @@ class database extends Step
500 $this->error[] = 'No database type selected'; 500 $this->error[] = 'No database type selected';
501 return 'error'; 501 return 'error';
502 } 502 }
503 - $this->{$this->dtype}(); 503 + if(!$this->{$this->dtype}()) {
  504 + return 'error';
  505 + }
504 } 506 }
505 507
506 /** 508 /**
@@ -515,7 +517,7 @@ class database extends Step @@ -515,7 +517,7 @@ class database extends Step
515 $con = $this->connectMysql(); 517 $con = $this->connectMysql();
516 if($con) { 518 if($con) {
517 if(!$this->createDB($con)) { 519 if(!$this->createDB($con)) {
518 - $this->error = array("20"=>"Could Create Database: " . $this->dbhandler->getErrors()); 520 + $this->error[] = "Could not Create Database: " . $this->dbhandler->getErrors();
519 return false; 521 return false;
520 } 522 }
521 $this->closeMysql($con); 523 $this->closeMysql($con);
@@ -533,7 +535,7 @@ class database extends Step @@ -533,7 +535,7 @@ class database extends Step
533 private function connectMysql() { 535 private function connectMysql() {
534 $con = $this->dbhandler->DBUtil($this->dhost, $this->duname, $this->dpassword, $this->dname); 536 $con = $this->dbhandler->DBUtil($this->dhost, $this->duname, $this->dpassword, $this->dname);
535 if (!$con) { 537 if (!$con) {
536 - $this->error = array("2"=>"Could not connect: " . $this->dbhandler->getErrors()); 538 + $this->error[] = "Could not connect: " . $this->dbhandler->getErrors();
537 539
538 return false; 540 return false;
539 } 541 }
@@ -553,31 +555,32 @@ class database extends Step @@ -553,31 +555,32 @@ class database extends Step
553 if($this->usedb($con)) { // attempt to use the db 555 if($this->usedb($con)) { // attempt to use the db
554 if($this->dropdb($con)) { // attempt to drop the db 556 if($this->dropdb($con)) { // attempt to drop the db
555 if(!$this->create($con)) { // attempt to create the db 557 if(!$this->create($con)) { // attempt to create the db
556 - $this->error = array("15"=>"Could create database: " . $this->dbhandler->getErrors()); 558 + $this->error[] = "Could create database: " . $this->dbhandler->getErrors();
557 return false;// cannot overwrite database 559 return false;// cannot overwrite database
558 } 560 }
559 } else { 561 } else {
560 - $this->error = array("14"=>"Could not drop database: " . $this->dbhandler->getErrors()); 562 + $this->error[] = "Could not drop database: " . $this->dbhandler->getErrors();
561 return false;// cannot overwrite database 563 return false;// cannot overwrite database
562 } 564 }
563 } else { 565 } else {
564 if(!$this->create($con)) { // attempt to create the db 566 if(!$this->create($con)) { // attempt to create the db
565 - $this->error = array("16"=>"Could create database: " . $this->dbhandler->getErrors()); 567 + $this->error[] = "Could not create database: " . $this->dbhandler->getErrors();
566 return false;// cannot overwrite database 568 return false;// cannot overwrite database
567 } 569 }
568 } 570 }
569 if(!$this->createDmsUser($con)) { 571 if(!$this->createDmsUser($con)) {
570 - // TODO:Way to catch errors 572 +
571 } 573 }
572 if(!$this->createSchema($con)) { 574 if(!$this->createSchema($con)) {
573 - // TODO:Way to catch errors 575 + $this->error[] = "Could not create schema ";
574 } 576 }
575 if(!$this->populateSchema($con)) { 577 if(!$this->populateSchema($con)) {
576 - // TODO:Way to catch errors 578 + $this->error[] = "Could not populate schema ";
577 } 579 }
578 if(!$this->applyUpgrades($con)) { 580 if(!$this->applyUpgrades($con)) {
579 - // TODO:Way to catch errors 581 + $this->error[] = "Could not apply updates ";
580 } 582 }
  583 +
581 return true; 584 return true;
582 } 585 }
583 586
@@ -611,7 +614,7 @@ class database extends Step @@ -611,7 +614,7 @@ class database extends Step
611 if($this->dbhandler->useBD($this->dname)) { 614 if($this->dbhandler->useBD($this->dname)) {
612 return true; 615 return true;
613 } else { 616 } else {
614 - $this->error = array("4"=>"Error using database: ".$this->dbhandler->getErrors().""); 617 + $this->error[] = "Error using database: ".$this->dbhandler->getErrors();
615 return false; 618 return false;
616 } 619 }
617 } 620 }
@@ -628,11 +631,11 @@ class database extends Step @@ -628,11 +631,11 @@ class database extends Step
628 if($this->ddrop) { 631 if($this->ddrop) {
629 $sql = "DROP DATABASE {$this->dname};"; 632 $sql = "DROP DATABASE {$this->dname};";
630 if(!$this->dbhandler->query($sql)) { 633 if(!$this->dbhandler->query($sql)) {
631 - $this->error = array("5"=>"Cannot drop database: ".$this->dbhandler->getErrors().""); 634 + $this->error[] = "Cannot drop database: ".$this->dbhandler->getErrors();
632 return false; 635 return false;
633 } 636 }
634 } else { 637 } else {
635 - $this->error = array("6"=>"Cannot drop database: ".$this->dbhandler->getErrors().""); 638 + $this->error[] = "Cannot drop database: ".$this->dbhandler->getErrors();
636 return false; 639 return false;
637 } 640 }
638 return true; 641 return true;
@@ -649,14 +652,15 @@ class database extends Step @@ -649,14 +652,15 @@ class database extends Step
649 private function createDmsUser($con) { 652 private function createDmsUser($con) {
650 if($this->dmsname == '' || $this->dmspassword == '') { 653 if($this->dmsname == '' || $this->dmspassword == '') {
651 $command = "{$this->dbbinary} -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/user.sql"; 654 $command = "{$this->dbbinary} -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/user.sql";
652 - return exec($command, $output); 655 + exec($command, $out, $ret);
  656 + return $ret;
653 } else { 657 } else {
654 $user1 = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY \"{$this->dmsuserpassword}\";"; 658 $user1 = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY \"{$this->dmsuserpassword}\";";
655 $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";"; 659 $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";";
656 if ($this->dbhandler->execute($user1) && $this->dbhandler->execute($user2)) { 660 if ($this->dbhandler->execute($user1) && $this->dbhandler->execute($user2)) {
657 return true; 661 return true;
658 } else { 662 } else {
659 - $this->error = array("18"=>"Could not create users in database: ".$this->dbhandler->getErrors().""); 663 + $this->error[] = "Could not create users in database: ".$this->dbhandler->getErrors();
660 return false; 664 return false;
661 } 665 }
662 } 666 }
@@ -673,7 +677,8 @@ class database extends Step @@ -673,7 +677,8 @@ class database extends Step
673 */ 677 */
674 private function createSchema($con) { 678 private function createSchema($con) {
675 $command = "{$this->dbbinary} -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/structure.sql"; 679 $command = "{$this->dbbinary} -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/structure.sql";
676 - return exec($command, $output); 680 + exec($command, $out, $ret);
  681 + return $ret;
677 } 682 }
678 683
679 /** 684 /**
@@ -686,7 +691,8 @@ class database extends Step @@ -686,7 +691,8 @@ class database extends Step
686 */ 691 */
687 private function populateSchema($con) { 692 private function populateSchema($con) {
688 $command = "{$this->dbbinary} -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/data.sql"; 693 $command = "{$this->dbbinary} -u{$this->duname} -p{$this->dpassword} {$this->dname} < sql/data.sql";
689 - return exec($command, $output); 694 + exec($command, $out, $ret);
  695 + return $ret;
690 } 696 }
691 697
692 private function applyUpgrades($con) { 698 private function applyUpgrades($con) {
@@ -708,7 +714,7 @@ class database extends Step @@ -708,7 +714,7 @@ class database extends Step
708 try { 714 try {
709 $this->dbhandler->close(); 715 $this->dbhandler->close();
710 } catch (Exeption $e) { 716 } catch (Exeption $e) {
711 - $this->error = array("13"=>"Could not close: " . $e); 717 + $this->error[] = "Could not close: " . $e;
712 } 718 }
713 } 719 }
714 720
@@ -724,5 +730,38 @@ class database extends Step @@ -724,5 +730,38 @@ class database extends Step
724 730
725 return $this->error; 731 return $this->error;
726 } 732 }
  733 +
  734 + /**
  735 + * Test database connectivity
  736 + *
  737 + * @author KnowledgeTree Team
  738 + * @param none
  739 + * @access public
  740 + * @return boolean
  741 + */
  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 + }
  754 + }
  755 +
  756 + public function setPostValues() {
  757 + foreach ($_POST as $k=>$v) {
  758 + echo "$k=>$v<br/>";
  759 + }
  760 + }
  761 +}
  762 +
  763 +if(isset($_POST['ajax'])) {
  764 + $db = new database();
  765 + $db->setPostValues();
727 } 766 }
728 ?> 767 ?>
729 \ No newline at end of file 768 \ No newline at end of file
setup/wizard/templates/database.tpl
1 <h1>Database Configuration</h1> 1 <h1>Database Configuration</h1>
  2 +<!--onclick="javascript:{ldelim}disableDnd('input_period');{rdelim}" readOnly="readonly"-->
2 3
3 <div class="errors"> 4 <div class="errors">
4 <?php if(isset($errors)) { 5 <?php if(isset($errors)) {
@@ -8,82 +9,66 @@ @@ -8,82 +9,66 @@
8 }?> 9 }?>
9 </div> 10 </div>
10 11
11 -<form action="index.php?step_name=<?php echo $step_name; ?>" method="post">  
12 - 12 +<form id="dbsettings" action="index.php?step_name=<?php echo $step_name; ?>" method="post" onsubmit="w.onSubmitValidate();return false;">
  13 +<!--Hidden Fields-->
  14 +<input type="hidden" id='ddrop' name="ddrop" <?php echo ($ddrop) ? 'CHECKED' : ''; ?>/>
  15 +<input type="hidden" id="sendAll" name="" value="" />
13 <!-- STEP 1 of the database configuration - server settings --> 16 <!-- STEP 1 of the database configuration - server settings -->
14 <div id="database" class="step1" style="display:block;"> 17 <div id="database" class="step1" style="display:block;">
15 -<div class="description">  
16 -This step configures the connection to the database server and installs the database. The details for an administrative user on the database  
17 -server are required in order to be able to configure and install the installation database.  
18 -</div>  
19 -  
20 - Select your database type:  
21 - <div class="dtype"> 18 + <div class="description">
  19 + This step configures the connection to the database server and installs the database. The details for an administrative <br/>
  20 + user on the database server are required in order to be able to configure and install the installation database.
  21 + </div>
  22 + <table class="dbconf">
  23 + <tr><td>Your current database type is: </td>
22 <?php if($dtypes) { 24 <?php if($dtypes) {
23 foreach($dtypes as $k=>$v) { 25 foreach($dtypes as $k=>$v) {
24 - ?>  
25 - <input type="radio" name="dtype" value="<?php echo $v; ?>" <?php if(!$k)echo 'checked="checked"'; ?>/>&nbsp;&nbsp;<?php echo ucwords($v); ?>  
26 - <br/> 26 + ?><td><input type="hidden" name="dtype" value="<?php echo $v; ?>" <?php if(!$k)echo 'checked="checked"'; ?>/>&nbsp;&nbsp;<?php echo ucwords($v); ?></td>
27 <?php } 27 <?php }
28 } 28 }
29 ?> 29 ?>
30 - </div>  
31 -<p>  
32 - <table>  
33 - <tr>  
34 - <td width="60%"><label for='dname'>Enter a name for the database: </label></td>  
35 - <td><input type='text' value="<?php echo $dname?>" id='dname' name='dname' size='40' /></td>  
36 - </tr>  
37 - <tr>  
38 - <td><label for='duname'>Enter the username for the Root or Administrative User: </label></td>  
39 - <td><input type='text' value="<?php echo $duname?>" id='duname' name='duname' size='40' /></td>  
40 - </tr>  
41 - <tr>  
42 - <td><label for='dpassword'>Enter the password for the user: </label></td>  
43 - <td><input type='password' value="<?php echo $dpassword?>" id='dpassword' name='dpassword' size='40' /></td>  
44 - </tr>  
45 - <tr>  
46 - <td><label for='ddrop'>Drop database if it exists: </label></td>  
47 - <td><input type="checkbox" id='ddrop' name="ddrop" <?php echo ($ddrop) ? 'CHECKED' : ''; ?>/></td> 30 + </tr>
  31 + <tr>
  32 + <td><label for='dname'>Enter a name for the database: </label></td>
  33 + <td><input type='text' value="<?php echo $dname?>" id='dname' name='dname' size='40'/></td>
  34 + </tr>
  35 + <tr>
  36 + <td><label for='duname'>Enter the username for the Root or Administrative User: </label></td>
  37 + <td><input type='text' value="<?php echo $duname?>" id='duname' name='duname' size='40' /></td>
  38 + </tr>
  39 + <tr>
  40 + <td><label for='dpassword'>Enter the password for the user: </label></td>
  41 + <td><input type='password' value="<?php echo $dpassword?>" id='dpassword' name='dpassword' size='40' /></td>
  42 + </tr>
48 </table> 43 </table>
49 - <br />  
50 -</p>  
51 44
52 - <div id="options" class="onclick" onclick="showAO();">Advanced Options</div> 45 + <div id="options" class="onclick" onclick="javascript:{w.showAO();}">Advanced Options</div>
53 46
54 <div id="database" class="adv_options" style="display:none;"> 47 <div id="database" class="adv_options" style="display:none;">
55 <div class="description"> 48 <div class="description">
56 These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings. 49 These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings.
57 </div> 50 </div>
58 -  
59 -  
60 <p> 51 <p>
61 <label for='dhost'>Host: </label><br /> 52 <label for='dhost'>Host: </label><br />
62 - <span class="description">The address of the server where the database is located, if different to the current server.</span><br /> 53 + <span class="description">The address of the server where the database is located, if different to the current server.</span><br/>
63 <input type="text" value="<?php echo $dhost?>" id="dhost" name="dhost" size='60'/> 54 <input type="text" value="<?php echo $dhost?>" id="dhost" name="dhost" size='60'/>
64 </p> 55 </p>
65 56
66 <p> 57 <p>
67 <label for='dport'>Port: </label><br /> 58 <label for='dport'>Port: </label><br />
68 - <span class="description">The port on which your database server is listening, if it is a non-standard port please enter the number here.</span><br /> 59 + <span class="description">The port on which your database server is listening, if it is a non-standard port please enter the number here.</span><br/>
69 <input type="text" value="<?php echo $dport?>" id="dport" name="dport" size='10'/> 60 <input type="text" value="<?php echo $dport?>" id="dport" name="dport" size='10'/>
70 </p> 61 </p>
71 62
72 <p> 63 <p>
73 - <label for='dbbinary'>Binary: </label><br />  
74 - <span class="description">The path to the database binary. If it is not on your system path then please enter it here.</span><br /> 64 + <label for='dbbinary'>Socket: </label><br />
  65 + <span class="description">The path to the database binary. If it is not on your system path then please enter it here.</span><br/>
75 <input type="text" value="<?php echo $dbbinary?>" id="dbbinary" name="dbbinary" size='60'/> 66 <input type="text" value="<?php echo $dbbinary?>" id="dbbinary" name="dbbinary" size='60'/>
76 </p> 67 </p>
77 -  
78 - <p>  
79 - <label for='tprefix'>Table Prefix: </label><br />  
80 - <span class="description">Used to differentiate between different applications sharing the same database. If more than one application will be sharing this database, enter a table prefix such as kt_ for your KnowledgeTree installation here.</span><br />  
81 - <input type="text" value="<?php echo $tprefix?>" id="tprefix" name="tprefix" size='60'/>  
82 - </p>  
83 </div> 68 </div>
84 <div class="buttons"> 69 <div class="buttons">
85 <input type="submit" name="Previous" value="previous" /> 70 <input type="submit" name="Previous" value="previous" />
86 - <input type="button" name="Next" value="next" onclick="showStep(1, 'n');"/> 71 + <input type="button" name="Next" value="next" onclick="javascript:{w.showStep(1, 'n');}"/>
87 </div> 72 </div>
88 </div> 73 </div>
89 74
@@ -92,25 +77,28 @@ server are required in order to be able to configure and install the installatio @@ -92,25 +77,28 @@ server are required in order to be able to configure and install the installatio
92 <div class="description"> 77 <div class="description">
93 An administrative user is required for creating tables within the database. 78 An administrative user is required for creating tables within the database.
94 </div> 79 </div>
95 -  
96 - <table> 80 + <table class="dbconf">
97 <tr> 81 <tr>
98 - <td width="60%"><label for='dmsname'>Enter the name of the Database Administrative User: </label></td> 82 + <td><label for='dmsname'>Enter the name of the Database Administrative User: </label></td>
99 <td><input type='text' value="<?php echo $dmsname; ?>" id='dmsname' name='dmsname' size='40' /></td> 83 <td><input type='text' value="<?php echo $dmsname; ?>" id='dmsname' name='dmsname' size='40' /></td>
  84 + <td id="error_1_2" class="error" style="display:none">Please Enter A Username</td>
100 </tr> 85 </tr>
101 <tr> 86 <tr>
102 <td><label for='dmspassword'>Enter a password: </label></td> 87 <td><label for='dmspassword'>Enter a password: </label></td>
103 <td><input type='password' value="<?php echo $dmspassword; ?>" id='dmspassword' name='dmspassword' size='40' /></td> 88 <td><input type='password' value="<?php echo $dmspassword; ?>" id='dmspassword' name='dmspassword' size='40' /></td>
  89 + <td id="error_2_2" class="error" style="display:none">Please Enter A Password</td>
104 </tr> 90 </tr>
105 <tr> 91 <tr>
106 <td><label for='dmspassword2'>Please confirm the password: </label></td> 92 <td><label for='dmspassword2'>Please confirm the password: </label></td>
107 <td><input type='password' value="" id='dmspassword2' name='dmspassword2' size='40' /></td> 93 <td><input type='password' value="" id='dmspassword2' name='dmspassword2' size='40' /></td>
  94 + <td id="error_3_2" class="error" style="display:none">Please Confirm Password</td>
  95 + <td id="error_4_2" class="error" style="display:none">Passwords Do Not Match</td>
108 </tr> 96 </tr>
109 </table> 97 </table>
110 98
111 <div class="buttons"> 99 <div class="buttons">
112 - <input type="button" name="Previous" value="previous" onclick="showStep(2, 'p');"/>  
113 - <input type="button" name="Next" value="next" onclick="showStep(2, 'n');"/> 100 + <input type="button" name="Previous" value="previous" onclick="javascript:{w.showStep(2, 'p');}"/>
  101 + <input type="button" name="Next" value="next" onclick="javascript:{w.showStep(2, 'n');}"/>
114 </div> 102 </div>
115 </div> 103 </div>
116 104
@@ -120,46 +108,28 @@ An administrative user is required for creating tables within the database. @@ -120,46 +108,28 @@ An administrative user is required for creating tables within the database.
120 An second user is required for normal database interaction, the reading and writing of data. 108 An second user is required for normal database interaction, the reading and writing of data.
121 </div> 109 </div>
122 110
123 - <table> 111 + <table class="dbconf">
124 <tr> 112 <tr>
125 - <td width="60%"><label for='dmsusername'>Enter a name for the User: </label></td> 113 + <td><label for='dmsusername'>Enter a name for the User: </label></td>
126 <td><input type='text' value="<?php echo $dmsusername; ?>" id='dmsusername' name='dmsusername' size='40' /></td> 114 <td><input type='text' value="<?php echo $dmsusername; ?>" id='dmsusername' name='dmsusername' size='40' /></td>
  115 + <td id="error_1_3" class="error" style="display:none">Please Enter A Username</td>
127 </tr> 116 </tr>
128 <tr> 117 <tr>
129 <td><label for='dmsuserpassword'>Enter a password: </label></td> 118 <td><label for='dmsuserpassword'>Enter a password: </label></td>
130 <td><input type='password' value="<?php echo $dmsuserpassword?>" id='dmsuserpassword' name='dmsuserpassword' size='40' /></td> 119 <td><input type='password' value="<?php echo $dmsuserpassword?>" id='dmsuserpassword' name='dmsuserpassword' size='40' /></td>
  120 + <td id="error_2_3" class="error" style="display:none">Please Enter A Password</td>
131 </tr> 121 </tr>
132 <tr> 122 <tr>
133 <td><label for='dmsuserpassword2'>Please confirm the password: </label></td> 123 <td><label for='dmsuserpassword2'>Please confirm the password: </label></td>
134 <td><input type='password' value="" id='dmsuserpassword2' name='dmsuserpassword2' size='40' /></td> 124 <td><input type='password' value="" id='dmsuserpassword2' name='dmsuserpassword2' size='40' /></td>
  125 + <td id="error_3_3" class="error" style="display:none">Please Confirm Password</td>
  126 + <td id="error_4_3" class="error" style="display:none">Passwords Do Not Match</td>
135 </tr> 127 </tr>
136 </table> 128 </table>
137 <div class="buttons"> 129 <div class="buttons">
138 - <input type="button" name="Previous" value="previous" onclick="showStep(3, 'p');"/>  
139 - <input type="submit" name="Next" value="next"/> 130 + <input type="button" name="Previous" value="previous" onclick="javascript:{w.showStep(3, 'p');}"/>
  131 +<!-- <input type="button" name="Next" value="next" onclick="showStep(3, 'n');"/>-->
  132 + <input type="submit" name="Next" value="next" />
140 </div> 133 </div>
141 </div> 134 </div>
142 -  
143 -</form>  
144 -<script type="text/javascript">  
145 -// Toggle Advance Database options  
146 - function showAO() {  
147 - var el = document.getElementsByClassName("adv_options");  
148 - if(el[0].style.display == 'none')  
149 - el[0].style.display = 'block';  
150 - else  
151 - el[0].style.display = 'none';  
152 - }  
153 -// Handle steps within database page  
154 - function showStep(p, d) {  
155 - var el = document.getElementsByClassName("step"+p);  
156 - el[0].style.display = 'none';  
157 - if(d == "n") {  
158 - var j = p+1;  
159 - } else if(d == "p") {  
160 - var j = p-1;  
161 - }  
162 - var el = document.getElementsByClassName("step"+j);  
163 - el[0].style.display = 'block';  
164 - }  
165 -</script>  
166 \ No newline at end of file 135 \ No newline at end of file
  136 +</form>
167 \ No newline at end of file 137 \ No newline at end of file
setup/wizard/templates/wizard.tpl
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <html> 2 <html>
3 -<head>  
4 - <title>KnowledgeTree Installer</title>  
5 - <link rel="stylesheet" type="text/css" href="resources/wizard.css" />  
6 -</head>  
7 -  
8 -<body>  
9 -  
10 -<div id="outer-wrapper">  
11 - <div id="header">  
12 - <div class="logo"></div>  
13 - </div>  
14 -  
15 - <div id="wrapper">  
16 - <div id="container">  
17 - <div id="content">  
18 - <?php echo $content; ?>  
19 - </div>  
20 - </div>  
21 -  
22 - <div id="sidebar">  
23 - <?php echo $left; ?>  
24 - </div>  
25 - <div class="clearing">&nbsp;</div>  
26 - </div>  
27 -  
28 - <div id="footer">  
29 - <div class="powered-by"></div>  
30 - </div>  
31 -</div>  
32 -  
33 -</body>  
34 -</html>  
35 \ No newline at end of file 3 \ No newline at end of file
  4 + <head>
  5 + <title>KnowledgeTree Installer</title>
  6 + <link rel="stylesheet" type="text/css" href="resources/wizard.css" />
  7 + <script type="text/javascript" src="resources/wizard.js"></script>
  8 + </head>
  9 + <body onload="w.doFormCheck();">
  10 + <div id="outer-wrapper">
  11 + <div id="header">
  12 + <div class="logo"></div>
  13 + </div>
  14 +
  15 + <div id="wrapper">
  16 + <div id="container">
  17 + <div id="content">
  18 + <?php echo $content; ?>
  19 + </div>
  20 + </div>
  21 +
  22 + <div id="sidebar">
  23 + <?php echo $left; ?>
  24 + </div>
  25 + <div class="clearing">&nbsp;</div>
  26 + </div>
  27 +
  28 + <div id="footer">
  29 + <div class="powered-by"></div>
  30 + </div>
  31 + </div>
  32 + </body>
  33 +</html>
  34 +<script>
  35 + var w = new wizard();
  36 + w.disableDnd();
  37 +</script>
36 \ No newline at end of file 38 \ No newline at end of file