Browse Source

Ticket #4014 - Group based: Invitation popup isn't automatically closed.

AntonLV 4 năm trước cách đây
mục cha
commit
933b3044cb

+ 4 - 1
modules/base/groups/classes/BxBaseModGroupsPageEntry.php

@@ -121,7 +121,10 @@ class BxBaseModGroupsPageEntry extends BxBaseModProfilePageEntry
                 'button_decline' => _t($CNF['T']['txt_invitation_popup_decline_button']),
             )), true);
 
-        $this->_oTemplate->addJs(array('invite_popup.js'));        
+        $this->_oTemplate->addJs([
+            'modules/base/groups/js/|invite_popup.js', 
+            'invite_popup.js'
+        ]);
         return $sCode;
     }
 

+ 49 - 0
modules/base/groups/js/invite_popup.js

@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    BaseGroups Base classes for groups modules
+ * @ingroup     UnaModules
+ *
+ * @{
+ */
+
+function BxBaseModGroupsInvitePopup(oOptions) {
+    this._sActionsUrl = oOptions.sActionUrl;
+    this._sPopupId = oOptions.sPopupId == undefined ? {} : oOptions.sPopupId;
+    this._sKey = oOptions.sKey == undefined ? {} : oOptions.sKey;
+    this._sAcceptUrl = oOptions.sAcceptUrl == undefined ? {} : oOptions.sAcceptUrl;
+    this._sDeclineUrl = oOptions.sDeclineUrl == undefined ? {} : oOptions.sDeclineUrl;
+    this._iGroupProfileId = oOptions.iGroupProfileId == undefined ? {} : oOptions.iGroupProfileId;
+
+    var $this = this;
+    $(document).ready(function () {
+        $this.init();
+    });
+}
+
+BxBaseModGroupsInvitePopup.prototype.init = function () {
+    var $this = this;
+    $('#' + $this._sPopupId + ' .bx-invite-accept').click(function () {
+        $this.onClickAccept();
+    });
+    $('#' + $this._sPopupId + ' .bx-invite-decline').click(function () {
+        $this.onClickDecline();
+    });
+
+    $('#' + $this._sPopupId).dolPopup();
+};
+
+BxBaseModGroupsInvitePopup.prototype.onClickAccept = function () {
+    var $this = this;
+    $.post($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/1/', function () {
+        location.href = $this._sAcceptUrl
+    });
+};
+
+BxBaseModGroupsInvitePopup.prototype.onClickDecline = function () {
+    var $this = this;
+    $.post($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/0/', function () {
+        location.href = $this._sDeclineUrl
+    });
+};

+ 3 - 37
modules/boonex/courses/js/invite_popup.js

@@ -9,42 +9,8 @@
  */
 
 function BxCoursesInvitePopup(oOptions) {
-	this._sActionsUrl = oOptions.sActionUrl;
-	this._sPopupId = oOptions.sPopupId == undefined ? {} : oOptions.sPopupId;
-	this._sKey = oOptions.sKey == undefined ? {} : oOptions.sKey;
-	this._sAcceptUrl = oOptions.sAcceptUrl == undefined ? {} : oOptions.sAcceptUrl;
-	this._sDeclineUrl = oOptions.sDeclineUrl == undefined ? {} : oOptions.sDeclineUrl;
-	this._iGroupProfileId = oOptions.iGroupProfileId == undefined ? {} : oOptions.iGroupProfileId;
-
-	var $this = this;
-	$(document).ready(function () {
-	    $this.init();
-	});
+    BxBaseModGroupsInvitePopup.call(this, oOptions);
 }
 
-BxCoursesInvitePopup.prototype.init = function () {
-    var $this = this;
-    $('#' + $this._sPopupId + ' .bx-invite-accept').click(function () {
-        $this.onClickAccept();
-    });
-    $('#' + $this._sPopupId + ' .bx-invite-decline').click(function () {
-        $this.onClickDecline();
-    });
-
-    $('#' + $this._sPopupId).dolPopup();
-};
-
-BxCoursesInvitePopup.prototype.onClickAccept = function () {
-	var $this = this;
-	$.getJSON($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/1/', function () {
-	    location.href = $this._sAcceptUrl
-	});
-
-};
-
-BxCoursesInvitePopup.prototype.onClickDecline = function () {
-    var $this = this;
-    $.getJSON($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/0/', function () {
-        location.href = $this._sDeclineUrl
-    });
-};
+BxCoursesInvitePopup.prototype = Object.create(BxBaseModGroupsInvitePopup.prototype);
+BxCoursesInvitePopup.prototype.constructor = BxCoursesInvitePopup;

+ 3 - 37
modules/boonex/events/js/invite_popup.js

@@ -9,42 +9,8 @@
  */
 
 function BxEventsInvitePopup(oOptions) {
-	this._sActionsUrl = oOptions.sActionUrl;
-	this._sPopupId = oOptions.sPopupId == undefined ? {} : oOptions.sPopupId;
-	this._sKey = oOptions.sKey == undefined ? {} : oOptions.sKey;
-	this._sAcceptUrl = oOptions.sAcceptUrl == undefined ? {} : oOptions.sAcceptUrl;
-	this._sDeclineUrl = oOptions.sDeclineUrl == undefined ? {} : oOptions.sDeclineUrl;
-	this._iGroupProfileId = oOptions.iGroupProfileId == undefined ? {} : oOptions.iGroupProfileId;
-
-	var $this = this;
-	$(document).ready(function () {
-	    $this.init();
-	});
+    BxBaseModGroupsInvitePopup.call(this, oOptions);
 }
 
-BxEventsInvitePopup.prototype.init = function () {
-    var $this = this;
-    $('#' + $this._sPopupId + ' .bx-invite-accept').click(function () {
-        $this.onClickAccept();
-    });
-    $('#' + $this._sPopupId + ' .bx-invite-decline').click(function () {
-        $this.onClickDecline();
-    });
-
-    $('#' + $this._sPopupId).dolPopup();
-};
-
-BxEventsInvitePopup.prototype.onClickAccept = function () {
-	var $this = this;
-	$.getJSON($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/1/', function () {
-	    location.href = $this._sAcceptUrl
-	});
-
-};
-
-BxEventsInvitePopup.prototype.onClickDecline = function () {
-    var $this = this;
-    $.getJSON($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/0/', function () {
-        location.href = $this._sDeclineUrl
-    });
-};
+BxEventsInvitePopup.prototype = Object.create(BxBaseModGroupsInvitePopup.prototype);
+BxEventsInvitePopup.prototype.constructor = BxEventsInvitePopup;

+ 3 - 37
modules/boonex/groups/js/invite_popup.js

@@ -9,42 +9,8 @@
  */
 
 function BxGroupsInvitePopup(oOptions) {
-	this._sActionsUrl = oOptions.sActionUrl;
-	this._sPopupId = oOptions.sPopupId == undefined ? {} : oOptions.sPopupId;
-	this._sKey = oOptions.sKey == undefined ? {} : oOptions.sKey;
-	this._sAcceptUrl = oOptions.sAcceptUrl == undefined ? {} : oOptions.sAcceptUrl;
-	this._sDeclineUrl = oOptions.sDeclineUrl == undefined ? {} : oOptions.sDeclineUrl;
-	this._iGroupProfileId = oOptions.iGroupProfileId == undefined ? {} : oOptions.iGroupProfileId;
-
-	var $this = this;
-	$(document).ready(function () {
-	    $this.init();
-	});
+    BxBaseModGroupsInvitePopup.call(this, oOptions);
 }
 
-BxGroupsInvitePopup.prototype.init = function () {
-    var $this = this;
-    $('#' + $this._sPopupId + ' .bx-invite-accept').click(function () {
-        $this.onClickAccept();
-    });
-    $('#' + $this._sPopupId + ' .bx-invite-decline').click(function () {
-        $this.onClickDecline();
-    });
-
-    $('#' + $this._sPopupId).dolPopup();
-};
-
-BxGroupsInvitePopup.prototype.onClickAccept = function () {
-	var $this = this;
-	$.post($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/1/', function () {
-	    location.href = $this._sAcceptUrl
-	});
-
-};
-
-BxGroupsInvitePopup.prototype.onClickDecline = function () {
-    var $this = this;
-    $.post($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/0/', function () {
-        location.href = $this._sDeclineUrl
-    });
-};
+BxGroupsInvitePopup.prototype = Object.create(BxBaseModGroupsInvitePopup.prototype);
+BxGroupsInvitePopup.prototype.constructor = BxGroupsInvitePopup;

+ 3 - 37
modules/boonex/spaces/js/invite_popup.js

@@ -9,42 +9,8 @@
  */
 
 function BxSpacesInvitePopup(oOptions) {
-	this._sActionsUrl = oOptions.sActionUrl;
-	this._sPopupId = oOptions.sPopupId == undefined ? {} : oOptions.sPopupId;
-	this._sKey = oOptions.sKey == undefined ? {} : oOptions.sKey;
-	this._sAcceptUrl = oOptions.sAcceptUrl == undefined ? {} : oOptions.sAcceptUrl;
-	this._sDeclineUrl = oOptions.sDeclineUrl == undefined ? {} : oOptions.sDeclineUrl;
-	this._iGroupProfileId = oOptions.iGroupProfileId == undefined ? {} : oOptions.iGroupProfileId;
-
-	var $this = this;
-	$(document).ready(function () {
-	    $this.init();
-	});
+    BxBaseModGroupsInvitePopup.call(this, oOptions);
 }
 
-BxSpacesInvitePopup.prototype.init = function () {
-    var $this = this;
-    $('#' + $this._sPopupId + ' .bx-invite-accept').click(function () {
-        $this.onClickAccept();
-    });
-    $('#' + $this._sPopupId + ' .bx-invite-decline').click(function () {
-        $this.onClickDecline();
-    });
-
-    $('#' + $this._sPopupId).dolPopup();
-};
-
-BxSpacesInvitePopup.prototype.onClickAccept = function () {
-	var $this = this;
-	$.getJSON($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/1/', function () {
-	    location.href = $this._sAcceptUrl
-	});
-
-};
-
-BxSpacesInvitePopup.prototype.onClickDecline = function () {
-    var $this = this;
-    $.getJSON($this._sActionsUrl + 'ProcessInvite/' + $this._sKey + '/' + $this._iGroupProfileId + '/0/', function () {
-        location.href = $this._sDeclineUrl
-    });
-};
+BxSpacesInvitePopup.prototype = Object.create(BxBaseModGroupsInvitePopup.prototype);
+BxSpacesInvitePopup.prototype.constructor = BxSpacesInvitePopup;