📄 sendtofriend.cs
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
// Copyright (c) Telligent Systems Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Web.UI.WebControls;
using CommunityServer.Components;
namespace CommunityServer.Galleries.Controls
{
public class SendToFriend : GalleryThemedControl
{
#region Child Controls
private TextBox From;
private TextBox To;
private TextBox Subject;
private TextBox Body;
private Button Submit;
#endregion
#region Skin
protected override void AttachChildControls()
{
From = (TextBox)FindControl( "SendToFriendFrom" );
To = (TextBox)FindControl( "SendToFriendTo" );
Subject = (TextBox)FindControl( "SendToFriendSubject" );
Body = (TextBox)FindControl( "SendToFriendBody" );
Submit = (Button)FindControl( "SendToFriendSubmit" );
InitializeChildControls();
}
private void InitializeChildControls()
{
Submit.Click += new EventHandler(Submit_Click);
}
#endregion
protected override void OnLoad(EventArgs e)
{
if(!Page.IsPostBack)
Submit.Text = ResourceManager.GetString( "Send" );
}
protected override void OnPreRender(EventArgs e)
{
Submit.Attributes.Add("onclick", "return SubmitSendToFriend('" + From.ClientID + "', '" + To.ClientID + "');");
}
private void Submit_Click(object sender, EventArgs e)
{
if((From.Text != "") && (To.Text != ""))
{
GalleryEmails.SendToFriend(CSContext.Current.ApplicationKey, CSContext.Current.CategoryID, CSContext.Current.PostID, To.Text, From.Text, Subject.Text, Body.Text);
From.Text = "";
To.Text = "";
Subject.Text = "";
Body.Text = "";
Page.RegisterStartupScript("AlertSuccess", "<script language='JavaScript'>alert('Message successfully sent!');</script>");
}
else
Page.RegisterStartupScript("AlertFailure", "<script language='JavaScript'>ToggleSendToFriend();document.getElementById('" + From.ClientID + "').focus();alert('Missing required fields.');</script>");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -