Example #1
0
        private static string GetImageAbsoluteWebPath(string fileName, Guid partID)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                return(string.Empty);
            }
            var filepath = GetPartImageFolderRel(partID) + "/" + fileName;

            return(WebPath.GetPath(filepath.ToLower()));
        }
Example #2
0
 /// <summary>
 /// WEB地址栏上级目录按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void BtnUpWeb(object sender, EventArgs e)
 {
     if (WebPath.Equals("/"))
     {
         return;
     }
     WebPath = WebPath.Substring(0, WebPath.Length - 1);
     WebPath = WebPath.Substring(0, WebPath.LastIndexOf(@"/") + 1);
     WebUrlTextChanged();
 }
Example #3
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));
        }
Example #4
0
        public string GetImageFolderAbsoluteWebPath(Guid moduleID)
        {
            if (HttpContextAccessor?.HttpContext == null)
            {
                return(string.Empty);
            }

            var currentThemePath = GetPartImageFolderRel(moduleID);

            return(WebPath.GetPath(currentThemePath));
        }
        public static string GetImageFolderAbsoluteWebPath(Guid moduleID)
        {
            if (HttpContext.Current == null)
            {
                return(string.Empty);
            }

            var currentThemePath = GetPartImageFolderRel(moduleID);

            return(WebPath.GetPath(currentThemePath.ToLower()));
        }
Example #6
0
        public void HasExtension()
        {
            Assert.IsTrue(WebPath.HasExtension("default.aspx"));
            Assert.IsTrue(WebPath.HasExtension("usrs/admin/default.aspx"));
            Assert.IsTrue(WebPath.HasExtension("http://www.site.com/users/default.aspx"));

            Assert.IsFalse(WebPath.HasExtension("http://www.site.com/users/"));
            Assert.IsFalse(WebPath.HasExtension("~/users/"));
            Assert.IsFalse(WebPath.HasExtension("admin/blogs/users"));
            Assert.IsFalse(WebPath.HasExtension(null));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!CoreContext.Configuration.Standalone)
            {
                Response.Redirect("~/management.aspx");
            }

            AjaxPro.Utility.RegisterTypeForAjax(GetType(), Page);
            Page.RegisterBodyScripts(ResolveUrl("~/usercontrols/management/fulltextsearch/js/fulltextsearch.js"));
            Page.RegisterStyleControl(WebPath.GetPath("usercontrols/management/fulltextsearch/css/fulltextsearch.css"));
        }
Example #8
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);
        }
Example #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SoundPath = WebPath.GetPath("usercontrols/common/smallchat/css/sounds/chat");
     Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/usercontrols/common/smallchat/css/smallchat.css"));
     Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/usercontrols/common/smallchat/css/jquery.cssemoticons.css"));
     Page.RegisterBodyScripts(ResolveUrl("~/js/third-party/jquery/jquery.linkify.js"));
     Page.RegisterBodyScripts(ResolveUrl("~/js/third-party/jquery/noty/jquery.noty.js"));
     Page.RegisterBodyScripts(ResolveUrl("~/js/third-party/jquery/jquery.cssemoticons.js"));
     Page.RegisterBodyScripts(ResolveUrl("~/js/third-party/jquery/jquery.autosize.js"));
     Page.RegisterBodyScripts(ResolveUrl("~/usercontrols/common/smallchat/js/smallchat.js"));
     IsMobile = MobileDetector.IsMobile;
 }
Example #10
0
        public string GetAbsoluteWebPath(string path)
        {
            var p = path.ToLower().Replace("<theme_folder>", FolderName.ToLower());

            if (WebPath.Exists(p))
            {
                return(WebPath.GetPath(p));
            }

            p = path.ToLower().Replace("<theme_folder>", DefaultSkin.FolderName.ToLower());
            return(WebPath.GetPath(p));
        }
Example #11
0
        public void IsDirectoryRelative()
        {
            const string appRelativeUrl = "~/images/image.jpg";
            const string dirRelativeUrl = "images/image.jpg";
            const string absoluteUrl    = "/images/image.jpg";
            const string fullUrl        = "http://www.google.com/images/image.jpg";

            Assert.IsTrue(WebPath.IsDirectoryRelative(dirRelativeUrl));

            Assert.IsFalse(WebPath.IsDirectoryRelative(absoluteUrl));
            Assert.IsFalse(WebPath.IsDirectoryRelative(appRelativeUrl));
            Assert.IsFalse(WebPath.IsDirectoryRelative(fullUrl));
        }
        private static LocalizedTextServiceFileSources CreateLocalizedTextServiceFileSourcesFactory(IServiceProvider container)
        {
            var hostingEnvironment = container.GetRequiredService <IHostingEnvironment>();
            var subPath            = WebPath.Combine(Constants.SystemDirectories.Umbraco, "config", "lang");
            var mainLangFolder     = new DirectoryInfo(hostingEnvironment.MapPathContentRoot(subPath));

            return(new LocalizedTextServiceFileSources(
                       container.GetRequiredService <ILogger <LocalizedTextServiceFileSources> >(),
                       container.GetRequiredService <AppCaches>(),
                       mainLangFolder,
                       container.GetServices <LocalizedTextServiceSupplementaryFileSource>(),
                       new EmbeddedFileProvider(typeof(IAssemblyProvider).Assembly, "Umbraco.Cms.Core.EmbeddedResources.Lang").GetDirectoryContents(string.Empty)));
        }
Example #13
0
        public void GetLeafNameRoot()
        {
            string result = WebPath.GetLeafName(Path1);

            Assert.IsNotNull(result, Path1 + " returns null");
            Assert.IsTrue(result.Length == 0, Path1 + " should return zero length.");
            Assert.AreEqual(string.Empty, result);

            result = WebPath.GetLeafName(Path2);
            Assert.IsNotNull(result, Path2 + " returns null");
            Assert.IsTrue(result.Length == 0, Path2 + " should return zero length.");
            Assert.AreEqual(string.Empty, result);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SoundPath = WebPath.GetPath("usercontrols/common/smallchat/css/sounds/chat");

            Page.RegisterStyle("~/usercontrols/common/smallchat/css/smallchat.css",
                               "~/usercontrols/common/smallchat/css/jquery.cssemoticons.css");

            Page.RegisterBodyScripts("~/js/third-party/jquery/jquery.linkify.js",
                                     "~/js/third-party/jquery/noty/jquery.noty.js",
                                     "~/js/third-party/jquery/jquery.cssemoticons.js",
                                     "~/js/third-party/jquery/jquery.autosize.js",
                                     "~/usercontrols/common/smallchat/js/smallchat.js");
        }
Example #15
0
        public void GetLeafNameDirectory()
        {
            string result = WebPath.GetLeafName(Path7);

            Assert.IsNotNull(result, Path7 + " returns null");
            Assert.IsTrue(result.Length > 0, Path7 + " returns zero length.");
            Assert.AreEqual(@"webdirectory9", result);

            result = WebPath.GetLeafName(Path8);
            Assert.IsNotNull(result, Path8 + " returns null");
            Assert.IsTrue(result.Length > 0, Path8 + " returns zero length.");
            Assert.AreEqual(@"webdirectory9", result);
        }
Example #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.RegisterBodyScripts(ResolveUrl("~/usercontrols/management/loginhistory/js/loginhistory.js"));
            Page.RegisterStyleControl(VirtualPathUtility.ToAbsolute("~/usercontrols/management/loginhistory/css/loginhistory.less"));

            var emptyScreenControl = new EmptyScreenControl
            {
                ImgSrc   = WebPath.GetPath("usercontrols/management/loginhistory/img/login_history_empty_screen.jpg"),
                Header   = AuditResource.LoginHistoryEmptyScreenHeader,
                Describe = AuditResource.LoginHistoryEmptyScreenDscr
            };

            emptyScreenHolder.Controls.Add(emptyScreenControl);
        }
Example #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            TariffPageLink = TenantExtra.GetTariffPageLink();
            Page.RegisterBodyScripts("~/UserControls/Management/AuditTrail/js/audittrail.js")
                .RegisterStyle("~/UserControls/Management/AuditTrail/css/audittrail.less");

            var emptyScreenControl = new EmptyScreenControl
            {
                ImgSrc = WebPath.GetPath("UserControls/Management/AuditTrail/img/audit_trail_empty_screen.jpg"),
                Header = AuditResource.AuditTrailEmptyScreenHeader,
                Describe = AuditResource.AuditTrailEmptyScreenDscr
            };
            emptyScreenHolder.Controls.Add(emptyScreenControl);
        }
Example #18
0
        public override async Task PerformExecuteAsync(object state)
        {
            if (_keepAliveSettings.DisableKeepAliveTask)
            {
                return;
            }

            // Don't run on replicas nor unknown role servers
            switch (_serverRegistrar.CurrentServerRole)
            {
            case ServerRole.Subscriber:
                _logger.LogDebug("Does not run on subscriber servers.");
                return;

            case ServerRole.Unknown:
                _logger.LogDebug("Does not run on servers with unknown role.");
                return;
            }

            // Ensure we do not run if not main domain, but do NOT lock it
            if (_mainDom.IsMainDom == false)
            {
                _logger.LogDebug("Does not run if not MainDom.");
                return;
            }

            using (_profilingLogger.DebugDuration <KeepAlive>("Keep alive executing", "Keep alive complete"))
            {
                var umbracoAppUrl = _hostingEnvironment.ApplicationMainUrl?.ToString();
                if (umbracoAppUrl.IsNullOrWhiteSpace())
                {
                    _logger.LogWarning("No umbracoApplicationUrl for service (yet), skip.");
                    return;
                }

                // If the config is an absolute path, just use it
                string keepAlivePingUrl = WebPath.Combine(umbracoAppUrl, _hostingEnvironment.ToAbsolute(_keepAliveSettings.KeepAlivePingUrl));

                try
                {
                    var        request    = new HttpRequestMessage(HttpMethod.Get, keepAlivePingUrl);
                    HttpClient httpClient = _httpClientFactory.CreateClient(Constants.HttpClients.IgnoreCertificateErrors);
                    _ = await httpClient.SendAsync(request);
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, "Keep alive failed (at '{keepAlivePingUrl}').", keepAlivePingUrl);
                }
            }
        }
Example #19
0
 protected void RegisterClientScript()
 {
     Page.ClientScript.RegisterClientScriptInclude(typeof(Reports), "flotlib_script",
                                                   WebPath.GetPath("products/crm/controls/reports/jquery.flot.js"));
     Page.ClientScript.RegisterClientScriptBlock(typeof(Reports), "reports_full_screen",
                                                 @"<style type=""text/css"">
             .mainPageLayout {
                 margin: 0px 20px;
                 text-align: left;  
                 width:auto;  
             }
             #studioPageContent{padding-bottom:0px;}
             #studio_sidePanelUpHeight20{display:none;}                    
             </style>", false);
 }
Example #20
0
 public static String GetFileStaticRelativePath(String fileName)
 {
     if (fileName.EndsWith(".js"))
     {
         return(WebPath.GetPath("/products/files/js/" + fileName).ToLowerInvariant());
     }
     if (fileName.EndsWith(".ascx"))
     {
         return(VirtualPathUtility.ToAbsolute("~/products/files/controls/" + fileName).ToLowerInvariant());
     }
     if (fileName.EndsWith(".css"))
     {
         return(WebSkin.GetUserSkin().GetAbsoluteWebPath("/products/files/app_themes/<theme_folder>/" + fileName).ToLowerInvariant());
     }
     return(fileName);
 }
Example #21
0
 /// <summary>
 /// WEB工具栏按钮:一键复制外链
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void BtnLinkWeb_click(object sender, EventArgs e)
 {
     if (ListViewWeb.SelectedItems[0].Text.Contains(".") && ListViewWeb.SelectedItems[0].Text.Substring(ListViewWeb.SelectedItems[0].Text.LastIndexOf(".")).Length == 4)
     {
         string CopyLink = "";
         if (userInformation.Url.Substring(userInformation.Url.Length - 1).Equals("/"))
         {
             CopyLink = userInformation.Url + WebPath.Substring(1) + ListViewWeb.SelectedItems[0].Text;
         }
         else
         {
             CopyLink = userInformation.Url + "/" + WebPath.Substring(1) + ListViewWeb.SelectedItems[0].Text;
         }
         Clipboard.SetDataObject(CopyLink);
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!SetupInfo.IsVisibleSettings(ManagementType.SmtpSettings.ToString()))
            {
                Response.Redirect(CommonLinkUtility.GetDefault(), true);
                return;
            }

            AjaxPro.Utility.RegisterTypeForAjax(GetType(), Page);
            Page.RegisterBodyScripts(ResolveUrl, "~/UserControls/Management/SmtpSettings/js/smtpsettings.js");
            Page.ClientScript.RegisterClientScriptBlock(GetType(),
                                                        "smtpsettings_style",
                                                        string.Format("<link rel=\"stylesheet\" type=\"text/css\" href=\"{0}\">",
                                                                      WebPath.GetPath("UserControls/Management/SmtpSettings/css/smtpsettings.css")), false);
            Page.RegisterInlineScript(GetSmtpSettingsInitInlineScript(), true, false);
        }
Example #23
0
        protected override IEnumerable <KeyValuePair <string, object> > GetClientVariables(HttpContext context)
        {
            var config = new TalkConfiguration();

            return(new List <KeyValuePair <string, object> >(2)
            {
                RegisterObject(new
                {
                    Icons = new
                    {
                        addonIcon16 = WebImageSupplier.GetAbsoluteWebPath("talk16.png", TalkAddon.AddonID),
                        addonIcon32 = WebImageSupplier.GetAbsoluteWebPath("talk32.png", TalkAddon.AddonID),
                        addonIcon48 = WebImageSupplier.GetAbsoluteWebPath("talk48.png", TalkAddon.AddonID),
                        addonIcon128 = WebImageSupplier.GetAbsoluteWebPath("talk128.png", TalkAddon.AddonID),
                        iconNewMessage = WebImageSupplier.GetAbsoluteWebPath("icon-new-message.ico", TalkAddon.AddonID)
                    }
                }),
                RegisterObject(new
                {
                    Config = new
                    {
                        validSymbols = config.ValidSymbols ?? "",
                        historyLength = config.HistoryLength ?? "",
                        boshUri = config.BoshUri,
                        jabberAccount = GetJabberAccount(),
                        resourcePriority = config.ResourcePriority,
                        clientInactivity = config.ClientInactivity,
                        addonID = TalkAddon.AddonID,
                        enabledMassend = config.EnabledMassend.ToString().ToLower(),
                        enabledConferences = config.EnabledConferences.ToString().ToLower(),
                        requestTransportType = config.RequestTransportType ?? string.Empty,
                        fileTransportType = config.FileTransportType ?? string.Empty,
                        maxUploadSize = SetupInfo.MaxImageUploadSize,
                        sounds = WebPath.GetPath("/addons/talk/swf/sounds.swf"),
                        soundsHtml = new List <string>()
                        {
                            WebPath.GetPath("/addons/talk/swf/startupsound.mp3"),
                            WebPath.GetPath("/addons/talk/swf/incmsgsound.mp3"),
                            WebPath.GetPath("/addons/talk/swf/letupsound.mp3"),
                            WebPath.GetPath("/addons/talk/swf/sndmsgsound.mp3"),
                            WebPath.GetPath("/addons/talk/swf/statussound.mp3")
                        },
                        fullText = FactoryIndexer <JabberWrapper> .CanSearchByContent()
                    }
                })
            });
        }
Example #24
0
        public static String GetFileStaticRelativePath(String fileName)
        {
            var ext = FileUtility.GetFileExtension(fileName);

            switch (ext)
            {
            case ".js":
                return(WebPath.GetPath("/products/files/js/" + fileName).ToLowerInvariant());

            case ".ascx":
                return(CommonLinkUtility.ToAbsolute("~/products/files/controls/" + fileName).ToLowerInvariant());

            case ".css":
                return(WebPath.GetPath("/products/files/app_themes/default/" + fileName).ToLowerInvariant());
            }
            return(fileName);
        }
Example #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("order_edit", "编辑订单"))
            {
                WindowNoPower();
            }
            int        id      = RequestTool.RequestInt("id", 0);
            int        orderid = RequestTool.RequestInt("orderid", 0);
            Lebi_Order order   = B_Lebi_Order.GetModel(orderid);

            if (order != null)
            {
                order.KeyCode = GetMd5Str(order.Code);
                B_Lebi_Order.Update(order);
            }
            QuickPayURL = "http://" + RequestTool.GetRequestDomain() + WebPath.TrimEnd('/') + "/OrderQuickPay/?k=" + order.KeyCode;
        }
 public static string GetFileStaticRelativePath(String fileName)
 {
     var ext = FileUtility.GetFileExtension(fileName);
     switch (ext)
     {
         case ".js":
             return VirtualPathUtility.ToAbsolute("~/Products/Projects/js/" + fileName);
         case ".png":
             return WebPath.GetPath("/Products/Projects/App_Themes/Default/images/" + fileName);
         case ".ascx":
             return CommonLinkUtility.ToAbsolute("~/Products/Projects/Controls/" + fileName);
         case ".css":
         case ".less":
             return VirtualPathUtility.ToAbsolute("~/Products/Projects/App_Themes/default/css/" + fileName);
     }
     return fileName;
 }
Example #27
0
        public void Combine()
        {
            string result = WebPath.Combine(Path1, Path2);

            Assert.IsNotNull(result);
            Assert.IsTrue(result.Length > 0);
            Assert.AreEqual(@"/webdirectory1/webdirectory2/", result);

            result = WebPath.Combine(Path2, Path3);
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Length > 0);
            Assert.AreEqual(@"/webdirectory2/webdirectory3/webpage1.aspx", result);

            result = WebPath.Combine(Path2, Path5);
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Length > 0);
            Assert.AreEqual(@"/webdirectory2/webdirectory6/webdirectory7/webpage1.aspx", result);
        }
        public void Is_Built_Correctly()
        {
            // Arrange
            var          testPath    = WebPath.PathSeparator + WebPath.Combine("css", "styles.css");
            const string testContent = @"body { color:#000; } .bold {font-weight:bold;}";

            var builder = new StylesheetBuilder();

            // Act
            Stylesheet stylesheet = builder
                                    .WithPath(testPath)
                                    .WithContent(testContent)
                                    .Build();

            // Assert
            Assert.AreEqual(Path.DirectorySeparatorChar + Path.Combine("css", "styles.css"), stylesheet.Path);
            Assert.AreEqual(testContent, stylesheet.Content);
        }
Example #29
0
        public void GetLeafNameFile()
        {
            string result = WebPath.GetLeafName(Path6);

            Assert.IsNotNull(result, Path6 + " returns null");
            Assert.IsTrue(result.Length > 0, Path6 + " returns zero length.");
            Assert.AreEqual(@"webpage1.aspx", result);

            result = WebPath.GetLeafName(Path11);
            Assert.IsNotNull(result, Path11 + " returns null");
            Assert.IsTrue(result.Length > 0, Path11 + " returns zero length.");
            Assert.AreEqual(@"webpage1.aspx", result);

            result = WebPath.GetLeafName(Path3);
            Assert.IsNotNull(result, Path3 + " returns null");
            Assert.IsTrue(result.Length > 0, Path3 + " returns zero length.");
            Assert.AreEqual(@"webpage1.aspx", result);
        }
Example #30
0
        public void GetExtension()
        {
            string[] mp3Files =
            {
                "files/sample.mp3",
                "/files/sample.mp3",
                "sample.mp3",
                "files/samples/sample.mp3",
                "/files/samples/sample.mp3"
            };

            foreach (string file in mp3Files)
            {
                string result = WebPath.GetExtension(file);
                Assert.IsNotNull(result, "Result should not be null.");
                Assert.AreEqual(4, result.Length, "Extension should be four characters in length.");
                Assert.AreEqual(".mp3", result, "Extension should be .mp3.");
            }
        }