示例#1
0
        private int SetCallsCurrentCommunity()
        {
            int       idCommunity      = this.UserContext.CurrentCommunityID;
            Community currentCommunity = CurrentManager.GetCommunity(idCommunity);
            Community community        = null;

            if (View.PreloadIdCommunity > 0)
            {
                idCommunity = View.PreloadIdCommunity;
            }

            if (idCommunity > 0)
            {
                community = CurrentManager.GetCommunity(idCommunity);
                if (community == null && currentCommunity != null)
                {
                    idCommunity = this.UserContext.CurrentCommunityID;
                }
                else if (community == null)
                {
                    idCommunity = 0;
                }
            }
            View.IdCallCommunity = idCommunity;
            return(idCommunity);
        }
示例#2
0
        public void InitView(PreviewMode pMode, String languageCode, lm.Comol.Core.DomainModel.Languages.ItemObjectTranslation content, SmtpServiceConfig smtpConfig, String recipients = "", List <String> modules = null, MessageSettings settings = null, Int32 idCommunity = -1, ModuleObject obj = null)
        {
            View.DisplayOptions = (pMode == PreviewMode.MailSent);
            Person person = CurrentManager.GetPerson(UserContext.CurrentUserID);

            if (!UserContext.isAnonymous && person != null)
            {
                View.isInitialized = true;
                switch (pMode)
                {
                case PreviewMode.TemplateDisplay:
                case PreviewMode.MailToSend:
                    if (String.IsNullOrEmpty("recipients"))
                    {
                        recipients = person.Mail;
                    }
                    View.AllowSendMail = settings != null && View.AllowSendMail && (View.EditAddressTo || !String.IsNullOrEmpty(recipients));
                    Language dLanguage = CurrentManager.GetDefaultLanguage();
                    Language language  = CurrentManager.GetLanguageByCodeOrDefault(languageCode, true);
                    if (modules != null)
                    {
                        String    organizationName = "";
                        Community community        = null;
                        if (idCommunity > 0)
                        {
                            community = CurrentManager.GetCommunity(idCommunity);
                            if (community != null)
                            {
                                organizationName = CurrentManager.GetOrganizationName(community.Id);
                            }
                        }
                        if (community != null && idCommunity > 0)
                        {
                            content = View.ParseContent((language == null) ? 0 : language.Id, languageCode, content, modules, community, person, organizationName, obj);
                        }
                        else
                        {
                            content = View.ParseContent((language == null) ? 0 : language.Id, languageCode, content, modules, idCommunity, (community == null || idCommunity < 1) ? View.GetPortalName((language != null) ? language.Id : 0) : community.Name, person, organizationName, obj);
                        }
                    }
                    if (settings != null)
                    {
                        dtoMailMessagePreview dtoContent = new dtoMailMessagePreview((language != null) ? language.Id : 0, dLanguage, new dtoMailMessage()
                        {
                            UserSubject = content.Subject, Body = content.Body
                        }, settings, smtpConfig);
                        View.LoadPreviewTemplateMessage(pMode, dtoContent, recipients);
                    }
                    else
                    {
                        View.LoadPreviewTemplateMessage(pMode, content);
                    }
                    break;
                }
            }
            else
            {
                View.HideContent();
            }
        }
示例#3
0
        public void DeleteCommunityAssignment(Int32 idCommunity, long idAssignment)
        {
            long idVersion = View.IdVersion;

            if (UserContext.isAnonymous)
            {
                Logout(View.CurrentType, View.IdTemplate, idVersion);
            }
            else
            {
                Boolean deleted = Service.DeleteCommunityAssignments(idVersion, idCommunity, idAssignment);
                if (deleted)
                {
                    Community c = CurrentManager.GetCommunity(idCommunity);
                    if (c != null)
                    {
                        View.DisplayCommunityAssignmentDeleted(c.Name);
                    }
                    LoadAssignments(idVersion, View.GetPermissions(), PermissionType.Base);
                }
                else
                {
                    View.DisplayCommunityDeletingError();
                }
            }
        }
        public void DeleteCommunityAssignment(Int32 idCommunity, long idAssignment)
        {
            long idCall = View.IdCall;

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                Boolean deleted = CallService.DeleteCommunityAssignments(idCall, idCommunity, idAssignment);
                if (deleted)
                {
                    Community c = CurrentManager.GetCommunity(idCommunity);
                    if (c != null)
                    {
                        View.DisplayCommunityAssignmentDeleted(c.Name);
                    }
                    LoadAssignments(idCall);
                }
                else
                {
                    View.DisplaySaveErrors(!deleted);
                }
            }
        }
示例#5
0
        private void InitializeContext(dtoProjectContext cContex)
        {
            Int32     idCommunity = (!cContex.isForPortal && cContex.IdCommunity < 1) ? UserContext.CurrentCommunityID :  cContex.IdCommunity;
            Community community   = (idCommunity > 0) ? CurrentManager.GetCommunity(idCommunity) : null;

            cContex.IdCommunity = (community != null) ? community.Id : 0;

            View.ProjectIdCommunity = cContex.IdCommunity;
            View.forPortal          = cContex.isForPortal;
            View.isPersonal         = cContex.isPersonal;
        }
        public void InitView(Int32 idUser, Int32 idCommunity)
        {
            Boolean accessAvailable = !(View.isSystemOutOfOrder);

            if (!accessAvailable)
            {
                View.DisplaySystemOutOfOrder();
            }
            else
            {
                Person person = null;
                if (idUser > 0)
                {
                    person = CurrentManager.GetPerson(idUser);
                }
                //else if (!UserContext.isAnonymous)
                //    person = CurrentManager.GetPerson(UserContext.CurrentUserID);

                if (person == null || (person != null && person.TypeID != (int)UserTypeStandard.PublicUser))
                {
                    person = InternalService.GetDefaultUser(UserTypeStandard.PublicUser);
                }

                if (person != null)
                {
                    if (idCommunity == 0)
                    {
                        idCommunity = InternalService.GetDefaultLogonCommunity(person);
                    }

                    Community community = CurrentManager.GetCommunity(idCommunity);
                    if (community == null)
                    {
                        View.DisplayUnknownCommunity();
                    }
                    else if (!community.AllowPublicAccess)
                    {
                        View.DisplayCommunityName(community.Name);
                        View.DisplayNotAllowedCommunity();
                    }
                    else
                    {
                        View.DisplayCommunityName(community.Name);
                        View.LogonUser(person, person.IdDefaultProvider, lm.Comol.Core.BaseModules.ModulesLoader.RootObject.PublicAccess(View.PreloadedIdUser, View.PreloadedIdCommunity));
                        View.LogonIntoCommunity(person.Id, idCommunity);
                    }
                }
                else
                {
                    View.DisplayUnknownUser();
                }
            }
        }
        private void RefreshCallName(CallStandardAction action, String name, Int32 idCommunity)
        {
            Community community = CurrentManager.GetCommunity(idCommunity);

            if (community != null)
            {
                View.SetContainerName(action, community.Name, name);
            }
            else
            {
                View.SetContainerName(action, View.Portalname, name);
            }
        }
 public void InitView()
 {
     if (this.UserContext.isAnonymous)
     {
         //  codice per effettuare il login automatico...
         this.View.NoPermissionToAccess();
     }
     else
     {
         int     IdCommunity = View.PreLoadedIdCommunity;
         String  url         = View.PreLoadedPageUrl;
         Boolean decodeUrl   = true;
         if (String.IsNullOrEmpty(url))
         {
             url       = View.PreLoadedPlainPageUrl;
             decodeUrl = false;
         }
         if (IdCommunity == 0)
         {
             View.NavigateToUrl(url, decodeUrl);
         }
         else
         {
             Community community = CurrentManager.GetCommunity(IdCommunity);
             if (community == null && IdCommunity == 0)
             {
                 View.ShowNoCommunityAccess(View.PortalName);
             }
             else if (CurrentManager.HasActiveSubscription(UserContext.CurrentUserID, IdCommunity))
             {
                 if (IdCommunity == UserContext.CurrentCommunityID)
                 {
                     View.NavigateToUrl(url, decodeUrl);
                 }
                 else
                 {
                     View.NavigateToCommunityUrl(UserContext.CurrentUserID, IdCommunity, url, decodeUrl);
                 }
             }
             else if (community != null)
             {
                 View.ShowNoCommunityAccess(community.Name);
             }
             View.PreviousUrl = (decodeUrl) ? View.DecodeUrl(url) : url;
         }
     }
 }
示例#9
0
        public void SaveSettings(Int32 idCommunity, List <dtoTemplateAssignment> assignments, List <Int32> roles)
        {
            long idVersion = View.IdVersion;

            if (UserContext.isAnonymous)
            {
                Logout(View.CurrentType, View.IdTemplate, idVersion);
            }
            else
            {
                String    name = "";
                Community c    = CurrentManager.GetCommunity(idCommunity);
                if (c != null)
                {
                    name = c.Name;
                }
                else if (idCommunity > 0)
                {
                    name = View.UnknownCommunityTranslation;
                }
                else
                {
                    name = View.Portalname;
                }

                List <dtoRoleAssignment> rAssignments = assignments.Where(a => a.Type == PermissionType.Role).Select(a => ((dtoRoleAssignment)a)).ToList().Where(a => roles.Contains(a.IdRole) && a.IdCommunity == idCommunity).ToList();
                rAssignments.AddRange(roles.Where(t => !rAssignments.Where(a => a.IdRole == t && a.IdCommunity == idCommunity).Any()).Select(t => new dtoRoleAssignment()
                {
                    IdRole = t, IdCommunity = idCommunity, Use = true
                }).ToList());

                Boolean saved = Service.SaveCommunityPermissions(idVersion, idCommunity, rAssignments);
                if (saved)
                {
                    View.SendUserAction(View.IdTemplateCommunity, Service.ServiceModuleID(), ModuleTemplateMessages.ActionType.CommunityPermissionsSaved);
                    View.DisplayCommunityAssignmentSaved(name);
                    LoadAssignments(idVersion, assignments, PermissionType.Role, idCommunity);
                }
                else
                {
                    View.SendUserAction(View.IdTemplateCommunity, Service.ServiceModuleID(), ModuleTemplateMessages.ActionType.CommunityPermissionsSavingErrors);
                    View.DisplayCommunityAssignmentErrorSaving();
                }
            }
        }
示例#10
0
        private dtoProject InitializeContext(long idProject, ref dtoProjectContext cContex)
        {
            dtoProject project = Service.GetdtoProject(idProject);

            View.IdProject = idProject;
            if (project == null)
            {
                Int32     idCommunity = (!cContex.isForPortal && cContex.IdCommunity < 1) ? UserContext.CurrentCommunityID : cContex.IdCommunity;
                Community community   = (idCommunity > 0) ? CurrentManager.GetCommunity(idCommunity) : null;
                cContex.IdCommunity = (community != null) ? community.Id : 0;
            }
            else
            {
                cContex.IdCommunity = project.IdCommunity;
            }

            return(project);
        }
 public void LoadCommunityAssignments(Int32 idCommunity, long idAssignment, Dictionary <Int32, String> roles)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         String    cName     = View.UnknownCommunityTranslation;
         Community community = CurrentManager.GetCommunity(idCommunity);
         if (community != null)
         {
             cName = community.Name;
         }
         View.SelectedIdUsers = GetUpdatedUsersSelection();
         View.LoadCommunityAssignment(CallService.GetCommunityAssignments(View.IdCall, idCommunity, idAssignment, roles), cName, idCommunity, CommunityService.GetCommunityAvailableIdRoles(community));
     }
 }
 public void InitView(Int32 idCommunity, List <long> selectedFiles, Boolean loadIntoTree, Boolean showHiddenItems, Boolean forAdminPurpose, Boolean disableWaitingFiles, RepositoryItemType type)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplayNoFilesFound();
     }
     else
     {
         Community community = CurrentManager.GetCommunity(idCommunity);
         if (community == null && idCommunity > 0)
         {
             View.DisplayNoFilesFound();
         }
         else
         {
             LoadFiles(community, selectedFiles, loadIntoTree, showHiddenItems, forAdminPurpose, disableWaitingFiles, type);
         }
     }
 }
        private void LoadAvailableFiltersBy(Person user, dtoProjectContext context, dtoItemsFilter filter, PageListType currentPageType)
        {
            List <ProjectFilterBy> fItems = Service.GetAvailableFilterBy(user.Id, context, currentPageType);

            if (!fItems.Contains(filter.FilterBy))
            {
                filter.FilterBy = ProjectFilterBy.All;
            }
            String name = "";

            if (fItems.Contains(ProjectFilterBy.CurrentCommunity))
            {
                Community community = CurrentManager.GetCommunity(context.IdCommunity);
                if (community != null)
                {
                    name = community.Name;
                }
            }
            View.LoadFilterBy(fItems, filter.FilterBy, context.isForPortal, name);
        }
示例#14
0
        public void LoadCommunityAssignments(Int32 idCommunity, long idAssignment, Dictionary <String, String> modules, Dictionary <Int32, String> roles)
        {
            long idVersion = View.IdVersion;

            if (UserContext.isAnonymous)
            {
                Logout(View.CurrentType, View.IdTemplate, idVersion);
            }
            else
            {
                String    cName     = View.UnknownCommunityTranslation;
                Community community = CurrentManager.GetCommunity(idCommunity);
                if (community != null)
                {
                    cName = community.Name;
                }
                View.SelectedIdUsers = GetUpdatedUsersSelection();
                View.LoadCommunityAssignment(Service.GetCommunityAssignments(idVersion, idCommunity, idAssignment, modules, roles), cName, idCommunity, CommunityService.GetCommunityAvailableIdRoles(community));
            }
        }
        public void SaveSettings(Int32 idCommunity, Boolean forAllUsers, List <Int32> roles)
        {
            long idCall = View.IdCall;

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else if (roles.Count == 0 && !forAllUsers && !CallService.HasCallUserAssignments(idCall))
            {
                View.DisplayNoAvailability();
            }
            else
            {
                String    name = "";
                Community c    = CurrentManager.GetCommunity(idCommunity);
                if (c != null)
                {
                    name = c.Name;
                }
                else if (idCommunity > 0)
                {
                    name = View.UnknownCommunityTranslation;
                }
                else
                {
                    name = View.Portalname;
                }

                Boolean saved = CallService.SaveCommunityAvailability(idCall, idCommunity, forAllUsers, roles);
                if (saved)
                {
                    View.DisplayCommunityAssignmentSaved(name);
                    LoadAssignments(idCall);
                }
                else
                {
                    View.DisplaySaveErrors(!saved);
                }
            }
        }
示例#16
0
        private dtoSelectorContext GetContext()
        {
            dtoSelectorContext item = new dtoSelectorContext();

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

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

            if (item.IdCommunity == 0 && item.IsForPortal == false)
            {
                item.IdCommunity = UserContext.CurrentCommunityID;
                item.IsForPortal = (item.IdCommunity == 0);
            }
            else if (item.IdCommunity > 0 && item.IsForPortal)
            {
                item.IsForPortal = false;
            }
            item.IdOrganization = (item.IdOrganization == 0) ? ((c == null) ? 0 : c.IdOrganization) : item.IdOrganization;
            if (item.IdOrganization > 0)
            {
                item.IdOrganizationCommunity = CurrentManager.GetIdCommunityFromOrganization(item.IdOrganization);
            }
            return(item);
        }
        public void TryToPublish(long IdDestinationFolder)
        {
            List <long> IdLinks = View.SelectedItemFileLinksId;

            if (IdLinks.Count == 0)
            {
                View.ShowWizardStep(WizardStep.FileSelector);
            }
            else
            {
                List <BaseCommunityFile> existingFiles = new List <BaseCommunityFile>();
                List <BaseCommunityFile> internalFiles = Service.GetModuleFiles(View.SelectedItemFilesId);

                Community community = CurrentManager.GetCommunity(View.SelectedCommunityID);
                foreach (ModuleInternalFile moduleFile in internalFiles)
                {
                    CommunityFile repositoryFile = Service.FindDuplicatedRepositoryItem(community, IdDestinationFolder, moduleFile);
                    if (repositoryFile != null)
                    {
                        existingFiles.Add(moduleFile);
                    }
                }
                List <dtoFileExist <long> > filesToChange = new List <dtoFileExist <long> >();
                if (existingFiles.Count > 0)
                {
                    filesToChange = (from ef in existingFiles
                                     select new dtoFileExist <long> {
                        Id = ef.Id, ExistFileName = ef.DisplayName, Extension = ef.Extension, ProposedFileName = Service.ProposedRepositoryItemName(ef, community, IdDestinationFolder)
                    }).ToList();
                    View.LoadDuplicates(filesToChange);
                    View.ShowWizardStep(WizardStep.RenamedFileList);
                }
                else
                {
                    View.LoadDuplicates(filesToChange);
                    LoadStepSummary(internalFiles, new List <dtoModuleFileToPublish>());
                    View.ShowWizardStep(WizardStep.ConfirmPublish);
                }
            }
        }
示例#18
0
        public void InitView(long idFolder, Int32 idCommunity)
        {
            if (idFolder != 0)
            {
                BaseCommunityFile folder = Service.GetItem(idFolder);
                if (folder == null || folder.isFile)
                {
                    idFolder = 0;
                }
                else if (folder.CommunityOwner != null && folder.CommunityOwner.Id != idCommunity)
                {
                    idCommunity = folder.CommunityOwner.Id;
                }
            }
            Community comm = CurrentManager.GetCommunity(idCommunity);

            if (idCommunity > 0 && comm == null)
            {
                idCommunity = UserContext.CurrentCommunityID;
            }
            View.IdCommunityRepository = idCommunity;
            View.CommunityName         = (idCommunity == 0 || comm == null) ? View.Portalname : comm.Name;

            View.AllowFolderChange = Service.CommunityHasFolders(idCommunity);
            View.IdFolder          = idFolder;
            String path = View.BaseFolder;

            if (idFolder > 0)
            {
                BaseCommunityFile folder = Service.GetItem(idFolder);
                if (folder != null)
                {
                    path = Service.GetFolderPathName(folder.Id);
                }
            }
            View.FilePath = path;
            View.DownlodableByCommunity = true;
            View.VisibleToDonwloaders   = true;
            View.LoadFolderSelector(idFolder, idCommunity, false, false);
        }
示例#19
0
        public void InitView(ModuleGenericTemplateMessages permissions, lm.Comol.Core.Notification.Domain.NotificationChannel channel, dtoSelectorContext context, long idTemplate, long idVersion, Boolean isVerifyed = false, List <dtoTemplateItem> items = null)
        {
            View.isInitialized = true;
            if (!isVerifyed)
            {
                if (context.IdModule <= 0 && !String.IsNullOrEmpty(context.ModuleCode))
                {
                    context.IdModule = CurrentManager.GetModuleID(context.ModuleCode);
                }
                if (context.IdModule > 0 && String.IsNullOrEmpty(context.ModuleCode))
                {
                    context.ModuleCode = CurrentManager.GetModuleCode(context.IdModule);
                }
                context.IsForPortal = (context.IsForPortal && context.IdCommunity == 0 && context.IdOrganization == 0);
                if (context.IdOrganizationCommunity <= 0)
                {
                    if (context.IdOrganization > 0)
                    {
                        context.IdOrganizationCommunity = CurrentManager.GetIdCommunityFromOrganization(context.IdOrganization);
                    }
                    else if (context.IdCommunity > 0 && context.IdOrganization <= 0)
                    {
                        Community community = CurrentManager.GetCommunity(context.IdCommunity);
                        context.IdOrganizationCommunity = (community == null) ? 0 : ((community.IdFather == 0) ? community.Id : CurrentManager.GetIdCommunityFromOrganization(community.IdOrganization));
                    }
                }
            }
            dtoTemplateItem current = Service.GetDefaultAutomaticTemplate(context, channel);

            if (UserContext.isAnonymous)
            {
                LoadCurrentTemplate(current);
                View.AllowPreview = false;
                View.AllowSelect  = false;
            }
            else
            {
                LoadItems(permissions, channel, current, context, idTemplate, idVersion, items);
            }
        }
        private void LoadStepSummary(List <BaseCommunityFile> internalFiles, List <dtoModuleFileToPublish> RenamedFiles)
        {
            List <dtoModuleFileToPublish> filesToPublish = (from f in internalFiles
                                                            select new dtoModuleFileToPublish()
            {
                FileID = f.Id, FileName = f.Name, Extension = f.Extension, IsVisible = true
            }).ToList();

            if (RenamedFiles.Count > 0)
            {
                filesToPublish.AddRange(RenamedFiles);
            }
            String    communityName = View.PortalHome;
            Community community     = CurrentManager.GetCommunity(View.SelectedCommunityID);

            if (community != null)
            {
                communityName = community.Name;
            }
            View.LoadSummary(communityName, View.SelectedFolderName, filesToPublish);
            View.ShowWizardStep(WizardStep.ConfirmPublish);
        }
示例#21
0
        public void InitView(ModuleGenericTemplateMessages permissions, lm.Comol.Core.Notification.Domain.NotificationChannel channel, long idAction, Int32 idModule, String moduleCode, Int32 idCommunty, Int32 idOrganization = 0, Boolean forPortal = false, long idTemplate = 0, long idVersion = 0, lm.Comol.Core.DomainModel.ModuleObject obj = null, List <dtoTemplateItem> items = null)
        {
            dtoSelectorContext c = new dtoSelectorContext();

            c.IdAction       = idAction;
            c.IdModule       = (idModule > 0) ? idModule : (!String.IsNullOrEmpty(moduleCode) ? CurrentManager.GetModuleID(moduleCode) : 0);
            c.ModuleCode     = (!String.IsNullOrEmpty(moduleCode)) ? moduleCode : (idModule > 0 ? CurrentManager.GetModuleCode(idModule) : "");
            c.IdCommunity    = idCommunty;
            c.IdOrganization = idOrganization;
            if (idCommunty > 0 && idOrganization <= 0)
            {
                Community community = CurrentManager.GetCommunity(idCommunty);
                c.IdOrganizationCommunity = (community == null) ? 0 : ((community.IdFather == 0) ? community.Id : CurrentManager.GetIdCommunityFromOrganization(community.IdOrganization));
            }
            else if (idOrganization > 0)
            {
                c.IdOrganizationCommunity = CurrentManager.GetIdCommunityFromOrganization(idOrganization);
            }
            c.IsForPortal = (forPortal && idCommunty == 0 && idOrganization == 0);
            c.ObjectOwner = obj;
            InitView(permissions, channel, c, idTemplate, idVersion, true, items);
        }
        private void PreLoadModule(Person authenticatedUser, String externalIdCommunity, String providerCode)
        {
            ExternalCommunityInfo externalCommunity = Service.FindExternalCommunityByIdentifier(View.PreLoadedExternalID, providerCode);

            if (externalCommunity == null && string.IsNullOrEmpty(View.PreLoadedExternalID))
            {
                View.LoadWaitingMessage(authenticatedUser, View.PortalHome);
            }
            else if (externalCommunity != null)
            {
                Community community = CurrentManager.GetCommunity(externalCommunity.IdCommunity);
                if (community == null)
                {
                    View.LoadUnknowCommunity();
                }
                else if (CurrentManager.HasActiveSubscription(authenticatedUser.Id, community.Id))
                {
                    View.LoadWaitingMessage(authenticatedUser, community.Name);
                    String destinationUrl = Service.GetModuleUrlByIdentifier(community.Id, authenticatedUser.Id, authenticatedUser.LanguageID, View.PreLoadedModuleCode, View.PreloadedModulePage);
                    if (UserContext.isAnonymous)
                    {
                        View.LoadModuleWithLogon(authenticatedUser, community.Id, destinationUrl);
                    }
                    else
                    {
                        View.LoadModule(community.Id, destinationUrl);
                    }
                }
                else
                {
                    View.LoadUnsubscribedCommunity(community.Name);
                }
            }
            else
            {
                View.LoadUnknowCommunity();
            }
        }
示例#23
0
        private int GetCurrentCommunity(dtoBaseForPaper call)
        {
            int       idCommunity      = 0;
            Community currentCommunity = CurrentManager.GetCommunity(this.UserContext.CurrentCommunityID);
            Community community        = null;

            if (call != null)
            {
                idCommunity = (call.IsPortal) ? 0 : (call.Community != null) ? call.Community.Id : 0;
            }
            community = CurrentManager.GetCommunity(idCommunity);

            if (community == null && currentCommunity != null && !call.IsPortal)
            {
                idCommunity = this.UserContext.CurrentCommunityID;
            }
            else if (community == null)
            {
                idCommunity = 0;
            }
            View.IdCallCommunity = idCommunity;
            return(idCommunity);
        }
        //Public Sub FindCommunityFolder(ByVal CommunityID As Integer)
        //    'Dim oItem As WorkBookItem = Me.CurrentManager.GetWorkBookItem(Me.View.PreloadedItemID)
        //    Dim oFilePermission As ModuleCommunityRepository = Me.View.CommunityRepositoryPermission(CommunityID)
        //    Me.View.SelectedCommunityID = CommunityID
        //    If CommunityID > 0 Then
        //        If Me.View.SelectedFolder = -1 Then
        //            Me.View.InitializeFolderSelector(CommunityID, 0, (oFilePermission.Administration))
        //        Else
        //            Me.View.ShowFoldersList()
        //        End If
        //    Else
        //        Me.View.ShowSelectCommunity()
        //    End If

        //End Sub
        private void LoadStepCommunitySelector()
        {
            int       IdCommunity = View.InternalFileSelectorIdCommunity;
            Community community   = CurrentManager.GetCommunity(IdCommunity);

            if (IdCommunity <= 0 || community == null)
            {
                if (View.CommunitySelectorLoaded)
                {
                    View.ShowWizardStep(WizardStep.CommunitySelector);
                }
                else
                {
                    View.InitializeCommunitySelector();
                }
            }
            else
            {
                View.SelectedCommunityID = IdCommunity;
                View.SetFolderInfo(community.Name);
                LoadStepFolderSelector();
            }
        }
        public void AddCommunity(List <Int32> idCommunites)
        {
            long idCall = View.IdCall;

            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout();
            }
            else if (idCommunites.Any())
            {
                Boolean saved = CallService.AddCommunityAssignment(idCall, idCommunites);
                if (saved)
                {
                    if (idCommunites.Count > 1)
                    {
                        View.DisplayCommunityAssignmentsAdded();
                    }
                    else
                    {
                        Community c = CurrentManager.GetCommunity(idCommunites.First());
                        if (c != null)
                        {
                            View.DisplayCommunityAssignmentAdded(c.Name);
                        }
                        else
                        {
                            View.DisplayCommunityAssignmentsAdded();
                        }
                    }
                    LoadAssignments(idCall);
                }
                else
                {
                    View.DisplaySaveErrors(!saved);
                }
            }
        }
        public void PublishIntoCommunityRepository(String BaseFilePath, int IdCategory, List <dtoModuleFileToPublish> files)
        {
            int       IdCommunity = View.SelectedCommunityID;
            Community community   = CurrentManager.GetCommunity(IdCommunity);

            if (BaseFilePath == "" || files.Count == 0 || IdCommunity < 1 || community == null)
            {
                View.ReturnToManagement();
            }
            else
            {
                List <BaseCommunityFile>    addedFiles    = new List <BaseCommunityFile>();
                List <dtoFileExist <long> > filesToRename = Service.PublishFilesIntoRepository(BaseFilePath, IdCategory, community, View.SelectedFolderId, files, ref addedFiles);
                View.UpdateSelectedFilesId((from f in filesToRename select f.Id).ToList());

                String ParentFolder = View.BaseFolder;
                if (View.SelectedFolderId > 0)
                {
                    ParentFolder = Service.GetFolderName(View.SelectedFolderId);
                }
                foreach (BaseCommunityFile addedFile in (from f in addedFiles where f != null && f.Id > 0 select f).ToList())
                {
                    View.NotifyRepositoryAdd(IdCommunity, ModuleID, addedFile, ParentFolder);
                }

                if (filesToRename.Count == 0)
                {
                    View.ReturnToManagement();
                }
                else
                {
                    View.LoadDuplicates(filesToRename);
                    View.ShowWizardStep(WizardStep.RenamedFileList);
                }
            }
        }
示例#27
0
        private int SetCallsCurrentCommunity()
        {
            int       idCommunity      = this.UserContext.CurrentCommunityID;
            Community currentCommunity = CurrentManager.GetCommunity(idCommunity);
            Community community        = null;

            if (View.PreloadIdCommunity > 0)
            {
                idCommunity = View.PreloadIdCommunity;
            }

            if (idCommunity > 0)
            {
                community = CurrentManager.GetCommunity(idCommunity);
                if (community != null)
                {
                    View.SetContainerName(idCommunity, community.Name);
                }
                else if (currentCommunity != null)
                {
                    idCommunity = this.UserContext.CurrentCommunityID;
                    View.SetContainerName(idCommunity, community.Name);
                }
                else
                {
                    idCommunity = 0;
                    View.SetContainerName(idCommunity, View.Portalname);
                }
            }
            else
            {
                View.SetContainerName(0, View.Portalname);
            }
            View.IdCallCommunity = idCommunity;
            return(idCommunity);
        }
示例#28
0
        public dtoUploadedFile AddFileToRepository(CommunityFile file, String savedFile, String communityPath)
        {
            dtoUploadedFile result = new dtoUploadedFile(file, ItemRepositoryStatus.CreationError);

            if (file != null && lm.Comol.Core.File.Exists.File(savedFile))
            {
                CommunityFile        savedItem   = null;
                Int32                idCommunity = View.IdCommunityRepository;
                Community            community   = CurrentManager.GetCommunity(idCommunity);
                ItemRepositoryStatus status      = ItemRepositoryStatus.None;

                if ((idCommunity > 0 && community != null) || (community == null && idCommunity == 0))
                {
                    file.Owner          = CurrentManager.GetPerson(UserContext.CurrentUserID);
                    file.CommunityOwner = community;
                    file.CreatedOn      = DateTime.Now;
                    file.ModifiedOn     = file.CreatedOn;
                    file.ModifiedBy     = file.Owner;

                    if (View.DownlodableByCommunity)
                    {
                        savedItem = Service.AddFile(file, communityPath, (long)CoreModuleRepository.Base2Permission.DownloadFile, ref status);
                    }
                    else
                    {
                        savedItem = Service.AddFile(file, file.Owner, communityPath, (long)CoreModuleRepository.Base2Permission.DownloadFile, ref status);
                    }
                    if (savedItem != null)
                    {
                        result.Link = Service.CreateModuleActionLink(savedItem, (Int32)CoreModuleRepository.Base2Permission.DownloadFile, Service.ServiceModuleID());
                    }
                }
                result.Status = status;
            }
            return(result);
        }
        public void InitView(String editorConfigurationPath, System.Guid currentWorkingApplicationId)
        {
            NoticeboardMessage message = null;

            EditorConfiguration config = ServiceEditor.GetConfiguration(editorConfigurationPath);

            if (config != null)
            {
                ModuleEditorSettings mSettings = (config.ModuleSettings == null) ? null : config.ModuleSettings.Where(m => m.ModuleCode == ModuleNoticeboard.UniqueID).FirstOrDefault();
                if (mSettings == null && config.CssFiles.Any())
                {
                    View.PreloadCssFiles(config.DefaultCssFilesPath, config.CssFiles);
                }
                else if (mSettings != null && mSettings.CssFiles != null && mSettings.CssFiles.Any() && mSettings.OvverideCssFileSettings)
                {
                    View.PreloadCssFiles(config.DefaultCssFilesPath, mSettings.CssFiles);
                }
                else if (mSettings != null && mSettings.CssFiles != null && !mSettings.OvverideCssFileSettings)
                {
                    View.PreloadCssFiles(config.DefaultCssFilesPath, config.CssFiles);
                }
            }

            long idMessage   = View.PreloadedIdMessage;
            int  IdCommunity = View.PreloadedIdCommunity;

            if (idMessage != 0)
            {
                message = Service.GetMessage(idMessage);
            }
            else
            {
                message = Service.GetLastMessage(IdCommunity);
                if (message != null)
                {
                    idMessage = message.Id;
                }
            }
            if (message != null && message.Community != null)
            {
                IdCommunity = message.Community.Id;
            }
            else if (message != null && message.isForPortal)
            {
                IdCommunity = 0;
            }
            else
            {
                IdCommunity = UserContext.WorkingCommunityID;
            }

            Community community = null;

            if (IdCommunity > 0)
            {
                community = CurrentManager.GetCommunity(IdCommunity);
            }
            if (community == null && IdCommunity > 0)
            {
                View.ContainerName = "";
            }
            else if (community != null)
            {
                View.ContainerName = community.Name;
            }
            else
            {
                View.ContainerName = View.PortalName;
            }

            Boolean anonymousViewAllowed = (View.PreloadWorkingApplicationId != Guid.Empty && View.PreloadWorkingApplicationId == currentWorkingApplicationId);

            if (message == null && idMessage > 0)
            {
                View.DisplayUnknownMessage();
                View.SendUserAction(IdCommunity, ModuleID, idMessage, ModuleNoticeboard.ActionType.ViewUnknownMessage);
            }
            else if (message == null && idMessage == 0)
            {
                View.DisplayEmptyMessage();
                View.SendUserAction(IdCommunity, ModuleID, idMessage, ModuleNoticeboard.ActionType.ViewEmptyMessage);
            }
            else if (UserContext.isAnonymous && !anonymousViewAllowed)
            {
                View.DisplaySessionTimeout();
            }
            else
            {
                View.IdCurrentMessage = idMessage;

                ModuleNoticeboard module = null;
                if (IdCommunity == 0 && 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 || anonymousViewAllowed)
                {
                    View.DisplayMessage(message);
                    View.SendUserAction(IdCommunity, ModuleID, idMessage, ModuleNoticeboard.ActionType.ViewMessage);
                }
                else
                {
                    View.DisplayNoPermission();
                    View.SendUserAction(IdCommunity, ModuleID, idMessage, ModuleNoticeboard.ActionType.NoPermission);
                }
            }
        }