示例#1
0
        private void SetSkinDetails(Int32 idUser, long idCall)
        {
            Language   language = CurrentManager.GetDefaultLanguage();
            litePerson person   = GetCurrentUser(ref idUser);

            View.IdUserSubmitter = idUser;
            if (language != null)
            {
                View.DefaultLanguageCode = language.Code;
            }
            if (idUser == UserContext.CurrentUserID || person == null || UserContext.CurrentUserID == 0)
            {
                View.UserLanguageCode = UserContext.Language.Code;
            }
            else if (person != null)
            {
                language = CurrentManager.GetLanguage(person.LanguageID);
                if (language != null)
                {
                    View.UserLanguageCode = language.Code;
                }
                else
                {
                    View.UserLanguageCode = UserContext.Language.Code;
                }
            }
            else
            {
                View.UserLanguageCode = UserContext.Language.Code;
            }

            View.SkinDetails = ServiceCall.GetUserExternalContext(idCall, GetCurrentUser(ref idUser));
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="uiCode">user language code from browser</param>
        public void InitializeLanguageView(String uiCode)
        {
            String lCode = uiCode;
            List <dtoMacUrlProviderIdentifier> items = UrlService.GetActiveApplicationIdentifiers();
            Language language = CurrentManager.GetLanguage(uiCode);

            if (items != null && items.Any())
            {
                dtoMacUrlProviderIdentifier identifier = View.GetUrlIdentifier(items);
                BaseUrlMacAttribute         lAttribute = UrlService.GetProviderLanguageAttribute((identifier == null) ? 0 : identifier.IdProvider);
                if (lAttribute != null)
                {
                    lCode = View.GetUrlAttributeValue(lAttribute.QueryStringName);
                }
            }
            if (lCode != "" && uiCode.Contains(lCode))
            {
                lCode = uiCode;
            }
            if (language == null || (lCode != uiCode && !String.IsNullOrEmpty(lCode)))
            {
                language = CurrentManager.GetLanguageByCodeOrDefault(lCode);
            }
            View.LoadLanguage(language);
        }
示例#3
0
        private void InitializeLanguage(Person person)
        {
            Language language = null;

            if (person != null)
            {
                language = CurrentManager.GetLanguage(person.LanguageID);
            }
            if (language == null)
            {
                language = CurrentManager.GetDefaultLanguage();
            }

            View.LoadLanguage(language);
        }
        public void InitView()
        {
            Boolean accessAvailable = !(View.isSystemOutOfOrder && !View.AllowAdminAccess);

            View.AllowInternalAuthentication = !View.isSystemOutOfOrder;
            if (!accessAvailable)
            {
                View.DisplaySystemOutOfOrder();
            }
            else
            {
                Int32 iduser        = View.PreloadedIdUser;
                Guid  urlIdentifier = View.PreloadedUrlIdentifier;

                Person person = CurrentManager.GetPerson(iduser);
                if (person != null)
                {
                    Language language = CurrentManager.GetLanguage(person.LanguageID);
                    if (language != null)
                    {
                        View.ReloadLanguageSettings(language.Id, language.Code);
                    }
                }

                if (iduser <= 0 || urlIdentifier == Guid.Empty)
                {
                    View.DisplayUnknownUser();
                }
                else if (Service.IsActivatedUserMail(iduser, urlIdentifier))
                {
                    View.DisplayAlreadyActivatedInfo();
                }
                else if (Service.ActivateUserMail(iduser, urlIdentifier))
                {
                    View.DisplayActivationInfo();
                    View.SendActivationMail(person);
                }
                else
                {
                    View.DisplayUnknownUser();
                }
            }
        }
示例#5
0
        public void InitView()
        {
            TemplateType         t         = View.PreloadTemplateType;
            dtoBaseTemplateOwner ownerInfo = View.PreloadOwnership;
            Int32 idCommunity = ownerInfo.IdCommunity;

            if (idCommunity == -1)
            {
                idCommunity = UserContext.CurrentCommunityID;
                //if (t== TemplateType.System)
                ownerInfo.IdCommunity = idCommunity;
            }
            if (ownerInfo.IdModule == 0 && !String.IsNullOrEmpty(ownerInfo.ModuleCode))
            {
                ownerInfo.IdModule = CurrentManager.GetModuleID(ownerInfo.ModuleCode);
            }
            View.Ownership           = ownerInfo;
            View.IdTemplateCommunity = idCommunity;
            View.CurrentType         = t;
            if (UserContext.isAnonymous)
            {
                View.DisplaySessionTimeout(RootObject.Add(t, View.PreloadOwnership, View.PreloadFromIdCommunity, View.PreloadFromModuleCode, View.PreloadFromModulePermissions));
            }
            else
            {
                Boolean allowAdd = false;
                switch (ownerInfo.Type)
                {
                case OwnerType.None:
                    View.UnableToReadUrlSettings();
                    View.SendUserAction(idCommunity, Service.ServiceModuleID(), ModuleTemplateMessages.ActionType.MalformedUrl);
                    break;

                //case OwnerType.Object:
                //    allowAdd = View.HasPermissionForObject(ModuleObject.CreateLongObject(ownerInfo.IdObject, ownerInfo.IdObjectType, ownerInfo.IdObjectCommunity,CurrentManager.GetModuleCode(ownerInfo.IdObjectModule)));
                //    break;
                default:
                    if (t == TemplateType.Module)
                    {
                        ModuleGenericTemplateMessages p = GetPermissions(View.PreloadFromModuleCode, View.PreloadFromModulePermissions, View.PreloadFromIdCommunity, t);
                        allowAdd = p.Administration || p.Add;
                    }
                    else
                    {
                        allowAdd = Service.AllowAdd(ownerInfo);
                    }
                    break;
                }
                List <lm.Comol.Core.Wizard.NavigableWizardItem <dtoTemplateStep> > steps = Service.GetAvailableSteps(0, WizardTemplateStep.Settings, ownerInfo.Type);
                View.AllowAdd = allowAdd;
                if (allowAdd)
                {
                    Boolean isAdministrative = Service.IsAdministrativeUser(UserContext.CurrentUserID);
                    View.AllowSenderEdit    = isAdministrative && t == TemplateType.System;
                    View.AllowSubjectEdit   = isAdministrative;
                    View.AllowSignatureEdit = isAdministrative;
                    List <NotificationChannel> channels = Service.GetAvailableChannels(t, 0);
                    if (t == TemplateType.Module || ownerInfo.IdModule > 0)
                    {
                        View.IdTemplateModule = ownerInfo.IdModule;
                        View.DisplayInput(CurrentManager.GetLanguage(UserContext.Language.Id), Service.GetTemplateNumber(ownerInfo), channels);
                        if (channels.Any() && channels.Count == 1 && channels.Contains(NotificationChannel.Mail))
                        {
                            AddNotificationSetting(NotificationChannel.Mail, new List <dtoChannelConfigurator>());
                        }
                    }
                    else
                    {
                        View.DisplayInput(CurrentManager.GetLanguage(UserContext.Language.Id), Service.GetTemplateNumber(ownerInfo), View.GetAvailableModules(), channels);
                        if (t == TemplateType.User && channels.Contains(NotificationChannel.Mail))
                        {
                            AddNotificationSetting(NotificationChannel.Mail, new List <dtoChannelConfigurator>());
                        }
                    }
                    View.SendUserAction(idCommunity, Service.ServiceModuleID(), ModuleTemplateMessages.ActionType.StartAddNewTemplate);
                }
                else
                {
                    steps                       = steps.Where(s => s.Id.Type == WizardTemplateStep.Settings).ToList();
                    steps[0].Status             = Wizard.WizardItemStatus.disabled;
                    steps[0].DisplayOrderDetail = Wizard.DisplayOrderEnum.first | Wizard.DisplayOrderEnum.last;
                    View.DisplayAddUnavailable();
                    View.SendUserAction(idCommunity, Service.ServiceModuleID(), ModuleTemplateMessages.ActionType.TryToAddNewTemplate);
                }
                View.LoadWizardSteps(idCommunity, steps);
                if (String.IsNullOrEmpty(View.PreloadBackUrl))
                {
                    View.SetBackUrl(RootObject.List(View.PreloadFromIdCommunity, t, ownerInfo, true, View.PreloadFromModuleCode, View.PreloadFromModulePermissions));
                }
                else
                {
                    View.SetBackUrl(View.PreloadBackUrl);
                }
            }
        }