diff --git a/setup/wizard/config/databases.xml b/setup/wizard/config/databases.xml index cd2e9a5..897f8c5 100644 --- a/setup/wizard/config/databases.xml +++ b/setup/wizard/config/databases.xml @@ -15,7 +15,7 @@ 3306 dms root - dmsadminuser + dmsuser js9281djw dmsuser djw9281js diff --git a/setup/wizard/htmlHelper.php b/setup/wizard/htmlHelper.php new file mode 100644 index 0000000..fe286f0 --- /dev/null +++ b/setup/wizard/htmlHelper.php @@ -0,0 +1,133 @@ + '', + 'metalink' => '', + 'link' => '%s', + 'mailto' => '%s', + 'form' => '
', + 'formend' => '
', + 'input' => '', + 'textarea' => '', + 'hidden' => '', + 'checkbox' => '', + 'checkboxmultiple' => '', + 'radio' => '%s', + 'selectstart' => '', + 'selectempty' => '', + 'selectoption' => '', + 'selectend' => '', + 'optiongroup' => '', + 'optiongroupend' => '', + 'checkboxmultiplestart' => '', + 'checkboxmultipleend' => '', + 'password' => '', + 'file' => '', + 'file_no_model' => '', + 'submit' => '', + 'submitimage' => '', + 'button' => '', + 'image' => '', + 'tableheader' => '%s', + 'tableheaderrow' => '%s', + 'tablecell' => '%s', + 'tablerow' => '%s', + 'block' => '%s', + 'blockstart' => '', + 'blockend' => '', + 'tag' => '<%s%s>%s', + 'tagstart' => '<%s%s>', + 'tagend' => '', + 'para' => '%s

', + 'parastart' => '', + 'label' => '', + 'fieldset' => '%s', + 'fieldsetstart' => '
%s', + 'fieldsetend' => '
', + 'legend' => '%s', + 'css' => '', + 'style' => '', + 'charset' => '', + 'ul' => '%s', + 'ol' => '%s', + 'li' => '%s', + 'error' => '%s' + ); + + function __construct() { + } + + function js($name) { + return ""; + } + + function css($name) { + return ""; + } + + function image($name, $options = array()) { + $path = "resources/graphics/$name"; + $image = sprintf($this->tags['image'], $path, $this->_parseAttributes($options, null, '', ' ')); + + return $image; + //return ""; + } + + function _parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) { + if (is_array($options)) { + $options = array_merge(array('escape' => true), $options); + + if (!is_array($exclude)) { + $exclude = array(); + } + $keys = array_diff(array_keys($options), array_merge((array)$exclude, array('escape'))); + $values = array_intersect_key(array_values($options), $keys); + $escape = $options['escape']; + $attributes = array(); + + foreach ($keys as $index => $key) { + $attributes[] = $this->__formatAttribute($key, $values[$index], $escape); + } + $out = implode(' ', $attributes); + } else { + $out = $options; + } + return $out ? $insertBefore . $out . $insertAfter : ''; + } + + function __formatAttribute($key, $value, $escape = true) { + $attribute = ''; + $attributeFormat = '%s="%s"'; + $minimizedAttributes = array('compact', 'checked', 'declare', 'readonly', 'disabled', 'selected', 'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize'); + if (is_array($value)) { + $value = ''; + } + + if (in_array($key, $minimizedAttributes)) { + if ($value === 1 || $value === true || $value === 'true' || $value == $key) { + $attribute = sprintf($attributeFormat, $key, $key); + } + } else { + $attribute = sprintf($attributeFormat, $key, $this->ife($escape, $this->h($value), $value)); + } + return $attribute; + } + + function ife($condition, $val1 = null, $val2 = null) { + if (!empty($condition)) { + return $val1; + } + return $val2; + } + + function h($text, $charset = 'UTF-8') { + if (is_array($text)) { + return array_map('h', $text); + } + return htmlspecialchars($text, ENT_QUOTES, $charset); + } + } +?> \ No newline at end of file diff --git a/setup/wizard/install.lock b/setup/wizard/install.lock index 8f18131..e69de29 100644 --- a/setup/wizard/install.lock +++ b/setup/wizard/install.lock @@ -1 +0,0 @@ -Install Lock File \ No newline at end of file diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index e1c790c..099461a 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -254,9 +254,12 @@ class InstallUtil { * @param boolean $create Whether to create the directory if it doesn't exist * @return array The message and css class to use */ - public function checkPermission($dir, $create=false) + public function checkPermission($dir, $create=false, $file = false) { - $exist = 'Directory doesn\'t exist'; + if(!$file) + $exist = 'Directory doesn\'t exist'; + else + $exist = 'File doesn\'t exist'; $write = 'Directory not writable'; $ret = array('class' => 'cross'); diff --git a/setup/wizard/installWizard.php b/setup/wizard/installWizard.php index 2c6b928..0841c16 100644 --- a/setup/wizard/installWizard.php +++ b/setup/wizard/installWizard.php @@ -73,7 +73,7 @@ class InstallWizard { protected $bypass = null; /** - * Install bypass flag + * Level of debugger * * @author KnowledgeTree Team * @access protected @@ -228,7 +228,7 @@ class InstallWizard { if(isset($_GET['debug'])) { $this->setDebugLevel($_GET['debug']); } else { - $this->setDebugLevel(0); + $this->setDebugLevel($this->debugLevel); } $this->setIUtil(new InstallUtil()); } diff --git a/setup/wizard/lib/helpers/config-path-mock-windows b/setup/wizard/lib/helpers/config-path-mock-windows new file mode 100644 index 0000000..92d4112 --- /dev/null +++ b/setup/wizard/lib/helpers/config-path-mock-windows @@ -0,0 +1,8 @@ +C:\ktdms\var +C:\ktdms\config\config.ini +C:\ktdms\log +C:\ktdms\tmp +C:\ktdms\var\Documents +C:\ktdms\var\indexes +C:\ktdms\var\proxies +C:\ktdms\var\uploads \ No newline at end of file diff --git a/setup/wizard/lib/services/unixLucene.php b/setup/wizard/lib/services/unixLucene.php index 0250c84..89e8ad0 100644 --- a/setup/wizard/lib/services/unixLucene.php +++ b/setup/wizard/lib/services/unixLucene.php @@ -42,6 +42,7 @@ class unixLucene extends unixService { public $util; + private $shutdownScript; private $indexerDir; private $lucenePidFile; @@ -58,7 +59,6 @@ class unixLucene extends unixService { } public function load() { - $this->setSystemOutputDir(); $this->setLuceneDir(SYSTEM_DIR."bin".DS."luceneserver".DS); $this->setIndexerDir(SYSTEM_DIR."search2".DS."indexing".DS."bin".DS); $this->setLucenePidFile("lucene_test.pid"); @@ -68,12 +68,6 @@ class unixLucene extends unixService { $this->setShutdownScript("shutdown.php"); } - function setSystemOutputDir() { - $conf = $this->util->getDataFromSession('configuration'); - print_r($conf); - die; -// $conf['path']['']; - } public function setIndexerDir($indexerDir) { $this->indexerDir = $indexerDir; @@ -190,7 +184,7 @@ class unixLucene extends unixService { $state = $this->status(); if($state != 'STARTED') { $cmd = "cd ".$this->getLuceneDir()."; "; - $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".SYS_LOG_DIR."lucene.log 2>&1 & echo $!"; + $cmd .= "nohup java {$this->getJavaXmx()} {$this->getJavaXmx()} -jar ".$this->getLuceneSource()." > ".$this->outputDir."lucene.log 2>&1 & echo $!"; if(DEBUG) { echo "Command : $cmd
"; return ; diff --git a/setup/wizard/lib/services/unixOpenOffice.php b/setup/wizard/lib/services/unixOpenOffice.php index e711fae..261354d 100644 --- a/setup/wizard/lib/services/unixOpenOffice.php +++ b/setup/wizard/lib/services/unixOpenOffice.php @@ -68,7 +68,7 @@ class unixOpenOffice extends unixService { } public function load() { - + $this->setPort("8100"); $this->setHost("localhost"); $this->setLog("openoffice.log"); @@ -76,6 +76,8 @@ class unixOpenOffice extends unixService { $this->setOption(); } + + private function setPort($port = "8100") { $this->port = $port; } @@ -156,7 +158,7 @@ class unixOpenOffice extends unixService { public function start() { $state = $this->status(); if($state != 'STARTED') { - $cmd = "nohup {$this->getBin()} ".$this->getOption()." > ".SYS_LOG_DIR."{$this->getLog()} 2>&1 & echo $!"; + $cmd = "nohup {$this->getBin()} ".$this->getOption()." > ".$this->outputDir."{$this->getLog()} 2>&1 & echo $!"; if(DEBUG) { echo "Command : $cmd
"; return ; diff --git a/setup/wizard/lib/services/unixScheduler.php b/setup/wizard/lib/services/unixScheduler.php index 2ea1a04..8a58038 100644 --- a/setup/wizard/lib/services/unixScheduler.php +++ b/setup/wizard/lib/services/unixScheduler.php @@ -59,6 +59,7 @@ class unixScheduler extends unixService { $this->setSchedulerDir(VAR_BIN_DIR); $this->setSchedulerSourceLoc('schedulerTask.sh'); } + function setSystemDir($systemDir) { $this->systemDir = $systemDir; @@ -155,10 +156,10 @@ class unixScheduler extends unixService { $source = $this->getSchedulerSourceLoc(); $this->writeSchedulerTask(); if($source) { // Source - $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!"; + $cmd = "nohup ".$source." > ".$this->outputDir."scheduler.log 2>&1 & echo $!"; } else { // Could be Stack $source = SYS_BIN_DIR.$this->schedulerSource; - $cmd = "nohup ".$source." > ".SYS_LOG_DIR."scheduler.log 2>&1 & echo $!"; + $cmd = "nohup ".$source." > ".$this->outputDir."scheduler.log 2>&1 & echo $!"; } if(DEBUG) { echo "Command : $cmd
"; diff --git a/setup/wizard/lib/services/unixService.php b/setup/wizard/lib/services/unixService.php index c4c42c8..0b2b6c7 100644 --- a/setup/wizard/lib/services/unixService.php +++ b/setup/wizard/lib/services/unixService.php @@ -41,6 +41,30 @@ */ class unixService extends Service { + + public $outputDir; + public $varDir; + /** + * Reference to utility object + * + * @author KnowledgeTree Team + * @access public + * @param none + * @return string + */ + public $util; + + public function __construct() { + $this->util = new InstallUtil(); + $this->setSystemDirs(); + } + + function setSystemDirs() { + $conf = $this->util->getDataFromSession('configuration'); + $this->outputDir = $conf['paths']['logDirectory']['path'].DS; + $this->varDir = $conf['paths']['varDirectory']['path'].DS; + } + /** * Retrieve Service name * diff --git a/setup/wizard/lib/services/windowsLucene.php b/setup/wizard/lib/services/windowsLucene.php index 1b7e413..7eeda2a 100644 --- a/setup/wizard/lib/services/windowsLucene.php +++ b/setup/wizard/lib/services/windowsLucene.php @@ -121,6 +121,7 @@ class windowsLucene extends windowsService { */ private $luceneDir; + /** * Service name * @@ -140,7 +141,7 @@ class windowsLucene extends windowsService { * @return void */ public function load() { - $this->setSystemOutputDir(); + $this->setJavaBin(); $this->setLuceneDIR(SYSTEM_DIR."bin".DS."luceneserver"); $this->setLuceneExe("KTLuceneService.exe"); @@ -151,12 +152,6 @@ class windowsLucene extends windowsService { $this->setLuceneError("lucene-err.txt"); } - function setSystemOutputDir() { - $conf = $this->util->getDataFromSession('configuration'); - print_r($conf); - die; -// $conf['path']['']; - } /** * Retrieve Status Service @@ -195,8 +190,8 @@ class windowsLucene extends windowsService { } } // TODO: Will not detect, but a java pre-check is done in services, before this - if(file_exists(SYS_OUT_DIR.'outJVHome')) { - $this->javaBin = file_get_contents(SYS_OUT_DIR.'outJVHome'); + if(file_exists($this->varDir.'outJVHome')) { + $this->javaBin = file_get_contents($this->varDir.'outJVHome'); if($this->javaBin != '') return true; } @@ -326,7 +321,7 @@ class windowsLucene extends windowsService { * @return void */ private function setLuceneOut($luceneOut) { - $this->luceneOut = SYS_LOG_DIR.$luceneOut; + $this->luceneOut = $this->outputDir.$luceneOut; } /** @@ -350,7 +345,7 @@ class windowsLucene extends windowsService { * @return void */ private function setLuceneError($luceneError) { - $this->luceneError = SYS_LOG_DIR.$luceneError; + $this->luceneError = $this->outputDir.$luceneError; } /** diff --git a/setup/wizard/lib/services/windowsScheduler.php b/setup/wizard/lib/services/windowsScheduler.php index 897c612..d07e2ba 100644 --- a/setup/wizard/lib/services/windowsScheduler.php +++ b/setup/wizard/lib/services/windowsScheduler.php @@ -76,7 +76,7 @@ class windowsScheduler extends windowsService { * @return string */ public $name = "KTSchedulerTest"; - + /** * Load defaults needed by service * @@ -86,12 +86,14 @@ class windowsScheduler extends windowsService { * @return void */ function load() { - $this->setSchedulerDIR(SYS_OUT_DIR."bin"); + $this->setSchedulerDIR($this->varDir."bin"); $this->setSchedulerScriptPath("taskrunner.bat"); $this->setSchedulerSource("schedulerService.php"); } + + /** * Set Scheduler Directory path * @@ -101,6 +103,9 @@ class windowsScheduler extends windowsService { * @return string */ private function setSchedulerDIR($schedulerDIR) { + if(!file_exists($schedulerDIR)) { + @mkdir($schedulerDIR); + } $this->schedulerDir = $schedulerDIR; } @@ -243,10 +248,10 @@ class windowsScheduler extends windowsService { private function writeTaskRunner() { // Check if bin is readable and writable - if(is_readable(SYS_OUT_DIR."bin") && is_writable(SYS_OUT_DIR."bin")) { - if(DEBUG) { - echo "Create {$this->getSchedulerDir()}\\taskrunner.bat
"; - } + if(DEBUG) { + echo "Attempt to Create {$this->getSchedulerDir()}\\taskrunner.bat
"; + } + if(is_readable($this->varDir."bin") && is_writable($this->varDir."bin")) { $fp = fopen($this->getSchedulerDir().""."\\taskrunner.bat", "w+"); $content = "@echo off \n"; $content .= "\"".PHP_DIR."php.exe\" "."\"{$this->getSchedulerSource()}\""; diff --git a/setup/wizard/lib/services/windowsService.php b/setup/wizard/lib/services/windowsService.php index fcde6bd..fb2121a 100644 --- a/setup/wizard/lib/services/windowsService.php +++ b/setup/wizard/lib/services/windowsService.php @@ -59,11 +59,21 @@ class windowsService extends Service { * @param none * @return string */ - public $util; + public $outputDir; + + public $varDir; + public function __construct() { $this->util = new InstallUtil(); + $this->setSystemDirs(); + } + + function setSystemDirs() { + $conf = $this->util->getDataFromSession('configuration'); + $this->outputDir = $conf['paths']['logDirectory']['path'].DS; + $this->varDir = $conf['paths']['varDirectory']['path'].DS; } /** diff --git a/setup/wizard/path.php b/setup/wizard/path.php index 3a13595..b0699c1 100644 --- a/setup/wizard/path.php +++ b/setup/wizard/path.php @@ -70,6 +70,9 @@ define('SERVICE_LIB', WIZARD_LIB."services".DS); define('CONF_DIR', WIZARD_DIR."config".DS); define('RES_DIR', WIZARD_DIR."resources".DS); + define('JS_DIR', RES_DIR."js".DS); + define('CSS_DIR', RES_DIR."css".DS); + define('IMG_DIR', RES_DIR."graphics".DS); define('STEP_DIR', WIZARD_DIR."steps".DS); define('TEMP_DIR', WIZARD_DIR."templates".DS); define('SHELL_DIR', WIZARD_DIR."shells".DS); diff --git a/setup/wizard/resources/wizard.css b/setup/wizard/resources/css/wizard.css index 3170842..86a0162 100644 --- a/setup/wizard/resources/wizard.css +++ b/setup/wizard/resources/css/wizard.css @@ -3,7 +3,7 @@ body { background-attachment:scroll; background-color:transparent; - background-image:url("graphics/dame/loginbg.png"); + background-image:url("../graphics/dame/loginbg.png"); background-position:0 0; background-repeat:repeat-x; font-family:sans-serif; @@ -71,7 +71,7 @@ select { } #header { - background: transparent url("graphics/dame/installer_head.png") repeat scroll 0% 0%; + background: transparent url("../graphics/dame/installer_head.png") repeat scroll 0% 0%; text-align: right; font-size: 100%; color: rgb(167, 167, 167); @@ -82,12 +82,12 @@ select { } #wrapper { - /*background: white url("graphics/background.gif") repeat-y left;*/ + /*background: white url("../graphics/background.gif") repeat-y left;*/ } #container { width: 100%; - background: white url("graphics/background.gif") repeat-y left; + background: white url("../graphics/background.gif") repeat-y left; float: right; } @@ -175,7 +175,7 @@ select { } #footer { - background-image:url("graphics/dame/navbar.png"); + background-image:url("../graphics/dame/navbar.png"); height:35px; } @@ -187,7 +187,7 @@ select { /* Content Styles */ .logo { - background: url("graphics/logo.png") no-repeat; + background: url("../graphics/logo.png") no-repeat; background-position: top left; height: 50px; width: 200px; @@ -207,7 +207,7 @@ select { } .indicator a { - background:url("graphics/dame/tick1.png") no-repeat left; + background:url("../graphics/dame/tick1.png") no-repeat left; padding-top:15px; padding-bottom:10px; padding-left:30px; @@ -215,7 +215,7 @@ select { } .active { - background:url("graphics/dame/tick1.png") no-repeat left; + background:url("../graphics/dame/tick1.png") no-repeat left; padding-top:15px; padding-bottom:10px; padding-left:30px; @@ -223,7 +223,7 @@ select { } .inactive { - background:url("graphics/dame/tick2.png") no-repeat left; + background:url("../graphics/dame/tick2.png") no-repeat left; padding-top:15px; padding-bottom:10px; padding-left:30px; @@ -231,7 +231,7 @@ select { } .current { - background:url("graphics/dame/dot.png") no-repeat left; + background:url("../graphics/dame/dot.png") no-repeat left; padding-top:15px; padding-bottom:10px; padding-left:30px; @@ -239,20 +239,20 @@ select { } .tick { - background: url("graphics/tick.png") no-repeat; + background: url("../graphics/tick.png") no-repeat; height: 16px; width: 16px; } .cross { - background: url("graphics/cross.png") no-repeat; + background: url("../graphics/cross.png") no-repeat; height: 16px; width: 16px; color:#A30000; } .cross_orange { - background: url("graphics/cross_orange.png") no-repeat; + background: url("../graphics/cross_orange.png") no-repeat; height: 16px; width: 16px; color:#EC7725; @@ -289,7 +289,7 @@ select { } .back { - background-image: url("graphics/dame/kt_gradient.jpg"); + background-image: url("../graphics/dame/kt_gradient.jpg"); background-repeat:repeat-x; border:1px solid #CECECE; float:left; @@ -305,7 +305,7 @@ select { } .step input { - background-image: url("graphics/dame/kt_gradient.jpg"); + background-image: url("../graphics/dame/kt_gradient.jpg"); background-repeat:repeat-x; border:1px solid #CECECE; float:right; @@ -340,7 +340,7 @@ select { } .powered-by { - background: url("graphics/powered-by-kt.png") no-repeat; + background: url("../graphics/powered-by-kt.png") no-repeat; background-position: center left; height: 50px; width: 140px; @@ -478,7 +478,7 @@ td.dir_description { } .big_ok { - background: url("graphics/big-ok.png") no-repeat; + background: url("../graphics/big-ok.png") no-repeat; padding:4px; /*width:16px; height:16px; @@ -505,7 +505,7 @@ td.dir_description { } #tooltips { - background: url("graphics/question.gif") no-repeat; + background: url("../graphics/question.gif") no-repeat; width:16px; height:16px; cursor:pointer; diff --git a/setup/wizard/resources/form.js b/setup/wizard/resources/js/form.js index b88c521..b88c521 100644 --- a/setup/wizard/resources/form.js +++ b/setup/wizard/resources/js/form.js diff --git a/setup/wizard/resources/jquery.blockUI.js b/setup/wizard/resources/js/jquery.blockUI.js index 3a50783..3a50783 100644 --- a/setup/wizard/resources/jquery.blockUI.js +++ b/setup/wizard/resources/js/jquery.blockUI.js diff --git a/setup/wizard/resources/jquery.form.js b/setup/wizard/resources/js/jquery.form.js index 51225ea..51225ea 100644 --- a/setup/wizard/resources/jquery.form.js +++ b/setup/wizard/resources/js/jquery.form.js diff --git a/setup/wizard/resources/js/jquery.hotkeys.js b/setup/wizard/resources/js/jquery.hotkeys.js new file mode 100644 index 0000000..15f1ce4 --- /dev/null +++ b/setup/wizard/resources/js/jquery.hotkeys.js @@ -0,0 +1,244 @@ +/* +(c) Copyrights 2007 - 2008 + +Original idea by by Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ + +jQuery Plugin by Tzury Bar Yochay +tzury.by@gmail.com +http://evalinux.wordpress.com +http://facebook.com/profile.php?id=513676303 + +Project's sites: +http://code.google.com/p/js-hotkeys/ +http://github.com/tzuryby/hotkeys/tree/master + +License: same as jQuery license. + +USAGE: + // simple usage + $(document).bind('keydown', 'Ctrl+c', function(){ alert('copy anyone?');}); + + // special options such as disableInIput + $(document).bind('keydown', {combi:'Ctrl+x', disableInInput: true} , function() {}); + +Note: + This plugin wraps the following jQuery methods: $.fn.find, $.fn.bind and $.fn.unbind + +*/ + + +(function (jQuery){ + // keep reference to the original $.fn.bind and $.fn.unbind + jQuery.fn.__bind__ = jQuery.fn.bind; + jQuery.fn.__unbind__ = jQuery.fn.unbind; + jQuery.fn.__find__ = jQuery.fn.find; + + var hotkeys = { + version: '0.7.8', + override: /keydown|keypress|keyup/g, + triggersMap: {}, + + specialKeys: { 27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', + 20: 'capslock', 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del', + 35:'end', 33: 'pageup', 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', + 112:'f1',113:'f2', 114:'f3', 115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', + 120:'f9', 121:'f10', 122:'f11', 123:'f12' }, + + shiftNums: { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", + "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<", + ".":">", "/":"?", "\\":"|" }, + + newTrigger: function (type, combi, callback) { + // i.e. {'keyup': {'ctrl': {cb: callback, disableInInput: false}}} + var result = {}; + result[type] = {}; + result[type][combi] = {cb: callback, disableInInput: false}; + return result; + } + }; + // add firefox num pad char codes + if (jQuery.browser.mozilla){ + hotkeys.specialKeys = jQuery.extend(hotkeys.specialKeys, { 96: '0', 97:'1', 98: '2', 99: + '3', 100: '4', 101: '5', 102: '6', 103: '7', 104: '8', 105: '9' }); + } + + // a wrapper around of $.fn.find + // see more at: http://groups.google.com/group/jquery-en/browse_thread/thread/18f9825e8d22f18d + jQuery.fn.find = function( selector ) { + this.query=selector; + return jQuery.fn.__find__.apply(this, arguments); + }; + + jQuery.fn.unbind = function (type, combi, fn){ + if (jQuery.isFunction(combi)){ + fn = combi; + combi = null; + } + if (combi && typeof combi === 'string'){ + var selectorId = ((this.prevObject && this.prevObject.query) || (this[0].id && this[0].id) || this[0]).toString(); + var hkTypes = type.split(' '); + for (var x=0; x'file', 'name'=>ucwords($dbconf['dname']), 'section'=>'db', 'value'=>$dbconf['dname'], 'setting'=>'dbName'); $server['dbUser'] = array('where'=>'file', 'name'=>ucwords($dbconf['duname']), 'section'=>'db', 'value'=>$dbconf['duname'], 'setting'=>'dbUser'); $server['dbPass'] = array('where'=>'file', 'name'=>ucwords($dbconf['dpassword']), 'section'=>'db', 'value'=>$dbconf['dpassword'], 'setting'=>'dbPass'); @@ -306,6 +305,17 @@ class configuration extends Step return $server; } + private function registerDirs() { // Adjust directories variables + $this->readConfigPath(); + $dirs = $this->getFromConfigPath(); + $directories['varDirectory'] = array('section'=>'urls', 'value'=>mysql_real_escape_string($dirs['varDirectory']['path']), 'setting'=>'varDirectory'); + $directories['logDirectory'] = array('section'=>'urls', 'value'=>mysql_real_escape_string($dirs['logDirectory']['path']), 'setting'=>'logDirectory'); + $directories['documentRoot'] = array('section'=>'urls', 'value'=>mysql_real_escape_string($dirs['documentRoot']['path']), 'setting'=>'documentRoot'); + $directories['uiDirectory'] = array('section'=>'urls', 'value'=>'${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree', 'setting'=>'uiDirectory'); + $directories['tmpDirectory'] = array('section'=>'urls', 'value'=>mysql_real_escape_string($dirs['tmpDirectory']['path']), 'setting'=>'tmpDirectory'); + + return $directories; + } /** * Perform the installation associated with the step. * Variables required by the installation are stored within the session. @@ -315,13 +325,10 @@ class configuration extends Step */ public function installStep() { - // get data from the server - $conf = $this->getDataFromSession("configuration"); + $conf = $this->getDataFromSession("configuration"); // get data from the server $server = $conf['server']; $paths = $conf['paths']; - - // initialise writing to config.ini - $this->readConfigPath(); + $this->readConfigPath(); // initialise writing to config.ini $dirs = $this->getFromConfigPath(); if(isset($this->confpaths['configIni'])) { // Check if theres a config path $configPath = realpath("../../{$this->confpaths['configIni']}"); // Relative to Config Path File @@ -335,26 +342,50 @@ class configuration extends Step if(file_exists($configPath)) { $ini = new Ini($configPath); } + $this->writeUrlSection($ini); + $this->writeDBSection($ini, $server); + $this->writeDBPathSection($ini, $paths); + if(!$ini === false){ // write out the config.ini file + $ini->write(); + } + $this->_dbhandler->close(); // close the database connection + $this->writeConfigPath(); // Write config file + } - // initialise the db connection - - // retrieve database information from session - $dbconf = $this->getDataFromSession("database"); - - // make db connection - $this->_dbhandler->load($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']); - - // add db config to server variables - $server = $this->registerDBConfig($server, $dbconf); - + private function writeUrlSection($ini) { + $directories = $this->registerDirs(); + foreach($directories as $item) { // write server settings to config_settings table and config.ini + if(!$ini === false) { + $ini->updateItem($item['section'], $item['setting'], $item['value']); + } + } + } + + private function writeDBPathSection($ini, $paths) { + $table = 'config_settings'; + if(is_array($paths)) { // write the paths to the config_settings table + foreach ($paths as $item){ + if(empty($item['setting'])){ + continue; + } + $value = mysql_real_escape_string($item['path']); + $setting = mysql_real_escape_string($item['setting']); + $sql = "UPDATE {$table} SET value = '{$value}' WHERE item = '{$setting}'"; + $this->_dbhandler->query($sql); + } + } + } + + private function writeDBSection($ini, $server) { + $dbconf = $this->getDataFromSession("database"); // retrieve database information from session + $this->_dbhandler->load($dbconf['dhost'], $dbconf['duname'], $dbconf['dpassword'], $dbconf['dname']); // initialise the db connection + $server = $this->registerDBConfig($server, $dbconf); // add db config to server variables $table = 'config_settings'; - // write server settings to config_settings table and config.ini - foreach($server as $item){ - - switch($item['where']){ + foreach($server as $item) { // write server settings to config_settings table and config.ini + switch($item['where']) { case 'file': $value = $item['value']; - if($value == 'yes'){ + if($value == 'yes') { $value = 'true'; } if($value == 'no'){ @@ -364,7 +395,6 @@ class configuration extends Step $ini->updateItem($item['section'], $item['setting'], $value); } break; - case 'db': $value = mysql_real_escape_string($item['value']); $setting = mysql_real_escape_string($item['setting']); @@ -374,34 +404,8 @@ class configuration extends Step break; } } - - // write the paths to the config_settings table - if(is_array($paths)) { - foreach ($paths as $item){ - if(empty($item['setting'])){ - continue; - } - - $value = mysql_real_escape_string($item['path']); - $setting = mysql_real_escape_string($item['setting']); - - $sql = "UPDATE {$table} SET value = '{$value}' WHERE item = '{$setting}'"; - $this->_dbhandler->query($sql); - } - } - - // write out the config.ini file - if(!$ini === false){ - $ini->write(); - } - - // close the database connection - $this->_dbhandler->close(); - - // Write config file - $this->writeConfigPath(); } - + /** * Get the server settings information * @@ -473,7 +477,10 @@ class configuration extends Step if(WINDOWS_OS) $path = preg_replace('/\//', '\\',$path); $dirs[$key]['path'] = $path; - $class = $this->util->checkPermission($path, $dir['create']); + if(isset($dir['file'])) + $class = $this->util->checkPermission($path, $dir['create'], true); + else + $class = $this->util->checkPermission($path, $dir['create']); if($class['class'] != 'tick') { $this->temp_variables['paths_perms'] = $class['class']; $this->done = false; @@ -525,7 +532,7 @@ class configuration extends Step array('name' => 'Log Directory', 'setting' => 'logDirectory', 'path' => $_POST['logDirectory'], 'create' => true), array('name' => 'Temporary Directory', 'setting' => 'tmpDirectory', 'path' => $_POST['tmpDirectory'], 'create' => true), array('name' => 'Uploads Directory', 'setting' => 'uploadDirectory', 'path' => $_POST['uploadDirectory'], 'create' => true), - array('name' => 'Configuration File', 'setting' => 'configFile', 'path' => $_POST['configFile'], 'create' => false), + array('name' => 'Configuration File', 'setting' => 'configFile', 'path' => $_POST['configFile'], 'create' => false, 'file'=>true), ); } @@ -540,17 +547,11 @@ class configuration extends Step private function getFromConfigPath() { $configs = array(); if(isset($this->confpaths['configIni'])) { // Simple check to see if any paths were written - $configPath = realpath("../../{$this->confpaths['configIni']}"); // Relative to Config Path File - if($configPath == '') { // Absolute path probably entered - $configPath = realpath("{$this->confpaths['configIni']}"); // Get absolute path - if($configPath == '') { - $configPath = realpath('../../config/config.ini'); - } - } + $configPath = $this->confpaths['configIni']; // Get absolute path } else { $configPath = '${fileSystemRoot}/config/config.ini'; } - $configs['configFile'] = array('name' => 'Configuration File', 'setting' => 'configFile', 'path' => $configPath, 'create' => false); + $configs['configFile'] = array('name' => 'Configuration File', 'setting' => 'configFile', 'path' => $configPath, 'create' => false, 'file'=>true); if(isset($this->confpaths['Documents'])) { $docsPath = $this->confpaths['Documents']; } else { @@ -610,7 +611,7 @@ class configuration extends Step if(!$configPath) return false; $ini = new Ini($configPath); $data = $ini->getFileByLine(); - $firstline = true; + $firstline = true; foreach ($data as $k=>$v) { if($firstline) { // First line holds the var directory $firstline = false; diff --git a/setup/wizard/template.php b/setup/wizard/template.php index 00dc10a..e33ff34 100644 --- a/setup/wizard/template.php +++ b/setup/wizard/template.php @@ -81,7 +81,7 @@ class Template if($isA) { $value = $value->fetch(); } - $this->template_vars[$name] = $value; + $this->template_vars[$name] = $value; } @@ -99,7 +99,9 @@ class Template if (!file_exists($file)) { trigger_error('Template file '.$file.' does not exist ', E_USER_ERROR); } + $this->template_vars['html'] = new htmlHelper(); extract($this->template_vars); // Extract the vars to local namespace + ob_start(); include($file); $contents = ob_get_contents(); diff --git a/setup/wizard/templates/complete.tpl b/setup/wizard/templates/complete.tpl index 42e76db..990c351 100644 --- a/setup/wizard/templates/complete.tpl +++ b/setup/wizard/templates/complete.tpl @@ -126,4 +126,4 @@ } ?> - \ No newline at end of file +js('form.js'); } ?> \ No newline at end of file diff --git a/setup/wizard/templates/configuration.tpl b/setup/wizard/templates/configuration.tpl index 233879f..9bb3a7c 100644 --- a/setup/wizard/templates/configuration.tpl +++ b/setup/wizard/templates/configuration.tpl @@ -118,4 +118,4 @@ - +js('form.js'); } ?> diff --git a/setup/wizard/templates/configuration_confirm.tpl b/setup/wizard/templates/configuration_confirm.tpl index 346835a..8592e74 100644 --- a/setup/wizard/templates/configuration_confirm.tpl +++ b/setup/wizard/templates/configuration_confirm.tpl @@ -94,4 +94,4 @@ - +js('form.js'); } ?> diff --git a/setup/wizard/templates/database.tpl b/setup/wizard/templates/database.tpl index eff52c4..266e3b4 100644 --- a/setup/wizard/templates/database.tpl +++ b/setup/wizard/templates/database.tpl @@ -142,7 +142,7 @@ An second user is required for normal database interaction, the reading and writ - +js('form.js'); } ?> \ No newline at end of file diff --git a/setup/wizard/templates/database_confirm.tpl b/setup/wizard/templates/database_confirm.tpl index 671e2be..1fc2b2c 100644 --- a/setup/wizard/templates/database_confirm.tpl +++ b/setup/wizard/templates/database_confirm.tpl @@ -101,4 +101,4 @@ - \ No newline at end of file +js('form.js'); } ?> \ No newline at end of file diff --git a/setup/wizard/templates/dependencies.tpl b/setup/wizard/templates/dependencies.tpl index 1643336..2fbb949 100644 --- a/setup/wizard/templates/dependencies.tpl +++ b/setup/wizard/templates/dependencies.tpl @@ -151,4 +151,4 @@ - \ No newline at end of file +js('form.js'); } ?> \ No newline at end of file diff --git a/setup/wizard/templates/error.tpl b/setup/wizard/templates/error.tpl index 2c1a7cb..f49bfc5 100644 --- a/setup/wizard/templates/error.tpl +++ b/setup/wizard/templates/error.tpl @@ -2,9 +2,9 @@ KnowledgeTree Installer - - - + + + diff --git a/setup/wizard/templates/install.tpl b/setup/wizard/templates/install.tpl index 79fcc39..d5d22e4 100644 --- a/setup/wizard/templates/install.tpl +++ b/setup/wizard/templates/install.tpl @@ -7,9 +7,9 @@

The wizard will now complete the installation and run a final check on the system.

-
+
image('dame/kt_browse.png'); ?>
- \ No newline at end of file +js('form.js'); } ?> \ No newline at end of file diff --git a/setup/wizard/templates/license.tpl b/setup/wizard/templates/license.tpl index 165546e..b4bdf55 100644 --- a/setup/wizard/templates/license.tpl +++ b/setup/wizard/templates/license.tpl @@ -334,7 +334,7 @@ govern. + - - \ No newline at end of file +js('form.js'); } ?> \ No newline at end of file diff --git a/setup/wizard/templates/registration.tpl b/setup/wizard/templates/registration.tpl index b2f098b..d790250 100644 --- a/setup/wizard/templates/registration.tpl +++ b/setup/wizard/templates/registration.tpl @@ -29,7 +29,7 @@     - + image('dropbox.png'); ?> @@ -107,7 +107,7 @@ - +js('form.js'); } ?> \ No newline at end of file diff --git a/setup/wizard/templates/registration_confirm.tpl b/setup/wizard/templates/registration_confirm.tpl index 6b1affb..6a9cb7f 100644 --- a/setup/wizard/templates/registration_confirm.tpl +++ b/setup/wizard/templates/registration_confirm.tpl @@ -6,9 +6,9 @@

Thank you for signing up. You'll receive an email from us shortly with download instructions for the KnowledgeTree Drop Box software.

-
+
image('kt_browse.png'); ?>
- \ No newline at end of file +js('form.js'); } ?> \ No newline at end of file diff --git a/setup/wizard/templates/services.tpl b/setup/wizard/templates/services.tpl index a5463d1..d34ac82 100644 --- a/setup/wizard/templates/services.tpl +++ b/setup/wizard/templates/services.tpl @@ -196,4 +196,4 @@ - \ No newline at end of file +js('form.js'); } ?> \ No newline at end of file diff --git a/setup/wizard/templates/welcome.tpl b/setup/wizard/templates/welcome.tpl index 79b208c..ef18fa2 100644 --- a/setup/wizard/templates/welcome.tpl +++ b/setup/wizard/templates/welcome.tpl @@ -4,9 +4,9 @@

This wizard will lead you through the steps needed to install and configure KnowledgeTree on your server.

-
+
image('kt_browse.png'); ?>
- \ No newline at end of file +js('form.js'); } ?> \ No newline at end of file diff --git a/setup/wizard/templates/wizard.tpl b/setup/wizard/templates/wizard.tpl index 1246b13..b367a29 100644 --- a/setup/wizard/templates/wizard.tpl +++ b/setup/wizard/templates/wizard.tpl @@ -2,16 +2,17 @@ KnowledgeTree Installer - - - - - + js('jquery.js'); ?> + js('jquery.form.js'); ?> + js('jquery.blockUI.js'); ?> + js('jquery.hotkeys.js'); ?> + js('wizard.js'); ?> + css('wizard.css'); ?>
- +