[-] BO : fixed bug #PSCFV-2180 - Not auto height with long name shop

// Clean HTML, JS, CSS code

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15043 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
aFolletete
2012-05-03 13:48:58 +00:00
parent cfe25a54e1
commit 41184a7620
4 changed files with 166 additions and 134 deletions

View File

@@ -31,7 +31,7 @@
</script>
<div id="container">
<div id="error" style="{if !isset($errors)}display:none;{/if}">
<div id="error" {if !isset($errors)}class="hide"{/if}>
{if isset($errors)}
<h3>{if $nbErrors > 1}{l s='There are'}{else}{l s='There is'}{/if} {$nbErrors}{if $nbErrors > 1} {l s='errors'}{else} {l s='error'}{/if}</h3>
<ol style="margin: 0 0 0 20px;">
@@ -48,59 +48,66 @@
</div>
{/if}
<div id="login">
{if !isset($wrong_folder_name)}
<div id="login_form">
<h1>{$shop_name}</h1>
<form action="" method="post" id="login_form" onsubmit="doAjaxLogin('{$redirect}');return false;">
<label for="email">{l s='E-mail address:'}</label><br />
<input type="text" id="email" name="email" class="input" value="{if isset($email)}{$email|escape:'htmlall':'UTF-8'}{/if}" />
<div style="margin: 1.8em 0 0 0;">
<label for="passwd">{l s='Password:'}</label><br />
<input id="passwd" type="password" name="passwd" class="input" value="{if isset($password)}{$password}{/if}"/>
</div>
<div>
<div id="submit">
<input type="hidden" name="redirect" value="{$redirect}"/>
<input type="submit" name="submitLogin" value="{l s='Log in'}" class="button" style="float:left"/>
<span style="float:left;width:30px">
<img id="ajax-loader" src="../img/loader.gif" style="float:left;margin:2px 0 0 5px;display:none">
</span>
</div>
<div id="lost">
<a href="#" onclick="displayForgotPassword();return false;">{l s='Lost password?'}</a>
</div>
</div>
<script type="text/javascript">
//TODO FOCUS ON EMAIL
</script>
</form>
</div>
{else}
<h1>{$shop_name}</h1>
<div style="margin:30px;">
<p><span>{l s='For security reasons, you cannot connect to the Back Office until after you have:'}<br /><br />
<ul>
<li>{l s='deleted the /install folder'}</li>
<li>{l s='renamed the /admin folder (e.g. /admin123%d)' sprintf=$randomNb}</li>
</ul>
<br />{l s='Please then access this page by the new URL (e.g. http://www.yoursite.com/admin123%d)' sprintf=$randomNb}</span></p>
{if !isset($wrong_folder_name)}
<form action="#" id="login_form" method="post">
<div class="field">
<label for="email">{l s='E-mail address:'}</label>
<input type="text" id="email" name="email" class="input email_field" value="{if isset($email)}{$email|escape:'htmlall':'UTF-8'}{/if}" />
</div>
<div class="field">
<label for="passwd">{l s='Password:'}</label>
<input id="passwd" type="password" name="passwd" class="input password_field" value="{if isset($password)}{$password}{/if}"/>
</div>
<div class="field">
<input type="submit" name="submitLogin" value="{l s='Log in'}" class="button fl margin-right-5" />
<p class="fl no-margin hide ajax-loader">
<img src="../img/loader.gif">
</p>
<p class="fr no-margin">
<a href="#" class="show-forgot-password">{l s='Lost password?'}</a>
</p>
<div class="clear"></div>
</div>
<input type="hidden" name="redirect" id="redirect" value="{$redirect}"/>
</form>
<form action="#" id="forgot_password_form" method="post" class="hide">
<h2 class="no-margin">{l s='Forgot your password?'}</h2>
<p class="bold">{l s='Please enter the e-mail address you provided during the registration process in order to receive your access code by e-mail'}</p>
<div class="field">
<label>{l s='E-mail address:'}</label>
<input type="text" name="email_forgot" id="email_forgot" class="input email_field" />
</div>
<div class="field">
<input type="submit" name="submit" value="{l s='Send'}" class="button fl margin-right-5" />
<p class="fl no-margin hide ajax-loader">
<img src="../img/loader.gif">
</p>
<p class="fr no-margin">
<a href="#" class="show-login-form">{l s='Back to login'}</a>
</p>
<div class="clear"></div>
</div>
</form>
{else}
<div class="padding-30">
<p>{l s='For security reasons, you cannot connect to the Back Office until after you have:'}</p>
<ul>
<li>{l s='deleted the /install folder'}</li>
<li>{l s='renamed the /admin folder (e.g. /admin123%d)' sprintf=$randomNb}</li>
</ul>
<p>{l s='Please then access this page by the new URL (e.g. http://www.yoursite.com/admin123%d)' sprintf=$randomNb}</p>
</div>
{/if}
<div id="forgot_password" style="display:none">
<h1>{$shop_name}</h1>
<form action="" method="post" onsubmit="doAjaxForgot();return false;">
<div class="page-title center">{l s='Forgot your password?'}</div><br />
<span style="font-weight: bold;">{l s='Please enter the e-mail address you provided during the registration process in order to receive your access code by e-mail'}</span><br />
<input style="margin-top:20px" type="text" name="email_forgot" id="email_forgot" class="input" />
<div id="submit">
<input type="submit" name="Submit" value="{l s='Send'}" class="button" style="float:left" />
<span style="float:left;width:30px">
<img id="ajax-loader" src="../img/loader.gif" style="float:left;margin:2px 0 0 5px;display:none">
</span>
</div>
<div id="lost"><a href="#" onclick="displayLogin();return false;">{l s='Back to login'}</a></div>
</form>
</div>
</div>
<h2><a href="http://www.prestashop.com">&copy; 2005 - {$smarty.now|date_format:"%Y"} Copyright by PrestaShop. all rights reserved.</a></h2>
</div>

View File

@@ -69,31 +69,27 @@ class AdminLoginControllerCore extends AdminController
if (file_exists(_PS_ADMIN_DIR_.'/../install') || file_exists(_PS_ADMIN_DIR_.'/../admin')
|| (file_exists(_PS_ADMIN_DIR_.'/../install-dev') && (!defined('_PS_MODE_DEV_') || !_PS_MODE_DEV_)))
$this->context->smarty->assign(
array(
$this->context->smarty->assign(array(
'randomNb' => rand(100, 999),
'wrong_folder_name' => true)
);
'wrong_folder_name' => true
));
// Redirect to admin panel
if (isset($_GET['redirect']) && Validate::isControllerName($_GET['redirect']))
$this->context->smarty->assign(array('redirect' => Tools::getValue('redirect')));
if (Tools::isSubmit('redirect') && Validate::isControllerName(Tools::getValue('redirect')))
$this->context->smarty->assign('redirect', Tools::getValue('redirect'));
else
{
$tab = new Tab((int)$this->context->employee->default_tab);
$url = $this->context->link->getAdminLink($tab->class_name);
$this->context->smarty->assign(array('redirect' => $url));
$this->context->smarty->assign('redirect', $this->context->link->getAdminLink($tab->class_name));
}
if ($nbErrors = count($this->errors))
$this->context->smarty->assign(
array(
'errors' => $this->errors,
'nbErrors' => $nbErrors,
'shop_name' => Tools::safeOutput(Configuration::get('PS_SHOP_NAME')),
'disableDefaultErrorOutPut' => true,
)
);
$this->context->smarty->assign(array(
'errors' => $this->errors,
'nbErrors' => $nbErrors,
'shop_name' => Tools::safeOutput(Configuration::get('PS_SHOP_NAME')),
'disableDefaultErrorOutPut' => true,
));
$this->setMedia();
$this->initHeader();
parent::initContent();
@@ -132,11 +128,10 @@ class AdminLoginControllerCore extends AdminController
$this->errors[] = Tools::displayError('E-mail is empty');
elseif (!Validate::isEmail($email))
$this->errors[] = Tools::displayError('Invalid e-mail address');
if (empty($passwd))
$this->errors[] = Tools::displayError('Password is blank');
else if (!Validate::isPasswd($passwd))
elseif (!Validate::isPasswd($passwd))
$this->errors[] = Tools::displayError('Invalid password');
if (!count($this->errors))
@@ -191,8 +186,8 @@ class AdminLoginControllerCore extends AdminController
$employee = new Employee();
if (!$employee->getByemail($email) || !$employee)
$this->errors[] = Tools::displayError('This account does not exist');
else if ((strtotime($employee->last_passwd_gen.'+'.Configuration::get('PS_PASSWD_TIME_BACK').' minutes') - time()) > 0)
$this->errors[] = Tools::displayError('You can regenerate your password only every').' '.Configuration::get('PS_PASSWD_TIME_BACK').' '.Tools::displayError('minute(s)');
elseif ((strtotime($employee->last_passwd_gen.'+'.Configuration::get('PS_PASSWD_TIME_BACK').' minutes') - time()) > 0)
$this->errors[] = Tools::displayError('You can regenerate your password only every').' '.Configuration::get('PS_PASSWD_TIME_BACK').' '.Tools::displayError('minute(s)');
}
if (_PS_MODE_DEMO_)
$errors[] = Tools::displayError('This functionality has been disabled.');
@@ -208,16 +203,22 @@ class AdminLoginControllerCore extends AdminController
else
{
$params = array(
'{email}' => $employee->email,
'{lastname}' => $employee->lastname,
'{firstname}' => $employee->firstname,
'{passwd}' => $pwd
);
'{email}' => $employee->email,
'{lastname}' => $employee->lastname,
'{firstname}' => $employee->firstname,
'{passwd}' => $pwd
);
if (Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'password', Mail::l('Your new admin password', (int)Configuration::get('PS_LANG_DEFAULT')), $params, $employee->email, $employee->firstname.' '.$employee->lastname))
die(Tools::jsonEncode(array('hasErrors' => false, 'confirm' => $this->l('Your password has been e-mailed to you'))));
die(Tools::jsonEncode(array(
'hasErrors' => false,
'confirm' => $this->l('Your password has been e-mailed to you')
)));
else
die(Tools::jsonEncode(array('hasErrors' => true, 'errors' => array(Tools::displayError('An error occurred during your password change.')))));
die(Tools::jsonEncode(array(
'hasErrors' => true,
'errors' => array(Tools::displayError('An error occurred during your password change.'))
)));
}
}

View File

@@ -1,5 +1,3 @@
/* CSS Document */
body {
margin: 0;
padding: 0;
@@ -11,9 +9,6 @@ body {
background-position: center center;
}
body #main {
}
h1 {
color: #902F52;
font-size: 20pt;
@@ -60,7 +55,6 @@ input:focus, textarea:focus {
}
/* CONTENT */
#container {
width: 464px;
margin: 12% auto 1em;
@@ -68,7 +62,6 @@ input:focus, textarea:focus {
}
#login {
height: 313px;
color: #383838;
text-align: left;
font-weight: bold;
@@ -83,38 +76,26 @@ input:focus, textarea:focus {
text-shadow:0 1px 0 #fff;
}
#login a {
color:#3A6EA7;
}
#login label {
text-shadow: 0 1px 0 #fff;
}
#login a { color:#3A6EA7; }
#login label { text-shadow: 0 1px 0 #fff; }
#login form {
border-top:1px solid #fff;
margin: 0;
padding: 40px 30px 25px 30px;
padding: 30px;
}
#login #submit {
#login .submit {
margin: 1em 1px;
padding: 0;
display: block;
float:left;
}
#login #submit input {
#login .submit input {
padding: 4px 10px;
_padding: 0;
}
#login #lost {
margin:20px;
font-size: 0.95em;
float:left;
}
/* ERROR */
.error, #error {
margin: 0;
padding: 10px 15px;
@@ -154,18 +135,22 @@ input:focus, textarea:focus {
padding: 6px 4px 6px 35px;
}
.input#email {
background: #fff url(../img/admin/bg_form_email.png) no-repeat scroll 10px 8px;
}
.input, .input#passwd {
background: #fff url(../img/admin/bg_form_password.png) no-repeat scroll 10px 8px;
}
.email_field { background: #fff url(../img/admin/bg_form_email.png) no-repeat scroll 10px 8px; }
.password_field { background: #fff url(../img/admin/bg_form_password.png) no-repeat scroll 10px 8px; }
.button {
background: -moz-linear-gradient(center top , #F9F9F9, #E3E3E3) repeat scroll 0 0 transparent;
background: -webkit-gradient(linear, center top ,center bottom, from(#F9F9F9), to(#E3E3E3)) repeat scroll 0 0 transparent;
border-color: #CCCCCC #BBBBBB #A0A0A0;border-left: 1px solid #BBBBBB;border-radius: 3px 3px 3px 3px;border-right: 1px solid #BBBBBB;border-style: solid;border-width: 1px;color: #000000;margin: 0; outline: medium none;padding: 3px 8px;
border-color: #CCCCCC #BBBBBB #A0A0A0;
border-left: 1px solid #BBBBBB;
border-radius: 3px 3px 3px 3px;
border-right: 1px solid #BBBBBB;
border-style: solid;
border-width: 1px;
color: #000000;
margin: 0;
outline: medium none;
padding: 3px 8px;
}
.button:hover {
@@ -173,10 +158,18 @@ input:focus, textarea:focus {
cursor:pointer;
}
.center {
font-size:20px;
font-weight: normal;
text-align: center;
}
.clear { clear: both; }
.hide { display: none; }
.bold { font-weight: bold; }
#login form span { font-weight:normal;}
.field { margin-bottom: 20px; }
.fl { float: left; }
.fr { float: right; }
.no-margin { margin: 0; }
.margin-right-5 { margin-right: 5px; }
.padding-30 { padding: 30px; }
.center { text-align: center; }

View File

@@ -1,11 +1,40 @@
$(document).ready(function() {
if (document.getElementById('email')) document.getElementById('email').focus(); //$("#login").effect( "slide", { direction: "up" }, 1000 );
// Focus on email address field
$('#email').select();
// Initialize events
$('#login_form').submit(function(e) {
// Kill default behaviour
e.preventDefault();
doAjaxLogin($('#redirect').val());
});
$('#forgot_password_form').submit(function(e) {
// Kill default behaviour
e.preventDefault();
doAjaxForgot();
});
$('.show-forgot-password').click(function(e) {
// Kill default behaviour
e.preventDefault();
displayForgotPassword();
});
$('.show-login-form').click(function(e) {
// Kill default behaviour
e.preventDefault();
displayLogin();
});
});
function displayForgotPassword() {
$('#error').hide();
$('#login_form').fadeOut('fast', function () {
$("#forgot_password").fadeIn('fast');
$("#forgot_password_form").fadeIn('fast');
// Focus on email address forgot field
$('#email_forgot').select();
});
}
@@ -13,8 +42,10 @@ function displayForgotPassword() {
function displayLogin() {
$('#error').hide();
$('#forgot_password').fadeOut('fast', function () {
$("#login_form").fadeIn('fast');
$('#forgot_password_form').fadeOut('fast', function () {
$('#login_form').fadeIn('fast');
// Focus on email address field
$('#email').select();
});
return false;
@@ -27,7 +58,7 @@ function displayLogin() {
*/
function doAjaxLogin(redirect) {
$('#error').hide();
$('#ajax-loader').fadeIn('slow', function() {
$('#login_form .ajax-loader').fadeIn('slow', function() {
$.ajax({
type: "POST",
url: "ajax-tab.php",
@@ -50,16 +81,15 @@ function doAjaxLogin(redirect) {
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$('#error').html('<h3>TECHNICAL ERROR:</h3><p>Details: Error thrown: ' + XMLHttpRequest + '</p><p>Text status: ' + textStatus + '</p>');
$('#error').fadeIn();
$('#ajax-loader').fadeOut('slow');
$('#error').html('<h3>TECHNICAL ERROR:</h3><p>Details: Error thrown: ' + XMLHttpRequest + '</p><p>Text status: ' + textStatus + '</p>').show();
$('#login_form .ajax-loader').fadeOut('slow');
}
});
});
}
function doAjaxForgot() {
$('#error').hide();
$('#ajax-loader').fadeIn('slow', function() {
$('#forgot_password_form .ajax-loader').fadeIn('slow', function() {
$.ajax({
type: "POST",
url: "ajax-tab.php",
@@ -73,16 +103,18 @@ function doAjaxForgot() {
email_forgot: $('#email_forgot').val()
},
success: function(jsonData) {
if (jsonData.hasErrors) {
if (jsonData.hasErrors)
displayErrors(jsonData.errors);
} else {
else
{
alert(jsonData.confirm);
$('#forgot_password_form .ajax-loader').hide();
displayLogin();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$('#error').html('<h3>TECHNICAL ERROR:</h3><p>Details: Error thrown: ' + XMLHttpRequest + '</p><p>Text status: ' + textStatus + '</p>');
$('#error').fadeIn();
$('#ajax-loader').fadeOut('slow');
$('#error').html('<h3>TECHNICAL ERROR:</h3><p>Details: Error thrown: ' + XMLHttpRequest + '</p><p>Text status: ' + textStatus + '</p>').show();
$('#forgot_password_form .ajax-loader').fadeOut('slow');
}
});
});
@@ -91,9 +123,8 @@ function displayErrors(errors) {
str_errors = '<h3>' + (errors.length > 1 ? there_are : there_is) + ' ' + errors.length + ' ' + (errors.length > 1 ? label_errors : label_error) + '</h3><ol>';
for (var error in errors) //IE6 bug fix
if (error != 'indexOf') str_errors += '<li>' + errors[error] + '</li>';
$('#ajax-loader').hide();
$('#error').html(str_errors + '</ol>');
$('#error').fadeIn();
$('.ajax-loader').hide();
$('#error').html(str_errors + '</ol>').fadeIn('slow');
$("#login").effect("shake", {
times: 4
}, 100);