Example #1
0
        public static IHtmlString PageUrl(this IFrontUrlHelper frontUrlHelper, string urlMapKey, object values)
        {
            Page page;

            return(PageUrl(frontUrlHelper, urlMapKey, values, out page));
        }
Example #2
0
        public static IHtmlString PageUrl(this IFrontUrlHelper frontUrlHelper, string urlMapKey, object values, out Page page)
        {
            var url = frontUrlHelper.GeneratePageUrl(urlMapKey, values, (site, key) => null, out page);

            return(url);
        }
 /// <summary>
 /// Resizes the image URL.
 /// </summary>
 /// <param name="imagePath">The image path.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="preserverAspectRatio">The preserver aspect ratio.</param>
 /// <param name="quality">The quality.</param>
 /// <returns></returns>
 public static IHtmlString ResizeImageUrl(this IFrontUrlHelper frontUrl, string imagePath, int width, int height, bool?preserverAspectRatio, int?quality)
 {
     return(frontUrl.ResourceCDNUrl(frontUrl.WrapperUrl(frontUrl.Url.Action("ResizeImage", "Resource",
                                                                            new { siteName = frontUrl.Site.AbsoluteName, url = imagePath, area = "", width = width, height = height, preserverAspectRatio = preserverAspectRatio, quality = quality })).ToString()));
 }
Example #4
0
 public static IHtmlString PageUrl(this IFrontUrlHelper frontUrlHelper, string urlMapKey)
 {
     return(PageUrl(frontUrlHelper, urlMapKey, null));
 }
Example #5
0
        /// <summary>
        /// the site theme URL.
        /// </summary>
        /// <retu+rns></returns>
        public static IHtmlString SiteThemeUrl(this IFrontUrlHelper frontUrl, string baseUri, string themeName)
        {
            var site = frontUrl.Site;

            return(new HtmlString(UrlUtility.ToHttpAbsolute(baseUri, frontUrl.Url.Action("theme", "Resource", new { siteName = site.AbsoluteName, name = themeName, version = site.GetVersionUsedInUrl(), area = "" })).ToString()));
        }
 /// <summary>
 /// Resizes the image URL.
 /// </summary>
 /// <param name="imagePath">The image path.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <returns></returns>
 public static IHtmlString ResizeImageUrl(this IFrontUrlHelper frontUrl, string imagePath, int width, int height)
 {
     return(ResizeImageUrl(frontUrl, imagePath, width, height, null, null));
 }
Example #7
0
        /// <summary>
        /// Sites the theme URL.
        /// </summary>
        /// <returns></returns>
        public static IHtmlString SiteThemeUrl(this IFrontUrlHelper frontUrl)
        {
            var site = frontUrl.Site;

            return(SiteThemeUrl(frontUrl, site.ResourceDomain, site.Theme));
        }
Example #8
0
        /// <summary>
        /// The URL for combined site scripts.
        /// </summary>
        /// <param name="baseUri">The base URI.</param>
        /// <param name="compressed">if set to <c>true</c> [compressed].</param>
        /// <returns></returns>
        public static IHtmlString SiteScriptsUrl(this IFrontUrlHelper frontUrl, string baseUri, string folder, bool compressed)
        {
            var site = frontUrl.Site;

            return(new HtmlString(UrlUtility.ToHttpAbsolute(baseUri, frontUrl.Url.Action("scripts", "Resource", new { siteName = site.AbsoluteName, version = site.GetVersionUsedInUrl(), area = "", compressed, name = folder }))));
        }
Example #9
0
 /// <summary>
 /// The URL for combined site scripts.
 /// </summary>
 /// <param name="baseUri">The base URI.</param>
 /// <returns></returns>
 public static IHtmlString SiteScriptsUrl(this IFrontUrlHelper frontUrl, string baseUri)
 {
     return(SiteScriptsUrl(frontUrl, baseUri, "", true));
 }
Example #10
0
 /// <summary>
 /// The URL for combined site scripts.
 /// </summary>
 /// <returns></returns>
 public static IHtmlString SiteScriptsUrl(this IFrontUrlHelper frontUrl)
 {
     return(SiteScriptsUrl(frontUrl, frontUrl.Site.ResourceDomain));
 }
Example #11
0
        ///// <summary>
        ///// the file URL under the theme of current site.
        ///// </summary>
        ///// <param name="relativeUrl">The relative URL.<example>images/logo.png</example></param>
        ///// <returns></returns>
        //public virtual IHtmlString ThemeFileUrl(this IFrontUrlHelper frontUrl, string relativeUrl)
        //{
        //    var site = frontUrl.Site;
        //    IHtmlString url = new HtmlString("");
        //    if (!string.IsNullOrEmpty(site.Name))
        //    {
        //        var fileExists = false;
        //        var themeFileUrl = "";
        //        do
        //        {
        //            site = site.AsActual();

        //            Theme theme = new Theme(site, site.Theme).LastVersion();
        //            themeFileUrl = Kooboo.Common.Web.UrlUtility.Combine(theme.VirtualPath, relativeUrl);
        //            var physicalPath = UrlUtility.MapPath(themeFileUrl);
        //            fileExists = File.Exists(physicalPath);

        //            site = theme.Site.Parent;
        //        } while (site != null && !fileExists);

        //        url = ResourceCDNUrl(themeFileUrl);
        //    }

        //    return url;

        //}

        /// <summary>
        /// Resources the URL. Using the ResourceDomain to generate the resource absolute url.
        /// </summary>
        /// <param name="relativeUrl">The relative URL.</param>
        /// <returns></returns>
        public static IHtmlString ResourceCDNUrl(this IFrontUrlHelper frontUrl, string relativeUrl)
        {
            string resourceDomain = frontUrl.Site.ResourceDomain;

            return(new HtmlString(UrlUtility.ToHttpAbsolute(resourceDomain, relativeUrl)));
        }