From 6c7a9d37ba742a0ea54326bc78514def12701182 Mon Sep 17 00:00:00 2001 From: Alexandre SEBBANE Date: Wed, 25 May 2011 06:45:32 +0200 Subject: [PATCH 1/2] add proxy step to ezpublish install Signed-off-by: Alexandre SEBBANE --- .../templates/setup/init/proxy_settings.tpl | 34 +++++++ .../setup/init/proxy_settings_help.tpl | 5 ++ design/standard/templates/setup/summary.tpl | 19 +++- kernel/setup/ezsetup_summary.php | 12 +++ kernel/setup/steps/ezstep_create_sites.php | 11 ++- kernel/setup/steps/ezstep_data.php | 6 +- kernel/setup/steps/ezstep_proxy_settings.php | 90 +++++++++++++++++++ 7 files changed, 172 insertions(+), 5 deletions(-) create mode 100644 design/standard/templates/setup/init/proxy_settings.tpl create mode 100644 design/standard/templates/setup/init/proxy_settings_help.tpl create mode 100644 kernel/setup/steps/ezstep_proxy_settings.php diff --git a/design/standard/templates/setup/init/proxy_settings.tpl b/design/standard/templates/setup/init/proxy_settings.tpl new file mode 100644 index 00000000000..74ed5c2467a --- /dev/null +++ b/design/standard/templates/setup/init/proxy_settings.tpl @@ -0,0 +1,34 @@ +{* DO NOT EDIT THIS FILE! Use an override template instead. *} +{*?template charset=latin1?*} +
+

{"Proxy settings"|i18n("design/standard/setup/init")}

+
+ +

+ {"This section is used to configure how eZ Publish is connect to internet."|i18n("design/standard/setup/init")} +

+ +

+

+
+{"Proxy"|i18n("design/standard/setup/init")}: + + + + + + + + + + + + + +
+
+ {include uri='design:setup/init/navigation.tpl'} + {include uri='design:setup/persistence.tpl'} +
+ +

diff --git a/design/standard/templates/setup/init/proxy_settings_help.tpl b/design/standard/templates/setup/init/proxy_settings_help.tpl new file mode 100644 index 00000000000..ff7df9618a4 --- /dev/null +++ b/design/standard/templates/setup/init/proxy_settings_help.tpl @@ -0,0 +1,5 @@ +{* DO NOT EDIT THIS FILE! Use an override template instead. *} +{"The eZ Publish system can use proxy server to connect to Internet."|i18n("design/standard/setup/init")} +

+{"That is the help chapter about proxy."|i18n("design/standard/setup/init")} +

\ No newline at end of file diff --git a/design/standard/templates/setup/summary.tpl b/design/standard/templates/setup/summary.tpl index 192bd095be8..85a16583274 100644 --- a/design/standard/templates/setup/summary.tpl +++ b/design/standard/templates/setup/summary.tpl @@ -1,4 +1,4 @@ -{* DO NOT EDIT THIS FILE! Use an override template instead. *} +{* DO NOT EDIT THIS FILE! Use an override template instead. *} {*?template charset=latin1?*} @@ -55,6 +55,23 @@ + + + + + +
+ {if count($summary_proxy_info)} +
+ {else} +
+ {/if} + + {"Proxy"|i18n("design/standard/setup")}:
+ {if count($summary_proxy_info)} +
{$summary_proxy_info}
+ {/if} +
{if count($database)} diff --git a/kernel/setup/ezsetup_summary.php b/kernel/setup/ezsetup_summary.php index a377aa01046..65de9bdb7f5 100644 --- a/kernel/setup/ezsetup_summary.php +++ b/kernel/setup/ezsetup_summary.php @@ -111,6 +111,18 @@ function summary() } } + // Proxy settings + $this->Tpl->setVariable( 'summary_proxy_info', '' ); + + if ( isset( $persistenceList['proxy_info'] ) ) { + if ( $persistenceList['proxy_info']['server'] <> "" ) + { + $this->Tpl->setVariable( 'summary_proxy_info', $persistenceList['proxy_info']['server'] ); + }else{ + $this->Tpl->setVariable( 'summary_proxy_info', '-' ); + } + } + // Templates chosen $chosenSitePackage = false; if ( isset( $this->PersistenceList['chosen_site_package']['0'] ) ) diff --git a/kernel/setup/steps/ezstep_create_sites.php b/kernel/setup/steps/ezstep_create_sites.php index 550a7876b55..699efa953bb 100644 --- a/kernel/setup/steps/ezstep_create_sites.php +++ b/kernel/setup/steps/ezstep_create_sites.php @@ -1,4 +1,4 @@ -setVariable( 'MailSettings', 'TransportPassword', $emailInfo['password'] ); } + if ( $this->PersistenceList['proxy_info']['server']<>"" ) + { + $ini->setVariable( 'ProxySettings', 'ProxyServer', $this->PersistenceList['proxy_info']['server'] ); + $ini->setVariable( 'ProxySettings', 'User', $this->PersistenceList['proxy_info']['user'] ); + $ini->setVariable( 'ProxySettings', 'Password', $this->PersistenceList['proxy_info']['password'] ); + } + // Enable design location cache $ini->setVariable( 'DesignSettings', 'DesignLocationCache', 'enabled' ); @@ -1413,4 +1420,4 @@ function initializePackage( // $package, } -?> +?> \ No newline at end of file diff --git a/kernel/setup/steps/ezstep_data.php b/kernel/setup/steps/ezstep_data.php index a6988c04681..1d274cdc046 100644 --- a/kernel/setup/steps/ezstep_data.php +++ b/kernel/setup/steps/ezstep_data.php @@ -1,4 +1,4 @@ - 'SystemFinetune' ), array( 'file' => 'email_settings', 'class' => 'EmailSettings' ), + array( 'file' => 'proxy_settings', + 'class' => 'ProxySettings' ), array( 'file' => 'database_choice', 'class' => 'DatabaseChoice' ), array( 'file' => 'database_init', @@ -178,4 +180,4 @@ function progress( $step ) } -?> +?> \ No newline at end of file diff --git a/kernel/setup/steps/ezstep_proxy_settings.php b/kernel/setup/steps/ezstep_proxy_settings.php new file mode 100644 index 00000000000..eb877a94567 --- /dev/null +++ b/kernel/setup/steps/ezstep_proxy_settings.php @@ -0,0 +1,90 @@ +eZStepInstaller( $tpl, $http, $ini, $persistenceList, + 'proxy_settings', 'Proxy settings' ); + } + + function processPostData() + { + if ( $this->Http->hasPostVariable( 'eZSetupPROXYServer' ) ) + { + $this->PersistenceList['proxy_info']['server'] = $this->Http->postVariable( 'eZSetupPROXYServer' ); + $this->PersistenceList['proxy_info']['user'] = $this->Http->postVariable( 'eZSetupPROXYUser' ); + $this->PersistenceList['proxy_info']['password'] = $this->Http->postVariable( 'eZSetupPROXYPassword' ); + $siteINI = eZINI::instance( 'site.ini.append', 'settings/override', null, null, false, true ); + $siteINI->setVariable( 'ProxySettings', 'ProxyServer', $this->PersistenceList['proxy_info']['server'] ); + $siteINI->setVariable( 'ProxySettings', 'User', $this->PersistenceList['proxy_info']['user'] ); + $siteINI->setVariable( 'ProxySettings', 'Password', $this->PersistenceList['proxy_info']['password'] ); + $siteINI->save( 'site.ini.append', '.php', false, false ); + } + + return true; + } + + function init() + { + if ( $this->hasKickstartData() ) + { + $data = $this->kickstartData(); + $this->PersistenceList['proxy_info']['server'] = $data['Server']; + $this->PersistenceList['proxy_info']['user'] = $data['User']; + $this->PersistenceList['proxy_info']['password'] = $data['Password']; + eZSetupMergePersistenceList( $this->PersistenceList, $persistenceData ); + return $this->kickstartContinueNextStep(); + } + return false; // Always display proxy settings + } + + function display() + { + $proxyInfo = array( 'server' => false, + 'user' => false, + 'password' => false ); + if ( isset( $this->PersistenceList['proxy_info'] ) ) + $proxyInfo = array_merge( $proxyInfo, $this->PersistenceList['proxy_info'] ); + if ( $proxyInfo['server'] and + $this->Ini->variable( 'ProxySettings', 'ProxyServer' ) ) + $proxyInfo['server'] = $this->Ini->variable( 'ProxySettings', 'ProxyServer' ); + if ( $proxyInfo['user'] and + $this->Ini->variable( 'ProxySettings', 'TransportUser' ) ) + $proxyInfo['user'] = $this->Ini->variable( 'ProxySettings', 'User' ); + if ( $proxyInfo['password'] and + $this->Ini->variable( 'ProxySettings', 'TransportPassword' ) ) + $proxyInfo['password'] = $this->Ini->variable( 'ProxySettings', 'Password' ); + $this->Tpl->setVariable( 'proxy_info', $proxyInfo ); + $this->Tpl->setVariable( 'setup_previous_step', 'EmailSettings' ); + $this->Tpl->setVariable( 'setup_next_step', 'DatabaseCreate' ); + + $result = array(); + // Display template + $result['content'] = $this->Tpl->fetch( "design:setup/init/proxy_settings.tpl" ); + $result['path'] = array( array( 'text' => ezpI18n::tr( 'design/standard/setup/init', + 'proxy settings' ), + 'url' => false ) ); + return $result; + + } +} + +?> \ No newline at end of file From c60e291adea6ab3cb1e3dd4ccbbecb7bb6a67801 Mon Sep 17 00:00:00 2001 From: Alexandre SEBBANE Date: Tue, 21 Jun 2011 07:26:28 +0200 Subject: [PATCH 2/2] Modifications asked by comment of @dpobel --- .../templates/setup/init/proxy_settings.tpl | 8 ++++---- kernel/setup/ezsetup_summary.php | 14 +++++++++----- kernel/setup/steps/ezstep_proxy_settings.php | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/design/standard/templates/setup/init/proxy_settings.tpl b/design/standard/templates/setup/init/proxy_settings.tpl index 74ed5c2467a..731ff63f592 100644 --- a/design/standard/templates/setup/init/proxy_settings.tpl +++ b/design/standard/templates/setup/init/proxy_settings.tpl @@ -5,7 +5,7 @@

- {"This section is used to configure how eZ Publish is connect to internet."|i18n("design/standard/setup/init")} + {"This section is used to configure how eZ Publish connects to the Internet. This step is only needed if the server where eZ Publish will be installed needs to use a proxy to connect to Internet, otherwise you can ignore this step."|i18n("design/standard/setup/init")}

@@ -15,15 +15,15 @@ - + - + - +
diff --git a/kernel/setup/ezsetup_summary.php b/kernel/setup/ezsetup_summary.php index 65de9bdb7f5..79a584001bc 100644 --- a/kernel/setup/ezsetup_summary.php +++ b/kernel/setup/ezsetup_summary.php @@ -78,7 +78,8 @@ function summary() } // Database selected - if ( isset( $persistenceList['database_info'] ) ) { + if ( isset( $persistenceList['database_info'] ) ) + { $database = $databaseMap[$persistenceList['database_info']['type']]['name']; $this->Tpl->setVariable( 'database', $database ); } @@ -88,7 +89,8 @@ function summary() } // Languages selected - if ( isset( $persistenceList['regional_info'] ) ) { + if ( isset( $persistenceList['regional_info'] ) ) + { $languages = $persistenceList['regional_info']['languages']; $this->Tpl->setVariable( 'languages', $languages ); } @@ -100,7 +102,8 @@ function summary() // Email settings $this->Tpl->setVariable( 'summary_email_info', '' ); - if ( isset( $persistenceList['email_info'] ) ) { + if ( isset( $persistenceList['email_info'] ) ) + { if ( $persistenceList['email_info']['type'] == 1 ) { $this->Tpl->setVariable( 'summary_email_info', 'sendmail' ); @@ -114,7 +117,8 @@ function summary() // Proxy settings $this->Tpl->setVariable( 'summary_proxy_info', '' ); - if ( isset( $persistenceList['proxy_info'] ) ) { + if ( isset( $persistenceList['proxy_info'] ) ) + { if ( $persistenceList['proxy_info']['server'] <> "" ) { $this->Tpl->setVariable( 'summary_proxy_info', $persistenceList['proxy_info']['server'] ); @@ -139,4 +143,4 @@ function summary() public $PersistenceList; } -?> +?> \ No newline at end of file diff --git a/kernel/setup/steps/ezstep_proxy_settings.php b/kernel/setup/steps/ezstep_proxy_settings.php index eb877a94567..f0162a38a97 100644 --- a/kernel/setup/steps/ezstep_proxy_settings.php +++ b/kernel/setup/steps/ezstep_proxy_settings.php @@ -1,4 +1,4 @@ -