Commit 22e761c7 authored by Raph El's avatar Raph El
Browse files

Merge branch 'qa' into development

parents c5bcbc6d 8d9289a9
......@@ -19,12 +19,13 @@ class NetworkModule extends CWebModule {
'errorAction'=>'/'.$this->id.'/error'
)
));
//var_dump("NETWORK INIT"); exit;
Yii::app()->homeUrl = Yii::app()->createUrl($this->id);
//sudo ln -s co2 network
Yii::app()->theme = "network";
Yii::app()->session["theme"] == "network";
Yii::app()->session["network"] = "network";
Yii::app()->params['networkParams'] = ( @Yii::app()->session["networkParams"] ) ? Yii::app()->session["networkParams"] : @$_GET["network"];
/*if(@$_GET["network"] ){
......@@ -119,6 +120,9 @@ class NetworkModule extends CWebModule {
//Yii::app()->params['networkParams'] = $_GET["network"];
}
Yii::app()->session["theme"] = $theme;
Rest::json(Yii::app()->session["theme"]); exit;
//Yii::app()->session["network"]
return $theme;
}
}
......@@ -71,8 +71,7 @@ var addressObj = {
initVar: function (pInit) {
mylog.log("addressObj.initVar", pInit);
this.container = ((pInit != null && typeof pInit.container != "undefined") ? pInit.container : null );
this.result = ((pInit != null && typeof pInit.result != "undefined" && typeof pInit.result != "string") ? pInit.result : [] );
this.result = ((pInit != null && typeof pInit.result != "undefined" && pInit.result != null && pInit.result != "") ? pInit.result : [] );
},
bindAddress: function (pInit, aObj) {
$(aObj.container+" .btnSearchAddress").off().click(function () {
......
......@@ -3277,6 +3277,7 @@ function updateSlug() {
//rcObj.loadChat(data.resultGoods.values.slug,type,canEdit,hasRc);
//loadDataDirectory(connectType, "user", true);
//changeHiddenFields();
urlCtrl.loadByHash(location.hash);
},
properties : {
info : {
......
......@@ -177,8 +177,8 @@ var calendar = {
date : dateToShow.getDate(),
//gotoDate:moment(initDate),
editable : false,
eventBackgroundColor: '#FFA200',
textColor: '#fff',
eventBackgroundColor: '#FFA200 !important',
textColor: '#fff !important',
defaultView: calendar.viewMode,
events : [],
eventLimit: 3,
......@@ -301,6 +301,7 @@ var calendar = {
if(!data){
toastr.error(data.content);
} else {
//mylog.log("calendar.php globalautocomplete success searchObject", searchObject.initType, searchObject.text);
if(typeof calendar != "undefined" && searchObject.initType == "events" && searchObject.text=="")
calendar.addEvents(data.events);
}
......
......@@ -448,8 +448,8 @@ function calculateAgendaWindow(nbMonth){
var today = new Date();
var todayMoment = moment().seconds(0).minute(0).hour(0);
mylog.log('directory.js calculateAgendaWindow today', typeof today, today);
mylog.log('directory.js calculateAgendaWindow today', typeof todayMoment, todayMoment, todayMoment.valueOf());
// mylog.log('directory.js calculateAgendaWindow today', typeof today, today);
// mylog.log('directory.js calculateAgendaWindow today', typeof todayMoment, todayMoment, todayMoment.valueOf());
today = new Date(today.setSeconds(0));
today = new Date(today.setMinutes(0));
today = new Date(today.setHours(0));
......@@ -457,11 +457,11 @@ function calculateAgendaWindow(nbMonth){
//STARTDATE = moment(todayMoment.format()).valueOf();
STARTDATE = today.setDate(today.getDate());
mylog.log('directory.js calculateAgendaWindow today2', typeof today, today);
mylog.log('directory.js calculateAgendaWindow todayMoment', typeof todayMoment, todayMoment.format(), todayMoment.valueOf());
/// mylog.log("directory.js calculateAgendaWindow todayUTC0", typeof todayUTC0, todayUTC0, todayUTC0.format(), todayUTC0.valueOf());
mylog.log('directory.js calculateAgendaWindow STARTDATE', typeof STARTDATE, STARTDATE);
mylog.log('directory.js calculateAgendaWindow end',STARTDATE);
// mylog.log('directory.js calculateAgendaWindow today2', typeof today, today);
// mylog.log('directory.js calculateAgendaWindow todayMoment', typeof todayMoment, todayMoment.format(), todayMoment.valueOf());
// /// mylog.log("directory.js calculateAgendaWindow todayUTC0", typeof todayUTC0, todayUTC0, todayUTC0.format(), todayUTC0.valueOf());
// mylog.log('directory.js calculateAgendaWindow STARTDATE', typeof STARTDATE, STARTDATE);
// mylog.log('directory.js calculateAgendaWindow end',STARTDATE);
searchObject.startDate = Math.floor(STARTDATE / 1000);
......@@ -2763,9 +2763,8 @@ var directory = {
&& typeof costum.app[directory.appKeyParam].map != 'undefined'
&& typeof costum.app[directory.appKeyParam].map.hash != 'undefined'){
mylog.log('headerStr if');
headerStr+= '<button class="lbh-menu-app hidden-xs" data-hash="'+costum.app[directory.appKeyParam].directory.map.hash+'" style="" title="'+trad.showmap+'" alt="'+trad.showmap+'">'+
'<i class="fa fa-map-marker"></i> '+trad.map;
'</button>';
headerStr+= '<a class="lbh-menu-app btn btn-hash-map" href="'+costum.app[directory.appKeyParam].map.hash+'" style="" title="'+trad.showmap+'" alt="'+trad.showmap+'">'+
'<i class="fa fa-map-marker"></i> '+trad.map+'</a>';
} else if( !notNull(directory.costum)
|| typeof directory.costum.header == 'undefined'
|| typeof directory.costum.header.map== 'undefined'
......
......@@ -435,7 +435,7 @@ var pageProfil = {
},
chat : function(){
hasRc=(typeof contextData.hasRC != "undefined" || contextData.type=="citoyens" ) ? true : false;
rcObj.loadChat(contextData.slug,contextData.type,canEdit,hasRc, contextData);
rcObj.loadChat(contextData.slug, contextData.type, (params && params.element && params.element.preferences && params.element.preferences.private && params.element.preferences.private === true) ? false : true,hasRc, contextData);
},
mindmap : function(){
co.mind();
......@@ -590,7 +590,8 @@ function getLabelTitleDir(dataName, dataIcon, countData, n){
}
if(dataName != "contacts" && dataName != "collections" &&
( costum == null ||
typeof costum.htmlConstruct.element == "undefined" || typeof costum.htmlConstruct.element.viewMode == "undefined" ||
typeof costum.htmlConstruct.element == "undefined" ||
typeof costum.htmlConstruct.element.viewMode == "undefined" ||
costum.htmlConstruct.element.viewMode == true ) ){
html+='<div class="col-xs-12 text-right no-padding margin-top-5">'+
'<button class="btn switchDirectoryView ';
......
......@@ -511,7 +511,7 @@ var searchInterface={
SEARCH ENGINE
-------------------------------*/
constructObjectAndUrl: function(notUrl){
mylog.log("searchInterface.constructObjectAndUrl", searchObject);
mylog.log("searchInterface.constructObjectAndUrl", searchObject, notUrl);
getStatus="";
var searchConstruct={};
if(searchObject.text != "")
......@@ -579,13 +579,13 @@ var searchInterface={
if(searchObject.community != false)
searchConstruct.community = searchObject.community;
// Locality
searchConstruct.locality = getSearchLocalityObject();
searchInterface.countActiveFilters();
// searchConstruct.locality = getSearchLocalityObject();
// searchInterface.countActiveFilters();
//Construct url with all necessar params
if(typeof notUrl == "undefined" ||
notUrl == null ||
notUrl == false)
if(typeof notUrl === "undefined" ||
notUrl === null ||
notUrl === false)
urlCtrl.manageHistory();
return searchConstruct;
},
......
......@@ -21,7 +21,18 @@ var settings = {
function(data){
toastr.success(data.msg);
}
);
});
if (param.type === 'private') {
if (params && params.element && params.element.preferences) {
if (param.value === 'true'){
params.element.preferences.private = true;
delete contextData.hasRC;
} else {
params.element.preferences.private = false;
delete contextData.hasRC;
}
}
}
});
},
bindButtonConfidentiality : function(preferences){
......
......@@ -5,7 +5,7 @@
*/
class CommunecterController extends Controller
{
public $version = "v0.2.8.7";
public $version = "v0.2.8.9";
public $versionDate = "29/07/2016 19:12";
public $title = "Communectez";
public $subTitle = "se connecter à sa commune";
......
......@@ -7418,6 +7418,67 @@ if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
$events = Element::getLastEvents("organizations", "5e203fc98b509c36568b4584", 4, "2016-01-23T00:00:00+04:00");
Rest::json($events); exit;
}
public function actionAddZonePF(){
//$level1 = Zone::createLevel("PF", "Polynésie française", "1");
$url = "https://nominatim.openstreetmap.org/details.php?osmtype=R&osmid=3412620&class=boundary&format=json&email=".Yii::app()->params["contactEmail"];
$nominatim = SIG::getUrl($url);
//var_dump(json_decode($nominatim)); exit;
$nominatim = json_decode($nominatim, true);
$zone=array();
$info=array();
$translates=array();
if(!empty($nominatim)){
$zone["name"] = $nominatim["localname"];
$zone["countryCode"] = "PF";
$zone["level"] = array("1");
// $zone["geo"] = SIG::getFormatGeo($nominatim["lat"], $nominatim["lon"]);
// $zone["geoPosition"] = SIG::getFormatGeoPosition($nominatim["lat"], $nominatim["lon"]);
$lat = $nominatim["geometry"]["coordinates"][1];
$lon = $nominatim["geometry"]["coordinates"][0];
$zone["geo"] = SIG::getFormatGeo($lat, $lon);
$zone["geoPosition"] = SIG::getFormatGeoPosition($lat, $lon);
//$zone["geoShape"] = $nominatim["geojson"];
if(!empty($nominatim["osm_id"]))
$zone["osmID"] = $nominatim["osm_id"];
if(!empty($nominatim["extratags"]["wikidata"]))
$zone["wikidataID"] = $nominatim["extratags"]["wikidata"];
if(!empty($nominatim["names"])){
foreach ($nominatim["names"] as $keyName => $valueName) {
$arrayName = explode(":", $keyName);
if(!empty($arrayName[1]) && $arrayName[0] == "name" && strlen($arrayName[1]) == 2 && $nominatim["localname"] != $valueName){
$translates[strtoupper($arrayName[1])] = $valueName;
}
}
}
$info["countryCode"] = $zone["countryCode"];
$info["parentType"] = Zone::COLLECTION;
$info["translates"] = $translates;
$info["origin"] = $nominatim["localname"];
}
$res = array(
"zone" =>$zone,
"info" =>$info
);
// PHDB::insert(Zone::COLLECTION, $zone );
// $info["parentId"] = (String) $zone["_id"];
// PHDB::insert(Zone::TRANSLATE, $info);
// PHDB::update(Zone::COLLECTION,
// array("_id"=>new MongoId((String) $zone["_id"])),
// array('$set' => array("translateId" => (String)$info["_id"]))
// );
Rest::json($res);
}
public function actionCitySaintPierreEtMichellon(){
//$level1 = Zone::createLevel("PF", "Polynésie française", "1");
$city = PHDB::find(City::COLLECTION, array('postalCodes.postalCode'=> '97500'));
Rest::json($city); exit;
}
public function actionBashforeachActiveTags() {
if( Role::isSuperAdmin(Role::getRolesUserId(Yii::app()->session["userId"]) )){
......
......@@ -136,14 +136,16 @@ class RocketchatController extends CommunecterController {
}
else if($roomType == "channel"){
$path = "/channel/".$name;
$group = RocketChat::createGroup ($name,$roomType, Yii::app()->session['user']['username']);
$isAdmin = Authorisation::canEditItem(Yii::app()->session['userId'], $type, $id);
$group = RocketChat::createGroup ($name,$roomType, Yii::app()->session['user']['username'], null,$isAdmin);
}
else {
$path = "/group/".$name;
$group = null;
if(Authorisation::canEditItem(Yii::app()->session['userId'], $type, $id) ||
$isAdmin = Authorisation::canEditItem(Yii::app()->session['userId'], $type, $id);
if($isAdmin ||
Link::isLinked($id,$type,Yii::app()->session["userId"]) ){
$group = RocketChat::createGroup ($name,null, Yii::app()->session['user']['username']);
$group = RocketChat::createGroup ($name,null, Yii::app()->session['user']['username'], null,$isAdmin);
} else
Rest::json(array("result"=>false,
"error"=>"Unauthorized Access.",
......@@ -155,20 +157,28 @@ class RocketchatController extends CommunecterController {
}
if($group != null && @$group->create->channel->_id ) {
if($group != null && (@$group->create->channel->_id || @$group->create->group->_id)) {
$result = PHDB::update( $type, array("_id" => new MongoId($id)),
array('$set' => array("hasRC"=>true),
'$addToSet' => array( "tools.chat.int" => array( "name" => $name , "url" => $path ) ) ));
}
}
if($group != null && @$group->settype->success ) {
$result = PHDB::update( $type, array("_id" => new MongoId($id)),
array('$set' => array("hasRC"=>true)));
$result = PHDB::update( $type, array("_id" => new MongoId($id), "tools.chat.int.name" => $name),
array('$set' => array("tools.chat.int.$.url"=> $path) ));
}
if($group != null){
// TODO : notification or news
Notification::constructNotification(ActStr::VERB_ADD,
/*Notification::constructNotification(ActStr::VERB_ADD,
array("id" => Yii::app()->session["userId"],"name"=> Yii::app()->session["user"]["name"]),
array( "type"=>$type,"id"=> $id),
null,
"chat"
);
);*/
/*array( "text"=>"Oyé Oyé , ".Yii::app()->session["user"]["name"]." a créé la fusée pour Dailoguer en direct : Click pour découvrir le Rocket Chat de la Communauté.",
"parentType"=>$type,
......
......@@ -120,7 +120,7 @@ $userId = Yii::app()->session["userId"] ;
<?php
if(!empty($allMappings)){
foreach ($allMappings as $key => $value){
if(empty($value["userId"]) || ( $userId == $value["userId"] || $value["userId"] == "0") ) {
if( (!empty($value["init"]) && $value["init"] === true) || empty($value["userId"]) || ( $userId == $value["userId"] || $value["userId"] == "0") ) {
echo '<option value="'.$key .'">'.$value["name"].'</option>';
}
}
......
......@@ -32,7 +32,7 @@ HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesTheme, Yii::app()->requ
$cssAnsScriptFilesModule = array(
'/js/default/calendar.js',
);
HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesModule, $this->module->assetsUrl);
HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesModule, Yii::app()->getModule( "co2" )->getAssetsUrl());
HtmlHelper::registerCssAndScriptsFiles( array( '/css/calendar.css') , Yii::app()->theme->baseUrl. '/assets');
$calendarParams=(@$this->appConfig["pages"]["#agenda"] && @$this->appConfig["pages"]["#agenda"]["calendar"]) ?$this->appConfig["pages"]["#agenda"]["calendar"] : null;
if(isset($this->costum) && !empty($calendarParams)){
......
......@@ -26,7 +26,7 @@
$params["canEdit"] = $canEdit;
else
$params["canEdit"] = Authorisation::canEditItem(Yii::app()->session["userId"],@$this->costum["contextType"], @$this->costum["contextId"]);
//echo "<script>alert('welcomeAjax')</script>";
if( isset($test) ){
$params["tpl"]=$id;
$params["test"]=$test;
......@@ -34,6 +34,7 @@
if(isset($_GET["form"]))
$params = Form::getDataForm($params);
//var_dump($params);exit;
$this->renderPartial( $this->costum["welcomeTpl"],$params );
}
else if( @$_GET["city"] || @$this->costum['id'] )
......
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