Example #1
0
        private static string ConstructFullAuthUrl(string providerUrl, string opLocalId, string returnToUrl)
        {
            // Determine the query parts we need.
            if (string.IsNullOrEmpty(opLocalId)) opLocalId = "http://specs.openid.net/auth/2.0/identifier_select";
            var qry = new Dictionary<string, string>
                          {
                              {"openid.ns", "http://specs.openid.net/auth/2.0"},
                              {"openid.claimed_id", "http://specs.openid.net/auth/2.0/identifier_select"},
                              {"openid.identity", opLocalId},
                              {"openid.mode", "checkid_setup"},
                              {"openid.return_to", returnToUrl}
                          };
            // Create and return the full URL.
            var fullUrl = new StringBuilder(providerUrl);
            fullUrl.Append(providerUrl.Contains("?") ? "&" : "?");
            fullUrl.Append(qry.ToUrlQuery());

            return fullUrl.ToString();
        }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      if (this.Domain().IsEmpty() || this.Width().IsEmpty() || this.Height().IsEmpty())
      {
        return string.Empty;
      }

      var config = new Dictionary<string, object>
      {
        { "domain", this.Domain() },
        { "font", this.Font() },
        { "width", this.Width() },
        { "height", this.Height() }
      };
      
      if (!this.TitleText().IsEmpty())
      {
        config["title"] = this.TitleText();
      }
      if (!this.Title())
      {
        config["notitle"] = true;
      }
      if (!this.TitleColor().IsEmpty())
      {
        config["title-color"] = this.TitleColor();
      }
      if (!this.BackgroundColor().IsEmpty())
      {
        config["background"] = this.BackgroundColor();
      }
      if (!this.BorderColor().IsEmpty())
      {
        config["border"] = this.BorderColor();
      }
      if (!this.TextColor().IsEmpty())
      {
        config["color"] = this.TextColor();
      }
      if (!this.HyperlinkColor().IsEmpty())
      {
        config["link-color"] = this.HyperlinkColor();
      }

      return new TagBuilder("a")
        .Attribute("href", "http://connect.mail.ru/share_friends?{0}".FormatSelf(config.ToUrlQuery()))
        .Attribute("rel", config.Json())
        .CssClass("mrc__plugin_share_friends")
        .InnerHtml("Друзья")
        .ToString();
    }
    /// <summary>
    ///   <para>Returns HTML markup text of widget.</para>
    /// </summary>
    /// <returns>Widget's HTML markup.</returns>
    public override string ToHtmlString()
    {
      if (this.Account().IsEmpty() || this.Width().IsEmpty() || this.Height().IsEmpty())
      {
        return string.Empty;
      }

      var config = new Dictionary<string, object>
      {
        { "group", this.Account() },
        { "max_sub", 50 },
        { "width", this.Width() },
        { "height", this.Height() }
      };

      if (this.Subscribers())
      {
        config["show_subscribers"] = true;
      }
      if (!this.BackgroundColor().IsEmpty())
      {
        config["background"] = this.BackgroundColor();
      }
      if (!this.TextColor().IsEmpty())
      {
        config["color"] = this.TextColor();
      }
      if (!this.ButtonColor().IsEmpty())
      {
        config["button_background"] = this.ButtonColor();
      }
      if (!this.Domain().IsEmpty())
      {
        config["domain"] = this.Domain();
      }

      return new TagBuilder("a")
        .Attribute("target", "_blank")
        .Attribute("href", "http://connect.mail.ru/groups_widget?{0}".FormatSelf(config.ToUrlQuery()))
        .Attribute("rel", config.Json())
        .CssClass("mrc__plugin_groups_widget")
        .InnerHtml("Группы")
        .ToString();
    }