From 31d55f4bb5077f17b913dd7066d328a0d6c76723 Mon Sep 17 00:00:00 2001 From: afornerot Date: Thu, 26 Nov 2020 16:09:28 +0100 Subject: [PATCH] svg --- src/ninesurvey-1.0/config/routes.yaml | 4 + .../public/styles/css/style.css | 2 +- .../src/Controller/CropController.php | 39 +++++++- .../src/Service/sessionInit.php | 1 + .../templates/Config/edit.html.twig | 4 +- .../templates/Crop/crop02.html.twig | 88 ++++++++++--------- .../templates/Form/fields.html.twig | 13 --- .../templates/Include/javascript.js.twig | 2 + .../templates/Include/style.css.twig | 23 +++++ .../templates/User/edit.html.twig | 2 +- 10 files changed, 117 insertions(+), 61 deletions(-) diff --git a/src/ninesurvey-1.0/config/routes.yaml b/src/ninesurvey-1.0/config/routes.yaml index 9543e3e..02bc1b7 100644 --- a/src/ninesurvey-1.0/config/routes.yaml +++ b/src/ninesurvey-1.0/config/routes.yaml @@ -81,6 +81,10 @@ app_crop02: path: /user/crop02/{type}/{reportinput} defaults: { _controller: App\Controller\CropController:crop02 } +app_ckupload: + path: /user/ckupload + defaults: { _controller: App\Controller\CropController:ckupload } + oneup_uploader: resource: . type: uploader diff --git a/src/ninesurvey-1.0/public/styles/css/style.css b/src/ninesurvey-1.0/public/styles/css/style.css index 254166b..8525831 100644 --- a/src/ninesurvey-1.0/public/styles/css/style.css +++ b/src/ninesurvey-1.0/public/styles/css/style.css @@ -79,7 +79,7 @@ h1{ color: #ECEFF1; } -#sidebar .nav a .fa{ +#sidebar .nav a i{ margin-right: 5px; width: 20px; text-align: center; diff --git a/src/ninesurvey-1.0/src/Controller/CropController.php b/src/ninesurvey-1.0/src/Controller/CropController.php index 84275c4..2074d53 100644 --- a/src/ninesurvey-1.0/src/Controller/CropController.php +++ b/src/ninesurvey-1.0/src/Controller/CropController.php @@ -7,9 +7,18 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\HiddenType; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\HttpKernel\KernelInterface; +use Symfony\Component\HttpFoundation\Response; class CropController extends AbstractController { + private $appKernel; + + public function __construct(KernelInterface $appKernel) + { + $this->appKernel = $appKernel; + } + // Etape 01 - Téléchargement de l'image public function crop01($type,$reportinput) { @@ -50,7 +59,7 @@ class CropController extends AbstractController $max_width=1600; $ratio="16:9"; break; - + case "image": $max_height=1600; $max_width=1600; @@ -70,7 +79,7 @@ class CropController extends AbstractController // Construction du formulaire $submited=false; $form = $this->createFormBuilder() - ->add('submit',SubmitType::class,array("label" => "Valider","attr" => array("class" => "btn btn-success","onclick" => "reportThumb()"))) + ->add('submit',SubmitType::class,array("label" => "Valider","attr" => array("class" => "btn btn-success"))) ->add('x',HiddenType::class) ->add('y',HiddenType::class) ->add('w',HiddenType::class) @@ -105,6 +114,32 @@ class CropController extends AbstractController ]); } + // Upload ckeditor + public function ckupload(Request $request) { + // Fichier temporaire uploadé + $tmpfile = $request->files->get('upload'); + $extention = $tmpfile->getClientOriginalExtension(); + + // Répertoire de Destination + $fs = new Filesystem(); + $rootdir = $this->appKernel->getProjectDir()."/public"; + $fs->mkdir($rootdir."/uploads/ckeditor"); + + // Fichier cible + $targetName = uniqid().".".$extention; + $targetFile = $rootdir."/uploads/ckeditor/".$targetName; + $targetUrl = "/".$this->getParameter('appAlias')."/uploads/ckeditor/".$targetName; + $message = ""; + + move_uploaded_file($tmpfile,$targetFile); + + $output["uploaded"]=1; + $output["fileName"]=$targetName; + $output["url"]=$targetUrl; + + return new Response(json_encode($output)); + } + // Calcul de la hauteur protected function getHeight($image) { $size = getimagesize($image); diff --git a/src/ninesurvey-1.0/src/Service/sessionInit.php b/src/ninesurvey-1.0/src/Service/sessionInit.php index 05e52bb..5841d00 100644 --- a/src/ninesurvey-1.0/src/Service/sessionInit.php +++ b/src/ninesurvey-1.0/src/Service/sessionInit.php @@ -89,6 +89,7 @@ // Calcul couleur $this->session->set("colorbgbodylight-darker", $this->adjustBrightness($this->session->get("colorbgbodylight"),-10)); + $this->session->set("colorbgbodydark-darker", $this->adjustBrightness($this->session->get("colorbgbodydark"),-50)); $this->session->set("colorfttitlelight-darker", $this->adjustBrightness($this->session->get("colorfttitlelight"),-50)); } diff --git a/src/ninesurvey-1.0/templates/Config/edit.html.twig b/src/ninesurvey-1.0/templates/Config/edit.html.twig index 8ca36dd..0a62546 100755 --- a/src/ninesurvey-1.0/templates/Config/edit.html.twig +++ b/src/ninesurvey-1.0/templates/Config/edit.html.twig @@ -66,12 +66,12 @@ {% elseif config.type=="hero" %}
- Modifier + Modifier
{% elseif config.type=="image" %}
- Modifier + Modifier
{% endif %} {{ form_row(form.help) }} diff --git a/src/ninesurvey-1.0/templates/Crop/crop02.html.twig b/src/ninesurvey-1.0/templates/Crop/crop02.html.twig index 45071f9..cc33eda 100644 --- a/src/ninesurvey-1.0/templates/Crop/crop02.html.twig +++ b/src/ninesurvey-1.0/templates/Crop/crop02.html.twig @@ -5,27 +5,29 @@ {% endblock %} {% block body %} - {{ form_start(form) }} - {{ form_widget(form.submit) }} - + {% if not submited %} + {{ form_start(form) }} + {{ form_widget(form.submit) }} + - {% if ratio=="1:1" %} - {% set class="width:90px; height:90px;" %} - {% elseif ratio=="16:9" %} - {% set class="width:160px; height:90px;" %} - {% elseif ratio=="16:2" %} - {% set class="width:160px; height:20px;" %} - {% endif %} + {% if ratio=="1:1" %} + {% set class="width:90px; height:90px;" %} + {% elseif ratio=="16:9" %} + {% set class="width:160px; height:90px;" %} + {% elseif ratio=="16:2" %} + {% set class="width:160px; height:20px;" %} + {% endif %} -
- Thumbnail Preview -
- -
-
+
+ Thumbnail Preview
-
- {{ form_end(form) }} + +
+
+
+
+ {{ form_end(form) }} + {% endif %} {% endblock %} @@ -73,8 +75,8 @@ {% if reportinput == "refresh" %} window.parent.location.reload(); {% elseif reportinput != "none" %} - window.parent.$("#{{ reportinput }}").val("thumb_{{ file }}"); - window.parent.$("#{{ reportinput }}_img").attr("src","/{{ appAlias }}/uploads/{{ type }}/thumb_{{ file }}"); + window.parent.$("{{ reportinput }}").val("thumb_{{ file }}"); + window.parent.$("{{ reportinput }}_img").attr("src","/{{ appAlias }}/uploads/{{ type }}/thumb_{{ file }}"); {% endif %} closeModal(); @@ -85,33 +87,35 @@ } $(document).ready(function() { - window.parent.$(".modal-title").html("ETAPE 2 - Découper votre image"); + {% if submited %} + reportThumb(); + {% else %} + window.parent.$(".modal-title").html("ETAPE 2 - Découper votre image"); - realheight=$('#largeimg').height(); - realwidth=$('#largeimg').width(); + realheight=$('#largeimg').height(); + realwidth=$('#largeimg').width(); - if(realheight>505) { $('#largeimg').height(505); $('#largeimg').width("auto") } - if($('#largeimg').width() > 868) { $('#largeimg').width(868); $('#largeimg').height("auto") } + if(realheight>505) { $('#largeimg').height(505); $('#largeimg').width("auto") } + if($('#largeimg').width() > 868) { $('#largeimg').width(868); $('#largeimg').height("auto") } - resizeheight=$('#largeimg').height(); - resizewidth=$('#largeimg').width(); + resizeheight=$('#largeimg').height(); + resizewidth=$('#largeimg').width(); - $('#largeimg').CropSelectJs({ - imageSrc: "/{{ appAlias }}/uploads/{{type}}/{{ file }}", - selectionResize: function(data) { resize(data); }, - selectionMove: function(data) { move(data); }, - }); + $('#largeimg').CropSelectJs({ + imageSrc: "/{{ appAlias }}/uploads/{{type}}/{{ file }}", + selectionResize: function(data) { resize(data); }, + selectionMove: function(data) { move(data); }, + }); - {% if ratio=="1:1" %} - {% set nbratio=1 %} - {% elseif ratio=="16:9" %} - {% set nbratio=(16/9) %} - {% elseif nbratio=="16:2" %} - {% set class=(16/2) %} + {% if ratio=="1:1" %} + {% set nbratio=1 %} + {% elseif ratio=="16:9" %} + {% set nbratio=(16/9) %} + {% elseif nbratio=="16:2" %} + {% set class=(16/2) %} + {% endif %} + + $('#largeimg').CropSelectJs('setSelectionAspectRatio',{{nbratio}}); {% endif %} - - $('#largeimg').CropSelectJs('setSelectionAspectRatio',{{nbratio}}); - - }); {% endblock %} diff --git a/src/ninesurvey-1.0/templates/Form/fields.html.twig b/src/ninesurvey-1.0/templates/Form/fields.html.twig index 03835d7..b5a5b31 100644 --- a/src/ninesurvey-1.0/templates/Form/fields.html.twig +++ b/src/ninesurvey-1.0/templates/Form/fields.html.twig @@ -83,19 +83,6 @@ les plus importants pour y ajouter le class imposée par Bootstrap 3 #} {%- endblock button_widget %} -{# Personnalisation des attributs des boutons #} -{% block button_attributes -%} - {% if type is defined and type == 'submit' -%} - {% set class = 'btn-primary' %} - {% else %} - {% set class = 'btn-default' %} - {%- endif -%} - - {% set attr = attr|merge({'class': (attr.class|default('') ~ ' btn ' ~ class)|trim}) %} - {{ parent() }} -{%- endblock button_attributes %} - - {# Personnalisation des select #} {% block choice_widget_collapsed %} {% set attr = attr|merge({'class': (attr.class|default('') ~ ' form-control')|trim}) %} diff --git a/src/ninesurvey-1.0/templates/Include/javascript.js.twig b/src/ninesurvey-1.0/templates/Include/javascript.js.twig index f2c43c4..c53991d 100644 --- a/src/ninesurvey-1.0/templates/Include/javascript.js.twig +++ b/src/ninesurvey-1.0/templates/Include/javascript.js.twig @@ -7,6 +7,8 @@ $(document).ready(function() { } ); + $(".pick-a-color").attr("autocomplete","off"); + var doit = true; $("a[data-method]").on('click',function(){ diff --git a/src/ninesurvey-1.0/templates/Include/style.css.twig b/src/ninesurvey-1.0/templates/Include/style.css.twig index e281f44..ffec452 100644 --- a/src/ninesurvey-1.0/templates/Include/style.css.twig +++ b/src/ninesurvey-1.0/templates/Include/style.css.twig @@ -13,6 +13,7 @@ --fontsizeh4: {{ app.session.get('fontsizeh4')~"px"|raw }}; --colorbgbodylight-darker: {{ app.session.get('colorbgbodylight-darker')|raw }}; + --colorbgbodydark-darker: {{ app.session.get('colorbgbodydark-darker')|raw }}; --colorfttitlelight-darker: {{ app.session.get('colorfttitlelight-darker')|raw }}; } @@ -59,6 +60,10 @@ body .nav a{ color: var(--colorfttitledark); } +body .table { + color: var(--colorftbodylight); +} + body .card { background-color: var(--colorbgbodylight); } @@ -80,6 +85,15 @@ body .page-item.active .page-link:hover { border-color: var(--colorfttitlelight); } +body .btn-primary { + background-color: var(--colorbgbodydark); + border-color: var(--colorbgbodydark); +} +body .btn-primary:hover { + background-color: var(--colorbgbodydark-darker); + border-color: var(--colorbgbodydark-darker); +} + body .modal-title { } @@ -134,6 +148,15 @@ body.monocolor .card-header .custom-control { font-size: 80%; } +body.monocolor .btn-primary { + background-color: var(--colorbgbodylight); + border-color: var(--colorbgbodylight); +} +body.monocolor .btn-primary:hover { + background-color: var(--colorbgbodylight-darker); + border-color: var(--colorbgbodylight-darker); +} + /* FONT */ body { font-family: var(--fontbody); diff --git a/src/ninesurvey-1.0/templates/User/edit.html.twig b/src/ninesurvey-1.0/templates/User/edit.html.twig index 33f50ac..d1a8b41 100755 --- a/src/ninesurvey-1.0/templates/User/edit.html.twig +++ b/src/ninesurvey-1.0/templates/User/edit.html.twig @@ -48,7 +48,7 @@ {{ form_widget(form.avatar) }} {% if appMasteridentity=="LDAP" or appMasteridentity=="SQL" %} - Modifier + Modifier {% endif %}