diff --git a/admin/api/exercice.go b/admin/api/exercice.go index f5496aa1..ef597be2 100644 --- a/admin/api/exercice.go +++ b/admin/api/exercice.go @@ -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 { diff --git a/admin/static/views/exercice-flags.html b/admin/static/views/exercice-flags.html index 3b701808..adcd7f60 100644 --- a/admin/static/views/exercice-flags.html +++ b/admin/static/views/exercice-flags.html @@ -29,8 +29,8 @@
- - + +
diff --git a/admin/static/views/exercice.html b/admin/static/views/exercice.html index 6821814b..3b598d32 100644 --- a/admin/static/views/exercice.html +++ b/admin/static/views/exercice.html @@ -174,7 +174,7 @@
- +
diff --git a/admin/sync/README.md b/admin/sync/README.md index 1a342516..70b2d017 100644 --- a/admin/sync/README.md +++ b/admin/sync/README.md @@ -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]] diff --git a/admin/sync/exercice_defines.go b/admin/sync/exercice_defines.go index fab93625..f1336f16 100644 --- a/admin/sync/exercice_defines.go +++ b/admin/sync/exercice_defines.go @@ -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, diff --git a/admin/sync/exercice_keys.go b/admin/sync/exercice_keys.go index ece36066..43be18de 100644 --- a/admin/sync/exercice_keys.go +++ b/admin/sync/exercice_keys.go @@ -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), diff --git a/frontend/static/js/challenge.js b/frontend/static/js/challenge.js index 3c7d1143..e6c5f497 100644 --- a/frontend/static/js/challenge.js +++ b/frontend/static/js/challenge.js @@ -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) { diff --git a/frontend/static/js/common.js b/frontend/static/js/common.js index 6f3a0371..fe6fbe94 100644 --- a/frontend/static/js/common.js +++ b/frontend/static/js/common.js @@ -196,8 +196,8 @@ angular.module("FICApp")
- - + +
- +
` diff --git a/libfic/flag_key.go b/libfic/flag_key.go index e1d71608..be27441b 100644 --- a/libfic/flag_key.go +++ b/libfic/flag_key.go @@ -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 diff --git a/libfic/team_my.go b/libfic/team_my.go index b267f5e0..e6582b50 100644 --- a/libfic/team_my.go +++ b/libfic/team_my.go @@ -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) {