Example #1
0
/**
 * Tells the user how to enable IMAP/POP3 for Gmail
 */
function SetupFixGmail(domNode, mode, args) {
  this.domNode = domNode;
  this.account = args.account;
  this.restoreCard = args.restoreCard;

  // The account name is not translatable; set it verbatim.
  this.getElement('sup-gmail-account').textContent = this.account.name;

  // Localize the common elements. Since the text of these may differ
  // depending on the account type, we must translate them here rather
  // than through data-l10n-id.
  var translations = {
    'sup-account-header-label': 'setup-gmail-{ACCOUNT_TYPE}-header',
    'sup-enable-label': 'setup-gmail-{ACCOUNT_TYPE}-message',
    'sup-dismiss-btn': 'setup-gmail-{ACCOUNT_TYPE}-retry'
  };
  var accountType = (this.account.type === 'imap+smtp' ? 'imap' : 'pop3');
  for (var className in translations) {
    var l10nId = translations[className].replace('{ACCOUNT_TYPE}', accountType);
    mozL10n.localize(this.getElement(className), l10nId);
  }

  this.getElement('sup-dismiss-btn').addEventListener(
    'click', this.onDismiss.bind(this), false);
}
Example #2
0
  renderSendStatus: function() {
    var sendStatus = this.composer.sendStatus || {};
    if (sendStatus.state === 'error') {
      var badAddresses = sendStatus.badAddresses || [];

      // For debugging, report some details to the console, masking
      // recipients for privacy.
      console.log('Editing a failed outbox message. Details:', JSON.stringify({
        err: sendStatus.err,
        badAddressCount: badAddresses.length,
        sendFailures: sendStatus.sendFailures
      }, null, ' '));

      var l10nId;
      if (badAddresses.length || sendStatus.err === 'bad-recipient') {
        l10nId = 'send-failure-recipients';
      } else {
        l10nId = 'send-failure-unknown';
      }

      mozL10n.localize(this.errorMessage, l10nId);
      this.errorMessage.classList.remove('collapsed');
    } else {
      this.errorMessage.classList.add('collapsed');
    }
  },