Files

6.4 KiB

Bookmarklet — auto-fill test form

A drag-to-bookmarks helper that pre-fills an XAMXAM thesis form with dummy data so a submit can be tested quickly.

The old ?mode=student flag and the standalone student form no longer exist. Student submissions now use share links at /partage/<slug> (see the share_links table). The same form template (app/templates/partials/form/) drives admin add/edit and the partage form, so the field names below mostly match. The bookmarklet below targets the admin add form (/admin/add.php).

Bookmarklet

Open /admin/add.php (logged in), then click the bookmarklet:

javascript:(function(){var set=function(n,v){var e=document.querySelector('[name="'+n+'"]');if(e){e.value=v;e.dispatchEvent(new Event('change',{bubbles:true}));}};var setFirst=function(n,v){var e=document.querySelector('[name="'+n+'"][type="text"]');if(e){e.value=v;e.dispatchEvent(new Event('change',{bubbles:true}));}};var checkCB=function(n,v){var e=document.querySelector('[name="'+n+'[]"][value="'+v+'"]');if(e){e.checked=true;e.dispatchEvent(new Event('change',{bubbles:true}));}};var check=function(n){var e=document.querySelector('[name="'+n+'"]');if(e){e.checked=true;e.dispatchEvent(new Event('change',{bubbles:true}));}};set('titre','TFE Test — Impact des réseaux sociaux');set('subtitle','Étude de cas auprès des étudiant·es de l\'ERG');set('auteurice','Marie-France Dupont');set('contact_visible','public');setFirst('jury_promoteur[]','Dr. Aline Vandenberghe');setFirst('jury_lecteur_interne[]','Prof. Jean-Luc Moreau');setFirst('jury_lecteur_externe[]','Prof. Kim Sølv');setFirst('jury_promoteur_ulb_name[]','Prof. Université');set('synopsis','Ce travail explore l\'impact des plateformes numériques sur la pratique artistique contemporaine.');set('orientation','4');set('ap','3');set('finality','1');checkCB('formats','1');checkCB('formats','3');set('license_id','8');set('duration_pages','96');check('cc2r');set('website_url','https://example.com/tfe-test');set('access_type_id','2');set('contact_interne','mfd@testmail.be');set('jury_points','16.5');})()

Readable source

(function () {
  var set = function (n, v) {
    var e = document.querySelector('[name="' + n + '"]');
    if (e) { e.value = v; e.dispatchEvent(new Event('change', { bubbles: true })); }
  };
  var setFirst = function (n, v) {           // first hidden/text field of a jury array
    var e = document.querySelector('[name="' + n + '"][type="text"]');
    if (e) { e.value = v; e.dispatchEvent(new Event('change', { bubbles: true })); }
  };
  var checkCB = function (n, v) {            // checkbox-list (formats[]) value
    var e = document.querySelector('[name="' + n + '[]"][value="' + v + '"]');
    if (e) { e.checked = true; e.dispatchEvent(new Event('change', { bubbles: true })); }
  };
  var check = function (n) {
    var e = document.querySelector('[name="' + n + '"]');
    if (e) { e.checked = true; e.dispatchEvent(new Event('change', { bubbles: true })); }
  };

  // ── Informations du TFE ──
  set('titre', 'TFE Test — Impact des réseaux sociaux');
  set('subtitle', 'Étude de cas auprès des étudiant·es de l\'ERG');
  set('auteurice', 'Marie-France Dupont');          // comma-separated
  set('contact_visible', 'public');                 // admin mode; partage uses 'mail'

  // ── Jury (array fields, one row each) ──
  setFirst('jury_promoteur[]', 'Dr. Aline Vandenberghe');
  setFirst('jury_lecteur_interne[]', 'Prof. Jean-Luc Moreau');
  setFirst('jury_lecteur_externe[]', 'Prof. Kim Sølv');
  setFirst('jury_promoteur_ulb_name[]', 'Prof. Université');

  // ── Cadre académique ──
  set('synopsis', 'Ce travail explore l\'impact des plateformes numériques sur la pratique artistique contemporaine.');
  set('orientation', '4');       // Installation-Performance
  set('ap', '3');                // Atelier Pratiques Situées
  set('finality', '1');          // Approfondie
  checkCB('formats', '1');       // Site web
  checkCB('formats', '3');       // Vidéo

  // ── Métadonnées ──
  set('license_id', '8');        // Tous droits réservés
  set('duration_pages', '96');
  check('cc2r');                 // CC2r licence
  set('website_url', 'https://example.com/tfe-test');
  set('access_type_id', '2');    // Interne
  set('contact_interne', 'mfd@testmail.be');
  set('jury_points', '16.5');
})();

Notes & current field names (verified against the form partials)

Field Notes
titre, subtitle, auteurice auteurice is comma-separated
contact_visible admin add/edit; the partage form uses mail
jury_promoteur[], jury_lecteur_interne[], jury_lecteur_externe[], jury_promoteur_ulb_name[] one input[type=text] per row (setFirst targets the first)
orientation, ap, finality <select>; values are DB ids
formats[] checkbox-list
languages[], tags[] pill-search (type-ahead with hidden name=…[] pills) — not pre-filled by this simple helper; add pills through the search UI or dispatch the pill-create event
license_id <select> of license_types
cc2r checkbox (renamed from cc4r)
want_license hidden 0; set to 1 to show the licence explanation block
duration_pages combined duration: pages int; time uses duration_h + duration_m (values in minutes)
website_url, website_label the "lien" (site web) fields
access_type_id radio: "", 1=Libre, 2=Interne, 3=Interdit
contact_interne, exemplaire_baiu, exemplaire_erg, is_published, context_note, jury_points, remarks other form fields

Removed / renamed

  • cc4r → cc2r
  • duration_info → split into duration_pages + duration_h/duration_m
  • jury_president, single jury_promoteur → jury arrays above (jury_promoteur[] etc.)
  • lien → website_url; mail in admin mode → contact_visible
  • contact_public checkbox → handled via authors.show_contact / contact_visible
  • ?mode=student → student flows go through /partage/<slug>

Lookup ids

orientations 4=Installation-Performance; ap_programs 3=Atelier Pratiques Situées; finality_types 1=Approfondie; format_types 1=Site web, 3=Vidéo; license_types 8=Tous droits réservés; access_types 2=Interne.

IDs may shift after DB migrations that re-number reference rows — verify against the current app/storage/schema.sql seed data if a lookup fails.