Commit d7c7feff authored by ramiandrison gova's avatar ramiandrison gova
Browse files

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

parents 9810d2ad 9e1b1191
......@@ -36,16 +36,24 @@ class FiliereController extends CommunecterController {
"paddingBottom" => "0",
"paddingLeft" => "0",
"paddingRight" => "0",
"paddingTop" => "0",
"paddingTop" => "0"
);
if($key==0){
if(file_exists(Yii::app()->getModule("costum")->assetsUrl."/images/filiereGenerique/".$_POST['thematic'].".png")){
if(file_exists(Yii::app()->baseUrl.Yii::app()->getModule("costum")->assetsUrl."/images/filiereGenerique/".$_POST['thematic'].".png")){
$arrayInsert["logo"] = Yii::app()->getModule("costum")->assetsUrl."/images/filiereGenerique/".$_POST['thematic'].".jpg";
$arrayInsert["logo"] = Yii::app()->getModule("costum")->assetsUrl."/images/filiereGenerique/".$_POST['thematic'].".png";
}else{
$arrayInsert["logo"] = Yii::app()->getModule("costum")->assetsUrl."/images/filiereGenerique/default.png";
}
$arrayInsert["titleBlock"] = "Filière ".$_POST['thematic'];
$arrayInsert["subtitleBlock"] = $_POST['ville'];
$arrayInsert["blockCmsColorTitle1"] = "white";
$arrayInsert["blockCmsColorTitle2"] = "white";
}
Yii::app()->mongodb->selectCollection("cms")->insert($arrayInsert);
......
graph
\ No newline at end of file
......@@ -966,7 +966,13 @@
/*end toogle uploader and colorpicker******************/
/*Tools bar for edit cms******************/
#toolsBar a{
cursor: pointer;
}
#toolsBar {
left: 20%;
top: 40%;
max-width: 650px;
z-index: 99999;
position: fixed;
......
......@@ -40,7 +40,7 @@
"textMT" => "8.5",
"textPR" => "10",
"textPL" => "10",
"logo" => null,
"logo" => "",
"logosPosition" => "centre",
"logosWidth" => "30",
"backgroundImages"=> null
......@@ -54,7 +54,10 @@
}
}
$paramsData["logo"] = $logoPicture;
if(count($logoPicture)!=0){
$paramsData["logo"] = $logoPicture;
}
$paramsData["backgroundImages"] = $backgroundImages;
......@@ -105,15 +108,12 @@
position:absolute;
z-index:1;
/*text-align:center;*/
font-weight: 500;
top: <?= $paramsData['textMT']?>%;
padding-left: <?= $paramsData['textPR']?>%;
padding-left: <?= $paramsData['textPL']?>%;
/*color: <?//= $paramsData["titleColor"] ?>;
text-shadow: black 0.1em 0.1em 0.2em;*/
}
.title-1, .title-2, .title-3 {
font-weight: 500;
font-weight: 800;
}
.imgBgHeight {
height: <?= $paramsData['imgHeight']?>px!important;
......@@ -150,16 +150,16 @@
<div class="containerCarousel containerCarousel-<?= $kunik?>">
<div id="docCarousel" class="carousel slide" data-ride="carousel">
<div id="head<?=$kunik ?>" class="col-xs-12">
<h3 class="title-1"><?= $paramsData["titleBlock"] ?></h3>
<h4 class="title-2"><?= $paramsData["subtitleBlock"] ?></h4>
<h1 class="title-1"><?= $paramsData["titleBlock"] ?></h1>
<h3 class="title-2"><?= $paramsData["subtitleBlock"] ?></h3>
<h5 class="title-3"><?= $paramsData["other"] ?></h5>
</div>
<br><br>
<div class="content<?=$kunik ?>">
<?php if(empty($paramsData["logo"])){
<?php if(is_string($paramsData["logo"]) && $paramsData["logo"]!=""){
?>
<img class="logo<?=$kunik ?>" src="<?= $paramsData['logo']; ?>">
<?php }else{ ?>
<img class="logo<?=$kunik ?>" src="<?= $paramsData['logo']['0'] ?>">
<?php } ?>
......
......@@ -142,16 +142,7 @@ $margin = max($margintop,$marginright,$marginleft,$marginbottom);
min-height: <?= $width ?>;
}
#toolsBar {
left: 20%;
top: 40%;
}
#toolsBar a{
cursor: pointer;
}
.cards-list {
.cards-list {
z-index: 0;
width: 100%;
display: flex;
......@@ -210,11 +201,11 @@ $margin = max($margintop,$marginright,$marginleft,$marginbottom);
position: relative;
}
.whole-<?= $kunik ?>:hover {
cursor: default;
.edit-mode-<?= $kunik ?>:hover {
cursor: context-menu;
}
.whole-<?= $kunik ?>:hover > .<?= $kunik ?> > .stop-propagation {
cursor: pointer;
.edit-mode-<?= $kunik ?>:hover > .stop-propagation {
cursor: default;
}
@media all and (max-width: 500px) {
......@@ -421,7 +412,7 @@ jQuery.fn.removeClassExcept = function (val) {
// Desable drag when container has more item (Flexbox arrange item possition Automatically)
// if ($(".container<?= $blockCms['tplParent'] ?> .super-container ").size() === 1) {
<?php if ($blockCms["type"] === "blockChild") { ?>
$(".<?= $kunik ?>").draggable({
/* $(".<?= $kunik ?>").draggable({
cancel: '.editable',
start : function(event, ui){
$("#toolsBar").html(``);
......@@ -445,18 +436,18 @@ jQuery.fn.removeClassExcept = function (val) {
dataHelper.path2Value( tplCtx, function(params) {} );
}
});
});*/
<?php } ?>
// }
/*****************End drag and resize*****************/
/********************Display menu**********************/
$(".<?= $kunik ?>").click(function(){
if ($.trim($("#toolsBar").html()) != "") {
$("#toolsBar").hide();
$("#toolsBar").html("");
superCms<?= $kunik ?>.editMode();
}else{
// if ($.trim($("#toolsBar").html()) != "") {
// $("#toolsBar").hide();
$("#toolsBar").html("");
// superCms<?= $kunik ?>.editMode();
// }else{
superCms<?= $kunik ?>.selectetMode();
$("#toolsBar").show();
$("#toolsBar").append(
......@@ -734,10 +725,11 @@ $(".<?= $kunik ?>").click(function(){
$(".closeBtn").click(function(){
superCms<?= $kunik ?>.editMode();
$("#toolsBar").hide();
$(".<?= $kunik ?>").css("cursor", "default");
$("#toolsBar").html("");
// $(".<?= $kunik ?>").css("cursor", "default");
});
}
// }
/* Upload d'image */
sectionDyf.<?php echo $kunik ?>Params = {
......
......@@ -38,7 +38,8 @@ $initImage = Document::getListDocumentsWhere(
/* Get settings */
$otherClass = $params["class"]["other"] ?? $params["class"]["other"] ?? "";
$otherCss = $params["css"]["other"] ?? $params["css"]["other"] ?? [];
$array_position = $params["css"]['position'] ?? $params["css"]['position'] ?? [];
$top = $params["css"]['position']["top"] ?? $params["css"]['position']["top"] ?? [];
$left = $params["css"]['position']["left"] ?? $params["css"]['position']["left"] ?? [];
$width = $params["css"]["size"]["width"] ?? $params["css"]["size"]["width"] ?? "320px";
$objfit = $params["css"]["object-fit"] ?? $params["css"]["object-fit"] ?? "none";
$height = $params["css"]["size"]["height"] ?? $params["css"]["size"]["height"] ?? "80px";
......@@ -117,6 +118,11 @@ $margin = max($margintop,$marginright,$marginleft,$marginbottom);
?>
}
.<?= $kunik ?>:hover {
cursor: context-menu;
}
.btn-<?= $kunik ?> {
border-radius: <?= $borderRadiustopLeft ?>px <?= $borderRadiustopRight ?>px <?= $borderRadiusbottomRight ?>px <?= $borderRadiusbottomLeft ?>px;
}
......@@ -144,14 +150,14 @@ $margin = max($margintop,$marginright,$marginleft,$marginbottom);
min-height: <?= $width ?>;
}
#toolsBar {
/* #toolsBar {
left: 20%;
top: 40%;
}
#toolsBar a{
cursor: pointer;
}
}*/
.cards-list {
z-index: 0;
......@@ -276,8 +282,8 @@ $margin = max($margintop,$marginright,$marginleft,$marginbottom);
</style>
<?php //if ($blockCms["type" != "blockCopy"]) { ?>
<?php// }else{ } ?>
<div class="whole-<?= $kunik ?> unselectable">
<div class="super-container <?= $kunik ?> <?= $otherClass ?> other-css-<?= $kunik ?> super-cms" style="position:relative;<?php foreach ($array_position as $key => $value) { echo $key." : ".$value."; "; } ?>">
<div class="whole-<?= $kunik ?> unselectable" style="margin-top:<?= $top ?>">
<div class="super-container <?= $kunik ?> <?= $otherClass ?> other-css-<?= $kunik ?> super-cms" style="position:relative;left:<?= $left ?>">
<button class="bs btn-<?= $kunik ?> <?= $type ?>" ><?= $text ?></button>
</div>
</div>
......@@ -344,12 +350,16 @@ jQuery.fn.removeClassExcept = function (val) {
viewMode: function(){
// $(".<?= $kunik ?>").addClass("default-<?= $kunik ?>");
$(".<?= $kunik ?>").removeClass("edit-mode-<?= $kunik ?>");
mode = "v";
// $(".<?= $kunik ?>").draggable("destroy").resizable("destroy");
// $(".<?= $kunik ?>").draggable("destroy").resizable("destroy");
// $(".<?= $kunik ?>").removeClass("selected-mode-<?= $kunik ?>");
$(".btn-<?= $kunik ?>").attr("href", link<?= $kunik ?>);
$(".btn-<?= $kunik ?>").addClass(lbh<?= $kunik ?>);
},
editMode: function(){
$(".<?= $kunik ?>").addClass("edit-mode-<?= $kunik ?>");
mode = "w";
// $(".<?= $kunik ?>").removeClass("default-<?= $kunik ?>");
// $(".<?= $kunik ?>").removeClass("selected-mode-<?= $kunik ?>");
$(".btn-<?= $kunik ?>").attr("href", "");
......@@ -379,13 +389,15 @@ jQuery.fn.removeClassExcept = function (val) {
/***************Drag and resize*******************/
// Desable drag when container has more item (Flexbox arrange item possition Automatically)
<?php if ($blockCms["type"] === "blockChild") { ?>
$(".<?= $kunik ?>").draggable({
cancel: '.editable',
start : function(event, ui){
$("#toolsBar").html(``);
$("#toolsBar").hide();
},
stop: function(event, ui){
$('.edit-mode-<?= $kunik ?>').mousedown(function() {
if (mode == "w") {
$(".edit-mode-<?= $kunik ?>").draggable({
cancel: '.editable',
start : function(event, ui){
$("#toolsBar").html(``);
$("#toolsBar").hide();
},
stop: function(event, ui){
//convert position from px to %
var myLeft = $(".<?= $kunik ?>").css("left");
var myTop = $(".<?= $kunik ?>").css("top");
......@@ -395,54 +407,59 @@ jQuery.fn.removeClassExcept = function (val) {
var parentWidth = $(".whole-<?= $kunik ?>").width()-20;
LeftPrnt = (myLeft / parentWidth) *100;
$(".<?= $kunik ?>").css("left", (LeftPrnt)+"%");
$(".whole-<?= $kunik ?>").css("top", myTop+margintop<?= $kunik ?>+"px");
$(".<?= $kunik ?>").css("top", "");
margintop<?= $kunik ?> = myTop+margintop<?= $kunik ?>;
$(".whole-<?= $kunik ?>").css("margin-top", margintop<?= $kunik ?>+"px");
// alert(margintop<?= $kunik ?>);
revert: true,
tplCtx = {};
tplCtx.id = "<?php echo $myCmsId ?>";
tplCtx.collection = "cms";
tplCtx.path = "params.css.position";
tplCtx.value = {};
tplCtx.value.top = $(".<?= $kunik ?>").css("top");
tplCtx.value.top = margintop<?= $kunik ?>+"px";
tplCtx.value.left = LeftPrnt+"%";
dataHelper.path2Value( tplCtx, function(params) {} );
}
});
$(".<?= $kunik ?>").resizable({
stop: function(event, ui){
superCms<?= $kunik ?>.editMode();
var myWidth = $(".<?= $kunik ?>").width();
var myHeight = $(".<?= $kunik ?>").height();
var parentWidth = $(".container<?= $blockCms['tplParent'] ?>").width();
if ("<?= $blockCms['type'] ?>" === "blockCopy") {
parentWidth = $( window ).width();
$(".edit-mode-<?= $kunik ?>").resizable({
stop: function(event, ui){
superCms<?= $kunik ?>.editMode();
var myWidth = $(".<?= $kunik ?>").width();
var myHeight = $(".<?= $kunik ?>").height();
var parentWidth = $(".container<?= $blockCms['tplParent'] ?>").width();
if ("<?= $blockCms['type'] ?>" === "blockCopy") {
parentWidth = $( window ).width();
}
widthPrnt = (myWidth / parentWidth) * 100;
$(".whole-<?= $kunik ?>").css("height", myHeight+"px");
$(".whole-<?= $kunik ?>").css("width", (widthPrnt+2)+"%");
$(".<?= $kunik ?>").css("width", "");
revert: true,
tplCtx = {};
tplCtx.id = "<?php echo $myCmsId ?>";
tplCtx.collection = "cms";
tplCtx.path = "params.css.size";
tplCtx.value = {};
tplCtx.value.width = widthPrnt+"%";
tplCtx.value.height = myHeight+"px";
dataHelper.path2Value( tplCtx, function(params) {} );
}
widthPrnt = (myWidth / parentWidth) * 100;
$(".whole-<?= $kunik ?>").css("height", myHeight+"px");
$(".whole-<?= $kunik ?>").css("width", (widthPrnt+2)+"%");
revert: true,
tplCtx = {};
tplCtx.id = "<?php echo $myCmsId ?>";
tplCtx.collection = "cms";
tplCtx.path = "params.css.size";
tplCtx.value = {};
tplCtx.value.width = widthPrnt+"%";
tplCtx.value.height = myHeight+"px";
dataHelper.path2Value( tplCtx, function(params) {} );
}
});
}
});
<?php } ?>
/*****************End drag and resize*****************/
/********************Display menu**********************/
$(".<?= $kunik ?>").click(function(){
if ($.trim($("#toolsBar").html()) != "") {
$("#toolsBar").hide();
$(".edit-mode-<?= $kunik ?>").on( "click",function(){
if (mode == "w") {
// $("#toolsBar").hide();
$("#toolsBar").html("");
superCms<?= $kunik ?>.editMode();
}else{
// superCms<?= $kunik ?>.editMode();
// }else{
superCms<?= $kunik ?>.selectetMode();
$("#toolsBar").show();
$("#toolsBar").append(
......
......@@ -83,10 +83,10 @@ $padding = max($paddingtop,$paddingright,$paddingleft,$paddingbottom);
}
#toolsBar {
/* #toolsBar {
left: 40%;
top: 40%;
}
}*/
.super-img-<?= $myCmsId ?> {
object-fit: <?= $objfit ?>;
......@@ -162,10 +162,14 @@ $padding = max($paddingtop,$paddingright,$paddingleft,$paddingbottom);
/*padding: 20px;*/
}
.edit-<?= $kunik ?>:hover {
cursor: context-menu;
}
@media (max-width: 800px) {
.super-img-<?= $myCmsId ?> {
padding: 0px;
margin: 0px;
/*padding: 0px;
margin: 0px; */
position: sticky;
}
.<?= $kunik ?> {
......
......@@ -12,69 +12,154 @@
<div class="mytext" contenteditable="true"><span align="center"> Ipsum is simply dummy</span><br> Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
<script>
// var selecteds ="";
// Create click event handler on the container element.
// var selectedPart ="";
// // var selecteds ="";
// // Create click event handler on the container element.
// function getIntersection(text1, text2){
// var res = [],
// minText = text1.length<=text2.length?text1:text2,
// maxText = text1.length > text2.length?text1:text2,
// parts = minText.split(" ")
// parts.forEach(part => {
// if(maxText.indexOf(part)>-1){
// if(res.length>0 && maxText.indexOf(res[res.length-1]+" "+part) >-1)
// res[res.length-1] += " " +part
// else
// res.push(part)
// }
// })
// return res
// }
// var e = {} , selecteds ={}, selectedPart = "", selectedPart = "";
// $('.mytext').mousedown(function() {
// selectedPart = "";
// $('.mytext').mousemove(function() {
// e = window;
// selecteds = e.getSelection();
// });
// $('.sb-s').mouseenter(function() {
// selectedPart = $(this);
// });
// });
function wrap(el, wrapper){
el.parentNode.insertBefore(wrapper, el)
wrapper.appendChild(el)
}
function addClassToSelection(className){
var selection = window.getSelection()
cssSelected = (selection.getRangeAt(0).startContainer.parentNode).style.cssText;
// idSelected = selecteds.baseNode.parentNode.id;
clasSelected = selection.baseNode.parentNode.className;
clasSelected = clasSelected.replace("mytext focus-visible","");
clasSelected = clasSelected.replace("stop-propagation","");
array_class_selected = clasSelected.split(/[ ,]+/);
array_css_selected = cssSelected.split(";");
if(selection.rangeCount > 0){
var range = selection.getRangeAt(0),
fragments = range.extractContents(),
nodeList = fragments.childNodes;
nodeList.forEach(node => {
if(node.nodeType == Node.TEXT_NODE){
var span = document.createElement("div")
span.classList.add(className)
// for (var i = 0, length = array_class_selected.length; i < length; i++) {
// span.classList.add(array_class_selected[i]);
// }
wrap(node, span)
}else
node.classList.add(className)
})
range.insertNode(fragments)
}
}
document.addEventListener("mouseup", function(){
addClassToSelection("sb")
})
$('.mytext').mouseup(function() {
$("#toolsBar").show();
e = window;
selecteds = e.getSelection();
selectedText = selecteds.toString();
cssSelected = (selecteds.getRangeAt(0).startContainer.parentNode).style.cssText;
// idSelected = selecteds.baseNode.parentNode.id;
clasSelected = selecteds.baseNode.parentNode.className;
clasSelected = clasSelected.replace("mytext focus-visible","");
clasSelected = clasSelected.replace("stop-propagation","");
array_class_selected = clasSelected.split(/[ ,]+/);
array_css_selected = cssSelected.split(";");
// selectedText = selecteds.toString();
// // $('.sb-s').mouseenter(function() {
// // selectedPart = $('.sb-s').text();
// // alert(selectedPart);
// // });
// selectedPart.html("dsq");
// console.log(selectedPart;
// alert(selectedText);
// htmlEls = selecteds.getRangeAt(0).startContainer.parentNode;
// var newText = $(this).html().replace(selectedText,selectedText.replace(/(<([^>]+)>)/gi, ""));
// $(this).html(newText);
// cssSelected = (selecteds.getRangeAt(0).startContainer.parentNode).style.cssText;
// // idSelected = selecteds.baseNode.parentNode.id;
// clasSelected = selecteds.baseNode.parentNode.className;
// clasSelected = clasSelected.replace("mytext focus-visible","");
// clasSelected = clasSelected.replace("stop-propagation","");
// array_class_selected = clasSelected.split(/[ ,]+/);
// array_css_selected = cssSelected.split(";");
// $(this).contents().unwrap();
// var selection=window.getSelection().getRangeAt(0);
// var selectedText=selection.extractContents();
// if (selectedText != "") {
// var span=document.createElement("span");
// span.classList.add("my-class");
// span.appendChild(selectedText);
// selection.insertNode(span);
console.log(cssSelected);
if (selectedText !="") {
// var span = document.createElement('b');
if (selecteds.rangeCount) {
if ( clasSelected == "") {
$('.sb').replaceWith(function() {
return selectedText;
});
var range = selecteds.getRangeAt(0);
var span=document.createElement("span");
span.classList.add("sb");
// nodes.addClass("editing");
range.surroundContents(span);
selecteds.removeAllRanges();
// selecteds.replaceWith(range);
selecteds.addRange(range);
var parent = selecteds.anchorNode.parentNode.className;
}else{
var range = selecteds.getRangeAt(0);
var span=document.createElement("span");
span.classList.add("sb");
// selection.insertNode(span);"<span>zfezfqefez</span>".replace(/(<([^>]+)>)/gi, "")
// console.log(htmlEls);
// htmlEls.remove();
// if (selectedText !="") {
// // var span = document.createElement('b');
// if (selecteds.rangeCount) {
// if ( clasSelected == "") {
// $('.sb').replaceWith(function() {
// return selectedText;
// });
// var range = selecteds.getRangeAt(0);
// var span=document.createElement("span");
// span.classList.add("sb");
// span.classList.add("sb-s");
// // nodes.addClass("editing");
// range.surroundContents(span);
// selecteds.removeAllRanges();
// // selecteds.replaceWith(range);
// selecteds.addRange(range);
// var parent = selecteds.anchorNode.parentNode.className;
// }else{
// var range = selecteds.getRangeAt(0);
// var span=document.createElement("span");
// span.classList.add("sb");
// for (var i = 0, length = array_class_selected.length; i < length; i++) {
span.style.cssText = cssSelected;
// }
for (var i = 0, length = array_class_selected.length; i < length; i++) {
span.classList.add(array_class_selected[i]);
}
// // for (var i = 0, length = array_class_selected.length; i < length; i++) {
// span.style.cssText = cssSelected;
// // }
// for (var i = 0, length = array_class_selected.length; i < length; i++) {
// span.classList.add(array_class_selected[i]);
// }
// nodes.addClass("editing");
range.surroundContents(span);
selecteds.removeAllRanges();
// selecteds.replaceWith(range);
selecteds.addRange(range);
var parent = selecteds.anchorNode.parentNode.className;
$('.'+array_class_selected[0]).replaceWith(function() {
return $('span', this);
});
}
}
// // nodes.addClass("editing");
// range.surroundContents(span);
// selecteds.removeAllRanges();
// // selecteds.replaceWith(range);
// selecteds.addRange(range);
// var parent = selecteds.anchorNode.parentNode.className;