issue #0001610 : Interface pour modification de l'email dans le portefeuille des surveillances
This commit is contained in:
parent
f902f96de7
commit
b0de71b906
@ -438,6 +438,47 @@ class UserController extends Zend_Controller_Action
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override email in surveillance portfolio
|
||||
*/
|
||||
public function emailsurveillanceAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$request = $this->getRequest();
|
||||
|
||||
$user = new Scores_Utilisateur();
|
||||
|
||||
//Execute webservice operation
|
||||
if ( $request->isPost() ) {
|
||||
$email = trim($request->getParam('email'));
|
||||
if ($user->isAdmin() || $user->isSuperAdmin()) {
|
||||
$login = $request->getParam('login');
|
||||
}
|
||||
|
||||
if (empty($email)) {
|
||||
$result = "Aucun email défini!";
|
||||
} else if (empty($login)) {
|
||||
$result = "Aucun utilisateur défini!";
|
||||
} else {
|
||||
$ws = new WsScores();
|
||||
$result = $ws->setSurveillancesMail($login, $email);
|
||||
}
|
||||
|
||||
$this->view->assign('result', $result);
|
||||
}
|
||||
//Display form in dialog
|
||||
else {
|
||||
if ($user->isAdmin() || $user->isSuperAdmin()) {
|
||||
$login = $request->getParam('login');
|
||||
} else {
|
||||
$login = $user->getLogin();
|
||||
}
|
||||
$this->view->assign('login', $login);
|
||||
$this->view->assign('dialog',true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Changer le theme de l'utilisateur
|
||||
*/
|
||||
@ -461,7 +502,9 @@ class UserController extends Zend_Controller_Action
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display browser informations on a simple page
|
||||
*/
|
||||
public function browserAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
|
@ -43,6 +43,11 @@ if ($this->action == 'new') {
|
||||
<div class="infoTitle StyleInfoLib">Adresse e-mail</div>
|
||||
<div class="infoData">
|
||||
<input type="text" size="30" maxlength="80" name="frmOptions[email]" value="<?=$this->options['email']?>"/>
|
||||
<?php if ($this->action != 'new') {?>
|
||||
<br/><a id="email-surveillance"
|
||||
href="<?=$this->url(array('controller'=>'user', 'action'=>'emailsurveillance', 'login'=>$this->options['login']), null, true)?>"
|
||||
title="Initialiser email des surveillances">Initialiser email des surveillances</a>
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
<div class="infoTitle StyleInfoLib">
|
||||
@ -279,7 +284,7 @@ foreach ($this->prefsLib as $code => $lib) {
|
||||
|
||||
</div>
|
||||
|
||||
<div id="dialog" title="Modifier le mot de passe">
|
||||
<div id="dialog-password" title="Modifier le mot de passe">
|
||||
<form>
|
||||
<label for="npass1">Nouveau mot de passe</label><br/>
|
||||
<input type="password" name="npass1" size="15" maxlength="32"/><br/>
|
||||
|
@ -0,0 +1,42 @@
|
||||
<?php if ( $this->dialog ) {?>
|
||||
|
||||
<form action="<?=$this->url(array('controller'=>'user', 'action'=>'emailsurveillance'), null, true)?>" method="post">
|
||||
<input type="hidden" name="login" value="<?=$this->login?>"/>
|
||||
<label>Email : </label><input type="text" name="email" value="<?=$this->email?>"/>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [
|
||||
{ text: "Valider", click: function() { dialogSubmit(); } },
|
||||
{ text: "Annuler", click: function() { $(this).dialog("close"); } }
|
||||
]});
|
||||
|
||||
function dialogSubmit(){
|
||||
$('#dialog').dialog({buttons: []});
|
||||
var action = $('#dialog form').attr('action');
|
||||
$.post(action, $('#dialog form').serialize(), function(data) {
|
||||
$('#dialog').html(data);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php } else {?>
|
||||
|
||||
<?php if (is_int($this->result) && $this->result<=1) {?>
|
||||
<?=$this->result?> surveillance affectée.
|
||||
|
||||
<?php } elseif (is_int($this->result) && $this->result>1) {?>
|
||||
<?=$this->result?> surveillances affectées.
|
||||
|
||||
<?php } else {?>
|
||||
Erreur : <?=$this->result?>
|
||||
<?php }?>
|
||||
|
||||
<script>
|
||||
$('#dialog').dialog({ buttons: [ {
|
||||
text: "Fermer",
|
||||
click: function() { $(this).dialog("close"); }
|
||||
} ] });
|
||||
</script>
|
||||
|
||||
<?php }?>
|
@ -57,12 +57,32 @@ class WsScores
|
||||
}
|
||||
}
|
||||
|
||||
public function setSurveillancesMail($login, $email)
|
||||
{
|
||||
$params = new stdClass();
|
||||
$params->login = $login;
|
||||
$params->email = $email;
|
||||
$client = $this->loadClient('gestion');
|
||||
try {
|
||||
$reponse = $client->setSurveillancesMail($params);
|
||||
return $reponse->setSurveillancesMailResult;
|
||||
} catch (SoapFault $fault) {
|
||||
Zend_Registry::get('firebug')->info($fault->faultcode.':'.$fault->faultstring);
|
||||
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
|
||||
return $fault->faultstring;
|
||||
} else {
|
||||
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setUserService($login, $code)
|
||||
{
|
||||
$params = new stdClass();
|
||||
$params->login = $login;
|
||||
$params->code = $code;
|
||||
$client = $this->loadClient('saisie');
|
||||
$client = $this->loadClient('gestion');
|
||||
try {
|
||||
$reponse = $client->setUserService($params);
|
||||
return $reponse->setUserServiceResult;
|
||||
|
@ -1,5 +1,6 @@
|
||||
$(document).ready(function(){
|
||||
$('body').delegate('#password', 'click', function(){
|
||||
|
||||
$('a#password').on('click', function(){
|
||||
var dialogOpts = {
|
||||
bgiframe: true,
|
||||
autoOpen: false,
|
||||
@ -19,11 +20,11 @@ $(document).ready(function(){
|
||||
},
|
||||
'Annuler': function() { $(this).dialog('close'); }
|
||||
},
|
||||
close: function() { $('#dialog').remove(); }
|
||||
close: function() { $('#dialog-password').remove(); }
|
||||
};
|
||||
|
||||
$("#dialog").dialog(dialogOpts);
|
||||
$("#dialog").dialog('open');
|
||||
$("#dialog-password").dialog(dialogOpts);
|
||||
$("#dialog-password").dialog('open');
|
||||
return false;
|
||||
});
|
||||
|
||||
@ -43,5 +44,25 @@ $(document).ready(function(){
|
||||
bouton.removeAttr('disabled');
|
||||
});
|
||||
|
||||
|
||||
$('a#email-surveillance').on('click', function(){
|
||||
var href = $(this).attr('href');
|
||||
if (href!='#') {
|
||||
var title = $(this).attr('title');
|
||||
var dialogOpts = {
|
||||
bgiframe: true,
|
||||
title: title,
|
||||
width: 550,
|
||||
height: 300,
|
||||
modal: true,
|
||||
open: function(event, ui) {
|
||||
$(this).html('Chargement...');
|
||||
$(this).load(href);
|
||||
},
|
||||
buttons: { Annuler: function() { $(this).dialog('close'); } },
|
||||
close: function() { $('#dialog').remove(); }
|
||||
};
|
||||
$('<div id="dialog"></div>').dialog(dialogOpts);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user