public void InitView(Boolean advancedMode, lm.Comol.Core.BaseModules.CommunityManagement.CommunityAvailability availability = CommunityManagement.CommunityAvailability.Subscribed, Int32 idReferenceCommunity = 0, String referencePath = "")
 {
     View.AdvancedMode         = advancedMode;
     View.ReferenceIdCommunity = idReferenceCommunity;
     View.IsFirstLoad          = true;
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         ModuleDashboard.ActionType action = (idReferenceCommunity > 0) ? ModuleDashboard.ActionType.TreeNoChildrenToLoad : ModuleDashboard.ActionType.TreeUnableToLoad;
         List <lm.Comol.Core.DomainModel.Filters.Filter> fToLoad = null;
         switch (availability)
         {
         case CommunityManagement.CommunityAvailability.Subscribed:
             fToLoad = Service.GetDefaultFilters(UserContext.CurrentUserID, "", -1, -1, null, null, availability).OrderBy(f => f.DisplayOrder).ToList();
             View.LoadDefaultFilters(fToLoad);
             break;
         }
         if (fToLoad != null && fToLoad.Any())
         {
             lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters = new lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters(fToLoad, availability);
             View.CurrentFilters = filters;
             action = (idReferenceCommunity > 0) ? ModuleDashboard.ActionType.TreeLoadChildren : ModuleDashboard.ActionType.TreeLoad;
             LoadTree(filters, advancedMode, idReferenceCommunity, false);
         }
         else
         {
             View.DisplayNoTreeToLoad((idReferenceCommunity > 0) ? CurrentManager.GetCommunityName(idReferenceCommunity) : "");
         }
         View.SendUserAction(idReferenceCommunity, CurrentIdModule, action);
     }
 }
        public void InitView()
        {
            var idCommunity = View.PreloadIdCommunity;
            var idGlossary  = View.PreloadIdGlossary;

            View.SetTitle((idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdCommunity = idCommunity;
                View.IdGlossary  = idGlossary;
                var module = Service.GetPermissions(View.IdCommunity, litePerson);

                if (module.AddGlossary || module.Administration || module.ManageGlossary)
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), View.IdGlossary > 0 ? ModuleGlossaryNew.ActionType.StartEditGlossary : ModuleGlossaryNew.ActionType.StartAddGlossary);
                    var glossary = View.IdGlossary > 0 ? Service.GetDTO_Glossary(View.IdGlossary, View.IdCommunity) : new DTO_Glossary {
                        IdLanguage = -1, IdCommunity = View.IdCommunity, TermsArePaged = false
                    };
                    View.LoadViewData(View.IdCommunity, glossary, Service.GetAvailableLanguages());
                }
                else
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                    View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
                }
            }
        }
示例#3
0
        public void InitView()
        {
            var idCommunity = View.PreloadIdCommunity;

            if (idCommunity <= 0)
            {
                idCommunity = UserContext.CurrentCommunityID;
            }

            View.SetTitle((idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.IdCommunity = idCommunity;
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdCommunity = idCommunity;
                var module = Service.GetPermissions(View.IdCommunity, litePerson);

                if (module.DeleteGlossary || module.Administration || module.ManageGlossary)
                {
                    LoadGlossary();
                    return;
                }
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
            }
        }
示例#4
0
        public void InitView()
        {
            var idCommunity = View.PreloadIdCommunity;

            View.SetTitle((idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.IdCommunity = idCommunity;
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdCommunity = idCommunity;
                var module = Service.GetPermissions(View.IdCommunity, litePerson);
                // Verifico Permessi modulo
                if (module.ViewTerm || module.Administration || module.ManageGlossary)
                {
                    // var usedLetters = Service.GetGlossaryUsedLetters(GetIDGlossary());
                    var filter = new GlossaryFilter {
                        SearchString = View.SearchString, LemmaString = View.LemmaString, LemmaContentString = View.LemmaContentString, LemmaSearchType = (FilterTypeEnum)View.LemmaSearchType, LemmaVisibilityType = (FilterVisibilityTypeEnum)View.LemmaVisibilityType
                    };
                    View.LoadViewData(View.IdCommunity, filter);
                    ChangeLetter(String.Empty, 0, 50, filter);
                    return;
                }
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
            }
        }
        public void InitView(Boolean isManage)
        {
            var idCommunity = View.PreloadIdCommunity;
            var idGlossary  = View.PreloadIdGlossary;

            View.SetTitle((idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
            }
            else
            {
                var module = Service.GetPermissions(View.IdCommunity, litePerson);
                View.IdCommunity      = idCommunity;
                View.IdGlossary       = idGlossary;
                View.ForManageEnabled = module.Administration || module.ManageGlossary;
                View.ForManage        = isManage;


                if (module.AddGlossary || module.Administration || module.ManageGlossary)
                {
                    var dto_glossary = Service.GetDTO_GlossaryShare(View.IdGlossary, View.IdCommunity);
                    View.LoadViewData(View.IdCommunity, dto_glossary, View.ForManageEnabled, View.ForManage);
                }
                else
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                    View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
                }
            }
        }
        public void InitView(Boolean isFirstOpen)
        {
            var idCommunity   = View.PreloadIdCommunity;
            var forManagement = View.PreloadForManagement;

            if (idCommunity <= 0)
            {
                idCommunity = UserContext.CurrentCommunityID;
            }

            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.IdCommunity = idCommunity;
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdCommunity = idCommunity;
                View.SetTitle((idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
                var module = Service.GetPermissions(View.IdCommunity, litePerson);

                // Test
                //Service.ExportAllCommunityGlossary();
                forManagement = forManagement && (module.Administration || module.ManageGlossary);

                if (module.ViewTerm || module.Administration || module.ManageGlossary)
                {
                    if (forManagement)
                    {
                        View.LoadViewData(View.IdCommunity, module.Administration || module.ManageGlossary, forManagement);
                    }
                    else
                    {
                        long idGlossary = -1;
                        // controllo se aprire la lista di tutti i glossari o se solo direttamente il glossario di default o l'unico glossario
                        if (isFirstOpen)
                        {
                            idGlossary = Service.GetGlossaryDefaultId(View.IdCommunity);
                        }

                        if (idGlossary > 0)
                        {
                            View.GoToGlossaryView(idGlossary);
                        }
                        else
                        {
                            View.LoadViewData(View.IdCommunity, module.Administration || module.ManageGlossary, forManagement);
                        }
                    }
                }
                else
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                    View.DisplayNoPermission(idCommunity, Service.GetServiceIdModule());
                }
            }
        }
示例#7
0
        public void InitView()
        {
            var idCommunity = View.PreloadIdCommunity;

            View.SetTitle((idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.IdCommunity = idCommunity;
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdCommunity = idCommunity;
                var module = Service.GetPermissions(View.IdCommunity, litePerson);

                if (module.AddGlossary || module.Administration || module.ManageGlossary)
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.StartAddGlossary);
                    View.ItemData = new DTO_Glossary {
                        IdLanguage = UserContext.Language.Id
                    };
                    var steps = Service.GetAvailableSteps(GlossaryStep.Settings, true);
                    View.LoadViewData(View.IdCommunity, Service.GetAvailableLanguages(), steps, true);
                }
                else
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                    View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
                }
            }
        }
示例#8
0
        public void InitView()
        {
            var idCommunity = View.PreloadIdCommunity;
            var idGlossary  = View.PreloadIdGlossary;
            var fromViewMap = View.PreloadFromViewMap;

            View.SetTitle((idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.IdCommunity = idCommunity;
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdCommunity = idCommunity;
                View.IdGlossary  = idGlossary;
                View.FromViewMap = fromViewMap;
                var module = Service.GetPermissions(View.IdCommunity, litePerson);
                if (module.AddTerm || module.Administration || module.ManageGlossary)
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.StartAddTerm);
                    View.LoadViewData(View.IdCommunity, View.IdGlossary);
                    View.ItemData = new DTO_Term();
                }
                else
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                    View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
                }
            }
        }
示例#9
0
 public void InitView(Boolean advanced, Int32 idCommunity = 0, Boolean fromPage = false, String url = "", Boolean fromSession = false)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         ModuleDashboard.ActionType action = (idCommunity == 0) ? ModuleDashboard.ActionType.TreePageLoading : ModuleDashboard.ActionType.TreePageLoadingFromCommunity;
         if (fromSession && idCommunity == 0)
         {
             idCommunity = UserContext.CurrentCommunityID;
         }
         View.DashboardIdCommunity = idCommunity;
         String name = (idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "";
         if (idCommunity > 0 && String.IsNullOrEmpty(name))
         {
             View.DisplayUnknownCommunity();
             View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idCommunity, ModuleDashboard.ActionType.TreePageLoadingFromUnknownCommunity);
         }
         else
         {
             View.SetTitle(name);
             View.LoadTree(advanced, idCommunity);
             View.SendUserAction(UserContext.CurrentCommunityID, CurrentIdModule, idCommunity, action);
         }
     }
 }
示例#10
0
        public void InitView(long idMessage, Int32 idCommunity)
        {
            View.IdLoaderCommunity = 0;
            if (IsSessionTimeout())
            {
                return;
            }

            View.IdLoaderCommunity = UserContext.CurrentCommunityID;
            NoticeboardMessage message = null;

            if (idMessage != 0)
            {
                message = Service.GetMessage(idMessage);
            }

            Boolean isForPortal = (message != null && message.isForPortal) || (message == null && idCommunity == 0);

            View.SetHeaderTitle(isForPortal, (isForPortal) ? View.PortalName : CurrentManager.GetCommunityName(idCommunity));
            if (message == null && idMessage > 0)
            {
                View.SendUserAction(idCommunity, ModuleID, idMessage, ModuleNoticeboard.ActionType.ViewUnknownMessage);
            }
            else if (message == null && idMessage == 0)
            {
                View.SendUserAction(idCommunity, ModuleID, idMessage, ModuleNoticeboard.ActionType.ViewEmptyMessage);
            }
            else
            {
                ModuleNoticeboard module = null;
                if (message.isForPortal)
                {
                    module = ModuleNoticeboard.CreatePortalmodule((UserContext.isAnonymous) ? (int)UserTypeStandard.Guest : UserContext.UserTypeID);
                }
                else if (idCommunity > 0)
                {
                    module = new ModuleNoticeboard(CurrentManager.GetModulePermission(UserContext.CurrentUserID, idCommunity, ModuleID));
                }
                else
                {
                    module = new ModuleNoticeboard();
                }
                if (module.Administration || module.ViewCurrentMessage || module.ViewOldMessage)
                {
                    View.DisplayMessage(idMessage, idCommunity);
                    View.SendUserAction(idCommunity, ModuleID, idMessage, ModuleNoticeboard.ActionType.ViewMessage);
                }
                else
                {
                    View.SendUserAction(idCommunity, ModuleID, idMessage, ModuleNoticeboard.ActionType.NoPermission);
                }
                View.AllowPrint = module.Administration || module.ViewCurrentMessage || module.PrintMessage;
            }
        }
示例#11
0
        public void InitView(Int32 idCommunity, MenuBarType menubarType, String baseUrl, String defaultModuleToolTip, String defaultModuleUrl, String defaultModuleText)
        {
            if (idCommunity == -1)
            {
                idCommunity = UserContext.CurrentCommunityID;
            }

            Int32 idOrganization = 0;

            if (idCommunity > 0)
            {
                liteCommunity community = CurrentManager.Get <liteCommunity>(idCommunity);
                if (community == null)
                {
                    idCommunity = 0;
                }
                else
                {
                    idOrganization = community.IdOrganization;
                }
            }
            if (idOrganization == 0)
            {
                idOrganization = CurrentManager.GetUserDefaultIdOrganization(UserContext.CurrentUserID);
            }

            if (idCommunity == 0 && (menubarType != MenuBarType.Portal && menubarType != MenuBarType.PortalAdministration))
            {
                menubarType = MenuBarType.Portal;
                idCommunity = 0;
            }
            else if (idCommunity > 0 && menubarType == MenuBarType.None)
            {
                menubarType = MenuBarType.GenericCommunity;
            }
            if (idCommunity == 0)
            {
                View.DisplayName((menubarType == MenuBarType.Portal) ? View.GetPortalName : View.GetAdministrationName);
            }
            else
            {
                View.DisplayName(CurrentManager.GetCommunityName(idCommunity));
            }

            //Language language = CurrentManager.GetLanguageByIdOrDefault(UserContext.cu)
            View.BindLogo(idCommunity, idOrganization, UserContext.Language.Code);
            View.LoadMenuBar(Service.RenderCachedMenubar(idCommunity, menubarType, baseUrl, defaultModuleToolTip, defaultModuleUrl, defaultModuleText));
            View.MenubarType = menubarType;
        }
        public void InitView(DashboardType type, Boolean loadFromRecycleBin, Int32 idCommunity)
        {
            Person p = CurrentManager.GetPerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || p == null)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                ModuleDashboard permissions = ModuleDashboard.CreatePortalmodule(p.TypeID);
                if (type == DashboardType.Community)
                {
                    idCommunity = UserContext.CurrentCommunityID;
                    if (idCommunity < 0)
                    {
                        idCommunity = UserContext.CurrentCommunityID;
                    }
                    if (idCommunity > 0 && (!permissions.Administration && !permissions.ManageTiles))
                    {
                        permissions = Service.GetPermission(idCommunity);
                    }
                }
                else
                {
                    idCommunity = 0;
                }
                View.IdContainerCommunity = idCommunity;
                View.SetTitle(type, (idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
                if (permissions.Administration || permissions.List || permissions.Edit)
                {
                    if (loadFromRecycleBin)
                    {
                        View.SetBackUrl(RootObject.DashboardList(type, false, idCommunity));
                    }
                    else
                    {
                        View.SetRecycleUrl(RootObject.DashboardList(type, true, idCommunity));
                        View.SetAddUrl(RootObject.DashboardAdd(type, idCommunity));
                    }
                    View.InitializeListControl(permissions, type, idCommunity, loadFromRecycleBin);
                }
                else
                {
                    View.DisplayNoPermission(idCommunity, CurrentIdModule);
                }
            }
        }
示例#13
0
        private void InitializeView(NoticeBoard.Domain.ModuleNoticeboard permissions, Int32 idCommunity, Boolean isForPortal, Boolean setBackUrl, long idMessage)
        {
            View.SetHeaderTitle(isForPortal, (isForPortal) ? View.PortalName : CurrentManager.GetCommunityName(idCommunity));
            String url = View.GetBackUrl();

            if (setBackUrl && !String.IsNullOrEmpty(url))
            {
                View.SetBackUrl(url);
            }
            else if (setBackUrl && isForPortal)
            {
                View.SetBackUrl(View.GetDefaultHomePage());
            }

            LoadMessage(permissions, idCommunity, isForPortal, idMessage);
        }
示例#14
0
        public void InitView()
        {
            var idCommunity = View.PreloadIdCommunity;
            var idGlossary  = View.PreloadIdGlossary;
            var idTerm      = View.PreloadIdTerm;
            var fromViewMap = View.PreloadFromViewMap;

            View.SetTitle((idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.IdCommunity = idCommunity;
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdCommunity = idCommunity;
                View.IdGlossary  = idGlossary;
                View.IdTerm      = idTerm;
                View.FromViewMap = fromViewMap;

                var module = Service.GetPermissions(idCommunity, litePerson);
                if (module.EditTerm || module.Administration || module.ManageGlossary)
                {
                    var glossary = Service.GetDTO_Glossary(View.IdGlossary, View.IdCommunity);
                    Service.UpdateGlossaryPermission(module, glossary, litePerson, idCommunity);
                    // Verifico permessi specifici del termine
                    if (glossary.Permission.EditTerm)
                    {
                        View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.StartEditTerm);
                        View.LoadViewData(View.IdCommunity, View.IdGlossary, Service.GetTermDTO(idTerm), View.PreloadFromType, View.PreloadPageIndex, View.LoadfromCookies, View.IdCookies);
                        //View.InitializeUploaderControl(RepositoryAttachmentUploadActions.uploadtomoduleitem, idCommunity);
                        return;
                    }
                }

                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
            }
        }
示例#15
0
        public void InitView()
        {
            var idCommunity = View.PreloadIdCommunity;
            var idGlossary  = View.PreloadIdGlossary;
            var pageIndex   = View.PreloadPageIndex;

            View.SetTitle((idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.IdCommunity = idCommunity;
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdCommunity = idCommunity;
                View.IdGlossary  = idGlossary;
                var module = Service.GetPermissions(View.IdCommunity, litePerson);
                // Verifico Permessi modulo
                if (module.ViewTerm || module.Administration || module.ManageGlossary)
                {
                    var glossary = Service.GetDTO_Glossary(View.IdGlossary, View.IdCommunity);
                    Service.UpdateGlossaryPermission(module, glossary, litePerson, View.IdCommunity);
                    // Verifico permessi specifici del glossario
                    if (glossary.Permission.ViewTerm)
                    {
                        Dictionary <Char, UInt16> wordUsingDictionary;
                        //var words = Service.GetTermUsedLetters(idGlossary, out wordUsingDictionary);
                        var usedLetters = Service.GetGlossaryUsedLetters(View.IdGlossary);

                        View.LoadViewData(glossary, usedLetters, View.IdCommunity, (module.Administration || module.ManageGlossary), View.PreloadForManagement, View.LoadfromCookies, View.IdCookies, pageIndex);

                        return;
                    }
                }
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
            }
        }
示例#16
0
        public void InitView(Boolean fromListGlossary)
        {
            var idCommunity = View.PreloadIdCommunity;
            var idGlossary  = View.PreloadIdGlossary;
            var showSaveNew = View.PreloadShowSave;

            View.SetTitle((idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : "");
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.IdCommunity = idCommunity;
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdCommunity = idCommunity;
                View.IdGlossary  = idGlossary;
                var module = Service.GetPermissions(idCommunity, litePerson);
                if (module.EditGlossary || module.Administration || module.ManageGlossary)
                {
                    var glossary = Service.GetDTO_Glossary(idGlossary, View.IdCommunity);
                    Service.UpdateGlossaryPermission(module, glossary, litePerson, View.IdCommunity);
                    // Verifico permessi specifici del glossario
                    if (glossary.Permission.EditGlossary)
                    {
                        View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.StartEditGlossary);
                        var steps = Service.GetAvailableSteps(GlossaryStep.Settings, true);
                        View.LoadViewData(View.IdCommunity, glossary, Service.GetAvailableLanguages(), steps, fromListGlossary, showSaveNew);
                        return;
                    }
                }
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
            }
        }
        public void initView()
        {
            if (CommunityId <= 0)
            {
                return;
            }

            if (!Service.HasCommunityPermission(CommunityId, UserContext.CurrentUserID))
            {
                View.ShowNoPermission();
                return;
            }


            View.CurrentCommunityName = CurrentManager.GetCommunityName(CommunityId);

            View.Configs = Service.GetCommunityExpirationConfig(
                CommunityId,
                UserContext.Language.Id,
                UserContext.Language.Code
                );

            //ToDo: SendUserAction
        }
 private void InitializeView(long idMessage, Boolean advancedEditor, Int32 idCommunity, Boolean isForPortal)
 {
     View.AllowSave(true);
     LoadMessage(idMessage, advancedEditor);
     View.SetHeaderTitle(isForPortal, (isForPortal) ? View.PortalName : CurrentManager.GetCommunityName(idCommunity));
 }
        public void UnsubscribeFromCommunity(Int32 idCommunity, String path, RemoveAction action, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsBy orderBy, Boolean ascending, Int32 pageIndex, Int32 pageSize)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                lm.Comol.Core.BaseModules.CommunityManagement.dtoUnsubscribeTreeNode node = Service.UnsubscribeInfo(UserContext.CurrentUserID, idCommunity, path);
                if (node != null)
                {
                    switch (action)
                    {
                    case RemoveAction.None:
                        break;

                    default:
                        ModuleDashboard.ActionType  dAction       = ModuleDashboard.ActionType.UnableToUnsubscribe;
                        List <liteSubscriptionInfo> subscriptions = Service.UnsubscribeFromCommunity(UserContext.CurrentUserID, node, action);
                        if (subscriptions == null && !subscriptions.Any())
                        {
                            switch (action)
                            {
                            case RemoveAction.FromCommunity:
                                dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunity;
                                View.DisplayUnableToUnsubscribe(node.Name);
                                break;

                            case RemoveAction.FromAllSubCommunities:
                                dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunities;
                                View.DisplayUnsubscriptionMessage(new List <String>(), node.GetAllNodes().Where(n => n.AllowUnsubscribe()).Select(n => n.Name).ToList());
                                break;
                            }
                        }
                        else
                        {
                            switch (action)
                            {
                            case RemoveAction.FromCommunity:
                                dAction = ModuleDashboard.ActionType.UnsubscribeFromCommunity;
                                View.DisplayUnsubscribedFrom(node.Name);
                                break;

                            case RemoveAction.FromAllSubCommunities:
                                dAction = ModuleDashboard.ActionType.UnsubscribeFromCommunities;
                                View.DisplayUnsubscriptionMessage(node.GetAllNodes().Where(n => n.AllowUnsubscribe() && subscriptions.Where(s => s.IdCommunity == n.Id && s.IdRole < 1).Any()).Select(n => n.Name).ToList(),
                                                                  node.GetAllNodes().Where(n => n.AllowUnsubscribe() && subscriptions.Where(s => s.IdCommunity == n.Id && s.IdRole > 0).Any()).Select(n => n.Name).ToList()
                                                                  );
                                break;
                            }
                        }
                        View.SendUserAction(0, CurrentIdModule, idCommunity, dAction);
                        break;
                    }
                }
                else
                {
                    String name = CurrentManager.GetCommunityName(idCommunity);
                    if (!String.IsNullOrEmpty(name))
                    {
                        View.DisplayUnableToUnsubscribe(name);
                    }
                    View.SendUserAction(0, CurrentIdModule, idCommunity, ModuleDashboard.ActionType.UnableToUnsubscribe);
                }
                LoadCommunities(filters, orderBy, ascending, pageIndex, pageSize);
            }
        }
        public void UnsubscribeFromCommunity(Int32 idCommunity, String path, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsBy orderBy, Boolean ascending, Int32 pageIndex, Int32 pageSize)
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                lm.Comol.Core.BaseModules.CommunityManagement.dtoUnsubscribeTreeNode node = Service.UnsubscribeInfo(UserContext.CurrentUserID, idCommunity, path);
                if (node != null)
                {
                    ModuleDashboard.ActionType dAction = ModuleDashboard.ActionType.None;
                    List <lm.Comol.Core.BaseModules.CommunityManagement.dtoUnsubscribeTreeNode> nodes = node.GetAllNodes();
                    if (!nodes.Where(n => n.AllowUnsubscribe()).Any())
                    {
                        View.DisplayUnableToUnsubscribe(CurrentManager.GetCommunityName(idCommunity));
                        dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunity;
                    }
                    else
                    {
                        List <RemoveAction> actions = new List <RemoveAction>();
                        actions.Add(RemoveAction.None);
                        actions.Add(RemoveAction.FromCommunity);
                        if (nodes.Where(n => n.AllowUnsubscribe()).Count() > 1)
                        {
                            actions.Add(RemoveAction.FromAllSubCommunities);
                        }

                        if (node == null)
                        {
                            View.DisplayUnableToUnsubscribe(CurrentManager.GetCommunityName(idCommunity));
                            dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunity;
                        }
                        else if (!node.AllowUnsubscribe())
                        {
                            View.DisplayUnsubscribeNotAllowed(node.Name);
                            dAction = ModuleDashboard.ActionType.UnsubscribeNotallowed;
                        }
                        else if (node.AllowUnsubscribe() && (!node.CommunityAllowSubscription || node.MaxUsersWithDefaultRole > 0 || (node.CommunitySubscriptionEndOn.HasValue && DateTime.Now.AddDays(30) > node.CommunitySubscriptionEndOn.Value)))
                        {
                            View.DisplayConfirmMessage(idCommunity, path, node, actions, RemoveAction.None, nodes.Where(n => n.AllowUnsubscribe() && n.Id != idCommunity).ToList());
                            dAction = ModuleDashboard.ActionType.RequireUnsubscribeConfirm;
                        }
                        else
                        {
                            if (nodes.Where(n => n.AllowUnsubscribe()).Count() > 1)
                            {
                                View.DisplayConfirmMessage(idCommunity, path, node, actions, RemoveAction.FromCommunity, nodes.Where(n => n.AllowUnsubscribe() && n.Id != idCommunity).ToList());
                                dAction = ModuleDashboard.ActionType.RequireUnsubscribeConfirmFromSubCommunities;
                            }
                            else
                            {
                                List <liteSubscriptionInfo> subscriptions = Service.UnsubscribeFromCommunity(UserContext.CurrentUserID, node, RemoveAction.FromCommunity);
                                if (subscriptions != null && subscriptions.Any() && subscriptions.Count == 1 && subscriptions[0].IdRole < 1)
                                {
                                    View.DisplayUnsubscribedFrom(node.Name);
                                    dAction = ModuleDashboard.ActionType.UnsubscribeFromCommunity;
                                }
                                else
                                {
                                    View.DisplayUnableToUnsubscribe(node.Name);
                                    dAction = ModuleDashboard.ActionType.UnableToUnsubscribeFromCommunity;
                                }
                            }
                        }
                    }
                    View.SendUserAction(0, CurrentIdModule, idCommunity, dAction);
                }
                else
                {
                    String name = CurrentManager.GetCommunityName(idCommunity);
                    if (!String.IsNullOrEmpty(name))
                    {
                        View.DisplayUnableToUnsubscribe(CurrentManager.GetCommunityName(idCommunity));
                    }
                    View.SendUserAction(0, CurrentIdModule, idCommunity, ModuleDashboard.ActionType.UnableToUnsubscribe);
                }
                LoadCommunities(filters, orderBy, ascending, pageIndex, pageSize);
            }
        }
        public void InitView(Boolean isExternalPage, long idItem, long idVersion, Int32 idModule, long idLink, DownloadErrorType type)
        {
            liteRepositoryItem item = (idItem > 0) ? Service.ItemGet(idItem) : null;
            Int32 idCommunity       = (idLink > 0 ? Service.ModuleLinkGetIdSourceCommunity(idLink) : 0);

            if (item != null)
            {
                RepositoryType repositoryType = (item.IdCommunity > 0 ? RepositoryType.Community : RepositoryType.Portal);
                switch (repositoryType)
                {
                case RepositoryType.Community:
                    if (idCommunity == 0)
                    {
                        idCommunity = item.IdCommunity;
                    }
                    View.InitializeCommunityView(item.DisplayName, item.Extension, type, item.IdCommunity, ((idCommunity > 0) ? CurrentManager.GetCommunityName(idCommunity) : ""));
                    break;

                case RepositoryType.Portal:
                    View.InitializePortalView(item.DisplayName, item.Extension, type);
                    break;
                    break;
                }
            }
            else
            {
                View.InitializeView(type);
            }
            if (isExternalPage)
            {
                View.InitializeContext(GetContext(idCommunity, idItem, idVersion, idModule, item));
            }
            else
            {
                View.InitializeContext();
            }
        }