Commit 4e1a1e4d authored by Tibor Katelbach's avatar Tibor Katelbach

Merge remote-tracking branch 'origin/development' into development

parents 0e2876a2 0be4952f
......@@ -1809,6 +1809,8 @@ function resetSearchObject(){
searchObject.initType="",
searchObject.types=[],
searchObject.countType=[];
searchObject.text="";
searchObject.tags=[];
}
......
......@@ -674,6 +674,68 @@ function initPageTable(number){
var afterLoad = null;
location.hash="#dda?"+coopType+"."+coopId+"."+parentId+"."+parentType;
uiCoop.prepPreview(coopType,coopId,idParentRoom,parentId,parentType,afterLoad);
if( $(this).data("coop-section") ){
coopSection = $(this).data("coop-section");
if(coopSection == "amendments" ){
afterLoad = function() {
uiCoop.showAmendement(true);
if($("#form-amendement").hasClass("hidden"))
$("#form-amendement").removeClass("hidden");
else
$("#form-amendement").addClass("hidden");
};
} else if(coopSection == "vote" ){
mylog.log(".openCoopPanelHtml vote");
afterLoad = function() {
setTimeout(function(){
$("#coop-container").animate({
scrollTop: $("#podVote").offset().top
}, 1000);
}, 1000);
};
}
else if(coopSection == "comments" ){
afterLoad = function() {
setTimeout(function(){
$("#coop-container").animate({
scrollTop: $(".btn-select-arg-comment").offset().top
}, 1000);
}, 1000);
};
}
}
coopType = coopType == "actions" ? "action" : coopType;
coopType = coopType == "proposals" ? "proposal" : coopType;
coopType = coopType == "resolutions" ? "resolution" : coopType;
console.log("onclick coopPanelHtml", coopType, coopId, idParentRoom, parentId, parentType);
if(notNull(contextData) && contextData.id == parentId && contextData.type == parentType && typeof isOnepage == "undefined" && idParentRoom != ""){
toastr.info(trad["processing"]);
uiCoop.startUI();
$("#modalCoop").modal("show");
onchangeClick=false;
if(coopType == "rooms"){
uiCoop.getCoopData(contextData.type, contextData.id, "room", null, coopId);
}else{
setTimeout(function(){
uiCoop.getCoopData(contextData.type, contextData.id, "room", null, idParentRoom,
function(){
toastr.info(trad["processing"]);
uiCoop.getCoopData(contextData.type, contextData.id, coopType, null, coopId);
}, false);
}, 1000);
}
}else{
if(coopType == "rooms"){
var hash = "#page.type." + parentType + ".id." + parentId +
".view.coop.room." + idParentRoom + "."+coopType+"." + coopId;
urlCtrl.loadByHash(hash);
}else{
uiCoop.getCoopDataPreview(coopType, coopId, afterLoad);
}
}
});
......@@ -2540,11 +2602,12 @@ var directory = {
str += '<small class="text-'+statusColor+'"><i class="fa fa-certificate"></i> '+trad[params.status]+'</small>';
// YOUR VOTE STATUS
if((params.status == "tovote" || params.status == "amendementAndVote") && params.hasVote ===false)
str += '<small class="margin-left-15 letter-red"><i class="fa fa-ban"></i> '+trad["You did not vote"]+'</small>';
else if((params.status == "tovote" || params.status == "amendementAndVote") && params.hasVote !==false)
str += '<small class="margin-left-15"><i class="fa fa-thumbs-up"></i> '+trad["You did vote"]+'</small>';
if(typeof userId != "undefined" && userId != null && userId != ""){
if((params.status == "tovote" || params.status == "amendementAndVote") && params.hasVote ===false)
str += '<small class="margin-left-15 letter-red"><i class="fa fa-ban"></i> '+trad["You did not vote"]+'</small>';
else if((params.status == "tovote" || params.status == "amendementAndVote") && params.hasVote !==false)
str += '<small class="margin-left-15"><i class="fa fa-thumbs-up"></i> '+trad["You did vote"]+'</small>';
}
// if(params.chat)
// str += '<a href="javascript:" '+linkParams+' data-coop-section="comments" class="openCoopPanelHtml btn btn-xs btn-default tooltips pull-right text-dark" data-toggle="tooltip" data-placement="top" data-original-title="'+tradDynForm.chat+'"><i class="fa fa-comments" ></i></a> ';
// if(params.invite)
......@@ -2568,15 +2631,18 @@ var directory = {
}
//SHOW HIDE VOTE BTNs
var btnSize = (params.status == "amendementAndVote") ? "6" : "12";
if( (params.status == "tovote" || params.status == "amendementAndVote") && params.hasVote ===false )
str += '<a href="javascript:" '+ linkParams + ' class="btn-openVoteDetail bg-green btn col-sm-'+btnSize+' "><i class="fa fa-gavel"></i> '+trad.Vote+'</a>';
else if( (params.status == "tovote" || params.status == "amendementAndVote") && params.hasVote !==false )
str += '<a href="javascript:;" '+ linkParams + ' data-coop-section="vote" class="openCoopPanelHtml btn btn-default col-sm-'+btnSize+' "><i class="fa fa-eye"></i> '+trad["See votes"]+'</a>';
if( params.status == "amendementAndVote" || params.status =="amendable" ){
amendCount = (params.amendements) ? " ("+Object.keys(params.amendements).length+")": "";
str += '<a href="javascript:;" '+ linkParams + ' data-coop-section="amendments" class="openCoopPanelHtml btn btn-default text-purple col-sm-6 "><i class="fa fa-list"></i> '+trad.Amendements+amendCount+'</a>';
if(typeof userId != "undefined" && userId != null && userId != ""){
var btnSize = (params.status == "amendementAndVote") ? "6" : "12";
if( (params.status == "tovote" || params.status == "amendementAndVote") && params.hasVote ===false )
str += '<a href="javascript:" '+ linkParams + ' class="btn-openVoteDetail bg-green btn col-sm-'+btnSize+' "><i class="fa fa-gavel"></i> '+trad.Vote+'</a>';
else if( (params.status == "tovote" || params.status == "amendementAndVote") && params.hasVote !==false )
str += '<a href="javascript:;" '+ linkParams + ' data-coop-section="vote" class="openCoopPanelHtml btn btn-default col-sm-'+btnSize+' "><i class="fa fa-eye"></i> '+trad["See votes"]+'</a>';
if( params.status == "amendementAndVote" || params.status =="amendable" ){
amendCount = (params.amendements) ? " ("+Object.keys(params.amendements).length+")": "";
str += '<a href="javascript:;" '+ linkParams + ' data-coop-section="amendments" class="openCoopPanelHtml btn btn-default text-purple col-sm-6 "><i class="fa fa-list"></i> '+trad.Amendements+amendCount+'</a>';
}
}
str += '</div>';
......@@ -2877,10 +2943,10 @@ var directory = {
},
endOfResult : function(noResult){
str="";
//Event scroll and all searching
$("#btnShowMoreResult").remove();
scrollEnd=true;
if(!notNull(directory.custom)){
//Event scroll and all searching
$("#btnShowMoreResult").remove();
scrollEnd=true;
//msg specific for end search
match= (searchObject.text != "") ? "match" : "";
msg= (notNull(noResult) && noResult) ? trad["noresult"+match] : trad["nomoreresult"+match];
......@@ -2905,6 +2971,13 @@ var directory = {
str = '<div class="pull-left col-md-12 text-left" id="footerDropdown" style="width:100%;">';
str += "<h5 style='margin-bottom:10px; margin-left:15px;border-left: 2px solid lightgray;' class='text-dark padding-20'>"+msg+"<br/>"+contributeMsg+"</h5><br/>";
str += "</div>";
}else{
$("#btnShowMoreResult").remove();
match= (searchObject.text != "") ? "match" : "";
msg= (notNull(noResult) && noResult) ? trad["noresult"+match] : trad["nomoreresult"+match];
str = '<div class="pull-left col-xs-12 col-sm-8 col-sm-offset-2 col-md-offset-3 col-md-6 text-center shadow2" id="footerDropdown" style="border-radius: 50px;">';
str += "<h5 class='letter-blue padding-10'><i class='fa fa-ban'></i> "+msg+"</h5>";
str += "</div>";
}
return str;
},
......@@ -3303,10 +3376,20 @@ var directory = {
params.imgProfil = "<i class='fa fa-image fa-2x'></i>";
params.imgMediumProfil = "<i class='fa fa-image fa-2x'></i>";
}
if("undefined" != typeof directory.custom
// <<<<<<< HEAD
// mylog.log("DIrectory ", directory.custom);
// if( directory.custom != null &&
// typeof directory.custom != "undefined" &&
// typeof directory.custom.results != "undefined" &&
// typeof directory.custom.results[params.type] != "undefined" &&
// typeof directory.custom.results[params.type].defaultImg != "undefined")
// =======
if("undefined" != typeof directory.custom && notNull(directory.custom)
&& typeof directory.custom.results != "undefined"
&& typeof directory.custom.results[params.type] != "undefined"
&& typeof directory.custom.results[params.type].defaultImg != "undefined")
params.imgMediumProfil= "<img class='img-responsive' onload='directory.checkImage(this);' src='"+parentModuleUrl+directory.custom.results[params.type].defaultImg+"'/>";
if("undefined" != typeof params.profilMediumImageUrl && params.profilMediumImageUrl != "")
......
......@@ -33,37 +33,37 @@ var totalDataGS = 0;
var mapElementsGS = new Array();
function startGlobalSearch(indexMin, indexMax, input){
mylog.log("startGlobalSearch", indexMin, indexMax, input);
setTimeout(function(){ loadingDataGS = false; }, 10000);
if(notNull(input))
var search = $(input+" .input-global-search").val();
else
var search = $('#second-search-bar').val();
//if(search == "") search = $('#input-global-search-xs').val();
if(loadingDataGS || search.length<3) return;
spinSearchAddon(true);
mylog.log("loadingDataGS true");
loadingDataGS = true;
if(typeof indexMin == "undefined") indexMin = 0;
if(typeof indexMax == "undefined") indexMax = indexStepGS;
currentIndexMinGS = indexMin;
currentIndexMaxGS = indexMax;
if(indexMin == 0) {
totalDataGS = 0;
mapElementsGS = new Array();
}
else{ mylog.log("scrollEndGS ? ", scrollEndGS); if(scrollEndGS) return; }
autoCompleteSearchGS(search, indexMin, indexMax, input);
mylog.log("startGlobalSearch", indexMin, indexMax, input);
setTimeout(function(){ loadingDataGS = false; }, 10000);
if(notNull(input))
var search = $(input+" .input-global-search").val();
else
var search = $('#second-search-bar').val();
//if(search == "") search = $('#input-global-search-xs').val();
if(loadingDataGS || search.length<3) return;
spinSearchAddon(true);
mylog.log("loadingDataGS true");
loadingDataGS = true;
if(typeof indexMin == "undefined") indexMin = 0;
if(typeof indexMax == "undefined") indexMax = indexStepGS;
currentIndexMinGS = indexMin;
currentIndexMaxGS = indexMax;
if(indexMin == 0) {
totalDataGS = 0;
mapElementsGS = new Array();
}
else{ mylog.log("scrollEndGS ? ", scrollEndGS); if(scrollEndGS) return; }
autoCompleteSearchGS(search, indexMin, indexMax, input);
}
function spinSearchAddon(bool){
removeClass= (bool) ? "fa-arrow-circle-right" : "fa-spin fa-circle-o-notch";
addClass= (bool) ? "fa-spin fa-circle-o-notch" : "fa-arrow-circle-right";
$(".main-search-bar-addon, .second-search-bar-addon").find("i").removeClass(removeClass).addClass(addClass);
removeClass= (bool) ? "fa-arrow-circle-right" : "fa-spin fa-circle-o-notch";
addClass= (bool) ? "fa-spin fa-circle-o-notch" : "fa-arrow-circle-right";
$(".main-search-bar-addon, .second-search-bar-addon").find("i").removeClass(removeClass).addClass(addClass);
}
......@@ -135,10 +135,10 @@ function autoCompleteSearchGS(search, indexMin, indexMax, input){
if(totalDataGS > 0){
labelSearch=(Object.keys(data.results).length == totalDataGS) ? trad.extendedsearch : "Voir tous les résultats";
str += '<div class="text-left col-xs-12" id="footerDropdownGS" style="">';
str += "<label class='text-dark margin-top-5'><i class='fa fa-angle-down'></i> " + totalDataGSMSG + "</label>";
str += '<a href="#search" class="btn btn-default btn-sm pull-right lbh" id="btnShowMoreResultGS">'+
'<i class="fa fa-angle-right"></i> <i class="fa fa-search"></i> '+labelSearch+
'</a>';
str += "<label class='text-dark margin-top-5'><i class='fa fa-angle-down'></i> " + totalDataGSMSG + "</label>";
str += '<a href="#search" class="btn btn-default btn-sm pull-right lbh" id="btnShowMoreResultGS">'+
'<i class="fa fa-angle-right"></i> <i class="fa fa-search"></i> '+labelSearch+
'</a>';
str += '</div>';
str += "<hr style='margin: 0px; float:left; width:100%;'/>";
}
......@@ -372,125 +372,8 @@ function autoCompleteSearchGS(search, indexMin, indexMax, input){
o.key = valuesScopes.key;
str += directory.zonePanelHtml(o);
}
// var valuesScopes = {};
// if(type == "city"){
// valuesScopes = {
// city : o._id.$id,
// cityName : o.name,
// cp : o.postalCode,
// country : o.country,
// allCP : o.allCP,
// level1 : o.level1,
// level1Name : o.level1Name
// }
// typeSearchCity="city";
// levelSearchCity="city";
// }else{
// valuesScopes = {
// id : o._id.$id,
// name : o.name,
// country : o.countryCode,
// level : o.level
// }
// if(o.level.indexOf("1") >= 0){
// typeSearchCity="level1";
// levelSearchCity="1";
// valuesScopes.numLevel = 1;
// }else if(o.level.indexOf("2") >= 0){
// typeSearchCity="level2";
// levelSearchCity="2";
// valuesScopes.numLevel = 2;
// }else if(o.level.indexOf("3") >= 0){
// typeSearchCity="level3";
// levelSearchCity="3";
// valuesScopes.numLevel = 3;
// }else if(o.level.indexOf("4") >= 0){
// typeSearchCity="level4";
// levelSearchCity="4";
// valuesScopes.numLevel = 4;
// }
// if(notNull(typeSearchCity))
// valuesScopes.type = typeSearchCity;
// mylog.log("valuesScopes test", (valuesScopes.id != o.level1), valuesScopes.id, o.level1);
// if( notEmpty( o.level1 ) && valuesScopes.id != o.level1){
// mylog.log("valuesScopes test", (valuesScopes.id != o.level1), valuesScopes.id, o.level1);
// valuesScopes.level1 = o.level1 ;
// valuesScopes.level1Name = o.level1Name ;
// }
// }
// if( notEmpty( o.cityName ) ){
// valuesScopes.name = o.cityName ;
// }
// if( notEmpty( o.level4 ) && valuesScopes.id != o.level4){
// valuesScopes.level4 = o.level4 ;
// valuesScopes.level4Name = o.level4Name ;
// }
// if( notEmpty( o.level3 ) && valuesScopes.id != o.level3 ){
// valuesScopes.level3 = o.level3 ;
// valuesScopes.level3Name = o.level3Name ;
// }
// if( notEmpty( o.level2 ) && valuesScopes.id != o.level2){
// valuesScopes.level2 = o.level2 ;
// valuesScopes.level2Name = o.level2Name ;
// }
// var domContainer=(notNull(input)) ? input+" .scopes-container" : "";
// mylog.log("valuesScopes", valuesScopes);
// str += "<a href='javascript:' class='col-md-12 col-sm-12 col-xs-12 no-padding communecterSearch item-globalscope-checker searchEntity' ";
// str += "data-scope-value='" + o._id.$id + "' " +
// "data-scope-name='" + o.name + "' " +
// "data-scope-level='"+levelSearchCity+"' " +
// "data-scope-type='"+typeSearchCity+"' " +
// "data-scope-values='"+JSON.stringify(valuesScopes)+"' " +
// "data-scope-notsearch='"+true+"' "+
// "data-append-container='"+domContainer+"' ";
// str += ">";
// if(type == "city"){
// str += "<div class='col-md-12 col-sm-12 col-xs-12 entityRight'>";
// str += "<div class='entityName text-dark'>" + name ;
// mylog.log("hereeee ", notNull(o.postalCode), o.postalCode, o );
// if(notNull(o.postalCode))
// str += " - "+ o.postalCode;
// str +="</div>";
// str += '<div data-id="' + dataId + '"' + " class='entityLocality'>"+
// '<span class="col-xs-1">'+
// "<i class='fa fa-home'></i></span>" + o.country;
// str += '</div>';
// str += "</div>";
// }else{
// str += "<div class='col-xs-12 entityRight'>";
// str += "<div class='entityName text-dark'>" + name + "</div>";
// str += '<div data-id="' + dataId + '"' + " class='entityLocality'>"+
// '<span class="col-xs-1">'+
// "<i class='fa fa-bullseye fa-stack-1x bold text-red'></i>"+
// "<i class='fa fa-stack-1x bold' style='left : 5px; bottom : -13px; font-size: 15px; color : #000000'>"+
// levelSearchCity+"</i>"+
// '</span>' + o.countryCode;
// '<span></span>'
// str += '</div>';
// str += "</div>";
// }
// str += "</a>";
}
}); //end each
}
}); //end each
//ajout du footer
/*str+="<div class='text-center col-md-12 col-sm-12 col-xs-12 padding-10'>"+
......
......@@ -23,12 +23,13 @@ dynForm = {
" : <i class='text-white'>#"+currentRoomName+"</i>"+
"</small>" );
}
$("#ajaxFormModal .publiccheckboxSimple").remove();
$("#ajaxFormModal .infoScopecustom").remove();
$("#ajaxFormModal .locationlocation").remove();
$("#ajaxFormModal .shortDescription").remove();
}else{
} else {
pid = (contextData && contextData.id) ? contextData.id : userId;
ptype = (contextData && contextData.type) ? contextData.type : "citoyens";
mylog.log("init input hidden parentdata : ", pid, ptype, "");
......@@ -40,7 +41,7 @@ dynForm = {
$("#ajax-modal #ajaxFormModal .titletext label").html("<i class='fa fa-chevron-down'></i> "+tradDynForm.surveyname);
$("#ajax-modal #ajaxFormModal .titletext input#title").attr("placeholder", tradDynForm.surveyname);
$("#ajaxFormModal .locationBtn").html("<i class='fa fa-home'></i> Sélectionner une commune");
$("#ajaxFormModal .publiccheckboxSimple").hide();
}
......@@ -258,6 +259,7 @@ dynForm = {
$(".voteAnonymouscheckboxSimple").hide();
$(".voteCanChangecheckboxSimple").hide();
$(".producerfinder").hide();
$(".scopescope").hide();
},
adminOnly : function() {
......@@ -392,32 +394,18 @@ dynForm = {
"labelInformation": "<i class='fa fa-info-circle'></i> " + tradDynForm.allowChangeVote
}),
// infoScope : {
// inputType : "custom",
// html:"<br><i class='fa fa-angle-down fa-2x letter-red'></i><br>"+
// "<span style='font-size:13px;' class='bg-red badge'><i class='fa fa-bullseye'></i> "+
// tradDynForm.selectcitytosharesurvey+
// "</span>",
// },
// formLocality : dyFInputs.formLocality(tradDynForm.addLocality, tradDynForm.addLocality),
// location : dyFInputs.location,
infoScope : {
inputType : "custom",
html:"<br><i class='fa fa-angle-down fa-2x letter-red'></i><br>"+
"<span style='font-size:13px;' class='bg-red badge'><i class='fa fa-bullseye'></i> "+
tradDynForm.selectcitytosharesurvey+
"</span>",
},
location : {
label : tradDynForm["Scoping"],
inputType : "location"
},
//scope : dyFInputs.scope,
scope : dyFInputs.scope,
tags : dyFInputs.tags(),
urls : dyFInputs.urls,
status: dyFInputs.inputHidden( "amendable" ),
public : dyFInputs.checkboxSimple("true", "public", {
"onText" : trad.yes,
"offText": trad.no,
"onLabel" : tradDynForm.public,
"offLabel": tradDynForm.private,
"labelText": tradDynForm.makeprojectvisible+" ?",
"labelInformation": tradDynForm.explainvisibleproject
}),
parentId : dyFInputs.inputHidden(),
parentType : dyFInputs.inputHidden(),
}
......
......@@ -801,15 +801,17 @@ function toggleFilters(what){
getCommunexionLabel();
//countFavoriteScope();
}
function bindSearchOnNews(){
$("#searchOnCityNews").off().on("keyup", function(e){
e.preventDefault();
if(e.keyCode == 13){
searchTypeGS = ["cities"];
startGlobalSearch(0, 30, "#scopes-news-form");
}
});
$("#searchOnCityNews").off().on("keyup", function(e){
e.preventDefault();
if(e.keyCode == 13){
searchTypeGS = ["cities"];
startGlobalSearch(0, 30, "#scopes-news-form");
}
});
}
function bindScopesNewsEvent(news){
mylog.log("bindScopesNewsEvent", news);
......
......@@ -77,6 +77,8 @@ class CommunecterController extends Controller
"index" => array("href" => "/ph/co2/admin"),
"accueil" => array("href" => "/ph/co2/accueil"),
"directory" => array("href" => "/ph/co2/admin/directory"),
"reference" => array("href" => "/ph/co2/admin/reference"),
"setsource" => array("href" => "/ph/co2/admin/setsource"),
"switchto" => array("href" => "/ph/co2/admin/switchto"),
"delete" => array("href" => "/ph/co2/admin/delete"),
"activateuser" => array("href" => "/ph/co2/admin/activateuser"),
......
......@@ -317,7 +317,7 @@
"#admin": {
"inMenu" : false,
"useHeader" : false,
"useHeader" : true,
"useFilter" : false,
"open" : false,
"subdomain" : "admin",
......@@ -452,6 +452,77 @@
}
}
},
"adminPanel": {
"directory" :{
"label":"Directory",
"super":true,
"class":"text-yellow",
"id":"btn-directory",
"href":"javascript:;",
"icon":"user"
},
"reference":{
"label":"Reference",
"sourceKey":true,
"init":["organizations", "events", "projects"],
"class":"text-azure",
"id":"btn-reference",
"href":"javascript:;",
"icon":"creative-commons"
},
"converter":{
"label":"Converter",
"class":"text-green",
"id": "btn-importdata",
"href":"javascript:;",
"icon":"upload"
},
"import":{
"label":"IMPORT DATA",
"class":"letter-blue",
"id": "btn-adddata",
"href":"javascript:;",
"icon":"plus"
},
"mails":{
"label":"Mails simulator",
"super":true,
"class": "text-purple",
"id":"btn-mailslist",
"href":"javascript:;",
"icon":"at"
},
"log":{
"label":"LOG",
"super":true,
"class":"text-dark",
"id": "btn-log",
"href":"javascript:;",
"icon":"list"
},
"moderation":{
"label":"MODERATION",
"class":"text-red",
"id":"btn-moderate",
"href":"javascript:;",
"icon":"check"
},
"statistic":{
"label":"Statitics",
"class":"text-orange",
"id":"btn-statistic",
"href":"javascript:;",
"icon":"bar-chart"
},
"mailerror" :{
"label":"Mail error",
"super":true,
"class":"text-yellow",
"id":"btn-mailerror",
"href":"javascript:;",
"icon":"envelope"
}
},
"element":{
"initView": "",
"menuLeft":{
......
......@@ -17,6 +17,8 @@ class AdminController extends CommunecterController {
public function actions(){
return array(
'directory' => 'citizenToolKit.controllers.admin.DirectoryAction',
'reference' => 'citizenToolKit.controllers.admin.ReferenceAction',
'setsource' => 'citizenToolKit.controllers.admin.SetSourceAction',
'circuits' => 'citizenToolKit.controllers.admin.CircuitsAction',
'mailerrordashboard' => 'citizenToolKit.controllers.admin.MailErrorDashboardAction',
'switchto' => 'citizenToolKit.controllers.admin.SwitchtoAction',
......
......@@ -5448,6 +5448,36 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
echo "Number of user with preferences modified : ".$nbUser;
}
}
public function actionPublicProposal() {
if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
$nbUser = 0;
$elts = PHDB::find( Proposal::COLLECTION,
array( "modifiedByBatch.PublicProposal" => array('$exists' => 0),