Durchsuchbare Dokumentation aufrufen

Zurück zur Dokumentationsübersicht

Vorhandene Mitteilungskonfiguration erweitern

Diese Dokumentation zeigt, wie Sie die E-Mail-Konfiguration für Mitteilungen erweitern, sodass Sie eigene Intervalle definieren können. Dabei bleibt die gesamte Konfiguration updatefähig.

Voraussetzungen


Sie benötigen das Plugin agorum core template manager. Installieren Sie das Plugin über den agorum core plugin manager.

Das Projekt anlegen


  1. Legen Sie über den agorum core template manager ein neues Projekt an, falls nicht vorhanden.

Das Konfigurationsskript anlegen


  1. Öffnen Sie links in der Seitenleiste Explorer.
  2. Öffnen Sie Ihr eben angelegtes Projekt und wechseln Sie dort in den Unterordner js.
  3. Legen Sie einen Ordner namens notification an.
  4. Legen Sie in diesem neuen Ordner eine JavaScript-Datei namens notification-type-email.js an.
  5. Befüllen Sie die Datei mit folgendem Inhalt:
    /* global sc */
    /* jshint unused: true */
    let i18n = require('common/i18n');
    
    // load original script
    let baseNotification = require('/agorum/roi/customers/agorum.composite/js/notification/notification-type-email');
    
    // settings
    exports.settings = user => { 
      if (!user) user = sc.loginUser;
    
      let settings = baseNotification.settings(user);
      
      // now modify the settings
      settings[0].intervals = [
        {
          text: i18n.translate('agorum.composite.notification.time.5'),
          value: 5
        },
        {
          text: i18n.translate('agorum.composite.notification.time.30'),
          value: 30
        },
        {
          text: i18n.translate('agorum.composite.notification.time.60'),
          value: 60
        },
        {
          text: i18n.translate('agorum.composite.notification.time.480'),
          value: 480
        },
        {
          text: i18n.translate('agorum.composite.notification.time.1440'),
          value: 1440
        },
        {
          text: i18n.translate('agorum.composite.notification.time.ASAP'),
          value: 0
        },
        {
          text: i18n.translate('agorum.composite.notification.time.Disabled'),
          value: -1
        }
      ];
      
      return settings;
    };
    
    Das Skript lädt alle Einstellungen des Standardskripts /agorum/roi/customers/agorum.composite/js/notification/notification-type-email und überschreibt einen Teil. Das Laden geschieht mit:
    let settings = baseNotification.settings(user);
  6. Passen Sie das obige Skript an, um einen Teil der Konfiguration zu überschreiben. In diesem Beispiel sollen andere Intervalle bei der Auswahl zur Verfügung stehen:
    // now modify the settings
    settings[0].intervals = [
      {
        text: i18n.translate('agorum.composite.notification.time.5'),
        value: 5
      },
      {
        text: i18n.translate('agorum.composite.notification.time.30'),
        value: 30
      },
      {
        text: i18n.translate('agorum.composite.notification.time.60'),
        value: 60
      },
      {
        text: i18n.translate('agorum.composite.notification.time.480'),
        value: 480
      },
      {
        text: i18n.translate('agorum.composite.notification.time.1440'),
        value: 1440
      },
      {
        text: i18n.translate('agorum.composite.notification.time.ASAP'),
        value: 0
      },
      {
        text: i18n.translate('agorum.composite.notification.time.Disabled'),
        value: -1
      }
    ];
    
    Ergebnis: Das System übernimmt alle Einstellungen des originalen Skripts und überschreibt die Intervalle.

Das eigene Skript registrieren


Als letzten Schritt registrieren Sie das eigene Skript, sodass das System es lädt.

  1. Öffnen Sie links in der Seitenleiste Administration und dann MetaDB.
  2. Öffnen Sie den Pfad:
    MAIN_MODULE_MANAGEMENT/customers
  3. Legen Sie über das Symbol  folgende Property-Bundles an:

    • agorum.composite.acic.notification
    • settings
    • email

    Ergebnis: Folgende Struktur entsteht:
    MAIN_MODULE_MANAGEMENT/customers
      agorum.composite.acic.notification
        settings
          email
    
  4. Legen Sie unterhalb von email über das Symbol  folgenden Property-Entry an:

    Name
    js

    Datentyp
    Zeichenkette (String)

    Wert (String)
    /agorum/roi/customers/[ Name Ihres Plug-ins]/js/notification/notification-type-email.js
  5. Speichern Sie.
  6. Testen Sie die Konfiguration, indem Sie eine Suche ausführen und auf die Mitteilungsglocke klicken.

    Ergebnis: Im Bereich E-Mail erscheint bei Intervalle der neue Eintrag ASAP.