Moved under "trunk" to be able to track releases under "tags"

SVN:trunk[55]
This commit is contained in:
Denis Flaven
2009-04-28 09:03:12 +00:00
parent 3c438e20ed
commit b756db0992
422 changed files with 62557 additions and 0 deletions

64
setup/ajax.dataloader.php Normal file
View File

@@ -0,0 +1,64 @@
<?php
/**
* This page is called to load "asynchronously" some xml file into the database
* parameters
* 'file' string Name of the file to load
* 'session_status' string 'start', 'continue' or 'end'
* 'percent' integer 0..100 the percentage of completion once the file has been loaded
*/
require_once('../application/utils.inc.php');
require_once('../core/config.class.inc.php');
require_once('../core/cmdbsource.class.inc.php');
require_once('./setuppage.class.inc.php');
require_once('./xmldataloader.class.inc.php');
define('TMP_CONFIG_FILE', '../tmp-config-itop.php');
//define('FINAL_CONFIG_FILE', '../config-itop.php');
// Never cache this page
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Fri, 17 Jul 1970 05:00:00 GMT"); // Date in the past
/**
* Main program
*/
$sFileName = Utils::ReadParam('file', '');
$sSessionStatus = Utils::ReadParam('session_status', '');
$iPercent = (integer)Utils::ReadParam('percent', 0);
setup_web_page::log("Info - Loading file: $sFileName");
try
{
if (empty($sFileName) || !file_exists($sFileName))
{
throw(new Exception("File $sFileName does not exist"));
}
$oDataLoader = new XMLDataLoader(TMP_CONFIG_FILE); // When called by the wizard, the final config is not yet there
if ($sSessionStatus == 'start')
{
$oChange = MetaModel::NewObject("CMDBChange");
$oChange->Set("date", time());
$oChange->Set("userinfo", "Initialization");
$iChangeId = $oChange->DBInsert();
$oDataLoader->StartSession($oChange);
}
$oDataLoader->LoadFile($sFileName);
if ($sSessionStatus == 'end')
{
$oDataLoader->EndSession();
}
$sResult = sprintf("Info - loading of %s done. (Overall %d %% completed).", basename($sFileName), $iPercent);
echo $sResult;
setup_web_page::log($sResult);
}
catch(Exception $e)
{
echo "<p>An error happened while loading the data</p>\n";
echo '<p>'.$e."</p>\n";
setup_web_page::log("Error - An error happened while loading the data. ".$e);
}
?>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<bizOrganization id="3">
<name>Demo</name>
<code>MCO</code>
<status>implementation</status>
<parent_id>3</parent_id>
</bizOrganization>
<bizOrganization id="6">
<name>Oracle</name>
<code>ORA</code>
<status>production</status>
<parent_id>6</parent_id>
</bizOrganization>
</Set>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<bizLocation id="29">
<name>Grenoble</name>
<status>production</status>
<org_id>3</org_id>
<severity>high</severity>
<address>5 Avenue de la Poste</address>
<country>France</country>
<parent_location_id>1</parent_location_id>
</bizLocation>
<bizLocation id="1">
<name>Paris</name>
<status>implementation</status>
<org_id>3</org_id>
<severity>high</severity>
<address>5 rue de la Paroisse
15eme arrondissement</address>
<country>France</country>
<parent_location_id>1</parent_location_id>
</bizLocation>
</Set>

33
setup/data/03.persons.xml Normal file
View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<bizPerson id="21">
<name>Denis</name>
<status>production</status>
<org_id>3</org_id>
<email>denis.flaven@gmail.com</email>
<phone></phone>
<location_id>29</location_id>
<first_name>Flaven</first_name>
<employe_number></employe_number>
</bizPerson>
<bizPerson id="20">
<name>Quetiez</name>
<status>production</status>
<org_id>3</org_id>
<email>romain.quetiez@gmail.com</email>
<phone></phone>
<location_id>1</location_id>
<first_name>Romain</first_name>
<employe_number></employe_number>
</bizPerson>
<bizPerson id="7">
<name>Taloc</name>
<status>production</status>
<org_id>3</org_id>
<email>erwan.taloc@gmail.com</email>
<phone>33172382223</phone>
<location_id>1</location_id>
<first_name>Erwan</first_name>
<employe_number>e12345</employe_number>
</bizPerson>
</Set>

19
setup/data/04.teams.xml Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<bizTeam id="26">
<name>Application support</name>
<status>implementation</status>
<org_id>3</org_id>
<email>application@mecanorama.com</email>
<phone>33456456788</phone>
<location_id>29</location_id>
</bizTeam>
<bizTeam id="8">
<name>ITOP admin team</name>
<status>production</status>
<org_id>3</org_id>
<email>combodo@gmail.com</email>
<phone>33123453612</phone>
<location_id>1</location_id>
</bizTeam>
</Set>

1865
setup/data/05.pcs.xml Normal file

File diff suppressed because it is too large Load Diff

4063
setup/data/06.servers.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<bizApplication id="22">
<name>Oracle 10g</name>
<status>production</status>
<org_id>3</org_id>
<severity>high</severity>
<device_id>5</device_id>
<install_date>2008-11-05 00:00:00</install_date>
<version>10g</version>
<function>Database</function>
</bizApplication>
<bizApplication id="15">
<name>outlook Office</name>
<status>production</status>
<org_id>3</org_id>
<severity>high</severity>
<device_id>2</device_id>
<install_date>2008-12-30 00:00:00</install_date>
<version>8.4</version>
<function>Mail client</function>
</bizApplication>
<bizApplication id="14">
<name>Outlook server</name>
<status>implementation</status>
<org_id>3</org_id>
<severity>high</severity>
<device_id>5</device_id>
<install_date>2008-12-20 00:00:00</install_date>
<version>8.1</version>
<function>Mail Server</function>
</bizApplication>
</Set>

View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<bizNetworkDevice id="6">
<name>router01</name>
<status>production</status>
<org_id>3</org_id>
<severity>high</severity>
<location_id>1</location_id>
<brand>Cisco</brand>
<model>6500</model>
<serial_number>S2345985</serial_number>
<type>switch</type>
<ip_address>10.25.3.45</ip_address>
<default_gateway>10.25.3.1</default_gateway>
<ios_version>8.2</ios_version>
<memory>flash :1=16.48MB</memory>
<snmp_read>public</snmp_read>
<snmp_write>private</snmp_write>
</bizNetworkDevice>
<bizNetworkDevice id="323">
<name>router02</name>
<status>production</status>
<org_id>3</org_id>
<severity>high</severity>
<location_id>1</location_id>
<brand>Cisco</brand>
<model>6500</model>
<serial_number>S2345985</serial_number>
<type>switch</type>
<ip_address>10.25.3.46</ip_address>
<default_gateway>10.25.3.1</default_gateway>
<ios_version>8.2</ios_version>
<memory>flash :1=16.48MB</memory>
<snmp_read>public</snmp_read>
<snmp_write>private</snmp_write>
</bizNetworkDevice>
<bizNetworkDevice id="324">
<name>router03</name>
<status>production</status>
<org_id>3</org_id>
<severity>high</severity>
<location_id>1</location_id>
<brand>Cisco</brand>
<model>6500</model>
<serial_number>S2345985</serial_number>
<type>switch</type>
<ip_address>10.25.3.47</ip_address>
<default_gateway>10.25.3.1</default_gateway>
<ios_version>8.2</ios_version>
<memory>flash :1=16.48MB</memory>
<snmp_read>public</snmp_read>
<snmp_write>private</snmp_write>
</bizNetworkDevice>
<bizNetworkDevice id="17">
<name>switch01</name>
<status>production</status>
<org_id>3</org_id>
<severity>high</severity>
<location_id>1</location_id>
<brand></brand>
<model></model>
<serial_number></serial_number>
<type>switch</type>
<ip_address></ip_address>
<default_gateway></default_gateway>
<ios_version></ios_version>
<memory></memory>
<snmp_read></snmp_read>
<snmp_write></snmp_write>
</bizNetworkDevice>
</Set>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<lnkContactRealObject id="1">
<contact_id>8</contact_id>
<object_id>7</object_id>
<role>business model expert</role>
</lnkContactRealObject>
<lnkContactRealObject id="2">
<contact_id>21</contact_id>
<object_id>2</object_id>
<role>owner</role>
</lnkContactRealObject>
<lnkContactRealObject id="5">
<contact_id>7</contact_id>
<object_id>5</object_id>
<role>Server Owner</role>
</lnkContactRealObject>
<lnkContactRealObject id="4">
<contact_id>8</contact_id>
<object_id>21</object_id>
<role>Team Leader</role>
</lnkContactRealObject>
</Set>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<bizWorkgroup id="19">
<name>FLS Desktop</name>
<status>production</status>
<org_id>3</org_id>
<team_id>8</team_id>
<role>1st level support</role>
</bizWorkgroup>
<bizWorkgroup id="24">
<name>FLS Network</name>
<status>production</status>
<org_id>3</org_id>
<team_id>8</team_id>
<role>2nd level support</role>
</bizWorkgroup>
</Set>

132
setup/data/11.incidents.xml Normal file
View File

@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<bizIncidentTicket id="1">
<name>I-000001</name>
<title>PC issue</title>
<type>Desktop</type>
<customer_id>3</customer_id>
<ticket_status>WorkInProgress</ticket_status>
<initial_situation>there is an issue with my PC</initial_situation>
<current_situation></current_situation>
<start_date>2009-02-10 21:30:55</start_date>
<last_update></last_update>
<next_update></next_update>
<end_date></end_date>
<caller_id>21</caller_id>
<impact>not able to start IE</impact>
<workgroup_id>19</workgroup_id>
<agent_id>7</agent_id>
<action_log>We are about to connect to your PC via Netmeeting and troubleshoot what&apos;s up.
Then we will try to contact Microsoft to understand if it is a known issue</action_log>
<severity>critical</severity>
<assignment_count>1</assignment_count>
<resolution></resolution>
</bizIncidentTicket>
<bizIncidentTicket id="2">
<name>I-000002</name>
<title>Network issue</title>
<type>Network</type>
<customer_id>3</customer_id>
<ticket_status>Assigned</ticket_status>
<initial_situation>No more access to the network</initial_situation>
<current_situation>Network connectivity lost</current_situation>
<start_date>2009-02-19 19:07:25</start_date>
<last_update>0000-00-00 00:00:00</last_update>
<next_update>0000-00-00 00:00:00</next_update>
<end_date>0000-00-00 00:00:00</end_date>
<caller_id>7</caller_id>
<impact>high</impact>
<workgroup_id>24</workgroup_id>
<agent_id>21</agent_id>
<action_log>need to investigate the network</action_log>
<severity>low</severity>
<assignment_count>2</assignment_count>
<resolution></resolution>
</bizIncidentTicket>
<bizIncidentTicket id="3">
<name>I-000003</name>
<title>Disk Failure on Server01</title>
<type>Server</type>
<customer_id>3</customer_id>
<ticket_status>WorkInProgress</ticket_status>
<initial_situation>Partition /var is no more accessible.
It seems that hard disk is broken</initial_situation>
<current_situation>Filesystem is full</current_situation>
<start_date>2009-03-21 08:27:46</start_date>
<last_update>2009-02-10 22:25:00</last_update>
<next_update>2009-02-10 00:25:00</next_update>
<end_date>0000-00-00 00:00:00</end_date>
<caller_id>20</caller_id>
<impact>Really important for the business</impact>
<workgroup_id>19</workgroup_id>
<agent_id>7</agent_id>
<action_log>There are lot of logs file to be trimed</action_log>
<severity>medium</severity>
<assignment_count>2</assignment_count>
<resolution></resolution>
</bizIncidentTicket>
<bizIncidentTicket id="4">
<name>I-000004</name>
<title>Oracle Database down on domino</title>
<type>Server</type>
<customer_id>3</customer_id>
<ticket_status>New</ticket_status>
<initial_situation>Database Oracle is no more accessible on Server01</initial_situation>
<current_situation>Customer cannot access Order web site.</current_situation>
<start_date>2009-03-17 09:31:09</start_date>
<last_update>0000-00-00 00:00:00</last_update>
<next_update>0000-00-00 00:00:00</next_update>
<end_date>0000-00-00 00:00:00</end_date>
<caller_id>7</caller_id>
<impact>Very critical</impact>
<workgroup_id>19</workgroup_id>
<agent_id>0</agent_id>
<action_log></action_log>
<severity>low</severity>
<assignment_count>0</assignment_count>
<resolution></resolution>
</bizIncidentTicket>
<bizIncidentTicket id="5">
<name>I-000005</name>
<title>Issue with my pc</title>
<type>Desktop</type>
<customer_id>3</customer_id>
<ticket_status>Assigned</ticket_status>
<initial_situation>My PC is locked</initial_situation>
<current_situation>We have to analyze</current_situation>
<start_date>2009-03-01 23:22:38</start_date>
<last_update>0000-00-00 00:00:00</last_update>
<next_update>0000-00-00 00:00:00</next_update>
<end_date>0000-00-00 00:00:00</end_date>
<caller_id>7</caller_id>
<impact></impact>
<workgroup_id>19</workgroup_id>
<agent_id>20</agent_id>
<action_log></action_log>
<severity>medium</severity>
<assignment_count>1</assignment_count>
<resolution></resolution>
</bizIncidentTicket>
<bizIncidentTicket id="6">
<name>I-000006</name>
<title>Demo</title>
<type>Server</type>
<customer_id>3</customer_id>
<ticket_status>New</ticket_status>
<initial_situation>gdfgl</initial_situation>
<current_situation></current_situation>
<start_date>2009-03-18 22:00:00</start_date>
<last_update>0000-00-00 00:00:00</last_update>
<next_update>0000-00-00 00:00:00</next_update>
<end_date>0000-00-00 00:00:00</end_date>
<caller_id>20</caller_id>
<impact>personne ne peut acceder au site de paris</impact>
<workgroup_id>19</workgroup_id>
<agent_id>0</agent_id>
<action_log></action_log>
<severity>low</severity>
<assignment_count>0</assignment_count>
<resolution></resolution>
</bizIncidentTicket>
</Set>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<lnkRelatedTicket id="1">
<rel_ticket_id>2</rel_ticket_id>
<ticket_id>1</ticket_id>
<impact>Real cause is a network incident</impact>
</lnkRelatedTicket>
</Set>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<lnkInfraTicket id="12">
<infra_id>125</infra_id>
<ticket_id>6</ticket_id>
<impact>c&apos;est down</impact>
</lnkInfraTicket>
<lnkInfraTicket id="13">
<infra_id>5</infra_id>
<ticket_id>3</ticket_id>
<impact>main application is broken</impact>
</lnkInfraTicket>
<lnkInfraTicket id="5">
<infra_id>5</infra_id>
<ticket_id>2</ticket_id>
<impact>no more access to network</impact>
</lnkInfraTicket>
<lnkInfraTicket id="4">
<infra_id>2</infra_id>
<ticket_id>1</ticket_id>
<impact>not able to start IE</impact>
</lnkInfraTicket>
<lnkInfraTicket id="9">
<infra_id>28</infra_id>
<ticket_id>5</ticket_id>
<impact>not able to work</impact>
</lnkInfraTicket>
<lnkInfraTicket id="10">
<infra_id>5</infra_id>
<ticket_id>4</ticket_id>
<impact>Order web site is no more working</impact>
</lnkInfraTicket>
</Set>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<lnkContactTicket id="1">
<contact_id>8</contact_id>
<ticket_id>1</ticket_id>
<role>Team that need to be informed</role>
</lnkContactTicket>
<lnkContactTicket id="2">
<contact_id>21</contact_id>
<ticket_id>3</ticket_id>
<role>to be informed</role>
</lnkContactTicket>
</Set>

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<bizChangeTicket id="1">
<name>CM-0000003</name>
<title>1st change</title>
<type>Routine</type>
<domain>Desktop</domain>
<reason>reason</reason>
<requestor_id>20</requestor_id>
<customer_id>3</customer_id>
<ticket_status>PlannedScheduled</ticket_status>
<creation_date>2009-02-19 21:35:47</creation_date>
<last_update>2009-02-18 18:33:14</last_update>
<start_date>0000-00-00 00:00:00</start_date>
<end_date>0000-00-00 00:00:00</end_date>
<close_date>0000-00-00 00:00:00</close_date>
<impact>There is no impact</impact>
<workgroup_id>19</workgroup_id>
<agent_id>21</agent_id>
<supervisorgroup_id>19</supervisorgroup_id>
<supervisor_id>20</supervisor_id>
<managergroup_id>19</managergroup_id>
<manager_id>7</manager_id>
<outage>No</outage>
<change_request>I would like to install SQL plus on my laptop.
Could you make it please</change_request>
<change_log>We will push via netmeeting the package and install it at 10:00 tomorrow</change_log>
<fallback>If there is any issue we will uninstall it</fallback>
<assignment_count>0</assignment_count>
</bizChangeTicket>
<bizChangeTicket id="2">
<name>CM-0000004</name>
<title>Oracle upgrade on domino</title>
<type>Routine</type>
<domain>Application</domain>
<reason>Patch Installation for Oracle</reason>
<requestor_id>21</requestor_id>
<customer_id>3</customer_id>
<ticket_status>Approved</ticket_status>
<creation_date>2009-03-17 14:50:34</creation_date>
<last_update>2009-03-17 14:50:34</last_update>
<start_date>2009-02-24 00:00:00</start_date>
<end_date>2009-02-24 02:00:00</end_date>
<close_date>0000-00-00 00:00:00</close_date>
<impact>application impacted</impact>
<workgroup_id>19</workgroup_id>
<agent_id>20</agent_id>
<supervisorgroup_id>19</supervisorgroup_id>
<supervisor_id>21</supervisor_id>
<managergroup_id>19</managergroup_id>
<manager_id>7</manager_id>
<outage>Yes</outage>
<change_request>We wan to install last Oracle Patch in order to fix rollback management issues</change_request>
<change_log>We will install patch and reboot the server</change_log>
<fallback>If not working we will remove this patch</fallback>
<assignment_count>0</assignment_count>
</bizChangeTicket>
<bizChangeTicket id="3">
<name>CM-0000005</name>
<title>IOS upgrade</title>
<type>Routine</type>
<domain>Desktop</domain>
<reason>security issue</reason>
<requestor_id>21</requestor_id>
<customer_id>3</customer_id>
<ticket_status>New</ticket_status>
<creation_date>2009-04-04 23:23:37</creation_date>
<last_update>0000-00-00 00:00:00</last_update>
<start_date>0000-00-00 00:00:00</start_date>
<end_date>0000-00-00 00:00:00</end_date>
<close_date>0000-00-00 00:00:00</close_date>
<impact></impact>
<workgroup_id>19</workgroup_id>
<agent_id>21</agent_id>
<supervisorgroup_id>19</supervisorgroup_id>
<supervisor_id>20</supervisor_id>
<managergroup_id>19</managergroup_id>
<manager_id>7</manager_id>
<outage>No</outage>
<change_request>Upgrade to new IOS due to security reason</change_request>
<change_log></change_log>
<fallback></fallback>
<assignment_count>0</assignment_count>
</bizChangeTicket>
</Set>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<lnkInfraChangeTicket id="7">
<infra_id>22</infra_id>
<ticket_id>2</ticket_id>
<impact>impacted application</impact>
</lnkInfraChangeTicket>
<lnkInfraChangeTicket id="6">
<infra_id>5</infra_id>
<ticket_id>2</ticket_id>
<impact>impacted server</impact>
</lnkInfraChangeTicket>
<lnkInfraChangeTicket id="5">
<infra_id>2</infra_id>
<ticket_id>1</ticket_id>
<impact>PC where to install new appli</impact>
</lnkInfraChangeTicket>
<lnkInfraChangeTicket id="8">
<infra_id>6</infra_id>
<ticket_id>3</ticket_id>
<impact>router not available </impact>
</lnkInfraChangeTicket>
</Set>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<lnkContactChange id="3">
<contact_id>7</contact_id>
<change_id>1</change_id>
<role>DB admin</role>
</lnkContactChange>
<lnkContactChange id="4">
<contact_id>20</contact_id>
<change_id>2</change_id>
<role>Db administrator</role>
</lnkContactChange>
<lnkContactChange id="1">
<contact_id>21</contact_id>
<change_id>1</change_id>
<role>notify me</role>
</lnkContactChange>
<lnkContactChange id="5">
<contact_id>7</contact_id>
<change_id>2</change_id>
<role>Server Owner for reboot</role>
</lnkContactChange>
</Set>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<bizContract id="1">
<name>Oracle Support</name>
<customer_id>3</customer_id>
<provider_id>6</provider_id>
<service_name>Software support</service_name>
<team_id>8</team_id>
<service_level>Gold</service_level>
<cost_unit>Global</cost_unit>
<cost_freq>Yearly</cost_freq>
<cost>30000</cost>
<currency>Euros</currency>
<description>This contract define Oracle Support contract between Mecanorama and Oracle company.
Yearly cost is 30.000 euros</description>
<move2prod_date>2009-02-22 18:54:14</move2prod_date>
<end_prod>2009-03-04 00:01:38</end_prod>
<status>Signed</status>
<type>Software</type>
<version_number>3</version_number>
</bizContract>
</Set>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<lnkInfraContract id="1">
<infra_id>22</infra_id>
<contract_id>1</contract_id>
<coverage>Office Hour</coverage>
<service_level>Gold</service_level>
</lnkInfraContract>
</Set>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<lnkContactContract id="1">
<contact_id>21</contact_id>
<contract_id>1</contract_id>
<role>Contract Manager</role>
</lnkContactContract>
<lnkContactContract id="2">
<contact_id>8</contact_id>
<contract_id>1</contract_id>
<role>Team in charge to manage Oracle</role>
</lnkContactContract>
</Set>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<AuditCategory id="1">
<name>Devices in production</name>
<description>Checking all devices in production</description>
<definition_set>bizDevice: status = &apos;production&apos;</definition_set>
</AuditCategory>
</Set>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<Set>
<AuditRule id="1">
<name>Devices in production on a Location not in production</name>
<description></description>
<query>bizDevice: location_id IN (bizLocation: status != &apos;production&apos;)</query>
<valid_flag>false</valid_flag>
<category_id>1</category_id>
</AuditRule>
<AuditRule id="2">
<name>Devices not attached to a monitoring group</name>
<description></description>
<query>bizDevice: PKEY IS infra_id IN (lnkInfraGrouping: infra_group_id IN (bizInfraGroup: type = &apos;Monitoring&apos;))</query>
<valid_flag>true</valid_flag>
<category_id>1</category_id>
</AuditRule>
</Set>

27
setup/data/export.cmd Normal file
View File

@@ -0,0 +1,27 @@
SET WEBROOT=http://localhost:81
SET USER=Erwan
SET PWD=Taloc
REM The order (numbering) of the files is important since
REM it dictates the order to import them back
wget --output-document=01.organizations.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizOrganization&format=xml"
wget --output-document=02.locations.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizLocation&format=xml"
wget --output-document=03.persons.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizPerson&format=xml"
wget --output-document=04.teams.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizTeam&format=xml"
wget --output-document=05.pcs.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizPC&format=xml"
wget --output-document=06.servers.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizServer&format=xml"
wget --output-document=07.applications.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizApplication&format=xml"
wget --output-document=08.nw-devices.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizNetworkDevice&format=xml"
wget --output-document=09.links_contacts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkContactRealObject&format=xml"
wget --output-document=10.workgroups.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizWorkgroup&format=xml"
wget --output-document=11.incidents.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizIncidentTicket&format=xml"
wget --output-document=12.relatedtickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkRelatedTicket&format=xml"
wget --output-document=13.infratickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkInfraTicket&format=xml"
wget --output-document=14.contacttickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkContactTicket&format=xml"
wget --output-document=15.changetickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizChangeTicket&format=xml"
wget --output-document=16.infrachangetickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkInfraChangeTicket&format=xml"
wget --output-document=17.contactchangetickets.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkContactChange&format=xml"
wget --output-document=18.contracts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT bizContract&format=xml"
wget --output-document=19.infracontracts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkInfraContract&format=xml"
wget --output-document=20.contactcontracts.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT lnkContactContract&format=xml"
wget --output-document=21.auditcategories.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT AuditCategory&format=xml"
wget --output-document=22.auditrules.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT AuditRule&format=xml"

6
setup/export_menus.cmd Normal file
View File

@@ -0,0 +1,6 @@
SET WEBROOT=http://localhost:81
SET USER=Erwan
SET PWD=Taloc
REM The order (numbering) of the files is important since
REM it dictates the order to import them back
wget --output-document=1.menus.xml --post-data="auth_user=%USER%&auth_pwd=%PWD%&operation=login" "%WEBROOT%/pages/export.php?expression=SELECT menuNode WHERE type%%3D%%27application%%27&format=xml"

536
setup/index.php Normal file
View File

@@ -0,0 +1,536 @@
<?php
/**
* Wizard to configure and initialize the iTop application
*/
require_once('../application/utils.inc.php');
require_once('../core/config.class.inc.php');
require_once('../core/cmdbsource.class.inc.php');
require_once('./setuppage.class.inc.php');
define('TMP_CONFIG_FILE', '../tmp-config-itop.php');
define('FINAL_CONFIG_FILE', '../config-itop.php');
define('SETUP_DATA_DIR', './data');
define('PHP_MIN_VERSION', '5.2.0');
define('MYSQL_MIN_VERSION', '5.0.0');
$sOperation = Utils::ReadParam('operation', 'step1');
$oP = new setup_web_page('iTop configuration wizard');
/**
* 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(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.")");
}
else
{
$oP->error("Error: The current PHP Version (".phpversion().") is lower than the minimum required version (".PHP_MIN_VERSION.")");
return false;
}
$aMandatoryExtensions = array('mysql', 'iconv', 'simplexml');
asort($aMandatoryExtensions); // Sort the list to look clean !
$aExtensionsOk = array();
$aMissingExtensions = array();
$aMissingExtensionsLinks = array();
foreach($aMandatoryExtensions as $sExtension)
{
if (extension_loaded($sExtension))
{
$aExtensionsOk[] = $sExtension;
}
else
{
$aMissingExtensions[] = $sExtension;
$aMissingExtensionsLinks[] = "<a href=\"http://www.php.net/manual/en/book.$sExtension.php\">$sExtension</a>";
}
}
if (count($aExtensionsOk) > 0)
{
$oP->ok("Required PHP extension(s): ".implode(', ', $aExtensionsOk).".");
}
if (count($aMissingExtensions) > 0)
{
$oP->error("Missing PHP extension(s): ".implode(', ', $aMissingExtensionsLinks).".");
return false;
}
return true;
}
/**
* Helper function check the connection to the database and (if connected) to enumerate
* the existing databases
* @return Array The list of databases found in the server
*/
function CheckServerConnection(setup_web_page $oP, $sDBServer, $sDBUser, $sDBPwd)
{
$aResult = array();
$oP->log('Info - CheckServerConnection');
try
{
$oDBSource = new CMDBSource;
$oDBSource->Init($sDBServer, $sDBUser, $sDBPwd);
$oP->ok("Connection to '$sDBServer' as '$sDBUser' successful.");
$sDBVersion = $oDBSource->GetDBVersion();
if (version_compare($sDBVersion, MYSQL_MIN_VERSION, '>='))
{
$oP->ok("Current MySQL version ($sDBVersion), greater than minimum required version (".MYSQL_MIN_VERSION.")");
}
else
{
$oP->error("Error: Current MySQL version is ($sDBVersion), minimum required version (".MYSQL_MIN_VERSION.")");
return false;
}
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)
{
$oP->error("Error: Connection to '$sDBServer' as '$sDBUser' failed.");
$oP->p($e->GetHtmlDesc());
$aResult = false;
}
return $aResult;
}
/**
* 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)
{
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');
$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())
{
MetaModel::DBCreate();
$oP->ok("Database structure created in '$sDBName' (prefix = '$sDBPrefix').");
}
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;
}
/**
* Helper function to create and administrator account for iTop
* @return boolean true on success, false otherwise
*/
function CreateAdminAccount(setup_web_page $oP, Config $oConfig, $sAdminUser, $sAdminPwd)
{
$oP->log('Info - CreateAdminAccount');
InitDataModel($oP, TMP_CONFIG_FILE, true); // allow missing DB
if (UserRights::CreateAdministrator($sAdminUser, $sAdminPwd))
{
$oP->ok("Administrator account '$sAdminUser' created.");
return true;
}
else
{
$oP->error("Failed to create the administrator account '$sAdminUser'.");
return false;
}
}
/**
* Scans the ./data directory for XML files and output them as a Javascript array
*/
function PopulateDataFilesList(setup_web_page $oP)
{
if ($hDir = @opendir(SETUP_DATA_DIR))
{
$aFilesToLoad = array();
// This is the correct way to loop over the directory. (according the documentation)
while (($sFile = readdir($hDir)) !== false)
{
$sExtension = pathinfo($sFile, PATHINFO_EXTENSION );
if (strcasecmp($sExtension, 'xml') == 0)
{
$aFilesToLoad[] = SETUP_DATA_DIR.'/'.$sFile;
}
}
closedir($hDir);
// Load order is important we expect the files to be ordered
// like numbered 1.Organizations.xml 2.Locations.xml , etc.
asort($aFilesToLoad);
// Menus can be loaded any time... like here at the end
$oP->add("<script type=\"text/javascript\">\n");
$oP->add("function PopulateDataFilesList()\n");
$oP->add("{\n");
$index = 0;
foreach($aFilesToLoad as $sFile)
{
$oP->add("aFilesToLoad[aFilesToLoad.length] = '$sFile';\n");
$index++;
}
$oP->add("}\n");
$oP->add("</script>\n");
}
else
{
$oP->error("Data directory (".SETUP_DATA_DIR.") no found or not readable.");
}
}
/**
* Display the form for the first step of the configuration wizard
* which consists in the database server selection
*/
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\" 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$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$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");
$oP->add("<button type=\"submit\">Next >></button>\n");
$oP->add("</form>\n");
}
}
/**
* Display the form for the second step of the configuration wizard
* which consists in
* 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(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\" onSubmit=\"return DoSubmit('Creating database structure...', 2);\">\n");
$aDatabases = CheckServerConnection($oP, $sDBServer, $sDBUser, $sDBPwd);
if ($aDatabases === false)
{
// Connection failed, invalid credentials ? Go back
$oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n");
}
else
{
// Connection is Ok, save it and continue the setup wizard
$oConfig->SetDBHost($sDBServer);
$oConfig->SetDBUser($sDBUser);
$oConfig->SetDBPwd($sDBPwd);
$oConfig->WriteToFile();
$oP->add("<fieldset><legend>Specify a database<span class=\"hilite\">*</span></legend>\n");
$aForm = array();
if (is_array($aDatabases))
{
foreach($aDatabases as $sDBName)
{
$aForm[] = array('label' => "<input id=\"db_$sDBName\" type=\"radio\" name=\"db_name\" value=\"$sDBName\" /><label for=\"db_$sDBName\"> $sDBName</label>");
}
}
else
{
$aForm[] = array('label' => "<input id=\"current_db\" type=\"radio\" name=\"db_name\" value=\"-1\" /><label for=\"current_db\"> Use the existing database:</label> <input type=\"text\" id=\"current_db_name\" name=\"current_db_name\" value=\"\" maxlength=\"32\"/>");
$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:</label> <input type=\"text\" id=\"new_db_name\" name=\"new_db_name\" value=\"\" maxlength=\"32\"/>");
$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 id=\"db_prefix\" type=\"text\" name=\"db_prefix\" value=\"\" maxlength=\"32\"/>");
$oP->form($aForm);
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"$sNextOperation\">\n");
$oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n");
$oP->add("&nbsp;&nbsp;&nbsp;&nbsp;\n");
$oP->add("<button type=\"submit\">Next >></button>\n");
}
$oP->add("</form>\n");
}
/**
* Display the form for the third step of the configuration wizard
* which consists in
* 1) Validating the parameters by connecting to the database server & selecting the database
* 2) Creating the database structure
* 3) Prompting for the admin account to be created
*/
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\" 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$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");
$oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n");
$oP->add("&nbsp;&nbsp;&nbsp;&nbsp;\n");
$oP->add("<button type=\"submit\">Next >></button>\n");
}
else
{
$oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n");
}
// Form goes here
$oP->add("</form>\n");
}
/**
* Display the form for the fourth step of the configuration wizard
* which consists in
* 1) Creating the admin user account
* 2) Prompting to load some sample data
*/
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");
if (CreateAdminAccount($oP, $oConfig, $sAdminUser, $sAdminPwd))
{
$oP->add("<h2>Step 4: Loading of sample data</h2>\n");
$oP->p("<fieldset><legend> Do you want to load sample data into the database ? </legend>\n");
$oP->p("<input type=\"radio\" id=\"sample_data\" name=\"sample_data\" checked value=\"yes\"> Yes, for testing purposes, populate the database with sample data.\n");
$oP->p("<input type=\"radio\" name=\"sample_data\" unchecked value=\"no\"> No, this is a production system, I will load real data myself.\n");
$oP->p("</fieldset>\n");
$oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n");
$oP->add("&nbsp;&nbsp;&nbsp;&nbsp;\n");
$oP->add("<button onclick=\"DoSubmit('Finalizing configuration and loading data...', 4);\">Finish</button>\n");
}
else
{
// Creation failed
$oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n");
}
// End of visible form
$oP->add("</form>\n");
// Hidden form
$oP->add("<form id=\"GoToNextStep\" method=\"post\">\n");
$oP->add("<input type=\"hidden\" name=\"auth_user\" value=\"$sAdminUser\">\n"); // To be compatible with login page
$oP->add("<input type=\"hidden\" name=\"auth_pwd\" value=\"$sAdminPwd\">\n"); // To be compatible with login page
$oP->add("<input type=\"hidden\" name=\"operation\" value=\"$sNextOperation\">\n");
$oP->add("</form>\n");
$oP->add_linked_script('./jquery.progression.js');
PopulateDataFilesList($oP);
}
/**
* Display the form for the fifth (and final) step of the configuration wizard
* which consists in
* 1) Creating the final configuration file
* 2) Prompting the user to make the file read-only
*/
function DisplayStep5(setup_web_page $oP, Config $oConfig, $sAuthUser, $sAuthPwd)
{
try
{
session_start();
// Write the final configuration file
$oConfig->WriteToFile(FINAL_CONFIG_FILE);
// Start the application
InitDataModel($oP, FINAL_CONFIG_FILE, false); // DO NOT allow missing DB
if (UserRights::Login($sAuthUser, $sAuthPwd))
{
$_SESSION['auth_user'] = $sAuthUser;
$_SESSION['auth_pwd'] = $sAuthPwd;
// remove the tmp config file
@unlink(TMP_CONFIG_FILE);
// try to make the final config file read-only
@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");
$oP->ok("The initialization completed successfully.");
// Form goes here
$oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n");
$oP->add("&nbsp;&nbsp;&nbsp;&nbsp;\n");
$oP->add("<button type=\"submit\">Enter iTop</button>\n");
$oP->add("</form>\n");
}
else
{
$oP->add("<h1>iTop configuration wizard</h1>\n");
$oP->add("<h2>Step 5: Configuration completed</h2>\n");
@unlink(FINAL_CONFIG_FILE); // remove the aborted config
$oP->error("Error: Failed to login for user: '$sAuthUser'\n");
$oP->add("<form method=\"get\" action=\"../index.php\">\n");
$oP->add("<button onClick=\"window.history.back();\"><< Back</button>\n");
$oP->add("&nbsp;&nbsp;&nbsp;&nbsp;\n");
$oP->add("</form>\n");
}
}
catch(Exception $e)
{
$oP->error("Error: unable to create the configuration file.");
$oP->p($e->getHtmlDesc());
$oP->p("Did you forget to remove the previous (read-only) configuration file ?");
}
}
/**
* 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);
}
catch(Exception $e)
{
// We'll end here when the tmp config file does not exist. It's normal
$oConfig = new Config(TMP_CONFIG_FILE, false /* Don't try to load it */);
}
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');
DisplayStep2($oP, $oConfig, $sDBServer, $sDBUser, $sDBPwd);
break;
case 'step3':
$oP->no_cache();
$oP->log("Info - ========= Wizard step 3 ========");
$sDBName = Utils::ReadParam('db_name');
if (empty($sDBName))
{
$sDBName = Utils::ReadParam('new_db_name');
}
$sDBPrefix = Utils::ReadParam('db_prefix');
DisplayStep3($oP, $oConfig, $sDBName, $sDBPrefix);
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 ========");
$sAdminUser = Utils::ReadParam('auth_user');
$sAdminPwd = Utils::ReadParam('auth_pwd');
DisplayStep5($oP, $oConfig, $sAdminUser, $sAdminPwd);
break;
default:
$oP->error("Error: unsupported operation '$sOperation'");
}
$oP->output();
?>

193
setup/jquery.progression.js Normal file
View File

@@ -0,0 +1,193 @@
/*
* Progression - jQuery plugin for Progress Bar 1.3
*
* http://www.anthor.net/fr/jquery-progression.html
*
* Copyright (c) 2008 FOURNET Loïc
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
(function($) {
$.fn.progression = function(options) {
// Récupération des options par défaut
var opts = $.extend({
Current: 50,
Maximum: 100,
Background: '#FFFFFF',
TextColor: '#000000',
aBackground: '#FF0000',
aTextColor: '#FFFFFF',
BorderColor: '#000000',
Animate: true,
AnimateTimeOut: 3000,
Easing: 'linear',
startFct : null,
endFct : null
}, $.fn.progression.defaults, options);
if(options)
var newCurrent = options.Current;
// Boucle sur les éléments appelés
return this.each(function() {
$this = $(this); // Elément en cours
$innerdiv=$this.find(".progress"); // On recherche si l'élément a déjà été traité
// Options Spécifiques + Métadata ?
var o = $.metadata ? $.extend({}, opts, $this.metadata()) : opts;
// Premier traitement de l'élément, pour la mise en place
if($innerdiv.length!=1)
BuildBarre($this, o);
else
{
// Si c'est une nouvelle valeur, la fonction doit avoir la priorité sur les métadata
if(newCurrent)
o.Current = newCurrent;
o.Maximum = parseInt($this.attr('pmax'));
}
// Valeur supérieur au maximum ?
if( o.Current > o.Maximum )
{
debug('La valeur demandee doit etre inférieur ou egale a la valeur maximale.')
return false;
}
// Calcul du pourcentage actuel
var aWidth = Math.round(parseInt($this.attr('pcur'))/o.Maximum*100);
// Calcul du nouveaux pourcentage
var Width = Math.round(parseInt(o.Current)/o.Maximum*100);
//Start Callback
if (typeof o.startFct == 'function')
o.startFct(o);
if(o.Animate)
{
var oldCurrent = parseInt($this.attr('pcur'));
var Steps = Math.abs(oldCurrent - o.Current);
var StepsTimeOut = Math.floor(o.AnimateTimeOut/o.Maximum);
$innerdiv.queue("fx", []);
$innerdiv.stop();
$innerdiv.animate({ width: Width+"%" }, {
duration: Math.round(StepsTimeOut*(Steps+1)),
queue: false,
easing: o.Easing,
complete: function(){
if (typeof o.endFct == 'function')
o.endFct(o);
}
});
for (i=0; i<=Steps; i++) {
$innerdiv.animate({opacity: 1},{
duration: Math.round(StepsTimeOut*i),
queue: false,
complete: function(){
if(oldCurrent<=o.Current)
$(this).progressionSetTextTo(oldCurrent++);
else
$(this).progressionSetTextTo(oldCurrent--);
}
});
}
}
else
{
$innerdiv.css({ width: Width+'%' });
$innerdiv.progressionSetTextTo(o.Current);
if (typeof o.endFct == 'function')
o.endFct(o);
}
});
};
// Fonction de création de la barre
function BuildBarre($this, o) {
// On vide la barre
$this.html('');
$this.css({
textAlign: 'left',
position: 'relative',
overflow: 'hidden',
backgroundColor: o.Background,
borderColor: o.BorderColor,
color: o.TextColor
});
// Si largeur Spécifique
if(o.Width)
$this.css('width', o.Width);
// Si hauteur Spécifique
if(o.Height)
$this.css({ height: o.Height, lineHeight: o.Height });
// Si image de fond
if(o.BackgroundImg)
$this.css({ backgroundImage: 'url(' + o.BackgroundImg + ')' });
$innerdiv=$("<div class='progress'></div>");
$("<div class='text'>&nbsp;</div>").css({
position: 'absolute',
width: '100%',
height: '100%',
textAlign: 'center'
}).appendTo($this);
$("<span class='text'>&nbsp;</span>")
.css({
position: 'absolute',
width: $this.width(),
textAlign: 'center'
})
.appendTo($innerdiv);
$this.append($innerdiv);
// On applique le CSS de $innerdiv
$innerdiv.css({
position: 'absolute',
width: 0,
height: '100%',
overflow: 'hidden',
backgroundColor: o.aBackground,
color: o.aTextColor
});
// Si image de fond active
if(o.aBackgroundImg)
$innerdiv.css({ backgroundImage: 'url(' + o.aBackgroundImg + ')' });
$this.attr('pmax', o.Maximum);
$this.attr('pcur', 0);
};
// Fonction pour aller à une valeur précise
$.fn.progressionSetTextTo = function(i) {
return this.each(function() {
$this = $(this).parent();
if($this.attr('pmax')!=100)
$this.find(".text").html(i+"/"+$this.attr('pmax'));
else
$this.find(".text").html(i+" %");
$this.attr('pcur', i);
});
};
// Fonction d'impression dans la console javascript
function debug($txt) {
if (window.console && window.console.log)
window.console.log('jQuery Progression: ' + $txt);
};
$.fn.progression.defaults = {};
})(jQuery);

610
setup/menus.xml Normal file
View File

@@ -0,0 +1,610 @@
<?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>&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:32px;&quot;&gt;Tools for the iTop consultant&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:14px;&quot;&gt;&lt;i&gt;This section contains links to useful tools for extending or debugging iTop&lt;/i&gt;&lt;/p&gt;
</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizApplication&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizApplication&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:24px;&quot;&gt;All Applications&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizApplication&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizApplication&lt;/itopblock&gt;
&lt;/div&gt;
</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizCircuit&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizCircuit&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:24px;&quot;&gt;All Circuits&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizCircuit&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizCircuit&lt;/itopblock&gt;
&lt;/div&gt;
</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizContract&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizContract&lt;/itopblock&gt;
&lt;/div&gt;</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizInterface&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:24px;&quot;&gt;All Interfaces&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizInterface&lt;/itopblock&gt;
&lt;/div&gt;
</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizNetworkDevice&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizNetworkDevice&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:24px;&quot;&gt;All Network Devices&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizNetworkDevice&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizNetworkDevice&lt;/itopblock&gt;
&lt;/div&gt;
</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizPatch&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizPatch&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:24px;&quot;&gt;All Patches&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizPatch&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizPatch&lt;/itopblock&gt;
&lt;/div&gt;
</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizPC&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:24px;&quot;&gt;All PCs&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizPC&lt;/itopblock&gt;
&lt;/div&gt;
</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizServer&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:24px;&quot;&gt;All Servers&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizServer&lt;/itopblock&gt;
&lt;/div&gt;
</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 &amp; Restore</name>
<label>Backup &amp; 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>&lt;style&gt;
.dashboard {
vertical-align:top;
width:50%;
border:1px solid #000;
-moz-border-radius:10px;
padding:5px;
text-align:center;
}
&lt;/style&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:24px;&quot;&gt;Changes Overview&lt;/p&gt;
&lt;table border=&quot;0&quot; padding=&quot;5&quot;&gt;
&lt;tr&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizChangeTicket&quot; type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:bars;group_by:type;chart_title:Changes by type&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizChangeTicket&lt;/itopblock&gt;
&lt;/td&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizChangeTicket&quot; type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:pie;group_by:ticket_status;chart_title:Changes by status&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizChangeTicket&lt;/itopblock&gt;
&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;&quot;&gt;Changes by Workgroup&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizChangeTicket&quot; type=&quot;count&quot; parameters=&quot;group_by:workgroup_name&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizChangeTicket&lt;/itopblock&gt;
&lt;/td&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;&quot;&gt;Changes not yet assigned&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizChangeTicket&quot; type=&quot;list&quot; parameters=&quot;dashboard:true&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizChangeTicket WHERE ticket_status = &apos;New&apos;&lt;/itopblock&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizChangeTicket: ticket_status = &apos;Closed&apos;&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizChangeTicket: ticket_status = &apos;Closed&apos;&lt;/itopblock&gt;
&lt;/div&gt;</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizIncidentTicket: ticket_status Contains &apos;Open&apos; AND severity Contains &apos;critical&apos;&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizIncidentTicket: ticket_status = &apos;Closed&apos;&lt;/itopblock&gt;
&lt;/div&gt;</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>&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:left; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:40px;&quot;&gt;&lt;img src=&quot;/images/devices_big.gif&quot; align=&quot;baseline&quot;&gt;Devices Overview&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;table border=&quot;0&quot; padding=&quot;5&quot; class=&quot;layout&quot;&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p style=&quot;text-align:left; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:18px;&quot;&gt;Servers&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizServer&quot; type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:pie;group_by:severity&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizServer&lt;/itopblock&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p style=&quot;text-align:left; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:18px;&quot;&gt;PCs&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizPC&quot; type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:pie;group_by:severity&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizPC&lt;/itopblock&gt;
&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td&gt;
&lt;p style=&quot;text-align:left; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:18px;&quot;&gt;Netword Devices&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizNetworDevice type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:pie;group_by:severity&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizNetworkDevice&lt;/itopblock&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p style=&quot;text-align:left; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:18px;&quot;&gt;Applications&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizApplication&quot; type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:pie;group_by:severity&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizApplication&lt;/itopblock&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</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>&lt;style&gt;
td.dashboard {
vertical-align:top;
text-align: center;
border: 1px solid #ccc;
-moz-border-radius: 10px;
padding: 10px;
}
&lt;/style&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:24px;&quot;&gt;Infrastructure Overview&lt;/p&gt;
&lt;table border=&quot;0&quot; padding=&quot;5&quot; class=&quot;layout&quot;&gt;
&lt;tr&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;logInfra&quot; type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:pie;group_by:status;chart_title:Infrastructure Objects by status&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;logInfra&lt;/itopblock&gt;
&lt;/td&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;logInfra&quot; type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:bars;group_by:finalclass;chart_title:Infrastructure Objects by type&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;logInfra&lt;/itopblock&gt;
&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;&quot;&gt;Infrastructure Objects by type&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;logInfra&quot; type=&quot;count&quot; parameters=&quot;group_by:finalclass&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;logInfra&lt;/itopblock&gt;
&lt;/td&gt;
&lt;td&gt;
&amp;nbsp;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</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>&lt;img src=&quot;/images/users2-big.png&quot; style=&quot;float:right&quot;&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:24px;&quot;&gt;Contacts Overview&lt;/p&gt;
&lt;table border=&quot;0&quot; padding=&quot;5&quot; class=&quot;layout&quot;&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;&quot;&gt;Contacts by Type&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;count&quot; parameters=&quot;group_by:finalclass&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizContact&lt;/itopblock&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;&quot;&gt;Contacts by Location&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;count&quot; parameters=&quot;group_by:location_name&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizContact&lt;/itopblock&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;&quot;&gt;Contacts by status&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;count&quot; parameters=&quot;group_by:status&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizContact&lt;/itopblock&gt;
&lt;/td&gt;
&lt;/table&gt;</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="18">
<parent_id>17</parent_id>
<name>Data Model</name>
<label>Overview of the Data Model</label>
<hyperlink>schema.php</hyperlink>
<template></template>
<rank>999</rank>
<type>application</type>
</menuNode>
<menuNode id="12">
<parent_id>1</parent_id>
<name>Document</name>
<label>Any object of class &apos;Document&apos;</label>
<hyperlink>UI.php</hyperlink>
<template>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizDocument&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:24px;&quot;&gt;All Documents&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizDocument&lt;/itopblock&gt;
&lt;/div&gt;</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizInfraGroup&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizInfraGroup&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:24px;&quot;&gt;All Groups&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;Infra Group&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizInfraGroup&lt;/itopblock&gt;
&lt;/div&gt;
</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>&lt;style&gt;
.dashboard {
vertical-align:top;
width:50%;
border:1px solid #000;
-moz-border-radius:10px;
padding:5px;
text-align:center;
}
&lt;/style&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:24px;&quot;&gt;Incidents Overview&lt;/p&gt;
&lt;table border=&quot;0&quot; padding=&quot;5&quot;&gt;
&lt;tr&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizIncidentTicket&quot; type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:pie;group_by:type;chart_title:Incidents by Type&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizIncidentTicket&lt;/itopblock&gt;
&lt;/td&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizIncidentTicket&quot; type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:bars;group_by:ticket_status;chart_title:Incidents by status&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizIncidentTicket&lt;/itopblock&gt;
&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;&quot;&gt;Incidents by Workgroup&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizIncidentTicket&quot; type=&quot;count&quot; parameters=&quot;group_by:workgroup_name&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizIncidentTicket&lt;/itopblock&gt;
&lt;/td&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;&quot;&gt;Incidents not yet assigned&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizIncidentTicket&quot; type=&quot;list&quot; parameters=&quot;dashboard:true&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizIncidentTicket: ticket_status = &apos;New&apos;&lt;/itopblock&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizKnownErrort&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizKnownError&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizKnownError&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizKnownError&lt;/itopblock&gt;
&lt;/div&gt;</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizLocation&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizLocation&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:24px;&quot;&gt;All Locations&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizLocation&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizLocation&lt;/itopblock&gt;
&lt;/div&gt;</template>
<rank>5</rank>
<type>application</type>
</menuNode>
<menuNode id="65">
<parent_id>64</parent_id>
<name>Negociating contracts</name>
<label>Negociating contracts</label>
<hyperlink>UI.php</hyperlink>
<template>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizContract: status = &apos;Negotiating&apos;&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizContract: status = &apos;Negotiating&apos;&lt;/itopblock&gt;
&lt;/div&gt;</template>
<rank>1</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizChangeTicket: ticket_status != &apos;Closed&apos;&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizChangeTicket: ticket_status != &apos;Closed&apos;&lt;/itopblock&gt;
&lt;/div&gt;</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizIncidentTicket: ticket_status Contains &apos;Open&apos; AND severity Contains &apos;critical&apos;&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizIncidentTicket: ticket_status != &apos;Closed&apos;&lt;/itopblock&gt;
&lt;/div&gt;</template>
<rank>1</rank>
<type>application</type>
</menuNode>
<menuNode id="14">
<parent_id>2</parent_id>
<name>Persons</name>
<label>Any contact of class &apos;Person&apos;</label>
<hyperlink>UI.php</hyperlink>
<template>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizPerson&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizPerson&lt;/itopblock&gt;
&lt;/div&gt;</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>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizChangeTicket&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizChangeTicket: outage = &apos;Yes&apos; AND ticket_status != &apos;Closed&apos;&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizChangeTicket&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizChangeTicket: outage = &apos;Yes&apos; AND ticket_status != &apos;Closed&apos;&lt;/itopblock&gt;
&lt;/div&gt;</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>&lt;style&gt;
.dashboard {
vertical-align:top;
width:50%;
border:1px solid #000;
-moz-border-radius:10px;
padding:5px;
text-align:center;
}
&lt;/style&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:24px;&quot;&gt;Changes Overview&lt;/p&gt;
&lt;table border=&quot;0&quot; padding=&quot;5&quot;&gt;
&lt;tr&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContract&quot; type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:bars;group_by:type;chart_title:Contract by service level&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizContract&lt;/itopblock&gt;
&lt;/td&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContract&quot; type=&quot;open_flash_chart&quot; parameters=&quot;chart_type:pie;group_by:status;chart_title:Contracts by status&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizContract&lt;/itopblock&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;dashboard&quot;&gt;
&lt;p style=&quot;text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;&quot;&gt;Contracts ending in 30 days&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContract&quot; type=&quot;list&quot; parameters=&quot;dashboard:true&quot; asynchronous=&quot;false&quot; encoding=&quot;text/oql&quot;&gt;SELECT bizContract WHERE bizContract.end_prod = (TO_DAYS(NOW()) + TO_DAYS(30))&lt;/itopblock&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</template>
<rank>5</rank>
<type>application</type>
</menuNode>
<menuNode id="43">
<parent_id>2</parent_id>
<name>Teams</name>
<label>Any contact of class &apos;team&apos;</label>
<hyperlink>UI.php</hyperlink>
<template>&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;search&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizTeam&lt;/itopblock&gt;
&lt;div id=&quot;BottomPane&quot;&gt;
&lt;p&gt;&lt;/p&gt;
&lt;itopblock BlockClass=&quot;DisplayBlock&quot; objectclass=&quot;bizContact&quot; type=&quot;list&quot; asynchronous=&quot;false&quot; encoding=&quot;text/sibusql&quot;&gt;bizTeam&lt;/itopblock&gt;
&lt;/div&gt;</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>
<menuNode id="76">
<parent_id>0</parent_id>
<name>Welcome</name>
<label>Welcome</label>
<hyperlink>./UI.php</hyperlink>
<template>&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:32px;&quot;&gt;Welcome to iTop&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style=&quot;text-align:center; font-family:Georgia, &apos;Times New Roman&apos;, Times, serif; font-size:14px;&quot;&gt;&lt;i&gt;Version 0.7&lt;/i&gt;&lt;/p&gt;
</template>
<rank>1</rank>
<type>application</type>
</menuNode>
</Set>

BIN
setup/orange-progress.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

138
setup/setup.js Normal file
View File

@@ -0,0 +1,138 @@
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;
case 4:
bResult = DoLoadDataAsynchronous();
}
if (bResult)
{
$('#setup').block({message: '<img src="../images/indicator.gif">&nbsp;'+sMsg});
}
return bResult;
}
var aFilesToLoad = new Array();
function DoLoadDataAsynchronous()
{
// Check if sample data must be loaded, or just the menus
aFilesToLoad[aFilesToLoad.length] = './menus.xml'; // First load the menus
if (($("#sample_data:checked").length == 1))
{
PopulateDataFilesList(); // Function created in PHP to get the list of XML files on the server
}
$('#setup').block({message: '<p>Loading data...<br/><div id=\"progress\">0%</div></p>'});
$('#progress').progression( {Current:0, Maximum: 100, aBackgroundImg: 'orange-progress.gif', aTextColor: '#000000'} );
LoadNextDataFile('', '');
return false; // Stop here for now
}
var iCounter = 0;
function LoadNextDataFile(sData, sTextStatus)
{
//$("#progress").html(sData);
if (iCounter < aFilesToLoad.length)
{
if (iCounter == (aFilesToLoad.length - 1))
{
// Last file in the list (or only 1 file), this completes the session
sSessionStatus = 'end';
}
else if (iCounter == 0)
{
// First file in the list, start the session
sSessionStatus = 'start';
}
else
{
sSessionStatus = 'continue';
}
iPercent = Math.round((100.0 * (1+iCounter)) / aFilesToLoad.length);
sFileName = aFilesToLoad[iCounter];
//alert('Loading file '+sFileName+' ('+iPercent+' %) - '+sSessionStatus);
$("#progress").progression({ Current: iPercent });
iCounter++;
$.get( 'ajax.dataloader.php', { 'file': sFileName, 'percent': iPercent, 'session_status': sSessionStatus }, LoadNextDataFile, 'html');
}
else
{
// We're done
$('#setup').unblock();
$('#GoToNextStep').submit(); // Use the hidden form to navigate to the next step
}
}

View File

@@ -0,0 +1,176 @@
<?php
require_once("../application/nicewebpage.class.inc.php");
define('INSTALL_LOG_FILE', '../setup.log');
/**
* Web page used for displaying the login form
*/
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;
margin: 0;
padding: 0;
font-size: 10pt;
}
#setup {
width: 600px;
margin-left: auto;
margin-right: auto;
margin-top: 50px;
padding: 20px;
background-color: #fff;
border: 1px solid #000;
}
.center {
text-align: center;
}
h1 {
color: #83b217;
font-size: 16pt;
}
h2 {
color: #000;
font-size: 14pt;
}
.v-spacer {
padding-top: 1em;
}
button {
margin-top: 1em;
padding-left: 1em;
padding-right: 1em;
}
p.info {
padding-left: 50px;
background: url(../images/info-mid.png) no-repeat top left;
height: 48px;
line-height: 48px;
}
p.ok {
padding-left: 50px;
background: url(../images/clean-mid.png) no-repeat top left;
height: 48px;
line-height: 48px;
}
p.warning {
padding-left: 50px;
background: url(../images/messagebox_warning-mid.png) no-repeat top left;
height: 48px;
line-height: 48px;
}
p.error {
padding-left: 50px;
background: url(../images/stop-mid.png) no-repeat top left;
height: 48px;
line-height: 48px;
}
td.label {
text-align: left;
}
td.input {
text-align: left;
}
table.formTable {
border: 0;
cellpadding: 2px;
cellspacing: 0;
}
.wizlabel, .wizinput {
color: #000;
font-size: 10pt;
}
.wizhelp {
color: #333;
font-size: 8pt;
}
#progress {
border:1px solid #000000;
width: 180px;
height: 20px;
line-height: 20px;
text-align: center;
margin: 5px;
}
");
}
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)
{
$this->add("<table class=\"formTable\">\n");
foreach($aData as $aRow)
{
$this->add("<tr>\n");
if (isset($aRow['label']) && isset($aRow['label']) && isset($aRow['help']))
{
$this->add("<td class=\"wizlabel\">{$aRow['label']}</td>\n");
$this->add("<td class=\"wizinput\">{$aRow['input']}</td>\n");
$this->add("<td class=\"wizhelp\">{$aRow['help']}</td>\n");
}
else if (isset($aRow['label']) && isset($aRow['help']))
{
$this->add("<td colspan=\"2\" class=\"wizlabel\">{$aRow['label']}</td>\n");
$this->add("<td class=\"wizhelp\">{$aRow['help']}</td>\n");
}
else if (isset($aRow['label']) && isset($aRow['input']))
{
$this->add("<td class=\"wizlabel\">{$aRow['label']}</td>\n");
$this->add("<td colspan=\"2\" class=\"wizinput\">{$aRow['input']}</td>\n");
}
else if (isset($aRow['label']))
{
$this->add("<td colspan=\"3\" class=\"wizlabel\">{$aRow['label']}</td>\n");
}
$this->add("</tr>\n");
}
$this->add("</table>\n");
}
public function output()
{
$this->s_content = "<div id=\"setup\">{$this->s_content}\n</div>\n";
return parent::output();
}
public static 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
?>

View File

@@ -0,0 +1,282 @@
<?php
define ('KEYS_CACHE_FILE', '../keyscache.tmp');
/**
* Class to load sets of objects from XML files into the database
* XML files can be produced by the 'export' web service or by any other means
* Here is a simple example:
* $oLoader = new XMLDataLoader('../itop-config.php');
* $oLoader->StartSession();
* $oLoader->LoadFile('./organizations.xml');
* $oLoader->LoadFile('./locations.xml');
* $oLoader->EndSession();
*/
class XMLDataLoader
{
protected $m_aKeys;
protected $m_aObjectsCache;
protected $m_bSessionActive;
protected $m_oChange;
protected $m_sCacheFileName;
public function __construct($sConfigFileName)
{
$this->m_aKeys = array();
$this->m_aObjectsCache = array();
$this->m_oChange = null;
$this->m_sCacheFileName = dirname(__FILE__).'/'.KEYS_CACHE_FILE;
$this->InitDataModel($sConfigFileName);
$this->LoadKeysCache();
$this->m_bSessionActive = true;
}
public function StartSession($oChange)
{
$this->m_oChange = $oChange;
$this->m_bSessionActive = true;
}
public function EndSession()
{
$this->ResolveExternalKeys();
$this->m_bSessionActive = false;
}
public function __destruct()
{
// Stopping in the middle of a session, let's save the context information
if ($this->m_bSessionActive)
{
$this->SaveKeysCache();
}
else
{
$this->ClearKeysCache();
}
}
/**
* Initializes the ORM (MetaModel)
*/
protected function InitDataModel($sConfigFileName, $bAllowMissingDatabase = true)
{
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($sConfigFileName, $bAllowMissingDatabase);
}
/**
* Stores the keys & object cache in a file
*/
protected function SaveKeysCache()
{
$hFile = @fopen($this->m_sCacheFileName, 'w');
if ($hFile !== false)
{
$sData = serialize( array('keys' => $this->m_aKeys,
'objects' => $this->m_aObjectsCache,
'change' => $this->m_oChange));
fwrite($hFile, $sData);
fclose($hFile);
}
else
{
echo "<p><strong>Error: Cannot write to file: '{$this->m_sCacheFileName}'!</strong></p>";
}
}
/**
* Loads the keys & object cache from the tmp file
*/
protected function LoadKeysCache()
{
$sFileContent = @file_get_contents($this->m_sCacheFileName);
if (!empty($sFileContent))
{
$aCache = unserialize($sFileContent);
$this->m_aKeys = $aCache['keys'];
$this->m_aObjectsCache = $aCache['objects'];
$this->m_oChange = $aCache['change'];
}
}
/**
* Remove the tmp file used to store the keys cache
*/
protected function ClearKeysCache()
{
if(is_file($this->m_sCacheFileName))
{
unlink($this->m_sCacheFileName);
}
else
{
//echo "<p>Hm, it looks like the file does not exist!!!</p>";
}
$this->m_aKeys = array();
$this->m_aObjectsCache = array();
}
/**
* Helper function to load the objects from a standard XML file into the database
*/
function LoadFile($sFilePath)
{
global $aKeys;
$oXml = simplexml_load_file($sFilePath);
$aReplicas = array();
foreach($oXml as $sClass => $oXmlObj)
{
$iSrcId = (integer)$oXmlObj['id']; // Mandatory to cast
// Import algorithm
// Here enumerate all the attributes of the object
// for all attribute that is neither an external field
// not an external key, assign it
// Store all external keys for further reference
// Create the object an store the correspondence between its newly created Id
// and its original Id
// Once all the objects have been created re-assign all the external keys to
// their actual Ids
$oTargetObj = MetaModel::NewObject($sClass);
foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode=>$oAttDef)
{
if (($oAttDef->IsWritable()) && ($oAttDef->IsScalar()) && ($sAttCode != 'finalclass') )
{
if ($oAttDef->IsExternalKey())
{
$iDstObj = (integer)($oXmlObj->$sAttCode);
$iExtKey = $this->GetObjectKey($oAttDef->GetTargetClass(), $iDstObj);
if ($iExtKey == 0)
{
$iExtKey = -$iDstObj; // Convention: Unresolved keys are stored as negative !
}
// tested by Romain, little impact on perf (not significant on the intial setup)
//$oTargetObj->CheckValue($sAttCode, $iExtKey);
$oTargetObj->Set($sAttCode, $iExtKey);
}
else
{
// tested by Romain, little impact on perf (not significant on the intial setup)
//$oTargetObj->CheckValue($sAttCode, (string)$oXmlObj->$sAttCode);
$oTargetObj->Set($sAttCode, (string)$oXmlObj->$sAttCode);
}
}
}
$this->StoreObject($sClass, $oTargetObj, $iSrcId);
}
return true;
}
/**
* Get the new ID of an object in the database given its original ID
* This may fail (return 0) if the object has not yet been created in the database
* This is why the order of the import may be important
*/
protected function GetObjectKey($sClass, $iSrcId)
{
if (isset($this->m_aKeys[$sClass]) && isset($this->m_aKeys[$sClass][$iSrcId]))
{
return $this->m_aKeys[$sClass][$iSrcId];
}
return 0;
}
/**
* Store an object in the database and remember the mapping
* between its original ID and the newly created ID in the database
*/
protected function StoreObject($sClass, $oTargetObj, $iSrcId)
{
try
{
if (is_subclass_of($oTargetObj, 'CMDBObject'))
{
$iObjId = $oTargetObj->DBInsertTrackedNoReload($this->m_oChange);
}
else
{
$iObjId = $oTargetObj->DBInsertNoReload();
}
}
catch(Exception $e)
{
echo $e->GetHtmlDesc();
}
$aParentClasses = MetaModel::EnumParentClasses($sClass);
$aParentClasses[] = $sClass;
foreach($aParentClasses as $sObjClass)
{
$this->m_aKeys[$sObjClass][$iSrcId] = $iObjId;
}
$this->m_aObjectsCache[$sClass][$iObjId] = $oTargetObj;
}
/**
* Maps an external key to its (newly created) value
*/
protected function ResolveExternalKeys()
{
foreach($this->m_aObjectsCache as $sClass => $oObjList)
{
foreach($oObjList as $oTargetObj)
{
$bChanged = false;
$sClass = get_class($oTargetObj);
foreach(MetaModel::ListAttributeDefs($sClass) as $sAttCode=>$oAttDef)
{
if ( ($oAttDef->IsExternalKey()) && ($oTargetObj->Get($sAttCode) < 0) ) // Convention unresolved key = negative
{
$iExtKey = $this->GetObjectKey($oAttDef->GetTargetClass(), -$oTargetObj->Get($sAttCode));
if ($iExtKey == 0)
{
echo "Warning: unresolved extkey in $sClass::".$oTargetObj->GetName()."(".$oTargetObj->GetKey().")::$sAttCode=".$oAttDef->GetTargetClass()."[".$oTargetObj->Get($sAttCode)."]<br/>\n";
echo "<pre>aKeys[".$oAttDef->GetTargetClass()."]:\n";
print_r($this->m_aKeys[$oAttDef->GetTargetClass()]);
echo "</pre>\n";
}
else
{
$bChanged = true;
$oTargetObj->Set($sAttCode, $iExtKey);
}
}
}
if ($bChanged)
{
try
{
if (is_subclass_of($oTargetObj, 'CMDBObject'))
{
$oTargetObj->DBUpdateTracked($this->m_oChange);
}
else
{
$oTargetObj->DBUpdate();
}
}
catch(Exception $e)
{
echo $e->GetHtmlDesc();
}
}
}
}
return true;
}
}
?>