private void SetTagsInfo(dtoFilters filters, Int32 idCommunity)
        {
            Int32  idOrganization = 0;
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            lm.Comol.Core.DomainModel.Domain.ModuleCommunityManagement permissions = null;
            if (filters.ForOrganization)
            {
                if (idCommunity == 0)
                {
                    idCommunity    = UserContext.CurrentCommunityID;
                    idOrganization = CurrentManager.GetIdOrganizationFromCommunity(idCommunity);
                }
                if (idOrganization == 0)
                {
                    idOrganization = CurrentManager.GetUserDefaultIdOrganization(UserContext.CurrentUserID);
                    idCommunity    = CurrentManager.GetIdCommunityFromOrganization(idOrganization);
                }
                permissions = new DomainModel.Domain.ModuleCommunityManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, lm.Comol.Core.DomainModel.Domain.ModuleCommunityManagement.UniqueID));
            }
            else
            {
                permissions = DomainModel.Domain.ModuleCommunityManagement.CreatePortalmodule((p == null) ? (Int32)UserTypeStandard.Guest : p.TypeID);
            }

            Int32  noTags = ServiceTags.GetCommunitiesWithNoTags();
            String url    = "";

            if (permissions.Administration || permissions.Manage)
            {
                url = RootObject.BulkTagsAssignment(idOrganization, !filters.ForOrganization, true);
            }
            View.LoadTagsInfo(noTags, ServiceTags.GetUntranslatedTagsCount(filters.IdSelectedLanguage, false), 0, url);
        }
Exemple #2
0
        public void InitView(ModuleGenericTemplateMessages permissions, lm.Comol.Core.Notification.Domain.NotificationChannel channel, dtoSelectorContext context, long idTemplate, long idVersion, Boolean isVerifyed = false, List <dtoTemplateItem> items = null)
        {
            View.isInitialized = true;
            if (!isVerifyed)
            {
                if (context.IdModule <= 0 && !String.IsNullOrEmpty(context.ModuleCode))
                {
                    context.IdModule = CurrentManager.GetModuleID(context.ModuleCode);
                }
                if (context.IdModule > 0 && String.IsNullOrEmpty(context.ModuleCode))
                {
                    context.ModuleCode = CurrentManager.GetModuleCode(context.IdModule);
                }
                context.IsForPortal = (context.IsForPortal && context.IdCommunity == 0 && context.IdOrganization == 0);
                if (context.IdOrganizationCommunity <= 0)
                {
                    if (context.IdOrganization > 0)
                    {
                        context.IdOrganizationCommunity = CurrentManager.GetIdCommunityFromOrganization(context.IdOrganization);
                    }
                    else if (context.IdCommunity > 0 && context.IdOrganization <= 0)
                    {
                        Community community = CurrentManager.GetCommunity(context.IdCommunity);
                        context.IdOrganizationCommunity = (community == null) ? 0 : ((community.IdFather == 0) ? community.Id : CurrentManager.GetIdCommunityFromOrganization(community.IdOrganization));
                    }
                }
            }
            dtoTemplateItem current = Service.GetDefaultAutomaticTemplate(context, channel);

            if (UserContext.isAnonymous)
            {
                LoadCurrentTemplate(current);
                View.AllowPreview = false;
                View.AllowSelect  = false;
            }
            else
            {
                LoadItems(permissions, channel, current, context, idTemplate, idVersion, items);
            }
        }
Exemple #3
0
        private dtoSelectorContext GetContext()
        {
            dtoSelectorContext item = new dtoSelectorContext();

            item.ObjectOwner = View.PreloadModuleObject;
            item.IdCommunity = View.PreloadIdCommunity;
            item.IdModule    = View.PreloadIdModule;
            item.ModuleCode  = View.PreloadModuleCode;
            item.IsForPortal = View.PreloadForPortal;
            if (item.IdCommunity == -1 && item.ObjectOwner != null)
            {
                item.IdCommunity = item.ObjectOwner.CommunityID;
            }
            if (item.IdModule > 0 && String.IsNullOrEmpty(item.ModuleCode))
            {
                item.ModuleCode = CurrentManager.GetModuleCode(item.IdModule);
            }
            else if (item.IdModule == 0 && !String.IsNullOrEmpty(item.ModuleCode))
            {
                item.IdModule = CurrentManager.GetModuleID(item.ModuleCode);
            }

            Community c = CurrentManager.GetCommunity(item.IdCommunity);

            if (item.IdCommunity == 0 && item.IsForPortal == false)
            {
                item.IdCommunity = UserContext.CurrentCommunityID;
                item.IsForPortal = (item.IdCommunity == 0);
            }
            else if (item.IdCommunity > 0 && item.IsForPortal)
            {
                item.IsForPortal = false;
            }
            item.IdOrganization = (item.IdOrganization == 0) ? ((c == null) ? 0 : c.IdOrganization) : item.IdOrganization;
            if (item.IdOrganization > 0)
            {
                item.IdOrganizationCommunity = CurrentManager.GetIdCommunityFromOrganization(item.IdOrganization);
            }
            return(item);
        }
Exemple #4
0
        public void InitView(ModuleGenericTemplateMessages permissions, lm.Comol.Core.Notification.Domain.NotificationChannel channel, long idAction, Int32 idModule, String moduleCode, Int32 idCommunty, Int32 idOrganization = 0, Boolean forPortal = false, long idTemplate = 0, long idVersion = 0, lm.Comol.Core.DomainModel.ModuleObject obj = null, List <dtoTemplateItem> items = null)
        {
            dtoSelectorContext c = new dtoSelectorContext();

            c.IdAction       = idAction;
            c.IdModule       = (idModule > 0) ? idModule : (!String.IsNullOrEmpty(moduleCode) ? CurrentManager.GetModuleID(moduleCode) : 0);
            c.ModuleCode     = (!String.IsNullOrEmpty(moduleCode)) ? moduleCode : (idModule > 0 ? CurrentManager.GetModuleCode(idModule) : "");
            c.IdCommunity    = idCommunty;
            c.IdOrganization = idOrganization;
            if (idCommunty > 0 && idOrganization <= 0)
            {
                Community community = CurrentManager.GetCommunity(idCommunty);
                c.IdOrganizationCommunity = (community == null) ? 0 : ((community.IdFather == 0) ? community.Id : CurrentManager.GetIdCommunityFromOrganization(community.IdOrganization));
            }
            else if (idOrganization > 0)
            {
                c.IdOrganizationCommunity = CurrentManager.GetIdCommunityFromOrganization(idOrganization);
            }
            c.IsForPortal = (forPortal && idCommunty == 0 && idOrganization == 0);
            c.ObjectOwner = obj;
            InitView(permissions, channel, c, idTemplate, idVersion, true, items);
        }
        public void InitView(Int32 pageSize, Int32 idOrganization = 0, Boolean assigned = false, Boolean fromPortal = true, Boolean fromPage = false, String url = "")
        {
            litePerson p = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Int32 idCommunity = 0;
                lm.Comol.Core.DomainModel.Domain.ModuleCommunityManagement permissions = null;
                if (!fromPortal)
                {
                    if (idOrganization > 0)
                    {
                        idCommunity = CurrentManager.GetIdCommunityFromOrganization(idOrganization);
                    }
                    if (idCommunity == 0)
                    {
                        idCommunity    = UserContext.CurrentCommunityID;
                        idOrganization = CurrentManager.GetIdOrganizationFromCommunity(idCommunity);
                    }
                    if (idOrganization == 0)
                    {
                        idOrganization = CurrentManager.GetUserDefaultIdOrganization(UserContext.CurrentUserID);
                        idCommunity    = CurrentManager.GetIdCommunityFromOrganization(idOrganization);
                    }
                    permissions = new DomainModel.Domain.ModuleCommunityManagement(CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, lm.Comol.Core.DomainModel.Domain.ModuleCommunityManagement.UniqueID));
                }
                else
                {
                    permissions = DomainModel.Domain.ModuleCommunityManagement.CreatePortalmodule(p.TypeID);
                }
                View.CurrentIdOrganization = idOrganization;
                View.CurrentIdCommunity    = idCommunity;
                View.CurrentAssignedTags   = new List <dtoBulkCommunityForTags>();
                if (!String.IsNullOrEmpty(url) && fromPage)
                {
                    View.SetBackUrl(url);
                }
                if (permissions.Administration || permissions.Manage)
                {
                    View.AllowSave = true;
                    List <lm.Comol.Core.DomainModel.Filters.Filter> fToLoad = ServiceCommunities.GetDefaultFiltersForAssignments(p.Id, "", -1, null, lm.Comol.Core.BaseModules.CommunityManagement.CommunityAvailability.All, assigned).OrderBy(f => f.DisplayOrder).ToList();

                    View.LoadDefaultFilters(fToLoad);
                    if (fToLoad != null && fToLoad.Any())
                    {
                        lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters = new lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters(fToLoad, CommunityManagement.CommunityAvailability.All);

                        View.CurrentFilters = filters;
                        LoadCommunities(idCommunity, filters, 0, pageSize, ModuleTags.ActionType.BulkTagsAssignLoad, true);
                    }
                    else
                    {
                        View.DisplayNoCommunitiesToLoad();
                        View.SendUserAction(idCommunity, CurrentIdModule, ModuleTags.ActionType.BulkTagsNoCommunitiesFound);
                    }
                }
                else
                {
                    View.SendUserAction(idCommunity, CurrentIdModule, ModuleTags.ActionType.NoPermissionForBulkTagsAssign);
                }
            }
        }