Skip to content

feat: add notifications handler #46

@Vexcited

Description

@Vexcited

Create a handler in the client to access data from this menu.

image

Related PR on pronotepy : bain3/pronotepy#288


request

{
  "session": 1261072,
  "numeroOrdre": "c0169622e638d173cc1245a582ae5a4f",
  "nom": "CentraleNotifications",
  "donneesSec": {
    "_Signature_": {
      "onglet": 7 // current active onglet, could be any 
    }
  }
}

response data

{
  "donnees": {
    "liste": {
      "_T": 24,
      "V": [
        {
          "L": "Sécurité",
          "ident": "secSecurite",
          "liste": {
            "_T": 24,
            "V": [
              {
                "type": 1,
                "action": 0,
                "date": {
                  "_T": 7,
                  "V": "04/07/2024 22:41:03"
                },
                "id": "not_app_5_FA2949486DC7B572D796718B89343531",
                "titre": {
                  "_T": 21,
                  "V": "Opérations sur votre compte PRONOTE"
                },
                "message": {
                  "_T": 21,
                  "V": "Le 04/07/2024 à 22:41, suite à une modification de la politique de sécurité de l'établissement par votre administrateur, la politique de sécurité de votre compte a été modifiée.<br />  - personnalisation de votre mot de passe"
                },
                "compteur": 1,
                "modalites": {
                  "_T": 26,
                  "V": "[0]"
                },
                "dateExpiration": {
                  "_T": 7,
                  "V": "11/07/2024 22:41:03"
                },
                "onBtnClick": true
              }
            ]
          }
        }
      ]
    },
    "nbNotifs": 1
  },
  "nom": "CentraleNotifications"
}

javascript builder

_construireListeNotifications(aSection, aIndexSection, aAfficherHistorique) {
  const H = [];
  aSection.liste.parcourir((aNotification,aIndexNotif)=>{
    const lEstHistorique = aNotification.modalites.contains(TypeCentraleNotifications_1.TypeModaliteAffichage.affHistorique);
    if ((aAfficherHistorique && !lEstHistorique) || (!aAfficherHistorique && lEstHistorique)) {
      return;
    }
    let lBoutonCoin = '';
    let lAvecActionArticle = false;
    switch (aNotification.action) {
    case TypeCentraleNotifications_1.TypeActionBoutonNotif.abnLien:
      lBoutonCoin = '<i class="sc_btnCoin icon_affichage_widget"></i>';
      lAvecActionArticle = true;
      break;
    case TypeCentraleNotifications_1.TypeActionBoutonNotif.abnLu:
      if (!aAfficherHistorique) {
        lBoutonCoin = ['<ie-btnimage class="sc_btnCoin btnImageIcon icon_eye_close"', ' title="', ObjetTraduction_1.GTraductions.getValeur('CentraleNotifications.MarquerLu'), '"', ObjetHtml_1.GHtml.composeAttr('ie-model', 'btnNotifCoin', [aIndexSection, aIndexNotif]), '></ie-btnimage>'].join('');
      }
      break;
    case TypeCentraleNotifications_1.TypeActionBoutonNotif.abnFermer:
      lBoutonCoin = ['<ie-btnimage class="sc_btnCoin btnImageIcon icon_fermeture_widget"', ' title="', ObjetTraduction_1.GTraductions.getValeur('Fermer'), '"', ObjetHtml_1.GHtml.composeAttr('ie-model', 'btnNotifCoin', [aIndexSection, aIndexNotif]), '></ie-btnimage>'].join('');
      break;
    }
    const lClasses = [];
    if (lAvecActionArticle) {
      lClasses.push('sc_article_action', 'ie-ripple');
    }
    if (aAfficherHistorique) {
      lClasses.push('sc_article_histo');
    }
    H.push('<article tabindex="0"', (lClasses.length > 0 ? ' class="' + lClasses.join(' ') + '"' : ''), (lAvecActionArticle ? ObjetHtml_1.GHtml.composeAttr('ie-node', 'getNodeNotif', [aIndexSection, aIndexNotif, aNotification.id]) : ''), '>', lBoutonCoin, '<div class="sc_article_gauche">', _contruireEtiquetteArticle(aNotification), '</div>', '<div class="sc_article_contenu">', aNotification.titre ? '<div class="sc_article_contenu_titre' + (lBoutonCoin ? ' sc_article_contenu_titre_avecBtn' : '') + '">' + aNotification.titre + '</div>' : '', '<div ie-node="getNodeMessage">', aNotification.message, '</div>', aNotification.dateLue ? _construireDateLue(aNotification) : '', aNotification.dateExpiration && lEstHistorique ? _construireDateExpiration(aNotification) : '', '</div>', '</article>');
  }
  );
  return H.join('');
}

enums

;IE.fModule({
  f: function(exports, require, module, global) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.TypeModaliteAffichage = exports.TypeActionBoutonNotif = exports.TypeNotification = void 0;
    var TypeNotification;
    (function(TypeNotification) {
      TypeNotification[TypeNotification["nOrpheline"] = 0] = "nOrpheline";
      TypeNotification[TypeNotification["nUnique"] = 1] = "nUnique";
      TypeNotification[TypeNotification["nCompteur"] = 2] = "nCompteur";
      TypeNotification[TypeNotification["nRouleau"] = 3] = "nRouleau";
    }
    )(TypeNotification || (exports.TypeNotification = TypeNotification = {}));
    var TypeActionBoutonNotif;
    (function(TypeActionBoutonNotif) {
      TypeActionBoutonNotif[TypeActionBoutonNotif["abnLu"] = 0] = "abnLu";
      TypeActionBoutonNotif[TypeActionBoutonNotif["abnFermer"] = 1] = "abnFermer";
      TypeActionBoutonNotif[TypeActionBoutonNotif["abnLien"] = 2] = "abnLien";
      TypeActionBoutonNotif[TypeActionBoutonNotif["abnNoAction"] = 3] = "abnNoAction";
    }
    )(TypeActionBoutonNotif || (exports.TypeActionBoutonNotif = TypeActionBoutonNotif = {}));
    var TypeModaliteAffichage;
    (function(TypeModaliteAffichage) {
      TypeModaliteAffichage[TypeModaliteAffichage["affZone"] = 0] = "affZone";
      TypeModaliteAffichage[TypeModaliteAffichage["affHistorique"] = 1] = "affHistorique";
      TypeModaliteAffichage[TypeModaliteAffichage["affModale"] = 2] = "affModale";
      TypeModaliteAffichage[TypeModaliteAffichage["affPopup"] = 3] = "affPopup";
    }
    )(TypeModaliteAffichage || (exports.TypeModaliteAffichage = TypeModaliteAffichage = {}));
  },
  fn: 'typecentralenotifications.js'
});

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions