svg
This commit is contained in:
parent
866536c457
commit
9f0915789b
|
@ -49,6 +49,9 @@ php bin/console Core:InitData --env=prod
|
|||
php bin/console Cron:InitData --env=prod
|
||||
php bin/console Portal:InitData --env=prod
|
||||
|
||||
# Passage des scripts
|
||||
php bin/console Core:Script --env=prod
|
||||
|
||||
# Generation des assets
|
||||
bin/console assetic:dump --env=prod
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class PurgeFileCommand extends Command
|
|||
|
||||
if($fs->exists($directory)) {
|
||||
$finder = new Finder();
|
||||
$finder->in($directory)->directories()->exclude("thumb");
|
||||
$finder->in($directory)->directories()->exclude("thumb")->exclude("thumbmini");
|
||||
|
||||
foreach (iterator_to_array($finder) as $file) {
|
||||
$name = $file->getRelativePathname();
|
||||
|
@ -78,8 +78,6 @@ class PurgeFileCommand extends Command
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,11 +331,11 @@ class PurgeFileCommand extends Command
|
|||
if($result) $find=true;
|
||||
}
|
||||
|
||||
// Si pas trouvé on la cherche dans les blogcommentaire
|
||||
// Si pas trouvé on la cherche dans les blogcomment
|
||||
if(!$find) {
|
||||
$result = $this->em
|
||||
->getRepository("CadolesPortalBundle:Blogcommentaire")->createQueryBuilder('blogcommentaire')
|
||||
->where('blogarticle.description LIKE :tofind')
|
||||
->getRepository("CadolesPortalBundle:Blogcomment")->createQueryBuilder('blogcomment')
|
||||
->where('blogcomment.description LIKE :tofind')
|
||||
->setParameter('tofind', '%'.$tofind.'%')
|
||||
->getQuery()->getResult();
|
||||
if($result) $find=true;
|
||||
|
|
|
@ -11,6 +11,7 @@ use Symfony\Component\HttpKernel\KernelInterface;
|
|||
use Doctrine\DBAL\Connection as DBALConnection;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
use Cadoles\CoreBundle\Entity\Script;
|
||||
use Cadoles\CoreBundle\Entity\User;
|
||||
use Cadoles\PortalBundle\Entity\Project;
|
||||
|
||||
|
@ -30,8 +31,6 @@ class ScriptCommand extends Command
|
|||
$this
|
||||
->setName('Core:Script')
|
||||
->setDescription('Lauch Script')
|
||||
->setHelp('Execeute some script : visibletrue / setusersniveau')
|
||||
->addArgument('scriptname', InputArgument::OPTIONAL, 'scriptname')
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -43,18 +42,64 @@ class ScriptCommand extends Command
|
|||
$this->filesystem = new Filesystem();
|
||||
$this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/";
|
||||
|
||||
$this->writelnred('');
|
||||
$this->writelnred('== Core:Script');
|
||||
$this->writelnred('==========================================================================================================');
|
||||
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"visibletrue"]);
|
||||
if(!$script) {
|
||||
$this->writelnred("== SCRIPT = visibletrue");
|
||||
$this->visibletrue();
|
||||
|
||||
$scriptname = $input->getArgument('scriptname');
|
||||
$this->writeln($scriptname);
|
||||
$script=new Script();
|
||||
$script->setName("visibletrue");
|
||||
$this->em->persist($script);
|
||||
$this->em->flush();
|
||||
$this->writeln("");
|
||||
}
|
||||
|
||||
switch($scriptname) {
|
||||
case "visibletrue": $this->visibletrue(); break;
|
||||
case "setusersniveau": $this->setusersniveau(); break;
|
||||
case "setfgcancreateproject": $this->setfgcancreateproject(); break;
|
||||
case "createproject": $this->createproject(); break;
|
||||
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"setusersniveau"]);
|
||||
if(!$script) {
|
||||
$this->writelnred("== SCRIPT = setusersniveau");
|
||||
$this->setusersniveau();
|
||||
|
||||
$script=new Script();
|
||||
$script->setName("setusersniveau");
|
||||
$this->em->persist($script);
|
||||
$this->em->flush();
|
||||
$this->writeln("");
|
||||
}
|
||||
|
||||
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"setfgcancreateproject"]);
|
||||
if(!$script) {
|
||||
$this->writelnred("== SCRIPT = setfgcancreateproject");
|
||||
$this->setfgcancreateproject();
|
||||
|
||||
$script=new Script();
|
||||
$script->setName("setfgcancreateproject");
|
||||
$this->em->persist($script);
|
||||
$this->em->flush();
|
||||
$this->writeln("");
|
||||
}
|
||||
|
||||
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createproject"]);
|
||||
if(!$script) {
|
||||
$this->writelnred("== SCRIPT = createproject");
|
||||
$this->createproject();
|
||||
|
||||
$script=new Script();
|
||||
$script->setName("createproject");
|
||||
$this->em->persist($script);
|
||||
$this->em->flush();
|
||||
$this->writeln("");
|
||||
}
|
||||
|
||||
$script=$this->em->getRepository("CadolesCoreBundle:Script")->findOneBy(["name"=>"createthumbmini"]);
|
||||
if(!$script) {
|
||||
$this->writelnred("== SCRIPT = createthumbmini");
|
||||
$this->createthumbmini();
|
||||
|
||||
$script=new Script();
|
||||
$script->setName("createthumbmini");
|
||||
$this->em->persist($script);
|
||||
$this->em->flush();
|
||||
$this->writeln("");
|
||||
}
|
||||
|
||||
$this->writeln('');
|
||||
|
@ -113,6 +158,51 @@ class ScriptCommand extends Command
|
|||
}
|
||||
}
|
||||
|
||||
private function createthumbmini() {
|
||||
$directory=$this->container->get('kernel')->getRootDir()."/../uploads/file";
|
||||
$files=[];
|
||||
$fs = new Filesystem();
|
||||
|
||||
if($fs->exists($directory)) {
|
||||
$finder = new Finder();
|
||||
$finder->in($directory)->directories()->exclude("thumb")->exclude("thumbmini");
|
||||
|
||||
foreach (iterator_to_array($finder) as $rep) {
|
||||
$finder2 = new Finder();
|
||||
if($fs->exists($rep."/thumb")) {
|
||||
$finder2->sortByName()->in($rep."/thumb");
|
||||
|
||||
foreach ($finder2 as $file) {
|
||||
if(!$fs->exists($rep."/thumbmini/".$file->getRelativePathname())) {
|
||||
$this->writeln($file->getRelativePathname());
|
||||
$fs->mkdir($rep."/thumbmini");
|
||||
$fs->copy($rep."/thumb/".$file->getRelativePathname(),$rep."/thumbmini/".$file->getRelativePathname());
|
||||
$max_width=60;
|
||||
$width = $this->getWidth($rep."/thumbmini/".$file->getRelativePathname());
|
||||
$height = $this->getHeight($rep."/thumbmini/".$file->getRelativePathname());
|
||||
$scale = $max_width/$width;
|
||||
$this->resizeImage($rep."/thumbmini/".$file->getRelativePathname(),$width,$height,$scale);
|
||||
$fs->chown($rep."/thumbmini/".$file->getRelativePathname(), 'www-data');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private function writelnred($string) {
|
||||
$this->output->writeln('<fg=red>'.$string.'</>');
|
||||
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
|
||||
|
@ -122,6 +212,63 @@ class ScriptCommand extends Command
|
|||
$this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n");
|
||||
}
|
||||
|
||||
protected function getHeight($image) {
|
||||
$size = getimagesize($image);
|
||||
$height = $size[1];
|
||||
return $height;
|
||||
}
|
||||
|
||||
// Cacul de la largeur
|
||||
protected function getWidth($image) {
|
||||
$size = getimagesize($image);
|
||||
$width = $size[0];
|
||||
return $width;
|
||||
}
|
||||
|
||||
protected function resizeImage($image,$width,$height,$scale) {
|
||||
list($imagewidth, $imageheight, $imageType) = getimagesize($image);
|
||||
$imageType = image_type_to_mime_type($imageType);
|
||||
$newImageWidth = ceil($width * $scale);
|
||||
$newImageHeight = ceil($height * $scale);
|
||||
$newImage = imagecreatetruecolor($newImageWidth,$newImageHeight);
|
||||
switch($imageType) {
|
||||
case "image/gif":
|
||||
$source=imagecreatefromgif($image);
|
||||
break;
|
||||
case "image/pjpeg":
|
||||
case "image/jpeg":
|
||||
case "image/jpg":
|
||||
$source=imagecreatefromjpeg($image);
|
||||
break;
|
||||
case "image/png":
|
||||
case "image/x-png":
|
||||
$source=imagecreatefrompng($image);
|
||||
break;
|
||||
}
|
||||
|
||||
$newImage = imagecreatetruecolor( $newImageWidth, $newImageHeight );
|
||||
imagealphablending( $newImage, false );
|
||||
imagesavealpha( $newImage, true );
|
||||
imagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height);
|
||||
|
||||
switch($imageType) {
|
||||
case "image/gif":
|
||||
imagegif($newImage,$image);
|
||||
break;
|
||||
case "image/pjpeg":
|
||||
case "image/jpeg":
|
||||
case "image/jpg":
|
||||
imagejpeg($newImage,$image,90);
|
||||
break;
|
||||
case "image/png":
|
||||
case "image/x-png":
|
||||
imagepng($newImage,$image);
|
||||
break;
|
||||
}
|
||||
|
||||
chmod($image, 0640);
|
||||
return $image;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -50,6 +50,10 @@ class CoreController extends Controller
|
|||
// Récupération de la page encours
|
||||
$id = $request->query->get('id');
|
||||
|
||||
// Récupération redirection potentielle
|
||||
$gotoroute = $request->query->get('gotoroute');
|
||||
$gotoid = $request->query->get('gotoid');
|
||||
|
||||
// L'utilisateur en cours
|
||||
|
||||
|
||||
|
@ -131,7 +135,9 @@ class CoreController extends Controller
|
|||
'groupsshared' => $groupsshared,
|
||||
'canadd' => $this->get('session')->get('cancreatepage'),
|
||||
'widgetsuser' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess("user"),
|
||||
'widgetsgroup' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess("group")
|
||||
'widgetsgroup' => $this->getDoctrine()->getRepository("CadolesPortalBundle:Widget")->getWidgetAccess("group"),
|
||||
'gotoroute' => $gotoroute,
|
||||
'gotoid' => $gotoid,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class FileController extends Controller
|
|||
|
||||
if($fs->exists($dir)) {
|
||||
$finder = new Finder();
|
||||
$finder->sortByName()->in($dir)->exclude('thumb');
|
||||
$finder->sortByName()->in($dir)->exclude('thumb')->exclude("thumbmini");
|
||||
|
||||
$i=-1;
|
||||
|
||||
|
|
|
@ -192,4 +192,11 @@ class SecurityController extends Controller
|
|||
|
||||
return new Response();
|
||||
}
|
||||
|
||||
public function redirectAction($route,$id,Request $request) {
|
||||
if($route=="cadoles_core_home")
|
||||
return $this->redirectToRoute($route,["id"=>$id]);
|
||||
else
|
||||
return $this->redirectToRoute("cadoles_core_home",["gotoroute"=>$route,"gotoid"=>$id]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
namespace Cadoles\CoreBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="script")
|
||||
*/
|
||||
class Script
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Script
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
|
@ -108,7 +108,7 @@ class uploadListener
|
|||
if (in_array(strtolower($file->GetExtension()), array('jpg', 'jpeg', 'jpe', 'png', 'gif', 'bmp'))) {
|
||||
$fs = new Filesystem();
|
||||
$fs->copy($pathname."/".$directory."/".$filename,$pathname."/".$directory."/thumb/".$filename);
|
||||
$max_width=350;
|
||||
$max_width=300;
|
||||
$width = $this->getWidth($pathname."/".$directory."/thumb/".$filename);
|
||||
$height = $this->getHeight($pathname."/".$directory."/thumb/".$filename);
|
||||
$scale = $max_width/$width;
|
||||
|
@ -118,7 +118,7 @@ class uploadListener
|
|||
|
||||
if (in_array(strtolower($file->GetExtension()), array('pdf'))) {
|
||||
$im = new \Imagick();
|
||||
$im->setResolution(350, 350);
|
||||
$im->setResolution(300, 300);
|
||||
$im->readImage($pathname."/".$directory."/".$filename."[0]");
|
||||
$im->setImageBackgroundColor('#ffffff');
|
||||
$im = $im->flattenImages();
|
||||
|
@ -128,6 +128,17 @@ class uploadListener
|
|||
$fs->rename($pathname."/".$directory."/thumb/".$filename.".jpg", $pathname."/".$directory."/thumb/".$filename);
|
||||
}
|
||||
|
||||
$fgexit=$fs->exists($pathname."/".$directory."/thumb/".$filename);
|
||||
if($fgexit) {
|
||||
$fs->mkdir($pathname."/".$directory."/thumbmini");
|
||||
$fs->copy($pathname."/".$directory."/thumb/".$filename,$pathname."/".$directory."/thumbmini/".$filename);
|
||||
$max_width=60;
|
||||
$width = $this->getWidth($pathname."/".$directory."/thumbmini/".$filename);
|
||||
$height = $this->getHeight($pathname."/".$directory."/thumbmini/".$filename);
|
||||
$scale = $max_width/$width;
|
||||
$this->resizeImage($pathname."/".$directory."/thumbmini/".$filename,$width,$height,$scale);
|
||||
}
|
||||
|
||||
if (strpos($directory, 'widget') === 0) {
|
||||
$tmp=explode("-",$directory);
|
||||
$widgetid=$tmp[1];
|
||||
|
|
|
@ -41,6 +41,9 @@ cadoles_core_ldap_login:
|
|||
path: /ldaplogin
|
||||
defaults: { _controller: CadolesCoreBundle:Security:login }
|
||||
|
||||
cadoles_core_redirect:
|
||||
path: /user/redirect/{route}/{id}
|
||||
defaults: { _controller: CadolesCoreBundle:Security:redirect }
|
||||
|
||||
#== Crop Image ===========================================================================================================
|
||||
cadoles_core_crop01:
|
||||
|
|
|
@ -559,6 +559,7 @@ class PageController extends Controller
|
|||
'group' => $groupid
|
||||
]);
|
||||
}
|
||||
|
||||
// Type Widgets
|
||||
if($entity->getPageCategory()->getId()==2) {
|
||||
return $this->render($this->labelentity.':viewwidget.html.twig', [
|
||||
|
|
|
@ -1449,7 +1449,7 @@ class PagewidgetController extends Controller
|
|||
|
||||
if($fs->exists($directory)) {
|
||||
$finder = new Finder();
|
||||
$finder->sortByName()->in($directory)->exclude('thumb');
|
||||
$finder->sortByName()->in($directory)->exclude('thumb')->exclude('thumbmini');
|
||||
|
||||
foreach ($finder as $file) {
|
||||
$tmp=[];
|
||||
|
@ -1460,7 +1460,25 @@ class PagewidgetController extends Controller
|
|||
$tmp["minefamily"]=explode("/",$tmp["minetype"])[0];
|
||||
|
||||
$tmp["thumb"]="";
|
||||
if($fs->exists($directory."/thumb/".$tmp["name"])) {
|
||||
if($tmp["extension"]=="pdf") {
|
||||
$tmp["thumb"]="/".$this->getParameter('alias')."/bundles/cadolescore/images/files/".$tmp["extension"].".png";
|
||||
|
||||
if($fs->exists($directory."/thumbmini/".$tmp["name"])) {
|
||||
$data = file_get_contents($directory."/thumbmini/".$tmp["name"]);
|
||||
$tmp["thumb"]="data:image/jpg;base64," . base64_encode($data);
|
||||
}
|
||||
elseif($fs->exists($directory."/thumb/".$tmp["name"])) {
|
||||
$data = file_get_contents($directory."/thumb/".$tmp["name"]);
|
||||
$tmp["thumb"]="data:image/jpg;base64," . base64_encode($data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
elseif($fs->exists($directory."/thumbmini/".$tmp["name"])) {
|
||||
$data = file_get_contents($directory."/thumbmini/".$tmp["name"]);
|
||||
$tmp["thumb"]=$data;
|
||||
}
|
||||
elseif($fs->exists($directory."/thumb/".$tmp["name"])) {
|
||||
$data = file_get_contents($directory."/thumb/".$tmp["name"]);
|
||||
$tmp["thumb"]="data:image/" . $tmp["extension"] . ";base64," . base64_encode($data);
|
||||
}
|
||||
|
@ -1504,7 +1522,7 @@ class PagewidgetController extends Controller
|
|||
|
||||
if($fs->exists($directory)) {
|
||||
$finder = new Finder();
|
||||
$finder->sortByName()->in($directory)->exclude('thumb');
|
||||
$finder->sortByName()->in($directory)->exclude('thumb')->exclude('thumbmini');
|
||||
|
||||
foreach ($finder as $file) {
|
||||
$tmp=[];
|
||||
|
|
|
@ -244,6 +244,7 @@
|
|||
{% block localjavascript %}
|
||||
var idpage;
|
||||
$('document').ready(function(){
|
||||
{% if gotoroute is empty %}
|
||||
{% for page in pagesadmin %}
|
||||
{% if page.id==entity.id %}
|
||||
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','portal');
|
||||
|
@ -263,7 +264,10 @@
|
|||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{% else %}
|
||||
var url="{{ path(gotoroute,{id:gotoid}) }}";
|
||||
showGoto(url);
|
||||
{% endif %}
|
||||
|
||||
// Rendre les pages user déplacable
|
||||
$("#pagesuser").sortable({
|
||||
|
@ -393,8 +397,6 @@
|
|||
// Sauvegarder la page en cours
|
||||
idpage=id;
|
||||
|
||||
|
||||
|
||||
// Cacher toutes les pages
|
||||
$(".pageframereload").remove();
|
||||
$(".pageframe").hide();
|
||||
|
@ -455,11 +457,19 @@
|
|||
|
||||
}
|
||||
|
||||
// On resize les frame
|
||||
resizeFrame();
|
||||
}
|
||||
|
||||
// Affichages des pages
|
||||
function showGoto(url) {
|
||||
$("#pagecontainer").append("<iframe 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);
|
||||
|
|
|
@ -41,6 +41,7 @@ class onlyService
|
|||
$folders=[];
|
||||
$tasks=[];
|
||||
|
||||
dump($idgroup);
|
||||
$group=$this->em->getRepository("CadolesCoreBundle:Group")->find($idgroup);
|
||||
if($group&&$group->getIdonlyoffice()) {
|
||||
if($this->only_activate) {
|
||||
|
|
|
@ -10,6 +10,7 @@ use Gos\Bundle\WebSocketBundle\Router\WampRequest;
|
|||
use Doctrine\ORM\EntityManager;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Gos\Bundle\WebSocketBundle\Client\ClientManipulatorInterface;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
use Cadoles\WebsocketBundle\Entity\Message;
|
||||
|
||||
|
@ -112,11 +113,15 @@ class WebsocketTopic implements TopicInterface
|
|||
if(array_key_exists("mail",$event)) {
|
||||
$mail = $this->container->get('cadoles.core.service.mail');
|
||||
if($mail) {
|
||||
$cplt="<br><br><b>Attention ne répondez pas à ce mail : Pour répondre, rendez-vous dans ce groupe sur le portail et utilisez le fil de conversation (chat)</b><br>";
|
||||
$pages=$group->getPages();
|
||||
$pageid=$pages[0]->getId();
|
||||
$cplt="<br><br><b>Attention pour répondre à ce message : n’utilisez pas votre mail mais rendez vous dans ce groupe sur Transnum et utilisez le fil de conversation (chat)</b><br>";
|
||||
$url=$url = $this->container->get('router')->generate('cadoles_core_hone', ['id'=>$pageid], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
$cplturl="<br><a href='".$url."'>".$url."</a>";
|
||||
$mail_params=array(
|
||||
"subject" => $event["subject"],
|
||||
"body_html"=>$event["message"].$cplt,
|
||||
"body_text"=>strip_tags($event["message"].$cplt)
|
||||
"body_html"=>$event["message"].$cplt.$cplturl,
|
||||
"body_text"=>strip_tags($event["message"].$cplt.$url)
|
||||
);
|
||||
|
||||
// Transformer la liste des destinataires en tableau : [0] tjr vide on l'unset
|
||||
|
|
Loading…
Reference in New Issue