Replace old Help term by Placeholder
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
eca814ca4b
commit
a0155c6deb
|
@ -400,7 +400,7 @@ func deleteExerciceHint(hint fic.EHint, _ []byte) (interface{}, error) {
|
|||
|
||||
type uploadedFlag struct {
|
||||
Label string
|
||||
Help string
|
||||
Placeholder string
|
||||
IgnoreCase bool
|
||||
Multiline bool
|
||||
ValidatorRe *string `json:"validator_regexp"`
|
||||
|
@ -424,7 +424,7 @@ func createExerciceFlag(exercice fic.Exercice, body []byte) (interface{}, error)
|
|||
vre = uk.ValidatorRe
|
||||
}
|
||||
|
||||
return exercice.AddRawFlagKey(uk.Label, uk.Help, uk.IgnoreCase, uk.Multiline, vre, []byte(uk.Flag), uk.ChoicesCost)
|
||||
return exercice.AddRawFlagKey(uk.Label, uk.Placeholder, uk.IgnoreCase, uk.Multiline, vre, []byte(uk.Flag), uk.ChoicesCost)
|
||||
}
|
||||
|
||||
func showExerciceFlag(flag fic.FlagKey, _ fic.Exercice, body []byte) (interface{}, error) {
|
||||
|
@ -464,7 +464,7 @@ func updateExerciceFlag(flag fic.FlagKey, exercice fic.Exercice, body []byte) (i
|
|||
flag.Label = uk.Label
|
||||
}
|
||||
|
||||
flag.Help = uk.Help
|
||||
flag.Placeholder = uk.Placeholder
|
||||
flag.IgnoreCase = uk.IgnoreCase
|
||||
flag.Multiline = uk.Multiline
|
||||
if len(uk.Flag) > 0 {
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
<div class="float-right">
|
||||
<button type="button" ng-click="deleteFlag()" class="btn btn-sm btn-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
<label for="khelp{{flag.id}}" class="col-form-label-sm">Placeholder</label>
|
||||
<input type="text" id="khelp{{flag.id}}" ng-model="flag.help" class="form-control form-control-sm" placeholder="Indication de formatage" title="Indication de formatage">
|
||||
<label for="kplaceholder{{flag.id}}" class="col-form-label-sm">Placeholder</label>
|
||||
<input type="text" id="kplaceholder{{flag.id}}" ng-model="flag.placeholder" class="form-control form-control-sm" placeholder="Indication de formatage" title="Indication de formatage">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="kvalue{{flag.id}}" class="col-form-label-sm">Valeur</label>
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<input type="text" id="khelp{{flag.id}}" ng-model="flag.help" class="col form-control form-control-sm" placeholder="Indication de formatage" title="Indication de formatage">
|
||||
<input type="text" id="kplaceholder{{flag.id}}" ng-model="flag.placeholder" class="col form-control form-control-sm" placeholder="Indication de formatage" title="Indication de formatage">
|
||||
<div class="col-auto">
|
||||
<button type="submit" class="btn btn-sm btn-success"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
|
|
|
@ -24,7 +24,7 @@ Tous les textes doivent utiliser l'encodage UTF8.
|
|||
* `validator_regexp = "^(?:sudo +)?(.*)$"` : (facultatif) expression rationnelle dont les groupes capturés serviront comme chaîne à valider (notez que `?:` au début d'un groupe ne le capturera pas) ;
|
||||
* `ordered = false` : (facultatif, par défaut : `false`) ignore l'ordre dans lequels les éléments du tableau sont passés ;
|
||||
* `ignorecase = true` : (facultatif, par défaut : `false`) ignore la case de ce drapeau ;
|
||||
* `help = "Indication"` : (facultatif) chaîne de caractères placée sous le champ du formulaire, idéale pour donner une indication de format ;
|
||||
* `placeholder = "Indication"` : (facultatif) chaîne de caractères placée sous le champ du formulaire, idéale pour donner une indication de format ;
|
||||
* `[[flag.unlock_file]]` : bloque l'accès à un fichier tant que le flag n'est pas obtenu :
|
||||
+ `filename = "toto.txt"` : nom du fichier tel qu'il apparaît dans le dossier `files` ;
|
||||
* `[[flag.need_flag]]` : liste des flags devant être validés avant de débloquer celui-ci :
|
||||
|
@ -34,13 +34,13 @@ Tous les textes doivent utiliser l'encodage UTF8.
|
|||
* `[[flag_mcq.choice]]` : représente un choix, répétez autant de fois qu'il y a de choix :
|
||||
+ `label = "Intitulé de la réponse"`,
|
||||
+ `value = true` : (facultatif, par défaut `false`) valeur attendue pour ce choix ; pour un QCM justifié, utilisez une chaîne de caractères (notez qu'il n'est pas possible de combiner des réponses vraies justifiées et justifiées),
|
||||
+ `help = "Flag correspondant"` : (facultatif) indication affichée dans le champ de texte des QCM justifiés ;
|
||||
+ `placeholder = "Flag correspondant"` : (facultatif) indication affichée dans le champ de texte des QCM justifiés ;
|
||||
- `[[flag_ucq]]` : drapeau sous forme de question à choix unique :
|
||||
* `id = 42` : (facultatif) identifiant du flag au sein de l'exercice, pour définir des dépendances ;
|
||||
* `label = "Intitulé du groupe"` : (facultatif) intitulé du groupe de choix ;
|
||||
* `raw = 'MieH2athxuPhai6u'` : drapeau attendu parmi les propositions ;
|
||||
* `validator_regexp = "^(?:sudo +)?(.*)$"` : (facultatif) expression rationnelle dont les groupes capturés serviront comme chaîne à valider (notez que `?:` au début d'un groupe ne le capturera pas) ;
|
||||
* `help = "Indication"` : (facultatif, uniquement si `displayAs = select`) chaîne de caractères placée sous le champ du formulaire ;
|
||||
* `placeholder = "Indication"` : (facultatif, uniquement si `displayAs = select`) chaîne de caractères placée sous le champ du formulaire ;
|
||||
* `displayAs = "select|radio"` : (facultatif, par défaut `radio`) manière dont est affichée le choix : `select` pour une liste de choix, `radio` pour des boutons radios ;
|
||||
* `choices_cost = 20` : (facultatif, par défaut `0`) coût pour afficher les choix, avant l'affichage, se comporte comme un `flag` classique (à 0, les choix sont affichés directement) ;
|
||||
* `[[flag_ucq.choice]]` : représente un choix, répétez autant de fois qu'il y a de choix :
|
||||
|
@ -144,7 +144,7 @@ id = 2
|
|||
|
||||
[[flag]]
|
||||
label = "Date d'exfiltration"
|
||||
help= "Format : yyyy-mm"
|
||||
placeholder = "Format : yyyy-mm"
|
||||
raw = '2015-12'
|
||||
|
||||
[[flag]]
|
||||
|
|
|
@ -39,7 +39,7 @@ type ExerciceFlag struct {
|
|||
Ordered bool `toml:",omitempty"`
|
||||
CaseSensitive bool `toml:",omitempty"`
|
||||
ValidatorRe string `toml:"validator_regexp,omitempty"`
|
||||
Help string `toml:",omitempty"`
|
||||
Placeholder string `toml:",omitempty"`
|
||||
ChoicesCost int64 `toml:"choices_cost,omitempty"`
|
||||
Choice []ExerciceFlagChoice
|
||||
LockedFile []ExerciceUnlockFile `toml:"unlock_file,omitempty"`
|
||||
|
@ -93,7 +93,7 @@ func getExerciceParams(i Importer, exercice fic.Exercice) (params ExerciceParams
|
|||
Type: "ucq",
|
||||
Raw: flag.Raw,
|
||||
ValidatorRe: flag.ValidatorRe,
|
||||
Help: flag.Help,
|
||||
Placeholder: flag.Placeholder,
|
||||
ChoicesCost: flag.ChoicesCost,
|
||||
Choice: flag.Choice,
|
||||
LockedFile: flag.LockedFile,
|
||||
|
|
|
@ -131,7 +131,7 @@ func buildKeyFlag(exercice fic.Exercice, flag ExerciceFlag, flagline int, defaul
|
|||
fl := fic.Flag(fic.FlagKey{
|
||||
IdExercice: exercice.Id,
|
||||
Label: flag.Label,
|
||||
Help: flag.Help,
|
||||
Placeholder: flag.Placeholder,
|
||||
IgnoreCase: !flag.CaseSensitive,
|
||||
Multiline: flag.Type == "text",
|
||||
ValidatorRegexp: validatorRegexp(flag.ValidatorRe),
|
||||
|
|
|
@ -349,7 +349,7 @@ angular.module("FICApp", ["ngRoute", "ngSanitize"])
|
|||
|
||||
if (!this[cid].justification.label) {
|
||||
this[cid].justification.label = "Flag correspondant";
|
||||
this[cid].justification.help2 = "Trouvez et validez les choix du QCM pour avoir des indications supplémentaires";
|
||||
this[cid].justification.help = "Trouvez et validez les choix du QCM pour avoir des indications supplémentaires";
|
||||
}
|
||||
|
||||
if ($scope.my && $scope.my.exercices[eid] && $scope.my.exercices[eid].mcqs[mid] && $scope.my.exercices[eid].mcqs[mid].choices[cid] && $scope.my.exercices[eid].mcqs[mid].choices[cid].justification) {
|
||||
|
|
|
@ -196,8 +196,8 @@ angular.module("FICApp")
|
|||
<label for="sol_{{ $ctrl.kid }}_0" ng-class="{'text-light': !$ctrl.key.found}">{{ $ctrl.key.label }} :</label>
|
||||
<span ng-if="$ctrl.key.found && $ctrl.key.value" ng-bind="$ctrl.key.value"></span>
|
||||
<div class="input-group" ng-repeat="v in $ctrl.key.values track by $index" ng-class="{'mt-1': !$first}" ng-if="!$ctrl.key.found">
|
||||
<input type="text" class="form-control flag" id="sol_{{ $ctrl.kid }}_{{ $index }}" autocomplete="off" name="sol_{{ $ctrl.kid }}_{{ $index }}" ng-model="$ctrl.key.values[$index]" ng-if="!$ctrl.key.choices && !$ctrl.key.multiline" placeholder="{{ $ctrl.key.help }}" title="{{ $ctrl.key.help }}">
|
||||
<textarea class="form-control flag" id="sol_{{ $ctrl.kid }}_{{ $index }}" autocomplete="off" name="sol_{{ $ctrl.kid }}_{{ $index }}" ng-model="$ctrl.key.values[$index]" ng-if="!$ctrl.key.choices && $ctrl.key.multiline" placeholder="{{ $ctrl.key.help }}" title="{{ $ctrl.key.help }}"></textarea>
|
||||
<input type="text" class="form-control flag" id="sol_{{ $ctrl.kid }}_{{ $index }}" autocomplete="off" name="sol_{{ $ctrl.kid }}_{{ $index }}" ng-model="$ctrl.key.values[$index]" ng-if="!$ctrl.key.choices && !$ctrl.key.multiline" placeholder="{{ $ctrl.key.placeholder }}" title="{{ $ctrl.key.placeholder }}">
|
||||
<textarea class="form-control flag" id="sol_{{ $ctrl.kid }}_{{ $index }}" autocomplete="off" name="sol_{{ $ctrl.kid }}_{{ $index }}" ng-model="$ctrl.key.values[$index]" ng-if="!$ctrl.key.choices && $ctrl.key.multiline" placeholder="{{ $ctrl.key.placeholder }}" title="{{ $ctrl.key.placeholder }}"></textarea>
|
||||
<select class="custom-select" id="sol_{{ $ctrl.kid }}" name="sol_{{ $ctrl.kid }}" ng-model="$ctrl.key.values[$index]" ng-if="$ctrl.key.choices" ng-options="l as v for (l, v) in $ctrl.key.choices"></select>
|
||||
<div class="input-group-append" ng-if="$ctrl.key.choices_cost">
|
||||
<button class="btn btn-success" type="button" ng-click="$ctrl.wantchoices($ctrl.kid)" ng-class="{disabled: $ctrl.key.wcsubmitted}" title="Cliquez pour échanger ce champ de texte par une liste de choix. L'opération vous coûtera {{ $ctrl.key.choices_cost * $ctrl.settings.wchoiceCurrentCoefficient }} points.">
|
||||
|
@ -211,7 +211,7 @@ angular.module("FICApp")
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<small class="form-text text-muted" ng-if="!$ctrl.key.found && $ctrl.key.help2.length > 0" ng-bind="$ctrl.key.help2"></small>
|
||||
<small class="form-text text-muted" ng-if="!$ctrl.key.found && $ctrl.key.help.length > 0" ng-bind="$ctrl.key.help"></small>
|
||||
<span class="glyphicon glyphicon-ok form-control-feedback text-success" aria-hidden="true" ng-if="$ctrl.key.found" title="Flag trouvé à {{ $ctrl.key.found | date:'mediumTime'}}"></span>
|
||||
</div>
|
||||
`
|
||||
|
|
|
@ -17,8 +17,8 @@ type FlagKey struct {
|
|||
IdExercice int64 `json:"idExercice"`
|
||||
// Label is the title of the flag as displayed to players
|
||||
Label string `json:"label"`
|
||||
// Help is a small piece of text that aims to add useful information like flag format, ...
|
||||
Help string `json:"help"`
|
||||
// Placeholder is a small piece of text that aims to add useful information like flag format, ...
|
||||
Placeholder string `json:"placeholder"`
|
||||
// IgnoreCase indicates if the case is sensitive to case or not
|
||||
IgnoreCase bool `json:"ignorecase"`
|
||||
// Multiline indicates if the flag is stored on multiple lines
|
||||
|
@ -43,7 +43,7 @@ func (e Exercice) GetFlagKeys() ([]FlagKey, error) {
|
|||
var k FlagKey
|
||||
k.IdExercice = e.Id
|
||||
|
||||
if err := rows.Scan(&k.Id, &k.IdExercice, &k.Label, &k.Help, &k.IgnoreCase, &k.Multiline, &k.ValidatorRegexp, &k.Checksum, &k.ChoicesCost); err != nil {
|
||||
if err := rows.Scan(&k.Id, &k.IdExercice, &k.Label, &k.Placeholder, &k.IgnoreCase, &k.Multiline, &k.ValidatorRegexp, &k.Checksum, &k.ChoicesCost); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -59,13 +59,13 @@ func (e Exercice) GetFlagKeys() ([]FlagKey, error) {
|
|||
|
||||
// GetFlagKey returns a list of flags comming with the challenge.
|
||||
func GetFlagKey(id int64) (k FlagKey, err error) {
|
||||
err = DBQueryRow("SELECT id_flag, id_exercice, type, help, ignorecase, multiline, validator_regexp, cksum, choices_cost FROM exercice_flags WHERE id_flag = ?", id).Scan(&k.Id, &k.IdExercice, &k.Label, &k.Help, &k.IgnoreCase, &k.Multiline, &k.ValidatorRegexp, &k.Checksum, &k.ChoicesCost)
|
||||
err = DBQueryRow("SELECT id_flag, id_exercice, type, help, ignorecase, multiline, validator_regexp, cksum, choices_cost FROM exercice_flags WHERE id_flag = ?", id).Scan(&k.Id, &k.IdExercice, &k.Label, &k.Placeholder, &k.IgnoreCase, &k.Multiline, &k.ValidatorRegexp, &k.Checksum, &k.ChoicesCost)
|
||||
return
|
||||
}
|
||||
|
||||
// GetFlagKeyByLabel returns a flag matching the given label.
|
||||
func (e Exercice) GetFlagKeyByLabel(label string) (k FlagKey, err error) {
|
||||
err = DBQueryRow("SELECT id_flag, id_exercice, type, help, ignorecase, multiline, validator_regexp, cksum, choices_cost FROM exercice_flags WHERE type LIKE ? AND id_exercice = ?", label, e.Id).Scan(&k.Id, &k.IdExercice, &k.Label, &k.Help, &k.IgnoreCase, &k.Multiline, &k.ValidatorRegexp, &k.Checksum, &k.ChoicesCost)
|
||||
err = DBQueryRow("SELECT id_flag, id_exercice, type, help, ignorecase, multiline, validator_regexp, cksum, choices_cost FROM exercice_flags WHERE type LIKE ? AND id_exercice = ?", label, e.Id).Scan(&k.Id, &k.IdExercice, &k.Label, &k.Placeholder, &k.IgnoreCase, &k.Multiline, &k.ValidatorRegexp, &k.Checksum, &k.ChoicesCost)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ func ExecValidatorRegexp(vre string, val []byte, ignorecase bool) ([]byte, error
|
|||
}
|
||||
|
||||
// AddRawFlagKey creates and fills a new struct FlagKey, from a non-hashed flag, and registers it into the database.
|
||||
func (e Exercice) AddRawFlagKey(name string, help string, ignorecase bool, multiline bool, validator_regexp *string, raw_value []byte, choicescost int64) (f FlagKey, err error) {
|
||||
func (e Exercice) AddRawFlagKey(name string, placeholder string, ignorecase bool, multiline bool, validator_regexp *string, raw_value []byte, choicescost int64) (f FlagKey, err error) {
|
||||
hash, errr := ComputeHashedFlag(raw_value, ignorecase, validator_regexp)
|
||||
if errr != nil {
|
||||
return f, err
|
||||
|
@ -113,7 +113,7 @@ func (e Exercice) AddRawFlagKey(name string, help string, ignorecase bool, multi
|
|||
|
||||
f = FlagKey{
|
||||
Label: name,
|
||||
Help: help,
|
||||
Placeholder: placeholder,
|
||||
IgnoreCase: ignorecase,
|
||||
Multiline: multiline,
|
||||
ValidatorRegexp: validator_regexp,
|
||||
|
@ -148,7 +148,7 @@ func (k FlagKey) Create(e Exercice) (Flag, error) {
|
|||
}
|
||||
}
|
||||
|
||||
if res, err := DBExec("INSERT INTO exercice_flags (id_exercice, type, help, ignorecase, multiline, validator_regexp, cksum, choices_cost) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", e.Id, k.Label, k.Help, k.IgnoreCase, k.Multiline, k.ValidatorRegexp, k.Checksum, k.ChoicesCost); err != nil {
|
||||
if res, err := DBExec("INSERT INTO exercice_flags (id_exercice, type, help, ignorecase, multiline, validator_regexp, cksum, choices_cost) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", e.Id, k.Label, k.Placeholder, k.IgnoreCase, k.Multiline, k.ValidatorRegexp, k.Checksum, k.ChoicesCost); err != nil {
|
||||
return k, err
|
||||
} else if kid, err := res.LastInsertId(); err != nil {
|
||||
return k, err
|
||||
|
@ -173,7 +173,7 @@ func (k FlagKey) Update() (int64, error) {
|
|||
}
|
||||
}
|
||||
|
||||
if res, err := DBExec("UPDATE exercice_flags SET id_exercice = ?, type = ?, help = ?, ignorecase = ?, multiline = ?, validator_regexp = ?, cksum = ?, choices_cost = ? WHERE id_flag = ?", k.IdExercice, k.Label, k.Help, k.IgnoreCase, k.Multiline, k.ValidatorRegexp, k.Checksum, k.ChoicesCost, k.Id); err != nil {
|
||||
if res, err := DBExec("UPDATE exercice_flags SET id_exercice = ?, type = ?, help = ?, ignorecase = ?, multiline = ?, validator_regexp = ?, cksum = ?, choices_cost = ? WHERE id_flag = ?", k.IdExercice, k.Label, k.Placeholder, k.IgnoreCase, k.Multiline, k.ValidatorRegexp, k.Checksum, k.ChoicesCost, k.Id); err != nil {
|
||||
return 0, err
|
||||
} else if nb, err := res.RowsAffected(); err != nil {
|
||||
return 0, err
|
||||
|
|
|
@ -28,7 +28,7 @@ type myTeamHint struct {
|
|||
}
|
||||
type myTeamFlag struct {
|
||||
Label string `json:"label"`
|
||||
Help string `json:"help,omitempty"`
|
||||
Placeholder string `json:"placeholder,omitempty"`
|
||||
Separator string `json:"separator,omitempty"`
|
||||
NbLines uint64 `json:"nb_lines,omitempty"`
|
||||
IgnoreOrder bool `json:"ignore_order,omitempty"`
|
||||
|
@ -221,7 +221,7 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
|
|||
|
||||
// Fill more information if the flag is displaied
|
||||
if flag.Solved == nil {
|
||||
flag.Help = k.Help
|
||||
flag.Placeholder = k.Placeholder
|
||||
if choices, err := k.GetChoices(); err != nil {
|
||||
return nil, err
|
||||
} else if t == nil || WChoiceCoefficient < 0 || k.ChoicesCost == 0 || t.SeeChoices(k) {
|
||||
|
|
Loading…
Reference in New Issue