示例#1
0
        protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context)
        {
            var curQuota = TenantExtra.GetTenantQuota();
            var tenant   = CoreContext.TenantManager.GetCurrentTenant();
            var helpLink = CommonLinkUtility.GetHelpLink();

            var result = new List <KeyValuePair <string, object> >(4)
            {
                RegisterObject(
                    new {
                    ApiPath         = SetupInfo.WebApiBaseUrl,
                    IsAuthenticated = SecurityContext.IsAuthenticated,
                    IsAdmin         = CoreContext.UserManager.IsUserInGroup(SecurityContext.CurrentAccount.ID, Constants.GroupAdmin.ID),
                    IsVisitor       = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsVisitor(),
                    //CurrentTenantId = tenant.TenantId,
                    CurrentTenantCreatedDate      = tenant.CreatedDateTime,
                    CurrentTenantVersion          = tenant.Version,
                    CurrentTenantUtcOffset        = tenant.TimeZone,
                    CurrentTenantUtcHoursOffset   = tenant.TimeZone.BaseUtcOffset.Hours,
                    CurrentTenantUtcMinutesOffset = tenant.TimeZone.BaseUtcOffset.Minutes,
                    TimezoneDisplayName           = tenant.TimeZone.DisplayName,
                    TimezoneOffsetMinutes         = tenant.TimeZone.GetUtcOffset(DateTime.UtcNow).TotalMinutes,
                    TenantIsPremium = curQuota.Trial ? "No" : "Yes",
                    TenantTariff    = curQuota.Id,
                    EmailRegExpr    = @"^(([^<>()[\]\\.,;:\s@\""]+(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$",
                    GroupSelector_MobileVersionGroup = new { Id = -1, Name = UserControlsCommonResource.LblSelect.HtmlEncode().ReplaceSingleQuote() },
                    GroupSelector_WithGroupEveryone  = new { Id = Constants.GroupEveryone.ID, Name = UserControlsCommonResource.Everyone.HtmlEncode().ReplaceSingleQuote() },
                    GroupSelector_WithGroupAdmin     = new { Id = Constants.GroupAdmin.ID, Name = UserControlsCommonResource.Admin.HtmlEncode().ReplaceSingleQuote() },
                    SetupInfoNotifyAddress           = SetupInfo.NotifyAddress,
                    SetupInfoTipsAddress             = SetupInfo.TipsAddress,
                    CKEDITOR_BASEPATH   = WebPath.GetPath("/usercontrols/common/ckeditor/"),
                    MaxImageFCKWidth    = ConfigurationManager.AppSettings["MaxImageFCKWidth"] ?? "620",
                    UserPhotoHandlerUrl = VirtualPathUtility.ToAbsolute("~/UserPhoto.ashx"),
                    ImageWebPath        = WebImageSupplier.GetImageFolderAbsoluteWebPath(),
                    UrlShareGooglePlus  = SetupInfo.ShareGooglePlusUrl,
                    UrlShareTwitter     = SetupInfo.ShareTwitterUrl,
                    UrlShareFacebook    = SetupInfo.ShareFacebookUrl,
                    LogoDarkUrl         = CommonLinkUtility.GetFullAbsolutePath(TenantLogoManager.GetLogoDark(true)),
                    HelpLink            = helpLink ?? ""
                })
            };

            if (CoreContext.Configuration.Personal)
            {
                result.Add(RegisterObject(new { CoreContext.Configuration.Personal }));
            }

            if (CoreContext.Configuration.Standalone)
            {
                result.Add(RegisterObject(new { CoreContext.Configuration.Standalone }));
            }

            if (!string.IsNullOrEmpty(helpLink))
            {
                result.Add(RegisterObject(new { FilterHelpCenterLink = helpLink.TrimEnd('/') + "/tipstricks/using-search.aspx" }));
            }

            return(result);
        }
示例#2
0
        protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context)
        {
            yield return(RegisterObject("ApiPath", SetupInfo.WebApiBaseUrl));

            yield return(RegisterObject("IsAuthenticated", SecurityContext.IsAuthenticated));

            yield return(RegisterObject("IsAdmin", CoreContext.UserManager.IsUserInGroup(SecurityContext.CurrentAccount.ID, ASC.Core.Users.Constants.GroupAdmin.ID)));

            yield return(RegisterObject("CurrentTenantVersion", CoreContext.TenantManager.GetCurrentTenant().Version));

            yield return(RegisterObject("CurrentTenantUtcOffset", CoreContext.TenantManager.GetCurrentTenant().TimeZone));

            yield return(RegisterObject("CurrentTenantUtcHoursOffset", CoreContext.TenantManager.GetCurrentTenant().TimeZone.GetUtcOffset(DateTime.UtcNow).Hours));

            yield return(RegisterObject("CurrentTenantUtcMinutesOffset", CoreContext.TenantManager.GetCurrentTenant().TimeZone.GetUtcOffset(DateTime.UtcNow).Minutes));

            var curQuota = TenantExtra.GetTenantQuota();

            yield return(RegisterObject("TenantIsPremium", curQuota.Trial ? "No" : "Yes"));

            yield return(RegisterObject("TenantTariff", curQuota.Id));

            yield return(RegisterObject("TenantTariffDocsEdition", curQuota.DocsEdition));

            if (CoreContext.Configuration.Personal)
            {
                yield return(RegisterObject("Personal", CoreContext.Configuration.Personal));
            }

            yield return(RegisterObject("ShowPromotions", SettingsManager.Instance.LoadSettings <StudioNotifyBarSettings>(TenantProvider.CurrentTenantID).ShowPromotions));

            yield return(RegisterObject("EmailRegExpr", @"^(([^<>()[\]\\.,;:\s@\""]+(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$"));

            yield return(RegisterObject("GroupSelector_MobileVersionGroup", new { Id = -1, Name = UserControlsCommonResource.LblSelect.HtmlEncode().ReplaceSingleQuote() }));

            yield return(RegisterObject("GroupSelector_WithGroupEveryone", new { Id = ASC.Core.Users.Constants.GroupEveryone.ID, Name = UserControlsCommonResource.Everyone.HtmlEncode().ReplaceSingleQuote() }));

            yield return(RegisterObject("GroupSelector_WithGroupAdmin", new { Id = ASC.Core.Users.Constants.GroupAdmin.ID, Name = UserControlsCommonResource.Admin.HtmlEncode().ReplaceSingleQuote() }));

            yield return(RegisterObject("FilterHelpCenterLink", CommonLinkUtility.GetHelpLink(true) + "/tipstricks/using-search.aspx"));

            yield return(RegisterObject("SetupInfoNotifyAddress", SetupInfo.NotifyAddress));

            yield return(RegisterObject("CKEDITOR_BASEPATH", WebPath.GetPath("/usercontrols/common/ckeditor/")));

            yield return(RegisterObject("MaxImageFCKWidth", ConfigurationManager.AppSettings["MaxImageFCKWidth"] ?? "620"));

            yield return(RegisterObject("UserPhotoHandlerUrl", VirtualPathUtility.ToAbsolute("~/UserPhoto.ashx")));

            yield return(RegisterObject("ImageWebPath", WebImageSupplier.GetImageFolderAbsoluteWebPath()));

            yield return(RegisterObject("UploadFlashUrl", FileUploaderFlashParams.GetFlashUrl));

            yield return(RegisterObject("UploadDefaultRuntimes", FileUploaderFlashParams.DefaultRuntimes));
        }
示例#3
0
        protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context)
        {
            var curQuota = TenantExtra.GetTenantQuota();

            var result = new List <KeyValuePair <string, object> >(32)
            {
                RegisterObject("ApiPath", SetupInfo.WebApiBaseUrl),
                RegisterObject("IsAuthenticated", SecurityContext.IsAuthenticated),
                RegisterObject("IsAdmin", CoreContext.UserManager.IsUserInGroup(SecurityContext.CurrentAccount.ID, Constants.GroupAdmin.ID)),
                RegisterObject("IsVisitor", CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).IsVisitor()),
                RegisterObject("CurrentTenantId", CoreContext.TenantManager.GetCurrentTenant().TenantId),
                RegisterObject("CurrentTenantCreatedDate", CoreContext.TenantManager.GetCurrentTenant().CreatedDateTime),
                RegisterObject("CurrentTenantVersion", CoreContext.TenantManager.GetCurrentTenant().Version),
                RegisterObject("CurrentTenantUtcOffset", CoreContext.TenantManager.GetCurrentTenant().TimeZone),
                RegisterObject("CurrentTenantUtcHoursOffset", CoreContext.TenantManager.GetCurrentTenant().TimeZone.BaseUtcOffset.Hours),
                RegisterObject("CurrentTenantUtcMinutesOffset", CoreContext.TenantManager.GetCurrentTenant().TimeZone.BaseUtcOffset.Minutes),
                RegisterObject("TimezoneDisplayName", CoreContext.TenantManager.GetCurrentTenant().TimeZone.DisplayName),
                RegisterObject("TimezoneOffsetMinutes", CoreContext.TenantManager.GetCurrentTenant().TimeZone.GetUtcOffset(DateTime.UtcNow).TotalMinutes),
                RegisterObject("TenantIsPremium", curQuota.Trial ? "No" : "Yes"),
                RegisterObject("TenantTariff", curQuota.Id),
                RegisterObject("TenantTariffDocsEdition", curQuota.DocsEdition),
                RegisterObject("EmailRegExpr", @"^(([^<>()[\]\\.,;:\s@\""]+(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$"),
                RegisterObject("GroupSelector_MobileVersionGroup", new { Id = -1, Name = UserControlsCommonResource.LblSelect.HtmlEncode().ReplaceSingleQuote() }),
                RegisterObject("GroupSelector_WithGroupEveryone", new { Id = Constants.GroupEveryone.ID, Name = UserControlsCommonResource.Everyone.HtmlEncode().ReplaceSingleQuote() }),
                RegisterObject("GroupSelector_WithGroupAdmin", new { Id = Constants.GroupAdmin.ID, Name = UserControlsCommonResource.Admin.HtmlEncode().ReplaceSingleQuote() }),
                RegisterObject("SetupInfoNotifyAddress", SetupInfo.NotifyAddress),
                RegisterObject("SetupInfoTipsAddress", SetupInfo.TipsAddress),
                RegisterObject("CKEDITOR_BASEPATH", WebPath.GetPath("/usercontrols/common/ckeditor/")),
                RegisterObject("MaxImageFCKWidth", ConfigurationManager.AppSettings["MaxImageFCKWidth"] ?? "620"),
                RegisterObject("UserPhotoHandlerUrl", VirtualPathUtility.ToAbsolute("~/UserPhoto.ashx")),
                RegisterObject("ImageWebPath", WebImageSupplier.GetImageFolderAbsoluteWebPath()),
                RegisterObject("UrlShareGooglePlus", SetupInfo.ShareGooglePlusUrl),
                RegisterObject("UrlShareTwitter", SetupInfo.ShareTwitterUrl),
                RegisterObject("UrlShareFacebook", SetupInfo.ShareFacebookUrl),
                RegisterObject("ZeroClipboardMoviePath", CommonLinkUtility.ToAbsolute("~/js/flash/zeroclipboard/zeroclipboard10.swf"))
            };

            if (CoreContext.Configuration.Personal)
            {
                result.Add(RegisterObject("Personal", CoreContext.Configuration.Personal));
            }

            if (CoreContext.Configuration.Standalone)
            {
                result.Add(RegisterObject("Standalone", CoreContext.Configuration.Standalone));
            }

            if (!string.IsNullOrEmpty(CommonLinkUtility.GetHelpLink()))
            {
                result.Add(RegisterObject("FilterHelpCenterLink", CommonLinkUtility.GetHelpLink() + "/tipstricks/using-search.aspx"));
            }

            return(result);
        }
        protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context)
        {
            var imgs = new Dictionary <string, string>
            {
                { "empty_screen_filter", WebImageSupplier.GetAbsoluteWebPath("empty_screen_filter.png") },
                { "empty_screen_tasks", WebImageSupplier.GetAbsoluteWebPath("empty_screen_tasks.png", ProductEntryPoint.ID) },
                { "empty_screen_deals", WebImageSupplier.GetAbsoluteWebPath("empty_screen_deals.png", ProductEntryPoint.ID) },
                { "empty_screen_cases", WebImageSupplier.GetAbsoluteWebPath("empty_screen_cases.png", ProductEntryPoint.ID) },
                { "empty_screen_invoices", WebImageSupplier.GetAbsoluteWebPath("empty_screen_invoices.png", ProductEntryPoint.ID) },
                { "empty_screen_products_services", WebImageSupplier.GetAbsoluteWebPath("empty_screen_products_services.png", ProductEntryPoint.ID) },
                { "empty_screen_taxes", WebImageSupplier.GetAbsoluteWebPath("empty_screen_taxes.png", ProductEntryPoint.ID) },
                { "empty_screen_persons", WebImageSupplier.GetAbsoluteWebPath("empty_screen_persons.png", ProductEntryPoint.ID) },
                { "empty_screen_phones", WebImageSupplier.GetAbsoluteWebPath("empty_screen_phones.png", ProductEntryPoint.ID) },
                { "empty_screen_voip_settings", WebImageSupplier.GetAbsoluteWebPath("empty_screen_voip_settings.png", ProductEntryPoint.ID) },
                { "empty_people_logo_40_40", WebImageSupplier.GetAbsoluteWebPath("empty_people_logo_40_40.png", ProductEntryPoint.ID) },
                { "empty_screen_opportunity_participants", WebImageSupplier.GetAbsoluteWebPath("empty_screen_opportunity_participants.png", ProductEntryPoint.ID) },
                { "empty_screen_company_participants", WebImageSupplier.GetAbsoluteWebPath("empty_screen_company_participants.png", ProductEntryPoint.ID) },
                { "empty_screen_case_participants", WebImageSupplier.GetAbsoluteWebPath("empty_screen_case_participants.png", ProductEntryPoint.ID) },
                { "empty_screen_projects", WebImageSupplier.GetAbsoluteWebPath("empty_screen_projects.png", ProductEntryPoint.ID) },
                { "empty_screen_userfields", WebImageSupplier.GetAbsoluteWebPath("empty_screen_userfields.png", ProductEntryPoint.ID) },
                { "empty_screen_tags", WebImageSupplier.GetAbsoluteWebPath("empty_screen_tags.png", ProductEntryPoint.ID) },
                { "empty_screen_twitter", WebImageSupplier.GetAbsoluteWebPath("empty_screen_twitter.png", ProductEntryPoint.ID) }
            };

            return(new List <KeyValuePair <string, object> >(1)
            {
                RegisterObject(
                    new
                {
                    MediumSizePhotoCompany = ContactPhotoManager.GetMediumSizePhoto(0, true),
                    MediumSizePhoto = ContactPhotoManager.GetMediumSizePhoto(0, false),
                    SmallSizePhotoCompany = ContactPhotoManager.GetSmallSizePhoto(0, true),
                    SmallSizePhoto = ContactPhotoManager.GetSmallSizePhoto(0, false),
                    ProfileRemoved = Constants.LostUser.DisplayUserName(),
                    System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyDecimalSeparator,
                    KeyCodeCurrencyDecimalSeparator = (int)System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.CurrencyDecimalSeparator[0],
                    Global.VisiblePageCount,
                    DefaultEntryCountOnPage = Global.EntryCountOnPage,
                    Global.DefaultCustomFieldSize,
                    Global.DefaultCustomFieldRows,
                    Global.DefaultCustomFieldCols,
                    Global.MaxCustomFieldSize,
                    Global.MaxCustomFieldRows,
                    Global.MaxCustomFieldCols,
                    Global.MaxHistoryEventCharacters,
                    Global.MaxInvoiceItemPrice,
                    Global.CanDownloadInvoices,
                    IsCRMAdmin = CRMSecurity.IsAdmin,
                    EmptyScrImgs = imgs,
                    ImageWebPath = WebImageSupplier.GetImageFolderAbsoluteWebPath(ProductEntryPoint.ID),

                    ContactSelectorTypeEnum =
                        new Dictionary <string, int>
                    {
                        { "All", (int)ContactSelectorTypeEnum.All },
                        { "Companies", (int)ContactSelectorTypeEnum.Companies },
                        { "CompaniesAndPersonsWithoutCompany", (int)ContactSelectorTypeEnum.CompaniesAndPersonsWithoutCompany },
                        { "Persons", (int)ContactSelectorTypeEnum.Persons },
                        { "PersonsWithoutCompany", (int)ContactSelectorTypeEnum.PersonsWithoutCompany }
                    },

                    HistoryCategorySystem =
                        new Dictionary <string, int>
                    {
                        { "TaskClosed", (int)HistoryCategorySystem.TaskClosed },
                        { "FilesUpload", (int)HistoryCategorySystem.FilesUpload },
                        { "MailMessage", (int)HistoryCategorySystem.MailMessage }
                    },

                    DefaultContactPhoto =
                        new Dictionary <string, string>
                    {
                        { "CompanyBigSizePhoto", ContactPhotoManager.GetBigSizePhoto(0, true) },
                        { "PersonBigSizePhoto", ContactPhotoManager.GetBigSizePhoto(0, false) },
                        { "CompanyMediumSizePhoto", ContactPhotoManager.GetMediumSizePhoto(0, true) },
                        { "PersonMediumSizePhoto", ContactPhotoManager.GetMediumSizePhoto(0, false) }
                    },

                    CookieKeyForPagination =
                        new Dictionary <string, string>
                    {
                        { "contacts", "contactPageNumber" },
                        { "tasks", "taskPageNumber" },
                        { "deals", "dealPageNumber" },
                        { "cases", "casesPageNumber" },
                        { "invoices", "invoicePageNumber" },
                        { "invoiceitems", "invoiceItemsPageNumber" }
                    },

                    CanCreateProjects = Global.CanCreateProjects()
                })
            });
        }