From 4e55731746daa018f72d66a539f288ec5868d158 Mon Sep 17 00:00:00 2001 From: Greg Roach Date: Wed, 21 Jan 2015 00:40:07 +0000 Subject: PGV wizard - styling --- admin_pgv_to_wt.php | 128 +++++++++++++++++++++++++++---------------------- admin_trees_config.php | 2 +- 2 files changed, 71 insertions(+), 59 deletions(-) diff --git a/admin_pgv_to_wt.php b/admin_pgv_to_wt.php index b5a4dc91e7..c717285a96 100644 --- a/admin_pgv_to_wt.php +++ b/admin_pgv_to_wt.php @@ -36,11 +36,15 @@ $controller ->restrictAccess(Auth::isAdmin()) ->setPageTitle(WT_I18N::translate('PhpGedView to webtrees transfer wizard')); -$error = ''; -$warning = ''; +$error = false; $PGV_PATH = WT_Filter::post('PGV_PATH'); // We read these variables from PGV's config.php, and set them here in case any are missing. +$INDEX_DIRECTORY = ''; +$DBHOST = ''; +$DBNAME = ''; +$TBLPREFIX = ''; +$PGV_SCHEMA_VERSION = ''; $USE_REGISTRATION_MODULE = ''; $REQUIRE_ADMIN_AUTH_REGISTRATION = ''; $ALLOW_USER_THEMES = ''; @@ -58,7 +62,8 @@ $PGV_SMTP_FROM_NAME = ''; if ($PGV_PATH) { if (!is_dir($PGV_PATH) || !is_readable($PGV_PATH . '/config.php')) { - $error = WT_I18N::translate('The specified directory does not contain an installation of PhpGedView'); + WT_FlashMessages::addMessage('The specified directory does not contain an installation of PhpGedView', 'danger'); + $PGV_PATH = null; } else { // Load the configuration settings $config_php = file_get_contents($PGV_PATH . '/config.php'); @@ -79,7 +84,8 @@ if ($PGV_PATH) { } $wt_config = parse_ini_file(WT_ROOT . 'data/config.ini.php'); if ($DBHOST != $wt_config['dbhost']) { - $error = WT_I18N::translate('PhpGedView must use the same database as webtrees.'); + WT_FlashMessages::addMessage(WT_I18N::translate('PhpGedView must use the same database as webtrees.', 'danger')); + $PGV_PATH = null; unset($wt_config); } else { unset($wt_config); @@ -88,51 +94,42 @@ if ($PGV_PATH) { "SELECT site_setting_value FROM `{$DBNAME}`.`{$TBLPREFIX}site_setting` WHERE site_setting_name='PGV_SCHEMA_VERSION'" )->fetchOne(); if ($PGV_SCHEMA_VERSION < 10) { - $error = WT_I18N::translate('The version of %s is too old.', 'PhpGedView'); + WT_FlashMessages::addMessage(WT_I18N::translate('The version of %s is too old.', 'PhpGedView'), 'danger'); + $PGV_PATH = null; } elseif ($PGV_SCHEMA_VERSION > 14) { - $error = WT_I18N::translate('The version of %s is too new.', 'PhpGedView'); + WT_FlashMessages::addMessage(WT_I18N::translate('The version of %s is too new.', 'PhpGedView'), 'danger'); + $PGV_PATH = null; } } catch (PDOException $ex) { - $error = + WT_FlashMessages::addMessage( /* I18N: %s is a database name/identifier */ WT_I18N::translate('webtrees cannot connect to the PhpGedView database: %s.', $DBNAME . '@' . $DBHOST) . '
' . /* I18N: %s is an error message */ - WT_I18N::translate('MySQL gave the error: %s', $ex->getMessage()); + WT_I18N::translate('MySQL gave the error: %s', $ex->getMessage()), 'danger'); + $PGV_PATH = null; } } } } -if ($PGV_PATH && !$error) { +if ($PGV_PATH) { // The account we are using is about to be deleted. $WT_SESSION->wt_user = null; } $controller->pageHeader(); -echo - ''; - -if ($error || !$PGV_PATH) { - // Prompt for location of PhpGedView installation - echo '
'; - echo '

', WT_I18N::translate('PhpGedView to webtrees transfer wizard'), '

'; - if ($error) { - echo '

', $error, '

'; - } +?> + +

getPageTitle(); ?>

+', - '

', WT_I18N::translate('Where is your PhpGedView installation?'), '

', - '
', - '
', WT_I18N::translate('Installation folder'), '
'; - switch (count($pgv_dirs)) { - case '0': - echo '
'; - break; - case '1': - echo '
'; - break; - default: - echo '
'; - echo '
', WT_I18N::translate('PhpGedView might be installed in one of these folders:'), '
'; - echo '
'; - foreach ($pgv_dirs as $pgvpath) { - echo '

', $pgvpath, '

'; - } - echo '
'; - break; - } - echo - '
', - '
', - '', - '
'; + ?> + 1): ?> + + + +
+
+ +
+ +
+
+ +
+
+ +
+
+
+ '; echo '

', WT_I18N::translate('You need to login again, using your PhpGedView username and password.'), '

'; -echo ''; +echo ''; diff --git a/admin_trees_config.php b/admin_trees_config.php index c1ab4a97fd..d5a4ec831c 100644 --- a/admin_trees_config.php +++ b/admin_trees_config.php @@ -420,7 +420,7 @@ $controller

getPageTitle(); ?>

-
+ -- cgit v1.3