📄 postimagebuttons.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using CommunityServer.Components;
using CommunityServer.Controls;
namespace CommunityServer.Discussions.Controls
{
public class PostImageButtons : UserInfo
{
CSContext csContext = CSContext.Current;
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender (e);
}
protected override void Render(HtmlTextWriter writer)
{
// If the user should be hidden then return
//
if(IsCloakedUser)
return;
HyperLink l = new HyperLink();
User poster = this.User;
User reader = csContext.User;
// User's email
//
if ((!reader.IsAnonymous) && (!poster.IsAnonymous) && csContext.SiteSettings.EnableEmail )
{
writer.Write(" ");
// ModalLink link = new ModalLink();
// link.Url = Globals.GetSiteUrls().EmailToUser(poster.UserID);
// link.Height = 480;
// link.Width = 640;
// link.Text = "Email";
// link.Attributes.Add("title",String.Format(CommunityServer.Components.ResourceManager.GetString("User_AltEmail"), poster.DisplayName));
// link.RenderControl(writer);
// l.ImageUrl = Globals.GetSkinPath() + "/images/post_button_email.gif";
ModalLink ml = new ModalLink();
ml.Url = SiteUrls.Instance().EmailToUser(poster.UserID);
ml.Text = ResourceManager.GetString("ViewUserProfile_Email");
ml.Attributes.Add("style", "background-image: url(" + Globals.GetSkinPath() + "/images/forum/email.gif)");
ml.CssClass = this.CssClass;
//l.NavigateUrl = Globals.GetSiteUrls().EmailToUser(poster.UserID);
ml.Attributes.Add("title", String.Format(CommunityServer.Components.ResourceManager.GetString("User_AltEmail"), poster.DisplayName));
ml.Text = ResourceManager.GetString("Button_Email");
ml.Width = 600;
ml.Height = 400;
ml.RenderControl(writer);
}
// User's Private Messages
//
if ((!reader.IsAnonymous) && (!poster.IsAnonymous))
{
writer.Write(" ");
// l.ImageUrl = Globals.GetSkinPath() + "/images/post_button_pm.gif";
l.Attributes.Add("style", "background-image: url(" + Globals.GetSkinPath() + "/images/forum/privatemessage.gif)");
l.CssClass = this.CssClass;
l.NavigateUrl = Globals.GetSiteUrls().PrivateMessage(poster.UserID);
l.Attributes.Add("title", String.Format(CommunityServer.Components.ResourceManager.GetString("User_AltPrivateMessage"), poster.DisplayName));
l.Text = ResourceManager.GetString("Button_PrivateMessage");
l.RenderControl(writer);
}
// User's home page
//
if ((poster.Profile.WebAddress != String.Empty) && (!reader.IsAnonymous))
{
writer.Write(" ");
l.Target = "_blank";
//l.ImageUrl = Globals.GetSkinPath() + "/images/post_button_www.gif";
l.Attributes.Add("style", "background-image: url(" + Globals.GetSkinPath() + "/images/forum/homepage.gif)");
l.CssClass = this.CssClass;
l.NavigateUrl = this.User.Profile.WebAddress;
l.Attributes.Add("title", String.Format(CommunityServer.Components.ResourceManager.GetString("User_AltHomePage"), poster.DisplayName));
l.Text = ResourceManager.GetString("Button_Homepage");
l.RenderControl(writer);
}
// User's web log
//
if ((poster.Profile.WebLog != String.Empty) && (!reader.IsAnonymous))
{
writer.Write(" ");
l.Target = "_blank";
//l.ImageUrl = Globals.GetSkinPath() + "/images/post_button_weblog.gif";
l.Attributes.Add("style", "background-image: url(" + Globals.GetSkinPath() + "/images/forum/weblog.gif)");
l.CssClass = this.CssClass;
l.NavigateUrl = this.User.Profile.WebLog;
l.Attributes.Add("title", String.Format(CommunityServer.Components.ResourceManager.GetString("User_AltWeblog"), poster.DisplayName));
l.Text = ResourceManager.GetString("Button_Weblog");
l.RenderControl(writer);
}
// User's web gallery
//
if ((poster.Profile.WebGallery != String.Empty) && (!reader.IsAnonymous))
{
writer.Write(" ");
l.Target = "_blank";
l.Attributes.Add("style", "background-image: url(" + Globals.GetSkinPath() + "/images/forum/webgallery.gif)");
l.CssClass = this.CssClass;
l.NavigateUrl = this.User.Profile.WebGallery;
l.Attributes.Add("title", String.Format(CommunityServer.Components.ResourceManager.GetString("User_AltWebGallery"), poster.DisplayName));
l.Text = ResourceManager.GetString("Button_WebGallery");
l.RenderControl(writer);
}
// Favorite users
//
if ((!reader.IsAnonymous) && (csContext.User.UserID != User.UserID))
{
writer.Write(" ");
ModalLink ml = new ModalLink();
ml.Url = SiteUrls.Instance().Favorite(ApplicationType.Unknown, FavoriteType.User, poster.UserID);
ml.Attributes.Add("style", "background-image: url(" + Globals.GetSkinPath() + "/images/forum/favoriteuser.gif)");
ml.CssClass = this.CssClass;
ml.Attributes.Add("title", String.Format(CommunityServer.Components.ResourceManager.GetString("User_AltFavoriteUser"), poster.DisplayName));
ml.Text = ResourceManager.GetString("Button_FavoriteUser");
ml.Width = 300;
ml.Height = 125;
ml.RenderControl(writer);
}
}
[
System.ComponentModel.DefaultValue("CommonImageTextButton")
]
public virtual String CssClass
{
get
{
Object state = ViewState["CssClass"];
if ( state != null )
{
return (String)state;
}
return "CommonImageTextButton";
}
set
{
ViewState["CssClass"] = value;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -