Commit 27c8dbfb authored by Clément Damiens's avatar Clément Damiens

settings panel construct
parent 00587be0
......@@ -330,7 +330,7 @@ function bindButtonMenu(){
responsiveMenuLeft();
//location.hash=hashUrlPage+".view.networks";
//history.pushState(null, "New Title", hashUrlPage+".view.contacts");
loadPreferences();
loadSettings();
});
$("#inviteBtn").on("click", function(){
mylog.log("invite");
......@@ -518,7 +518,13 @@ function loadNewsStream(isLiveBool){
}
function loadSettings(){
mylog.log("confidentiality", seePreferences);
loadNewsStream(true);
$("#modal-settings").modal("show");
var url = "settings/index";
showLoader('#modal-settings');
ajaxPost('#modal-settings', baseUrl+'/'+moduleId+'/'+url,
null,
function(){},"html");
/*loadNewsStream(true);
history.pushState(null, "New Title", hashUrlPage);
$("#modal-confidentiality").modal("show");
if(seePreferences=="true"){
......@@ -538,7 +544,7 @@ function loadSettings(){
}
}
});
}
}*/
}
function loadGallery(){
toogleNotif(false);
......
......@@ -383,6 +383,9 @@ class CommunecterController extends Controller
"circuit" => array("href" => "/ph/co2/pod/circuit"),
"preferences" => array("href" => "/ph/co2/pod/preferences"),
),
"settings" => array(
"index" => array("href" => "/ph/co2/settings/index", "public" => true),
),
"bookmark" => array(
"delete" => array("href" => "ph/communecter/bookmark/delete"),
),
......
<?php
/**
* PodController.php
*
*/
class SettingsController extends CommunecterController {
protected function beforeAction($action) {
parent::initPage();
return parent::beforeAction($action);
}
public function actions()
{
return array(
'slideragenda' => 'citizenToolKit.controllers.pod.SliderAgendaAction',
'photovideo' => 'citizenToolKit.controllers.pod.PhotoVideoAction',
'fileupload' => 'citizenToolKit.controllers.pod.FileUploadAction',
'activitylist' => 'citizenToolKit.controllers.pod.ActivityListAction',
//'preferences' => 'citizenToolKit.controllers.pod.preferencesAction',
);
}
public function actionCircuit(){
echo $this->renderPartial("circuit", array(), true);
}
public function actionIndex($page=null){
//$url=(!empty($dir)) ? $dir."/".$page : $page;
$url="index";
if(!empty($page))
$url=$page;
echo $this->renderPartial($url, null,true);
}
}
?>
\ No newline at end of file
......@@ -357,13 +357,13 @@ jQuery(document).ready(function() {
});
});
function initDocs(page, dir){
if(urlBackDocs.indexOf("#docs") >= 0){
if(urlBackHistory.indexOf("#docs") >= 0){
if(userId!="")
$("#close-docs").attr("href","#page.type.citoyens.id."+userId);
else
$("#close-docs").attr("href","#search");
}else
$("#close-docs").attr("href",urlBackDocs);
$("#close-docs").attr("href",urlBackHistory);
navInDocs(page, dir);
$(".link-docs-menu[data-type='"+page+"'][data-dir='"+dir+"']").addClass("active");
if(!$(".link-docs-menu[data-type='"+page+"'][data-dir='"+dir+"']").hasClass("down-menu"))
......
<div class="modal fade" role="dialog" id="modal-confidentiality">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<?php if($type==Person::COLLECTION)
$titleParams=Yii::t("common","Confidentiality of your personal informations");
else
$titleParams=Yii::t("common","Settings {what}", array("{what}"=>Yii::t("common","of the ".Element::getControlerByCollection($type))));
?>
<h4 class="modal-title"><i class="fa fa-cog"></i> <?php echo $titleParams ?></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="pull-left text-left padding-10"
style="border: 1px solid rgba(128, 128, 128, 0.3); margin: 10px;">
<?php if ($type==Person::COLLECTION){ ?>
<strong><i class="fa fa-group"></i> <?php echo Yii::t("common","Public"); ?></strong> :
<?php echo Yii::t("common","Visible for everyone."); ?><br/><br/>
<strong><i class="fa fa-user-secret"></i> <?php echo Yii::t("common","Private"); ?></strong> :
<?php echo Yii::t("common","Visible for my contacts."); ?><br/><br/>
<strong><i class="fa fa-ban"></i> <?php echo Yii::t("common","Mask"); ?></strong> :
<?php echo Yii::t("common","Not visible."); ?><br/> <br/>
<?php } ?>
<strong><i class="fa fa-group"></i> <?php echo Yii::t("common","Open Data"); ?></strong> :
<?php echo Yii::t("common","You propose your data in free access, to contribut for commons."); ?>
<br/><br/>
<?php if ($type!=Person::COLLECTION){ ?>
<strong><i class="fa fa-group"></i> <?php echo Yii::t("common","Open Edition") ;?></strong> :
<?php echo Yii::t("common","All users can participed / modified the informations."); ?><br/><br/>
<?php } ?>
</div>
</div>
<div class="row text-dark panel-btn-confidentiality">
<?php if ($type==Person::COLLECTION){ ?>
<div class="col-sm-4 col-xs-4 text-right padding-10 margin-top-10">
<i class="fa fa-message"></i> <strong><?php echo Yii::t("person","Birth date"); ?> :</strong>
</div>
<div class="col-sm-8 col-xs-8 text-left padding-10">
<div class="btn-group btn-group-birthDate inline-block">
<button class="btn btn-default confidentialitySettings" type="birthDate" value="public"><i class="fa fa-group"></i> <?php echo Yii::t("common","Public"); ?></button>
<button class="btn btn-default confidentialitySettings" type="birthDate" value="private"><i class="fa fa-user-secret"></i> <?php echo Yii::t("common","Private"); ?></button>
<button class="btn btn-default confidentialitySettings" type="birthDate" value="hide"><i class="fa fa-ban"></i> <?php echo Yii::t("common","Mask"); ?></button>
</div>
</div>
<div class="col-sm-4 col-xs-4 text-right padding-10 margin-top-10">
<i class="fa fa-message"></i> <strong><?php echo Yii::t("common","My mail"); ?> :</strong>
</div>
<div class="col-sm-8 col-xs-8 text-left padding-10">
<div class="btn-group btn-group-email inline-block">
<button class="btn btn-default confidentialitySettings" type="email" value="public"><i class="fa fa-group"></i> <?php echo Yii::t("common","Public"); ?></button>
<button class="btn btn-default confidentialitySettings" type="email" value="private"><i class="fa fa-user-secret"></i> <?php echo Yii::t("common","Private"); ?></button>
<button class="btn btn-default confidentialitySettings" type="email" value="hide"><i class="fa fa-ban"></i> <?php echo Yii::t("common","Mask"); ?></button>
</div>
</div>
<div class="col-sm-4 col-xs-4 text-right padding-10 margin-top-10">
<i class="fa fa-message"></i> <strong><?php echo Yii::t("common","Locality") ;?> :</strong>
</div>
<div class="col-sm-8 col-xs-8 text-left padding-10">
<div class="btn-group btn-group-locality inline-block">
<button class="btn btn-default confidentialitySettings" type="locality" value="public" selected><i class="fa fa-group"></i> <?php echo Yii::t("common","Public") ;?></button>
<button class="btn btn-default confidentialitySettings" type="locality" value="private"><i class="fa fa-user-secret"></i> <?php echo Yii::t("common","Private"); ?></button>
<button class="btn btn-default confidentialitySettings" type="locality" value="hide"><i class="fa fa-ban"></i> <?php echo Yii::t("common","Mask"); ?></button>
</div>
</div>
<div class="col-sm-4 col-xs-4 text-right padding-10 margin-top-10">
<i class="fa fa-message"></i> <strong><?php echo Yii::t("common","My phone"); ?> :</strong>
</div>
<div class="col-sm-8 col-xs-8 text-left padding-10">
<div class="btn-group btn-group-phone inline-block">
<button class="btn btn-default confidentialitySettings" type="phone" value="public"><i class="fa fa-group"></i> <?php echo Yii::t("common","Public") ;?></button>
<button class="btn btn-default confidentialitySettings" type="phone" value="private"><i class="fa fa-user-secret"></i> <?php echo Yii::t("common","Private") ;?></button>
<button class="btn btn-default confidentialitySettings" type="phone" value="hide"><i class="fa fa-ban"></i> <?php echo Yii::t("common","Mask"); ?></button>
</div>
</div>
<div class="col-sm-4 col-xs-4 text-right padding-10 margin-top-10">
<i class="fa fa-message"></i> <strong><?php echo Yii::t("common","My directory"); ?> :</strong>
</div>
<div class="col-sm-8 col-xs-8 text-left padding-10">
<div class="btn-group btn-group-directory inline-block">
<button class="btn btn-default confidentialitySettings" type="directory" value="public"><i class="fa fa-group"></i> <?php echo Yii::t("common","Public") ;?></button>
<button class="btn btn-default confidentialitySettings" type="directory" value="private"><i class="fa fa-user-secret"></i> <?php echo Yii::t("common","Private") ;?></button>
<button class="btn btn-default confidentialitySettings" type="directory" value="hide"><i class="fa fa-ban"></i> <?php echo Yii::t("common","Mask"); ?></button>
</div>
</div>
<?php } ?>
<div class="col-sm-4 col-xs-4 text-right padding-10 margin-top-10">
<i class="fa fa-message"></i> <strong><?php echo Yii::t("common","Open Data") ;?> :</strong>
</div>
<div class="col-sm-8 col-xs-8 text-left padding-10">
<div class="btn-group btn-group-isOpenData inline-block">
<button class="btn btn-default confidentialitySettings" type="isOpenData" value="true">
<i class="fa fa-group"></i> <?php echo Yii::t("common","Yes"); ?>
</button>
<button class="btn btn-default confidentialitySettings" type="isOpenData" value="false">
<i class="fa fa-user-secret"></i> <?php echo Yii::t("common","No"); ?>
</button>
<?php
$url = Yii::app()->baseUrl.'/api/';
if($type == Person::COLLECTION)
$url .= Person::CONTROLLER;
else if($type == Organization::COLLECTION)
$url .= Organization::CONTROLLER;
else if($type == Event::COLLECTION)
$url .= Event::CONTROLLER;
else if($type == Project::COLLECTION)
$url .= Project::CONTROLLER;
?>
<a href="<?php echo $url.'/get/id/'.$element['_id'] ;?>" data-toggle="tooltip"
title='Visualiser la données' id="urlOpenData"
class="urlOpenData padding-5 margin-left-10 pull-left" target="_blank">
<i class="fa fa-eye"></i> visualiser
</a>
</div>
</div>
<?php if($type != Person::COLLECTION){ ?>
<div class="col-sm-4 col-xs-4 text-right padding-10 margin-top-10">
<i class="fa fa-message"></i> <strong><?php echo Yii::t("common","Open Edition") ;?> :</strong>
</div>
<div class="col-sm-8 col-xs-8 text-left padding-10">
<div class="btn-group btn-group-isOpenEdition inline-block">
<button class="btn btn-default confidentialitySettings" type="isOpenEdition" value="true">
<i class="fa fa-group"></i> <?php echo Yii::t("common","Yes"); ?></button>
<button class="btn btn-default confidentialitySettings" type="isOpenEdition" value="false">
<i class="fa fa-user-secret"></i> <?php echo Yii::t("common","No"); ?></button>
</div>
</div>
<?php } ?>
</div>
</div>
<div class="modal-footer">
<button type="button" class="lbh btn btn-success btn-confidentialitySettings" data-dismiss="modal" aria-label="Close" data-hash="#page.type.<?php echo $type ?>.id.<?php echo $element['_id'] ;?>">
<i class="fa fa-save"></i> <?php echo Yii::t("common","Save") ;?>
</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var seePreferences = '<?php echo (@$element["seePreferences"] == true) ? "true" : "false"; ?>';
jQuery(document).ready(function() {
bindButtonConfidentiality();
});
function bindButtonConfidentiality(){
<?php
//Params Checked
$typePreferences = array("privateFields", "publicFields");
$nameFields = array("email", "locality", "phone", "directory", "birthDate");
foreach ($nameFields as $key => $value) {
$fieldPreferences[$value] = true;
}
$typePreferencesBool = array("isOpenData", "isOpenEdition");
//To checked private or public
foreach($typePreferences as $typePref){
foreach ($fieldPreferences as $field => $hidden) {
if(isset($element["preferences"][$typePref]) && in_array($field, $element["preferences"][$typePref])){
echo "$('.btn-group-$field > button[value=\'".str_replace("Fields", "", $typePref)."\']').addClass('active');";
$fieldPreferences[$field] = false;
}
}
}
//To checked if there are hidden
foreach ($fieldPreferences as $field => $hidden) {
if($hidden) echo "$('.btn-group-$field > button[value=\'hide\']').addClass('active');";
}
foreach ($typePreferencesBool as $field => $typePrefB) {
if(isset($element["preferences"][$typePrefB]) && $element["preferences"][$typePrefB] == true)
echo "$('.btn-group-$typePrefB > button[value=\'true\']').addClass('active');";
else
echo "$('.btn-group-$typePrefB > button[value=\'false\']').addClass('active');";
}
?>
}
</script>
\ No newline at end of file
<style type="text/css">
#menu-left{
position: fixed;
z-index: 100000;
bottom: 0;
top: 60px;
left: 0;
padding: 0;
overflow-y: scroll;
background-color: white;
}
#header-settings{
position: fixed;
z-index: 100000;
top: 0px;
left: 0px;
height: 60px;
right: 0px;
padding-top: 10px;
background-color: white;
}
#header-settings h2{
float: left;
color: #354C57;
font-size: 20px;
font-variant: small-caps;
line-height: 41px;
padding: 0px 10px;
}
#menu-left ul li{
list-style: none;
}
#menu-left > ul > li > a{
font-size: 20px;
}
ul.subMenu > li > a{
font-size:16px;
}
#menu-left > ul > li > a, ul.subMenu > li > a{
color: #354C57;
width: 100%;
float: left;
padding: 5px 20px;
text-align: left;
}
#menu-left ul li .subMenu, #menu-left > ul > li > a{
border-bottom: 1px solid #ccc;
}
#menu-left > ul > li > a.active, #menu-left > ul > li > a:hover{
text-decoration: none;
background-color:#E5344D;
color: white;
font-size: 22px;
}
ul.subMenu > li > a.active, ul.subMenu > li > a:hover{
border-left: 4px solid #E5344D;
color: #E5344D;
font-size:18px;
text-decoration: none;
}
#menu-left ul li a.active span.text-red, #menu-left ul li a:hover span.text-red{
color:#354C57 !important;
}
.close-modal{
top: 10px !important;
right: 10px !important;
z-index: 100000000000000 !important;
position: fixed !important;
}
.close-modal .lr, .close-modal .rl{
height: 40px !important;
}
ul.subMenu{
/*display:none;*/
}
ul.subMenu{
padding-left: 30px
}
#show-menu-xs, #close-settings{
padding: 7px 15px;
font-size: 20px;
}
.keypan .panel-heading{
margin-top: 20px;
min-height: 70px;
}
.keypan{
border: none;
margin-bottom: 10px;
box-shadow: none;
}
.keypan, .keypanList{
box-shadow: none;
}
.keypanList .panel-title i{
margin-right: 10px;
}
.keypanList .panel-body ul{
padding-left: 0px;
}
.keypanList .panel-title span{
font-size: 24px !important;
}
.keypan .panel-body{
min-height: 200px;
}
.keypan hr {
width: 75%;
margin: auto;
}
#header-settings .panel-title, .subtitleDocs .panel-title {
font-size: 40px;
}
#header-settings .panel-title .sub-title, .subtitleDocs .panel-title .sub-title{
font-size: 20px !important;
font-style: italic;
}
#container-settings-view{
background-color: white;
top:55px;
}
@media (max-width: 991px) {
/* .open-type-filter{
display: block;
position: absolute;
right: -33px;
height: 50px;
width: 50px;
border: 1px solid #dadada;
border-radius: 100%;
text-align: right;
padding-right: 8px;
z-index: -1;
font-size: 20px;
}*/
#menu-left{
width: 56%;
left: -56%;
bottom: 0px;
}
}
@media (min-width: 991px) {
#menu-left {
left:0 !important;
}
}
</style>
<div id="header-settings" class="shadow2">
<a href='javascript:;' id="show-menu-xs" class="visible-xs visible-sm pull-left" data-placement="bottom" data-title="Menu"><i class="fa fa-bars"></i></a>
<h2 class="elipsis no-margin"><i class="fa fa-cogs hidden-xs"></i> <?php echo Yii::t("settings", "Settings of my accont") ?></h2>
<a href='javascript:;' class="lbh pull-right" id="close-settings"><span><i class="fa fa-close"></i></span></a>
</div>
<div id="menu-left" class="col-md-3 col-sm-2 col-xs-12 shadow2">
<ul class="col-md-12 col-sm-12 col-xs-12 no-padding">
<li class="col-xs-12 no-padding">
<a href="javascript:" class="link-docs-menu down-menu" data-page="notification-explain">
<i class="fa fa-angle-right"></i> <?php echo Yii::t("docs","Notifications"); ?>
</a>
<ul class="subMenu col-xs-12 no-padding">
<li class="col-xs-12 no-padding">
<a href="javascript:;" class="link-docs-menu" data-page="notification-account">
<?php echo Yii::t("common","My account"); ?>
</a>
</li>
<li class="col-xs-12 no-padding">
<a href="javascript:;" class="link-docs-menu" data-page="notification-community">
<?php echo Yii::t("docs","My community"); ?>
</a>
</li>
</ul>
</li>
<li class="col-xs-12 no-padding">
<a href="javascript:;" class="link-docs-menu down-menu" data-type="contribute">
<i class="fa fa-angle-right"></i> <?php echo Yii::t("docs","Chat settings"); ?>
</a>
</li>
<li class="col-xs-12 no-padding">
<a href="javascript:" class="link-docs-menu down-menu" data-page="confidentiality">
<i class="fa fa-angle-right"></i> <?php echo Yii::t("docs","Confidentiality"); ?>
</a>
</li>
</ul>
</div>
<div id="container-settings-view" class="col-md-offset-3 col-md-9 col-sm-12 col-xs-12 no-padding text-center">
</div>
<script type="text/javascript">
var page="<?php echo @$page ?>";
jQuery(document).ready(function() {
if(page != "")
initSettings(page);
else
initSettings("notification-account");
$("#close-settings").off().on("click",function(){
$("#modal-settings").hide(300);
onchangeClick=false;
location.hash=urlBackHistory;
});
$(".link-docs-menu").off().on("click",function(){
if($(this).hasClass("down-menu")){
$("#menu-left > ul > li > a").removeClass("active").find("i").removeClass("fa-angle-down").addClass("fa-angle-right");
$(".subMenu .link-docs-menu").removeClass("active");
$(this).addClass("active").find("i").removeClass("fa-angle-right").addClass("fa-angle-down");
}else{
$(".subMenu .link-docs-menu").removeClass("active");
$(this).addClass("active");
if(!$(this).parents().eq(2).find(".link-docs-menu:first").hasClass("active")){
$("#menu-left > ul > li > a").removeClass("active").find("i").removeClass("fa-angle-down").addClass("fa-angle-right");
$(this).parents().eq(2).find(".link-docs-menu:first").addClass("active").find("i").removeClass("fa-angle-right").addClass("fa-angle-down");
}
}
if($("#show-menu-xs").is(":visible")){
$("#show-menu-xs").removeClass("show-dir");
$("#menu-left").animate({ left : "-56%" }, 400 );
}
onchangeClick=false;
hashDocs="#settings.page."+$(this).data("page");
location.hash=hashDocs;
navInSettings($(this).data("page"));
});
$("#show-menu-xs").click(function(){
if(!$(this).hasClass("show-dir")){
$(this).addClass("show-dir").data("title", "<?php echo Yii::t("common","Close") ?>").find("i").removeClass("fa-chevron-right").addClass("fa-times");
$("#menu-left").animate({ left : "0%" }, 400 );
}else{
$(this).removeClass("show-dir").data("title", "<?php echo Yii::t("common","Open filtering by type") ?>").find("i").removeClass("fa-times").addClass("fa-chevron-right");
$("#menu-left").animate({ left : "-56%" }, 400 );
}
});
});
function initSettings(page){
navInSettings(page);
$(".link-docs-menu[data-type='"+page+"']").addClass("active");
if(!$(".link-docs-menu[data-type='"+page+"']").hasClass("down-menu"))
$(".link-docs-menu[data-type='"+page+"']").parents().eq(2).find(".down-menu").addClass("active").find("i").removeClass("fa-angle-right").addClass("fa-angle-down");
else
$(".link-docs-menu[data-type='"+page+"']").find("i").removeClass("fa-angle-right").addClass("fa-angle-down");
}
function navInSettings(page){
simpleScroll(0);
showLoader('#container-settings-view');
urlToSend="settings/index/page/"+page;
//if(notNull(dir) && dir !="")
// urlToSend+="dir/"+dir+"/";
ajaxPost('#container-settings-view' ,baseUrl+'/'+moduleId+"/"+urlToSend,
null,function(){},"html");
}
</script>
\ No newline at end of file
......@@ -2,9 +2,8 @@
$cs = Yii::app()->getClientScript();
$cssAnsScriptFilesTheme = array(
//SELECT2
'/plugins/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css',
'/plugins/bootstrap-switch/dist/js/bootstrap-switch.min.js' ,
'/plugins/bootstrap-toggle/css/bootstrap-toggle.min.css',
'/plugins/bootstrap-toggle/js/bootstrap-toggle.min.js' ,
);
//if ($type == Project::COLLECTION)
// array_push($cssAnsScriptFilesTheme, "/assets/plugins/Chart.js/Chart.min.js");
......@@ -47,11 +46,51 @@ HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesTheme, Yii::app()->requ
<span class="labelNotifications">Votes (new vote, alert before the end of votes, vote's result)</span>
</div>
</div>-->
<div class="col-md-12">
<h1>Notifications settings</h1>
<span> Activate or desactivate notifications and mails you want to received. You have a basic settings with three level personal, your network (including admin and members link) and public (your points of communexion)</span>
<div class="col-xs-12">
<h1>My account notifications settings</h1>
<span> Manage notifications you want to received link to your user account. For your personal notifications inside the platform you can directly activate or desactivate what you want. You can also choose a personal mail notification packages. Of course you are free to desactivate all notifications</span>
</div>
<div id="notifications-settings" class="col-xs-12">
<h2>Notifications:</h2>
<div class="col-xs-12">
<label>Someone invites you to join an organization, a project or an event</label>
<input class="toggle-btn" checked type="checkbox" data-toggle="toggle" data-size="mini" data-onstyle="info">
</div>
<div class="col-xs-12">
<label>Someone confirms a demand you did in order to join an organization, a project or an event</label>
<input class="toggle-btn" checked type="checkbox" data-toggle="toggle" data-size="mini" data-onstyle="info">
</div>
<div class="col-xs-12">
<label>Someone is following you</label>
<input class="toggle-btn" checked type="checkbox" data-toggle="toggle" data-size="mini" data-onstyle="info">
</div>
<div class="col-xs-12">
<label>Someone mentions you in a news or a comment</label>
<input class="toggle-btn" checked type="checkbox" data-toggle="toggle" data-size="mini" data-onstyle="info">
</div>
<div class="col-xs-12">
<label>Someone writes a news on your wall</label>
<input class="toggle-btn" checked type="checkbox" data-toggle="toggle" data-size="mini" data-onstyle="info">
</div>
<div class="col-xs-12">
<label>Someone likes or unlikes one of your news</label>
<input class="toggle-btn" checked type="checkbox" data-toggle="toggle" data-size="mini" data-onstyle="info">
</div>
<div class="col-xs-12">
<label>Someone comments one of your news or answers to your comment</label>
<input class="toggle-btn" checked type="checkbox" data-toggle="toggle" data-size="mini" data-onstyle="info">
</div>
<div class="col-xs-12">
<label>Registration of people you invited</label>
<input class="toggle-btn" checked type="checkbox" data-toggle="toggle" data-size="mini" data-onstyle="info">