Commit 53edd7d7 authored by Raph El's avatar Raph El
Browse files

Merge branch 'development' of https://gitlab.adullact.net/pixelhumain/co2 into development

parents 3876a69e 8344c388
......@@ -927,16 +927,14 @@ var urlCtrl = {
}
// console.log(">>>>>>>>>>>>>>>>>>> mod",mod,"> path : ",path,"> urlExtra : ",urlExtra,"> extraParams : ",extraParams);
showAjaxPanel( baseUrl+'/'+ mod +path+urlExtra+extraParams, endPoint.title,endPoint.icon, res,endPoint );
if(path == "dda" && extraParams != "" ){
urlCtrl.afterLoad = function() {
extraParams = extraParams.substring(1);
extraParamsT = extraParams.split(".");
typeProp= (extraParamsT[0]=="proposals") ? "proposal": extraParamsT[0];
uiCoop.getCoopDataPreview(typeProp,extraParamsT[1]/*, function(){
onchangeClick=false;
location.hash="#dda?"+typeProp+"."+extraParamsT[1];
}*/);
uiCoop.getCoopDataPreview(typeProp,extraParamsT[1]);
//uiCoop.prepPreview(extraParamsT[0],extraParamsT[1],null,extraParamsT[2],extraParamsT[3],null);
}
}
......
......@@ -108,6 +108,8 @@ class CommunecterController extends Controller
"cities" => array("href" => "/ph/co2/admin/cities"),
"circuits" => array("href" => "/ph/co2/admin/circuits"),
"mailslist" => array("href" => "ph/co2/admin/mailslist"),
"notsendmail" => array("href" => "/ph/co2/admin/notsendmail"),
"addnotsendmail" => array("href" => "/ph/co2/admin/addnotsendmail"),
),
"docs" => array(
"index" => array("href" => "/ph/co2/docs"),
......@@ -536,6 +538,9 @@ class CommunecterController extends Controller
"droppedmail" => array("href" => "/co2/mailmanagement/droppedmail"),
"updatetopending" => array("href" => "/co2/mailmanagement/updatetopending"),
"createandsend" => array("href" => "/co2/mailmanagement/createandsend"),
"removedata" => array("href" => "/co2/mailmanagement/removedata"),
"askdata" => array("href" => "/co2/mailmanagement/askdata"),
"getdata" => array("href" => "/co2/mailmanagement/getdata"),
),
"element"=> array(
"updatesettings" => array('href' => "/ph/co2/element/updatesettings"),
......@@ -570,6 +575,9 @@ class CommunecterController extends Controller
'getnetworks' => array("href" => "/ph/co2/element/getnetworks"),
"invoice" => array("href" => "/ph/co2/element/invoice"),
"invite" => array("href" => "/ph/co2/element/invite"),
"askdata" => array("href" => "/co2/element/askdata"),
"deletedata" => array("href" => "/co2/element/deletedata"),
"remove" => array("href" => "/co2/element/remove"),
),
"app" => array(
"welcome" => array('href' => "/ph/co2/app/welcome", "public" => true),
......
......@@ -109,8 +109,8 @@
"hash" : "#app.web",
"icon" : "globe",
"mainTitle" : "Moteur de recherche",
"placeholderMainSearch" : "Que recherchez-vous ?"},
"placeholderMainSearch" : "Que recherchez-vous ?"
},
"#referencement":
{ "inMenu" : false,
"useHeader" : true,
......@@ -530,6 +530,14 @@
"id":"btn-mailerror",
"href":"javascript:;",
"icon":"envelope"
},
"notsendmail" :{
"label":"Not send mail",
"super":true,
"class":"text-red",
"id":"btn-notsendmail",
"href":"javascript:;",
"icon":"envelope"
}
},
"element":{
......
......@@ -47,7 +47,8 @@ class AdminController extends CommunecterController {
'statistics' => 'citizenToolKit.controllers.admin.StatisticsAction',
'createfile' => 'citizenToolKit.controllers.admin.CreateFileAction',
'cities' => 'citizenToolKit.controllers.admin.CitiesAction',
'notsendmail' => 'citizenToolKit.controllers.admin.NotSendMailAction',
'addnotsendmail' => 'citizenToolKit.controllers.admin.AddNotSendMailAction',
);
}
......
......@@ -3801,6 +3801,36 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
}else
echo "Tout le monde t'as vu !! reste bien tranquille";
}
public function actionStatsPacteEmails(){
if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
$listPeopleId=array();
$countTotalVotes=0;
$props=PHDB::find('proposals', array("source.key"=>"pactePourLaTransition"));
foreach($props as $k => $v){
if(@$v["votes"]){
foreach($v["votes"] as $k => $ids){
if(@$v["votes"][$k] && !empty($v["votes"][$k])){
$countTotalVotes=($countTotalVotes+count($v["votes"][$k]));
foreach($ids as $id){
if(!in_array($id, $listPeopleId))
array_push($listPeopleId, $id);
}
}
}
}
}
echo "<span class='pull-left'>nombre de votes :".$countTotalVotes."</span><br/>----------------<br/>";
echo "nombre de personnes votantes:".count($listPeopleId)."<br/>------------------<br/>";
$listPeopleEmail=[];
foreach($listPeopleId as $k => $id){
$citoyen=PHDB::findOne('citoyens',array("_id"=>new MongoId($id)));
if(@$citoyen["email"]){
echo $citoyen["email"].",<br/>";
}
}
}else
echo "Tout le monde t'as vu !! reste bien tranquille";
}
public static function createfolder($folderPath){
if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
echo "/////////////create folder//////////////////////////<br/>";
......
......@@ -191,4 +191,12 @@ class DefaultController extends CommunecterController {
$this->render("sitemap",array("list"=>$list));
}
public function actionRemoveData($type=null){
$this->layout = "//layouts/empty";
$list = PHDB::find( "slugs" , array(), array("name", "slug") );
$this->render("sitemap",array("list"=>$list));
}
}
\ No newline at end of file
......@@ -45,6 +45,10 @@ class ElementController extends CommunecterController {
'invoice' => 'citizenToolKit.controllers.element.InvoiceAction',
'invite' => 'citizenToolKit.controllers.element.InviteAction',
'list' => 'citizenToolKit.controllers.element.ListAction',
'askdata' => 'citizenToolKit.controllers.element.AskDataAction',
'remove' => 'citizenToolKit.controllers.element.RemoveAction',
'deletedata' => 'citizenToolKit.controllers.element.DeleteDataAction'
);
}
}
\ No newline at end of file
......@@ -20,12 +20,17 @@ class MailmanagementController extends CommunecterController {
return parent::beforeAction($action);
}
public function actions()
{
return array(
'updatetopending' => 'citizenToolKit.controllers.mailmanagement.UpdateToPendingAction',
'droppedmail' => 'citizenToolKit.controllers.mailmanagement.DroppedMailAction',
'createandsend' => 'citizenToolKit.controllers.mailmanagement.CreateAndSendAction'
'createandsend' => 'citizenToolKit.controllers.mailmanagement.CreateAndSendAction',
'removedata' => 'citizenToolKit.controllers.mailmanagement.RemoveDataAction',
'askdata' => 'citizenToolKit.controllers.mailmanagement.AskDataAction',
'getdata' => 'citizenToolKit.controllers.mailmanagement.GetDataAction'
);
}
}
\ No newline at end of file
......@@ -67,13 +67,14 @@ $this->renderPartial( $layoutPath.'modals.'.Yii::app()->params["CO2DomainName"].
<script type="text/javascript">
var contextData = {id : "<?php echo $id ?>", type : "<?php echo $type ?>", connectTo : "<?php echo $connectTo ?>"};
var data =<?php echo json_encode($results); ?>;
var community =<?php echo json_encode($results); ?>;
jQuery(document).ready(function() {
bindLBHLinks();
//bindAnwserList();
if(typeof data != "undefined"){
initViewTableCommunity(data);
//var rolesList=
if(typeof community != "undefined"){
initViewTableCommunity(community);
}
$(".disconnectConnection").click(function(){
......@@ -248,7 +249,7 @@ $this->renderPartial( $layoutPath.'modals.'.Yii::app()->params["CO2DomainName"].
mylog.log("updateRoles", id, type, name);
//if( typeof form.links.members[id] != "undefined" ){
// var roles = ( ( typeof form.links.members[id].roles != "undefined" ) ? form.links.members[id].roles : [] ) ;
var roles = ( ( typeof community[id].roles != "undefined" ) ? community[id].roles : [] ) ;
updateRoles(id, type, name, "members", roles);
//}
......@@ -256,7 +257,7 @@ $this->renderPartial( $layoutPath.'modals.'.Yii::app()->params["CO2DomainName"].
}
function updateRoles(childId, childType, childName, connectType, roles) {
mylog.log("updateRoles", form.custom.roles);
mylog.log("updateRoles", rolesList);
var formRole = {
saveUrl : baseUrl+"/"+moduleId+"/link/removerole/",
dynForm : {
......@@ -274,7 +275,7 @@ $this->renderPartial( $layoutPath.'modals.'.Yii::app()->params["CO2DomainName"].
mylog.log("afterSave",data);
dyFObj.closeForm();
//loadDataDirectory(connectType, "user", true);
form.links.members[data.memberid].roles = data.roles ;
community[data.memberid].roles = data.roles ;
var str = "";
if( typeof data.roles != "undefined") {
$.each(data.roles, function(kR, vR){
......@@ -288,7 +289,7 @@ $this->renderPartial( $layoutPath.'modals.'.Yii::app()->params["CO2DomainName"].
properties : {
contextId : dyFInputs.inputHidden(),
contextType : dyFInputs.inputHidden(),
roles : dyFInputs.tags(form.custom.roles, tradDynForm["addroles"] , tradDynForm["addroles"], 0),
roles : dyFInputs.tags(rolesList, tradDynForm["addroles"] , tradDynForm["addroles"], 0),
childId : dyFInputs.inputHidden(),
childType : dyFInputs.inputHidden(),
connectType : dyFInputs.inputHidden()
......
......@@ -221,6 +221,8 @@
loadAdddata();
else if(sub=="mailslist")
loadMailslist();
else if(sub=="notsendmail")
loadNotsendmail();
else if(sub=="community")
loadCustomCommunity();
......@@ -272,6 +274,11 @@
loadMailerror();
});
$("#btn-notsendmail").click(function(){
location.hash=hashUrlPage+".view.notsendmail";
loadNotsendmail();
});
$("#btn-mailslist").click(function(){
location.hash=hashUrlPage+".view.mailslist";
loadMailslist();
......@@ -361,6 +368,15 @@
}
function loadNotsendmail(){
initDashboard();
var url = "admin/notsendmail";
//showLoader('.content-view-dashboard');
$("#goBackToHome").show(700);
ajaxPost('#content-view-admin', baseUrl+'/'+moduleId+'/'+url, null, function(){},"html");
}
function loadMailslist(){
initDashboard();
var url = "adminpublic/mailslist";
......
<div class="col-xs-12" id="divRemove" style="margin-top: 10px">
<legend><?php echo Yii::t("common","Not send mails"); ?> :</legend>
<div class="col-xs-12 padding-10">
<label for="email"><?php echo Yii::t("common","Your mail"); ?> : </label> <input type="text" name="email" id="email" />
</div>
<div class="col-xs-12">
<button id="btn-valider" class="btn btn-default" ><!-- <i class="fa fa-times"></i> --><?php echo Yii::t("common","Validate"); ?></button>
</div>
<div class="col-xs-12 padding-10">
<div id="success" class="hidden text-green" style="margin-top: 30px;">
<h4><?php echo Yii::t("common","An e-mail has just been sent to you to validate the request"); ?> .</h4>
</div>
<div id="error" class="hidden text-red" style="margin-top: 30px;">
<h4 id="errormsg"></h4>
</div>
</div>
<div class="pageTable col-md-12 col-sm-12 col-xs-12 padding-20 text-center"></div>
<div class="panel-body">
<div>
<table class="table table-striped table-bordered table-hover directoryTable" id="panelAdmin">
<thead>
<tr>
<th>Email</th>
<th>Date</th>
</tr>
</thead>
<tbody class="directoryLines">
</tbody>
</table>
</div>
</div>
<div class="pageTable col-md-12 col-sm-12 col-xs-12 padding-20"></div>
</div>
<script type="text/javascript">
var results = <?php echo json_encode($results) ?>;
jQuery(document).ready(function() {
setTitle("Not send mail","cog");
initViewTable(results);
$("#btn-valider").off().on( "click", function(){
$("#success").addClass("hidden");
$("#error").addClass("hidden");
var param = {
email : $("#email").val()
} ;
mylog.log("param", param);
$.ajax({
type: "POST",
url: baseUrl+"/"+moduleId+"/admin/addnotsendmail/",
dataType: "json",
data : param,
success: function(data){
if (data.res.result) {
toastr.success(data.res.msg);
location.reload();
} else {
$("#error").removeClass("hidden");
$("#success").addClass("hidden");
toastr.error(data.res.msg);
$("#errormsg").html(data.res.msg);
}
}
});
});
});
function initViewTable(data){
$('#panelAdmin .directoryLines').html("");
$.each(data,function(key,values){
entry=buildDirectoryLine(key, values );
$("#panelAdmin .directoryLines").append(entry);
});
//bindAdminBtnEvents();
}
function buildDirectoryLine(key, e ){
mylog.log("here", e);
strHTML="";
actions = "";
classes = "";
strHTML += '<tr id="'+key+'">';
strHTML += '<td>'+e.target.email+'</td>';
strHTML += '<td class="center status">'+moment(e.date).local().format("DD-MM-YYYY HH:mm");
strHTML += '</td>';
/* **************************************
* ACTIONS
***************************************** */
// if(searchAdmin.mode=="source"){
// action='<button data-id="'+id+'" data-type="'+type+'" data-action="remove" data-setkey="source" class="margin-right-5 setSourceAdmin btn bg-red text-white"><i class="fa fa-ban"></i> Remove from source</button>';
// }else if (searchAdmin.mode=="reference"){
// action='<button data-id="'+id+'" data-type="'+type+'" data-action="remove" data-setkey="reference" class="margin-right-5 setSourceAdmin btn bg-red text-white"><i class="fa fa-ban"></i> Remove from reference</button> ';
// }
// else if (searchAdmin.mode=="open"){
// action='<button data-id="'+id+'" data-type="'+type+'" data-action="add" data-setkey="reference" class="margin-right-5 setSourceAdmin btn bg-green text-white"><i class="fa fa-plus"></i> Add as reference</button>';
// }
// strHTML += '<td class="center">';
// strHTML += '<div class="btn-group">'+action
// '</div>';
// strHTML += '</td>';
strHTML += '</tr>';
return strHTML;
}
\ No newline at end of file
......@@ -67,6 +67,7 @@ $layoutPath = 'webroot.themes.'.Yii::app()->theme->name.'.views.layouts.';
<?php foreach ($typeDirectory as $value) { ?>
<a href="javascript:;" onclick="applyStateFilter('<?php echo $value ?>')" class="filter<?php echo $value ?> btn btn-xs btn-default active btncountsearch"> <?php echo $value ?> <span class="badge badge-warning countPeople" id="count<?php echo $value ?>"> <?php echo @$results["count"][$value] ?></span></a>
<?php } ?>
<a href="<?php echo Yii::app()->request->baseUrl. '/dda/co/getproposals/format/csv'; ?> " target="_blank" id="csv"><i class='fa fa-2x fa-table text-green'></i></a></span>
</div>
<div class="pageTable col-md-12 col-sm-12 col-xs-12 padding-20 text-center"></div>
<div class="panel-body">
......
......@@ -59,8 +59,6 @@ $states = array();
<a href="javascript:;" onclick="showType('line')" class="btn btn-xs btn-default">Tous</a>
<a href="javascript:;" onclick="showType('pending')" class="btn btn-xs btn-default">Pending</a>
<a href="javascript:;" onclick="showType('update')" class="btn btn-xs btn-default">Update</a>
</h5>
<div style="width:80%; display: -webkit-inline-box;">
......
......@@ -241,7 +241,7 @@ function startNewsSearch(isFirst){
var urlCtrl = "/news/co/index/type/city/isLive/true";
if(typeof liveParams != "undefined"){
if(typeof liveParams.slug != "undefined" && notNull(costum))
urlCtrl = "/news/co/index/type/"+costum.type+"/id/"+costum.id;
urlCtrl = "/news/co/index/type/"+costum.contextType+"/id/"+costum.contextId;
if(typeof liveParams.formCreate != "undefined")
urlCtrl += "/formCreate/false";
}
......
......@@ -73,6 +73,7 @@
}
.text-comment{
word-wrap: break-word;
white-space: pre-line;
}
.content-new-comment .mentions{
......
<?php
$cssAnsScriptFiles = array(
'/assets/vendor/jquery_realperson_captcha/jquery.realperson.css',
'/assets/vendor/jquery_realperson_captcha/jquery.plugin.js',
'/assets/vendor/jquery_realperson_captcha/jquery.realperson.min.js'
);
HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFiles, Yii::app()->theme->baseUrl);
$layoutPath = 'webroot.themes.'.Yii::app()->theme->name.'.views.layouts.';
$this->renderPartial($layoutPath.'header',
array( "layoutPath"=>$layoutPath ,
"page" => "welcome",
"type" => @$type));
?>
<div class="row">
<div class="col-md-12 margin-top-15 text-dark menuInvite">
<ul class="nav nav-tabs">
<li role="presentation">
<a href="javascript:" class='radius-10 padding-10 text-green' id="menuRemove">
<h4><i class="fa fa-trash"></i>
<?php echo Yii::t("common","Remove my data"); ?> </h4>
</a>
</li>
<li role="presentation">
<a href="javascript:" class="radius-10 padding-10 text-dark" id="menuGet">
<h4><i class="fa fa-info-circle"></i>
<?php echo Yii::t("common","Get my data"); ?> </h4>
</a>
</li>
</ul>
</div>
</div>
<div class="col-xs-12" id="divRemove" style="margin-top: 10px">
<legend><?php echo Yii::t("common","Please choose your actions"); ?> :</legend>
<div class="col-xs-12">
<input type="checkbox" id="remove1" name="remove" value="remove1">
<label for="remove1"><?php echo Yii::t("common","Delete my email associated with items"); ?></label>
</div>
<div class="col-xs-12">
<input type="checkbox" id="remove2" name="remove" value="remove2">
<label for="remove2"><?php echo Yii::t("common","No longer allow my email to be informed about the platform"); ?></label>
</div>
<div class="col-xs-12 padding-10">
<label for="email"><?php echo Yii::t("common","Your mail"); ?> : </label> <input type="text" name="email" id="email" />
</div>
<div class="col-xs-12">
<div class="col-xs-4 padding-10">
<input placeholder="<?php echo Yii::t("terla", "copy the code here"); ?>" class="col-xs-12 txt-captcha" id="captcha">
</div>
</div>
<div class="col-xs-12">
<button id="btn-valider" class="btn btn-default" ><!-- <i class="fa fa-times"></i> --><?php echo Yii::t("common","Validate"); ?></button>
</div>
<div class="col-xs-12 padding-10">
<div id="success" class="hidden text-green" style="margin-top: 30px;">
<h4><?php echo Yii::t("common","An e-mail has just been sent to you to validate the request"); ?> .</h4>
</div>
<div id="error" class="hidden text-red" style="margin-top: 30px;">
<h4 id="errormsg"></h4>
</div>
</div>
</div>
<div class="col-xs-12 hidden" id="divGet" style="margin-top: 10px">
<div class="col-xs-12">
<legend><?php echo Yii::t("common","Your data associated with your email address"); ?> :</legend>
<label for="email-info"><?php echo Yii::t("common","Your mail"); ?> : </label> <input type="text" name="email-info" id="email-info" />
</div>
<div class="col-xs-12">
<div class="col-xs-4 padding-10">
<input placeholder="<?php echo Yii::t("terla", "copy the code here"); ?>" class="col-xs-12 txt-captcha" id="captchaGet">
</div>
</div>
<div class="col-xs-12">
<button id="btn-valid-info" class="btn btn-default" ><?php echo Yii::t("common","Validate"); ?></button>
</div>
<div class="col-xs-12 padding-10">
<div id="successGet" class="hidden text-green" style="margin-top: 30px;">
<h4><?php echo Yii::t("common","Vous allez recevoir un e-mail avec vos informations"); ?> .</h4>
</div>
<div id="errorGet" class="hidden text-red" style="margin-top: 30px;">
<h4 id="errormsgget"></h4>
</div>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function() {
setTitle("Remove donnée : Répertoire","cog");
$("#captcha").realperson({length: 4});
$("#captchaGet").realperson({length: 4});
$("#btn-valider").off().on( "click", function(){
$("#success").addClass("hidden");
$("#error").addClass("hidden");
if($('[name=remove').is(':checked') == true ) {
var param = {
removeMail : $("#remove1").prop("checked"),
notMail :$("#remove2").prop("checked"),
email : $("#email").val(),
captchaUserVal: $("#captcha").val(),
captchaHash: $("#captcha").realperson('getHash')
} ;
mylog.log("param", param);
$.ajax({
type: "POST",
url: baseUrl+"/"+moduleId+"/mailmanagement/removedata/",
dataType: "json",
data : param,
success: function(data){
console.log("data", data);
if (data.result) {
toastr.success(data.msg);
$("#email").val("");
$("#success").removeClass("hidden");
$("#error").addClass("hidden");
} else {
$("#error").removeClass("hidden");
$("#success").addClass("hidden");
toastr.error(data.msg);
$("#errormsg").html(data.msg);
}
}
});
} else {
$("#error").removeClass("hidden");
$("#success").addClass("hidden");
toastr.error("Select at least one action");
$("#errormsg").html("Select at least one action");
}
});
$("#btn-valid-info").off().on( "click", function(){
var param = {
email : $("#email-info").val(),
captchaUserVal: $("#captchaGet").val(),
captchaHash: $("#captchaGet").realperson('getHash'),
} ;
$.ajax({
type: "POST",
url: baseUrl+"/"+moduleId+"/mailmanagement/askdata/",
dataType: "json",
data : param,
success: function(data){
console.log("data", data);
if (data.result) {
toastr.success(data.msg);
$("#email-info").val("");
$("#successGet").removeClass("hidden");
$("#errorGet").addClass("hidden");
} else {
$("#errorGet").removeClass("hidden");
$("#success").addClass("hidden");
toastr.error(data.msg);
$("#errormsgget").html(data.msg);
}
}
});
});
$("#menuRemove").click(function() {
mylog.log("menuRemove");
$("#divGet").addClass("hidden");
$("#divRemove").removeClass("hidden");