ajout PJ et editeur riche sur evenement calendrier (ref #170)

This commit is contained in:
afornerot 2020-09-17 14:51:15 +02:00
parent 2da3128312
commit 5941260165
10 changed files with 299 additions and 59 deletions

View File

@ -130,6 +130,7 @@ class FileController extends Controller
public function uploadAction($id,$type,Request $request,$access="config")
{
$subdirectory=$request->get("subdirectory");
$forcereload=(is_null($request->get("forcereload"))?true:$request->get("forcereload"));
return $this->render('CadolesCoreBundle:File:upload.html.twig',[
'useheader' => false,
@ -139,6 +140,7 @@ class FileController extends Controller
'id' => $id,
'type' => $type,
'subdirectory' => $subdirectory,
'forcereload' => $forcereload,
]);
}
@ -363,6 +365,18 @@ class FileController extends Controller
$em->getRepository("CadolesPortalBundle:Project")->getPermission($user,$project,$cansee,$canupdate,$canadd);
if(!$cansee) throw $this->createNotFoundException('Permission denied');
break;
case "calendarevent":
// Récupération de l'event'
$calendarevent=$em->getRepository("CadolesPortalBundle:Calendarevent")->find($id);
if (!$calendarevent) throw $this->createNotFoundException('Unable to find entity.');
// On s'assure que l'utilisateur à la permission de voir
$calendar=$calendarevent->getCalendar();
$user=$this->getUser();
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($user,$calendar,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied');
break;
}
}
else $canupdate=true;

View File

@ -468,4 +468,3 @@
margin-left: -5px;
margin-right: -5px;
}
/*# sourceMappingURL=bootstrap-datepicker.css.map */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,12 @@
this.on("complete", function (file) {
completeFiles += 1;
if (completeFiles === totalFiles) {
parent.document.location.reload();
{% if forcereload %}
parent.document.location.reload();
{% else %}
parent.refreshPJ();
closeModal();
{% endif %}
}
});
},
@ -47,8 +52,8 @@
}
function closeModal() {
window.parent.$("#mymodal").removeClass("in");
window.parent.$(".modal-backdrop").remove();
//window.parent.$("#mymodal").removeClass("in");
//window.parent.$(".modal-backdrop").remove();
window.parent.$("#mymodal").modal('hide');
}

View File

@ -150,6 +150,12 @@
$("#page-wrapper").css("margin","0px");
$("#page-wrapper").css("border-left","none");
}
$(document).tooltip({
content: function () {
return $(this).prop('title');
}
});
});
// Cacher afficher le menu des widgets

View File

@ -5,6 +5,10 @@ namespace Cadoles\PortalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpFoundation\File\File;
use Doctrine\Common\Collections\ArrayCollection;
use Ramsey\Uuid\Uuid;
@ -64,6 +68,7 @@ class CalendareventController extends Controller
$tmp['allDay'] = $calendarevent->getAllday();
$tmp['calendar'] = $calendar->getId();
$tmp['editable'] = $calendarevent->getCalendar()->getCanupdate();
$tmp['files'] = $this->loadpj($tmp['id'] );
array_push($events,$tmp);
array_push($eventids,$tmp["id"]);
@ -90,6 +95,7 @@ class CalendareventController extends Controller
$tmp['allDay'] = $calendarevent->getAllday();
$tmp['calendar'] = $calendar->getId();
$tmp['editable'] = $calendarevent->getCalendar()->getCanupdate();
$tmp['files'] = $this->loadpj($tmp['id'] );
if(!in_array($tmp['id'],$eventids)) {
array_push($events,$tmp);
@ -286,4 +292,63 @@ class CalendareventController extends Controller
'form' => $form->createView(),
]);
}
public function loadpjAction(Request $request, $access="config") {
$id = $request->request->get('id');
$em = $this->getDoctrine()->getManager();
$calendarevent = $em->getRepository($this->labelentity)->find($id);
if (!$calendarevent) throw $this->createNotFoundException('Unable to find entity.');
$calendar=$calendarevent->getCalendar();
// On s'assure que l'utilisateur à la permission
if($access=="user") {
$em->getRepository("CadolesPortalBundle:Calendar")->getPermission($this->getUser(),$calendar,$cansee,$canupdate);
if(!$canupdate) throw $this->createNotFoundException('Permission denied');
}
$files = $this->loadpj($id);
$response = new Response(json_encode($files));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
private function loadpj($id) {
$directory=$this->get('kernel')->getRootDir()."/../uploads/file/calendarevent-".$id;
$files=[];
$fs = new Filesystem();
if($fs->exists($directory)) {
$finder = new Finder();
$finder->sortByName()->in($directory)->exclude('thumb')->exclude('thumbmini');
foreach ($finder as $file) {
$tmpfile=[];
$tmpfile["name"]=$file->getRelativePathname();
$tmpfile["extension"]=strtolower($file->getExtension());
$fileinfo = new file($file->getPathname());
$tmpfile["minetype"]=$fileinfo->getMimeType();
$tmpfile["minefamily"]=explode("/",$tmpfile["minetype"])[0];
$tmpfile["thumb"]="";
if($tmpfile["extension"]=="pdf") {
$tmpfile["thumb"]="/".$this->getParameter('alias')."/bundles/cadolescore/images/files/".$tmpfile["extension"].".png";
}
elseif($fs->exists($directory."/thumbmini/".$tmpfile["name"])) {
$data = file_get_contents($directory."/thumbmini/".$tmpfile["name"]);
$tmpfile["thumb"]="data:image/" . $tmpfile["extension"] . ";base64," . base64_encode($data);
}
elseif($fs->exists($directory."/thumb/".$tmpfile["name"])) {
$data = file_get_contents($directory."/thumb/".$tmpfile["name"]);
$tmpfile["thumb"]="data:image/" . $tmpfile["extension"] . ";base64," . base64_encode($data);
}
elseif($fs->exists($this->get('kernel')->getRootDir()."/../web/bundles/cadolescore/images/files/".$tmpfile["extension"].".png")) {
$tmpfile["thumb"]="/".$this->getParameter('alias')."/bundles/cadolescore/images/files/".$tmpfile["extension"].".png";
}
array_push($files,$tmpfile);
}
}
return $files;
}
}

View File

@ -689,6 +689,9 @@ cadoles_portal_config_calendarevent_share:
path: /config/calendarevent/share/{id}
defaults: { _controller: CadolesPortalBundle:Calendarevent:share, access: config }
cadoles_portal_config_calendarevent_loadpj:
path: /config/calendarevent/loadpj
defaults: { _controller: CadolesPortalBundle:Calendarevent:loadpj, access: config }
#-- Access user
cadoles_portal_user_calendarevent_load:
@ -711,6 +714,9 @@ cadoles_portal_user_calendarevent_share:
path: /user/calendarevent/share/{id}
defaults: { _controller: CadolesPortalBundle:Calendarevent:share, access: user }
cadoles_portal_user_calendarevent_loadpj:
path: /user/calendarevent/loadpj
defaults: { _controller: CadolesPortalBundle:Calendarevent:loadpj, access: user }
#== PROJECT =================================================================================================================================================

View File

@ -1,7 +1,6 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{% if access=="config" %}
<div class="pagemenu">
@ -57,14 +56,15 @@
<!-- CREATION EVENEMENT -->
<div id="mymodal-event-add" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<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">Evénement</h4>
<h4 class="modal-title">Création Evénement</h4>
</div>
<div class="modal-body">
<input id='vladd' name='vladd' class='btn btn-success' type='submit' onClick='submitEvent();' value='Valider' />
<input id='vladd' name='vladd' class='btn btn-success' type='submit' onClick='submitEvent(false);' value='Valider' />
<input id='vladdpj' name='vladdpj' class='btn btn-success' type='submit' onClick='submitEvent(true);' value='Valider & Ajouter des PJ' />
&nbsp;
<input class='btn btn-default' type='submit' value='Annuler' onClick='$("#mymodal-event-add").modal("hide");'>
<input name="calendar_id" id="calendar_id" type="hidden" class="form-control" placeholder="Nom">
@ -72,8 +72,8 @@
<fieldset class="fieldset form-horizontal" style="clear:both; margin-top:30px;">
<div class="form-group">
<label for="event_calendar" class="col-sm-5 control-label">Calendrier*</label>
<div class="col-sm-7">
<label for="event_calendar" class="col-sm-3 control-label">Calendrier*</label>
<div class="col-sm-9">
<select name="event_calendar" id="event_calendar" class="form-control">
{% if access=="config" %}
{% for calendar in calendars %}
@ -91,38 +91,38 @@
</div>
<div class="form-group">
<label for="event_title" class="col-sm-5 control-label">Titre*</label>
<div class="col-sm-7"><input name="event_title" id="event_title" type="titre" class="form-control focus" placeholder="Titre"></div>
<label for="event_title" class="col-sm-3 control-label">Titre*</label>
<div class="col-sm-9"><input name="event_title" id="event_title" type="titre" class="form-control focus" placeholder="Titre"></div>
</div>
<div class="form-group">
<label for="event_description" class="col-sm-5 control-label">Description</label>
<div class="col-sm-7"><textarea style="height:150px" name="event_description" id="event_description" type="titre" class="form-control focus" placeholder="Description"></textarea></div>
<label for="event_description" class="col-sm-3 control-label">Description</label>
<div class="col-sm-9"><textarea style="height:150px" name="event_description" id="event_description-add" type="titre" class="form-control focus" placeholder="Description"></textarea></div>
</div>
<div class="form-group">
<label for="event_allday" class="col-sm-5 control-label">Evènement sur la journée*</label>
<div class="col-sm-7"><input id="event_allday" name="event_allday" type="checkbox" class="switch" onChange="switchallDay('SUBMIT');"></div>
<label for="event_allday" class="col-sm-3 control-label">Evènement sur la journée*</label>
<div class="col-sm-9"><input id="event_allday" name="event_allday" type="checkbox" class="switch" onChange="switchallDay('SUBMIT');"></div>
</div>
<div class="form-group" id="form_event_start_time">
<label for="date" class="col-sm-5 control-label">Date Début*</label>
<div class="col-sm-7"><input name="event_start_time" id="event_start_time" type="titre" class="form-control" placeholder="Date Début" value=""></div>
<label for="date" class="col-sm-3 control-label">Date Début*</label>
<div class="col-sm-9"><input name="event_start_time" id="event_start_time" type="titre" class="form-control" placeholder="Date Début" value=""></div>
</div>
<div class="form-group" id="form_event_end_time">
<label for="date" class="col-sm-5 control-label">Date Fin*</label>
<div class="col-sm-7"><input name="event_end_time" id="event_end_time" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
<label for="date" class="col-sm-3 control-label">Date Fin*</label>
<div class="col-sm-9"><input name="event_end_time" id="event_end_time" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
</div>
<div class="form-group" id="form_event_start">
<label for="date" class="col-sm-5 control-label">Date Début*</label>
<div class="col-sm-7"><input name="event_start" id="event_start" type="titre" class="form-control" placeholder="Date Début" value=""></div>
<label for="date" class="col-sm-3 control-label">Date Début*</label>
<div class="col-sm-9"><input name="event_start" id="event_start" type="titre" class="form-control" placeholder="Date Début" value=""></div>
</div>
<div class="form-group" id="form_event_end">
<label for="date" class="col-sm-5 control-label">Date Fin*</label>
<div class="col-sm-7"><input name="event_end" id="event_end" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
<label for="date" class="col-sm-3 control-label">Date Fin*</label>
<div class="col-sm-9"><input name="event_end" id="event_end" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
</div>
</fieldset>
</div>
@ -133,7 +133,7 @@
<!-- UPDATE / DELETE EVENEMENT -->
<div id="mymodal-event-mod" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<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>
@ -151,8 +151,8 @@
<fieldset class="fieldset form-horizontal" style="clear:both; margin-top:30px;">
<div class="form-group">
<label for="event_calendar" class="col-sm-5 control-label">Calendrier*</label>
<div class="col-sm-7">
<label for="event_calendar" class="col-sm-3 control-label">Calendrier*</label>
<div class="col-sm-9">
<select name="event_calendar" id="event_calendar" class="form-control">
{% if access=="config" %}
{% for calendar in calendars %}
@ -170,41 +170,48 @@
</div>
<div class="form-group">
<label for="event_title" class="col-sm-5 control-label">Titre*</label>
<div class="col-sm-7"><input name="event_title" id="event_title" type="titre" class="form-control focus" placeholder="Titre"></div>
<label for="event_title" class="col-sm-3 control-label">Titre*</label>
<div class="col-sm-9"><input name="event_title" id="event_title" type="titre" class="form-control focus" placeholder="Titre"></div>
</div>
<div class="form-group">
<label for="event_description" class="col-sm-5 control-label">Description</label>
<div class="col-sm-7"><textarea style="height:150px" name="event_description" id="event_description" type="titre" class="form-control focus" placeholder="Description"></textarea></div>
</div>
<div class="form-group">
<label for="event_allday" class="col-sm-5 control-label">Evènement sur la journée*</label>
<div class="col-sm-7"><input id="event_allday" name="event_allday" type="checkbox" class="switch" onChange="switchallDay('UPDATE');"></div>
<label for="event_allday" class="col-sm-3 control-label">Evènement sur la journée*</label>
<div class="col-sm-9"><input id="event_allday" name="event_allday" type="checkbox" class="switch" onChange="switchallDay('UPDATE');"></div>
</div>
<div class="form-group" id="form_event_start_time">
<label for="date" class="col-sm-5 control-label">Date Début*</label>
<div class="col-sm-7"><input name="event_start_time" id="event_start_timem" type="titre" class="form-control" placeholder="Date Début" value=""></div>
<label for="date" class="col-sm-3 control-label">Date Début*</label>
<div class="col-sm-9"><input name="event_start_time" id="event_start_timem" type="titre" class="form-control" placeholder="Date Début" value=""></div>
</div>
<div class="form-group" id="form_event_end_time">
<label for="date" class="col-sm-5 control-label">Date Fin*</label>
<div class="col-sm-7"><input name="event_end_time" id="event_end_timem" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
<label for="date" class="col-sm-3 control-label">Date Fin*</label>
<div class="col-sm-9"><input name="event_end_time" id="event_end_timem" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
</div>
<div class="form-group" id="form_event_start">
<label for="date" class="col-sm-5 control-label">Date Début*</label>
<div class="col-sm-7"><input name="event_start" id="event_startm" type="titre" class="form-control" placeholder="Date Début" value=""></div>
<label for="date" class="col-sm-3 control-label">Date Début*</label>
<div class="col-sm-9"><input name="event_start" id="event_startm" type="titre" class="form-control" placeholder="Date Début" value=""></div>
</div>
<div class="form-group" id="form_event_end">
<label for="date" class="col-sm-5 control-label">Date Fin*</label>
<div class="col-sm-7"><input name="event_end" id="event_endm" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
<label for="date" class="col-sm-3 control-label">Date Fin*</label>
<div class="col-sm-9"><input name="event_end" id="event_endm" type="titre" class="form-control" placeholder="Date Fin" value=""></div>
</div>
<div class="form-group">
<div class="col-sm-12"><textarea style="height:150px" name="event_description" id="event_description-mod" type="titre" class="form-control focus" placeholder="Description"></textarea></div>
</div>
<div id="event_PJ"></div>
</fieldset>
</div>
<div class="modal-footer">
<input id='vldel' name='vldel' class='btn btn-danger' type='submit' onClick='deleteEvent();' value='Suppression' />
</div>
</div>
@ -212,8 +219,15 @@
</div>
{% endblock %}
{% block localexternalscript %}
<script type="text/javascript" src="/{{alias}}/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/{{alias}}/ckeditor/adapters/jquery.js"></script>
{% endblock %}
{% block localjavascript %}
var idcalendar;
var toaddPJ;
var toaddPJevent;
var defautView='month';
{% if app.user %}
@ -225,6 +239,17 @@
{% endif %}
$('document').ready(function(){
CKEDITOR.config.toolbar_Basic =
[
{ name: 'document', items : ['Bold','Italic','Underline','-', 'NumberedList','BulletedList','-', 'Link'] },
];
CKEDITOR.config.toolbar = 'Basic';
CKEDITOR.config.height = '100';
CKEDITOR.config.removePlugins = 'elementspath,save,font, resize';
CKEDITOR.replace( 'event_description-add' );
CKEDITOR.replace( 'event_description-mod' );
{% if entity.id is defined %}
{% for calendar in calendars %}
{% if calendar.id==entity.id %}
@ -289,7 +314,6 @@
$("#menudelete").hide();
if($("#menucalendar-"+id).data("open")) {
console.log($("#menucalendar-"+id).data("open"));
$("#menuupdate").show();
$("#menushare").show();
$("#menudelete").show();
@ -316,7 +340,7 @@
{% if app.user %}
var allDay = !start.hasTime() && !end.hasTime();
$("#mymodal-event-add #event_title").val("");
$("#mymodal-event-add #event_description").val("");
CKEDITOR.instances["event_description-add"].setData("")
$("#mymodal-event-add #event_start_time").val(moment(start).format("DD/MM/YYYY HH:mm"));
$("#mymodal-event-add #event_end_time").val(moment(end).format("DD/MM/YYYY HH:mm"));
$("#mymodal-event-add #event_start").val(moment(start).format("DD/MM/YYYY"));
@ -335,7 +359,7 @@
if(event.editable) {
$("#mymodal-event-mod #event_id").val(event.id);
$("#mymodal-event-mod #event_title").val(event.title);
$("#mymodal-event-mod #event_description").val(event.description);
CKEDITOR.instances["event_description-mod"].setData(event.description)
$("#mymodal-event-mod #event_start_timem").val(event.start.format("DD/MM/YYYY HH:mm"));
$("#mymodal-event-mod #event_end_timem").val(event.end.format("DD/MM/YYYY HH:mm"));
$("#mymodal-event-mod #event_startm").val(event.start.format("DD/MM/YYYY"));
@ -343,6 +367,9 @@
$("#mymodal-event-mod #event_allday").bootstrapSwitch('state', event.allDay);
$("#mymodal-event-mod #event_calendar option[value='"+event.calendar+"']").prop('selected', true);
refreshPJ();
switchallDay("UPDATE");
$('#mymodal-event-mod').modal('show');
}
@ -400,6 +427,7 @@
eventRender: function(event, element) {
element.attr('title', event.description);
element.find('.fc-content').attr("id", "event-" + event.id);
},
events:urltoload
@ -437,7 +465,7 @@
}
}
function submitEvent() {
function submitEvent(addPJ) {
$("#mymodal-event-add .alert").remove();
if($("#mymodal-event-add #event_title").val()=="") {
$("#mymodal-event-add fieldset").append("<div class='alert alert-danger' style='margin: 5px 0px'>Titre obligatoire</div>");
@ -475,32 +503,35 @@
url: "{{ path('cadoles_portal_'~access~'_calendarevent_submit') }}",
data: {
"title":$("#mymodal-event-add #event_title").val(),
"description":$("#mymodal-event-add #event_description").val(),
"description":CKEDITOR.instances["event_description-add"].getData(),
"start": dstart,
"end": dend,
"allday": $("#mymodal-event-add #event_allday").bootstrapSwitch('state'),
"idcalendar": $("#mymodal-event-add #event_calendar").val()
},
success: function(data) {
console.log(data.id);
// Ajout de l'event dans fullcalendar
$('#calendar').fullCalendar('renderEvent',
event = $('#calendar').fullCalendar('renderEvent',
{
id: data.id,
title: $("#mymodal-event-add #event_title").val(),
description: $("#mymodal-event-add #event_description").val(),
description: CKEDITOR.instances["event_description-add"].getData(),
start: start,
end: end,
editable: true,
color: data.color,
allDay: $("#mymodal-event-add #event_allday").bootstrapSwitch('state'),
calendar: $("#mymodal-event-add #event_calendar").val()
calendar: $("#mymodal-event-add #event_calendar").val(),
files: []
},
false // make the event "stick"
);
console.log(event);
$("#mymodal-event-add").modal("hide");
toaddPJ=addPJ;
toaddPJevent=data.id;
}
});
}
@ -546,7 +577,7 @@
data: {
"id": $("#mymodal-event-mod #event_id").val(),
"title":$("#mymodal-event-mod #event_title").val(),
"description":$("#mymodal-event-mod #event_description").val(),
"description":CKEDITOR.instances["event_description-mod"].getData(),
"start": dstart,
"end": dend,
"allday": $("#mymodal-event-mod #event_allday").bootstrapSwitch('state'),
@ -561,7 +592,7 @@
{
id: idevent,
title: $("#mymodal-event-mod #event_title").val(),
description: $("#mymodal-event-mod #event_description").val(),
description: CKEDITOR.instances["event_description-mod"].getData(),
start: start,
end: end,
editable: true,
@ -576,6 +607,15 @@
});
}
function AddPJ() {
$('#mymodal-event-mod').modal('hide');
url='{{ path('cadoles_core_'~access~'_file_upload',{'id': 'calendarevent-xxxx','type':'all','forcereload':false}) }}';
url=url.replace('xxxx',$("#mymodal-event-mod #event_id").val());
$("#mymodal").modal('show');
ModalLoad('mymodal','Fichiers',url);
}
function shareEvent() {
var id=$("#mymodal-event-mod #event_id").val();
@ -603,4 +643,111 @@
}
});
}
// 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_'~access~'_file_delete') }}",
data: {
directory:directory,
filename:filename
},
success: function() {
refreshPJ();
}
});
}
}
$(document).on('mouseenter', '.grid-item-content', function(){
$(this).children(".item-delete").show();
});
$(document).on('mouseleave', '.grid-item-content', function(){
$(this).children(".item-delete").hide();
});
$('#mymodal-event-add').on('hidden.bs.modal', function() {
if(toaddPJ) {
$('#event-'+toaddPJevent+'.fc-content').trigger('click');
AddPJ();
}
toaddPJ=false;
});
$('#mymodal-event-mod').on('shown.bs.modal', function() {
$('body').imagesLoaded(function() {
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
var grid = $('.grid').masonry(optiongrid);
});
});
function refreshPJ() {
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_'~access~'_calendarevent_loadpj') }}",
data: {
"id": $("#mymodal-event-mod #event_id").val()
},
success: function(data) {
htmlPJ(data);
}
});
}
$('#mymodal').on('hidden.bs.modal', function() {
$("#mymodal-event-mod").modal("show");
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
var grid = $('.grid').masonry(optiongrid);
});
function htmlPJ(files) {
html ='<div class="grid clearfix">';
html+='<div class="grid-sizer grid-small"></div>';
html+='<div class="grid-gutter-sizer"></div>';
files.forEach(function(file) {
url="{{ path('cadoles_core_'~access~'_file_download',{'directory':'calendarevent-xxxx','filename':'yyyy' }) }}";
url=url.replace("xxxx",event.id);
url=url.replace("yyyy",file.name);
html+='<div class="grid-item grid-small">';
html+='<div class="grid-item-content" style="background-color: #{{ color["main"]}}">';
html+='<a style="cursor:pointer;color: #{{color['fontcolorhover']}}" onClick="delFile(\'calendarevent-'+$("#mymodal-event-mod #event_id").val()+'\',\''+file.name+'\')" class="item-delete">';
html+='<i class="fa fa-trash" title="Supprimer le fichier"></i>';
html+='</a>';
html+='<a style="cursor:pointer" href="'+url+'">';
html+='<div class="item-link clearfix">';
html+='<div class="grid-item-logo">';
if(file.thumb)
html+='<img class="grid-item-img" height="110" src="'+file.thumb+'">';
else
html+='<img class="grid-item-img" height="110" src="/{{ alias }}/bundles/cadolescore/images/files/_blank.png">';
html+='</div>';
html+='<div class="grid-item-title">';
html+='<h2>'+file.name+'</h2>';
html+='</div>';
html+='</div>';
html+='</a>';
html+='</div>';
html+='</div>';
});
html+='<div class="grid-item grid-small">'
html+='<div onClick="AddPJ();" title="Ajouter des fichiers" class="grid-item-content" style="cursor:pointer;margin-top:20px;">';
html+='<img class="grid-item-img imageshadow" height="60" src="/ninegate/uploads/icon/icon_add.png">';
html+='<br>Ajouter des fichiers';
html+='</div>';
html+='</div>';
html+='</div>';
html+='</div>';
html+='</div>';
// On ajoute les PJ à la modal
$("#mymodal-event-mod #event_PJ").html("");
$("#mymodal-event-mod #event_PJ").append(html);
}
{% endblock %}

View File

@ -170,7 +170,7 @@
{% if canadd %}
<div data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'projecttask-'~entity.id,'type':'all'}) }}');" title="Ajouter des fichiers" class="grid-item-content" style="cursor:pointer;margin-top:20px;">
<img class="grid-item-img imageshadow" height="60" src="/ninegate/uploads/icon/icon_add.png">
<br>Ajouter un fichier
<br>Ajouter des fichiers
</div>
{% endif %}
</div>