|
| 1 | +<?php |
| 2 | +header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); |
| 3 | +header("Cache-Control: post-check=0, pre-check=0", false); |
| 4 | +header("Pragma: no-cache"); |
| 5 | +
|
| 6 | +if (isset($sujet_id)) { |
| 7 | + $sujet = App\Models\Sujet::find(Crypt::decryptString($sujet_id)); |
| 8 | + if (!isset($sujet)) { |
| 9 | + echo "<pre>Ce sujet n'existe pas.</pre>"; |
| 10 | + exit(); |
| 11 | + } else { |
| 12 | + if ($sujet->user_id !== 0 && (!Auth::check() || (Auth::check() && Auth::id() !== $sujet->user_id))) { |
| 13 | + echo "<pre>Vous ne pouvez pas accéder à ce sujet.</pre>"; |
| 14 | + exit(); |
| 15 | + } |
| 16 | + $sujet_json = json_decode($sujet->sujet); |
| 17 | + } |
| 18 | +} |
| 19 | +?> |
| 20 | +<!doctype html> |
| 21 | +<html lang="fr"> |
| 22 | +<head> |
| 23 | + @include('inc-meta') |
| 24 | + @include('markdown/inc-markdown-css') |
| 25 | + <title>SUJET MARKDOWN | CRÉER / MODIFIER</title> |
| 26 | +</head> |
| 27 | +<body> |
| 28 | + |
| 29 | + @if(Auth::check()) |
| 30 | + @include('inc-nav-console') |
| 31 | + @else |
| 32 | + @include('inc-nav') |
| 33 | + @endif |
| 34 | + |
| 35 | + <div class="container mt-4 mb-5"> |
| 36 | + |
| 37 | + <div class="row"> |
| 38 | + |
| 39 | + <div class="col-md-2 text-right mt-1"> |
| 40 | + @if(Auth::check()) |
| 41 | + <a class="btn btn-light btn-sm" href="/console/sujets" role="button"><i class="fas fa-arrow-left"></i></a> |
| 42 | + @else |
| 43 | + @if (isset($jeton_secret)) |
| 44 | + <a class="btn btn-light btn-sm" href="/sujet-console/{{ $jeton_secret }}" role="button"><i class="fas fa-arrow-left"></i></a> |
| 45 | + @else |
| 46 | + <a class="btn btn-light btn-sm" href="/sujet-creer" role="button"><i class="fas fa-arrow-left"></i></a> |
| 47 | + @endif |
| 48 | + <div class="mt-3 small text-monospace text-muted">Vous pouvez <a href="/creer-un-compte" target="_blank">créer un compte</a> pour regrouper, gérer et partager vos sujets.</div> |
| 49 | + @endif |
| 50 | + </div> |
| 51 | + |
| 52 | + <div class="col-md-10 pl-4 pr-4"> |
| 53 | + |
| 54 | + <h1 class="mb-0">{{__('sujet')}}</h1> |
| 55 | + <div class="mb-4 text-muted">Au format Markdown</div> |
| 56 | + |
| 57 | + <form id="sujet_form" method="POST" action="{{ route('sujet-md-creer-post') }}" enctype="multipart/form-data"> |
| 58 | + |
| 59 | + @csrf |
| 60 | + |
| 61 | + <!-- TITRE --> |
| 62 | + <div class="text-monospace">{{strtoupper(__('titre'))}}<sup class="ml-1 text-danger small">*</sup></div> |
| 63 | + <input id="titre" type="text" class="form-control @error('titre') is-invalid @enderror" name="titre" value="{{ $sujet->titre ?? '' }}" autofocus> |
| 64 | + <div id="error_titre" class="mt-1 text-danger text-monospace" style="font-size:70%" role="alert"> </div> |
| 65 | + <!-- /TITRE --> |
| 66 | + |
| 67 | + <!-- ÉNONCÉ --> |
| 68 | + <div class="mt-4 text-monospace">{{strtoupper(__('ÉNONCÉ'))}}<sup class="ml-1 text-danger small">*</sup></div> |
| 69 | + <textarea id="markdown_content" class="form-control" name="enonce" rows="6">{{ $sujet_json->enonce ?? '' }}</textarea> |
| 70 | + <!-- /ÉNONCÉ --> |
| 71 | + |
| 72 | + @if(isset($sujet_id)) |
| 73 | + <input type="hidden" name="sujet_id" value="{{Crypt::encryptString($sujet->id)}}" /> |
| 74 | + @endif |
| 75 | + |
| 76 | + @if(isset($dupliquer)) |
| 77 | + <input type="hidden" name="dupliquer" value="true" /> |
| 78 | + @endif |
| 79 | + |
| 80 | + <button type="submit" id="dropzone_submit" class="btn btn-primary mt-3 mb-5 pl-4 pr-4"><i class="fas fa-check"></i></button> |
| 81 | + |
| 82 | + </form> |
| 83 | + |
| 84 | + </div> |
| 85 | + </div><!-- /row --> |
| 86 | + </div><!-- /container --> |
| 87 | + |
| 88 | + @include('inc-bottom-js') |
| 89 | + @include('markdown/inc-markdown-editeur-js') |
| 90 | + |
| 91 | +</body> |
| 92 | +</html> |
0 commit comments