invite_popup.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Copyright (c) UNA, Inc - https://una.io
  3. * MIT License - https://opensource.org/licenses/MIT
  4. *
  5. * @defgroup BaseGroups Base classes for groups modules
  6. * @ingroup UnaModules
  7. *
  8. * @{
  9. */
  10. function BxBaseModGroupsInvitePopup(oOptions) {
  11. this._sActionsUrl = oOptions.sActionUrl;
  12. this._sPopupId = oOptions.sPopupId == undefined ? {} : oOptions.sPopupId;
  13. this._sKey = oOptions.sKey == undefined ? {} : oOptions.sKey;
  14. this._sAcceptUrl = oOptions.sAcceptUrl == undefined ? {} : oOptions.sAcceptUrl;
  15. this._sDeclineUrl = oOptions.sDeclineUrl == undefined ? {} : oOptions.sDeclineUrl;
  16. this._iGroupProfileId = oOptions.iGroupProfileId == undefined ? {} : oOptions.iGroupProfileId;
  17. var $this = this;
  18. $(document).ready(function () {
  19. $this.init();
  20. });
  21. }
  22. BxBaseModGroupsInvitePopup.prototype.init = function () {
  23. var $this = this;
  24. $('#' + $this._sPopupId + ' .bx-invite-accept').click(function () {
  25. $this.onClickAccept();
  26. });
  27. $('#' + $this._sPopupId + ' .bx-invite-decline').click(function () {
  28. $this.onClickDecline();
  29. });
  30. $('#' + $this._sPopupId).dolPopup();
  31. };
  32. BxBaseModGroupsInvitePopup.prototype.onClickAccept = function () {
  33. var $this = this;
  34. $.post($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/1/', function () {
  35. location.href = $this._sAcceptUrl
  36. });
  37. };
  38. BxBaseModGroupsInvitePopup.prototype.onClickDecline = function () {
  39. var $this = this;
  40. $.post($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/0/', function () {
  41. location.href = $this._sDeclineUrl
  42. });
  43. };