Commit 5b77af1ada48c371abd610be92a3478daa7c3b0f

Authored by Jarrett Jordaan
1 parent 1732c001

Daily Commit.

Committed by: Jarrett Jordaan

Reviewed by: Megan Watson
setup/firstlogin/firstlogin.php
... ... @@ -44,7 +44,7 @@
44 44 * @version Version 0.1
45 45 */
46 46  
47   -class FirstLogin {
  47 +class firstlogin {
48 48 /**
49 49 * Reference to simple xml object
50 50 *
... ... @@ -160,7 +160,7 @@ class FirstLogin {
160 160 try {
161 161 $this->simpleXmlObj = simplexml_load_file(CONF_DIR.INSTALL_TYPE."_$name");
162 162 } catch (Exception $e) {
163   - $util = new FirstLoginUtil();
  163 + $util = new firstloginUtil();
164 164 $util->error("Error reading configuration file: $e");
165 165 exit();
166 166 }
... ... @@ -435,7 +435,7 @@ class FirstLogin {
435 435 if($class->run()) { // Check if step needs to be run
436 436 $class->setDataFromSession($className); // Set Session Information
437 437 $class->setPostConfig(); // Set any posted variables
438   - $class->Step(); // Run step
  438 + $class->runStep(); // Run step
439 439 }
440 440 } else {
441 441 $util = new firstloginUtil();
... ...
setup/firstlogin/firstloginUtil.php
... ... @@ -53,12 +53,10 @@ class firstloginUtil extends InstallUtil {
53 53 * @param none
54 54 * @return boolean
55 55 */
56   - public function isSystem() {
57   - if (file_exists(dirname(__FILE__)."/firstlogin")) {
58   -
  56 + public function isFirstLogin() {
  57 + if (file_exists(SYSTEM_DIR.'var'.DS.'bin'.DS."firstlogin.lock")) {
59 58 return true;
60 59 }
61   -
62 60 return false;
63 61 }
64 62  
... ...
setup/firstlogin/firstloginWizard.php
... ... @@ -63,8 +63,8 @@ class firstloginWizard extends WizardBase {
63 63 * @param none
64 64 * @return boolean
65 65 */
66   - private function isSystem() {
67   - return $this->util->isSystem();
  66 + private function isFirstLogin() {
  67 + return $this->util->isFirstLogin();
68 68 }
69 69  
70 70 /**
... ... @@ -77,10 +77,10 @@ class firstloginWizard extends WizardBase {
77 77 */
78 78 public function display($response = null) {
79 79 if($response) {
80   - $ins = new FirstLogin(); // Instantiate
  80 + $ins = new firstlogin(); // Instantiate
81 81 $ins->resolveErrors($response); // Run step
82 82 } else {
83   - $ins = new FirstLogin(new Session()); // Instantiate and pass the session class
  83 + $ins = new firstlogin(new Session()); // Instantiate and pass the session class
84 84 $ins->step(); // Run step
85 85 }
86 86 }
... ... @@ -165,7 +165,7 @@ class firstloginWizard extends WizardBase {
165 165 } elseif ($this->getBypass() === "0") {
166 166 $this->createFile();
167 167 }
168   - if(!$this->isSystem()) { // Check if the systems
  168 + if(!$this->isFirstLogin()) { // Check if the systems
169 169 $response = $this->systemChecks();
170 170 if($response === true) {
171 171 $this->display();
... ...
setup/firstlogin/step.php
... ... @@ -131,7 +131,7 @@ class Step extends StepBase
131 131 * @access public
132 132 * @return void
133 133 */
134   - public function Step() {
  134 + public function runStep() {
135 135 return '';
136 136 }
137 137  
... ...
setup/firstlogin/steps/firstloginComplete.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Complete Step Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright (C) 2008, 2009, 2010 KnowledgeTree Inc.
  8 +*
  9 +* This program is free software; you can redistribute it and/or modify it under
  10 +* the terms of the GNU General Public License version 3 as published by the
  11 +* Free Software Foundation.
  12 +*
  13 +* This program is distributed in the hope that it will be useful, but WITHOUT
  14 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  16 +* details.
  17 +*
  18 +* You should have received a copy of the GNU General Public License
  19 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  20 +*
  21 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 +* California 94120-7775, or email info@knowledgetree.com.
  23 +*
  24 +* The interactive user interfaces in modified source and object code versions
  25 +* of this program must display Appropriate Legal Notices, as required under
  26 +* Section 5 of the GNU General Public License version 3.
  27 +*
  28 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  29 +* these Appropriate Legal Notices must retain the display of the "Powered by
  30 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  32 +* must display the words "Powered by KnowledgeTree" and retain the original
  33 +* copyright notice.
  34 +* Contributor( s): ______________________________________
  35 +*/
  36 +
  37 +/**
  38 +*
  39 +* @copyright 2008-2010, KnowledgeTree Inc.
  40 +* @license GNU General Public License version 3
  41 +* @author KnowledgeTree Team
  42 +* @package First Login
  43 +* @version Version 0.1
  44 +*/
  45 +
  46 +class firstloginComplete extends Step {
  47 + /**
  48 + * Flag if step needs to run silently
  49 + *
  50 + * @access protected
  51 + * @var boolean
  52 + */
  53 + protected $silent = true;
  54 +
  55 + /**
  56 + * Returns step state
  57 + *
  58 + * @author KnowledgeTree Team
  59 + * @param none
  60 + * @access public
  61 + * @return string
  62 + */
  63 + function doStep() {
  64 + $this->temp_variables = array(
  65 + "step_name"=>"complete",
  66 + "silent"=>$this->silent);
  67 + return $this->doRun();
  68 + }
  69 +
  70 + function doRun() {
  71 +
  72 + return 'landing';
  73 + }
  74 +
  75 +
  76 +
  77 + public function getErrors() {
  78 + return $this->error;
  79 + }
  80 +}
  81 +?>
0 82 \ No newline at end of file
... ...
setup/firstlogin/steps/firstloginTemplates.php 0 → 100644
  1 +<?php
  2 +/**
  3 +* Template Step Controller.
  4 +*
  5 +* KnowledgeTree Community Edition
  6 +* Document Management Made Simple
  7 +* Copyright (C) 2008, 2009, 2010 KnowledgeTree Inc.
  8 +*
  9 +* This program is free software; you can redistribute it and/or modify it under
  10 +* the terms of the GNU General Public License version 3 as published by the
  11 +* Free Software Foundation.
  12 +*
  13 +* This program is distributed in the hope that it will be useful, but WITHOUT
  14 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  15 +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  16 +* details.
  17 +*
  18 +* You should have received a copy of the GNU General Public License
  19 +* along with this program. If not, see <http://www.gnu.org/licenses/>.
  20 +*
  21 +* You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 +* California 94120-7775, or email info@knowledgetree.com.
  23 +*
  24 +* The interactive user interfaces in modified source and object code versions
  25 +* of this program must display Appropriate Legal Notices, as required under
  26 +* Section 5 of the GNU General Public License version 3.
  27 +*
  28 +* In accordance with Section 7(b) of the GNU General Public License version 3,
  29 +* these Appropriate Legal Notices must retain the display of the "Powered by
  30 +* KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 +* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  32 +* must display the words "Powered by KnowledgeTree" and retain the original
  33 +* copyright notice.
  34 +* Contributor( s): ______________________________________
  35 +*/
  36 +
  37 +/**
  38 +*
  39 +* @copyright 2008-2010, KnowledgeTree Inc.
  40 +* @license GNU General Public License version 3
  41 +* @author KnowledgeTree Team
  42 +* @package First Login
  43 +* @version Version 0.1
  44 +*/
  45 +
  46 +class firstloginTemplates extends Step {
  47 + /**
  48 + * Flag if step needs to run silently
  49 + *
  50 + * @access protected
  51 + * @var boolean
  52 + */
  53 + protected $silent = true;
  54 +
  55 + /**
  56 + * Returns step state
  57 + *
  58 + * @author KnowledgeTree Team
  59 + * @param none
  60 + * @access public
  61 + * @return string
  62 + */
  63 + function doStep() {
  64 + $this->temp_variables = array(
  65 + "step_name"=>"folderstructures",
  66 + "silent"=>$this->silent);
  67 + return $this->doRun();
  68 + }
  69 +
  70 + function doRun() {
  71 +
  72 + return 'landing';
  73 + }
  74 +
  75 + public function getErrors() {
  76 + return $this->error;
  77 + }
  78 +}
  79 +?>
0 80 \ No newline at end of file
... ...
setup/firstlogin/templates/error.tpl
... ... @@ -3,7 +3,7 @@
3 3 <head>
4 4 <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon">
5 5 <title>KnowledgeTree Installer</title>
6   - <script type="text/javascript" src="resources/jquery.js"></script>
  6 + <script type="text/javascript" src="../../thirdpartyjs/jquery/jquery-1.3.2.js"></script>
7 7 <script type="text/javascript" src="resources/wizard.js" ></script>
8 8 <link rel="stylesheet" type="text/css" href="resources/wizard.css" />
9 9 </head>
... ...
setup/firstlogin/templates/templates.tpl
1 1 <form id="<?php echo $step_name; ?>" action="index.php?step_name=<?php echo $step_name; ?>" method="post">
2 2 <p class="title">Apply A Folder Template to KnowledgeTree</p>
3   -
  3 + <div id="step_content_<?php echo $step_name; ?>" class="step">
  4 + </div>
4 5 <input type="submit" name="Previous" value="Previous" class="button_previous"/>
5 6 <input type="submit" name="Next" value="Next" class="button_next"/>
6 7 </form>
... ...
setup/firstlogin/templates/wizard.tpl
... ... @@ -3,7 +3,7 @@
3 3 <head>
4 4 <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon">
5 5 <title>KnowledgeTree Installer</title>
6   - <?php echo $html->js('jquery.js'); ?>
  6 + <?php echo $html->tpjs('jquery-1.3.2.js'); ?>
7 7 <?php echo $html->js('jquery.form.js'); ?>
8 8 <?php echo $html->js('jquery.blockUI.js'); ?>
9 9 <?php echo $html->js('jquery.hotkeys.js'); ?>
... ...
setup/migrate/templates/error.tpl
... ... @@ -3,7 +3,7 @@
3 3 <head>
4 4 <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon">
5 5 <title>KnowledgeTree Installer</title>
6   - <script type="text/javascript" src="resources/jquery.js"></script>
  6 + <script type="text/javascript" src="../../thirdpartyjs/jquery/jquery-1.3.2.js"></script>
7 7 <script type="text/javascript" src="resources/wizard.js" ></script>
8 8 <link rel="stylesheet" type="text/css" href="resources/wizard.css" />
9 9 </head>
... ...
setup/migrate/templates/wizard.tpl
... ... @@ -3,7 +3,7 @@
3 3 <head>
4 4 <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon">
5 5 <title>KnowledgeTree Installer</title>
6   - <?php echo $html->js('jquery.js'); ?>
  6 + <?php echo $html->tpjs('jquery-1.3.2.js'); ?>
7 7 <?php echo $html->js('jquery.form.js'); ?>
8 8 <?php echo $html->js('jquery.blockUI.js'); ?>
9 9 <?php echo $html->js('jquery.hotkeys.js'); ?>
... ...
setup/upgrade/templates/error.tpl
... ... @@ -3,7 +3,7 @@
3 3 <head>
4 4 <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon">
5 5 <title>KnowledgeTree Installer</title>
6   - <script type="text/javascript" src="resources/jquery.js"></script>
  6 + <script type="text/javascript" src="../../thirdpartyjs/jquery/jquery-1.3.2.js"></script>
7 7 <script type="text/javascript" src="resources/wizard.js" ></script>
8 8 <link rel="stylesheet" type="text/css" href="resources/wizard.css" />
9 9  
... ...
setup/upgrade/templates/progress.tpl
... ... @@ -3,7 +3,7 @@
3 3 <head>
4 4 <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon">
5 5 <title>KnowledgeTree Upgrade Wizard</title>
6   - <script type="text/javascript" src="resources/jquery.js"></script>
  6 + <script type="text/javascript" src="../../thirdpartyjs/jquery/jquery-1.3.2.js"></script>
7 7 <script type="text/javascript" src="resources/wizard.js" ></script>
8 8 <link rel="stylesheet" type="text/css" href="resources/wizard.css" />
9 9  
... ...
setup/upgrade/templates/wizard.tpl
... ... @@ -3,7 +3,7 @@
3 3 <head>
4 4 <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon">
5 5 <title>KnowledgeTree Upgrader</title>
6   - <?php echo $html->js('jquery.js'); ?>
  6 + <?php echo $html->tpjs('jquery-1.3.2.js'); ?>
7 7 <?php echo $html->js('jquery.form.js'); ?>
8 8 <?php echo $html->js('jquery.blockUI.js'); ?>
9 9 <?php echo $html->js('jquery.hotkeys.js'); ?>
... ...
setup/wizard/lib/helpers/htmlHelper.php
... ... @@ -102,16 +102,20 @@ class htmlHelper {
102 102 function __construct() {
103 103 }
104 104  
  105 + function tpjs($name) {
  106 + return "<script type=\"text/javascript\" src=\"".WIZARD_ROOT."thirdpartyjs/jquery/$name\"></script>";
  107 + }
  108 +
105 109 function js($name) {
106   - return "<script type=\"text/javascript\" src=\"../wizard/resources/js/$name\"></script>";
  110 + return "<script type=\"text/javascript\" src=\"".WIZARD_SETUP."/wizard/resources/js/$name\"></script>";
107 111 }
108 112  
109 113 function css($name) {
110   - return "<link rel=\"stylesheet\" type=\"text/css\" href=\"../wizard/resources/css/$name\" />";
  114 + return "<link rel=\"stylesheet\" type=\"text/css\" href=\"".WIZARD_SETUP."/wizard/resources/css/$name\" />";
111 115 }
112 116  
113 117 function image($name, $options = array()) {
114   - $path = "../wizard/resources/graphics/$name";
  118 + $path = WIZARD_SETUP."/wizard/resources/graphics/$name";
115 119 $image = sprintf($this->tags['image'], $path, $this->_parseAttributes($options, null, '', ' '));
116 120  
117 121 return $image;
... ...
setup/wizard/path.php
... ... @@ -65,11 +65,7 @@
65 65 define('UNIX_OS', true);
66 66 define('OS', 'unix');
67 67 }
68   - if(WINDOWS_OS) {
69   - define('DS', '\\');
70   - } else {
71   - define('DS', '/');
72   - }
  68 + define('DS', DIRECTORY_SEPARATOR);
73 69 // Define environment root
74 70 $wizard = realpath(dirname(__FILE__));
75 71 $xdir = explode(DS, $wizard);
... ... @@ -86,6 +82,9 @@
86 82 case 'upgrade' :
87 83 $wizard = $sys.'upgrade';
88 84 break;
  85 + case 'firstlogin' :
  86 + $wizard = $sys.'firstlogin';
  87 + break;
89 88 default:
90 89  
91 90 break;
... ... @@ -134,4 +133,38 @@
134 133 } else {
135 134 define('INSTALL_TYPE', 'community');
136 135 }
  136 + define('WIZARD_ROOT',guessRootUrl().DS);
  137 + define('WIZARD_SETUP',WIZARD_ROOT . "setup");
  138 +
  139 + function guessRootUrl() {
  140 + $urlpath = $_SERVER['SCRIPT_NAME'];
  141 + $bFound = false;
  142 + $rootUrl = '';
  143 + while ($urlpath) {
  144 + if (file_exists(SYSTEM_DIR . '/' . $urlpath)) {
  145 + $bFound = true;
  146 + break;
  147 + }
  148 + $i = strpos($urlpath, '/');
  149 + if ($i === false) {
  150 + break;
  151 + }
  152 + if ($rootUrl)
  153 + {
  154 + $rootUrl .= '/';
  155 + }
  156 + $rootUrl .= substr($urlpath, 0, $i);
  157 + $urlpath = substr($urlpath, $i + 1);
  158 + }
  159 + if ($bFound) {
  160 + if ($rootUrl) {
  161 + $rootUrl = '/' . $rootUrl;
  162 + }
  163 + if(strpos($rootUrl, SYSTEM_DIR) !== false){
  164 + return '';
  165 + }
  166 + return $rootUrl;
  167 + }
  168 + return '';
  169 + }
137 170 ?>
... ...
setup/wizard/resources/css/firstlogin.css
  1 +#step_content_folderstructures {
  2 + border: 1px solid rgb(207, 207, 207);
  3 + overflow: auto;
  4 + padding: 5px;
  5 + min-height:315px;
  6 +}
0 7 \ No newline at end of file
... ...
setup/wizard/resources/js/firstlogin.js 0 → 100644
  1 +/*
  2 +* Create the electronic signature dialog
  3 +*/
  4 +var showForm = function(){
  5 + createForm();
  6 + // create the window
  7 + this.win = new Ext.Window({
  8 + applyTo : 'firstlogin',
  9 + layout : 'fit',
  10 + width : 800,
  11 + height : 500,
  12 + closeAction :'destroy',
  13 + y : 75,
  14 + shadow: false,
  15 + modal: true
  16 + });
  17 +
  18 + this.win.show();
  19 +}
  20 +
  21 +var createForm = function() {
  22 + var holder = "<div id='firstlogin'></div>";
  23 + $("#wrapper").append(holder);// Append to current dashboard
  24 + var address = "setup/firstlogin/index.php";
  25 + getUrl(address, "firstlogin");
  26 +}
  27 +
  28 +// Send request and update a div
  29 +var getUrl = function (address, div) {
  30 + $.ajax({
  31 + url: address,
  32 + dataType: "html",
  33 + type: "POST",
  34 + cache: false,
  35 + success: function(data) {
  36 + $("#"+div).empty();
  37 + $("#"+div).append(data);
  38 + }
  39 + });
  40 +}
  41 +
  42 +$(function() { // Document is ready
  43 +
  44 + showForm();
  45 +});
... ...
setup/wizard/share/wizardBase.php
... ... @@ -39,7 +39,7 @@
39 39 * @package Installer
40 40 * @version Version 0.1
41 41 */
42   -include("../wizard/path.php"); // Paths
  42 +require_once("../wizard/path.php"); // Paths
43 43  
44 44 /**
45 45 * Auto loader to bind installer package
... ...
setup/wizard/templates/error.tpl
... ... @@ -3,7 +3,7 @@
3 3 <head>
4 4 <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon">
5 5 <title>KnowledgeTree Installer</title>
6   - <script type="text/javascript" src="resources/js/jquery-tooltip/lib/jquery.js"></script>
  6 + <script type="text/javascript" src="../../thirdpartyjs/jquery/jquery-1.3.2.js"></script>
7 7 <script type="text/javascript" src="resources/js/wizard.js" ></script>
8 8 <link rel="stylesheet" type="text/css" href="resources/css/wizard.css" />
9 9  
... ...
setup/wizard/templates/wizard.tpl
... ... @@ -3,7 +3,7 @@
3 3 <head>
4 4 <link rel="shortcut icon" href="../wizard/resources/graphics/favicon.ico" type="image/x-icon">
5 5 <title>KnowledgeTree Installer</title>
6   - <?php echo $html->js('jquery.js'); ?>
  6 + <?php echo $html->tpjs('jquery-1.3.2.js'); ?>
7 7 <?php echo $html->js('jquery.form.js'); ?>
8 8 <?php echo $html->js('jquery.blockUI.js'); ?>
9 9 <?php echo $html->js('jquery.hotkeys.js'); ?>
... ...