From b80cc36fb5464dfe6c295c89637cd8acb180bec0 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Fri, 22 Jul 2011 11:55:41 +0000 Subject: [PATCH] TO BE TESTED: New step in the wizard confirmation of the URL to be used for accessing the application. SVN:trunk[1348] --- setup/index.php | 87 +++++++++++++++++++++++++++++++++++++++---------- setup/setup.js | 25 ++++++++++++-- 2 files changed, 91 insertions(+), 21 deletions(-) diff --git a/setup/index.php b/setup/index.php index 6bacb5d11..ecafd39c3 100644 --- a/setup/index.php +++ b/setup/index.php @@ -981,7 +981,7 @@ function ModulesSelection(SetupWebPage $oP, $aParamValues, $iCurrentStep, $oConf $oP->add("\n"); if ($aParamValues['mode'] == 'upgrade') { - $oP->add("

Next: Sample data selection

\n"); + $oP->add("

Next: Application path

\n"); AddHiddenParam($oP, 'operation', 'step6'); } else @@ -1042,7 +1042,7 @@ function AdminAccountDefinition(SetupWebPage $oP, $aParamValues, $iCurrentStep, $aForm[] = array('label' => "Retype password$sRedStar:", 'input' => ""); $oP->form($aForm); $oP->add("\n"); - $oP->add("

Next: Sample data selection

\n"); + $oP->add("

Next: Application path

\n"); $oP->add("\n"); $oP->add("\n"); $oP->add("\n"); @@ -1052,6 +1052,51 @@ function AdminAccountDefinition(SetupWebPage $oP, $aParamValues, $iCurrentStep, $oP->add("\n"); } + +/** + * Display the form for validating/entering the URL (path) to the application + * which consists in + */ +function ApplicationPathSelection(SetupWebPage $oP, $aParamValues, $iCurrentStep, Config $oConfig) +{ + $sNextOperation = 'step7'; + if ($aParamValues['mode'] == 'upgrade') + { + $iPrevStep = 4; + } + else + { + $iPrevStep = 5; + } + + $oP->set_title("Application Path"); + + $oP->add("\n"); + $oP->add("\n"); + AddParamsToForm($oP, $aParamValues, array('application_path')); + + try + { + $sDefaultAppPath = utils::GetDefaultUrlAppRoot(); + } + catch(Exception $e) + { + $sDefaultAppPath = 'http:///itop'; + } + $sAppPath = empty($aParamValues['application_path']) ? $sDefaultAppPath : $aParamValues['application_path']; + + $oP->add("

Enter the URL that will be used to connect to the application

\n"); + $oP->p("
Application URL \n"); + $oP->p("\n"); + $oP->p("
\n"); + $oP->add("

Next: Sample data selection

\n"); + $oP->add("
> \"/>
\n"); + $oP->add("\n"); + $oP->add("\n"); + $oP->add("
> \"/>
\n"); + $oP->add("\n"); +} + /** * Display the form for the fourth step of the configuration wizard * which consists in @@ -1060,15 +1105,8 @@ function AdminAccountDefinition(SetupWebPage $oP, $aParamValues, $iCurrentStep, */ function SampleDataSelection(SetupWebPage $oP, $aParamValues, $iCurrentStep, Config $oConfig) { - $sNextOperation = 'step7'; - if ($aParamValues['mode'] == 'upgrade') - { - $iPrevStep = 4; - } - else - { - $iPrevStep = 5; - } + $sNextOperation = 'step8'; + $iPrevStep = 6; $oP->set_title("Application initialization"); $sAdminUser = $aParamValues['auth_user']; @@ -1081,6 +1119,7 @@ function SampleDataSelection(SetupWebPage $oP, $aParamValues, $iCurrentStep, Con $aAvailableModules = AnalyzeInstallation($oConfig); BuildConfig($oP, $oConfig, $aParamValues, $aAvailableModules); // Load all the includes based on the modules selected + $oConfig->Set('app_root_url', $aParamValues['application_path']); // in case of upgrade, the value is already present in the config file $oConfig->WriteToFile(TMP_CONFIG_FILE); @@ -1111,7 +1150,7 @@ function SampleDataSelection(SetupWebPage $oP, $aParamValues, $iCurrentStep, Con $oP->add("

Next: Installation summary

\n"); $oP->add("\n"); $oP->add("\n"); - $oP->add("\n"); + $oP->add("\n"); $oP->add("
> \"/>> \"/>
\n"); $oP->add("\n"); } @@ -1179,6 +1218,9 @@ function DisplaySummary(SetupWebPage $oP, $aParamValues, $iCurrentStep, Config $ } $oP->collapsible('sample_data', "Sample Data", array($sSampleData)); + // Application Path + $oP->collapsible('application_path', "Application path", array('URL:'.htmlentities($aParamValues['application_path'], ENT_QUOTES, 'UTF-8'))); + // Admin account $oP->collapsible('admin_account', "Administrator account", array('Login:'.htmlentities($aParamValues['auth_user'], ENT_QUOTES, 'UTF-8'))); // Default language @@ -1190,9 +1232,9 @@ function DisplaySummary(SetupWebPage $oP, $aParamValues, $iCurrentStep, Config $ $oP->add("\n"); AddParamsToForm($oP, $aParamValues); $oP->add("\n"); - $oP->add("\n"); + $oP->add("\n"); // Note: the Next >> button is NOT a submit, since moving to the next page is triggered asynchronously - $oP->add("\n"); + $oP->add("\n"); $oP->add("
\n"); $oP->add("\n"); break; @@ -1289,6 +1331,9 @@ function DisplaySummary(SetupWebPage $oP, $aParamValues, $iCurrentStep, Config $ $sSampleData = 'No sample data will be loaded.'; } $oP->collapsible('sample_data', "Sample Data", array($sSampleData)); + + // Application Path + $oP->collapsible('application_path', "Application path", array('URL:'.htmlentities($aParamValues['application_path'], ENT_QUOTES, 'UTF-8'))); $oP->add(''); $oP->add("
\n"); @@ -1453,7 +1498,7 @@ ini_set('max_execution_time', max(240, ini_get('max_execution_time'))); ini_set('display_errors', true); ini_set('display_startup_errors', true); -$aParams = array('mode', 'previous_step', 'licence_ok', 'db_server', 'db_user', 'db_pwd','db_name', 'new_db_name', 'db_prefix', 'module', 'sample_data', 'auth_user', 'auth_pwd', 'language'); +$aParams = array('mode', 'previous_step', 'licence_ok', 'db_server', 'db_user', 'db_pwd','db_name', 'new_db_name', 'db_prefix', 'module', 'sample_data', 'auth_user', 'auth_pwd', 'language', 'application_path'); foreach($aParams as $sName) { $aParamValues[$sName] = utils::ReadParam($sName, ''); @@ -1547,18 +1592,24 @@ try case 'step6': $oP->no_cache(); $oP->log("Info - ========= Wizard step 6 ========"); - SampleDataSelection($oP, $aParamValues, 6, $oConfig); + ApplicationPathSelection($oP, $aParamValues, 6, $oConfig); break; case 'step7': $oP->no_cache(); $oP->log("Info - ========= Wizard step 7 ========"); - DisplaySummary($oP, $aParamValues, 7, $oConfig); + SampleDataSelection($oP, $aParamValues, 6, $oConfig); break; - + case 'step8': $oP->no_cache(); $oP->log("Info - ========= Wizard step 8 ========"); + DisplaySummary($oP, $aParamValues, 7, $oConfig); + break; + + case 'step9': + $oP->no_cache(); + $oP->log("Info - ========= Wizard step 9 ========"); SetupFinished($oP, $aParamValues, 8, $oConfig); break; diff --git a/setup/setup.js b/setup/setup.js index 49e2a1c30..1373fef0c 100644 --- a/setup/setup.js +++ b/setup/setup.js @@ -103,10 +103,29 @@ function DoSubmit(sMsg, iStep) } break; - case 6: // Sample data selection + case 6: // application path + var appPath = new String($('#application_path').val()); + if (appPath == '') + { + alert('Please specify the URL to the application'); + bResult = false; + } + else + { + var bMatch = appPath.match(/^http(?:s)?\:\/\//); + if (!bMatch) + { + alert('"'+appPath+'" does not look like a valid URL for the application...\nPlease check your input.'); + bResult = false; + } + } + break; - - case 7: // Display Summary: launch DoUpdateDBSchema to start the asynchronous update + + case 7: // Sample data selection + break; + + case 8: // Display Summary: launch DoUpdateDBSchema to start the asynchronous update bResult = DoUpdateDBSchema(); break;