Commit 3f77f45e authored by Clément Damiens's avatar Clément Damiens
Browse files

fix admin isAdminInviting process

parent b6c29610
......@@ -376,7 +376,7 @@ function connectPerson(connectUserId, callback)
function disconnectTo(parentType,parentId,childId,childType,connectType, callback) {
function disconnectTo(parentType,parentId,childId,childType,connectType, callback, linkOption) {
var messageBox = trad["removeconnection"+connectType];
$(".disconnectBtnIcon").removeClass("fa-unlink").addClass("fa-spinner fa-spin");
var formData = {
......@@ -386,6 +386,8 @@ function disconnectTo(parentType,parentId,childId,childType,connectType, callbac
"parentId" : parentId,
"connectType" : connectType,
};
if(typeof linkOption != "undefined" && linkOption)
formData.linkOption=linkOption;
bootbox.dialog({
onEscape: function() {
$(".disconnectBtnIcon").removeClass("fa-spinner fa-spin").addClass("fa-unlink");
......
......@@ -905,10 +905,13 @@ var directory = {
if(typeof(params.statusLink)!="undefined"){
if(typeof(params.statusLink.isAdmin)!="undefined" && typeof(params.statusLink.isAdminPending)=="undefined")
str+="<span class='text-red'>Administrateur</span>";
if(typeof(params.statusLink.isAdmin)!="undefined" && typeof(params.statusLink.isAdminPending)=="undefined" && typeof(params.statusLink.isAdminInviting)=="undefined")
str+="<span class='text-red'>"+trad.administrator+"</span>";
if(typeof(params.statusLink.isAdminInviting)!="undefined"){
str+="<span class='text-red'>"+trad.invitingToAdmin+"</span>";
}
if(typeof(params.statusLink.toBeValidated)!="undefined" || typeof(params.statusLink.isAdminPending)!="undefined")
str+="<span class='text-red'>En attente de validation</span>";
str+="<span class='text-red'>"+trad.waitingValidation+"</span>";
}
if(params.rolesLbl != "")
......
......@@ -132,18 +132,29 @@
if(@$invitedMe && !empty($invitedMe)){
$inviteRefuse="Refuse";
$inviteAccept="Accept";
$tooltipAccept="Join this ".Element::getControlerByCollection($type);
$verb="Join";
$labelAdmin="";
$option=null;
$linkValid=Link::IS_INVITING;
if(@$invitedMe["isAdminInviting"]){
$verb="Administrate";
$option="isAdminInviting";
$labelAdmin=" to administrate";
$linkValid=Link::IS_ADMIN_INVITING;
}
$labelInvitation=Yii::t("common", "{who} invited you".$labelAdmin, array("{who}"=>"<a href='#page.type.".Person::COLLECTION.".id.".$invitedMe["invitorId"]."' class='lbh'>".$invitedMe["invitorName"]."</a>"));
$tooltipAccept=$verb." this ".Element::getControlerByCollection($type);
if ($type == Event::COLLECTION){
$inviteRefuse="Not interested";
$inviteAccept="I go";
}
echo "<div class='no-padding containInvitation' style='border-bottom: 1px solid lightgray;margin-bottom:10px !important;'>".
"<div class='padding-5'>".
"<a href='#page.type.".Person::COLLECTION.".id.".$invitedMe["invitorId"]."' class='lbh'>".$invitedMe["invitorName"]."</a><span class='text-dark'> vous a invité: <br/>".
'<a class="btn btn-xs tooltips btn-accept" href="javascript:;" onclick="validateConnection(\''.$type.'\',\''.(string)$element["_id"].'\', \''.Yii::app()->session["userId"].'\',\''.Person::COLLECTION.'\',\''.Link::IS_INVITING.'\')" data-placement="bottom" data-original-title="'.Yii::t("common",$tooltipAccept).'">'.
$labelInvitation.": <br/>".
'<a class="btn btn-xs tooltips btn-accept" href="javascript:;" onclick="validateConnection(\''.$type.'\',\''.(string)$element["_id"].'\', \''.Yii::app()->session["userId"].'\',\''.Person::COLLECTION.'\',\''.$linkValid.'\')" data-placement="bottom" data-original-title="'.Yii::t("common",$tooltipAccept).'">'.
'<i class="fa fa-check "></i> '.Yii::t("common",$inviteAccept).
'</a>'.
'<a class="btn btn-xs tooltips btn-refuse margin-left-5" href="javascript:;" onclick="disconnectTo(\''.$type.'\',\''.(string)$element["_id"].'\',\''.Yii::app()->session["userId"].'\',\''.Person::COLLECTION.'\',\''.Element::$connectTypes[$type].'\')" data-placement="bottom" data-original-title="'.Yii::t("common","Not interested by the invitation").'">'.
'<a class="btn btn-xs tooltips btn-refuse margin-left-5" href="javascript:;" onclick="disconnectTo(\''.$type.'\',\''.(string)$element["_id"].'\',\''.Yii::app()->session["userId"].'\',\''.Person::COLLECTION.'\',\''.Element::$connectTypes[$type].'\',null,\''.$option.'\')" data-placement="bottom" data-original-title="'.Yii::t("common","Not interested by the invitation").'">'.
'<i class="fa fa-remove"></i> '.Yii::t("common",$inviteRefuse).
'</a>'.
"</div>".
......
......@@ -66,6 +66,8 @@ var trad = {
"city" : "<?php echo Yii::t("common","City"); ?>",
"administrator" : "<?php echo Yii::t("common","Administrator") ?>",
"invitingToAdmin" : "<?php echo Yii::t("common","Invited to administrate") ?>",
"waitingValidation" : "<?php echo Yii::t("common","Waiting for validation") ?>",
"Member" : "<?php echo Yii::t("common","Member") ?>",
"justCitizen" : "<?php echo Yii::t("common","Just a citizen wanting to give visibility to it :)") ?>",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment