ninegate
Some checks failed
Cadoles/nineskeletor/pipeline/head There was a failure building this commit

This commit is contained in:
2023-01-12 16:14:31 +01:00
parent f5d1995040
commit cdf7c5a24c
72 changed files with 10635 additions and 1013 deletions

View File

@ -0,0 +1,334 @@
{% extends '@CadolesCore/base.html.twig' %}
{% set color = app.session.get('color') %}
{% set colormain = color['main'] %}
{% block pagewrapper %}
<div id="pagecontainer" style="margin: 0px -30px;"></div>
<div id="gridtemplate" style="max-width:1500px; margin:auto; margin-bottom:30px">
<div class="col-md-3">qsdfqsdfqsd</div>
<div class="col-md-9">
{% if bookmarks is not empty %}
<div class="bookmark-container">
{% if items is not empty %}
<h3 class="grid-title" data-idcategory="bookmark" style="{{ colorbodyfont }}">Favoris</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% for bookmark in bookmarks %}
<div class="grid-item grid-small">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
{% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url }}')">
{% elseif bookmark.target == "_self" %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{% if access=="user" %}_top{% else %}{{ bookmark.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{{ bookmark.target }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if bookmark.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ bookmark.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ bookmark.title }}</h2>
<span>{{ bookmark.subtitle|nl2br }}</<span>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
{% else %}
<div class="bookmark-container" style="display:none">
<h3 class="grid-title" data-idcategory="bookmark"">Favoris</h3>
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
</div>
</div>
{% endif %}
{% set mycategs = [] %}
{% for itemcategory in itemcategorys %}
{% set haveitem=false %}
{% for item in items if item.itemcategory==itemcategory %}
{% if loop.index ==1 %}
{% set mycategs = mycategs|merge({ (loop.index) : itemcategory}) %}
{% endif %}
{% endfor %}
{% endfor %}
{% for itemcategory in mycategs %}
{% set haveitem=false %}
{% for item in items if item.itemcategory==itemcategory %}
{% if loop.index ==1 %}
{% set haveitem=true %}
{% if mycategs|length > 1 or bookmarks is not empty %}
<h3 class="grid-title" data-idcategory="{{ itemcategory.id }}">{{ itemcategory.label }}</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
<div class="grid-item grid-small" data-idcategory="{{ item.itemcategory.id }}" data-iditem="{{ item.id }}">
<div class="grid-item-content" style="background-color: {{ item.color ? "#"~item.color : '#'~colormain }};">
{% if item.content %}
<a style="cursor:pointer" class="item-preview"><i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i></a>
{% endif %}
{% if item.protected and not app.user %}
{% if mode_auth == "SAML" %}
<a href="{{ path('lightsaml_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "CAS" %}
<a href="{{ path('cas_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "MYSQL" %}
<a href="{{ path('cnous_portal_user_login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% endif %}
{% else %}
{% if item.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ item.title }}" style="cursor:pointer" onClick="showFrameitem({{ item.id }},'{{ item.url }}')">
{% elseif item.target == "_self" %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{% if access=="user" %}_top{% else %}{{ item.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{{ item.target }}">
{% endif %}
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if item.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ item.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ item.title }}</h2>
<span>{{ item.subtitle|nl2br }}</<span>
</div>
</div>
</a>
<div class="grid-item-body" style="display:none">
{{ item.content|raw }}
</div>
</div>
</div>
{% endfor %}
{% if haveitem %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endblock %}
{% block localjavascript %}
$('document').ready(function(){
// Ajustement des frames
$(window).resize(function() {
AjustFrame();
});
// Création des grilles d'items
var optiongrid={columnWidth: '.grid-sizer', itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
$('body').imagesLoaded(function() {
var grid = $('.grid').masonry(optiongrid);
});
// Preview item de bureau
$( ".grid .item-preview" ).click(function() {
if($(this).parent().children(".grid-item-body").css('display') == 'none') {
$(this).html('<i style="color: #FFF" class="fa fa-minus" title="Informations sur ce service"></i>');
heightbody=$(this).parent().children(".grid-item-body").height()+30;
heightitem=$(this).parent().parent().height();
$(this).parent().children(".grid-item-body").show();
$(this).parent().parent().css("width","100%");
$(this).parent().parent().css("height",heightitem+heightbody);
$(this).parent().children(".grid-item-content").css("height",heightitem+heightbody);
$(this).parent().children(".item-preview").css("height",heightitem+heightbody);
var grid = $('.grid').masonry(optiongrid);
}
else {
$(this).html('<i style="color: #FFF" class="fa fa-plus" title="Informations sur ce service"></i>');
$(this).parent().children(".grid-item-body").hide();
$(this).parent().parent().css("width","");
$(this).parent().parent().css("height","");
$(this).parent().children(".grid-item-content").css("height","");
$(this).parent().children(".item-preview").css("height","");
var grid = $('.grid').masonry(optiongrid);
}
});
// Sur click item à sonder
{% if activate_widsonde %}
$( ".linktosonde" ).click(function() {
title=$(this).attr("data-sonde");
//$.getScript( "{{ widsonde_url }}?appli="+title );
});
{% endif %}
});
// Ajout d'un bookmark
function addBookmark(idwidget,touser) {
var url="{{ path('cadoles_portal_user_bookmark_submit',{idpage:0,idwidget:'xx',touser:'yy'})}}";
url=url.replace('xx',idwidget);
url=url.replace('yy',touser);
$(location).attr('href', url);
}
// Modifciation d'un bookmark
function modBookmark(idbookmark) {
var url="{{ path('cadoles_portal_user_bookmark_update',{idpage:0,id:'xx'})}}";
url=url.replace('xx',idbookmark);
$(location).attr('href', url);
}
// Ajouter un item aux bookmark
function heartBookmark(iditem) {
var idbookmark;
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_user_bookmark_heart') }}",
data: {
iditem:iditem
},
success: function(idbookmark) {
location.reload();
}
});
}
// Supprimer un fichier
function delFile(directory,filename) {
var r = confirm("Confirmez-vous la suppression de ce fichier ?");
if (r == true) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_core_user_file_delete') }}",
data: {
directory:directory,
filename:filename
},
success: function() {
location.reload();
}
});
}
}
// Ajustement des frames
function AjustFrame() {
$('.frameajust').iframeAutoHeight({
minHeight: 500, // Sets the iframe height to this value if the calculated value is less
heightOffset: 0, // Optionally add some buffer to the bottom
callback: function(callbackObject) { $(this).parent().css("height",callbackObject.newFrameHeight) ;}
});
if($(".frameitem").length>0) {
var heightbody = $('html').height();
var heightheader = $('.header').height();
if($('.pagemenu').css("display")=="none")
var heightmenu = 0;
else
var heightmenu = $('.pagemenu').height();
var heightframe = heightbody-heightheader-heightmenu;
$(".frameitem").height(heightframe);
}
}
// Affichage d'un Flux
function showFlux(idwidget, id) {
if(id=="all")
$(".widget[data-id="+idwidget+"]").find(".feed").show();
else {
$(".widget[data-id="+idwidget+"]").find(".feed").hide();
$(".widget[data-id="+idwidget+"]").find(".flux-"+id).show();
}
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'};
var grid = $('.grid').masonry(optiongrid);
}
// Affichage des frames associés aux items de bureau
function resizeFrame() {
var iFrame = document.getElementById('frameContent');
var heightbody = $('html').height();
var heightheader = $('.header').height();
if($('#appmenu').css("display")=="none")
var heightmenu = 0;
else
var heightmenu = $('#appmenu').height();
var heightframe = heightbody-heightheader-heightmenu;
$(".pageframe").each(function( index ) {
$(this).height(heightframe);
});
}
function showFrameitem(id,url,forcereload) {
$(".pageframe").hide();
// Si force le rechargement et frame existante on la détruit
if(forcereload&&$("#frameitem-"+id).length)
$("#frameitem-"+id).remove();
// Si la frame en cours existe déjà on l'affiche
if($("#frameitem-"+id).length)
$("#frameitem-"+id).show();
// Sinon on la génère
else
$("#pagecontainer").append("<iframe id='frameitem-"+id+"' class='pageframe' src='"+url+"' style='border:none; width:100%'></iframe>");
resizeFrame();
}
{% endblock %}

View File

@ -0,0 +1,141 @@
{% extends 'base.html.twig' %}
{% block localstyle %}
.thumbnail {
text-align:center;
}
.thumbnail img {
width:200px;
border: 5px solid #fff;
border-radius: 10px;
}
.caption p {
text-align:justify;
font-size:14px;
word-wrap: break-word;
}
.caption ul {
margin-top:-10px;
padding-left: 20px;
}
.caption li {
text-align:left;
font-size:14px;
word-wrap: break-word;
font-style: italic;
}
h3 {
margin-top:10px;
}
{% endblock %}
{% block body %}
<div style="width: 400px;margin: auto;text-align: center;margin-top: 10px;">
<a href="{{ path("app_home") }}">
<img src="/{{ appAlias }}/uploads/logo/{{app.session.get("logolight")}}" style="max-width: 100%; max-height:200px;">
<h1 style="text-transform:uppercase; padding-top:0px">{{ app.session.get('appname') }}</h1>
</a>
<br>
{% if not app.user and moderegistration!="none" and appMasteridentity=="SQL"%}
<a href="{{ path("app_resetpwd01") }}">Mot de passe oublié ?</a>
{% endif %}
</div>
<div class="container row m-auto">
<div class="col-lg-3">
<div class="thumbnail" style="margin-top:10px; border:none; background-color:transparent">
<img class="imgreflect" src="/{{ appAlias }}/images/thumb-01.jpg"/>
<div class="caption">
<h3 style="text-align:center">Portail<br>Profilé</h3>
<p>Tous les éléments du portail peuvent être distribués en fonction du profil de l'utilisateur.</p>
<p>Il est possible de définir le profil de l'utilisateur en fonction :
<ul>
<li>De son groupe d'appartenance</li>
<li>D'attributs Annuaire</li>
<li>D'attributs SSO</li>
</ul>
</p>
<p>En fonction du profil de l'utilisateur, il est possible de distribuer :
<ul>
<li>Des pages en onglet</li>
<li>Des Flux RSS</li>
<li>Des Annonces</li>
<li>Des Applications Web</li>
<li>Des Calendriers</li>
</ul>
</p>
</div>
</div>
</div>
<div class="col-lg-3">
<div class="thumbnail" style="margin-top:10px; border:none; background-color:transparent">
<img class="imgreflect" src="/{{ appAlias }}/images/thumb-02.jpg"/>
<div class="caption">
<h3 style="text-align:center">Portail<br>Personnalisable</h3>
<p>En fonction de la configuration et de leur profil, les utilisateurs du portail sont libres de créer leur propre page.</p>
<p>Les pages de l'utilisateur pouvant prendre plusieurs formes :
<ul>
<li>Une page pointant sur l'adresse d'un autre site</li>
<li>Une page construite par l'utilisateur via l'utilisation d'un éditeur riche</li>
<li>Une page constituée de widgets qu'il dispose selon son libre choix</li>
</ul>
</p>
</div>
</div>
</div>
<div class="col-lg-3">
<div class="thumbnail" style="margin-top:10px; border:none; background-color:transparent">
<img class="imgreflect" src="/{{ appAlias }}/images/thumb-03.jpg"/>
<div class="caption">
<h3 style="text-align:center">Portail<br>Evolutif</h3>
<p>Ninegate est évolutif dans le sens où, vous disposerez d'une large bibliothèque de widgets qui composeront vos pages.</p>
<p>Voici quelques exemples :
<ul>
<li>Widget URL</li>
<li>Widget Flux RSS</li>
<li>Widget Editeur de texte</li>
<li>Widget Gestionnaire de tâches</li>
<li>Widget Calendriers</li>
<li>Widget Favoris</li>
<li>Widget Dépôt de Fichiers</li>
<li>Et bien d'autres encore</li>
</ul>
</div>
</div>
</div>
<div class="col-lg-3">
<div class="thumbnail" style="margin-top:10px; border:none; background-color:transparent">
<img class="imgreflect" src="/{{ appAlias }}/images/thumb-04.jpg"/>
<div class="caption">
<h3 style="text-align:center">Portail</br>Open Source</h3>
<p>Ce projet est opensource
<ul>
<li>Vous pouvez à tout moment modifier le code de votre portail</li>
<li>Distribuer {{ app.session.get('appname') }}</li>
</ul>
</p>
<p>Ninegate est développé dans le cadre du projet <a href='https://envole.ac-dijon.fr/ninegate/' target='_blank'>Envole</a>. Vous pourrez trouver le code source de Ninegate sur la <a href='https://dev-eole.ac-dijon.fr/projects/eole-eportail' target='_blank'>forge du projet</a></p>
<p>Ninegate est propulsé par la société <a href='https://cadoles.com' target='_blank'>Cadoles</a></p>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,89 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1 class="page-header">
Gestion des Pages
</h1>
<a href="{{ path('app_config_page_submit') }}" class="btn btn-success">Ajouter une Page</a>
<div class="custom-control custom-switch float-right">
<input id="alluser" type="checkbox" class="custom-control-input">
<label id="labelalluser" class="custom-control-label" for="alluser">Afficher les pages créées par des utilisateurs</label>
</div>
<br><br>
<div class="card">
<div class="card-header">
<i class="fa fa-table fa-fw"></i> Liste des Pages
</div>
<div class="card-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
<thead>
<tr>
<th width="140px" class="no-sort">Action</th>
<th>Ordre</th>
<th>Nom</th>
<th class="no-sort">Catégorie</th>
<th>Propriétaire</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
{% if not app.session.get('alluserpage') is empty %}
var state={{ app.session.get('alluserpage') }};
if(state) {
$("#labelalluser").html("Afficher les pages non liées à un utilisateur");
$("#alluser").attr('checked', true);
}
{% endif %}
table = $('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 1, "asc" ]],
processing: true,
serverSide: true,
ajax: {
"url": "{{ path('app_config_page_ajax_list') }}",
"data": function ( d ) {
return $.extend( {}, d, {
"alluser": $('#alluser').is(':checked')
});
}
},
drawCallback: function(settings) {
$("a[data-method='delete']").click(function(){
if( !confirm('Êtes-vous sûr de vouloir supprimer cette page ?')) {
return false;
}
});
}
});
});
$('#alluser').change(function() {
if (typeof table !== 'undefined') {
table.ajax.reload();
}
var check = $('#alluser').is(':checked');
if(check)
$("#labelalluser").html("Afficher les pages non liées à un utilisateur");
else
$("#labelalluser").html("Afficher les pages créées par des utilisateurs");
});
{% endblock %}

View File

@ -0,0 +1,109 @@
{% if not inmenu %}
<ul class="list-group" id="listgrouppage">
{% for groupshared in groupsshared %}
{% for page in groupshared.pagesshared %}
{% set forcereload=true %}
{% if page.pagecategory.id==1 %}
{% set forcereload=page.toreload %}
{% endif %}
{% set isactive="" %}
{% if entity.id is defined and page.id==entity.id %}
{% set isactive="active" %}
{% endif %}
<li id="menupage-{{page.id}}" {{ isactive }} class="list-group-item {{isactive}}" onClick="$('#listgrouppage li').removeClass('active'); $(this).addClass('active') " style="cursor:pointer">
<a data-group="{{groupshared.id}}" onClick="$('#selgrouppages').modal('hide'); showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group','{{forcereload}}','{{groupshared.id}}','{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>
{% else %}
<i class="fa fa-users fa-fw"></i>
{% endif %}
&nbsp;{{ page.name }}
{% if loop.first and page.counterread > 0 %}
<span id="badge-{{groupshared.id}}" class="badge">{{page.counterread}}</span>
{% endif %}
</a>
{% if loop.first and groupshared.pagesshared|length > 1 %}
<ul class="list-group" style="margin-top:15px">
{% endif %}
{% if groupshared.pagesshared|length > 1 and loop.last %}
</ul>
{% endif %}
{% if loop.last %}
</li>
{% endif %}
{% endfor %}
{% endfor %}
</ul>
{% else %}
{% for groupshared in groupsshared %}
{% if groupshared.pagesshared|length == 1 %}
{% set page = groupshared.pagesshared[0] %}
{% set forcereload=true %}
{% if page.pagecategory.id==1 %}
{% set forcereload=page.toreload %}
{% endif %}
{% set isactive="" %}
{% if entity.id is defined and page.id==entity.id %}
{% set isactive="class='active'" %}
{% endif %}
<li id="menupage-{{page.id}}" {{ isactive }} style="cursor:pointer">
<a data-group="{{groupshared.id}}" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group','{{forcereload}}','{{groupshared.id}}','{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>
{% else %}
<i class="fa fa-users fa-fw"></i>
{% endif %}
&nbsp;{{ groupshared.label }}
{% if page.counterread > 0 %}
<span id="badge-{{groupshared.id}}" class="badge">{{page.counterread}}</span>
{% endif %}
</a>
</li>
{% else %}
<ul id="pagesshared" class="nav navbar-top-links navbar-left">
<li class="dropdown">
<a data-group="{{groupshared.id}}" href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-users fa-fw"></i>
&nbsp;{{ groupshared.label }}
<span class="caret"></span>
{% if groupshared.pagesshared[0].counterread > 0 %}
<span id="badge-{{groupshared.id}}" class="badge">{{groupshared.pagesshared[0].counterread}}</span>
{% endif %}
</a>
<ul class="dropdown-menu">
{% for page in groupshared.pagesshared %}
{% set forcereload=true %}
{% if page.pagecategory.id==1 %}
{% set forcereload=page.toreload %}
{% endif %}
{% set isactive="" %}
{% if entity.id is defined and page.id==entity.id %}
{% set isactive="class='active'" %}
{% endif %}
<li id="menupage-{{page.id}}" {{isactive}} style="cursor:pointer">
<a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group','{{forcereload}}','{{groupshared.id}}','{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>
{% endif %}
{{ page.name }}
</a>
</li>
{% endfor %}
</ul>
</li>
</ul>
{% endif %}
{% endfor %}
{% endif %}

View File

@ -0,0 +1,334 @@
{% extends '@CadolesCore/base.html.twig' %}
{% set color = app.session.get('color') %}
{% set colormain = color['main'] %}
{% block pagewrapper %}
<div id="pagecontainer" style="margin: 0px -30px;"></div>
<div id="gridtemplate" style="max-width:1500px; margin:auto; margin-bottom:30px">
<div class="col-md-3">qsdfqsdfqsd</div>
<div class="col-md-9">
{% if bookmarks is not empty %}
<div class="bookmark-container">
{% if items is not empty %}
<h3 class="grid-title" data-idcategory="bookmark" style="{{ colorbodyfont }}">Favoris</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% for bookmark in bookmarks %}
<div class="grid-item grid-small">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
{% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url }}')">
{% elseif bookmark.target == "_self" %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{% if access=="user" %}_top{% else %}{{ bookmark.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{{ bookmark.target }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if bookmark.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ bookmark.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ bookmark.title }}</h2>
<span>{{ bookmark.subtitle|nl2br }}</<span>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
{% else %}
<div class="bookmark-container" style="display:none">
<h3 class="grid-title" data-idcategory="bookmark"">Favoris</h3>
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
</div>
</div>
{% endif %}
{% set mycategs = [] %}
{% for itemcategory in itemcategorys %}
{% set haveitem=false %}
{% for item in items if item.itemcategory==itemcategory %}
{% if loop.index ==1 %}
{% set mycategs = mycategs|merge({ (loop.index) : itemcategory}) %}
{% endif %}
{% endfor %}
{% endfor %}
{% for itemcategory in mycategs %}
{% set haveitem=false %}
{% for item in items if item.itemcategory==itemcategory %}
{% if loop.index ==1 %}
{% set haveitem=true %}
{% if mycategs|length > 1 or bookmarks is not empty %}
<h3 class="grid-title" data-idcategory="{{ itemcategory.id }}">{{ itemcategory.label }}</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
<div class="grid-item grid-small" data-idcategory="{{ item.itemcategory.id }}" data-iditem="{{ item.id }}">
<div class="grid-item-content" style="background-color: {{ item.color ? "#"~item.color : '#'~colormain }};">
{% if item.content %}
<a style="cursor:pointer" class="item-preview"><i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i></a>
{% endif %}
{% if item.protected and not app.user %}
{% if mode_auth == "SAML" %}
<a href="{{ path('lightsaml_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "CAS" %}
<a href="{{ path('cas_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "MYSQL" %}
<a href="{{ path('cnous_portal_user_login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% endif %}
{% else %}
{% if item.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ item.title }}" style="cursor:pointer" onClick="showFrameitem({{ item.id }},'{{ item.url }}')">
{% elseif item.target == "_self" %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{% if access=="user" %}_top{% else %}{{ item.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{{ item.target }}">
{% endif %}
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if item.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ item.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ item.title }}</h2>
<span>{{ item.subtitle|nl2br }}</<span>
</div>
</div>
</a>
<div class="grid-item-body" style="display:none">
{{ item.content|raw }}
</div>
</div>
</div>
{% endfor %}
{% if haveitem %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endblock %}
{% block localjavascript %}
$('document').ready(function(){
// Ajustement des frames
$(window).resize(function() {
AjustFrame();
});
// Création des grilles d'items
var optiongrid={columnWidth: '.grid-sizer', itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
$('body').imagesLoaded(function() {
var grid = $('.grid').masonry(optiongrid);
});
// Preview item de bureau
$( ".grid .item-preview" ).click(function() {
if($(this).parent().children(".grid-item-body").css('display') == 'none') {
$(this).html('<i style="color: #FFF" class="fa fa-minus" title="Informations sur ce service"></i>');
heightbody=$(this).parent().children(".grid-item-body").height()+30;
heightitem=$(this).parent().parent().height();
$(this).parent().children(".grid-item-body").show();
$(this).parent().parent().css("width","100%");
$(this).parent().parent().css("height",heightitem+heightbody);
$(this).parent().children(".grid-item-content").css("height",heightitem+heightbody);
$(this).parent().children(".item-preview").css("height",heightitem+heightbody);
var grid = $('.grid').masonry(optiongrid);
}
else {
$(this).html('<i style="color: #FFF" class="fa fa-plus" title="Informations sur ce service"></i>');
$(this).parent().children(".grid-item-body").hide();
$(this).parent().parent().css("width","");
$(this).parent().parent().css("height","");
$(this).parent().children(".grid-item-content").css("height","");
$(this).parent().children(".item-preview").css("height","");
var grid = $('.grid').masonry(optiongrid);
}
});
// Sur click item à sonder
{% if activate_widsonde %}
$( ".linktosonde" ).click(function() {
title=$(this).attr("data-sonde");
//$.getScript( "{{ widsonde_url }}?appli="+title );
});
{% endif %}
});
// Ajout d'un bookmark
function addBookmark(idwidget,touser) {
var url="{{ path('cadoles_portal_user_bookmark_submit',{idpage:0,idwidget:'xx',touser:'yy'})}}";
url=url.replace('xx',idwidget);
url=url.replace('yy',touser);
$(location).attr('href', url);
}
// Modifciation d'un bookmark
function modBookmark(idbookmark) {
var url="{{ path('cadoles_portal_user_bookmark_update',{idpage:0,id:'xx'})}}";
url=url.replace('xx',idbookmark);
$(location).attr('href', url);
}
// Ajouter un item aux bookmark
function heartBookmark(iditem) {
var idbookmark;
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_user_bookmark_heart') }}",
data: {
iditem:iditem
},
success: function(idbookmark) {
location.reload();
}
});
}
// Supprimer un fichier
function delFile(directory,filename) {
var r = confirm("Confirmez-vous la suppression de ce fichier ?");
if (r == true) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_core_user_file_delete') }}",
data: {
directory:directory,
filename:filename
},
success: function() {
location.reload();
}
});
}
}
// Ajustement des frames
function AjustFrame() {
$('.frameajust').iframeAutoHeight({
minHeight: 500, // Sets the iframe height to this value if the calculated value is less
heightOffset: 0, // Optionally add some buffer to the bottom
callback: function(callbackObject) { $(this).parent().css("height",callbackObject.newFrameHeight) ;}
});
if($(".frameitem").length>0) {
var heightbody = $('html').height();
var heightheader = $('.header').height();
if($('.pagemenu').css("display")=="none")
var heightmenu = 0;
else
var heightmenu = $('.pagemenu').height();
var heightframe = heightbody-heightheader-heightmenu;
$(".frameitem").height(heightframe);
}
}
// Affichage d'un Flux
function showFlux(idwidget, id) {
if(id=="all")
$(".widget[data-id="+idwidget+"]").find(".feed").show();
else {
$(".widget[data-id="+idwidget+"]").find(".feed").hide();
$(".widget[data-id="+idwidget+"]").find(".flux-"+id).show();
}
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'};
var grid = $('.grid').masonry(optiongrid);
}
// Affichage des frames associés aux items de bureau
function resizeFrame() {
var iFrame = document.getElementById('frameContent');
var heightbody = $('html').height();
var heightheader = $('.header').height();
if($('#appmenu').css("display")=="none")
var heightmenu = 0;
else
var heightmenu = $('#appmenu').height();
var heightframe = heightbody-heightheader-heightmenu;
$(".pageframe").each(function( index ) {
$(this).height(heightframe);
});
}
function showFrameitem(id,url,forcereload) {
$(".pageframe").hide();
// Si force le rechargement et frame existante on la détruit
if(forcereload&&$("#frameitem-"+id).length)
$("#frameitem-"+id).remove();
// Si la frame en cours existe déjà on l'affiche
if($("#frameitem-"+id).length)
$("#frameitem-"+id).show();
// Sinon on la génère
else
$("#pagecontainer").append("<iframe id='frameitem-"+id+"' class='pageframe' src='"+url+"' style='border:none; width:100%'></iframe>");
resizeFrame();
}
{% endblock %}

View File

@ -0,0 +1,571 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block localstyle %}
body{overflow-y:hidden}
{% endblock %}
{% block appmenu %}
<ul class="nav navbar-top-links navbar-left">
{% for page in pagesadmin %}
{% set forcereload=true %}
{% if page.pagecategory.id==1 %}
{% set forcereload=page.toreload %}
{% endif %}
{% set usage="portal" %}
{% if loop.first %} {% set usage="accueil" %} {%endif %}
{% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer">
<a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','{{usage}}','{{forcereload}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>&nbsp;
{% endif %}
{{ page.name }}
</a>
</li>
{% else %}
<li id="menupage-{{page.id}}">
<a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','portal','{{forcereload}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>&nbsp;
{% endif %}
{{ page.name }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
<ul id="pagesuser" class="nav navbar-top-links navbar-left">
{% for page in pagesuser %}
{% set forcereload=true %}
{% if page.pagecategory.id==1 %}
{% set forcereload=page.toreload %}
{% endif %}
{% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer">
<a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','user','{{forcereload}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>
{% else %}
<i class="fa fa-user fa-fw"></i>
{% endif %}
&nbsp;{{ page.name }}
</a>
</li>
{% else %}
<li id="menupage-{{page.id}}">
<a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','user','{{forcereload}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>
{% else %}
<i class="fa fa-user fa-fw"></i>
{% endif %}
&nbsp;{{ page.name }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
<ul id="pagesgroup" class="nav navbar-top-links navbar-left">
<!-- On regroupe l'ensemble des pages si plus de x groupes -->
{% set nbgroupregrouped=5 %}
{% if groupsshared|length > nbgroupregrouped %}
<ul id="pagesshared" class="nav navbar-top-links navbar-left">
<li>
<a id="menugrouppages" style='cursor:pointer' data-toggle='modal' data-target='#selgrouppages'>
<i class="fa fa-users fa-fw"></i>&nbsp;Mes Groupes
<span class="caret"></span>
</a>
</li>
</ul>
{%else%}
{% set inmenu=true %}
{{ include('@CadolesPortal/Page/menugroupe.html.twig') }}
{% endif %}
</ul>
<div id="menupageaction">
<a id="menuname" style="cursor:pointer;font-size:80%" href=""></a>
{% if canadd %}
<a id="menusubmit" style="cursor:pointer" onclick="submitPage()" title='Ajouter une page'><i class='fa fa-plus fa-fw'></i></a>
{% endif %}
<a id="menuupdate" style="cursor:pointer;display:none" onclick="updatePage()" title='Modifier une page'><i class='fa fa-file fa-fw'></i></a>
<a id="menushare" style="cursor:pointer;display:none" onclick="sharePage()" title='Partager une page'><i class='fa fa-share-alt fa-fw'></i></a>
<a id="menudelete" style="cursor:pointer;display:none" onclick="deletePage()" title='Supprimer une page'><i class='fa fa-trash fa-fw'></i></a>
<a id="menubookmark" style="cursor:pointer;display:none" onclick="bookmarkPage()" title="Faire de cette page votre page d'accueil"><i class='fa fa-heart fa-fw'></i></a>
<a id="menuwidgetuser" style='cursor:pointer;display:none' data-toggle='modal' data-target='#selwidgetuser' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a>
<a id="menuwidgetgroup" style='cursor:pointer;display:none' data-toggle='modal' data-target='#selwidgetgroup' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a>
</div>
{% endblock %}
{% block pagewrapper %}
<div id="pagecontainer" style="margin: 0px -30px;"></div>
{% if activate_widonlyoffice %}
<iframe src="{{ widonlyoffice_url }}/sso/login" style="display:none"></iframe>
{% endif %}
{% set nbgroupregrouped=5 %}
{% if groupsshared|length > nbgroupregrouped %}
<div id="selgrouppages" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">MES GROUPES</h4>
</div>
<div class="modal-body">
<a onclick="$('#selgrouppages').modal('hide');" class="btn btn-default" style="margin-bottom:15px">
Annuler
</a>
{% set inmenu=false %}
{{ include('@CadolesPortal/Page/menugroupe.html.twig') }}
</div>
</div>
</div>
</div>
{%endif%}
<div id="selwidgetuser" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">SELECTIONNER UN WIDGET</h4>
</div>
<div class="modal-body">
<div class="form-group row clearfix">
<div class="col-md-12" style="margin-bottom:15px">
<a onclick="$('#selwidgetuser').modal('hide');" class="btn btn-default">
Annuler
</a>
</div>
<div class="dataTable_wrapper col-md-12">
<table id="dataTables" class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th width="100px">#</th>
<th>Nom</th>
<th class="no-sort">Description</th>
</tr>
</thead>
<tbody>
{% for widget in widgetsuser %}
<tr>
<td>
<a onClick="selWidget({{ widget.id }})" style="cursor:pointer;">
<img id="widgettype-{{ widget.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ widget.icon.label }}" style="padding:2px">
</a>
</td>
<td>{{ widget.name }}</td>
<td>{{ widget.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="selwidgetgroup" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">SELECTIONNER UN WIDGET</h4>
</div>
<div class="modal-body">
<div class="form-group row clearfix">
<div class="col-md-12" style="margin-bottom:15px">
<a onclick="$('#selwidgetgroup').modal('hide');" class="btn btn-default">
Annuler
</a>
</div>
<div class="dataTable_wrapper col-md-12">
<table id="dataTables" class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th width="100px">#</th>
<th>Nom</th>
<th class="no-sort">Description</th>
</tr>
</thead>
<tbody>
{% for widget in widgetsgroup %}
<tr>
<td>
<a onClick="selWidget({{ widget.id }})" style="cursor:pointer;">
<img id="widgettype-{{ widget.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ widget.icon.label }}" style="padding:2px">
</a>
</td>
<td>{{ widget.name }}</td>
<td>{{ widget.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
{%if app.user %}
<a id="refreshcounter" data-event=""></a>
{% endif %}
{% endblock %}
{% block localexternalscript %}
{% if app.user %}
<script src="/{{alias}}/bundles/goswebsocket/js/vendor/autobahn.min.js"></script>
<script src="/{{alias}}/bundles/goswebsocket/js/gos_web_socket_client.js"></script>
{% endif %}
{% endblock %}
{% block localjavascript %}
var idpage;
pagebookmark="{{app.session.get("pagebookmark")}}";
$('document').ready(function(){
{% if gotoroute is empty %}
{% for page in pagesadmin %}
{% if page.id==entity.id %}
{% set usage="portal" %}
{% if loop.first %} {% set usage="accueil" %} {%endif %}
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','{{usage}}',false,null,'{{page.name}}');
{% endif %}
{% endfor %}
{% for page in pagesuser %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','user',false,null,'{{page.name}}');
{% endif %}
{% endfor %}
{% for groupshared in groupsshared %}
{% for page in groupshared.pagesshared %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','group',true,{{groupshared.id}},'{{page.name}}');
{% endif %}
{% endfor %}
{% endfor %}
{% else %}
var url="{{ path(gotoroute,{id:gotoid}) }}";
showGoto(url);
{% endif %}
// Rendre les pages user déplacable
$("#pagesuser").sortable({
axis: "x",
forcePlaceholderSize: true,
placeholder: "placeholder",
update: function( event, ui ) {
$('#pagesuser li').each(function(order) {
var idpage=$(this).attr('id').replace("menupage-","");
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_'~access~'_page_order') }}",
data: {
id:idpage,
order:order
}
});
});
}
});
// Initialisation du tableau des widgets selectionnable à la création
$('.table').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false }, { "targets": 0, "className": "text-center" } ],
responsive: true,
iDisplayLength: 10,
order: [[ 1, "asc" ]],
});
{% if app.user and app.session.get("timerefreshnotif") > 0%}
setInterval(function(){
loadmsgCounter()
}, {{(app.session.get("timerefreshnotif")*1000)}});
{% endif %}
});
$(window).resize(function() {
resizeFrame();
});
function resizeFrame() {
var iFrame = document.getElementById('frameContent');
var heightbody = $('html').height();
if($('.header').length)
var heightheader = $('.header').height();
else
var heightheader = $('.navbarsmall').height();
if($('#appmenu').css("display")=="none")
var heightmenu = 0;
else
var heightmenu = $('#appmenu').height();
var heightframe = heightbody-heightheader-heightmenu;
$(".pageframe").each(function( index ) {
$(this).height(heightframe);
});
}
// Affichage des frames associés aux items de bureau
function showFrameitem(id,url,forcereload) {
$(".pageframereload").remove();
$(".pageframe").hide();
// Si force le rechargement et frame existante on la détruit
if(forcereload&&$("#frameitem-"+id).length)
$("#frameitem-"+id).remove();
// Si la frame en cours existe déjà on l'affiche
if($("#frameitem-"+id).length)
$("#frameitem-"+id).show();
// Sinon on la génère
else {
var myclass="";
if(forcereload) myclass="pageframereload";
$("#pagecontainer").append("<iframe onload='this.contentWindow.focus()' id='frameitem-"+id+"' class='pageframe "+myclass+"' src='"+url+"' style='border:none; width:100%'></iframe>");
}
resizeFrame();
}
// Affichages des pages
function showPage(id,catid,canupdate,usage,forcereload,groupid,pagename) {
// Sauvegarder la page en cours
idpage=id;
// Cacher toutes les pages
$(".pageframereload").remove();
$(".pageframe").hide();
// Rendre actif le page en cours dans le menu
$(".navbar-top-links li").removeClass("active");
$(".dropdown-toggle").removeClass("dropdownactive");
$("#menupage-"+id).addClass("active");
$('a[data-group="'+groupid+'"][data-toggle="dropdown"]').addClass("dropdownactive");;
var url="{{ path('cadoles_portal_user_page_view',{id:'xx',usage:'yy','group':'zz'}) }}";
url=url.replace('xx',id);
url=url.replace('yy',usage);
url=url.replace('zz',groupid);
passurl="{{ path('cadoles_core_home',{id:'xx'}) }}";
passurl=passurl.replace('xx',id);
history.pushState('data to be passed', 'Title of the page', passurl);
// Si force le rechargement et frame existante on la détruit
if(forcereload&&$("#page-"+id).length)
$("#page-"+id).remove();
// Si la frame en cours existe déjà on l'affiche
if($("#page-"+id).length)
$("#page-"+id).show();
// Sinon on la génère
else {
var myclass="";
if(forcereload) myclass="pageframereload";
$("#pagecontainer").append("<iframe onload='this.contentWindow.focus()' id='page-"+id+"' data-category='"+catid+"' class='pageframe "+myclass+"' src='"+url+"' style='border:none; width:100%'></iframe>");
}
// Détruire le badge associé car normalement de fait on a lu les notif
if(usage=="group") {
$("#badge-"+groupid).remove()
}
// Nom de la page
console.log(pagename);
$("#menuname").html(pagename);
// Cacher les actions possibles sur la page
$("#menuupdate").hide();
$("#menushare").hide();
$("#menudelete").hide();
$("#menubookmark").hide();
$("#menuwidgetuser").hide();
$("#menuwidgetgroup").hide();
if(canupdate) {
$("#menuupdate").show();
$("#menushare").show();
$("#menudelete").show();
}
{% if app.user %}
if(id==pagebookmark) {
$("#menubookmark").css("color","red");
$("#menubookmark").attr("title","Ne plus faire de cette page votre page d'accueil")
}
else {
$("#menubookmark").css("color","");
$("#menubookmark").attr("title","Faire de cette page votre page d'accueil")
}
$("#menubookmark").show();
{% endif %}
// Si page de type widget on affiche la selection des widgets à insérer
if($("#page-"+id).data('category')==2&&canupdate) {
if(usage=="user") $("#menuwidgetuser").show();
if(usage=="group") $("#menuwidgetgroup").show();
}
// On resize les frame
resizeFrame();
// Mettre le focus dans la frame
//$("#page-"+id).contentWindow.focus();
}
// Affichages des pages
function showGoto(url) {
$("#pagecontainer").append("<iframe onload='this.contentWindow.focus()' id='goto' class='pageframe pageframereload' src='"+url+"' style='border:none; width:100%'></iframe>");
// On resize les frame
resizeFrame();
}
function submitPage() {
var url="{{ path('cadoles_portal_'~access~'_page_submit') }}";
$(location).attr('href',url);
}
function updatePage() {
if($("#page-"+idpage).length) {
var url="{{ path('cadoles_portal_'~access~'_page_update',{id:'xx'}) }}";
url=url.replace('xx',idpage);
$(location).attr('href',url);
}
}
function sharePage() {
if($("#page-"+idpage).length) {
var url="{{ path('cadoles_portal_'~access~'_page_share',{id:'xx'}) }}";
url=url.replace('xx',idpage);
$(location).attr('href',url);
}
}
function deletePage() {
if($("#page-"+idpage).length) {
if (confirm('Êtes-vous sûr de vouloir supprimer ?')) {
var url="{{ path('cadoles_portal_'~access~'_page_delete',{id:'xx'}) }}";
url=url.replace('xx',idpage);
$(location).attr('href',url);
}
}
}
function bookmarkPage() {
{% if app.user %}
if($("#page-"+idpage).length) {
if(pagebookmark==idpage)
confirmtext="Votre page d'accueil redevient l'accueil général de {{ app.session.get("appname") }}.";
else
confirmtext="Cette page sera votre page d'acueil à l'ouverture de {{ app.session.get("appname") }}, vous pourrez à tout moment changer de page d'accueil.";
if (confirm(confirmtext)) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_core_user_preference') }}",
data: {
id:0,
key:'pagebookmark',
value: idpage
},
success: function() {
if(pagebookmark==idpage) {
pagebookmark="";
$("#menubookmark").css("color","");
$("#menubookmark").attr("title","Faire de cette page votre page d'accueil")
}
else {
pagebookmark=idpage;
$("#menubookmark").css("color","red");
$("#menubookmark").attr("title","Ne plus faire de cette page votre page d'accueil")
}
}
});
}
}
{% endif %}
}
// Création d'un widget selectionné
function selWidget(idwidgettype) {
var url="{{ path('cadoles_portal_user_pagewidget_widget_sumbit',{idpage:'yy',idwidgettype:'xx'})}}";
url=url.replace('xx',idwidgettype);
url=url.replace('yy',idpage);
$(location).attr('href', url);
};
function loadmsgCounter() {
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_user_page_ajax_msgcounter') }}",
success: function(data) {
$.each(data, function(group, counter) {
menu=$("a[data-group='"+group+"']");
if(menu.length) {
if(menu.children(".badge").length) {
if(counter==0)
menu.remove();
else
menu.children(".badge").html(counter);
}
else if(counter>0)
menu.append("<span id='badge-"+group+"' class='badge'>"+counter+"</span");
}
});
}
});
}
{% endblock %}

View File

@ -0,0 +1,46 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1>
Partage Page
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_row(form.groups) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,86 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1>
Nouvelle Page
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page') }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home') }}">Annuler</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_row(form.name) }}
{{ form_row(form.pagecategory) }}
{{ form_row(form.usage) }}
{% if form.user is defined %}
{{ form_row(form.user) }}
{% endif %}
<div id="pagegroup">{{ form_row(form.page) }}</div>
<div id="groupworkgroup">{{ form_row(form.groups) }}</div>
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
{{ form_row(form.maxwidth) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
$('document').ready(function(){
hideshow();
});
$(document.body).on("change","#page_submit_pagecategory",function(){
hideshow();
});
$(document.body).on("change","#page_submit_usage",function(){
hideshow();
});
function hideshow() {
if($("#page_submit_pagecategory").val()==2)
$("#pagegroup").show();
else {
$("#pagegroup").hide();
}
if($("#page_submit_usage").val()=="group")
$("#groupworkgroup").show();
else {
$("#groupworkgroup").hide();
}
}
{% endblock %}

View File

@ -0,0 +1,72 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Page Editeur = {{entity.name}}
{% elseif mode=="submit" %}
Création Page Editeur
{% endif %}
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a>
{% endif %}
{% if mode=="update" %}
<a href={{ path('cadoles_portal_'~access~'_page_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette page ?">
Supprimer
</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
{% else %}
<div class="col-md-12">
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
{{ form_row(form.maxwidth) }}
{{ form_row(form.html) }}
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
{% endif %}
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,66 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
Modification Page {{ entity.pagecategory.name}} = {{entity.name}}
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a>
{% endif %}
{% if mode=="update" %}
<a href={{ path('cadoles_portal_'~access~'_page_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette page ?">
Supprimer
</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
{% else %}
<div class="col-md-12">
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
{% endif %}
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,76 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Page URL = {{entity.name}}
{% elseif mode=="submit" %}
Création Page URL
{% endif %}
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a>
{% endif %}
{% if mode=="update" %}
<a href={{ path('cadoles_portal_'~access~'_page_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette page ?">
Supprimer
</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
{% else %}
<div class="col-md-12">
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.url) }}
<em>le mot clé #login# sera remplacé par le login de l'utilisateur</em><br>
<em>Attention certains sites n'acceptent pas d'être encapsulés dans une frame.<br><br></em>
{{ form_row(form.toreload) }}
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
{{ form_row(form.maxwidth) }}
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
{% endif %}
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,543 @@
{% extends 'base.html.twig' %}
{% block localstyle %}
<style>
#gridtemplate {
border: 1px solid #cdcdcd;
padding:20px;
margin: 0px;
}
#gridtemplate .row {
height: 500px;
border: 1px solid #cdcdcd;
margin: 0px 0px 20px 0px;
background-color: #c8f7c5;
}
#gridtemplate .rowcontainer {
float:left;
width:90%;
height:80%;
}
#gridtemplate .rowcontainer .row {height:33.333333333333333%; margin:0px}
#gridtemplate .rowcontainer .maxright, #gridtemplate .rowcontainer .maxleft {height:90% !important; width:20% !important; }
#gridtemplate .rowcontainer .rowcontainer {width:60% !important;}
#gridtemplate .rowcontainer .addRow {display:none;}
#gridtemplate .rowcontainer .colcontainer {padding:5px;}
#gridtemplate .addRow {
width: 100%;
height: 10%;
padding: 2px;
max-height: 30px
}
#gridtemplate .delRow {
height:100%;
width: 5%;
background-color: #e74c3c;
color: #fff;
text-align:center;
float: left;
cursor: pointer;
}
#gridtemplate .delRow i {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
#gridtemplate .colcontainer {
width:90%;
height:100% !important;
float:left;
padding:15px;
}
#gridtemplate .colcontainer .col {
border: 1px solid #cdcdcd;
height:100%;
padding: 0px;
background-color:#fff;
}
#gridtemplate .addCol {
height:100%;
width: 5%;
background-color: #2c3e50;
color: #fff;
text-align:center;
float: right;
cursor: pointer;
}
#gridtemplate .addCol i {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
#gridtemplate .colcontainer .col .delCol {
height:10%;
width: 100%;
background-color: #e74c3c;
color: #fff;
text-align:center;
float: right;
cursor: pointer;
}
#gridtemplate .colcontainer .col .delCol i {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
#gridtemplate .colcontainer .col .maxleft {
height:80%;
width: 5%;
background-color: #2c3e50;
color: #fff;
text-align:center;
float: left;
cursor: pointer;
}
#gridtemplate .colcontainer .col .maxleft i {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
#gridtemplate .colcontainer .col .maxright {
height:80%;
width: 5%;
background-color: #2c3e50;
color: #fff;
text-align:center;
float: right;
cursor: pointer;
}
#gridtemplate .colcontainer .col .maxright i {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
</style>
{% endblock %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Page Widget = {{page.name}}
{% elseif mode=="updatetemplate" %}
Modification Modèle de Page = {{page.name}}
{% elseif mode=="submit" %}
Création Page Widget
{% endif %}
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
{% if mode=="updatetemplate" %}
<a class="btn btn-secondary" href="{{ path('app_config_pagetemplate_view',{id:page.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-secondary" href="{{ path('app_config_page_view',{id:page.id}) }}">Annuler</a>
{% endif %}
{% else %}
<a class="btn btn-secondary" href="{{ path('app_home',{id:page.id}) }}">Annuler</a>
{% endif %}
{% if mode=="update" %}
<a href={{ path('app_'~access~'_page_delete',{'id':page.id}) }}
class="btn btn-danger float-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette page ?">
Supprimer
</a>
{% endif %}
{% if mode=="updatetemplate" %}
<a href={{ path('app_'~access~'_pagetemplate_delete',{'id':page.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer ce modèle ?">
Supprimer
</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
{% else %}
<div class="col-md-12">
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
{{ form_row(form.maxwidth) }}
{{ form_row(form.template) }}
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
{% endif %}
</div>
<h3>Template de Mise en Page</h3>
<div id="gridtemplate">
</div>
{{ form_end(form) }}
{% endblock %}
{% block localscript %}
<script>
var defcol = [];
defcol[1] = ["col-12"];
defcol[2] = ["col-6","col-6"];
defcol[3] = ["col-4","col-4","col-4"];
defcol[4] = ["col-3","col-3","col-3","col-3"];
defcol[5] = ["col-4","col-2","col-2","col-2","col-2"];
defcol[6] = ["col-2","col-2","col-2","col-2","col-2","col-2"];
var defaultcol = ""
defaultcol+="<div class='delCol'>";
defaultcol+="<i class='fa fa-trash'></i>";
defaultcol+="</div>";
defaultcol+="<div class='maxleft'>";
defaultcol+="<i class='fa fa-chevron-left'></i>";
defaultcol+="</div>";
defaultcol+="<div class='rowcontainer'>";
defaultcol+="</div>";
defaultcol+="<div class='maxright'>";
defaultcol+="<i class='fa fa-chevron-right'></i>";
defaultcol+="</div>";
defaultcol+="<a class='addRow btn btn-info'>Ajouter une Ligne</a>";
$('document').ready(function(){
// Template de base
if($(page_update_widget_template).val()=="") {
myrow ="<div class='row'>";
myrow+="<div class='delRow'><i class='fa fa-trash'></i></div>";
myrow+="<div class='row colcontainer'>";
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="</div>"
myrow+="<div class='addCol'><i class='fa fa-plus'></i></div>";
myrow+="</div>"
$("#gridtemplate").append(myrow);
}
// Interprétation du template sauvegardé
else {
var json = jQuery.parseJSON($(page_update_widget_template).val());
var mygrid="";
$.each(json.rows, function( index, rownv01 ) {
mygrid+="<div class='row'>";
mygrid+="<div class='delRow'><i class='fa fa-trash'></i></div>";
mygrid+="<div class='row colcontainer'>";
$.each(rownv01.cols, function( index, colnv01 ) {
mygrid+="<div class='col col-"+colnv01.size+"'>";
mygrid+="<div class='delCol'>";
mygrid+="<i class='fa fa-trash'></i>";
mygrid+="</div>";
mygrid+="<div class='maxleft'>";
mygrid+="<i class='fa fa-chevron-left'></i>";
mygrid+="</div>";
mygrid+="<div class='rowcontainer'>";
$.each(colnv01.rows, function( index, rownv02 ) {
mygrid+="<div class='row'>";
mygrid+="<div class='delRow'><i class='fa fa-trash'></i></div>";
mygrid+="<div class='row colcontainer'>";
$.each(rownv02.cols, function( index, colnv02 ) {
mygrid+="<div class='col col-"+colnv02.size+"'>"+defaultcol+"</div>";
});
mygrid+="</div>";
mygrid+="<div class='addCol'><i class='fa fa-plus'></i></div>";
mygrid+="</div>";
});
mygrid+="</div>";
mygrid+="<div class='maxright'>";
mygrid+="<i class='fa fa-chevron-right'></i>";
mygrid+="</div>";
mygrid+="<a class='addRow btn btn-info'>Ajouter une Ligne</a>";
mygrid+="</div>";
});
mygrid+="</div>";
mygrid+="<div class='addCol'><i class='fa fa-plus'></i></div>";
mygrid+="</div>";
});
$("#gridtemplate").append(mygrid);
}
$("#gridtemplate").append("<a class='addRow btn btn-info'>Ajouter une Ligne</a>");
// Ajout d'une ligne
$(document).on('click','.addRow', function(event){
lastrow=$(this).parent().children('.row').last();
parentid=$(this).parent().attr("id");
if(parentid=="gridtemplate") {
nbrow=$(this).parent().children('.row').length;
nbmax=5;
}
else {
nbrow=$(this).parent().children(".rowcontainer").children('.row').length;
nbmax=4;
}
nbrow++;
if(nbrow==nbmax)
alert("Vous ne pouvez pas insérer plus de "+(nbmax-1)+" lignes");
else {
myrow ="<div class='row'>";
myrow+="<div class='delRow'><i class='fa fa-trash'></i></div>";
myrow+="<div class='row colcontainer'>";
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="</div>"
myrow+="<div class='addCol'><i class='fa fa-plus'></i></div>";
myrow+="</div>"
if(lastrow.length)
lastrow.after(myrow);
else
$(this).parent().children(".rowcontainer").append(myrow);
}
});
// Suppression d'une ligne
$(document).on('click','.delRow', function(event){
// On compte le nombre de row de ce niveau et on bloque s'il en reste plus qu'une et que l'on est sur le premier niveau de ligne
if($( this ).parent().parent().children(".row").length==1 && $( this ).parent().parent().attr("id")=="gridtemplate")
{
alert("Votre page doit avoir au minimum une ligne");
}
// Si ce n'est pas le cas on la supprime
else {
$( this ).parent().remove();
}
});
// Ajout d'une Colonne
$(document).on('click','.addCol', function(event){
// On récupère la ligne
row=$( this ).parent();
colcontainer=row.children(".colcontainer");
// On compte le nombre de colonne
nbcol=colcontainer.children(".col").length;
nbcol++;
if(nbcol>6) {
alert("Votre page ne peut avoir plus de 6 colonnes");
}
else {
// Pour chaque colonne on applique la répartition de taille en fonction du nombre de colonne total
colcontainer.children('.col').each(function( index ) {
$(this).removeClass();
$(this).attr("class","col "+defcol[nbcol][index]);
});
// On ajoute une colonne après la derniere colonne de la ligne
lastcol=colcontainer.children('.col').last();
lastcol.after("<div class='col "+defcol[nbcol][nbcol-1]+"'>"+defaultcol+"</div>");
}
});
// Suppression d'une Colonne
$(document).on('click','.delCol', function(event){
// On récupère la colonne
col=$( this ).parent();
colcontainer=col.parent();
// On compte le nombre de colonne
nbcol=colcontainer.children(".col").length;
nbcol--;
if(nbcol<1) {
alert("Au minimum 1 colonne");
}
else {
// On détruit la colonne
col.remove();
// Pour chaque colonne on applique la répartition de taille en fonction du nombre de colonne total
colcontainer.children('.col').each(function( index ) {
$(this).removeClass();
$(this).attr("class","col "+defcol[nbcol][index]);
});
}
});
// Agrandissement colonne sur la droite
$(document).on('click','.maxright', function(event){
// On récupère la colonne
col=$( this ).parent();
colcontainer=col.parent();
// On recherche la colonne suivante
colnext=col.next();
if(colnext.length) {
// uniquement si taille de la colonne suivant n'est pas col-1
if(colnext.attr("class")!="col col-1") {
// On récupére la taille de la colonne suivante et en cours
taillenext=parseInt(colnext.attr("class").replace("col-","").replace("col ",""));
taille=parseInt(col.attr("class").replace("col-","").replace("col ",""));
// On applique la nouvelle taille à la colonne en cours
col.removeClass();
col.attr("class","col col-"+(taille+1));
// On applique la nouvelle taille à la colonne suivante
colnext.removeClass();
colnext.attr("class","col col-"+(taillenext-1));
}
}
});
// Agrandissement colonne sur la gauche
$(document).on('click','.maxleft', function(event){
console.log("here");
// On récupère la colonne
col=$( this ).parent();
colcontainer=col.parent();
// On recherche la colonne suivante
colprev=col.prev();
if(colprev.length) {
// uniquement si taille de la colonne précédente n'est pas col-1
if(colprev.attr("class")!="col col-1") {
console.log(colprev.attr("class"));
// On récupére la taille de la colonne précédente et en cours
tailleprev=parseInt(colprev.attr("class").replace("col-","").replace("col ",""));
taille=parseInt(col.attr("class").replace("col-","").replace("col ",""));
console.log(taille);
// On applique la nouvelle taille à la colonne en cours
col.removeClass();
col.attr("class","col col-"+(taille+1));
// On applique la nouvelle taille à la colonne suivante
colprev.removeClass();
colprev.attr("class","col col-"+(tailleprev-1));
}
}
});
// Sur validation formulaire
$( "form" ).submit(function( event ) {
//event.preventDefault();
template='{"rows":[';
// Pour chaque ligne de niveau 01 de la grille
nbrownv01=$("#gridtemplate").children('.row').length;
$("#gridtemplate").children('.row').each(function( index ) {
template+='{';
template+='"id":'+index+',';
// Pour chaque colonne de la ligne de niveau 01
nbcolnv01=$(this).children('.colcontainer').children('.col').length;
template+='"cols":[';
$(this).children('.colcontainer').children('.col').each(function( index ) {
template+='{';
template+='"id":'+index+',';
template+='"size": '+parseInt($(this).attr("class").replace("col-","").replace("col ",""))+',';
// Pour chaque ligne de niveau 02
template+='"rows":[';
nbrownv02=$(this).children('.rowcontainer').children('.row').length;
$(this).children('.rowcontainer').children('.row').each(function( index ) {
template+='{';
template+='"id":'+index+',';
nbcolnv02=$(this).children('.colcontainer').children('.col').length;
template+='"cols":[';
$(this).children('.colcontainer').children('.col').each(function( index ) {
template+='{';
template+='"id":'+index+',';
template+='"size": '+parseInt($(this).attr("class").replace("col-","").replace("col ",""));
template+='}';
if(index+1<nbcolnv02) template+=',';
});
template+=']';
template+='}';
if(index+1<nbrownv02) template+=',';
});
template+=']';
template+='}';
if(index+1<nbcolnv01) template+=',';
});
template+=']';
template+='}';
if(index+1<nbrownv01) template+=',';
});
template+=']}';
$("#page_update_widget_template").val(template);
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,23 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{% if access=="config" %}
<div class="pagemenu">
<a href="{{ path('cadoles_portal_config_page_view', {id:entity.id})}}">{{ entity.name }}</a>
<a href='{{ path('cadoles_portal_config_page_update', {id:entity.id}) }}' title='Modifier la page'><i class='fa fa-cog fa-fw'></i></a>
<a href='{{ path('cadoles_portal_config_page_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer la page'><i class='fa fa-trash fa-fw'></i></a>
</div>
{% endif %}
<div style="{% if entity.maxwidth>0%} max-width:{{ entity.maxwidth }}px; margin:auto; {% else %} margin: 30px 0px; {% endif %}">
{{ entity.html | raw }}
</div>
{% endblock %}
{% block localjavascript %}
$('document').ready(function(){
});
{% endblock %}

View File

@ -0,0 +1,59 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block localstyle %}
#pageiframe { margin: 0px -30px;}
{% endblock %}
{% if app.user %}
{% set username = app.user.username %}
{% else %}
{% set username = "" %}
{% endif %}
{% block pagewrapper %}
{% if access=="config" %}
<div class="pagemenu">
<a href="{{ path('cadoles_portal_config_page_view', {id:entity.id})}}">{{ entity.name }}</a>
<a href='{{ path('cadoles_portal_config_page_update', {id:entity.id}) }}' title='Modifier la page'><i class='fa fa-cog fa-fw'></i></a>
<a href='{{ path('cadoles_portal_config_page_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer la page'><i class='fa fa-trash fa-fw'></i></a>
</div>
{% endif %}
<div id="pageiframe" style="{% if entity.maxwidth>0%} max-width:{{ entity.maxwidth }}px; margin:auto; {% endif %}">
<iframe onload='this.contentWindow.focus()' src="{{entity.url|replace({'#login#': username})}}" id="frameContent" style="border:none;" width="100%" height="100%"></iframe>
</div>
{% endblock %}
{% block localjavascript %}
$(window).resize(function() {
resizeFrame();
});
$('document').ready(function(){
resizeFrame();
});
function resizeFrame() {
$("body").css("overflow-y","hidden");
$(".col-md-10").css("padding","0");
var iFrame = document.getElementById('frameContent');
var heightbody = $('html').height();
var heightheader = $('.header').height();
if($('.pagemenu').css("display")=="none")
var heightmenu = 0;
else
var heightmenu = $('.pagemenu').height();
var heightframe = heightbody-heightheader-heightmenu;
if($("#frameContent").length>0) {
$("#frameContent").height(heightframe);
}
}
{% endblock %}

View File

@ -0,0 +1,563 @@
{% extends 'base.html.twig' %}
{% block localstyle %}
{% if look=="list" %}
#R1C1:first-child {
margin-top: 30px;
}
.widget-mini .logo {
background-color: {{app.session.get('colorbgbodydark')}};
padding: 3px;
border-radius: 100%;
}
{% endif %}
{% endblock %}
{% block menuuser %}
{% if access=="admin" %}
{% set template="" %}
{% if mode=="viewtemplate" %}
{% set template="template" %}
{% endif %}
<li><a href="{{ path('app_'~access~'_page'~template~'_view', {id:page.id})}}">{{ page.name }}</a></li>
<li><a href='{{ path('app_'~access~'_page'~template~'_update', {id:page.id}) }}' title='Modifier la page'><i class='fa fa-cog fa-fw'></i></a></li>
<li><a href='{{ path('app_'~access~'_page'~template~'_delete', { id: page.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer la page'><i class='fa fa-trash fa-fw'></i></a></li>
<li><a class="btn-modal" style='cursor:pointer' data-modalid='selwidget' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a></li>
{% endif %}
{% endblock %}
{% block body %}
<div id="widget-container" style="{% if page.maxwidth>0%} max-width:{{ page.maxwidth }}px; margin:auto; {% endif %}">
</div>
<div id="tolocalize" style="display:none">
{% for pagewidget in page.pagewidgets %}
<a href="{{ url(pagewidget.widget.routeview|replace({'_admin_':'_'~access~'_'}),{id:pagewidget.id,by:mode,usage:usage,group:group,look:look,selwidget:selwidget}) }}"></a>
{{ render(url(pagewidget.widget.routeview|replace({'_admin_':'_'~access~'_'}),{id:pagewidget.id,by:mode,usage:usage,group:group,look:look,selwidget:selwidget})) }}
{% endfor %}
</div>
{% if access!="all" %}
<div id="selwidget" class="modal fade" role="dialog">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div id="mymodalheader" class="modal-header">
<h4 class="modal-title">SELECTIONNER UN WIDGET</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<a onclick="$('#selwidget').modal('hide');" class="btn btn-secondary mb-3">
Annuler
</a>
<table id="dataTables" class="table table-striped table-bordered table-hover" style="width:100%">
<thead>
<tr>
<th class="no-sort" width="80px"></th>
<th width="100px">Nom</th>
<th class="no-sort" width="500px">Description</th>
</tr>
</thead>
<tbody>
{% for widget in widgets %}
<tr>
<td>
<a onClick="selWidget({{ widget.id }})" style="cursor:pointer;">
<img id="widgettype-{{ widget.id }}" class="grid-item-img" height="40" src="{{path('app_minio_image',{file:widget.icon.label}) }}" style="padding:2px">
</a>
</td>
<td>{{ widget.name }}</td>
<td>{{ widget.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}
{% block localscript %}
<script>
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
$('document').ready(function(){
// Initialisation du tableau des widgets selectionnable à la création
$('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false }, { "targets": 0, "className": "text-center" } ],
iDisplayLength: 10,
order: [[ 1, "asc" ]],
//responsive: false,
scrollX: false,
});
// Ajustement des frames
$(window).resize(function() {
AjustFrame();
});
// Création de la grille des widgets
var template = '{{ page.template | raw }}';
// Template de base
if(template=="") {
myrow ="<div>";
myrow+="<div class='row colcontainer no-gutters'>";
myrow+="<div id='R1C1' class='col col-lg-4'></div>"
myrow+="<div id='R1C2' class='col col-lg-4'></div>"
myrow+="<div id='R1C3' class='col col-lg-4'></div>"
myrow+="</div>"
$("#widget-container").append(myrow);
}
// Interprétation du template sauvegardé
else {
var json = jQuery.parseJSON(template);
var mygrid="";
var row01=0;
$.each(json.rows, function( index, rownv01 ) {
row01++;
col01=0;
mygrid+="<div>";
mygrid+="<div class='row colcontainer no-gutters'>";
$.each(rownv01.cols, function( index, colnv01 ) {
col01++;
var row02=0;
mygrid+="<div id='R"+row01+"C"+col01+"' class='mycol col-lg-"+colnv01.size+"'>";
mygrid+="<div class='rowcontainer'>";
$.each(colnv01.rows, function( index, rownv02 ) {
row02++;
col02=0;
mygrid+="<div>";
mygrid+="<div class='row colcontainer no-gutters'>";
$.each(rownv02.cols, function( index, colnv02 ) {
col02++;
mygrid+="<div id='R"+row01+"C"+col01+"R"+row02+"C"+col02+"' class='mycol col-lg-"+colnv02.size+"'></div>";
});
mygrid+="</div>";
mygrid+="</div>";
});
mygrid+="</div>";
mygrid+="</div>";
});
mygrid+="</div>";
mygrid+="</div>";
});
$("#widget-container").append(mygrid);
}
// On déplace les widgets à leur emplacement
$("#tolocalize").children(".widget").each(function( element ) {
if($('#'+$(this).attr("loc")).length)
$(this).appendTo('#'+$(this).attr("loc"));
else
$(this).appendTo('#R1C1');
});
// On ajoute un widget vide à chaque colonne
$("#widget-container .col").each(function(element) {
$("<div class='widgetempty'>&nbsp;</div>").appendTo($(this));
});
{% if canupdate %}
// Mettre une taille mini de colonne sinon on ne pourra pas déplacer le widget dans la colonne
$(".colcontainer .col").css("min-height","80px");
// Cursor move sur les widgets header
//$(".widgetheader").css("cursor","move");
// Rendre les widgets déplacable
$("#widget-container .mycol").sortable({
connectWith: "#widget-container .mycol",
handle: '.widgetheader',
placeholder: "widget widgetplacehorder",
tolerance: "pointer",
cursor: "move",
opacity: 0.6,
start: function( event, ui ) {
ui.placeholder.css("height",ui.item.height());
$(".widgetbody").hide();
$(".colcontainer .mycol").css("border","1px solid #cdcdcd");
$(".colcontainer .mycol").css("padding-bottom","15px");
},
stop: function( event, ui ) {
$(".widgetbody").show();
$(".colcontainer .mycol").css("border","none");
$(".colcontainer .mycol").css("padding-bottom","");
// Création des grilles d'items
var grid = $('.grid').masonry(optiongrid);
},
update: updateLocalisation
});
{% endif %}
// Création des slick
//slick();
// Sur le click des titres de widgets ouvrir / fermer le widget
$( ".widgetheader .title" ).click(function() {
showhideWidget(this);
});
$( ".widgetheader .logo" ).click(function() {
showhideWidget(this);
});
// balise h des widget editor
$(".widget-editor .widgetbody :header").css("color",$(".widgetbody").css("color"));
// cacher le loader
$("#loader").hide();
});
// function slick
function slick() {
$('.slick').slick({
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
//autoplaySpeed: ($(this).data("interval")*1000),
dots: false,
touchMove: false,
pauseOnHover: false,
fade: true,
cssEase: 'linear',
prevArrow: '<button type="button" class="slick-prev"></button>',
nextArrow: '<button type="button" class="slick-next"></button>',
});
}
// Cacher afficher le menu des widgets
$(".widget").hover(function() {
if($(this).find(".widget-menu").length) {
$(this).find(".widget-menu").show();
}
});
$( ".widget" ).mouseleave(function() {
$(this).find(".widget-menu").hide();
});
function showhideWidget(elem) {
widget=$(elem).parent().parent();
idwidget= widget.data("id");
if(widget.children(".widgetbody").css("display")=='block')
value=false;
else
value=true;
{% if app.user %}
$.ajax({
method: "POST",
url: "{{ path('app_all_preference') }}",
data: {
id:idwidget,
key:'widgetshowhide',
value:value
},
success: function(idbookmark) {
// on récupère le parent widget conteneur
widget=$(elem).parent().parent();
//console.log(widget.children(".widgetbody").css("display"));
widget.children(".widgetbody" ).toggle();
// On recalcule les grilles
var grid = $('.grid').masonry(optiongrid);
}
});
{% endif %}
}
// Modification de la localisation d'un widget
function updateLocalisation() {
$('.colcontainer .mycol').each(function(index) {
var idloc=$(this).attr('id');
$(this).children(".widget").each(function(order){
var idwidget=$(this).data('id');
$.ajax({
method: "POST",
url: "{{ path('app_'~access~'_pagewidget_order') }}",
data: {
idwidget:idwidget,
order:order,
idloc:idloc
}
});
});
});
}
// Création d'un widget selectionné
function selWidget(idwidgettype) {
var url="{{ path('app_'~access~'_pagewidget_widget_sumbit',{idpage:page.id,idwidgettype:'xx','by':mode})}}";
url=url.replace('xx',idwidgettype);
$(location).attr('href', url);
};
// Modifciation d'un widget
function modWidget(idwidget) {
var url="{{ path('app_'~access~'_pagewidget_widget_update',{idpage:page.id,idwidget:'xx',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idwidget);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url);
}
// Suppression d'un widget
function delWidget(idwidget) {
var txt;
var r = confirm("ATTENTION\nConfirmez-vous la suppression de ce widget ?\n\nL'ensemble du contenu sera définitivement perdu !!");
if (r == true) {
url="{{ path('app_'~access~'_pagewidget_delete',{idwidget:'xx'}) }}";
url=url.replace('xx',idwidget);
$.ajax({
method: "POST",
url: url,
});
$(".widget[data-id="+idwidget+"]").remove();
}
}
// Changer widget
function changeWidget(idwidget,key,value) {
{% if app.user %}
if(key=="modedesktop") {
value=value+1;
if(value==5) value=0;
}
$.ajax({
method: "POST",
url: "{{ path('app_all_preference') }}",
data: {
id:idwidget,
key:key,
value:value
},
success: function() {
location.reload();
}
});
{% endif %}
}
// Ajout d'un bookmark
function addBookmark(idwidget,touser) {
var url="{{ path('app_'~access~'_bookmark_submit',{idpage:page.id,idwidget:'xx',touser:'yy',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idwidget);
url=url.replace('yy',touser);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url);
}
// Modifciation d'un bookmark
function modBookmark(idbookmark) {
var url="{{ path('app_'~access~'_bookmark_update',{idpage:page.id,id:'xx',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idbookmark);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url);
}
// Ajouter un item aux bookmark
function heartBookmark(iditem) {
var idbookmark;
$.ajax({
method: "POST",
url: "{{ path('app_all_bookmark_heart') }}",
data: {
iditem:iditem
},
success: function(idbookmark) {
location.reload();
}
});
}
// Supprimer un bookmark
function delBookmark(idbookmark) {
if (confirm('Êtes-vous sûr de vouloir supprimer cet item ?')) {
var url="{{ path('app_'~access~'_bookmark_delete',{idpage:page.id,id:'xx',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idbookmark);
url=url.replace(/&amp;/g,"&");
$.ajax({
method: "POST",
url: url,
success: function(idbookmark) {
location.reload();
}
});
}
}
// Supprimer un fichier
function delFile(directory,filename) {
var r = confirm("Confirmez-vous la suppression de ce fichier ?");
if (r == true) {
$.ajax({
method: "POST",
url: "{{ path('app_'~access~'_file_delete') }}",
data: {
directory:directory,
filename:filename
},
success: function() {
location.reload();
}
});
}
}
// Liste des slides
function listSlide(idwidget) {
var url="{{ path('app_'~access~'_slide_list',{idpage:page.id,idwidget:'xx',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idwidget);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url);
}
// Ajustement des frames
function AjustFrame() {
if($(".itemframe").length>0) {
$(".itemframe").css("height",$(window).height()-$(".header").height());
}
}
// Affichage des frames associés aux items de bureau
function showItemframe(id,url,forcereload) {
{% if access=="all" %}
window.parent.showItemframe(id,url,forcereload);
{% else %}
$("#page").hide();
$("body").css("overflow-y","hidden");
if($("#itemframe-"+id).length) {
if(forcereload) {
$("#itemframe-"+id).attr("src",url);
}
$("#itemframe-"+id).show();
}
else {
$("#page").before("<iframe id='itemframe-"+id+"' class='itemframe' src='"+url+"'></iframe>");
}
AjustFrame();
{% endif %}
}
// Affichage des items d'une catégorie
function showItemCat(idwidget, id) {
$(".widget[data-id="+idwidget+"]").find("#itemsearch").val("");
$(".widget[data-id="+idwidget+"]").find(".item").hide();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title").hide();
if(id=="all") {
$(".widget[data-id="+idwidget+"]").find(".item").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title").show();
}
else if(id=="fav") {
$(".widget[data-id="+idwidget+"]").find(".item[data-idcategory="+id+"]").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title[data-idcategory="+id+"]").show();
}
else {
$(".widget[data-id="+idwidget+"]").find(".item[data-idcategory="+id+"]").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title[data-idcategory="+id+"]").show();
}
}
// Affichage des items d'une catégorie
function searchItem(idwidget, label) {
$(".widget[data-id="+idwidget+"]").find(".bookmark-container").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-container").show();
if(label=="") {
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title").show();
$(".widget[data-id="+idwidget+"]").find(".item").show();
}
else {
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title").hide();
$(".widget[data-id="+idwidget+"]").find(".item").hide();
items=$(".widget[data-id="+idwidget+"]").find(".item[data-title*='"+label.toLowerCase()+"']");
if(items.length) {
items.show();
items.each(function() {
category=$(this).data("idcategory");
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title[data-idcategory="+category+"]").show();
});
}
}
}
// Place un message en lu
function hideMessage(id) {
$.ajax({
method: "POST",
url: "{{ path('app_all_message_see') }}",
data: {
id:id
},
success: function() {
$(".msg-"+id).remove();
var ele = $(".msg-hidden").first();
ele.show();
ele.removeClass("msg-hidden");
var grid = $('.grid').masonry(optiongrid);
}
});
}
// Place un message en lu
function hideAlert(id) {
$.ajax({
method: "POST",
url: "{{ path('app_all_alert_read') }}",
data: {
id:id
},
success: function() {
$("#alert-"+id).remove();
var grid = $('.grid').masonry(optiongrid);
}
});
}
</script>
{% endblock %}