Commit 8b419a00 authored by Clément Damiens's avatar Clément Damiens

Merged branch development into development

parents 75a6f10a fa3b56da
......@@ -335,7 +335,7 @@ var calendar = {
popupContent += "<a href='"+url+"' onclick='"+onclick+"' class='lbh'>";
popupContent += "<a href='"+url+"' target='_blank' onclick='"+onclick+"' class='lbh'>";
popupContent += '<div class="btn btn-sm btn-more col-md-12 col-sm-12 col-xs-12"><i class="fa fa-hand-pointer-o"></i> en savoir +</div>';
popupContent += '</a>';
......
......@@ -616,10 +616,6 @@ function bindAboutPodElement() {
// $("textarea#description").val( mentionsInit.addMentionInText( $("textarea#description"), contextData.descMentions ) ) ;
}
},
// formatData : function(formData){
// if($("textarea#description").val() )
// return mentionsInit.beforeSave(formData, 'textarea#description');
// },
afterSave : function(data){
mylog.dir(data);
if(data.result&& data.resultGoods && data.resultGoods.result){
......
dynForm = {
jsonSchema : {
title : trad.addorganization,
icon : "group",
type : "object",
onLoads : {
//pour creer un subevnt depuis un event existant
onload : function(){
//dyFInputs.setHeader("bg-green");
jsonSchema : {
title : trad.addorganization,
icon : "group",
type : "object",
onLoads : {
//pour creer un subevnt depuis un event existant
onload : function(){
//dyFInputs.setHeader("bg-green");
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{
//alert("dyn on load" );
$("#ajax-modal .modal-header").addClass("bg-green");
$("#ajax-modal .infocustom p").addClass("text-green");
}
},
sub : function(){
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{
//alert("dyn on load" );
$("#ajax-modal .modal-header").addClass("bg-green");
$("#ajax-modal .infocustom p").addClass("text-green");
}
},
sub : function(){
if(typeof currentKFormType == "undefined" || currentKFormType == "" ||
currentKFormType == "null" || currentKFormType == null ){
currentKFormType = "organization";
......@@ -30,86 +30,86 @@ dynForm = {
}
mylog.log("currentKFormType sub", currentKFormType);
//console.log("onLoads Sub currentKFormType", currentKFormType, contextData, contextData.id);
var typeName = (typeof currentKFormType != "undefined" && currentKFormType!=null) ? trad["add"+currentKFormType] : elementObj.dynForm.jsonSchema.title;
var typeIcon = (typeof currentKFormType != "undefined" && currentKFormType!=null) ? typeObj[currentKFormType].icon : elementObj.dynForm.jsonSchema.icon;
$("#ajax-modal-modal-title").html( "<i class='fa fa-"+typeIcon+"'></i> "+typeName );
//console.log("onLoads Sub currentKFormType", currentKFormType, contextData, contextData.id);
var typeName = (typeof currentKFormType != "undefined" && currentKFormType!=null) ? trad["add"+currentKFormType] : elementObj.dynForm.jsonSchema.title;
var typeIcon = (typeof currentKFormType != "undefined" && currentKFormType!=null) ? typeObj[currentKFormType].icon : elementObj.dynForm.jsonSchema.icon;
$("#ajax-modal-modal-title").html( "<i class='fa fa-"+typeIcon+"'></i> "+typeName );
$("#ajax-modal .modal-header").removeClass("bg-dark bg-red bg-purple bg-green bg-green-poi bg-orange bg-turq bg-yellow bg-url bg-azure").addClass("bg-"+typeObj[currentKFormType].color);
$("#ajax-modal .infocustom p").removeClass("text-dark text-red text-purple text-green text-green-poi text-orange text-turq text-yellow text-url text-azure").addClass("text-"+typeObj[currentKFormType].color);
/*if(contextData && contextData.type && contextData.id ){
$('#ajaxFormModal #parentId').val(contextData.id);
$("#ajaxFormModal #parentType").val( contextData.type );
$("#ajax-modal-modal-title").append(
" <br><small class='text-white'>"+tradDynForm.speakingas+" : <span class='text-dark'>"+
contextData.name+
"</span></small>" );
} else if(userConnected) {
/*if(contextData && contextData.type && contextData.id ){
$('#ajaxFormModal #parentId').val(contextData.id);
$("#ajaxFormModal #parentType").val( contextData.type );
$("#ajax-modal-modal-title").append(
" <br><small class='text-white'>"+tradDynForm.speakingas+" : <span class='text-dark'>"+
contextData.name+
"</span></small>" );
} else if(userConnected) {
$('#ajaxFormModal #parentId').val( userId );
$("#ajaxFormModal #parentType").val( "citoyens" );
$("#ajax-modal-modal-title").append(
" <br><small class='text-white'>"+tradDynForm.speakingas+" : <span class='text-dark'>"+
userConnected.name+
"</span></small>" );
" <br><small class='text-white'>"+tradDynForm.speakingas+" : <span class='text-dark'>"+
userConnected.name+
"</span></small>" );
}*/
mylog.log("currentKFormType", currentKFormType);
},
},
beforeBuild : function(){
//alert("before Build orga");
dyFObj.setMongoId('organizations', function(){
uploadObj.gotoUrl = '#page.type.organizations.id.'+uploadObj.id;
});
},
beforeSave : function(){
if (typeof $("#ajaxFormModal #description").code === 'function' )
$("#ajaxFormModal #description").val( $("#ajaxFormModal #description").code() );
},
afterSave : function(data,callB){
if( $(uploadObj.domTarget).fineUploader('getUploads').length > 0 ){
$(uploadObj.domTarget).fineUploader('uploadStoredFiles');
//principalement pour les surveys
if(typeof callB == "function")
callB();
}
else {
if(typeof networkJson != "undefined")
},
},
beforeBuild : function(){
//alert("before Build orga");
dyFObj.setMongoId('organizations', function(){
uploadObj.gotoUrl = '#page.type.organizations.id.'+uploadObj.id;
});
},
beforeSave : function(){
if (typeof $("#ajaxFormModal #description").code === 'function' )
$("#ajaxFormModal #description").val( $("#ajaxFormModal #description").code() );
},
afterSave : function(data,callB){
if( $(uploadObj.domTarget).fineUploader('getUploads').length > 0 ){
$(uploadObj.domTarget).fineUploader('uploadStoredFiles');
//principalement pour les surveys
if(typeof callB == "function")
callB();
}
else {
if(typeof networkJson != "undefined")
isMapEnd = true;
dyFObj.closeForm();
if(typeof updateForm != "undefined" && updateForm != null)//use case for answerList forms updating
window.location.reload();
else
urlCtrl.loadByHash( uploadObj.gotoUrl );
}
},
properties : {
info : {
inputType : "custom",
html:"<p class='text-"+typeObj["organization"].color+"'>"+
//"Faire connaître votre Organisation n'a jamais été aussi simple !<br>" +
tradDynForm["infocreateorganization"]+" ...<hr>" +
window.location.reload();
else
urlCtrl.loadByHash( uploadObj.gotoUrl );
}
},
properties : {
info : {
inputType : "custom",
html:"<p class='text-"+typeObj["organization"].color+"'>"+
//"Faire connaître votre Organisation n'a jamais été aussi simple !<br>" +
tradDynForm["infocreateorganization"]+" ...<hr>" +
"</p>",
},
name : dyFInputs.name("organization"),
similarLink : dyFInputs.similarLink,
type : dyFInputs.inputSelect(tradDynForm["organizationType"], tradDynForm["organizationType"], organizationTypes, { required : true }),
//type : dyFInputs.inputSelect(tradDynForm["organizationType"], tradDynForm["organizationType"], organizationTypes, { required : true }),
role : dyFInputs.inputSelect( tradDynForm["yourrole"],
tradDynForm["whichrole"]+" ?",
{ admin : trad.administrator, member : trad.Member, creator : trad.justCitizen },
{ required : true } ),
tags : dyFInputs.tags(),
location : dyFInputs.location,
image : dyFInputs.image(),
email : dyFInputs.text(),
shortDescription : dyFInputs.textarea(tradDynForm["shortDescription"], "...",{ maxlength: 140 }),
url : dyFInputs.inputUrl(),
"preferences[publicFields]" : dyFInputs.inputHidden([]),
"preferences[privateFields]" : dyFInputs.inputHidden([]),
"preferences[isOpenData]" : dyFInputs.inputHidden(true),
"preferences[isOpenEdition]" : dyFInputs.inputHidden(true),
}
},
name : dyFInputs.name("organization"),
similarLink : dyFInputs.similarLink,
type : dyFInputs.inputSelect(tradDynForm["organizationType"], tradDynForm["organizationType"], organizationTypes, { required : true }),
//type : dyFInputs.inputSelect(tradDynForm["organizationType"], tradDynForm["organizationType"], organizationTypes, { required : true }),
role : dyFInputs.inputSelect( tradDynForm["yourrole"],
tradDynForm["whichrole"]+" ?",
{ admin : trad.administrator, member : trad.Member, creator : trad.justCitizen },
{ required : true } ),
tags : dyFInputs.tags(),
location : dyFInputs.location,
image : dyFInputs.image(),
email : dyFInputs.text(),
shortDescription : dyFInputs.textarea(tradDynForm["shortDescription"], "...",{ maxlength: 140 }),
url : dyFInputs.inputUrl(),
"preferences[publicFields]" : dyFInputs.inputHidden([]),
"preferences[privateFields]" : dyFInputs.inputHidden([]),
"preferences[isOpenData]" : dyFInputs.inputHidden(true),
"preferences[isOpenEdition]" : dyFInputs.inputHidden(true),
}
}
};
\ No newline at end of file
......@@ -10,38 +10,32 @@
*/
var inviteObj = {
rolesListCustom : null,
parentId : null,
parentLinks : null,
rolesListCustom : null,
isElementAdmin : null,
listInvite : {
citoyens : {},
organizations : {},
invites : {},
},
// contactTypes : {
// citoyens : { color: "yellow", icon:"user", label: trad.People },
// organizations : { color: "green", icon:"group", label: trad.Organizations }
// },
init : function (initParams) {
inviteObj.parentType = ( (typeof initParams.parentType != "undefined") ? initParams.parentType : null ) ;
inviteObj.parentId = ( (typeof initParams.parentId != "undefined") ? initParams.parentId : null ) ;
inviteObj.parentLinks = ( (typeof initParams.parentLinks != "undefined") ? initParams.parentLinks : null ) ;
inviteObj.rolesListCustom = ( (typeof initParams.rolesListCustom != "undefined") ? initParams.rolesListCustom : null ) ;
inviteObj.isElementAdmin= ( (typeof initParams.isElementAdmin != "undefined") ? initParams.isElementAdmin : null ) ;
$('#btnInviteNew').click(function(e){
var form = $('#form-invite');
var loginBtn = null;
form.submit(function(e){ e.preventDefault() });
init : function(initParams){
var errorHandler = $('.errorHandler', form);
},
formInvite : function(id, search, callback){
mylog.log("finder formInvite ", id, search, callback);
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if(emailReg.test( $(search).val() )){
$(id+' #inviteEmail').val( $(search).val());
var nameEmail = $(search).val().split("@");
$(id+" #inviteName").val(nameEmail[0]);
}else{
$(id+" #inviteName").val($(search).val());
$(id+" #inviteEmail").val("");
}
form.validate({
$(id+' #btnInviteNew').off().on("click", function(e){
mylog.log("finder btnInviteNew ");
var formInvite = $(id);
var loginBtn = null;
mylog.log("finder form ", formInvite);
//formInvite.submit(function(e){ e.preventDefault() });
var errorHandler = $('.errorHandler', formInvite);
mylog.log("finder errorHandler ", errorHandler);
formInvite.validate({
rules : {
inviteEmail : {
minlength : 2,
......@@ -56,85 +50,169 @@ var inviteObj = {
maxlength : 500,
}
},
submitHandler : function(form) {
submitHandler : function(formInvite) {
mylog.log("finder submitHandler form", formInvite);
errorHandler.hide();
var mail = $('#form-invite #email').val();
var msg = "";
var name = "tetst";
var mail = $(id+' #inviteEmail').val();
var msg = $(id+' #inviteText').val();
var name = $(id+' #inviteName').val();
if(typeof inviteObj.listInvite.invites[mail] == "undefined"){
var keyUnique = inviteObj.keyUniqueByMail(mail);
inviteObj.listInvite.invites[keyUnique] = {
if(typeof listInvite.invites[mail] == "undefined"){
var keyUnique = keyUniqueByMail(mail);
listInvite.invites[keyUniqueByMail(mail)] = {
name : name,
mail : mail,
msg : msg
} ;
/**** Exemple pour les user dejà dans la db *****/
// listInvite.citoyens[id] = {
// name : name,
// profilThumbImageUrl : profilThumbImageUrl
// } ;
// if(parentType != "citoyens")
// listInvite.citoyens[id].isAdmin = "";
if(parentType != "citoyens")
listInvite.invites[keyUnique].isAdmin = "";
inviteObj.multiconnect();
$(id+' #inviteEmail').val("");
$(id+' #inviteText').val("");
$(id+' #inviteName').val("");
$(id+" #form-invite").hide();
} else {
toastr.error(tradDynForm.alreadyInTheList);
}
// showElementInvite(listInvite, true);
// bindRemove();
}
if(typeof callback != "undefined" && callback != null){
callback();
}else{
showElementInvite(listInvite, true);
bindRemove();
}
},
invalidHandler: function(event, validator) {
mylog.log("finder invalidHandler", event, validator)
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'You missed 1 field. It has been highlighted'
: 'You missed ' + errors + ' fields. They have been highlighted';
mylog.log("finder message", message);
$("div.error span").html(message);
$("div.error").show();
} else {
$("div.error").hide();
}
}
});
});
$('#modal-invite #btnValider').click(function(e){
}
};
//// OLD
// var inviteObj = {
// rolesListCustom : null,
// parentId : null,
// parentLinks : null,
// rolesListCustom : null,
// isElementAdmin : null,
// listInvite : {
// citoyens : {},
// organizations : {},
// invites : {},
// },
// init : function (initParams) {
// inviteObj.parentType = ( (typeof initParams.parentType != "undefined") ? initParams.parentType : null ) ;
// inviteObj.parentId = ( (typeof initParams.parentId != "undefined") ? initParams.parentId : null ) ;
// inviteObj.parentLinks = ( (typeof initParams.parentLinks != "undefined") ? initParams.parentLinks : null ) ;
// inviteObj.rolesListCustom = ( (typeof initParams.rolesListCustom != "undefined") ? initParams.rolesListCustom : null ) ;
// inviteObj.isElementAdmin= ( (typeof initParams.isElementAdmin != "undefined") ? initParams.isElementAdmin : null ) ;
// $('#btnInviteNew').click(function(e){
// var form = $('#form-invite');
// var loginBtn = null;
// form.submit(function(e){ e.preventDefault() });
// var errorHandler = $('.errorHandler', form);
// form.validate({
// rules : {
// inviteEmail : {
// minlength : 2,
// required : true,
// email: true
// },
// inviteName : {
// minlength : 2,
// required : true,
// },
// inviteText : {
// maxlength : 500,
// }
// },
// submitHandler : function(form) {
// errorHandler.hide();
// var mail = $('#form-invite #email').val();
// var msg = "";
// var name = "tetst";
// if(typeof inviteObj.listInvite.invites[mail] == "undefined"){
// var keyUnique = inviteObj.keyUniqueByMail(mail);
// inviteObj.listInvite.invites[keyUnique] = {
// name : name,
// mail : mail,
// msg : msg
// } ;
// inviteObj.multiconnect();
// } else {
// toastr.error(tradDynForm.alreadyInTheList);
// }
// }
// });
// });
// $('#modal-invite #btnValider').click(function(e){
});
},
keyUniqueByMail : function(mail) {
mylog.log("keyUniqueByMail", mail);
var keyUnique = "";
for (var i=0; i < mail.length; i++) {
keyUnique += mail.charCodeAt(i);
}
return keyUnique ;
},
multiconnect : function(){
mylog.log("multiconnect", Object.keys(inviteObj.listInvite.organizations).length, Object.keys(inviteObj.listInvite.citoyens).length);
if( Object.keys(inviteObj.listInvite.organizations).length > 0 ||
Object.keys(inviteObj.listInvite.citoyens).length > 0 ||
Object.keys(inviteObj.listInvite.invites).length > 0 ) {
mylog.log("#modal-invite #btnValider");
var params = {
parentId : inviteObj.parentId,
parentType : inviteObj.parentType,
listInvite : inviteObj.listInvite
};
$.ajax({
type: "POST",
url: baseUrl+'/co2/link/multiconnect',
data: params,
dataType: "json",
success: function(data){
mylog.log("link/multiconnect success", data);
var nbInvites = data.length;
var str = "";
if(typeof data.citoyens != "undefined"){
// });
// },
// keyUniqueByMail : function(mail) {
// mylog.log("keyUniqueByMail", mail);
// var keyUnique = "";
// for (var i=0; i < mail.length; i++) {
// keyUnique += mail.charCodeAt(i);
// }
// return keyUnique ;
// },
// multiconnect : function(){
// mylog.log("multiconnect", Object.keys(inviteObj.listInvite.organizations).length, Object.keys(inviteObj.listInvite.citoyens).length);
// if( Object.keys(inviteObj.listInvite.organizations).length > 0 ||
// Object.keys(inviteObj.listInvite.citoyens).length > 0 ||
// Object.keys(inviteObj.listInvite.invites).length > 0 ) {
// mylog.log("#modal-invite #btnValider");
// var params = {
// parentId : inviteObj.parentId,
// parentType : inviteObj.parentType,
// listInvite : inviteObj.listInvite
// };
// $.ajax({
// type: "POST",
// url: baseUrl+'/co2/link/multiconnect',
// data: params,
// dataType: "json",
// success: function(data){
// mylog.log("link/multiconnect success", data);
// var nbInvites = data.length;
// var str = "";
// if(typeof data.citoyens != "undefined"){
}
// }
if(typeof data.invites != "undefined"){
// if(typeof data.invites != "undefined"){
}
toastr.success(trad["processing"]);
}
});
// }
// toastr.success(trad["processing"]);
// }
// });
}
}
}
\ No newline at end of file
// }
// }
// }
\ No newline at end of file
......@@ -21,6 +21,28 @@ $(document).ready(function() {
calendar.init("#profil-content-calendar");
//loadCalendar(events);
$("#outils2").click(function(){
alert("HERE");
uiCoop.startUI();
});
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("href") // activated tab
if(target == "#agenda"){
$(".fc-month-button").trigger("click");
}
});
// $('a[data-toggle="tab"]').click(function(){
// mylog.log("agenda");
// alert("here");
// $(".fc-month-button").trigger("click");
// // setTimeout(200, function(){
// // $(".fc-month-button").trigger("click");
// // });
// });
$('#follows').click(function(){
var id = $(this).data("id");
......@@ -46,8 +68,7 @@ function loadCalendar(typeElt, id) {
$.ajax({
type: "POST",
url: baseUrl+'/co2/element/getdatadetail/type/'+typeElt+
'/id/'+id+'/dataName/events',
url: baseUrl+'/co2/element/getdatadetail/type/'+typeElt+'/id/'+id+'/dataName/events/sub/2',
data: {},
dataType: "json"
}).done(function(data){
......@@ -342,13 +363,16 @@ function feedProject(el, countMembers, countEvents, countProjects){
if( el.map.contacts != null ){
$('.customTabTriggerContacts').show();
$(el.map.contacts).each(function(index){
// $(el.map.contacts).each(function(index){
$.each(el.map.contacts, function (key,value){
//mylog.log("Project : " + this.toSource() );
var htmlContacts = "<div class='col col-xs-6 col-md-3'>" +
"<h4>" + el.map.contacts[index]['name'] + "</h4>" +
"<a href='mailto:"+el.map.contacts[index]['email']+"'>"+el.map.contacts[index]['email']+"</a>" +
"<br><a href='phone:"+el.map.contacts[index]['telephone'][0]+"'>"+el.map.contacts[index]['telephone'][0]+"</a>" +
"</div>";
var htmlContacts = "<div class='col col-xs-6 col-md-3'>";
htmlContacts += "<h4>" + (typeof value['name'] != "undefined" ? value['name'] : "") + "</h4>";
if(typeof value['email'] != "undefined")
htmlContacts += "<a href='mailto:"+value['email']+"'>"+value['email']+"</a>" ;
if(typeof value['telephone'] != "undefined" && typeof value['telephone'][0] != "undefined")
htmlContacts += "<br><a href='phone:"+value['telephone'][0]+"'>"+value['telephone'][0]+"</a>";
htmlContacts += "</div>";
$(htmlContacts).appendTo('#projectContacts .row');
});
......@@ -358,6 +382,9 @@ function feedProject(el, countMembers, countEvents, countProjects){
isContributor();
loadMyStream('projects', id);
loadCalendar('projects', id);
contextData = el.map;
contextData.type = 'projects';
contextData.id = id;
}
......
......@@ -396,12 +396,14 @@
<script type="text/javascript">
urlCtrl.loadByHash = false;
var elt = <?php echo json_encode(@$elt); ?> ;
var type = <?php echo json_encode(@$type); ?> ;
var idElt = <?php echo json_encode(@$idElt); ?> ;
var events = <?php echo json_encode(@$events); ?> ;
var baseUrl = `<?php echo Yii::app()->createUrl("") ?>` ;
var defaultBannerUrl = ` <?php echo Yii::app()->theme->baseUrl. '/assets/img/background-onepage/connexion-lines.jpg';?> `;
//var links = <?php echo json_encode(@$linksElt); ?> ;
</script>
......
......@@ -546,8 +546,6 @@ HtmlHelper::registerCssAndScriptsFiles($cssJs, Yii::app()->getRequest()->getBase
bindRemove();
}
});
});
$('#modal-invite #btnValider').click(function(e){
......
......@@ -416,7 +416,16 @@ $this->renderPartial( $layoutPath.'modals.'.Yii::app()->params["CO2DomainName"].
if( $type == Organization::COLLECTION || $type == Project::COLLECTION ){ ?>
<button type="button" class="btn btn-default bold hidden-xs letter-turq" data-toggle="modal" data-target="#modalCoop"
id="open-co-space" style="border-right:0px!important;">
<i class="fa fa-connectdevelop"></i> <?php echo Yii::t("cooperation", "CO-space"); ?>
<?php
$name = Yii::t("cooperation", "CO-space");
if(@Yii::app()->session['costum']["modules"]["dda"]["name"])
$name = Yii::app()->session['costum']["modules"]["dda"]["name"];
$icon = "fa-connectdevelop";
if(@Yii::app()->session['costum']["modules"]["dda"]["icon"])
$icon = Yii::app()->session['costum']["modules"]["dda"]["icon"];
?>
<i class="fa <?php echo $icon; ?>"></i> <?php echo $name; ?>
</button>
<?php } ?>
......
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