From 2312297c4a78da209c373b8b7017cdf36d003dd1 Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 27 Jan 2020 11:53:04 +0100 Subject: [PATCH] =?UTF-8?q?renommages=20des=20bien=20->=20article=20ajout?= =?UTF-8?q?=20d'un=20param=C3=A8tre=20au=20plugin=20(pour=20les=20groupes)?= =?UTF-8?q?=20mise=20en=20forme=20des=20formulaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/editer_article.html | 46 +++++ content/editer_bien.html | 35 ---- css/_sq_balint.scss | 84 +++----- css/_variables.scss | 3 +- css/mon_site.css | 132 +++++-------- formulaires/configurer_balint.html | 16 +- formulaires/editer_article.html | 160 +++++++++++++++ formulaires/editer_article.php | 307 +++++++++++++++++++++++++++++ formulaires/login.html | 2 +- inclure/diaporama_accueil.html | 10 +- paquet.xml | 2 +- 11 files changed, 609 insertions(+), 188 deletions(-) create mode 100644 content/editer_article.html delete mode 100644 content/editer_bien.html create mode 100644 formulaires/editer_article.html create mode 100644 formulaires/editer_article.php diff --git a/content/editer_article.html b/content/editer_article.html new file mode 100644 index 0000000..01e22c8 --- /dev/null +++ b/content/editer_article.html @@ -0,0 +1,46 @@ +
+ +
+ + [(#ENV{id_article}|?{ + [(#INCLURE{fond=inclure/bouton_supprimer,id_article=#ENV{id_article}})] + [(#INCLURE{fond=inclure/bouton_une,id_article=#ENV{id_article}})] +

Éditer l'article n°[(#ENV{id_article})]

+ , +

Rédiger un article

+ })] + + [(#SESSION{id_auteur}|oui) + [(#ENV{id_article}|oui) + [(#AUTORISER{modifier, article, #ENV{id_article}}|?{ +
+ [(#FORMULAIRE_EDITER_ARTICLE{#ENV{id_article}})]
+
+ , +
Votre compte ne fait pas partie des auteurs autorisés à modifier cet article.
+ })] + ] + [(#ENV{id_article}|non) + [(#AUTORISER{creer, article}|?{ +
+ [(#FORMULAIRE_EDITER_ARTICLE)] +
+ , +
Votre compte n'a pas les droits suffisants pour créer un article.
+ })] + ] + ] + [(#SESSION{id_auteur}|non) +
+
+ [(#FORMULAIRE_LOGIN{#SELF})] +
+

ou

+
+ [(#FORMULAIRE_INSCRIPTION{#SELF})] +
+
+ ] +
+ +
diff --git a/content/editer_bien.html b/content/editer_bien.html deleted file mode 100644 index 706190c..0000000 --- a/content/editer_bien.html +++ /dev/null @@ -1,35 +0,0 @@ -[(#ENV{id_article}|?{ - [(#INCLURE{fond=inclure/bouton_supprimer,id_article=#ENV{id_article}})] - [(#INCLURE{fond=inclure/bouton_une,id_article=#ENV{id_article}})] -

Éditer l'article n°[(#ENV{id_article})]

- , -

Créer un article

-})] - -
- [(#SESSION{id_auteur}|oui) - [(#ENV{id_article}|oui) - [(#AUTORISER{modifier, article, #ENV{id_article}}|?{ - [(#FORMULAIRE_EDITER_BIEN{#ENV{id_article}})]
- , -
Votre compte ne fait pas partie des auteurs autorisés à modifier cet article.
- })] - ] - [(#ENV{id_article}|non) - [(#AUTORISER{creer, article}|?{ - [(#FORMULAIRE_EDITER_BIEN)] - , -
Votre compte n'a pas les droits suffisants pour créer un article.
- })] - ] - ] - [(#SESSION{id_auteur}|non) -
- [(#FORMULAIRE_LOGIN{#ENV{url}})] -
-

ou

-
- [(#FORMULAIRE_INSCRIPTION)] -
- ] -
diff --git a/css/_sq_balint.scss b/css/_sq_balint.scss index 91bcda4..b3c12f9 100644 --- a/css/_sq_balint.scss +++ b/css/_sq_balint.scss @@ -231,18 +231,15 @@ body{ max-width: 100%; } .formulaire_nous_contacter{ + background: none; input, textarea{ background-color: $light; - padding: 0.5rem; border: none; - border-radius: 0.2rem; } input.submit{ border: solid 2px $light; - font-size: 1.5rem; background: none; color: $light; - cursor: pointer; &:hover{ background: rgba(255,255,255,0.25); border-color: transparent; @@ -342,7 +339,7 @@ body{ padding: 10px 15px; } - .colophon{ + .footer-options{ background:$fond-footer; padding: 1rem 0; ul{ @@ -351,7 +348,7 @@ body{ } } - .colophon .generator { + .footer-options .generator { max-width: 300px; } .lien_cc svg { @@ -367,7 +364,7 @@ body{ .nav li { display: inline-block !important; } .nav li:not(.generator) a { display: inline; } .nav li.separ { border: none; } - .nav li.separ:not(:first-of-type)::before { content: " | "; } + //.nav li.separ:not(:first-of-type)::before { content: " | "; } .generator { /*position: absolute; top: 1rem; right: 0; max-width: 200px;*/ float: right; } .nav li a .title { display: none; } } @@ -410,16 +407,39 @@ body{ /**********************************************************************/ .boutons .submit { - font-size: 2.5rem; + font-size: 1.5rem; + line-height: 1rem; + padding: 1rem; + border: solid 1px $light; + border-radius: 0.5rem; + background-color: #4f56cd; + color: $light; + &:hover{ + background-color: #7276ee; + cursor: pointer; + } } .btn.pull-right, .une_OK { margin-left: 2rem; } +.formulaire_spip{ + background: $fond-formulaires; + border-radius: 0.5rem; + fieldset legend{ + background: none; + } + input, textarea{ + padding: 0.5rem; + border-radius: 0.2rem; + border: solid 1px grey; + } +} + /**********************************************************************/ /*************** FORMULAIRE DE SAISIE D'ARTICLE ***********************/ /**********************************************************************/ -.formulaire_editer_bien { +.formulaire_editer_article { clear: none; .resume textarea { min-height: 25rem; } .upload_vignette { @@ -431,24 +451,8 @@ body{ } } } - .col_droite { - float: right; - width: 33%; - clear: right; - } - .principal, .auteurs { width: 60%; } - .formulaire_uploadhtml5 { - margin-bottom: 0; - float: left; - width: 100%; - .dropzone { - min-height: 50px; - .dz-message { margin: .5em 0; } - } - @include media-breakpoint-up(lg) { - width: 25%; - } - } + + .photo_bien { justify-content: left; .une_photo { @@ -474,32 +478,6 @@ body{ width: auto; } } -.une_OK i.fas { color: green; } - -/**********************************************************************/ -/******** FORMULAIRE DE CONNEXION / CREATION DE COMPTE ****************/ -/**********************************************************************/ - -#choix_connexion { - fieldset { - clear: none; - margin-bottom: 2rem; - border: solid 1px #BBB; - padding: 1.5rem; - background-color: #FCFCFC; - > div { margin-bottom: 1.2rem;} - } -} -@include media-breakpoint-up(md) { - #choix_connexion { flex-wrap: nowrap; } -} -.bloc_connexion { - flex-grow: 1; -} -.creer_associer_compte { - flex-grow: 2; -} - /**********************************************************************/ /****************************** spip_admin ****************************/ diff --git a/css/_variables.scss b/css/_variables.scss index e2f2b29..d312f9b 100644 --- a/css/_variables.scss +++ b/css/_variables.scss @@ -5,9 +5,8 @@ $couleur-liens : #dc7544; $page-active: #ffe9aa; $fond-footer: #464ba3; $titres-footer: #64d4af; +$fond-formulaires: rgba(255,255,255,0.8); $fond-transparent: rgba(255, 255, 255, 0.92); -$fond-rouge: #882625; - $bg-body: url('../images/bg-web.jpg'); $bg-presentation: url('../images/bg-rouge-fonce-3.jpg'); diff --git a/css/mon_site.css b/css/mon_site.css index 0da3774..1c950a3 100644 --- a/css/mon_site.css +++ b/css/mon_site.css @@ -12086,19 +12086,19 @@ body { max-width: 100%; } +#nous-contacter .formulaire_nous_contacter { + background: none; +} + #nous-contacter .formulaire_nous_contacter input, #nous-contacter .formulaire_nous_contacter textarea { background-color: #f8f9fa; - padding: 0.5rem; border: none; - border-radius: 0.2rem; } #nous-contacter .formulaire_nous_contacter input.submit { border: solid 2px #f8f9fa; - font-size: 1.5rem; background: none; color: #f8f9fa; - cursor: pointer; } #nous-contacter .formulaire_nous_contacter input.submit:hover { @@ -12209,19 +12209,19 @@ body { padding: 10px 15px; } -.footer .colophon { +.footer .footer-options { background: #464ba3; padding: 1rem 0; } -.footer .colophon ul { +.footer .footer-options ul { -webkit-box-pack: justify; justify-content: space-between; -webkit-box-align: center; align-items: center; } -.footer .colophon .generator { +.footer .footer-options .generator { max-width: 300px; } @@ -12253,9 +12253,6 @@ body { .footer .nav li.separ { border: none; } - .footer .nav li.separ:not(:first-of-type)::before { - content: " | "; - } .footer .generator { /*position: absolute; top: 1rem; right: 0; max-width: 200px;*/ float: right; @@ -12305,74 +12302,70 @@ body { /**************** TOUS LES FORMULAIRES DE CONNEXION *******************/ /**********************************************************************/ .boutons .submit { - font-size: 2.5rem; + font-size: 1.5rem; + line-height: 1rem; + padding: 1rem; + border: solid 1px #f8f9fa; + border-radius: 0.5rem; + background-color: #4f56cd; + color: #f8f9fa; +} + +.boutons .submit:hover { + background-color: #7276ee; + cursor: pointer; } .btn.pull-right, .une_OK { margin-left: 2rem; } +.formulaire_spip { + background: rgba(255, 255, 255, 0.8); + border-radius: 0.5rem; +} + +.formulaire_spip fieldset legend { + background: none; +} + +.formulaire_spip input, .formulaire_spip textarea { + padding: 0.5rem; + border-radius: 0.2rem; + border: solid 1px grey; +} + /**********************************************************************/ /*************** FORMULAIRE DE SAISIE D'ARTICLE ***********************/ /**********************************************************************/ -.formulaire_editer_bien { +.formulaire_editer_article { clear: none; } -.formulaire_editer_bien .resume textarea { +.formulaire_editer_article .resume textarea { min-height: 25rem; } -.formulaire_editer_bien .upload_vignette label { +.formulaire_editer_article .upload_vignette label { display: block; } -.formulaire_editer_bien .upload_vignette .ajaxbloc { +.formulaire_editer_article .upload_vignette .ajaxbloc { clear: both; } @media (min-width: 992px) { - .formulaire_editer_bien .upload_vignette .ajaxbloc { + .formulaire_editer_article .upload_vignette .ajaxbloc { clear: initial; } } -.formulaire_editer_bien .col_droite { - float: right; - width: 33%; - clear: right; -} - -.formulaire_editer_bien .principal, .formulaire_editer_bien .auteurs { - width: 60%; -} - -.formulaire_editer_bien .formulaire_uploadhtml5 { - margin-bottom: 0; - float: left; - width: 100%; -} - -.formulaire_editer_bien .formulaire_uploadhtml5 .dropzone { - min-height: 50px; -} - -.formulaire_editer_bien .formulaire_uploadhtml5 .dropzone .dz-message { - margin: .5em 0; -} - -@media (min-width: 992px) { - .formulaire_editer_bien .formulaire_uploadhtml5 { - width: 25%; - } -} - -.formulaire_editer_bien .photo_bien { +.formulaire_editer_article .photo_bien { -webkit-box-pack: left; justify-content: left; } -.formulaire_editer_bien .photo_bien .une_photo { +.formulaire_editer_article .photo_bien .une_photo { margin-right: 1rem; display: -webkit-box; display: flex; @@ -12382,60 +12375,25 @@ body { max-width: 320px; } -.formulaire_editer_bien .photo_bien .boutons_actions { +.formulaire_editer_article .photo_bien .boutons_actions { width: 100%; display: -webkit-box; display: flex; justify-content: space-around; } -.formulaire_editer_bien .photo_bien .boutons_actions i.green { +.formulaire_editer_article .photo_bien .boutons_actions i.green { padding: .6rem 1.5rem; } -.formulaire_editer_bien .photo_bien .boutons_actions a { +.formulaire_editer_article .photo_bien .boutons_actions a { margin: 0; } -.formulaire_editer_bien legend { +.formulaire_editer_article legend { width: auto; } -.une_OK i.fas { - color: green; -} - -/**********************************************************************/ -/******** FORMULAIRE DE CONNEXION / CREATION DE COMPTE ****************/ -/**********************************************************************/ -#choix_connexion fieldset { - clear: none; - margin-bottom: 2rem; - border: solid 1px #BBB; - padding: 1.5rem; - background-color: #FCFCFC; -} - -#choix_connexion fieldset > div { - margin-bottom: 1.2rem; -} - -@media (min-width: 768px) { - #choix_connexion { - flex-wrap: nowrap; - } -} - -.bloc_connexion { - -webkit-box-flex: 1; - flex-grow: 1; -} - -.creer_associer_compte { - -webkit-box-flex: 2; - flex-grow: 2; -} - /**********************************************************************/ /****************************** spip_admin ****************************/ /**********************************************************************/ diff --git a/formulaires/configurer_balint.html b/formulaires/configurer_balint.html index d2f1b72..7fc0c8c 100644 --- a/formulaires/configurer_balint.html +++ b/formulaires/configurer_balint.html @@ -40,14 +40,20 @@
- #SET{name,id_bien} - #SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}} + #SET{name1,id_rub_articles} + #SET{name2,id_rub_groupes} + #SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name1}}|table_valeur{#GET{name2}}} #SET{obli,"obligatoire"} Configuration de l'arborescence -
- +
+ [(#GET{erreurs})] - + +
+
+ + [(#GET{erreurs})] +
diff --git a/formulaires/editer_article.html b/formulaires/editer_article.html new file mode 100644 index 0000000..e67813a --- /dev/null +++ b/formulaires/editer_article.html @@ -0,0 +1,160 @@ + +
+ + [

(#ENV*{message_erreur})

] + [

(#ENV*{message_ok})

] + +
+ + #ACTION_FORMULAIRE{#ENV{action}} + +
+
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ + [(#REM) champ_1 en attente +
+ + + OU + +
+ ] + [(#REM) champ_2 en attente +
+ + + OU + +
+ ] + [(#REM) les champs non utilisés +
+ + +
+ +
+ + +
+ +
+ + +
+ ] +
+ [(#REM) +
+ Localisation + + [(#SAISIE{carte,editer_gis_oui,env})] + + [(#SAISIE{input,lat, + label=<:gis:lat:>, + defaut=#ENV{lat,#CONFIG{gis/lat,0}}, + obligatoire=oui})] + [(#SAISIE{input,lon, + label=<:gis:lon:>, + defaut=#ENV{lon,#CONFIG{gis/lon,0}}, + obligatoire=oui})] +
+ ] +
+ + +
+
+ Groupe +
+ +
+
+ + +
+ Emplacements + +
+ +
+ +
+
+ +
+ Photos + +
+ +
+ +
+ +

+ +
+
+
+ + +
+ + + + + + diff --git a/formulaires/editer_article.php b/formulaires/editer_article.php new file mode 100644 index 0000000..b9e1c44 --- /dev/null +++ b/formulaires/editer_article.php @@ -0,0 +1,307 @@ + 'image_web','taille_max'=>'2000','largeur_max'=>'2048','hauteur_max'=>'2048']; + $bigform($options,$erreurs); + + return $erreurs; +} + +function formulaires_editer_bien_traiter_dist($id_article=0, $redirect=''){ + $new = $id_article; + if (!intval($id_article)) { + + //$id_rubrique = lire_config('balint/id_bien'); + $id_rubrique = intval(_request('id_rubrique')); + include_spip('action/editer_article'); + $set = array( + 'statut' => 'prepa' + ); + $id_article = article_inserer($id_rubrique,$set); + } + + // enregistrement de l'image + if (!intval($new)) { + $where = array( + 'objet="article"', + 'id_objet='.intval(session_get('id_auteur')) * -1 + ); + sql_updateq('spip_documents_liens',array('id_objet' => intval($id_article)), $where); + } + + // maj de l'article + $set = array( + 'titre' => _request('titre'), + 'texte' => _request('texte'), + 'soustitre' => _request('soustitre'), + 'date' => date("Y-m-d H:i:s"), +// 'champ_1' => _request('champ_1'), +// 'champ_2' => _request('champ_2'), +// 'descriptif' => _request('descriptif'), +// 'chapo' => _request('chapo'), +// 'surtitre' => _request('surtitre') + ); + sql_updateq('spip_articles',$set,'id_article='.intval($id_article)); + + // maj rubrique si besoin + $id_rubrique = intval(_request('id_rubrique')); + $id_rub = sql_getfetsel('id_rubrique', 'spip_articles', 'id_article='.$id_article); + if ($id_rub != $id_rubrique) { + include_spip('action/editer_article'); + article_instituer($id_article, array('id_parent' => $id_rubrique)); + } + + // maj association article -> auteurs + include_spip('action/editer_liens'); + $where = array( + 'id_objet='.intval($id_article), + 'objet="article"', + ); + $ids_auteurs = sql_allfetsel('id_auteur', 'spip_auteurs_liens', $where); + $ids_auteurs = array_column($ids_auteurs, 'id_auteur'); + $Tauteurs = _request('Tauteurs'); + if (count($Tauteurs)) { + $associer = array_diff($Tauteurs, $ids_auteurs); + $dissocier = array_diff($ids_auteurs, $Tauteurs); + + objet_associer( array('auteur' => $associer),array('article' => intval($id_article) )); + objet_dissocier( array('auteur' => $dissocier) , array('article' =>intval($id_article) )); + } + + // maj des mots fermes + $T_id_groupe = sql_allfetsel('id_groupe','spip_groupes_mots','grigri!="tags"'); + $T_id_groupe = array_column($T_id_groupe,'id_groupe'); + + foreach ($T_id_groupe as $id_groupe) { + $from = array( + 'spip_mots as M', + 'spip_mots_liens as L' + ); + $where = array( + 'L.id_objet='.intval($id_article), + 'L.objet="article"', + 'L.id_mot=M.id_mot', + 'M.id_groupe='.$id_groupe + ); + + $ids_mots = sql_allfetsel('M.id_mot AS id_mot', $from, $where); + $ids_mots = array_column($ids_mots, 'id_mot'); + $coches = _request('id_groupe_'.$id_groupe); + if (count($coches)) { + $associer = array_diff($coches, $ids_mots); + $dissocier = array_diff($ids_mots, $coches); + + objet_associer(array('mot' => $associer),array('article' => intval($id_article))); + objet_dissocier(array('mot' => $dissocier), array('article' => intval($id_article))); + } + } + + // maj des mots clefs ouverts + $json_htags = _request('tags_save'); + $T_htags = json_decode($json_htags); + + $from = array( + 'spip_groupes_mots AS G', + 'spip_mots AS M' + ); + $where = array( + 'G.grigri="tags"', + 'G.id_groupe=M.id_groupe' + ); + $res = sql_allfetsel('M.id_mot as id_mot, M.titre as titre',$from,$where); + $T_mots_existants = array_column($res,'id_mot','titre'); + $T_id_mots_existants = array_column($res,'id_mot'); + // on supprime toutes les liaisons + include_spip('action/editer_liens'); + objet_dissocier(array("mot"=>$T_id_mots_existants), array("article"=>intval($id_article))); + + $T_id_mots_a_associer = array(); + $T_mots_a_creer = array(); + foreach ($T_htags as $mot) { + if (array_key_exists($mot,$T_mots_existants)) { + $T_id_mots_a_associer[] = $T_mots_existants[$mot]; + } else { + $T_mots_a_creer[] = $mot; + } + } + // On associe les nouveaux mots existants: + objet_associer(array("mot"=>$T_id_mots_a_associer), array("article"=>intval($id_article))); + + // On cree les nouveaux mots + if (count($T_mots_a_creer)) { + $id_groupe = sql_getfetsel('id_groupe','spip_groupes_mots','grigri="tags"'); + include_spip('action/editer_mot'); + $T_nvx_id_mot = array(); + foreach ($T_mots_a_creer as $nvx_mot) { + $set = array( 'titre' => $nvx_mot); + $T_nvx_id_mot[] = mot_inserer($id_groupe, $set); + } + // On associe les nouveaux mots crees : + objet_associer(array("mot"=>$T_nvx_id_mot), array("article"=>intval($id_article))); + } + + include_spip('action/editer_objet'); + // GIS + $lat_def = lire_config('gis/lat'); + $lon_def = lire_config('gis/lon'); + $lat = _request('lat'); + $lon = _request('lon'); + // 1. recup id_gis si present + $from = array( + 'spip_gis as G', + 'spip_gis_liens as L', + 'spip_articles as A' + ); + $where = array( + 'L.id_objet='.intval($id_article), + 'L.objet="article"', + 'L.id_gis=G.id_gis' + ); + $id_gis = sql_getfetsel('G.id_gis', $from, $where); + $set = array( + 'titre' => _request('titre'), + 'lat' => $lat, + 'lon' => $lon, + 'zoom' => 15 + ); + + if (!$id_gis) { + $id_gis = sql_insertq('spip_gis',$set); + $set = array( + 'id_gis' => $id_gis, + 'id_objet' => intval($id_article), + 'objet' => 'article' + ); + sql_insertq('spip_gis_liens',$set); + } else { + if ($lat !== $lat_def and $lon !== $lon_def) { + objet_modifier('gis', $id_gis, $set); + } + } + + // SEO title et description: créer ou mettre à jour, y compris si les valeurs postées sont vides (= vidage du champ) + $id_article = intval($id_article); + $seo_titre = _request('seo_titre'); + $set = array('id_objet' => $id_article, 'objet' => 'article', 'meta_name' => 'title', 'meta_content' => $seo_titre); + $where = array("id_objet = $id_article", "objet = 'article'", "meta_name = 'title'"); + $res = sql_getfetsel('meta_content', 'spip_seo', $where); + if ((!$res AND $seo_titre != '') + OR ($res != $seo_titre)) { + sql_replace('spip_seo', $set, $where); + } + $seo_descriptif = _request('seo_descriptif'); + $set = array('id_objet' => $id_article, 'objet' => 'article', 'meta_name' => 'description', 'meta_content' => $seo_descriptif); + $where = array("id_objet = $id_article", "objet = 'article'", "meta_name = 'description'"); + $res = sql_getfetsel('meta_content', 'spip_seo', $where); + if ((!$res AND $seo_descriptif != '') + OR ($res != $seo_descriptif)) { + sql_replace('spip_seo', $set, $where); + } + + include_spip('inc/invalideur'); + suivre_invalideur("id='id_article/1'"); + + $retour = array(); + $retour['message_ok'] = "L'article est enregistré"; + + $retour['redirect'] = 'spip.php?page=article&id_article='.$id_article; + + $bigform = charger_fonction('bigform_traiter','inc'); + $bigform($id_article, 'article'); + + + return $retour; +} diff --git a/formulaires/login.html b/formulaires/login.html index 6adc2bf..3c45c67 100644 --- a/formulaires/login.html +++ b/formulaires/login.html @@ -17,7 +17,7 @@ [(#REM) declarer les hidden qui declencheront le service du formulaire parametre : url d'action ] #ACTION_FORMULAIRE{#ENV{action}}
- Se connecter + Se connecter [(#ENV*{_logo,''})]