Improve team interface
This commit is contained in:
parent
7f9581f578
commit
6863891ba2
6 changed files with 76 additions and 23 deletions
|
@ -47,7 +47,7 @@ func exportThemes() (interface{}, error) {
|
|||
}
|
||||
ret[fmt.Sprintf("%d", theme.Id)] = exportedTheme{
|
||||
theme.Name,
|
||||
theme.Authors,
|
||||
theme.Authors[:len(theme.Authors)-1],
|
||||
exos,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@
|
|||
<div class="col-sm-9 col-sm-offset-3">
|
||||
<div class="page-header">
|
||||
<h1 ng-show="(current_theme)">{{ themes[current_theme].name }} <small class="authors" ng-show="themes[current_theme].authors">{{ themes[current_theme].authors }}</small></h1>
|
||||
<h1 ng-show="(!current_theme && title)">{{ title }}</h1>
|
||||
<h1 ng-show="(!current_theme && !title)">Challenge FIC 2016 <small>Laboratoire SRS, Epita</small></h1>
|
||||
<h1 ng-show="(!current_theme && title)">{{ title }} <small class="authors" ng-show="authors">{{ authors }}</small></h1>
|
||||
<h1 ng-show="(!current_theme && !title)">Challenge forensic 2016 <small class="authors">Laboratoire SRS, Epita</small></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -71,7 +71,7 @@
|
|||
<div class="panel panel-default" ng-show="(my.team_id)">
|
||||
<div class="panel-body">
|
||||
<strong class="teamname" style="background-color: {{ teams[my.team_id].color }}; color: {{ teams[my.team_id].color }};"><span>{{ my.name }}</span></strong>
|
||||
<a style="float: right;" class="btn btn-default btn-xs" href="/edit">edit</a><br><br>
|
||||
<a style="float: right;" class="btn btn-default btn-xs" href="/edit">voir</a><br><br>
|
||||
|
||||
<span ng-show="teams[my.team_id].rank">{{ teams[my.team_id].rank }}<sup>e</sup> sur {{ teams_count }} –</span>
|
||||
{{ my.score }} points
|
||||
|
|
|
@ -63,7 +63,21 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
updTime();
|
||||
});
|
||||
|
||||
String.prototype.capitalize = function() {
|
||||
return this
|
||||
.toLowerCase()
|
||||
.replace(
|
||||
/(^|\s)([a-z])/g,
|
||||
function(m,p1,p2) { return p1+p2.toUpperCase(); }
|
||||
);
|
||||
}
|
||||
|
||||
angular.module("FICApp")
|
||||
.filter("capitalize", function() {
|
||||
return function(input) {
|
||||
return input.capitalize();
|
||||
}
|
||||
})
|
||||
.filter("time", function() {
|
||||
return function(input) {
|
||||
if (input == undefined) {
|
||||
|
@ -75,6 +89,11 @@ angular.module("FICApp")
|
|||
}
|
||||
}
|
||||
})
|
||||
.filter("date", function() {
|
||||
return function(input) {
|
||||
return (new Date(Date.parse(input))).toLocaleTimeString();
|
||||
}
|
||||
})
|
||||
.controller("DataController", function($scope, $http, $rootScope, $timeout) {
|
||||
var actMenu = function() {
|
||||
if ($scope.my && $scope.themes) {
|
||||
|
@ -90,7 +109,7 @@ angular.module("FICApp")
|
|||
}
|
||||
$rootScope.refresh = function(justMy) {
|
||||
if (!justMy) {
|
||||
$timeout($rootScope.refresh, 60000);
|
||||
$timeout($rootScope.refresh, 42000);
|
||||
$http.get("/time.json").success(function(time) {
|
||||
time.he = (new Date()).getTime();
|
||||
sessionStorage.userService = angular.toJson(time);
|
||||
|
@ -130,11 +149,15 @@ angular.module("FICApp")
|
|||
if ($scope.themes && $scope.my && $scope.themes[$scope.current_theme]) {
|
||||
var exos = Object.keys($scope.themes[$scope.current_theme].exercices);
|
||||
var i = 0;
|
||||
for (; i < exos.length - 1; i++) {
|
||||
for (; i < exos.length; i++) {
|
||||
if (!$scope.my.exercices[exos[i]] || !$scope.my.exercices[exos[i]].solved)
|
||||
break;
|
||||
}
|
||||
if (i < exos.length) {
|
||||
$rootScope.current_exercice = exos[i];
|
||||
} else {
|
||||
$rootScope.current_exercice = exos[0];
|
||||
}
|
||||
} else {
|
||||
$rootScope.current_exercice = 0;
|
||||
}
|
||||
|
@ -143,6 +166,7 @@ angular.module("FICApp")
|
|||
})
|
||||
.controller("SubmissionController", function($scope, $http, $rootScope, $timeout) {
|
||||
$scope.flags = []
|
||||
$rootScope.sberr = "";
|
||||
|
||||
var waitMy = function() {
|
||||
if (!$scope.my || !$scope.my.exercices || !$scope.my.exercices[$rootScope.current_exercice]) {
|
||||
|
@ -162,18 +186,35 @@ angular.module("FICApp")
|
|||
$scope.ssubmit = function() {
|
||||
var flgs = {}
|
||||
|
||||
var filled = true;
|
||||
angular.forEach($scope.flags, function(flag,kid) {
|
||||
flgs[flag.name] = flag.value;
|
||||
flag.value = "";
|
||||
filled = filled && flag.value.length > 0;
|
||||
});
|
||||
|
||||
if (!filled) {
|
||||
$rootScope.messageClass = {"text-danger": true};
|
||||
$rootScope.sberr = "Tous les champs sont obligatoires.";
|
||||
$timeout(function() {
|
||||
if ($rootScope.sberr == "Tous les champs sont obligatoires.") {
|
||||
$rootScope.sberr = "";
|
||||
}
|
||||
}, 2345);
|
||||
return;
|
||||
}
|
||||
|
||||
$http({
|
||||
url: "/submit/" + $rootScope.current_exercice,
|
||||
method: "POST",
|
||||
data: flgs
|
||||
}).success(function(data, status, header, config) {
|
||||
$rootScope.messageClass = {"alert-success": true};
|
||||
$rootScope.messageClass = {"text-success": true};
|
||||
$rootScope.message = data.errmsg;
|
||||
$rootScope.sberr = "";
|
||||
|
||||
angular.forEach($scope.flags, function(flag,kid) {
|
||||
flag.value = "";
|
||||
});
|
||||
|
||||
var checkDiff = function() {
|
||||
$http.get("/my.json").success(function(my) {
|
||||
|
@ -189,8 +230,11 @@ angular.module("FICApp")
|
|||
if (status >= 500) {
|
||||
$scope.my.exercices[$rootScope.current_exercice].submitted = false;
|
||||
}
|
||||
$rootScope.messageClass = {"alert-danger": true};
|
||||
$rootScope.messageClass = {"text-danger": true};
|
||||
$rootScope.message = data.errmsg;
|
||||
if (status != 402) {
|
||||
$rootScope.sberr = "Une erreur est survenue lors de l'envoi. Veuillez réessayer dans quelques instants.";
|
||||
}
|
||||
});
|
||||
$scope.my.exercices[$rootScope.current_exercice].submitted = true;
|
||||
};
|
||||
|
@ -260,6 +304,7 @@ angular.module("FICApp")
|
|||
$rootScope.current_theme = 0;
|
||||
$rootScope.current_exercice = 0;
|
||||
$rootScope.title = "Classement général";
|
||||
$rootScope.authors = "";
|
||||
|
||||
$scope.fields = ["rank", "name", "score"];
|
||||
$scope.rankOrder = "rank";
|
||||
|
@ -277,6 +322,7 @@ angular.module("FICApp")
|
|||
$rootScope.current_theme = 0;
|
||||
$rootScope.current_exercice = 0;
|
||||
$rootScope.title = "";
|
||||
$rootScope.authors = "";
|
||||
});
|
||||
|
||||
function sready() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="well well-lg">
|
||||
<h3>Bienvenue <span ng-repeat="member in my.members"><span ng-show="$last && !$first"> et </span><span ng-show="$middle">, </span>{{ member.firstname | capitalize }} {{ member.lastname | capitalize }}</span> !</h3>
|
||||
<p ng-show="(my.team_id)">
|
||||
Félicitations ! vous êtes actuellement connecté à l'espace de votre
|
||||
Félicitations ! vous êtes maintenant connecté à l'espace de votre
|
||||
équipe <em>{{ teams[my.team_id].name }}</em>. Vous pouvez changer ce nom
|
||||
dès maintenant en vous rendant sur la page de <a href="/edit">votre
|
||||
équipe</a>.
|
||||
|
@ -19,6 +19,12 @@
|
|||
Saurez-vous identifier les différents vecteurs de fuites de données avec
|
||||
lesquels nos systèmes d'informations et nos utilisateurs font faces ?
|
||||
</p>
|
||||
<p>
|
||||
<strong>Attention :</strong> puisqu'il s'agit de captures effectuées dans
|
||||
le but de découvrir si des actes malveillants ont été commis sur différents
|
||||
systèmes d'information, les contenus qui sont
|
||||
téléchargeables <em>peuvent</em> contenir du contenu malveillant !
|
||||
</p>
|
||||
<p>
|
||||
Bon courage !
|
||||
</p>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="team in rank | filter: query | orderBy:rankOrder:reverse" ng-click="show(team.id)" ng-show="team.rank">
|
||||
<td ng-repeat="field in fields">
|
||||
<td ng-repeat="field in fields" ng-class="{info: my.team_id == team.id}">
|
||||
{{ team[field] }}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -39,22 +39,23 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info" ng-class="messageClass" ng-show="my.exercices[current_exercice] && !(my.exercices[current_exercice].solved) && (my.exercices[current_exercice].submitted)">
|
||||
<strong>Votre tentative a bien été transmise.</strong> {{ message }}
|
||||
</div>
|
||||
|
||||
<div class="panel panel-danger" ng-show="my.team_id && my.exercices[current_exercice] && !(my.exercices[current_exercice].solved) && !(my.exercices[current_exercice].submitted)">
|
||||
<div class="panel panel-danger" ng-show="my.team_id && my.exercices[current_exercice] && !(my.exercices[current_exercice].solved)">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-title">Soumettre une solution</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p ng-show="(my.exercices[current_exercice].solved_number)">Dernière solution envoyée à {{ my.exercices[current_exercice].solved_time }}.</p>
|
||||
<ul class="list-group" ng-show="(my.exercices[current_exercice].solved_number || my.exercices[current_exercice].submitted || sberr)">
|
||||
<li class="list-group-item text-warning" ng-show="my.exercices[current_exercice].solved_number">{{ my.exercices[current_exercice].solved_number }} tentative(s) effectuée(s). Dernière solution envoyée à {{ my.exercices[current_exercice].solved_time | date }}.</li>
|
||||
<li class="list-group-item" ng-class="messageClass" ng-show="my.exercices[current_exercice].submitted || sberr"><strong ng-show="!sberr">Votre solution a bien été envoyée !</strong><strong ng-show="sberr">{{ sberr }}</strong> {{ message }}</li>
|
||||
</ul>
|
||||
<div class="panel-body" ng-show="!my.exercices[current_exercice].submitted || sberr">
|
||||
<form ng-controller="SubmissionController" ng-submit="ssubmit()">
|
||||
<div class="form-group" ng-repeat="key in flags">
|
||||
<label for="sol_{{ key.id }}">{{ key.name }}</label>
|
||||
<label for="sol_{{ key.id }}">{{ key.name }} :</label>
|
||||
<input type="text" class="form-control" id="sol_{{ key.id }}" name="sol_{{ index }}" ng-model="key.value">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success" id="sbmt">Soumettre</button>
|
||||
<div class="form-group text-right">
|
||||
<button type="submit" class="btn btn-warning" id="sbmt">Soumettre</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -64,11 +65,11 @@
|
|||
<div class="panel-title">Challenge réussi !</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
Vous êtes la {{ my.exercices[current_exercice].solved_number }}<sup>e</sup> équipe à avoir résolu ce challenge à {{ my.exercices[current_exercice].solved_time }}. Vous avez marqué {{ themes[current_theme].exercices[current_exercice].gain }} points !
|
||||
Vous êtes la {{ my.exercices[current_exercice].solved_number }}<sup>e</sup> équipe à avoir résolu ce challenge à {{ my.exercices[current_exercice].solved_time | date }}. Vous avez marqué {{ themes[current_theme].exercices[current_exercice].gain }} points !
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-success" ng-show="(!my.team_id)">
|
||||
<div class="panel panel-success" ng-show="(!my.team_id && my.exercices[current_exercice].keys)">
|
||||
<div class="panel-heading">
|
||||
<div class="panel-title">Clefs du challenge</div>
|
||||
</div>
|
||||
|
|
Reference in a new issue