Fixed issue #30

This commit is contained in:
Rooty 2020-12-14 15:18:55 +01:00
parent 97d179514d
commit de1fce5aac
2 changed files with 95 additions and 160 deletions

View File

@ -1,142 +1,64 @@
<div class="tab-content container px-2 py-2 border">
<div class="panel-heading">
<mx:text id="TxtListUserForInscription"/> (<a href="javascript:void(0);" onclick="setCheckOptions('FManageRegister', 'user_id[]'); return false;" class="Navigation"><mx:text id="user_action"/></a>)
</div>
<div class="panel-body">
<form name="fictif" action="#">
<input type="hidden" name="selectcheckbox" value="<mx:text id="selectcheckbox"/>" />
<input type="hidden" name="confirmactivate" value="<mx:text id="confirmactivate"/>" />
<input type="hidden" name="confirmdelete" value="<mx:text id="confirmdelete"/>" />
<input type="hidden" name="urlAction1" mXattribut="value:urlAction1" />
<input type="hidden" name="urlAction2" mXattribut="value:urlAction2" />
</form>
<form class="form-inline" id="FManageRegister" name="FManageRegister" role="form" method="post" mXattribut="action:urlAction0">
<div class="row">
<div class="table-responsive">
<table class="table table-responsive table-bordered table-striped table-hover" id="tabInscriptions" mXattribut="summary:TxtListUserForInscription">
<thead class="thead-default">
<tr>
<th><mx:text id="user_first_name_without_dots"/></th>
<th><mx:text id="user_last_name_without_dots"/></th>
<th><mx:text id="user_login_without_dots"/></th>
<th><mx:text id="user_group_without_dots"/></th>
<th><mx:text id="user_mail_without_dots"/></th>
<!--<th><mx:text id="user_city_without_dots"/></th>-->
<!--<th><mx:text id="user_organisation_without_dots"/></th>-->
<th><mx:text id="TxtAction_without_dots"/></th>
</tr>
</thead>
<tbody>
<mx:bloc id="ligne">
<tr>
<td><mx:text id="vuser_first_name"/></td>
<td><mx:text id="vuser_last_name"/></td>
<td><mx:text id="vuser_login"/></td>
<td><mx:text id="vuser_group"/></td>
<td><mx:text id="vuser_mail"/></td>
<!--<td><mx:text id="vuser_city"/></td>-->
<!--<td><mx:text id="vuser_organisation"/></td>-->
<td class="action"><div class="boxcheck"><mx:checker id="vuser_action" /></div></td>
</tr>
</mx:bloc id="ligne">
<tfoot class="tfoot-default">
<tr>
<th><mx:text id="user_first_name_without_dots"/></th>
<th><mx:text id="user_last_name_without_dots"/></th>
<th><mx:text id="user_login_without_dots"/></th>
<th><mx:text id="user_group_without_dots"/></th>
<th><mx:text id="user_mail_without_dots"/></th>
<!--<th><mx:text id="user_city_without_dots"/></th>-->
<!--<th><mx:text id="user_organisation_without_dots"/></th>-->
<th><mx:text id="TxtAction_without_dots"/></th>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="row">
<div class="panel-heading">
<mx:text id="user_action_text"/>
</div>
<div class="panel-body">
<p class="input-group col-xs-12 col-sm-4 col-lg-4">
<span class="input-group-addon"><span class="fa fa-user"></span><mx:text id="GroupChoiceDefaultActivate"/></span><mx:select id="GROUP"/>
<mx:formField id="user_accept" class="add"/>
<mx:formField id="user_delete" class="delete"/>
</p>
</div>
</div>
</form>
<div class="tab-content container-fluid px-2 py-2 w-75 border">
<div class="card w-100">
<div class="card-header text-center">
<h3><mx:text id="TxtListUserForInscription"/> (<a href="javascript:void(0);" onclick="setCheckOptions('FManageRegister', 'user_id[]'); return false;" class="Navigation"><mx:text id="user_action"/></a>)</h3>
</div>
<div class="card-body">
<div class="row mb-0">
<form id="userTemp" name="userTemp" role="form" class="form text-center px-0" method="post" action="#">
<input type="hidden" name="selectcheckbox" value="<mx:text id="selectcheckbox"/>" />
<input type="hidden" name="confirmactivate" value="<mx:text id="confirmactivate"/>" />
<input type="hidden" name="confirmdelete" value="<mx:text id="confirmdelete"/>" />
<input type="hidden" name="urlAction1" mXattribut="value:urlAction1" />
<input type="hidden" name="urlAction2" mXattribut="value:urlAction2" />
</form>
</div>
<form id="FManageRegister" name="FManageRegister" role="form" class="form text-center px-0" method="post" mXattribut="action:urlAction0">
<table class="table table-sm table-responsive-sm table-bordered table-striped table-hover" id="tabInscriptions" mXattribut="summary:TxtListUserForInscription">
<thead class="thead-default">
<tr>
<th><mx:text id="user_first_name"/></th>
<th><mx:text id="user_last_name"/></th>
<th><mx:text id="user_login"/></th>
<th><mx:text id="user_group"/></th>
<th><mx:text id="user_mail"/></th>
<!--<th><mx:text id="user_city_without_dots"/></th>-->
<!--<th><mx:text id="user_organisation_without_dots"/></th>-->
<th data-orderable="false"><mx:text id="TxtAction"/></th>
</tr>
</thead>
<tbody>
<mx:bloc id="ligne">
<tr>
<td><mx:text id="vuser_first_name"/></td>
<td><mx:text id="vuser_last_name"/></td>
<td><mx:text id="vuser_login"/></td>
<td><mx:text id="vuser_group"/></td>
<td><mx:text id="vuser_mail"/></td>
<!--<td><mx:text id="vuser_city"/></td>-->
<!--<td><mx:text id="vuser_organisation"/></td>-->
<td class="action"><div class="boxcheck"><mx:checker id="vuser_action" /></div></td>
</tr>
</mx:bloc id="ligne">
</table>
<div class="card-header text-center pb-0">
<h3><mx:text id="user_action_text"/></h3>
</div>
<div class="card-body">
<div class="row mb-0">
<div class="input-group col-xs-12 col-sm-8 col-lg-12 p-0 m-0 justify-content-center">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-lg fa-group"></i><mx:text id="GroupChoiceDefaultActivate"/></span>
</div>
<mx:select id="GROUP"/>
</div>
</div>
</div>
<div class="card-footer border-0 bg-white text-center pb-0">
<mx:formField id="user_accept" class="add"/>
<mx:formField id="user_delete" class="delete"/>
</div>
</form>
</div>
</div>
</div>
<script>
$(document).ready(function()
{
$('#tabInscriptions').dataTable( {
"bPaginate": false,
"bFilter": false,
"bInfo": false,
// "sPaginationType": "full_numbers",
// "bAutoWidth": true,
// "bSort": false,
"aaSorting": [[ 0, "desc" ]],
// "iDisplayLength": 20,
// "aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]],
"oLanguage": {
"sUrl": "data/message/fr/datatables.txt"
}
} );
}
);
</script>
<script type="text/javascript">
<!--
function Valid_register(the_val,the_form,the_field)
{
var objectform = document.forms[the_form];
var nbr = objectform.length;
var flag = 0;
for (z=0 ; z < nbr; z++)
{
if (objectform.elements[z].checked == true && objectform.elements[z].name == the_field)
{
flag=1;
}
}
if (flag == 0)
{
alert(document.fictif.selectcheckbox.value);
return false;
}
else
{
if(the_val == 1)
{
var reponse = confirm(document.fictif.confirmactivate.value);
}
else
{
var reponse = confirm(document.fictif.confirmdelete.value);
}
if (reponse == true)
{
if(the_val==1)
{
objectform.action=document.fictif.urlAction1.value;
}
else
{
objectform.action=document.fictif.urlAction2.value;
}
objectform.submit();
}
else
{
return false;
}
}
}
//-->
</script>

View File

@ -46,13 +46,33 @@ Class UserTemp extends CoordinationObj
*/
function actionManageRegister()
{
/* On inclus la template (voir package.template.php) */
withBlocPath("UserTemp", "actionManageRegister");
global $SERVER_NAME, $SCRIPT_NAME, $CONF_PERSISTANT_SECURE,$CONF_DATA_PATH;
/*Récupération des messages utilisateurs*/
addMessageFile("user.ini");
mxPageTitle("titlAdminSubscriptions");
/* gestion du lib en fonction de la langue courante */
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
/* fin récupération des codes par defaut */
$arrayCallCss = array();
$arrayCallCss[] = "data/css/dataTables.bootstrap4/1.10.22/dataTables.bootstrap4.min.css";
mxCallCss($arrayCallCss);
$arrayCallJs = array();
$arrayCallJs[] = "data/javascript/jquery.dataTables/1.10.22/jquery.dataTables.min.js";
$arrayCallJs[] = "data/javascript/dataTables.bootstrap4/1.10.22/dataTables.bootstrap4.min.js";
mxCallJs($arrayCallJs);
$arrayRawJs[] = "\$(document).ready(function(){\$(\"#tabInscriptions\").dataTable({\"bPaginate\": false,\"bFilter\": false,\"bInfo\": false,\"aaSorting\": [[ 0, \"desc\" ]],\"oLanguage\": {\"sUrl\": \"data/message/".$currentCode."/datatables.txt\"}});}); ";
$arrayRawJs[] = "function Valid_register(the_val,the_form,the_field){var objectform = document.forms[the_form];var nbr = objectform.length;var flag = 0;for (z=0 ; z < nbr; z++){if(objectform.elements[z].checked == true && objectform.elements[z].name == the_field){flag=1;}}if(flag == 0){alert(document.userTemp.selectcheckbox.value);return false;}else{if(the_val == 1){var reponse = confirm(document.userTemp.confirmactivate.value);}else{var reponse = confirm(document.userTemp.confirmdelete.value);}if(reponse == true){if(the_val==1){objectform.action=document.userTemp.urlAction1.value;}else{objectform.action=document.userTemp.urlAction2.value;}objectform.submit();}else{return false;}}}";
mxRawJs($arrayRawJs);
/* On inclus la template (voir package.template.php) */
withBlocPath("UserTemp", "actionManageRegister");
/* Récuperation du noeud à administrer sinon noeud d'entrée de l'admin */
$groupId=($this->getData("groupId")!="")?$this->getData("groupId"):1; /* Tous les Groupes par défaut */
@ -68,11 +88,6 @@ Class UserTemp extends CoordinationObj
// --> recuperation du treeNode correspondant au noeurd
$tabTreeGroup[0]=$myTreeGroup; //--> treeNodeUnique....
/* gestion du lib en fonction de la langue courante */
$currentCode=$GLOBALS["SYSTEM_USER_SESSION"]->langue->getCode();
$defaultCode=$GLOBALS["SYSTEM_DEFAULT_LANGUAGE_CODE"];
/* fin récupération des codes par defaut */
//Récupération de l'identifiant de la communauté : methode en fin de page
$nodeId = $this->recupCommunauty();
@ -103,8 +118,6 @@ Class UserTemp extends CoordinationObj
//OBTENIR LE GROUPE DE L'UTILISATEUR
// var_dump($tabNodeGroupUser[$i]->getGroupId());
//On récupère les données de l'utilisateur concerné
// $titre = array(getMessage("mr"),getMessage("mrs"), getMessage("miss"));
// $GLOBALS["SYSTEM_TEMPLATE"]->MxText("ligne.vuser_title", $titre[$currentUser->getTitle()]);
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("ligne.vuser_first_name", $currentUser->getFirstName());
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("ligne.vuser_last_name", $currentUser->getLastName());
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("ligne.vuser_login", $currentUser->getLogin());
@ -121,9 +134,9 @@ Class UserTemp extends CoordinationObj
$treeGroup = "";
for($n=(count($tabWayTreeGroup)-1);$n>=0;$n--){
if($n>0)
$treeGroup .= "/ ".$tabWayTreeGroup[$n];
$treeGroup .= " / ".$tabWayTreeGroup[$n];
else
$treeGroup .= "/".$tabWayTreeGroup[$n]."";
$treeGroup .= " / ".$tabWayTreeGroup[$n]."";
}
} else {
$treeGroup = "Aucun";
@ -142,17 +155,17 @@ Class UserTemp extends CoordinationObj
$GLOBALS["SYSTEM_CONTROL"]->messageSystem = "NoRegisterEntry";
}
printTabTreeGroup($tabTreeGroup, 0, "GROUP","id_Group");
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_delete", "button", "boutton", getMessage("user_delete"), " class=\"form-control\" onclick=\"javascript:Valid_register(2,'FManageRegister','user_id[]');\"");
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_accept", "button", "boutton", getMessage("user_accept"), " class=\"form-control\" onclick=\"javascript:Valid_register(1,'FManageRegister','user_id[]');\"");
printTabTreeGroup($tabTreeGroup, 0, "GROUP", "id_Group", '', getMessage("TxtGroup"));
// <input type="button" name="BtnReturn" class="btn btn-outline-secondary btn-lg btn-sm" aria-pressed="true" value="<mx:text id="BtnReturn"/>" onclick="history.back();"/>
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_delete", "button", "boutton", getMessage("user_delete"), " class=\"form\" onclick=\"javascript:Valid_register(2,'FManageRegister','user_id[]');\"");
$GLOBALS["SYSTEM_TEMPLATE"]->MxFormField("user_accept", "button", "boutton", getMessage("user_accept"), " class=\"form\" onclick=\"javascript:Valid_register(1,'FManageRegister','user_id[]');\"");
# Envoi du formulaire en fonction de l'action : encode le javascript
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("urlAction0", formatUrl($this->getId(),"UserTemp","execManageRegister"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("urlAction1", formatUrl($this->getId(),"UserTemp","execManageRegister"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("urlAction2", formatUrl($this->getId(),"UserTemp","execDeleteManageRegister"));
return "";
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("urlAction1", formatUrl($this->getId(),"UserTemp","execManageRegister"));
$GLOBALS["SYSTEM_TEMPLATE"]->MxAttribut("urlAction2", formatUrl($this->getId(),"UserTemp","execDeleteManageRegister"));
return "";
}
/**