server/frontend/static/views/defi.html

150 lines
12 KiB
HTML

<nav role="navigation">
<ol class="breadcrumb">
<li ng-repeat="(k,exercice) in themes[current_theme].exercices" class="breadcrumb-item" ng-class="{active: k == current_exercice, disabled: !my.exercices[k]}">
<a ng-if="(k != current_exercice && !my.exercices[k])">{{ exercice.title }}</a>
<a ng-href="/{{ themes[current_theme].urlid }}/{{ themes[current_theme].exercices[k].urlid }}" ng-if="(k != current_exercice && my.exercices[k])" ng-class="{'text-success': my.exercices[k].solved}">
{{ exercice.title }}
<span class="glyphicon glyphicon-gift" aria-hidden="true" ng-if="themes[current_theme].exercices[k].curcoeff > 1.0"></span>
<span class="glyphicon glyphicon-ok text-success" aria-hidden="true" ng-if="(my.team_id && my.exercices[k].solved)"></span>
</a>
<strong ng-if="k == current_exercice" class="text-info">
{{ exercice.title }}
<span class="glyphicon glyphicon-gift" aria-hidden="true" ng-if="themes[current_theme].exercices[k].curcoeff > 1.0"></span>
<span class="glyphicon glyphicon-ok text-success" aria-hidden="true" ng-if="(my.team_id && my.exercices[k].solved)"></span>
</strong>
</li>
</ol>
</nav>
<div class="alert alert-warning mt-3" ng-if="!(my.exercices[current_exercice])">
Vous n'avez pas encore accès à cet exercice.
</div>
<div class="jumbotron niceborder text-indent mt-3" ng-if="!(my.exercices[current_exercice])">
<p class="lead text-justify" ng-bind-html="themes[current_theme].headline"></p>
<p class="text-justify" ng-bind-html="themes[current_theme].intro"></p>
</div>
<div class="jumbotron niceborder text-indent mt-3" ng-if="(my.exercices[current_exercice])">
<h3 class="display-4">{{ themes[current_theme].exercices[current_exercice].title }}</h3>
<a ng-href="/tags/{{tag}}" class="badge badge-pill badge-secondary mr-2 mb-2" ng-repeat="tag in themes[current_theme].exercices[current_exercice].tags">#{{ tag }}</a>
<p class="lead text-justify" ng-bind-html="my.exercices[current_exercice].statement"></p>
<div class="alert alert-{{my.exercices[current_exercice].issuekind}}" ng-if="my.exercices[current_exercice].issue" ng-bind-html="my.exercices[current_exercice].issue"></div>
<hr class="my-3">
<ul>
<li><strong>Gain&nbsp;:</strong> <ng-pluralize count="themes[current_theme].exercices[current_exercice].gain" when="{'one': '{} point', 'other': '{} points'}"></ng-pluralize> <em ng-if="settings.firstBlood && themes[current_theme].exercices[current_exercice].solved < 1">{{ 1 + settings.firstBlood | coeff }} prem's</em> <em ng-if="themes[current_theme].exercices[current_exercice].curcoeff != 1.0 || settings.exerciceCurrentCoefficient">{{ themes[current_theme].exercices[current_exercice].curcoeff * settings.exerciceCurrentCoefficient | coeff }} bonus</em></li>
<li ng-if="themes[current_theme].exercices[current_exercice].tried"><strong>Tenté par&nbsp;:</strong> <ng-pluralize count="themes[current_theme].exercices[current_exercice].tried" when="{'0': 'aucune équipe', 'one': '{} équipe', 'other': '{} équipes'}"></ng-pluralize> <span ng-if="my.exercices[current_exercice].total_tries">(cumulant <ng-pluralize count="my.exercices[current_exercice].total_tries" when="{'one': '{} tentative', 'other': '{} tentatives'}"></ng-pluralize>)</span>.</li>
<li><strong>Résolu par&nbsp;:</strong> <ng-pluralize count="themes[current_theme].exercices[current_exercice].solved" when="{'0': 'aucune équipe', 'one': '{} équipe', 'other': '{} équipes'}"></ng-pluralize>.</li>
</ul>
</div>
<div class="row">
<div class="col-xl mb-5" ng-if="(my.exercices[current_exercice] && my.exercices[current_exercice].files.length)">
<div class="card">
<div class="card-header text-white">
<span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span> Téléchargements
</div>
<div class="card-body text-indent">
<p class="card-text text-danger text-justify">
<strong>Attention&nbsp;:</strong> puisqu'il s'agit de captures effectuées dans le but de découvrir si des actes malveillants ont été commis, les contenus qui sont téléchargeables <em>peuvent</em> contenir du contenu malveillant&nbsp;!
</p>
</div>
<div class="list-group">
<a ng-href="{{ file.path }}" target="_self" class="list-group-item" ng-repeat="file in my.exercices[current_exercice].files">
<h1 class="float-left" style="margin: 7px 7px 5px -5px"><span class="glyphicon glyphicon-download" aria-hidden="true"></span></h1>
<h4 class="list-group-item-heading"><strong><samp>{{ file.name }}</samp></strong></h4>
<p class="list-group-item-text"><nobr>Taille&nbsp;: <span title="{{ file.size }} octets">{{ file.size | size }}</span></nobr> &ndash; <nobr><span title="blake2.net">b2sum</span>&nbsp;: <samp class="cksum" title="{{ file.checksum }}">{{ file.checksum }}</samp></nobr></p>
</a>
</div>
</div>
</div>
<div class="col-xl mb-5" ng-if="(my.exercices[current_exercice] && my.exercices[current_exercice].hints.length)">
<div class="card border-info">
<div class="card-header bg-info text-white">
<span class="glyphicon glyphicon-lamp" aria-hidden="true"></span> Indices
</div>
<div class="card-body" ng-if="hinterror">
<div class="card-text text-danger" ng-bind="hinterror"></div>
</div>
<div class="list-group">
<a target="_self" class="list-group-item text-light" ng-repeat="hint in my.exercices[current_exercice].hints" ng-href="{{ hint.file }}">
<button type="button" ng-click="hsubmit(hint)" class="float-right btn btn-info" ng-if="!(hint.content || hint.file)" ng-class="{disabled: hint.submitted}"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span> Débloquer</button>
<button type="button" ng-click="hint.hidden = false;" class="float-right btn btn-info" ng-if="!hint.file && hint.hidden"><span class="glyphicon glyphicon-lock" aria-hidden="true"></span> Afficher</button>
<h1 class="float-left" style="margin: 5px 7px 5px -5px" ng-if="hint.file"><span class="glyphicon glyphicon-download" aria-hidden="true"></span></h1>
<h4 class="list-group-item-heading">{{ hint.title }}</h4>
<p class="list-group-item-text" ng-if="!hint.file && hint.content && !hint.hidden" ng-bind-html="hint.content"></p>
<p class="list-group-item-text" ng-if="hint.file">Cliquez ici pour télécharger l'indice.<br>b2sum&nbsp;: <samp class="cksum" title="Somme de contrôle BLAKE2b : {{ hint.content }}">{{ hint.content }}</samp></p>
<p class="list-group-item-text" ng-if="!hint.file && ((!hint.content && hint.hidden === undefined) || hint.hidden === true)">Débloquer cet indice vous fera perdre <ng-pluralize count="hint.cost * settings.hintCurrentCoefficient" when="{'one': '{} point', 'other': '{} points'}"></ng-pluralize>.</p>
</a>
</div>
</div>
</div>
<div class="col-xl mb-5" ng-controller="SubmissionController">
<div class="card border-danger" ng-if="my.exercices[current_exercice] && !(my.exercices[current_exercice].solved)">
<div class="card-header bg-danger text-white">
<span class="glyphicon glyphicon-flag" aria-hidden="true"></span> Faire son rapport
</div>
<ul class="list-group" ng-if="(my.exercices[current_exercice].tries || my.exercices[current_exercice].submitted || sberr)">
<li class="list-group-item text-warning" ng-if="my.exercices[current_exercice].solved_time && my.exercices[current_exercice].tries"><ng-pluralize count="my.exercices[current_exercice].tries" when="{'one': '{} tentative effectuée', 'other': '{} tentatives effectuées'}"></ng-pluralize>. Dernière solution envoyée à {{ my.exercices[current_exercice].solved_time | date:"mediumTime" }}. <span ng-if="my.exercices[current_exercice].solve_dist"><ng-pluralize count="my.exercices[current_exercice].solve_dist" when="{'one': '{} réponse erronée', 'other': '{} réponses erronées'}"></ng-pluralize>.</span></li>
<li class="list-group-item" ng-class="messageClass" ng-if="my.exercices[current_exercice].submitted || sberr"><strong ng-if="!sberr">Votre solution a bien été envoyée !</strong><strong ng-if="sberr">{{ sberr }}</strong> {{ message }}</li>
<li class="list-group-item text-danger" ng-if="my.exercices[current_exercice].timeouted"><strong>Oops</strong> La requête a dépassé le délai d'attente. Vous devriez réessayer dans quelques instant&hellip;</li>
</ul>
<div class="card-body" ng-if="!my.exercices[current_exercice].submitted || sberr">
<form ng-submit="ssubmit()">
<flag-key ng-repeat="(kid,key) in my.exercices[current_exercice].flags" kid="kid" key="key" settings="settings" wantchoices="wantchoices"></flag-key>
<div class="form-group" ng-repeat="(k,mcq) in my.exercices[current_exercice].mcqs">
<p ng-if="mcq.title">{{ mcq.title }} <span class="glyphicon glyphicon-ok form-control-feedback text-success" aria-hidden="true" ng-if="mcq.solved" title="QCM réussi à {{ mcq.solved | date:'mediumTime'}}"></span></p>
<div class="form-check">
<div class="custom-control custom-checkbox" ng-repeat="(cid,choice) in mcq.choices" ng-if="!mcq.solved || mcq.justify">
<input class="custom-control-input" type="checkbox" id="mcq_{{k}}_{{cid}}" name="mcq_{{k}}_{{cid}}" ng-model="choice.value" ng-disabled="choice.disabled">
<label class="custom-control-label" for="mcq_{{k}}_{{cid}}" ng-bind="choice.label"></label>
<flag-key kid="cid" key="choice.justification" settings="settings" wantchoices="wantchoices" ng-if="choice.value && mcq.justify && (!choice.justification || !choice.justification.solved)"></flag-key>
<span ng-if="choice.value && mcq.justify && choice.solved" ng-bind="choice.justify"></span>
<span class="glyphicon glyphicon-ok form-control-feedback text-success" aria-hidden="true" ng-if="choice.solved" title="Flag trouvé !"></span>
</div>
</div>
<hr>
</div>
<div class="form-group text-right">
<button type="submit" class="btn btn-danger" id="sbmt">Soumettre</button>
</div>
</form>
</div>
</div>
<div class="card border-success" ng-if="my.exercices[current_exercice].solved">
<div class="card-header bg-success text-white">
<span class="glyphicon glyphicon-flag" aria-hidden="true"></span> Défi réussi !
</div>
<div class="card-body">
<p class="card-text" ng-if="my.exercices[current_exercice].solved_rank">
Vous êtes la {{ my.exercices[current_exercice].solved_rank }}<sup><ng-pluralize count="my.exercices[current_exercice].solved_rank" when="{'one': 're', 'other': 'e'}"></ng-pluralize></sup> équipe à avoir résolu ce défi à {{ my.exercices[current_exercice].solved_time | date:"mediumTime" }}. Vous avez marqué <ng-pluralize count="my.exercices[current_exercice].gain" when="{'one': '{} point', 'other': '{} points'}"></ng-pluralize> !
</p>
<p class="card-text" ng-if="!my.exercices[current_exercice].solved_rank">
Bravo, vous avez résolu ce défi à {{ my.exercices[current_exercice].solved_time | date:"mediumTime" }}. Vous marquez <ng-pluralize count="my.exercices[current_exercice].gain" when="{'one': '{} point', 'other': '{} points'}"></ng-pluralize> !
</p>
<hr ng-if="my.exercices[current_exercice].finished">
<p class="card-text" ng-if="my.exercices[current_exercice].finished" ng-bind-html="my.exercices[current_exercice].finished"></p>
<hr ng-if="my.exercices[current_exercice].finished && themes[current_theme].exercices[current_exercice].next">
<a href="/{{ themes[current_theme].urlid }}/{{ themes[current_theme].exercices[themes[current_theme].exercices[current_exercice].next].urlid }}" class="btn btn-success" ng-if="themes[current_theme].exercices[current_exercice].next">Passer au défi suivant</a>
</div>
</div>
<div class="card border-success mt-2" ng-if="my.exercices[current_exercice].video_uri">
<div class="card-header bg-success text-white">
<span class="glyphicon glyphicon-blackboard" aria-hidden="true"></span> Solution du défi
</div>
<div class="card-body">
<div class="embed-responsive embed-responsive-16by9">
<iframe type="text/html" ng-src="{{ my.exercices[current_exercice].video_uri }}" class="embed-responsive-item">
Regardez la vidéo de résolution de ce défi&nbsp;: <a ng-href="{{ my.exercices[current_exercice].video_uri }}">{{ my.exercices[current_exercice].video_uri }}</a>.
</iframe>
</div>
</div>
</div>
</div>
</div>