Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add proxy step to ezpublish install #65

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions design/standard/templates/setup/init/proxy_settings.tpl
Original file line number Diff line number Diff line change
@@ -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")}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be "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." The second sentence can/should also be put in the help too.

</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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be marked as optional

And, the default value of all fields is empty, this means that if you go back in the installer steps, the form will be empty (see for instance the mail settings template for instance)

<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>
5 changes: 5 additions & 0 deletions design/standard/templates/setup/init/proxy_settings_help.tpl
Original file line number Diff line number Diff line change
@@ -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>
19 changes: 18 additions & 1 deletion design/standard/templates/setup/summary.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like your editor is configured to insert the BOM at the beginning of files (you use UltraEdit perhaps ?), this is not needed for UTF8 and it may even be dangerous in PHP, so please configure your editor to not do that.

{*?template charset=latin1?*}

<table border="0" cellspacing="3" cellpadding="0">
Expand Down Expand Up @@ -55,6 +55,23 @@
</td>
</tr>

<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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space at the end of the line


<tr>
<td>
{if count($database)}
Expand Down
12 changes: 12 additions & 0 deletions kernel/setup/ezsetup_summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ function summary()
}
}

// Proxy settings
$this->Tpl->setVariable( 'summary_proxy_info', '' );

if ( isset( $persistenceList['proxy_info'] ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS issues, { and } should be alone on its line. There are also space/tabs trailing at the end of this block.

if ( $persistenceList['proxy_info']['server'] <> "" )
{
$this->Tpl->setVariable( 'summary_proxy_info', $persistenceList['proxy_info']['server'] );
}else{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes :

}else{

should be

}
else
{

$this->Tpl->setVariable( 'summary_proxy_info', '-' );
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space at the end of the line (the same for the following line)


// Templates chosen
$chosenSitePackage = false;
if ( isset( $this->PersistenceList['chosen_site_package']['0'] ) )
Expand Down
11 changes: 9 additions & 2 deletions kernel/setup/steps/ezstep_create_sites.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php
/**
* File containing the eZStepCreateSites class.
*
Expand Down Expand Up @@ -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' );

Expand Down Expand Up @@ -1413,4 +1420,4 @@ function initializePackage( // $package,

}

?>
?>
6 changes: 4 additions & 2 deletions kernel/setup/steps/ezstep_data.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php
/**
* File containing the eZStepData class.
*
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -178,4 +180,4 @@ function progress( $step )

}

?>
?>
90 changes: 90 additions & 0 deletions kernel/setup/steps/ezstep_proxy_settings.php
Original file line number Diff line number Diff line change
@@ -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;

}
}

?>