var Unibase; (function (Unibase) { let Platform; (function (Platform) { let Portlets; (function (Portlets) { let Components; (function (Components) { class PortletPermission extends Platform.Core.BaseComponent { jsFiles() { return ['platform/portlets/managers/portletmanager.js', "platform/permission/managers/permissionmanager.js", 'platform/widgets/managers/widgetmanager.js', "platform/portlets/requests/portlet.js", 'platform/permission/managers/permissionmanager.js', "platform/widgets/requests/widgetrole.js", "platform/portlets/requests/portletrole.js", "platform/widgets/components/widgetpermission.js"]; } cssFiles() { return []; } html(id, containerid) { let html = '
' + '
' + ' ' + ' ' + '
' + '
' + '
' + '
' + '
' + '
' + '
' + 'Is Trackable ?' + '' + '
' + '
' + '
' + '
' + 'Everyone can view?' + ' ' + '
' + '
' + '
' + '
' + '' + ' ' + ' ' + '
' + '
' + '
' + '
' + `` + '' + '' + '
' + '
' + '
' + '
' + '
' + '
' + '' + '
'; return html; } load(id, containerid, callback) { var instance = this; var activeportletid = 0; var appId = Unibase.Themes.Providers.DetailHelper.installedAppId; let ActivePortletIndex = Unibase.Themes.Providers.Detail_Settings.Instance().ActivePortlets.findIndex(x => x.InstalledAppId == appId); if (ActivePortletIndex != -1) { activeportletid = Unibase.Themes.Providers.Detail_Settings.Instance().ActivePortlets[ActivePortletIndex].ActivePortletId; } else { activeportletid = Number($("#hf_PortletId").val()); } $("#btn_PortletPermissions_close").click(function () { Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp(); $('.btn_addportlt').removeClass('hidden'); $('.btnEdit_portlet').removeClass('hidden'); $('.manage_pPermissions').removeClass('hidden'); $('.btn_dltportlet').removeClass('hidden'); }); $("#chkIsPortletViewable").change(function () { instance.setPortletViewable(activeportletid); }); $("#Ch_IsTrackable").change(function () { instance.Tracking(activeportletid); }); Unibase.Platform.Widgets.Components.WidgetPermission.Instance().showPermissions(activeportletid, 'portlet', 0); } Tracking(Portletid) { var instance = this; var isTrackble = $("#Ch_IsTrackable").prop('checked'); this.fileCacheHelper.loadJsFile("platform/portlets/requests/portlet.js", function () { let reqObj = new Unibase.Platform.Portlets.Requests.Portlet(); reqObj.PortletId = Portletid, reqObj.IsTrackable = isTrackble; Unibase.Platform.Portlets.Managers.PortletManager.Instance().updateTracking(reqObj).then(function (response) { if (response.status != Unibase.Data.Status.Error) { MessageHelper.Instance().showSuccess(response.message, 'div_PortletMessage'); } else { MessageHelper.Instance().showError(response.message, 'div_PortletMessage'); } }); }); } setPortletViewable(portletid) { var viewable = $("#chkIsPortletViewable").prop('checked'); if (viewable) $('#divPortletViewRoles').hide(); else $('#divPortletViewRoles').show(); Unibase.Platform.Portlets.Managers.PortletManager.Instance().setViewable(portletid, viewable).then(function (response) { if (response.status != Unibase.Data.Status.Error) { MessageHelper.Instance().showSuccess(response.message, 'div_PortletMessage'); } else { MessageHelper.Instance().showError(response.message, 'div_PortletMessage'); } }); } DataBind(Id) { Unibase.Platform.Portlets.Managers.PortletManager.Instance().getPortlet(Id).then(function (response) { if (response.result.IsMandatory == true) { $('#divPortletViewRoles').hide(); } else { $('#divPortletViewRoles').show(); } if (response.result.IsTrackable) { $("#Ch_IsTrackable").prop('checked', true); } if (response.result.ViewAllStages) { $('#tblWPStages').hide(); } else { $('#tblWPStages').show(); } $("#chkIsPortletViewable").prop('checked', response.result.IsMandatory); $("#chkAllStages").prop('checked', response.result.ViewAllStages); Unibase.Platform.Widgets.Components.WidgetPermission.Instance().loadViewRoles(response.result.IsMandatory); }); } changeStagePortletPermissions(stageId, portletId, action) { var postData = { PortletId: portletId, Portlet_StageId: stageId, Status: action }; Unibase.Platform.Portlets.Managers.PortletManager.Instance().savePortletStage(postData).then(function (response) { if (response.status != Unibase.Data.Status.Error) { MessageHelper.Instance().showSuccess(response.message, 'div_WidgetMessage'); } else { MessageHelper.Instance().showError(response.message, 'div_WidgetMessage'); } }); } setViewToAllStages(portletid, viewable) { Unibase.Platform.Portlets.Managers.PortletManager.Instance().setViewToAllStages(portletid, viewable).then(function (response) { if (response.status == Unibase.Data.Status.Success) { if (response.result.ViewAllStages) { $('#tblWPStages').hide(); } else { $('#tblWPStages').show(); } MessageHelper.Instance().showSuccess(response.message, 'div_WidgetMessage'); } else { MessageHelper.Instance().showError(response.message, 'div_WidgetMessage'); } }); } static Instance() { if (this._instance === undefined) this._instance = new PortletPermission(); return this._instance; } } Components.PortletPermission = PortletPermission; })(Components = Portlets.Components || (Portlets.Components = {})); })(Portlets = Platform.Portlets || (Platform.Portlets = {})); })(Platform = Unibase.Platform || (Unibase.Platform = {})); })(Unibase || (Unibase = {}));