Ejemplo n.º 1
0
    public string GetDescription(string value)
    {
        HtmlWriterOptions options = new HtmlWriterOptions();

        options.BaseHref      = Uri.IsWellFormedUriString(AccountFeed.LinkUrl, UriKind.Absolute) ? new Uri(AccountFeed.LinkUrl) : null;
        options.RewriteImgSrc = new Uri(SessionManager.WebsiteUri, "AccountFeedItemPicture.aspx?src={url}");
        return(Renderer.CleanHtml(value, options));
    }
Ejemplo n.º 2
0
    public string GetDescription(string s, string uri)
    {
        HtmlWriterOptions options = new HtmlWriterOptions();

        options.RewriteImgSize = new Size(0, 0);
        options.BaseHref       = Uri.IsWellFormedUriString(uri, UriKind.Absolute) ? new Uri(uri) : null;
        options.RewriteImgSrc  = new Uri(SessionManager.WebsiteUri, "AccountFeedItemPicture.aspx?src={url}");
        return(Renderer.CleanHtml(s, options));
    }
Ejemplo n.º 3
0
    public string GetSummary(string summary, string link)
    {
        Uri uri = null;

        Uri.TryCreate(link, UriKind.Absolute, out uri);
        Uri imgrewriteuri         = new Uri(SessionManager.WebsiteUri, "AccountFeedItemPicture.aspx?src={url}");
        HtmlWriterOptions options = new HtmlWriterOptions();

        options.BaseHref      = uri;
        options.RewriteImgSrc = imgrewriteuri;
        return(Renderer.CleanHtml(summary, options));
    }
Ejemplo n.º 4
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TransitAccountFeedItem tfi = GetAccountFeedItem();

            if (tfi == null)
            {
                Response.Redirect("AccountFeedItemsView.aspx");
                return;
            }

            licenseView.AccountId = tfi.AccountId;

            labelAccountName.Text = Renderer.Render(tfi.AccountName);
            imageAccount.Src      = string.Format("AccountPictureThumbnail.aspx?id={0}", tfi.AccountPictureId);

            this.Title = string.Format("{0}'s {1} in {2}",
                                       Renderer.Render(tfi.AccountName),
                                       Renderer.Render(tfi.Title),
                                       Renderer.Render(tfi.AccountFeedName));

            FeedTitle.Text            = Renderer.Render(tfi.AccountFeedName);
            FeedItemCreated.Text      = base.Adjust(tfi.Created).ToString();
            FeedItemTitle.NavigateUrl = tfi.Link;

            linkAccountView.HRef    = string.Format("AccountView.aspx?id={0}", tfi.AccountId);
            FeedTitle.NavigateUrl   = string.Format("AccountFeedView.aspx?id={0}", tfi.AccountFeedId);
            FeedXPosted.NavigateUrl = Render(tfi.Link);

            FeedItemTitle.Text = Renderer.Render(tfi.Title);

            Uri imgrewriteuri = new Uri(SessionManager.WebsiteUri, "AccountFeedItemPicture.aspx?src={url}");

            HtmlWriterOptions options = new HtmlWriterOptions();
            options.BaseHref         = Uri.IsWellFormedUriString(tfi.AccountFeedLinkUrl, UriKind.Absolute) ? new Uri(tfi.AccountFeedLinkUrl) : null;
            options.RewriteImgSrc    = imgrewriteuri;
            FeedItemDescription.Text = Renderer.CleanHtml(tfi.Description, options);

            FeedItemComments.DiscussionId = SessionManager.GetCount <TransitDiscussion, string, int>(
                typeof(AccountFeedItem).Name, RequestId, SessionManager.DiscussionService.GetOrCreateDiscussionId);

            GetDataFeature(sender, e);

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Blogs", Request, "AccountFeedItemsView.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode(tfi.AccountFeedName, Request, string.Format("AccountFeedView.aspx?id={0}", tfi.AccountFeedId)));
            sitemapdata.Add(new SiteMapDataAttributeNode(tfi.Title, Request.Url));
            StackSiteMap(sitemapdata);
        }
    }
Ejemplo n.º 5
0
 public string GetDescription(object link, object description)
 {
     if (LinkDescription)
     {
         return(string.Format("<a href='{0}' target='_blank'>{1}</a>",
                              link, RenderEx(description)));
     }
     else
     {
         Uri feedlinkUri = null;
         Uri.TryCreate(Feed.LinkUrl, UriKind.Absolute, out feedlinkUri);
         Uri imgrewriteuri         = new Uri(SessionManager.WebsiteUri, "AccountFeedItemPicture.aspx?src={url}");
         HtmlWriterOptions options = new HtmlWriterOptions();
         options.BaseHref      = feedlinkUri;
         options.RewriteImgSrc = imgrewriteuri;
         return(Renderer.CleanHtml(description.ToString(), options));
     }
 }
Ejemplo n.º 6
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SyndicationService.TransitAccountFeedItem tfi = GetAccountFeedItem();

            if (tfi == null)
            {
                Response.Redirect("AccountFeedItemsView.aspx");
                return;
            }

            this.Title = string.Format("{0}'s {1} in {2}",
                                       Renderer.Render(tfi.AccountName),
                                       Renderer.Render(tfi.Title),
                                       Renderer.Render(tfi.AccountFeedName));

            feeditemCreated.Text        = SessionManager.Adjust(tfi.Created).ToString();
            feeditemXPosted.NavigateUrl = Renderer.Render(tfi.Link);

            HtmlWriterOptions options = new HtmlWriterOptions();
            options.RewriteImgSize   = new Size(0, 0);
            options.BaseHref         = Uri.IsWellFormedUriString(tfi.AccountFeedLinkUrl, UriKind.Absolute) ? new Uri(tfi.AccountFeedLinkUrl) : null;
            options.RewriteImgSrc    = new Uri(SessionManager.WebsiteUri, "AccountFeedItemPicture.aspx?src={url}");
            feeditemDescription.Text = Renderer.CleanHtml(tfi.Description, options);

            int discussion_id = SessionManager.GetCount <DiscussionService.TransitDiscussion, DiscussionService.ServiceQueryOptions, string, int>(
                "AccountFeedItem", RequestId, SessionManager.DiscussionService.GetOrCreateDiscussionId);

            linkDiscussion.NavigateUrl = string.Format("DiscussionView.aspx?id={0}", discussion_id);

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Blogs", Request, "AccountFeedItemsView.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode(tfi.AccountFeedName, Request, string.Format("AccountFeedView.aspx?id={0}", tfi.AccountFeedId)));
            sitemapdata.Add(new SiteMapDataAttributeNode(tfi.Title, Request.Url));
            StackSiteMap(sitemapdata);
        }
    }
Ejemplo n.º 7
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            linkChooseLicense.NavigateUrl = string.Format("http://creativecommons.org/license/?partner={0}&exit_url={1}",
                                                          Renderer.Render(SessionManager.GetCachedConfiguration("SnCore.Title", "SnCore")),
                                                          Renderer.UrlEncode(Request.Url.ToString() + "?license_url=[license_url]&license_name=[license_name]&license_button=[license_button]"));

            string license_url    = Request.QueryString["license_url"];
            string license_name   = Request.QueryString["license_name"];
            string license_button = Request.QueryString["license_button"];

            TransitAccountLicense tal = SessionManager.LicenseService.GetAccountLicenseByAccountId(
                SessionManager.Ticket, SessionManager.AccountId);

            linkChooseLicense.Text = (tal == null) ? "&#187; Choose a License" : "&#187; Choose a New License";

            if (!string.IsNullOrEmpty(license_url))
            {
                if (tal == null)
                {
                    tal           = new TransitAccountLicense();
                    tal.AccountId = SessionManager.Account.Id;
                }

                tal.LicenseUrl = Renderer.UrlDecode(license_url);
                tal.ImageUrl   = Renderer.UrlDecode(license_button);
                tal.Name       = Renderer.UrlDecode(license_name);

                tal.Id = SessionManager.CreateOrUpdate <TransitAccountLicense>(
                    tal, SessionManager.LicenseService.CreateOrUpdateAccountLicense);

                Redirect("AccountLicenseEdit.aspx");
            }

            licenseImage.Visible      = (tal != null);
            linkDeleteLicense.Visible = (tal != null);
            licenseDiv.Visible        = (tal != null);

            if (tal != null && !string.IsNullOrEmpty(tal.LicenseUrl))
            {
                string key     = string.Format("license:{0}", tal.Name);
                string license = (string)Cache[key];
                if (string.IsNullOrEmpty(license))
                {
                    WebClient client = new WebClient();
                    client.Headers["Accept"]     = "*/*";
                    client.Headers["User-Agent"] = SessionManager.GetCachedConfiguration("SnCore.Web.UserAgent", "SnCore/1.0");
                    license = client.DownloadString(tal.LicenseUrl);
                    license = license.Substring(license.IndexOf("<div id=\"deed\""));
                    license = license.Substring(0, license.LastIndexOf("</div>") + 4);

                    HtmlWriterOptions options = new HtmlWriterOptions();
                    options.BaseHref = new Uri("http://creativecommons.org/");
                    license          = Renderer.CleanHtml(license, options);
                    Cache[key]       = license;
                }

                licenseContent.Text = license;
                licenseImage.Src    = tal.ImageUrl;
                licenseLink.HRef    = tal.LicenseUrl;
                licenseImage.Alt    = Renderer.Render(tal.Name);
            }

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode("Creative License", Request.Url));
            StackSiteMap(sitemapdata);
        }
    }