Ejemplo n.º 1
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());
                }
            }
        }
Ejemplo n.º 2
0
        public void InitView()
        {
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Int32         idCommunity = View.PreloadIdCommunity;
                litePerson    person      = CurrentManager.GetLitePerson(UserContext.CurrentUserID);
                ModuleEduPath mEduPath    = PathService.ServiceStat.GetPermissionForCertification(idCommunity, person, View.PreloadIdPath);
                if (mEduPath.Administration || mEduPath.ViewMyStatistics || mEduPath.ViewMyStatistics)
                {
                    View.SendUserAction(idCommunity, IdModule, ModuleEduPath.ActionType.ViewCerticationList);

                    View.CurrentIdPath          = View.PreloadIdPath;
                    View.CurrentPathIdCommunity = View.PreloadIdCommunity;

                    LoadCertificates();

                    LoadRoles();

                    View.InitializeFilters();

                    LoadData();
                }
                else
                {
                    View.DisplayWrongPageAccess();
                    View.SendUserAction(idCommunity, IdModule, ModuleEduPath.ActionType.WrongPageAccess);
                }
            }
        }
Ejemplo n.º 3
0
 public void PhisicalDelete(long idItem, long idAttachment, Int32 idCommunity, String baseFilePath, String baseThumbnailPath, String unknownUser)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout(View.IdCommunityDiary);
     }
     else
     {
         litePerson person = CurrentManager.GetLitePerson(UserContext.CurrentUserID);
         if (person == null || person.Id == 0)
         {
             View.DisplaySessionTimeout(idCommunity, idItem);
         }
         else
         {
             ModuleCommunityDiary module     = Service.GetPermissions(UserContext.CurrentUserID, idCommunity);
             CommunityEventItem   item       = Service.EventItemGet(idItem);
             EventItemFile        attachment = Service.EventItemGetAttachment(idAttachment);
             if (item != null && attachment != null)
             {
                 if (module.Edit || module.Administration)
                 {
                     Service.AttachmentPhisicalDelete(item, attachment, baseFilePath, baseThumbnailPath);
                 }
                 ReloadAttachments(person, item, module, View.RepositoryIdentifier, unknownUser);
             }
             else if (item != null)
             {
                 ReloadAttachments(person, item, module, View.RepositoryIdentifier, unknownUser);
             }
         }
     }
 }
Ejemplo n.º 4
0
        public void ChangeLetter(String letter, GlossaryFilter filter)
        {
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
                return;
            }
            if (String.IsNullOrEmpty(letter))
            {
                letter = " ";
            }

            var words                 = new List <String>();
            var currentChar           = letter[0];
            var wordAlls              = new List <String>();
            var currentLetterTermList = Service.GetDTO_TermListMapFromliteTerm(f => f.IdGlossary == View.IdGlossary && f.Deleted == BaseStatusDeleted.None, f => f.Name, currentChar, filter, out wordAlls);

            if (!String.IsNullOrWhiteSpace(letter))
            {
                words.Add(letter);
            }
            else
            {
                words.AddRange(currentLetterTermList.Select(dtoTermMap => dtoTermMap.FirstLetter.ToString()));
            }

            View.BindRepeaterList(words, wordAlls, currentLetterTermList, currentChar);
        }
Ejemplo n.º 5
0
        public void InitView(TabListItem tabItem)
        {
            Int32             idCommunity = View.PreloadIdContainerCommunity;
            dtoProjectContext cContext    = InitializeContext();
            long idProject = View.PreloadIdProject;

            View.DashboardContext = cContext;
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout((idCommunity > -1) ? idCommunity : cContext.IdCommunity, View.GetCurrentUrl());
            }
            else
            {
                litePerson p = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

                if (tabItem == TabListItem.Resource || (tabItem != TabListItem.Resource && Service.GetAvailableTabs((p != null ? p.Id : 0), cContext, PageContainerType.ProjectDashboard).Contains(tabItem)))
                {
                    View.InitializeProjectTopControl(cContext, idCommunity, View.PreloadFromCookies, tabItem, PageContainerType.ProjectDashboard, idProject, View.PreloadGroupBy, ItemListStatus.All, View.PreloadFilterStatus, View.PreloadTimeLine);
                    InitializeBackUrl(idProject, idCommunity, cContext, tabItem, View.PreloadFromPage);
                    View.SendUserAction(cContext.IdCommunity, CurrentIdModule, idProject, GetDefaultAction(tabItem));
                }
                else
                {
                    View.RedirectToUrl(View.GetCurrentUrl().Replace(RootObject.GetDashboardPlainPage(idProject, PageListType.ProjectDashboardResource), RootObject.GetDashboardPlainPage(idProject, PageListType.DashboardResource)));
                }
            }
        }
Ejemplo n.º 6
0
 public void UnlinkRepositoryItem(long idItem, long idAttachment, Int32 idCommunity, String unknownUser)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout(idCommunity, idItem);
     }
     else
     {
         litePerson person = CurrentManager.GetLitePerson(UserContext.CurrentUserID);
         if (person == null || person.Id == 0)
         {
             View.DisplaySessionTimeout(idCommunity, idItem);
         }
         else
         {
             ModuleCommunityDiary module     = Service.GetPermissions(UserContext.CurrentUserID, idCommunity);
             CommunityEventItem   item       = Service.EventItemGet(idItem);
             EventItemFile        attachment = Service.EventItemGetAttachment(idAttachment);
             if (item != null && attachment != null)
             {
                 Service.UnLinkAttachment(idAttachment, person);
                 ReloadAttachments(person, item, module, View.RepositoryIdentifier, unknownUser);
             }
             else if (item != null)
             {
                 ReloadAttachments(person, item, module, View.RepositoryIdentifier, unknownUser);
             }
             else
             {
                 View.LoadAttachments(null);
             }
         }
     }
 }
Ejemplo n.º 7
0
        public void RecoverTerm(long idTerm)
        {
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
                return;
            }


            var module = Service.GetPermissions(View.IdCommunity, litePerson);

            if (module.DeleteTerm || module.Administration || module.ManageGlossary)
            {
                var errors = String.Empty;
                if (Service.RestoreVirtualTerm(idTerm, out errors))
                {
                    LoadTerms();
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), idTerm, ModuleGlossaryNew.ObjectType.Term, ModuleGlossaryNew.ActionType.RecoverTerm);
                }
            }
            else
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
            }
        }
Ejemplo n.º 8
0
        private void InitializeView(Boolean forAdministration, Int32 idProfile, List <Int32> unloadIdCommunities, CommunityAvailability availability, List <Int32> onlyFromOrganizations, Dictionary <Int32, long> requiredPermissions = null)
        {
            View.IdProfile = idProfile;
            litePerson currentUser = CurrentManager.GetLitePerson(UserContext.CurrentUserID);
            litePerson person      = CurrentManager.GetLitePerson(idProfile);

            View.OnlyFromOrganizations = onlyFromOrganizations;
            View.SelectedIdCommunities = new List <int>();
            View.CurrentAvailability   = availability;
            View.ExcludeCommunities    = unloadIdCommunities;
            List <lm.Comol.Core.DomainModel.Filters.Filter> fToLoad = ServiceCommunities.GetDefaultFilters(idProfile, "", -1, -1, null, null, availability, -2, unloadIdCommunities, onlyFromOrganizations, requiredPermissions).OrderBy(f => f.DisplayOrder).ToList();

            View.LoadDefaultFilters(fToLoad, requiredPermissions, unloadIdCommunities, availability, onlyFromOrganizations);
            if (fToLoad != null && fToLoad.Any())
            {
                dtoCommunitiesFilters filters = new lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters(fToLoad, availability);
                filters.AvailableIdOrganizations       = onlyFromOrganizations;
                filters.OnlyFromAvailableOrganizations = (onlyFromOrganizations != null && onlyFromOrganizations.Any());
                filters.RequiredPermissions            = (requiredPermissions == null)? new List <dtoModulePermission>() : requiredPermissions.Select(r => new dtoModulePermission()
                {
                    IdModule = r.Key, Permissions = r.Value
                }).ToList();
                LoadCommunities(idProfile, filters, unloadIdCommunities, 0, View.CurrentPageSize, false);
                View.HasAvailableCommunities = true;
            }
            else
            {
                View.LoadNothing();
            }
        }
        public void InitView()
        {
            var idCommunity = View.PreloadIdCommunity;

            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.Administration || module.ManageGlossary)
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.StartManageSort);
                    LoadGlossary();
                }
                else
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                    View.DisplayNoPermission(idCommunity, Service.GetServiceIdModule());
                }
            }
        }
        public void ReorderGlossary(List <long> idGlossaryList, long defaultId)
        {
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

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

            if (module.Administration || module.ManageGlossary)
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.SaveManageSort);
                var result = Service.ReorderGlossary(View.IdCommunity, idGlossaryList, defaultId);
                if (result)
                {
                    LoadGlossary();
                    View.ShowMessage(SaveStateEnum.Saved, MessageType.success);
                }
                else
                {
                    View.ShowMessage(SaveStateEnum.NotSaved, MessageType.error);
                }
            }
            else
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
            }
        }
Ejemplo n.º 11
0
        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());
                }
            }
        }
Ejemplo n.º 12
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());
            }
        }
Ejemplo n.º 13
0
        public List <Int64> GetIDGlossary()
        {
            var listValidId  = new List <Int64>();
            var glossaryList = Service.GetDTO_GlossaryListOrdered(View.IdCommunity, false);

            var person = CurrentManager.GetLitePerson(UserContext.CurrentUserID);
            var module = Service.GetPermissions(View.IdCommunity, person);

            // Calcolo i permessi di tutti i glossari
            foreach (var dtoGlossary in glossaryList)
            {
                Service.UpdateGlossaryPermission(module, dtoGlossary, person, View.IdCommunity);
            }

            // Carico tutti i glossari pubblici, pubblicati e non della mia comunità
            var publicGlossaryList = Service.GetDTO_GlossaryListFromliteGlossary(f => f.IdCommunity != View.IdCommunity && f.Deleted == BaseStatusDeleted.None && f.IsPublic && f.IsPublished);

            // li metto in sola visualizzazione
            // non verifico al momento i permessi che ho nella comunità di origine del glossario
            foreach (var dtoGlossary in publicGlossaryList)
            {
                dtoGlossary.Permission.ViewTerm = module.ViewTerm;
            }

            // Dovrei aver concatenato tutti i permessi e quindi
            // invio dati alla vista solo con i glossari visibili

            listValidId.AddRange(glossaryList.Where(f => f.Permission.ViewTerm).Select(f => f.Id).ToList());
            listValidId.AddRange(publicGlossaryList.Select(f => f.Id).ToList());
            return(listValidId);
        }
Ejemplo n.º 14
0
        public List <dtoModuleUploadedItem> AddFiles(String istanceIdentifier, Int32 idUploaderUser, Boolean allowAnonymousUpload, Boolean alwaysLastVersion, RepositoryIdentifier identifier, long idFolder, List <dtoUploadedItem> files, Object obj, long idObject, Int32 idObjectType, String moduleCode, Int32 idModuleAjaxAction, Int32 idModuleAction = 0)
        {
            List <dtoModuleUploadedItem> items = new List <dtoModuleUploadedItem>();

            if (!SessionTimeout() || allowAnonymousUpload && idUploaderUser > 0)
            {
                litePerson                  person   = Service.GetValidPerson(idUploaderUser);
                liteRepositorySettings      settings = Service.SettingsGetByRepositoryIdentifier(identifier);
                ModuleRepository            module   = Service.GetPermissions(identifier, idUploaderUser);
                ModuleRepository.ObjectType oType    = ModuleRepository.ObjectType.File;
                ModuleRepository.ActionType uAction  = ModuleRepository.ActionType.UnableToAddFile;
                liteRepositoryItem          item     = (idFolder > 0 ? Service.ItemGet(idFolder) : null);
                if (person == null || (item == null && idFolder > 0))
                {
                    View.DisplayError(ItemUploadError.UnableToAddFileToUnknownFolder);
                    uAction = ModuleRepository.ActionType.UnknownItemFound;
                    InitializeView(idFolder, identifier, module, settings, CurrentManager.GetLitePerson(idUploaderUser));
                }
                else
                {
                    Boolean allowAdd = module.Administration || module.ManageItems || module.UploadFile;
                    dtoDisplayRepositoryItem dItem = Service.GetItemWithPermissions(idFolder, UserContext.CurrentUserID, identifier, View.GetUnknownUserName());

                    if (dItem != null)
                    {
                        oType    = ModuleRepository.GetObjectType(dItem.Type);
                        allowAdd = allowAdd || dItem.Permissions.GetActions().Contains(ItemAction.upload);
                    }
                    else if (idFolder == 0)
                    {
                        oType = ModuleRepository.ObjectType.Folder;
                    }

                    String folderName = (idFolder == 0 ? View.GetRootFolderName() : dItem.Name);
                    if (!allowAdd)
                    {
                        View.DisplayError(ItemUploadError.MissingPermissionsToAddFile, folderName, "", ItemType.Folder);
                        uAction = ModuleRepository.ActionType.UnavailableItem;
                    }
                    else
                    {
                        Boolean executed = false;
                        items    = Service.FileAddToRepository(settings, istanceIdentifier, identifier, person, alwaysLastVersion, module, View.GetRepositoryDiskPath(), idFolder, files, obj, idObject, idObjectType, moduleCode, idModuleAjaxAction, idModuleAction);
                        executed = (items != null && items.Any(a => a.IsAdded));

                        uAction = (executed ? (items.Any(a => !a.IsAdded) ? ModuleRepository.ActionType.UnableToAddSomeFile : ModuleRepository.ActionType.AddFile) : ModuleRepository.ActionType.UnableToAddFile);
                        if (executed)
                        {
                            View.NotifyAddedItems(Service.GetIdModule(), idFolder, folderName, RootObject.RepositoryItems(identifier.Type, identifier.IdCommunity, -1, (dItem == null ? 0 : dItem.Id)), items.Where(a => a.ItemAdded != null).Select(f => f.ItemAdded).ToList());
                        }
                        else
                        {
                            View.DisplayError(ItemUploadError.UnableToAddFile, folderName, (items == null) ? null : items.Where(a => !a.IsAdded).Select(a => a.UploadedFile).ToList());
                        }
                    }
                }
                View.SendUserAction(identifier.IdCommunity, Service.GetIdModule(), uAction, idFolder, oType);
            }
            return(items);
        }
        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 SaveOrUpdate(DTO_Glossary glossary)
        {
            View.ShowErrors(SaveStateEnum.None, MessageType.none);

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

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
                return;
            }
            var result = Service.SaveOrUpdateGlossary(glossary);

            if (result.SaveState == SaveStateEnum.Saved)
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), result.Id, ModuleGlossaryNew.ActionType.SaveGlossary);
                View.ShowErrors(result.SaveState, MessageType.success);
                View.GoToGlossaryEdit(result.Id);
            }
            else
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.GenericError);
                View.ShowErrors(result.SaveState);
            }
        }
Ejemplo n.º 17
0
        public void SaveOrUpdate(DTO_Glossary glossary, List <DTO_Share> dtoShares)
        {
            View.ShowErrors(SaveStateEnum.None, MessageType.none);

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

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
                return;
            }
            var result = Service.SaveOrUpdateGlossaryShare(glossary, dtoShares);

            if (result.SaveState == SaveStateEnum.Saved)
            {
                var glossary2 = View.IdGlossary > 0 ? Service.GetDTO_Glossary(View.IdGlossary, View.IdCommunity) : new DTO_Glossary {
                    IdLanguage = -1, IdCommunity = View.IdCommunity, TermsArePaged = false
                };
                var communityShareList = Service.GetDTO_GlossaryShareList(View.IdGlossary);

                View.LoadViewData(View.IdCommunity, glossary2, communityShareList);

                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), result.Id, ModuleGlossaryNew.ActionType.SaveGlossaryShare);
                View.ShowErrors(result.SaveState, MessageType.success);
            }
            else
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.GenericError);
                View.ShowErrors(result.SaveState);
            }
        }
Ejemplo n.º 18
0
        private void LoadRevisions(ModuleRequestForMembership module, CallStandardAction action, int idCommunity, dtoRevisionFilters filters, int pageIndex, int pageSize)
        {
            liteCommunity community          = CurrentManager.GetLiteCommunity(idCommunity);
            litePerson    person             = CurrentManager.GetLitePerson(UserContext.CurrentUserID);
            Boolean       fromAllcommunities = false;
            PagerBase     pager = new PagerBase();

            pager.PageSize = pageSize;

            if (action == CallStandardAction.Manage)
            {
                pager.Count = (int)Service.RevisionCount(fromAllcommunities, (idCommunity == 0), community, person, CallForPaperType.RequestForMembership, filters, RevisionType.Manager) - 1;
            }
            else
            {
                fromAllcommunities = (idCommunity == 0);
                pager.Count        = (int)Service.RevisionCount(fromAllcommunities, (idCommunity == 0), community, person, CallForPaperType.RequestForMembership, filters, RevisionType.UserRequired) - 1;
            }
            pager.PageIndex = pageIndex;// Me.View.CurrentPageIndex
            View.Pager      = pager;
            if (pager.Count < 0)
            {
                View.LoadNoRevisionsFound();
            }
            else
            {
                View.LoadRevisions(Service.GetRevisionList(module, action, fromAllcommunities, (idCommunity == 0), community, person, filters, pager.PageIndex, pageSize));
            }

            View.SendUserAction(View.IdCallCommunity, ServiceRequest.ServiceModuleID(), ModuleRequestForMembership.ActionType.LoadRevisionsList);
        }
        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());
                }
            }
        }
Ejemplo n.º 20
0
        public void InitView()
        {
            var idCommunity = View.PreloadIdCommunity;

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

            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(idCommunity, litePerson);
                View.IdCommunity = idCommunity;
                View.IdGlossary  = View.PreloadIdGlossary;
                if (module.ViewTerm || module.Administration || module.ManageGlossary)
                {
                    //UpdateView(litePerson, module);
                }
                else
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                    View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
                }
            }
        }
Ejemplo n.º 21
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());
                }
            }
        }
        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.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)
                    {
                        var steps = Service.GetAvailableSteps(GlossaryStep.Settings, true);
                        View.LoadViewData(View.IdCommunity, glossary, steps);
                        return;
                    }
                }
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
            }
        }
        public void ImportTerms(List <long> listId, int selectedIndex)
        {
            View.ShowInfo(SaveStateEnum.None, MessageType.none);

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

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
                return;
            }

            var module = Service.GetPermissions(View.IdCommunity, litePerson);

            if (module.EditGlossary || module.Administration || module.ManageGlossary)
            {
                if (Service.ImportTerms(View.IdCommunity, View.IdGlossary, listId, selectedIndex))
                {
                    View.ShowInfo(SaveStateEnum.Saved, MessageType.success);
                }
                else
                {
                    View.ShowInfo(SaveStateEnum.NotSaved, MessageType.error);
                }
            }
            else
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
            }
        }
        private void LoadTemplate(long idCall)
        {
            BaseForPaper call = CallService.GetCall(idCall);

            if (call == null)
            {
                View.LoadUnknowCall(View.IdCommunity, View.IdCallModule, idCall, View.CallType);
            }
            else
            {
                dtoManagerTemplateMail template = CallService.GetManagerTemplateMail(idCall);
                if (template == null)
                {
                    View.DisplayNoTemplate();
                    template = View.GetDefaultTemplate;
                    litePerson person = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

                    template.NotifyTo = (call.CreatedBy != null) ? call.CreatedBy.Mail : "";

                    if (person != null && call.CreatedBy != null && person.Id != call.CreatedBy.Id)
                    {
                        template.NotifyTo = (string.IsNullOrEmpty(template.NotifyTo)) ? "" : ";" + person.Mail;
                    }
                }
                View.LoadTemplate(template);
            }
        }
 public void PreviewMessage(dtoManagerTemplateMail template, String fakeName, String fakeSurname, String fakeTaxCode, String fakeMail, lm.Comol.Core.MailCommons.Domain.Configurations.SmtpServiceConfig smtpConfig, String websiteUrl, Dictionary <SubmissionTranslations, string> translations)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         Language   dLanguage   = CurrentManager.GetDefaultLanguage();
         litePerson currentUser = CurrentManager.GetLitePerson(UserContext.CurrentUserID);
         litePerson fakeUser    = new litePerson();
         fakeUser.TypeID     = (int)UserTypeStandard.Student;
         fakeUser.Name       = fakeName;
         fakeUser.Surname    = fakeSurname;
         fakeUser.Mail       = fakeMail;
         fakeUser.TaxCode    = fakeTaxCode;
         fakeUser.LanguageID = currentUser.LanguageID;
         lm.Comol.Core.Mail.dtoMailMessage message = CallService.GetMailPreview(View.IdCall, template, currentUser, smtpConfig, websiteUrl, translations);
         String recipients = template.NotifyTo;
         if (String.IsNullOrEmpty(recipients))
         {
             recipients = currentUser.Mail;
         }
         else if (recipients.Contains(","))
         {
             recipients = recipients.Replace(",", ";");
         }
         View.DisplayMessagePreview(new lm.Comol.Core.Mail.dtoMailMessagePreview(currentUser.LanguageID, dLanguage, message, template.MailSettings, smtpConfig), recipients);
     }
 }
Ejemplo n.º 26
0
        public Boolean VirtualDeleteTerm(Int64 idTerm, out String errors)
        {
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            errors = String.Empty;
            if (UserContext.isAnonymous || litePerson == null)
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();

                return(false);
            }

            var module = Service.GetPermissions(View.IdCommunity, litePerson);

            if (module.DeleteTerm || module.Administration || module.ManageGlossary)
            {
                var result = Service.DeleteVirtualTerm(idTerm, out errors);
                if (result)
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), idTerm, ModuleGlossaryNew.ObjectType.Term, ModuleGlossaryNew.ActionType.VirtualDeleteTerm);
                }
                return(result);
            }
            View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
            View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());


            return(false);
        }
Ejemplo n.º 27
0
        public void DeleteGlossary(long idShare)
        {
            var litePerson = CurrentManager.GetLitePerson(UserContext.CurrentUserID);

            if (UserContext.isAnonymous || litePerson == null)
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplaySessionTimeout();
                return;
            }

            var module = Service.GetPermissions(View.IdCommunity, litePerson);

            if (module.DeleteGlossary || module.Administration || module.ManageGlossary)
            {
                var errors = String.Empty;
                if (Service.DeleteGlossary(idShare, out errors))
                {
                    View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), idShare, ModuleGlossaryNew.ObjectType.Glossary, ModuleGlossaryNew.ActionType.PhisicalDeleteGlossary);
                    LoadGlossary();
                }
            }
            else
            {
                View.SendUserAction(View.IdCommunity, Service.GetServiceIdModule(), ModuleGlossaryNew.ActionType.NoPermission);
                View.DisplayNoPermission(View.IdCommunity, Service.GetServiceIdModule());
            }
        }
Ejemplo n.º 28
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());
            }
        }
Ejemplo n.º 29
0
        public void EnrollTo(Int32 idCommunity, String name, String path, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters)
        {
            Int32 idPerson = UserContext.CurrentUserID;

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Boolean reloadCommunities          = false;
                ModuleDashboard.ActionType dAction = ModuleDashboard.ActionType.None;
                dtoCommunityInfoForEnroll  item    = Service.GetEnrollingItem(idPerson, idCommunity, path);
                litePerson person = CurrentManager.GetLitePerson(idPerson);
                if (item != null && item.Id > 0 && person != null && person.Id > 0)
                {
                    if (!item.AllowEnroll)
                    {
                        dAction = ModuleDashboard.ActionType.EnrollNotAllowed;
                        View.DisplayEnrollMessage(item, dAction);
                    }
                    else
                    {
                        if (!item.HasConstraints && item.AllowUnsubscribe)
                        {
                            dtoEnrollment enrollment = Service.EnrollTo(idPerson, item);
                            if (enrollment == null)
                            {
                                dAction = ModuleDashboard.ActionType.UnableToEnroll;
                                View.DisplayEnrollMessage(item, dAction);
                            }
                            else
                            {
                                View.DisplayEnrollMessage(enrollment, enrollment.IdCommunity, person, Service.GetTranslatedProfileType(person), CurrentManager.GetUserDefaultOrganizationName(idPerson));
                                reloadCommunities = true;
                                dAction           = (enrollment.Status == EnrolledStatus.NeedConfirm) ? ModuleDashboard.ActionType.EnrollToCommunityWaitingConfirm : ModuleDashboard.ActionType.EnrollToCommunity;
                                lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(lm.Comol.Core.BaseModules.CommunityManagement.Domain.CacheKeys.UserCommunitiesTree(idPerson));
                            }
                        }
                        else
                        {
                            dAction = ModuleDashboard.ActionType.RequireEnrollConfirm;
                            View.DisplayConfirmMessage(item);
                        }
                    }
                }
                else
                {
                    dAction = ModuleDashboard.ActionType.UnableToEnroll;
                    View.DisplayUnknownCommunity(name);
                }
                View.SendUserAction(0, CurrentIdModule, idCommunity, dAction);
                if (reloadCommunities)
                {
                    LoadTree(filters, View.AdvancedMode, View.ReferenceIdCommunity, false);
                }
            }
        }
        public void EnrollTo(List <dtoCommunityInfoForEnroll> sCommunities, Int32 itemsForPage, RangeSettings range, lm.Comol.Core.BaseModules.CommunityManagement.dtoCommunitiesFilters filters, OrderItemsToSubscribeBy orderBy, Boolean ascending, Int32 pageIndex)
        {
            Int32 idPerson = UserContext.CurrentUserID;

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Boolean reloadCommunities = false;
                if (sCommunities.Any())
                {
                    reloadCommunities = true;
                    litePerson           person           = CurrentManager.GetLitePerson(idPerson);
                    String               profileType      = Service.GetTranslatedProfileType(person);
                    String               organizationName = CurrentManager.GetUserDefaultOrganizationName(idPerson);
                    List <dtoEnrollment> enrollments      = new List <dtoEnrollment>();
                    foreach (dtoCommunityInfoForEnroll cm in sCommunities)
                    {
                        dtoEnrollment enrollment = Service.EnrollTo(idPerson, cm);
                        if (enrollment != null)
                        {
                            enrollments.Add(enrollment);
                        }
                    }
                    if (enrollments.Any())
                    {
                        if (enrollments.Where(e => e.Status == EnrolledStatus.Available || e.Status == EnrolledStatus.NeedConfirm).Any())
                        {
                            lm.Comol.Core.DomainModel.Helpers.CacheHelper.PurgeCacheItems(lm.Comol.Core.BaseModules.CommunityManagement.Domain.CacheKeys.UserCommunitiesTree(idPerson));
                            enrollments.Where(e => e.Status == EnrolledStatus.Available || e.Status == EnrolledStatus.NeedConfirm).ToList().ForEach(e => View.NotifyEnrollment(e, person, profileType, organizationName));
                            reloadCommunities = true;
                        }

                        if (enrollments.Where(e => e.Status == EnrolledStatus.Available).Any())
                        {
                            View.SendUserAction(0, CurrentIdModule, enrollments.Where(e => e.Status == EnrolledStatus.Available).Select(c => c.IdCommunity).ToList(), ModuleDashboard.ActionType.EnrollToCommunities);
                        }
                        if (enrollments.Where(e => e.Status == EnrolledStatus.NeedConfirm).Any())
                        {
                            View.SendUserAction(0, CurrentIdModule, enrollments.Where(e => e.Status == EnrolledStatus.NeedConfirm).Select(c => c.IdCommunity).ToList(), ModuleDashboard.ActionType.EnrollToCommunitiesWaitingConfirm);
                        }
                        UpdateSelectedItems(enrollments.Where(e => e.Status == EnrolledStatus.Available || e.Status == EnrolledStatus.NeedConfirm || e.Status == EnrolledStatus.PreviousEnrolled || e.Status == EnrolledStatus.UnableToEnroll).Select(e => e.IdCommunity).ToList());
                        View.DisplayEnrollMessage(enrollments);
                    }
                    if (reloadCommunities)
                    {
                        InternalLoadCommunities(itemsForPage, range, filters, orderBy, ascending, true, pageIndex, ModuleDashboard.ActionType.EnrollPageLoadcommunitiesAfterEnrolling, true);
                    }
                }
                else
                {
                    View.SendUserAction(0, CurrentIdModule, ModuleDashboard.ActionType.NoSelectedCommunitiesToEnroll);
                }
            }
        }