From bd3e09a9b8dc160941c70c1149bae414ca1d0548 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Tue, 4 May 2010 14:23:06 +0000 Subject: [PATCH] Remove unused/obsolete pages SVN:trunk[396] --- pages/advanced_search.php | 310 ------------------------------------ pages/ajax.php | 40 ----- pages/data_generator.php | 321 -------------------------------------- pages/db_importer.php | 171 -------------------- 4 files changed, 842 deletions(-) delete mode 100644 pages/advanced_search.php delete mode 100644 pages/ajax.php delete mode 100644 pages/data_generator.php delete mode 100644 pages/db_importer.php diff --git a/pages/advanced_search.php b/pages/advanced_search.php deleted file mode 100644 index cb2a4ec6b0..0000000000 --- a/pages/advanced_search.php +++ /dev/null @@ -1,310 +0,0 @@ -no_cache(); - - -MetaModel::CheckDefinitions(); -// new API - MetaModel::DBCheckFormat(); -// not necessary, and time consuming! -// MetaModel::DBCheckIntegrity(); - - -function ReadParam($sName, $defaultValue = "") -{ - return isset($_REQUEST[$sName]) ? $_REQUEST[$sName] : $defaultValue; -} - - - -function Page1_AskClass($oPage) -{ - $oPage->add("
\n"); - //$oPage->add(""); - $oPage->p("Please select the type of object that you want to look for:"); - $oPage->MakeClassesSelect("class", "", 50, UR_ACTION_READ); - $oPage->add("\n"); - $oPage->add("
\n"); -} - - -function Page2_ConfigFilters($oPage, $oFilter) -{ - $sClass = $oFilter->GetClass(); - - $oPage->p("Objects of class $sClass"); - $oPage->add("
\n"); - $oPage->add("\n"); - - // Full text input - // - $oPage->add("
\n"); - $oPage->add("Full text: "); - $sFullText = ""; - foreach($oFilter->GetCriteria_FullText() as $sFullText) - { - // #@# Known limitation: do not consider other full text conditions... - continue; - } - - $oPage->add("\n"); - $oPage->add("
\n"); - - // Attribute-related criteria - // - foreach (MetaModel::GetClassFilterDefs($sClass) as $sFltCode => $oFltDef) - { - // Set its current values - $sOpCode = "__none__"; - $sValue = ""; - foreach($oFilter->GetCriteria() as $aCritInfo) - { - if ($aCritInfo["filtercode"] == "id") - { - // ??? - } - elseif ($aCritInfo["filtercode"] == $sFltCode) - { - $sOpCode = $aCritInfo["opcode"]; - $sValue = $aCritInfo["value"]; - break; - } - } - - $oPage->add("
\n"); - //$oPage->add($oFltDef->GetType()." (".$oFltDef->GetTypeDesc().")"); - $oPage->add(" ".$oFltDef->GetLabel()." "); - - $aOperators = array_merge(array("__none__" => ""), $oFltDef->GetOperators()); - $oPage->add_select($aOperators, "flt_ops[$sFltCode]", $sOpCode, 100); - $oPage->add("\n"); - - $oPage->add("\n"); - $oPage->add("
\n"); - } - - // Ext key criteria - // - foreach (MetaModel::EnumReferencedClasses($sClass) as $sExtKeyAttCode => $sRemoteClass) - { - // Set its current values - $oSubFilter = $oFilter->GetCriteria_PointingTo($sExtKeyAttCode); - if (!$oSubFilter) - { - $oSubFilter = new CMDBSearchFilter($sRemoteClass); - } - - $oPage->add("
\n"); - $oAtt = MetaModel::GetAttributeDef($oFilter->GetClass(), $sExtKeyAttCode); - $oPage->add($oAtt->GetLabel()." having ({$oSubFilter->DescribeConditions()})"); - //$oPage->add("having $oFilter->DescribeConditionPointTo($sExtKeyAttCode)); - $oPage->add("\n"); - - $oPage->add(dialogstack::RenderEditableField("Edit...", "flt_pointto[$sExtKeyAttCode]", $oSubFilter->serialize(), true)); - $oPage->add("
\n"); - } - - // Ext key criteria, the other way - // - foreach (MetaModel::EnumReferencingClasses($sClass, true) as $sRemoteClass => $aRemoteKeys) - { - foreach ($aRemoteKeys as $sExtKeyAttCode => $oExtKeyAttDef) - { - // Set its current values - $oSubFilter = $oFilter->GetCriteria_ReferencedBy($sRemoteClass, $sExtKeyAttCode); - if (!$oSubFilter) - { - $oSubFilter = new CMDBSearchFilter($sRemoteClass); - } - - $oPage->add("
\n"); - //$oPage->add($oFilter->DescribeConditionRefBy($sRemoteClass, $sExtKeyAttCode)); - $oAtt = MetaModel::GetAttributeDef($sRemoteClass, $sExtKeyAttCode); - $oPage->add("being ".$oAtt->GetLabel()." for ".$sRemoteClass."(e)s in ({$oSubFilter->DescribeConditions()})"); - $oPage->add("\n"); - - $oPage->add(dialogstack::RenderEditableField("Edit...", "flt_refedby[$sRemoteClass][$sExtKeyAttCode]", $oSubFilter->serialize(), true)); - $oPage->add("
\n"); - } - } - - // Ext key criteria -> link objects - // - foreach (MetaModel::EnumLinkingClasses($sClass) as $sLinkClass => $aRemoteClasses) - { - foreach($aRemoteClasses as $sExtKeyAttCode => $sRemoteClass) - { - // Set its current values - //$oSubFilter = $oFilter->GetCriteria_PointingTo($sExtKeyAttCode); - $oSubFilter = null; - if (!$oSubFilter) - { - $oSubFilter = new CMDBSearchFilter($sRemoteClass); - } - $oPage->add("
\n"); - //$oPage->add(" ".MetaModel::GetName($sRemoteClass)." "); - $oPage->add(" Linked to '".MetaModel::GetLinkLabel($sLinkClass, $sExtKeyAttCode)."' by "); - $oSubFilter = new CMDBSearchFilter($sRemoteClass); - $oPage->add($oSubFilter->__DescribeHTML()); - $oPage->add("\n"); - - $oPage->add(dialogstack::RenderEditableField("Edit...", "flt_linkedwith[$sRemoteClass][$sExtKeyAttCode]", $oSubFilter->serialize(), true)); - $oPage->add("
\n"); - } - } - - $oPage->add("\n"); - $oPage->add("
\n"); -} - -function MakeFilterFromArgs() -{ - $sClass = ReadParam("class"); - $sFilterFullText = ReadParam("flt_fulltext", ""); - $aFilterOps = ReadParam("flt_ops", array()); - $aFilterValues = ReadParam("flt_values", array()); - $aPointTo = ReadParam("flt_pointto", array()); - $aRefedBy = ReadParam("flt_refedby", array()); - $aLinkedWith = ReadParam("flt_linkedwith", array()); - - $oFilter = new CMDBSearchFilter($sClass); - - if (!empty($sFilterFullText)) - { - $oFilter->AddCondition_FullText($sFilterFullText); - } - - foreach($aFilterOps as $sFltCode=>$sOpCode) - { - if ($sOpCode == "__none__") continue; - $oFilter->AddCondition($sFltCode, $aFilterValues[$sFltCode], $sOpCode); - } - - foreach($aPointTo as $sExtKeyAttCode=>$sFilterShortcut) - { - $oSubFilter = CMDBSearchFilter::unserialize($sFilterShortcut); - $oFilter->AddCondition_PointingTo($oSubFilter, $sExtKeyAttCode); - } - - foreach($aRefedBy as $sForeignClass=>$aExtKeys) - { - foreach($aExtKeys as $sForeignExtKey=>$sFilterShortcut) - { - //MyHelpers::var_dump_html("$sForeignClass / $sForeignExtKey / $sFilterShortcut"); - $oSubFilter = CMDBSearchFilter::unserialize($sFilterShortcut); - //MyHelpers::var_dump_html($oSubFilter); - $oFilter->AddCondition_ReferencedBy($oSubFilter, $sForeignExtKey); - } - } - -// $oFilter->AddCondition_LinkedTo(DBObjectSearch $oLinkFilter, $sExtKeyAttCodeToMe, $sExtKeyAttCodeTarget, DBObjectSearch $oFilterTarget); - - return $oFilter; -} - -function Page3_ViewResults($oPage, $oFilter) -{ - // Output results in various forms... - // - if ($oFilter->IsAny()) - { - $oPage->p("You are considering the ENTIRE set of objects..."); - } - else - { - $oPage->p($oFilter->__DescribeHTML()); - - $oSet = new CMDBObjectSet($oFilter); - $oPage->p("Found ".$oSet->Count()." items"); - - $sFilterPhrase = urlencode($oFilter->serialize()); - $oPage->p("See detailed results"); - } -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// -// M a i n P r o g r a m -// -/////////////////////////////////////////////////////////////////////////////////////////////////// - - -$oPage->p("

Advanced search

"); - - -// Page 1 - Ask class -// -// Page 2 - Class is given, enum existing filters/possible links -// -// Page 3 - Interpret user choices, create a filter and render its string representation -// - -//MyHelpers::arg_dump_html(); -//MyHelpers::var_dump_html($_SESSION); - -if (ReadParam('userconfig', false)) -{ - $sTodo = 'userconfig'; -} -if (ReadParam('makeit', false)) -{ - $sTodo = 'makeit'; -} -else -{ - if (dialogstack::IsDialogStartup()) - { - $sInit = dialogstack::StartDialog(); - $oFilter = CMDBSearchFilter::unserialize($sInit); - $sTodo = 'userconfig'; - } - else - { - $sClass = ReadParam('class', ''); - if (empty($sClass)) - { - $sTodo = 'selectclass'; - } - else - { - $oFilter = MakeFilterFromArgs(); - $sTodo = 'userconfig'; - } - } -} - -switch ($sTodo) -{ -case "selectclass": - Page1_AskClass($oPage); - break; - -case "userconfig": - dialogstack::DeclareCaller("Define filter for ".$oFilter->GetClass()); - $oPage->add(implode(" / ", dialogstack::GetCurrentStack())); - Page2_ConfigFilters($oPage, $oFilter); - break; - -case "makeit": - $oFilter = MakeFilterFromArgs(); - Page3_ViewResults($oPage, $oFilter); - $oPage->add(dialogstack::RenderEndDialogForm(DLGSTACK_OK, "Use filter", $oFilter->serialize())); - $oPage->add(dialogstack::RenderEndDialogForm(DLGSTACK_CANCEL, "Annuler")); - break; - -default: - trigger_error("Wrong value for arg todo ($sTodo)", E_USER_ERROR); -} - -$oPage->output(); - -?> diff --git a/pages/ajax.php b/pages/ajax.php deleted file mode 100644 index 76cef861a8..0000000000 --- a/pages/ajax.php +++ /dev/null @@ -1,40 +0,0 @@ -no_cache(); -$oPage->add("

Asynchronous versus asynchronous DisplayBlocks

\n"); - -$oContext = new UserContext(); -$operation = ReadParam('operation', ''); -$sClassName = ReadParam('class', 'bizContact'); -$sOrganizationCode = ReadParam('org', 'ITOP'); - -$oPage->p("[Synchronous] Count of all $sClassName objects for organization '$sOrganizationCode'"); -$oFilter = $oContext->NewFilter($sClassName); -$oFilter ->AddCondition('organization', $sOrganizationCode, '='); -$oBlock = new DisplayBlock($oFilter, 'count', false); -$oBlock->Display($oPage, "block1"); - -$oPage->p("[Asynchronous] All $sClassName objects for organization '$sOrganizationCode'"); -$oFilter = $oContext->NewFilter($sClassName); -$oFilter ->AddCondition('organization', $sOrganizationCode, '='); -$oBlock = new DisplayBlock($oFilter, 'list', true); -$oBlock->Display($oPage, "block2"); - -$oPage->p("[Asynchronous] Details of all $sClassName objects for organization '$sOrganizationCode'"); -$oFilter = $oContext->NewFilter($sClassName); -$oFilter ->AddCondition('organization', $sOrganizationCode, '='); -$oBlock = new DisplayBlock($oFilter, 'details', true); -$oBlock->Display($oPage, "block3"); - -$oPage->output(); -?> diff --git a/pages/data_generator.php b/pages/data_generator.php deleted file mode 100644 index c804788121..0000000000 --- a/pages/data_generator.php +++ /dev/null @@ -1,321 +0,0 @@ -\n"; - echo "DEBUG: \$_SERVER\n"; - print_r($_SERVER); - echo "\n"; - exit; -} -if (!UserRights::Login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) -{ - header('WWW-Authenticate: Basic realm="iTop"'); - header('HTTP/1.0 401 Unauthorized'); - echo 'Authentication failed !'; - exit; -} - -$oPage = new iTopWebPage("iTop Data Generator", $currentOrganization); -$oPage->no_cache(); - -// From now on the context is limited to the the selected organization ?? - -// Retrieve the root node for the menu -$oSearchFilter = $oContext->NewFilter("menuNode"); -$oSearchFilter->AddCondition('parent_id', 0, '='); -// There may be more criteria added later to have a specific menu based on the user's profile -$oSet = new CMDBObjectSet($oSearchFilter, array('rank' => true)); -while ($oRootMenuNode = $oSet->Fetch()) -{ - $oRootMenuNode->DisplayMenu($oPage, $oContext, $iActiveNodeId, null, $oAppContext->GetAsHash()); -} -/** - * The (ordered) list of classes for which to generate objects - * - * Each class in this list must implement a non-static Generate(cmdbDataGenerator $oGenerator) method - */ -//$aClassesToGenerate = array('bizOrganization' /* This one is special and must go first */, 'bizService', 'bizContact', 'bizPC', 'bizNetworkDevice'); -$aClassesToGenerate = array('bizOrganization' /* This one is special and must go first */, 'bizLocation', 'bizPC', 'bizNetworkDevice', 'bizPerson', 'bizIncidentTicket', 'bizInfraGroup', 'bizInfraInfra'); - -///////////////////////////////////////////////////////////////////////////////////// -// Actual actions of the page -///////////////////////////////////////////////////////////////////////////////////// - -/** - * Populate an organization with objects of each class listed in the (global) $aClassesToGenerate array - * - * @param WebPage $oPage The object used for the HTML output - * @param cmdbGenerator $oGenerator The object used for the generation of the objects - * @param string $sSize An enum specifying (roughly) how many objects of each class to create: one of 'small', 'medium', 'big', 'huge' or 'max' - */ -function PopulateOrganization(CMDBChange $oMyChange, WebPage $oPage, cmdbDataGenerator $oGenerator, $sSize = 'small') -{ - global $aClassesToGenerate; - - for ($i=1 /* skip the first one (i=0) which is the org itself */; $iGenerate($oGenerator); - // By rom - // $oObject->DBInsert(); - $oObject->DBInsertTracked($oMyChange); - - //$oObject->DisplayDetails($oPage); - } - } - $oPage->p("$nbObjects $sClass objects created."); - } -} - -/** - * Delete an organization and all the instances of 'Object' belonging to this organization - * - * @param WebPage $oPage The object used for the HTML output - * @param string $sOrganizationCode The code (pkey) of the organization to delete - */ -function DeleteOrganization($oMyChange, $oPage, $sOrganizationCode) -{ - $oOrg = MetaModel::GetObject('bizOrganization', $sOrganizationCode); - if ($oOrg == null) - { - $oPage->p("Organization '$sOrganizationCode' already deleted!!"); - } - else - { - // Delete all the objects linked to this organization - $oFilter = new CMDBSearchFilter('logRealObject'); - $oFilter->AddCondition('organization', $sOrganizationCode, '='); - $oSet = new CMDBObjectSet($oFilter); - $countDeleted = $oSet->Count(); - MetaModel::BulkDeleteTracked($oMyChange, $oFilter); // Should do a one by one delete to let the objects do their own cleanup ! - $oPage->p("$countDeleted object(s) deleted!!"); - - $oOrg->DBDeleteTracked($oMyChange); - $oPage->p("Ok, organization '$sOrganizationCode' deleted!"); - } -} - -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// M a i n P r o g r a m -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -$operation = utils::ReadParam('operation', ''); - -$oPage->add("
\n"); -$oPage->add("
\n"); - -switch($operation) -{ - - case 'specify_generate': - // Display a form to specify what to generate - $oPage->p("iTop Data Generator\n"); - $oPage->add("
\n"); - $oPage->add("Number of organizations to generate: \n"); - $oPage->add(" (max ".count($aCompanies).") \n"); - $oPage->add("Size of the organizations\n"); - $oPage->add("\n"); - $oPage->add("\n"); - $oPage->add("\n"); - $oPage->add("
\n"); - break; - - case 'generate': - // perform the actual generation - $iOrgCount = utils::ReadParam('org_count', 0); - $sOrgSize = utils::ReadParam('org_size', 'small'); - // By rom - $oMyChange = MetaModel::NewObject("CMDBChange"); - $oMyChange->Set("date", time()); - $oMyChange->Set("userinfo", "Made by data generator ($iOrgCount orgs of size '$sOrgSize')"); - $oMyChange->DBInsert(); - while($iOrgCount > 0) - { - set_time_limit(5*60); // let it run for 5 minutes for each organization - $oGenerator = new cmdbDataGenerator(); - // Create the new organization - $oOrg = MetaModel::NewObject('bizOrganization'); - $oOrg->Generate($oGenerator); - - // By rom - // $oOrg->DBInsert(); - $oOrg->DBInsertTracked($oMyChange); - $oGenerator->SetOrganizationId($oOrg->GetKey()); - - $oPage->p("Organization '".$oOrg->GetKey()."' created\n"); - $oOrg->DisplayDetails($oPage); - $oPage->add("
\n"); - PopulateOrganization($oMyChange, $oPage, $oGenerator, $sOrgSize); - $oPage->add("
\n"); - unset($oGenerator); - $iOrgCount--; - } - break; - - case 'specify_update': - // Specify which organization to update - $oPage->add("
\n"); - $oPage->add("Select the organization to update: \n"); - $oPage->add("\n"); - $oPage->add("\n"); - $oPage->p(""); - $oPage->add("Quantity of of objects to add in each class: \n"); - $oPage->add("\n"); - $oPage->p(""); - $oPage->add("  \n"); - $oPage->add("\n"); - $oPage->add("
\n"); - break; - - case 'update': - // perform the actual update - set_time_limit(5*60); // let it run for 5 minutes - $sOrganizationCode = utils::ReadParam('org', ''); - $sOrgSize = utils::ReadParam('org_size', 'small'); - if ($sOrganizationCode == '') - { - $oPage->p("Error: please specify an organization (org)."); - } - else - { - // By rom - $oMyChange = MetaModel::NewObject("CMDBChange"); - $oMyChange->Set("date", time()); - $oMyChange->Set("userinfo", "Made by data generator (update org '$sOrganizationCode', size '$sOrgSize')"); - $oMyChange->DBInsert(); - - $oPage->p("Organization '$sOrganizationCode' updated."); - $oGenerator = new cmdbDataGenerator($sOrganizationCode); - PopulateOrganization($oMyChange, $oPage, $oGenerator, $sOrgSize); - } - break; - - case 'specify_delete': - // Select an organization to be deleted - $oPage->add("
\n"); - $oPage->add("Select the organization to delete: \n"); - $oPage->add("\n"); - $oPage->add("\n"); - $oPage->p(""); - $oPage->add("  \n"); - $oPage->add("\n"); - $oPage->add("
\n"); - break; - - case 'confirm_delete': - // confirm the dangerous action - $sOrganizationCode = ReadParam('org', ''); - $oPage->p("iTop Data Generator\n"); - $oPage->p("Warning: you are about to delete the organization '$sOrganizationCode' and all its related objects\n"); - $oPage->add("
\n"); - $oPage->add("\n"); - $oPage->add("\n"); - $oPage->add("  \n"); - $oPage->add("\n"); - $oPage->add("
\n"); - break; - - case 'delete': - // perform the actual deletion - $sOrganizationCode = ReadParam('org', ''); - if ($sOrganizationCode == '') - { - $oPage->p("Error: please specify an organization (org)."); - } - else - { - // By rom - $oMyChange = MetaModel::NewObject("CMDBChange"); - $oMyChange->Set("date", time()); - $oMyChange->Set("userinfo", "Made by data generator (delete org '$sOrganizationCode'"); - $oMyChange->DBInsert(); - - $oPage->p("Deleting '$sOrganizationCode'\n"); - DeleteOrganization($oMyChange, $oPage, $sOrganizationCode); - } - break; - - // display the menu of actions - case 'menu': - default: - $oPage->p("Data Generator Menu"); - $oPage->p("Generate one or more organizations"); - $oPage->p("Add more objects into an organization"); - $oPage->p("Delete an organization"); -} -$oPage->add("
\n"); -$oPage->add("
\n"); - -$oPage->p("Return to the data generator menu"); - -$oPage->output(); -?> diff --git a/pages/db_importer.php b/pages/db_importer.php deleted file mode 100644 index cb56bf4e78..0000000000 --- a/pages/db_importer.php +++ /dev/null @@ -1,171 +0,0 @@ -add('
'); - $oP->add('

Creation of an archive for the business model: '.$sBizModel.'

'); - $oP->p('Title of the archive: '); - $oP->p('Description of this archive: '); - $oP->p('Select the packages you want to include into this archive (When restoring the archive you will prompted to pick a package):'); - $oP->p(' The full database (schema + data).'); - $oP->p(' Only the schema but of the complete database.'); - $oP->p(' The complete business model (all the tables used by the business model, schema + data).'); - $oP->p(' Only the schema of the business model.'); - $oP->add(''); - $oP->add(''); - $oP->add(''); - $oP->add($oAppContext->GetForForm()); - $oP->add('
'); - $oP->p('Back to menu'); - break; - - case 'do_create': - $sTitle = utils::ReadParam('title', 'Unknown archive'); - $sDescription = utils::ReadParam('description', 'No description provided for this archive.'); - $bfullDump = utils::ReadParam('full', false); - $bfullSchemaDump = utils::ReadParam('full_schema', false); - $bBizDump = utils::ReadParam('biz', false); - $bBizSchemaDump = utils::ReadParam('biz_schema', false); - $sArchiveFile = '../tmp/archive1.zip'; - - $oArchive = new iTopArchive($sArchiveFile, iTopArchive::create); - $oArchive->SetTitle($sTitle); - $oArchive->SetDescription($sDescription); - if ($bfullDump) - { - $oArchive->AddDatabaseDump("Full Database Dump", "Choose this option to completely reload your database. All current data will be deleted and replaced by the backup", "full-db.sql", 'itop', array(), false); - } - - if ($bfullSchemaDump) - { - $oArchive->AddDatabaseDump("Full Schema Dump", "Choose this option to completely wipe out your database and start from an empty database", "full-schema.sql", 'itop', array(), true); - } - - if ($bBizDump || $bBizSchemaDump) - { - // compute the list of the tables involved in the business model - $aBizTables = array(); - foreach(MetaModel::GetClasses('bizmodel') as $sClass) - { - $sTable = MetaModel::DBGetTable($sClass); - $aBizTables[$sTable] = $sTable; - } - unset($aBizTables['']); - if ($bfullDump) - { - $oArchive->AddDatabaseDump("Full Business Model Dump", "Choose this option to completely reload the business model part of your database. All current business data will be deleted and replaced by the backup. Application data (like menus...) are preserved.", "biz-db.sql", 'itop', $aBizTables, false); - } - - if ($bfullSchemaDump) - { - $oArchive->AddDatabaseDump("Full Business Model Schema Dump", "Choose this option to wipe out the business data and start from an empty database. All current business data will be deleted. Application data (like menus...) are preserved.", "biz-schema.sql", 'itop', $aBizTables, true); - } - } - $oArchive->WriteCatalog(); - $oP->p("The archive '$sTitle' has been created in $sArchiveFile."); - $oP->p('Back to menu'); - break; - - case 'select_archive': - $sArchivesDir = '../tmp'; - $oP->add('
'); - $oP->add('

Importation of an archive

'); - $oP->p('Select the archive you want to import:'); - $aArchives = array(); - if ($handle = opendir($sArchivesDir)) - { - while (false !== ($sFileName = readdir($handle))) - { - if (strtolower(substr($sFileName, -3, 3)) == 'zip') - { - $oArchive = new iTopArchive('../tmp/'.$sFileName, iTopArchive::read); - if ($oArchive->IsValid()) - { - $oArchive->ReadCatalog(); - $aArchives['../tmp/'.$sFileName] = $oArchive->GetTitle(); - } - } - } - closedir($handle); - } - foreach($aArchives as $sFileName => $sTitle) - { - $oP->p(''.$sTitle); - } - $oP->add(''); - $oP->add(''); - $oP->add(''); - $oP->add($oAppContext->GetForForm()); - $oP->add('
'); - $oP->p("(Archives are searched into the directory: $sArchivesDir.)"); - $oP->p('Cancel'); - break; - - case 'select_package': - $sArchiveFile = utils::ReadParam('archive_file', ''); - $oArchive = new iTopArchive($sArchiveFile, iTopArchive::read); - $oArchive->ReadCatalog(); - $oP->add('
'); - $oP->add('

Selection of a package inside '.$oArchive->GetTitle().'

'); - $oP->p('Select the package you want to apply:'); - $aPackages = $oArchive->GetPackages(); - foreach($aPackages as $sPackageName => $aPackage) - { - $oP->p(''.$aPackage['title']); - $oP->p($aPackage['description']); - } - $oP->add(''); - $oP->add(''); - $oP->add(''); - $oP->add(''); - $oP->add($oAppContext->GetForForm()); - $oP->add('
'); - $oP->p('Cancel'); - break; - - case 'import_package': - $sArchiveFile = utils::ReadParam('archive_file', ''); - $sPackageName = utils::ReadParam('package_name', ''); - $oArchive = new iTopArchive($sArchiveFile, iTopArchive::read); - $oArchive->ReadCatalog(); - $oP->add('

Applying the package '.$sPackageName.'

'); - if($oArchive->ImportSQL($sPackageName)) - { - $oP->p('Done.'); - } - else - { - $oP->p('Sorry, an error occured while applying the package...'); - } - $oP->p('Apply another package from the same archive'); - $oP->p('Select another archive'); - $oP->p('Back to the menu'); - break; - - case 'menu': - default: - $oP->add('

Database backup & restore

'); - $oP->add('

Select one of the actions below:

'); - $oP->add('

Export the database to an archive

'); - $oP->add('

Reload the database from an archive

'); -} - -$oP->output(); -?>