issue #0001636 : Update for performance

This commit is contained in:
Michael RICOIS 2013-07-29 14:43:00 +00:00
parent d01c794b4d
commit 77ac82c861
3 changed files with 79 additions and 72 deletions

View File

@ -619,7 +619,6 @@ class UserController extends Zend_Controller_Action
if ( $request->isPost() ) {
$params = $request->getParams();
$message = '';
$bt_fermer = '0';
$paramlist = array(
'telephone' => 'Numéro de téléphone direct',
@ -647,7 +646,7 @@ class UserController extends Zend_Controller_Action
if ($message == '') {
$mailbody = '<style type="text/css">table {font-family:Arial, Helvetica, sans-serif; font-size: 12px; width: 550px; border: none;}table td{padding: 4px 8px;}</style>';
$mailbody .= "Demande de envoi des identifiants.<br /><br />";
$mailbody .= "Demande d'envoi des identifiants.<br /><br />";
$mailbody .= "L'un de nos clients a égaré son(ses) identifiant(s).<br />";
$mailbody .= "Via notre lien -identifiants oubliés- il a effectué une demande de transmission de ces codes.<br />";
$mailbody .= "<p>A l'aide des informations ci-dessous, merci de retrouver ces codes et les lui envoyer par email.</p>";
@ -667,22 +666,21 @@ class UserController extends Zend_Controller_Action
require_once 'Scores/Mail.php';
$mail = new Mail();
$mail->setSubject("Demande de envoi des identifiants");
$mail->setSubject("Demande d'envoi des identifiants");
$mail->setBodyHTML($mailbody);
$mail->setFrom('support');
$mail->addToKey('support');
$mail->setReplyTo($params['email']);
try {
$mail->send();
$message = "Votre demande avec les informations suivantes a été envoyée. Nous vous contacterons prochainement.";
$bt_fermer = '1';
$this->view->assign('sendEmail' , true);
}
catch ( Zend_Mail_Transport_Exception $e ){
$message = $e->getMessage();
}
}
}
$this->view->assign('message', $message);
$this->view->assign('bt_fermer', $bt_fermer);
$this->view->assign('message', $message);
}
$this->view->assign('params', $params);
}

View File

@ -58,6 +58,19 @@ label#frm {
</style>
<?php if ($this->sendEmail) {?>
<div class='message'><p id='<?=$this->bt_fermer;?>'>
Votre demande avec les informations suivantes a été envoyée. Nous vous contacterons prochainement.
</p></div>
<script>
$('#dlg').dialog({ buttons: [
{ text: "Fermer", click: function() { $(this).dialog('close'); }}
] });
</script>
<?php } else {?>
<?php if ($this->message!='') {?>
<div class='message'><p id='<?=$this->bt_fermer;?>'><?=$this->message; ?></p></div>
<?php }?>
@ -122,4 +135,63 @@ Ces informations sont destinées exclusivement au traitement de votre demande et
<div class="loading"><center><img style="padding-top:25%" src="/themes/default/images/giant/19-1.gif" /></center></div>
<script type="text/javascript" src="/themes/default/scripts/motpasse.js" />
<script>
function validate() {
var allvals = true;
$('div#dlg input[required]').each(function() {
if(!$(this).val()) {
allvals = false;
$(this).addClass('brsr');
}
else { $(this).removeClass('brsr'); }
});
return allvals;
}
function isEmail(email) {
var emailval = true;
var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!regex.test(email.val())) {
emailval = false;
$(email).addClass('brsr');
}
else {
$(email).removeClass('brsr');
}
return emailval;
}
$(document).ready(function(){
validate();
});
$('div#dlg input[required]').blur(function(){
if(!$(this).val()) { $(this).addClass('brsr'); }
else { $(this).removeClass('brsr'); }
});
$('#dlg').dialog({ buttons: [
{ text: "Valider", click: function() {
var values = $(this).find('form').serialize();
if (validate() && isEmail($('div#dlg input[name=email]'))) {
if ($('.loading').css('display')=='none') {
$('.loading').css('display', 'block');
$('.ui-dialog-content').css('overflow','hidden');
$(".ui-dialog-buttonpane button:contains('Valider')").button("disable");
} else {
$('.loading').css('display', 'none');
}
$.post('/user/motpasse', values, function(data) {
$('#dlg').html(data);
$('pre').hide();
$('#htxt').height(50);
$('input#frm').attr("disabled", "disabled");
$(".ui-dialog-buttonpane button:contains('Valider')").hide();
});
}
}},
{ text: "Annuler", click: function() { $(this).dialog('close'); }}
] });
</script>
<?php }?>

View File

@ -1,63 +0,0 @@
function validate() {
var allvals = true;
$('div#dlg input[required]').each(function() {
if(!$(this).val()) {
allvals = false;
$(this).addClass('brsr');
}
else { $(this).removeClass('brsr'); }
});
return allvals;
}
function isEmail(email) {
var emailval = true;
var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!regex.test(email.val())) {
emailval = false;
$(email).addClass('brsr');
}
else {
$(email).removeClass('brsr');
}
return emailval;
}
$(document).ready(function(){
validate();
});
$('div#dlg input[required]').blur(function(){
if(!$(this).val()) { $(this).addClass('brsr'); }
else { $(this).removeClass('brsr'); }
});
if ($('div.message p').attr('id')=='1') {
txt = "Fermer";
}
else {
txt = "Annuler";
}
$('#dlg').dialog({ buttons: [
{ text: "Valider", click: function() {
var values = $(this).find('form').serialize();
if (validate() && isEmail($('div#dlg input[name=email]'))) {
if ($('.loading').css('display')=='none') {
$('.loading').css('display', 'block');
$('.ui-dialog-content').css('overflow','hidden');
$(".ui-dialog-buttonpane button:contains('Valider')").button("disable");
} else {
$('.loading').css('display', 'none');
}
$.post('/user/motpasse', values, function(data) {
$('#dlg').html(data);
$('pre').hide();
$('#htxt').height(50);
$('input#frm').attr("disabled", "disabled");
$(".ui-dialog-buttonpane button:contains('Valider')").hide();
});
}
}},
{ text: txt, click: function() { $(this).dialog('close'); }}
] });