Commit 1f4fb4ccb5846f16fd46a6179023cfcc9854d9d0
1 parent
b339470e
PT:2492070 : First Login wizard updated
Committed by: Jarrett Jordaan Reviewed by: Megan Watson
Showing
12 changed files
with
110 additions
and
60 deletions
dashboard.php
| ... | ... | @@ -135,9 +135,21 @@ class DashboardDispatcher extends KTStandardDispatcher { |
| 135 | 135 | 'dashlets_left' => $aDashletsLeft, |
| 136 | 136 | 'dashlets_right' => $aDashletsRight, |
| 137 | 137 | ); |
| 138 | + | |
| 139 | + // TODO : Is this ok? | |
| 140 | + if(file_exists(KT_DIR.DIRECTORY_SEPARATOR.'var'.DIRECTORY_SEPARATOR.'bin'.DIRECTORY_SEPARATOR."firstlogin.lock")) { | |
| 141 | + $this->runFirstLoginWizard($oTemplate, $aTemplateData); | |
| 142 | + } | |
| 143 | + | |
| 138 | 144 | return $oTemplate->render($aTemplateData); |
| 139 | 145 | } |
| 140 | 146 | |
| 147 | + // | |
| 148 | + function runFirstLoginWizard($oTemplate, $aTemplateData) { | |
| 149 | + $this->oPage->requireJSResource('thirdpartyjs/jquery/jquery-1.3.2.min.js'); | |
| 150 | + $this->oPage->requireJSResource('setup/wizard/resources/js/firstlogin.js'); | |
| 151 | + } | |
| 152 | + | |
| 141 | 153 | // return some kind of ID for each dashlet |
| 142 | 154 | // currently uses the class name |
| 143 | 155 | function _getDashletId($oDashlet) { | ... | ... |
setup/firstlogin/firstlogin.php
| ... | ... | @@ -491,7 +491,8 @@ class firstlogin { |
| 491 | 491 | $this->_readXml(); // Xml steps |
| 492 | 492 | $this->_resetSessions(); // Make sure session is cleared |
| 493 | 493 | $this->_loadFromSessions(); |
| 494 | - if(isset($_POST['Next'])) { $this->action = 'next'; | |
| 494 | + if(isset($_POST['Next'])) { | |
| 495 | + $this->action = 'next'; | |
| 495 | 496 | $this->response = 'next'; |
| 496 | 497 | } elseif (isset($_POST['Previous'])) { |
| 497 | 498 | $this->action = 'previous'; |
| ... | ... | @@ -509,8 +510,31 @@ class firstlogin { |
| 509 | 510 | $this->response = ''; |
| 510 | 511 | $this->action = ''; |
| 511 | 512 | } |
| 513 | + $this->loadAjax(); | |
| 512 | 514 | } |
| 513 | 515 | |
| 516 | + private function loadAjax() { | |
| 517 | + if(isset($_GET['Next'])) { | |
| 518 | + $this->action = 'next'; | |
| 519 | + $this->response = 'next'; | |
| 520 | + } elseif (isset($_GET['Previous'])) { | |
| 521 | + $this->action = 'previous'; | |
| 522 | + $this->response = 'previous'; | |
| 523 | + } elseif (isset($_GET['Confirm'])) { | |
| 524 | + $this->action = 'confirm'; | |
| 525 | + $this->response = 'next'; | |
| 526 | + } elseif (isset($_GET['Edit'])) { | |
| 527 | + $this->action = 'edit'; | |
| 528 | + $this->response = 'next'; | |
| 529 | + } elseif (isset($_GET['Skip'])) { | |
| 530 | + $this->action = 'next'; | |
| 531 | + $this->response = 'next'; | |
| 532 | + } else { | |
| 533 | + $this->response = ''; | |
| 534 | + $this->action = ''; | |
| 535 | + } | |
| 536 | + } | |
| 537 | + | |
| 514 | 538 | /** |
| 515 | 539 | * Main control to handle the flow |
| 516 | 540 | * | ... | ... |
setup/firstlogin/firstloginUtil.php
| ... | ... | @@ -85,47 +85,23 @@ class firstloginUtil extends InstallUtil { |
| 85 | 85 | * @return mixed |
| 86 | 86 | */ |
| 87 | 87 | public function checkStructurePermissions() { |
| 88 | - // Check if Wizard Directory is writable | |
| 89 | - if(!$this->_checkPermission(WIZARD_DIR)) { | |
| 88 | + if(!$this->_checkPermission(WIZARD_DIR)) { // Check if Wizard Directory is writable | |
| 90 | 89 | return 'firstlogin'; |
| 91 | 90 | } |
| 92 | 91 | |
| 93 | 92 | return true; |
| 94 | 93 | } |
| 95 | 94 | |
| 96 | - public function loadInstallServices() { | |
| 97 | - require_once("../wizard/steps/services.php"); | |
| 98 | - $s = new services(); | |
| 99 | - return $s->getServices(); | |
| 100 | - } | |
| 101 | - | |
| 102 | - public function loadInstallService($serviceName) { | |
| 103 | - require_once("../wizard/lib/services/service.php"); | |
| 104 | - require_once("../wizard/lib/services/".OS."Service.php"); | |
| 105 | - require_once("../wizard/lib/services/$serviceName.php"); | |
| 106 | - return new $serviceName(); | |
| 107 | - } | |
| 108 | - | |
| 109 | 95 | /** |
| 110 | - * Return port of the old installation | |
| 96 | + * Deletes first login lock file | |
| 111 | 97 | * |
| 112 | - * @param location | |
| 113 | - * @return string | |
| 98 | + * @author KnowledgeTree Team | |
| 99 | + * @access public | |
| 100 | + * @return void | |
| 114 | 101 | */ |
| 115 | - public function getPort($location) { | |
| 116 | - if(WINDOWS_OS) { | |
| 117 | - $myIni = "my.ini"; | |
| 118 | - } else { | |
| 119 | - $myIni = "my.cnf"; | |
| 120 | - } | |
| 121 | - $dbConfigPath = $location.DS."mysql".DS."$myIni"; | |
| 122 | - if(file_exists($dbConfigPath)) { | |
| 123 | - $this->iniUtilities->load($dbConfigPath); | |
| 124 | - $dbSettings = $this->iniUtilities->getSection('mysqladmin'); | |
| 125 | - return $dbSettings['port']; | |
| 126 | - } | |
| 127 | - | |
| 128 | - return '3306'; | |
| 102 | + public function deleteFirstLogin() { | |
| 103 | + if(file_exists(SYSTEM_DIR.'var'.DS.'bin'.DS."firstlogin.lock")) | |
| 104 | + unlink(SYSTEM_DIR.'var'.DS.'bin'.DS."firstlogin.lock"); | |
| 129 | 105 | } |
| 130 | 106 | } |
| 131 | 107 | ?> |
| 132 | 108 | \ No newline at end of file | ... | ... |
setup/firstlogin/firstloginWizard.php
| ... | ... | @@ -165,7 +165,7 @@ class firstloginWizard extends WizardBase { |
| 165 | 165 | } elseif ($this->getBypass() === "0") { |
| 166 | 166 | $this->createFile(); |
| 167 | 167 | } |
| 168 | - if(!$this->isFirstLogin()) { // 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
| ... | ... | @@ -145,7 +145,23 @@ class Step extends StepBase |
| 145 | 145 | */ |
| 146 | 146 | public function run() { |
| 147 | 147 | return $this->run; |
| 148 | - } | |
| 148 | + } | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * Checks if next button has been clicked | |
| 152 | + * | |
| 153 | + * @author KnowledgeTree Team | |
| 154 | + * @param none | |
| 155 | + * @access public | |
| 156 | + * @return boolean | |
| 157 | + */ | |
| 158 | + public function next() { | |
| 159 | + if(isset($_GET['Next'])) { | |
| 160 | + return true; | |
| 161 | + } | |
| 162 | + | |
| 163 | + return false; | |
| 164 | + } | |
| 149 | 165 | } |
| 150 | 166 | |
| 151 | 167 | ?> |
| 152 | 168 | \ No newline at end of file | ... | ... |
setup/firstlogin/steps/firstloginComplete.php
setup/firstlogin/steps/firstloginTemplates.php
| ... | ... | @@ -91,14 +91,16 @@ class firstloginTemplates extends Step { |
| 91 | 91 | |
| 92 | 92 | function applyTemplates() { |
| 93 | 93 | $templateId = KTUtil::arrayGet($_POST['data'], "templateId", 0); |
| 94 | + if($templateId < 1) { | |
| 95 | + $templateId = KTUtil::arrayGet($_GET, "templateId", 0);// Could be ajax call | |
| 96 | + } | |
| 94 | 97 | if($templateId > 0) { |
| 95 | 98 | if (KTPluginUtil::pluginIsActive('fs.FolderTemplatesPlugin.plugin')) { // Check if folder templates plugin is active |
| 96 | 99 | $oRegistry =& KTPluginRegistry::getSingleton(); |
| 97 | 100 | $oPlugin =& $oRegistry->getPlugin('fs.FolderTemplatesPlugin.plugin'); // Get a handle on the plugin |
| 98 | - return $oPlugin->applyFolderTemplate($templateId, 1); | |
| 101 | + return $oPlugin->firstLoginAction(1, $templateId); | |
| 99 | 102 | } |
| 100 | 103 | } |
| 101 | - | |
| 102 | 104 | return false; |
| 103 | 105 | } |
| 104 | 106 | ... | ... |
setup/firstlogin/templates/complete.tpl
| ... | ... | @@ -6,6 +6,9 @@ |
| 6 | 6 | <input type="submit" name="Next" value="Finish" class="button_next"/> |
| 7 | 7 | </form> |
| 8 | 8 | <script type="text/javascript"> |
| 9 | - $("#duname").focus(); | |
| 9 | + $("form").bind("submit", function() { | |
| 10 | + closeFirstLogin(); | |
| 11 | + return false; | |
| 12 | + }); | |
| 10 | 13 | </script> |
| 11 | 14 | <?php if (AJAX) { echo $html->js('form.js'); } ?> |
| 12 | 15 | \ No newline at end of file | ... | ... |
setup/firstlogin/templates/templates.tpl
| 1 | -<form id="<?php echo $step_name; ?>" action="index.php?step_name=<?php echo $step_name; ?>" method="post"> | |
| 1 | +<form id="step_name_<?php echo $step_name; ?>" action="index.php?step_name=<?php echo $step_name; ?>" method="post"> | |
| 2 | 2 | <p class="title">Apply Templates</p> |
| 3 | 3 | <p class="description">You can select a base folder layout to apply to your root folder of KnowledgeTree.</p> |
| 4 | 4 | <div id="step_content_<?php echo $step_name; ?>" class="step"> |
| 5 | 5 | <div class="field "> |
| 6 | 6 | <p class="descriptiveText">Choose a template, if you would like to generate predefined folders.</p> |
| 7 | 7 | <p class="errorMessage"></p> |
| 8 | - <select name="data[templateId]"> | |
| 9 | - <option selected="selected" value="">- No template -</option> | |
| 8 | + <select name="data[templateId]" id="selectedTemplate"> | |
| 9 | + <option selected="selected" value="0">- No template -</option> | |
| 10 | 10 | <?php |
| 11 | 11 | foreach ($aFolderTemplates as $oFolderTemplate) { |
| 12 | 12 | echo "<option onclick=\"javascript:{fl.showFolderTemplateTree('{$oFolderTemplate->getId()}')}\" value=\"{$oFolderTemplate->getId()}\">".$oFolderTemplate->getName()."</option>"; |
| ... | ... | @@ -45,10 +45,13 @@ |
| 45 | 45 | </table> |
| 46 | 46 | </div> |
| 47 | 47 | </div> |
| 48 | - <input type="submit" name="Skip" value="Skip" class="button_skip"/> | |
| 49 | - <input type="submit" name="Next" value="Next" class="button_next"/> | |
| 48 | + <input id="skip" type="submit" name="Skip" value="Skip" class="button_skip"/> | |
| 49 | + <input id="next" type="submit" name="Next" value="Next" class="button_next"/> | |
| 50 | 50 | </form> |
| 51 | 51 | <script type="text/javascript"> |
| 52 | - $("#duname").focus(); | |
| 52 | + $("form").bind("submit", function() { | |
| 53 | + fl.sendFirstLoginForm(); | |
| 54 | + return false; | |
| 55 | + }); | |
| 53 | 56 | </script> |
| 54 | 57 | <?php if (AJAX) { echo $html->js('form.js'); } ?> |
| 55 | 58 | \ No newline at end of file | ... | ... |
setup/wizard/installer.php
setup/wizard/resources/js/firstlogin.js
| 1 | -// Class First Login | |
| 2 | -//TODO : Plugin path in js | |
| 3 | -var ktfolderAccess = "../../plugins/commercial/folder-templates/KTFolderTemplates.php?action="; | |
| 4 | -var ktmanageFolderAccess = "admin.php?kt_path_info=misc/adminfoldertemplatesmanagement&action="; | |
| 1 | +var win; | |
| 2 | + | |
| 5 | 3 | $(function() { // Document is ready |
| 6 | 4 | if($("#wrapper").attr('class') != 'wizard') {// Check if we in a wizard, or on the dashboard |
| 7 | 5 | showForm(); // Display first login wizard |
| 8 | 6 | } |
| 9 | 7 | }); |
| 10 | 8 | |
| 9 | +// Class First Login | |
| 11 | 10 | function firstlogin(rootUrl) { |
| 11 | + this.rootUrl = rootUrl; | |
| 12 | 12 | this.ktfolderAccess = rootUrl + "plugins/commercial/folder-templates/KTFolderTemplates.php?action="; |
| 13 | 13 | this.ktmanageFolderAccess = rootUrl + "admin.php?kt_path_info=misc/adminfoldertemplatesmanagement&action="; |
| 14 | 14 | this.ajaxOn = false; |
| ... | ... | @@ -49,6 +49,7 @@ firstlogin.prototype.hideFolderTemplateTrees = function() { |
| 49 | 49 | ); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | +// Template has this action. Not needed in first login wizard | |
| 52 | 53 | firstlogin.prototype.showNodeOptions = function() { |
| 53 | 54 | |
| 54 | 55 | } |
| ... | ... | @@ -68,13 +69,12 @@ var showForm = function() { |
| 68 | 69 | shadow: false, |
| 69 | 70 | modal: true |
| 70 | 71 | }); |
| 71 | - | |
| 72 | 72 | this.win.show(); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | var createForm = function() { |
| 76 | 76 | var holder = "<div id='firstlogin'></div>"; |
| 77 | - $("#wrapper").append(holder); // Append to current dashboard | |
| 77 | + $("#pageBody").append(holder); // Append to current dashboard | |
| 78 | 78 | var address = "setup/firstlogin/index.php"; |
| 79 | 79 | getUrl(address, "firstlogin"); // Pull in existing wizard |
| 80 | 80 | } |
| ... | ... | @@ -93,6 +93,19 @@ var getUrl = function (address, div) { |
| 93 | 93 | }); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | +/* | |
| 97 | +* Close the popup | |
| 98 | +*/ | |
| 99 | +var closeFirstLogin = function () { | |
| 100 | + this.win.destroy(); | |
| 101 | + $('.ext-el-mask').each( // TODO : Why does overlay hang around? | |
| 102 | + function() { | |
| 103 | + $(this).remove(); | |
| 104 | + } | |
| 105 | + ); | |
| 106 | + | |
| 107 | +} | |
| 108 | + | |
| 96 | 109 | // Node clicked |
| 97 | 110 | firstlogin.prototype.nodeAction = function(updateContentDiv, updateDiv, address) { |
| 98 | 111 | var className = $("#"+updateDiv).attr('class'); |
| ... | ... | @@ -106,4 +119,13 @@ firstlogin.prototype.nodeAction = function(updateContentDiv, updateDiv, address) |
| 106 | 119 | } |
| 107 | 120 | } |
| 108 | 121 | |
| 122 | +firstlogin.prototype.getRootUrl = function() { | |
| 123 | + return this.rootUrl; | |
| 124 | +} | |
| 109 | 125 | |
| 126 | +firstlogin.prototype.sendFirstLoginForm = function() { | |
| 127 | + var templateId = $("#selectedTemplate").val(); | |
| 128 | + var action = $("#step_name_templates").attr('action'); | |
| 129 | + var address = this.rootUrl + "setup/firstlogin/" + action + "&templateId=" + templateId + "&Next=Next"; | |
| 130 | + getUrl(address, 'firstlogin'); | |
| 131 | +} | ... | ... |
setup/wizard/steps/complete.php
| ... | ... | @@ -242,21 +242,12 @@ class complete extends Step { |
| 242 | 242 | function checkInstallType() { |
| 243 | 243 | if ($this->util->isMigration()) { |
| 244 | 244 | $this->migrate_check = true; |
| 245 | - $this->registerPlugins(); // Set silent mode variables | |
| 246 | 245 | } else { |
| 247 | 246 | $this->migrate_check = false; |
| 248 | 247 | } |
| 249 | 248 | } |
| 250 | 249 | |
| 251 | 250 | /** |
| 252 | - * Register extra commercial plugins | |
| 253 | - * | |
| 254 | - */ | |
| 255 | - private function registerPlugins() { | |
| 256 | - | |
| 257 | - } | |
| 258 | - | |
| 259 | - /** | |
| 260 | 251 | * Set all silent mode varibles |
| 261 | 252 | * |
| 262 | 253 | */ | ... | ... |