Permalink
Browse files

add proxy step to ezpublish install

Signed-off-by: Alexandre SEBBANE <alex@sebbane.org>
  • Loading branch information...
1 parent c97049d commit 6c7a9d37ba742a0ea54326bc78514def12701182 @alexsebbane committed May 25, 2011
@@ -0,0 +1,34 @@
+{* DO NOT EDIT THIS FILE! Use an override template instead. *}
+{*?template charset=latin1?*}
+<div align="center">
+ <h1>{"Proxy settings"|i18n("design/standard/setup/init")}</h1>
+</div>
+
+<p>
+ {"This section is used to configure how eZ Publish is connect to internet."|i18n("design/standard/setup/init")}
+</p>
+
+<p>
+<form method="post" action="{$script}">
+<fieldset>
+<legend>{"Proxy"|i18n("design/standard/setup/init")}:</legend>
+<table cellspacing="3" cellpadding="0" border="0">
+<tr>
+ <td></td><td class="normal"><label for="eZSetupPROXYServer" class="textfield">{"Server name: "|i18n("design/standard/setup/init")}</label></td>
+ <td class="normal"><input type="text" size="25" id="eZSetupPROXYServer" name="eZSetupPROXYServer" value=""></td>
+</tr>
+<tr>
+ <td></td><td class="normal"><label for="eZSetupPROXYUser" class="textfield">{"Username (optional): "|i18n("design/standard/setup/init")}</label></td>
+ <td class="normal"><input type="text" size="25" id="eZSetupPROXYUser" name="eZSetupPROXYUser" value=""></td>
+</tr>
+<tr>
+ <td></td><td class="normal"><label for="eZSetupPROXYPassword" class="textfield">{"Password (optional): "|i18n("design/standard/setup/init")}</label></td>
+ <td class="normal"><input type="password" size="25" id="eZSetupPROXYPassword" name="eZSetupPROXYPassword" value=""></td>
+</tr>
+</table>
+</fieldset>
+ {include uri='design:setup/init/navigation.tpl'}
+ {include uri='design:setup/persistence.tpl'}
+</form>
+
+</p>
@@ -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")}
+<p></p>
+{"That is the help chapter about proxy."|i18n("design/standard/setup/init")}
+<p></p>
@@ -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?*}
<table border="0" cellspacing="3" cellpadding="0">
@@ -57,6 +57,23 @@
<tr>
<td>
+ {if count($summary_proxy_info)}
+ <div class="setup_summary_ok">
+ {else}
+ <div class="setup_summary_empty">
+ {/if}
+
+ {"Proxy"|i18n("design/standard/setup")}:</td>
+
+ <td>
+ {if count($summary_proxy_info)}
+ <div class="setup_summary_ok">{$summary_proxy_info}</div>
+ {/if}
+ </td>
+ </tr>
+
+ <tr>
+ <td>
{if count($database)}
<div class="setup_summary_ok">
{else}
@@ -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'] ) )
@@ -1,4 +1,4 @@
-<?php
+<?php
/**
* File containing the eZStepCreateSites class.
*
@@ -313,6 +313,13 @@ function init()
$ini->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,
}
-?>
+?>
@@ -1,4 +1,4 @@
-<?php
+<?php
/**
* File containing the eZStepData class.
*
@@ -148,6 +148,8 @@ function progress( $step )
'class' => '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 )
}
-?>
+?>
@@ -0,0 +1,90 @@
+<?php
+/**
+ * File containing the eZStepProxySettings class.
+ *
+ * @copyright Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
+ * @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
+ * @version 2011.5
+ * @package kernel
+ */
+
+/*!
+ \class eZStepProxySettings ezstep_proxy_settings.php
+ \brief The class eZStepProxySettings does
+
+*/
+
+class eZStepProxySettings extends eZStepInstaller
+{
+ /*!
+ Constructor
+ */
+ function eZStepProxySettings( $tpl, $http, $ini, &$persistenceList )
+ {
+ $this->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;
+
+ }
+}
+
+?>

0 comments on commit 6c7a9d3

Please sign in to comment.