<commit_before>//*****************************************************************************************************
//  Original code by: DLESKTECH at http://www.dlesktech.com/support.aspx
//  Modifications by: KASL Technologies at www.kasltechnologies.com
//  Mod date:7/21/2009
//  Mods: working smileys, moved smilies to bottom, added clear button for admin, new stored procedure
//  Mods: fixed the time to show the viewers time not the server time
//  Mods: added small chat window popup that runs separately from forum
//  Note: flyout button opens smaller chat window
//  Note: clear button removes message more than 24hrs old from db
//*****************************************************************************************************
using System;
using System.Data;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using YAF.Classes;
using YAF.Classes.Core;
using YAF.Classes.Data;
using YAF.Classes.UI;
using YAF.Controls;

namespace YAF.Controls
{
	public partial class ShoutBox : BaseUserControl
	{
		public string CacheKey
		{
			get
			{
				return YafCache.GetBoardCacheKey( Constants.Cache.Shoutbox );
			}
		}

		public ShoutBox()
			: base()
		{

		}

		protected void Page_Load( object sender, EventArgs e )
		{
			YafContext.Current.PageElements.RegisterJsBlockStartup( shoutBoxUpdatePanel, "DisablePageManagerScrollJs", YAF.Utilities.JavaScriptBlocks.DisablePageManagerScrollJs );

			if ( PageContext.User != null )
			{
				//phShoutText.Visible = true;
				shoutBoxPanel.Visible = true;

				if ( PageContext.IsAdmin )
				{
					btnClear.Visible = true;
				}
			}

			if ( !IsPostBack )
			{
				btnFlyOut.Text = PageContext.Localization.GetText( "SHOUTBOX", "FLYOUT" );
				btnClear.Text = PageContext.Localization.GetText( "SHOUTBOX", "CLEAR" );
				btnButton.Text = PageContext.Localization.GetText( "SHOUTBOX", "SUBMIT" );

				FlyOutHolder.Visible = !YafControlSettings.Current.Popup;
				CollapsibleImageShoutBox.Visible = !YafControlSettings.Current.Popup;

				DataBind();
			}
		}

		protected void ShoutBoxRefreshTimer_Tick( object sender, EventArgs e )
		{
			DataBind();
		}
	
		protected void btnButton_Click( object sender, EventArgs e )
		{
			string username = PageContext.PageUserName;

			if ( username != null && messageTextBox.Text != String.Empty )
			{
				DB.shoutbox_savemessage( messageTextBox.Text, username, PageContext.PageUserID, Request.UserHostAddress );
				// clear cache...
				PageContext.Cache.Remove( CacheKey );
			}

			DataBind();
			messageTextBox.Text = String.Empty;
			ScriptManager scriptManager = ScriptManager.GetCurrent( Page );

			if ( scriptManager != null )<commit_msg>Shoutbox now defaults to the text message box when you load the page/click enter.<commit_after>//*****************************************************************************************************
//  Original code by: DLESKTECH at http://www.dlesktech.com/support.aspx
//  Modifications by: KASL Technologies at www.kasltechnologies.com
//  Mod date:7/21/2009
//  Mods: working smileys, moved smilies to bottom, added clear button for admin, new stored procedure
//  Mods: fixed the time to show the viewers time not the server time
//  Mods: added small chat window popup that runs separately from forum
//  Note: flyout button opens smaller chat window
//  Note: clear button removes message more than 24hrs old from db
//*****************************************************************************************************
using System;
using System.Data;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using YAF.Classes;
using YAF.Classes.Core;
using YAF.Classes.Data;
using YAF.Classes.UI;
using YAF.Controls;

namespace YAF.Controls
{
	public partial class ShoutBox : BaseUserControl
	{
		public string CacheKey
		{
			get
			{
				return YafCache.GetBoardCacheKey( Constants.Cache.Shoutbox );
			}
		}

		public ShoutBox()
			: base()
		{

		}

		protected void Page_Load( object sender, EventArgs e )
		{
			YafContext.Current.PageElements.RegisterJsBlockStartup( shoutBoxUpdatePanel, "DisablePageManagerScrollJs", YAF.Utilities.JavaScriptBlocks.DisablePageManagerScrollJs );

			if ( PageContext.User != null )
			{
				//phShoutText.Visible = true;
				shoutBoxPanel.Visible = true;

				if ( PageContext.IsAdmin )
				{
					btnClear.Visible = true;
				}
			}

			if ( !IsPostBack )
			{
				btnFlyOut.Text = PageContext.Localization.GetText( "SHOUTBOX", "FLYOUT" );
				btnClear.Text = PageContext.Localization.GetText( "SHOUTBOX", "CLEAR" );
				btnButton.Text = PageContext.Localization.GetText( "SHOUTBOX", "SUBMIT" );

				FlyOutHolder.Visible = !YafControlSettings.Current.Popup;
				CollapsibleImageShoutBox.Visible = !YafControlSettings.Current.Popup;

				DataBind();
			}

			if ( shoutBoxPanel.Visible )
			{
				// set the focus to default to the shoutbox message text box...
				if ( String.IsNullOrEmpty( Page.Form.DefaultFocus ) )
					Page.Form.DefaultFocus = messageTextBox.ClientID;
			}
		}

		protected void ShoutBoxRefreshTimer_Tick( object sender, EventArgs e )
		{
			DataBind();
		}
	
		protected void btnButton_Click( object sender, EventArgs e )
		{
			string username = PageContext.PageUserName;

			if ( username != null && messageTextBox.Text != String.Empty )
			{
				DB.shoutbox_savemessage( messageTextBox.Text, username, PageContext.PageUserID, Request.UserHostAddress );
				// clear cache...
				PageContext.Cache.Remove( CacheKey );
			}

			DataBind();
			messageTextBox.Text = String.Empty;
			ScriptManager scriptManager = ScriptManager.GetCurrent( Page );

			if ( scriptManager != null )
{'fraction_non_alphanumeric': 0.16454802259887005, 'fraction_numerical': 0.0031779661016949155, 'mean_word_length': 3.943280977312391, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '8733', 'n_tokens_mistral': 1920, 'n_tokens_neox': 1625, 'n_words': 415}