diff --git a/application/itopwebpage.class.inc.php b/application/itopwebpage.class.inc.php index 98dafd2c4..d9d00c49c 100644 --- a/application/itopwebpage.class.inc.php +++ b/application/itopwebpage.class.inc.php @@ -99,6 +99,18 @@ class iTopWebPage extends NiceWebPage { $sInitClosed = 'initClosed: true,'; } + + $this->add_script( +<<m_sInitScript = <<< EOF @@ -709,6 +721,10 @@ EOF $aActions[$oChangePwd->GetUID()] = $oChangePwd->GetMenuItem(); } utils::GetPopupMenuItems($this, iPopupMenuExtension::MENU_USER_ACTIONS, null, $aActions); + + $oAbout = new JSPopupMenuItem('UI:AboutBox', Dict::S('UI:AboutBox'), 'return ShowAboutBox();'); + $aActions[$oAbout->GetUID()] = $oAbout->GetMenuItem(); + $sLogOffMenu .= $this->RenderPopupMenuItems($aActions); diff --git a/dictionaries/dictionary.itop.ui.php b/dictionaries/dictionary.itop.ui.php index 939cb8ea3..fc7ccf0c1 100644 --- a/dictionaries/dictionary.itop.ui.php +++ b/dictionaries/dictionary.itop.ui.php @@ -1199,5 +1199,11 @@ When associated with a trigger, each action is given an "order" number, specifyi 'UI:Button:Remove' => 'Remove', 'UI:AddAnExisting_Class' => 'Add objects of type %1$s...', 'UI:SelectionOf_Class' => 'Selection of objects of type %1$s', + + 'UI:AboutBox' => 'About iTop...', + 'UI:About:Title' => 'About iTop', + 'UI:About:Support' => 'Support information', + 'UI:About:Licenses' => 'Licenses', + 'UI:About:Modules' => 'Installed modules', )); ?> diff --git a/dictionaries/fr.dictionary.itop.ui.php b/dictionaries/fr.dictionary.itop.ui.php index a0afd2ee2..f894dbef4 100644 --- a/dictionaries/fr.dictionary.itop.ui.php +++ b/dictionaries/fr.dictionary.itop.ui.php @@ -1040,5 +1040,11 @@ Lors de l\'association à un déclencheur, on attribue à chaque action un numé 'UI:Button:Remove' => 'Enlever', 'UI:AddAnExisting_Class' => 'Ajouter des objets de type %1$s...', 'UI:SelectionOf_Class' => 'Sélection d\'objets de type %1$s', + + 'UI:AboutBox' => 'A propos d\'iTop...', + 'UI:About:Title' => 'A propos d\'iTop', + 'UI:About:Support' => 'Informations pour le support', + 'UI:About:Licenses' => 'Licences', + 'UI:About:Modules' => 'Modules installés', )); ?> diff --git a/pages/ajax.render.php b/pages/ajax.render.php index 58cca468a..bcf4b4ecc 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -1098,6 +1098,158 @@ EOF $oPage->add(json_encode($aResult)); break; + case 'about_box': + $oPage->SetContentType('text/html'); + + $sDialogTitle = Dict::S('UI:About:Title'); + $sOkButtonLabel = Dict::S('UI:Button:Ok'); + $oPage->add_ready_script( +<< false)); // Most recent first + $oLastInstall = $oSet->Fetch(); + $sLastInstallDate = $oLastInstall->Get('installed'); + $sDataModelVersion = $oLastInstall->Get('version'); + $aDataModelInfo = json_decode($oLastInstall->Get('comment'), true); + $sDataModelSourceDir = $aDataModelInfo['source_dir']; + + require_once(APPROOT.'setup/runtimeenv.class.inc.php'); + $sCurrEnv = utils::GetCurrentEnvironment(); + $oRuntimeEnv = new RunTimeEnvironment($sCurrEnv); + $aAvailableModules = $oRuntimeEnv->AnalyzeInstallation(MetaModel::GetConfig(), array(APPROOT.$sDataModelSourceDir)); + + require_once(APPROOT.'setup/setuputils.class.inc.php'); + $aLicenses = SetupUtils::GetLicenses(); + + $aItopSettings = array('cron_max_execution_time', 'timezone'); + $aPHPSettings = array('memory_limit', 'max_execution_time', 'upload_max_filesize', 'post_max_size'); + $aMySQLSettings = array('max_allowed_packet', 'key_buffer_size', 'query_cache_size'); + $aMySQLStatuses = array('Key_read_requests', 'Key_reads'); + + if (extension_loaded('suhosin')) + { + $aPHPSettings[] = 'suhosin.post.max_vars'; + $aPHPSettings[] = 'suhosin.get.max_value_length'; + } + + $aMySQLVars = array(); + foreach (CMDBSource::QueryToArray('SHOW VARIABLES') as $aRow) + { + $aMySQLVars[$aRow['Variable_name']] = $aRow['Value']; + } + + $aMySQLStats = array(); + foreach (CMDBSource::QueryToArray('SHOW GLOBAL STATUS') as $aRow) + { + $aMySQLStats[$aRow['Variable_name']] = $aRow['Value']; + } + + // Display + // + $oPage->add("
"); + $oPage->p('iTop '.$sVersionString); + $oPage->p('Data model '.$sDataModelVersion); + + $oPage->p('MySQL '.$sMySQLVersion); + $oPage->p('PHP '.$sPHPVersion); + + $oPage->add("
"); + $oPage->add('
'); + $oPage->add(''.Dict::S('UI:About:Licenses').''); + $oPage->add('
    '); + foreach($aLicenses as $index => $oLicense) + { + $oPage->add('
  • '.$oLicense->product.', © '.$oLicense->author.' is licensed under the '.$oLicense->license_type.' license. (Details)'); + $oPage->add(''); + $oPage->add_ready_script('$("#toggle_'.$index.'").click( function() { $("#license_'.$index.'").slideToggle("normal"); } );'); + } + $oPage->add('
'); + $oPage->add('
'); + $oPage->add("
"); + + $oPage->add('
'); + $oPage->add(''.Dict::S('UI:About:Modules').''); + //$oPage->add(print_r($aAvailableModules, true)); + $oPage->add("
"); + $oPage->add('
    '); + foreach ($aAvailableModules as $sModuleId => $aModuleData) + { + if ($sModuleId == '_Root_') continue; + if (!$aModuleData['visible']) continue; + if ($aModuleData['version_db'] == '') continue; + $oPage->add('
  • '.$aModuleData['label'].' '.$aModuleData['version_db'].'
  • '); + } + $oPage->add('
'); + $oPage->add("
"); + $oPage->add('
'); + + + // MUST NOT be localized, as the information given here will be sent to the support + $oPage->add("".Dict::S('UI:About:Support')."
\n"); + $oPage->add("
"); + $oPage->add(''); + $oPage->add("
"); + + $oPage->add("
"); + break; + default: $oPage->p("Invalid query."); } diff --git a/setup/setuputils.class.inc.php b/setup/setuputils.class.inc.php index f738fa054..c53f5b265 100644 --- a/setup/setuputils.class.inc.php +++ b/setup/setuputils.class.inc.php @@ -1394,7 +1394,25 @@ EOF } return false; } + + /** + * Returns an array of xml nodes describing the licences + */ + static public function GetLicenses() + { + $aLicenses = array(); + foreach (glob(APPROOT.'setup/licenses/*.xml') as $sFile) + { + $oXml = simplexml_load_file($sFile); + foreach($oXml->license as $oLicense) + { + $aLicenses[] = $oLicense; + } + } + return $aLicenses; + } } + /** * Helper class to write rules (as PHP expressions) in the 'auto_select' field of the 'module' */ diff --git a/setup/wizardsteps.class.inc.php b/setup/wizardsteps.class.inc.php index 2f46b0ae3..f5af1b964 100644 --- a/setup/wizardsteps.class.inc.php +++ b/setup/wizardsteps.class.inc.php @@ -650,19 +650,11 @@ class WizStepLicense extends WizardStep $this->oWizard->SaveParameter('accept_license', 'no'); return array('class' => 'WizStepDBParams', 'state' => ''); } - + public function Display(WebPage $oPage) { - $aLicenses = array(); - foreach (glob(APPROOT.'setup/licenses/*.xml') as $sFile) - { - $oXml = simplexml_load_file($sFile); - foreach($oXml->license as $oLicense) - { - $aLicenses[] = $oLicense; - } - } - + $aLicenses = SetupUtils::GetLicenses(); + $oPage->add('

Licenses agreements for the components of '.ITOP_APPLICATION.'

'); $oPage->add_style('div a.no-arrow { background:transparent; padding-left:0;}'); $oPage->add_style('.toggle { cursor:pointer; text-decoration:underline; color:#1C94C4; }');