diff --git a/public/index.html b/public/index.html index a0de11a..2dce941 100644 --- a/public/index.html +++ b/public/index.html @@ -7,9 +7,7 @@ - - + - Formation & Tutoriel Gratuit ou payant Excellente qualité + diff --git a/src/components/AddArticleAvis.js b/src/components/AddArticleAvis.js index 314e759..8aa1369 100644 --- a/src/components/AddArticleAvis.js +++ b/src/components/AddArticleAvis.js @@ -138,7 +138,7 @@ const AddArticleAvis = () => { }); }, []) - + return (
diff --git a/src/components/Article.js b/src/components/Article.js index a46c886..589b6ed 100644 --- a/src/components/Article.js +++ b/src/components/Article.js @@ -42,8 +42,50 @@ import { MdDeleteForever } from "react-icons/md"; import { AddCircleOutline } from "@mui/icons-material"; import Popup from 'reactjs-popup'; import 'reactjs-popup/dist/index.css'; +import TextField from '@mui/material/TextField'; + +import CancelPresentationIcon from '@mui/icons-material/CancelPresentation'; +import { IconButton } from '@material-ui/core'; +import { makeStyles } from "@material-ui/core/styles"; +import Paper from '@material-ui/core/Paper'; +import Draggable from 'react-draggable'; + +function PaperComponent(props) { + return ( + + + + ); +} + + +const useStyles = makeStyles((theme) => ({ + + dialog: { + position: 'absolute', + // left: 10, + top: 400 + }, + + paper: { + overflowY: 'unset', + }, + customizedButton: { + position: 'absolute', + left: '98%', + top: '-3%', + backgroundColor: 'lightgray', + color: 'gray', + }, +})); + const Article = (props) => { + + const classes = useStyles(); const history = useHistory(); const [isLoading, setLoading] = useState(); @@ -106,7 +148,7 @@ const Article = (props) => { setLoading(false); if (String(res.data.status) === "true") { //console.log(" In Get_Partner_Article_Avis_Data res.data.status = " + res.data.status); - //console.log(" In Get_Partner_Article_Avis_Data res.data.message r_class = " + res.data.message); + // console.log(" In Get_Partner_Article_Avis_Data res.data.message r_class = " + res.data.message); setGet_Partner_Article_Avis_Data_api("true"); setGet_Partner_Article_Avis_Data_result(res.data.message); @@ -142,6 +184,15 @@ const Article = (props) => { if (mylocal_document.img_path) { setarticle_avis_img_path(mylocal_document.img_path); + } else { + setarticle_avis_img_path(""); + } + + + if (mylocal_document.meta_description) { + setarticle_avis_meta_description(mylocal_document.meta_description); + } else { + setarticle_avis_meta_description(""); } @@ -258,6 +309,7 @@ const Article = (props) => { const [article_avis_internal_url, setarticle_avis_internal_url] = React.useState(""); const [article_avis_display_header_img, setarticle_avis_display_header_img] = React.useState(false); const [article_avis_img_path, setarticle_avis_img_path] = React.useState(""); + const [article_avis_meta_description, setarticle_avis_meta_description] = React.useState(""); function Add_Update_Article_Avis() { @@ -270,6 +322,17 @@ const Article = (props) => { form.append("qualite", ""); form.append("note", ""); + + if (img_img_article_file2) { + form.append('File', img_img_article_file2); + form.append('img_file_name', img_img_article_file2.name); + } + else { + form.append('File', ""); + form.append('img_file_name', ""); + } + + if (!article_avis_img_path || String(article_avis_img_path).trim() === "") { alert(" Vous devez saisir une image à afficher avec l'article "); return; @@ -302,8 +365,18 @@ const Article = (props) => { form.append("user_longitude", longitude); form.append("user_state", state); + // Si une balise meta description n'est pas fourni, alors on lui donne le titre + var local_meta_description = ""; + if (article_avis_meta_description) { + local_meta_description = String(article_avis_meta_description).trim().toLocaleLowerCase().substring(0, 154); + } else { + local_meta_description = String(article_avis_title_formation).trim().toLocaleLowerCase().substring(0, 154); + } + form.append("meta_description", local_meta_description); - //console.log(" ## form = ", form); + + + console.log(" ## form = ", form); var myurl = ""; if (selected_id && String(selected_id).length > 3) { @@ -378,7 +451,229 @@ const Article = (props) => { } + /**** Gestion image de l'article */ + const [logo_file_name, setlogo_file_name] = useState(); + const hiddenFileInput_logo = React.useRef(null); + + const [GetLms_Themes_img_article_Img, setGetLms_Themes_img_article_Img] = useState(""); + + const [handleSubmission_img_article_api, sethandleSubmission_img_article_api] = useState(); + const [handleSubmission_img_article_result, sethandleSubmission_img_article_result] = useState(); + const [handleSubmission_img_article_message, sethandleSubmission_img_article_message] = useState(); + + + const [img_img_article_file, setimg_img_article_file] = useState(); + const [img_bg_file, setimg_bg_file] = useState(); + + const [img_img_article_file2, setimg_img_article_file2] = useState(); + const [img_bg_file2, setimg_bg_file2] = useState(); + + const handleSubmission_logo = event => { + clear_message(); + + + const fileUploaded = event.target.files[0]; + let file_size = event.target.files[0].size; + let file_type = event.target.files[0].type; + + //console.log("file_size = ", file_size, " file_type = ", file_type); + //console.log(" fileUploaded = ", fileUploaded); + if (file_size > 1000000) { + alert("Le fichier ne doit pas dépasser un 1 Méga octets"); + return; + } + + //image/png + if (String(file_type) !== "image/png") { + alert("Le fichier n'est pas au format PNG"); + return; + } + + setLoading(true); + + var _URL = window.URL || window.webkitURL; + var file, img; + var img_height, img_width; + + if ((file = event.target.files[0])) { + img = new Image(); + var objectUrl = _URL.createObjectURL(file); + img.onload = function () { + img_height = this.height; + img_width = this.width; + _URL.revokeObjectURL(objectUrl); + console.log(" img_width = ", img_width, " img_height = ", img_height) + + if (parseFloat(img_width) > 130 && parseFloat(img_width) < 1000 && + parseFloat(img_height) > 130 && parseFloat(img_height) < 1000) { + //console.log(" img_height est = ", img_height, " < à 1500 "); + + // Verification que le nom du fichier est alpha numerique + /*var regExp = /^[A-Za-z0-9]+$/; + if (!regExp.test(event.target.files[0].name)) { + sethandleSubmission_img_article_message(" Le nom de l'image comporte des caractères non alphanumériques"); + sethandleSubmission_img_article_api("false"); + setLoading(false); + + return + }*/ + + + if (String(event.target.files[0].name).length > 50) { + sethandleSubmission_img_article_message(" Le nom du fichier est trop long. il doit faire moins de 50 caractère"); + sethandleSubmission_img_article_api("false"); + setLoading(false); + + return + } + + setlogo_file_name(event.target.files[0].name); + setimg_img_article_file(URL.createObjectURL(event.target.files[0])); + setimg_img_article_file2(event.target.files[0]); + + } else { + sethandleSubmission_img_article_message(" La taille de l'image est incorrecte. Larg = " + String(img_width) + " px Long = " + String(img_height) + " px"); + sethandleSubmission_img_article_api("false"); + setLoading(false); + return; + } + + //console.log(" after img_width = ", img_width, " after img_height = ", img_height) + }; + img.src = objectUrl; + + } + setLoading(false); + }; + + function clear_message() { + sethandleSubmission_img_article_message(); + sethandleSubmission_img_article_api(); + } + + + const [Send_img_article_Img_api, setSend_img_article_Img_api] = useState(); + const [Send_img_article_Img_result, setSend_img_article_Img_result] = useState(); + const [Send_img_article_Img_message, setSend_img_article_Img_message] = useState(); + function Send_img_article_Img() { + clear_message(); + setLoading(true); + const formData = new FormData(); + formData.append('File', img_img_article_file2); + //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); + const stored_cookie = getCookie('tokenmysypart'); + formData.append("token", stored_cookie); + + console.log(" ## le nom du fichier est : ", img_img_article_file2.name); + + fetch( + process.env.REACT_APP_API_URL + "myclass/api/Blog_Img_Store_Article_Image/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + //console.log('Success:', result['message']); + + if (String(result['status']) === String("true")) { + setSend_img_article_Img_api("true"); + alert(" La mise à jour du logo a été correctement effectuée. "); + + } else if (String(result['status']) === String("Err_Connexion")) { + alert('Erreur: ' + result['message']); + history.push("/Connexion"); + } + + else { + setSend_img_article_Img_api("false"); + setSend_img_article_Img_message(result['message']); + } + setLoading(false); + + }) + .catch((error) => { + console.error('Error:', error); + setSend_img_article_Img_api("false"); + + setLoading(false); + }); + + } + + + const [Delete_img_article_Img_api, setDelete_img_article_Img_api] = useState(); + const [Delete_img_article_Img_result, setDelete_img_article_Img_result] = useState(); + const [Delete_img_article_Img_message, setDelete_img_article_Img_message] = useState(); + function Delete_img_article_Img() { + clear_message(); + + + setLoading(true); + + + const formData = new FormData(); + + //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); + const stored_cookie = getCookie('tokenmysypart'); + formData.append("token", stored_cookie); + + + fetch( + process.env.REACT_APP_API_URL + "myclass/api/Lms_Delete_img_article_File/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + //console.log('Success:', result['message']); + + if (String(result['status']) === String("true")) { + setDelete_img_article_Img_api("true"); + setGetLms_Themes_img_article_Img(''); + alert(" Le logo a été correctement supprimé "); + + } else if (String(result['status']) === String("Err_Connexion")) { + alert('Erreur: ' + result['message']); + history.push("/Connexion"); + } + + else { + setDelete_img_article_Img_api("false"); + setDelete_img_article_Img_message(result['message']); + } + setLoading(false); + + }) + .catch((error) => { + console.error('Error:', error); + setDelete_img_article_Img_api("false"); + setDelete_img_article_Img_message(" Impossible de supprimer le fichier logo"); + setLoading(false); + }); + + } + + const changeHandler2_logo = (event) => { + clear_message(); + hiddenFileInput_logo.current.click(); + }; + + function Annule_img_article_img() { + clear_message(); + setimg_img_article_file(); + setimg_img_article_file2(); + sethandleSubmission_img_article_message(); + setSend_img_article_Img_api(); + setSend_img_article_Img_message(); + setlogo_file_name(); + } + + /***** Fin gestion de l'image de l'article */ return (
@@ -388,8 +683,30 @@ const Article = (props) => { {/*** GESTION article */} null} + + PaperProps={{ + + + className: classes.paper, // Apply the paper style + style: { + overflowY: 'unset', + position: 'absolute', + top: '5rem', + margin: "2px", + }, + }} + hideBackdrop={true} + disableScrollLock + classes={{ + paper: classes.dialog + }} + + PaperComponent={PaperComponent} + aria-labelledby="draggable-dialog-title" > Votre article @@ -453,7 +770,7 @@ const Article = (props) => {
{ setarticle_avis_display_header_img(e.target.checked); @@ -470,27 +787,142 @@ const Article = (props) => {
-
-
- { - setarticle_avis_img_path(e.target.value); - setis_data_changed("1"); - }} - className='disabled_style_width_100_percent' +
+
+ { + setarticle_avis_img_path(e.target.value); + setis_data_changed("1"); + }} + className='disabled_style_width_100_percent' - > + > +
+
+
+ +
+
+ Image Url (a poster) +
+ ---------------- +
+ +
Import du logo
+
+   +
+ +
+ + {logo_file_name && } + + + {img_img_article_file && } + + {String(Send_img_article_Img_api) === "true" &&
La mise à jour a été correctement faite
} + {String(Send_img_article_Img_api) === "false" &&
{Send_img_article_Img_message}
} + + {String(handleSubmission_img_article_api) === "false" &&
{handleSubmission_img_article_message}
} + + + +
+ +
+
+   +
+ {
+ +
+ +
+ +
+ + + + +
+ +
} +
+   +
+ +
+
+ + ---------------
+
+
+ Meta description u +
+ + { + setarticle_avis_meta_description(e.target.value); + setis_data_changed("1"); + } + } + + + /> +
+ +
+ +
@@ -542,9 +974,17 @@ const Article = (props) => { + + +
- +
diff --git a/src/components/ButtonHilight.js b/src/components/ButtonHilight.js index 634c227..ca16ebc 100644 --- a/src/components/ButtonHilight.js +++ b/src/components/ButtonHilight.js @@ -355,7 +355,7 @@ const ButtonHilight = () => { setcontact_message_sujet(""); setcontact_message_message(""); } - + const [contact_message_nom_prenom, setcontact_message_nom_prenom] = React.useState(""); const [contact_message_email, setcontact_message_email] = React.useState(""); const [contact_message_phone, setcontact_message_phone] = React.useState(""); @@ -606,7 +606,7 @@ const ButtonHilight = () => {
- + {/* @@ -615,7 +615,7 @@ const ButtonHilight = () => { - +*/} { return (
- MySy Training, contactez-nous diff --git a/src/components/DisplayDetailArticle_new_v2.js b/src/components/DisplayDetailArticle_new_v2.js index 7194a36..b12eb88 100644 --- a/src/components/DisplayDetailArticle_new_v2.js +++ b/src/components/DisplayDetailArticle_new_v2.js @@ -1,24 +1,20 @@ import React, { useRef, useState, useEffect } from "react"; import axios from "axios"; -import bannerimg2 from "../mysy_img/MYSY-LOGO-BLUE.png"; + import { useParams } from 'react-router-dom' import { Button, } from "reactstrap"; import { Helmet } from "react-helmet"; import { useCookies } from "react-cookie"; -import { FacebookShareButton, LinkedinShareButton, TwitterShareButton } from "react-share"; -import { SocialIcon } from 'react-social-icons'; -import ReactStars from "react-rating-stars-component"; + import { confirmAlert } from 'react-confirm-alert'; //mport slideimg4 from "../mysy_img/mysy_img.png"; import 'react-slideshow-image/dist/styles.css' import slideimg1 from "../mysy_img/Image_article2.jpg"; //import slideimg4 from "../mysy_img/Image_article1.png"; import Articles from "../components/Article"; -import { Fade } from 'react-slideshow-image'; -import { CommentSection } from 'react-comments-section' -import DiscussionBoard from 'react-discussion-board' + import 'react-discussion-board/dist/index.css' -import ArticleComment from "./ArticleComment" + import { useForm } from 'react-hook-form'; import { Editor } from "react-draft-wysiwyg"; import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css"; @@ -29,10 +25,7 @@ import logowhite from "../mysy_img/MYSY-LOGO-WHITE.png"; import Footer from "./Fotter"; import Fotter_v3 from "./Fotter_v3"; import Header from "./Header"; -import ListeArticle from "./ListeArticles"; -import moment from "moment"; -import slidearticle1 from "../mysy_img/Image_article2.jpg"; -import slidearticle2 from "../mysy_img/Image_article1.png"; + import img_met_digital from "../mysy_img/met_digital.jpg"; import connect_white from "../mysy_img/connect_white_v2.png"; import connect_green from "../mysy_img/connect_green.png"; @@ -41,7 +34,7 @@ import { getCookie, removeCookie } from 'react-use-cookie'; import MenuItem from "@material-ui/core/MenuItem"; import Menu from "@material-ui/core/Menu"; - + import { useLocation } from "react-router-dom"; @@ -258,10 +251,11 @@ const DisplayDetailArticle_new_v2 = (props) => { const [pagecanoniktitle, setpagecanoniktitle] = useState(""); const [pagecanonikurl, setpagecanonikurl] = useState(window.location.host); const [article_img, setarticle_img] = useState("") + const [page_meta_description, setpage_meta_description] = useState(""); useEffect(() => { - + setpagecanonikurl(window.location.host); async function fetchData() { @@ -283,7 +277,7 @@ const DisplayDetailArticle_new_v2 = (props) => { // Display_article_comment(); Get_3_Articles(); - + //alert("stored_user = "+stored_user); @@ -343,13 +337,20 @@ const DisplayDetailArticle_new_v2 = (props) => { } if (my_avis && my_avis.title_formation) { - setpagecanoniktitle(my_avis.title_formation) + setpagecanoniktitle(my_avis.title_formation); } + if (my_avis && my_avis.meta_description) { + setpage_meta_description(my_avis.meta_description); + } else { + setpage_meta_description(my_avis.title_formation); + } + + if (my_avis && my_avis.internal_url) { setpagecanonikurl(my_avis.internal_url); - console.log(process.env.REACT_APP_BASE_URL+"/"+my_avis.internal_url); + console.log(process.env.REACT_APP_BASE_URL + "/" + my_avis.internal_url); } @@ -449,7 +450,7 @@ const DisplayDetailArticle_new_v2 = (props) => { setmyApicommentResponse("False"); }) } - + function RecordArticle(e) { @@ -937,19 +938,18 @@ const DisplayDetailArticle_new_v2 = (props) => { return (
- - - - {`${pagecanoniktitle}`} - - - - - - + + {`${pagecanoniktitle}`} + + + + + + +
@@ -978,7 +978,7 @@ const DisplayDetailArticle_new_v2 = (props) => {
- +
{DetailArticleAvis && DetailArticleAvis.avis &&
diff --git a/src/components/HebergementLms.js b/src/components/HebergementLms.js index 8d80a7c..ce73e4f 100644 --- a/src/components/HebergementLms.js +++ b/src/components/HebergementLms.js @@ -314,11 +314,7 @@ function HebergementLms(props) { const [Send_logo_Img_message, setSend_logo_Img_message] = useState(); function Send_logo_Img() { clear_message(); - - setLoading(true); - - const formData = new FormData(); formData.append('File', img_logo_file2); //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); diff --git a/src/components/Mon_Catalogue_Public.js b/src/components/Mon_Catalogue_Public.js index 8a08fe7..04f6a1e 100644 --- a/src/components/Mon_Catalogue_Public.js +++ b/src/components/Mon_Catalogue_Public.js @@ -2889,7 +2889,7 @@ const Mon_Catalogue_Public = (props) => { Formation & Tutoriel Gratuit ou payant Excellente qualité - + diff --git a/src/components/RechercheArticles_new_v2.js b/src/components/RechercheArticles_new_v2.js index 2631bb3..d0425f4 100644 --- a/src/components/RechercheArticles_new_v2.js +++ b/src/components/RechercheArticles_new_v2.js @@ -49,8 +49,49 @@ import { FcPlus } from "react-icons/fc"; import Autocomplete from '@mui/material/Autocomplete'; import TextField from '@mui/material/TextField'; +import CancelPresentationIcon from '@mui/icons-material/CancelPresentation'; +import { IconButton } from '@material-ui/core'; +import { makeStyles } from "@material-ui/core/styles"; +import Paper from '@material-ui/core/Paper'; +import Draggable from 'react-draggable'; + +function PaperComponent(props) { + return ( + + + + ); +} + + +const useStyles = makeStyles((theme) => ({ + + dialog: { + position: 'absolute', + // left: 10, + top: 400 + }, + + paper: { + overflowY: 'unset', + }, + customizedButton: { + position: 'absolute', + left: '98%', + top: '-3%', + backgroundColor: 'lightgray', + color: 'gray', + }, +})); + + + let PageSize = 5; const RechercheArticles_new_v2 = (props) => { + const classes = useStyles(); const [userconnected, setuserconnected] = useState(""); const [SearchText, setSearchText] = useState(""); const [result, setResult] = useState(""); @@ -744,9 +785,13 @@ const RechercheArticles_new_v2 = (props) => { const [article_avis_internal_url, setarticle_avis_internal_url] = React.useState(""); const [article_avis_display_header_img, setarticle_avis_display_header_img] = React.useState(false); const [article_avis_img_path, setarticle_avis_img_path] = React.useState(""); + const [article_avis_meta_description, setarticle_avis_meta_description] = React.useState(""); function Add_Update_Article_Avis(e) { + clear_message(); + setLoading(true); + var form = new FormData(); const stored_cookie = getCookie('tokenmysypart'); @@ -756,6 +801,17 @@ const RechercheArticles_new_v2 = (props) => { form.append("qualite", " --- "); form.append("note", "---"); + if (img_img_article_file2) { + form.append('File', img_img_article_file2); + form.append('img_file_name', img_img_article_file2.name); + } + else { + form.append('File', ""); + form.append('img_file_name', ""); + } + + + if (!article_avis_img_path || String(article_avis_img_path).trim() === "") { alert(" Vous devez saisir une image à afficher avec l'article "); return; @@ -788,8 +844,17 @@ const RechercheArticles_new_v2 = (props) => { form.append("user_longitude", longitude); form.append("user_state", state); + // Si une balise meta description n'est pas fourni, alors on lui donne le titre + var local_meta_description = ""; + if (article_avis_meta_description) { + local_meta_description = String(article_avis_meta_description).trim().toLocaleLowerCase().substring(0, 154); + } else { + local_meta_description = String(article_avis_title_formation).trim().toLocaleLowerCase().substring(0, 154); + } + form.append("meta_description", state); - //console.log(" ## form = ", form); + + console.log(" ## form = ", form); var myurl = process.env.REACT_APP_API_URL + "myclass/api/add_articles_avis/"; axios.post(myurl, form).then(res => { @@ -817,7 +882,7 @@ const RechercheArticles_new_v2 = (props) => { } - + const editorRef_texte_avis = useRef(null); const [editorRef_texte_avis_limite, seteditorRef_texte_avis] = useState(1000); const [field_texte_avis, setfield_texte_avis] = useState(""); @@ -839,7 +904,231 @@ const RechercheArticles_new_v2 = (props) => { ] const [publish_status, setpublish_status] = useState("published"); + const [isLoading, setLoading] = useState(); + /**** Gestion image de l'article */ + + const [logo_file_name, setlogo_file_name] = useState(); + const hiddenFileInput_logo = React.useRef(null); + + const [GetLms_Themes_img_article_Img, setGetLms_Themes_img_article_Img] = useState(""); + + const [handleSubmission_img_article_api, sethandleSubmission_img_article_api] = useState(); + const [handleSubmission_img_article_result, sethandleSubmission_img_article_result] = useState(); + const [handleSubmission_img_article_message, sethandleSubmission_img_article_message] = useState(); + + + const [img_img_article_file, setimg_img_article_file] = useState(); + const [img_bg_file, setimg_bg_file] = useState(); + + const [img_img_article_file2, setimg_img_article_file2] = useState(); + const [img_bg_file2, setimg_bg_file2] = useState(); + + const handleSubmission_logo = event => { + clear_message(); + + + const fileUploaded = event.target.files[0]; + let file_size = event.target.files[0].size; + let file_type = event.target.files[0].type; + + //console.log("file_size = ", file_size, " file_type = ", file_type); + //console.log(" fileUploaded = ", fileUploaded); + if (file_size > 1000000) { + alert("Le fichier ne doit pas dépasser un 1 Méga octets"); + return; + } + + //image/png + if (String(file_type) !== "image/png") { + alert("Le fichier n'est pas au format PNG"); + return; + } + + setLoading(true); + + var _URL = window.URL || window.webkitURL; + var file, img; + var img_height, img_width; + + if ((file = event.target.files[0])) { + img = new Image(); + var objectUrl = _URL.createObjectURL(file); + img.onload = function () { + img_height = this.height; + img_width = this.width; + _URL.revokeObjectURL(objectUrl); + console.log(" img_width = ", img_width, " img_height = ", img_height) + + if (parseFloat(img_width) > 130 && parseFloat(img_width) < 1000 && + parseFloat(img_height) > 130 && parseFloat(img_height) < 1000) { + //console.log(" img_height est = ", img_height, " < à 1500 "); + + // Verification que le nom du fichier est alpha numerique + /*var regExp = /^[A-Za-z0-9]+$/; + if (!regExp.test(event.target.files[0].name)) { + sethandleSubmission_img_article_message(" Le nom de l'image comporte des caractères non alphanumériques"); + sethandleSubmission_img_article_api("false"); + setLoading(false); + + return + }*/ + + + if (String(event.target.files[0].name).length > 50) { + sethandleSubmission_img_article_message(" Le nom du fichier est trop long. il doit faire moins de 50 caractère"); + sethandleSubmission_img_article_api("false"); + setLoading(false); + + return + } + + setlogo_file_name(event.target.files[0].name); + setimg_img_article_file(URL.createObjectURL(event.target.files[0])); + setimg_img_article_file2(event.target.files[0]); + + } else { + sethandleSubmission_img_article_message(" La taille de l'image est incorrecte. Larg = " + String(img_width) + " px Long = " + String(img_height) + " px"); + sethandleSubmission_img_article_api("false"); + setLoading(false); + return; + } + + //console.log(" after img_width = ", img_width, " after img_height = ", img_height) + }; + img.src = objectUrl; + + } + setLoading(false); + }; + + function clear_message() { + sethandleSubmission_img_article_message(); + sethandleSubmission_img_article_api(); + } + + + const [Send_img_article_Img_api, setSend_img_article_Img_api] = useState(); + const [Send_img_article_Img_result, setSend_img_article_Img_result] = useState(); + const [Send_img_article_Img_message, setSend_img_article_Img_message] = useState(); + function Send_img_article_Img() { + clear_message(); + setLoading(true); + const formData = new FormData(); + formData.append('File', img_img_article_file2); + //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); + const stored_cookie = getCookie('tokenmysypart'); + formData.append("token", stored_cookie); + + console.log(" ## le nom du fichier est : ", img_img_article_file2.name); + + fetch( + process.env.REACT_APP_API_URL + "myclass/api/Blog_Img_Store_Article_Image/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + //console.log('Success:', result['message']); + + if (String(result['status']) === String("true")) { + setSend_img_article_Img_api("true"); + alert(" La mise à jour du logo a été correctement effectuée. "); + + } else if (String(result['status']) === String("Err_Connexion")) { + alert('Erreur: ' + result['message']); + history.push("/Connexion"); + } + + else { + setSend_img_article_Img_api("false"); + setSend_img_article_Img_message(result['message']); + } + setLoading(false); + + }) + .catch((error) => { + console.error('Error:', result); + setSend_img_article_Img_api("false"); + setSend_img_article_Img_message(result['message']); + setLoading(false); + }); + + } + + + const [Delete_img_article_Img_api, setDelete_img_article_Img_api] = useState(); + const [Delete_img_article_Img_result, setDelete_img_article_Img_result] = useState(); + const [Delete_img_article_Img_message, setDelete_img_article_Img_message] = useState(); + function Delete_img_article_Img() { + clear_message(); + + + setLoading(true); + + + const formData = new FormData(); + + //formData.append('token', 'K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA'); + const stored_cookie = getCookie('tokenmysypart'); + formData.append("token", stored_cookie); + + + fetch( + process.env.REACT_APP_API_URL + "myclass/api/Lms_Delete_img_article_File/", + { + method: 'POST', + body: formData, + } + ) + .then((response) => response.json()) + .then((result) => { + //console.log('Success:', result['message']); + + if (String(result['status']) === String("true")) { + setDelete_img_article_Img_api("true"); + setGetLms_Themes_img_article_Img(''); + alert(" Le logo a été correctement supprimé "); + + } else if (String(result['status']) === String("Err_Connexion")) { + alert('Erreur: ' + result['message']); + history.push("/Connexion"); + } + + else { + setDelete_img_article_Img_api("false"); + setDelete_img_article_Img_message(result['message']); + } + setLoading(false); + + }) + .catch((error) => { + console.error('Error:', error); + setDelete_img_article_Img_api("false"); + setDelete_img_article_Img_message(" Impossible de supprimer le fichier logo"); + setLoading(false); + }); + + } + + const changeHandler2_logo = (event) => { + clear_message(); + hiddenFileInput_logo.current.click(); + }; + + function Annule_img_article_img() { + clear_message(); + setimg_img_article_file(); + setimg_img_article_file2(); + sethandleSubmission_img_article_message(); + setSend_img_article_Img_api(); + setSend_img_article_Img_message(); + setlogo_file_name(); + } + + /***** Fin gestion de l'image de l'article */ return (
@@ -847,8 +1136,30 @@ const RechercheArticles_new_v2 = (props) => { {/*** GESTION article */} null} + + PaperProps={{ + + + className: classes.paper, // Apply the paper style + style: { + overflowY: 'unset', + position: 'absolute', + top: '5rem', + margin: "2px", + }, + }} + hideBackdrop={true} + disableScrollLock + classes={{ + paper: classes.dialog + }} + + PaperComponent={PaperComponent} + aria-labelledby="draggable-dialog-title" > Votre article @@ -949,8 +1260,126 @@ const RechercheArticles_new_v2 = (props) => {
+ +
+
+ Image Url (a poster) +
+ ---------------- +
+ +
Import du logo
+
+   +
+ +
+ + {logo_file_name && } + + + {img_img_article_file && } + + {String(Send_img_article_Img_api) === "true" &&
La mise à jour a été correctement faite
} + {String(Send_img_article_Img_api) === "false" &&
{Send_img_article_Img_message}
} + + {String(handleSubmission_img_article_api) === "false" &&
{handleSubmission_img_article_message}
} + + + +
+ +
+
+   +
+ {
+ +
+ +
+ +
+ + + + +
+ +
} +
+   +
+ +
+
+ + --------------- + +
+
+ + +
+
+ Meta description +
+ + { + setarticle_avis_meta_description(e.target.value); + setis_data_changed("1"); + } + } + + + /> +
+ +
+ +
+
Texte Article @@ -1001,6 +1430,17 @@ const RechercheArticles_new_v2 = (props) => { + + + + + +
@@ -1020,12 +1460,9 @@ const RechercheArticles_new_v2 = (props) => {
- - - Le blog, liste des articles + -