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 457 $class->setDataFromSession($className); // Set Session Information
458 458 $class->setDBConfig(); // Set any posted variables
459 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 467 } else {
462 468 die("$className : Class Files Missing");
... ...
setup/wizard/resources/wizard.css
... ... @@ -118,8 +118,8 @@ td {
118 118  
119 119 .indicator {
120 120 background: url("graphics/indicator.png") no-repeat;
121   - height: 15px;
122   - width: 15px;
  121 + height: 16px;
  122 + width: 16px;
123 123 padding-left: 20px;
124 124 }
125 125  
... ... @@ -129,35 +129,35 @@ td {
129 129  
130 130 .active {
131 131 background: url("graphics/active.png") no-repeat;
132   - height: 15px;
133   - width: 15px;
  132 + height: 16px;
  133 + width: 16px;
134 134 padding-left: 20px;
135 135 }
136 136  
137 137 .inactive {
138 138 background: url("graphics/inactive.png") no-repeat;
139   - height: 15px;
140   - width: 15px;
  139 + height: 16px;
  140 + width: 16px;
141 141 padding-left: 20px;
142 142 color: #919191;
143 143 }
144 144  
145 145 .tick {
146 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 151 .cross {
152 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 157 .cross_orange {
158 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 163 .green {
... ... @@ -232,3 +232,19 @@ td {
232 232 .right_top {
233 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 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 144 \ No newline at end of file
... ...
setup/wizard/step_action.php
... ... @@ -333,7 +333,6 @@ class stepAction {
333 333 $this->loadValueToSession($this->stepName, $key, $value);
334 334 }
335 335 }
336   -
337 336 $content = $step_tpl->fetch();
338 337 $tpl = new Template("templates/wizard.tpl");
339 338 $tpl->set('content', $content);
... ...
setup/wizard/steps/database.php
... ... @@ -292,11 +292,11 @@ class database extends Step
292 292 */
293 293 public function doTest() {
294 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 296 return false;
297 297 }
298 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 300 return false;
301 301 }
302 302 if($this->dport == '')
... ... @@ -304,7 +304,7 @@ class database extends Step
304 304 else
305 305 $con = $this->dbhandler->DBUtil($this->dhost.":".$this->dport, $this->duname, $this->dpassword, $this->dname);
306 306 if (!$con) {
307   - $this->error = array("1"=>"Could not connect: " . $this->dbhandler->getErrors());
  307 + $this->error[] = "Could not connect: " . $this->dbhandler->getErrors();
308 308 return false;
309 309 } else {
310 310 return true;
... ... @@ -500,7 +500,9 @@ class database extends Step
500 500 $this->error[] = 'No database type selected';
501 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 517 $con = $this->connectMysql();
516 518 if($con) {
517 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 521 return false;
520 522 }
521 523 $this->closeMysql($con);
... ... @@ -533,7 +535,7 @@ class database extends Step
533 535 private function connectMysql() {
534 536 $con = $this->dbhandler->DBUtil($this->dhost, $this->duname, $this->dpassword, $this->dname);
535 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 540 return false;
539 541 }
... ... @@ -553,31 +555,32 @@ class database extends Step
553 555 if($this->usedb($con)) { // attempt to use the db
554 556 if($this->dropdb($con)) { // attempt to drop the db
555 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 559 return false;// cannot overwrite database
558 560 }
559 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 563 return false;// cannot overwrite database
562 564 }
563 565 } else {
564 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 568 return false;// cannot overwrite database
567 569 }
568 570 }
569 571 if(!$this->createDmsUser($con)) {
570   - // TODO:Way to catch errors
  572 +
571 573 }
572 574 if(!$this->createSchema($con)) {
573   - // TODO:Way to catch errors
  575 + $this->error[] = "Could not create schema ";
574 576 }
575 577 if(!$this->populateSchema($con)) {
576   - // TODO:Way to catch errors
  578 + $this->error[] = "Could not populate schema ";
577 579 }
578 580 if(!$this->applyUpgrades($con)) {
579   - // TODO:Way to catch errors
  581 + $this->error[] = "Could not apply updates ";
580 582 }
  583 +
581 584 return true;
582 585 }
583 586  
... ... @@ -611,7 +614,7 @@ class database extends Step
611 614 if($this->dbhandler->useBD($this->dname)) {
612 615 return true;
613 616 } else {
614   - $this->error = array("4"=>"Error using database: ".$this->dbhandler->getErrors()."");
  617 + $this->error[] = "Error using database: ".$this->dbhandler->getErrors();
615 618 return false;
616 619 }
617 620 }
... ... @@ -628,11 +631,11 @@ class database extends Step
628 631 if($this->ddrop) {
629 632 $sql = "DROP DATABASE {$this->dname};";
630 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 635 return false;
633 636 }
634 637 } else {
635   - $this->error = array("6"=>"Cannot drop database: ".$this->dbhandler->getErrors()."");
  638 + $this->error[] = "Cannot drop database: ".$this->dbhandler->getErrors();
636 639 return false;
637 640 }
638 641 return true;
... ... @@ -649,14 +652,15 @@ class database extends Step
649 652 private function createDmsUser($con) {
650 653 if($this->dmsname == '' || $this->dmspassword == '') {
651 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 657 } else {
654 658 $user1 = "GRANT SELECT, INSERT, UPDATE, DELETE ON {$this->dname}.* TO {$this->dmsusername}@{$this->dhost} IDENTIFIED BY \"{$this->dmsuserpassword}\";";
655 659 $user2 = "GRANT ALL PRIVILEGES ON {$this->dname}.* TO {$this->dmsname}@{$this->dhost} IDENTIFIED BY \"{$this->dmspassword}\";";
656 660 if ($this->dbhandler->execute($user1) && $this->dbhandler->execute($user2)) {
657 661 return true;
658 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 664 return false;
661 665 }
662 666 }
... ... @@ -673,7 +677,8 @@ class database extends Step
673 677 */
674 678 private function createSchema($con) {
675 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 691 */
687 692 private function populateSchema($con) {
688 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 698 private function applyUpgrades($con) {
... ... @@ -708,7 +714,7 @@ class database extends Step
708 714 try {
709 715 $this->dbhandler->close();
710 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 730  
725 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 768 \ No newline at end of file
... ...
setup/wizard/templates/database.tpl
1 1 <h1>Database Configuration</h1>
  2 +<!--onclick="javascript:{ldelim}disableDnd('input_period');{rdelim}" readOnly="readonly"-->
2 3  
3 4 <div class="errors">
4 5 <?php if(isset($errors)) {
... ... @@ -8,82 +9,66 @@
8 9 }?>
9 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 16 <!-- STEP 1 of the database configuration - server settings -->
14 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 24 <?php if($dtypes) {
23 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 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 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 47 <div id="database" class="adv_options" style="display:none;">
55 48 <div class="description">
56 49 These options are only necessary for some sites. If you're not sure what you should enter here, leave the default settings.
57 50 </div>
58   -
59   -
60 51 <p>
61 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 54 <input type="text" value="<?php echo $dhost?>" id="dhost" name="dhost" size='60'/>
64 55 </p>
65 56  
66 57 <p>
67 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 60 <input type="text" value="<?php echo $dport?>" id="dport" name="dport" size='10'/>
70 61 </p>
71 62  
72 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 66 <input type="text" value="<?php echo $dbbinary?>" id="dbbinary" name="dbbinary" size='60'/>
76 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 68 </div>
84 69 <div class="buttons">
85 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 72 </div>
88 73 </div>
89 74  
... ... @@ -92,25 +77,28 @@ server are required in order to be able to configure and install the installatio
92 77 <div class="description">
93 78 An administrative user is required for creating tables within the database.
94 79 </div>
95   -
96   - <table>
  80 + <table class="dbconf">
97 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 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 85 </tr>
101 86 <tr>
102 87 <td><label for='dmspassword'>Enter a password: </label></td>
103 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 90 </tr>
105 91 <tr>
106 92 <td><label for='dmspassword2'>Please confirm the password: </label></td>
107 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 96 </tr>
109 97 </table>
110 98  
111 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 102 </div>
115 103 </div>
116 104  
... ... @@ -120,46 +108,28 @@ An administrative user is required for creating tables within the database.
120 108 An second user is required for normal database interaction, the reading and writing of data.
121 109 </div>
122 110  
123   - <table>
  111 + <table class="dbconf">
124 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 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 116 </tr>
128 117 <tr>
129 118 <td><label for='dmsuserpassword'>Enter a password: </label></td>
130 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 121 </tr>
132 122 <tr>
133 123 <td><label for='dmsuserpassword2'>Please confirm the password: </label></td>
134 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 127 </tr>
136 128 </table>
137 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 133 </div>
141 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 135 \ No newline at end of file
  136 +</form>
167 137 \ No newline at end of file
... ...
setup/wizard/templates/wizard.tpl
1 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 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 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 38 \ No newline at end of file
... ...