gestion copier / coller des images dans les editeurs de texte (fixes #33465)
This commit is contained in:
parent
95e51c4d53
commit
01da55e6d6
|
@ -147,7 +147,7 @@ ivory_ck_editor:
|
|||
language: fr
|
||||
toolbar: "my_toolbar_1"
|
||||
uiColor: "#ffffff"
|
||||
extraPlugins: ["html5video","pastebase64"]
|
||||
extraPlugins: ["html5video"]
|
||||
light_config:
|
||||
language: fr
|
||||
toolbar: "my_toolbar_2"
|
||||
|
|
|
@ -380,6 +380,46 @@ class PurgeFileCommand extends Command
|
|||
if($result) $find=true;
|
||||
}
|
||||
|
||||
// Si pas trouvé on la cherche dans les projecttask
|
||||
if(!$find) {
|
||||
$result = $this->em
|
||||
->getRepository("CadolesPortalBundle:Projecttask")->createQueryBuilder('projecttask')
|
||||
->where('projecttask.description LIKE :tofind')
|
||||
->setParameter('tofind', '%'.$tofind.'%')
|
||||
->getQuery()->getResult();
|
||||
if($result) $find=true;
|
||||
}
|
||||
|
||||
// Si pas trouvé on la cherche dans les projectcomment
|
||||
if(!$find) {
|
||||
$result = $this->em
|
||||
->getRepository("CadolesPortalBundle:Projectcomment")->createQueryBuilder('projectcomment')
|
||||
->where('projectcomment.description LIKE :tofind')
|
||||
->setParameter('tofind', '%'.$tofind.'%')
|
||||
->getQuery()->getResult();
|
||||
if($result) $find=true;
|
||||
}
|
||||
|
||||
// Si pas trouvé on la cherche dans les blogcomment
|
||||
if(!$find) {
|
||||
$result = $this->em
|
||||
->getRepository("CadolesPortalBundle:Blogcomment")->createQueryBuilder('blogcomment')
|
||||
->where('blogcomment.description LIKE :tofind')
|
||||
->setParameter('tofind', '%'.$tofind.'%')
|
||||
->getQuery()->getResult();
|
||||
if($result) $find=true;
|
||||
}
|
||||
|
||||
// Si pas trouvé on la cherche dans les alert
|
||||
if(!$find) {
|
||||
$result = $this->em
|
||||
->getRepository("CadolesPortalBundle:Alert")->createQueryBuilder('alert')
|
||||
->where('alert.content LIKE :tofind')
|
||||
->setParameter('tofind', '%'.$tofind.'%')
|
||||
->getQuery()->getResult();
|
||||
if($result) $find=true;
|
||||
}
|
||||
|
||||
// Si pas trouvé on supprime
|
||||
if(!$find) {
|
||||
$this->writeln($name);
|
||||
|
|
|
@ -52,7 +52,7 @@ class MailType extends AbstractType
|
|||
'mapped'=> false,
|
||||
'required' => false,
|
||||
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px"),
|
||||
'config' => ["height" => "150px",'filebrowserUploadRoute' => 'cadoles_portal_user_pagewidget_upload']
|
||||
'config' => ["height" => "150px"]
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ class MailingType extends AbstractType
|
|||
'mapped'=> false,
|
||||
'required' => true,
|
||||
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px"),
|
||||
'config' => ["height" => "400px",'filebrowserUploadRoute' => 'cadoles_portal_user_pagewidget_upload']
|
||||
'config' => ["height" => "400px"]
|
||||
]);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
use Cadoles\PortalBundle\Entity\Alert;
|
||||
use Cadoles\PortalBundle\Form\AlertType;
|
||||
|
@ -195,6 +196,32 @@ class AlertController extends Controller
|
|||
return $response;
|
||||
}
|
||||
|
||||
public function uploadAction(Request $request,$access=null) {
|
||||
// Fichier temporaire uploadé
|
||||
$tmpfile = $request->files->get('upload');
|
||||
$extention = $tmpfile->getClientOriginalExtension();
|
||||
|
||||
// Répertoire de Destination
|
||||
$fs = new Filesystem();
|
||||
$rootdir = $this->get('kernel')->getRootDir()."/../web";
|
||||
$fs->mkdir($rootdir."/uploads/ckeditor");
|
||||
|
||||
// Fichier cible
|
||||
$targetName = uniqid().".".$extention;
|
||||
$targetFile = $rootdir."/uploads/ckeditor/".$targetName;
|
||||
$targetUrl = "/".$this->getParameter('alias')."/uploads/ckeditor/".$targetName;
|
||||
$message = "";
|
||||
|
||||
move_uploaded_file($tmpfile,$targetFile);
|
||||
|
||||
$output["uploaded"]=1;
|
||||
$output["fileName"]=$targetName;
|
||||
$output["url"]=$targetUrl;
|
||||
|
||||
return new Response(json_encode($output));
|
||||
|
||||
}
|
||||
|
||||
public function readAction(Request $request) {
|
||||
$output=array();
|
||||
$id=$request->request->get('id');
|
||||
|
|
|
@ -33,7 +33,7 @@ class AlertType extends AbstractType
|
|||
"label" => 'Description',
|
||||
"required" => false,
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
"config" => array("height" => "500px")
|
||||
"config" => array("height" => "500px","filebrowserUploadRoute" => 'cadoles_portal_config_alert_upload')
|
||||
])
|
||||
|
||||
->add("fghideable",ChoiceType::class,[
|
||||
|
|
|
@ -159,6 +159,13 @@ cadoles_portal_config_alert_order:
|
|||
path: /config/alert/order
|
||||
defaults: { _controller: CadolesPortalBundle:Alert:order }
|
||||
|
||||
cadoles_portal_config_alert_upload:
|
||||
path: /config/alert/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Alert:upload }
|
||||
cadoles_portal_config_alert_upload_direct:
|
||||
path: /config/alert/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Alert:upload }
|
||||
|
||||
cadoles_portal_config_ajax_alert_seleclist:
|
||||
path: /config/alert/ajax/selectlist
|
||||
defaults: { _controller: CadolesPortalBundle:Alert:ajaxseleclist }
|
||||
|
@ -321,6 +328,9 @@ cadoles_portal_config_page_order:
|
|||
cadoles_portal_config_page_upload:
|
||||
path: /config/page/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Page:upload, access: config }
|
||||
cadoles_portal_config_page_upload_direct:
|
||||
path: /config/page/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Page:upload, access: config }
|
||||
|
||||
#-- Access user
|
||||
cadoles_portal_user_page_submit:
|
||||
|
@ -350,6 +360,9 @@ cadoles_portal_user_page_order:
|
|||
cadoles_portal_user_page_upload:
|
||||
path: /user/page/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Page:upload, access: user }
|
||||
cadoles_portal_user_page_upload_direct:
|
||||
path: /user/page/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Page:upload, access: user }
|
||||
|
||||
# Page spécifique
|
||||
cadoles_portal_user_page_application:
|
||||
|
@ -531,7 +544,10 @@ cadoles_portal_config_blogarticle_delete:
|
|||
cadoles_portal_config_blogarticle_upload:
|
||||
path: /config/blogarticle/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Blogarticle:upload, access: config }
|
||||
|
||||
cadoles_portal_config_blogarticle_upload_direct:
|
||||
path: /config/blogarticle/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Blogarticle:upload, access: config }
|
||||
|
||||
cadoles_portal_config_blogarticle_image:
|
||||
path: /config/blogarticle/image
|
||||
defaults: { _controller: CadolesPortalBundle:Blogarticle:image, access: config }
|
||||
|
@ -556,6 +572,9 @@ cadoles_portal_user_blogarticle_delete:
|
|||
cadoles_portal_user_blogarticle_upload:
|
||||
path: /user/blogarticle/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Blogarticle:upload, access: user }
|
||||
cadoles_portal_user_blogarticle_upload_direct:
|
||||
path: /user/blogarticle/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Blogarticle:upload, access: user }
|
||||
|
||||
cadoles_portal_user_blogarticle_image:
|
||||
path: /user/blogarticle/image
|
||||
|
@ -584,6 +603,9 @@ cadoles_portal_config_blogcomment_delete:
|
|||
cadoles_portal_config_blogcomment_upload:
|
||||
path: /config/blogcomment/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:upload, access: config }
|
||||
cadoles_portal_config_blogcomment_upload_direct:
|
||||
path: /config/blogcomment/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:upload, access: config }
|
||||
|
||||
#-- Access user
|
||||
cadoles_portal_user_blogcomment_submit:
|
||||
|
@ -605,7 +627,9 @@ cadoles_portal_user_blogcomment_delete:
|
|||
cadoles_portal_user_blogcomment_upload:
|
||||
path: /user/blogcomment/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:upload, access: user }
|
||||
|
||||
cadoles_portal_user_blogcomment_upload_direct:
|
||||
path: /user/blogcomment/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Blogcomment:upload, access: user }
|
||||
|
||||
#== CALENDAR =============================================================================================================================================
|
||||
|
||||
|
@ -804,6 +828,9 @@ cadoles_portal_config_projecttask_delete:
|
|||
cadoles_portal_config_projecttask_upload:
|
||||
path: /config/projecttask/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Projecttask:upload, access: config }
|
||||
cadoles_portal_config_projecttask_upload_direct:
|
||||
path: /config/projecttask/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Projecttask:upload, access: config }
|
||||
|
||||
cadoles_portal_config_projecttask_users:
|
||||
path: /config/projecttask/users
|
||||
|
@ -833,6 +860,9 @@ cadoles_portal_user_projecttask_delete:
|
|||
cadoles_portal_user_projecttask_upload:
|
||||
path: /user/projecttask/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Projecttask:upload, access: user }
|
||||
cadoles_portal_user_projecttask_upload_direct:
|
||||
path: /user/projecttask/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Projecttask:upload, access: user }
|
||||
|
||||
cadoles_portal_user_projecttask_users:
|
||||
path: /user/projecttask/users
|
||||
|
@ -861,6 +891,9 @@ cadoles_portal_config_projectcomment_delete:
|
|||
cadoles_portal_config_projectcomment_upload:
|
||||
path: /config/projectcomment/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Projectcomment:upload, access: config }
|
||||
cadoles_portal_config_projectcomment_upload_direct:
|
||||
path: /config/projectcomment/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Projectcomment:upload, access: config }
|
||||
|
||||
#-- Access user
|
||||
cadoles_portal_user_projectcomment_submit:
|
||||
|
@ -878,7 +911,9 @@ cadoles_portal_user_projectcomment_delete:
|
|||
cadoles_portal_user_projectcomment_upload:
|
||||
path: /user/projectcomment/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Projectcomment:upload, access: user }
|
||||
|
||||
cadoles_portal_user_projectcomment_upload_direct:
|
||||
path: /user/projectcomment/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Projectcomment:upload, access: user }
|
||||
|
||||
#== FEED =================================================================================================================================================
|
||||
|
||||
|
@ -930,6 +965,9 @@ cadoles_portal_config_pagewidget_order:
|
|||
cadoles_portal_config_pagewidget_upload:
|
||||
path: /config/pagewidget/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:upload, access: config }
|
||||
cadoles_portal_config_pagewidget_upload_direct:
|
||||
path: /config/pagewidget/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:upload, access: config }
|
||||
|
||||
cadoles_portal_config_panelwidget_view_url:
|
||||
path: /config/pagewidget/view/url/{id}
|
||||
|
@ -1051,6 +1089,9 @@ cadoles_portal_user_pagewidget_order:
|
|||
cadoles_portal_user_pagewidget_upload:
|
||||
path: /user/pagewidget/upload
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:upload, access: user }
|
||||
cadoles_portal_user_pagewidget_upload_direct:
|
||||
path: /user/pagewidget/upload&responseType=json
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:upload, access: user }
|
||||
|
||||
cadoles_portal_user_panelwidget_view_url:
|
||||
path: /pagewidget/view/url/{id}
|
||||
|
|
|
@ -30,7 +30,7 @@ class ChatType extends AbstractType
|
|||
'mapped'=> false,
|
||||
'required' => false,
|
||||
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px"),
|
||||
'config' => ["height" => "100px",'filebrowserUploadRoute' => 'cadoles_portal_user_pagewidget_upload',],
|
||||
'config' => ["height" => "100px"],
|
||||
]);
|
||||
|
||||
$builder
|
||||
|
@ -40,7 +40,7 @@ class ChatType extends AbstractType
|
|||
'mapped'=> false,
|
||||
'required' => false,
|
||||
'attr' => array("class" => "form-control", "style" => "margin-bottom:15px"),
|
||||
'config' => ["height" => "150px",'filebrowserUploadRoute' => 'cadoles_portal_user_pagewidget_upload']
|
||||
'config' => ["height" => "150px"]
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue