OTRS API Reference JavaScript

Source: Core.Agent.TicketEmailOutbound.js

  1. // --
  2. // Copyright (C) 2001-2020 OTRS AG, https://otrs.com/
  3. // --
  4. // This software comes with ABSOLUTELY NO WARRANTY. For details, see
  5. // the enclosed file COPYING for license information (GPL). If you
  6. // did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
  7. // --
  8. "use strict";
  9. var Core = Core || {};
  10. Core.Agent = Core.Agent || {};
  11. /**
  12. * @namespace Core.Agent.TicketEmailOutbound
  13. * @memberof Core.Agent
  14. * @author OTRS AG
  15. * @description
  16. * This namespace contains special module functions for TicketEmailOutbound.
  17. */
  18. Core.Agent.TicketEmailOutbound = (function (TargetNS) {
  19. /**
  20. * @name Init
  21. * @memberof Core.Agent.TicketEmailOutbound
  22. * @function
  23. * @description
  24. * This function initializes the module functionality.
  25. */
  26. TargetNS.Init = function () {
  27. var ArticleComposeOptions = Core.Config.Get('ArticleComposeOptions'),
  28. DynamicFieldNames = Core.Config.Get('DynamicFieldNames');
  29. // remove customers
  30. $('.CustomerTicketRemove').on('click', function () {
  31. Core.Agent.CustomerSearch.RemoveCustomerTicket($(this));
  32. return false;
  33. });
  34. // set a template
  35. $('#StandardTemplateID').on('change', function () {
  36. Core.Agent.TicketAction.ConfirmTemplateOverwrite('RichText', $(this), function () {
  37. Core.AJAX.FormUpdate($('#Compose'), 'AJAXUpdateTemplate', 'StandardTemplateID', ['RichTextField']);
  38. });
  39. return false;
  40. });
  41. // update dynamic fields in form
  42. $('#ComposeStateID').on('change', function () {
  43. Core.AJAX.FormUpdate($('#Compose'), 'AJAXUpdate', 'ComposeStateID', DynamicFieldNames);
  44. });
  45. // change article compose options
  46. if (typeof ArticleComposeOptions !== 'undefined') {
  47. $.each(ArticleComposeOptions, function (Key, Value) {
  48. $('#'+Value.Name).on('change', function () {
  49. Core.AJAX.FormUpdate($('#Compose'), 'AJAXUpdate', Value.Name, Value.Fields);
  50. });
  51. });
  52. }
  53. };
  54. Core.Init.RegisterNamespace(TargetNS, 'APP_MODULE');
  55. return TargetNS;
  56. }(Core.Agent.TicketEmailOutbound || {}));

^ Use Elevator