Commit 95898fce authored by Clément Damiens's avatar Clément Damiens
Browse files

roles right ctenat
parent 2bbc19b9
......@@ -214,10 +214,10 @@ var pageProfil = {
'/id/'+contextData.id+'/dataName/'+pageProfil.params.dir+'?tpl=json',
function(data){
var type = ($.inArray(pageProfil.params.dir, ["poi","ressources","vote","actions","discuss"]) >=0) ? pageProfil.params.dir : null;
if(typeof edit != "undefined" && edit)
edit=pageProfil.params.dir;
mylog.log("loadDataDirectory edit" , edit);
displayInTheContainer(data, pageProfil.params.dir, dataIcon, type, edit);
if(typeof canEdit != "undefined" && canEdit)
canEdit=pageProfil.params.dir;
mylog.log("loadDataDirectory edit" , canEdit);
displayInTheContainer(data, pageProfil.params.dir, dataIcon, type, canEdit);
if(typeof mapCO != "undefined"){
mapCO.clearMap();
mapCO.addElts(data);
......@@ -255,8 +255,8 @@ var pageProfil = {
getAjax('', baseUrl+'/'+moduleId+'/element/getnetworks/type/'+contextData.type+
'/id/'+contextData.id,
function(data){
mylog.log("loadNetworks success", data, edit);
displayInTheContainer(data, "networks", "external-link", "networks",edit);
mylog.log("loadNetworks success", data, canEdit);
displayInTheContainer(data, "networks", "external-link", "networks",canEdit);
}
,"html");
},
......@@ -346,7 +346,7 @@ var pageProfil = {
},
chat : function(){
hasRc=(typeof contextData.hasRC != "undefined" || contextData.type=="citoyens" ) ? true : false;
rcObj.loadChat(contextData.slug,contextData.type,edit,hasRc, contextData);
rcObj.loadChat(contextData.slug,contextData.type,canEdit,hasRc, contextData);
},
mindmap : function(){
co.mind();
......@@ -476,7 +476,7 @@ function getLabelTitleDir(dataName, dataIcon, countData, n){
else if(dataName == "actionRooms") { html += countData+" <b>espace de décision"+s+"</b> de " + elementName; }
else if(dataName == "networks") { html += countData+" <b>"+trad.map+s+"</b> "+trad.of+" " + elementName;
if( (typeof openEdition != "undefined" && openEdition == true) || (typeof edit != "undefined" && edit == true) ){
if( (typeof openEdition != "undefined" && openEdition == true) || (typeof canEdit != "undefined" && canEdit == true) ){
html += '<a class="btn btn-sm btn-link bg-green-k pull-right " href="javascript:;" onclick="dyFObj.openForm ( \'network\', \'sub\')">';
html += '<i class="fa fa-plus"></i> '+tradDynForm["Add map"]+'</a>' ;
}
......@@ -487,7 +487,7 @@ function getLabelTitleDir(dataName, dataIcon, countData, n){
if(countData == "Aucun")
str = " n'a aucun";
html += elementName + str+" <b> lien"+s;
if( (typeof openEdition != "undefined" && openEdition == true) || (typeof edit != "undefined" && edit == true) ){
if( (typeof openEdition != "undefined" && openEdition == true) || (typeof canEdit != "undefined" && canEdit == true) ){
html += '<a class="btn btn-sm btn-link bg-green-k pull-right " href="javascript:;" onclick="dyFObj.openForm ( \'url\',\'sub\')">';
html += '<i class="fa fa-plus"></i> '+trad["Add link"]+'</a>' ;
}
......@@ -499,13 +499,13 @@ function getLabelTitleDir(dataName, dataIcon, countData, n){
if(countData == "Aucun")
str = " n'a aucun";
html += elementName + " a " + countData+" <b> point de contact"+s;
if( (typeof openEdition != "undefined" && openEdition == true) || (typeof edit != "undefined" && edit == true) ){
if( (typeof openEdition != "undefined" && openEdition == true) || (typeof canEdit != "undefined" && canEdit == true) ){
html += '<a class="btn btn-sm btn-link bg-green-k pull-right " href="javascript:;" onclick="dyFObj.openForm ( \'contactPoint\',\'sub\')">';
html += '<i class="fa fa-plus"></i> '+trad["Add contact"]+'</a>' ;
}
}
if( openEdition || edit ){
if( openEdition || canEdit ){
if( $.inArray( dataName, ["events","projects","organizations","poi","classifieds", "jobs","collections","actionRooms", "ressources"] ) >= 0 ){
if(dataName == "collections"){
html += '<a class="btn btn-sm btn-link bg-green-k pull-right " href="javascript:;" onclick="collection.crud()">';
......
......@@ -29,7 +29,8 @@ class AppController extends CommunecterController {
'dashboard' => 'citizenToolKit.controllers.app.DashboardAction',
'welcome' => 'citizenToolKit.controllers.app.WelcomeAction',
//'sendmailformcontact' => 'citizenToolKit.controllers.app.SendMailFormContactAction',
'checkurlexists' => 'citizenToolKit.controllers.app.CheckUrlExistsAction',
'checkurlexists' => 'citizenToolKit.controllers.app.CheckUrlExistsAction',
'admin' => 'citizenToolKit.controllers.app.AdminAction',
);
}
......@@ -218,7 +219,7 @@ class AppController extends CommunecterController {
}
public function actionAdmin($view=null, $dir=null, $subview=null){
/*public function actionAdmin($view=null, $dir=null, $subview=null){
CO2Stat::incNbLoad("co2-admin");
$params = array(
"dir" => @$dir,
......@@ -231,7 +232,7 @@ class AppController extends CommunecterController {
$view = "index";
$redirect="";
echo $this->renderPartial("../admin/".$redirect.$view, $params, true);
}
}*/
public function actionAdminpublic($view = null){
......
......@@ -29,9 +29,7 @@
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 no-padding" id="content-admin-panel">
<?php if(@Yii::app()->session["userIsAdmin"] || Yii::app()->session["userIsAdminPublic"] ||
Yii::app()->session["isCostumAdmin"]){
$authorizedAdmin=true;
<?php if($authorizedAdmin){
$title=(@Yii::app()->session["userIsAdmin"]) ? Yii::t("common","Administration portal") : Yii::t("common","Public administration portal");
$logo = (@Yii::app()->session['costum']["logo"]) ? Yii::app()->session['costum']["logo"] : Yii::app()->theme->baseUrl."/assets/img/LOGOS/CO2/logo-min.png";
?>
......@@ -62,22 +60,24 @@
<ul class="list-group text-left no-margin menuAdmin">
<?php
foreach($adminConstruct["menu"] as $key => $v) {
$show=(isset($v["super"]) && !isset(Yii::app()->session["userIsAdmin"])) ? false : true;
$show= (isset($v["costumAdmin"]) && !isset(Yii::app()->session["isCostumAdmin"]) && !isset(Yii::app()->session["userIsAdmin"])) ? false : true;
$show=(isset($v["show"])) ? $v["show"] : true;
if($show){
$dataAttr="";
$dataAttr=(isset($v["dataHref"])) ? "data-href='".$v["dataHref"]."' " : "";
$dataAttr.=(isset($v["view"]) && !empty($v["view"])) ? "data-view='".$v["view"]."' " : "";
?>
<li class="text-center list-group-item col-xs-12 col-sm-offset-1 col-md-offset-2 col-md-8 col-sm-10">
<a href="javascript:;" class="btnNavAdmin <?php echo @$v["class"] ?>" id="<?php echo @$v["id"] ?>" <?php echo $dataAttr; ?> style="cursor:pointer;">
<i class="fa fa-<?php echo @$v["icon"] ?> fa-2x"></i>
<?php echo Yii::t("admin", @$v["label"]); ?>
</a>
</li>
<?php
if(!empty($menu)){
foreach($adminConstruct["menu"] as $key => $v) {
$show=(isset($v["super"]) && !isset(Yii::app()->session["userIsAdmin"])) ? false : true;
$show= (isset($v["costumAdmin"]) && !isset(Yii::app()->session["isCostumAdmin"]) && !isset(Yii::app()->session["userIsAdmin"])) ? false : true;
$show=(isset($v["show"])) ? $v["show"] : true;
if($show){
$dataAttr="";
$dataAttr=(isset($v["dataHref"])) ? "data-href='".$v["dataHref"]."' " : "";
$dataAttr.=(isset($v["view"]) && !empty($v["view"])) ? "data-view='".$v["view"]."' " : "";
?>
<li class="text-center list-group-item col-xs-12 col-sm-offset-1 col-md-offset-2 col-md-8 col-sm-10">
<a href="javascript:;" class="btnNavAdmin <?php echo @$v["class"] ?>" id="<?php echo @$v["id"] ?>" <?php echo $dataAttr; ?> style="cursor:pointer;">
<i class="fa fa-<?php echo @$v["icon"] ?> fa-2x"></i>
<?php echo Yii::t("admin", @$v["label"]); ?>
</a>
</li>
<?php
}
}
}
?>
......
......@@ -32,7 +32,7 @@
"id" => @$id,
"type" => @$type,
"page" => "page",
"edit"=>$edit,
"canEdit"=>$canEdit,
"openEdition" => $openEdition,
"linksBtn" => $linksBtn,
"isLinked" => $isLinked,
......@@ -46,8 +46,8 @@
"id" => @$id,
"type" => @$type,
"page" => "page",
"edit"=>$edit,
"openEdition" => $openEdition,
"canEdit"=>@$canEdit,
"openEdition" => @$openEdition,
"linksBtn" => $linksBtn,
"isLinked" => $isLinked,
"controller" => $controller,
......@@ -57,19 +57,7 @@
if(@$members) $params["members"] = $members;
if(@$invitedMe) $params["invitedMe"] = $invitedMe;
// <<<<<<< HEAD
// //Rest::json(array("view" => $view, "onepageKey" => $onepageKey)); exit ;
// if( !empty(Yii::app()->session['costum']) &&
// !empty(Yii::app()->session['costum']['htmlConstruct']) &&
// !empty(Yii::app()->session['costum']['htmlConstruct']['element']) &&
// !empty(Yii::app()->session['costum']['htmlConstruct']['element']['url']) ) {
// echo $this->renderPartial(Yii::app()->session['costum']['htmlConstruct']['element']['url'],$params);
// } else if(Yii::app()->params["CO2DomainName"] == "terla")
// $this->renderPartial('co2.views.element.terla.index', $params );
// else if(!empty($view) && !empty($onepageKey) && in_array($view, $onepageKey)) {
// =======
if(isset($view) && !empty($view) && !empty($onepageKey) && in_array($view, $onepageKey))
$this->renderPartial("co2.views.element.onepage", $params);
else
......
......@@ -34,6 +34,7 @@
//var currentCategory = "";
jQuery(document).ready(function() {
// initWelcomeInterface();
});
......
......@@ -774,7 +774,7 @@
});
function inintDescs() {
mylog.log("inintDescs");
if(edit == true || openEdition== true)
if(canEdit == true || openEdition== true)
descHtmlToMarkdown();
mylog.log("after");
mylog.log("inintDescs", $("#descriptionAbout").html());
......
......@@ -331,8 +331,9 @@ if(isset($pageConfig["banner"]) && !empty($pageConfig["banner"])){
} ?>
<div id="uploadScropResizeAndSaveImage" style="display:none;padding:0px 60px;">
<div class="close-modal" data-dismiss="modal"><div class="lr"><div class="rl"></div></div></div>
<?php $imgLogo=(@Yii::app()->session['costum']["logo"]) ? Yii::app()->session['costum']["logo"] : Yii::app()->theme->baseUrl."/assets/img/LOGOS/CO2/logo-head-search.png"; ?>
<div class="col-lg-12">
<img src="<?php echo Yii::app()->theme->baseUrl; ?>/assets/img/LOGOS/<?php echo Yii::app()->params["CO2DomainName"]; ?>/logo-head-search.png"
<img src="<?php echo $imgLogo ?>"
class="inline margin-top-25 margin-bottom-5" height="50">
<br>
</div>
......
......@@ -64,6 +64,7 @@
$show=true;
if(isset($v["openEdition"]) && empty($openEdition)) $show=false;
if(isset($v["edit"]) && empty($edit)) $show=false;
if(isset($v["onlyMember"])) $show=Authorisation::isElementMember((string)$element["_id"],$type, Yii::app()->session["userId"]);
if(isset($v["typeAllow"]) && !in_array($type, $v["typeAllow"])) $show=false;
if(isset($v["userConnected"]) && !isset(Yii::app()->session["userId"])) $show=false;
if(isset($v["categoryAllow"]) && (!isset($element["category"]) || $element["category"]!=$v["categoryAllow"])) $show=false;
......@@ -89,6 +90,7 @@
$show=true;
if(isset($v["openEdition"]) && empty($openEdition)) $show=false;
if(isset($v["edit"]) && empty($edit)) $show=false;
if(isset($v["onlyMember"])) $show=Authorisation::isElementMember((string)$element["_id"],$type, Yii::app()->session["userId"]);
if(isset($v["typeAllow"]) && !in_array($type, $v["typeAllow"])) $show=false;
if(isset($v["userConnected"]) && !isset(Yii::app()->session["userId"])) $show=false;
if(isset($v["categoryAllow"]) && (!isset($element["category"]) || $element["category"]!=$v["categoryAllow"])) $show=false;
......
......@@ -81,13 +81,7 @@
style=" background: url('<?php echo $url;?>') center bottom;"
<?php } ?>>
<div id="topPosKScroll"></div>
<?php if(@$edit==true && false) { ?>
<button class="btn btn-default btn-sm pull-right margin-right-15 margin-top-70 hidden-xs btn-edit-section"
data-id="#header">
<i class="fa fa-cog"></i>
</button>
<?php } ?>
<?php
$this->renderPartial('co2.views.element.banner',
array( "iconColor"=>$iconColor,
......@@ -100,7 +94,7 @@
"elementId"=>(string)$element["_id"],
"elementType"=>$type,
"elementName"=> $element["name"],
"edit" => @$edit,
"edit" => @$canEdit,
"openEdition" => @$openEdition)
);
?>
......@@ -128,7 +122,7 @@
"resize" => false,
"contentId" => Document::IMG_PROFIL,
"show" => true,
"editMode" => $edit,
"editMode" => $canEdit,
"image" => $images,
"openEdition" => $openEdition)
);
......@@ -140,7 +134,7 @@
<?php $params = array(
"element" => @$element,
"type" => @$type,
"edit" => @$edit,
"edit" => @$canEdit,
"id"=>$id,
"openEdition" => $openEdition,
"iconColor"=>$iconColor,
......@@ -161,7 +155,7 @@
$params = array(
"element" => @$element,
"type" => @$type,
"edit" => @$edit,
"edit" => @$canEdit,
"countNotifElement"=>@$countNotifElement,
"invitedMe" => @$invitedMe,
"openEdition" => $openEdition,
......@@ -201,7 +195,7 @@
//render of modal for coop spaces
$params = array( "element" => @$element,
"type" => @$type,
"edit" => @$edit,
"edit" => @$canEdit,
"thumbAuthor"=>@$thumbAuthor,
"openEdition" => $openEdition,
"iconColor" => $iconColor
......@@ -225,7 +219,7 @@
$this->renderPartial('co2.views.pod.confidentiality',
array( "element" => @$element,
"type" => @$type,
"edit" => @$edit,
"edit" => @$canEdit,
"controller" => $controller,
"openEdition" => $openEdition,
) );
......@@ -247,7 +241,9 @@
var contextData = <?php echo json_encode( Element::getElementForJS(@$element, @$type) ); ?>;
mylog.log("init contextData", contextData);
var params = <?php echo json_encode(@$params); ?>;
var edit = ( ( '<?php echo (@$edit == true); ?>' == "1") ? true : false );
var canEdit = <?php echo json_encode(@$canEdit) ?>;
var canSee = <?php echo json_encode(@$canParticipate)?>;
var canSee = <?php echo json_encode(@$canSee) ?>;
var openEdition = ( ( '<?php echo (@$openEdition == true); ?>' == "1") ? true : false );
var dateLimit = 0;
var typeItem = "<?php echo $typeItem; ?>";
......
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