Commit e164cdec authored by Clément Damiens's avatar Clément Damiens

Merged branch development into refactoDynform4Surveys

parents b53e10ac 367d6c48
......@@ -10,6 +10,7 @@ dynForm = {
if(typeof currentKFormType != "undefined" && typeObj[currentKFormType] && typeObj[currentKFormType].color){
//alert("dyn" + typeObj[currentKFormType].color);
mylog.log("currentKFormType", currentKFormType, typeObj[currentKFormType], typeObj[currentKFormType].color);
$("#ajax-modal .modal-header").addClass("bg-"+typeObj[currentKFormType].color);
$("#ajax-modal .infocustom p").addClass("text-"+typeObj[currentKFormType].color);
}else{
......
......@@ -41,4 +41,12 @@ filtre.tags :Utilité
### A Renommer
displayCommunexion -> signup ou login
\ No newline at end of file
displayCommunexion -> signup ou login
# Test a faire sur les networks
- https://www.communecter.org/network/default/index/?src=https://gist.githubusercontent.com/SimonSarazin/a1ec515294dd8f633fcf22ff11e7dc9a/raw/b9dfed22bbb3b4faa11d85e8248a2e93cb6a01b5/Beuvrages
+ [ ] Vérifier que les liens fonctions
+ [ ] Vérifier que les filtres
\ No newline at end of file
......@@ -10,7 +10,16 @@
</div>
<div class="modal-body text-dark">
<p>
<?php echo Yii::t('common',"Are you sure you want to delete this element ? </br> The element will be deleted : it will not be referenced in all their projects or events. But these last ones will not be deleted. <span class=\"text-red\">Warning:</span> this action can be cancelled only by an administrator") ;?>
<?php
if($id == Yii::app()->session["userId"] && $type == Person::COLLECTION){
echo "Si vous supprimer votre comptes, toutes vos informations personnelles et vos messages seront supprimer";
} else {
echo Yii::t('common',"Are you sure you want to delete this element ? </br> The element will be deleted : it will not be referenced in all their projects or events. But these last ones will not be deleted. <span class=\"text-red\">Warning:</span> this action can be cancelled only by an administrator") ;
}
?>
</p>
<br>
<?php echo Yii::t('common','You can add bellow the reason why you want to delete this element :') ;?>
......
......@@ -119,14 +119,7 @@
</div>
</a>
</li>
<li role="presentation">
<a href="javascript:" class="" id="menuImportFile">
<div id="titleImportFile" class='radius-10 padding-10 text-grey text-dark'>
<i class="fa fa-upload fa-2x"></i>
<?php echo Yii::t("invite","Import a file"); ?>
</div>
</a>
</li>
<?php
if($parentType != Person::COLLECTION){
?>
......@@ -141,6 +134,15 @@
<?php
}
?>
<li role="presentation">
<a href="javascript:" class="" id="menuImportFile">
<div id="titleImportFile" class='radius-10 padding-10 text-grey text-dark'>
<i class="fa fa-pencil fa-2x"></i>
<?php echo Yii::t("invite","Others");
//echo Yii::t("invite","Import a file"); ?>
</div>
</a>
</li>
</ul>
</div>
</div>
......@@ -191,10 +193,24 @@
</form>
</div>
</div>
<div id="step1-import" class="modal-body col-xs-6">
<div class="form-group">
<div id="step1-other" class="modal-body col-xs-6">
<div class="form-group col-xs-12">
<select id="typeOther" name="typeOther">
<option value="-1"><?php echo Yii::t("common","Choose"); ?></option>
<option value="import"><?php echo Yii::t("invite","Import a file"); ?></option>
<option value="text"><?php echo Yii::t("invite","Write"); ?></option>
</select>
</div>
<div class="form-group col-xs-12" id="step-import">
<label for="fileEmail" > <?php echo Yii::t("invite","Files (CSV)"); ?> : <input type="file" id="fileEmail" name="fileEmail" accept=".csv"> </label>
</div>
<div class="form-group col-xs-12" id="step-text" >
<textarea id="textarea-invite" rows="10" cols="50"></textarea></br>
<button id="btnValiderTextarea" class="btn btn-success" >
<?php echo Yii::t("invite","Check"); ?>
</button>
</div>
<span id="errorFile" class="col-xs-12 text-red" ></span>
</div>
<div id="step1-mycontacts" class="modal-body col-xs-6" >
<div class="form-group">
......@@ -265,9 +281,9 @@
if(inView == "step1-search") {
$("#modal-invite #divSearchInvite").show();
$("#modal-invite #step1-search").show();
} else if(inView == "step1-import") {
} else if(inView == "step1-other") {
$("#modal-invite #divSearchInvite").show();
$("#modal-invite #step1-import").show();
$("#modal-invite #step1-other").show();
} else if(inView == "step1-mycontacts") {
$("#modal-invite #divSearchInvite").show();
$("#modal-invite #step1-mycontacts").show();
......@@ -294,14 +310,18 @@
$("#modal-invite #divSearchInvite").hide();
$("#modal-invite #divResult").hide();
$("#modal-invite #step1-search").hide();
$("#modal-invite #step1-import").hide();
$("#modal-invite #step1-other").hide();
$("#modal-invite #step1-mycontacts").hide();
$("#modal-invite #step2").hide();
$("#modal-invite #form-invite").hide();
$("#modal-invite #errorFile").hide();
$("#modal-invite #step-import").hide();
$("#modal-invite #step-text").hide();
$("#modal-invite #dropdown-invite").html("");
$("#modal-invite #dropdown-search-invite").html("");
$("#modal-invite #dropdown-result").html("");
$("#modal-invite #errorFile").html("");
$("#modal-invite #inviteSearch").val("");
$("#modal-invite #inviteName").val("");
......@@ -309,6 +329,8 @@
$("#fileEmail").val("");
$("#modal-invite .errorHandler").hide();
}
......@@ -320,10 +342,35 @@
myContactsToListInvites();
});
$("#modal-invite #typeOther").change(function(e) {
mylog.log("typeOther");
initInvite();
fadeInView("step1-other");
if( $(this).val() == "import" ){
$("#modal-invite #step-import").show();
$("#modal-invite #step-text").hide();
} else if( $(this).val() == "text" ){
$("#modal-invite #step-import").hide();
$("#modal-invite #step-text").show();
} else {
$("#modal-invite #step-import").hide();
$("#modal-invite #step-text").hide();
}
});
$("#modal-invite #btnValiderTextarea").click(function() {
var textarea = $("#modal-invite #textarea-invite").val();
var mailsArray = [] ;
if(textarea.indexOf("<") > -1)
textarea = textarea.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi).join(';');
mailsArray = textarea.split(/[\s\n;,]+/);
checkAndGetMailsInvite(mailsArray);
});
$("#modal-invite #menuImportFile").click(function() {
mylog.log("menuImportFile");
fadeInView("step1-import");
fadeInView("step1-other");
});
$("#modal-invite #menuInviteSomeone").click(function() {
......@@ -809,7 +856,14 @@
str += '<i class="fa fa-users "></i> ';
}
str += '<span class="text-dark text-bold">' + elem.name + '</span>';
str += '<span class="text-dark text-bold">' + elem.name ;
mylog.log("mailalal", typeList, elem.mail, (typeList == "invites" && typeof elem.mail != "undefined"));
if(typeList == "invites" && typeof elem.mail != "undefined"){
mylog.log("mailalal", typeList, elem.mail);
str += ' <'+ elem.mail +'> </span>';
}
str += '</span>';
if(inMyContact == true)
str += ' <span class="text-dark text-bold text-green follows tooltips"> '+
'<i class="fa fa-link" data-toggle="tooltip" data-placement="top" title="'+trad.follows+'" alt="" data-original-title="'+trad.follows+'"></i>'+
......@@ -862,9 +916,13 @@
dataType: "json",
success: function(data){
mylog.log("getcontactsbymails data", data, data.length);
var regexMail = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
regexMail.test("zfezsqsqfezf@yahoo.fr");
var nbError = 0;
$.each(data, function(keyMails, valueMails){
mylog.log("keyMails valueMails", keyMails, valueMails, typeof valueMails);
if(typeof valueMails == "object"){
listInvite.citoyens[valueMails.id] = {
name : valueMails.name,
......@@ -875,18 +933,31 @@
listInvite.citoyens[valueMails.id].isAdmin = "";
} else {
listInvite.invites[keyUniqueByMail(keyMails)] = {
name : keyMails,
email : keyMails,
msg : ""
} ;
if(parentType != "citoyens")
listInvite.invites[keyUniqueByMail(keyMails)].isAdmin = "";
mylog.log("regexMail", keyMails, regexMail.test(keyMails))
if(regexMail.test(keyMails)){
listInvite.invites[keyUniqueByMail(keyMails)] = {
name : keyMails,
mail : keyMails,
msg : ""
} ;
if(parentType != "citoyens")
listInvite.invites[keyUniqueByMail(keyMails)].isAdmin = "";
} else {
nbError++;
}
}
});
showElementInvite(listInvite, true);
bindRemove();
mylog.log("nbError", nbError);
if(nbError > 0){
$("#modal-invite #errorFile").html(nbError+ " mails ne sont pas valides");
$("#modal-invite #errorFile").show();
}
$.unblockUI();
}
});
......
......@@ -166,7 +166,7 @@
$auth = Authorisation::canParticipate(Yii::app()->session['userId'], $type, (string)$element["_id"]);
if (Authorisation::canDeleteElement((String)$element["_id"], $type, Yii::app()->session["userId"]) && !@$deletePending)
$this->renderPartial('../element/confirmDeleteModal'); ?>
$this->renderPartial('../element/confirmDeleteModal', array("id" =>(String)$element["_id"], "type"=>$type)); ?>
<?php
if (@$element["status"] == "deletePending" && Authorisation::isElementAdmin((String)$element["_id"], $type, Yii::app()->session["userId"])) $this->renderPartial('../element/confirmDeletePendingModal', array( "element"=>$element)); ?>
......@@ -566,19 +566,6 @@
</a>
</li>
<?php } ?>
<?php if ( Authorisation::canDeleteElement((String)$element["_id"], $type, Yii::app()->session["userId"]) &&
!@$deletePending && !empty(Yii::app()->session["userId"])) { ?>
<li class="text-left">
<a href="javascript:;" id="btn-delete-element" class="bg-white text-red" data-toggle="modal">
<i class="fa fa-trash"></i>
<?php echo Yii::t("common", "Delete {what}",
array("{what}"=>
Yii::t("common","this ".Element::getControlerByCollection($type))));
?>
</a>
</li>
<?php } ?>
<?php } else { ?>
<?php if(@Yii::app()->session["userId"] && $edit==true){ ?>
......@@ -636,6 +623,26 @@
<i class='fa fa-print'></i> <?php echo Yii::t("home","Print out") ?>
</a>
</li>
<?php if ( Authorisation::canDeleteElement( (String)$element["_id"], $type, Yii::app()->session["userId"]) &&
!@$deletePending &&
!empty(Yii::app()->session["userId"]) &&
$type !=Person::COLLECTION
) { ?>
<li class="text-left">
<a href="javascript:;" id="btn-delete-element" class="bg-white text-red" data-toggle="modal">
<i class="fa fa-trash"></i>
<?php
if($type == Person::COLLECTION && (String)$element["_id"] == Yii::app()->session["userId"])
echo "Supprimer mon compte";
else
echo Yii::t("common", "Delete {what}",
array("{what}"=>
Yii::t("common","this ".Element::getControlerByCollection($type))));
?>
</a>
</li>
<?php } ?>
</ul>
</li>
</ul>
......@@ -644,7 +651,7 @@
<?php if(isset(Yii::app()->session["userId"]) && $typeItem!=Person::COLLECTION){ ?>
<div class="btn-group pull-right">
<button class='btn btn-default bold btn-share pull-right letter-green' style="border:0px!important;"
data-ownerlink='share' data-id='<?php echo $element["_id"]; ?>' data-type='<?php echo $typeItem; ?>'
data-ownerlink='share' data-id='<?php echo $element["_id"]; ?>' data-type='<?php echo $typeItem; ?>'
data-isShared='false'>
<i class='fa fa-share'></i> <span class="hidden-xs"><?php echo Yii::t("common","Share") ?></span>
</button>
......
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