コード例 #1
0
  /**
 * @param messageBundleFactory Used for injecting message bundles into gadget output.
 */
  public RenderingContentRewriter()
  {
      messageBundleFactory = DefaultMessageBundleFactory.Instance;
      containerConfig = JsonContainerConfig.Instance;
      featureRegistry = GadgetFeatureRegistry.Instance;
      urlGenerator = DefaultUrlGenerator.Instance;
  }
コード例 #2
0
ファイル: BundlesHelper.cs プロジェクト: jlopresti/cassette
 public BundlesHelper_Tests()
 {
     settings = new CassetteSettings();
     bundles = new BundleCollection(settings, Mock.Of<IFileSearchProvider>(), Mock.Of<IBundleFactoryProvider>(), Mock.Of<IBundleCollectionInitializer>());
     referenceBuilder = new Mock<IReferenceBuilder>();
     var urlModifier = new VirtualDirectoryPrepender("/");
     var urlGenerator = new UrlGenerator(urlModifier, new FakeFileSystem(), "cassette.axd/");
     helper = new BundlesHelper(bundles, settings, urlGenerator, () => referenceBuilder.Object, Mock.Of<IFileAccessAuthorization>(), Mock.Of<IBundleCacheRebuilder>(), new SimpleJsonSerializer());
 }
コード例 #3
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
        public void InsertsAssetSourceFilenameWithBackSlashesConvertedToForwardSlashes()
        {
            var asset = new Mock<IAsset>();
            asset.SetupGet(a => a.SourceFilename).Returns("~/test/sub/asset.js");
            var app = new UrlGenerator("/");

            var url = app.CreateAssetUrl(asset.Object);

            url.ShouldStartWith("/test/sub/asset.js");
        }
コード例 #4
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
        public void AppendsHashHexString()
        {
            var asset = new Mock<IAsset>();
            asset.SetupGet(a => a.SourceFilename).Returns("~/test/sub/asset.js");
            asset.SetupGet(a => a.Hash).Returns(new byte[] { 1, 2, 15, 16 });
            var app = new UrlGenerator("/");

            var url = app.CreateAssetUrl(asset.Object);

            url.ShouldEqual("/test/sub/asset.js?01020f10");
        }
コード例 #5
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
        public void CreateAssetCompileUrlReturnsCompileUrl()
        {
            var module = new Module("~/test");
            var asset = new Mock<IAsset>();
            asset.SetupGet(a => a.SourceFilename).Returns("~/test/asset.coffee");
            asset.SetupGet(a => a.Hash).Returns(new byte[] { 1, 2, 15, 16 });
            var app = new UrlGenerator("/");

            var url = app.CreateAssetCompileUrl(module, asset.Object);

            url.ShouldEqual("/_assets/get/test/asset.coffee?01020f10");
        }
コード例 #6
0
        public static TreeView CreateTreeView(HtmlTextWriter writer, ITreeViewHtmlBuilder renderer, IClientSideObjectWriter clientSideObjectWriter)
        {
            Mock<HttpContextBase> httpContext = TestHelper.CreateMockedHttpContext();

            if (writer != null)
            {
                httpContext.Setup(c => c.Request.Browser.CreateHtmlTextWriter(It.IsAny<TextWriter>())).Returns(writer);
            }

            urlGenerator = new UrlGenerator();
            authorization = new Mock<INavigationItemAuthorization>();

            Mock<ITreeViewHtmlBuilderFactory> TreeViewRendererFactory = new Mock<ITreeViewHtmlBuilderFactory>();

            Mock<IViewDataContainer> viewDataContainer = new Mock<IViewDataContainer>();

            var viewDataDinctionary = new ViewDataDictionary();
            viewDataDinctionary.Add("sample", TestHelper.CreateXmlSiteMap());

            viewDataContainer.SetupGet(container => container.ViewData).Returns(viewDataDinctionary);

            // needed for testing serialization
            Mock<IClientSideObjectWriterFactory> clientSideObjectWriterFactory = new Mock<IClientSideObjectWriterFactory>();

            viewContext = TestHelper.CreateViewContext();
            viewContext.ViewData = viewDataDinctionary;

            clientSideObjectWriterFactory.Setup(c => c.Create(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<TextWriter>())).Returns(clientSideObjectWriter);

            viewContext = TestHelper.CreateViewContext();
            viewContext.ViewData = viewDataDinctionary;

            authorization.Setup(a => a.IsAccessibleToUser(viewContext.RequestContext, It.IsAny<INavigatable>())).Returns(true);

            TreeView TreeView = new TreeView(viewContext, clientSideObjectWriterFactory.Object, urlGenerator, authorization.Object, TreeViewRendererFactory.Object);

            renderer = renderer ?? new TreeViewHtmlBuilder(TreeView, new Mock<IActionMethodCache>().Object);
            TreeViewRendererFactory.Setup(f => f.Create(It.IsAny<TreeView>())).Returns(renderer);

            return TreeView;
        }
コード例 #7
0
ファイル: UrlGeneratorTests.cs プロジェクト: Squidex/hosting
        public void Should_build_url_from_options_with_base_path(string url)
        {
            var sut = new UrlGenerator(Options.Create(new UrlOptions
            {
                BaseUrl  = url,
                BasePath = "base"
            }));

            Assert.Equal("http://squidex.io/base", sut.BuildUrl());

            Assert.Equal("http://squidex.io/base", sut.BuildUrl("/", false));
            Assert.Equal("http://squidex.io/base", sut.BuildCallbackUrl("/", false));

            Assert.Equal("http://squidex.io/base/", sut.BuildUrl("/", true));
            Assert.Equal("http://squidex.io/base/", sut.BuildCallbackUrl("/", true));

            Assert.Equal("http://squidex.io/base/path", sut.BuildUrl("/path", false));
            Assert.Equal("http://squidex.io/base/path", sut.BuildUrl("/path/", false));

            Assert.Equal("http://squidex.io/base/path/", sut.BuildUrl("/path", true));
            Assert.Equal("http://squidex.io/base/path/", sut.BuildUrl("/path/", true));
        }
コード例 #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _LinkId = AbleCommerce.Code.PageHelper.GetLinkId();
     _Link   = LinkDataSource.Load(_LinkId);
     if (_Link != null)
     {
         string durl = "~/Admin/Catalog/EditLink.aspx?LinkId={0}";
         durl = string.Format(durl, _LinkId);
         string murl = "~/Admin/Catalog/EditLinkCategories.aspx?LinkId={0}";
         murl = string.Format(murl, _LinkId);
         LinkDetails.NavigateUrl      = durl;
         ManageCategories.NavigateUrl = murl;
         string confirmationJS = String.Format("return confirm('Are you sure you want to delete \\'{0}\\'?');", _Link.Name);
         DeleteLink.Attributes.Add("onclick", confirmationJS);
         Preview.NavigateUrl = UrlGenerator.GetBrowseUrl(AbleCommerce.Code.PageHelper.GetCategoryId(), _LinkId, CatalogNodeType.Link, _Link.Name);
         HighlightMenu();
     }
     else
     {
         this.Controls.Clear();
     }
 }
コード例 #9
0
        public static Menu CreateMenu(HtmlTextWriter writer, INavigationComponentHtmlBuilder <MenuItem> renderer)
        {
            Mock <HttpContextBase> httpContext = TestHelper.CreateMockedHttpContext();

            if (writer != null)
            {
                httpContext.Setup(c => c.Request.Browser.CreateHtmlTextWriter(It.IsAny <TextWriter>())).Returns(writer);
            }

            Mock <INavigationComponentHtmlBuilderFactory <Menu, MenuItem> > menuRendererFactory = new Mock <INavigationComponentHtmlBuilderFactory <Menu, MenuItem> >();

            Mock <IViewDataContainer> viewDataContainer = new Mock <IViewDataContainer>();
            var viewDataDinctionary = new ViewDataDictionary();

            viewDataDinctionary.Add("sample", TestHelper.CreateXmlSiteMap());

            viewDataContainer.SetupGet(container => container.ViewData).Returns(viewDataDinctionary);

            // needed for testing serialization
            Mock <ClientSideObjectWriterFactory> clientSideObjectWriterFactory = new Mock <ClientSideObjectWriterFactory>();

            UrlGenerator urlGeneratorObject = new UrlGenerator();
            Mock <INavigationItemAuthorization> authorization = new Mock <INavigationItemAuthorization>();

            TestHelper.RegisterDummyRoutes();

            ViewContext viewContext = TestHelper.CreateViewContext();

            viewContext.ViewData = viewDataDinctionary;

            authorization.Setup(a => a.IsAccessibleToUser(viewContext.RequestContext, It.IsAny <INavigatable>())).Returns(true);

            Menu menu = new Menu(viewContext, clientSideObjectWriterFactory.Object, urlGeneratorObject, authorization.Object, menuRendererFactory.Object);

            renderer = renderer ?? new MenuHtmlBuilder(menu, new Mock <IActionMethodCache>().Object);
            menuRendererFactory.Setup(f => f.Create(It.IsAny <Menu>())).Returns(renderer);

            return(menu);
        }
コード例 #10
0
        public static PdfPage ConvertToDL8(this PdfPage page, UrlGenerator generator, int offset, string functionDirectory)
        {
            var type             = LabelTypes.DL8;
            var width            = 270;
            var height           = 182;
            var logoWidth        = 140;
            var logoOffsetLeft   = 35;
            var logoOffsetTop    = 160;
            var marginTop        = 41;
            var marginLeft       = 18;
            var marginRight      = 18;
            var marginBottom     = 10;
            var qrCodeSize       = 178;
            var qrCodeImageSize  = 500;
            var qrCodeOffsetTop  = 190;
            var qrCodeOffsetLeft = 80;

            gfx = XGraphics.FromPdfPage(page);

            var pen = new XPen(XColors.Black);

            var rectangles = GetRectangles(width, height, (int)type, marginTop, marginBottom, marginLeft, marginRight);

            gfx.DrawRectangles(pen, rectangles.ToArray());

            var totalSquaresAvailable = rectangles.Count;
            var numberOfSquresToPrint = generator.ToUri().Count;

            for (var i = 0; i < numberOfSquresToPrint; i++)
            {
                var squareToPrint = (offset + i) % totalSquaresAvailable;

                DrawQrCode(qrCodeImageSize, qrCodeSize, qrCodeOffsetLeft, qrCodeOffsetTop, rectangles[squareToPrint], generator.ToUri()[i], functionDirectory + iconPath);
                DrawImage(rectangles[squareToPrint], logoWidth, logoOffsetLeft, logoOffsetTop, functionDirectory + LogoImagePath);
            }

            return(page);
        }
コード例 #11
0
        public List <Post> GetPosts(string basePath)
        {
            var postList     = new List <Post>();
            var deserializer = new PostDeserializer();
            var files        = Directory.GetFiles(basePath, "*.yml").ToList();

            files.ForEach(file =>
            {
                var fileContent = GetFileContent(file);
                try
                {
                    var instance     = deserializer.Serialize(fileContent);
                    instance.PostUrl = UrlGenerator.UrlFriendly(Path.GetFileNameWithoutExtension(file));
                    postList.Add(instance);
                }
                // ReSharper disable EmptyGeneralCatchClause
                catch (Exception)
                // ReSharper restore EmptyGeneralCatchClause
                {
                }
            });
            return(postList);
        }
コード例 #12
0
        public void GetFromPageXkcd()
        {
            var xkcdUrl    = "http://xkcd.com/614";
            var xkcdParser = new ComicParser(xkcdUrl);
            var xkcdImg    = "http://imgs.xkcd.com/comics/woodpecker.png";
            var xkcdImg2   = "http://imgs.xkcd.com/comics/avoidance.png";

            // get the generator object
            UrlGenerator urlGen = xkcdParser.GetUrlGenerator();

            Assert.AreEqual("1", urlGen.Start);

            // generate 10 urls, starting from 605
            List <string> backUrls = urlGen.Get(605, 10);
            // generate 10 urls, starting from 615
            List <string> forwardUrls = urlGen.Get(615, 10);
            // generate 10 urls, starting from 614
            List <string> incUrls = urlGen.Get(614, 10);

            // each url should be the comic, directly
            // urls are sorted

//			foreach (var x in backUrls) {
//				Console.WriteLine (x);
//			}

            // Seems like this is a legitimate fail...
            // backUrls[0] is actually comic 606, expected 605
            // further investigation required
            Assert.AreEqual(10, backUrls.Count());
            Assert.AreEqual(xkcdImg, backUrls [9]);
            Assert.AreEqual(10, forwardUrls.Count());
            Assert.AreEqual(xkcdImg2, forwardUrls [0]);
            Assert.AreEqual(10, incUrls.Count());
            Assert.AreEqual(xkcdImg, incUrls [0]);
            Assert.AreEqual(xkcdImg2, incUrls [1]);
        }
コード例 #13
0
        public static PanelBar CreatePanelbar(HtmlTextWriter writer, INavigationComponentHtmlBuilder<PanelBarItem> renderer)
        {
            Mock<HttpContextBase> httpContext = TestHelper.CreateMockedHttpContext();

            if (writer != null)
            {
               httpContext.Setup(c => c.Request.Browser.CreateHtmlTextWriter(It.IsAny<TextWriter>())).Returns(writer);
            }

            Mock<INavigationComponentHtmlBuilderFactory<PanelBar, PanelBarItem>> panelBarRendererFactory = new Mock<INavigationComponentHtmlBuilderFactory<PanelBar, PanelBarItem>>();

            Mock<IViewDataContainer> viewDataContainer = new Mock<IViewDataContainer>();
            var viewDataDinctionary = new ViewDataDictionary();
            viewDataDinctionary.Add("sample", TestHelper.CreateXmlSiteMap());

            viewDataContainer.SetupGet(container => container.ViewData).Returns(viewDataDinctionary);

            Mock<IClientSideObjectWriterFactory> clientSideObjectWriterFactory = new Mock<IClientSideObjectWriterFactory>();
            clientSideObjectWriter = new Mock<IClientSideObjectWriter>();
            IUrlGenerator urlGeneratorObject = new UrlGenerator();
            Mock<INavigationItemAuthorization> authorization = new Mock<INavigationItemAuthorization>();

            TestHelper.RegisterDummyRoutes();

            ViewContext viewContext = TestHelper.CreateViewContext();
            viewContext.ViewData = viewDataDinctionary;

            authorization.Setup(a => a.IsAccessibleToUser(viewContext.RequestContext, It.IsAny<INavigatable>())).Returns(true);
            clientSideObjectWriterFactory.Setup(c => c.Create(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<TextWriter>())).Returns(clientSideObjectWriter.Object);

            PanelBar panelBar = new PanelBar(viewContext, clientSideObjectWriterFactory.Object, urlGeneratorObject, authorization.Object, panelBarRendererFactory.Object);

            renderer = renderer ?? new PanelBarHtmlBuilder(panelBar, new Mock<IActionMethodCache>().Object);
            panelBarRendererFactory.Setup(f => f.Create(It.IsAny<PanelBar>())).Returns(renderer);

            return panelBar;
        }
コード例 #14
0
        public static Menu CreateMenu(HtmlTextWriter writer, INavigationComponentHtmlBuilder<MenuItem> renderer)
        {
            Mock<HttpContextBase> httpContext = TestHelper.CreateMockedHttpContext();

            if (writer != null)
            {
                httpContext.Setup(c => c.Request.Browser.CreateHtmlTextWriter(It.IsAny<TextWriter>())).Returns(writer);
            }

            Mock<INavigationComponentHtmlBuilderFactory<Menu, MenuItem>> menuRendererFactory = new Mock<INavigationComponentHtmlBuilderFactory<Menu, MenuItem>>();

            Mock<IViewDataContainer> viewDataContainer = new Mock<IViewDataContainer>();
            var viewDataDinctionary = new ViewDataDictionary();
            viewDataDinctionary.Add("sample", TestHelper.CreateXmlSiteMap());

            viewDataContainer.SetupGet(container => container.ViewData).Returns(viewDataDinctionary);

            // needed for testing serialization
            Mock<ClientSideObjectWriterFactory> clientSideObjectWriterFactory = new Mock<ClientSideObjectWriterFactory>();

            UrlGenerator urlGeneratorObject = new UrlGenerator();
            Mock<INavigationItemAuthorization> authorization = new Mock<INavigationItemAuthorization>();

            TestHelper.RegisterDummyRoutes();

            ViewContext viewContext = TestHelper.CreateViewContext();
            viewContext.ViewData = viewDataDinctionary;

            authorization.Setup(a => a.IsAccessibleToUser(viewContext.RequestContext, It.IsAny<INavigatable>())).Returns(true);

            Menu menu = new Menu(viewContext, clientSideObjectWriterFactory.Object, urlGeneratorObject, authorization.Object, menuRendererFactory.Object);

            renderer = renderer ?? new MenuHtmlBuilder(menu, new Mock<IActionMethodCache>().Object);
            menuRendererFactory.Setup(f => f.Create(It.IsAny<Menu>())).Returns(renderer);

            return menu;
        }
コード例 #15
0
        public IEnumerable <houseEntity> GetHouseList(string csrfToken)
        {
            var urls = new UrlGenerator().GetHouseListApiUrl();

            Helper.WriteMultipleLineLig("Request urls", urls.ToList(), log);
            IEnumerable <houseEntity> houseList = new List <houseEntity>();

            foreach (var url in urls)
            {
                try
                {
                    var response      = Get591Response(url, Method.POST, csrfToken).Content;
                    var houseResponse = JsonConvert.DeserializeObject <ResponseHouseEntity>(response);
                    var entity        = Convert591DataToEntity(houseResponse.data.data);
                    houseList = houseList.Concat(entity);
                }
                catch (Exception ex)
                {
                    log.Error("GetHouseList error. msg:" + ex.Message);
                }
            }

            return(houseList);
        }
コード例 #16
0
 protected override string GenerateDownloadUrl(Mirrors.MirrorConfiguration mirrorConfiguration)
 {
     return(UrlGenerator.GetFictionDownloadUrl(mirrorConfiguration, DetailsItem.Book));
 }
コード例 #17
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     PreviewButton.NavigateUrl  = UrlGenerator.GetBrowseUrl(_LinkId, CatalogNodeType.Link, _Link.Name);
     PreviewButton2.NavigateUrl = UrlGenerator.GetBrowseUrl(_LinkId, CatalogNodeType.Link, _Link.Name);
 }
コード例 #18
0
ファイル: GeneralTests.cs プロジェクト: wish-wish/skyheroes
 public static void Urlgenerator()
 {
     Assert.Equal(UrlGenerator.Generate(UrlType.EewJson, DateTime.Parse("2017/03/19 22:13:47")), "http://www.kmoni.bosai.go.jp/new/webservice/hypo/eew/20170319221347.json");
 }
コード例 #19
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     PreviewButton.NavigateUrl  = UrlGenerator.GetBrowseUrl(_Category.Id, _Category.Name);
     PreviewButton1.NavigateUrl = PreviewButton.NavigateUrl;
 }
コード例 #20
0
ファイル: RawFileCopier.cs プロジェクト: yukine/cassette
 public RawFileCopier(string absoluteSourceDirectory, string outputDirectory)
 {
     this.absoluteSourceDirectory = absoluteSourceDirectory;
     urlGenerator = new UrlGenerator(new CombinePathWithUrl(outputDirectory), new FileSystemDirectory(absoluteSourceDirectory), "");
 }
コード例 #21
0
ファイル: EPRss.aspx.cs プロジェクト: macyst/Engage-Publish
        private void Page_Load(object sender, EventArgs e)
        {
            // PortalSettings ps = (PortalSettings)HttpContext.Current.Items["PortalSettings"];
            PortalSettings ps = Utility.GetPortalSettings(this.PortalId);

            this.Response.ContentType     = "text/xml";
            this.Response.ContentEncoding = Encoding.UTF8;

            var sw = new StringWriter(CultureInfo.InvariantCulture);
            var wr = new XmlTextWriter(sw);

            wr.WriteStartElement("rss");
            wr.WriteAttributeString("version", "2.0");
            wr.WriteAttributeString("xmlns:wfw", "http://wellformedweb.org/CommentAPI/");
            wr.WriteAttributeString("xmlns:slash", "http://purl.org/rss/1.0/modules/slash/");
            wr.WriteAttributeString("xmlns:dc", "http://purl.org/dc/elements/1.1/");
            wr.WriteAttributeString("xmlns:trackback", "http://madskills.com/public/xml/rss/module/trackback/");

            wr.WriteStartElement("channel");
            wr.WriteElementString("title", ps.PortalName);
            if (ps.PortalAlias.HTTPAlias.IndexOf("http://", StringComparison.OrdinalIgnoreCase) == -1)
            {
                wr.WriteElementString("link", "http://" + ps.PortalAlias.HTTPAlias);
            }
            else
            {
                wr.WriteElementString("link", ps.PortalAlias.HTTPAlias);
            }

            wr.WriteElementString("description", "RSS Feed for " + ps.PortalName);
            wr.WriteElementString("ttl", "120");

            // TODO: look into options for how to display the "Title" of the RSS feed
            var dt = new DataTable
            {
                Locale = CultureInfo.InvariantCulture
            };

            if (this.DisplayType == "ItemListing" || this.DisplayType == null)
            {
                dt = this.ItemId == -1
                         ? DataProvider.Instance().GetMostRecent(this.ItemTypeId, this.NumberOfItems, this.PortalId)
                         : DataProvider.Instance().GetMostRecentByCategoryId(this.ItemId, this.ItemTypeId, this.NumberOfItems, this.PortalId);
            }
            else if (this.DisplayType == "CategoryFeature")
            {
                DataSet ds = DataProvider.Instance().GetParentItems(this.ItemId, this.PortalId, this.RelationshipTypeId);
                dt = ds.Tables[0];
            }
            else if (this.DisplayType == "TagFeed")
            {
                if (this.AllowTags && this._tagQuery != null && this._tagQuery.Count > 0)
                {
                    string tagCacheKey = Utility.CacheKeyPublishTag + this.PortalId + this.ItemTypeId.ToString(CultureInfo.InvariantCulture) +
                                         this._qsTags;

                    // +"PageId";
                    dt = DataCache.GetCache(tagCacheKey) as DataTable;
                    if (dt == null)
                    {
                        // ToDo: we need to make getitemsfromtags use the numberofitems value
                        dt = Tag.GetItemsFromTags(this.PortalId, this._tagQuery);

                        // TODO: we should sort the tags
                        // TODO: should we set a 5 minute cache on RSS?
                        DataCache.SetCache(tagCacheKey, dt, DateTime.Now.AddMinutes(5));
                        Utility.AddCacheKey(tagCacheKey, this.PortalId);
                    }
                }
            }

            if (dt != null)
            {
                DataView dv = dt.DefaultView;
                if (dv.Table.Columns.IndexOf("dateColumn") > 0)
                {
                    dv.Table.Columns.Add("dateColumn", typeof(DateTime));
                    foreach (DataRowView dr in dv)
                    {
                        dr["dateColumn"] = Convert.ToDateTime(dr["startdate"]);
                    }

                    dv.Sort = " dateColumn desc ";
                }

                for (int i = 0; i < dv.Count; i++)
                {
                    // DataRow r = dt.Rows[i];
                    DataRow r = dv[i].Row;
                    wr.WriteStartElement("item");

                    //              wr.WriteElementString("slash:comments", objArticle.CommentCount.ToString());
                    // wr.WriteElementString("wfw:commentRss", "http://" & Request.Url.Host & Me.ResolveUrl("RssComments.aspx?TabID=" & m_tabID & "&ModuleID=" & m_moduleID & "&ArticleID=" & objArticle.ArticleID.ToString()).Replace(" ", "%20"));
                    // wr.WriteElementString("trackback:ping", "http://" & Request.Url.Host & Me.ResolveUrl("Tracking/Trackback.aspx?ArticleID=" & objArticle.ArticleID.ToString() & "&PortalID=" & _portalSettings.PortalId.ToString() & "&TabID=" & _portalSettings.ActiveTab.TabID.ToString()).Replace(" ", "%20"));
                    string title       = string.Empty,
                           description = string.Empty,
                           childItemId = string.Empty,
                           thumbnail   = string.Empty,
                           guid        = string.Empty,
                           author      = string.Empty;

                    DateTime startDate = DateTime.MinValue;

                    if (this.DisplayType == null || string.Equals(this.DisplayType, "ItemListing", StringComparison.OrdinalIgnoreCase) ||
                        string.Equals(this.DisplayType, "TagFeed", StringComparison.OrdinalIgnoreCase))
                    {
                        title       = r["ChildName"].ToString();
                        description = r["ChildDescription"].ToString();
                        childItemId = r["ChilditemId"].ToString();
                        guid        = r["itemVersionIdentifier"].ToString();
                        startDate   = (DateTime)r["StartDate"];
                        thumbnail   = r["Thumbnail"].ToString();
                        author      = r["Author"].ToString();

                        // UserController uc = new UserController();
                        // UserInfo ui = uc.GetUser(PortalId, Convert.ToInt32(r["AuthorUserId"].ToString()));
                        // if(ui!=null)
                        // author = ui.DisplayName;
                    }
                    else if (string.Equals(this.DisplayType, "CategoryFeature", StringComparison.OrdinalIgnoreCase))
                    {
                        title       = r["Name"].ToString();
                        description = r["Description"].ToString();
                        childItemId = r["itemId"].ToString();
                        guid        = r["itemVersionIdentifier"].ToString();
                        startDate   = (DateTime)r["StartDate"];
                        thumbnail   = r["Thumbnail"].ToString();
                        author      = r["Author"].ToString();

                        // UserController uc = new UserController();
                        // UserInfo ui = uc.GetUser(PortalId, Convert.ToInt32(r["AuthorUserId"].ToString()));
                        // if (ui != null)
                        // author = ui.DisplayName;
                    }

                    if (!Uri.IsWellFormedUriString(thumbnail, UriKind.Absolute) && thumbnail != string.Empty)
                    {
                        var thumnailLink = new Uri(this.Request.Url, ps.HomeDirectory + thumbnail);
                        thumbnail = thumnailLink.ToString();
                    }

                    wr.WriteElementString("title", title);

                    // if the item isn't disabled add the link
                    if (!Utility.IsDisabled(Convert.ToInt32(childItemId, CultureInfo.InvariantCulture), this.PortalId))
                    {
                        wr.WriteElementString("link", UrlGenerator.GetItemLinkUrl(childItemId, this.PortalSettings));
                    }

                    // wr.WriteElementString("description", Utility.StripTags(this.Server.HtmlDecode(description)));
                    description = Utility.ReplaceTokens(description);
                    wr.WriteElementString("description", this.Server.HtmlDecode(description));

                    // wr.WriteElementString("author", Utility.StripTags(this.Server.HtmlDecode(author)));
                    wr.WriteElementString("thumbnail", thumbnail);

                    wr.WriteElementString("dc:creator", author);

                    wr.WriteElementString("pubDate", startDate.ToUniversalTime().ToString("r", CultureInfo.InvariantCulture));

                    // file attachment enclosure
                    ItemVersionSetting attachmentSetting = ItemVersionSetting.GetItemVersionSetting(
                        Convert.ToInt32(r["ItemVersionId"].ToString()), "ArticleSettings", "ArticleAttachment", this.PortalId);
                    if (attachmentSetting != null)
                    {
                        if (attachmentSetting.PropertyValue.Length > 7)
                        {
                            var       fileManager = FileManager.Instance;
                            int       fileId      = Convert.ToInt32(attachmentSetting.PropertyValue.Substring(7));
                            IFileInfo fi          = fileManager.GetFile(fileId);
                            string    fileurl     = "http://" + this.PortalSettings.PortalAlias.HTTPAlias + this.PortalSettings.HomeDirectory + fi.Folder +
                                                    fi.FileName;
                            wr.WriteStartElement("enclosure");
                            wr.WriteAttributeString("url", fileurl);
                            wr.WriteAttributeString("length", fi.Size.ToString());
                            wr.WriteAttributeString("type", fi.ContentType);
                            wr.WriteEndElement();
                        }
                    }

                    wr.WriteStartElement("guid");

                    wr.WriteAttributeString("isPermaLink", "false");

                    wr.WriteString(guid);

                    // wr.WriteString(itemVersionId);
                    wr.WriteEndElement();

                    wr.WriteEndElement();
                }
            }

            wr.WriteEndElement();
            wr.WriteEndElement();
            this.Response.Write(sw.ToString());
        }
コード例 #22
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void GetModuleRouteUrl_InsertsConventionalStylesheetModuleName()
 {
     var app = new UrlGenerator("/");
     var url = app.GetModuleRouteUrl<StylesheetModule>();
     url.ShouldEqual("_assets/stylesheets/{*path}");
 }
コード例 #23
0
 protected override string GenerateDownloadUrl(Mirrors.MirrorConfiguration mirrorConfiguration, NonFictionBook book)
 {
     return(UrlGenerator.GetNonFictionDownloadUrl(mirrorConfiguration, book));
 }
コード例 #24
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void GetImageRouteUrl_ReturnsRouteUrlWithPathParameter()
 {
     var app = new UrlGenerator("/");
     var url = app.GetRawFileRouteUrl();
     url.ShouldEqual("_assets/file/{*path}");
 }
コード例 #25
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void GetModuleRouteUrl_InsertsConventionalHtmlTemplateModuleName()
 {
     var app = new UrlGenerator("/");
     var url = app.GetModuleRouteUrl<HtmlTemplateModule>();
     url.ShouldEqual("_assets/htmltemplates/{*path}");
 }
コード例 #26
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void UrlStartsWithApplicationVirtualDirectory()
 {
     var app = new UrlGenerator("/");
     var url = app.CreateModuleUrl(StubScriptModule("~/test"));
     url.ShouldStartWith("/");
 }
コード例 #27
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void Inserts_assetsPrefix()
 {
     var app = new UrlGenerator("/");
     var url = app.CreateModuleUrl(StubScriptModule("~/test"));
     url.ShouldStartWith("/_assets/");
 }
コード例 #28
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void InsertsModuleDirectoryWithBackSlashesConvertedToForwardSlashes()
 {
     var app = new UrlGenerator("/");
     var url = app.CreateModuleUrl(StubScriptModule("~\\test\\foo\\bar"));
     url.ShouldStartWith("/_assets/scripts/test/foo/bar");
 }
コード例 #29
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void InsertsLowercasedPluralisedStylesheetModuleTypeName()
 {
     var app = new UrlGenerator("/");
     var url = app.CreateModuleUrl(StubStylesheetModule("~/test"));
     url.ShouldStartWith("/_assets/stylesheets/");
 }
コード例 #30
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void ConvertsToForwardSlashes()
 {
     var generator = new UrlGenerator("/");
     var url = generator.CreateRawFileUrl("~\\test\\foo.png", "hash");
     url.ShouldEqual("/_assets/images/test/foo_hash_png");
 }
コード例 #31
0
 protected override string GenerateDownloadUrl(Mirrors.MirrorConfiguration mirrorConfiguration)
 {
     return(UrlGenerator.GetSciMagDownloadUrl(mirrorConfiguration, DetailsItem.Article));
 }
コード例 #32
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void ArgumentExceptionThrownWhenFilenameDoesNotStartWithTilde()
 {
     var generator = new UrlGenerator("/");
     Assert.Throws<ArgumentException>(delegate
     {
         generator.CreateRawFileUrl("fail.png", "hash");
     });
 }
コード例 #33
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void CreateImageUrlPrependsHandlerRoute()
 {
     var generator = new UrlGenerator("/");
     var url = generator.CreateRawFileUrl("~/test.png", "hash");
     url.ShouldStartWith("/_assets/images/");
 }
コード例 #34
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
        public void StartsWithApplicationVirtualDirectoryEndingInSlash()
        {
            var asset = new Mock<IAsset>();
            asset.SetupGet(a => a.SourceFilename).Returns("~/test/asset.js");
            var app = new UrlGenerator("/myapp");

            var url = app.CreateAssetUrl(asset.Object);

            url.ShouldStartWith("/myapp/");
        }
コード例 #35
0
        public static HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "api/generate")] HttpRequestMessage req, TraceWriter log)
        {
            if (IsAuthenticated)
            {
                auth = req.GetAuthInfoAsync(log).Result;
            }

            log.Info("Is Authenticated: " + IsAuthenticated);

            var queryTracked = req.GetQueryValue("tracked");

            var title = req.GetQueryValue("title");

            var queryLogo = req.GetQueryValue("logo");

            var queryLatitude = req.GetQueryValue("latitude");

            var queryLongitude = req.GetQueryValue("longitude");

            var queryWallToken = req.GetQueryValue("wallToken");

            var wallToken = DecryptWallToken(queryWallToken);

            var isTracked = Boolean.TryParse(queryTracked, out bool tracked);

            var logoParsed = Boolean.TryParse(queryTracked, out bool hasLogo);

            var isLatitude = double.TryParse(queryLatitude, out double latitude);

            var isLongitude = double.TryParse(queryLongitude, out double longitude);

            var isWallId = Guid.TryParse(wallToken, out Guid wallId);

            //There's no validation on the values
            if (!isTracked || !logoParsed || (!isLatitude && queryLatitude != null) || (!isLongitude && queryLongitude != null) || !isWallId)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }

            var wallPath = string.Format($"{wallId.ToString("N")}/wall");

            var wallblob = BlobStorage.GetBlob(Constants.BlobContainerNames.Wall, wallPath);

            var contents = new WallEntity(new Message {
                Text = Constants.Default.Wall.WelcomeMessage, Username = Constants.Default.Wall.User
            });

            var json = JsonConvert.SerializeObject(contents);

            wallblob.UploadText(json);

            var wall = new Walls(wallId.ToString("N"), latitude, longitude, title);

            TableStorage.Insert(Constants.TableNames.Walls, wall);

            var host = req.GetHost();

            var generator = new UrlGenerator(new Uri(host + path), 1);

            var uri = generator.ToUri().First();

            var bitmap = new QrCode().GenerateImage(uri, 50);

            var qrCodePath = string.Format($"{wallId.ToString("N")}/qrCode");

            var container = BlobStorage.GetContainer(Constants.BlobContainerNames.Wall);

            var qrCodeBlob = container.GetBlockBlobReference(qrCodePath);

            qrCodeBlob.Properties.ContentType = "image/jpeg";

            var ms = new MemoryStream();

            bitmap.Save(ms, ImageFormat.Jpeg);

            qrCodeBlob.UploadFromStream(ms);

            log.Info("Image uploaded to: " + qrCodeBlob.Uri.AbsoluteUri);

            if (tracked && IsAuthenticated)
            {
                var name   = auth.GetClaim(ClaimTypes.Name).Value;
                var nameId = auth.GetClaim(ClaimTypes.NameIdentifier).Value;
                var user   = new Users(name, nameId);
                TableStorage.Insert(Constants.TableNames.Users, user);

                var trackedWall = new Tracked(nameId, wallId.ToString("N"));
                TableStorage.Insert(Constants.TableNames.Tracked, trackedWall);
            }

            if (tracked)
            {
                return(req.CreateResponse(HttpStatusCode.OK, new { Created = DateTime.UtcNow, WallId = wallId.ToString("N") }));
            }
            else
            {
                return(req.CreateResponse(HttpStatusCode.OK, new { Created = DateTime.UtcNow }));
            }
        }
コード例 #36
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
        public void InsertsModuleDirectory()
        {
            var asset = new Mock<IAsset>();
            asset.SetupGet(a => a.SourceFilename).Returns("~/test/asset.js");
            var app = new UrlGenerator("/myapp");

            var url = app.CreateAssetUrl(asset.Object);

            url.ShouldStartWith("/myapp/test/");
        }
コード例 #37
0
 protected static string BuildEditUrl(int itemId, int tabId, int moduleId, int portalId)
 {
     return(UrlGenerator.BuildEditUrl(itemId, tabId, moduleId, portalId));
 }
コード例 #38
0
        public UrlGeneratorTests()
        {
            TestHelper.RegisterDummyRoutes();

            _urlGenerator = new UrlGenerator();
        }
コード例 #39
0
        public override void WriteInitializationScript(TextWriter writer)
        {
            IClientSideObjectWriter objectWriter = ClientSideObjectWriterFactory.Create(Id, "tTreeView", writer);

            objectWriter.Start();

            if (!defaultEffects.SequenceEqual(Effects.Container))
            {
                objectWriter.Serialize("effects", Effects);
            }

            if (!ShowLines)
            {
                objectWriter.Append("showLines", ShowLines);
            }

            if (ShowCheckBox)
            {
                objectWriter.Append("showCheckBox", ShowCheckBox);
            }

            if (DragAndDrop.Enabled)
            {
                if (DragAndDrop.DropTargets.HasValue())
                {
                    var dragAndDropOptions = new Dictionary <string, string>();

                    dragAndDropOptions["dropTargets"] = DragAndDrop.DropTargets;

                    objectWriter.AppendObject("dragAndDrop", dragAndDropOptions);
                }
                else
                {
                    objectWriter.Append("dragAndDrop", true);
                }
            }

            if (Ajax.Enabled)
            {
                Dictionary <string, string> ajax = new Dictionary <string, string>();

                ajax["selectUrl"] = UrlGenerator.Generate(ViewContext.RequestContext, Ajax.Select);

                objectWriter.AppendObject("ajax", ajax);
            }

            if (WebService.Enabled)
            {
                Dictionary <string, string> webService = new Dictionary <string, string>();

                webService["selectUrl"] = UrlGenerator.Generate(ViewContext.RequestContext, WebService.Select.Url);

                objectWriter.AppendObject("ws", webService);
            }

            objectWriter.AppendClientEvent("onExpand", ClientEvents.OnExpand);
            objectWriter.AppendClientEvent("onCollapse", ClientEvents.OnCollapse);
            objectWriter.AppendClientEvent("onSelect", ClientEvents.OnSelect);
            objectWriter.AppendClientEvent("onLoad", ClientEvents.OnLoad);
            objectWriter.AppendClientEvent("onError", ClientEvents.OnError);
            objectWriter.AppendClientEvent("onChecked", ClientEvents.OnChecked);
            objectWriter.AppendClientEvent("onNodeDragStart", ClientEvents.OnNodeDragStart);
            objectWriter.AppendClientEvent("onNodeDragging", ClientEvents.OnNodeDragging);
            objectWriter.AppendClientEvent("onNodeDragCancelled", ClientEvents.OnNodeDragCancelled);
            objectWriter.AppendClientEvent("onNodeDrop", ClientEvents.OnNodeDrop);
            objectWriter.AppendClientEvent("onNodeDropped", ClientEvents.OnNodeDropped);
            objectWriter.AppendClientEvent("onDataBinding", ClientEvents.OnDataBinding);
            objectWriter.AppendClientEvent("onDataBound", ClientEvents.OnDataBound);

            objectWriter.Complete();
            base.WriteInitializationScript(writer);
        }
コード例 #40
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            _BasketItem = BasketItemDataSource.Load(BasketItemId);
            if (_BasketItem != null)
            {
                Product product = _BasketItem.Product;
                if (product != null)
                {
                    //OUTPUT THE PRODUCT NAME
                    string productName = product.Name;
                    if (_BasketItem.ProductVariant != null)
                    {
                        productName += string.Format(" ({0})", _BasketItem.ProductVariant.VariantName);
                    }
                    if (this.LinkProducts)
                    {
                        //OUTPUT NAME AS LINK
                        string url = UrlGenerator.GetBrowseUrl(product.Id, CatalogNodeType.Product, product.Name);
                        if (!string.IsNullOrEmpty(_BasketItem.KitList) && !string.IsNullOrEmpty(_BasketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Kits={2}&Options={3} \">{4}</a>", Page.ResolveUrl(url), _BasketItem.Id, _BasketItem.KitList, _BasketItem.OptionList.Replace(",0", string.Empty), productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else if (!string.IsNullOrEmpty(_BasketItem.KitList) && string.IsNullOrEmpty(_BasketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Kits={2}\">{3}</a>", Page.ResolveUrl(url), _BasketItem.Id, _BasketItem.KitList, productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else if (string.IsNullOrEmpty(_BasketItem.KitList) && !string.IsNullOrEmpty(_BasketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Options={2}\">{3}</a>", Page.ResolveUrl(url), _BasketItem.Id, _BasketItem.OptionList.Replace(",0", string.Empty), productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}\">{2}</a>", Page.ResolveUrl(url), _BasketItem.Id, productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                    }
                    else
                    {
                        //OUTPUT NAME
                        phProductName.Controls.Add(new LiteralControl(productName));
                    }
                    //SHOW INPUTS
                    IList <BasketItemInput> inputs = GetCustomerInputs();
                    if (inputs.Count > 0)
                    {
                        InputList.DataSource = inputs;
                        InputList.DataBind();
                    }
                    else
                    {
                        InputList.Visible = false;
                    }
                    //SHOW KIT PRODUCTS
                    IList <BasketItem> kitProductList = GetKitProducts(_BasketItem);
                    KitProductPanel.Visible = (kitProductList.Count > 0 && _BasketItem.Product.Kit != null && !_BasketItem.Product.Kit.ItemizeDisplay);
                    if (KitProductPanel.Visible)
                    {
                        KitProductRepeater.DataSource = kitProductList;
                        KitProductRepeater.DataBind();
                    }
                    //SET THE WISHLIST LABEL
                    WishlistLabel.Visible = (_BasketItem.WishlistItem != null);
                    if (WishlistLabel.Visible)
                    {
                        //SET THE WISHLIST NAME
                        WishlistLabel.Text = string.Format(WishlistLabel.Text, GetWishlistName(_BasketItem.WishlistItem.Wishlist));
                    }
                    //SET THE SHIPS TO PANEL
                    Basket basket = _BasketItem.Basket;

                    //SHOW ASSETS
                    List <AbleCommerce.Code.ProductAssetWrapper> assets = AbleCommerce.Code.ProductHelper.GetAssets(this.Page, _BasketItem.Product, _BasketItem.OptionList, _BasketItem.KitList, "javascript:window.close()");
                    AssetsPanel.Visible = (this.ShowAssets && assets.Count > 0);
                    if (AssetsPanel.Visible)
                    {
                        AssetLinkList.DataSource = assets;
                        AssetLinkList.DataBind();
                    }
                    //SHOW SUBSCRIPTIONS
                    SubscriptionPlan sp = _BasketItem.Product.SubscriptionPlan;
                    SubscriptionPanel.Visible = (this.ShowSubscription && _BasketItem.IsSubscription);
                    if (SubscriptionPanel.Visible)
                    {
                        InitialPayment.Visible = (sp.RecurringChargeSpecified);
                        if (InitialPayment.Visible)
                        {
                            InitialPayment.Text = string.Format(InitialPayment.Text, _BasketItem.Price.LSCurrencyFormat("ulc"));
                        }
                        string period;
                        if (_BasketItem.Frequency > 1)
                        {
                            period = _BasketItem.Frequency + " " + _BasketItem.FrequencyUnit.ToString().ToLowerInvariant() + "s";
                        }
                        else
                        {
                            period = _BasketItem.FrequencyUnit.ToString().ToLowerInvariant();
                        }
                        int numPayments = (sp.RecurringChargeSpecified ? sp.NumberOfPayments - 1 : sp.NumberOfPayments);
                        if (sp.NumberOfPayments == 0)
                        {
                            RecurringPayment.Text = string.Format("Recurring Payment: {0}, every {1} until canceled", sp.CalculateRecurringCharge(_BasketItem.Price).LSCurrencyFormat("ulc"), period);
                        }
                        else
                        {
                            RecurringPayment.Text = string.Format(RecurringPayment.Text, numPayments, sp.CalculateRecurringCharge(_BasketItem.Price).LSCurrencyFormat("ulc"), period);
                        }
                    }
                }
                else
                {
                    //OUTPUT NAME
                    phProductName.Controls.Add(new LiteralControl(_BasketItem.Name));
                    InputList.Visible         = false;
                    KitProductPanel.Visible   = false;
                    WishlistLabel.Visible     = false;
                    AssetsPanel.Visible       = false;
                    SubscriptionPanel.Visible = false;
                }
            }
            else
            {
                //NO ITEM TO DISPLAY
                this.Controls.Clear();
            }
        }
コード例 #41
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (_OrderItem != null)
            {
                Product product = _OrderItem.Product;
                if (product != null)
                {
                    string productName = _OrderItem.Name;
                    if (!string.IsNullOrEmpty(_OrderItem.VariantName))
                    {
                        string variantName = string.Format(" ({0})", _OrderItem.VariantName);
                        if (!productName.Contains(variantName))
                        {
                            productName += variantName;
                        }
                    }
                    if (this.LinkProducts)
                    {
                        ProductLink.NavigateUrl = UrlGenerator.GetBrowseUrl(product.Id, CatalogNodeType.Product, productName);
                        if (EnableFriendlyFormat)
                        {
                            ProductLink.Text = string.Format("{0} of {1}(<span class='price'>{2}</span>)", _OrderItem.Quantity, productName, _OrderItem.Price.LSCurrencyFormat("ulc"));
                        }
                        else
                        {
                            ProductLink.Text = productName;
                        }
                        ProductName.Visible = false;
                    }
                    else
                    {
                        if (EnableFriendlyFormat)
                        {
                            ProductName.Text = string.Format("{0} of {1}(<span class='price'>{2}</span>)", _OrderItem.Quantity, productName, _OrderItem.Price.LSCurrencyFormat("ulc"));
                        }
                        else
                        {
                            ProductName.Text = productName;
                        }
                        ProductLink.Visible = false;
                    }
                    //SHOW INPUTS
                    if (_OrderItem.Inputs.Count > 0)
                    {
                        InputList.DataSource = _OrderItem.Inputs;
                        InputList.DataBind();
                    }
                    else
                    {
                        InputList.Visible = false;
                    }
                    //SHOW KIT PRODUCTS IF AVAILABLE, AND THE PRODUCT DOES NOT USE ITEMIZED DISPLAY
                    if (!string.IsNullOrEmpty(_OrderItem.KitList) && !_OrderItem.ItemizeChildProducts)
                    {
                        IList <OrderItem> kitProductList = GetKitProducts(_OrderItem);
                        if (kitProductList.Count > 0)
                        {
                            KitProductPanel.Visible       = true;
                            KitProductRepeater.DataSource = kitProductList;
                            KitProductRepeater.DataBind();
                        }
                    }
                    //SET THE KIT MEMBER LABEL
                    if (_OrderItem.OrderItemType == OrderItemType.Product && _OrderItem.IsChildItem)
                    {
                        OrderItem parentItem = _OrderItem.GetParentItem(true);
                        if (parentItem.ItemizeChildProducts ||
                            _OrderItem.Id != parentItem.Id)
                        {
                            //SET THE WISHLIST NAME
                            KitMemberLabel.Visible = true;
                            KitMemberLabel.Text    = string.Format(KitMemberLabel.Text, parentItem.Name);
                        }
                    }
                    //SET THE WISHLIST LABEL
                    WishlistLabel.Visible = (_OrderItem.WishlistItem != null);
                    if (WishlistLabel.Visible)
                    {
                        //SET THE WISHLIST NAME
                        WishlistLabel.Text = string.Format(WishlistLabel.Text, GetWishlistName(_OrderItem.WishlistItem.Wishlist));
                    }
                    //SET THE SHIPS TO PANEL
                    Order         basket   = _OrderItem.Order;
                    OrderShipment shipment = _OrderItem.OrderShipment;
                    ShipsToPanel.Visible = this.ShowShipTo;
                    if (ShipsToPanel.Visible)
                    {
                        ShipsTo.Text = shipment.ShipToFullName;
                    }
                    //SHOW GIFT WRAP
                    GiftWrapPanel.Visible = (_OrderItem.WrapStyle != null);
                    if (GiftWrapPanel.Visible)
                    {
                        GiftWrap.Text         = _OrderItem.WrapStyle.Name;
                        GiftWrapPrice.Visible = (_OrderItem.WrapStyle.Price != 0);
                        GiftWrapPrice.Text    = string.Format("&nbsp;({0})", _OrderItem.WrapStyle.Price.LSCurrencyFormat("ulc"));
                    }
                    //SHOW GIFT MESSAGE
                    GiftMessagePanel.Visible = (!string.IsNullOrEmpty(_OrderItem.GiftMessage));
                    if (GiftMessagePanel.Visible)
                    {
                        GiftMessage.Text = _OrderItem.GiftMessage;
                    }
                    //SHOW ASSETS
                    List <AbleCommerce.Code.ProductAssetWrapper> assets = AbleCommerce.Code.ProductHelper.GetAssets(this.Page, _OrderItem.Product, _OrderItem.OptionList, _OrderItem.KitList, "~/Members/MyOrder.aspx?OrderNumber=" + _OrderItem.Order.OrderNumber.ToString());
                    AssetsPanel.Visible = (this.ShowAssets && assets.Count > 0);
                    if (AssetsPanel.Visible)
                    {
                        AssetLinkList.DataSource = assets;
                        AssetLinkList.DataBind();
                    }

                    //SHOW SUBSCRIPTIONS
                    if (this.ShowSubscription)
                    {
                        SubscriptionPlan sp = _OrderItem.Product.SubscriptionPlan;
                        if (sp != null && _OrderItem.IsSubscription && _OrderItem.Frequency > 0)
                        {
                            // GET THE RECURRING PAYMENT MESSAGE FOR THIS PRODUCT
                            RecurringPaymentMessage.Text = ProductHelper.GetRecurringPaymentMessage(_OrderItem);
                            SubscriptionPanel.Visible    = true;
                        }
                    }
                }
                else
                {
                    ProductLink.Visible       = false;
                    ProductName.Text          = _OrderItem.Name;
                    InputList.Visible         = false;
                    KitProductPanel.Visible   = false;
                    WishlistLabel.Visible     = false;
                    ShipsToPanel.Visible      = false;
                    GiftWrapPanel.Visible     = false;
                    GiftMessagePanel.Visible  = false;
                    AssetsPanel.Visible       = false;
                    SubscriptionPanel.Visible = false;
                }
            }
            else
            {
                //NO ITEM TO DISPLAY
                this.Controls.Clear();
            }
        }
コード例 #42
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void AppendsModuleHashHexString()
 {
     var app = new UrlGenerator("/");
     var url = app.CreateModuleUrl(StubScriptModule("~\\test\\foo\\bar"));
     url.ShouldEqual("/_assets/scripts/test/foo/bar_010203");
 }
コード例 #43
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            int     productId = AbleCommerce.Code.PageHelper.GetProductId();
            Product product   = ProductDataSource.Load(productId);

            if (product != null)
            {
                NameValueCollection menuLinks = new NameValueCollection();
                menuLinks.Add("Product", "EditProduct.aspx");
                menuLinks.Add("Images", "Assets/Images.aspx");
                menuLinks.Add("Options", "Variants/Options.aspx");
                menuLinks.Add("Digital Goods", "DigitalGoods/DigitalGoods.aspx");
                menuLinks.Add("Kitting", "Kits/EditKit.aspx");
                menuLinks.Add("Volume Pricing", "EditVolumePricing.aspx");
                //menuLinks.Add("Discounts", "ProductDiscounts.aspx");
                menuLinks.Add("Specials", "Specials/Default.aspx");
                menuLinks.Add("Similar Products", "EditSimilarProducts.aspx");
                menuLinks.Add("Upsell", "EditProductAccessories.aspx");
                menuLinks.Add("Categories", "EditProductCategories.aspx");
                menuLinks.Add("Templates", "EditProductTemplate.aspx");
                menuLinks.Add("Subscriptions", "EditSubscription.aspx");

                string suffix     = "?ProductId=" + product.Id.ToString();
                int    categoryId = AlwaysConvert.ToInt(Request.QueryString["CategoryId"]);
                if (categoryId > 0)
                {
                    suffix += "&CategoryId=" + categoryId.ToString();
                }
                string        activeMenu = GetActiveMenu(Request.Url);
                StringBuilder menu       = new StringBuilder();
                menu.AppendLine("<div class=\"secondaryMenu\">");
                menu.AppendLine("<ul>");
                foreach (string key in menuLinks.AllKeys)
                {
                    if (key == activeMenu)
                    {
                        menu.Append("<li class=\"active\">");
                    }
                    else
                    {
                        menu.Append("<li>");
                    }
                    menu.AppendLine("<a href=\"" + Page.ResolveUrl("~/Admin/Products/" + menuLinks[key]) + suffix + "\">" + key + "</a></li>");
                }

                // preview link can never be active
                string pUrl = UrlGenerator.GetBrowseUrl(categoryId, productId, CatalogNodeType.Product, product.Name);
                if (pUrl.StartsWith("~/"))
                {
                    pUrl = ResolveClientUrl(pUrl);
                }

                menu.AppendLine("<li><a href=\"" + pUrl + "\" target=\"_blank\">Preview</a></li>");

                menu.AppendLine("</ul>");
                menu.AppendLine("</div>");
                MenuContent.Text = menu.ToString();
            }
            else
            {
                // no order, do not display menu
                this.Controls.Clear();
            }
        }
コード例 #44
0
ファイル: RawFileCopier.cs プロジェクト: joshperry/cassette
 public RawFileCopier(string absoluteSourceDirectory, string outputDirectory)
 {
     this.absoluteSourceDirectory = absoluteSourceDirectory;
     urlGenerator = new UrlGenerator(new CombinePathWithUrl(outputDirectory), new FileSystemDirectory(absoluteSourceDirectory), "");
 }
コード例 #45
0
ファイル: UrlGenerator.cs プロジェクト: stucampbell/cassette
        protected UrlGenerator_Tests()
        {
            UrlModifier.Setup(m => m.Modify(It.IsAny<string>()))
                       .Returns<string>(url => url);

            var container = new Mock<ICassetteApplicationContainer<ICassetteApplication>>();
            container.SetupGet(c => c.Application.Bundles).Returns(Enumerable.Empty<Bundle>());
            UrlGenerator = new UrlGenerator(UrlModifier.Object, "_cassette");
        }
コード例 #46
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void AppendsSlashToVirtualDirectoryWhenMissingFromEnd()
 {
     var app = new UrlGenerator("/myapp");
     var url = app.CreateModuleUrl(StubScriptModule("~/test"));
     url.ShouldStartWith("/myapp/");
 }
コード例 #47
0
 protected override string GenerateDownloadUrl(Mirrors.MirrorConfiguration mirrorConfiguration, SciMagArticle article)
 {
     return(UrlGenerator.GetSciMagDownloadUrl(mirrorConfiguration, article));
 }
コード例 #48
0
 public string URLs()
 {
     return((string)CacheService.GetCachedItem("URLs", () => UrlGenerator.GenerateUrls(Assembly.GetExecutingAssembly())));
 }
コード例 #49
0
 protected override string GenerateCoverUrl(Mirrors.MirrorConfiguration mirrorConfiguration)
 {
     return(UrlGenerator.GetNonFictionCoverUrl(mirrorConfiguration, DetailsItem.Book));
 }
コード例 #50
0
        public UrlGeneratorTests()
        {
            TestHelper.RegisterDummyRoutes();

            _urlGenerator = new UrlGenerator();
        }
コード例 #51
0
        public JsonResult NewsPost(ClsPost clsPost)
        {
            try
            {
                var currentUser = (ClaimsPrincipal)Thread.CurrentPrincipal;
                var UserId      = currentUser.Claims.Where(x => x.Type == ClaimTypes.PrimarySid).Select(c => c.Value).SingleOrDefault();
                var Role        = currentUser.Claims.Where(x => x.Type == ClaimTypes.Role).Select(c => c.Value).SingleOrDefault();
                clsPost.IsReviewed = false;
                clsPost.CreatedBy  = int.Parse(UserId);
                if (clsPost.IsSchedule == false)
                {
                    if (Role == "SuperAdmin" || Role == "Admin")
                    {
                        clsPost.ReviewedBy = int.Parse(UserId);
                        clsPost.IsReviewed = true;
                    }
                }
                clsPost.PostedOn    = DateTime.Now;
                clsPost.PostedDate  = DateTime.Now;
                clsPost.PostedYear  = DateTime.Now.Year;
                clsPost.PostedMonth = DateTime.Now.Month;
                clsPost.SlugUrl     = UrlGenerator.GetUrl(clsPost.EnglishTitle);
                NewsOprations oprations = new NewsOprations();
                decimal       i         = oprations.NewsPost(clsPost);
                if (i > 0)
                {
                    Task.Factory.StartNew(() => new NewsOprations().UpdateData());

                    if (clsPost.IsSchedule == true)
                    {
                        try
                        {
                            SchdulePostConfig schPostConfig = new SchdulePostConfig();
                            if (schPostConfig != null)
                            {
                                schPostConfig.PostId       = i;
                                schPostConfig.PostedOn     = DateTime.Now;
                                schPostConfig.ScheduleTime = DateTime.Now.AddHours(clsPost.Delay);
                                schPostConfig.TimeDelay    = clsPost.Delay;
                                schulepostconfig.Insert(schPostConfig);
                                schulepostconfig.Save();
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex.ToString());
                        }
                    }
                    if (clsPost.IsSchedule == false)
                    {
                        if (Role == "SuperAdmin" || Role == "Admin")
                        {
                            if (clsPost.IsFacebookPublish == true)
                            {
                                string category = newsType.GetByID(x => x.Id == clsPost.CategoryId).NewsType;
                                var    webadrs  = ConfigurationManager.AppSettings["webid"];
                                Task.Factory.StartNew(() => new apiPlugin().pagePublish(clsPost.OdiaTitle, (webadrs + "/News/" + category + "/" + clsPost.PostedYear + "/" + clsPost.PostedMonth + "/" + i + "/" + clsPost.SlugUrl)));
                            }
                        }
                    }
                    return(Json(new { msg = "News Posted Successfully..." }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { msg = "News Posted UnSuccessful..." }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
            return(Json(new { msg = "News Posted UnSuccessful..." }, JsonRequestBehavior.AllowGet));
        }
コード例 #52
0
 public JsonResult UpdatePost(ClsPost clsPost)
 {
     try
     {
         var currentUser = (ClaimsPrincipal)Thread.CurrentPrincipal;
         var UserId      = currentUser.Claims.Where(x => x.Type == ClaimTypes.PrimarySid).Select(c => c.Value).SingleOrDefault();
         var Role        = currentUser.Claims.Where(x => x.Type == ClaimTypes.Role).Select(c => c.Value).SingleOrDefault();
         clsPost.IsReviewed = false;
         if (clsPost.IsSchedule == false)
         {
             if (Role == "SuperAdmin" || Role == "Admin")
             {
                 clsPost.ReviewedBy = int.Parse(UserId);
                 clsPost.IsReviewed = true;
             }
         }
         clsPost.Modified = DateTime.Now;
         bool IsReviewed = false;
         using (NewsPortalEntities portalEntities = new NewsPortalEntities())
         {
             NewsPost newsPost = portalEntities.NewsPosts.Where(x => x.Id == clsPost.Id).FirstOrDefault();
             IsReviewed               = newsPost.IsReviewed.Value;
             newsPost.EnglishTitle    = clsPost.EnglishTitle;
             newsPost.OdiaTitle       = clsPost.OdiaTitle;
             newsPost.EngShortDesc    = clsPost.EngShortDesc;
             newsPost.ODShortDesc     = clsPost.ODShortDesc;
             newsPost.SeoMeta         = clsPost.SeoMeta;
             newsPost.Tags            = clsPost.Tags;
             newsPost.CategoryId      = clsPost.CategoryId;
             newsPost.HeaderImageName = clsPost.ImageName;
             newsPost.ODContent       = clsPost.ODContent;
             newsPost.IsReviewed      = clsPost.IsReviewed;
             newsPost.ReviewedBy      = clsPost.ReviewedBy;
             newsPost.ModifiedOn      = clsPost.Modified;
             newsPost.Thumbnail86     = clsPost.ImageName.Replace("Img", "Thumbnail_86x64");
             newsPost.Thumbnail210    = clsPost.ImageName.Replace("Img", "Thumbnail_210x136");
             newsPost.Thumbnail279    = clsPost.ImageName.Replace("Img", "Thumbnail_279x220");
             newsPost.SlugUrl         = UrlGenerator.GetUrl(clsPost.EnglishTitle);
             portalEntities.NewsPosts.Attach(newsPost);
             portalEntities.Entry(newsPost).State = EntityState.Modified;
             portalEntities.SaveChanges();
             //if(IsReviewed==false)
             {
                 if (Role == "SuperAdmin" || Role == "Admin")
                 {
                     string category = newsType.GetByID(x => x.Id == newsPost.CategoryId).NewsType;
                     var    webadrs  = ConfigurationManager.AppSettings["webid"];
                     Task.Factory.StartNew(() => new apiPlugin().pagePublish(newsPost.OdiaTitle, (webadrs + "/News/" + category + "/" + newsPost.PostedYear + "/" + newsPost.PostedMonth + "/" + clsPost.Id + "/" + newsPost.SlugUrl)));
                 }
             }
         }
         Task.Factory.StartNew(() => new NewsOprations().UpdateData());
         if (clsPost.IsSchedule == true)
         {
             try
             {
                 SchdulePostConfig schPostConfig = schulepostconfig.GetByID(x => x.PostId == clsPost.Id);
                 if (schPostConfig != null)
                 {
                     schPostConfig.PostId       = clsPost.Id;
                     schPostConfig.PostedOn     = DateTime.Now;
                     schPostConfig.ScheduleTime = DateTime.Now.AddHours(clsPost.Delay);
                     schPostConfig.TimeDelay    = clsPost.Delay;
                     schulepostconfig.Edit(schPostConfig);
                     schulepostconfig.Save();
                 }
                 else
                 {
                     SchdulePostConfig scPostConfig = new SchdulePostConfig();
                     scPostConfig.PostId       = clsPost.Id;
                     scPostConfig.PostedOn     = DateTime.Now;
                     scPostConfig.ScheduleTime = DateTime.Now.AddHours(clsPost.Delay);
                     scPostConfig.TimeDelay    = clsPost.Delay;
                     schulepostconfig.Insert(scPostConfig);
                     schulepostconfig.Save();
                 }
             }
             catch (Exception ex)
             {
                 Log.Error("Update News schdule issue", ex);
             }
         }
         else
         {
             try
             {
                 SchdulePostConfig schPostConfig = schulepostconfig.GetByID(x => x.PostId == clsPost.Id);
                 if (schPostConfig != null)
                 {
                     schulepostconfig.Delete(x => x.PostId == clsPost.Id);
                     schulepostconfig.Save();
                 }
             }
             catch (Exception ex)
             {
                 Log.Error("Delete News schdule issue", ex);
             }
         }
         return(Json(new { msg = "Post Updated Successfully" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         Log.Error(ex.ToString());
     }
     return(Json(new { msg = "Post Updation Unsucessful" }, JsonRequestBehavior.AllowGet));
 }
コード例 #53
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            BasketItem basketItem = BasketItemDataSource.Load(this.BasketItemId);

            if (basketItem != null)
            {
                Product product = basketItem.Product;
                if (product != null)
                {
                    //OUTPUT THE PRODUCT NAME
                    string productName = basketItem.Name;
                    if (basketItem.ProductVariant != null)
                    {
                        string variantName = string.Format(" ({0})", basketItem.ProductVariant.VariantName);
                        if (!productName.EndsWith(variantName))
                        {
                            productName += variantName;
                        }
                    }
                    if (this.LinkProducts && product.Visibility != CatalogVisibility.Private)
                    {
                        //OUTPUT NAME AS LINK
                        string url = UrlGenerator.GetBrowseUrl(product.Id, CatalogNodeType.Product, product.Name);
                        if (!string.IsNullOrEmpty(basketItem.KitList) && !string.IsNullOrEmpty(basketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Kits={2}&Options={3}\">{4}</a>", Page.ResolveUrl(url), basketItem.Id, basketItem.KitList, basketItem.OptionList.Replace(",0", string.Empty), productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else if (!string.IsNullOrEmpty(basketItem.KitList) && string.IsNullOrEmpty(basketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Kits={2}\">{3}</a>", Page.ResolveUrl(url), basketItem.Id, basketItem.KitList, productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else if (string.IsNullOrEmpty(basketItem.KitList) && !string.IsNullOrEmpty(basketItem.OptionList))
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}&Options={2}\">{3}</a>", Page.ResolveUrl(url), basketItem.Id, basketItem.OptionList.Replace(",0", string.Empty), productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                        else
                        {
                            string link = string.Format("<a href=\"{0}?ItemId={1}\">{2}</a>", Page.ResolveUrl(url), basketItem.Id, productName);
                            phProductName.Controls.Add(new LiteralControl(link));
                        }
                    }
                    else
                    {
                        //OUTPUT NAME
                        phProductName.Controls.Add(new LiteralControl(productName));
                    }

                    if (EnableFriendlyFormat)
                    {
                        phProductName.Controls.AddAt(0, new LiteralControl(string.Format("{0} of ", basketItem.Quantity)));
                        phProductName.Controls.Add(new LiteralControl(string.Format("<span class='price'>({0})</span>", basketItem.Price.LSCurrencyFormat("ulc"))));
                    }

                    //SHOW INPUTS
                    IList <BasketItemInput> inputs = GetCustomerInputs(basketItem);
                    if (inputs.Count > 0)
                    {
                        InputList.DataSource = inputs;
                        InputList.DataBind();
                    }
                    else
                    {
                        InputList.Visible = false;
                    }
                    //SHOW KIT PRODUCTS IF AVAILABLE, AND THE PRODUCT DOES NOT USE ITEMIZED DISPLAY OR FORCE KIT DISPLAY IS ON
                    if (!string.IsNullOrEmpty(basketItem.KitList) && basketItem.Product != null &&
                        basketItem.Product.Kit != null && (!basketItem.Product.Kit.ItemizeDisplay || this.ForceKitDisplay))
                    {
                        IList <BasketItem> kitProductList = GetKitProducts(basketItem, this.IgnoreKitShipment);
                        if (kitProductList.Count > 0)
                        {
                            KitProductPanel.Visible       = true;
                            KitProductRepeater.DataSource = kitProductList;
                            KitProductRepeater.DataBind();
                        }
                    }
                    //SET THE KIT MEMBER LABEL
                    if (basketItem.OrderItemType == OrderItemType.Product && basketItem.IsChildItem)
                    {
                        BasketItem parentItem = basketItem.GetParentItem(true);
                        if (parentItem != null)
                        {
                            if ((parentItem.Product != null && basketItem.Product.Kit != null && parentItem.Product.Kit.ItemizeDisplay) ||
                                basketItem.ShipmentId != parentItem.ShipmentId)
                            {
                                //SET THE WISHLIST NAME
                                KitMemberLabel.Visible = true;
                                KitMemberLabel.Text    = string.Format(KitMemberLabel.Text, parentItem.Name);
                            }
                        }
                    }
                    //SET THE WISHLIST LABEL
                    WishlistLabel.Visible = (basketItem.WishlistItem != null);
                    if (WishlistLabel.Visible)
                    {
                        //SET THE WISHLIST NAME
                        WishlistLabel.Text = string.Format(WishlistLabel.Text, GetWishlistName(basketItem.WishlistItem.Wishlist));
                    }
                    //SET THE SHIPS TO PANEL
                    Basket         basket   = basketItem.Basket;
                    BasketShipment shipment = basketItem.Shipment;
                    Address        address  = (shipment == null) ? null : shipment.Address;
                    ShipsToPanel.Visible = (this.ShowShipTo && (address != null) && (!string.IsNullOrEmpty(address.FullName)));
                    if (ShipsToPanel.Visible)
                    {
                        ShipsTo.Text = address.FullName;
                    }
                    //SHOW GIFT WRAP
                    GiftWrapPanel.Visible = (basketItem.WrapStyle != null);
                    if (GiftWrapPanel.Visible)
                    {
                        GiftWrap.Text         = basketItem.WrapStyle.Name;
                        GiftWrapPrice.Visible = (basketItem.WrapStyle.Price != 0);
                        GiftWrapPrice.Text    = string.Format("&nbsp;({0})", basketItem.WrapStyle.Price.LSCurrencyFormat("ulc"));
                    }
                    //SHOW GIFT MESSAGE
                    GiftMessagePanel.Visible = (!string.IsNullOrEmpty(basketItem.GiftMessage));
                    if (GiftMessagePanel.Visible)
                    {
                        GiftMessage.Text = basketItem.GiftMessage;
                    }
                    //SHOW ASSETS
                    List <AbleCommerce.Code.ProductAssetWrapper> assets = AbleCommerce.Code.ProductHelper.GetAssets(this.Page, basketItem.Product, basketItem.OptionList, basketItem.KitList, "javascript:window.close()");
                    AssetsPanel.Visible = (this.ShowAssets && assets.Count > 0);
                    if (AssetsPanel.Visible)
                    {
                        AssetLinkList.DataSource = assets;
                        AssetLinkList.DataBind();
                    }
                    //SHOW SUBSCRIPTIONS
                    if (this.ShowSubscription)
                    {
                        SubscriptionPlan sp = basketItem.Product.SubscriptionPlan;
                        if (sp != null && basketItem.IsSubscription && basketItem.Frequency > 0)
                        {
                            // GET THE RECURRING PAYMENT MESSAGE FOR THIS PRODUCT
                            RecurringPaymentMessage.Text = AbleCommerce.Code.ProductHelper.GetRecurringPaymentMessage(basketItem);
                            SubscriptionPanel.Visible    = true;
                        }
                    }
                }
                else
                {
                    //OUTPUT NAME
                    phProductName.Controls.Add(new LiteralControl(basketItem.Name));
                    InputList.Visible         = false;
                    KitProductPanel.Visible   = false;
                    WishlistLabel.Visible     = false;
                    ShipsToPanel.Visible      = false;
                    GiftWrapPanel.Visible     = false;
                    GiftMessagePanel.Visible  = false;
                    AssetsPanel.Visible       = false;
                    SubscriptionPanel.Visible = false;
                }
            }
            else
            {
                //NO ITEM TO DISPLAY
                this.Controls.Clear();
            }
        }
コード例 #54
0
ファイル: UrlGenerator.cs プロジェクト: lukebennett/cassette
 public void CreateImageUrlConvertsFileExtensinDotToUnderscore()
 {
     var generator = new UrlGenerator("/");
     var url = generator.CreateRawFileUrl("~/test.png", "hash");
     url.ShouldStartWith("/_assets/images/test_hash_png");
 }
コード例 #55
0
 public TeacherAddedNotification(User from, User to, RequestContext request)
     : base(new[] { to },
            u => $"Пользователь <b>{from.Name} {from.Surname}</b> ({new MailTo(from.Email)}) указал вас как преподавателя. " +
            $"Создайте <a href = \"{UrlGenerator.GetRouteUrl(request, "Create", "Courses")}\">свой первый курс</a>")
 {
 }
コード例 #56
0
        public static List <TagModel> GetBlogTags()
        {
            ILocator postLocator = new PostLocator();
            var      posts       = postLocator.GetPosts(PathProvider.GetPostsPath());
            var      allTags     = posts.SelectMany(p => p.Tags).ToList().Distinct();

            return(allTags.Select(t => new TagModel {
                TagText = t, TagSlug = string.Format("{0}/tag/{1}", Constants.BlogBasePath, UrlGenerator.UrlFriendly(t))
            }).ToList());
        }