mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-17 14:28:53 +02:00
- First version of the setup wizard (fully operational)
SVN:code[17]
This commit is contained in:
241
setup/index.php
241
setup/index.php
@@ -13,15 +13,15 @@ define(MYSQL_MIN_VERSION, '5.0.0');
|
||||
|
||||
$sOperation = Utils::ReadParam('operation', 'step1');
|
||||
$oP = new setup_web_page('iTop configuration wizard');
|
||||
$oP->no_cache();
|
||||
|
||||
/**
|
||||
* Helper function to check if the current version of PHP
|
||||
* is compatible with the application
|
||||
* @return boolean true if this is Ok, false otherwise
|
||||
*/
|
||||
function CheckPHPVersion(nice_web_page $oP)
|
||||
function CheckPHPVersion(setup_web_page $oP)
|
||||
{
|
||||
$oP->log('Info - CheckPHPVersion');
|
||||
if (version_compare(phpversion(), PHP_MIN_VERSION, '>='))
|
||||
{
|
||||
$oP->ok("The current PHP Version (".phpversion().") is greater than the minimum required version (".PHP_MIN_VERSION.")");
|
||||
@@ -31,13 +31,30 @@ function CheckPHPVersion(nice_web_page $oP)
|
||||
$oP->error("Error: The current PHP Version (".phpversion().") is lower than the minimum required version (".PHP_MIN_VERSION.")");
|
||||
return false;
|
||||
}
|
||||
if (extension_loaded('mysql'))
|
||||
$aMandatoryExtensions = array('mysql', 'iconv', 'simplexml');
|
||||
asort($aMandatoryExtensions); // Sort the list to look clean !
|
||||
$aExtensionsOk = array();
|
||||
$aMissingExtensions = array();
|
||||
$aMissingExtensionsLinks = array();
|
||||
foreach($aMandatoryExtensions as $sExtension)
|
||||
{
|
||||
$oP->ok("The required extension 'mysql' is present.");
|
||||
if (extension_loaded($sExtension))
|
||||
{
|
||||
$aExtensionsOk[] = $sExtension;
|
||||
}
|
||||
else
|
||||
{
|
||||
$aMissingExtensions[] = $sExtension;
|
||||
$aMissingExtensionsLinks[] = "<a href=\"http://www.php.net/manual/en/book.$sExtension.php\">$sExtension</a>";
|
||||
}
|
||||
}
|
||||
else
|
||||
if (count($aExtensionsOk) > 0)
|
||||
{
|
||||
$oP->error("Error: missing required extension 'mysql'.");
|
||||
$oP->ok("Required PHP extension(s): ".implode(', ', $aExtensionsOk).".");
|
||||
}
|
||||
if (count($aMissingExtensions) > 0)
|
||||
{
|
||||
$oP->error("Missing PHP extension(s): ".implode(', ', $aMissingExtensionsLinks).".");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -48,9 +65,10 @@ function CheckPHPVersion(nice_web_page $oP)
|
||||
* the existing databases
|
||||
* @return Array The list of databases found in the server
|
||||
*/
|
||||
function CheckServerConnection(nice_web_page $oP, $sDBServer, $sDBUser, $sDBPwd)
|
||||
function CheckServerConnection(setup_web_page $oP, $sDBServer, $sDBUser, $sDBPwd)
|
||||
{
|
||||
$aResult = array();
|
||||
$oP->log('Info - CheckServerConnection');
|
||||
try
|
||||
{
|
||||
$oDBSource = new CMDBSource;
|
||||
@@ -66,7 +84,15 @@ function CheckServerConnection(nice_web_page $oP, $sDBServer, $sDBUser, $sDBPwd)
|
||||
$oP->error("Error: Current MySQL version is ($sDBVersion), minimum required version (".MYSQL_MIN_VERSION.")");
|
||||
return false;
|
||||
}
|
||||
$aResult = $oDBSource->ListDB();
|
||||
try
|
||||
{
|
||||
$aResult = $oDBSource->ListDB();
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$oP->warning("Warning: unable to enumerate the current databases.");
|
||||
$aResult = true; // Not an array to differentiate with an empty array
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
@@ -76,14 +102,16 @@ function CheckServerConnection(nice_web_page $oP, $sDBServer, $sDBUser, $sDBPwd)
|
||||
}
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper function to create the database structure
|
||||
* @return boolean true on success, false otherwise
|
||||
*/
|
||||
function CreateDatabaseStructure(nice_web_page $oP, Config $oConfig, $sDBName, $sDBPrefix)
|
||||
* Helper function to initialize the ORM and load the data model
|
||||
* from the given file
|
||||
* @param $sConfigFileName string The name of the configuration file to load
|
||||
* @param $bAllowMissingDatabase boolean Whether or not to allow loading a data model with no corresponding DB
|
||||
* @return none
|
||||
*/
|
||||
function InitDataModel(setup_web_page $oP, $sConfigFileName, $bAllowMissingDatabase = true)
|
||||
{
|
||||
$oP->info("Creating the structure in '$sDBName' (prefix = '$sDBPrefix').");
|
||||
require_once('../core/coreexception.class.inc.php');
|
||||
require_once('../core/attributedef.class.inc.php');
|
||||
require_once('../core/filterdef.class.inc.php');
|
||||
@@ -96,7 +124,18 @@ function CreateDatabaseStructure(nice_web_page $oP, Config $oConfig, $sDBName, $
|
||||
require_once('../core/dbobjectsearch.class.php');
|
||||
require_once('../core/dbobjectset.class.php');
|
||||
require_once('../core/userrights.class.inc.php');
|
||||
MetaModel::Startup(TMP_CONFIG_FILE, true); // allow missing DB
|
||||
$oP->log("Info - MetaModel::Startup from file '$sConfigFileName' (AllowMissingDB = $bAllowMissingDatabase)");
|
||||
MetaModel::Startup($sConfigFileName, $bAllowMissingDatabase);
|
||||
}
|
||||
/**
|
||||
* Helper function to create the database structure
|
||||
* @return boolean true on success, false otherwise
|
||||
*/
|
||||
function CreateDatabaseStructure(setup_web_page $oP, Config $oConfig, $sDBName, $sDBPrefix)
|
||||
{
|
||||
InitDataModel($oP, TMP_CONFIG_FILE, true); // Allow the DB to NOT exist since we're about to create it !
|
||||
$oP->log('Info - CreateDatabaseStructure');
|
||||
$oP->info("Creating the structure in '$sDBName' (prefix = '$sDBPrefix').");
|
||||
//MetaModel::CheckDefinitions();
|
||||
if (!MetaModel::DBExists())
|
||||
{
|
||||
@@ -106,6 +145,8 @@ function CreateDatabaseStructure(nice_web_page $oP, Config $oConfig, $sDBName, $
|
||||
else
|
||||
{
|
||||
$oP->error("Error: database '$sDBName' (prefix = '$sDBPrefix') already exists.");
|
||||
$oP->p("Tables with conflicting names already exist in the database.
|
||||
Try selecting another database instance or specifiy a prefix to prevent conflicting table names.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -115,21 +156,10 @@ function CreateDatabaseStructure(nice_web_page $oP, Config $oConfig, $sDBName, $
|
||||
* Helper function to create and administrator account for iTop
|
||||
* @return boolean true on success, false otherwise
|
||||
*/
|
||||
function CreateAdminAccount(nice_web_page $oP, Config $oConfig, $sAdminUser, $sAdminPwd)
|
||||
function CreateAdminAccount(setup_web_page $oP, Config $oConfig, $sAdminUser, $sAdminPwd)
|
||||
{
|
||||
require_once('../core/coreexception.class.inc.php');
|
||||
require_once('../core/attributedef.class.inc.php');
|
||||
require_once('../core/filterdef.class.inc.php');
|
||||
require_once('../core/stimulus.class.inc.php');
|
||||
require_once('../core/MyHelpers.class.inc.php');
|
||||
require_once('../core/expression.class.inc.php');
|
||||
require_once('../core/cmdbsource.class.inc.php');
|
||||
require_once('../core/sqlquery.class.inc.php');
|
||||
require_once('../core/dbobject.class.php');
|
||||
require_once('../core/dbobjectsearch.class.php');
|
||||
require_once('../core/dbobjectset.class.php');
|
||||
require_once('../core/userrights.class.inc.php');
|
||||
MetaModel::Startup(TMP_CONFIG_FILE, true); // allow missing DB
|
||||
$oP->log('Info - CreateAdminAccount');
|
||||
InitDataModel($oP, TMP_CONFIG_FILE, true); // allow missing DB
|
||||
if (UserRights::CreateAdministrator($sAdminUser, $sAdminPwd))
|
||||
{
|
||||
$oP->ok("Administrator account '$sAdminUser' created.");
|
||||
@@ -143,35 +173,82 @@ function CreateAdminAccount(nice_web_page $oP, Config $oConfig, $sAdminUser, $sA
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to load some sample data into the database
|
||||
* Helper function to load the standard menus into the database
|
||||
*/
|
||||
function LoadSampleData(nice_web_page $oP)
|
||||
function LoadStandardMenus(setup_web_page $oP)
|
||||
{
|
||||
// TO BE IMPLEMENTED
|
||||
$oP->log('Info - LoadStandardMenus');
|
||||
|
||||
$oXml = simplexml_load_file('menus.xml');
|
||||
$aReplicas = array();
|
||||
foreach($oXml as $oXmlMenu)
|
||||
{
|
||||
$iPreviousId = (integer)$oXmlMenu['id']; // Mandatory to cast
|
||||
$iParentId = (integer)$oXmlMenu->parent_id; // Mandatory to cast
|
||||
// echo "<p>PreviousId = $iPreviousId; parent_id: $iParentId</p>\n";
|
||||
$oMenuNode = MetaModel::NewObject('menuNode');
|
||||
$oMenuNode->Set('name', $oXmlMenu->name);
|
||||
$oMenuNode->Set('label', $oXmlMenu->label);
|
||||
$oMenuNode->Set('hyperlink', $oXmlMenu->hyperlink);
|
||||
$oMenuNode->Set('template', $oXmlMenu->template);
|
||||
$oMenuNode->Set('rank', $oXmlMenu->rank);
|
||||
$oMenuNode->DBInsert();
|
||||
$iDstId = $oMenuNode->GetKey();
|
||||
$aReplicas[$iPreviousId] = array('dstObj' => $oMenuNode, 'parentId' => $iParentId);
|
||||
}
|
||||
|
||||
foreach($aReplicas as $iKey => $aReplica)
|
||||
{
|
||||
$iSrcParentId = $aReplica['parentId'];
|
||||
if ($iSrcParentId != 0)
|
||||
{
|
||||
if (isset($aReplicas[$iSrcParentId]))
|
||||
{
|
||||
$oParentMenu = $aReplicas[$iSrcParentId]['dstObj'];
|
||||
$oMenu = $aReplica['dstObj'];
|
||||
$oMenu->Set('parent_id', $oParentMenu->GetKey());
|
||||
$oMenu->DBUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oP->ok("Standard menus have been created successfully.");
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to load sample data into the database
|
||||
*/
|
||||
function LoadSampleData(setup_web_page $oP)
|
||||
{
|
||||
$oP->log('Info - LoadSampleData');
|
||||
|
||||
$oP->ok("Sample data loaded into the database.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Display the form for the first step of the configuration wizard
|
||||
* which consists in the database server selection
|
||||
*/
|
||||
function DisplayStep1(nice_web_page $oP)
|
||||
function DisplayStep1(setup_web_page $oP)
|
||||
{
|
||||
$sNextOperation = 'step2';
|
||||
$oP->add("<h1>iTop configuration wizard</h1>\n");
|
||||
$oP->add("<h2>Checking prerequisites</h2>\n");
|
||||
if (CheckPHPVersion($oP))
|
||||
{
|
||||
$sRedStar = '<span class="hilite">*</span>';
|
||||
$oP->add("<h2>Step 1: Configuration of the database connection</h2>\n");
|
||||
$oP->add("<form method=\"post\">\n");
|
||||
$oP->add("<form method=\"get\" onSubmit=\"return DoSubmit('Connection to the database...', 1)\">\n");
|
||||
// Form goes here
|
||||
$oP->add("<fieldset><legend>Database connection</legend>\n");
|
||||
$aForm = array();
|
||||
$aForm[] = array('label' => 'Server name:', 'input' => "<input type=\"text\" name=\"db_server\" value=\"\">",
|
||||
$aForm[] = array('label' => "Server name$sRedStar:", 'input' => "<input id=\"db_server\" type=\"text\" name=\"db_server\" value=\"\">",
|
||||
'help' => 'E.g. "localhost", "dbserver.mycompany.com" or "192.142.10.23".');
|
||||
$aForm[] = array('label' => 'User name:', 'input' => "<input type=\"text\" name=\"db_user\" value=\"\">");
|
||||
$aForm[] = array('label' => 'Password:', 'input' => "<input type=\"password\" name=\"db_pwd\" value=\"\">");
|
||||
$aForm[] = array('label' => "User name$sRedStar:", 'input' => "<input id=\"db_user\" type=\"text\" name=\"db_user\" value=\"\">");
|
||||
$aForm[] = array('label' => 'Password:', 'input' => "<input id=\"db_pwd\" type=\"password\" name=\"db_pwd\" value=\"\">");
|
||||
$oP->form($aForm);
|
||||
$oP->add("</fieldset>\n");
|
||||
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"$sNextOperation\">\n");
|
||||
@@ -186,12 +263,12 @@ function DisplayStep1(nice_web_page $oP)
|
||||
* 1) Validating the parameters by connecting to the database server
|
||||
* 2) Prompting to select an existing database or to create a new one
|
||||
*/
|
||||
function DisplayStep2(nice_web_page $oP, Config $oConfig, $sDBServer, $sDBUser, $sDBPwd)
|
||||
function DisplayStep2(setup_web_page $oP, Config $oConfig, $sDBServer, $sDBUser, $sDBPwd)
|
||||
{
|
||||
$sNextOperation = 'step3';
|
||||
$oP->add("<h1>iTop configuration wizard</h1>\n");
|
||||
$oP->add("<h2>Step 2: Database selection</h2>\n");
|
||||
$oP->add("<form method=\"post\">\n");
|
||||
$oP->add("<form method=\"post\" onSubmit=\"return DoSubmit('Creating database structure...', 2);\">\n");
|
||||
$aDatabases = CheckServerConnection($oP, $sDBServer, $sDBUser, $sDBPwd);
|
||||
if ($aDatabases === false)
|
||||
{
|
||||
@@ -206,18 +283,27 @@ function DisplayStep2(nice_web_page $oP, Config $oConfig, $sDBServer, $sDBUser,
|
||||
$oConfig->SetDBPwd($sDBPwd);
|
||||
$oConfig->WriteToFile();
|
||||
|
||||
$oP->add("<fieldset><legend>Specify a database</legend>\n");
|
||||
$oP->add("<fieldset><legend>Specify a database<span class=\"hilite\">*</span></legend>\n");
|
||||
$aForm = array();
|
||||
foreach($aDatabases as $sDBName)
|
||||
if (is_array($aDatabases))
|
||||
{
|
||||
$aForm[] = array('label' => "<input type=\"radio\" name=\"db_name\" value=\"$sDBName\" /> $sDBName");
|
||||
foreach($aDatabases as $sDBName)
|
||||
{
|
||||
$aForm[] = array('label' => "<input id=\"db_$sDBName\" type=\"radio\" name=\"db_name\" value=\"$sDBName\" /><label for=\"db_$sDBName\"> $sDBName</label>");
|
||||
}
|
||||
}
|
||||
$aForm[] = array('label' => "<input type=\"radio\" name=\"db_name\" value=\"\" /> create a new database: <input type=\"text\" name=\"new_db_name\" value=\"\" />");
|
||||
else
|
||||
{
|
||||
$aForm[] = array('label' => "<input id=\"current_db\" type=\"radio\" name=\"db_name\" value=\"-1\" /><label for=\"current_db\"> Use the existing database: <input type=\"text\" id=\"current_db_name\" name=\"current_db_name\" value=\"\" maxlength=\"32\"/></label>");
|
||||
$oP->add_ready_script("$('#current_db_name').click( function() { $('#current_db').attr('checked', true); });");
|
||||
}
|
||||
$aForm[] = array('label' => "<input id=\"new_db\" type=\"radio\" name=\"db_name\" value=\"\" /><label for=\"new_db\"> Create a new database: <input type=\"text\" id=\"new_db_name\" name=\"new_db_name\" value=\"\" maxlength=\"32\"/></label>");
|
||||
$oP->form($aForm);
|
||||
|
||||
$oP->add_ready_script("$('#new_db_name').click( function() { $('#new_db').attr('checked', true); });");
|
||||
$oP->add("</fieldset>\n");
|
||||
$aForm = array();
|
||||
$aForm[] = array('label' => "Add a prefix to all the tables: <input type=\"text\" name=\"db_prefix\" value=\"\" />");
|
||||
$aForm[] = array('label' => "Add a prefix to all the tables: <input id=\"db_prefix\" type=\"text\" name=\"db_prefix\" value=\"\" maxlength=\"32\"/>");
|
||||
$oP->form($aForm);
|
||||
|
||||
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"$sNextOperation\">\n");
|
||||
@@ -235,24 +321,25 @@ function DisplayStep2(nice_web_page $oP, Config $oConfig, $sDBServer, $sDBUser,
|
||||
* 2) Creating the database structure
|
||||
* 3) Prompting for the admin account to be created
|
||||
*/
|
||||
function DisplayStep3(nice_web_page $oP, Config $oConfig, $sDBName, $sDBPrefix)
|
||||
function DisplayStep3(setup_web_page $oP, Config $oConfig, $sDBName, $sDBPrefix)
|
||||
{
|
||||
$sNextOperation = 'step4';
|
||||
$oP->add("<h1>iTop configuration wizard</h1>\n");
|
||||
$oP->add("<h2>Creation of the database structure</h2>\n");
|
||||
$oP->add("<form method=\"post\">\n");
|
||||
$oP->add("<form method=\"post\" onSubmit=\"return DoSubmit('Creating user and profiles...', 3);\">\n");
|
||||
$oConfig->SetDBName($sDBName);
|
||||
$oConfig->SetDBSubname($sDBPrefix);
|
||||
$oConfig->WriteToFile(TMP_CONFIG_FILE);
|
||||
if (CreateDatabaseStructure($oP, $oConfig, $sDBName, $sDBPrefix))
|
||||
{
|
||||
$sRedStar = "<span class=\"hilite\">*</span>";
|
||||
$oP->add("<h2>Step 3: Definition of the administrator account</h2>\n");
|
||||
// Database created, continue with admin creation
|
||||
$oP->add("<fieldset><legend>Administrator account</legend>\n");
|
||||
$aForm = array();
|
||||
$aForm[] = array('label' => "Login:", 'input' => "<input type=\"text\" name=\"auth_user\" value=\"\">");
|
||||
$aForm[] = array('label' => "Password:", 'input' => "<input type=\"password\" name=\"auth_pwd\" value=\"\">");
|
||||
$aForm[] = array('label' => "Retype password:", 'input' => "<input type=\"password\" name=\"auth_pwd2\" value=\"\">");
|
||||
$aForm[] = array('label' => "Login$sRedStar:", 'input' => "<input id=\"auth_user\" type=\"text\" name=\"auth_user\" value=\"\">");
|
||||
$aForm[] = array('label' => "Password$sRedStar:", 'input' => "<input id=\"auth_pwd\" type=\"password\" name=\"auth_pwd\" value=\"\">");
|
||||
$aForm[] = array('label' => "Retype password$sRedStar:", 'input' => "<input id=\"auth_pwd2\" type=\"password\" name=\"auth_pwd2\" value=\"\">");
|
||||
$oP->form($aForm);
|
||||
$oP->add("</fieldset>\n");
|
||||
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"$sNextOperation\">\n");
|
||||
@@ -274,13 +361,13 @@ function DisplayStep3(nice_web_page $oP, Config $oConfig, $sDBName, $sDBPrefix)
|
||||
* 1) Creating the admin user account
|
||||
* 2) Prompting to load some sample data
|
||||
*/
|
||||
function DisplayStep4(nice_web_page $oP, Config $oConfig, $sAdminUser, $sAdminPwd)
|
||||
function DisplayStep4(setup_web_page $oP, Config $oConfig, $sAdminUser, $sAdminPwd)
|
||||
{
|
||||
$sNextOperation = 'step5';
|
||||
$oP->add("<h1>iTop configuration wizard</h1>\n");
|
||||
$oP->add("<h2>Creation of the administrator account</h2>\n");
|
||||
|
||||
$oP->add("<form method=\"post\">\n");
|
||||
$oP->add("<form method=\"post\" onSubmit=\"return DoSubmit('Finalizing configuration and loading data...', 4);\">\n");
|
||||
if (CreateAdminAccount($oP, $oConfig, $sAdminUser, $sAdminPwd))
|
||||
{
|
||||
$oP->add("<h2>Step 4: Loading of sample data</h2>\n");
|
||||
@@ -309,7 +396,7 @@ function DisplayStep4(nice_web_page $oP, Config $oConfig, $sAdminUser, $sAdminPw
|
||||
* 1) Creating the final configuration file
|
||||
* 2) Prompting the user to make the file read-only
|
||||
*/
|
||||
function DisplayStep5(nice_web_page $oP, Config $oConfig, $sAuthUser, $sAuthPwd, $bLoadSampleData)
|
||||
function DisplayStep5(setup_web_page $oP, Config $oConfig, $sAuthUser, $sAuthPwd, $bLoadSampleData)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -319,8 +406,7 @@ function DisplayStep5(nice_web_page $oP, Config $oConfig, $sAuthUser, $sAuthPwd,
|
||||
$oConfig->WriteToFile(FINAL_CONFIG_FILE);
|
||||
|
||||
// Start the application
|
||||
require_once('../application/application.inc.php');
|
||||
require_once('../application/startup.inc.php');
|
||||
InitDataModel($oP, FINAL_CONFIG_FILE, false); // DO NOT allow missing DB
|
||||
if (UserRights::Login($sAuthUser, $sAuthPwd))
|
||||
{
|
||||
$_SESSION['auth_user'] = $sAuthUser;
|
||||
@@ -328,11 +414,12 @@ function DisplayStep5(nice_web_page $oP, Config $oConfig, $sAuthUser, $sAuthPwd,
|
||||
// remove the tmp config file
|
||||
@unlink(TMP_CONFIG_FILE);
|
||||
// try to make the final config file read-only
|
||||
@chmod(FINAL_CONFIG_FILE, "a-w");
|
||||
@chmod(FINAL_CONFIG_FILE, 0440); // Read-only for owner and group, nothing for others
|
||||
|
||||
$oP->add("<h1>iTop configuration wizard</h1>\n");
|
||||
$oP->add("<h2>Configuration completed</h2>\n");
|
||||
$oP->add("<form method=\"get\" action=\"../index.php\">\n");
|
||||
LoadStandardMenus($oP);
|
||||
if ($bLoadSampleData)
|
||||
{
|
||||
LoadSampleData($oP);
|
||||
@@ -367,6 +454,39 @@ function DisplayStep5(nice_web_page $oP, Config $oConfig, $sAuthUser, $sAuthPwd,
|
||||
/**
|
||||
* Main program
|
||||
*/
|
||||
clearstatcache(); // Make sure we know what we are doing !
|
||||
if (file_exists(FINAL_CONFIG_FILE))
|
||||
{
|
||||
// The configuration file already exists
|
||||
if (is_writable(FINAL_CONFIG_FILE))
|
||||
{
|
||||
$oP->warning("<b>Warning:</b> a configuration file '".FINAL_CONFIG_FILE."' already exists, and will be overwritten.");
|
||||
}
|
||||
else
|
||||
{
|
||||
$oP->add("<h1>iTop configuration wizard</h1>\n");
|
||||
$oP->add("<h2>Fatal error</h2>\n");
|
||||
$oP->error("<b>Error:</b> the configuration file '".FINAL_CONFIG_FILE."' already exists and cannot be overwritten.");
|
||||
$oP->p("The wizard cannot create the configuration file for you. Please remove the file '<b>".realpath(FINAL_CONFIG_FILE)."</b>' or change its access-rights/read-only flag before continuing.");
|
||||
$oP->output();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No configuration file yet
|
||||
// Check that the wizard can write into the root dir to create the configuration file
|
||||
if (!is_writable(dirname(FINAL_CONFIG_FILE)))
|
||||
{
|
||||
$oP->add("<h1>iTop configuration wizard</h1>\n");
|
||||
$oP->add("<h2>Fatal error</h2>\n");
|
||||
$oP->error("<b>Error:</b> the directory where to store the configuration file is not writable.");
|
||||
$oP->p("The wizard cannot create the configuration file for you. Please make sure that the directory '<b>".realpath(dirname(FINAL_CONFIG_FILE))."</b>' is writable for the web server.");
|
||||
$oP->output();
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
try
|
||||
{
|
||||
$oConfig = new Config(TMP_CONFIG_FILE);
|
||||
@@ -379,10 +499,13 @@ catch(Exception $e)
|
||||
switch($sOperation)
|
||||
{
|
||||
case 'step1':
|
||||
$oP->log("Info - ========= Wizard step 1 ========");
|
||||
DisplayStep1($oP);
|
||||
break;
|
||||
|
||||
case 'step2':
|
||||
$oP->no_cache();
|
||||
$oP->log("Info - ========= Wizard step 2 ========");
|
||||
$sDBServer = Utils::ReadParam('db_server');
|
||||
$sDBUser = Utils::ReadParam('db_user');
|
||||
$sDBPwd = Utils::ReadParam('db_pwd');
|
||||
@@ -390,6 +513,8 @@ switch($sOperation)
|
||||
break;
|
||||
|
||||
case 'step3':
|
||||
$oP->no_cache();
|
||||
$oP->log("Info - ========= Wizard step 3 ========");
|
||||
$sDBName = Utils::ReadParam('db_name');
|
||||
if (empty($sDBName))
|
||||
{
|
||||
@@ -400,12 +525,16 @@ switch($sOperation)
|
||||
break;
|
||||
|
||||
case 'step4':
|
||||
$oP->no_cache();
|
||||
$oP->log("Info - ========= Wizard step 4 ========");
|
||||
$sAdminUser = Utils::ReadParam('auth_user');
|
||||
$sAdminPwd = Utils::ReadParam('auth_pwd');
|
||||
DisplayStep4($oP, $oConfig, $sAdminUser, $sAdminPwd);
|
||||
break;
|
||||
|
||||
case 'step5':
|
||||
$oP->no_cache();
|
||||
$oP->log("Info - ========= Wizard step 5 ========");
|
||||
$bLoadSampleData = (Utils::ReadParam('sample_data', 'no') == 'yes');
|
||||
$sAdminUser = Utils::ReadParam('auth_user');
|
||||
$sAdminPwd = Utils::ReadParam('auth_pwd');
|
||||
|
||||
615
setup/menus.xml
Normal file
615
setup/menus.xml
Normal file
@@ -0,0 +1,615 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Set>
|
||||
<menuNode id="17">
|
||||
<parent_id>0</parent_id>
|
||||
<name>Admin Tools</name>
|
||||
<label>iTop consultant tools</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:32px;">Tools for the iTop consultant</p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:14px;"><i>This section contains links to useful tools for extending or debugging iTop</i></p>
|
||||
|
||||
|
||||
</template>
|
||||
<rank>7</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="59">
|
||||
<parent_id>5</parent_id>
|
||||
<name>All Applications</name>
|
||||
<label>All Applications</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizApplication" type="search" asynchronous="false" encoding="text/sibusql">bizApplication</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:24px;">All Applications</p>
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizApplication" type="list" asynchronous="false" encoding="text/sibusql">bizApplication</itopblock>
|
||||
</div>
|
||||
</template>
|
||||
<rank>999</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="47">
|
||||
<parent_id>5</parent_id>
|
||||
<name>All Circuits</name>
|
||||
<label>All Circuits</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizCircuit" type="search" asynchronous="false" encoding="text/sibusql">bizCircuit</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:24px;">All Circuits</p>
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizCircuit" type="list" asynchronous="false" encoding="text/sibusql">bizCircuit</itopblock>
|
||||
</div>
|
||||
</template>
|
||||
<rank>999</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="75">
|
||||
<parent_id>64</parent_id>
|
||||
<name>All Contracts</name>
|
||||
<label>All Contracts</label>
|
||||
<hyperlink>./UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizContract</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizContract</itopblock>
|
||||
</div></template>
|
||||
<rank>2</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="48">
|
||||
<parent_id>5</parent_id>
|
||||
<name>All Interfaces</name>
|
||||
<label>All Interfaces</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizInterface</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:24px;">All Interfaces</p>
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizInterface</itopblock>
|
||||
</div>
|
||||
</template>
|
||||
<rank>999</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="46">
|
||||
<parent_id>5</parent_id>
|
||||
<name>All Network devices</name>
|
||||
<label>All Network devices</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizNetworkDevice" type="search" asynchronous="false" encoding="text/sibusql">bizNetworkDevice</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:24px;">All Network Devices</p>
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizNetworkDevice" type="list" asynchronous="false" encoding="text/sibusql">bizNetworkDevice</itopblock>
|
||||
</div>
|
||||
</template>
|
||||
<rank>999</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="60">
|
||||
<parent_id>5</parent_id>
|
||||
<name>All Patches</name>
|
||||
<label>All Patches</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizPatch" type="search" asynchronous="false" encoding="text/sibusql">bizPatch</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:24px;">All Patches</p>
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizPatch" type="list" asynchronous="false" encoding="text/sibusql">bizPatch</itopblock>
|
||||
</div>
|
||||
</template>
|
||||
<rank>999</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="6">
|
||||
<parent_id>5</parent_id>
|
||||
<name>All PCs</name>
|
||||
<label>All PCs</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizPC</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:24px;">All PCs</p>
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizPC</itopblock>
|
||||
</div>
|
||||
</template>
|
||||
<rank>999</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="45">
|
||||
<parent_id>5</parent_id>
|
||||
<name>All Servers</name>
|
||||
<label>All Servers</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizServer</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:24px;">All Servers</p>
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizServer</itopblock>
|
||||
</div>
|
||||
</template>
|
||||
<rank>999</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="58">
|
||||
<parent_id>1</parent_id>
|
||||
<name>Audit</name>
|
||||
<label>Audit</label>
|
||||
<hyperlink>/pages/audit.php</hyperlink>
|
||||
<template></template>
|
||||
<rank>4</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="44">
|
||||
<parent_id>17</parent_id>
|
||||
<name>Backup & Restore</name>
|
||||
<label>Backup & Restore the whole database</label>
|
||||
<hyperlink>./db_importer.php</hyperlink>
|
||||
<template></template>
|
||||
<rank>998</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="66">
|
||||
<parent_id>0</parent_id>
|
||||
<name>Change Management</name>
|
||||
<label>Change Management</label>
|
||||
<hyperlink>./UI.php</hyperlink>
|
||||
<template><img src="/images/imageChange.gif" style="float:right">
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:24px;">Changes Overview</p>
|
||||
<table border="0" padding="5" class="layout">
|
||||
<tr>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Change by type</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizChangeTicket" type="pie_chart" parameters="group_by:type" asynchronous="false" encoding="text/oql">SELECT bizChangeTicket</itopblock>
|
||||
</td>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Changes by status</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizChangeTicket" type="pie_chart" parameters="group_by:ticket_status;chart_title:Incidents by status" asynchronous="false" encoding="text/oql">SELECT bizChangeTicket</itopblock>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Changes by Workgroup</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizChangeTicket" type="count" parameters="group_by:workgroup_name" asynchronous="false" encoding="text/sibusql">bizChangeTicket</itopblock>
|
||||
</td>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Changes not yet assigned</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizChangeTicket" type="list" parameters="dashboard:true" asynchronous="false" encoding="text/sibusql">bizChangeTicket: ticket_status = 'New'</itopblock>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</template>
|
||||
<rank>4</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="74">
|
||||
<parent_id>66</parent_id>
|
||||
<name>Closed Changes</name>
|
||||
<label>Closed Changes</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizChangeTicket: ticket_status = 'Closed'</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizChangeTicket: ticket_status = 'Closed'</itopblock>
|
||||
</div></template>
|
||||
<rank>2</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="63">
|
||||
<parent_id>61</parent_id>
|
||||
<name>Closed Incident</name>
|
||||
<label>List of closed ticket</label>
|
||||
<hyperlink>./UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizIncidentTicket: ticket_status Contains 'Open' AND severity Contains 'critical'</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizIncidentTicket: ticket_status = 'Closed'</itopblock>
|
||||
</div></template>
|
||||
<rank>2</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="5">
|
||||
<parent_id>1</parent_id>
|
||||
<name>Configuration Items</name>
|
||||
<label>All about devices</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><p></p>
|
||||
<p></p>
|
||||
<p style="text-align:left; font-family:Georgia, 'Times New Roman', Times, serif; font-size:40px;"><img src="/images/devices_big.gif" align="baseline">Devices Overview</p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<table border="0" padding="5" class="layout">
|
||||
<tr>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Georgia, 'Times New Roman', Times, serif; font-size:18px;">Servers</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizServer" type="pie_chart" parameters="group_by:severity" asynchronous="false" encoding="text/oql">SELECT bizServer</itopblock>
|
||||
</td>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Georgia, 'Times New Roman', Times, serif; font-size:18px;">PCs</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizPC" type="pie_chart" parameters="group_by:severity" asynchronous="false" encoding="text/oql">SELECT bizPC</itopblock>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Georgia, 'Times New Roman', Times, serif; font-size:18px;">Netword Devices</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizNetworDevice type="pie_chart" parameters="group_by:severity" asynchronous="false" encoding="text/oql">SELECT bizNetworkDevice</itopblock>
|
||||
</td>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Georgia, 'Times New Roman', Times, serif; font-size:18px;">Applications</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizApplication" type="pie_chart" parameters="group_by:severity" asynchronous="false" encoding="text/oql">SELECT bizApplication</itopblock>
|
||||
</td>
|
||||
</tr>
|
||||
</table></template>
|
||||
<rank>2</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="1">
|
||||
<parent_id>0</parent_id>
|
||||
<name>Configuration Management</name>
|
||||
<label>Configuration Management</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><style>
|
||||
td.dashboard {
|
||||
vertical-align:top;
|
||||
text-align: center;
|
||||
border: 1px solid #ccc;
|
||||
-moz-border-radius: 10px;
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:24px;">Infrastructure Overview</p>
|
||||
<table border="0" padding="5" class="layout">
|
||||
<tr>
|
||||
<td class="dashboard">
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="logInfra" type="open_flash_chart" parameters="chart_type:pie;group_by:status;chart_title:Infrastructure Objects by status" asynchronous="false" encoding="text/oql">SELECT logInfra</itopblock>
|
||||
</td>
|
||||
<td class="dashboard">
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="logInfra" type="open_flash_chart" parameters="chart_type:bars;group_by:finalclass;chart_title:Infrastructure Objects by type" asynchronous="false" encoding="text/oql">SELECT logInfra</itopblock>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td class="dashboard">
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Infrastructure Objects by type</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="logInfra" type="count" parameters="group_by:finalclass" asynchronous="false" encoding="text/sibusql">logInfra</itopblock>
|
||||
</td>
|
||||
<td>
|
||||
&nbsp;
|
||||
</td>
|
||||
</tr>
|
||||
</table></template>
|
||||
<rank>2</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="2">
|
||||
<parent_id>1</parent_id>
|
||||
<name>Contacts</name>
|
||||
<label>Everything about Contacts</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><img src="/images/users2-big.png" style="float:right">
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:24px;">Contacts Overview</p>
|
||||
<table border="0" padding="5" class="layout">
|
||||
<tr>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Contacts by Type</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="count" parameters="group_by:finalclass" asynchronous="false" encoding="text/sibusql">bizContact</itopblock>
|
||||
</td>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Contacts by Location</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="count" parameters="group_by:location_name" asynchronous="false" encoding="text/sibusql">bizContact</itopblock>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Contacts by status</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="count" parameters="group_by:status" asynchronous="false" encoding="text/sibusql">bizContact</itopblock>
|
||||
</td>
|
||||
</table></template>
|
||||
<rank>1</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="19">
|
||||
<parent_id>17</parent_id>
|
||||
<name>CSV import</name>
|
||||
<label>Bulk creation or update</label>
|
||||
<hyperlink>csvimport.php</hyperlink>
|
||||
<template></template>
|
||||
<rank>998</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="12">
|
||||
<parent_id>1</parent_id>
|
||||
<name>Document</name>
|
||||
<label>Any object of class 'Document'</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizDocument</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:24px;">All Documents</p>
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizDocument</itopblock>
|
||||
</div></template>
|
||||
<rank>6</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="50">
|
||||
<parent_id>17</parent_id>
|
||||
<name>Export</name>
|
||||
<label>Export any filter in HTML, CSV or XML</label>
|
||||
<hyperlink>./export.php</hyperlink>
|
||||
<template></template>
|
||||
<rank>1000</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="49">
|
||||
<parent_id>1</parent_id>
|
||||
<name>Grouping</name>
|
||||
<label>All Groups</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizInfraGroup" type="search" asynchronous="false" encoding="text/sibusql">bizInfraGroup</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:24px;">All Groups</p>
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="Infra Group" type="list" asynchronous="false" encoding="text/sibusql">bizInfraGroup</itopblock>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
<rank>3</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="61">
|
||||
<parent_id>0</parent_id>
|
||||
<name>Incident Management</name>
|
||||
<label>Incident Management</label>
|
||||
<hyperlink>./UI.php</hyperlink>
|
||||
<template><img src="/images/messagebox_warning.png" style="float:right">
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:24px;">Incidents Overview</p>
|
||||
<table border="0" padding="5" class="layout">
|
||||
<tr>
|
||||
<td>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizIncidentTicket" type="open_flash_chart" parameters="group_by:severity;chart_title:Incidents by Severity" asynchronous="false" encoding="text/oql">SELECT bizIncidentTicket</itopblock>
|
||||
</td>
|
||||
<td>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizIncidentTicket" type="open_flash_chart" parameters="group_by:ticket_status;chart_title:Incidents by status" asynchronous="false" encoding="text/oql">SELECT bizIncidentTicket</itopblock>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Incidents by Workgroup</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizIncidentTicket" type="count" parameters="group_by:workgroup_name" asynchronous="false" encoding="text/sibusql">bizIncidentTicket</itopblock>
|
||||
</td>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Incidents not yet assigned</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizIncidentTicket" type="list" parameters="dashboard:true" asynchronous="false" encoding="text/sibusql">bizIncidentTicket: ticket_status = 'New'</itopblock>
|
||||
</td>
|
||||
</tr>
|
||||
</table></template>
|
||||
<rank>3</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="72">
|
||||
<parent_id>61</parent_id>
|
||||
<name>Known Errors</name>
|
||||
<label>Known Errors</label>
|
||||
<hyperlink>./UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizKnownErrort" type="search" asynchronous="false" encoding="text/sibusql">bizKnownError</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizKnownError" type="list" asynchronous="false" encoding="text/sibusql">bizKnownError</itopblock>
|
||||
</div></template>
|
||||
<rank>999</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="9">
|
||||
<parent_id>1</parent_id>
|
||||
<name>Locations</name>
|
||||
<label>Any locations</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizLocation" type="search" asynchronous="false" encoding="text/sibusql">bizLocation</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:24px;">All Locations</p>
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizLocation" type="list" asynchronous="false" encoding="text/sibusql">bizLocation</itopblock>
|
||||
</div></template>
|
||||
<rank>5</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="57">
|
||||
<parent_id>0</parent_id>
|
||||
<name>My Bookmarks</name>
|
||||
<label>My Bookmarks</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><p></p>
|
||||
<p></p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:32px;">My bookmark</p>
|
||||
<p style="text-align:center; font-family:Georgia, 'Times New Roman', Times, serif; font-size:14px;"><i>This section contains my most favorite search</i></p>
|
||||
|
||||
|
||||
</template>
|
||||
<rank>7</rank>
|
||||
<type>user</type>
|
||||
</menuNode>
|
||||
<menuNode id="71">
|
||||
<parent_id>57</parent_id>
|
||||
<name>My Cisco Devices</name>
|
||||
<label></label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><div id="TopPane">
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizNetworkDevice: org_id = 3 AND brand Contains 'Cisco'</itopblock>
|
||||
</div>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizNetworkDevice: org_id = 3 AND brand Contains 'Cisco'</itopblock>
|
||||
</div></template>
|
||||
<rank>1</rank>
|
||||
<type>user</type>
|
||||
</menuNode>
|
||||
<menuNode id="69">
|
||||
<parent_id>57</parent_id>
|
||||
<name>My Client Server</name>
|
||||
<label>My Client Server</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><div id="TopPane">
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">lnkClientServer</itopblock>
|
||||
</div>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">lnkClientServer</itopblock>
|
||||
</div></template>
|
||||
<rank>1</rank>
|
||||
<type>user</type>
|
||||
</menuNode>
|
||||
<menuNode id="65">
|
||||
<parent_id>64</parent_id>
|
||||
<name>Negociating contracts</name>
|
||||
<label>Negociating contracts</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizContract: status = 'Negotiating'</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizContract: status = 'Negotiating'</itopblock>
|
||||
</div></template>
|
||||
<rank>1</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="18">
|
||||
<parent_id>17</parent_id>
|
||||
<name>Objects Schema</name>
|
||||
<label>Displays the schema of all the objects</label>
|
||||
<hyperlink>schema.php</hyperlink>
|
||||
<template></template>
|
||||
<rank>999</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="68">
|
||||
<parent_id>66</parent_id>
|
||||
<name>Open Changes</name>
|
||||
<label>Open Changes</label>
|
||||
<hyperlink>./UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizChangeTicket: ticket_status != 'Closed'</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizChangeTicket: ticket_status != 'Closed'</itopblock>
|
||||
</div></template>
|
||||
<rank>1</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="62">
|
||||
<parent_id>61</parent_id>
|
||||
<name>Open Incidents</name>
|
||||
<label>List of open incidents</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizIncidentTicket: ticket_status Contains 'Open' AND severity Contains 'critical'</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizIncidentTicket: ticket_status != 'Closed'</itopblock>
|
||||
</div></template>
|
||||
<rank>1</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="14">
|
||||
<parent_id>2</parent_id>
|
||||
<name>Persons</name>
|
||||
<label>Any contact of class 'Person'</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizPerson</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizPerson</itopblock>
|
||||
</div></template>
|
||||
<rank>7</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="51">
|
||||
<parent_id>17</parent_id>
|
||||
<name>Run queries</name>
|
||||
<label>Run any query</label>
|
||||
<hyperlink>./sibusql.php</hyperlink>
|
||||
<template></template>
|
||||
<rank>1001</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="73">
|
||||
<parent_id>66</parent_id>
|
||||
<name>Scheduled Outages</name>
|
||||
<label>Scheduled Outages</label>
|
||||
<hyperlink>./UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizChangeTicket" type="search" asynchronous="false" encoding="text/sibusql">bizChangeTicket: outage = 'Yes' AND ticket_status != 'Closed'</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizChangeTicket" type="list" asynchronous="false" encoding="text/sibusql">bizChangeTicket: outage = 'Yes' AND ticket_status != 'Closed'</itopblock>
|
||||
</div></template>
|
||||
<rank>999</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="64">
|
||||
<parent_id>0</parent_id>
|
||||
<name>Service Management</name>
|
||||
<label>Service Management</label>
|
||||
<hyperlink>./UI.php</hyperlink>
|
||||
<template><img src="/images/erwanContracts.jpg" style="float:right">
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:24px;">Contracts Overview</p>
|
||||
<table border="0" padding="5" class="layout">
|
||||
<tr>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Contracts by Service Level</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContract" type="pie_chart" parameters="group_by:service_level" asynchronous="false" encoding="text/sibusql">bizContract</itopblock>
|
||||
</td>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Contracts by Status</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContract" type="pie_chart" parameters="group_by:status" asynchronous="false" encoding="text/sibusql">bizContract</itopblock>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;">Contracts end in 30 days</p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContract" type="list" asynchronous="false" encoding="text/oql">SELECT bizContract AS C WHERE (TO_DAYS(NOW()) - TO_DAYS(C.end_prod)) < 31</itopblock>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table></template>
|
||||
<rank>5</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="43">
|
||||
<parent_id>2</parent_id>
|
||||
<name>Teams</name>
|
||||
<label>Any contact of class 'team'</label>
|
||||
<hyperlink>UI.php</hyperlink>
|
||||
<template><itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="search" asynchronous="false" encoding="text/sibusql">bizTeam</itopblock>
|
||||
<div id="BottomPane">
|
||||
<p></p>
|
||||
<itopblock BlockClass="DisplayBlock" objectclass="bizContact" type="list" asynchronous="false" encoding="text/sibusql">bizTeam</itopblock>
|
||||
</div></template>
|
||||
<rank>8</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
<menuNode id="16">
|
||||
<parent_id>17</parent_id>
|
||||
<name>Universal Search</name>
|
||||
<label>Search for anything...</label>
|
||||
<hyperlink>UniversalSearch.php</hyperlink>
|
||||
<template></template>
|
||||
<rank>999</rank>
|
||||
<type>application</type>
|
||||
</menuNode>
|
||||
</Set>
|
||||
83
setup/setup.js
Normal file
83
setup/setup.js
Normal file
@@ -0,0 +1,83 @@
|
||||
function NameIsValid(name)
|
||||
{
|
||||
sName = new String(name);
|
||||
if (sName.match(/^[A-Za-z][A-Za-z0-9_]*$/)) return true;
|
||||
return false;
|
||||
}
|
||||
function DoSubmit(sMsg, iStep)
|
||||
{
|
||||
var bResult = true;
|
||||
switch(iStep)
|
||||
{
|
||||
case 1:
|
||||
if ($('#db_server').val() == '')
|
||||
{
|
||||
alert('Please specify a database server. Use "localhost" for a local DB server.');
|
||||
bResult = false;
|
||||
}
|
||||
else if ($('#db_user').val() == '')
|
||||
{
|
||||
alert('Please specify a user name to connect to the database.');
|
||||
bResult = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if ($("input[@type=radio]:checked").length < 1)
|
||||
{
|
||||
alert('Please specify a database name');
|
||||
bResult = false;
|
||||
}
|
||||
else if( ($("#new_db:checked").length == 1))
|
||||
{
|
||||
if ($('#new_db_name').val() == '')
|
||||
{
|
||||
alert('Please specify the name of the database to create');
|
||||
bResult = false;
|
||||
}
|
||||
else if (!NameIsValid($('#new_db_name').val()))
|
||||
{
|
||||
alert($('#new_db_name').val()+' is not a valid database name. Please limit yourself to letters, numbers and the underscore character.');
|
||||
bResult = false;
|
||||
}
|
||||
}
|
||||
else if ($("#current_db:checked").length == 1)
|
||||
{
|
||||
// Special case (DB enumeration failed, user must enter DB name)
|
||||
if ($("#current_db_name").val() == '')
|
||||
{
|
||||
alert('Please specify the name of the database.');
|
||||
bResult = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy the typed value as the value of the radio
|
||||
$("#current_db").val($("#current_db_name").val());
|
||||
}
|
||||
}
|
||||
if( ($('#db_prefix').val() != '') && (!NameIsValid($('#db_prefix').val())) )
|
||||
{
|
||||
alert($('#db_prefix').val()+' is not a valid table name. Please limit yourself to letters, numbers and the underscore character.');
|
||||
bResult = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if ($('#auth_user').val() == '')
|
||||
{
|
||||
alert('Please specify a login name for the administrator account');
|
||||
bResult = false;
|
||||
}
|
||||
else if ($('#auth_pwd').val() != $('#auth_pwd2').val())
|
||||
{
|
||||
alert('Retyped password does not match! Please verify the password.');
|
||||
bResult = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (bResult)
|
||||
{
|
||||
$('#setup').block({message: '<img src="../images/indicator.gif"> '+sMsg});
|
||||
}
|
||||
return bResult;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
require_once("../application/nicewebpage.class.inc.php");
|
||||
define(INSTALL_LOG_FILE, '../setup.log');
|
||||
/**
|
||||
* Web page used for displaying the login form
|
||||
*/
|
||||
@@ -8,6 +9,8 @@ class setup_web_page extends nice_web_page
|
||||
public function __construct($sTitle)
|
||||
{
|
||||
parent::__construct($sTitle);
|
||||
$this->add_linked_script("../js/jquery.blockUI.js");
|
||||
$this->add_linked_script("./setup.js");
|
||||
$this->add_style("
|
||||
body {
|
||||
background-color: #eee;
|
||||
@@ -92,21 +95,25 @@ table.formTable {
|
||||
public function info($sText)
|
||||
{
|
||||
$this->add("<p class=\"info\">$sText</p>\n");
|
||||
$this->log("Info - ".$sText);
|
||||
}
|
||||
|
||||
public function ok($sText)
|
||||
{
|
||||
$this->add("<p class=\"ok\">$sText</p>\n");
|
||||
$this->log("Ok - ".$sText);
|
||||
}
|
||||
|
||||
public function warning($sText)
|
||||
{
|
||||
$this->add("<p class=\"warning\">$sText</p>\n");
|
||||
$this->log("Warning - ".$sText);
|
||||
}
|
||||
|
||||
public function error($sText)
|
||||
{
|
||||
$this->add("<p class=\"error\">$sText</p>\n");
|
||||
$this->log("Error - ".$sText);
|
||||
}
|
||||
|
||||
public function form($aData)
|
||||
@@ -145,5 +152,16 @@ table.formTable {
|
||||
$this->s_content = "<div id=\"setup\">{$this->s_content}\n</div>\n";
|
||||
return parent::output();
|
||||
}
|
||||
|
||||
public function log($sText)
|
||||
{
|
||||
$hLogFile = @fopen(INSTALL_LOG_FILE, 'a');
|
||||
if ($hLogFile !== false)
|
||||
{
|
||||
$sDate = date('Y-m-d H:i:s');
|
||||
fwrite($hLogFile, "$sDate - $sText\n");
|
||||
fclose($hLogFile);
|
||||
}
|
||||
}
|
||||
} // End of class
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user