You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.1 KiB

  1. openerp.web_offline_warning = function(openerp) {
  2. var _t = openerp.web._t;
  3. var QWeb = openerp.web.qweb;
  4. /**
  5. * Handle general XmlHttpRequestErrors, which occur when the server cannot be reached.
  6. */
  7. openerp.web.GenericXmlHttpRequestErrorHandler = openerp.web.Dialog.extend(openerp.web.ExceptionHandler, {
  8. init: function(parent, error) {
  9. this._super(parent);
  10. this.error = error;
  11. },
  12. display: function() {
  13. var self = this;
  14. new openerp.web.Dialog(this, {
  15. size: 'medium',
  16. title: "Odoo " + _t("Warning"),
  17. buttons: [
  18. {text: _t("Ok"), click: function() { self.$el.parents('.modal').modal('hide'); self.destroy();}}
  19. ],
  20. }, QWeb.render('CrashManager.warning',
  21. {message: _t("The server cannot be reached. You are probably offline.")})
  22. ).open();
  23. }
  24. });
  25. openerp.web.crash_manager_registry.add(void(0), 'openerp.web.GenericXmlHttpRequestErrorHandler');
  26. }